From cf07aa6803a70f52f6a178219097e9f9e6ee1a51 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Sun, 21 Jun 2015 16:45:01 -0500 Subject: [svn-r27261] apply metadata enhancement patch that was based on the mdc 3 branch. --- src/H5A.c | 178 +++++---- src/H5AC.c | 76 +++- src/H5ACprivate.h | 3 + src/H5C.c | 975 ++++++++++++++++++++++++++++++++++++++++++++++---- src/H5Cpkg.h | 269 +++++++++++++- src/H5Cprivate.h | 6 + src/H5D.c | 41 +-- src/H5Dchunk.c | 22 ++ src/H5Ddeprec.c | 3 +- src/H5F.c | 30 +- src/H5FDmpio.c | 81 ++--- src/H5Fint.c | 8 + src/H5Fmpi.c | 29 ++ src/H5Fpkg.h | 3 + src/H5Fprivate.h | 1 + src/H5G.c | 67 ++-- src/H5L.c | 164 +++++---- src/H5Lexternal.c | 7 +- src/H5O.c | 95 ++--- src/H5Pdxpl.c | 14 + src/H5Pencdec.c | 2 +- src/H5Pfapl.c | 177 +++++++++ src/H5Pint.c | 72 +++- src/H5Plapl.c | 16 +- src/H5Ppkg.h | 2 + src/H5Pprivate.h | 11 + src/H5Ppublic.h | 8 + src/H5Tcommit.c | 35 +- src/Makefile.in | 2 +- testpar/t_cache.c | 311 +++++++++++++++- testpar/t_mdset.c | 1 + testpar/t_shapesame.c | 2 + testpar/testphdf5.c | 2 + 33 files changed, 2304 insertions(+), 409 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index 4afdefe..888993b 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -229,12 +229,13 @@ H5A_term_interface(void) /* ARGSUSED */ hid_t H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, - hid_t acpl_id, hid_t H5_ATTR_UNUSED aapl_id) + hid_t acpl_id, hid_t aapl_id) { H5A_t *attr = NULL; /* Attribute created */ H5G_loc_t loc; /* Object location */ H5T_t *type; /* Datatype to use for attribute */ H5S_t *space; /* Dataspace to use for attribute */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -254,8 +255,13 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") - /* Go do the real work for attaching the attribute to the dataset */ - if(NULL == (attr = H5A_create(&loc, attr_name, type, space, acpl_id, H5AC_dxpl_id))) + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&aapl_id, H5P_ATTRIBUTE_ACCESS, H5P_ATTRIBUTE_ACCESS_DEFAULT, + &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + + /* Go do the real work for attaching the attribute to the object */ + if(NULL == (attr = H5A_create(&loc, attr_name, type, space, acpl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute") /* Register the new attribute and get an ID for it */ @@ -304,7 +310,7 @@ done: /* ARGSUSED */ hid_t H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, - hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t H5_ATTR_UNUSED aapl_id, + hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t lapl_id) { H5A_t *attr = NULL; /* Attribute created */ @@ -315,6 +321,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ H5T_t *type; /* Datatype to use for attribute */ H5S_t *space; /* Dataspace to use for attribute */ + hid_t dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -342,13 +349,25 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, obj_loc.path = &obj_path; H5G_loc_reset(&obj_loc); + dxpl_id = H5AC_ind_dxpl_id; + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&aapl_id, H5P_ATTRIBUTE_ACCESS, H5P_ATTRIBUTE_ACCESS_DEFAULT, + &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; + dxpl_id = H5AC_dxpl_id; + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&aapl_id, H5P_ATTRIBUTE_ACCESS, H5P_ATTRIBUTE_ACCESS_DEFAULT, + &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Go do the real work for attaching the attribute to the dataset */ - if(NULL == (attr = H5A_create(&obj_loc, attr_name, type, space, acpl_id, H5AC_dxpl_id))) + if(NULL == (attr = H5A_create(&obj_loc, attr_name, type, space, acpl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute") /* Register the new attribute and get an ID for it */ @@ -385,10 +404,11 @@ done: H5Aclose or resource leaks will develop. --------------------------------------------------------------------------*/ hid_t -H5Aopen(hid_t loc_id, const char *attr_name, hid_t H5_ATTR_UNUSED aapl_id) +H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -402,8 +422,13 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t H5_ATTR_UNUSED aapl_id) if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&aapl_id, H5P_ATTRIBUTE_ACCESS, H5P_ATTRIBUTE_ACCESS_DEFAULT, + &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Read in attribute from object header */ - if(NULL == (attr = H5O_attr_open_by_name(loc.oloc, attr_name, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5O_attr_open_by_name(loc.oloc, attr_name, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to load attribute info from object header for attribute: '%s'", attr_name) /* Finish initializing attribute */ @@ -447,10 +472,11 @@ done: --------------------------------------------------------------------------*/ hid_t H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, - hid_t H5_ATTR_UNUSED aapl_id, hid_t lapl_id) + hid_t aapl_id, hid_t lapl_id) { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -471,8 +497,13 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&aapl_id, H5P_ATTRIBUTE_ACCESS, H5P_ATTRIBUTE_ACCESS_DEFAULT, + &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Open the attribute on the object header */ - if(NULL == (attr = H5A_open_by_name(&loc, obj_name, attr_name, lapl_id, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5A_open_by_name(&loc, obj_name, attr_name, lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") /* Register the attribute and get an ID for it */ @@ -515,10 +546,11 @@ done: --------------------------------------------------------------------------*/ hid_t H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t n, hid_t H5_ATTR_UNUSED aapl_id, hid_t lapl_id) + H5_iter_order_t order, hsize_t n, hid_t aapl_id, hid_t lapl_id) { H5A_t *attr = NULL; /* Attribute opened */ H5G_loc_t loc; /* Object location */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -542,8 +574,13 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&aapl_id, H5P_ATTRIBUTE_ACCESS, H5P_ATTRIBUTE_ACCESS_DEFAULT, + &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Open the attribute in the object header */ - if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open attribute") /* Register the attribute and get an ID for it */ @@ -831,6 +868,7 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute object for name */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -848,14 +886,13 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ - if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") /* Get the length of the name */ @@ -969,6 +1006,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute object for name */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -985,14 +1023,13 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") if(NULL == ainfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ - if(NULL == (attr = H5A_open_by_name(&loc, obj_name, attr_name, lapl_id, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5A_open_by_name(&loc, obj_name, attr_name, lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") /* Get the attribute information */ @@ -1028,6 +1065,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute object for name */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1047,14 +1085,13 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(NULL == ainfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ - if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") /* Get the attribute information */ @@ -1131,6 +1168,7 @@ herr_t H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, const char *new_attr_name, hid_t lapl_id) { + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by the library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1146,11 +1184,10 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no old attribute name") if(!new_attr_name || !*new_attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new attribute name") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Avoid thrashing things if the names are the same */ if(HDstrcmp(old_attr_name, new_attr_name)) { @@ -1160,7 +1197,7 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Call private attribute rename routine */ - if(H5A_rename_by_name(loc, obj_name, old_attr_name, new_attr_name, lapl_id, H5AC_dxpl_id) < 0) + if(H5A_rename_by_name(loc, obj_name, old_attr_name, new_attr_name, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") } /* end if */ @@ -1305,6 +1342,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5A_attr_iter_op_t attr_op; /* Attribute operator */ hsize_t start_idx; /* Index of attribute to start iterating at */ hsize_t last_attr; /* Index of last attribute examined */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1322,11 +1360,10 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1334,12 +1371,12 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5G_loc_reset(&obj_loc); /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; /* Open the object */ - if((obj_loc_id = H5O_open_by_loc(&obj_loc, lapl_id, H5AC_ind_dxpl_id, TRUE)) < 0) + if((obj_loc_id = H5O_open_by_loc(&obj_loc, lapl_id, dxpl_id, TRUE)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open object") /* Build attribute operator info */ @@ -1348,7 +1385,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Call attribute iteration routine */ last_attr = start_idx = (idx ? *idx : 0); - if((ret_value = H5O_attr_iterate(obj_loc_id, H5AC_ind_dxpl_id, idx_type, order, start_idx, &last_attr, &attr_op, op_data)) < 0) + if((ret_value = H5O_attr_iterate(obj_loc_id, dxpl_id, idx_type, order, start_idx, &last_attr, &attr_op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); /* Set the last attribute information */ @@ -1433,6 +1470,7 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ + hid_t dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1447,11 +1485,11 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + dxpl_id = H5AC_ind_dxpl_id; + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1459,12 +1497,17 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5G_loc_reset(&obj_loc); /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; + dxpl_id = H5AC_dxpl_id; + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Delete the attribute from the location */ - if(H5O_attr_remove(obj_loc.oloc, attr_name, H5AC_dxpl_id) < 0) + if(H5O_attr_remove(obj_loc.oloc, attr_name, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1509,6 +1552,7 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ + hid_t dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1525,11 +1569,11 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + dxpl_id = H5AC_ind_dxpl_id; + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1537,12 +1581,17 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5G_loc_reset(&obj_loc); /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; + dxpl_id = H5AC_dxpl_id; + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Delete the attribute from the location */ - if(H5O_attr_remove_by_idx(obj_loc.oloc, idx_type, order, n, H5AC_dxpl_id) < 0) + if(H5O_attr_remove_by_idx(obj_loc.oloc, idx_type, order, n, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1648,6 +1697,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t lapl_id) { H5G_loc_t loc; /* Object location */ + hid_t dxpl_id; /* dxpl used by library */ htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1662,13 +1712,13 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") - if((ret_value = H5A_exists_by_name(loc, obj_name, attr_name, lapl_id, H5AC_ind_dxpl_id)) < 0) + dxpl_id = H5AC_ind_dxpl_id; + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + + if((ret_value = H5A_exists_by_name(loc, obj_name, attr_name, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: diff --git a/src/H5AC.c b/src/H5AC.c index c6b0b47..446e58c 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -149,16 +149,17 @@ static herr_t H5AC__run_sync_point(H5F_t *f, hid_t dxpl_id, int sync_point_op); /*****************************/ /* Default dataset transfer property list for metadata I/O calls */ -/* (Collective set, "block before metadata write" set and "library internal" set) */ +/* (Collective set) */ /* (Global variable definition, declaration is in H5ACprivate.h also) */ hid_t H5AC_dxpl_id = (-1); /* Dataset transfer property list for independent metadata I/O calls */ -/* (just "library internal" set - i.e. independent transfer mode) */ /* (Global variable definition, declaration is in H5ACprivate.h also) */ H5P_genplist_t *H5AC_ind_dxpl_g = NULL; hid_t H5AC_ind_dxpl_id = (-1); +hid_t H5AC_coll_write_coll_read_dxpl_id=(-1); +hid_t H5AC_ind_write_coll_read_dxpl_id=(-1); /*******************/ /* Local Variables */ @@ -251,6 +252,7 @@ H5AC_init_interface(void) #ifdef H5_HAVE_PARALLEL H5P_genplist_t *xfer_plist; /* Dataset transfer property list object */ unsigned coll_meta_write; /* "collective metadata write" property value */ + H5P_coll_md_read_flag_t coll_meta_read; #endif /* H5_HAVE_PARALLEL */ herr_t ret_value = SUCCEED; /* Return value */ @@ -267,6 +269,7 @@ H5AC_init_interface(void) /* Get the property list object */ if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_dxpl_id))) HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") + HDassert(xfer_plist); /* Insert 'collective metadata write' property */ coll_meta_write = 1; @@ -287,12 +290,53 @@ H5AC_init_interface(void) if(H5P_insert(H5AC_ind_dxpl_g, H5AC_COLLECTIVE_META_WRITE_NAME, H5AC_COLLECTIVE_META_WRITE_SIZE, &coll_meta_write, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") + + /* Get an ID for H5AC_coll_write_coll_read_dxpl_id */ + if((H5AC_coll_write_coll_read_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") + + /* Get the property list object */ + if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_coll_write_coll_read_dxpl_id))) + HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") + + /* Insert 'collective metadata write' property */ + coll_meta_write = 1; + if(H5P_insert(xfer_plist, H5AC_COLLECTIVE_META_WRITE_NAME, H5AC_COLLECTIVE_META_WRITE_SIZE, &coll_meta_write, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") + + /* set 'collective metadata read' property */ + coll_meta_read = H5P_USER_TRUE; + if(H5P_set(xfer_plist, H5_COLL_MD_READ_FLAG_NAME, &coll_meta_read) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set collective metadata read flag") + + + /* Get an ID for H5AC_ind_write_coll_read_dxpl_id */ + if((H5AC_ind_write_coll_read_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") + + /* Get the property list object */ + if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_ind_write_coll_read_dxpl_id))) + HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") + + /* Insert 'collective metadata write' property */ + coll_meta_write = 0; + if(H5P_insert(xfer_plist, H5AC_COLLECTIVE_META_WRITE_NAME, H5AC_COLLECTIVE_META_WRITE_SIZE, &coll_meta_write, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") + /* set 'collective metadata read' property */ + coll_meta_read = H5P_USER_TRUE; + if(H5P_set(xfer_plist, H5_COLL_MD_READ_FLAG_NAME, &coll_meta_read) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set collective metadata read flag") + #else /* H5_HAVE_PARALLEL */ /* Sanity check */ HDassert(H5P_LST_DATASET_XFER_ID_g!=(-1)); H5AC_dxpl_id = H5P_DATASET_XFER_DEFAULT; H5AC_ind_dxpl_id = H5P_DATASET_XFER_DEFAULT; + H5AC_coll_write_coll_read_dxpl_id = H5P_DATASET_XFER_DEFAULT; + H5AC_ind_write_coll_read_dxpl_id = H5P_DATASET_XFER_DEFAULT; /* Get the property list objects for the IDs */ if(NULL == (H5AC_ind_dxpl_g = (H5P_genplist_t *)H5I_object(H5AC_ind_dxpl_id))) @@ -328,17 +372,23 @@ H5AC_term_interface(void) if(H5_interface_initialize_g) { #ifdef H5_HAVE_PARALLEL - if(H5AC_dxpl_id > 0 || H5AC_ind_dxpl_id > 0) { + if(H5AC_dxpl_id > 0 || H5AC_ind_dxpl_id > 0 || + H5AC_coll_write_coll_read_dxpl_id > 0 || + H5AC_ind_write_coll_read_dxpl_id > 0) { /* Indicate more work to do */ n = 1; /* H5I */ /* Close H5AC dxpl */ - if(H5I_dec_ref(H5AC_dxpl_id) < 0 || H5I_dec_ref(H5AC_ind_dxpl_id) < 0) + if(H5I_dec_ref(H5AC_dxpl_id) < 0 || H5I_dec_ref(H5AC_ind_dxpl_id) < 0 || + H5I_dec_ref(H5AC_coll_write_coll_read_dxpl_id) < 0 || + H5I_dec_ref(H5AC_ind_write_coll_read_dxpl_id) < 0) H5E_clear_stack(NULL); /*ignore error*/ else { /* Reset static IDs */ H5AC_dxpl_id = (-1); H5AC_ind_dxpl_id = (-1); + H5AC_coll_write_coll_read_dxpl_id = (-1); + H5AC_ind_write_coll_read_dxpl_id = (-1); /* Reset interface initialization flag */ H5_interface_initialize_g = 0; @@ -351,6 +401,8 @@ H5AC_term_interface(void) H5AC_ind_dxpl_id = (-1); #ifdef H5_HAVE_PARALLEL } /* end else */ + H5AC_coll_write_coll_read_dxpl_id = (-1); + H5AC_ind_write_coll_read_dxpl_id = (-1); #endif /* H5_HAVE_PARALLEL */ /* Reset interface initialization flag */ @@ -564,6 +616,10 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id) #endif /* H5AC__TRACE_FILE_ENABLED */ #ifdef H5_HAVE_PARALLEL + /* destroying the cache, so clear all collective entries */ + if(H5C_clear_coll_entries(f, dxpl_id, f->shared->cache, 0) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") + aux_ptr = (struct H5AC_aux_t *)(f->shared->cache->aux_ptr); if(aux_ptr) /* Sanity check */ @@ -702,6 +758,10 @@ H5AC_flush(H5F_t *f, hid_t dxpl_id) #endif /* H5AC__TRACE_FILE_ENABLED */ #ifdef H5_HAVE_PARALLEL + /* flushing the cache, so clear all collective entries */ + if(H5C_clear_coll_entries(f, dxpl_id, f->shared->cache, 0) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") + /* Attempt to flush all entries from rank 0 & Bcast clean list to other ranks */ if(H5AC__flush_entries(f, dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush.") @@ -4276,6 +4336,14 @@ HDfprintf(stdout, "%d:H5AC_propagate...:%u: (u/uu/i/iu/r/ru) = %zu/%u/%zu/%u/%zu aux_ptr->rename_dirty_bytes_updates); #endif /* H5AC_DEBUG_DIRTY_BYTES_CREATION */ + /* clear collective access flag on half of the entries in the + cache and mark them as independent in case they need to be + evicted later. All ranks are guranteed to mark the same entires + since we don't modify the order of the collectively accessed + entries except through collective access. */ + if(H5C_clear_coll_entries(f, dxpl_id, cache_ptr, TRUE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") + switch(aux_ptr->metadata_write_strategy) { case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY: switch(sync_point_op) { diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 584ce9d..7a5a4d9 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -196,6 +196,9 @@ extern hid_t H5AC_dxpl_id; H5_DLLVAR H5P_genplist_t *H5AC_ind_dxpl_g; H5_DLLVAR hid_t H5AC_ind_dxpl_id; +H5_DLLVAR hid_t H5AC_coll_write_coll_read_dxpl_id; +H5_DLLVAR hid_t H5AC_ind_write_coll_read_dxpl_id; + /* Default cache configuration. */ diff --git a/src/H5C.c b/src/H5C.c index fc4e8a5..05b4299 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -109,6 +109,19 @@ H5FL_DEFINE_STATIC(H5C_t); +#ifdef H5_HAVE_PARALLEL +typedef struct H5C_collective_write_t { + size_t length; + hbool_t free_buf; + void *buf; + haddr_t offset; +} H5C_collective_write_t; +static herr_t H5C_collective_write(H5F_t *f, + hid_t dxpl_id, + H5SL_t *collective_write_list); +static herr_t H5C_collective_write_free(void *_item, void *key, void *op_data); +#endif /* H5_HAVE_PARALLEL */ + /* * Private file-scope function declarations: */ @@ -144,8 +157,9 @@ static herr_t H5C_flush_single_entry(const H5F_t * f, hid_t dxpl_id, haddr_t addr, unsigned flags, - hbool_t del_entry_from_slist_on_destroy, - int64_t *entry_size_change_ptr); + hbool_t del_entry_from_slist_on_destroy, + int64_t *entry_size_change_ptr, + H5SL_t * collective_write_list); static herr_t H5C_flush_invalidate_cache(const H5F_t * f, hid_t dxpl_id, @@ -153,6 +167,9 @@ static herr_t H5C_flush_invalidate_cache(const H5F_t * f, static void * H5C_load_entry(H5F_t * f, hid_t dxpl_id, +#ifdef H5_HAVE_PARALLEL + hbool_t coll_access, +#endif /* H5_HAVE_PARALLEL */ const H5C_class_t * type, haddr_t addr, void * udata); @@ -178,6 +195,9 @@ static herr_t H5C_flush_marked_entries(H5F_t * f, hid_t dxpl_id, H5C_t * cache_ptr); +static herr_t H5C__generate_image(H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr, + hid_t dxpl_id, int64_t *entry_size_change_ptr); + #if H5C_DO_TAGGING_SANITY_CHECKS static herr_t H5C_verify_tag(int id, haddr_t tag); #endif @@ -529,6 +549,7 @@ H5C_apply_candidate_list(H5F_t * f, H5C_cache_entry_t * entry_ptr = NULL; H5C_cache_entry_t * flush_ptr = NULL; H5C_cache_entry_t * delayed_ptr = NULL; + H5SL_t * collective_write_list = NULL; #if H5C_DO_SANITY_CHECKS haddr_t last_addr; #endif /* H5C_DO_SANITY_CHECKS */ @@ -561,6 +582,10 @@ H5C_apply_candidate_list(H5F_t * f, HDfprintf(stdout, "%s", tbl_buf); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ + /* Create skip list of entries for collective write */ + if(NULL == (collective_write_list = H5SL_create(H5SL_TYPE_HADDR, NULL))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create skip list for entries") + n = num_candidates / mpi_size; m = num_candidates % mpi_size; HDassert(n >= 0); @@ -665,6 +690,17 @@ H5C_apply_candidate_list(H5F_t * f, entries_to_clear++; entry_ptr->clear_on_unprotect = TRUE; } /* end else */ + + /* Entries marked as collectively accessed and are in the + candidate list to clear from the cache have to be + removed from the coll list. This is OK since the + candidate list is collective and uniform across all + ranks. */ + if(TRUE == entry_ptr->coll_access) { + entry_ptr->coll_access = FALSE; + cache_ptr->num_coll_entries --; + H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) + } } /* end else */ } /* end for */ @@ -746,6 +782,7 @@ H5C_apply_candidate_list(H5F_t * f, clear_ptr->addr, H5C__FLUSH_CLEAR_ONLY_FLAG, TRUE, + NULL, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") } /* end if */ @@ -796,7 +833,8 @@ H5C_apply_candidate_list(H5F_t * f, flush_ptr->addr, H5C__NO_FLAGS_SET, TRUE, - NULL) < 0) + NULL, + collective_write_list) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't flush entry.") if ( ( cache_ptr->entries_removed_counter > 1 ) || @@ -956,11 +994,12 @@ H5C_apply_candidate_list(H5F_t * f, #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ if(H5C_flush_single_entry(f, - dxpl_id, - clear_ptr->addr, - H5C__FLUSH_CLEAR_ONLY_FLAG, - TRUE, - NULL) < 0) + dxpl_id, + clear_ptr->addr, + H5C__FLUSH_CLEAR_ONLY_FLAG, + TRUE, + NULL, + NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") } /* end else-if */ @@ -977,11 +1016,12 @@ H5C_apply_candidate_list(H5F_t * f, #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ if(H5C_flush_single_entry(f, - dxpl_id, - flush_ptr->addr, - H5C__NO_FLAGS_SET, - TRUE, - NULL) < 0) + dxpl_id, + flush_ptr->addr, + H5C__NO_FLAGS_SET, + TRUE, + NULL, + collective_write_list) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") } /* end else-if */ } /* end if */ @@ -1015,26 +1055,41 @@ H5C_apply_candidate_list(H5F_t * f, if (delayed_ptr) { if (delayed_ptr->clear_on_unprotect) { + if(H5C_flush_single_entry(f, + dxpl_id, + delayed_ptr->addr, + H5C__FLUSH_CLEAR_ONLY_FLAG, + TRUE, + NULL, + NULL) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, + "Can't flush entry collectively.") entry_ptr->clear_on_unprotect = FALSE; entries_cleared++; } else if (delayed_ptr->flush_immediately) { + if(H5C_flush_single_entry(f, + dxpl_id, + delayed_ptr->addr, + H5C__NO_FLAGS_SET, + TRUE, + NULL, + collective_write_list) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, + "Can't flush entry collectively.") entry_ptr->flush_immediately = FALSE; entries_flushed++; } /* end if */ - if(H5C_flush_single_entry(f, - dxpl_id, - delayed_ptr->addr, - H5C__NO_FLAGS_SET, - TRUE, - NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, - "Can't flush entry collectively.") - entries_flushed_collectively++; entries_flushed_or_cleared_last++; } /* end if */ + /* Write collective list */ + if(H5C_collective_write(f, + dxpl_id, + collective_write_list) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't write metadata collectively") + /* ====================================================================== * * Finished flushing everything. * * ====================================================================== */ @@ -1054,6 +1109,10 @@ done: if(candidate_assignment_table != NULL) candidate_assignment_table = (int *)H5MM_xfree((void *)candidate_assignment_table); + if(collective_write_list) + if(H5SL_destroy(collective_write_list, H5C_collective_write_free, NULL) < 0) + HDONE_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "failed to destroy skip list") + FUNC_LEAVE_NOAPI(ret_value) } /* H5C_apply_candidate_list() */ #endif /* H5_HAVE_PARALLEL */ @@ -1396,6 +1455,14 @@ H5C_create(size_t max_cache_size, cache_ptr->LRU_head_ptr = NULL; cache_ptr->LRU_tail_ptr = NULL; +#ifdef H5_HAVE_PARALLEL + cache_ptr->coll_list_len = 0; + cache_ptr->coll_list_size = (size_t)0; + cache_ptr->coll_head_ptr = NULL; + cache_ptr->coll_tail_ptr = NULL; + cache_ptr->num_coll_entries = 0; +#endif /* H5_HAVE_PARALLEL */ + cache_ptr->cLRU_list_len = 0; cache_ptr->cLRU_list_size = (size_t)0; cache_ptr->cLRU_head_ptr = NULL; @@ -1831,7 +1898,7 @@ H5C_expunge_entry(H5F_t *f, hid_t dxpl_id, const H5C_class_t *type, entry_size = entry_ptr->size; #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ - if(H5C_flush_single_entry(f, dxpl_id, entry_ptr->addr, flush_flags, TRUE, NULL) < 0) + if(H5C_flush_single_entry(f, dxpl_id, entry_ptr->addr, flush_flags, TRUE, NULL, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "H5C_flush_single_entry() failed.") #if H5C_DO_SANITY_CHECKS @@ -2157,11 +2224,12 @@ H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags) entry_size_change = 0; #endif /* H5C_DO_SANITY_CHECKS */ status = H5C_flush_single_entry(f, - dxpl_id, - entry_ptr->addr, - flags, - FALSE, - entry_size_change_ptr); + dxpl_id, + entry_ptr->addr, + flags, + FALSE, + entry_size_change_ptr, + NULL); if ( status < 0 ) { /* This shouldn't happen -- if it does, @@ -2217,11 +2285,12 @@ H5C_flush_cache(H5F_t *f, hid_t dxpl_id, unsigned flags) entry_size_change = 0; #endif /* H5C_DO_SANITY_CHECKS */ status = H5C_flush_single_entry(f, - dxpl_id, - entry_ptr->addr, - flags, - FALSE, - entry_size_change_ptr); + dxpl_id, + entry_ptr->addr, + flags, + FALSE, + entry_size_change_ptr, + NULL); if ( status < 0 ) { /* This shouldn't happen -- if it does, @@ -2915,7 +2984,9 @@ H5C_insert_entry(H5F_t * f, hbool_t insert_pinned; hbool_t flush_last; #ifdef H5_HAVE_PARALLEL + hbool_t coll_access = FALSE; /* whether access to the cache entry is done collectively */ hbool_t flush_collectively; + H5P_genplist_t * dxpl; /* dataset transfer property list */ #endif /* H5_HAVE_PARALLEL */ hbool_t set_flush_marker; hbool_t write_permitted = TRUE; @@ -3050,6 +3121,9 @@ H5C_insert_entry(H5F_t * f, entry_ptr->aux_next = NULL; entry_ptr->aux_prev = NULL; + entry_ptr->coll_next = NULL; + entry_ptr->coll_prev = NULL; + H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) if ( ( cache_ptr->flash_size_increase_possible ) && @@ -3180,6 +3254,50 @@ H5C_insert_entry(H5F_t * f, H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) +#ifdef H5_HAVE_PARALLEL + /* Get the dataset transfer property list */ + if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list"); + + if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { + coll_access = (H5P_USER_TRUE == f->coll_md_read ? TRUE : FALSE); + + if(!coll_access && H5P_FORCE_FALSE != f->coll_md_read) { + H5P_coll_md_read_flag_t prop_value; + + /* get the property value */ + if(H5P_get(dxpl, H5_COLL_MD_READ_FLAG_NAME, &prop_value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't get collective metadata access flag") + + coll_access = (H5P_USER_TRUE == prop_value ? TRUE : FALSE); + } + //fprintf(stderr, "COLLACCESS = %d.. FILE property = %d\n", coll_access, f->coll_md_read); + } + + entry_ptr->coll_access = coll_access; + if(coll_access) { + //fprintf(stderr, "NEW (%llu, %s)\n", addr, entry_ptr->type->name); + cache_ptr->num_coll_entries ++; + H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, FAIL) + + /* Make sure the size of the collective entries in the cache remain in check */ + if(H5P_USER_TRUE == f->coll_md_read) { + if(cache_ptr->max_cache_size*0.8 < cache_ptr->coll_list_size) { + if(H5C_clear_coll_entries(f, dxpl_id, cache_ptr, 1) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") + } + } + else { + if(cache_ptr->max_cache_size*0.4 < cache_ptr->coll_list_size) { + if(H5C_clear_coll_entries(f, dxpl_id, cache_ptr, 1) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") + } + } + + } + entry_ptr->ind_access_while_coll = FALSE; +#endif + done: #if H5C_DO_EXTREME_SANITY_CHECKS @@ -3359,6 +3477,12 @@ H5C_mark_entries_as_clean(H5F_t * f, * scan the LRU list shortly, and clear all those entries * not currently protected. */ + if(TRUE == entry_ptr->coll_access) { + entry_ptr->coll_access = FALSE; + cache_ptr->num_coll_entries --; + H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) + } + entry_ptr->clear_on_unprotect = TRUE; #if H5C_DO_SANITY_CHECKS if ( entry_ptr->is_protected ) { @@ -3424,6 +3548,7 @@ H5C_mark_entries_as_clean(H5F_t * f, clear_ptr->addr, H5C__FLUSH_CLEAR_ONLY_FLAG, TRUE, + NULL, NULL) < 0 ) { HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") @@ -3459,6 +3584,7 @@ H5C_mark_entries_as_clean(H5F_t * f, clear_ptr->addr, H5C__FLUSH_CLEAR_ONLY_FLAG, TRUE, + NULL, NULL) < 0 ) { HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") @@ -3853,6 +3979,14 @@ H5C_resize_entry(void *thing, size_t new_size) (entry_ptr->size), (new_size)) } /* end if */ +#ifdef H5_HAVE_PARALLEL + if(entry_ptr->coll_access) { + H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr->coll_list_len), \ + (cache_ptr->coll_list_size), \ + (entry_ptr->size), (new_size)) + } /* end if */ +#endif /* H5_HAVE_PARALLEL */ + /* update the hash table */ H5C__UPDATE_INDEX_FOR_SIZE_CHANGE((cache_ptr), (entry_ptr->size),\ (new_size), (entry_ptr), (was_clean)); @@ -4080,14 +4214,15 @@ H5C_protect(H5F_t * f, hbool_t flush_last; #ifdef H5_HAVE_PARALLEL hbool_t flush_collectively; + hbool_t coll_access = FALSE; /* whether access to the cache entry is done collectively */ #endif /* H5_HAVE_PARALLEL */ hbool_t write_permitted; herr_t result; size_t empty_space; void * thing; H5C_cache_entry_t * entry_ptr; - haddr_t tag = HADDR_UNDEF; - H5P_genplist_t *dxpl; /* dataset transfer property list */ + haddr_t tag = HADDR_UNDEF; + H5P_genplist_t * dxpl; /* dataset transfer property list */ void * ret_value; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -4108,7 +4243,7 @@ H5C_protect(H5F_t * f, ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, \ "an extreme sanity check failed on entry.\n"); } #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -4119,15 +4254,101 @@ H5C_protect(H5F_t * f, flush_collectively = ( (flags & H5C__FLUSH_COLLECTIVELY_FLAG) != 0 ); #endif /* H5_HAVE_PARALLEL */ + /* Get the dataset transfer property list */ + if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list"); + +#ifdef H5_HAVE_PARALLEL + if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { + coll_access = (H5P_USER_TRUE == f->coll_md_read ? TRUE : FALSE); + + if(!coll_access && H5P_FORCE_FALSE != f->coll_md_read) { + H5P_coll_md_read_flag_t prop_value; + + /* get the property value */ + if(H5P_get(dxpl, H5_COLL_MD_READ_FLAG_NAME, &prop_value) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "Can't get collective metadata access flag") + + coll_access = (H5P_USER_TRUE == prop_value ? TRUE : FALSE); + } + //fprintf(stderr, "COLLACCESS = %d.. FILE property = %d\n", coll_access, f->coll_md_read); + } +#endif /* H5_HAVE_PARALLEL */ + /* first check to see if the target is in cache */ H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, NULL) if ( entry_ptr != NULL ) { - /* Check for trying to load the wrong type of entry from an address */ if(entry_ptr->type != type) HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, NULL, "incorrect cache entry type") + /* if this is a collective metadata read, the entry is not + marked as collective, and is clean, it is possible that + other processes will not have it in its cache and will + expect a bcast of the entry from process 0. So process 0 + will bcast the entry to all other ranks. Ranks that do have + the entry in their cache still have to participate in the + bcast. */ +#ifdef H5_HAVE_PARALLEL + if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && coll_access && + !(entry_ptr->is_dirty) && !(entry_ptr->coll_access)) { + MPI_Comm comm; /* File MPI Communicator */ + int mpi_code; /* MPI error code */ + int buf_size; + + if((comm = H5F_mpi_get_comm(f)) == MPI_COMM_NULL) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "get_comm request failed") + + if(entry_ptr->image_ptr == NULL) { + int mpi_rank; + size_t image_size; + + if((mpi_rank = H5F_mpi_get_rank(f)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank") + + if ( entry_ptr->compressed ) + image_size = entry_ptr->compressed_size; + else + image_size = entry_ptr->size; + + HDassert(image_size > 0); + + entry_ptr->image_ptr = H5MM_malloc(image_size + H5C_IMAGE_EXTRA_SPACE); + + if (NULL == entry_ptr->image_ptr) { + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, \ + "memory allocation failed for on disk image buffer") + } +#if H5C_DO_MEMORY_SANITY_CHECKS + HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + image_size, + H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); +#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ + if(0 == mpi_rank) { + if(H5C__generate_image(f, cache_ptr, entry_ptr, dxpl_id, NULL) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "Can't get Image") + } + } + + HDassert(entry_ptr->image_ptr); + + H5_CHECKED_ASSIGN(buf_size, int, entry_ptr->size, size_t); + if(MPI_SUCCESS != (mpi_code = MPI_Bcast(entry_ptr->image_ptr, buf_size, + MPI_BYTE, 0, comm))) + HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) + + entry_ptr->coll_access = TRUE; + cache_ptr->num_coll_entries ++; + + //fprintf(stderr, "ONLY INSERT (%llu, %s)\n", addr, entry_ptr->type->name); + H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) + } + else if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && coll_access && entry_ptr->coll_access) { + //fprintf(stderr, "UPDATE (%llu, %s)\n", addr, entry_ptr->type->name); + H5C__MOVE_TO_TOP_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) + } +#endif /* H5_HAVE_PARALLEL */ + #if H5C_DO_TAGGING_SANITY_CHECKS /* The entry is already in the cache, but make sure that the tag value being passed in via dxpl is still legal. This will ensure that had @@ -4135,10 +4356,6 @@ H5C_protect(H5F_t * f, and it would have received a legal tag value after getting loaded from disk. */ - /* Get the dataset transfer property list */ - if(NULL == (dxpl = (H5P_genplist_t *)H5I_object_verify(dxpl_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a property list"); - /* Get the tag from the DXPL */ if( (H5P_get(dxpl, "H5AC_metadata_tag", &tag)) < 0 ) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "unable to query property value"); @@ -4162,7 +4379,11 @@ H5C_protect(H5F_t * f, hit = FALSE; - thing = H5C_load_entry(f, dxpl_id, type, addr, udata); + thing = H5C_load_entry(f, dxpl_id, +#ifdef H5_HAVE_PARALLEL + coll_access, +#endif /* H5_HAVE_PARALLEL */ + type, addr, udata); if ( thing == NULL ) { @@ -4171,6 +4392,17 @@ H5C_protect(H5F_t * f, entry_ptr = (H5C_cache_entry_t *)thing; +#ifdef H5_HAVE_PARALLEL + if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { + if(entry_ptr->coll_access) { + cache_ptr->num_coll_entries ++; + //fprintf(stderr, "LOAD and INSERT (%llu, %s)\n", addr, entry_ptr->type->name); + H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) + } + } + //fprintf(stderr, "LOADED (%llu, %s) - %d\n", addr, entry_ptr->type->name, coll_access); +#endif /* H5_HAVE_PARALLEL */ + /* Apply tag to newly protected entry */ if(H5C_tag_entry(cache_ptr, entry_ptr, dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTTAG, NULL, "Cannot tag metadata entry") @@ -4453,6 +4685,29 @@ H5C_protect(H5F_t * f, } } +#ifdef H5_HAVE_PARALLEL + if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { + /* Make sure the size of the collective entries in the cache remain in check */ + if( TRUE == coll_access) { + if(H5P_USER_TRUE == f->coll_md_read) { + //fprintf(stderr, "COLL entries size = %zu, MAX = %zu\n", cache_ptr->coll_list_size, cache_ptr->max_cache_size); + if(cache_ptr->max_cache_size*0.8 < cache_ptr->coll_list_size) { + //fprintf(stderr, "COLL entries at 80.. CLEARING\n"); + if(H5C_clear_coll_entries(f, dxpl_id, cache_ptr, 1) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "H5C_clear_coll_entries() failed.") + } + } + else { + if(cache_ptr->max_cache_size*0.4 < cache_ptr->coll_list_size) { + //fprintf(stderr, "COLL entries at 40.. CLEARING\n"); + if(H5C_clear_coll_entries(f, dxpl_id, cache_ptr, 1) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "H5C_clear_coll_entries() failed.") + } + } + } + } +#endif /* H5_HAVE_PARALLEL */ + done: #if H5C_DO_EXTREME_SANITY_CHECKS @@ -4460,7 +4715,7 @@ done: ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, \ "an extreme sanity check failed on exit.\n"); } #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ @@ -6138,6 +6393,7 @@ H5C_unprotect(H5F_t * f, addr, flush_flags, TRUE, + NULL, NULL) < 0 ) { HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Can't flush.") @@ -6179,6 +6435,7 @@ H5C_unprotect(H5F_t * f, addr, H5C__FLUSH_CLEAR_ONLY_FLAG, TRUE, + NULL, NULL) < 0 ) { HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "Can't clear.") @@ -7518,6 +7775,7 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, entry_ptr->addr, H5C__NO_FLAGS_SET, FALSE, + NULL, NULL); if ( ( cache_ptr->entries_removed_counter > 1 ) || @@ -7534,6 +7792,7 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, entry_ptr->addr, H5C__FLUSH_INVALIDATE_FLAG, TRUE, + NULL, NULL); } @@ -7625,6 +7884,7 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, entry_ptr->addr, H5C__FLUSH_INVALIDATE_FLAG, TRUE, + NULL, NULL); if ( result < 0 ) { @@ -8404,7 +8664,8 @@ H5C_flush_invalidate_cache(const H5F_t * f, entry_ptr->addr, H5C__NO_FLAGS_SET, FALSE, - entry_size_change_ptr); + entry_size_change_ptr, + NULL); if ( status < 0 ) { /* This shouldn't happen -- if it does, we @@ -8462,11 +8723,12 @@ H5C_flush_invalidate_cache(const H5F_t * f, #endif /* H5C_DO_SANITY_CHECKS */ status = H5C_flush_single_entry(f, - dxpl_id, - entry_ptr->addr, - (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG), - TRUE, - entry_size_change_ptr); + dxpl_id, + entry_ptr->addr, + (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG), + TRUE, + entry_size_change_ptr, + NULL); if ( status < 0 ) { /* This shouldn't happen -- if it does, we @@ -8604,11 +8866,12 @@ H5C_flush_invalidate_cache(const H5F_t * f, entry_was_dirty = entry_ptr->is_dirty; status = H5C_flush_single_entry(f, - dxpl_id, - entry_ptr->addr, - (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG), - TRUE, - NULL); + dxpl_id, + entry_ptr->addr, + (cooked_flags | H5C__FLUSH_INVALIDATE_FLAG), + TRUE, + NULL, + NULL); if ( status < 0 ) { @@ -8820,7 +9083,8 @@ H5C_flush_single_entry(const H5F_t * f, haddr_t addr, unsigned flags, hbool_t del_entry_from_slist_on_destroy, - int64_t * entry_size_change_ptr) + int64_t * entry_size_change_ptr, + H5SL_t * collective_write_list) { H5C_t * cache_ptr = f->shared->cache; hbool_t destroy; /* external flag */ @@ -8866,6 +9130,8 @@ H5C_flush_single_entry(const H5F_t * f, /* attempt to find the target entry in the hash table */ H5C__SEARCH_INDEX(cache_ptr, addr, entry_ptr, FAIL) + HDassert(FALSE == entry_ptr->coll_access); + /* we will write the entry to disk if it exists, is dirty, and if the * clear only flag is not set. */ @@ -8948,7 +9214,7 @@ H5C_flush_single_entry(const H5F_t * f, unsigned coll_meta; /* Collective metadata write flag */ /* Get the dataset transfer property list */ - if(NULL == (dxpl = H5I_object(dxpl_id))) + if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id))) HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, FAIL, "not a dataset transfer property list") /* Get the collective metadata write property */ @@ -9301,6 +9567,25 @@ H5C_flush_single_entry(const H5F_t * f, else image_size = entry_ptr->size; +#ifdef H5_HAVE_PARALLEL + if(collective_write_list) { + H5C_collective_write_t *item = NULL; + + if(NULL == (item = (H5C_collective_write_t *)H5MM_malloc(sizeof(H5C_collective_write_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate skip list item") + + item->length = image_size; + item->free_buf = FALSE; + item->buf = entry_ptr->image_ptr; + item->offset = entry_ptr->addr; + + if(H5SL_insert(collective_write_list, item, &item->offset) < 0) { + H5MM_free(item); + HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "unable to insert skip list item") + } /* end if */ + } /* end if */ + else +#endif /* H5_HAVE_PARALLEL */ if ( ( H5F_block_write(f, entry_ptr->type->mem_type, entry_ptr->addr, image_size, dxpl_id, @@ -9644,6 +9929,9 @@ done: static void * H5C_load_entry(H5F_t * f, hid_t dxpl_id, +#ifdef H5_HAVE_PARALLEL + hbool_t coll_access, +#endif /* H5_HAVE_PARALLEL */ const H5C_class_t * type, haddr_t addr, void * udata) @@ -9662,6 +9950,11 @@ H5C_load_entry(H5F_t * f, H5C_cache_entry_t * entry; /* Alias for thing loaded, as cache entry */ size_t len; /* Size of image in file */ unsigned u; /* Local index variable */ +#ifdef H5_HAVE_PARALLEL + int mpi_rank; /* MPI process rank */ + MPI_Comm comm; /* File MPI Communicator */ + int mpi_code; /* MPI error code */ +#endif /* H5_HAVE_PARALLEL */ void * ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -9808,11 +10101,39 @@ H5C_load_entry(H5F_t * f, HDmemcpy(((uint8_t *)image) + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ +#ifdef H5_HAVE_PARALLEL + if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { + if((mpi_rank = H5F_mpi_get_rank(f)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank") + if((comm = H5F_mpi_get_comm(f)) == MPI_COMM_NULL) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "get_comm request failed") + } +#endif /* H5_HAVE_PARALLEL */ + /* Get the on-disk entry image */ - if ( 0 == (type->flags & H5C__CLASS_SKIP_READS) ) + if ( 0 == (type->flags & H5C__CLASS_SKIP_READS) ) { +#ifdef H5_HAVE_PARALLEL + if(!coll_access || 0 == mpi_rank) { +#endif /* H5_HAVE_PARALLEL */ + if(H5F_block_read(f, type->mem_type, addr, len, dxpl_id, image) < 0) HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL, "Can't read image*") +#ifdef H5_HAVE_PARALLEL + } + /* if the collective metadata read optimization is turned on, + bcast the metadata read from process 0 to all ranks in the file + communicator */ + if(coll_access) { + int buf_size; + + H5_CHECKED_ASSIGN(buf_size, int, len, size_t); + if(MPI_SUCCESS != (mpi_code = MPI_Bcast(image, buf_size, MPI_BYTE, 0, comm))) + HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) + } +#endif /* H5_HAVE_PARALLEL */ + } + /* Deserialize the on-disk image into the native memory form */ if(NULL == (thing = type->deserialize(image, len, udata, &dirty))) HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't deserialize image") @@ -9920,21 +10241,32 @@ H5C_load_entry(H5F_t * f, HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, \ "free_icr callback failed") +#ifdef H5_HAVE_PARALLEL + if(!coll_access || 0 == mpi_rank) { +#endif /* H5_HAVE_PARALLEL */ /* Go get the on-disk image again */ if(H5F_block_read(f, type->mem_type, addr, new_len, dxpl_id, image) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't read image") - HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, \ - "Can't read image") +#ifdef H5_HAVE_PARALLEL + } + /* if the collective metadata read optimization is turned on, + bcast the metadata read from process 0 to all ranks in the file + communicator */ + if(coll_access) { + int buf_size; + + H5_CHECKED_ASSIGN(buf_size, int, new_len, size_t); + if(MPI_SUCCESS != (mpi_code = MPI_Bcast(image, buf_size, MPI_BYTE, 0, comm))) + HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) + } +#endif /* H5_HAVE_PARALLEL */ - /* Deserialize on-disk image into native memory - * form again - */ + /* Deserialize on-disk image into native memory form again */ if(NULL == (thing = type->deserialize(image, new_len, udata, &dirty))) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, \ - "Can't deserialize image") + HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't deserialize image") #ifndef NDEBUG { @@ -10019,6 +10351,8 @@ H5C_load_entry(H5F_t * f, #ifdef H5_HAVE_PARALLEL entry->clear_on_unprotect = FALSE; entry->flush_immediately = FALSE; + entry->coll_access = coll_access; + entry->ind_access_while_coll = FALSE; #endif /* H5_HAVE_PARALLEL */ entry->flush_in_progress = FALSE; entry->destroy_in_progress = FALSE; @@ -10037,6 +10371,9 @@ H5C_load_entry(H5F_t * f, entry->aux_next = NULL; entry->aux_prev = NULL; + entry->coll_next = NULL; + entry->coll_prev = NULL; + H5C__RESET_CACHE_ENTRY_STATS(entry); ret_value = thing; @@ -10230,32 +10567,48 @@ H5C_make_space_in_cache(H5F_t * f, cache_ptr->entries_removed_counter = 0; cache_ptr->last_entry_removed_ptr = NULL; + if(TRUE == entry_ptr->coll_access) { + entry_ptr->coll_access = FALSE; + cache_ptr->num_coll_entries --; + H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) + } + result = H5C_flush_single_entry(f, dxpl_id, entry_ptr->addr, H5C__NO_FLAGS_SET, FALSE, + NULL, NULL); - if ( ( cache_ptr->entries_removed_counter > 1 ) || ( cache_ptr->last_entry_removed_ptr == prev_ptr ) ) restart_scan = TRUE; - } else if ( (cache_ptr->index_size + space_needed) - > - cache_ptr->max_cache_size ) { + } else if ( (cache_ptr->index_size + space_needed) > cache_ptr->max_cache_size +#ifdef H5_HAVE_PARALLEL + && !(entry_ptr->coll_access) +#endif /* H5_HAVE_PARALLEL */ + ) { #if H5C_COLLECT_CACHE_STATS cache_ptr->entries_scanned_to_make_space++; #endif /* H5C_COLLECT_CACHE_STATS */ + if(TRUE == entry_ptr->coll_access) { + entry_ptr->coll_access = FALSE; + cache_ptr->num_coll_entries --; + H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) + } + result = H5C_flush_single_entry(f, dxpl_id, entry_ptr->addr, H5C__FLUSH_INVALIDATE_FLAG, TRUE, + NULL, NULL); + } else { /* We have enough space so don't flush clean entry. @@ -10404,18 +10757,25 @@ H5C_make_space_in_cache(H5F_t * f, prev_ptr = entry_ptr->aux_prev; - result = H5C_flush_single_entry(f, - dxpl_id, - entry_ptr->addr, - H5C__FLUSH_INVALIDATE_FLAG, - TRUE, - NULL); +#ifdef H5_HAVE_PARALLEL + if(!(entry_ptr->coll_access)) { +#endif /* H5_HAVE_PARALLEL */ + result = H5C_flush_single_entry(f, + dxpl_id, + entry_ptr->addr, + H5C__FLUSH_INVALIDATE_FLAG, + TRUE, + NULL, + NULL); - if ( result < 0 ) { + if ( result < 0 ) { - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "unable to flush entry") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ + "unable to flush entry") + } +#ifdef H5_HAVE_PARALLEL } +#endif /* H5_HAVE_PARALLEL */ /* we are scanning the clean LRU, so the serialize function * will not be called on any entry -- thus there is no @@ -11305,6 +11665,222 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C_flush_marked_entries */ +#ifdef H5_HAVE_PARALLEL + +/*------------------------------------------------------------------------- + * + * Function: H5C_clear_coll_entries + * + * Purpose: + * + * Return: FAIL if error is detected, SUCCEED otherwise. + * + * Programmer: Mohamad Chaarawi + * April, 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5C_clear_coll_entries(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5C_t * cache_ptr, + hbool_t partial) +{ + int32_t list_len, coll_entries_cleared = 0, coll_dirty_entries=0; + H5C_cache_entry_t * entry_ptr = NULL; + H5C_cache_entry_t * prev_ptr; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + //fprintf(stderr, "List len = %d, NUM coll entries = %d\n", cache_ptr->coll_list_len, cache_ptr->num_coll_entries); + entry_ptr = cache_ptr->coll_tail_ptr; + list_len = cache_ptr->coll_list_len; + while(entry_ptr && (coll_entries_cleared < (partial ? list_len/2 : list_len))) { + prev_ptr = entry_ptr->coll_prev; + + HDassert(entry_ptr->coll_access); + + if(entry_ptr->is_dirty && partial && 0) { + coll_dirty_entries ++; + //fprintf(stderr, "%d: %llu Coll entry is Dirty\n", mpi_rank, entry_ptr->addr); + } + else { + entry_ptr->coll_access = FALSE; + H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) + coll_entries_cleared ++; + //fprintf(stderr, "Cleared %llu Coll entries Cleaned = %d\n", entry_ptr->addr, coll_entries_cleared); + } + entry_ptr = prev_ptr; + } + + //fprintf(stderr, "NUM COLL entries = %d, CLEARED %d, Dirty %d\n", + //cache_ptr->num_coll_entries, coll_entries_cleared, coll_dirty_entries); + + cache_ptr->num_coll_entries -= coll_entries_cleared; + //fprintf(stderr, "NUM COLL entries = %d, NUM COLL dirty entries = %d\n", cache_ptr->num_coll_entries, coll_dirty_entries); + HDassert(cache_ptr->coll_list_len == cache_ptr->num_coll_entries); + //HDassert(0 == coll_dirty_entries - cache_ptr->num_coll_entries); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C_clear_coll_entries */ + +static herr_t +H5C_collective_write(H5F_t *f, + hid_t dxpl_id, + H5SL_t *collective_write_list) +{ + H5P_genplist_t *plist = NULL; + H5FD_mpio_xfer_t xfer_mode = H5FD_MPIO_COLLECTIVE; + H5FD_mpio_xfer_t orig_xfer_mode = -1; + H5SL_node_t *node; + H5C_collective_write_t *item; + int count; + void *base_buf; + int *length_array = NULL; + MPI_Aint *buf_array = NULL; + MPI_Aint *offset_array = NULL; + MPI_Datatype btype; + MPI_Datatype ftype; + hbool_t btype_created = FALSE; + hbool_t ftype_created = FALSE; + int mpi_code; + int i; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + count = (int)H5SL_count(collective_write_list); + + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") + + if(H5P_get(plist, H5D_XFER_IO_XFER_MODE_NAME, &orig_xfer_mode) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O property") + + if(count > 0) { + if(H5P_set(plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O property") + + /* Allocate arrays */ + if(NULL == (length_array = (int *)H5MM_malloc((size_t)count * sizeof(int)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for collective write table length array") + if(NULL == (buf_array = (MPI_Aint *)H5MM_malloc((size_t)count * sizeof(MPI_Aint)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for collective buf table length array") + if(NULL == (offset_array = (MPI_Aint *)H5MM_malloc((size_t)count * sizeof(MPI_Aint)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for collective offset table length array") + + /* Fill arrays */ + node = H5SL_first(collective_write_list); + HDassert(node); + if(NULL == (item = (H5C_collective_write_t *)H5SL_item(node))) + HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "can't retrieve skip list item") + + length_array[0] = (int)item->length; + base_buf = item->buf; + buf_array[0] = (MPI_Aint)0; + offset_array[0] = (MPI_Aint)item->offset; + + node = H5SL_next(node); + i = 1; + while(node) { + if(NULL == (item = (H5C_collective_write_t *)H5SL_item(node))) + HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "can't retrieve skip list item") + + length_array[i] = (int)item->length; + buf_array[i] = (MPI_Aint)item->buf - (MPI_Aint)base_buf; + offset_array[i] = (MPI_Aint)item->offset; + node = H5SL_next(node); + i++; + } /* end while */ + + /* Create memory mpi type */ + if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed(count, length_array, buf_array, MPI_BYTE, &btype))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) + btype_created = TRUE; + if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&btype))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) + + /* Create file mpi type */ + if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed(count, length_array, offset_array, MPI_BYTE, &ftype))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) + ftype_created = TRUE; + if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&ftype))) + HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) + + /* Pass buf type, file type to the file driver. */ + if(H5FD_mpi_setup_collective(dxpl_id, &btype, &ftype) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O properties") + + /* Write data */ + if(H5F_block_write(f, H5FD_MEM_DEFAULT, (haddr_t)0, (size_t)1, dxpl_id, base_buf) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to write entries collectively") + } /* end if */ + else { + MPI_Status mpi_stat; + MPI_File mpi_fh_p; + MPI_File mpi_fh; + + if(H5F_get_mpi_handle(f, (MPI_File **)&mpi_fh_p) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get mpi file handle") + mpi_fh = *(MPI_File*)mpi_fh_p; + + /* just to match up with the 1st MPI_File_set_view from H5FD_mpio_write() */ + if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(mpi_fh, (MPI_Offset)0, MPI_BYTE, + MPI_BYTE, "native", MPI_INFO_NULL))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) + + /* just to match up with MPI_File_write_at_all from H5FD_mpio_write() */ + HDmemset(&mpi_stat, 0, sizeof(MPI_Status)); + if(MPI_SUCCESS != (mpi_code = MPI_File_write_at_all(mpi_fh, (MPI_Offset)0, NULL, 0, + MPI_BYTE, &mpi_stat))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at_all failed", mpi_code) + + /* just to match up with the 2nd MPI_File_set_view (reset) in H5FD_mpio_write() */ + if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(mpi_fh, (MPI_Offset)0, MPI_BYTE, + MPI_BYTE, "native", MPI_INFO_NULL))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) + } /* end else */ + +done: + /* Free arrays */ + length_array = (int *)H5MM_xfree(length_array); + buf_array = (MPI_Aint *)H5MM_xfree(buf_array); + offset_array = (MPI_Aint *)H5MM_xfree(offset_array); + + /* Free MPI Types */ + if(btype_created && MPI_SUCCESS != (mpi_code = MPI_Type_free(&btype))) + HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) + if(ftype_created && MPI_SUCCESS != (mpi_code = MPI_Type_free(&ftype))) + HMPI_DONE_ERROR(FAIL, "MPI_Type_free failed", mpi_code) + + /* Reset dxpl */ + if(orig_xfer_mode != H5FD_MPIO_COLLECTIVE) { + HDassert(plist); + if(H5P_set(plist, H5D_XFER_IO_XFER_MODE_NAME, &orig_xfer_mode) < 0) + HDONE_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O property") + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value); +} /* end H5C_collective_write() */ + +static herr_t +H5C_collective_write_free(void *_item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op_data) +{ + H5C_collective_write_t *item = (H5C_collective_write_t *)_item; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(item); + + if(item->free_buf) + item->buf = H5MM_xfree(item->buf); + /*!FIXME change to use free list for items */ + H5MM_free(item); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5C_double_collective_table() */ +#endif /* H5_HAVE_PARALLEL */ + #if H5C_DO_TAGGING_SANITY_CHECKS /*------------------------------------------------------------------------- @@ -11424,3 +12000,246 @@ H5C_retag_copied_metadata(H5C_t * cache_ptr, haddr_t metadata_tag) FUNC_LEAVE_NOAPI_VOID } /* H5C_retag_copied_metadata */ +static herr_t +H5C__generate_image(H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr, + hid_t dxpl_id, int64_t *entry_size_change_ptr) +{ + haddr_t new_addr = HADDR_UNDEF; + haddr_t old_addr = HADDR_UNDEF; + size_t new_len = 0; + size_t new_compressed_len = 0; + unsigned serialize_flags = H5C__SERIALIZE_NO_FLAGS_SET; + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(!entry_ptr->image_up_to_date); + + /* reset cache_ptr->slist_changed so we can detect slist + * modifications in the pre_serialize call. + */ + cache_ptr->slist_changed = FALSE; + + /* make note of the entry's current address */ + old_addr = entry_ptr->addr; + + /* Call client's pre-serialize callback, if there's one */ + if ( ( entry_ptr->type->pre_serialize != NULL ) && + ( (entry_ptr->type->pre_serialize)(f, dxpl_id, + (void *)entry_ptr, + entry_ptr->addr, + entry_ptr->size, + entry_ptr->compressed_size, + &new_addr, &new_len, + &new_compressed_len, + &serialize_flags) < 0 ) ) { + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ + "unable to pre-serialize entry"); + } + + /* set cache_ptr->slist_change_in_pre_serialize if the + * slist was modified. + */ + if ( cache_ptr->slist_changed ) + cache_ptr->slist_change_in_pre_serialize = TRUE; + + /* Check for any flags set in the pre-serialize callback */ + if ( serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET ) { + /* Check for unexpected flags from serialize callback */ + if ( serialize_flags & ~(H5C__SERIALIZE_RESIZED_FLAG | + H5C__SERIALIZE_MOVED_FLAG | + H5C__SERIALIZE_COMPRESSED_FLAG)) { + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ + "unknown serialize flag(s)"); + } + +#ifdef H5_HAVE_PARALLEL + if ( cache_ptr->aux_ptr != NULL ) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ + "resize/move in serialize occured in parallel case."); +#endif + + /* Resize the buffer if required */ + if ( ( ( ! entry_ptr->compressed ) && + ( serialize_flags & H5C__SERIALIZE_RESIZED_FLAG ) ) || + ( ( entry_ptr->compressed ) && + ( serialize_flags & H5C__SERIALIZE_COMPRESSED_FLAG ) ) ) { + size_t new_image_size; + + if ( entry_ptr->compressed ) + new_image_size = new_compressed_len; + else + new_image_size = new_len; + + HDassert(new_image_size > 0); + + /* Release the current image */ + if ( entry_ptr->image_ptr ) { + entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr); + } + + /* Allocate a new image buffer */ + entry_ptr->image_ptr = + H5MM_malloc(new_image_size + H5C_IMAGE_EXTRA_SPACE); + + if ( NULL == entry_ptr->image_ptr ) + { + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, \ + "memory allocation failed for on disk image buffer"); + } + +#if H5C_DO_MEMORY_SANITY_CHECKS + + HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + new_image_size, + H5C_IMAGE_SANITY_VALUE, + H5C_IMAGE_EXTRA_SPACE); + +#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ + + } /* end if */ + + /* If required, update the entry and the cache data structures + * for a resize. + */ + if ( serialize_flags & H5C__SERIALIZE_RESIZED_FLAG ) { + + H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, \ + entry_ptr, new_len); + + /* update the hash table for the size change*/ + H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, \ + entry_ptr->size, \ + new_len, entry_ptr, \ + !(entry_ptr->is_dirty)); + + /* The entry can't be protected since we are + * in the process of flushing it. Thus we must + * update the replacement policy data + * structures for the size change. The macro + * deals with the pinned case. + */ + H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_len); + + /* as we haven't updated the cache data structures for + * for the flush or flush destroy yet, the entry should + * be in the slist. Thus update it for the size change. + */ + HDassert(entry_ptr->in_slist); + H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, \ + new_len); + + /* if defined, update *entry_size_change_ptr for the + * change in entry size. + */ + if ( entry_size_change_ptr != NULL ) + { + *entry_size_change_ptr = (int64_t)new_len; + *entry_size_change_ptr -= (int64_t)(entry_ptr->size); + } + + /* finally, update the entry for its new size */ + entry_ptr->size = new_len; + } /* end if */ + + /* If required, udate the entry and the cache data structures + * for a move + */ + if(serialize_flags & H5C__SERIALIZE_MOVED_FLAG) { +#if H5C_DO_SANITY_CHECKS + int64_t saved_slist_len_increase; + int64_t saved_slist_size_increase; +#endif /* H5C_DO_SANITY_CHECKS */ + + H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr); + + if ( entry_ptr->addr == old_addr ) { + /* we must update cache data structures for the + * change in address. + */ + + /* delete the entry from the hash table and the slist */ + H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr); + H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr); + + /* update the entry for its new address */ + entry_ptr->addr = new_addr; + + /* and then reinsert in the index and slist */ + H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL); + +#if H5C_DO_SANITY_CHECKS + /* save cache_ptr->slist_len_increase and + * cache_ptr->slist_size_increase before the + * reinsertion into the slist, and restore + * them afterwards to avoid skewing our sanity + * checking. + */ + saved_slist_len_increase = cache_ptr->slist_len_increase; + saved_slist_size_increase = cache_ptr->slist_size_increase; +#endif /* H5C_DO_SANITY_CHECKS */ + + H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL); + +#if H5C_DO_SANITY_CHECKS + cache_ptr->slist_len_increase = saved_slist_len_increase; + cache_ptr->slist_size_increase = saved_slist_size_increase; +#endif /* H5C_DO_SANITY_CHECKS */ + } + else { + HDassert(entry_ptr->addr == new_addr); + } + } /* end if */ + + if ( serialize_flags & H5C__SERIALIZE_COMPRESSED_FLAG ) { + /* just save the new compressed entry size in + * entry_ptr->compressed_size. We don't need to + * do more, as compressed size is only used for I/O. + */ + HDassert(entry_ptr->compressed); + entry_ptr->compressed_size = new_compressed_len; + } + } /* end if ( serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET ) */ + + /* Serialize object into buffer */ + { + size_t image_len; + + if ( entry_ptr->compressed ) + image_len = entry_ptr->compressed_size; + else + image_len = entry_ptr->size; + + /* reset cache_ptr->slist_changed so we can detect slist + * modifications in the serialize call. + */ + cache_ptr->slist_changed = FALSE; + + + if ( entry_ptr->type->serialize(f, entry_ptr->image_ptr, + image_len, + (void *)entry_ptr) < 0) { + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ + "unable to serialize entry"); + } + + /* set cache_ptr->slist_change_in_serialize if the + * slist was modified. + */ + if ( cache_ptr->slist_changed ) + cache_ptr->slist_change_in_pre_serialize = TRUE; + +#if H5C_DO_MEMORY_SANITY_CHECKS + + HDassert(0 == HDmemcmp(((uint8_t *)entry_ptr->image_ptr) + + image_len, + H5C_IMAGE_SANITY_VALUE, + H5C_IMAGE_EXTRA_SPACE)); + +#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ + + entry_ptr->image_up_to_date = TRUE; + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5C__generate_image */ diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 988dfff..8fd3e43 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -955,7 +955,7 @@ if ( ( (cache_ptr) == NULL ) || \ } #define H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ - entry_ptr, was_clean) \ + entry_ptr, was_clean) \ if ( ( (cache_ptr) == NULL ) || \ ( (cache_ptr)->index_len <= 0 ) || \ ( (cache_ptr)->index_size <= 0 ) || \ @@ -1125,7 +1125,7 @@ if ( ( (cache_ptr)->index_size != \ H5C__POST_HT_REMOVE_SC(cache_ptr, entry_ptr) \ } -#define H5C__SEARCH_INDEX(cache_ptr, Addr, entry_ptr, fail_val) \ +#define H5C__SEARCH_INDEX(cache_ptr, Addr, entry_ptr, fail_val) \ { \ int k; \ int depth = 0; \ @@ -2351,7 +2351,16 @@ if ( ( (cache_ptr)->index_size != \ HDassert( ((entry_ptr)->ro_ref_count) == 0 ); \ HDassert( (entry_ptr)->size > 0 ); \ HDassert( new_size > 0 ); \ - \ + \ + if ( (entry_ptr)->coll_access ) { \ + \ + H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->coll_list_len, \ + (cache_ptr)->coll_list_size, \ + (entry_ptr)->size, \ + (new_size)); \ + \ + } \ + \ if ( (entry_ptr)->is_pinned ) { \ \ H5C__DLL_UPDATE_FOR_SIZE_CHANGE((cache_ptr)->pel_len, \ @@ -2701,6 +2710,252 @@ if ( ( (cache_ptr)->index_size != \ #endif /* H5C_MAINTAIN_CLEAN_AND_DIRTY_LRU_LISTS */ +#ifdef H5_HAVE_PARALLEL + +#if H5C_DO_SANITY_CHECKS +#define H5C__COLL_DLL_PRE_REMOVE_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \ +if ( ( (hd_ptr) == NULL ) || \ + ( (tail_ptr) == NULL ) || \ + ( (entry_ptr) == NULL ) || \ + ( (len) <= 0 ) || \ + ( (Size) < (entry_ptr)->size ) || \ + ( ( (Size) == (entry_ptr)->size ) && ( ! ( (len) == 1 ) ) ) || \ + ( ( (entry_ptr)->coll_prev == NULL ) && ( (hd_ptr) != (entry_ptr) ) ) || \ + ( ( (entry_ptr)->coll_next == NULL ) && ( (tail_ptr) != (entry_ptr) ) ) || \ + ( ( (len) == 1 ) && \ + ( ! ( ( (hd_ptr) == (entry_ptr) ) && ( (tail_ptr) == (entry_ptr) ) && \ + ( (entry_ptr)->coll_next == NULL ) && \ + ( (entry_ptr)->coll_prev == NULL ) && \ + ( (Size) == (entry_ptr)->size ) \ + ) \ + ) \ + ) \ + ) { \ + HDassert(0 && "coll DLL pre remove SC failed"); \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "coll DLL pre remove SC failed") \ +} + +#define H5C__COLL_DLL_SC(head_ptr, tail_ptr, len, Size, fv) \ +if ( ( ( ( (head_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ + ( (head_ptr) != (tail_ptr) ) \ + ) || \ + ( (len) < 0 ) || \ + ( (Size) < 0 ) || \ + ( ( (len) == 1 ) && \ + ( ( (head_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || \ + ( (head_ptr) == NULL ) || ( (head_ptr)->size != (Size) ) \ + ) \ + ) || \ + ( ( (len) >= 1 ) && \ + ( ( (head_ptr) == NULL ) || ( (head_ptr)->coll_prev != NULL ) || \ + ( (tail_ptr) == NULL ) || ( (tail_ptr)->coll_next != NULL ) \ + ) \ + ) \ + ) { \ + HDassert(0 && "COLL DLL sanity check failed"); \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "COLL DLL sanity check failed") \ +} + +#define H5C__COLL_DLL_PRE_INSERT_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) \ +if ( ( (entry_ptr) == NULL ) || \ + ( (entry_ptr)->coll_next != NULL ) || \ + ( (entry_ptr)->coll_prev != NULL ) || \ + ( ( ( (hd_ptr) == NULL ) || ( (tail_ptr) == NULL ) ) && \ + ( (hd_ptr) != (tail_ptr) ) \ + ) || \ + ( (len) < 0 ) || \ + ( ( (len) == 1 ) && \ + ( ( (hd_ptr) != (tail_ptr) ) || ( (Size) <= 0 ) || \ + ( (hd_ptr) == NULL ) || ( (hd_ptr)->size != (Size) ) \ + ) \ + ) || \ + ( ( (len) >= 1 ) && \ + ( ( (hd_ptr) == NULL ) || ( (hd_ptr)->coll_prev != NULL ) || \ + ( (tail_ptr) == NULL ) || ( (tail_ptr)->coll_next != NULL ) \ + ) \ + ) \ + ) { \ + HDassert(0 && "COLL DLL pre insert SC failed"); \ + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (fv), "COLL DLL pre insert SC failed") \ +} + +#else /* H5C_DO_SANITY_CHECKS */ + +#define H5C__COLL_DLL_PRE_REMOVE_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) +#define H5C__COLL_DLL_SC(head_ptr, tail_ptr, len, Size, fv) +#define H5C__COLL_DLL_PRE_INSERT_SC(entry_ptr, hd_ptr, tail_ptr, len, Size, fv) + +#endif /* H5C_DO_SANITY_CHECKS */ + + +#define H5C__COLL_DLL_APPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fail_val) \ +{ \ + H5C__COLL_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, \ + fail_val) \ + if ( (head_ptr) == NULL ) \ + { \ + (head_ptr) = (entry_ptr); \ + (tail_ptr) = (entry_ptr); \ + } \ + else \ + { \ + (tail_ptr)->coll_next = (entry_ptr); \ + (entry_ptr)->coll_prev = (tail_ptr); \ + (tail_ptr) = (entry_ptr); \ + } \ + (len)++; \ + (Size) += entry_ptr->size; \ +} /* H5C__COLL_DLL_APPEND() */ + +#define H5C__COLL_DLL_PREPEND(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ +{ \ + H5C__COLL_DLL_PRE_INSERT_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv)\ + if ( (head_ptr) == NULL ) \ + { \ + (head_ptr) = (entry_ptr); \ + (tail_ptr) = (entry_ptr); \ + } \ + else \ + { \ + (head_ptr)->coll_prev = (entry_ptr); \ + (entry_ptr)->coll_next = (head_ptr); \ + (head_ptr) = (entry_ptr); \ + } \ + (len)++; \ + (Size) += entry_ptr->size; \ +} /* H5C__COLL_DLL_PREPEND() */ + +#define H5C__COLL_DLL_REMOVE(entry_ptr, head_ptr, tail_ptr, len, Size, fv) \ +{ \ + H5C__COLL_DLL_PRE_REMOVE_SC(entry_ptr, head_ptr, tail_ptr, len, Size, fv)\ + { \ + if ( (head_ptr) == (entry_ptr) ) \ + { \ + (head_ptr) = (entry_ptr)->coll_next; \ + if ( (head_ptr) != NULL ) \ + { \ + (head_ptr)->coll_prev = NULL; \ + } \ + } \ + else \ + { \ + (entry_ptr)->coll_prev->coll_next = (entry_ptr)->coll_next; \ + } \ + if ( (tail_ptr) == (entry_ptr) ) \ + { \ + (tail_ptr) = (entry_ptr)->coll_prev; \ + if ( (tail_ptr) != NULL ) \ + { \ + (tail_ptr)->coll_next = NULL; \ + } \ + } \ + else \ + { \ + (entry_ptr)->coll_next->coll_prev = (entry_ptr)->coll_prev; \ + } \ + entry_ptr->coll_next = NULL; \ + entry_ptr->coll_prev = NULL; \ + (len)--; \ + (Size) -= entry_ptr->size; \ + } \ +} /* H5C__COLL_DLL_REMOVE() */ + + +/*------------------------------------------------------------------------- + * + * Macro: H5C__INSERT_IN_COLL_LIST + * + * Purpose: Insert entry into collective entries list + * + * Return: N/A + * + * Programmer: Mohamad Chaarawi + * + *------------------------------------------------------------------------- + */ + +#define H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, fail_val) \ +{ \ + HDassert( (cache_ptr) ); \ + HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ + HDassert( (entry_ptr) ); \ + \ + /* insert the entry at the head of the list. */ \ + \ + H5C__COLL_DLL_PREPEND((entry_ptr), (cache_ptr)->coll_head_ptr, \ + (cache_ptr)->coll_tail_ptr, \ + (cache_ptr)->coll_list_len, \ + (cache_ptr)->coll_list_size, \ + (fail_val)) \ + \ +} /* H5C__INSERT_IN_COLL_LIST */ + + +/*------------------------------------------------------------------------- + * + * Macro: H5C__REMOVE_FROM_COLL_LIST + * + * Purpose: Remove entry from collective entries list + * + * Return: N/A + * + * Programmer: Mohamad Chaarawi + * + *------------------------------------------------------------------------- + */ + +#define H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, fail_val) \ +{ \ + HDassert( (cache_ptr) ); \ + HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ + HDassert( (entry_ptr) ); \ + \ + /* remove the entry from the list. */ \ + \ + H5C__COLL_DLL_REMOVE((entry_ptr), (cache_ptr)->coll_head_ptr, \ + (cache_ptr)->coll_tail_ptr, \ + (cache_ptr)->coll_list_len, \ + (cache_ptr)->coll_list_size, \ + (fail_val)) \ + \ +} /* H5C__REMOVE_FROM_COLL_LIST */ + + +/*------------------------------------------------------------------------- + * + * Macro: H5C__MOVE_TO_TOP_IN_COLL_LIST + * + * Purpose: Update entry position in collective entries list + * + * Return: N/A + * + * Programmer: Mohamad Chaarawi + * + *------------------------------------------------------------------------- + */ + +#define H5C__MOVE_TO_TOP_IN_COLL_LIST(cache_ptr, entry_ptr, fail_val) \ +{ \ + HDassert( (cache_ptr) ); \ + HDassert( (cache_ptr)->magic == H5C__H5C_T_MAGIC ); \ + HDassert( (entry_ptr) ); \ + \ + /* Remove entry and insert at the head of the list. */ \ + H5C__COLL_DLL_REMOVE((entry_ptr), (cache_ptr)->coll_head_ptr, \ + (cache_ptr)->coll_tail_ptr, \ + (cache_ptr)->coll_list_len, \ + (cache_ptr)->coll_list_size, \ + (fail_val)) \ + \ + H5C__COLL_DLL_PREPEND((entry_ptr), (cache_ptr)->coll_head_ptr, \ + (cache_ptr)->coll_tail_ptr, \ + (cache_ptr)->coll_list_len, \ + (cache_ptr)->coll_list_size, \ + (fail_val)) \ + \ +} /* H5C__MOVE_TO_TOP_IN_COLL_LIST */ +#endif /* H5_HAVE_PARALLEL */ + /****************************/ /* Package Private Typedefs */ @@ -3658,6 +3913,14 @@ struct H5C_t { H5C_cache_entry_t * dLRU_head_ptr; H5C_cache_entry_t * dLRU_tail_ptr; +#ifdef H5_HAVE_PARALLEL + int32_t coll_list_len; + size_t coll_list_size; + H5C_cache_entry_t * coll_head_ptr; + H5C_cache_entry_t * coll_tail_ptr; + int32_t num_coll_entries; /* MSC - used only for debugging - should remove usage*/ +#endif /* H5_HAVE_PARALLEL */ + /* Fields for automatic cache size adjustment */ hbool_t size_increase_possible; hbool_t flash_size_increase_possible; diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index a9ffb70..00644b1 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -1532,6 +1532,8 @@ typedef struct H5C_cache_entry_t { hbool_t flush_me_collectively; hbool_t clear_on_unprotect; hbool_t flush_immediately; + hbool_t coll_access; + hbool_t ind_access_while_coll; #endif /* H5_HAVE_PARALLEL */ hbool_t flush_in_progress; hbool_t destroy_in_progress; @@ -1552,6 +1554,8 @@ typedef struct H5C_cache_entry_t { struct H5C_cache_entry_t * prev; struct H5C_cache_entry_t * aux_next; struct H5C_cache_entry_t * aux_prev; + struct H5C_cache_entry_t * coll_next; + struct H5C_cache_entry_t * coll_prev; #if H5C_COLLECT_CACHE_ENTRY_STATS /* cache entry stats fields */ @@ -1918,6 +1922,8 @@ H5_DLL herr_t H5C_apply_candidate_list(H5F_t *f, hid_t dxpl_id, int mpi_rank, int mpi_size); H5_DLL herr_t H5C_construct_candidate_list__clean_cache(H5C_t *cache_ptr); H5_DLL herr_t H5C_construct_candidate_list__min_clean(H5C_t *cache_ptr); +H5_DLL herr_t H5C_clear_coll_entries(H5F_t * f, hid_t dxpl_id, + H5C_t * cache_ptr, hbool_t partial); #endif /* H5_HAVE_PARALLEL */ #ifndef NDEBUG /* debugging functions */ diff --git a/src/H5D.c b/src/H5D.c index f06ec9b..6acec6a 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -154,6 +154,7 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, H5G_loc_t loc; /* Object location to insert dataset into */ H5D_t *dset = NULL; /* New dataset's info */ const H5S_t *space; /* Dataspace for dataset */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -182,15 +183,12 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") - /* Get correct property list */ - if(H5P_DEFAULT == dapl_id) - dapl_id = H5P_DATASET_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(dapl_id, H5P_DATASET_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&dapl_id, H5P_DATASET_ACCESS, H5P_DATASET_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create the new dataset & get its ID */ - if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id, H5AC_dxpl_id))) + if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id, dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset") @@ -246,6 +244,7 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, H5G_loc_t loc; /* Object location to insert dataset into */ H5D_t *dset = NULL; /* New dataset's info */ const H5S_t *space; /* Dataspace for dataset */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -264,15 +263,12 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") - /* Get correct property list */ - if(H5P_DEFAULT == dapl_id) - dapl_id = H5P_DATASET_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(dapl_id, H5P_DATASET_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&dapl_id, H5P_DATASET_ACCESS, H5P_DATASET_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* build and open the new dataset */ - if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id, H5AC_dxpl_id))) + if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id, dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") /* Register the new dataset to get an ID for it */ @@ -289,7 +285,7 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get object location of dataset") /* Decrement refcount on dataset's object header in memory */ - if(H5O_dec_rc_by_loc(oloc, H5AC_dxpl_id) < 0) + if(H5O_dec_rc_by_loc(oloc, dxpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") } /* end if */ @@ -341,12 +337,9 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - /* Get correct property list */ - if(H5P_DEFAULT == dapl_id) - dapl_id = H5P_DATASET_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(dapl_id, H5P_DATASET_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&dapl_id, H5P_DATASET_ACCESS, H5P_DATASET_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up dataset location to fill in */ dset_loc.oloc = &oloc; @@ -383,7 +376,6 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "can't free location") } /* end else */ } /* end if */ - FUNC_LEAVE_API(ret_value) } /* end H5Dopen2() */ @@ -979,10 +971,13 @@ H5Dset_extent(hid_t dset_id, const hsize_t size[]) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified") /* Private function */ - if(H5D__set_extent(dset, size, H5AC_dxpl_id) < 0) + if(H5D__set_extent(dset, size, H5AC_coll_write_coll_read_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set extend dataset") done: FUNC_LEAVE_API(ret_value) } /* end H5Dset_extent() */ + +/* LocalWords: buf + */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index af5123c..ca7bda5 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -45,6 +45,7 @@ /****************/ #define H5D_PACKAGE /*suppress error about including H5Dpkg */ +#define H5F_PACKAGE /*suppress error about including H5Fpkg */ /***********/ @@ -56,6 +57,7 @@ #endif /* H5_HAVE_PARALLEL */ #include "H5Dpkg.h" /* Dataset functions */ #include "H5Eprivate.h" /* Error handling */ +#include "H5Fpkg.h" /* File functions */ #include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ @@ -2497,6 +2499,9 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, /* Check for cached information */ if(!H5D__chunk_cinfo_cache_found(&dset->shared->cache.chunk.last, udata)) { H5D_chk_idx_info_t idx_info; /* Chunked index info */ +#ifdef H5_HAVE_PARALLEL + H5P_coll_md_read_flag_t temp_flag; /* temp flag to hold the coll metadata read setting */ +#endif /* H5_HAVE_PARALLEL */ /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; @@ -2505,10 +2510,27 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, idx_info.layout = &dset->shared->layout.u.chunk; idx_info.storage = &dset->shared->layout.storage.u.chunk; +#ifdef H5_HAVE_PARALLEL + if(H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI)) { + /* disable collective metadata read for chunk indexes + as it is highly unlikely that users would read the + same chunks from all processes. MSC - might turn on + for root node? */ + temp_flag = idx_info.f->coll_md_read; + idx_info.f->coll_md_read = H5P_FORCE_FALSE; + } +#endif /* H5_HAVE_PARALLEL */ + /* Go get the chunk information */ if((dset->shared->layout.storage.u.chunk.ops->get_addr)(&idx_info, udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query chunk address") +#ifdef H5_HAVE_PARALLEL + if(H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI)) { + idx_info.f->coll_md_read = temp_flag; + } +#endif /* H5_HAVE_PARALLEL */ + /* Cache the information retrieved */ H5D__chunk_cinfo_cache_update(&dset->shared->cache.chunk.last, udata); } /* end if */ diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 3da6b95..dd02907 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -189,7 +189,8 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") /* Build and open the new dataset */ - if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, H5P_LINK_CREATE_DEFAULT, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5AC_dxpl_id))) + if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, H5P_LINK_CREATE_DEFAULT, + dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5AC_dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") /* Register the new dataset to get an ID for it */ diff --git a/src/H5F.c b/src/H5F.c index d3b9fc8..f5b8e25 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -477,7 +477,8 @@ hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { H5F_t *new_file = NULL; /*file struct for new file */ - hid_t ret_value; /*return value */ + hid_t dxpl_id; /*dxpl used by library */ + hid_t ret_value; /*return value */ FUNC_ENTER_API(FAIL) H5TRACE4("i", "*sIuii", filename, flags, fcpl_id, fapl_id); @@ -501,12 +502,10 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if(TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file create property list") - /* Check the file access property list */ - if(H5P_DEFAULT == fapl_id) - fapl_id = H5P_FILE_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") + dxpl_id = H5AC_dxpl_id; + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&fapl_id, H5P_FILE_ACCESS, H5P_FILE_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* * Adjust bit flags by turning on the creation bit and making sure that @@ -520,7 +519,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* * Create a new file or truncate an existing file. */ - if(NULL == (new_file = H5F_open(filename, flags, fcpl_id, fapl_id, H5AC_dxpl_id))) + if(NULL == (new_file = H5F_open(filename, flags, fcpl_id, fapl_id, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file") /* Get an atom for the file */ @@ -583,7 +582,8 @@ hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) { H5F_t *new_file = NULL; /*file struct for new file */ - hid_t ret_value; /*return value */ + hid_t dxpl_id; /*dxpl used by library */ + hid_t ret_value; /*return value */ FUNC_ENTER_API(FAIL) H5TRACE3("i", "*sIui", filename, flags, fapl_id); @@ -595,14 +595,14 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) if((flags & ~H5F_ACC_PUBLIC_FLAGS) || (flags & H5F_ACC_TRUNC) || (flags & H5F_ACC_EXCL)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file open flags") - if(H5P_DEFAULT == fapl_id) - fapl_id = H5P_FILE_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") + + dxpl_id = H5AC_dxpl_id; + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&fapl_id, H5P_FILE_ACCESS, H5P_FILE_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the file */ - if(NULL == (new_file = H5F_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id))) + if(NULL == (new_file = H5F_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to open file") /* Get an atom for the file */ diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 5f36d2a..366a247 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -1499,7 +1499,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t dxpl_id, had #endif /* Only look for MPI views for raw data transfers */ - if(type==H5FD_MEM_DRAW) { + if(type == H5FD_MEM_DRAW) { H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */ /* Obtain the data transfer properties */ @@ -1765,6 +1765,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, int size_i; hbool_t use_view_this_time = FALSE; H5P_genplist_t *plist = NULL; /* Property list pointer */ + H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */ herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT @@ -1795,57 +1796,42 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, fprintf(stdout, "in H5FD_mpio_write mpi_off=%ld size_i=%d\n", (long)mpi_off, size_i); #endif - if(type == H5FD_MEM_DRAW) { - H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */ - - /* Obtain the data transfer properties */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + /* Obtain the data transfer properties */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") - /* get the transfer mode from the dxpl */ - if(H5P_get(plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode") + /* get the transfer mode from the dxpl */ + if(H5P_get(plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O transfer mode") - /* - * Set up for a fancy xfer using complex types, or single byte block. We - * wouldn't need to rely on the use_view field if MPI semantics allowed - * us to test that btype=ftype=MPI_BYTE (or even MPI_TYPE_NULL, which - * could mean "use MPI_BYTE" by convention). - */ - if(xfer_mode == H5FD_MPIO_COLLECTIVE) { - MPI_Datatype file_type; + /* + * Set up for a fancy xfer using complex types, or single byte block. We + * wouldn't need to rely on the use_view field if MPI semantics allowed + * us to test that btype=ftype=MPI_BYTE (or even MPI_TYPE_NULL, which + * could mean "use MPI_BYTE" by convention). + */ + if(xfer_mode == H5FD_MPIO_COLLECTIVE) { + MPI_Datatype file_type; - /* Remember that views are used */ - use_view_this_time = TRUE; + /* Remember that views are used */ + use_view_this_time = TRUE; - /* prepare for a full-blown xfer using btype, ftype, and disp */ - if(H5P_get(plist, H5FD_MPI_XFER_MEM_MPI_TYPE_NAME, &buf_type) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") - if(H5P_get(plist, H5FD_MPI_XFER_FILE_MPI_TYPE_NAME, &file_type) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") + /* prepare for a full-blown xfer using btype, ftype, and disp */ + if(H5P_get(plist, H5FD_MPI_XFER_MEM_MPI_TYPE_NAME, &buf_type) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") + if(H5P_get(plist, H5FD_MPI_XFER_FILE_MPI_TYPE_NAME, &file_type) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get MPI-I/O type property") - /* - * Set the file view when we are using MPI derived types - */ - if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(file->f, mpi_off, MPI_BYTE, file_type, H5FD_mpi_native_g, file->info))) - HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) + /* + * Set the file view when we are using MPI derived types + */ + if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(file->f, mpi_off, MPI_BYTE, file_type, H5FD_mpi_native_g, file->info))) + HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) - /* When using types, use the address as the displacement for - * MPI_File_set_view and reset the address for the read to zero - */ - mpi_off = 0; - } /* end if */ - } /* end if */ - else { -#if 0 /* JRM -- 3/23/10 */ /* this is no longer always the case */ - /* Only one process can do the actual metadata write */ - if(file->mpi_rank != H5_PAR_META_WRITE) -#ifdef LATER - HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "can't write metadata from non-zero rank") -#else /* LATER */ - HGOTO_DONE(SUCCEED) /* skip the actual write */ -#endif /* LATER */ -#endif /* JRM */ + /* When using types, use the address as the displacement for + * MPI_File_set_view and reset the address for the read to zero + */ + mpi_off = 0; } /* end if */ /* Write the data. */ @@ -1856,6 +1842,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, if(H5FD_mpio_Debug[(int)'t']) fprintf(stdout, "H5FD_mpio_write: using MPIO collective mode\n"); #endif + /* Get the collective_opt property to check whether the application wants to do IO individually. */ HDassert(plist); /* get the transfer mode from the dxpl */ @@ -1871,6 +1858,8 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at_all failed", mpi_code) } /* end if */ else { + if(type != H5FD_MEM_DRAW) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "Metadata Coll opt property should be collective at this point") #ifdef H5FDmpio_DEBUG if(H5FD_mpio_Debug[(int)'t']) fprintf(stdout, "H5FD_mpio_write: doing MPI independent IO\n"); diff --git a/src/H5Fint.c b/src/H5Fint.c index 0e77349..0cf60b3 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -198,6 +198,10 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) efc_size = H5F_efc_max_nfiles(f->shared->efc); if(H5P_set(new_plist, H5F_ACS_EFC_SIZE_NAME, &efc_size) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set elink file cache size") +#ifdef H5_HAVE_PARALLEL + if(H5P_set(new_plist, H5_COLL_MD_READ_FLAG_NAME, &(f->coll_md_read)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set collective metadata read flag") +#endif /* H5_HAVE_PARALLEL */ /* * Since we're resetting the driver ID and info, close them if they @@ -664,6 +668,10 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t if(efc_size > 0) if(NULL == (f->shared->efc = H5F_efc_create(efc_size))) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't create external file cache") +#ifdef H5_HAVE_PARALLEL + if(H5P_get(plist, H5_COLL_MD_READ_FLAG_NAME, &(f->coll_md_read)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get collective metadata read flag") +#endif /* H5_HAVE_PARALLEL */ /* Get the VFD values to cache */ f->shared->maxaddr = H5FD_get_maxaddr(lf); diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index 39b8dfa..9f7d316 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -77,6 +77,35 @@ #ifdef H5_HAVE_PARALLEL + +/*------------------------------------------------------------------------- + * Function: H5F_get_mpi_handle + * + * Purpose: Retrieves MPI File handle. + * + * Return: Success: The size (positive) + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5F_get_mpi_handle(const H5F_t *f, MPI_File **f_handle) +{ + herr_t ret_value = SUCCEED; + hid_t fapl = -1; + + FUNC_ENTER_NOAPI(FAIL) + + assert(f && f->shared); + + /* Dispatch to driver */ + if ((ret_value = H5FD_get_vfd_handle(f->shared->lf, fapl, (void **)f_handle)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get mpi file handle") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_get_mpi_handle() */ + /*------------------------------------------------------------------------- * Function: H5F_mpi_get_rank diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 175fa88..63708b8 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -311,6 +311,9 @@ struct H5F_t { hbool_t closing; /* File is in the process of being closed */ struct H5F_t *parent; /* Parent file that this file is mounted to */ unsigned nmounts; /* Number of children mounted to this file */ +#ifdef H5_HAVE_PARALLEL + H5P_coll_md_read_flag_t coll_md_read; /* Do all metadata reads collectively */ +#endif /* H5_HAVE_PARALLEL */ }; diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 36d7429..160740a 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -682,6 +682,7 @@ H5_DLL herr_t H5F_super_dirty(H5F_t *f); /* Parallel I/O (i.e. MPI) related routines */ #ifdef H5_HAVE_PARALLEL +H5_DLL herr_t H5F_get_mpi_handle(const H5F_t *f, MPI_File **f_handle); H5_DLL int H5F_mpi_get_rank(const H5F_t *f); H5_DLL MPI_Comm H5F_mpi_get_comm(const H5F_t *f); H5_DLL int H5F_mpi_get_size(const H5F_t *f); diff --git a/src/H5G.c b/src/H5G.c index 8fd65b8..abf64e8 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -277,6 +277,7 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, { H5G_loc_t loc; /* Location to create group */ H5G_t *grp = NULL; /* New group created */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -302,15 +303,12 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, if(TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group create property list") - /* Check the group access property list */ - if(H5P_DEFAULT == gapl_id) - gapl_id = H5P_GROUP_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&gapl_id, H5P_GROUP_ACCESS, H5P_GROUP_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create the new group & get its ID */ - if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id, gapl_id, H5AC_dxpl_id))) + if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id, gapl_id, dxpl_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") @@ -365,6 +363,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) H5G_loc_t loc; H5G_t *grp = NULL; H5G_obj_create_t gcrt_info; /* Information for group creation */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -381,12 +380,9 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) if(TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group create property list") - /* Check the group access property list */ - if(H5P_DEFAULT == gapl_id) - gapl_id = H5P_GROUP_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&gapl_id, H5P_GROUP_ACCESS, H5P_GROUP_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up group creation info */ gcrt_info.gcpl_id = gcpl_id; @@ -394,7 +390,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); /* Create the new group & get its ID */ - if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info, H5AC_dxpl_id))) + if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info, dxpl_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") @@ -409,7 +405,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get object location of group") /* Decrement refcount on group's object header in memory */ - if(H5O_dec_rc_by_loc(oloc, H5AC_dxpl_id) < 0) + if(H5O_dec_rc_by_loc(oloc, dxpl_id) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") } /* end if */ @@ -444,6 +440,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) { H5G_t *grp = NULL; /* Group opened */ H5G_loc_t loc; /* Location of parent for group */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -455,15 +452,12 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - /* Check the group access property list */ - if(H5P_DEFAULT == gapl_id) - gapl_id = H5P_GROUP_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&gapl_id, H5P_GROUP_ACCESS, H5P_GROUP_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the group */ - if((grp = H5G__open_name(&loc, name, gapl_id, H5AC_ind_dxpl_id)) == NULL) + if((grp = H5G__open_name(&loc, name, gapl_id, dxpl_id)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") /* Register an ID for the group */ @@ -677,6 +671,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, H5G_name_t grp_path; /* Opened object group hier. path */ H5O_loc_t grp_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Location at 'name' found */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -689,11 +684,10 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") if(!grp_info) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ grp_loc.oloc = &grp_oloc; @@ -701,12 +695,12 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, H5G_loc_reset(&grp_loc); /* Find the group object */ - if(H5G_loc_find(&loc, name, &grp_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find(&loc, name, &grp_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") loc_found = TRUE; /* Retrieve the group's information */ - if(H5G__obj_info(grp_loc.oloc, grp_info/*out*/, H5AC_ind_dxpl_id) < 0) + if(H5G__obj_info(grp_loc.oloc, grp_info/*out*/, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -740,6 +734,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_name_t grp_path; /* Opened object group hier. path */ H5O_loc_t grp_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -757,11 +752,10 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!grp_info) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ grp_loc.oloc = &grp_oloc; @@ -769,12 +763,13 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_loc_reset(&grp_loc); /* Find the object's location, according to the order in the index */ - if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &grp_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &grp_loc/*out*/, + lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") loc_found = TRUE; /* Retrieve the group's information */ - if(H5G__obj_info(grp_loc.oloc, grp_info/*out*/, H5AC_ind_dxpl_id) < 0) + if(H5G__obj_info(grp_loc.oloc, grp_info/*out*/, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: diff --git a/src/H5L.c b/src/H5L.c index 73d363e..d443b56 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -315,6 +315,7 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, { H5G_loc_t src_loc, *src_loc_p; H5G_loc_t dst_loc, *dst_loc_p; + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -343,9 +344,13 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, else if(dst_loc_id == H5L_SAME_LOC) dst_loc_p = src_loc_p; + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Move the link */ if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id, - lapl_id, H5AC_dxpl_id) < 0) + lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: @@ -373,6 +378,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, { H5G_loc_t src_loc, *src_loc_p; H5G_loc_t dst_loc, *dst_loc_p; + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -401,9 +407,13 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, else if(dst_loc_id == H5L_SAME_LOC) dst_loc_p = src_loc_p; + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Copy the link */ if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, TRUE, lcpl_id, - lapl_id, H5AC_dxpl_id) < 0) + lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: @@ -434,6 +444,7 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id) { H5G_loc_t link_loc; /* Group location for new link */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -449,8 +460,12 @@ H5Lcreate_soft(const char *link_target, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Create the link */ - if(H5L_create_soft(link_target, &link_loc, link_name, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + if(H5L_create_soft(link_target, &link_loc, link_name, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -480,6 +495,7 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, { H5G_loc_t cur_loc, *cur_loc_p; H5G_loc_t new_loc, *new_loc_p; + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -510,9 +526,13 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, else if(cur_loc_p->oloc->file != new_loc_p->oloc->file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should be in the same file.") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Create the link */ if(H5L_create_hard(cur_loc_p, cur_name, new_loc_p, new_name, - lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -549,6 +569,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, const void *udata, size_t udata_size, hid_t lcpl_id, hid_t lapl_id) { H5G_loc_t link_loc; + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -563,8 +584,12 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, if(link_type < H5L_TYPE_UD_MIN || link_type > H5L_TYPE_MAX) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Create external link */ - if(H5L_create_ud(&link_loc, link_name, udata, udata_size, link_type, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + if(H5L_create_ud(&link_loc, link_name, udata, udata_size, link_type, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -593,6 +618,7 @@ herr_t H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; /* Group's location */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -604,8 +630,12 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Unlink */ - if(H5L_delete(&loc, name, lapl_id, H5AC_dxpl_id) < 0) + if(H5L_delete(&loc, name, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: @@ -638,6 +668,7 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, { H5G_loc_t loc; /* Group's location */ H5L_trav_rmbi_t udata; /* User data for callback */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -652,11 +683,10 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for unlink operation */ udata.idx_type = idx_type; @@ -665,7 +695,8 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, udata.dxpl_id = H5AC_dxpl_id; /* Traverse the group hierarchy to remove the link */ - if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK|H5G_TARGET_MOUNT, H5L_delete_by_idx_cb, &udata, lapl_id, H5AC_dxpl_id) < 0) + if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK|H5G_TARGET_MOUNT, + H5L_delete_by_idx_cb, &udata, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist") done: @@ -697,6 +728,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, hid_t lapl_id) { H5G_loc_t loc; /* Group location for location to query */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -707,14 +739,13 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Get the link value */ - if(H5L_get_val(&loc, name, buf, size, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5L_get_val(&loc, name, buf, size, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link value for '%s'", name) done: @@ -747,6 +778,7 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, { H5G_loc_t loc; /* Group location for location to query */ H5L_trav_gvbi_t udata; /* User data for callback */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -762,22 +794,22 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for retrieving information */ udata.idx_type = idx_type; udata.order = order; udata.n = n; - udata.dxpl_id = H5AC_ind_dxpl_id; + udata.dxpl_id = dxpl_id; udata.buf = buf; udata.size = size; /* Traverse the group hierarchy to locate the object to get info about */ - if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L_get_val_by_idx_cb, &udata, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L_get_val_by_idx_cb, + &udata, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist") @@ -803,6 +835,7 @@ htri_t H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ htri_t ret_value; FUNC_ENTER_API(FAIL) @@ -813,14 +846,13 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Check for the existence of the link */ - if((ret_value = H5L_exists(&loc, name, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5L_exists(&loc, name, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") done: @@ -847,6 +879,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, hid_t lapl_id) { H5G_loc_t loc; + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) @@ -857,14 +890,13 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Get the link information */ - if(H5L_get_info(&loc, name, linfo, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5L_get_info(&loc, name, linfo, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") done: @@ -893,6 +925,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, { H5G_loc_t loc; /* Group location for group to query */ H5L_trav_gibi_t udata; /* User data for callback */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -908,21 +941,21 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for callback */ udata.idx_type = idx_type; udata.order = order; udata.n = n; - udata.dxpl_id = H5AC_ind_dxpl_id; + udata.dxpl_id = dxpl_id; udata.linfo = linfo; /* Traverse the group hierarchy to locate the object to get info about */ - if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_get_info_by_idx_cb, &udata, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, + H5L_get_info_by_idx_cb, &udata, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") @@ -1082,6 +1115,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, { H5G_loc_t loc; /* Location of group */ H5L_trav_gnbi_t udata; /* User data for callback */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1097,23 +1131,23 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for callback */ udata.idx_type = idx_type; udata.order = order; udata.n = n; - udata.dxpl_id = H5AC_ind_dxpl_id; + udata.dxpl_id = dxpl_id; udata.name = name; udata.size = size; udata.name_len = -1; /* Traverse the group hierarchy to locate the link to get name of */ - if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_get_name_by_idx_cb, &udata, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, + H5L_get_name_by_idx_cb, &udata, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist") /* Set the return value */ @@ -1179,7 +1213,8 @@ H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, lnk_op.op_func.op_new = op; /* Iterate over the links */ - if((ret_value = H5G_iterate(grp_id, ".", idx_type, order, idx, &last_lnk, &lnk_op, op_data, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_iterate(grp_id, ".", idx_type, order, idx, &last_lnk, &lnk_op, + op_data, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") /* Set the index we stopped at */ @@ -1221,6 +1256,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, H5G_link_iterate_t lnk_op; /* Link operator */ hsize_t last_lnk; /* Index of last object looked at */ hsize_t idx; /* Internal location to hold index */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1236,11 +1272,10 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up iteration beginning/end info */ idx = (idx_p == NULL ? 0 : *idx_p); @@ -1251,7 +1286,8 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, lnk_op.op_func.op_new = op; /* Iterate over the links */ - if((ret_value = H5G_iterate(loc_id, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_iterate(loc_id, group_name, idx_type, order, idx, &last_lnk, &lnk_op, + op_data, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") /* Set the index we stopped at */ @@ -1353,6 +1389,7 @@ herr_t H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data, hid_t lapl_id) { + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1368,14 +1405,13 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Call internal group visitation routine */ - if((ret_value = H5G_visit(loc_id, group_name, idx_type, order, op, op_data, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_visit(loc_id, group_name, idx_type, order, op, op_data, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link visitation failed") done: diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index ae13e6b..78ac6f5 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -553,6 +553,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name, size_t file_name_len; /* Length of file name string */ size_t norm_obj_name_len; /* Length of normalized object name string */ uint8_t *p; /* Pointer into external link buffer */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -587,8 +588,12 @@ H5Lcreate_external(const char *file_name, const char *obj_name, p += file_name_len; HDstrncpy((char *)p, norm_obj_name, buf_size - (file_name_len + 1)); /* External link's object */ + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Create an external link */ - if(H5L_create_ud(&link_loc, link_name, ext_link_buf, buf_size, H5L_TYPE_EXTERNAL, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + if(H5L_create_ud(&link_loc, link_name, ext_link_buf, buf_size, H5L_TYPE_EXTERNAL, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: diff --git a/src/H5O.c b/src/H5O.c index d0ace29..b89636b 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -282,6 +282,7 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_loc_t obj_loc; /* Location used to open group */ H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ hid_t ret_value = FAIL; @@ -297,11 +298,10 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -309,12 +309,12 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_loc_reset(&obj_loc); /* Find the object's location, according to the order in the index */ - if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") loc_found = TRUE; /* Open the object */ - if((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, H5AC_ind_dxpl_id, TRUE)) < 0) + if((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, dxpl_id, TRUE)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") done: @@ -426,6 +426,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, { H5G_loc_t new_loc; H5G_loc_t obj_loc; + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -448,8 +449,12 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Link to the object */ - if(H5L_link(&new_loc, new_name, &obj_loc, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + if(H5L_link(&new_loc, new_name, &obj_loc, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -556,6 +561,7 @@ htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; /* Location info */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) @@ -566,14 +572,13 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Check if the object exists */ - if((ret_value = H5G_loc_exists(&loc, name, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_loc_exists(&loc, name, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name) done: @@ -635,6 +640,7 @@ herr_t H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -647,14 +653,13 @@ H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lap HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") if(!oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Retrieve the object's information */ - if(H5G_loc_info(&loc, name, TRUE, oinfo/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_info(&loc, name, TRUE, oinfo/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") done: @@ -685,6 +690,7 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -702,11 +708,10 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -714,7 +719,7 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_loc_reset(&obj_loc); /* Find the object's location, according to the order in the index */ - if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") loc_found = TRUE; @@ -792,6 +797,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -802,14 +808,13 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* (Re)set the object's comment */ - if(H5G_loc_set_comment(&loc, name, comment, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_set_comment(&loc, name, comment, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") done: @@ -876,6 +881,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -886,14 +892,13 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Retrieve the object's comment */ - if((ret_value = H5G_loc_get_comment(&loc, name, comment/*out*/, bufsize, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_loc_get_comment(&loc, name, comment/*out*/, bufsize, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") done: @@ -995,6 +1000,7 @@ herr_t H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id) { + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1010,14 +1016,13 @@ H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Call internal object visitation routine */ - if((ret_value = H5O_visit(loc_id, obj_name, idx_type, order, op, op_data, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5O_visit(loc_id, obj_name, idx_type, order, op, op_data, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "object visitation failed") done: @@ -1346,7 +1351,7 @@ H5O_open_name(H5G_loc_t *loc, const char *name, hid_t lapl_id, hbool_t app_ref) H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ hid_t ret_value = FAIL; FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index b5bc720..acd30c8 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -168,6 +168,12 @@ #define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_SIZE sizeof(uint32_t) #define H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_DEF 0 +/* Definition for reading metadata collectively */ +#define H5D_XFER_COLL_MD_READ_SIZE sizeof(H5P_coll_md_read_flag_t) +#define H5D_XFER_COLL_MD_READ_DEF H5P_USER_FALSE +#define H5D_XFER_COLL_MD_READ_ENC H5P__encode_coll_md_read_flag_t +#define H5D_XFER_COLL_MD_READ_DEC H5P__decode_coll_md_read_flag_t + /******************/ /* Local Typedefs */ /******************/ @@ -271,6 +277,7 @@ static const hbool_t H5D_def_direct_chunk_flag_g = H5D_XFER_DIRECT_CHUNK_WRITE_F static const uint32_t H5D_def_direct_chunk_filters_g = H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_DEF; /* Default value for the filters of direct chunk write */ static const hsize_t *H5D_def_direct_chunk_offset_g = H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_DEF; /* Default value for the offset of direct chunk write */ static const uint32_t H5D_def_direct_chunk_datasize_g = H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_DEF; /* Default value for the datasize of direct chunk write */ +static const H5P_coll_md_read_flag_t H5D_def_coll_md_read_g = H5D_XFER_COLL_MD_READ_DEF; /* Default setting for the collective metedata read flag */ /*------------------------------------------------------------------------- @@ -465,6 +472,13 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the metadata collective read flag */ + if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5D_XFER_COLL_MD_READ_SIZE, + &H5D_def_coll_md_read_g, + NULL, NULL, NULL, H5D_XFER_COLL_MD_READ_ENC, H5D_XFER_COLL_MD_READ_DEC, + NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__dxfr_reg_prop() */ diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c index bd0a260..bb9f3be 100644 --- a/src/H5Pencdec.c +++ b/src/H5Pencdec.c @@ -793,7 +793,7 @@ H5P__decode(const void *buf) HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "property decoding routine failed, property: '%s'", name) } /* end if */ else - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "no decode callback for property: '%s', name") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "no decode callback for property: '%s'", name) /* Set the value for the property */ if(H5P_set(plist, name, value_buf) < 0) diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 6b3d4ac..de5f8bf 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -170,6 +170,12 @@ #define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEF 524288 #define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_ENC H5P__encode_size_t #define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEC H5P__decode_size_t +/* Definition of collective metadata read mode flag */ +#define H5F_ACS_COLL_MD_READ_FLAG_SIZE sizeof(H5P_coll_md_read_flag_t) +#define H5F_ACS_COLL_MD_READ_FLAG_DEF H5P_USER_FALSE +#define H5F_ACS_COLL_MD_READ_FLAG_ENC H5P__encode_coll_md_read_flag_t +#define H5F_ACS_COLL_MD_READ_FLAG_DEC H5P__decode_coll_md_read_flag_t + /******************/ /* Local Typedefs */ @@ -261,6 +267,7 @@ static const unsigned H5F_def_efc_size_g = H5F_ACS_EFC_SIZE_DEF; static const H5FD_file_image_info_t H5F_def_file_image_info_g = H5F_ACS_FILE_IMAGE_INFO_DEF; /* Default file image info and callbacks */ static const hbool_t H5F_def_core_write_tracking_flag_g = H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEF; /* Default setting for core VFD write tracking */ static const size_t H5F_def_core_write_tracking_page_size_g = H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEF; /* Default core VFD write tracking page size */ +static const H5P_coll_md_read_flag_t H5F_def_coll_md_read_flag_g = H5F_ACS_COLL_MD_READ_FLAG_DEF; /* Default setting for the collective metedata read flag */ /*------------------------------------------------------------------------- @@ -422,6 +429,13 @@ H5P_facc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the metadata collective read flag */ + if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5F_ACS_COLL_MD_READ_FLAG_SIZE, + &H5F_def_coll_md_read_flag_g, + NULL, NULL, NULL, H5F_ACS_COLL_MD_READ_FLAG_ENC, H5F_ACS_COLL_MD_READ_FLAG_DEC, + NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_facc_reg_prop() */ @@ -3083,3 +3097,166 @@ done: FUNC_LEAVE_API(ret_value) } + +/*------------------------------------------------------------------------- + * Function: H5P__encode_coll_md_read_flag_t + * + * Purpose: Generic encoding callback routine for 'coll_md_read_flag' properties. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * + *------------------------------------------------------------------------- + */ +herr_t +H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size) +{ + const H5P_coll_md_read_flag_t *coll_md_read_flag = (const H5P_coll_md_read_flag_t *)value; + uint8_t **pp = (uint8_t **)_pp; + + FUNC_ENTER_PACKAGE_NOERR + + /* Sanity checks */ + HDassert(coll_md_read_flag); + HDassert(size); + + if(NULL != *pp) { + /* Encode the value */ + HDmemcpy(*pp, coll_md_read_flag, sizeof(H5P_coll_md_read_flag_t)); + *pp += sizeof(H5P_coll_md_read_flag_t); + } /* end if */ + + /* Set size needed for encoding */ + *size += sizeof(H5P_coll_md_read_flag_t); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__encode_coll_md_read_flag_t() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__decode_coll_md_read_flag_t + * + * Purpose: Generic decoding callback routine for 'coll_md_read_flag' properties. + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * + *------------------------------------------------------------------------- + */ +herr_t +H5P__decode_coll_md_read_flag_t(const void **_pp, void *_value) +{ + H5P_coll_md_read_flag_t *coll_md_read_flag = (H5P_coll_md_read_flag_t *)_value; /* File close degree */ + const uint8_t **pp = (const uint8_t **)_pp; + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(pp); + HDassert(*pp); + HDassert(coll_md_read_flag); + + /* Decode file close degree */ + *coll_md_read_flag = (H5P_coll_md_read_flag_t)*(*pp); + *pp += sizeof(H5P_coll_md_read_flag_t); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__decode_coll_md_read_flag_t() */ + +#ifdef H5_HAVE_PARALLEL + +/*------------------------------------------------------------------------- + * Function: H5Pset_coll_metadata_read + * + * Purpose: Tell the library whether the metadata read operations will + * be done collectively (1) or not (0). Default is independent. With + * collective mode, the library will optimize access to metdata + * operations on the file. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_coll_metadata_read(hid_t plist_id, hbool_t is_collective) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ib", plist_id, is_collective); + + /* Compare the property list's class against the other class */ + if(TRUE != H5P_isa_class(plist_id, H5P_LINK_ACCESS) && + TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS) && + TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist") + + /* set property to either TRUE if > 0, or FALSE otherwise */ + if(is_collective > 0) + is_collective = TRUE; + else + is_collective = FALSE; + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Set values */ + if(H5P_set(plist, H5_COLL_MD_READ_FLAG_NAME, &is_collective) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set collective metadata read flag") + +done: + FUNC_LEAVE_API(ret_value) +} /* H5Pset_coll_metadata_read */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_coll_metadata_read + * + * Purpose: Gets information about collective metadata read mode. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_coll_metadata_read(hid_t plist_id, hbool_t *is_collective) +{ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*b", plist_id, is_collective); + + /* Compare the property list's class against the other class */ + if(TRUE != H5P_isa_class(plist_id, H5P_LINK_ACCESS) && + TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS) && + TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist") + + /* Get value */ + if(is_collective) { + H5P_coll_md_read_flag_t internal_flag; /* property setting. we need to convert to either TRUE or FALSE */ + H5P_genplist_t *plist; /* Property list pointer */ + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + if(H5P_get(plist, H5_COLL_MD_READ_FLAG_NAME, &internal_flag) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get core collective metadata read flag") + + if(internal_flag < 0) + *is_collective = FALSE; + else + *is_collective = (hbool_t)internal_flag; + } /* end if */ + +done: + FUNC_LEAVE_API(ret_value) +} /* H5Pget_coll_metadata_read */ +#endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5Pint.c b/src/H5Pint.c index e25b686..50a9b2e 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -32,6 +32,7 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free lists */ #include "H5Iprivate.h" /* IDs */ @@ -124,6 +125,8 @@ hid_t H5P_CLS_DATATYPE_ACCESS_ID_g = FAIL; H5P_genclass_t *H5P_CLS_DATATYPE_ACCESS_g = NULL; hid_t H5P_CLS_ATTRIBUTE_CREATE_ID_g = FAIL; H5P_genclass_t *H5P_CLS_ATTRIBUTE_CREATE_g = NULL; +hid_t H5P_CLS_ATTRIBUTE_ACCESS_ID_g = FAIL; +H5P_genclass_t *H5P_CLS_ATTRIBUTE_ACCESS_g = NULL; hid_t H5P_CLS_OBJECT_COPY_ID_g = FAIL; H5P_genclass_t *H5P_CLS_OBJECT_COPY_g = NULL; hid_t H5P_CLS_LINK_CREATE_ID_g = FAIL; @@ -148,6 +151,7 @@ hid_t H5P_LST_GROUP_ACCESS_ID_g = FAIL; hid_t H5P_LST_DATATYPE_CREATE_ID_g = FAIL; hid_t H5P_LST_DATATYPE_ACCESS_ID_g = FAIL; hid_t H5P_LST_ATTRIBUTE_CREATE_ID_g = FAIL; +hid_t H5P_LST_ATTRIBUTE_ACCESS_ID_g = FAIL; hid_t H5P_LST_OBJECT_COPY_ID_g = FAIL; hid_t H5P_LST_LINK_CREATE_ID_g = FAIL; hid_t H5P_LST_LINK_ACCESS_ID_g = FAIL; @@ -171,6 +175,26 @@ const H5P_libclass_t H5P_CLS_ROOT[1] = {{ NULL /* Class close callback info */ }}; +/* Attribute access property list class library initialization object */ +/* (move to proper source code file when used for real) */ +const H5P_libclass_t H5P_CLS_AACC[1] = {{ + "attribute access", /* Class name for debugging */ + H5P_TYPE_ATTRIBUTE_ACCESS, /* Class type */ + + &H5P_CLS_LINK_ACCESS_g, /* Parent class */ + &H5P_CLS_ATTRIBUTE_ACCESS_g, /* Pointer to class */ + &H5P_CLS_ATTRIBUTE_ACCESS_ID_g, /* Pointer to class ID */ + &H5P_LST_ATTRIBUTE_ACCESS_ID_g, /* Pointer to default property list ID */ + NULL, /* Default property registration routine */ + + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ +}}; + /* Group access property list class library initialization object */ /* (move to proper source code file when used for real) */ const H5P_libclass_t H5P_CLS_GACC[1] = {{ @@ -282,6 +306,7 @@ static H5P_libclass_t const * const init_class[] = { H5P_CLS_TCRT, /* Datatype creation */ H5P_CLS_TACC, /* Datatype access */ H5P_CLS_ACRT, /* Attribute creation */ + H5P_CLS_AACC, /* Attribute access */ H5P_CLS_LCRT /* Link creation */ }; @@ -544,6 +569,7 @@ H5P_term_interface(void) H5P_LST_DATATYPE_CREATE_ID_g = H5P_LST_DATATYPE_ACCESS_ID_g = H5P_LST_ATTRIBUTE_CREATE_ID_g = + H5P_LST_ATTRIBUTE_ACCESS_ID_g = H5P_LST_OBJECT_COPY_ID_g = H5P_LST_LINK_CREATE_ID_g = H5P_LST_LINK_ACCESS_ID_g = @@ -570,6 +596,7 @@ H5P_term_interface(void) H5P_CLS_DATATYPE_ACCESS_g = H5P_CLS_STRING_CREATE_g = H5P_CLS_ATTRIBUTE_CREATE_g = + H5P_CLS_ATTRIBUTE_ACCESS_g = H5P_CLS_OBJECT_COPY_g = H5P_CLS_LINK_CREATE_g = H5P_CLS_LINK_ACCESS_g = @@ -588,6 +615,7 @@ H5P_term_interface(void) H5P_CLS_DATATYPE_ACCESS_ID_g = H5P_CLS_STRING_CREATE_ID_g = H5P_CLS_ATTRIBUTE_CREATE_ID_g = + H5P_CLS_ATTRIBUTE_ACCESS_ID_g = H5P_CLS_OBJECT_COPY_ID_g = H5P_CLS_LINK_CREATE_ID_g = H5P_CLS_LINK_ACCESS_ID_g = @@ -1180,7 +1208,7 @@ H5P__find_prop_plist(const H5P_genplist_t *plist, const char *name) /* Check if the property has been deleted from list */ if(H5SL_search(plist->del,name) != NULL) { - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "can't find property in skip list") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "property deleted from skip list") } /* end if */ else { /* Get the property data from the skip list */ @@ -5015,7 +5043,7 @@ H5P__new_plist_of_type(H5P_plist_type_t type) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDcompile_assert(H5P_TYPE_LINK_ACCESS == (H5P_TYPE_MAX_TYPE - 1)); + HDcompile_assert(H5P_TYPE_ATTRIBUTE_ACCESS == (H5P_TYPE_MAX_TYPE - 1)); HDassert(type >= H5P_TYPE_USER && type <= H5P_TYPE_LINK_ACCESS); /* Check arguments */ @@ -5078,6 +5106,10 @@ H5P__new_plist_of_type(H5P_plist_type_t type) class_id = H5P_CLS_ATTRIBUTE_CREATE_ID_g; break; + case H5P_TYPE_ATTRIBUTE_ACCESS: + class_id = H5P_CLS_ATTRIBUTE_ACCESS_ID_g; + break; + case H5P_TYPE_OBJECT_COPY: class_id = H5P_CLS_OBJECT_COPY_ID_g; break; @@ -5165,3 +5197,39 @@ H5P_get_class(const H5P_genplist_t *plist) FUNC_LEAVE_NOAPI(plist->pclass) } /* end H5P_get_class() */ +herr_t +H5P_verify_and_set_dxpl(hid_t *acspl_id, hid_t pclass_id, hid_t default_id, hid_t *dxpl_id) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(acspl_id); + + /* Check the access property list */ + if(H5P_DEFAULT == *acspl_id) + *acspl_id = default_id; + + if(TRUE != H5P_isa_class(*acspl_id, pclass_id)) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Not the required access property list") + + if(dxpl_id) { + H5P_coll_md_read_flag_t is_collective; + H5P_genplist_t *plist; /* Property list pointer */ + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(*acspl_id, H5I_GENPROP_LST))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + if(H5P_get(plist, H5_COLL_MD_READ_FLAG_NAME, &is_collective) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get core collective metadata read flag") + + if(TRUE == is_collective && *dxpl_id == H5AC_dxpl_id) + *dxpl_id = H5AC_coll_write_coll_read_dxpl_id; + else if(TRUE == is_collective && *dxpl_id == H5AC_ind_dxpl_id) + *dxpl_id = H5AC_ind_write_coll_read_dxpl_id; + } + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_verify_and_set_dxpl */ diff --git a/src/H5Plapl.c b/src/H5Plapl.c index e3b3c4f..ed81acb 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -82,6 +82,11 @@ #define H5L_ACS_ELINK_CB_SIZE sizeof(H5L_elink_cb_t) #define H5L_ACS_ELINK_CB_DEF {NULL,NULL} +/* Definition for reading metadata collectively */ +#define H5L_ACS_COLL_MD_READ_SIZE sizeof(H5P_coll_md_read_flag_t) +#define H5L_ACS_COLL_MD_READ_DEF H5P_USER_FALSE +#define H5L_ACS_COLL_MD_READ_ENC H5P__encode_coll_md_read_flag_t +#define H5L_ACS_COLL_MD_READ_DEC H5P__decode_coll_md_read_flag_t /******************/ /* Local Typedefs */ @@ -154,7 +159,7 @@ static const char *H5L_def_elink_prefix_g = H5L_ACS_ELINK_PREFIX_DEF; /* Default static const hid_t H5L_def_fapl_id_g = H5L_ACS_ELINK_FAPL_DEF; /* Default fapl for external link access */ static const unsigned H5L_def_elink_flags_g = H5L_ACS_ELINK_FLAGS_DEF; /* Default file access flags for external link traversal */ static const H5L_elink_cb_t H5L_def_elink_cb_g = H5L_ACS_ELINK_CB_DEF; /* Default external link traversal callback */ - +static const H5P_coll_md_read_flag_t H5L_def_coll_md_read_g = H5L_ACS_COLL_MD_READ_DEF; /* Default setting for the collective metedata read flag */ /*------------------------------------------------------------------------- @@ -210,6 +215,13 @@ H5P_lacc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the metadata collective read flag */ + if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5L_ACS_COLL_MD_READ_SIZE, + &H5L_def_coll_md_read_g, + NULL, NULL, NULL, H5L_ACS_COLL_MD_READ_ENC, H5L_ACS_COLL_MD_READ_DEC, + NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_lacc_reg_prop() */ @@ -1172,5 +1184,3 @@ H5Pget_elink_cb(hid_t lapl_id, H5L_elink_traverse_t *func, void **op_data) done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_elink_cb() */ - - diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index 2942a4d..1bf4465 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -221,6 +221,8 @@ H5_DLL herr_t H5P__decode_unsigned(const void **_pp, void *value); H5_DLL herr_t H5P__decode_uint8_t(const void **_pp, void *value); H5_DLL herr_t H5P__decode_hbool_t(const void **_pp, void *value); H5_DLL herr_t H5P__decode_double(const void **_pp, void *value); +H5_DLL herr_t H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size); +H5_DLL herr_t H5P__decode_coll_md_read_flag_t(const void **_pp, void *value); /* Private OCPL routines */ H5_DLL herr_t H5P_get_filter(const struct H5Z_filter_info_t *filter, diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 7233818..81e1f40 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -46,6 +46,14 @@ /* Library Private Typedefs */ /****************************/ +#define H5_COLL_MD_READ_FLAG_NAME "collective_metadata_read" + +typedef enum H5P_coll_md_read_flag_t { + H5P_FORCE_FALSE = -1, + H5P_USER_FALSE = 0, + H5P_USER_TRUE = 1 +} H5P_coll_md_read_flag_t; + /* Forward declarations (for prototypes & type definitions) */ struct H5O_fill_t; struct H5T_t; @@ -73,6 +81,7 @@ typedef enum H5P_plist_type_t { H5P_TYPE_OBJECT_COPY = 15, H5P_TYPE_LINK_CREATE = 16, H5P_TYPE_LINK_ACCESS = 17, + H5P_TYPE_ATTRIBUTE_ACCESS = 18, H5P_TYPE_MAX_TYPE } H5P_plist_type_t; @@ -94,6 +103,7 @@ H5_DLLVAR H5P_genclass_t *H5P_CLS_GROUP_ACCESS_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_DATATYPE_CREATE_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_DATATYPE_ACCESS_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_ATTRIBUTE_CREATE_g; +H5_DLLVAR H5P_genclass_t *H5P_CLS_ATTRIBUTE_ACCESS_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_OBJECT_COPY_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_LINK_CREATE_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_LINK_ACCESS_g; @@ -162,5 +172,6 @@ H5_DLL herr_t H5P_fill_value_defined(H5P_genplist_t *plist, H5_DLL herr_t H5P_get_fill_value(H5P_genplist_t *plist, const struct H5T_t *type, void *value, hid_t dxpl_id); +H5_DLL herr_t H5P_verify_and_set_dxpl(hid_t *acspl_id, hid_t pclass_id, hid_t default_id, hid_t *dxpl_id); #endif /* _H5Pprivate_H */ diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index f56692c..84fa243 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -66,6 +66,7 @@ #define H5P_DATATYPE_ACCESS (H5OPEN H5P_CLS_DATATYPE_ACCESS_ID_g) #define H5P_STRING_CREATE (H5OPEN H5P_CLS_STRING_CREATE_ID_g) #define H5P_ATTRIBUTE_CREATE (H5OPEN H5P_CLS_ATTRIBUTE_CREATE_ID_g) +#define H5P_ATTRIBUTE_ACCESS (H5OPEN H5P_CLS_ATTRIBUTE_ACCESS_ID_g) #define H5P_OBJECT_COPY (H5OPEN H5P_CLS_OBJECT_COPY_ID_g) #define H5P_LINK_CREATE (H5OPEN H5P_CLS_LINK_CREATE_ID_g) #define H5P_LINK_ACCESS (H5OPEN H5P_CLS_LINK_ACCESS_ID_g) @@ -84,6 +85,7 @@ #define H5P_DATATYPE_CREATE_DEFAULT (H5OPEN H5P_LST_DATATYPE_CREATE_ID_g) #define H5P_DATATYPE_ACCESS_DEFAULT (H5OPEN H5P_LST_DATATYPE_ACCESS_ID_g) #define H5P_ATTRIBUTE_CREATE_DEFAULT (H5OPEN H5P_LST_ATTRIBUTE_CREATE_ID_g) +#define H5P_ATTRIBUTE_ACCESS_DEFAULT (H5OPEN H5P_LST_ATTRIBUTE_ACCESS_ID_g) #define H5P_OBJECT_COPY_DEFAULT (H5OPEN H5P_LST_OBJECT_COPY_ID_g) #define H5P_LINK_CREATE_DEFAULT (H5OPEN H5P_LST_LINK_CREATE_ID_g) #define H5P_LINK_ACCESS_DEFAULT (H5OPEN H5P_LST_LINK_ACCESS_ID_g) @@ -189,6 +191,7 @@ H5_DLLVAR hid_t H5P_CLS_DATATYPE_CREATE_ID_g; H5_DLLVAR hid_t H5P_CLS_DATATYPE_ACCESS_ID_g; H5_DLLVAR hid_t H5P_CLS_STRING_CREATE_ID_g; H5_DLLVAR hid_t H5P_CLS_ATTRIBUTE_CREATE_ID_g; +H5_DLLVAR hid_t H5P_CLS_ATTRIBUTE_ACCESS_ID_g; H5_DLLVAR hid_t H5P_CLS_OBJECT_COPY_ID_g; H5_DLLVAR hid_t H5P_CLS_LINK_CREATE_ID_g; H5_DLLVAR hid_t H5P_CLS_LINK_ACCESS_ID_g; @@ -206,6 +209,7 @@ H5_DLLVAR hid_t H5P_LST_GROUP_ACCESS_ID_g; H5_DLLVAR hid_t H5P_LST_DATATYPE_CREATE_ID_g; H5_DLLVAR hid_t H5P_LST_DATATYPE_ACCESS_ID_g; H5_DLLVAR hid_t H5P_LST_ATTRIBUTE_CREATE_ID_g; +H5_DLLVAR hid_t H5P_LST_ATTRIBUTE_ACCESS_ID_g; H5_DLLVAR hid_t H5P_LST_OBJECT_COPY_ID_g; H5_DLLVAR hid_t H5P_LST_LINK_CREATE_ID_g; H5_DLLVAR hid_t H5P_LST_LINK_ACCESS_ID_g; @@ -348,6 +352,10 @@ H5_DLL herr_t H5Pget_file_image_callbacks(hid_t fapl_id, H5_DLL herr_t H5Pset_core_write_tracking(hid_t fapl_id, hbool_t is_enabled, size_t page_size); H5_DLL herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, size_t *page_size); +#ifdef H5_HAVE_PARALLEL +H5_DLL herr_t H5Pset_coll_metadata_read(hid_t plist_id, hbool_t is_collective); +H5_DLL herr_t H5Pget_coll_metadata_read(hid_t plist_id, hbool_t *is_collective); +#endif /* H5_HAVE_PARALLEL */ /* Dataset creation property list (DCPL) routines */ H5_DLL herr_t H5Pset_layout(hid_t plist_id, H5D_layout_t layout); diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 024cc83..7508dbb 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -124,6 +124,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, { H5G_loc_t loc; /* Location to create datatype */ H5T_t *type; /* Datatype for ID */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -151,15 +152,12 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, if(TRUE != H5P_isa_class(tcpl_id, H5P_DATATYPE_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list") - /* Get correct property list */ - if(H5P_DEFAULT == tapl_id) - tapl_id = H5P_DATATYPE_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(tapl_id, H5P_DATATYPE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&tapl_id, H5P_DATATYPE_ACCESS, H5P_DATATYPE_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Commit the type */ - if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id, tapl_id, H5AC_dxpl_id) < 0) + if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id, tapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") done: @@ -273,6 +271,7 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) { H5G_loc_t loc; /* Group location for location */ H5T_t *type = NULL; /* Datatype created */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -291,15 +290,12 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) if(TRUE != H5P_isa_class(tcpl_id, H5P_DATATYPE_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list") - /* Get correct property list */ - if(H5P_DEFAULT == tapl_id) - tapl_id = H5P_DATATYPE_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(tapl_id, H5P_DATATYPE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&tapl_id, H5P_DATATYPE_ACCESS, H5P_DATATYPE_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Commit the type */ - if(H5T__commit(loc.oloc->file, type, tcpl_id, H5AC_dxpl_id) < 0) + if(H5T__commit(loc.oloc->file, type, tcpl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") /* Release the datatype's object header */ @@ -311,7 +307,7 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get object location of committed datatype") /* Decrement refcount on committed datatype's object header in memory */ - if(H5O_dec_rc_by_loc(oloc, H5AC_dxpl_id) < 0) + if(H5O_dec_rc_by_loc(oloc, dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") } /* end if */ @@ -570,12 +566,9 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - /* Get correct property list */ - if(H5P_DEFAULT == tapl_id) - tapl_id = H5P_DATATYPE_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(tapl_id, H5P_DATATYPE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_and_set_dxpl(&tapl_id, H5P_DATATYPE_ACCESS, H5P_DATATYPE_ACCESS_DEFAULT, &dxpl_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up datatype location to fill in */ type_loc.oloc = &oloc; diff --git a/src/Makefile.in b/src/Makefile.in index f546f2f..6dcba84 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -723,7 +723,7 @@ CHECK_CLEANFILES = *.chkexe *.chklog *.clog *.clog2 # After making changes, run bin/reconfigure to update other configure related # files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 212 +LT_VERS_REVISION = 211 LT_VERS_AGE = 0 # Our main target, the HDF5 library diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 18140ad..eb73fc3 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -7145,6 +7145,269 @@ trace_file_check(int metadata_write_strategy) /***************************************************************************** * + * Function: smoke_check_6() + * + * Purpose: Sixth smoke check for the parallel cache. + * + * Use random reads to vary the loads on the diffferent + * processors. Also force different cache size adjustments. + * + * In this test, load process 0 heavily, and the other + * processes lightly. + * + * Return: Success: TRUE + * + * Failure: FALSE + * + * Programmer: JRM -- 1/13/06 + * + *****************************************************************************/ +static hbool_t +smoke_check_6(int metadata_write_strategy) +{ + hbool_t success = TRUE; + int i; + int max_nerrors; + int min_count; + int max_count; + int min_idx; + int max_idx; + hid_t fid = -1; + H5F_t * file_ptr = NULL; + H5C_t * cache_ptr = NULL; + struct mssg_t mssg; + + switch ( metadata_write_strategy ) { + + case H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY: + if ( world_mpi_rank == 0 ) { + TESTING("smoke check #6 -- process 0 only md write strategy"); + } + break; + + case H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED: + if ( world_mpi_rank == 0 ) { + TESTING("smoke check #6 -- distributed md write strategy"); + } + break; + + default: + if ( world_mpi_rank == 0 ) { + TESTING("smoke check #6 -- unknown md write strategy"); + } + break; + } + + nerrors = 0; + init_data(); + reset_stats(); + + if ( world_mpi_rank == world_server_mpi_rank ) { + + if ( ! server_main() ) { + + /* some error occured in the server -- report failure */ + nerrors++; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: server_main() failed.\n", + world_mpi_rank, FUNC); + } + } + } + else /* run the clients */ + { + int temp; + + if ( ! setup_cache_for_test(&fid, &file_ptr, &cache_ptr, + metadata_write_strategy) ) { + + nerrors++; + fid = -1; + cache_ptr = NULL; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: setup_cache_for_test() failed.\n", + world_mpi_rank, FUNC); + } + } + + min_count = 100 / ((file_mpi_rank + 1) * (file_mpi_rank + 1)); + max_count = min_count + 50; + + temp = virt_num_data_entries; + virt_num_data_entries = NUM_DATA_ENTRIES; + + /* insert the first half collectively */ + file_ptr->coll_md_read = H5P_USER_TRUE; + for ( i = 0; i < virt_num_data_entries/2; i++ ) + { + struct datum * entry_ptr; + entry_ptr = &(data[i]); + + insert_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET); + + if(TRUE != entry_ptr->header.coll_access) { + nerrors++; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: Entry inserted not marked as collective.\n", + world_mpi_rank, FUNC); + } + } + + /* Make sure coll entries do not cross the 80% threshold */ + HDassert(cache_ptr->max_cache_size*0.8 > cache_ptr->coll_list_size); + } + + /* insert the other half independently */ + file_ptr->coll_md_read = H5P_USER_FALSE; + for ( i = virt_num_data_entries/2; i < virt_num_data_entries; i++ ) + { + struct datum * entry_ptr; + entry_ptr = &(data[i]); + + insert_entry(cache_ptr, file_ptr, i, H5AC__NO_FLAGS_SET); + + if(FALSE != entry_ptr->header.coll_access) { + nerrors++; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: Entry inserted indepedently marked as collective.\n", + world_mpi_rank, FUNC); + } + } + + /* Make sure coll entries do not cross the 80% threshold */ + HDassert(cache_ptr->max_cache_size*0.8 > cache_ptr->coll_list_size); + } + + /* flush the file */ + if ( H5Fflush(fid, H5F_SCOPE_GLOBAL) < 0 ) { + nerrors++; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: H5Fflush() failed.\n", + world_mpi_rank, FUNC); + } + } + + /* Protect the first half of the entries collectively */ + file_ptr->coll_md_read = H5P_USER_TRUE; + for ( i = 0; i < (virt_num_data_entries / 2); i++ ) + { + struct datum * entry_ptr; + entry_ptr = &(data[i]); + + lock_entry(file_ptr, i); + + if(TRUE != entry_ptr->header.coll_access) { + nerrors++; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: Entry protected not marked as collective.\n", + world_mpi_rank, FUNC); + } + } + + /* Make sure coll entries do not cross the 80% threshold */ + HDassert(cache_ptr->max_cache_size*0.8 > cache_ptr->coll_list_size); + } + + /* protect the other half independently */ + file_ptr->coll_md_read = H5P_USER_FALSE; + for ( i = virt_num_data_entries/2; i < virt_num_data_entries; i++ ) + { + struct datum * entry_ptr; + entry_ptr = &(data[i]); + + lock_entry(file_ptr, i); + + if(FALSE != entry_ptr->header.coll_access) { + nerrors++; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: Entry inserted indepedently marked as collective.\n", + world_mpi_rank, FUNC); + } + } + + /* Make sure coll entries do not cross the 80% threshold */ + HDassert(cache_ptr->max_cache_size*0.8 > cache_ptr->coll_list_size); + } + + for ( i = 0; i < (virt_num_data_entries); i++ ) + { + unlock_entry(file_ptr, i, H5AC__NO_FLAGS_SET); + } + + if ( fid >= 0 ) { + + if ( ! take_down_cache(fid) ) { + + nerrors++; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: take_down_cache() failed.\n", + world_mpi_rank, FUNC); + } + } + } + + /* verify that all instances of datum are back where the started + * and are clean. + */ + + for ( i = 0; i < NUM_DATA_ENTRIES; i++ ) + { + HDassert( data_index[i] == i ); + HDassert( ! (data[i].dirty) ); + } + + /* compose the done message */ + mssg.req = DONE_REQ_CODE; + mssg.src = world_mpi_rank; + mssg.dest = world_server_mpi_rank; + mssg.mssg_num = -1; /* set by send function */ + mssg.base_addr = 0; /* not used */ + mssg.len = 0; /* not used */ + mssg.ver = 0; /* not used */ + mssg.count = 0; /* not used */ + mssg.magic = MSSG_MAGIC; + + if ( success ) { + + + success = send_mssg(&mssg, FALSE); + + if ( ! success ) { + + nerrors++; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: send_mssg() failed on done.\n", + world_mpi_rank, FUNC); + } + } + } + virt_num_data_entries = temp; + } + + max_nerrors = get_max_nerrors(); + + if ( world_mpi_rank == 0 ) { + + if ( max_nerrors == 0 ) { + + PASSED(); + + } else { + + failures++; + H5_FAILED(); + } + } + + success = ( ( success ) && ( max_nerrors == 0 ) ); + + return(success); + +} /* smoke_check_6() */ + + +/***************************************************************************** + * * Function: main() * * Purpose: Main function for the parallel cache test. @@ -7250,6 +7513,15 @@ main(int argc, char **argv) } } + if ( H5Pset_coll_metadata_read(fapl, 1) < 0 ) { + + nerrors++; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: H5Pset_coll_metadata_read() failed 1.\n", + world_mpi_rank, FUNC); + } + } + /* fix the file names */ for ( u = 0; u < sizeof(FILENAME) / sizeof(FILENAME[0]) - 1; ++u ) { @@ -7294,6 +7566,14 @@ main(int argc, char **argv) world_mpi_rank, FUNC); } } + if ( H5Pset_coll_metadata_read(fapl, 1) < 0 ) { + + nerrors++; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: H5Pset_coll_metadata_read() failed 1.\n", + world_mpi_rank, FUNC); + } + } } setup_rand(); @@ -7315,6 +7595,7 @@ main(int argc, char **argv) #if 1 server_smoke_check(); #endif + #if 1 smoke_check_1(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); smoke_check_1(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -7323,6 +7604,18 @@ main(int argc, char **argv) smoke_check_2(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); smoke_check_2(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); #endif + /* MSC - smoke check 3 and 4 do independent reads, so we disable + the collective metadata read property here */ + if ( world_mpi_rank != world_server_mpi_rank ) { + if ( H5Pset_coll_metadata_read(fapl, 0) < 0 ) { + + nerrors++; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: H5Pset_coll_metadata_read() failed 1.\n", + world_mpi_rank, FUNC); + } + } + } #if 1 smoke_check_3(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); smoke_check_3(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -7331,10 +7624,27 @@ main(int argc, char **argv) smoke_check_4(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); smoke_check_4(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); #endif + /* re-enable the collective metadata read property */ + if ( world_mpi_rank != world_server_mpi_rank ) { + if ( H5Pset_coll_metadata_read(fapl, 0) < 0 ) { + + nerrors++; + if ( verbose ) { + HDfprintf(stdout, "%d:%s: H5Pset_coll_metadata_read() failed 1.\n", + world_mpi_rank, FUNC); + } + } + } #if 1 smoke_check_5(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); smoke_check_5(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); #endif + +#if 1 + smoke_check_6(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); + smoke_check_6(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); +#endif + #if 1 trace_file_check(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); trace_file_check(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -7368,4 +7678,3 @@ finish: /* cannot just return (failures) because exit code is limited to 1byte */ return(failures != 0); } - diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index f294b93..f718f5b 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -888,6 +888,7 @@ void independent_group_read(void) MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); + H5Pset_coll_metadata_read(plist, 0); fid = H5Fopen(filename, H5F_ACC_RDONLY, plist); H5Pclose(plist); diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c index 9088470..24e88b0 100644 --- a/testpar/t_shapesame.c +++ b/testpar/t_shapesame.c @@ -4948,6 +4948,8 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) /* set Parallel access with communicator */ ret = H5Pset_fapl_mpio(ret_pl, comm, info); VRFY((ret >= 0), ""); + ret = H5Pset_coll_metadata_read(ret_pl, 1); + VRFY((ret >= 0), ""); return(ret_pl); } diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index c3da73f..e2615b0 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -272,6 +272,8 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) /* set Parallel access with communicator */ ret = H5Pset_fapl_mpio(ret_pl, comm, info); VRFY((ret >= 0), ""); + ret = H5Pset_coll_metadata_read(ret_pl, 1); + VRFY((ret >= 0), ""); return(ret_pl); } -- cgit v0.12 From f56008e0fe0c6bce99205911d05dd4396baf6952 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Mon, 22 Jun 2015 10:54:43 -0500 Subject: [svn-r27264] some cleanups. --- src/H5AC.c | 6 +++--- src/H5C.c | 48 +++++++++++++----------------------------------- src/H5Cpkg.h | 7 ------- src/H5Cprivate.h | 3 +-- testpar/t_cache.c | 7 +------ 5 files changed, 18 insertions(+), 53 deletions(-) diff --git a/src/H5AC.c b/src/H5AC.c index 446e58c..aa35ed8 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -617,7 +617,7 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id) #ifdef H5_HAVE_PARALLEL /* destroying the cache, so clear all collective entries */ - if(H5C_clear_coll_entries(f, dxpl_id, f->shared->cache, 0) < 0) + if(H5C_clear_coll_entries(f->shared->cache, 0) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") aux_ptr = (struct H5AC_aux_t *)(f->shared->cache->aux_ptr); @@ -759,7 +759,7 @@ H5AC_flush(H5F_t *f, hid_t dxpl_id) #ifdef H5_HAVE_PARALLEL /* flushing the cache, so clear all collective entries */ - if(H5C_clear_coll_entries(f, dxpl_id, f->shared->cache, 0) < 0) + if(H5C_clear_coll_entries(f->shared->cache, 0) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") /* Attempt to flush all entries from rank 0 & Bcast clean list to other ranks */ @@ -4341,7 +4341,7 @@ HDfprintf(stdout, "%d:H5AC_propagate...:%u: (u/uu/i/iu/r/ru) = %zu/%u/%zu/%u/%zu evicted later. All ranks are guranteed to mark the same entires since we don't modify the order of the collectively accessed entries except through collective access. */ - if(H5C_clear_coll_entries(f, dxpl_id, cache_ptr, TRUE) < 0) + if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") switch(aux_ptr->metadata_write_strategy) { diff --git a/src/H5C.c b/src/H5C.c index 05b4299..4c83f22 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -698,7 +698,6 @@ H5C_apply_candidate_list(H5F_t * f, ranks. */ if(TRUE == entry_ptr->coll_access) { entry_ptr->coll_access = FALSE; - cache_ptr->num_coll_entries --; H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) } } /* end else */ @@ -1460,7 +1459,6 @@ H5C_create(size_t max_cache_size, cache_ptr->coll_list_size = (size_t)0; cache_ptr->coll_head_ptr = NULL; cache_ptr->coll_tail_ptr = NULL; - cache_ptr->num_coll_entries = 0; #endif /* H5_HAVE_PARALLEL */ cache_ptr->cLRU_list_len = 0; @@ -3277,19 +3275,18 @@ H5C_insert_entry(H5F_t * f, entry_ptr->coll_access = coll_access; if(coll_access) { //fprintf(stderr, "NEW (%llu, %s)\n", addr, entry_ptr->type->name); - cache_ptr->num_coll_entries ++; H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, FAIL) /* Make sure the size of the collective entries in the cache remain in check */ if(H5P_USER_TRUE == f->coll_md_read) { if(cache_ptr->max_cache_size*0.8 < cache_ptr->coll_list_size) { - if(H5C_clear_coll_entries(f, dxpl_id, cache_ptr, 1) < 0) + if(H5C_clear_coll_entries(cache_ptr, 1) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") } } else { if(cache_ptr->max_cache_size*0.4 < cache_ptr->coll_list_size) { - if(H5C_clear_coll_entries(f, dxpl_id, cache_ptr, 1) < 0) + if(H5C_clear_coll_entries(cache_ptr, 1) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") } } @@ -3479,7 +3476,6 @@ H5C_mark_entries_as_clean(H5F_t * f, */ if(TRUE == entry_ptr->coll_access) { entry_ptr->coll_access = FALSE; - cache_ptr->num_coll_entries --; H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) } @@ -4338,7 +4334,6 @@ H5C_protect(H5F_t * f, HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) entry_ptr->coll_access = TRUE; - cache_ptr->num_coll_entries ++; //fprintf(stderr, "ONLY INSERT (%llu, %s)\n", addr, entry_ptr->type->name); H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) @@ -4395,7 +4390,6 @@ H5C_protect(H5F_t * f, #ifdef H5_HAVE_PARALLEL if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { if(entry_ptr->coll_access) { - cache_ptr->num_coll_entries ++; //fprintf(stderr, "LOAD and INSERT (%llu, %s)\n", addr, entry_ptr->type->name); H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) } @@ -4693,14 +4687,14 @@ H5C_protect(H5F_t * f, //fprintf(stderr, "COLL entries size = %zu, MAX = %zu\n", cache_ptr->coll_list_size, cache_ptr->max_cache_size); if(cache_ptr->max_cache_size*0.8 < cache_ptr->coll_list_size) { //fprintf(stderr, "COLL entries at 80.. CLEARING\n"); - if(H5C_clear_coll_entries(f, dxpl_id, cache_ptr, 1) < 0) + if(H5C_clear_coll_entries(cache_ptr, 1) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "H5C_clear_coll_entries() failed.") } } else { if(cache_ptr->max_cache_size*0.4 < cache_ptr->coll_list_size) { //fprintf(stderr, "COLL entries at 40.. CLEARING\n"); - if(H5C_clear_coll_entries(f, dxpl_id, cache_ptr, 1) < 0) + if(H5C_clear_coll_entries(cache_ptr, 1) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "H5C_clear_coll_entries() failed.") } } @@ -10569,7 +10563,6 @@ H5C_make_space_in_cache(H5F_t * f, if(TRUE == entry_ptr->coll_access) { entry_ptr->coll_access = FALSE; - cache_ptr->num_coll_entries --; H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) } @@ -10596,7 +10589,6 @@ H5C_make_space_in_cache(H5F_t * f, if(TRUE == entry_ptr->coll_access) { entry_ptr->coll_access = FALSE; - cache_ptr->num_coll_entries --; H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) } @@ -11671,7 +11663,8 @@ done: * * Function: H5C_clear_coll_entries * - * Purpose: + * Purpose: Clear half or the entire list of collective entries and + * mark them as independent. * * Return: FAIL if error is detected, SUCCEED otherwise. * @@ -11681,45 +11674,30 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C_clear_coll_entries(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, H5C_t * cache_ptr, - hbool_t partial) +H5C_clear_coll_entries(H5C_t * cache_ptr, hbool_t partial) { - int32_t list_len, coll_entries_cleared = 0, coll_dirty_entries=0; + int32_t list_len, coll_entries_cleared = 0; H5C_cache_entry_t * entry_ptr = NULL; H5C_cache_entry_t * prev_ptr; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT - //fprintf(stderr, "List len = %d, NUM coll entries = %d\n", cache_ptr->coll_list_len, cache_ptr->num_coll_entries); entry_ptr = cache_ptr->coll_tail_ptr; list_len = cache_ptr->coll_list_len; + while(entry_ptr && (coll_entries_cleared < (partial ? list_len/2 : list_len))) { prev_ptr = entry_ptr->coll_prev; HDassert(entry_ptr->coll_access); - if(entry_ptr->is_dirty && partial && 0) { - coll_dirty_entries ++; - //fprintf(stderr, "%d: %llu Coll entry is Dirty\n", mpi_rank, entry_ptr->addr); - } - else { - entry_ptr->coll_access = FALSE; - H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) - coll_entries_cleared ++; - //fprintf(stderr, "Cleared %llu Coll entries Cleaned = %d\n", entry_ptr->addr, coll_entries_cleared); - } + entry_ptr->coll_access = FALSE; + H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) + coll_entries_cleared ++; + entry_ptr = prev_ptr; } - //fprintf(stderr, "NUM COLL entries = %d, CLEARED %d, Dirty %d\n", - //cache_ptr->num_coll_entries, coll_entries_cleared, coll_dirty_entries); - - cache_ptr->num_coll_entries -= coll_entries_cleared; - //fprintf(stderr, "NUM COLL entries = %d, NUM COLL dirty entries = %d\n", cache_ptr->num_coll_entries, coll_dirty_entries); - HDassert(cache_ptr->coll_list_len == cache_ptr->num_coll_entries); - //HDassert(0 == coll_dirty_entries - cache_ptr->num_coll_entries); - done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C_clear_coll_entries */ diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 8fd3e43..3e15bca 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -2833,9 +2833,7 @@ if ( ( (entry_ptr) == NULL ) || \ { \ (head_ptr) = (entry_ptr)->coll_next; \ if ( (head_ptr) != NULL ) \ - { \ (head_ptr)->coll_prev = NULL; \ - } \ } \ else \ { \ @@ -2845,14 +2843,10 @@ if ( ( (entry_ptr) == NULL ) || \ { \ (tail_ptr) = (entry_ptr)->coll_prev; \ if ( (tail_ptr) != NULL ) \ - { \ (tail_ptr)->coll_next = NULL; \ - } \ } \ else \ - { \ (entry_ptr)->coll_next->coll_prev = (entry_ptr)->coll_prev; \ - } \ entry_ptr->coll_next = NULL; \ entry_ptr->coll_prev = NULL; \ (len)--; \ @@ -3918,7 +3912,6 @@ struct H5C_t { size_t coll_list_size; H5C_cache_entry_t * coll_head_ptr; H5C_cache_entry_t * coll_tail_ptr; - int32_t num_coll_entries; /* MSC - used only for debugging - should remove usage*/ #endif /* H5_HAVE_PARALLEL */ /* Fields for automatic cache size adjustment */ diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 00644b1..9e29a7f 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -1922,8 +1922,7 @@ H5_DLL herr_t H5C_apply_candidate_list(H5F_t *f, hid_t dxpl_id, int mpi_rank, int mpi_size); H5_DLL herr_t H5C_construct_candidate_list__clean_cache(H5C_t *cache_ptr); H5_DLL herr_t H5C_construct_candidate_list__min_clean(H5C_t *cache_ptr); -H5_DLL herr_t H5C_clear_coll_entries(H5F_t * f, hid_t dxpl_id, - H5C_t * cache_ptr, hbool_t partial); +H5_DLL herr_t H5C_clear_coll_entries(H5C_t * cache_ptr, hbool_t partial); #endif /* H5_HAVE_PARALLEL */ #ifndef NDEBUG /* debugging functions */ diff --git a/testpar/t_cache.c b/testpar/t_cache.c index eb73fc3..8bbc33c 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -501,6 +501,7 @@ static hbool_t smoke_check_2(int metadata_write_strategy); static hbool_t smoke_check_3(int metadata_write_strategy); static hbool_t smoke_check_4(int metadata_write_strategy); static hbool_t smoke_check_5(int metadata_write_strategy); +static hbool_t smoke_check_6(int metadata_write_strategy); static hbool_t trace_file_check(int metadata_write_strategy); @@ -7149,12 +7150,6 @@ trace_file_check(int metadata_write_strategy) * * Purpose: Sixth smoke check for the parallel cache. * - * Use random reads to vary the loads on the diffferent - * processors. Also force different cache size adjustments. - * - * In this test, load process 0 heavily, and the other - * processes lightly. - * * Return: Success: TRUE * * Failure: FALSE -- cgit v0.12 From e8dc2c232da25eb914ea41303bd15fe81e45564f Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Tue, 25 Aug 2015 08:37:28 -0500 Subject: [svn-r27573] fix serial build. --- src/H5C.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/H5C.c b/src/H5C.c index 08c2b9a..528a142 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -7756,7 +7756,9 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ else destroy_entry = destroy; +#ifdef H5_HAVE_PARALLEL HDassert(FALSE == entry_ptr->coll_access); +#endif /* we will write the entry to disk if it exists, is dirty, and if the * clear only flag is not set. @@ -9023,10 +9025,12 @@ H5C_make_space_in_cache(H5F_t * f, cache_ptr->entries_removed_counter = 0; cache_ptr->last_entry_removed_ptr = NULL; +#ifdef H5_HAVE_PARALLEL if(TRUE == entry_ptr->coll_access) { entry_ptr->coll_access = FALSE; H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) } +#endif if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__NO_FLAGS_SET, NULL, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") @@ -9045,10 +9049,12 @@ H5C_make_space_in_cache(H5F_t * f, cache_ptr->entries_scanned_to_make_space++; #endif /* H5C_COLLECT_CACHE_STATS */ +#ifdef H5_HAVE_PARALLEL if(TRUE == entry_ptr->coll_access) { entry_ptr->coll_access = FALSE; H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) } +#endif if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") -- cgit v0.12 From 0286bb12de563c6aeb1b9d0c5be4afe717305477 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Tue, 25 Aug 2015 10:55:57 -0500 Subject: [svn-r27576] - mark the entry as indepndent when expunged. - disable the metadata coll hint for smoke checks 1 & 2. --- src/H5C.c | 6 ++++++ testpar/t_cache.c | 24 ++---------------------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/src/H5C.c b/src/H5C.c index 528a142..b26bd93 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -966,6 +966,12 @@ H5C_expunge_entry(H5F_t *f, hid_t dxpl_id, const H5C_class_t *type, HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "Target entry is protected.") if(entry_ptr->is_pinned) HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "Target entry is pinned.") +#ifdef H5_HAVE_PARALLEL + if(entry_ptr->coll_access) { + entry_ptr->coll_access = FALSE; + H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) + } +#endif /* H5_HAVE_PARALLEL */ /* If we get this far, call H5C__flush_single_entry() with the * H5C__FLUSH_INVALIDATE_FLAG and the H5C__FLUSH_CLEAR_ONLY_FLAG. diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 8072215..191cd87 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -7561,14 +7561,6 @@ main(int argc, char **argv) world_mpi_rank, FUNC); } } - if ( H5Pset_coll_metadata_read(fapl, 1) < 0 ) { - - nerrors++; - if ( verbose ) { - HDfprintf(stdout, "%d:%s: H5Pset_coll_metadata_read() failed 1.\n", - world_mpi_rank, FUNC); - } - } } setup_rand(); @@ -7599,18 +7591,6 @@ main(int argc, char **argv) smoke_check_2(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); smoke_check_2(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); #endif - /* MSC - smoke check 3 and 4 do independent reads, so we disable - the collective metadata read property here */ - if ( world_mpi_rank != world_server_mpi_rank ) { - if ( H5Pset_coll_metadata_read(fapl, 0) < 0 ) { - - nerrors++; - if ( verbose ) { - HDfprintf(stdout, "%d:%s: H5Pset_coll_metadata_read() failed 1.\n", - world_mpi_rank, FUNC); - } - } - } #if 1 smoke_check_3(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); smoke_check_3(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -7619,9 +7599,9 @@ main(int argc, char **argv) smoke_check_4(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); smoke_check_4(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); #endif - /* re-enable the collective metadata read property */ + /* enable the collective metadata read property */ if ( world_mpi_rank != world_server_mpi_rank ) { - if ( H5Pset_coll_metadata_read(fapl, 0) < 0 ) { + if ( H5Pset_coll_metadata_read(fapl, 1) < 0 ) { nerrors++; if ( verbose ) { -- cgit v0.12 From 2824e6bef0f9ea6550845f75ad4580349eafb822 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Mon, 14 Dec 2015 14:53:31 -0500 Subject: [svn-r28649] - add new API to toggle collective metadata write. - set default to FALSE - fix some bugs. --- src/H5Cmpio.c | 26 ++++++++++------ src/H5Fint.c | 2 ++ src/H5Fpkg.h | 3 +- src/H5Fprivate.h | 1 + src/H5Pfapl.c | 84 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/H5Ppublic.h | 2 ++ testpar/t_cache.c | 19 +++--------- testpar/t_dset.c | 2 +- testpar/t_shapesame.c | 4 ++- testpar/testphdf5.c | 4 ++- 10 files changed, 119 insertions(+), 28 deletions(-) diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index 604a991..0d75ac1 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -257,9 +257,11 @@ H5C_apply_candidate_list(H5F_t * f, HDfprintf(stdout, "%s", tbl_buf); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ - /* Create skip list of entries for collective write */ - if(NULL == (collective_write_list = H5SL_create(H5SL_TYPE_HADDR, NULL))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create skip list for entries") + if(f->coll_md_write) { + /* Create skip list of entries for collective write */ + if(NULL == (collective_write_list = H5SL_create(H5SL_TYPE_HADDR, NULL))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create skip list for entries") + } n = num_candidates / mpi_size; m = num_candidates % mpi_size; @@ -711,30 +713,34 @@ H5C_apply_candidate_list(H5F_t * f, if (delayed_ptr) { if (delayed_ptr->clear_on_unprotect) { - if(H5C__flush_single_entry(f, dxpl_id, delayed_ptr, H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, + if(H5C__flush_single_entry(f, dxpl_id, delayed_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG, NULL, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't flush entry collectively.") + entry_ptr->clear_on_unprotect = FALSE; entries_cleared++; } else if (delayed_ptr->flush_immediately) { if(H5C__flush_single_entry(f, dxpl_id, delayed_ptr, H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, collective_write_list) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't flush entry collectively.") + entry_ptr->flush_immediately = FALSE; entries_flushed++; } /* end if */ - entries_flushed_collectively++; entries_flushed_or_cleared_last++; } /* end if */ - /* Write collective list */ - if(H5C_collective_write(f, - dxpl_id, - collective_write_list) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't write metadata collectively") + if(f->coll_md_write) { + HDassert(collective_write_list); + /* Write collective list */ + if(H5C_collective_write(f, + dxpl_id, + collective_write_list) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't write metadata collectively") + } /* ====================================================================== * * Finished flushing everything. * * ====================================================================== */ diff --git a/src/H5Fint.c b/src/H5Fint.c index 33db083..4e44bcb 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -639,6 +639,8 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t #ifdef H5_HAVE_PARALLEL if(H5P_get(plist, H5_COLL_MD_READ_FLAG_NAME, &(f->coll_md_read)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get collective metadata read flag") + if(H5P_get(plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->coll_md_write)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get collective metadata write flag") #endif /* H5_HAVE_PARALLEL */ /* Get the VFD values to cache */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 4fda863..55e322b 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -312,7 +312,8 @@ struct H5F_t { struct H5F_t *parent; /* Parent file that this file is mounted to */ unsigned nmounts; /* Number of children mounted to this file */ #ifdef H5_HAVE_PARALLEL - H5P_coll_md_read_flag_t coll_md_read; /* Do all metadata reads collectively */ + H5P_coll_md_read_flag_t coll_md_read; /* Do all metadata reads collectively */ + hbool_t coll_md_write; /* Do all metadata writes collectively */ #endif /* H5_HAVE_PARALLEL */ }; diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 8c0e608..2d61a4c 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -454,6 +454,7 @@ #define H5F_ACS_FILE_IMAGE_INFO_NAME "file_image_info" /* struct containing initial file image and callback info */ #define H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME "core_write_tracking_flag" /* Whether or not core VFD backing store write tracking is enabled */ #define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME "core_write_tracking_page_size" /* The page size in kiB when core VFD write tracking is enabled */ +#define H5F_ACS_COLL_MD_WRITE_FLAG_NAME "collective_metadata_write" /* property indicating whether metadata writes are done collectively or not */ /* ======================== File Mount properties ====================*/ #define H5F_MNT_SYM_LOCAL_NAME "local" /* Whether absolute symlinks local to file. */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 7e1e0ee..9cc8fc7 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -183,6 +183,11 @@ #define H5F_ACS_COLL_MD_READ_FLAG_DEF H5P_USER_FALSE #define H5F_ACS_COLL_MD_READ_FLAG_ENC H5P__encode_coll_md_read_flag_t #define H5F_ACS_COLL_MD_READ_FLAG_DEC H5P__decode_coll_md_read_flag_t +/* Definition of collective metadata write mode flag */ +#define H5F_ACS_COLL_MD_WRITE_FLAG_SIZE sizeof(hbool_t) +#define H5F_ACS_COLL_MD_WRITE_FLAG_DEF FALSE +#define H5F_ACS_COLL_MD_WRITE_FLAG_ENC H5P__encode_hbool_t +#define H5F_ACS_COLL_MD_WRITE_FLAG_DEC H5P__decode_hbool_t /******************/ @@ -287,6 +292,7 @@ static const H5FD_file_image_info_t H5F_def_file_image_info_g = H5F_ACS_FILE_IMA static const hbool_t H5F_def_core_write_tracking_flag_g = H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEF; /* Default setting for core VFD write tracking */ static const size_t H5F_def_core_write_tracking_page_size_g = H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEF; /* Default core VFD write tracking page size */ static const H5P_coll_md_read_flag_t H5F_def_coll_md_read_flag_g = H5F_ACS_COLL_MD_READ_FLAG_DEF; /* Default setting for the collective metedata read flag */ +static const hbool_t H5F_def_coll_md_write_flag_g = H5F_ACS_COLL_MD_WRITE_FLAG_DEF; /* Default setting for the collective metedata write flag */ @@ -451,6 +457,13 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the metadata collective write flag */ + if(H5P_register_real(pclass, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, H5F_ACS_COLL_MD_WRITE_FLAG_SIZE, + &H5F_def_coll_md_write_flag_g, + NULL, NULL, NULL, H5F_ACS_COLL_MD_WRITE_FLAG_ENC, H5F_ACS_COLL_MD_WRITE_FLAG_DEC, + NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__facc_reg_prop() */ @@ -3651,4 +3664,75 @@ H5Pget_coll_metadata_read(hid_t plist_id, hbool_t *is_collective) done: FUNC_LEAVE_API(ret_value) } /* H5Pget_coll_metadata_read */ + + +/*------------------------------------------------------------------------- + * Function: H5Pset_coll_metadata_write + * + * Purpose: Tell the library whether the metadata write operations will + * be done collectively (1) or not (0). Default is collective. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_coll_metadata_write(hid_t plist_id, hbool_t is_collective) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ib", plist_id, is_collective); + + /* Compare the property list's class against the other class */ + if(TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not a file access plist") + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Set values */ + if(H5P_set(plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &is_collective) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set collective metadata write flag") + +done: + FUNC_LEAVE_API(ret_value) +} /* H5Pset_coll_metadata_write */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_coll_metadata_write + * + * Purpose: Gets information about collective metadata write mode. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_coll_metadata_write(hid_t plist_id, hbool_t *is_collective) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*b", plist_id, is_collective); + + /* Compare the property list's class against the other class */ + if(TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS)) + HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist") + + /* Get the plist structure */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + if(H5P_get(plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, is_collective) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get collective metadata write flag") + +done: + FUNC_LEAVE_API(ret_value) +} /* H5Pget_coll_metadata_write */ + #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 6a1dbad..a0a684f 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -354,6 +354,8 @@ H5_DLL herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, siz #ifdef H5_HAVE_PARALLEL H5_DLL herr_t H5Pset_coll_metadata_read(hid_t plist_id, hbool_t is_collective); H5_DLL herr_t H5Pget_coll_metadata_read(hid_t plist_id, hbool_t *is_collective); +H5_DLL herr_t H5Pset_coll_metadata_write(hid_t plist_id, hbool_t is_collective); +H5_DLL herr_t H5Pget_coll_metadata_write(hid_t plist_id, hbool_t *is_collective); #endif /* H5_HAVE_PARALLEL */ /* Dataset creation property list (DCPL) routines */ diff --git a/testpar/t_cache.c b/testpar/t_cache.c index e91ee4e..5b6b44f 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -7508,15 +7508,6 @@ main(int argc, char **argv) } } - if ( H5Pset_coll_metadata_read(fapl, 1) < 0 ) { - - nerrors++; - if ( verbose ) { - HDfprintf(stdout, "%d:%s: H5Pset_coll_metadata_read() failed 1.\n", - world_mpi_rank, FUNC); - } - } - /* fix the file names */ for ( u = 0; u < sizeof(FILENAME) / sizeof(FILENAME[0]) - 1; ++u ) { @@ -7561,6 +7552,7 @@ main(int argc, char **argv) world_mpi_rank, FUNC); } } + } setup_rand(); @@ -7599,6 +7591,10 @@ main(int argc, char **argv) smoke_check_4(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); smoke_check_4(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); #endif +#if 1 + smoke_check_5(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); + smoke_check_5(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); +#endif /* enable the collective metadata read property */ if ( world_mpi_rank != world_server_mpi_rank ) { if ( H5Pset_coll_metadata_read(fapl, 1) < 0 ) { @@ -7611,11 +7607,6 @@ main(int argc, char **argv) } } #if 1 - smoke_check_5(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); - smoke_check_5(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); -#endif - -#if 1 smoke_check_6(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); smoke_check_6(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); #endif diff --git a/testpar/t_dset.c b/testpar/t_dset.c index ae022fb..2e1005c 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -457,7 +457,7 @@ dataset_readInd(void) VRFY((acc_tpl >= 0), ""); /* open the file collectively */ - fid=H5Fopen(filename,H5F_ACC_RDONLY,acc_tpl); + fid = H5Fopen(filename, H5F_ACC_RDONLY, acc_tpl); VRFY((fid >= 0), ""); /* Release file-access template */ diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c index 5152408..1b856d0 100644 --- a/testpar/t_shapesame.c +++ b/testpar/t_shapesame.c @@ -4948,7 +4948,9 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) /* set Parallel access with communicator */ ret = H5Pset_fapl_mpio(ret_pl, comm, info); VRFY((ret >= 0), ""); - ret = H5Pset_coll_metadata_read(ret_pl, 1); + ret = H5Pset_coll_metadata_read(ret_pl, true); + VRFY((ret >= 0), ""); + ret = H5Pset_coll_metadata_write(ret_pl, true); VRFY((ret >= 0), ""); return(ret_pl); } diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index b652ef4..7ab479d 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -272,7 +272,9 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) /* set Parallel access with communicator */ ret = H5Pset_fapl_mpio(ret_pl, comm, info); VRFY((ret >= 0), ""); - ret = H5Pset_coll_metadata_read(ret_pl, 1); + ret = H5Pset_coll_metadata_read(ret_pl, true); + VRFY((ret >= 0), ""); + ret = H5Pset_coll_metadata_write(ret_pl, true); VRFY((ret >= 0), ""); return(ret_pl); } -- cgit v0.12 From 4a25e5b788b6264eaed93de45a55a333b204a037 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 21 Dec 2015 17:22:55 -0500 Subject: [svn-r28717] Description: Minor change to align w/revise_chunks branch Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (too minor for h5committest) --- src/H5Dchunk.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index ab621ca..efd94c0 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -1885,6 +1885,9 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, void *chunk = NULL; /* Pointer to locked chunk buffer */ htri_t cacheable; /* Whether the chunk is cacheable */ + /* Set chunk's [scaled] coordinates */ + io_info->store->chunk.scaled = chunk_info->scaled; + /* Determine if we should use the chunk cache */ if((cacheable = H5D__chunk_cacheable(io_info, udata.chunk_block.offset, FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't tell if chunk is cacheable") @@ -1895,9 +1898,6 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, H5_CHECK_OVERFLOW(type_info->src_type_size, /*From:*/ size_t, /*To:*/ uint32_t); src_accessed_bytes = chunk_info->chunk_points * (uint32_t)type_info->src_type_size; - /* Set chunk's [scaled] coordinates */ - io_info->store->chunk.scaled = chunk_info->scaled; - /* Lock the chunk into the cache */ if(NULL == (chunk = H5D__chunk_lock(io_info, &udata, FALSE))) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk") @@ -2011,6 +2011,9 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, HDassert((H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length > 0) || (!H5F_addr_defined(udata.chunk_block.offset) && udata.chunk_block.length == 0)); + /* Set chunk's [scaled] coordinates */ + io_info->store->chunk.scaled = chunk_info->scaled; + /* Determine if we should use the chunk cache */ if((cacheable = H5D__chunk_cacheable(io_info, udata.chunk_block.offset, TRUE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't tell if chunk is cacheable") @@ -2029,9 +2032,6 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, fm->fsel_type == H5S_SEL_POINTS) entire_chunk = FALSE; - /* Set chunk's [scaled] coordinates */ - io_info->store->chunk.scaled = chunk_info->scaled; - /* Lock the chunk into the cache */ if(NULL == (chunk = H5D__chunk_lock(io_info, &udata, entire_chunk))) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk") @@ -3684,9 +3684,6 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, } /* end if */ /* Insert the chunk record into the index */ - /* (Note that this isn't safe, from a SWMR perspective, unlike - * serial operation. -QAK - */ if(need_insert && ops->insert) if((ops->insert)(&idx_info, &udata, dset) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert chunk addr into index") -- cgit v0.12 From 6f83966fb9709ebd30e41d70f1bfd36ddce79636 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 22 Dec 2015 15:12:08 -0500 Subject: [svn-r28723] Description: Bring over rest of performance improvements for extending chunked datasets and normalize against revise_chunks branch. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel) (h5committest forthcoming) --- src/H5Dchunk.c | 184 ++++++++++++++++++++++++++++++++++++++++++------------- src/H5Dint.c | 5 ++ src/H5Dlayout.c | 6 +- src/H5Dpkg.h | 9 ++- src/H5Oprivate.h | 4 ++ src/H5Pdcpl.c | 38 ++++++++---- 6 files changed, 187 insertions(+), 59 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index efd94c0..2e000e3 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -72,6 +72,10 @@ #define H5D_CHUNK_GET_NODE_INFO(map, node) (map->use_single ? map->single_chunk_info : (H5D_chunk_info_t *)H5SL_item(node)) #define H5D_CHUNK_GET_NEXT_NODE(map, node) (map->use_single ? (H5SL_node_t *)NULL : H5SL_next(node)) +/* Sanity check on chunk index types: commonly used by a lot of routines in this file */ +#define H5D_CHUNK_STORAGE_INDEX_CHK(storage) \ + HDassert((H5D_CHUNK_IDX_BTREE == storage->idx_type && H5D_COPS_BTREE == storage->ops)); + /* * Feature: If this constant is defined then every cache preemption and load * causes a character to be printed on the standard error stream: @@ -215,7 +219,7 @@ H5D__nonexistent_readvv(const H5D_io_info_t *io_info, /* Helper routines */ static herr_t H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, - const hsize_t *curr_dims); + const hsize_t *curr_dims, const hsize_t *max_dims); static void *H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline); static void *H5D__chunk_mem_xfree(void *chk, const H5O_pline_t *pline); static void *H5D__chunk_mem_realloc(void *chk, size_t size, @@ -244,7 +248,8 @@ static herr_t H5D__chunk_cache_prune(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t *dxpl_cache, size_t size); static herr_t H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata); static herr_t H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, - const H5F_block_t *old_chunk, H5F_block_t *new_chunk, hbool_t *need_insert); + const H5F_block_t *old_chunk, H5F_block_t *new_chunk, hbool_t *need_insert, + hsize_t scaled[]); #ifdef H5_HAVE_PARALLEL static herr_t H5D__chunk_collective_fill(const H5D_t *dset, hid_t dxpl_id, H5D_chunk_coll_info_t *chunk_info, size_t chunk_size, const void *fill_buf); @@ -377,7 +382,7 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, /* Create the chunk it if it doesn't exist, or reallocate the chunk * if its size changed. */ - if(H5D__chunk_file_alloc(&idx_info, &old_chunk, &udata.chunk_block, &need_insert) < 0) + if(H5D__chunk_file_alloc(&idx_info, &old_chunk, &udata.chunk_block, &need_insert, scaled) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate chunk") /* Make sure the address of the chunk is returned. */ @@ -430,7 +435,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize_t *curr_dims) +H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, + const hsize_t *curr_dims, const hsize_t *max_dims) { unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -443,17 +449,21 @@ H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize HDassert(curr_dims); /* Compute the # of chunks in dataset dimensions */ - for(u = 0, layout->nchunks = 1; u < ndims; u++) { + for(u = 0, layout->nchunks = 1, layout->max_nchunks = 1; u < ndims; u++) { /* Round up to the next integer # of chunks, to accomodate partial chunks */ layout->chunks[u] = ((curr_dims[u] + layout->dim[u]) - 1) / layout->dim[u]; + layout->max_chunks[u] = ((max_dims[u] + layout->dim[u]) - 1) / layout->dim[u]; /* Accumulate the # of chunks */ layout->nchunks *= layout->chunks[u]; + layout->max_nchunks *= layout->max_chunks[u]; } /* end for */ /* Get the "down" sizes for each dimension */ if(H5VM_array_down(ndims, layout->chunks, layout->down_chunks) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute 'down' chunk size value") + if(H5VM_array_down(ndims, layout->max_chunks, layout->max_down_chunks) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute 'down' chunk size value") done: FUNC_LEAVE_NOAPI(ret_value) @@ -483,7 +493,7 @@ H5D__chunk_set_info(const H5D_t *dset) HDassert(dset); /* Set the base layout information */ - if(H5D__chunk_set_info_real(&dset->shared->layout.u.chunk, dset->shared->ndims, dset->shared->curr_dims) < 0) + if(H5D__chunk_set_info_real(&dset->shared->layout.u.chunk, dset->shared->ndims, dset->shared->curr_dims, dset->shared->max_dims) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout's chunk info") /* Call the index's "resize" callback */ @@ -596,6 +606,7 @@ H5D__chunk_init(H5F_t *f, hid_t dxpl_id, const H5D_t *dset, hid_t dapl_id) H5D_chk_idx_info_t idx_info; /* Chunked index info */ H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /* Convenience pointer to dataset's chunk cache */ H5P_genplist_t *dapl; /* Data access property list object pointer */ + H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk); herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -603,6 +614,7 @@ H5D__chunk_init(H5F_t *f, hid_t dxpl_id, const H5D_t *dset, hid_t dapl_id) /* Sanity check */ HDassert(f); HDassert(dset); + H5D_CHUNK_STORAGE_INDEX_CHK(sc); if(NULL == (dapl = (H5P_genplist_t *)H5I_object(dapl_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for fapl ID") @@ -686,12 +698,14 @@ done: hbool_t H5D__chunk_is_space_alloc(const H5O_storage_t *storage) { + const H5O_storage_chunk_t *sc = &(storage->u.chunk); hbool_t ret_value = FALSE; /* Return value */ FUNC_ENTER_PACKAGE_NOERR /* Sanity checks */ HDassert(storage); + H5D_CHUNK_STORAGE_INDEX_CHK(sc); /* Query index layer */ ret_value = (storage->u.chunk.ops->is_space_alloc)(&storage->u.chunk); @@ -1343,6 +1357,9 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t HDmemcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims); new_chunk_info->scaled[fm->f_ndims] = 0; + /* Copy the chunk's scaled coordinates */ + HDmemcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims); + /* Insert the new chunk into the skip list */ if(H5SL_insert(fm->sel_chunks, new_chunk_info, &new_chunk_info->index) < 0) { H5D__free_chunk_info(new_chunk_info, NULL, NULL); @@ -1600,6 +1617,7 @@ H5D__chunk_file_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, /* Set the chunk's scaled coordinates */ HDmemcpy(chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims); chunk_info->scaled[fm->f_ndims] = 0; + HDmemcpy(chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims); /* Insert the new chunk into the skip list */ if(H5SL_insert(fm->sel_chunks,chunk_info,&chunk_info->index) < 0) { @@ -2056,7 +2074,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, udata.chunk_block.length = io_info->dset->shared->layout.u.chunk.size; /* Allocate the chunk */ - if(H5D__chunk_file_alloc(&idx_info, NULL, &udata.chunk_block, &need_insert) < 0) + if(H5D__chunk_file_alloc(&idx_info, NULL, &udata.chunk_block, &need_insert, chunk_info->scaled) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level") /* Make sure the address of the chunk is returned. */ @@ -2221,12 +2239,14 @@ H5D__chunk_dest(H5D_t *dset, hid_t dxpl_id) H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /* Dataset's chunk cache */ H5D_rdcc_ent_t *ent = NULL, *next = NULL; /* Pointer to current & next cache entries */ int nerrors = 0; /* Accumulated count of errors */ + H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk); herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC_TAG(dxpl_id, dset->oloc.addr, FAIL) /* Sanity checks */ HDassert(dset); + H5D_CHUNK_STORAGE_INDEX_CHK(sc); /* Fill the DXPL cache values for later use */ if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0) @@ -2287,6 +2307,7 @@ H5D_chunk_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) /* Sanity checks */ HDassert(storage); HDassert(storage->ops); + H5D_CHUNK_STORAGE_INDEX_CHK(storage); /* Reset index structures */ if((storage->ops->reset)(storage, reset_addr) < 0) @@ -2351,6 +2372,7 @@ H5D__chunk_cinfo_cache_update(H5D_chunk_cached_t *last, const H5D_chunk_ud_t *ud HDmemcpy(last->scaled, udata->common.scaled, sizeof(hsize_t) * udata->common.layout->ndims); last->addr = udata->chunk_block.offset; H5_CHECKED_ASSIGN(last->nbytes, uint32_t, udata->chunk_block.length, hsize_t); + last->chunk_idx = udata->chunk_idx; last->filter_mask = udata->filter_mask; /* Indicate that the cached info is valid */ @@ -2397,6 +2419,7 @@ H5D__chunk_cinfo_cache_found(const H5D_chunk_cached_t *last, H5D_chunk_ud_t *uda /* Retrieve the information from the cache */ udata->chunk_block.offset = last->addr; udata->chunk_block.length = last->nbytes; + udata->chunk_idx = last->chunk_idx; udata->filter_mask = last->filter_mask; /* Indicate that the data was found */ @@ -2427,6 +2450,7 @@ herr_t H5D__chunk_create(const H5D_t *dset /*in,out*/, hid_t dxpl_id) { H5D_chk_idx_info_t idx_info; /* Chunked index info */ + H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk); herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -2435,6 +2459,8 @@ H5D__chunk_create(const H5D_t *dset /*in,out*/, hid_t dxpl_id) HDassert(dset); HDassert(H5D_CHUNKED == dset->shared->layout.type); HDassert(dset->shared->layout.u.chunk.ndims > 0 && dset->shared->layout.u.chunk.ndims <= H5O_LAYOUT_NDIMS); + H5D_CHUNK_STORAGE_INDEX_CHK(sc); + #ifndef NDEBUG { unsigned u; /* Local index variable */ @@ -2527,12 +2553,14 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, H5D_rdcc_ent_t *ent = NULL; /* Cache entry */ hbool_t found = FALSE; /* In cache? */ unsigned u; /* Counter */ + H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk); herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE HDassert(dset); HDassert(dset->shared->layout.u.chunk.ndims > 0); + H5D_CHUNK_STORAGE_INDEX_CHK(sc); HDassert(scaled); HDassert(udata); @@ -2563,6 +2591,7 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, if(found) { udata->chunk_block.offset = ent->chunk_block.offset; udata->chunk_block.length = ent->chunk_block.length;; + udata->chunk_idx = ent->chunk_idx; } /* end if */ else { /* Invalidate idx_hint, to signal that the chunk is not in cache */ @@ -2614,12 +2643,14 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t { void *buf = NULL; /* Temporary buffer */ hbool_t point_of_no_return = FALSE; + H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk); herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC_TAG(dxpl_id, dset->oloc.addr, FAIL) HDassert(dset); HDassert(dset->shared); + H5D_CHUNK_STORAGE_INDEX_CHK(sc); HDassert(dxpl_cache); HDassert(ent); HDassert(!ent->locked); @@ -2638,6 +2669,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t udata.chunk_block.offset = ent->chunk_block.offset; udata.chunk_block.length = dset->shared->layout.u.chunk.size; udata.filter_mask = 0; + udata.chunk_idx = ent->chunk_idx; /* Should the chunk be filtered before writing it to disk? */ if(dset->shared->dcpl_cache.pline.nused) { @@ -2697,7 +2729,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t /* Create the chunk it if it doesn't exist, or reallocate the chunk * if its size changed. */ - if(H5D__chunk_file_alloc(&idx_info, &(ent->chunk_block), &udata.chunk_block, &need_insert) < 0) + if(H5D__chunk_file_alloc(&idx_info, &(ent->chunk_block), &udata.chunk_block, &need_insert, ent->scaled) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level") /* Update the chunk entry's info, in case it was allocated or relocated */ @@ -2804,8 +2836,19 @@ H5D__chunk_cache_evict(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t rdcc->tail = ent->prev; ent->prev = ent->next = NULL; - /* Only clear hash table slot if chunk was not marked as deleted already */ - if(!ent->deleted) + /* Unlink from temporary list */ + if(ent->tmp_prev) { + HDassert(rdcc->tmp_head->tmp_next); + ent->tmp_prev->tmp_next = ent->tmp_next; + if(ent->tmp_next) { + ent->tmp_next->tmp_prev = ent->tmp_prev; + ent->tmp_next = NULL; + } /* end if */ + ent->tmp_prev = NULL; + } /* end if */ + else + /* Only clear hash table slot if the chunk was not on the temporary list + */ rdcc->slot[ent->idx] = NULL; /* Remove from cache */ @@ -2980,6 +3023,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, HDassert(udata); HDassert(dset); HDassert(TRUE == H5P_isa_class(io_info->dxpl_id, H5P_DATASET_XFER)); + HDassert(!rdcc->tmp_head); /* Get the chunk's size */ HDassert(layout->u.chunk.size > 0); @@ -2999,7 +3043,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, unsigned u; /*counters */ /* Make sure this is the right chunk */ - for(u = 0; u < layout->u.chunk.ndims; u++) + for(u = 0; u < layout->u.chunk.ndims - 1; u++) HDassert(io_info->store->chunk.scaled[u] == ent->scaled[u]); } #endif /* NDEBUG */ @@ -3147,6 +3191,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, /* Initialize the new entry */ ent->chunk_block.offset = chunk_addr; ent->chunk_block.length = chunk_alloc; + ent->chunk_idx = udata->chunk_idx; HDmemcpy(ent->scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims); H5_CHECKED_ASSIGN(ent->rd_count, uint32_t, chunk_size, size_t); H5_CHECKED_ASSIGN(ent->wr_count, uint32_t, chunk_size, size_t); @@ -3167,6 +3212,9 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, } /* end if */ else rdcc->head = rdcc->tail = ent; + ent->tmp_next = NULL; + ent->tmp_prev = NULL; + } /* end if */ else /* We did not add the chunk to cache */ @@ -3255,7 +3303,9 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, HDmemset(&fake_ent, 0, sizeof(fake_ent)); fake_ent.dirty = TRUE; HDmemcpy(fake_ent.scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims); + HDmemcpy(fake_ent.scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims); HDassert(layout->u.chunk.size > 0); + fake_ent.chunk_idx = udata->chunk_idx; fake_ent.chunk_block.offset = udata->chunk_block.offset; fake_ent.chunk_block.length = udata->chunk_block.length; fake_ent.chunk = (uint8_t *)chunk; @@ -3344,12 +3394,14 @@ H5D__chunk_allocated(H5D_t *dset, hid_t dxpl_id, hsize_t *nbytes) H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */ H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */ hsize_t chunk_bytes = 0; /* Number of bytes allocated for chunks */ + H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk); herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE HDassert(dset); HDassert(dset->shared); + H5D_CHUNK_STORAGE_INDEX_CHK(sc); /* Fill the DXPL cache values for later use */ if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0) @@ -3426,6 +3478,7 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, unsigned op_dim; /* Current operating dimension */ H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */ hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */ + const H5O_storage_chunk_t *sc = &(layout->storage.u.chunk); herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dxpl_id, dset->oloc.addr, FAIL) @@ -3433,6 +3486,7 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, /* Check args */ HDassert(dset && H5D_CHUNKED == layout->type); HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS); + H5D_CHUNK_STORAGE_INDEX_CHK(sc); HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER)); /* Retrieve the dataset dimensions */ @@ -3552,6 +3606,7 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, * Note that min_unalloc & max_unalloc are in scaled coordinates. * */ + chunk_size = orig_chunk_size; for(op_dim = 0; op_dim < space_ndims; op_dim++) { H5D_chunk_ud_t udata; /* User data for querying chunk info */ int i; /* Local index variable */ @@ -3570,18 +3625,11 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, while(!carry) { hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */ - /* Reset size of chunk in bytes, in case filtered size changes */ - chunk_size = orig_chunk_size; - + /* Look up this chunk */ + if(H5D__chunk_lookup(dset, dxpl_id, scaled, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") #ifndef NDEBUG /* None of the chunks should be allocated */ - { - /* Look up this chunk */ - if(H5D__chunk_lookup(dset, dxpl_id, scaled, &udata) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") - - HDassert(!H5F_addr_defined(udata.chunk_block.offset)); - } /* end block */ /* Make sure the chunk is really in the dataset and outside the * original dimensions */ @@ -3636,6 +3684,8 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, /* Keep the number of bytes the chunk turned in to */ chunk_size = nbytes; } /* end if */ + else + chunk_size = layout->u.chunk.size; } /* end if */ /* Initialize the chunk information */ @@ -3647,7 +3697,7 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, udata.filter_mask = filter_mask; /* Allocate the chunk (with all processes) */ - if(H5D__chunk_file_alloc(&idx_info, NULL, &udata.chunk_block, &need_insert) < 0) + if(H5D__chunk_file_alloc(&idx_info, NULL, &udata.chunk_block, &need_insert, scaled) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level") HDassert(H5F_addr_defined(udata.chunk_block.offset)); @@ -4139,6 +4189,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) hsize_t hyper_start[H5O_LAYOUT_NDIMS]; /* Starting location of hyperslab */ uint32_t elmts_per_chunk; /* Elements in chunk */ unsigned u; /* Local index variable */ + const H5O_storage_chunk_t *sc = &(layout->storage.u.chunk); herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -4146,6 +4197,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) /* Check args */ HDassert(dset && H5D_CHUNKED == layout->type); HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS); + H5D_CHUNK_STORAGE_INDEX_CHK(sc); HDassert(dxpl_cache); /* Fill the DXPL cache values for later use */ @@ -4284,6 +4336,8 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) while(!carry) { int i; /* Local index variable */ + udata.common.scaled = scaled; + if(0 == ndims_outside_fill) { HDassert(fill_dim[op_dim]); HDassert(scaled[op_dim] == min_mod_chunk_sc[op_dim]); @@ -4322,7 +4376,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) /* Remove the chunk from disk, if present */ if(H5F_addr_defined(chk_udata.chunk_block.offset)) { /* Update the offset in idx_udata */ - idx_udata.scaled = scaled; + idx_udata.scaled = udata.common.scaled; /* Remove the chunk from disk */ if((layout->storage.u.chunk.ops->remove)(&idx_info, &idx_udata) < 0) @@ -4444,12 +4498,14 @@ H5D__chunk_addrmap(const H5D_io_info_t *io_info, haddr_t chunk_addr[]) H5D_chk_idx_info_t idx_info; /* Chunked index info */ const H5D_t *dset = io_info->dset; /* Local pointer to dataset info */ H5D_chunk_it_ud2_t udata; /* User data for iteration callback */ + H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk); herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE HDassert(dset); HDassert(dset->shared); + H5D_CHUNK_STORAGE_INDEX_CHK(sc); HDassert(chunk_addr); /* Set up user data for B-tree callback */ @@ -4497,6 +4553,7 @@ H5D__chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_storage_t *storage) H5O_pline_t pline; /* I/O pipeline message */ hbool_t pline_read = FALSE; /* Whether the I/O pipeline message was read from the file */ htri_t exists; /* Flag if header message of interest exists */ + H5O_storage_chunk_t *sc = &(storage->u.chunk); herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -4505,6 +4562,7 @@ H5D__chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_storage_t *storage) HDassert(f); HDassert(oh); HDassert(storage); + H5D_CHUNK_STORAGE_INDEX_CHK(sc); /* Check for I/O pipeline message */ if((exists = H5O_msg_exists_oh(oh, H5O_PLINE_ID)) < 0) @@ -4571,6 +4629,8 @@ H5D__chunk_update_cache(H5D_t *dset, hid_t dxpl_id) { H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */ H5D_rdcc_ent_t *ent, *next; /*cache entry */ + H5D_rdcc_ent_t tmp_head; /* Sentinel entry for temporary entry list */ + H5D_rdcc_ent_t *tmp_tail; /* Tail pointer for temporary entry list */ H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */ H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */ herr_t ret_value = SUCCEED; /* Return value */ @@ -4588,6 +4648,11 @@ H5D__chunk_update_cache(H5D_t *dset, hid_t dxpl_id) if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") + /* Add temporary entry list to rdcc */ + (void)HDmemset(&tmp_head, 0, sizeof(tmp_head)); + rdcc->tmp_head = &tmp_head; + tmp_tail = &tmp_head; + /* Recompute the index for each cached chunk that is in a dataset */ for(ent = rdcc->head; ent; ent = next) { unsigned old_idx; /* Previous index number */ @@ -4608,37 +4673,58 @@ H5D__chunk_update_cache(H5D_t *dset, hid_t dxpl_id) HDassert(old_ent->locked == FALSE); HDassert(old_ent->deleted == FALSE); - /* Mark the old entry as deleted, but do not evict (yet). - * Make sure we do not make any calls to the index + /* Insert the old entry into the temporary list, but do not + * evict (yet). Make sure we do not make any calls to the index * until all chunks have updated indices! */ - old_ent->deleted = TRUE; + HDassert(!old_ent->tmp_next); + HDassert(!old_ent->tmp_prev); + tmp_tail->tmp_next = old_ent; + old_ent->tmp_prev = tmp_tail; + tmp_tail = old_ent; } /* end if */ /* Insert this chunk into correct location in hash table */ rdcc->slot[ent->idx] = ent; - /* If this chunk was previously marked as deleted and therefore - * not in the hash table, reset the deleted flag. + /* If this chunk was previously on the temporary list and therefore + * not in the hash table, remove it from the temporary list. * Otherwise clear the old hash table slot. */ - if(ent->deleted) - ent->deleted = FALSE; + if(ent->tmp_prev) { + HDassert(tmp_head.tmp_next); + HDassert(tmp_tail != &tmp_head); + ent->tmp_prev->tmp_next = ent->tmp_next; + if(ent->tmp_next) { + ent->tmp_next->tmp_prev = ent->tmp_prev; + ent->tmp_next = NULL; + } /* end if */ + else { + HDassert(tmp_tail == ent); + tmp_tail = ent->tmp_prev; + } /* end else */ + ent->tmp_prev = NULL; + } /* end if */ else rdcc->slot[old_idx] = NULL; } /* end if */ } /* end for */ - /* Evict chunks that are still marked as deleted */ - for(ent = rdcc->head; ent; ent = next) { - /* Get the pointer to the next cache entry */ - next = ent->next; + /* tmp_tail is no longer needed, and will be invalidated by + * H5D_chunk_cache_evict anyways. */ + tmp_tail = NULL; + + /* Evict chunks that are still on the temporary list */ + while(tmp_head.tmp_next) { + ent = tmp_head.tmp_next; /* Remove the old entry from the cache */ - if(ent->deleted) - if(H5D__chunk_cache_evict(dset, dxpl_id, dxpl_cache, ent, TRUE) < 0) - HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks") - } /* end for */ + if(H5D__chunk_cache_evict(dset, dxpl_id, dxpl_cache, ent, TRUE) < 0) + HGOTO_ERROR(H5E_IO, H5E_CANTFLUSH, FAIL, "unable to flush one or more raw data chunks") + } /* end while */ done: + /* Remove temporary list from rdcc */ + rdcc->tmp_head = NULL; + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__chunk_update_cache() */ @@ -4803,8 +4889,11 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) udata->buf_size = buf_size; } /* end if */ + udata_dst.chunk_idx = H5VM_array_offset_pre(udata_dst.common.layout->ndims - 1, + udata_dst.common.layout->down_chunks, udata_dst.common.scaled); + /* Allocate chunk in the file */ - if(H5D__chunk_file_alloc(udata->idx_info_dst, NULL, &udata_dst.chunk_block, &need_insert) < 0) + if(H5D__chunk_file_alloc(udata->idx_info_dst, NULL, &udata_dst.chunk_block, &need_insert, udata_dst.common.scaled) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level") /* Write chunk data to destination file */ @@ -4850,6 +4939,9 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, H5D_chunk_it_ud3_t udata; /* User data for iteration callback */ H5D_chk_idx_info_t idx_info_dst; /* Dest. chunked index info */ H5D_chk_idx_info_t idx_info_src; /* Source chunked index info */ + int sndims; /* Rank of dataspace */ + hsize_t curr_dims[H5O_LAYOUT_NDIMS]; /* Curr. size of dataset dimensions */ + hsize_t max_dims[H5O_LAYOUT_NDIMS]; /* Curr. size of dataset dimensions */ H5O_pline_t _pline; /* Temporary pipeline info */ const H5O_pline_t *pline; /* Pointer to pipeline info to use */ H5T_path_t *tpath_src_mem = NULL, *tpath_mem_dst = NULL; /* Datatype conversion paths */ @@ -4873,9 +4965,11 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, /* Check args */ HDassert(f_src); HDassert(storage_src); + H5D_CHUNK_STORAGE_INDEX_CHK(storage_src); HDassert(layout_src); HDassert(f_dst); HDassert(storage_dst); + H5D_CHUNK_STORAGE_INDEX_CHK(storage_dst); HDassert(ds_extent_src); HDassert(dt_src); @@ -4893,17 +4987,15 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, /* Initialize layout information */ { - hsize_t curr_dims[H5O_LAYOUT_NDIMS]; /* Curr. size of dataset dimensions */ - int sndims; /* Rank of dataspace */ unsigned ndims; /* Rank of dataspace */ /* Get the dim info for dataset */ - if((sndims = H5S_extent_get_dims(ds_extent_src, curr_dims, NULL)) < 0) + if((sndims = H5S_extent_get_dims(ds_extent_src, curr_dims, max_dims)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace dimensions") H5_CHECKED_ASSIGN(ndims, unsigned, sndims, int); /* Set the source layout chunk information */ - if(H5D__chunk_set_info_real(layout_src, ndims, curr_dims) < 0) + if(H5D__chunk_set_info_real(layout_src, ndims, curr_dims, max_dims) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout's chunk info") } /* end block */ @@ -5105,6 +5197,7 @@ H5D__chunk_bh_info(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh, H5O_layout_t H5D_chk_idx_info_t idx_info; /* Chunked index info */ H5S_t *space = NULL; /* Dataset's dataspace */ H5O_pline_t pline; /* I/O pipeline message */ + H5O_storage_chunk_t *sc = &(layout->storage.u.chunk); htri_t exists; /* Flag if header message of interest exists */ hbool_t idx_info_init = FALSE; /* Whether the chunk index info has been initialized */ hbool_t pline_read = FALSE; /* Whether the I/O pipeline message was read */ @@ -5117,6 +5210,7 @@ H5D__chunk_bh_info(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh, H5O_layout_t HDassert(loc->file); HDassert(H5F_addr_defined(loc->addr)); HDassert(layout); + H5D_CHUNK_STORAGE_INDEX_CHK(sc); HDassert(index_size); /* Check for I/O pipeline message */ @@ -5226,12 +5320,14 @@ H5D__chunk_dump_index_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) herr_t H5D__chunk_dump_index(H5D_t *dset, hid_t dxpl_id, FILE *stream) { + H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk); herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(dset); + H5D_CHUNK_STORAGE_INDEX_CHK(sc); /* Only display info if stream is defined */ if(stream) { @@ -5449,7 +5545,7 @@ done: */ static herr_t H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old_chunk, - H5F_block_t *new_chunk, hbool_t *need_insert) + H5F_block_t *new_chunk, hbool_t *need_insert, hsize_t scaled[]) { hbool_t alloc_chunk = FALSE; /* Whether to allocate chunk */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Dint.c b/src/H5Dint.c index 4ec48bb..ab2f8d0 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -718,6 +718,7 @@ static herr_t H5D__cache_dataspace_info(const H5D_t *dset) { int sndims; /* Signed number of dimensions of dataspace rank */ + unsigned u; /* Local index value */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -730,6 +731,10 @@ H5D__cache_dataspace_info(const H5D_t *dset) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't cache dataspace dimensions") dset->shared->ndims = (unsigned)sndims; + /* Compute the inital 'power2up' values */ + for(u = 0; u < dset->shared->ndims; u++) + dset->shared->curr_power2up[u] = H5VM_power2up(dset->shared->curr_dims[u]); + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__cache_dataspace_info() */ diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index 8676d7c..16ff81b 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -150,6 +150,7 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ switch(layout->type) { case H5D_COMPACT: + /* This information only present in older versions of message */ /* Size of raw data */ ret_value += 2; if(include_compact_data) @@ -157,6 +158,7 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ break; case H5D_CONTIGUOUS: + /* This information only present in older versions of message */ ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */ ret_value += H5F_SIZEOF_SIZE(f); /* Length of data */ break; @@ -206,7 +208,7 @@ herr_t H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset, hid_t dapl_id) { - H5O_layout_t *layout; /* Dataset's layout information */ + H5O_layout_t *layout; /* Dataset's layout information */ const H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */ hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */ herr_t ret_value = SUCCEED; /* Return value */ @@ -401,7 +403,7 @@ done: /*------------------------------------------------------------------------- * Function: H5D__layout_oh_write * - * Purpose: Write layout/pline/efl information for dataset + * Purpose: Write layout information for dataset * * Return: Success: SUCCEED * Failure: FAIL diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index e9e87af..06e763c 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -240,7 +240,7 @@ typedef struct H5D_chk_idx_info_t { typedef struct H5D_chunk_rec_t { hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Logical offset to start */ uint32_t nbytes; /* Size of stored data */ - unsigned filter_mask; /* Excluded filters */ + uint32_t filter_mask; /* Excluded filters */ haddr_t chunk_addr; /* Address of chunk in file */ } H5D_chunk_rec_t; @@ -264,6 +264,7 @@ typedef struct H5D_chunk_ud_t { unsigned idx_hint; /*index of chunk in cache, if present */ H5F_block_t chunk_block; /*offset/length of chunk in file */ unsigned filter_mask; /*excluded filters */ + hsize_t chunk_idx; /*chunk index for EA, FA indexing */ } H5D_chunk_ud_t; /* Typedef for "generic" chunk callbacks */ @@ -363,6 +364,7 @@ typedef struct H5D_chunk_cached_t { hsize_t scaled[H5O_LAYOUT_NDIMS]; /*scaled offset of chunk*/ haddr_t addr; /*file address of chunk */ uint32_t nbytes; /*size of stored data */ + hsize_t chunk_idx; /*index of chunk in dataset */ unsigned filter_mask; /*excluded filters */ } H5D_chunk_cached_t; @@ -379,6 +381,7 @@ typedef struct H5D_rdcc_t { double w0; /* Chunk preemption policy */ struct H5D_rdcc_ent_t *head; /* Head of doubly linked list */ struct H5D_rdcc_ent_t *tail; /* Tail of doubly linked list */ + struct H5D_rdcc_ent_t *tmp_head; /* Head of temporary doubly linked list. Chunks on this list are not in the hash table (slot). The head entry is a sentinel (does not refer to an actual chunk). */ size_t nbytes_used; /* Current cached raw data in bytes */ int nused; /* Number of chunk slots in use */ H5D_chunk_cached_t last; /* Cached copy of last chunk information */ @@ -422,6 +425,7 @@ typedef struct H5D_shared_t { /* Cached dataspace info */ unsigned ndims; /* The dataset's dataspace rank */ hsize_t curr_dims[H5S_MAX_RANK]; /* The curr. size of dataset dimensions */ + hsize_t curr_power2up[H5S_MAX_RANK]; /* The curr. dim sizes, rounded up to next power of 2 */ hsize_t max_dims[H5S_MAX_RANK]; /* The max. size of dataset dimensions */ /* Buffered/cached information for types of raw data storage*/ @@ -502,10 +506,13 @@ typedef struct H5D_rdcc_ent_t { uint32_t rd_count; /*bytes remaining to be read */ uint32_t wr_count; /*bytes remaining to be written */ H5F_block_t chunk_block; /*offset/length of chunk in file */ + hsize_t chunk_idx; /*index of chunk in dataset */ uint8_t *chunk; /*the unfiltered chunk data */ unsigned idx; /*index in hash table */ struct H5D_rdcc_ent_t *next;/*next item in doubly-linked list */ struct H5D_rdcc_ent_t *prev;/*previous item in doubly-linked list */ + struct H5D_rdcc_ent_t *tmp_next;/*next item in temporary doubly-linked list */ + struct H5D_rdcc_ent_t *tmp_prev;/*previous item in temporary doubly-linked list */ } H5D_rdcc_ent_t; typedef H5D_rdcc_ent_t *H5D_rdcc_ent_ptr_t; /* For free lists */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 0d77a83..9235d6c 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -506,10 +506,14 @@ typedef struct H5O_storage_t { typedef struct H5O_layout_chunk_t { unsigned ndims; /* Num dimensions in chunk */ uint32_t dim[H5O_LAYOUT_NDIMS]; /* Size of chunk in elements */ + unsigned enc_bytes_per_dim; /* Encoded # of bytes for storing each chunk dimension */ uint32_t size; /* Size of chunk in bytes */ hsize_t nchunks; /* Number of chunks in dataset */ + hsize_t max_nchunks; /* Max. number of chunks in dataset */ hsize_t chunks[H5O_LAYOUT_NDIMS]; /* # of chunks in each dataset dimension */ + hsize_t max_chunks[H5O_LAYOUT_NDIMS]; /* # of chunks in each dataset's max. dimension */ hsize_t down_chunks[H5O_LAYOUT_NDIMS]; /* "down" size of number of chunks in each dimension */ + hsize_t max_down_chunks[H5O_LAYOUT_NDIMS]; /* "down" size of number of chunks in each max dim */ } H5O_layout_chunk_t; typedef struct H5O_layout_t { diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 145e1b5..03d987f 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -29,14 +29,14 @@ /****************/ #include "H5Pmodule.h" /* This source code file is part of the H5P module */ +#define H5D_FRIEND /* Suppress error about including H5Dpkg */ /***********/ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Dprivate.h" /* Datasets */ +#include "H5Dpkg.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* IDs */ @@ -45,6 +45,7 @@ #include "H5Ppkg.h" /* Property lists */ #include "H5Sprivate.h" /* Dataspaces */ #include "H5Tprivate.h" /* Datatypes */ +#include "H5VMprivate.h" /* Vectors and arrays */ #include "H5Zprivate.h" /* Data filters */ @@ -55,28 +56,28 @@ /* Define default layout information */ #define H5D_DEF_STORAGE_COMPACT_INIT {(hbool_t)FALSE, (size_t)0, NULL} #define H5D_DEF_STORAGE_CONTIG_INIT {HADDR_UNDEF, (hsize_t)0} -#define H5D_DEF_STORAGE_CHUNK_INIT {H5D_CHUNK_IDX_BTREE, HADDR_UNDEF, NULL, {{HADDR_UNDEF, NULL}}} -#define H5D_DEF_LAYOUT_CHUNK_INIT {(unsigned)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, (uint32_t)0, (hsize_t)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}} +#define H5D_DEF_STORAGE_CHUNK_INIT {H5D_CHUNK_IDX_BTREE, HADDR_UNDEF, H5D_COPS_BTREE, {{HADDR_UNDEF, NULL}}} +#define H5D_DEF_LAYOUT_CHUNK_INIT {(unsigned)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, (unsigned)0, (uint32_t)0, (hsize_t)0, (hsize_t)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}} #define H5D_DEF_STORAGE_VIRTUAL_INIT {{HADDR_UNDEF, 0}, 0, NULL, 0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, H5D_VDS_ERROR, HSIZE_UNDEF, -1, -1, FALSE} #ifdef H5_HAVE_C99_DESIGNATED_INITIALIZER #define H5D_DEF_STORAGE_COMPACT {H5D_COMPACT, { .compact = H5D_DEF_STORAGE_COMPACT_INIT }} #define H5D_DEF_STORAGE_CONTIG {H5D_CONTIGUOUS, { .contig = H5D_DEF_STORAGE_CONTIG_INIT }} #define H5D_DEF_STORAGE_CHUNK {H5D_CHUNKED, { .chunk = H5D_DEF_STORAGE_CHUNK_INIT }} #define H5D_DEF_STORAGE_VIRTUAL {H5D_VIRTUAL, { .virt = H5D_DEF_STORAGE_VIRTUAL_INIT }} -#define H5D_DEF_LAYOUT_COMPACT {H5D_COMPACT, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, H5D_DEF_STORAGE_COMPACT} -#define H5D_DEF_LAYOUT_CONTIG {H5D_CONTIGUOUS, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, H5D_DEF_STORAGE_CONTIG} -#define H5D_DEF_LAYOUT_CHUNK {H5D_CHUNKED, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, H5D_DEF_STORAGE_CHUNK} -#define H5D_DEF_LAYOUT_VIRTUAL {H5D_VIRTUAL, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, H5D_DEF_STORAGE_VIRTUAL} +#define H5D_DEF_LAYOUT_COMPACT {H5D_COMPACT, H5O_LAYOUT_VERSION_DEFAULT, H5D_LOPS_COMPACT, {H5D_DEF_LAYOUT_CHUNK_INIT}, H5D_DEF_STORAGE_COMPACT} +#define H5D_DEF_LAYOUT_CONTIG {H5D_CONTIGUOUS, H5O_LAYOUT_VERSION_DEFAULT, H5D_LOPS_CONTIG, {H5D_DEF_LAYOUT_CHUNK_INIT}, H5D_DEF_STORAGE_CONTIG} +#define H5D_DEF_LAYOUT_CHUNK {H5D_CHUNKED, H5O_LAYOUT_VERSION_DEFAULT, H5D_LOPS_CHUNK, {H5D_DEF_LAYOUT_CHUNK_INIT}, H5D_DEF_STORAGE_CHUNK} +#define H5D_DEF_LAYOUT_VIRTUAL {H5D_VIRTUAL, H5O_LAYOUT_VERSION_4, H5D_LOPS_VIRTUAL, {H5D_DEF_LAYOUT_CHUNK_INIT}, H5D_DEF_STORAGE_VIRTUAL} #else /* H5_HAVE_C99_DESIGNATED_INITIALIZER */ /* Note that the compact & chunked layout initialization values are using the * contiguous layout initialization in the union, because the contiguous * layout is first in the union. These values are overridden in the * H5P__init_def_layout() routine. -QAK */ -#define H5D_DEF_LAYOUT_COMPACT {H5D_COMPACT, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT}} -#define H5D_DEF_LAYOUT_CONTIG {H5D_CONTIGUOUS, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT}} -#define H5D_DEF_LAYOUT_CHUNK {H5D_CHUNKED, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT}} -#define H5D_DEF_LAYOUT_VIRTUAL {H5D_VIRTUAL, H5O_LAYOUT_VERSION_3, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT}} +#define H5D_DEF_LAYOUT_COMPACT {H5D_COMPACT, H5O_LAYOUT_VERSION_DEFAULT, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT}} +#define H5D_DEF_LAYOUT_CONTIG {H5D_CONTIGUOUS, H5O_LAYOUT_VERSION_DEFAULT, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT}} +#define H5D_DEF_LAYOUT_CHUNK {H5D_CHUNKED, H5O_LAYOUT_VERSION_DEFAULT, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT}} +#define H5D_DEF_LAYOUT_VIRTUAL {H5D_VIRTUAL, H5O_LAYOUT_VERSION_4, NULL, {H5D_DEF_LAYOUT_CHUNK_INIT}, {H5D_CONTIGUOUS, H5D_DEF_STORAGE_CONTIG_INIT}} #endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */ /* ======== Dataset creation properties ======== */ @@ -1997,6 +1998,7 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/]) H5P_genplist_t *plist; /* Property list pointer */ H5O_layout_t chunk_layout; /* Layout information for setting chunk info */ uint64_t chunk_nelmts; /* Number of elements in chunk */ + unsigned max_enc_bytes_per_dim; /* Max. number of bytes required to encode this dimension */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2024,7 +2026,10 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/]) HDmemcpy(&chunk_layout, &H5D_def_layout_chunk_g, sizeof(H5D_def_layout_chunk_g)); HDmemset(&chunk_layout.u.chunk.dim, 0, sizeof(chunk_layout.u.chunk.dim)); chunk_nelmts = 1; + max_enc_bytes_per_dim = 0; for(u = 0; u < (unsigned)ndims; u++) { + unsigned enc_bytes_per_dim; /* Number of bytes required to encode this dimension */ + if(dim[u] == 0) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "all chunk dimensions must be positive") if(dim[u] != (dim[u] & 0xffffffff)) @@ -2033,7 +2038,16 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/]) if(chunk_nelmts > (uint64_t)0xffffffff) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "number of elements in chunk must be < 4GB") chunk_layout.u.chunk.dim[u] = (uint32_t)dim[u]; /* Store user's chunk dimensions */ + + /* Get encoded size of dim, in bytes */ + enc_bytes_per_dim = (H5VM_log2_gen(dim[u]) + 8) / 8; + + /* Check if this is the largest value so far */ + if(enc_bytes_per_dim > max_enc_bytes_per_dim) + max_enc_bytes_per_dim = enc_bytes_per_dim; } /* end for */ + HDassert(max_enc_bytes_per_dim > 0 && max_enc_bytes_per_dim <= 8); + chunk_layout.u.chunk.enc_bytes_per_dim = max_enc_bytes_per_dim; /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) -- cgit v0.12 From 6d8b831b3125ce66e23aba1f3ec16a03e00b5b82 Mon Sep 17 00:00:00 2001 From: HDF Tester Date: Sun, 27 Dec 2015 23:20:23 -0500 Subject: [svn-r28730] Snapshot version 1.9 release 233 --- README.txt | 2 +- c++/src/cpp_doc_config | 2 +- config/lt_vers.am | 2 +- configure.ac | 2 +- release_docs/RELEASE.txt | 2 +- src/H5public.h | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.txt b/README.txt index 291e8a6..6dfd021 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.233 released on 2015-10-06 +HDF5 version 1.9.234 currently under development Please refer to the release_docs/INSTALL file for installation instructions. ------------------------------------------------------------------------------ diff --git a/c++/src/cpp_doc_config b/c++/src/cpp_doc_config index 7060fd2..623f9c7 100644 --- a/c++/src/cpp_doc_config +++ b/c++/src/cpp_doc_config @@ -38,7 +38,7 @@ PROJECT_NAME = "HDF5 C++ API" # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = "1.9.233 currently under development" +PROJECT_NUMBER = "1.9.234 currently under development" # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/config/lt_vers.am b/config/lt_vers.am index 401bcb9..a3b7634 100644 --- a/config/lt_vers.am +++ b/config/lt_vers.am @@ -19,7 +19,7 @@ # After making changes, run bin/reconfigure to update other configure related # files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 223 +LT_VERS_REVISION = 224 LT_VERS_AGE = 0 ## If the API changes *at all*, increment LT_VERS_INTERFACE and diff --git a/configure.ac b/configure.ac index 0c3514c..0e853a8 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,7 @@ AC_PREREQ([2.69]) ## NOTE: Do not forget to change the version number here when we do a ## release!!! ## -AC_INIT([HDF5], [1.9.232], [help@hdfgroup.org]) +AC_INIT([HDF5], [1.9.234], [help@hdfgroup.org]) AC_CONFIG_SRCDIR([src/H5.c]) AC_CONFIG_HEADERS([src/H5config.h]) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 1cfe382..2c9c79f 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -1,4 +1,4 @@ -HDF5 version 1.9.233 released on 2015-10-06 +HDF5 version 1.9.234 currently under development ================================================================================ diff --git a/src/H5public.h b/src/H5public.h index 5b95fb7..554ad26 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -94,10 +94,10 @@ extern "C" { /* Version numbers */ #define H5_VERS_MAJOR 1 /* For major interface/format changes */ #define H5_VERS_MINOR 9 /* For minor interface/format changes */ -#define H5_VERS_RELEASE 233 /* For tweaks, bug-fixes, or development */ +#define H5_VERS_RELEASE 234 /* For tweaks, bug-fixes, or development */ #define H5_VERS_SUBRELEASE "" /* For pre-releases like snap0 */ /* Empty string for real releases. */ -#define H5_VERS_INFO "HDF5 library version: 1.9.233" /* Full version string */ +#define H5_VERS_INFO "HDF5 library version: 1.9.234" /* Full version string */ #define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ H5_VERS_RELEASE) -- cgit v0.12 From b5504be6cc6f61b5a8ce78f243b81b6afe9d13c9 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 29 Dec 2015 12:06:36 -0500 Subject: [svn-r28742] Description: Add 'update' operation to v2 B-trees, which will insert a new record, or modify an existing one, depending on if the record exists or not. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest forthcoming) --- src/H5Abtree2.c | 8 +- src/H5B2.c | 74 +- src/H5B2dbg.c | 44 +- src/H5B2int.c | 401 +++++++ src/H5B2pkg.h | 27 +- src/H5B2private.h | 5 +- src/H5B2test.c | 168 ++- src/H5Gbtree2.c | 8 +- src/H5HFbtree2.c | 57 +- src/H5SMbtree2.c | 44 +- test/btree2.c | 2902 ++++++++++++++++++++++++++++++++++++++++++++------ tools/misc/h5debug.c | 4 + 12 files changed, 3227 insertions(+), 515 deletions(-) diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c index 972fb0b..716ad4a 100644 --- a/src/H5Abtree2.c +++ b/src/H5Abtree2.c @@ -116,9 +116,7 @@ const H5B2_class_t H5A_BT2_NAME[1]={{ /* B-tree class information */ H5A__dense_btree2_name_compare, /* Record comparison callback */ H5A__dense_btree2_name_encode, /* Record encoding callback */ H5A__dense_btree2_name_decode, /* Record decoding callback */ - H5A__dense_btree2_name_debug, /* Record debugging callback */ - NULL, /* Create debugging context */ - NULL /* Destroy debugging context */ + H5A__dense_btree2_name_debug /* Record debugging callback */ }}; /* v2 B-tree class for indexing 'creation order' field of attributes */ @@ -132,9 +130,7 @@ const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */ H5A__dense_btree2_corder_compare, /* Record comparison callback */ H5A__dense_btree2_corder_encode, /* Record encoding callback */ H5A__dense_btree2_corder_decode, /* Record decoding callback */ - H5A__dense_btree2_corder_debug, /* Record debugging callback */ - NULL, /* Create debugging context */ - NULL /* Destroy debugging context */ + H5A__dense_btree2_corder_debug /* Record debugging callback */ }}; diff --git a/src/H5B2.c b/src/H5B2.c index a171917..c105a93 100644 --- a/src/H5B2.c +++ b/src/H5B2.c @@ -86,6 +86,7 @@ extern const H5B2_class_t H5G_BT2_CORDER[1]; extern const H5B2_class_t H5SM_INDEX[1]; extern const H5B2_class_t H5A_BT2_NAME[1]; extern const H5B2_class_t H5A_BT2_CORDER[1]; +extern const H5B2_class_t H5B2_TEST2[1]; const H5B2_class_t *const H5B2_client_class_g[] = { H5B2_TEST, /* 0 - H5B2_TEST_ID */ @@ -98,6 +99,7 @@ const H5B2_class_t *const H5B2_client_class_g[] = { H5SM_INDEX, /* 7 - H5B2_SOHM_INDEX_ID */ H5A_BT2_NAME, /* 8 - H5B2_ATTR_DENSE_NAME_ID */ H5A_BT2_CORDER, /* 9 - H5B2_ATTR_DENSE_CORDER_ID */ + H5B2_TEST2, /* 10 - H5B2_TEST_ID */ }; @@ -282,36 +284,78 @@ H5B2_insert(H5B2_t *bt2, hid_t dxpl_id, void *udata) /* Get the v2 B-tree header */ hdr = bt2->hdr; + /* Insert the record */ + if(H5B2__insert_hdr(hdr, dxpl_id, udata) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5B2_insert() */ + + +/*------------------------------------------------------------------------- + * Function: H5B2_update + * + * Purpose: Insert or modify a record to the B-tree. + * If the record exists already, it is modified as if H5B2_modify + * was called). If it doesn't exist, it is inserted as if + * H5B2_insert was called. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Dec 23 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5B2_update(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op, void *op_data) +{ + H5B2_hdr_t *hdr; /* Pointer to the B-tree header */ + H5B2_update_status_t status = H5B2_UPDATE_UNKNOWN; /* Whether the record was inserted/modified */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Check arguments. */ + HDassert(bt2); + HDassert(udata); + + /* Set the shared v2 B-tree header's file context for this operation */ + bt2->hdr->f = bt2->f; + + /* Get the v2 B-tree header */ + hdr = bt2->hdr; + /* Check if the root node is allocated yet */ if(!H5F_addr_defined(hdr->root.addr)) { /* Create root node as leaf node in B-tree */ if(H5B2__create_leaf(hdr, dxpl_id, &(hdr->root)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create root node") } /* end if */ - /* Check if we need to split the root node (equiv. to a 1->2 node split) */ - else if(hdr->root.node_nrec == hdr->node_info[hdr->depth].split_nrec) { - /* Split root node */ - if(H5B2__split_root(hdr, dxpl_id) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split root node") - } /* end if */ /* Attempt to insert record into B-tree */ if(hdr->depth > 0) { - if(H5B2__insert_internal(hdr, dxpl_id, hdr->depth, NULL, &hdr->root, H5B2_POS_ROOT, udata) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree internal node") + if(H5B2__update_internal(hdr, dxpl_id, hdr->depth, NULL, &hdr->root, &status, H5B2_POS_ROOT, udata, op, op_data) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to update record in B-tree internal node") } /* end if */ else { - if(H5B2__insert_leaf(hdr, dxpl_id, &hdr->root, H5B2_POS_ROOT, udata) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree leaf node") + if(H5B2__update_leaf(hdr, dxpl_id, &hdr->root, &status, H5B2_POS_ROOT, udata, op, op_data) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to update record in B-tree leaf node") } /* end else */ - /* Mark B-tree header as dirty */ - if(H5B2__hdr_dirty(hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark B-tree header dirty") + /* Sanity check */ + HDassert(H5B2_UPDATE_UNKNOWN != status); + + /* Use insert algorithm if nodes to leaf full */ + if(H5B2_UPDATE_INSERT_CHILD_FULL == status) + if(H5B2__insert_hdr(hdr, dxpl_id, udata) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree") done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5B2_insert() */ +} /* H5B2_update() */ /*------------------------------------------------------------------------- @@ -1202,7 +1246,7 @@ H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op, /* Unlock current node */ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, leaf_flags) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") - } + } /* end block */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c index 73084d2..ddff9e9 100644 --- a/src/H5B2dbg.c +++ b/src/H5B2dbg.c @@ -92,7 +92,6 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, const H5B2_class_t *type, haddr_t obj_addr) { H5B2_hdr_t *hdr = NULL; /* B-tree header info */ - void *dbg_ctx = NULL; /* v2 B-tree debugging context */ unsigned u; /* Local index variable */ char temp_str[128]; /* Temporary string, for formatting */ herr_t ret_value = SUCCEED; /* Return value */ @@ -109,17 +108,9 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, HDassert(indent >= 0); HDassert(fwidth >= 0); HDassert(type); - HDassert((type->crt_dbg_ctx && type->dst_dbg_ctx) || - (NULL == type->crt_dbg_ctx && NULL == type->dst_dbg_ctx)); - - /* Check for debugging context callback available */ - if(type->crt_dbg_ctx) - /* Create debugging context */ - if(NULL == (dbg_ctx = (type->crt_dbg_ctx)(f, dxpl_id, obj_addr))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context") /* Load the B-tree header */ - if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) + if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, addr, f, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header") /* Set file pointer for this B-tree operation */ @@ -171,8 +162,6 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, } /* end for */ done: - if(dbg_ctx && (type->dst_dbg_ctx)(dbg_ctx) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to release v2 B-tree debugging context") if(hdr && H5B2__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release v2 B-tree header") @@ -199,7 +188,6 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, { H5B2_hdr_t *hdr = NULL; /* B-tree header */ H5B2_internal_t *internal = NULL; /* B-tree internal node */ - void *dbg_ctx = NULL; /* v2 B-tree debugging context */ unsigned u; /* Local index variable */ char temp_str[128]; /* Temporary string, for formatting */ herr_t ret_value=SUCCEED; /* Return value */ @@ -215,21 +203,12 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, HDassert(indent >= 0); HDassert(fwidth >= 0); HDassert(type); - HDassert((type->crt_dbg_ctx && type->dst_dbg_ctx) || - (NULL == type->crt_dbg_ctx && NULL == type->dst_dbg_ctx)); HDassert(H5F_addr_defined(hdr_addr)); HDassert(H5F_addr_defined(obj_addr)); HDassert(nrec > 0); - /* Check for debugging context callback available */ - if(type->crt_dbg_ctx) { - /* Create debugging context */ - if(NULL == (dbg_ctx = (type->crt_dbg_ctx)(f, dxpl_id, obj_addr))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context") - } /* end if */ - /* Load the B-tree header */ - if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) + if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, hdr_addr, f, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load v2 B-tree header") /* Set file pointer for this B-tree operation */ @@ -279,7 +258,7 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); HDassert(H5B2_INT_NREC(internal, hdr, u)); - (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6), H5B2_INT_NREC(internal, hdr, u), dbg_ctx); + (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6), H5B2_INT_NREC(internal, hdr, u), hdr->cb_ctx); } /* end for */ /* Print final node pointer */ @@ -291,8 +270,6 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, internal->node_ptrs[u].addr); done: - if(dbg_ctx && (type->dst_dbg_ctx)(dbg_ctx) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to release v2 B-tree debugging context") if(hdr && H5B2__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release v2 B-tree header") if(internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, addr, internal, H5AC__NO_FLAGS_SET) < 0) @@ -321,7 +298,6 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent { H5B2_hdr_t *hdr = NULL; /* B-tree header */ H5B2_leaf_t *leaf = NULL; /* B-tree leaf node */ - void *dbg_ctx = NULL; /* v2 B-tree debugging context */ unsigned u; /* Local index variable */ char temp_str[128]; /* Temporary string, for formatting */ herr_t ret_value = SUCCEED; /* Return value */ @@ -337,20 +313,12 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent HDassert(indent >= 0); HDassert(fwidth >= 0); HDassert(type); - HDassert((type->crt_dbg_ctx && type->dst_dbg_ctx) || - (NULL == type->crt_dbg_ctx && NULL == type->dst_dbg_ctx)); HDassert(H5F_addr_defined(hdr_addr)); HDassert(H5F_addr_defined(obj_addr)); HDassert(nrec > 0); - /* Check for debugging context callback available */ - if(type->crt_dbg_ctx) - /* Create debugging context */ - if(NULL == (dbg_ctx = (type->crt_dbg_ctx)(f, dxpl_id, obj_addr))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context") - /* Load the B-tree header */ - if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, hdr_addr, dbg_ctx, H5AC__READ_ONLY_FLAG))) + if(NULL == (hdr = H5B2__hdr_protect(f, dxpl_id, hdr_addr, f, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect v2 B-tree header") /* Set file pointer for this B-tree operation */ @@ -391,12 +359,10 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str); HDassert(H5B2_LEAF_NREC(leaf, hdr, u)); - (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6), H5B2_LEAF_NREC(leaf, hdr, u), dbg_ctx); + (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6), H5B2_LEAF_NREC(leaf, hdr, u), hdr->cb_ctx); } /* end for */ done: - if(dbg_ctx && (type->dst_dbg_ctx)(dbg_ctx) < 0) - HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to release v2 B-tree debugging context") if(hdr && H5B2__hdr_unprotect(hdr, dxpl_id, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header") if(leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, addr, leaf, H5AC__NO_FLAGS_SET) < 0) diff --git a/src/H5B2int.c b/src/H5B2int.c index b8c9634..363d903 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -1513,6 +1513,62 @@ done: /*------------------------------------------------------------------------- + * Function: H5B2__insert_hdr + * + * Purpose: Adds a new record to the B-tree. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Dec 23 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5B2__insert_hdr(H5B2_hdr_t *hdr, hid_t dxpl_id, void *udata) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check arguments. */ + HDassert(hdr); + HDassert(udata); + + /* Check if the root node is allocated yet */ + if(!H5F_addr_defined(hdr->root.addr)) { + /* Create root node as leaf node in B-tree */ + if(H5B2__create_leaf(hdr, dxpl_id, &(hdr->root)) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create root node") + } /* end if */ + /* Check if we need to split the root node (equiv. to a 1->2 node split) */ + else if(hdr->root.node_nrec == hdr->node_info[hdr->depth].split_nrec) { + /* Split root node */ + if(H5B2__split_root(hdr, dxpl_id) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split root node") + } /* end if */ + + /* Attempt to insert record into B-tree */ + if(hdr->depth > 0) { + if(H5B2__insert_internal(hdr, dxpl_id, hdr->depth, NULL, &hdr->root, H5B2_POS_ROOT, udata) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree internal node") + } /* end if */ + else { + if(H5B2__insert_leaf(hdr, dxpl_id, &hdr->root, H5B2_POS_ROOT, udata) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree leaf node") + } /* end else */ + + /* Mark B-tree header as dirty */ + if(H5B2__hdr_dirty(hdr) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTMARKDIRTY, FAIL, "unable to mark B-tree header dirty") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5B2__insert_hdr() */ + + +/*------------------------------------------------------------------------- * Function: H5B2__insert_leaf * * Purpose: Adds a new record to a B-tree leaf node. @@ -1644,6 +1700,9 @@ H5B2__insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, if(NULL == (internal = H5B2__protect_internal(hdr, dxpl_id, curr_node_ptr->addr, curr_node_ptr->node_nrec, depth, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") + /* Sanity check number of records */ + HDassert(internal->nrec == curr_node_ptr->node_nrec); + /* Split or redistribute child node pointers, if necessary */ { int cmp; /* Comparison value of records */ @@ -1755,6 +1814,348 @@ done: /*------------------------------------------------------------------------- + * Function: H5B2__update_leaf + * + * Purpose: Insert or modify a record in a B-tree leaf node. + * If the record exists already, it is modified as if H5B2_modify + * was called). If it doesn't exist, it is inserted as if + * H5B2_insert was called. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Dec 23 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5B2__update_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr, + H5B2_update_status_t *status, H5B2_nodepos_t curr_pos, void *udata, + H5B2_modify_t op, void *op_data) +{ + H5B2_leaf_t *leaf; /* Pointer to leaf node */ + unsigned leaf_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting the leaf node */ + int cmp = -1; /* Comparison value of records */ + unsigned idx; /* Location of record which matches key */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check arguments. */ + HDassert(hdr); + HDassert(curr_node_ptr); + HDassert(H5F_addr_defined(curr_node_ptr->addr)); + + /* Lock current B-tree node */ + if(NULL == (leaf = H5B2__protect_leaf(hdr, dxpl_id, curr_node_ptr->addr, curr_node_ptr->node_nrec, H5AC__NO_FLAGS_SET))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + + /* Sanity check number of records */ + HDassert(curr_node_ptr->all_nrec == curr_node_ptr->node_nrec); + HDassert(leaf->nrec == curr_node_ptr->node_nrec); + + /* Check for inserting into empty leaf */ + if(leaf->nrec == 0) + idx = 0; + else { + /* Find correct location to insert this record */ + cmp = H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx); + + /* Check for inserting a record */ + if(0 != cmp) { + /* Check if the leaf node is full */ + if(curr_node_ptr->node_nrec == hdr->node_info[0].split_nrec) { + /* Indicate that the leaf is full, but we need to insert */ + *status = H5B2_UPDATE_INSERT_CHILD_FULL; + + /* Let calling routine handle insertion */ + HGOTO_DONE(SUCCEED) + } /* end if */ + + /* Adjust index to leave room for record to insert */ + if(cmp > 0) + idx++; + + /* Make room for new record */ + if(idx < leaf->nrec) + HDmemmove(H5B2_LEAF_NREC(leaf, hdr, idx + 1), H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size * (leaf->nrec - idx)); + } /* end if */ + } /* end else */ + + /* Check for modifying existing record */ + if(0 == cmp) { + hbool_t changed = FALSE; /* Whether the 'modify' callback changed the record */ + + /* Make callback for current record */ + if((op)(H5B2_LEAF_NREC(leaf, hdr, idx), op_data, &changed) < 0) { + /* Make certain that the callback didn't modify the value if it failed */ + HDassert(changed == FALSE); + + HGOTO_ERROR(H5E_BTREE, H5E_CANTMODIFY, FAIL, "'modify' callback failed for B-tree update operation") + } /* end if */ + + /* Mark the node as dirty if it changed */ + leaf_flags |= (changed ? H5AC__DIRTIED_FLAG : 0); + + /* Indicate that the record was modified */ + *status = H5B2_UPDATE_MODIFY_DONE; + } /* end if */ + else { + /* Must have a leaf node with enough space to insert a record now */ + HDassert(curr_node_ptr->node_nrec < hdr->node_info[0].max_nrec); + + /* Make callback to store record in native form */ + if((hdr->cls->store)(H5B2_LEAF_NREC(leaf, hdr, idx), udata) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into leaf node") + + /* Mark the node as dirty if it changed */ + leaf_flags |= H5AC__DIRTIED_FLAG; + + /* Indicate that the record was inserted */ + *status = H5B2_UPDATE_INSERT_DONE; + + /* Update record count for node pointer to current node */ + curr_node_ptr->all_nrec++; + curr_node_ptr->node_nrec++; + + /* Update record count for current node */ + leaf->nrec++; + } /* end else */ + + /* Check for new record being the min or max for the tree */ + /* (Don't use 'else' for the idx check, to allow for root leaf node) */ + if(H5B2_POS_MIDDLE != curr_pos) { + if(idx == 0) { + if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) { + if(hdr->min_native_rec == NULL) + if(NULL == (hdr->min_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info") + HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); + } /* end if */ + } /* end if */ + if(idx == (unsigned)(leaf->nrec - 1)) { + if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) { + if(hdr->max_native_rec == NULL) + if(NULL == (hdr->max_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info") + HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); + } /* end if */ + } /* end if */ + } /* end if */ + +done: + /* Release the B-tree leaf node */ + if(leaf && H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr->addr, leaf, leaf_flags) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release leaf B-tree node") + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5B2__update_leaf() */ + + +/*------------------------------------------------------------------------- + * Function: H5B2__update_internal + * + * Purpose: Insert or modify a record in a B-tree leaf node. + * If the record exists already, it is modified as if H5B2_modify + * was called). If it doesn't exist, it is inserted as if + * H5B2_insert was called. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Dec 24 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5B2__update_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, + unsigned *parent_cache_info_flags_ptr, H5B2_node_ptr_t *curr_node_ptr, + H5B2_update_status_t *status, H5B2_nodepos_t curr_pos, void *udata, + H5B2_modify_t op, void *op_data) +{ + H5B2_internal_t *internal = NULL; /* Pointer to internal node */ + unsigned internal_flags = H5AC__NO_FLAGS_SET; + int cmp; /* Comparison value of records */ + unsigned idx; /* Location of record which matches key */ + H5B2_nodepos_t next_pos = H5B2_POS_MIDDLE; /* Position of node */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check arguments. */ + HDassert(hdr); + HDassert(depth > 0); + HDassert(curr_node_ptr); + HDassert(H5F_addr_defined(curr_node_ptr->addr)); + + /* Lock current B-tree node */ + if(NULL == (internal = H5B2__protect_internal(hdr, dxpl_id, curr_node_ptr->addr, curr_node_ptr->node_nrec, depth, H5AC__NO_FLAGS_SET))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") + + /* Sanity check number of records */ + HDassert(internal->nrec == curr_node_ptr->node_nrec); + + /* Locate node pointer for child */ + cmp = H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx); + + /* Check for modifying existing record */ + if(0 == cmp) { + hbool_t changed = FALSE; /* Whether the 'modify' callback changed the record */ + + /* Make callback for current record */ + if((op)(H5B2_INT_NREC(internal, hdr, idx), op_data, &changed) < 0) { + /* Make certain that the callback didn't modify the value if it failed */ + HDassert(changed == FALSE); + + HGOTO_ERROR(H5E_BTREE, H5E_CANTMODIFY, FAIL, "'modify' callback failed for B-tree update operation") + } /* end if */ + + /* Mark the node as dirty if it changed */ + internal_flags |= (changed ? H5AC__DIRTIED_FLAG : 0); + + /* Indicate that the record was modified */ + *status = H5B2_UPDATE_MODIFY_DONE; + } /* end if */ + else { + /* Adjust index to leave room for node to insert */ + if(cmp > 0) + idx++; + + /* Check if this node is left/right-most */ + if(H5B2_POS_MIDDLE != curr_pos) { + if(idx == 0) { + if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) + next_pos = H5B2_POS_LEFT; + } /* end if */ + else if(idx == internal->nrec) { + if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) + next_pos = H5B2_POS_RIGHT; + } /* end else */ + } /* end if */ + + /* Attempt to update record in child */ + if(depth > 1) { + if(H5B2__update_internal(hdr, dxpl_id, (uint16_t)(depth - 1), &internal_flags, &internal->node_ptrs[idx], status, next_pos, udata, op, op_data) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update record in internal B-tree node") + } /* end if */ + else { + if(H5B2__update_leaf(hdr, dxpl_id, &internal->node_ptrs[idx], status, next_pos, udata, op, op_data) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "unable to update record in leaf B-tree node") + } /* end else */ + + /* Take actions based on child's status report */ + switch(*status) { + case H5B2_UPDATE_MODIFY_DONE: + /* No action */ + break; + + case H5B2_UPDATE_INSERT_DONE: + /* Mark node as dirty */ + internal_flags |= H5AC__DIRTIED_FLAG; + + /* Update total record count for node pointer to current node */ + curr_node_ptr->all_nrec++; + break; + + case H5B2_UPDATE_INSERT_CHILD_FULL: + /* Split/redistribute this node */ + if(internal->nrec == hdr->node_info[depth].split_nrec) { + hbool_t could_split = FALSE; /* Whether the child node could split */ + +#ifdef QAK +HDfprintf(stderr, "%s: idx = %u, internal->nrec = %u\n", FUNC, idx, internal->nrec); +HDfprintf(stderr, "%s: hdr->node_info[%u].split_nrec = %u\n", FUNC, (unsigned)depth, (unsigned)hdr->node_info[depth].split_nrec); +HDfprintf(stderr, "%s: hdr->node_info[%u].split_nrec = %u\n", FUNC, (unsigned)(depth - 1), (unsigned)hdr->node_info[depth - 1].split_nrec); +#endif /* QAK */ + if(idx == 0) { /* Left-most child */ +#ifdef QAK +HDfprintf(stderr, "%s: Left-most child\n", FUNC); +HDfprintf(stderr, "%s: internal->node_ptrs[%u].node_nrec = %u\n", FUNC, (unsigned)idx, (unsigned)internal->node_ptrs[idx].node_nrec); +HDfprintf(stderr, "%s: internal->node_ptrs[%u].node_nrec = %u\n", FUNC, (unsigned)(idx + 1), (unsigned)internal->node_ptrs[idx + 1].node_nrec); +#endif /* QAK */ + /* Check for left-most child and its neighbor being close to full */ + if((internal->node_ptrs[idx].node_nrec + internal->node_ptrs[idx + 1].node_nrec) + >= ((hdr->node_info[depth - 1].split_nrec * 2) - 1)) + could_split = TRUE; + } /* end if */ + else if(idx == internal->nrec) { /* Right-most child */ +#ifdef QAK +HDfprintf(stderr, "%s: Right-most child\n", FUNC); +HDfprintf(stderr, "%s: internal->node_ptrs[%u].node_nrec = %u\n", FUNC, (unsigned)(idx - 1), (unsigned)internal->node_ptrs[idx - 1].node_nrec); +HDfprintf(stderr, "%s: internal->node_ptrs[%u].node_nrec = %u\n", FUNC, (unsigned)idx, (unsigned)internal->node_ptrs[idx].node_nrec); +#endif /* QAK */ + /* Check for right-most child and its neighbor being close to full */ + if((internal->node_ptrs[idx - 1].node_nrec + internal->node_ptrs[idx].node_nrec) + >= ((hdr->node_info[depth - 1].split_nrec * 2) - 1)) + could_split = TRUE; + } /* end else-if */ + else { /* Middle child */ +#ifdef QAK +HDfprintf(stderr, "%s: Middle child\n", FUNC); +HDfprintf(stderr, "%s: internal->node_ptrs[%u].node_nrec = %u\n", FUNC, (unsigned)(idx - 1), (unsigned)internal->node_ptrs[idx - 1].node_nrec); +HDfprintf(stderr, "%s: internal->node_ptrs[%u].node_nrec = %u\n", FUNC, (unsigned)idx, (unsigned)internal->node_ptrs[idx].node_nrec); +HDfprintf(stderr, "%s: internal->node_ptrs[%u].node_nrec = %u\n", FUNC, (unsigned)(idx + 1), (unsigned)internal->node_ptrs[idx + 1].node_nrec); +#endif /* QAK */ + /* Check for middle child and its left neighbor being close to full */ + if((internal->node_ptrs[idx - 1].node_nrec + internal->node_ptrs[idx].node_nrec) + >= ((hdr->node_info[depth - 1].split_nrec * 2) - 1)) + could_split = TRUE; + /* Check for middle child and its right neighbor being close to full */ + else if((internal->node_ptrs[idx].node_nrec + internal->node_ptrs[idx + 1].node_nrec) + >= ((hdr->node_info[depth - 1].split_nrec * 2) - 1)) + could_split = TRUE; + } /* end if */ + + /* If this node is full and the child node insertion could + * cause a split, punt back up to caller, leaving the + * "insert child full" status. + */ + if(could_split) { + /* Release the internal B-tree node */ + if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node") + internal = NULL; + +#ifdef QAK +HDfprintf(stderr, "%s: Punting back to caller\n", FUNC); +#endif /* QAK */ + /* Punt back to caller */ + HGOTO_DONE(SUCCEED); + } /* end if */ + } /* end if */ + + /* Release the internal B-tree node */ + if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node") + internal = NULL; + + /* Indicate that the record was inserted */ + *status = H5B2_UPDATE_INSERT_DONE; + + /* Dodge sideways into inserting a record into this node */ + if(H5B2__insert_internal(hdr, dxpl_id, depth, parent_cache_info_flags_ptr, curr_node_ptr, curr_pos, udata) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into internal B-tree node") + break; + + case H5B2_UPDATE_UNKNOWN: + default: + HDassert(0 && "Invalid update status"); + HGOTO_ERROR(H5E_BTREE, H5E_CANTUPDATE, FAIL, "invalid update status") + } /* end switch */ + } /* end else */ + +done: + /* Release the internal B-tree node */ + if(internal && H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, internal, internal_flags) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release internal B-tree node") + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5B2__update_internal() */ + + +/*------------------------------------------------------------------------- * Function: H5B2__create_leaf * * Purpose: Creates empty leaf node of a B-tree and update node pointer diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h index f58850e..d6b6c04 100644 --- a/src/H5B2pkg.h +++ b/src/H5B2pkg.h @@ -228,6 +228,14 @@ typedef enum H5B2_nodepos_t { H5B2_POS_MIDDLE /* Node is neither right or left-most in tree */ } H5B2_nodepos_t; +/* Update status */ +typedef enum H5B2_update_status_t { + H5B2_UPDATE_UNKNOWN, /* Unknown update status (initial state) */ + H5B2_UPDATE_MODIFY_DONE, /* Update successfully modified existing record */ + H5B2_UPDATE_INSERT_DONE, /* Update inserted record successfully */ + H5B2_UPDATE_INSERT_CHILD_FULL /* Update will insert record, but child is full */ +} H5B2_update_status_t; + /* Callback info for loading a free space header into the cache */ typedef struct H5B2_hdr_cache_ud_t { H5F_t *f; /* File that v2 b-tree header is within */ @@ -252,7 +260,7 @@ typedef struct H5B2_leaf_cache_ud_t { #ifdef H5B2_TESTING /* Node information for testing */ -typedef struct { +typedef struct H5B2_node_info_test_t { unsigned depth; /* Depth of node */ unsigned nrec; /* Number of records in node */ } H5B2_node_info_test_t; @@ -281,6 +289,13 @@ H5FL_EXTERN(H5B2_leaf_t); /* Internal v2 B-tree testing class */ #ifdef H5B2_TESTING H5_DLLVAR const H5B2_class_t H5B2_TEST[1]; +H5_DLLVAR const H5B2_class_t H5B2_TEST2[1]; + +/* B-tree record for testing H5B2_TEST2 class */ +typedef struct H5B2_test_rec_t { + hsize_t key; /* Key for record */ + hsize_t val; /* Value for record */ +} H5B2_test_rec_t; #endif /* H5B2_TESTING */ /* Array of v2 B-tree client ID -> client class mappings */ @@ -327,12 +342,22 @@ H5_DLL herr_t H5B2__leaf_free(H5B2_leaf_t *l); H5_DLL herr_t H5B2__internal_free(H5B2_internal_t *i); /* Routines for inserting records */ +H5_DLL herr_t H5B2__insert_hdr(H5B2_hdr_t *hdr, hid_t dxpl_id, void *udata); H5_DLL herr_t H5B2__insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, unsigned *parent_cache_info_flags_ptr, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, void *udata); H5_DLL herr_t H5B2__insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr, H5B2_nodepos_t curr_pos, void *udata); +/* Routines for update records */ +H5_DLL herr_t H5B2__update_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, + uint16_t depth, unsigned *parent_cache_info_flags_ptr, + H5B2_node_ptr_t *curr_node_ptr, H5B2_update_status_t *status, + H5B2_nodepos_t curr_pos, void *udata, H5B2_modify_t op, void *op_data); +H5_DLL herr_t H5B2__update_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, + H5B2_node_ptr_t *curr_node_ptr, H5B2_update_status_t *status, + H5B2_nodepos_t curr_pos, void *udata, H5B2_modify_t op, void *op_data); + /* Routines for iterating over nodes/records */ H5_DLL herr_t H5B2__iterate_node(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, const H5B2_node_ptr_t *curr_node, H5B2_operator_t op, void *op_data); diff --git a/src/H5B2private.h b/src/H5B2private.h index 9e3c2d7..ff94680 100644 --- a/src/H5B2private.h +++ b/src/H5B2private.h @@ -54,6 +54,7 @@ typedef enum H5B2_subid_t { H5B2_SOHM_INDEX_ID, /* B-tree is an index for shared object header messages */ H5B2_ATTR_DENSE_NAME_ID, /* B-tree is for indexing 'name' field for "dense" attribute storage on objects */ H5B2_ATTR_DENSE_CORDER_ID, /* B-tree is for indexing 'creation order' field for "dense" attribute storage on objects */ + H5B2_TEST2_ID, /* Another B-tree is for testing (do not use for actual data) */ H5B2_NUM_BTREE_ID /* Number of B-tree IDs (must be last) */ } H5B2_subid_t; @@ -94,8 +95,6 @@ struct H5B2_class_t { herr_t (*decode)(const uint8_t *raw, void *record, void *ctx); /* Decode record from disk storage form to native form */ herr_t (*debug)(FILE *stream, int indent, int fwidth, /* Print a record for debugging */ const void *record, const void *ctx); - void *(*crt_dbg_ctx)(H5F_t *f, hid_t dxpl_id, haddr_t obj_addr); /* Create debugging context */ - herr_t (*dst_dbg_ctx)(void *dbg_ctx); /* Destroy debugging context */ }; /* v2 B-tree creation parameters */ @@ -140,6 +139,8 @@ H5_DLL herr_t H5B2_neighbor(H5B2_t *bt2, hid_t dxpl_id, H5B2_compare_t range, void *udata, H5B2_found_t op, void *op_data); H5_DLL herr_t H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op, void *op_data); +H5_DLL herr_t H5B2_update(H5B2_t *bt2, hid_t dxpl_id, void *udata, + H5B2_modify_t op, void *op_data); H5_DLL herr_t H5B2_remove(H5B2_t *b2, hid_t dxpl_id, void *udata, H5B2_remove_t op, void *op_data); H5_DLL herr_t H5B2_remove_by_idx(H5B2_t *bt2, hid_t dxpl_id, diff --git a/src/H5B2test.c b/src/H5B2test.c index 87fddf7..e0c96fb 100644 --- a/src/H5B2test.c +++ b/src/H5B2test.c @@ -61,6 +61,7 @@ typedef struct H5B2_test_ctx_t { /* Local Prototypes */ /********************/ +/* v2 B-tree driver callbacks for 'test' B-trees */ static void *H5B2__test_crt_context(void *udata); static herr_t H5B2__test_dst_context(void *ctx); static herr_t H5B2__test_store(void *nrecord, const void *udata); @@ -69,13 +70,21 @@ static herr_t H5B2__test_encode(uint8_t *raw, const void *nrecord, void *ctx); static herr_t H5B2__test_decode(const uint8_t *raw, void *nrecord, void *ctx); static herr_t H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record, const void *_udata); -static void *H5B2__test_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr); + +/* v2 B-tree driver callbacks for 'test2' B-trees */ +static herr_t H5B2__test2_store(void *nrecord, const void *udata); +static herr_t H5B2__test2_compare(const void *rec1, const void *rec2); +static herr_t H5B2__test2_encode(uint8_t *raw, const void *nrecord, void *ctx); +static herr_t H5B2__test2_decode(const uint8_t *raw, void *nrecord, void *ctx); +static herr_t H5B2__test2_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *_udata); /*********************/ /* Package Variables */ /*********************/ +/* Class structure for testing simple B-tree records */ const H5B2_class_t H5B2_TEST[1]={{ /* B-tree class information */ H5B2_TEST_ID, /* Type of B-tree */ "H5B2_TEST_ID", /* Name of B-tree class */ @@ -86,9 +95,21 @@ const H5B2_class_t H5B2_TEST[1]={{ /* B-tree class information */ H5B2__test_compare, /* Record comparison callback */ H5B2__test_encode, /* Record encoding callback */ H5B2__test_decode, /* Record decoding callback */ - H5B2__test_debug, /* Record debugging callback */ - H5B2__test_crt_dbg_context, /* Create debugging context */ - H5B2__test_dst_context /* Destroy debugging context */ + H5B2__test_debug /* Record debugging callback */ +}}; + +/* Class structure for testing key/value B-tree records */ +const H5B2_class_t H5B2_TEST2[1]={{ /* B-tree class information */ + H5B2_TEST2_ID, /* Type of B-tree */ + "H5B2_TEST2_ID", /* Name of B-tree class */ + sizeof(H5B2_test_rec_t), /* Size of native record */ + H5B2__test_crt_context, /* Create client callback context */ + H5B2__test_dst_context, /* Destroy client callback context */ + H5B2__test2_store, /* Record storage callback */ + H5B2__test2_compare, /* Record comparison callback */ + H5B2__test2_encode, /* Record encoding callback */ + H5B2__test2_decode, /* Record decoding callback */ + H5B2__test2_debug /* Record debugging callback */ }}; @@ -310,42 +331,139 @@ H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record, /*------------------------------------------------------------------------- - * Function: H5B2__test_crt_dbg_context + * Function: H5B2__test2_store * - * Purpose: Create context for debugging callback + * Purpose: Store native information into record for B-tree * - * Return: Success: non-NULL - * Failure: NULL + * Return: Success: non-negative + * Failure: negative * * Programmer: Quincey Koziol - * Tuesday, December 1, 2009 + * Friday, December 25, 2015 * *------------------------------------------------------------------------- */ -static void * -H5B2__test_crt_dbg_context(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr) +static herr_t +H5B2__test2_store(void *nrecord, const void *udata) { - H5B2_test_ctx_t *ctx; /* Callback context structure */ - void *ret_value = NULL; /* Return value */ + FUNC_ENTER_STATIC_NOERR - FUNC_ENTER_STATIC + *(H5B2_test_rec_t *)nrecord = *(const H5B2_test_rec_t *)udata; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5B2__test2_store() */ + + +/*------------------------------------------------------------------------- + * Function: H5B2__test2_compare + * + * Purpose: Compare two native information records, according to some key + * + * Return: <0 if rec1 < rec2 + * =0 if rec1 == rec2 + * >0 if rec1 > rec2 + * + * Programmer: Quincey Koziol + * Friday, December 25, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5B2__test2_compare(const void *rec1, const void *rec2) +{ + FUNC_ENTER_STATIC_NOERR + + FUNC_LEAVE_NOAPI((herr_t)(((const H5B2_test_rec_t *)rec1)->key - ((const H5B2_test_rec_t *)rec2)->key)) +} /* H5B2__test2_compare() */ + + +/*------------------------------------------------------------------------- + * Function: H5B2__test2_encode + * + * Purpose: Encode native information into raw form for storing on disk + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Friday, December 25, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5B2__test2_encode(uint8_t *raw, const void *nrecord, void *_ctx) +{ + H5B2_test_ctx_t *ctx = (H5B2_test_ctx_t *)_ctx; /* Callback context structure */ + + FUNC_ENTER_STATIC_NOERR /* Sanity check */ - HDassert(f); + HDassert(ctx); - /* Allocate callback context */ - if(NULL == (ctx = H5FL_MALLOC(H5B2_test_ctx_t))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate callback context") + H5F_ENCODE_LENGTH_LEN(raw, ((const H5B2_test_rec_t *)nrecord)->key, ctx->sizeof_size); + H5F_ENCODE_LENGTH_LEN(raw, ((const H5B2_test_rec_t *)nrecord)->val, ctx->sizeof_size); - /* Determine the size of addresses & lengths in the file */ - ctx->sizeof_size = H5F_SIZEOF_SIZE(f); + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5B2__test2_encode() */ - /* Set return value */ - ret_value = ctx; + +/*------------------------------------------------------------------------- + * Function: H5B2__test2_decode + * + * Purpose: Decode raw disk form of record into native form + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Friday, December 25, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5B2__test2_decode(const uint8_t *raw, void *nrecord, void *_ctx) +{ + H5B2_test_ctx_t *ctx = (H5B2_test_ctx_t *)_ctx; /* Callback context structure */ -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5B2__test_crt_dbg_context() */ + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(ctx); + + H5F_DECODE_LENGTH_LEN(raw, ((H5B2_test_rec_t *)nrecord)->key, ctx->sizeof_size); + H5F_DECODE_LENGTH_LEN(raw, ((H5B2_test_rec_t *)nrecord)->val, ctx->sizeof_size); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5B2__test2_decode() */ + + +/*------------------------------------------------------------------------- + * Function: H5B2__test2_debug + * + * Purpose: Debug native form of record + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Friday, December 25, 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5B2__test2_debug(FILE *stream, int indent, int fwidth, const void *record, + const void H5_ATTR_UNUSED *_udata) +{ + FUNC_ENTER_STATIC_NOERR + + HDassert(record); + + HDfprintf(stream, "%*s%-*s (%Hu, %Hu)\n", indent, "", fwidth, "Record:", + ((const H5B2_test_rec_t *)record)->key, + ((const H5B2_test_rec_t *)record)->val); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5B2__test2_debug() */ /*------------------------------------------------------------------------- diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c index b464930..1a99b12 100644 --- a/src/H5Gbtree2.c +++ b/src/H5Gbtree2.c @@ -114,9 +114,7 @@ const H5B2_class_t H5G_BT2_NAME[1]={{ /* B-tree class information */ H5G_dense_btree2_name_compare, /* Record comparison callback */ H5G_dense_btree2_name_encode, /* Record encoding callback */ H5G_dense_btree2_name_decode, /* Record decoding callback */ - H5G_dense_btree2_name_debug, /* Record debugging callback */ - NULL, /* Create debugging context */ - NULL /* Destroy debugging context */ + H5G_dense_btree2_name_debug /* Record debugging callback */ }}; /* v2 B-tree class for indexing 'creation order' field of links */ @@ -130,9 +128,7 @@ const H5B2_class_t H5G_BT2_CORDER[1]={{ /* B-tree class information */ H5G_dense_btree2_corder_compare, /* Record comparison callback */ H5G_dense_btree2_corder_encode, /* Record encoding callback */ H5G_dense_btree2_corder_decode, /* Record decoding callback */ - H5G_dense_btree2_corder_debug, /* Record debugging callback */ - NULL, /* Create debugging context */ - NULL /* Destroy debugging context */ + H5G_dense_btree2_corder_debug /* Record debugging callback */ }}; /*****************************/ diff --git a/src/H5HFbtree2.c b/src/H5HFbtree2.c index d82de93..a79bf58 100644 --- a/src/H5HFbtree2.c +++ b/src/H5HFbtree2.c @@ -71,7 +71,6 @@ typedef struct H5HF_huge_bt2_ctx_t { /* Common callbacks */ static void *H5HF__huge_bt2_crt_context(void *udata); static herr_t H5HF__huge_bt2_dst_context(void *ctx); -static void *H5HF__huge_bt2_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr); /* Callbacks for indirect objects */ static herr_t H5HF__huge_bt2_indir_store(void *native, const void *udata); @@ -127,9 +126,7 @@ const H5B2_class_t H5HF_HUGE_BT2_INDIR[1]={{ /* B-tree class information */ H5HF__huge_bt2_indir_compare, /* Record comparison callback */ H5HF__huge_bt2_indir_encode, /* Record encoding callback */ H5HF__huge_bt2_indir_decode, /* Record decoding callback */ - H5HF__huge_bt2_indir_debug, /* Record debugging callback */ - H5HF__huge_bt2_crt_dbg_context, /* Create debugging context */ - H5HF__huge_bt2_dst_context /* Destroy debugging context */ + H5HF__huge_bt2_indir_debug /* Record debugging callback */ }}; /* v2 B-tree class for indirectly accessed, filtered 'huge' objects */ @@ -143,9 +140,7 @@ const H5B2_class_t H5HF_HUGE_BT2_FILT_INDIR[1]={{ /* B-tree class information */ H5HF__huge_bt2_filt_indir_compare, /* Record comparison callback */ H5HF__huge_bt2_filt_indir_encode, /* Record encoding callback */ H5HF__huge_bt2_filt_indir_decode, /* Record decoding callback */ - H5HF__huge_bt2_filt_indir_debug, /* Record debugging callback */ - H5HF__huge_bt2_crt_dbg_context, /* Create debugging context */ - H5HF__huge_bt2_dst_context /* Destroy debugging context */ + H5HF__huge_bt2_filt_indir_debug /* Record debugging callback */ }}; /* v2 B-tree class for directly accessed 'huge' objects */ @@ -159,9 +154,7 @@ const H5B2_class_t H5HF_HUGE_BT2_DIR[1]={{ /* B-tree class information */ H5HF__huge_bt2_dir_compare, /* Record comparison callback */ H5HF__huge_bt2_dir_encode, /* Record encoding callback */ H5HF__huge_bt2_dir_decode, /* Record decoding callback */ - H5HF__huge_bt2_dir_debug, /* Record debugging callback */ - H5HF__huge_bt2_crt_dbg_context, /* Create debugging context */ - H5HF__huge_bt2_dst_context /* Destroy debugging context */ + H5HF__huge_bt2_dir_debug /* Record debugging callback */ }}; /* v2 B-tree class for directly accessed, filtered 'huge' objects */ @@ -175,9 +168,7 @@ const H5B2_class_t H5HF_HUGE_BT2_FILT_DIR[1]={{ /* B-tree class information */ H5HF__huge_bt2_filt_dir_compare, /* Record comparison callback */ H5HF__huge_bt2_filt_dir_encode, /* Record encoding callback */ H5HF__huge_bt2_filt_dir_decode, /* Record decoding callback */ - H5HF__huge_bt2_filt_dir_debug, /* Record debugging callback */ - H5HF__huge_bt2_crt_dbg_context, /* Create debugging context */ - H5HF__huge_bt2_dst_context /* Destroy debugging context */ + H5HF__huge_bt2_filt_dir_debug /* Record debugging callback */ }}; /*****************************/ @@ -270,46 +261,6 @@ H5HF__huge_bt2_dst_context(void *_ctx) /*------------------------------------------------------------------------- - * Function: H5HF__huge_bt2_crt_dbg_context - * - * Purpose: Create context for debugging callback - * - * Return: Success: non-NULL - * Failure: NULL - * - * Programmer: Quincey Koziol - * Tuesday, December 1, 2009 - * - *------------------------------------------------------------------------- - */ -static void * -H5HF__huge_bt2_crt_dbg_context(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr) -{ - H5HF_huge_bt2_ctx_t *ctx; /* Callback context structure */ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_STATIC - - /* Sanity check */ - HDassert(f); - - /* Allocate callback context */ - if(NULL == (ctx = H5FL_MALLOC(H5HF_huge_bt2_ctx_t))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate callback context") - - /* Determine the size of addresses & lengths in the file */ - ctx->sizeof_addr = H5F_SIZEOF_ADDR(f); - ctx->sizeof_size = H5F_SIZEOF_SIZE(f); - - /* Set return value */ - ret_value = ctx; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5HF__huge_bt2_crt_dbg_context() */ - - -/*------------------------------------------------------------------------- * Function: H5HF__huge_bt2_indir_found * * Purpose: Retrieve record for indirectly accessed 'huge' object, when diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c index e533ae8..0110c1e 100644 --- a/src/H5SMbtree2.c +++ b/src/H5SMbtree2.c @@ -50,7 +50,6 @@ static herr_t H5SM__bt2_dst_context(void *ctx); static herr_t H5SM__bt2_store(void *native, const void *udata); static herr_t H5SM__bt2_debug(FILE *stream, int indent, int fwidth, const void *record, const void *_udata); -static void *H5SM__bt2_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr); /*****************************/ @@ -67,9 +66,7 @@ const H5B2_class_t H5SM_INDEX[1]={{ /* B-tree class information */ H5SM__message_compare, /* Record comparison callback */ H5SM__message_encode, /* Record encoding callback */ H5SM__message_decode, /* Record decoding callback */ - H5SM__bt2_debug, /* Record debugging callback */ - H5SM__bt2_crt_dbg_context, /* Create debugging context */ - H5SM__bt2_dst_context /* Destroy debugging context */ + H5SM__bt2_debug /* Record debugging callback */ }}; @@ -218,45 +215,6 @@ H5SM__bt2_debug(FILE *stream, int indent, int fwidth, /*------------------------------------------------------------------------- - * Function: H5SM__bt2_crt_dbg_context - * - * Purpose: Create context for debugging callback - * - * Return: Success: non-NULL - * Failure: NULL - * - * Programmer: Quincey Koziol - * Tuesday, December 1, 2009 - * - *------------------------------------------------------------------------- - */ -static void * -H5SM__bt2_crt_dbg_context(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr) -{ - H5SM_bt2_ctx_t *ctx; /* Callback context structure */ - void *ret_value = NULL; /* Return value */ - - FUNC_ENTER_STATIC - - /* Sanity check */ - HDassert(f); - - /* Allocate callback context */ - if(NULL == (ctx = H5FL_MALLOC(H5SM_bt2_ctx_t))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate callback context") - - /* Determine the size of addresses & lengths in the file */ - ctx->sizeof_addr = H5F_SIZEOF_ADDR(f); - - /* Set return value */ - ret_value = ctx; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5SM__bt2_crt_dbg_context() */ - - -/*------------------------------------------------------------------------- * Function: H5SM_bt2_convert_to_list_op * * Purpose: An H5B2_remove_t callback function to convert a SOHM diff --git a/test/btree2.c b/test/btree2.c index 7a2432c..04c94fd 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -36,8 +36,11 @@ const char *FILENAME[] = { }; #define INSERT_SPLIT_ROOT_NREC 63 -#define INSERT_MANY (1000*1000) -#define FIND_MANY (INSERT_MANY/100) +#define INSERT_SPLIT_ROOT_NREC_REC 64 +#define INSERT_MANY (1000 * 1000) +#define INSERT_MANY_REC (2600 * 1000) +#define FIND_MANY (INSERT_MANY / 100) +#define FIND_MANY_REC (INSERT_MANY_REC / 100) #define FIND_NEIGHBOR 2000 #define DELETE_SMALL 20 #define DELETE_MEDIUM 200 @@ -63,7 +66,7 @@ typedef struct bt2_test_param_t { *------------------------------------------------------------------------- */ static int -init_cparam(H5B2_create_t *cparam) +init_cparam(H5B2_create_t *cparam, H5B2_create_t *cparam2) { /* Wipe out background */ HDmemset(cparam, 0, sizeof(*cparam)); @@ -75,6 +78,16 @@ init_cparam(H5B2_create_t *cparam) cparam->split_percent = 100; cparam->merge_percent = 40; + /* Wipe out background */ + HDmemset(cparam2, 0, sizeof(*cparam2)); + + /* General parameters */ + cparam2->cls = H5B2_TEST2; + cparam2->node_size = (size_t)1024; + cparam2->rrec_size = (size_t)16; + cparam2->split_percent = 100; + cparam2->merge_percent = 40; + return(0); } /* init_cparam() */ @@ -154,6 +167,47 @@ error: /*------------------------------------------------------------------------- + * Function: reopen_file + * + * Purpose: Re-open the file + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Monday, December 28, 2015 + * + *------------------------------------------------------------------------- + */ +static int +reopen_file(hid_t *file, H5F_t **f, hid_t fapl) +{ + char filename[1024]; /* Filename to use */ + + /* Set the filename to use for this test (dependent on fapl) */ + h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); + + /* Create the file to work on */ + if((*file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + + /* Get a pointer to the internal file object */ + if(NULL == (*f = (H5F_t *)H5I_object(*file))) + STACK_ERROR + + /* Ignore metadata tags in the file's cache */ + if(H5AC_ignore_tags(*f) < 0) + STACK_ERROR + + /* Success */ + return(0); + +error: + return(-1); +} /* end create_file() */ + + +/*------------------------------------------------------------------------- * Function: reopen_btree * * Purpose: Perform common "re-open" operations on B-tree for testing @@ -237,11 +291,11 @@ error: *------------------------------------------------------------------------- */ static int -check_node_depth(H5B2_t *bt2, hid_t dxpl, hsize_t record, unsigned depth) +check_node_depth(H5B2_t *bt2, hid_t dxpl, void *record, unsigned depth) { int rec_depth; /* Depth of record in B-tree */ - if((rec_depth = H5B2_get_node_depth_test(bt2, dxpl, &record)) < 0) + if((rec_depth = H5B2_get_node_depth_test(bt2, dxpl, record)) < 0) FAIL_STACK_ERROR if((unsigned)rec_depth != depth) TEST_ERROR @@ -285,7 +339,7 @@ check_node_info(H5B2_t *bt2, hid_t dxpl, hsize_t record, error: return(-1); -} /* end check_node_depth() */ +} /* end check_node_info() */ /*------------------------------------------------------------------------- @@ -294,7 +348,6 @@ error: * Purpose: v2 B-tree iterator callback * * Return: Success: 0 - * * Failure: 1 * * Programmer: Quincey Koziol @@ -317,12 +370,41 @@ iter_cb(const void *_record, void *_op_data) /*------------------------------------------------------------------------- + * Function: iter_rec_cb + * + * Purpose: v2 B-tree iterator callback for H5B2_test_rec_t records + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Friday, December 25, 2015 + * + *------------------------------------------------------------------------- + */ +static int +iter_rec_cb(const void *_record, void *_op_data) +{ + const H5B2_test_rec_t *record = (const H5B2_test_rec_t *)_record; + H5B2_test_rec_t *idx = (H5B2_test_rec_t *)_op_data; + + if(record->key != idx->key) + return(H5_ITER_ERROR); + if(record->val != idx->val) + return(H5_ITER_ERROR); + + idx->key++; + idx->val += 2; + return(H5_ITER_CONT); +} /* end iter_rec_cb() */ + + +/*------------------------------------------------------------------------- * Function: find_cb * * Purpose: v2 B-tree find callback * * Return: Success: TRUE/FALSE - * * Failure: FAIL * * Programmer: Quincey Koziol @@ -344,6 +426,33 @@ find_cb(const void *_record, void *_op_data) /*------------------------------------------------------------------------- + * Function: find_rec_cb + * + * Purpose: v2 B-tree find callback for H5B2_test_rec_t records + * + * Return: Success: TRUE/FALSE + * Failure: FAIL + * + * Programmer: Quincey Koziol + * Friday, December 25, 2015 + * + *------------------------------------------------------------------------- + */ +static int +find_rec_cb(const void *_record, void *_op_data) +{ + const H5B2_test_rec_t *record = (const H5B2_test_rec_t *)_record; + H5B2_test_rec_t *search = (H5B2_test_rec_t *)_op_data; + + if(record->key != search->key) + return(FALSE); + + search->val = record->val; + return(TRUE); +} /* end find_rec_cb() */ + + +/*------------------------------------------------------------------------- * Function: find_dec_cb * * Purpose: v2 B-tree find callback for indexing in decreasing order @@ -372,6 +481,34 @@ find_dec_cb(const void *_record, void *_op_data) /*------------------------------------------------------------------------- + * Function: index_rec_cb + * + * Purpose: v2 B-tree index callback for H5B2_test_rec_t records + * + * Return: Success: TRUE/FALSE + * Failure: FAIL + * + * Programmer: Quincey Koziol + * Friday, December 25, 2015 + * + *------------------------------------------------------------------------- + */ +static int +index_rec_cb(const void *_record, void *_op_data) +{ + const H5B2_test_rec_t *record = (const H5B2_test_rec_t *)_record; + H5B2_test_rec_t *search = (H5B2_test_rec_t *)_op_data; + + HDassert(record); + HDassert(search); + + search->key = record->key; + search->val = record->val; + return(TRUE); +} /* end index_rec_cb() */ + + +/*------------------------------------------------------------------------- * Function: neighbor_cb * * Purpose: v2 B-tree neighbor callback @@ -425,6 +562,57 @@ modify_cb(void *_record, void *_op_data, hbool_t *changed) /*------------------------------------------------------------------------- + * Function: modify_rec_cb + * + * Purpose: v2 B-tree modify callback for H5B2_test_rec_t records + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Friday, December 25, 2015 + * + *------------------------------------------------------------------------- + */ +static int +modify_rec_cb(void *_record, void *_op_data, hbool_t *changed) +{ + H5B2_test_rec_t *record = (H5B2_test_rec_t *)_record; + H5B2_test_rec_t *modify = (H5B2_test_rec_t *)_op_data; + + HDassert(record->key == modify->key); + record->val = modify->val; + *changed = TRUE; + + return(0); +} /* end modify_rec_cb() */ + + +/*------------------------------------------------------------------------- + * Function: no_modify_cb + * + * Purpose: v2 B-tree modify callback for updates which shouldn't change + * the record (ie. inserting not modifying) + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Wednesday, December 23, 2015 + * + *------------------------------------------------------------------------- + */ +static int +no_modify_cb(void H5_ATTR_UNUSED *_record, void H5_ATTR_UNUSED *_op_data, + hbool_t *changed) +{ + *changed = FALSE; + + return(1); +} /* end no_modify_cb() */ + + +/*------------------------------------------------------------------------- * Function: remove_cb * * Purpose: v2 B-tree remove callback @@ -717,7 +905,8 @@ test_insert_split_root(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC - 1); if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)33, (unsigned)0) < 0) + record = (hsize_t)33; + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -734,7 +923,8 @@ test_insert_split_root(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)33, (unsigned)1) < 0) + record = (hsize_t)33; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -755,7 +945,8 @@ test_insert_split_root(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC + 2); if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)33, (unsigned)1) < 0) + record = (hsize_t)33; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -889,7 +1080,8 @@ test_insert_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)INSERT_SPLIT_ROOT_NREC, (unsigned)1) < 0) + record = (hsize_t)INSERT_SPLIT_ROOT_NREC; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -909,7 +1101,8 @@ test_insert_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC + (INSERT_SPLIT_ROOT_NREC / 2) + 1); if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)((INSERT_SPLIT_ROOT_NREC / 2) + (INSERT_SPLIT_ROOT_NREC / 4) + 1), (unsigned)1) < 0) + record = (hsize_t)((INSERT_SPLIT_ROOT_NREC / 2) + (INSERT_SPLIT_ROOT_NREC / 4) + 1); + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Close the v2 B-tree */ @@ -940,7 +1133,8 @@ test_insert_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)(INSERT_SPLIT_ROOT_NREC / 2), (unsigned)1) < 0) + record = (hsize_t)(INSERT_SPLIT_ROOT_NREC / 2); + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -959,7 +1153,8 @@ test_insert_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC + (INSERT_SPLIT_ROOT_NREC / 2) + 1; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)((INSERT_SPLIT_ROOT_NREC / 2) + (INSERT_SPLIT_ROOT_NREC / 4) + 1), (unsigned)1) < 0) + record = (hsize_t)((INSERT_SPLIT_ROOT_NREC / 2) + (INSERT_SPLIT_ROOT_NREC / 4) + 1); + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Close the v2 B-tree */ @@ -1041,7 +1236,7 @@ test_insert_level1_side_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = INSERT_SPLIT_ROOT_NREC + (INSERT_SPLIT_ROOT_NREC / 2); - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -1061,10 +1256,10 @@ test_insert_level1_side_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 31; - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 63; - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Close the v2 B-tree */ @@ -1096,7 +1291,7 @@ test_insert_level1_side_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = (INSERT_SPLIT_ROOT_NREC / 2); - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -1115,9 +1310,11 @@ test_insert_level1_side_split(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = 2 * INSERT_SPLIT_ROOT_NREC; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)62, (unsigned)1) < 0) + record = 62; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)94, (unsigned)1) < 0) + record = 94; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Close the v2 B-tree */ @@ -1202,7 +1399,7 @@ test_insert_level1_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = (2 * INSERT_SPLIT_ROOT_NREC); - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -1222,10 +1419,10 @@ test_insert_level1_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = (INSERT_SPLIT_ROOT_NREC / 2); - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = (INSERT_SPLIT_ROOT_NREC + (INSERT_SPLIT_ROOT_NREC / 2) + 1); - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -1244,9 +1441,11 @@ test_insert_level1_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = (2 * INSERT_SPLIT_ROOT_NREC) + (INSERT_SPLIT_ROOT_NREC / 2) + 1; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)52, (unsigned)1) < 0) + record = 52; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)105, (unsigned)1) < 0) + record = 105; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -1343,7 +1542,7 @@ test_insert_level1_middle_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = (2 * INSERT_SPLIT_ROOT_NREC) + (INSERT_SPLIT_ROOT_NREC / 2); - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -1362,11 +1561,14 @@ test_insert_level1_middle_split(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = 3 * INSERT_SPLIT_ROOT_NREC; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)62, (unsigned)1) < 0) + record = 62; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)94, (unsigned)1) < 0) + record = 94; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)126, (unsigned)1) < 0) + record = 126; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -1464,7 +1666,8 @@ test_insert_make_level2(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 29) + 1; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)948, (unsigned)2) < 0) + record = 948; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -1513,7 +1716,8 @@ test_insert_make_level2(hid_t fapl, const H5B2_create_t *cparam, FAIL_STACK_ERROR /* Check with B-tree */ - if(check_node_depth(bt2, dxpl, (hsize_t)948, (unsigned)2) < 0) + record = 948; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR /* Attempt to find existant record in internal node of level-2 B-tree */ @@ -1522,7 +1726,8 @@ test_insert_make_level2(hid_t fapl, const H5B2_create_t *cparam, FAIL_STACK_ERROR /* Check with B-tree */ - if(check_node_depth(bt2, dxpl, (hsize_t)505, (unsigned)1) < 0) + record = 505; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Attempt to find existant record in leaf of level-2 B-tree */ @@ -1531,7 +1736,8 @@ test_insert_make_level2(hid_t fapl, const H5B2_create_t *cparam, FAIL_STACK_ERROR /* Check with B-tree */ - if(check_node_depth(bt2, dxpl, (hsize_t)555, (unsigned)0) < 0) + record = 555; + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Attempt to index non-existant record in level-2 B-tree */ @@ -1642,11 +1848,14 @@ test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2); if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)1008, (unsigned)2) < 0) + record = 1008; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)1859, (unsigned)1) < 0) + record = 1859; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)1921, (unsigned)0) < 0) + record = 1921; + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -1663,11 +1872,14 @@ test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2) + 1; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)1008, (unsigned)2) < 0) + record = 1008; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)1875, (unsigned)1) < 0) + record = 1875; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)1922, (unsigned)0) < 0) + record = 1922; + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR PASSED(); @@ -1683,11 +1895,14 @@ test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 29) + (INSERT_SPLIT_ROOT_NREC / 2) + 1; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)1008, (unsigned)2) < 0) + record = 1008; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)94, (unsigned)1) < 0) + record = 94; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)32, (unsigned)0) < 0) + record = 32; + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Add more records to left-most leaf, to force a 2->1 split and then a @@ -1704,11 +1919,14 @@ test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 30) + 1; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)1008, (unsigned)2) < 0) + record = 1008; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)47, (unsigned)1) < 0) + record = 47; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)0, (unsigned)0) < 0) + record = 0; + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR PASSED(); @@ -1724,13 +1942,17 @@ test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 30) + 1; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)1008, (unsigned)2) < 0) /* Record in root node */ + record = 1008; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) /* Record in root node */ TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)535, (unsigned)1) < 0) /* Record in middle node before insertion point */ + record = 535; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) /* Record in middle node before insertion point */ TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)630, (unsigned)1) < 0) /* Record in middle node after insertion point */ + record = 630; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) /* Record in middle node after insertion point */ TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)568, (unsigned)0) < 0) /* Record in leaf node just after insertion point */ + record = 568; + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) /* Record in leaf node just after insertion point */ TEST_ERROR /* Add more records to middle leaf, to force a split and a 3 node redistribution on middle leaf */ @@ -1745,13 +1967,17 @@ test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 30) + (INSERT_SPLIT_ROOT_NREC / 2) + 2; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)1008, (unsigned)2) < 0) /* Record in root node */ + record = 1008; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) /* Record in root node */ TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)524, (unsigned)1) < 0) /* Record in middle node before insertion point */ + record = 524; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) /* Record in middle node before insertion point */ TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)577, (unsigned)1) < 0) /* Record in middle node after insertion point */ + record = 577; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) /* Record in middle node after insertion point */ TEST_ERROR - if(check_node_depth(bt2, dxpl, (hsize_t)568, (unsigned)0) < 0) /* Record in leaf node just after insertion point */ + record = 568; + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) /* Record in leaf node just after insertion point */ TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -1851,13 +2077,13 @@ test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 946; /* Record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 1797; /* Right-most record in right internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 1859; /* Right-most record in right-most leaf */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -1877,16 +2103,16 @@ test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 946; /* Record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 1828; /* Next-to-right-most record in right-most internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 1860; /* Right-most record in right-most internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 1891; /* Right-most record in right-most leaf */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR PASSED(); @@ -1903,13 +2129,13 @@ test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 946; /* Record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 63; /* Left-most record in left-most internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 1; /* Left-most record in left-most leaf */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Add another record to left-most leaf, to force a 1->2 node split on left leaf */ @@ -1923,16 +2149,16 @@ test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 946; /* Record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 63; /* Left-most record in left-most internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 32; /* Left-most record in left internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 0; /* Left-most record in left-most leaf */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR PASSED(); @@ -1949,16 +2175,16 @@ test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 946; /* Record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 504; /* Record in internal node just before insertion point */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 568; /* Record in internal node just after insertion point */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 506; /* Record in leaf node just after insertion point */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Add another record to middle leaf, to force a node split on middle leaf */ @@ -1972,19 +2198,19 @@ test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 946; /* Record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 504; /* Left-most record of split in left internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 537; /* Middle record of split in left internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 568; /* Right-most record of split in left internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 506; /* Record in leaf node just after insertion point */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -2081,13 +2307,13 @@ test_insert_level2_2internal_redistrib(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 1318; /* Record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 3114; /* Right-most record in right internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 3145; /* Right-most record in right leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -2105,13 +2331,13 @@ test_insert_level2_2internal_redistrib(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 1822; /* Record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 3114; /* Right-most record in right internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 3146; /* Right-most record in right leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR PASSED(); @@ -2128,13 +2354,13 @@ test_insert_level2_2internal_redistrib(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 1822; /* Record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 436; /* Left-most record in left internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 374; /* Left-most record in left leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Force left-most internal node to redistribute */ @@ -2150,13 +2376,13 @@ test_insert_level2_2internal_redistrib(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 1570; /* Record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 61; /* Left-most record in left internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 0; /* Left-most record in left leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -2253,13 +2479,13 @@ test_insert_level2_2internal_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 2759; /* Record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 4555; /* Right-most record in right internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 4586; /* Right-most record in right leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -2277,16 +2503,16 @@ test_insert_level2_2internal_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 2759; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 3704; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 4555; /* Right-most record in right internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 4387; /* Right-most record in right leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR PASSED(); @@ -2303,13 +2529,13 @@ test_insert_level2_2internal_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 2759; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 932; /* Left-most record in left internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 870; /* Left-most record in left leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Force left-most internal node to split */ @@ -2325,16 +2551,16 @@ test_insert_level2_2internal_split(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 870; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 1814; /* Next-to-left-most record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 61; /* Left-most record in left internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 0; /* Left-most record in left leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -2436,19 +2662,19 @@ test_insert_level2_3internal_redistrib(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 3703; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 2267; /* Record to left of insertion point in middle internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 3199; /* Record to right of insertion point in middle internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 3137; /* Record just above insertion point in leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -2468,19 +2694,19 @@ test_insert_level2_3internal_redistrib(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 3703; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 3104; /* Record to left of insertion point in middle internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 3137; /* Record to right of insertion point in middle internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 3135; /* Record just above insertion point in leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -2498,21 +2724,21 @@ test_insert_level2_3internal_redistrib(hid_t fapl, const H5B2_create_t *cparam, if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR record = 1574; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR record = 3104; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR #ifdef NONE record = 2862; /* Record to left of insertion point in right internal node (now) */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR #endif /* NONE */ record = 3137; /* Record to right of insertion point in right internal node (now) */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 3135; /* Record just above insertion point in leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR /* Check for closing & re-opening the B-tree */ @@ -2588,126 +2814,2129 @@ test_insert_level2_3internal_split(hid_t fapl, const H5B2_create_t *cparam, */ TESTING("B-tree insert: split 3 internals to 4 in level 2 B-tree"); - /* Create the file for the test */ - if(create_file(&file, &f, fapl) < 0) + /* Create the file for the test */ + if(create_file(&file, &f, fapl) < 0) + TEST_ERROR + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* Insert enough records to force root to split into 3 internal nodes */ + /* (and fill right internal node) */ + for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 31); u++) { + record = u; + if(H5B2_insert(bt2, dxpl, &record) < 0) + FAIL_STACK_ERROR + } /* end for */ + for(; u < (INSERT_SPLIT_ROOT_NREC * 74); u++) { + record = u + ((INSERT_SPLIT_ROOT_NREC * 13) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 3); + if(H5B2_insert(bt2, dxpl, &record) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Check up on B-tree */ + bt2_stat.depth = 2; + bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC * 74; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record = 1889; /* Left record in root node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) + TEST_ERROR + record = 3703; /* Right record in root node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) + TEST_ERROR + record = 1952; /* Record to left of insertion point in middle internal node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + record = 2884; /* Record to right of insertion point in middle internal node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + record = 2822; /* Record just after insertion point in leaf node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) + TEST_ERROR + + /* Insert records to fill up middle internal node */ + for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 13) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 2); u++) { + record = u + (INSERT_SPLIT_ROOT_NREC * 31); + if(H5B2_insert(bt2, dxpl, &record) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 2; + bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 87) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 2; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record = 1889; /* Left record in root node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) + TEST_ERROR + record = 3703; /* Right record in root node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) + TEST_ERROR + record = 2789; /* Record to left of insertion point in middle internal node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + record = 2822; /* Record to right of insertion point in middle internal node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + record = 2823; /* Record just above insertion point in leaf node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Insert record to split middle internal node */ + record = u + (INSERT_SPLIT_ROOT_NREC * 31); + if(H5B2_insert(bt2, dxpl, &record) < 0) + FAIL_STACK_ERROR + + /* Check up on B-tree */ + bt2_stat.depth = 2; + bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 87) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 3; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record = 1889; /* Left record in root node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) + TEST_ERROR + record = 2789; /* Middle record in root node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) + TEST_ERROR + record = 3703; /* Right record in root node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) + TEST_ERROR +#ifdef NONE + record = 3049; /* Record to left of insertion point in middle internal node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR +#endif /* NONE */ + record = 2822; /* Record to right of insertion point in middle internal node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + record = 2823; /* Record just above insertion point in leaf node */ + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Iterate over B-tree to check records have been inserted correctly */ + idx = 0; + if(H5B2_iterate(bt2, dxpl, iter_cb, &idx) < 0) + FAIL_STACK_ERROR + + /* Make certain that the index is correct */ + if(idx != ((INSERT_SPLIT_ROOT_NREC * 87) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 3)) + TEST_ERROR + + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + /* Close file */ + if(H5Fclose(file) < 0) + FAIL_STACK_ERROR + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY { + if(bt2) + H5B2_close(bt2, dxpl); + H5Fclose(file); + } H5E_END_TRY; + return 1; +} /* test_insert_level2_3internal_split() */ + + +/*------------------------------------------------------------------------- + * Function: test_insert_lots + * + * Purpose: Basic tests for the B-tree v2 code. This test inserts many + * records in random order, enough to make at a level 4 B-tree. + * + * Return: Success: 0 + * + * Failure: 1 + * + * Programmer: Quincey Koziol + * Saturday, February 19, 2005 + * + *------------------------------------------------------------------------- + */ +static unsigned +test_insert_lots(hid_t fapl, const H5B2_create_t *cparam, + const bt2_test_param_t *tparam) +{ + hid_t file = -1; /* File ID */ + char filename[1024]; /* Filename to use */ + H5F_t *f = NULL; /* Internal file object pointer */ + hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ + haddr_t bt2_addr; /* Address of B-tree created */ + hsize_t record; /* Record to insert into tree */ + hsize_t idx; /* Index within B-tree, for iterator */ + time_t curr_time; /* Current time, for seeding random number generator */ + hsize_t *records; /* Record #'s for random insertion */ + unsigned u; /* Local index variable */ + unsigned swap_idx; /* Location to swap with when shuffling */ + hsize_t temp_rec; /* Temporary record */ + H5B2_stat_t bt2_stat; /* Statistics about B-tree created */ + hsize_t nrec; /* Number of records in B-tree */ + herr_t ret; /* Generic error return value */ + + /* Initialize random number seed */ + curr_time=HDtime(NULL); +#ifdef QAK +curr_time=1109170019; +HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); +#endif /* QAK */ + HDsrandom((unsigned)curr_time); + + /* + * Test inserting many records into v2 B-tree + */ + TESTING("B-tree insert: create random level 4 B-tree"); + + /* Allocate space for the records */ + if(NULL == (records = (hsize_t *)HDmalloc(sizeof(hsize_t) * INSERT_MANY))) + TEST_ERROR + + /* Initialize record #'s */ + for(u = 0; u < INSERT_MANY; u++) + records[u] = u; + + /* Shuffle record #'s */ + for(u = 0; u < INSERT_MANY; u++) { + swap_idx = ((unsigned)HDrandom() % (INSERT_MANY - u)) + u; + temp_rec = records[u]; + records[u] = records[swap_idx]; + records[swap_idx] = temp_rec; + } /* end for */ + + /* Set the filename to use for this test (dependent on fapl) */ + h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); + + /* Create the file to work on */ + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + TEST_ERROR + + /* Get a pointer to the internal file object */ + if(NULL == (f = (H5F_t *)H5I_object(file))) + STACK_ERROR + + /* Ignore metadata tags in the file's cache */ + if(H5AC_ignore_tags(f) < 0) + STACK_ERROR + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* Insert random records */ + for(u = 0; u < INSERT_MANY; u++) { + record = records[u]; + if(H5B2_insert(bt2, dxpl, &record) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 4; + bt2_stat.nrecords = INSERT_MANY; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + /* Close file */ + if(H5Fclose(file) < 0) + STACK_ERROR + + /* Re-open the file */ + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + FAIL_STACK_ERROR + + /* Get a pointer to the internal file object */ + if(NULL == (f = (H5F_t *)H5I_object(file))) + FAIL_STACK_ERROR + + /* Ignore metadata tags in the file's cache */ + if(H5AC_ignore_tags(f) < 0) + STACK_ERROR + + /* Re-open v2 B-tree */ + if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f))) + FAIL_STACK_ERROR + + /* Check up on B-tree after re-open */ + bt2_stat.depth = 4; + bt2_stat.nrecords = INSERT_MANY; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + + /* Iterate over B-tree to check records have been inserted correctly */ + idx = 0; + if(H5B2_iterate(bt2, dxpl, iter_cb, &idx) < 0) + FAIL_STACK_ERROR + + /* Make certain that the index is correct */ + if(idx != INSERT_MANY) + TEST_ERROR + + /* Attempt to find non-existant record in level-4 B-tree */ + /* (Should not be found, but not fail) */ + idx = INSERT_MANY * 2; + if(H5B2_find(bt2, dxpl, &idx, find_cb, &idx) != FALSE) + TEST_ERROR + + /* Find random records */ + for(u = 0; u < FIND_MANY; u++) { + /* Pick random record */ + idx = (hsize_t)(HDrandom()%INSERT_MANY); + + /* Attempt to find existant record in root of level-4 B-tree */ + if(H5B2_find(bt2, dxpl, &idx, find_cb, &idx) != TRUE) + FAIL_STACK_ERROR + } /* end for */ + + /* Attempt to index non-existant record in level-4 B-tree, in increasing & decreasing order */ + H5E_BEGIN_TRY { + ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)(INSERT_MANY*3), find_cb, NULL); + } H5E_END_TRY; + /* Should fail */ + if(ret != FAIL) + TEST_ERROR + H5E_BEGIN_TRY { + ret = H5B2_index(bt2, dxpl, H5_ITER_DEC, (hsize_t)(INSERT_MANY*3), find_cb, NULL); + } H5E_END_TRY; + /* Should fail */ + if(ret != FAIL) + TEST_ERROR + + /* Find random records */ + for(u = 0; u < FIND_MANY; u++) { + /* Pick random record */ + idx = (hsize_t)(HDrandom() % INSERT_MANY); + + /* Attempt to find existant record in root of level-4 B-tree */ + /* (in increasing order) */ + if(H5B2_index(bt2, dxpl, H5_ITER_INC, idx, find_cb, &idx) < 0) + FAIL_STACK_ERROR + + /* Attempt to find existant record in root of level-4 B-tree */ + /* (in decreasing order) */ + if(H5B2_index(bt2, dxpl, H5_ITER_DEC, idx, find_dec_cb, &idx) < 0) + FAIL_STACK_ERROR + } /* end for */ + + PASSED(); + + TESTING("B-tree insert: attempt duplicate record in level 4 B-tree"); + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + record = INSERT_MANY / 2; + H5E_BEGIN_TRY { + ret = H5B2_insert(bt2, dxpl, &record); + } H5E_END_TRY; + /* Should fail */ + if(ret != FAIL) + TEST_ERROR + + /* Query the number of records in the B-tree */ + if(H5B2_get_nrec(bt2, &nrec) < 0) + FAIL_STACK_ERROR + + /* Make certain that the # of records is correct */ + if(nrec != INSERT_MANY) + TEST_ERROR + + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + /* Close file */ + if(H5Fclose(file) < 0) + TEST_ERROR + + PASSED(); + + HDfree(records); + + return 0; + +error: + H5E_BEGIN_TRY { + if(bt2) + H5B2_close(bt2, dxpl); + H5Fclose(file); + } H5E_END_TRY; + HDfree(records); + return 1; +} /* test_insert_lots() */ + + +/*------------------------------------------------------------------------- + * Function: test_update_basic + * + * Purpose: Basic tests for the v2 B-tree update operation + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Wednesday, December 23, 2015 + * + *------------------------------------------------------------------------- + */ +static unsigned +test_update_basic(hid_t fapl, const H5B2_create_t *cparam, + const bt2_test_param_t *tparam) +{ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ + haddr_t bt2_addr; /* Address of B-tree created */ + H5B2_test_rec_t record; /* Record to insert into tree */ + H5B2_test_rec_t modify; /* Modified value */ + H5B2_test_rec_t find; /* Record to find */ + herr_t ret; /* Generic error return value */ + + /* Create the file for the test */ + if(create_file(&file, &f, fapl) < 0) + TEST_ERROR + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* + * Test insert record into empty v2 B-tree + */ + TESTING("B-tree update: inserting first record in empty B-tree"); + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + record.key = 42; + record.val = 72; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + + /* Attempt to find non-existant record in B-tree with 1 record */ + /* (Should not be found, but not fail) */ + find.key = 10; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE) + FAIL_STACK_ERROR + if(find.val != (hsize_t)-1) + TEST_ERROR + + /* Try again with NULL 'op' */ + /* (Should not be found, but not fail) */ + if(H5B2_find(bt2, dxpl, &find, NULL, NULL) != FALSE) + FAIL_STACK_ERROR + if(find.val != (hsize_t)-1) + TEST_ERROR + + /* Attempt to find existant record in B-tree with 1 record */ + find.key = 42; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.val != 72) + TEST_ERROR + + /* Try again with NULL 'op' */ + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, NULL, NULL) != TRUE) + FAIL_STACK_ERROR + if(find.val != (hsize_t)-1) + TEST_ERROR + + /* Attempt to index non-existant record in B-tree with 1 record */ + H5E_BEGIN_TRY { + ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)1, index_rec_cb, NULL); + } H5E_END_TRY; + /* Should fail */ + if(ret != FAIL) + TEST_ERROR + + /* Attempt to index existing record in B-tree with 1 record */ + find.key = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)0, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 42) + TEST_ERROR + if(find.val != 72) + TEST_ERROR + + PASSED(); + + + /* + * Test update only record into v2 B-tree + */ + TESTING("B-tree update: update only record in B-tree"); + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + modify.key = 42; + modify.val = 43; + if(H5B2_update(bt2, dxpl, &modify, modify_rec_cb, &modify) < 0) + FAIL_STACK_ERROR + + /* Attempt to find non-existant record in B-tree with 1 record */ + /* (Should not be found, but not fail) */ + find.key = 10; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE) + FAIL_STACK_ERROR + if(find.val != (hsize_t)-1) + TEST_ERROR + + /* Try again with NULL 'op' */ + /* (Should not be found, but not fail) */ + if(H5B2_find(bt2, dxpl, &find, NULL, NULL) != FALSE) + FAIL_STACK_ERROR + if(find.val != (hsize_t)-1) + TEST_ERROR + + /* Attempt to find modified record in B-tree with 1 record */ + find.key = 42; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.val != 43) + TEST_ERROR + + /* Try again with NULL 'op' */ + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, NULL, NULL) != TRUE) + FAIL_STACK_ERROR + if(find.val != (hsize_t)-1) + TEST_ERROR + + /* Attempt to index non-existant record in B-tree with 1 record */ + H5E_BEGIN_TRY { + ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)1, index_rec_cb, NULL); + } H5E_END_TRY; + /* Should fail */ + if(ret != FAIL) + TEST_ERROR + + /* Attempt to index existing record in B-tree with 1 record */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)0, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 42) + TEST_ERROR + if(find.val != 43) + TEST_ERROR + + PASSED(); + + + /* + * Test inserting more records into v2 B-tree + */ + TESTING("B-tree update: insert several records"); + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* + * Test inserting second record into v2 B-tree, before all other records + */ + record.key = 34; + record.val = 11; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + + /* + * Test inserting third record into v2 B-tree, after all other records + */ + record.key = 56; + record.val = 12; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + + /* + * Test inserting fourth record into v2 B-tree, in the middle of other records + */ + record.key = 38; + record.val = 13; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + + /* Attempt to find non-existant record in level-0 B-tree with several records */ + /* (Should not be found, but not fail) */ + find.key = 10; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE) + TEST_ERROR + if(find.val != (hsize_t)-1) + TEST_ERROR + + /* Attempt to find existant record in level-0 B-tree with several records */ + find.key = 56; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + TEST_ERROR + if(find.val != 12) + TEST_ERROR + + /* Attempt to index non-existant record in B-tree with several records */ + H5E_BEGIN_TRY { + ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)4, index_rec_cb, NULL); + } H5E_END_TRY; + /* Should fail */ + if(ret != FAIL) + TEST_ERROR + + /* Attempt to index existing record in B-tree with several records */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)0, index_rec_cb, &find) < 0) + TEST_ERROR + if(find.key != 34) + TEST_ERROR + if(find.val != 11) + TEST_ERROR + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)1, index_rec_cb, &find) < 0) + TEST_ERROR + if(find.key != 38) + TEST_ERROR + if(find.val != 13) + TEST_ERROR + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)2, index_rec_cb, &find) < 0) + TEST_ERROR + if(find.key != 42) + TEST_ERROR + if(find.val != 43) + TEST_ERROR + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)3, index_rec_cb, &find) < 0) + TEST_ERROR + if(find.key != 56) + TEST_ERROR + if(find.val != 12) + TEST_ERROR + + PASSED(); + + + /* + * Test updating all existing records in v2 B-tree + */ + TESTING("B-tree update: update several records"); + + record.key = 34; + modify.key = 34; + modify.val = 21; + if(H5B2_update(bt2, dxpl, &record, modify_rec_cb, &modify) < 0) + FAIL_STACK_ERROR + record.key = 38; + modify.key = 38; + modify.val = 23; + if(H5B2_update(bt2, dxpl, &record, modify_rec_cb, &modify) < 0) + FAIL_STACK_ERROR + record.key = 42; + modify.key = 42; + modify.val = 24; + if(H5B2_update(bt2, dxpl, &record, modify_rec_cb, &modify) < 0) + FAIL_STACK_ERROR + record.key = 56; + modify.key = 56; + modify.val = 22; + if(H5B2_update(bt2, dxpl, &record, modify_rec_cb, &modify) < 0) + FAIL_STACK_ERROR + + /* Attempt to find non-existant record in level-0 B-tree with several records */ + /* (Should not be found, but not fail) */ + find.key = 41; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE) + TEST_ERROR + if(find.val != (hsize_t)-1) + TEST_ERROR + + /* Attempt to find existant record in level-0 B-tree with several record */ + find.key = 56; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + TEST_ERROR + if(find.val != 22) + TEST_ERROR + + /* Attempt to index non-existant record in B-tree with several records */ + H5E_BEGIN_TRY { + ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)4, index_rec_cb, NULL); + } H5E_END_TRY; + /* Should fail */ + if(ret != FAIL) + TEST_ERROR + + /* Attempt to index existing record in B-tree with several records */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)0, index_rec_cb, &find) < 0) + TEST_ERROR + if(find.key != 34) + TEST_ERROR + if(find.val != 21) + TEST_ERROR + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)1, index_rec_cb, &find) < 0) + TEST_ERROR + if(find.key != 38) + TEST_ERROR + if(find.val != 23) + TEST_ERROR + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)2, index_rec_cb, &find) < 0) + TEST_ERROR + if(find.key != 42) + TEST_ERROR + if(find.val != 24) + TEST_ERROR + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)3, index_rec_cb, &find) < 0) + TEST_ERROR + if(find.key != 56) + TEST_ERROR + if(find.val != 22) + TEST_ERROR + + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + /* Close the file */ + if(H5Fclose(file) < 0) + TEST_ERROR + + PASSED(); + + + /* All tests passed */ + return(0); + +error: + H5E_BEGIN_TRY { + if(bt2) + H5B2_close(bt2, dxpl); + H5Fclose(file); + } H5E_END_TRY; + return(1); +} /* test_update_basic() */ + + +/*------------------------------------------------------------------------- + * Function: test_update_split_root + * + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * records to split the root node and force the tree to depth 1. + * It also continues to add a few more records to each of the + * left and right leaf nodes after the split + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Wednesday, December 23, 2015 + * + *------------------------------------------------------------------------- + */ +static unsigned +test_update_split_root(hid_t fapl, const H5B2_create_t *cparam, + const bt2_test_param_t *tparam) +{ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ + haddr_t bt2_addr; /* Address of B-tree created */ + H5B2_test_rec_t record; /* Record to insert into tree */ + H5B2_test_rec_t modify; /* Modified value */ + H5B2_test_rec_t find; /* Record to find */ + H5B2_test_rec_t idx; /* Index within B-tree, for iterator */ + H5B2_stat_t bt2_stat; /* Statistics about B-tree created */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic error return value */ + + /* + * Test inserting enough records into v2 B-tree to split the root node + */ + TESTING("B-tree update: split root"); + + /* Create the file for the test */ + if(create_file(&file, &f, fapl) < 0) + TEST_ERROR + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* Insert records to fill root leaf node */ + for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC - 1); u++) { + record.key = u + 2; + record.val = u * 2 + 4; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 0; + bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC_REC - 1); + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = 33; + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Insert record to split root leaf node */ + record.key = INSERT_SPLIT_ROOT_NREC_REC + 1; + record.val = (INSERT_SPLIT_ROOT_NREC_REC - 1) * 2 + 4; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = 33; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Iterate over B-tree to check records have been inserted correctly */ + idx.key = 2; + idx.val = 4; + if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &idx) < 0) + FAIL_STACK_ERROR + + /* Make certain that the index is correct */ + if(idx.key != (INSERT_SPLIT_ROOT_NREC_REC + 2)) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Modify all records */ + for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) { + record.key = u + 2; + modify.key = u + 2; + modify.val = u * 2 + 5; + if(H5B2_update(bt2, dxpl, &record, modify_rec_cb, &modify) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = 33; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Iterate over B-tree to check records have been inserted correctly */ + idx.key = 2; + idx.val = 5; + if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &idx) < 0) + FAIL_STACK_ERROR + + /* Make certain that the index is correct */ + if(idx.key != (INSERT_SPLIT_ROOT_NREC_REC + 2)) + TEST_ERROR + + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Insert a couple more records, on the left side of the B-tree */ + record.key = 0; + record.val = 1; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + record.key = 1; + record.val = 3; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC_REC + 2); + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = 33; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + + /* Iterate over B-tree to check records have been inserted correctly */ + idx.key = 0; + idx.val = 1; + if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &idx) < 0) + FAIL_STACK_ERROR + + /* Make certain that the index is correct */ + if(idx.key != (INSERT_SPLIT_ROOT_NREC_REC + 2)) + TEST_ERROR + + /* Attempt to find non-existant record in level-1 B-tree */ + /* (Should not be found, but not fail) */ + find.key = 800; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE) + TEST_ERROR + if(find.val != (hsize_t)-1) + TEST_ERROR + + /* Attempt to find existant record in root of level-1 B-tree */ + find.key = 33; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.key != 33) + TEST_ERROR + if(find.val != 67) + TEST_ERROR + + /* Attempt to find existant record in leaf of level-1 B-tree */ + find.key = 56; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.key != 56) + TEST_ERROR + if(find.val != 113) + TEST_ERROR + + /* Attempt to index non-existant record in level-1 B-tree */ + H5E_BEGIN_TRY { + ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC + 2), index_rec_cb, NULL); + } H5E_END_TRY; + /* Should fail */ + if(ret != FAIL) + TEST_ERROR + + /* Attempt to index existing record in root of level-1 B-tree */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)33, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 33) + TEST_ERROR + if(find.val != 67) + TEST_ERROR + + /* Attempt to index existing record in left leaf of level-1 B-tree */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)0, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 0) + TEST_ERROR + if(find.val != 1) + TEST_ERROR + + /* Attempt to index existing record in right leaf of level-1 B-tree */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)50, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 50) + TEST_ERROR + if(find.val != 101) + TEST_ERROR + + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + if(H5Fclose(file) < 0) + TEST_ERROR + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY { + if(bt2) + H5B2_close(bt2, dxpl); + H5Fclose(file); + } H5E_END_TRY; + return 1; +} /* test_update_split_root() */ + + +/*------------------------------------------------------------------------- + * Function: test_update_level1_2leaf_redistrib + * + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * records to split the root node and force the tree to depth 1. + * It continues to add a more records to the each of the + * left and right leaf nodes after the split to force a 2 node + * redistribution + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Saturday, December 26, 2015 + * + *------------------------------------------------------------------------- + */ +static unsigned +test_update_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, + const bt2_test_param_t *tparam) +{ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ + haddr_t bt2_addr; /* Address of B-tree created */ + H5B2_test_rec_t record; /* Record to insert into tree */ + H5B2_stat_t bt2_stat; /* Statistics about B-tree created */ + unsigned u; /* Local index variable */ + + /* + * Test inserting many records into v2 B-tree + */ + TESTING("B-tree update: redistribute 2 leaves in level 1 B-tree (l->r)"); + + /* Create the file for the test */ + if(create_file(&file, &f, fapl) < 0) + TEST_ERROR + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* Insert enough records to force root to split into 2 leaves */ + for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) { + record.key = u + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1; + record.val = u + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 10; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = INSERT_SPLIT_ROOT_NREC_REC; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + + /* Force redistribution from left node into right node */ + for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1; u++) { + record.key = u; + record.val = u + 9; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC_REC + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1); + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = (INSERT_SPLIT_ROOT_NREC_REC / 2) + (INSERT_SPLIT_ROOT_NREC_REC / 4); + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + PASSED(); + + /* + * Test inserting many records into v2 B-tree + */ + TESTING("B-tree update: redistribute 2 leaves in level 1 B-tree (r->l)"); + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* Insert enough records to force root to split into 2 leaves */ + for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) { + record.key = u; + record.val = u + 9; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = (INSERT_SPLIT_ROOT_NREC_REC / 2) - 1; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Force redistribution from left node into right node */ + for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1; u++) { + record.key = u + INSERT_SPLIT_ROOT_NREC_REC; + record.val = u + INSERT_SPLIT_ROOT_NREC_REC + 9; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = (INSERT_SPLIT_ROOT_NREC_REC / 2) + (INSERT_SPLIT_ROOT_NREC_REC / 4) - 1; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + /* Close file */ + if(H5Fclose(file) < 0) + FAIL_STACK_ERROR + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY { + if(bt2) + H5B2_close(bt2, dxpl); + H5Fclose(file); + } H5E_END_TRY; + return 1; +} /* test_update_level1_2leaf_redistrib() */ + + +/*------------------------------------------------------------------------- + * Function: test_update_level1_side_split + * + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * records to split the root node and force the tree to depth 1. + * It continues to add a more records to the each of the + * left and right leaf nodes after the split to force a 2 node + * split, adding another node to the B-tree + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Saturday, December 26, 2015 + * + *------------------------------------------------------------------------- + */ +static unsigned +test_update_level1_side_split(hid_t fapl, const H5B2_create_t *cparam, + const bt2_test_param_t *tparam) +{ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ + haddr_t bt2_addr; /* Address of B-tree created */ + H5B2_test_rec_t record; /* Record to insert into tree */ + H5B2_stat_t bt2_stat; /* Statistics about B-tree created */ + unsigned u; /* Local index variable */ + + /* + * Test inserting many records into v2 B-tree + */ + TESTING("B-tree update: split side leaf into 2 leaves in level 1 B-tree (l->r)"); + + /* Create the file for the test */ + if(create_file(&file, &f, fapl) < 0) + TEST_ERROR + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* Insert enough records to force root to split into 2 leaves */ + for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) { + record.key = u + INSERT_SPLIT_ROOT_NREC_REC; + record.val = u + INSERT_SPLIT_ROOT_NREC_REC + 10; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = INSERT_SPLIT_ROOT_NREC_REC + (INSERT_SPLIT_ROOT_NREC_REC / 2) - 1; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Force left node to split */ + for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) { + record.key = u; + record.val = u + 10; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = 2 * INSERT_SPLIT_ROOT_NREC_REC; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = 31; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + record.key = 64; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + PASSED(); + + /* + * Test inserting many records into v2 B-tree + */ + TESTING("B-tree update: split side leaf into 2 leaves in level 1 B-tree (r->l)"); + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* Insert enough records to force root to split into 2 leaves */ + for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) { + record.key = u; + record.val = u + 10; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = (INSERT_SPLIT_ROOT_NREC_REC / 2) - 1; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Force right node to split */ + for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) { + record.key = u + INSERT_SPLIT_ROOT_NREC_REC; + record.val = u + INSERT_SPLIT_ROOT_NREC_REC + 10; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = 2 * INSERT_SPLIT_ROOT_NREC_REC; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = 63; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + record.key = 95; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + /* Close file */ + if(H5Fclose(file) < 0) + FAIL_STACK_ERROR + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY { + if(bt2) + H5B2_close(bt2, dxpl); + H5Fclose(file); + } H5E_END_TRY; + return 1; +} /* test_update_level1_side_split() */ + + +/*------------------------------------------------------------------------- + * Function: test_update_level1_3leaf_redistrib + * + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * records to split the root node and force the tree to depth 1. + * It continues to add a more records to the each of the + * left and right leaf nodes after the split to force a 2 node + * split, adding another node to the B-tree, then continues to + * add records until a 3 node redistribution occurs + * + * Return: Success: 0 + * + * Failure: 1 + * + * Programmer: Quincey Koziol + * Saturday, December 26, 2015 + * + *------------------------------------------------------------------------- + */ +static unsigned +test_update_level1_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, + const bt2_test_param_t *tparam) +{ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ + haddr_t bt2_addr; /* Address of B-tree created */ + H5B2_test_rec_t record; /* Record to insert into tree */ + H5B2_test_rec_t idx; /* Index within B-tree, for iterator */ + H5B2_stat_t bt2_stat; /* Statistics about B-tree created */ + unsigned u; /* Local index variable */ + + /* + * Test inserting many records into v2 B-tree + */ + TESTING("B-tree update: redistribute 3 leaves in level 1 B-tree"); + + /* Create the file for the test */ + if(create_file(&file, &f, fapl) < 0) + TEST_ERROR + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* Insert enough records to force root to split into 2 leaves */ + for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) { + record.key = u + (INSERT_SPLIT_ROOT_NREC_REC + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1); + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = (2 * INSERT_SPLIT_ROOT_NREC_REC); + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Force left node to split */ + for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) { + record.key = u; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = 2 * INSERT_SPLIT_ROOT_NREC_REC; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = (INSERT_SPLIT_ROOT_NREC_REC / 2) - 1; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + record.key = INSERT_SPLIT_ROOT_NREC_REC + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Insert records to force middle node to redistribute */ + for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC_REC / 2) + 1); u++) { + record.key = u + INSERT_SPLIT_ROOT_NREC_REC; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = (2 * INSERT_SPLIT_ROOT_NREC_REC) + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = 52; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + record.key = 107; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Iterate over B-tree to check records have been inserted correctly */ + idx.key = 0; + idx.val = 0; + if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &idx) < 0) + FAIL_STACK_ERROR + + /* Make certain that the index is correct */ + if(idx.key != ((INSERT_SPLIT_ROOT_NREC_REC * 2) + (INSERT_SPLIT_ROOT_NREC_REC / 2) + 1)) + TEST_ERROR + + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + /* Close file */ + if(H5Fclose(file) < 0) + FAIL_STACK_ERROR + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY { + if(bt2) + H5B2_close(bt2, dxpl); + H5Fclose(file); + } H5E_END_TRY; + return 1; +} /* test_update_level1_3leaf_redistrib() */ + + +/*------------------------------------------------------------------------- + * Function: test_update_level1_middle_split + * + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * records to split the root node and force the tree to depth 1. + * It continues to add a more records to the each of the + * left and right leaf nodes after the split to force a 2 node + * split, adding another node to the B-tree, then continues to + * add records until a 3 node split occurs + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Saturday, December 26, 2015 + * + *------------------------------------------------------------------------- + */ +static unsigned +test_update_level1_middle_split(hid_t fapl, const H5B2_create_t *cparam, + const bt2_test_param_t *tparam) +{ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ + haddr_t bt2_addr; /* Address of B-tree created */ + H5B2_test_rec_t record; /* Record to insert into tree */ + H5B2_stat_t bt2_stat; /* Statistics about B-tree created */ + H5B2_test_rec_t idx; /* Index within B-tree, for iterator */ + unsigned u; /* Local index variable */ + + /* + * Test inserting many records into v2 B-tree + */ + TESTING("B-tree update: split middle leaf into 2 leaves in level 1 B-tree"); + + /* Create the file for the test */ + if(create_file(&file, &f, fapl) < 0) + TEST_ERROR + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* Insert enough records to force root to split into 2 leaves */ + for(u = 0; u < INSERT_SPLIT_ROOT_NREC_REC; u++) { + record.key = u + (INSERT_SPLIT_ROOT_NREC_REC * 2); + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC_REC; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = (2 * INSERT_SPLIT_ROOT_NREC_REC) + (INSERT_SPLIT_ROOT_NREC_REC / 2) - 1; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Force split from left node into right node */ + for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC * 2); u++) { + record.key = u; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 1; + bt2_stat.nrecords = 3 * INSERT_SPLIT_ROOT_NREC_REC; + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = 63; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + record.key = 95; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + record.key = 128; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Iterate over B-tree to check records have been inserted correctly */ + idx.key = 0; + idx.val = 0; + if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &idx) < 0) + FAIL_STACK_ERROR + + /* Make certain that the index is correct */ + if(idx.key != (INSERT_SPLIT_ROOT_NREC_REC * 3)) + TEST_ERROR + + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + /* Close file */ + if(H5Fclose(file) < 0) + STACK_ERROR + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY { + if(bt2) + H5B2_close(bt2, dxpl); + H5Fclose(file); + } H5E_END_TRY; + return 1; +} /* test_update_level1_middle_split() */ + + +/*------------------------------------------------------------------------- + * Function: test_update_make_level2 + * + * Purpose: Basic tests for the B-tree v2 code. This test inserts enough + * records to make a level 2 B-tree + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Quincey Koziol + * Saturday, December 26, 2015 + * + *------------------------------------------------------------------------- + */ +static unsigned +test_update_make_level2(hid_t fapl, const H5B2_create_t *cparam, + const bt2_test_param_t *tparam) +{ + hid_t file = -1; /* File ID */ + H5F_t *f = NULL; /* Internal file object pointer */ + hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ + haddr_t bt2_addr; /* Address of B-tree created */ + H5B2_test_rec_t record; /* Record to insert into tree */ + H5B2_test_rec_t find; /* Record to find */ + H5B2_test_rec_t idx; /* Index within B-tree, for iterator */ + H5B2_stat_t bt2_stat; /* Statistics about B-tree created */ + unsigned u; /* Local index variable */ + herr_t ret; /* Generic error return value */ + + /* + * Test inserting many records into v2 B-tree + */ + TESTING("B-tree update: make level 2 B-tree (l->r)"); + + /* Create the file for the test */ + if(create_file(&file, &f, fapl) < 0) + TEST_ERROR + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* Insert enough records to force root to split into 2 internal nodes */ + for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC * 9); u++) { + record.key = u + 2; /* Leave a gap for later insertion */ + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + for(; u < (INSERT_SPLIT_ROOT_NREC_REC * 41); u++) { + record.key = u + 4; /* Leave a gap for later insertion */ + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 2; + bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC_REC * 41); + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = 1347; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Add some extra records to left-most leaf */ + record.key = 0; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + record.key = 1; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + + /* Add some extra records to middle leaf */ + record.key = (INSERT_SPLIT_ROOT_NREC_REC * 9) + 2; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + record.key = (INSERT_SPLIT_ROOT_NREC_REC * 9) + 3; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + + /* Iterate over B-tree to check records have been inserted correctly */ + idx.key = 0; + idx.val = 0; + if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &idx) < 0) + FAIL_STACK_ERROR + + /* Make certain that the index is correct */ + if(idx.key != ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 4)) + TEST_ERROR + + /* Attempt to find non-existant record in level-2 B-tree */ + /* (Should not be found, but not fail) */ + find.key = INSERT_SPLIT_ROOT_NREC_REC * 42; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE) + TEST_ERROR + if(find.val != (hsize_t)-1) + TEST_ERROR + + /* Attempt to find existant record in root of level-2 B-tree */ + find.key = 1347; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.val != (1347 * 2)) + TEST_ERROR + + /* Check with B-tree */ + record.key = 1347; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) + TEST_ERROR + + /* Attempt to find existant record in internal node of level-2 B-tree */ + find.key = 513; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.val != (513 * 2)) + TEST_ERROR + + /* Check with B-tree */ + record.key = 513; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) + TEST_ERROR + + /* Attempt to find existant record in leaf of level-2 B-tree */ + find.key = 555; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.val != (555 * 2)) + TEST_ERROR + + /* Check with B-tree */ + record.key = 555; + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) + TEST_ERROR + + /* Attempt to index non-existant record in level-2 B-tree */ + H5E_BEGIN_TRY { + ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC * 42), index_rec_cb, NULL); + } H5E_END_TRY; + /* Should fail */ + if(ret != FAIL) + TEST_ERROR + + /* Attempt to index existing record in root of level-2 B-tree */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)1347, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 1347) + TEST_ERROR + if(find.val != (1347 * 2)) + TEST_ERROR + + /* Attempt to index existing record in internal node of level-2 B-tree */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)513, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 513) + TEST_ERROR + if(find.val != (513 * 2)) + TEST_ERROR + + /* Attempt to index existing record in leaf of level-2 B-tree */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)555, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 555) + TEST_ERROR + if(find.val != (555 * 2)) + TEST_ERROR + + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + PASSED(); + + + /* + * Test inserting many records into v2 B-tree + */ + TESTING("B-tree update: make level 2 B-tree (r->l)"); + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* Insert enough records to force root to split into 2 internal nodes */ + for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC * 9); u++) { + record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 1) - u; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + for(; u < (INSERT_SPLIT_ROOT_NREC_REC * 41); u++) { + record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 1) - (u +2); /* Leave a gap for later insertion */ + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Check up on B-tree */ + bt2_stat.depth = 2; + bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC_REC * 41); + if(check_stats(bt2, &bt2_stat) < 0) + TEST_ERROR + record.key = 1344; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) + TEST_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + /* Add some extra records to right-most leaf */ + record.key = (INSERT_SPLIT_ROOT_NREC_REC * 41) + 2; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + record.key = (INSERT_SPLIT_ROOT_NREC_REC * 41) + 3; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + + /* Add some extra records to middle leaf */ + record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) - (INSERT_SPLIT_ROOT_NREC_REC * 9)); + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) - (INSERT_SPLIT_ROOT_NREC_REC * 9)) + 1; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + TEST_ERROR + + + /* Iterate over B-tree to check records have been inserted correctly */ + idx.key = 0; + idx.val = 0; + if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &idx) < 0) + FAIL_STACK_ERROR + + /* Make certain that the index is correct */ + if(idx.key != ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 4)) + TEST_ERROR + + /* Attempt to find non-existant record in level-2 B-tree */ + /* (Should not be found, but not fail) */ + find.key = INSERT_SPLIT_ROOT_NREC_REC * 42; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE) + TEST_ERROR + if(find.val != (hsize_t)-1) + TEST_ERROR + + /* Attempt to find existant record in root of level-2 B-tree */ + find.key = 1344; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.val != (1344 * 2)) + TEST_ERROR + + /* Check with B-tree */ + record.key = 1344; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) + TEST_ERROR + + /* Attempt to find existant record in internal node of level-2 B-tree */ + find.key = 512; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.val != (512 * 2)) TEST_ERROR - /* Create the v2 B-tree & get its address */ - if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + /* Check with B-tree */ + record.key = 512; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR - /* Insert enough records to force root to split into 3 internal nodes */ - /* (and fill right internal node) */ - for(u = 0; u < (INSERT_SPLIT_ROOT_NREC * 31); u++) { - record = u; - if(H5B2_insert(bt2, dxpl, &record) < 0) - FAIL_STACK_ERROR - } /* end for */ - for(; u < (INSERT_SPLIT_ROOT_NREC * 74); u++) { - record = u + ((INSERT_SPLIT_ROOT_NREC * 13) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 3); - if(H5B2_insert(bt2, dxpl, &record) < 0) - FAIL_STACK_ERROR - } /* end for */ + /* Attempt to find existant record in leaf of level-2 B-tree */ + find.key = 555; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.val != (555 * 2)) + TEST_ERROR - /* Check for closing & re-opening the B-tree */ - if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + /* Check with B-tree */ + record.key = 555; + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR - /* Check up on B-tree */ - bt2_stat.depth = 2; - bt2_stat.nrecords = INSERT_SPLIT_ROOT_NREC * 74; - if(check_stats(bt2, &bt2_stat) < 0) + /* Attempt to index non-existant record in level-2 B-tree */ + H5E_BEGIN_TRY { + ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC * 42), index_rec_cb, NULL); + } H5E_END_TRY; + /* Should fail */ + if(ret != FAIL) TEST_ERROR - record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + + /* Attempt to index existing record in root of level-2 B-tree */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)1344, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 1344) TEST_ERROR - record = 3703; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(find.val != (1344 * 2)) TEST_ERROR - record = 1952; /* Record to left of insertion point in middle internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + + /* Attempt to index existing record in internal node of level-2 B-tree */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)512, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 512) TEST_ERROR - record = 2884; /* Record to right of insertion point in middle internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(find.val != (512 * 2)) TEST_ERROR - record = 2822; /* Record just after insertion point in leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + + /* Attempt to index existing record in leaf of level-2 B-tree */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)555, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 555) + TEST_ERROR + if(find.val != (555 * 2)) TEST_ERROR - /* Insert records to fill up middle internal node */ - for(u = 0; u < ((INSERT_SPLIT_ROOT_NREC * 13) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 2); u++) { - record = u + (INSERT_SPLIT_ROOT_NREC * 31); - if(H5B2_insert(bt2, dxpl, &record) < 0) + /* Close the v2 B-tree */ + if(H5B2_close(bt2, dxpl) < 0) + FAIL_STACK_ERROR + bt2 = NULL; + + PASSED(); + + + /* + * Test inserting many records into v2 B-tree + */ + TESTING("B-tree update: make level 2 B-tree (l+r->middle)"); + + /* Create the v2 B-tree & get its address */ + if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) + TEST_ERROR + + /* Insert enough records to force root to split into 2 internal nodes */ + for(u = 0; u < (INSERT_SPLIT_ROOT_NREC_REC * 9); u++) { + record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 3) - u; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + } /* end for */ + for(; u < (INSERT_SPLIT_ROOT_NREC_REC * 41); u++) { + record.key = u - ((INSERT_SPLIT_ROOT_NREC_REC * 9) - 2); /* Leave a gap for later insertion */ + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) FAIL_STACK_ERROR } /* end for */ /* Check up on B-tree */ bt2_stat.depth = 2; - bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 87) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 2; + bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC_REC * 41); if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR - record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) - TEST_ERROR - record = 3703; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) - TEST_ERROR - record = 2789; /* Record to left of insertion point in middle internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) - TEST_ERROR - record = 2822; /* Record to right of insertion point in middle internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + record.key = 1345; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR - record = 2823; /* Record just above insertion point in leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + + /* Check for closing & re-opening the B-tree */ + if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) TEST_ERROR + /* Add some extra records to right-most leaf */ + record.key = (INSERT_SPLIT_ROOT_NREC_REC * 41) + 4; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + record.key = (INSERT_SPLIT_ROOT_NREC_REC * 41) + 5; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + + /* Add some extra records to middle leaf */ + record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) - (INSERT_SPLIT_ROOT_NREC_REC * 9)) + 2; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + record.key = ((INSERT_SPLIT_ROOT_NREC_REC * 41) - (INSERT_SPLIT_ROOT_NREC_REC * 9)) + 3; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + + /* Add some extra records to left-most leaf */ + record.key = 0; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + record.key = 1; + record.val = record.key * 2; + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) + FAIL_STACK_ERROR + /* Check for closing & re-opening the B-tree */ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) TEST_ERROR - /* Insert record to split middle internal node */ - record = u + (INSERT_SPLIT_ROOT_NREC * 31); - if(H5B2_insert(bt2, dxpl, &record) < 0) + + /* Iterate over B-tree to check records have been inserted correctly */ + idx.key = 0; + idx.val = 0; + if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &idx) < 0) FAIL_STACK_ERROR - /* Check up on B-tree */ - bt2_stat.depth = 2; - bt2_stat.nrecords = (INSERT_SPLIT_ROOT_NREC * 87) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 3; - if(check_stats(bt2, &bt2_stat) < 0) + /* Make certain that the index is correct */ + if(idx.key != ((INSERT_SPLIT_ROOT_NREC_REC * 41) + 6)) TEST_ERROR - record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + + /* Attempt to find non-existant record in level-2 B-tree */ + /* (Should not be found, but not fail) */ + find.key = INSERT_SPLIT_ROOT_NREC_REC * 42; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE) TEST_ERROR - record = 2789; /* Middle record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(find.val != (hsize_t)-1) TEST_ERROR - record = 3703; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + + /* Attempt to find existant record in root of level-2 B-tree */ + find.key = 1345; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.val != (1345 * 2)) TEST_ERROR -#ifdef NONE - record = 3049; /* Record to left of insertion point in middle internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + + /* Check with B-tree */ + record.key = 1345; + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR -#endif /* NONE */ - record = 2822; /* Record to right of insertion point in middle internal node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + + /* Attempt to find existant record in internal node of level-2 B-tree */ + find.key = 513; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.val != (513 * 2)) TEST_ERROR - record = 2823; /* Record just above insertion point in leaf node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + + /* Check with B-tree */ + record.key = 513; + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR - /* Check for closing & re-opening the B-tree */ - if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) + /* Attempt to find existant record in leaf of level-2 B-tree */ + find.key = 555; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) + FAIL_STACK_ERROR + if(find.val != (555 * 2)) TEST_ERROR - /* Iterate over B-tree to check records have been inserted correctly */ - idx = 0; - if(H5B2_iterate(bt2, dxpl, iter_cb, &idx) < 0) + /* Check with B-tree */ + record.key = 555; + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) + TEST_ERROR + + /* Attempt to index non-existant record in level-2 B-tree */ + H5E_BEGIN_TRY { + ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)(INSERT_SPLIT_ROOT_NREC_REC * 42), index_rec_cb, NULL); + } H5E_END_TRY; + /* Should fail */ + if(ret != FAIL) + TEST_ERROR + + /* Attempt to index existing record in level-2 B-tree */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)1345, index_rec_cb, &find) < 0) FAIL_STACK_ERROR + if(find.key != 1345) + TEST_ERROR + if(find.val != (1345 * 2)) + TEST_ERROR - /* Make certain that the index is correct */ - if(idx != ((INSERT_SPLIT_ROOT_NREC * 87) + ((3 * INSERT_SPLIT_ROOT_NREC) / 4) + 3)) + /* Attempt to index existing record in internal node of level-2 B-tree */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)513, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 513) + TEST_ERROR + if(find.val != (513 * 2)) + TEST_ERROR + + /* Attempt to index existing record in leaf of level-2 B-tree */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + if(H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)555, index_rec_cb, &find) < 0) + FAIL_STACK_ERROR + if(find.key != 555) + TEST_ERROR + if(find.val != (555 * 2)) TEST_ERROR /* Close the v2 B-tree */ @@ -2730,103 +4959,95 @@ error: H5Fclose(file); } H5E_END_TRY; return 1; -} /* test_insert_level2_3internal_split() */ +} /* test_update_make_level2() */ /*------------------------------------------------------------------------- - * Function: test_insert_lots + * Function: test_update_lots * * Purpose: Basic tests for the B-tree v2 code. This test inserts many * records in random order, enough to make at a level 4 B-tree. * * Return: Success: 0 - * * Failure: 1 * * Programmer: Quincey Koziol - * Saturday, February 19, 2005 + * Sunday, December 27, 2015 * *------------------------------------------------------------------------- */ static unsigned -test_insert_lots(hid_t fapl, const H5B2_create_t *cparam, +test_update_lots(hid_t fapl, const H5B2_create_t *cparam, const bt2_test_param_t *tparam) { hid_t file = -1; /* File ID */ - char filename[1024]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ - hsize_t record; /* Record to insert into tree */ - hsize_t idx; /* Index within B-tree, for iterator */ time_t curr_time; /* Current time, for seeding random number generator */ - hsize_t *records; /* Record #'s for random insertion */ - unsigned u; /* Local index variable */ - unsigned swap_idx; /* Location to swap with when shuffling */ - hsize_t temp_rec; /* Temporary record */ + H5B2_test_rec_t *records; /* Record #'s for random insertion */ + H5B2_test_rec_t record; /* Record to insert into tree */ + H5B2_test_rec_t modify; /* Modified value */ + H5B2_test_rec_t find; /* Record to find */ + H5B2_test_rec_t iter; /* Index within B-tree, for iterator */ H5B2_stat_t bt2_stat; /* Statistics about B-tree created */ hsize_t nrec; /* Number of records in B-tree */ + unsigned u; /* Local index variable */ herr_t ret; /* Generic error return value */ /* Initialize random number seed */ - curr_time=HDtime(NULL); + curr_time = HDtime(NULL); #ifdef QAK -curr_time=1109170019; -HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); +curr_time = 1451342093; +HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); #endif /* QAK */ HDsrandom((unsigned)curr_time); /* * Test inserting many records into v2 B-tree */ - TESTING("B-tree insert: create random level 4 B-tree"); + TESTING("B-tree update: create random level 4 B-tree"); /* Allocate space for the records */ - if(NULL == (records = (hsize_t *)HDmalloc(sizeof(hsize_t) * INSERT_MANY))) + if(NULL == (records = (H5B2_test_rec_t *)HDmalloc(sizeof(H5B2_test_rec_t) * INSERT_MANY_REC))) TEST_ERROR /* Initialize record #'s */ - for(u = 0; u < INSERT_MANY; u++) - records[u] = u; + for(u = 0; u < INSERT_MANY_REC; u++) { + records[u].key = u; + records[u].val = u * 2; + } /* end for */ /* Shuffle record #'s */ - for(u = 0; u < INSERT_MANY; u++) { - swap_idx = ((unsigned)HDrandom() % (INSERT_MANY - u)) + u; + for(u = 0; u < INSERT_MANY_REC; u++) { + H5B2_test_rec_t temp_rec; /* Temporary record */ + unsigned swap_idx; /* Location to swap with when shuffling */ + + swap_idx = ((unsigned)HDrandom() % (INSERT_MANY_REC - u)) + u; temp_rec = records[u]; records[u] = records[swap_idx]; records[swap_idx] = temp_rec; } /* end for */ - /* Set the filename to use for this test (dependent on fapl) */ - h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); - - /* Create the file to work on */ - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + /* Create the file for the test */ + if(create_file(&file, &f, fapl) < 0) TEST_ERROR - /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) - STACK_ERROR - - /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(f) < 0) - STACK_ERROR - /* Create the v2 B-tree & get its address */ if(create_btree(f, dxpl, cparam, &bt2, &bt2_addr) < 0) TEST_ERROR /* Insert random records */ - for(u = 0; u < INSERT_MANY; u++) { + for(u = 0; u < INSERT_MANY_REC; u++) { record = records[u]; - if(H5B2_insert(bt2, dxpl, &record) < 0) + if(H5B2_update(bt2, dxpl, &record, no_modify_cb, NULL) < 0) FAIL_STACK_ERROR } /* end for */ /* Check up on B-tree */ bt2_stat.depth = 4; - bt2_stat.nrecords = INSERT_MANY; + bt2_stat.nrecords = INSERT_MANY_REC; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR @@ -2838,18 +5059,11 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); /* Close file */ if(H5Fclose(file) < 0) STACK_ERROR + file = -1; - /* Re-open the file */ - if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) - FAIL_STACK_ERROR - - /* Get a pointer to the internal file object */ - if(NULL == (f = (H5F_t *)H5I_object(file))) - FAIL_STACK_ERROR - - /* Ignore metadata tags in the file's cache */ - if(H5AC_ignore_tags(f) < 0) - STACK_ERROR + /* Re-open the file for the test */ + if(reopen_file(&file, &f, fapl) < 0) + TEST_ERROR /* Re-open v2 B-tree */ if(NULL == (bt2 = H5B2_open(f, dxpl, bt2_addr, f))) @@ -2857,87 +5071,110 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); /* Check up on B-tree after re-open */ bt2_stat.depth = 4; - bt2_stat.nrecords = INSERT_MANY; + bt2_stat.nrecords = INSERT_MANY_REC; if(check_stats(bt2, &bt2_stat) < 0) TEST_ERROR /* Iterate over B-tree to check records have been inserted correctly */ - idx = 0; - if(H5B2_iterate(bt2, dxpl, iter_cb, &idx) < 0) + iter.key = 0; + iter.val = 0; + if(H5B2_iterate(bt2, dxpl, iter_rec_cb, &iter) < 0) FAIL_STACK_ERROR /* Make certain that the index is correct */ - if(idx != INSERT_MANY) + if(iter.key != INSERT_MANY_REC) TEST_ERROR /* Attempt to find non-existant record in level-4 B-tree */ /* (Should not be found, but not fail) */ - idx = INSERT_MANY * 2; - if(H5B2_find(bt2, dxpl, &idx, find_cb, &idx) != FALSE) + find.key = INSERT_MANY_REC * 2; + find.val = (hsize_t)-1; + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != FALSE) + TEST_ERROR + if(find.val != (hsize_t)-1) TEST_ERROR /* Find random records */ - for(u = 0; u < FIND_MANY; u++) { + for(u = 0; u < FIND_MANY_REC; u++) { /* Pick random record */ - idx = (hsize_t)(HDrandom()%INSERT_MANY); + find.key = (hsize_t)(HDrandom() % INSERT_MANY_REC); + find.val = (hsize_t)-1; - /* Attempt to find existant record in root of level-4 B-tree */ - if(H5B2_find(bt2, dxpl, &idx, find_cb, &idx) != TRUE) + /* Attempt to find existant record in level-4 B-tree */ + if(H5B2_find(bt2, dxpl, &find, find_rec_cb, &find) != TRUE) FAIL_STACK_ERROR + if(find.val != (find.key * 2)) + TEST_ERROR } /* end for */ /* Attempt to index non-existant record in level-4 B-tree, in increasing & decreasing order */ H5E_BEGIN_TRY { - ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)(INSERT_MANY*3), find_cb, NULL); + ret = H5B2_index(bt2, dxpl, H5_ITER_INC, (hsize_t)(INSERT_MANY_REC * 3), find_rec_cb, NULL); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) TEST_ERROR H5E_BEGIN_TRY { - ret = H5B2_index(bt2, dxpl, H5_ITER_DEC, (hsize_t)(INSERT_MANY*3), find_cb, NULL); + ret = H5B2_index(bt2, dxpl, H5_ITER_DEC, (hsize_t)(INSERT_MANY_REC * 3), find_rec_cb, NULL); } H5E_END_TRY; /* Should fail */ if(ret != FAIL) TEST_ERROR /* Find random records */ - for(u = 0; u < FIND_MANY; u++) { + for(u = 0; u < FIND_MANY_REC; u++) { + hsize_t idx; /* Record index */ + /* Pick random record */ - idx = (hsize_t)(HDrandom() % INSERT_MANY); + idx = (hsize_t)(HDrandom() % INSERT_MANY_REC); - /* Attempt to find existant record in root of level-4 B-tree */ + /* Reset find record */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + + /* Attempt to find existant record in level-4 B-tree */ /* (in increasing order) */ - if(H5B2_index(bt2, dxpl, H5_ITER_INC, idx, find_cb, &idx) < 0) + if(H5B2_index(bt2, dxpl, H5_ITER_INC, idx, index_rec_cb, &find) < 0) FAIL_STACK_ERROR + if(find.key != idx) + TEST_ERROR + if(find.val != (find.key * 2)) + TEST_ERROR - /* Attempt to find existant record in root of level-4 B-tree */ + /* Reset find record */ + find.key = (hsize_t)-1; + find.val = (hsize_t)-1; + + /* Attempt to find existant record in level-4 B-tree */ /* (in decreasing order) */ - if(H5B2_index(bt2, dxpl, H5_ITER_DEC, idx, find_dec_cb, &idx) < 0) + if(H5B2_index(bt2, dxpl, H5_ITER_DEC, idx, index_rec_cb, &find) < 0) FAIL_STACK_ERROR + if(find.key != (INSERT_MANY_REC - (idx + 1))) + TEST_ERROR + if(find.val != (find.key * 2)) + TEST_ERROR } /* end for */ PASSED(); - TESTING("B-tree insert: attempt duplicate record in level 4 B-tree"); + TESTING("B-tree update: update record in level 4 B-tree"); /* Check for closing & re-opening the B-tree */ if(reopen_btree(f, dxpl, &bt2, bt2_addr, tparam) < 0) TEST_ERROR - record = INSERT_MANY / 2; - H5E_BEGIN_TRY { - ret = H5B2_insert(bt2, dxpl, &record); - } H5E_END_TRY; - /* Should fail */ - if(ret != FAIL) - TEST_ERROR + record.key = INSERT_MANY_REC / 2; + modify.key = INSERT_MANY_REC / 2; + modify.val = record.key * 3; + if(H5B2_update(bt2, dxpl, &record, modify_rec_cb, &modify) < 0) + FAIL_STACK_ERROR /* Query the number of records in the B-tree */ if(H5B2_get_nrec(bt2, &nrec) < 0) FAIL_STACK_ERROR /* Make certain that the # of records is correct */ - if(nrec != INSERT_MANY) + if(nrec != INSERT_MANY_REC) TEST_ERROR /* Close the v2 B-tree */ @@ -2956,14 +5193,16 @@ HDfprintf(stderr,"curr_time=%lu\n",(unsigned long)curr_time); return 0; error: + HDfprintf(stderr, "curr_time = %lu\n", (unsigned long)curr_time); H5E_BEGIN_TRY { if(bt2) H5B2_close(bt2, dxpl); H5Fclose(file); } H5E_END_TRY; HDfree(records); + return 1; -} /* test_insert_lots() */ +} /* test_update_lots() */ /*------------------------------------------------------------------------- @@ -3365,13 +5604,13 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam, /* Check up on B-tree */ record = 62; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 94; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = (INSERT_SPLIT_ROOT_NREC * 2) - 2; - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR rrecord = 0; @@ -3384,10 +5623,10 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam, /* Make certain that the leaf nodes didn't redistribute */ record = 62; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 94; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Query the number of records in the B-tree */ @@ -3409,7 +5648,7 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam, /* Check up on B-tree */ record = 0; - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR rrecord = 1; @@ -3422,10 +5661,10 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam, /* Make certain that the leaf nodes didn't redistribute */ record = 62; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 94; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Query the number of records in the B-tree */ @@ -3447,7 +5686,7 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam, /* Check up on B-tree */ record = INSERT_SPLIT_ROOT_NREC; - if(check_node_depth(bt2, dxpl, record, (unsigned)0) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)0) < 0) TEST_ERROR rrecord = 0; @@ -3460,10 +5699,10 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam, /* Make certain that the leaf nodes didn't redistribute */ record = 62; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 94; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Query the number of records in the B-tree */ @@ -3545,10 +5784,10 @@ test_remove_level1_redistrib(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 62; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 94; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Query the number of records in the B-tree */ @@ -3593,10 +5832,10 @@ test_remove_level1_redistrib(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 62; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 90; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR PASSED(); @@ -3629,10 +5868,10 @@ test_remove_level1_redistrib(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 64; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 90; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR PASSED(); @@ -3665,10 +5904,10 @@ test_remove_level1_redistrib(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 64; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 91; /* Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR /* Close the v2 B-tree */ @@ -3742,7 +5981,7 @@ test_remove_level1_2leaf_merge(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 62; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 2; @@ -3815,7 +6054,7 @@ test_remove_level1_2leaf_merge(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 62; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 2; @@ -3921,7 +6160,7 @@ test_remove_level1_3leaf_merge(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 62; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 2; @@ -4047,13 +6286,13 @@ test_remove_level1_promote(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 62; /* Left-most record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 125; /* Center-Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 188; /* Center-Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 4; @@ -4093,13 +6332,13 @@ test_remove_level1_promote(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 62; /* Left-most record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 125; /* Center-Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 188; /* Center-Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 4; @@ -4139,13 +6378,13 @@ test_remove_level1_promote(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 63; /* Left-most record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 125; /* Center-Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 188; /* Center-Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 4; @@ -4181,13 +6420,13 @@ test_remove_level1_promote(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 63; /* Left-most record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 126; /* Center-Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR record = 188; /* Center-Right record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 4; @@ -4274,7 +6513,7 @@ test_remove_level1_promote_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cpar /* Check record values in root of B-tree */ record = 62; /* Left-most record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 2; @@ -4335,7 +6574,7 @@ test_remove_level1_promote_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cpar /* Check record values in root of B-tree */ record = 62; /* Left-most record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 2; @@ -4422,7 +6661,7 @@ test_remove_level1_promote_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cpar /* Check record values in root of B-tree */ record = 62; /* Left-most record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 2; @@ -4483,7 +6722,7 @@ test_remove_level1_promote_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cpar /* Check record values in root of B-tree */ record = 39; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 2; @@ -4570,7 +6809,7 @@ test_remove_level1_promote_2leaf_merge(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 62; /* Left-most record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 2; @@ -4715,7 +6954,7 @@ test_remove_level1_promote_3leaf_merge(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 62; /* Left-most record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)1) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)1) < 0) TEST_ERROR ninfo.depth = 1; ninfo.nrec = 2; @@ -4999,7 +7238,7 @@ test_remove_level2_promote(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR ninfo.depth = 2; ninfo.nrec = 2; @@ -5285,7 +7524,7 @@ test_remove_level2_promote_2internal_redistrib(hid_t fapl, const H5B2_create_t * /* Check record values in root of B-tree */ record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR ninfo.depth = 2; ninfo.nrec = 2; @@ -5435,7 +7674,7 @@ test_remove_level2_promote_3internal_redistrib(hid_t fapl, const H5B2_create_t * /* Check record values in root of B-tree */ record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR ninfo.depth = 2; ninfo.nrec = 2; @@ -5585,7 +7824,7 @@ test_remove_level2_promote_2internal_merge(hid_t fapl, const H5B2_create_t *cpar /* Check record values in root of B-tree */ record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR ninfo.depth = 2; ninfo.nrec = 2; @@ -5736,7 +7975,7 @@ test_remove_level2_promote_3internal_merge(hid_t fapl, const H5B2_create_t *cpar /* Check record values in root of B-tree */ record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR ninfo.depth = 2; ninfo.nrec = 2; @@ -5887,7 +8126,7 @@ test_remove_level2_2internal_merge_left(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR ninfo.depth = 2; ninfo.nrec = 2; @@ -6013,7 +8252,7 @@ test_remove_level2_2internal_merge_right(hid_t fapl, const H5B2_create_t *cparam /* Check record values in root of B-tree */ record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR ninfo.depth = 2; ninfo.nrec = 2; @@ -6139,7 +8378,7 @@ test_remove_level2_3internal_merge(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR ninfo.depth = 2; ninfo.nrec = 2; @@ -6266,7 +8505,7 @@ test_remove_level2_collapse_right(hid_t fapl, const H5B2_create_t *cparam, /* Check record values in root of B-tree */ record = 1889; /* Left record in root node */ - if(check_node_depth(bt2, dxpl, record, (unsigned)2) < 0) + if(check_node_depth(bt2, dxpl, &record, (unsigned)2) < 0) TEST_ERROR ninfo.depth = 2; ninfo.nrec = 2; @@ -7750,7 +9989,7 @@ error: int main(void) { - H5B2_create_t cparam; /* Creation parameters for v2 B-tree */ + H5B2_create_t cparam, cparam2; /* Creation parameters for v2 B-tree */ bt2_test_param_t tparam; /* Test parameters for v2 B-tree */ hid_t fapl = -1; /* File access property list for data files */ unsigned nerrors = 0; /* Cumulative error count */ @@ -7770,8 +10009,7 @@ main(void) printf("***Express test mode on. Some tests may be skipped\n"); /* Initialize v2 B-tree creation parameters */ - init_cparam(&cparam); - + init_cparam(&cparam, &cparam2); /* Loop over re-opening B-tree during tests */ for(reopen = FALSE; reopen <= TRUE; reopen++) { @@ -7785,7 +10023,7 @@ main(void) } /* end else */ /* Test B-tree record insertion */ - /* Iteration, find & index routines tested in these routines as well */ + /* (Iteration, find & index routines exercised in these routines as well) */ nerrors += test_insert_basic(fapl, &cparam, &tparam); nerrors += test_insert_split_root(fapl, &cparam, &tparam); nerrors += test_insert_level1_2leaf_redistrib(fapl, &cparam, &tparam); @@ -7804,6 +10042,20 @@ main(void) else nerrors += test_insert_lots(fapl, &cparam, &tparam); + /* Test B-tree record update (ie. insert/modify) */ + /* (Iteration, find & index routines exercised in these routines as well) */ + nerrors += test_update_basic(fapl, &cparam2, &tparam); + nerrors += test_update_split_root(fapl, &cparam2, &tparam); + nerrors += test_update_level1_2leaf_redistrib(fapl, &cparam2, &tparam); + nerrors += test_update_level1_side_split(fapl, &cparam2, &tparam); + nerrors += test_update_level1_3leaf_redistrib(fapl, &cparam2, &tparam); + nerrors += test_update_level1_middle_split(fapl, &cparam2, &tparam); + nerrors += test_update_make_level2(fapl, &cparam2, &tparam); + if(ExpressMode > 1) + printf("***Express test mode on. test_update_lots skipped\n"); + else + nerrors += test_update_lots(fapl, &cparam2, &tparam); + /* Test B-tree record removal */ /* Querying the number of records routine also tested in these routines as well */ nerrors += test_remove_basic(fapl, &cparam, &tparam); diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c index 480450d..817f583 100644 --- a/tools/misc/h5debug.c +++ b/tools/misc/h5debug.c @@ -121,6 +121,10 @@ get_H5B2_class(const uint8_t *sig) cls = H5A_BT2_CORDER; break; + case H5B2_TEST2_ID: + cls = H5B2_TEST2; + break; + case H5B2_NUM_BTREE_ID: default: HDfprintf(stderr, "Unknown v2 B-tree subtype %u\n", (unsigned)(subtype)); -- cgit v0.12 From c6949efd4fd5f5757f2d0443d51e4d635485595b Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 29 Dec 2015 20:56:45 -0500 Subject: [svn-r28748] Description: Bump number of records for level 4 B-tree test, so that it's more likely to always get to level 4. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest forthcoming) --- test/btree2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/btree2.c b/test/btree2.c index 04c94fd..8a08d3d 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -38,7 +38,7 @@ const char *FILENAME[] = { #define INSERT_SPLIT_ROOT_NREC 63 #define INSERT_SPLIT_ROOT_NREC_REC 64 #define INSERT_MANY (1000 * 1000) -#define INSERT_MANY_REC (2600 * 1000) +#define INSERT_MANY_REC (2610 * 1000) #define FIND_MANY (INSERT_MANY / 100) #define FIND_MANY_REC (INSERT_MANY_REC / 100) #define FIND_NEIGHBOR 2000 -- cgit v0.12 From 528ab9b810102a7cc7773c6403c8b2be6578d380 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 30 Dec 2015 13:50:01 -0500 Subject: [svn-r28756] Description: Minor code neatening and cleanups (same as r28755) on revise_chunks branch. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (Too minor for h5committest) --- src/H5Dchunk.c | 40 ++++++++++++++++++++++++---------------- src/H5Dpkg.h | 10 +++++----- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 2e000e3..6b99a43 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -1034,9 +1034,8 @@ H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline) FUNC_ENTER_STATIC_NOERR HDassert(size); - HDassert(pline); - if(pline->nused > 0) + if(pline && pline->nused) ret_value = H5MM_malloc(size); else ret_value = H5FL_BLK_MALLOC(chunk, size); @@ -1064,10 +1063,8 @@ H5D__chunk_mem_xfree(void *chk, const H5O_pline_t *pline) { FUNC_ENTER_STATIC_NOERR - HDassert(pline); - if(chk) { - if(pline->nused > 0) + if(pline && pline->nused) H5MM_xfree(chk); else chk = H5FL_BLK_FREE(chunk, chk); @@ -1751,6 +1748,7 @@ H5D__chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr, hbool_t write_ FUNC_ENTER_PACKAGE + /* Sanity check */ HDassert(io_info); HDassert(dataset); @@ -2551,13 +2549,14 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, H5D_chunk_ud_t *udata) { H5D_rdcc_ent_t *ent = NULL; /* Cache entry */ - hbool_t found = FALSE; /* In cache? */ - unsigned u; /* Counter */ H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk); - herr_t ret_value = SUCCEED; /* Return value */ + unsigned idx; /* Index of chunk in cache, if present */ + hbool_t found = FALSE; /* In cache? */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE + /* Sanity checks */ HDassert(dset); HDassert(dset->shared->layout.u.chunk.ndims > 0); H5D_CHUNK_STORAGE_INDEX_CHK(sc); @@ -2567,7 +2566,7 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, /* Initialize the query information about the chunk we are looking for */ udata->common.layout = &(dset->shared->layout.u.chunk); udata->common.storage = &(dset->shared->layout.storage.u.chunk); - udata->common.scaled = scaled; + udata->common.scaled = scaled; /* Reset information about the chunk we are looking for */ udata->chunk_block.offset = HADDR_UNDEF; @@ -2576,19 +2575,29 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, /* Check for chunk in cache */ if(dset->shared->cache.chunk.nslots > 0) { - udata->idx_hint = H5D__chunk_hash_val(dset->shared, scaled); - ent = dset->shared->cache.chunk.slot[udata->idx_hint]; + /* Determine the chunk's location in the hash table */ + idx = H5D__chunk_hash_val(dset->shared, scaled); + + /* Get the chunk cache entry for that location */ + ent = dset->shared->cache.chunk.slot[idx]; + if(ent) { + unsigned u; /* Counter */ + + /* Speculatively set the 'found' flag */ + found = TRUE; - if(ent) - for(u = 0, found = TRUE; u < dset->shared->ndims; u++) + /* Verify that the cache entry is the correct chunk */ + for(u = 0; u < dset->shared->ndims; u++) if(scaled[u] != ent->scaled[u]) { found = FALSE; break; } /* end if */ + } /* end if */ } /* end if */ - /* Find chunk addr */ + /* Retrieve chunk addr */ if(found) { + udata->idx_hint = idx; udata->chunk_block.offset = ent->chunk_block.offset; udata->chunk_block.length = ent->chunk_block.length;; udata->chunk_idx = ent->chunk_idx; @@ -3287,6 +3296,7 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, FUNC_ENTER_PACKAGE + /* Sanity check */ HDassert(io_info); HDassert(udata); @@ -3294,8 +3304,6 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, /* * It's not in the cache, probably because it's too big. If it's * dirty then flush it to disk. In any case, free the chunk. - * Note: we have to copy the layout and filter messages so we - * don't discard the `const' qualifier. */ if(dirty) { H5D_rdcc_ent_t fake_ent; /* "fake" chunk cache entry */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 06e763c..4e6376b 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -250,7 +250,6 @@ typedef struct H5D_chunk_rec_t { * to which the index points. */ typedef struct H5D_chunk_common_ud_t { - /* downward */ const H5O_layout_chunk_t *layout; /* Chunk layout description */ const H5O_storage_chunk_t *storage; /* Chunk storage description */ const hsize_t *scaled; /* Scaled coordinates for a chunk */ @@ -258,13 +257,14 @@ typedef struct H5D_chunk_common_ud_t { /* B-tree callback info for various operations */ typedef struct H5D_chunk_ud_t { + /* Downward */ H5D_chunk_common_ud_t common; /* Common info for B-tree user data (must be first) */ /* Upward */ - unsigned idx_hint; /*index of chunk in cache, if present */ - H5F_block_t chunk_block; /*offset/length of chunk in file */ - unsigned filter_mask; /*excluded filters */ - hsize_t chunk_idx; /*chunk index for EA, FA indexing */ + unsigned idx_hint; /* Index of chunk in cache, if present */ + H5F_block_t chunk_block; /* Offset/length of chunk in file */ + unsigned filter_mask; /* Excluded filters */ + hsize_t chunk_idx; /* Chunk index for EA, FA indexing */ } H5D_chunk_ud_t; /* Typedef for "generic" chunk callbacks */ -- cgit v0.12 From 8d8d56d7d1601a88b90524c7bcb78c2515ce770f Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Thu, 31 Dec 2015 11:23:05 -0500 Subject: [svn-r28759] Description: Bump number of records for level 4 update test, to cut down on number of random failures. Tested on: None - trivial --- test/btree2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/btree2.c b/test/btree2.c index 8a08d3d..b0c0ac3 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -38,7 +38,7 @@ const char *FILENAME[] = { #define INSERT_SPLIT_ROOT_NREC 63 #define INSERT_SPLIT_ROOT_NREC_REC 64 #define INSERT_MANY (1000 * 1000) -#define INSERT_MANY_REC (2610 * 1000) +#define INSERT_MANY_REC (2650 * 1000) #define FIND_MANY (INSERT_MANY / 100) #define FIND_MANY_REC (INSERT_MANY_REC / 100) #define FIND_NEIGHBOR 2000 -- cgit v0.12 From f60170dac7c491cc75120a6ebdfe73c13c0bab1d Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 1 Jan 2016 01:28:04 -0500 Subject: [svn-r28761] Description: Clean up many mismatches between malloc/free and H5MM_malloc/H5MM_xfree in the library and tests (and use of H5free_memory and H5Dvlen_reclaim). Also make H5Ocopy use a private version of H5Lexists, which doesn't internally throw (and suppress) errors when an object (or the path to it) isn't found in the destination. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest forthcoming) --- fortran/src/H5Pf.c | 2 +- src/H5.c | 5 +- src/H5L.c | 186 ++++++++++++++++++++++++++++++++++++++++++++++++----- src/H5Lprivate.h | 2 + src/H5Ocopy.c | 24 ++----- src/H5TS.c | 17 +++-- src/H5Tvlen.c | 8 +-- src/H5Ztrans.c | 4 +- test/dtypes.c | 99 +++++++++++++++++++++++++--- test/fheap.c | 10 +-- test/file_image.c | 4 +- test/links.c | 57 ++++++++++------ test/objcopy.c | 150 ++++++++++++++++++++++++++++++++++++------ test/tgenprop.c | 4 +- test/tmisc.c | 16 ++++- test/tvlstr.c | 11 ++-- tools/h5ls/h5ls.c | 5 +- 17 files changed, 482 insertions(+), 122 deletions(-) diff --git a/fortran/src/H5Pf.c b/fortran/src/H5Pf.c index 523ed0b..3989512 100644 --- a/fortran/src/H5Pf.c +++ b/fortran/src/H5Pf.c @@ -5273,7 +5273,7 @@ h5pget_file_image_c(hid_t_f *fapl_id, void **buf_ptr, size_t_f *buf_len_ptr) *buf_len_ptr=(size_t_f)c_buf_len_ptr; ret_value = 0; - if(c_buf_ptr) HDfree(c_buf_ptr); + if(c_buf_ptr) H5free_memory(c_buf_ptr); return ret_value; } diff --git a/src/H5.c b/src/H5.c index 33ac340..2086ce8 100644 --- a/src/H5.c +++ b/src/H5.c @@ -942,7 +942,6 @@ H5allocate_memory(size_t size, hbool_t clear) ret_value = H5MM_malloc(size); FUNC_LEAVE_API(ret_value) - } /* end H5allocate_memory() */ @@ -981,7 +980,6 @@ H5resize_memory(void *mem, size_t size) ret_value = H5MM_realloc(mem, size); FUNC_LEAVE_API(ret_value) - } /* end H5resize_memory() */ @@ -1004,10 +1002,9 @@ H5free_memory(void *mem) H5TRACE1("e", "*x", mem); /* At this time, it is impossible for this to fail. */ - HDfree(mem); + H5MM_xfree(mem); FUNC_LEAVE_API(SUCCEED) - } /* end H5free_memory() */ diff --git a/src/H5L.c b/src/H5L.c index a1f3b6e..9daf948 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -93,6 +93,17 @@ typedef struct { hid_t dxpl_id; /* Dataset transfer property list */ } H5L_trav_mv2_t; +/* User data for path traversal routine for checking if a link exists */ +typedef struct { + /* Down */ + char *sep; /* Pointer to next separator in the string */ + hid_t lapl_id; /* Link access property list */ + hid_t dxpl_id; /* Dataset transfer property list */ + + /* Up */ + hbool_t exists; /* Whether the link exists or not */ +} H5L_trav_le_t; + /* User data for path traversal routine for getting link value */ typedef struct { size_t size; /* Size of user buffer */ @@ -170,10 +181,13 @@ static herr_t H5L_move_cb(H5G_loc_t *grp_loc/*in*/, const char *name, static herr_t H5L_move_dest_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static herr_t H5L_exists_cb(H5G_loc_t *grp_loc/*in*/, const char *name, +static herr_t H5L__exists_final_cb(H5G_loc_t *grp_loc/*in*/, const char *name, + const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, + H5G_own_loc_t *own_loc/*out*/); +static herr_t H5L__exists_inter_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); -static htri_t H5L_exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, +static htri_t H5L__exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id); static herr_t H5L_get_info_cb(H5G_loc_t *grp_loc/*in*/, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, @@ -827,7 +841,7 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Check for the existence of the link */ - if((ret_value = H5L_exists(&loc, name, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5L__exists(&loc, name, lapl_id, H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") done: @@ -2716,9 +2730,10 @@ done: /*------------------------------------------------------------------------- - * Function: H5L_exists_cb + * Function: H5L__exists_final_cb * - * Purpose: Callback for checking whether a link exists + * Purpose: Callback for checking whether a link exists, as the final + * component of a path * * Return: Non-negative on success/Negative on failure * @@ -2728,30 +2743,162 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5L_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, +H5L__exists_final_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, const H5O_link_t *lnk, H5G_loc_t H5_ATTR_UNUSED *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/) { - hbool_t *udata = (hbool_t *)_udata; /* User data passed in */ + H5L_trav_le_t *udata = (H5L_trav_le_t *)_udata; /* User data passed in */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Check if the name in this group resolved to a valid link */ - *udata = (hbool_t)(lnk != NULL); + udata->exists = (hbool_t)(lnk != NULL); /* Indicate that this callback didn't take ownership of the group * * location for the object */ *own_loc = H5G_OWN_NONE; FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5L_exists_cb() */ +} /* end H5L__exists_final_cb() */ /*------------------------------------------------------------------------- - * Function: H5L_exists + * Function: H5L__exists_inter_cb + * + * Purpose: Callback for checking whether a link exists, as an intermediate + * component of a path + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, December 31 2015 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5L__exists_inter_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *name, + const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, + H5G_own_loc_t *own_loc/*out*/) +{ + H5L_trav_le_t *udata = (H5L_trav_le_t *)_udata; /* User data passed in */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check if the name in this group resolved to a valid link */ + if(lnk != NULL) { + /* Check for more components to the path */ + if(udata->sep) { + H5G_traverse_t cb_func; /* Callback function for tranversal */ + char *next; /* Pointer to next component name */ + + /* Look for another separator */ + next = udata->sep; + if(NULL == (udata->sep = HDstrchr(udata->sep, '/'))) + cb_func = H5L__exists_final_cb; + else { + /* Chew through adjacent separators, if present */ + do { + *udata->sep = '\0'; + udata->sep++; + } while('/' == *udata->sep); + cb_func = H5L__exists_inter_cb; + } /* end else */ + if(H5G_traverse(obj_loc, next, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, cb_func, udata, udata->lapl_id, udata->dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't determine if link exists") + } /* end if */ + else + udata->exists = TRUE; + } /* end if */ + else + udata->exists = FALSE; + + /* Indicate that this callback didn't take ownership of the group * + * location for the object */ + *own_loc = H5G_OWN_NONE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5L__exists_inter_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5L_exists_tolerant * * Purpose: Returns whether a link exists in a group * + * Note: Same as H5L_exists, except that missing links are reported + * as 'FALSE' instead of causing failures + * + * Return: Non-negative (TRUE/FALSE) on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, December 31 2015 + * + *------------------------------------------------------------------------- + */ +htri_t +H5L_exists_tolerant(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id) +{ + H5L_trav_le_t udata; /* User data for traversal */ + H5G_traverse_t cb_func; /* Callback function for tranversal */ + char *name_copy = NULL; /* Duplicate of name */ + char *name_trav; /* Name to traverse */ + htri_t ret_value = FAIL; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(loc); + HDassert(name); + + /* Copy the name and skip leading '/'s */ + name_trav = name_copy = H5MM_strdup(name); + while('/' == *name_trav) + name_trav++; + + /* A path of "/" will always exist in a file */ + if('\0' == *name_trav) + HGOTO_DONE(TRUE) + + /* Set up user data & correct callback */ + udata.lapl_id = lapl_id; + udata.dxpl_id = dxpl_id; + udata.exists = FALSE; + if(NULL == (udata.sep = HDstrchr(name_trav, '/'))) + cb_func = H5L__exists_final_cb; + else { + /* Chew through adjacent separators, if present */ + do { + *udata.sep = '\0'; + udata.sep++; + } while('/' == *udata.sep); + cb_func = H5L__exists_inter_cb; + } /* end else */ + + /* Traverse the group hierarchy to locate the link to check */ + if(H5G_traverse(loc, name_trav, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, cb_func, &udata, lapl_id, dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't determine if link exists") + + /* Set return value */ + ret_value = (htri_t)udata.exists; + +done: + /* Release duplicated string */ + H5MM_xfree(name_copy); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5L_exists_tolerant() */ + + +/*------------------------------------------------------------------------- + * Function: H5L__exists + * + * Purpose: Returns whether a link exists in a group + * + * Note: Same as H5L_exists_tolerant, except that missing links are reported + * as failures + * * Return: Non-negative (TRUE/FALSE) on success/Negative on failure * * Programmer: Quincey Koziol @@ -2760,23 +2907,28 @@ H5L_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc/*in*/, const char H5_ATTR_UNUSED *------------------------------------------------------------------------- */ static htri_t -H5L_exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id) +H5L__exists(const H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id) { - hbool_t exists = FALSE; /* Whether the link exists in the group */ + H5L_trav_le_t udata; /* User data for traversal */ htri_t ret_value = FAIL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC + + /* A path of "/" will always exist in a file */ + if(0 == HDstrcmp(name, "/")) + HGOTO_DONE(TRUE) /* Traverse the group hierarchy to locate the object to get info about */ - if(H5G_traverse(loc, name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_exists_cb, &exists, lapl_id, dxpl_id) < 0) + udata.exists = FALSE; + if(H5G_traverse(loc, name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__exists_final_cb, &udata, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "path doesn't exist") /* Set return value */ - ret_value = (htri_t)exists; + ret_value = (htri_t)udata.exists; done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5L_exists() */ +} /* H5L__exists() */ /*------------------------------------------------------------------------- diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h index f3079bc..1c8690b 100644 --- a/src/H5Lprivate.h +++ b/src/H5Lprivate.h @@ -81,6 +81,8 @@ H5_DLL hid_t H5L_get_default_lcpl(void); H5_DLL herr_t H5L_move(H5G_loc_t *src_loc, const char *src_name, H5G_loc_t *dst_loc, const char *dst_name, hbool_t copy_flag, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id); +H5_DLL htri_t H5L_exists_tolerant(const H5G_loc_t *loc, const char *name, hid_t lapl_id, + hid_t dxpl_id); H5_DLL herr_t H5L_get_info(const H5G_loc_t *loc, const char *name, H5L_info_t *linkbuf/*out*/, hid_t lapl_id, hid_t dxpl_id); H5_DLL herr_t H5L_delete(H5G_loc_t *loc, const char *name, hid_t lapl_id, diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 02c72e7..6f42a88 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -213,10 +213,10 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* for opening the destination object */ H5G_name_t src_path; /* Opened source object hier. path */ H5O_loc_t src_oloc; /* Opened source object object location */ + htri_t dst_exists; /* Does destination name exist already? */ hbool_t loc_found = FALSE; /* Location at 'name' found */ hbool_t obj_open = FALSE; /* Entry at 'name' found */ - - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE6("e", "i*si*sii", src_loc_id, src_name, dst_loc_id, dst_name, @@ -233,22 +233,10 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination name specified") /* check if destination name already exists */ - { - H5G_name_t tmp_path; - H5O_loc_t tmp_oloc; - H5G_loc_t tmp_loc; - - /* Set up group location */ - tmp_loc.oloc = &tmp_oloc; - tmp_loc.path = &tmp_path; - H5G_loc_reset(&tmp_loc); - - /* Check if object already exists in destination */ - if(H5G_loc_find(&dst_loc, dst_name, &tmp_loc, H5P_DEFAULT, H5AC_ind_dxpl_id) >= 0) { - H5G_name_free(&tmp_path); - HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "destination object already exists") - } /* end if */ - } + if((dst_exists = H5L_exists_tolerant(&dst_loc, dst_name, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check if destination name exists") + if(TRUE == dst_exists) + HGOTO_ERROR(H5E_OHDR, H5E_EXISTS, FAIL, "destination object already exists") /* Set up opened group location to fill in */ src_loc.oloc = &src_oloc; diff --git a/src/H5TS.c b/src/H5TS.c index 987bead..6a64a14 100644 --- a/src/H5TS.c +++ b/src/H5TS.c @@ -255,19 +255,18 @@ H5TS_cancel_count_inc(void) if (!cancel_counter) { /* - * First time thread calls library - create new counter and associate + * First time thread calls library - create new counter and associate * with key */ - cancel_counter = (H5TS_cancel_t *)H5MM_calloc(sizeof(H5TS_cancel_t)); + cancel_counter = (H5TS_cancel_t *)HDcalloc(1, sizeof(H5TS_cancel_t)); - if (!cancel_counter) { - H5E_push_stack(NULL, "H5TS_cancel_count_inc", - __FILE__, __LINE__, H5E_ERR_CLS_g, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed"); - return FAIL; - } + if (!cancel_counter) { + H5E_push_stack(NULL, "H5TS_cancel_count_inc", __FILE__, __LINE__, + H5E_ERR_CLS_g, H5E_RESOURCE, H5E_NOSPACE, "memory allocation failed"); + return FAIL; + } - ret_value = pthread_setspecific(H5TS_cancel_key_g, - (void *)cancel_counter); + ret_value = pthread_setspecific(H5TS_cancel_key_g, (void *)cancel_counter); } if (cancel_counter->cancel_count == 0) diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index 2abdf6f..0ed8209 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -465,7 +465,7 @@ H5T_vlen_seq_mem_write(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, co HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data") } /* end if */ else { /* Default to system malloc */ - if(NULL==(vl.p=H5MM_malloc(len))) + if(NULL == (vl.p = HDmalloc(len))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data") } /* end else */ @@ -691,7 +691,7 @@ H5T_vlen_str_mem_write(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, co HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data") } /* end if */ else { /* Default to system malloc */ - if(NULL==(t = (char *)H5MM_malloc((seq_len+1)*base_size))) + if(NULL == (t = (char *)HDmalloc((seq_len + 1) * base_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for VL data") } /* end else */ @@ -1073,14 +1073,14 @@ H5T_vlen_reclaim_recurse(void *elem, const H5T_t *dt, H5MM_free_t free_func, voi if(free_func != NULL) (*free_func)(vl->p, free_info); else - H5MM_xfree(vl->p); + HDfree(vl->p); } /* end if */ } else if(dt->shared->u.vlen.type == H5T_VLEN_STRING) { /* Free the VL string */ if(free_func != NULL) (*free_func)(*(char **)elem, free_info); else - H5MM_xfree(*(char **)elem); + HDfree(*(char **)elem); } else { HDassert(0 && "Invalid VL type"); } /* end else */ diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index 0a9a4da..2627a29 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -1032,7 +1032,7 @@ H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void* array, size_t array_size /* Free the temporary arrays we used */ if(data_xform_prop->dat_val_pointers->num_ptrs > 1) for(i=0; idat_val_pointers->num_ptrs; i++) - HDfree(data_xform_prop->dat_val_pointers->ptr_dat_val[i]); + H5MM_xfree(data_xform_prop->dat_val_pointers->ptr_dat_val[i]); } /* end else */ done: @@ -1042,7 +1042,7 @@ done: if(data_xform_prop->dat_val_pointers->num_ptrs > 1) for(i = 0; i < data_xform_prop->dat_val_pointers->num_ptrs; i++) if(data_xform_prop->dat_val_pointers->ptr_dat_val[i]) - HDfree(data_xform_prop->dat_val_pointers->ptr_dat_val[i]); + H5MM_xfree(data_xform_prop->dat_val_pointers->ptr_dat_val[i]); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) diff --git a/test/dtypes.c b/test/dtypes.c index 326294f..984b6c6 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -1789,6 +1789,13 @@ test_compound_9(void) goto error; } /* end if */ + if(H5Dvlen_reclaim(dup_tid, space_id, H5P_DEFAULT, &rdata) < 0) { + H5_FAILED(); AT(); + printf("Can't reclaim read data\n"); + goto error; + } /* end if */ + rdata.str = NULL; + if(H5Dclose(dset_id) < 0) goto error; if(H5Tclose(cmpd_tid) < 0) @@ -1815,6 +1822,12 @@ test_compound_9(void) goto error; } /* end if */ + if((space_id = H5Dget_space(dset_id)) < 0) { + H5_FAILED(); AT(); + printf("Can't get space\n"); + goto error; + } /* end if */ + if((cmpd_tid = H5Dget_type(dset_id)) < 0) { H5_FAILED(); AT(); printf("cannot open dataset\n"); @@ -1842,10 +1855,19 @@ test_compound_9(void) goto error; } /* end if */ + if(H5Dvlen_reclaim(dup_tid, space_id, H5P_DEFAULT, &rdata) < 0) { + H5_FAILED(); AT(); + printf("Can't read data\n"); + goto error; + } /* end if */ + rdata.str = NULL; + if(rdata.str) HDfree(rdata.str); if(H5Dclose(dset_id) < 0) goto error; + if(H5Sclose(space_id) < 0) + goto error; if(H5Tclose(cmpd_tid) < 0) goto error; if(H5Tclose(dup_tid) < 0) @@ -2020,12 +2042,17 @@ test_compound_10(void) printf("incorrect VL read data\n"); goto error; } - - HDfree(t1); - HDfree(t2); - HDfree(wdata[i].str); - HDfree(rdata[i].str); } /* end for */ + if(H5Dvlen_reclaim(arr_tid, space_id, H5P_DEFAULT, &rdata) < 0) { + H5_FAILED(); AT(); + printf("Can't reclaim read data\n"); + goto error; + } /* end if */ + if(H5Dvlen_reclaim(arr_tid, space_id, H5P_DEFAULT, &wdata) < 0) { + H5_FAILED(); AT(); + printf("Can't reclaim read data\n"); + goto error; + } /* end if */ if(H5Dclose(dset_id) < 0) goto error; @@ -2090,6 +2117,8 @@ test_compound_11(void) hid_t big_tid, little_tid; /* Datatype IDs for type conversion */ hid_t big_tid2, little_tid2; /* Datatype IDs for type conversion */ hid_t opaq_src_tid, opaq_dst_tid; /* Datatype IDs for type conversion */ + hid_t space_id; /* Dataspace for buffer elements */ + hsize_t dim[1]; /* Dimensions for dataspace */ void *buf = NULL; /* Conversion buffer */ void *buf_orig = NULL; /* Copy of original conversion buffer */ void *bkg = NULL; /* Background buffer */ @@ -2138,6 +2167,13 @@ test_compound_11(void) /* Make copy of buffer before conversion */ HDmemcpy(buf_orig,buf,sizeof(big_t)*NTESTELEM); + dim[0] = NTESTELEM; + if((space_id = H5Screate_simple(1, dim, NULL)) < 0) { + H5_FAILED(); AT(); + printf("Can't create space\n"); + goto error; + } /* end if */ + /* Make copies of the 'big' and 'little' datatypes, so the type * conversion routine doesn't use the same ones this time and next time */ @@ -2169,8 +2205,12 @@ test_compound_11(void) (unsigned)u,((big_t *)buf_orig)[u].s1,(unsigned)u,((little_t *)buf)[u].s1); TEST_ERROR } /* end if */ - HDfree(((little_t *)buf)[u].s1); } /* end for */ + if(H5Dvlen_reclaim(little_tid2, space_id, H5P_DEFAULT, buf) < 0) { + H5_FAILED(); AT(); + printf("Can't reclaim data\n"); + goto error; + } /* end if */ /* Build source and destination types for conversion routine */ if((opaq_src_tid=H5Tcreate(H5T_OPAQUE, (size_t)4)) < 0) TEST_ERROR @@ -2209,8 +2249,12 @@ test_compound_11(void) (unsigned)u,((big_t *)buf_orig)[u].s1,(unsigned)u,((little_t *)buf)[u].s1); TEST_ERROR } /* end if */ - HDfree(((little_t *)buf)[u].s1); } /* end for */ + if(H5Dvlen_reclaim(little_tid, space_id, H5P_DEFAULT, buf) < 0) { + H5_FAILED(); AT(); + printf("Can't reclaim data\n"); + goto error; + } /* end if */ /* Unregister the conversion routine */ if(H5Tunregister(H5T_PERS_HARD, "opaq_test", opaq_src_tid, opaq_dst_tid, convert_opaque) < 0) TEST_ERROR @@ -2243,12 +2287,17 @@ test_compound_11(void) (unsigned)u,((big_t *)buf_orig)[u].s1,(unsigned)u,((little_t *)buf)[u].s1); TEST_ERROR } /* end if */ - HDfree(((little_t *)buf)[u].s1); } /* end for */ + if(H5Dvlen_reclaim(little_tid, space_id, H5P_DEFAULT, buf) < 0) { + H5_FAILED(); AT(); + printf("Can't reclaim data\n"); + goto error; + } /* end if */ /* Free everything */ for(u=0; udel_dir == FHEAP_DEL_FORWARD) if(tparam->drain_half == FHEAP_DEL_DRAIN_ALL) - str = HDstrdup("(all - forward)"); + str = H5MM_strdup("(all - forward)"); else - str = HDstrdup("(half, refill, all - forward)"); + str = H5MM_strdup("(half, refill, all - forward)"); else if(tparam->del_dir == FHEAP_DEL_REVERSE) if(tparam->drain_half == FHEAP_DEL_DRAIN_ALL) - str = HDstrdup("(all - reverse)"); + str = H5MM_strdup("(all - reverse)"); else - str = HDstrdup("(half, refill, all - reverse)"); + str = H5MM_strdup("(half, refill, all - reverse)"); else - str = HDstrdup("(all - deleting heap)"); + str = H5MM_strdup("(all - deleting heap)"); return(str); } /* get_del_string() */ diff --git a/test/file_image.c b/test/file_image.c index 52d0b28..6d1845f 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -156,8 +156,8 @@ error: if(H5Pclose(fapl_1) < 0) retval = 1; if(H5Pclose(fapl_2) < 0) retval = 1; HDfree(buffer); - HDfree(temp); - HDfree(temp2); + H5free_memory(temp); + H5free_memory(temp2); if(retval == 0) PASSED(); diff --git a/test/links.c b/test/links.c index 2886304..c87d2b6 100644 --- a/test/links.c +++ b/test/links.c @@ -136,7 +136,7 @@ const char *FILENAME[] = { #define H5L_DIM1 100 #define H5L_DIM2 100 -#define FILTER_FILESIZE_MAX_FRACTION 0.9F +#define FILTER_FILESIZE_MAX_FRACTION (double)0.9F /* Creation order macros */ #define CORDER_GROUP_NAME "corder_group" @@ -548,8 +548,27 @@ cklinks(hid_t fapl, hbool_t new_format) HDputs(" expected file location."); TEST_ERROR } /* end if */ + if(H5Lexists(file, "/", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR if(H5Lexists(file, "d1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR if(H5Lexists(file, "grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + if(H5Lexists(file, "/grp1", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + if(H5Lexists(file, "/grp1/hard", H5P_DEFAULT) != TRUE) FAIL_STACK_ERROR + H5E_BEGIN_TRY { + status = H5Lexists(file, "no_grp1/hard", H5P_DEFAULT); + } H5E_END_TRY; + if(status >= 0) { + H5_FAILED(); + HDputs(" H5Lexists() should have failed for a path with missing components."); + TEST_ERROR + } /* end if */ + H5E_BEGIN_TRY { + status = H5Lexists(file, "/no_grp1/hard", H5P_DEFAULT); + } H5E_END_TRY; + if(status >= 0) { + H5_FAILED(); + HDputs(" H5Lexists() should have failed for a path with missing components."); + TEST_ERROR + } /* end if */ /* Symbolic link */ if(H5Oget_info_by_name(file, "grp1/soft", &oinfo2, H5P_DEFAULT) < 0) FAIL_STACK_ERROR @@ -10985,6 +11004,7 @@ link_info_by_idx(hid_t fapl) char filename[NAME_BUF_SIZE];/* File name */ char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ unsigned u; /* Local index variable */ + ssize_t name_len; /* Length of name */ herr_t ret; /* Generic return value */ /* Loop over creating hard or soft links */ @@ -11026,9 +11046,9 @@ link_info_by_idx(hid_t fapl) } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { - ret = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)0, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + if(name_len >= 0) TEST_ERROR /* Create several links, up to limit of compact form */ for(u = 0; u < max_compact; u++) { @@ -11068,9 +11088,9 @@ link_info_by_idx(hid_t fapl) } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { - ret = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + if(name_len >= 0) TEST_ERROR /* Create more links, to push group into dense form */ for(; u < (max_compact * 2); u++) { @@ -11110,9 +11130,9 @@ link_info_by_idx(hid_t fapl) } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { - ret = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + if(name_len >= 0) TEST_ERROR /* Close the group */ if(H5Gclose(group_id) < 0) TEST_ERROR @@ -11167,6 +11187,7 @@ link_info_by_idx_old(hid_t fapl) char tmpname[NAME_BUF_SIZE]; /* Temporary link name */ char tmpval[NAME_BUF_SIZE]; /* Temporary link value */ unsigned u; /* Local index variable */ + ssize_t name_len; /* Length of name */ herr_t ret; /* Generic return value */ /* Loop over creating hard or soft links */ @@ -11278,9 +11299,9 @@ link_info_by_idx_old(hid_t fapl) } H5E_END_TRY; if(ret >= 0) TEST_ERROR H5E_BEGIN_TRY { - ret = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); + name_len = H5Lget_name_by_idx(group_id, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)u, tmpname, (size_t)NAME_BUF_SIZE, H5P_DEFAULT); } H5E_END_TRY; - if(ret >= 0) TEST_ERROR + if(name_len >= 0) TEST_ERROR /* Verify state of group */ if(H5G__has_stab_test(group_id) != TRUE) TEST_ERROR @@ -12038,7 +12059,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, iter_info->order = order; iter_info->stop = -1; iter_info->ncalled = 0; - iter_info->curr = order != H5_ITER_DEC ? skip : ((max_links - 1) - skip); + iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip)); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if(H5Literate(group_id, idx_type, order, &skip, link_iterate_cb, iter_info) < 0) TEST_ERROR @@ -12066,11 +12087,11 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, #ifndef H5_NO_DEPRECATED_SYMBOLS /* Skip over some links in group, with H5Giterate */ - iter_info->nskipped = gskip = max_links / 2; + iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2)); iter_info->order = order; iter_info->stop = -1; iter_info->ncalled = 0; - iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - gskip); + iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - (unsigned)gskip); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if(H5Giterate(group_id, ".", &gskip, group_iterate_cb, iter_info) < 0) TEST_ERROR @@ -12111,7 +12132,7 @@ link_iterate_check(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, #ifndef H5_NO_DEPRECATED_SYMBOLS /* Iterate over links in group, stopping in the middle, with H5Giterate() */ - iter_info->nskipped = gskip = 0; + iter_info->nskipped = (unsigned)(gskip = 0); iter_info->order = order; iter_info->stop = 3; iter_info->ncalled = 0; @@ -12468,7 +12489,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, #ifndef H5_NO_DEPRECATED_SYMBOLS /* Iterate over links in group, with H5Giterate */ - iter_info->nskipped = gskip = 0; + iter_info->nskipped = (unsigned)(gskip = 0); iter_info->order = order; iter_info->stop = -1; iter_info->ncalled = 0; @@ -12488,7 +12509,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, iter_info->order = order; iter_info->stop = -1; iter_info->ncalled = 0; - iter_info->curr = order != H5_ITER_DEC ? skip : ((max_links - 1) - skip); + iter_info->curr = (int64_t)(order != H5_ITER_DEC ? skip : ((max_links - 1) - skip)); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if(H5Literate(group_id, H5_INDEX_NAME, order, &skip, link_iterate_old_cb, iter_info) < 0) TEST_ERROR @@ -12516,11 +12537,11 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, #ifndef H5_NO_DEPRECATED_SYMBOLS /* Skip over some links in group, with H5Giterate */ - iter_info->nskipped = gskip = max_links / 2; + iter_info->nskipped = (unsigned)(gskip = (int)(max_links / 2)); iter_info->order = order; iter_info->stop = -1; iter_info->ncalled = 0; - iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - gskip); + iter_info->curr = order != H5_ITER_DEC ? (unsigned)gskip : ((max_links - 1) - (unsigned)gskip); HDmemset(iter_info->visited, 0, sizeof(hbool_t) * iter_info->max_visit); if(H5Giterate(group_id, ".", &gskip, group_iterate_old_cb, iter_info) < 0) TEST_ERROR @@ -12561,7 +12582,7 @@ link_iterate_old_check(hid_t group_id, H5_iter_order_t order, #ifndef H5_NO_DEPRECATED_SYMBOLS /* Iterate over links in group, stopping in the middle, with H5Giterate() */ - iter_info->nskipped = gskip = 0; + iter_info->nskipped = (unsigned)(gskip = 0); iter_info->order = order; iter_info->stop = 3; iter_info->ncalled = 0; diff --git a/test/objcopy.c b/test/objcopy.c index f3806cd..cd978f2 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -197,7 +197,7 @@ addr_insert(H5O_info_t *oi) * *------------------------------------------------------------------------- */ -static hbool_t +static H5_ATTR_PURE hbool_t addr_lookup(H5O_info_t *oi) { size_t n; @@ -512,8 +512,12 @@ test_copy_attach_attribute_vl(hid_t loc_id) ret_value = 0; done: - if(tid >0 && sid > 0) - H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf); + if(tid >0 && sid > 0) { + hid_t dxpl_id = H5Pcreate(H5P_DATASET_XFER); + H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL); + H5Dvlen_reclaim(tid, sid, dxpl_id, buf); + H5Pclose(dxpl_id); + } if(sid > 0) H5Sclose(sid); if(tid > 0) @@ -4028,6 +4032,7 @@ test_copy_dataset_contig_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_ hid_t tid = -1; /* Datatype ID */ hid_t sid = -1; /* Dataspace ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */ @@ -4111,7 +4116,12 @@ test_copy_dataset_contig_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_ /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid) < 0) TEST_ERROR @@ -4127,6 +4137,7 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); H5Tclose(tid); H5Sclose(sid); H5Fclose(fid_dst); @@ -4158,6 +4169,7 @@ test_copy_dataset_chunked_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid hid_t sid = -1; /* Dataspace ID */ hid_t pid = -1; /* Dataset creation property list ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ hsize_t chunk_dim1d[1] = {CHUNK_SIZE_1}; /* Chunk dimensions */ @@ -4250,7 +4262,12 @@ test_copy_dataset_chunked_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid) < 0) TEST_ERROR @@ -4266,6 +4283,8 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); + H5Pclose(pid); H5Tclose(tid); H5Sclose(sid); H5Fclose(fid_dst); @@ -4297,6 +4316,7 @@ test_copy_dataset_compact_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid hid_t sid = -1; /* Dataspace ID */ hid_t pid = -1; /* Dataset creation property list ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */ @@ -4387,7 +4407,12 @@ test_copy_dataset_compact_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid) < 0) TEST_ERROR @@ -4403,6 +4428,7 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); H5Tclose(tid); H5Sclose(sid); H5Fclose(fid_dst); @@ -4550,6 +4576,7 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t tid = -1; /* Datatype ID */ hid_t pid = -1; /* Dataset creation property list ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ hsize_t dim2d[2]; /* Dataset dimensions */ hsize_t chunk_dim2d[2] ={CHUNK_SIZE_1, CHUNK_SIZE_2}; /* Chunk dimensions */ hvl_t buf[DIM_SIZE_1][DIM_SIZE_2]; /* Buffer for writing data */ @@ -4649,7 +4676,12 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if(H5Fclose(fid_dst) < 0) TEST_ERROR /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid) < 0) TEST_ERROR @@ -4668,6 +4700,7 @@ error: H5Dclose(did); H5Pclose(pid); H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); H5Tclose(tid); H5Sclose(sid); H5Fclose(fid_dst); @@ -6357,6 +6390,7 @@ test_copy_dataset_compact_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap hid_t sid = -1; /* Dataspace ID */ hid_t pid = -1; /* Dataset creation property list ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */ @@ -6456,7 +6490,12 @@ test_copy_dataset_compact_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid_copy, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid_copy, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid_copy) < 0) TEST_ERROR @@ -6473,6 +6512,7 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); H5Tclose(tid); H5Tclose(tid_copy); H5Sclose(sid); @@ -6504,6 +6544,7 @@ test_copy_dataset_contig_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl hid_t tid = -1, tid_copy=-1; /* Datatype ID */ hid_t sid = -1; /* Dataspace ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */ @@ -6596,7 +6637,12 @@ test_copy_dataset_contig_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid_copy, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid_copy, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid_copy) < 0) TEST_ERROR @@ -6612,6 +6658,7 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); H5Tclose(tid); H5Tclose(tid_copy); H5Sclose(sid); @@ -6644,6 +6691,7 @@ test_copy_dataset_chunked_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap hid_t sid = -1; /* Dataspace ID */ hid_t pid = -1; /* Dataset creation property list ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */ @@ -6744,7 +6792,12 @@ test_copy_dataset_chunked_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid_copy, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid_copy, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid_copy) < 0) TEST_ERROR @@ -6761,6 +6814,7 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); H5Tclose(tid); H5Tclose(tid_copy); H5Sclose(sid); @@ -6793,6 +6847,7 @@ test_copy_dataset_compressed_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_ hid_t sid = -1; /* Dataspace ID */ hid_t pid = -1; /* Dataset creation property list ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */ @@ -6894,7 +6949,12 @@ test_copy_dataset_compressed_named_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_ /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid_copy, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid_copy, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid_copy) < 0) TEST_ERROR @@ -6911,6 +6971,7 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid_copy, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); H5Tclose(tid); H5Tclose(tid_copy); H5Sclose(sid); @@ -6943,6 +7004,7 @@ test_copy_dataset_compact_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t sid = -1; /* Dataspace ID */ hid_t pid = -1; /* Dataset creation property list ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j, k; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */ @@ -7049,7 +7111,12 @@ test_copy_dataset_compact_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, if(H5Fclose(fid_dst) < 0) TEST_ERROR /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid2, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid) < 0) TEST_ERROR @@ -7066,6 +7133,8 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); + H5Pclose(pid); H5Tclose(tid); H5Tclose(tid2); H5Sclose(sid); @@ -7098,6 +7167,7 @@ test_copy_dataset_contig_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h hid_t sid = -1; /* Dataspace ID */ hid_t pid = -1; /* Dataset creation property list ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j, k; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */ @@ -7203,7 +7273,12 @@ test_copy_dataset_contig_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h if(H5Fclose(fid_dst) < 0) TEST_ERROR /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid2, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid) < 0) TEST_ERROR @@ -7220,6 +7295,8 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); + H5Pclose(pid); H5Tclose(tid); H5Tclose(tid2); H5Sclose(sid); @@ -7252,6 +7329,7 @@ test_copy_dataset_chunked_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t sid = -1; /* Dataspace ID */ hid_t pid = -1; /* Dataset creation property list ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j, k; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */ @@ -7359,7 +7437,12 @@ test_copy_dataset_chunked_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid2, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid) < 0) TEST_ERROR @@ -7377,6 +7460,7 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); H5Tclose(tid); H5Tclose(tid2); H5Sclose(sid); @@ -7409,6 +7493,7 @@ test_copy_dataset_compressed_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap hid_t sid = -1; /* Dataspace ID */ hid_t pid = -1; /* Dataset creation property list ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j, k; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ hvl_t buf[DIM_SIZE_1]; /* Buffer for writing data */ @@ -7516,7 +7601,12 @@ test_copy_dataset_compressed_vl_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fap /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid2, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid2, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid) < 0) TEST_ERROR @@ -7534,6 +7624,7 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid2, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); H5Tclose(tid); H5Tclose(tid2); H5Sclose(sid); @@ -7576,6 +7667,7 @@ test_copy_dataset_contig_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t sid = -1; /* Dataspace ID */ hid_t did = -1; /* Dataset ID */ hid_t did2 = -1; /* Dataset ID */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ cmpd_vl_t buf[DIM_SIZE_1]; /* Buffer for writing data */ @@ -7665,7 +7757,12 @@ test_copy_dataset_contig_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid2) < 0) TEST_ERROR @@ -7682,6 +7779,7 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); H5Tclose(tid2); H5Tclose(tid); H5Sclose(sid); @@ -7714,6 +7812,7 @@ test_copy_dataset_chunked_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl hid_t sid = -1; /* Dataspace ID */ hid_t pid = -1; /* Dataset creation property list ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ hsize_t chunk_dim1d[1] = {CHUNK_SIZE_1}; /* Chunk dimensions */ @@ -7811,7 +7910,12 @@ test_copy_dataset_chunked_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid2) < 0) TEST_ERROR @@ -7828,6 +7932,8 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); + H5Pclose(pid); H5Tclose(tid2); H5Tclose(tid); H5Sclose(sid); @@ -7860,6 +7966,7 @@ test_copy_dataset_compact_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl hid_t sid = -1; /* Dataspace ID */ hid_t pid = -1; /* Dataset creation property list ID */ hid_t did = -1, did2 = -1; /* Dataset IDs */ + hid_t dxpl_id = -1; /* Dataset transfer property list ID */ unsigned int i, j; /* Local index variables */ hsize_t dim1d[1]; /* Dataset dimensions */ cmpd_vl_t buf[DIM_SIZE_1]; /* Buffer for writing data */ @@ -7956,7 +8063,12 @@ test_copy_dataset_compact_cmpd_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl /* Reclaim vlen buffer */ - if(H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf) < 0) TEST_ERROR + if(H5Tdetect_class(tid, H5T_VLEN) == TRUE) { + if((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0) TEST_ERROR + if(H5Pset_vlen_mem_manager(dxpl_id, NULL, NULL, NULL, NULL) < 0) TEST_ERROR + if(H5Dvlen_reclaim(tid, sid, dxpl_id, buf) < 0) TEST_ERROR + if(H5Pclose(dxpl_id) < 0) TEST_ERROR + } /* end if */ /* close datatype */ if(H5Tclose(tid2) < 0) TEST_ERROR @@ -7973,6 +8085,8 @@ error: H5Dclose(did2); H5Dclose(did); H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, buf); + H5Pclose(dxpl_id); + H5Pclose(pid); H5Tclose(tid2); H5Tclose(tid); H5Sclose(sid); diff --git a/test/tgenprop.c b/test/tgenprop.c index c4f3a3f..b670c0d 100644 --- a/test/tgenprop.c +++ b/test/tgenprop.c @@ -1780,7 +1780,7 @@ test_genprop_path(void) CHECK_PTR(path, "H5P_get_class_path_test"); if(HDstrcmp(path,CLASS1_PATH)!=0) TestErrPrintf("Class names don't match!, path=%s, CLASS1_PATH=%s\n",path,CLASS1_PATH); - HDfree(path); + H5free_memory(path); /* Create another new generic class, derived from first class */ cid2 = H5Pcreate_class(cid1,CLASS2_NAME, NULL, NULL, NULL, NULL, NULL, NULL); @@ -1805,7 +1805,7 @@ test_genprop_path(void) VERIFY(ret, 1, "H5Pequal"); /* Release the path string */ - HDfree(path); + H5free_memory(path); /* Close class */ ret = H5Pclose_class(cid3); diff --git a/test/tmisc.c b/test/tmisc.c index 1298f6b..011486a 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -462,7 +462,8 @@ static void test_misc2_write_attribute(void) ret = H5Aread(att1, type, &data_check); CHECK(ret, FAIL, "H5Aread"); - HDfree(data_check.string); + ret = H5Dvlen_reclaim(type, dataspace, H5P_DEFAULT, &data_check); + CHECK(ret, FAIL, "H5Dvlen_reclaim"); ret = H5Aclose(att1); CHECK(ret, FAIL, "HAclose"); @@ -487,7 +488,8 @@ static void test_misc2_write_attribute(void) ret = H5Aread(att2, type, &data_check); CHECK(ret, FAIL, "H5Aread"); - HDfree(data_check.string); + ret = H5Dvlen_reclaim(type, dataspace, H5P_DEFAULT, &data_check); + CHECK(ret, FAIL, "H5Dvlen_reclaim"); ret = H5Aclose(att2); CHECK(ret, FAIL, "HAclose"); @@ -514,6 +516,7 @@ static void test_misc2_read_attribute(const char *filename, const char *att_name { hid_t file, root, att; hid_t type; + hid_t space; herr_t ret; misc2_struct data_check; @@ -528,10 +531,17 @@ static void test_misc2_read_attribute(const char *filename, const char *att_name att = H5Aopen(root, att_name, H5P_DEFAULT); CHECK(att, FAIL, "H5Aopen"); + space = H5Aget_space(att); + CHECK(space, FAIL, "H5Aget_space"); + ret = H5Aread(att, type, &data_check); CHECK(ret, FAIL, "H5Aread"); - HDfree(data_check.string); + ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, &data_check); + CHECK(ret, FAIL, "H5Dvlen_reclaim"); + + ret = H5Sclose(space); + CHECK(ret, FAIL, "H5Sclose"); ret = H5Aclose(att); CHECK(ret, FAIL, "H5Aclose"); diff --git a/test/tvlstr.c b/test/tvlstr.c index 02bd59d..dbc3083 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -604,7 +604,7 @@ static void test_write_vl_string_attribute(void) if(HDstrcmp(string_att_check,string_att) != 0) TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check); - HDfree(string_att_check); + H5free_memory(string_att_check); string_att_check = NULL; ret = H5Aclose(att); @@ -626,7 +626,7 @@ static void test_write_vl_string_attribute(void) if(HDstrcmp(string_att_check,string_att_write) != 0) TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check); - HDfree(string_att_check); + H5free_memory(string_att_check); string_att_check = NULL; /* The attribute string written is freed below, in the test_read_vl_string_attribute() test */ @@ -687,7 +687,7 @@ static void test_read_vl_string_attribute(void) if(HDstrcmp(string_att_check,string_att) != 0) TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",string_att,string_att_check); - HDfree(string_att_check); + H5free_memory(string_att_check); string_att_check = NULL; ret = H5Aclose(att); @@ -704,7 +704,7 @@ static void test_read_vl_string_attribute(void) if(HDstrcmp(string_att_check,string_att_write) != 0) TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check); - HDfree(string_att_check); + H5free_memory(string_att_check); string_att_check = NULL; } @@ -762,7 +762,8 @@ static void read_scalar_dset(hid_t file, hid_t type, hid_t space, char *name, ch if(HDstrcmp(data, data_read)) TestErrPrintf("Expected %s for dataset %s but read %s\n", data, name, data_read); - HDfree(data_read); + ret = H5Dvlen_reclaim(type, space, H5P_DEFAULT, &data_read); + CHECK(ret, FAIL, "H5Dvlen_reclaim"); } /**************************************************************** diff --git a/tools/h5ls/h5ls.c b/tools/h5ls/h5ls.c index cce5f3d..98468c9 100644 --- a/tools/h5ls/h5ls.c +++ b/tools/h5ls/h5ls.c @@ -973,7 +973,7 @@ print_enum_type(h5tools_str_t *buffer, hid_t type, int ind) /* Release resources */ for(i = 0; i < (unsigned)nmembs; i++) - HDfree(name[i]); + H5free_memory(name[i]); HDfree(name); HDfree(value); } @@ -1856,13 +1856,10 @@ dataset_list2(hid_t dset, const char H5_ATTR_UNUSED *name) if (vmaps) { size_t next; - ssize_t ssize_out; h5tools_str_append(&buffer, " %-10s {%ld} Source {\n", "Maps:", vmaps); for (next = 0; next < (unsigned) vmaps; next++) { - ssize_out = H5Pget_virtual_filename(dcpl, next, NULL, 0); H5Pget_virtual_filename(dcpl, next, f_name, sizeof(f_name)); - ssize_out = H5Pget_virtual_dsetname(dcpl, next, NULL, 0); H5Pget_virtual_dsetname(dcpl, next, dset_name, sizeof(dset_name)); h5tools_str_append(&buffer, " %-10s ", " "); print_string(&buffer, f_name, TRUE); -- cgit v0.12 From 42bf0e2136a60a9dc18a2a2a5fb029fa5a0d6562 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 1 Jan 2016 20:58:18 -0500 Subject: [svn-r28765] Description: Bump the nunmber of v2 B-tree records for the random 4-level B-tree update test by another 25,000 records. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (Too minor to require h5committest) --- test/btree2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/btree2.c b/test/btree2.c index b0c0ac3..3278b67 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -38,7 +38,7 @@ const char *FILENAME[] = { #define INSERT_SPLIT_ROOT_NREC 63 #define INSERT_SPLIT_ROOT_NREC_REC 64 #define INSERT_MANY (1000 * 1000) -#define INSERT_MANY_REC (2650 * 1000) +#define INSERT_MANY_REC (2675 * 1000) #define FIND_MANY (INSERT_MANY / 100) #define FIND_MANY_REC (INSERT_MANY_REC / 100) #define FIND_NEIGHBOR 2000 -- cgit v0.12 From d4f3d93b8d9188548407453e10df12dc9ba0480f Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 2 Jan 2016 20:03:08 -0500 Subject: [svn-r28769] Description: More memory cleanups and leak elimination. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest forthcoming) --- src/H5Dcompact.c | 5 +---- src/H5Eint.c | 5 +++++ tools/h5repack/h5repacktst.c | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index ebe75bd..df2a740 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -440,12 +440,9 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *storage_src, H5F_t *f_dst HDassert(storage_src); HDassert(f_dst); HDassert(storage_dst); + HDassert(storage_dst->buf); HDassert(dt_src); - /* Allocate space for destination data */ - if(NULL == (storage_dst->buf = H5MM_malloc(storage_src->size))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate memory for compact dataset") - /* Create datatype ID for src datatype, so it gets freed */ if((tid_src = H5I_register(H5I_DATATYPE, dt_src, FALSE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register source file datatype") diff --git a/src/H5Eint.c b/src/H5Eint.c index 6e84a09..6ed405f 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -743,8 +743,13 @@ H5E_printf_stack(H5E_t *estack, const char *file, const char *func, unsigned lin done: if(va_started) va_end(ap); +#ifdef H5_HAVE_VASPRINTF + if(tmp) + HDfree(tmp); +#else /* H5_HAVE_VASPRINTF */ if(tmp) H5MM_xfree(tmp); +#endif /* H5_HAVE_VASPRINTF */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5E_printf_stack() */ diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index 3959300..972014d 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -1554,6 +1554,8 @@ int main (void) puts("All h5repack tests passed."); + h5tools_close(); + return 0; error: -- cgit v0.12 From f8465bd1243d16783b4df44b40193d8f5137a781 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sun, 3 Jan 2016 09:22:49 -0500 Subject: [svn-r28773] Description: Clear memory for shared message info when "deferring" and using memory checker, so valgrind doesn't whine. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest forthcoming) --- src/H5SM.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/H5SM.c b/src/H5SM.c index 4a562dd..413ad1f 100644 --- a/src/H5SM.c +++ b/src/H5SM.c @@ -1375,11 +1375,23 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, } /* end else */ } /* end else */ - if(found) + if(found) { /* If the message was found, it's shared in the heap (now). Set up a * shared message so we can mark it as shared. */ shared.type = H5O_SHARE_TYPE_SOHM; + +#ifdef H5_USING_MEMCHECKER + /* Reset the shared message payload if deferring. This doesn't matter + * in the long run since the payload will get overwritten when the + * non-deferred call to this routine occurs, but it stops memory + * checkers like valgrind from whining when the partially initialized + * shared message is serialized. -QAK + */ + if(defer) + HDmemset(&shared.u, 0, sizeof(shared.u)); +#endif /* H5_USING_MEMCHECKER */ + } /* end if */ else { htri_t share_in_ohdr; /* Whether the new message can be shared in another object's header */ -- cgit v0.12 From f017eb6fc09d74aa83eb5391028be5fd12380d34 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sun, 3 Jan 2016 17:06:52 -0500 Subject: [svn-r28777] Description: Add --enable-memory-alloc-sanity-check option to configure, to track and sanity check memory allocations within the library. This is orthogonal to the --enable-using-memchecker option and can be used with/without it. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest forthcoming) --- CMakeLists.txt | 8 + config/cmake/cacheinit.cmake | 2 + config/cmake/libhdf5.settings.cmake.in | 1 + config/cmake/mccacheinit.cmake | 2 + configure.ac | 31 ++++ release_docs/INSTALL_CMake.txt | 2 + src/H5.c | 5 + src/H5Dchunk.c | 32 +++- src/H5Dpkg.h | 25 +-- src/H5MM.c | 323 +++++++++++++++++++++++++++++++-- src/H5MMprivate.h | 13 +- src/libhdf5.settings.in | 1 + 12 files changed, 397 insertions(+), 48 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 65124ab..23b55c6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -376,6 +376,14 @@ if (HDF5_ENABLE_USING_MEMCHECKER) endif (HDF5_ENABLE_USING_MEMCHECKER) #----------------------------------------------------------------------------- +# Option to indicate internal memory allocation sanity checks are enabled +#----------------------------------------------------------------------------- +option (HDF5_MEMORY_ALLOC_SANITY_CHECK "Indicate that internal memory allocation sanity checks are enabled" OFF) +if (HDF5_MEMORY_ALLOC_SANITY_CHECK) + set (H5_MEMORY_ALLOC_SANITY_CHECK 1) +endif (HDF5_MEMORY_ALLOC_SANITY_CHECK) + +#----------------------------------------------------------------------------- # Option to use deprecated public API symbols #----------------------------------------------------------------------------- option (HDF5_ENABLE_DEPRECATED_SYMBOLS "Enable deprecated public API symbols" ON) diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index 4bef99f..5cae21b 100644 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -36,6 +36,8 @@ set (HDF5_ENABLE_COVERAGE OFF CACHE BOOL "Enable code coverage for Libraries and set (HDF5_ENABLE_USING_MEMCHECKER OFF CACHE BOOL "Indicate that a memory checker is used" FORCE) +set (HDF5_MEMORY_ALLOC_SANITY_CHECK OFF CACHE BOOL "Indicate that internal memory allocation sanity checks are enabled" FORCE) + set (HDF5_DISABLE_COMPILER_WARNINGS OFF CACHE BOOL "Disable compiler warnings" FORCE) set (HDF5_USE_FOLDERS ON CACHE BOOL "Enable folder grouping of projects in IDEs." FORCE) diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index ba764a4..cc6ae3e 100644 --- a/config/cmake/libhdf5.settings.cmake.in +++ b/config/cmake/libhdf5.settings.cmake.in @@ -65,6 +65,7 @@ Features: dmalloc: @H5_HAVE_LIBDMALLOC@ Clear file buffers before write: @HDF5_Enable_Clear_File_Buffers@ Using memory checker: @HDF5_ENABLE_USING_MEMCHECKER@ +Memory allocation sanity checks: @HDF5_MEMORY_ALLOC_SANITY_CHECK@ Function Stack Tracing: @HDF5_ENABLE_CODESTACK@ Strict File Format Checks: @HDF5_STRICT_FORMAT_CHECKS@ Optimization Instrumentation: @HDF5_Enable_Instrument@ diff --git a/config/cmake/mccacheinit.cmake b/config/cmake/mccacheinit.cmake index 19ecc15..e54db1f 100644 --- a/config/cmake/mccacheinit.cmake +++ b/config/cmake/mccacheinit.cmake @@ -48,6 +48,8 @@ set (HDF5_ENABLE_COVERAGE OFF CACHE BOOL "Enable code coverage for Libraries and set (HDF5_ENABLE_USING_MEMCHECKER ON CACHE BOOL "Indicate that a memory checker is used" FORCE) +set (HDF5_MEMORY_ALLOC_SANITY_CHECK OFF CACHE BOOL "Indicate that internal memory allocation sanity checks are enabled" FORCE) + set (HDF5_DISABLE_COMPILER_WARNINGS OFF CACHE BOOL "Disable compiler warnings" FORCE) set (HDF5_USE_FOLDERS ON CACHE BOOL "Enable folder grouping of projects in IDEs." FORCE) diff --git a/configure.ac b/configure.ac index 0e853a8..9c1d5b0 100644 --- a/configure.ac +++ b/configure.ac @@ -2044,6 +2044,8 @@ AC_ARG_ENABLE([using-memchecker], library. Enabling this causes the library to be more picky about it's memory operations and also disables the library's free space manager code. + This option is orthogonal to the + --enable-memory-alloc-sanity-check option. Default=no.])], [USINGMEMCHECKER=$enableval]) @@ -2062,6 +2064,35 @@ case "X-$USINGMEMCHECKER" in ;; esac +## ---------------------------------------------------------------------- +## Check if they would like to enable the internal memory allocation sanity +## checking code. +## +AC_SUBST([MEMORYALLOCSANITYCHECK]) +AC_MSG_CHECKING([whether internal memory allocation sanity checking is used]) +AC_ARG_ENABLE([memory-alloc-sanity-check], + [AS_HELP_STRING([--enable-memory-alloc-sanity-check], + [Enable this option to turn on internal memory + allocation sanity checking. This could cause + more memory use and somewhat slower allocation. + This option is orthogonal to the + --enable-using-memchecker option. + Default=no.])], + [MEMORYALLOCSANITYCHECK=$enableval]) + +case "X-$MEMORYALLOCSANITYCHECK" in + X-yes) + MEMORYALLOCSANITYCHECK=yes + AC_MSG_RESULT([yes]) + AC_DEFINE([MEMORY_ALLOC_SANITY_CHECK], [1], + [Define to enable internal memory allocation sanity checking.]) + ;; + *) + MEMORYALLOCSANITYCHECK=no + AC_MSG_RESULT([no]) + ;; +esac + ## Checkpoint the cache AC_CACHE_SAVE diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index e745084..37326ed 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -411,6 +411,7 @@ These five steps are described in detail below. set (HDF5_BUILD_PARALLEL_ALL OFF CACHE BOOL "Build Parallel Programs" FORCE) set (HDF5_ENABLE_COVERAGE OFF CACHE BOOL "Enable code coverage for Libraries and Programs" FORCE) set (HDF5_ENABLE_USING_MEMCHECKER OFF CACHE BOOL "Indicate that a memory checker is used" FORCE) + set (HDF5_MEMORY_ALLOC_SANITY_CHECK OFF CACHE BOOL "Indicate that internal memory allocation sanity checks are enabled" FORCE) set (HDF5_DISABLE_COMPILER_WARNINGS OFF CACHE BOOL "Disable compiler warnings" FORCE) set (HDF5_USE_FOLDERS ON CACHE BOOL "Enable folder grouping of projects in IDEs." FORCE) set (HDF5_USE_16_API_DEFAULT OFF CACHE BOOL "Use the HDF5 1.6.x API by default" FORCE) @@ -587,6 +588,7 @@ HDF5_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux HDF5_ENABLE_PARALLEL "Enable parallel build (requires MPI)" OFF HDF5_ENABLE_TRACE "Enable API tracing capability" OFF HDF5_ENABLE_USING_MEMCHECKER "Indicate that a memory checker is used" OFF +HDF5_MEMORY_ALLOC_SANITY_CHECK "Indicate that internal memory allocation sanity checks are enabled" OFF HDF5_METADATA_TRACE_FILE "Enable metadata trace file collection" OFF HDF5_NO_PACKAGES "Do not include CPack Packaging" OFF HDF5_PACKAGE_EXTLIBS "CPACK - include external libraries" OFF diff --git a/src/H5.c b/src/H5.c index 2086ce8..a522398 100644 --- a/src/H5.c +++ b/src/H5.c @@ -396,6 +396,11 @@ H5_term_library(void) (void)H5MM_free(tmp_open_stream); } /* end while */ +#if defined H5_MEMORY_ALLOC_SANITY_CHECK + /* Sanity check memory allocations */ + H5MM_final_sanity_check(); +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + /* Reset flag indicating that the library is being shut down */ H5_TERM_GLOBAL = FALSE; diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 6b99a43..0c4cba1 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -107,6 +107,25 @@ /* Local Typedefs */ /******************/ +/* Raw data chunks are cached. Each entry in the cache is: */ +typedef struct H5D_rdcc_ent_t { + hbool_t locked; /*entry is locked in cache */ + hbool_t dirty; /*needs to be written to disk? */ + hbool_t deleted; /*chunk about to be deleted */ + hsize_t scaled[H5O_LAYOUT_NDIMS]; /*scaled chunk 'name' (coordinates) */ + uint32_t rd_count; /*bytes remaining to be read */ + uint32_t wr_count; /*bytes remaining to be written */ + H5F_block_t chunk_block; /*offset/length of chunk in file */ + hsize_t chunk_idx; /*index of chunk in dataset */ + uint8_t *chunk; /*the unfiltered chunk data */ + unsigned idx; /*index in hash table */ + struct H5D_rdcc_ent_t *next;/*next item in doubly-linked list */ + struct H5D_rdcc_ent_t *prev;/*previous item in doubly-linked list */ + struct H5D_rdcc_ent_t *tmp_next;/*next item in temporary doubly-linked list */ + struct H5D_rdcc_ent_t *tmp_prev;/*previous item in temporary doubly-linked list */ +} H5D_rdcc_ent_t; +typedef H5D_rdcc_ent_t *H5D_rdcc_ent_ptr_t; /* For free lists */ + /* Callback info for iteration to prune chunks */ typedef struct H5D_chunk_it_ud1_t { H5D_chunk_common_ud_t common; /* Common info for B-tree user data (must be first) */ @@ -244,6 +263,11 @@ static herr_t H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t *dxpl_cache, H5D_rdcc_ent_t *ent, hbool_t reset); static herr_t H5D__chunk_cache_evict(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t *dxpl_cache, H5D_rdcc_ent_t *ent, hbool_t flush); +static void *H5D__chunk_lock(const H5D_io_info_t *io_info, + H5D_chunk_ud_t *udata, hbool_t relax); +static herr_t H5D__chunk_unlock(const H5D_io_info_t *io_info, + const H5D_chunk_ud_t *udata, hbool_t dirty, void *chunk, + uint32_t naccessed); static herr_t H5D__chunk_cache_prune(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t *dxpl_cache, size_t size); static herr_t H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata); @@ -3008,7 +3032,7 @@ done: * *------------------------------------------------------------------------- */ -void * +static void * H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, hbool_t relax) { @@ -3024,7 +3048,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, void *chunk = NULL; /*the file chunk */ void *ret_value = NULL; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_STATIC HDassert(io_info); HDassert(io_info->dxpl_cache); @@ -3286,7 +3310,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t +static herr_t H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, hbool_t dirty, void *chunk, uint32_t naccessed) { @@ -3294,7 +3318,7 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, const H5D_rdcc_t *rdcc = &(io_info->dset->shared->cache.chunk); herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE + FUNC_ENTER_STATIC /* Sanity check */ HDassert(io_info); diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 4e6376b..97fc442 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -369,6 +369,7 @@ typedef struct H5D_chunk_cached_t { } H5D_chunk_cached_t; /* The raw data chunk cache */ +struct H5D_rdcc_ent_t; /* Forward declaration of struct used below */ typedef struct H5D_rdcc_t { struct { unsigned ninits; /* Number of chunk creations */ @@ -497,25 +498,6 @@ typedef struct { hsize_t size; /* Accumulated number of bytes for the selection */ } H5D_vlen_bufsize_t; -/* Raw data chunks are cached. Each entry in the cache is: */ -typedef struct H5D_rdcc_ent_t { - hbool_t locked; /*entry is locked in cache */ - hbool_t dirty; /*needs to be written to disk? */ - hbool_t deleted; /*chunk about to be deleted */ - hsize_t scaled[H5O_LAYOUT_NDIMS]; /*scaled chunk 'name' (coordinates) */ - uint32_t rd_count; /*bytes remaining to be read */ - uint32_t wr_count; /*bytes remaining to be written */ - H5F_block_t chunk_block; /*offset/length of chunk in file */ - hsize_t chunk_idx; /*index of chunk in dataset */ - uint8_t *chunk; /*the unfiltered chunk data */ - unsigned idx; /*index in hash table */ - struct H5D_rdcc_ent_t *next;/*next item in doubly-linked list */ - struct H5D_rdcc_ent_t *prev;/*previous item in doubly-linked list */ - struct H5D_rdcc_ent_t *tmp_next;/*next item in temporary doubly-linked list */ - struct H5D_rdcc_ent_t *tmp_prev;/*previous item in temporary doubly-linked list */ -} H5D_rdcc_ent_t; -typedef H5D_rdcc_ent_t *H5D_rdcc_ent_ptr_t; /* For free lists */ - /*****************************/ /* Package Private Variables */ @@ -623,11 +605,6 @@ H5_DLL herr_t H5D__chunk_set_info(const H5D_t *dset); H5_DLL hbool_t H5D__chunk_is_space_alloc(const H5O_storage_t *storage); H5_DLL herr_t H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, H5D_chunk_ud_t *udata); -H5_DLL void *H5D__chunk_lock(const H5D_io_info_t *io_info, - H5D_chunk_ud_t *udata, hbool_t relax); -H5_DLL herr_t H5D__chunk_unlock(const H5D_io_info_t *io_info, - const H5D_chunk_ud_t *udata, hbool_t dirty, void *chunk, - uint32_t naccessed); H5_DLL herr_t H5D__chunk_allocated(H5D_t *dset, hid_t dxpl_id, hsize_t *nbytes); H5_DLL herr_t H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, hsize_t old_dim[]); diff --git a/src/H5MM.c b/src/H5MM.c index a37bbff..05bfb9e 100644 --- a/src/H5MM.c +++ b/src/H5MM.c @@ -25,9 +25,195 @@ */ -#include "H5private.h" -#include "H5Eprivate.h" -#include "H5MMprivate.h" +/****************/ +/* Module Setup */ +/****************/ + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5MMprivate.h" /* Memory management */ + + +/****************/ +/* Local Macros */ +/****************/ +#if defined H5_MEMORY_ALLOC_SANITY_CHECK +#define H5MM_SIG_SIZE 4 +#define H5MM_HEAD_GUARD_SIZE 8 +#define H5MM_TAIL_GUARD_SIZE 8 +#define H5MM_BLOCK_FROM_BUF(mem) ((H5MM_block_t *)((unsigned char *)mem - (offsetof(H5MM_block_t, b) + H5MM_HEAD_GUARD_SIZE))) +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + + +/******************/ +/* Local Typedefs */ +/******************/ + +#if defined H5_MEMORY_ALLOC_SANITY_CHECK +/* Memory allocation "block", wrapped around each allocation */ +struct H5MM_block_t; /* Forward declaration for typedef */ +typedef struct H5MM_block_t { + unsigned char sig[H5MM_SIG_SIZE]; /* Signature for the block, to indicate it was allocated with H5MM* interface */ + struct H5MM_block_t *next; /* Pointer to next block in the list of allocated blocks */ + struct H5MM_block_t *prev; /* Pointer to previous block in the list of allocated blocks */ + size_t size; + hbool_t in_use; + unsigned char b[]; +} H5MM_block_t; +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + + +/********************/ +/* Local Prototypes */ +/********************/ +#if defined H5_MEMORY_ALLOC_SANITY_CHECK +static hbool_t H5MM__is_our_block(void *mem); +static void H5MM__sanity_check_block(const H5MM_block_t *block); +static void H5MM__sanity_check(void *mem); +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + +#if defined H5_MEMORY_ALLOC_SANITY_CHECK +/* Constant strings for block signature, head & tail guards */ +static const char H5MM_block_signature_s[H5MM_SIG_SIZE] = {'H', '5', 'M', 'M'}; +static const char H5MM_block_head_guard_s[H5MM_HEAD_GUARD_SIZE] = {'D', 'E', 'A', 'D', 'B', 'E', 'E', 'F'}; +static const char H5MM_block_tail_guard_s[H5MM_TAIL_GUARD_SIZE] = {'B', 'E', 'E', 'F', 'D', 'E', 'A', 'D'}; + +/* Flag to indicate the the interface has been initialized */ +static hbool_t H5MM_init_s = FALSE; + +/* Head of the list of allocated blocks */ +static H5MM_block_t H5MM_block_head_s; + +/* Statistics about block allocations */ +static unsigned long long H5MM_total_alloc_bytes_s = 0; +static unsigned long long H5MM_curr_alloc_bytes_s = 0; +static unsigned long long H5MM_peak_alloc_bytes_s = 0; +static size_t H5MM_max_block_size_s = 0; +static size_t H5MM_total_alloc_blocks_count_s = 0; +static size_t H5MM_curr_alloc_blocks_count_s = 0; +static size_t H5MM_peak_alloc_blocks_count_s = 0; +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + + +#if defined H5_MEMORY_ALLOC_SANITY_CHECK + +/*------------------------------------------------------------------------- + * Function: H5MM__is_our_block + * + * Purpose: Try to determine if a memory buffer has been allocated through + * the H5MM* interface, instead of the system's malloc() routines. + * + * Return: Success: TRUE/FALSE + * Failure: (Can't fail) + * + * Programmer: Quincey Koziol + * Dec 30 2015 + * + *------------------------------------------------------------------------- + */ +static hbool_t +H5MM__is_our_block(void *mem) +{ + H5MM_block_t *block = H5MM_BLOCK_FROM_BUF(mem); + + return(0 == HDmemcmp(block->sig, H5MM_block_signature_s, H5MM_SIG_SIZE)); +} + + +/*------------------------------------------------------------------------- + * Function: H5MM__sanity_check_block + * + * Purpose: Check a block wrapper around a buffer to validate it. + * + * Return: N/A (void) + * + * Programmer: Quincey Koziol + * Dec 30 2015 + * + *------------------------------------------------------------------------- + */ +static void +H5MM__sanity_check_block(const H5MM_block_t *block) +{ + HDassert(block->size > 0); + HDassert(block->in_use); + /* Check for head & tail guards, if not head of linked list */ + if(block->size != SIZE_T_MAX) { + HDassert(0 == HDmemcmp(block->b, H5MM_block_head_guard_s, H5MM_HEAD_GUARD_SIZE)); + HDassert(0 == HDmemcmp(block->b + H5MM_HEAD_GUARD_SIZE + block->size, H5MM_block_tail_guard_s, H5MM_TAIL_GUARD_SIZE)); + } +} + + +/*------------------------------------------------------------------------- + * Function: H5MM__sanity_check + * + * Purpose: Check a buffer to validate it (just calls + * H5MM__sanity_check_block after finding block for buffer) + * + * Return: N/A (void) + * + * Programmer: Quincey Koziol + * Dec 30 2015 + * + *------------------------------------------------------------------------- + */ +static void +H5MM__sanity_check(void *mem) +{ + H5MM_block_t *block = H5MM_BLOCK_FROM_BUF(mem); + + H5MM__sanity_check_block(block); +} + + +/*------------------------------------------------------------------------- + * Function: H5MM_final_sanity_check + * + * Purpose: Final sanity checks on memory allocation. + * + * Return: N/A (void) + * + * Programmer: Quincey Koziol + * Jan 1 2016 + * + *------------------------------------------------------------------------- + */ +void +H5MM_final_sanity_check(void) +{ + HDassert(0 == H5MM_curr_alloc_bytes_s); + HDassert(0 == H5MM_curr_alloc_blocks_count_s); + HDassert(H5MM_block_head_s.next == &H5MM_block_head_s); + HDassert(H5MM_block_head_s.prev == &H5MM_block_head_s); +#ifdef H5MM_PRINT_MEMORY_STATS + HDfprintf(stderr, "%s: H5MM_total_alloc_bytes_s = %llu\n", __func__, H5MM_total_alloc_bytes_s); + HDfprintf(stderr, "%s: H5MM_peak_alloc_bytes_s = %llu\n", __func__, H5MM_peak_alloc_bytes_s); + HDfprintf(stderr, "%s: H5MM_max_block_size_s = %zu\n", __func__, H5MM_max_block_size_s); + HDfprintf(stderr, "%s: H5MM_total_alloc_blocks_count_s = %zu\n", __func__, H5MM_total_alloc_blocks_count_s); + HDfprintf(stderr, "%s: H5MM_peak_alloc_blocks_count_s = %zu\n", __func__, H5MM_peak_alloc_blocks_count_s); +#endif /* H5MM_PRINT_MEMORY_STATS */ +} +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ /*------------------------------------------------------------------------- @@ -42,7 +228,6 @@ * bytes usually indicate problems. * * Return: Success: Pointer new memory - * * Failure: NULL * * Programmer: Quincey Koziol @@ -60,12 +245,61 @@ H5MM_malloc(size_t size) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - if(size) +#if defined H5_MEMORY_ALLOC_SANITY_CHECK + /* Initialize block list head singleton */ + if(!H5MM_init_s) { + HDmemcpy(H5MM_block_head_s.sig, H5MM_block_signature_s, H5MM_SIG_SIZE); + H5MM_block_head_s.next = &H5MM_block_head_s; + H5MM_block_head_s.prev = &H5MM_block_head_s; + H5MM_block_head_s.size = SIZE_T_MAX; + H5MM_block_head_s.in_use = TRUE; + + H5MM_init_s = TRUE; + } /* end if */ +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + + if(size) { +#if defined H5_MEMORY_ALLOC_SANITY_CHECK + H5MM_block_t *block; + size_t alloc_size = sizeof(H5MM_block_t) + size + H5MM_HEAD_GUARD_SIZE + H5MM_TAIL_GUARD_SIZE; + + if(NULL != (block = (H5MM_block_t *)HDmalloc(alloc_size))) { + /* Set up block */ + HDmemcpy(block->sig, H5MM_block_signature_s, H5MM_SIG_SIZE); + block->next = H5MM_block_head_s.next; + H5MM_block_head_s.next = block; + block->next->prev = block; + block->prev = &H5MM_block_head_s; + block->size = size; + block->in_use = TRUE; + HDmemcpy(block->b, H5MM_block_head_guard_s, H5MM_HEAD_GUARD_SIZE); + HDmemcpy(block->b + H5MM_HEAD_GUARD_SIZE + size, H5MM_block_tail_guard_s, H5MM_TAIL_GUARD_SIZE); + + /* Update statistics */ + H5MM_total_alloc_bytes_s += size; + H5MM_curr_alloc_bytes_s += size; + if(H5MM_curr_alloc_bytes_s > H5MM_peak_alloc_bytes_s) + H5MM_peak_alloc_bytes_s = H5MM_curr_alloc_bytes_s; + if(size > H5MM_max_block_size_s) + H5MM_max_block_size_s = size; + H5MM_total_alloc_blocks_count_s++; + H5MM_curr_alloc_blocks_count_s++; + if(H5MM_curr_alloc_blocks_count_s > H5MM_peak_alloc_blocks_count_s) + H5MM_peak_alloc_blocks_count_s = H5MM_curr_alloc_blocks_count_s; + + /* Set buffer to return */ + ret_value = block->b + H5MM_HEAD_GUARD_SIZE; + } /* end if */ + else + ret_value = NULL; +#else /* H5_MEMORY_ALLOC_SANITY_CHECK */ ret_value = HDmalloc(size); +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + } /* end if */ else ret_value = NULL; - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5MM_malloc() */ @@ -83,7 +317,6 @@ H5MM_malloc(size_t size) * * * Return: Success: Pointer new memory - * * Failure: NULL * * Programmer: Quincey Koziol @@ -101,12 +334,18 @@ H5MM_calloc(size_t size) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - if(size) + if(size) { +#if defined H5_MEMORY_ALLOC_SANITY_CHECK + if(NULL != (ret_value = H5MM_malloc(size))) + HDmemset(ret_value, 0, size); +#else /* H5_MEMORY_ALLOC_SANITY_CHECK */ ret_value = HDcalloc((size_t)1, size); +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + } /* end if */ else ret_value = NULL; - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5MM_calloc() */ @@ -123,9 +362,7 @@ H5MM_calloc(size_t size) * Note that the (NULL, 0) combination is undefined behavior * in the C standard. * - * Return: Success: Ptr to new memory if size > 0 - * NULL if size is zero - * + * Return: Success: Ptr to new memory if size > 0, NULL if size is zero * Failure: NULL (input buffer is unchanged on failure) * * Programmer: Robb Matzke @@ -143,17 +380,39 @@ H5MM_realloc(void *mem, size_t size) HDassert(mem || size); - if(NULL == mem && 0 == size) { + if(NULL == mem && 0 == size) /* Not defined in the standard, return NULL */ ret_value = NULL; - } else { +#if defined H5_MEMORY_ALLOC_SANITY_CHECK + if(size > 0) { + if(mem) { + if(H5MM__is_our_block(mem)) { + H5MM_block_t *block = H5MM_BLOCK_FROM_BUF(mem); + size_t old_size = block->size; + + H5MM__sanity_check(mem); + + ret_value = H5MM_malloc(size); + HDmemcpy(ret_value, mem, MIN(size, old_size)); + H5MM_xfree(mem); + } /* end if */ + else + ret_value = HDrealloc(mem, size); + } + else + ret_value = H5MM_malloc(size); + } + else + ret_value = H5MM_xfree(mem); +#else /* H5_MEMORY_ALLOC_SANITY_CHECK */ ret_value = HDrealloc(mem, size); /* Some platforms do not return NULL if size is zero. */ if(0 == size) ret_value = NULL; - } +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + } /* end else */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5MM_realloc() */ @@ -250,8 +509,38 @@ H5MM_xfree(void *mem) /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR - if(mem) + if(mem) { +#if defined H5_MEMORY_ALLOC_SANITY_CHECK + if(H5MM__is_our_block(mem)) { + H5MM_block_t *block = H5MM_BLOCK_FROM_BUF(mem); + + /* Run sanity checks on this block and its neighbors */ + H5MM__sanity_check(mem); + H5MM__sanity_check_block(block->next); + H5MM__sanity_check_block(block->prev); + + /* Update statistics */ + H5MM_curr_alloc_bytes_s -= block->size; + H5MM_curr_alloc_blocks_count_s--; + + /* Reset block info */ + HDmemset(block->sig, 0, H5MM_SIG_SIZE); + block->next->prev = block->prev; + block->prev->next = block->next; + block->next = NULL; + block->prev = NULL; + block->in_use = FALSE; + + /* Free the block (finally!) */ + HDfree(block); + } + else + HDfree(mem); +#else /* H5_MEMORY_ALLOC_SANITY_CHECK */ HDfree(mem); +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + } /* end if */ - FUNC_LEAVE_NOAPI(NULL); + FUNC_LEAVE_NOAPI(NULL) } /* end H5MM_xfree() */ + diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h index 0d608b2..c494a60 100644 --- a/src/H5MMprivate.h +++ b/src/H5MMprivate.h @@ -21,8 +21,6 @@ * * Purpose: Private header for memory management. * - * Modifications: - * *------------------------------------------------------------------------- */ #ifndef _H5MMprivate_H @@ -33,7 +31,12 @@ /* Private headers needed by this file */ #include "H5private.h" +#if defined H5_MEMORY_ALLOC_SANITY_CHECK +/*#define H5MM_PRINT_MEMORY_STATS */ +#define H5MM_free(Z) H5MM_xfree(Z) +#else /* H5_MEMORY_ALLOC_SANITY_CHECK */ #define H5MM_free(Z) HDfree(Z) +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ /* * Library prototypes... @@ -44,5 +47,9 @@ H5_DLL void *H5MM_realloc(void *mem, size_t size); H5_DLL char *H5MM_xstrdup(const char *s); H5_DLL char *H5MM_strdup(const char *s); H5_DLL void *H5MM_xfree(void *mem); +#if defined H5_MEMORY_ALLOC_SANITY_CHECK +H5_DLL void H5MM_final_sanity_check(void); +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + +#endif /* _H5MMprivate_H */ -#endif diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index 2355543..90224c1 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -66,6 +66,7 @@ Features: dmalloc: @HAVE_DMALLOC@ Clear file buffers before write: @CLEARFILEBUF@ Using memory checker: @USINGMEMCHECKER@ +Memory allocation sanity checks: @MEMORYALLOCSANITYCHECK@ Function Stack Tracing: @CODESTACK@ Strict File Format Checks: @STRICT_FORMAT_CHECKS@ Optimization Instrumentation: @INSTRUMENT@ -- cgit v0.12 From 064b2f6dd85330a7e06f07c5fd2b8b26c29c8f28 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 4 Jan 2016 12:21:05 -0500 Subject: [svn-r28788] Added extern C block to H5Epubgen.h (via bin/make_err). Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 serial only --- bin/make_err | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bin/make_err b/bin/make_err index 4b1f474..1b39d53fb 100755 --- a/bin/make_err +++ b/bin/make_err @@ -175,6 +175,12 @@ sub create_public ($) { print_warning(*HEADER); print_startprotect(*HEADER, $file); + # Begin extern C block + print HEADER "\n"; + print HEADER "#ifdef __cplusplus\n"; + print HEADER "extern \"C\" {\n"; + print HEADER "#endif\n"; + # Iterate over all the major errors print HEADER "\n/*********************/\n"; print HEADER "/* Major error codes */\n"; @@ -202,6 +208,12 @@ sub create_public ($) { } } + # End extern C block + print HEADER "\n"; + print HEADER "#ifdef __cplusplus\n"; + print HEADER "}\n"; + print HEADER "#endif\n"; + print_endprotect(*HEADER, $file); # Close header file -- cgit v0.12 From cdc21e0cb2d8a987790660b660a56744d54c5bed Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 4 Jan 2016 15:56:08 -0500 Subject: [svn-r28790] Description: Correct non-portable 'SIZE_T_MAX' to 'SIZET_MAX'. Tested on: Linux/32 2.6.x (jam) w/default compilers (h5committest forthcoming) --- src/H5MM.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/H5MM.c b/src/H5MM.c index 05bfb9e..b6e77eb 100644 --- a/src/H5MM.c +++ b/src/H5MM.c @@ -157,7 +157,7 @@ H5MM__sanity_check_block(const H5MM_block_t *block) HDassert(block->size > 0); HDassert(block->in_use); /* Check for head & tail guards, if not head of linked list */ - if(block->size != SIZE_T_MAX) { + if(block->size != SIZET_MAX) { HDassert(0 == HDmemcmp(block->b, H5MM_block_head_guard_s, H5MM_HEAD_GUARD_SIZE)); HDassert(0 == HDmemcmp(block->b + H5MM_HEAD_GUARD_SIZE + block->size, H5MM_block_tail_guard_s, H5MM_TAIL_GUARD_SIZE)); } @@ -251,7 +251,7 @@ H5MM_malloc(size_t size) HDmemcpy(H5MM_block_head_s.sig, H5MM_block_signature_s, H5MM_SIG_SIZE); H5MM_block_head_s.next = &H5MM_block_head_s; H5MM_block_head_s.prev = &H5MM_block_head_s; - H5MM_block_head_s.size = SIZE_T_MAX; + H5MM_block_head_s.size = SIZET_MAX; H5MM_block_head_s.in_use = TRUE; H5MM_init_s = TRUE; -- cgit v0.12 From 1cbc72e1ef6d5a0341713b4c7d8b113310a52551 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 4 Jan 2016 16:12:14 -0500 Subject: [svn-r28792] Added cleanup for new test files to tfile.c. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 serial only --- test/tfile.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/tfile.c b/test/tfile.c index c36045b..927ecab 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -3715,5 +3715,7 @@ cleanup_file(void) HDremove(FILE3); HDremove(FILE4); HDremove(FILE5); + HDremove(FILE6); + HDremove(FILE7); } -- cgit v0.12 From 3e0e79aa6eaa26106d22c0b860d523fe945cb0ac Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 4 Jan 2016 21:46:26 -0500 Subject: [svn-r28795] Description: Clean up more memory allocation mis-matches. Tested on: Linux/32 2.6.x (jam) w/serial MacOSX/64 10.11.2 (amazon) w/serial & parallel --- src/H5E.c | 5 +++++ src/H5PL.c | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/H5E.c b/src/H5E.c index 4374f1d..efa83e4 100644 --- a/src/H5E.c +++ b/src/H5E.c @@ -1417,8 +1417,13 @@ H5Epush2(hid_t err_stack, const char *file, const char *func, unsigned line, done: if(va_started) va_end(ap); +#ifdef H5_HAVE_VASPRINTF + if(tmp) + HDfree(tmp); +#else /* H5_HAVE_VASPRINTF */ if(tmp) H5MM_xfree(tmp); +#endif /* H5_HAVE_VASPRINTF */ FUNC_LEAVE_API(ret_value) } /* end H5Epush2() */ diff --git a/src/H5PL.c b/src/H5PL.c index 4c35c09..a196884 100644 --- a/src/H5PL.c +++ b/src/H5PL.c @@ -413,9 +413,9 @@ H5PL__init_path_table(void) */ origin_dl_path = HDgetenv("HDF5_PLUGIN_PATH"); if(NULL == origin_dl_path) - dl_path = HDstrdup(H5PL_DEFAULT_PATH); + dl_path = H5MM_strdup(H5PL_DEFAULT_PATH); else - dl_path = HDstrdup(origin_dl_path); + dl_path = H5MM_strdup(origin_dl_path); if(NULL == dl_path) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path") @@ -425,7 +425,7 @@ H5PL__init_path_table(void) /* Check for too many directories in path */ if(H5PL_num_paths_g == H5PL_MAX_PATH_NUM) HGOTO_ERROR(H5E_PLUGIN, H5E_NOSPACE, FAIL, "too many directories in path for table") - if(NULL == (H5PL_path_table_g[H5PL_num_paths_g] = HDstrdup(dir))) + if(NULL == (H5PL_path_table_g[H5PL_num_paths_g] = H5MM_strdup(dir))) HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path") H5PL_num_paths_g++; dir = HDstrtok(NULL, H5PL_PATH_SEPARATOR); -- cgit v0.12 From 4c5bb2b8db3c16c9ec7a3f7f7eebf7fbeac8c48b Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 4 Jan 2016 22:28:43 -0500 Subject: [svn-r28797] Description: Clean up another round of memory allocation mis-matches. Tested on: Linux/32 2.6.x (jam) w/serial MacOSX/64 10.11.2 (amazon) w/serial & parallel --- src/H5B2.c | 8 ++++---- src/H5B2hdr.c | 12 ++++-------- src/H5B2int.c | 32 ++++++++++++-------------------- src/H5Dchunk.c | 4 ++-- src/H5Dmpio.c | 30 +++++++++++++++++------------- src/H5Dvirtual.c | 10 +++++----- src/H5FDlog.c | 14 ++++++-------- src/H5Ocopy.c | 4 ++-- src/H5Pdcpl.c | 4 ++-- 9 files changed, 54 insertions(+), 64 deletions(-) diff --git a/src/H5B2.c b/src/H5B2.c index c105a93..62aded3 100644 --- a/src/H5B2.c +++ b/src/H5B2.c @@ -614,7 +614,7 @@ H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op, if(idx == 0) { if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->min_native_rec == NULL) - if(NULL == (hdr->min_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size))) + if(NULL == (hdr->min_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info") HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -622,7 +622,7 @@ H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op, if(idx == (unsigned)(leaf->nrec - 1)) { if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->max_native_rec == NULL) - if(NULL == (hdr->max_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size))) + if(NULL == (hdr->max_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info") HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -1224,7 +1224,7 @@ H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op, if(idx == 0) { if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->min_native_rec == NULL) - if(NULL == (hdr->min_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size))) + if(NULL == (hdr->min_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info") HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -1232,7 +1232,7 @@ H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op, if(idx == (unsigned)(leaf->nrec - 1)) { if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->max_native_rec == NULL) - if(NULL == (hdr->max_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size))) + if(NULL == (hdr->max_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info") HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c index 25ac141..036e81a 100644 --- a/src/H5B2hdr.c +++ b/src/H5B2hdr.c @@ -619,14 +619,10 @@ H5B2__hdr_free(H5B2_hdr_t *hdr) } /* end if */ /* Release the min & max record info, if set */ - if(hdr->min_native_rec) { - HDfree(hdr->min_native_rec); - hdr->min_native_rec = NULL; - } /* end if */ - if(hdr->max_native_rec) { - HDfree(hdr->max_native_rec); - hdr->max_native_rec = NULL; - } /* end if */ + if(hdr->min_native_rec) + hdr->min_native_rec = H5MM_free(hdr->min_native_rec); + if(hdr->max_native_rec) + hdr->max_native_rec = H5MM_free(hdr->max_native_rec); /* Free B-tree header info */ hdr = H5FL_FREE(H5B2_hdr_t, hdr); diff --git a/src/H5B2int.c b/src/H5B2int.c index 363d903..105dad4 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -1640,7 +1640,7 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr if(idx == 0) { if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->min_native_rec == NULL) - if(NULL == (hdr->min_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size))) + if(NULL == (hdr->min_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info") HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -1648,7 +1648,7 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr if(idx == (unsigned)(leaf->nrec - 1)) { if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->max_native_rec == NULL) - if(NULL == (hdr->max_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size))) + if(NULL == (hdr->max_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info") HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -1929,7 +1929,7 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr if(idx == 0) { if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->min_native_rec == NULL) - if(NULL == (hdr->min_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size))) + if(NULL == (hdr->min_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info") HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -1937,7 +1937,7 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr if(idx == (unsigned)(leaf->nrec - 1)) { if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->max_native_rec == NULL) - if(NULL == (hdr->max_native_rec = (uint8_t *)HDmalloc(hdr->cls->nrec_size))) + if(NULL == (hdr->max_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info") HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -2552,18 +2552,14 @@ H5B2__remove_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr /* (Don't use 'else' for the idx check, to allow for root leaf node) */ if(idx == 0) { if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) { - if(hdr->min_native_rec) { - HDfree(hdr->min_native_rec); - hdr->min_native_rec = NULL; - } /* end if */ + if(hdr->min_native_rec) + hdr->min_native_rec = H5MM_free(hdr->min_native_rec); } /* end if */ } /* end if */ if(idx == (unsigned)(leaf->nrec - 1)) { if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) { - if(hdr->max_native_rec) { - HDfree(hdr->max_native_rec); - hdr->max_native_rec = NULL; - } /* end if */ + if(hdr->max_native_rec) + hdr->max_native_rec = H5MM_free(hdr->max_native_rec); } /* end if */ } /* end if */ } /* end if */ @@ -2867,18 +2863,14 @@ H5B2__remove_leaf_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, /* (Don't use 'else' for the idx check, to allow for root leaf node) */ if(idx == 0) { if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) { - if(hdr->min_native_rec) { - HDfree(hdr->min_native_rec); - hdr->min_native_rec = NULL; - } /* end if */ + if(hdr->min_native_rec) + hdr->min_native_rec = H5MM_free(hdr->min_native_rec); } /* end if */ } /* end if */ if(idx == (unsigned)(leaf->nrec - 1)) { if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) { - if(hdr->max_native_rec) { - HDfree(hdr->max_native_rec); - hdr->max_native_rec = NULL; - } /* end if */ + if(hdr->max_native_rec) + hdr->max_native_rec = H5MM_free(hdr->max_native_rec); } /* end if */ } /* end if */ } /* end if */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 0c4cba1..b0abdf1 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -3746,7 +3746,7 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, write collectively at the end */ /* allocate/resize address array if no more space left */ if(0 == chunk_info.num_io % 1024) - if(NULL == (chunk_info.addr = (haddr_t *)HDrealloc(chunk_info.addr, (chunk_info.num_io + 1024) * sizeof(haddr_t)))) + if(NULL == (chunk_info.addr = (haddr_t *)H5MM_realloc(chunk_info.addr, (chunk_info.num_io + 1024) * sizeof(haddr_t)))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed for chunk addresses") /* Store the chunk's address for later */ @@ -3813,7 +3813,7 @@ done: #ifdef H5_HAVE_PARALLEL if(using_mpi && chunk_info.addr) - HDfree(chunk_info.addr); + H5MM_free(chunk_info.addr); #endif FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index a5f34d1..0ba340a 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -1680,7 +1680,6 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm, MPI_Comm comm; int ic, root; int mpi_code; - hbool_t mem_cleanup = FALSE; #ifdef H5_HAVE_INSTRUMENTED_LIBRARY int new_value; htri_t check_prop; @@ -1715,12 +1714,14 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm, threshold_nproc_per_chunk = mpi_size * percent_nproc_per_chunk/100; /* Allocate memory */ - io_mode_info = (uint8_t *)H5MM_calloc(total_chunks); - mergebuf = H5MM_malloc((sizeof(haddr_t) + 1) * total_chunks); + if(NULL == (io_mode_info = (uint8_t *)H5MM_calloc(total_chunks))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate I/O mode info buffer") + if(NULL == (mergebuf = H5MM_malloc((sizeof(haddr_t) + 1) * total_chunks))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate mergebuf buffer") tempbuf = mergebuf + total_chunks; if(mpi_rank == root) - recv_io_mode_info = (uint8_t *)H5MM_malloc(total_chunks * mpi_size); - mem_cleanup = TRUE; + if(NULL == (recv_io_mode_info = (uint8_t *)H5MM_malloc(total_chunks * mpi_size))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate recv I/O mode info buffer") /* Obtain the regularity and selection information for all chunks in this process. */ chunk_node = H5SL_first(fm->sel_chunks); @@ -1742,11 +1743,12 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm, /* pre-computing: calculate number of processes and regularity of the selection occupied in each chunk */ - nproc_per_chunk = (int*)H5MM_calloc(total_chunks * sizeof(int)); + if(NULL == (nproc_per_chunk = (int*)H5MM_calloc(total_chunks * sizeof(int)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "couldn't allocate nproc_per_chunk buffer") /* calculating the chunk address */ if(H5D__chunk_addrmap(io_info, chunk_addr) < 0) { - HDfree(nproc_per_chunk); + H5MM_free(nproc_per_chunk); HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address") } /* end if */ @@ -1774,7 +1776,7 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm, HDmemcpy(mergebuf, assign_io_mode, total_chunks); HDmemcpy(tempbuf, chunk_addr, sizeof(haddr_t) * total_chunks); - HDfree(nproc_per_chunk); + H5MM_free(nproc_per_chunk); } /* end if */ /* Broadcasting the MPI_IO option info. and chunk address info. */ @@ -1824,11 +1826,13 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm, #endif done: - if(mem_cleanup) { - HDfree(io_mode_info); - HDfree(mergebuf); - if(mpi_rank == root) - HDfree(recv_io_mode_info); + if(io_mode_info) + H5MM_free(io_mode_info); + if(mergebuf) + H5MM_free(mergebuf); + if(recv_io_mode_info) { + HDassert(mpi_rank == root); + H5MM_free(recv_io_mode_info); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index 7c5186d..bf754cb 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -446,10 +446,10 @@ H5D__virtual_copy_layout(H5O_layout_t *layout) /* Copy original source names */ if(NULL == (layout->storage.u.virt.list[i].source_file_name - = HDstrdup(orig_list[i].source_file_name))) + = H5MM_strdup(orig_list[i].source_file_name))) HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source file name") if(NULL == (layout->storage.u.virt.list[i].source_dset_name - = HDstrdup(orig_list[i].source_dset_name))) + = H5MM_strdup(orig_list[i].source_dset_name))) HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source dataset name") /* Copy source selection */ @@ -488,7 +488,7 @@ H5D__virtual_copy_layout(H5O_layout_t *layout) } /* end if */ else if(NULL == (layout->storage.u.virt.list[i].source_dset.file_name - = HDstrdup(orig_list[i].source_dset.file_name))) + = H5MM_strdup(orig_list[i].source_dset.file_name))) HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source file name") } /* end if */ if(orig_list[i].source_dset.dset_name) { @@ -504,7 +504,7 @@ H5D__virtual_copy_layout(H5O_layout_t *layout) } /* end if */ else if(NULL == (layout->storage.u.virt.list[i].source_dset.dset_name - = HDstrdup(orig_list[i].source_dset.dset_name))) + = H5MM_strdup(orig_list[i].source_dset.dset_name))) HGOTO_ERROR(H5E_DATASET, H5E_RESOURCE, FAIL, "unable to duplicate source dataset name") } /* end if */ @@ -1124,7 +1124,7 @@ H5D__virtual_copy_parsed_name(H5O_storage_virtual_name_seg_t **dst, /* Duplicate name segment */ if(p_src->name_segment) { - if(NULL == ((*p_dst)->name_segment = HDstrdup(p_src->name_segment))) + if(NULL == ((*p_dst)->name_segment = H5MM_strdup(p_src->name_segment))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "unable to duplicate name segment") } /* end if */ diff --git a/src/H5FDlog.c b/src/H5FDlog.c index a8228e0..435ee70 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -406,7 +406,7 @@ H5FD_log_fapl_copy(const void *_old_fa) /* Deep copy the log file name */ if(old_fa->logfile != NULL) - if(NULL == (new_fa->logfile = H5MM_xstrdup(old_fa->logfile))) + if(NULL == (new_fa->logfile = H5MM_strdup(old_fa->logfile))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate log file name") /* Set return value */ @@ -416,7 +416,7 @@ done: if(NULL == ret_value) if(new_fa) { if(new_fa->logfile) - H5MM_free(new_fa->logfile); + new_fa->logfile = H5MM_free(new_fa->logfile); H5MM_free(new_fa); } /* end if */ @@ -445,7 +445,7 @@ H5FD_log_fapl_free(void *_fa) /* Free the fapl information */ if(fa->logfile) - H5MM_xfree(fa->logfile); + fa->logfile = H5MM_free(fa->logfile); H5MM_xfree(fa); FUNC_LEAVE_NOAPI(SUCCEED) @@ -594,7 +594,7 @@ H5FD_log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr) /* Get the flags for logging */ file->fa.flags = fa->flags; if(fa->logfile) - file->fa.logfile = HDstrdup(fa->logfile); + file->fa.logfile = H5MM_strdup(fa->logfile); else file->fa.logfile = NULL; file->fa.buf_size = fa->buf_size; @@ -798,10 +798,8 @@ H5FD_log_close(H5FD_t *_file) HDfclose(file->logfp); } /* end if */ - if(file->fa.logfile) { - HDfree(file->fa.logfile); - file->fa.logfile = NULL; - } + if(file->fa.logfile) + file->fa.logfile = H5MM_free(file->fa.logfile); /* Release the file info */ file = H5FL_FREE(H5FD_log_t, file); diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 6f42a88..70dc560 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -463,7 +463,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, /* Allocate memory for "deleted" array. This array marks the message in * the source that shouldn't be copied to the destination. */ - if(NULL == (deleted = (hbool_t *)HDmalloc(sizeof(hbool_t) * oh_src->nmesgs))) + if(NULL == (deleted = (hbool_t *)H5MM_malloc(sizeof(hbool_t) * oh_src->nmesgs))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") HDmemset(deleted, FALSE, sizeof(hbool_t) * oh_src->nmesgs); @@ -870,7 +870,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, done: /* Free deleted array */ if(deleted) - HDfree(deleted); + H5MM_free(deleted); /* Release pointer to source object header and its derived objects */ if(oh_src && H5O_unprotect(oloc_src, dxpl_id, oh_src, H5AC__NO_FLAGS_SET) < 0) diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 03d987f..971394c 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -2227,9 +2227,9 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, HDmemset(ent, 0, sizeof(H5O_storage_virtual_ent_t)); /* Clear before starting to set up */ if(NULL == (ent->source_dset.virtual_select = H5S_copy(vspace, FALSE, TRUE))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy virtual selection") - if(NULL == (ent->source_file_name = HDstrdup(src_file_name))) + if(NULL == (ent->source_file_name = H5MM_xstrdup(src_file_name))) HGOTO_ERROR(H5E_PLIST, H5E_RESOURCE, FAIL, "can't duplicate source file name") - if(NULL == (ent->source_dset_name = HDstrdup(src_dset_name))) + if(NULL == (ent->source_dset_name = H5MM_xstrdup(src_dset_name))) HGOTO_ERROR(H5E_PLIST, H5E_RESOURCE, FAIL, "can't duplicate source file name") if(NULL == (ent->source_select = H5S_copy(src_space, FALSE, TRUE))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "unable to copy source selection") -- cgit v0.12 From 4b90bb3317c39b347fd67dc753d70fe6808e4f2b Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 4 Jan 2016 22:37:06 -0500 Subject: [svn-r28798] Description: Add missing H5MMprivate.h header file Tested on: Linux/32 2.6.x (jam) w/serial MacOSX/64 10.11.2 (amazon) w/serial & parallel --- src/H5B2.c | 1 + src/H5B2hdr.c | 3 ++- src/H5B2int.c | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/H5B2.c b/src/H5B2.c index 62aded3..3a712da 100644 --- a/src/H5B2.c +++ b/src/H5B2.c @@ -42,6 +42,7 @@ #include "H5private.h" /* Generic Functions */ #include "H5B2pkg.h" /* v2 B-trees */ #include "H5Eprivate.h" /* Error handling */ +#include "H5MMprivate.h" /* Memory management */ /****************/ diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c index 036e81a..b6e0b26 100644 --- a/src/H5B2hdr.c +++ b/src/H5B2hdr.c @@ -38,7 +38,8 @@ #include "H5B2pkg.h" /* v2 B-trees */ #include "H5Eprivate.h" /* Error handling */ #include "H5MFprivate.h" /* File memory management */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ /* Local Macros */ diff --git a/src/H5B2int.c b/src/H5B2int.c index 105dad4..fe82604 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -38,7 +38,8 @@ #include "H5B2pkg.h" /* v2 B-trees */ #include "H5Eprivate.h" /* Error handling */ #include "H5MFprivate.h" /* File memory management */ -#include "H5VMprivate.h" /* Vectors and arrays */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5VMprivate.h" /* Vectors and arrays */ /****************/ /* Local Macros */ -- cgit v0.12 From 63102599575c860b0f5b839e0e3ab8e5944fd1fc Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 4 Jan 2016 22:46:10 -0500 Subject: [svn-r28800] Description: Correct H5MM_free => H5MM_xfree Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel --- src/H5B2hdr.c | 4 ++-- src/H5B2int.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c index b6e0b26..ab424b7 100644 --- a/src/H5B2hdr.c +++ b/src/H5B2hdr.c @@ -621,9 +621,9 @@ H5B2__hdr_free(H5B2_hdr_t *hdr) /* Release the min & max record info, if set */ if(hdr->min_native_rec) - hdr->min_native_rec = H5MM_free(hdr->min_native_rec); + hdr->min_native_rec = H5MM_xfree(hdr->min_native_rec); if(hdr->max_native_rec) - hdr->max_native_rec = H5MM_free(hdr->max_native_rec); + hdr->max_native_rec = H5MM_xfree(hdr->max_native_rec); /* Free B-tree header info */ hdr = H5FL_FREE(H5B2_hdr_t, hdr); diff --git a/src/H5B2int.c b/src/H5B2int.c index fe82604..f3bae69 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -2554,13 +2554,13 @@ H5B2__remove_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr if(idx == 0) { if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->min_native_rec) - hdr->min_native_rec = H5MM_free(hdr->min_native_rec); + hdr->min_native_rec = H5MM_xfree(hdr->min_native_rec); } /* end if */ } /* end if */ if(idx == (unsigned)(leaf->nrec - 1)) { if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->max_native_rec) - hdr->max_native_rec = H5MM_free(hdr->max_native_rec); + hdr->max_native_rec = H5MM_xfree(hdr->max_native_rec); } /* end if */ } /* end if */ } /* end if */ @@ -2865,13 +2865,13 @@ H5B2__remove_leaf_by_idx(H5B2_hdr_t *hdr, hid_t dxpl_id, if(idx == 0) { if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->min_native_rec) - hdr->min_native_rec = H5MM_free(hdr->min_native_rec); + hdr->min_native_rec = H5MM_xfree(hdr->min_native_rec); } /* end if */ } /* end if */ if(idx == (unsigned)(leaf->nrec - 1)) { if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->max_native_rec) - hdr->max_native_rec = H5MM_free(hdr->max_native_rec); + hdr->max_native_rec = H5MM_xfree(hdr->max_native_rec); } /* end if */ } /* end if */ } /* end if */ -- cgit v0.12 From fb1525c2b2bb606a39fa6b2d2a50cfa4d3fee640 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 4 Jan 2016 22:47:55 -0500 Subject: [svn-r28802] Description: Correct another H5MM_free => H5MM_xfree Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel --- src/H5FDlog.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 435ee70..4bb72ce 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -416,7 +416,7 @@ done: if(NULL == ret_value) if(new_fa) { if(new_fa->logfile) - new_fa->logfile = H5MM_free(new_fa->logfile); + new_fa->logfile = H5MM_xfree(new_fa->logfile); H5MM_free(new_fa); } /* end if */ @@ -445,7 +445,7 @@ H5FD_log_fapl_free(void *_fa) /* Free the fapl information */ if(fa->logfile) - fa->logfile = H5MM_free(fa->logfile); + fa->logfile = H5MM_xfree(fa->logfile); H5MM_xfree(fa); FUNC_LEAVE_NOAPI(SUCCEED) @@ -799,7 +799,7 @@ H5FD_log_close(H5FD_t *_file) } /* end if */ if(file->fa.logfile) - file->fa.logfile = H5MM_free(file->fa.logfile); + file->fa.logfile = H5MM_xfree(file->fa.logfile); /* Release the file info */ file = H5FL_FREE(H5FD_log_t, file); -- cgit v0.12 From 48f7ad2df147d92851c6246155712f430a9f39f0 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 6 Jan 2016 10:46:02 -0500 Subject: [svn-r28811] Description: Switch v2 B-tree min & max records to be void*'s to be cleaner and generate less warnings. Tested on: Linux/32 2.6.x (jam) w/serial MacOSX/64 10.11.2 (amazon) w/serial & parallel --- src/H5B2.c | 8 ++++---- src/H5B2int.c | 8 ++++---- src/H5B2pkg.h | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/H5B2.c b/src/H5B2.c index 3a712da..a1e9d37 100644 --- a/src/H5B2.c +++ b/src/H5B2.c @@ -615,7 +615,7 @@ H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op, if(idx == 0) { if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->min_native_rec == NULL) - if(NULL == (hdr->min_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) + if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info") HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -623,7 +623,7 @@ H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op, if(idx == (unsigned)(leaf->nrec - 1)) { if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->max_native_rec == NULL) - if(NULL == (hdr->max_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) + if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info") HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -1225,7 +1225,7 @@ H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op, if(idx == 0) { if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->min_native_rec == NULL) - if(NULL == (hdr->min_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) + if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info") HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -1233,7 +1233,7 @@ H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op, if(idx == (unsigned)(leaf->nrec - 1)) { if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->max_native_rec == NULL) - if(NULL == (hdr->max_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) + if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info") HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ diff --git a/src/H5B2int.c b/src/H5B2int.c index f3bae69..a69774a 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -1641,7 +1641,7 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr if(idx == 0) { if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->min_native_rec == NULL) - if(NULL == (hdr->min_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) + if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info") HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -1649,7 +1649,7 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr if(idx == (unsigned)(leaf->nrec - 1)) { if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->max_native_rec == NULL) - if(NULL == (hdr->max_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) + if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info") HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -1930,7 +1930,7 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr if(idx == 0) { if(H5B2_POS_LEFT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->min_native_rec == NULL) - if(NULL == (hdr->min_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) + if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info") HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ @@ -1938,7 +1938,7 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr if(idx == (unsigned)(leaf->nrec - 1)) { if(H5B2_POS_RIGHT == curr_pos || H5B2_POS_ROOT == curr_pos) { if(hdr->max_native_rec == NULL) - if(NULL == (hdr->max_native_rec = (uint8_t *)H5MM_malloc(hdr->cls->nrec_size))) + if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info") HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h index d6b6c04..2b2c145 100644 --- a/src/H5B2pkg.h +++ b/src/H5B2pkg.h @@ -182,8 +182,8 @@ typedef struct H5B2_hdr_t { uint8_t *page; /* Common disk page for I/O */ size_t *nat_off; /* Array of offsets of native records */ H5B2_node_info_t *node_info; /* Table of node info structs for current depth of B-tree */ - uint8_t *min_native_rec; /* Pointer to minimum native record */ - uint8_t *max_native_rec; /* Pointer to maximum native record */ + void *min_native_rec; /* Pointer to minimum native record */ + void *max_native_rec; /* Pointer to maximum native record */ /* Client information (not stored) */ const H5B2_class_t *cls; /* Class of B-tree client */ -- cgit v0.12 From 4bf63f78e71aed68ba946dbfda545d657a9a94b5 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 6 Jan 2016 12:04:15 -0500 Subject: [svn-r28815] Description: Add internal routine to sanity check all blocks allocated through H5MM interface. Tested on: Linux/32 2.6.x (jam) w/serial Linux/64 2.6.x (mayll) w/serial MacOSX/64 10.11.2 (amazon) w/serial & parallel --- src/H5MM.c | 25 +++++++++++++++++++++++++ src/H5MMprivate.h | 1 + 2 files changed, 26 insertions(+) diff --git a/src/H5MM.c b/src/H5MM.c index b6e77eb..fd9a4a9 100644 --- a/src/H5MM.c +++ b/src/H5MM.c @@ -187,6 +187,31 @@ H5MM__sanity_check(void *mem) /*------------------------------------------------------------------------- + * Function: H5MM_sanity_check_all + * + * Purpose: Sanity check all current memory allocations. + * + * Return: N/A (void) + * + * Programmer: Quincey Koziol + * Jan 5 2016 + * + *------------------------------------------------------------------------- + */ +void +H5MM_sanity_check_all(void) +{ + H5MM_block_t *curr; + + curr = H5MM_block_head_s.next; + while(curr != &H5MM_block_head_s) { + H5MM__sanity_check_block(curr); + curr = curr->next; + } /* end while */ +} /* end H5MM_sanity_check_all() */ + + +/*------------------------------------------------------------------------- * Function: H5MM_final_sanity_check * * Purpose: Final sanity checks on memory allocation. diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h index c494a60..14bd28d 100644 --- a/src/H5MMprivate.h +++ b/src/H5MMprivate.h @@ -48,6 +48,7 @@ H5_DLL char *H5MM_xstrdup(const char *s); H5_DLL char *H5MM_strdup(const char *s); H5_DLL void *H5MM_xfree(void *mem); #if defined H5_MEMORY_ALLOC_SANITY_CHECK +H5_DLL void H5MM_sanity_check_all(void); H5_DLL void H5MM_final_sanity_check(void); #endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ -- cgit v0.12 From 06da6031a596c2d19dcc4a253253b6ea33378728 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 6 Jan 2016 12:50:08 -0500 Subject: [svn-r28819] Description: Align internal memory sanity checking buffer, to avoid problems when optimization is enabled. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel Linux/32 2.6.x (jam) w/serial --- src/H5MM.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/src/H5MM.c b/src/H5MM.c index fd9a4a9..b830d21 100644 --- a/src/H5MM.c +++ b/src/H5MM.c @@ -60,9 +60,14 @@ typedef struct H5MM_block_t { unsigned char sig[H5MM_SIG_SIZE]; /* Signature for the block, to indicate it was allocated with H5MM* interface */ struct H5MM_block_t *next; /* Pointer to next block in the list of allocated blocks */ struct H5MM_block_t *prev; /* Pointer to previous block in the list of allocated blocks */ - size_t size; - hbool_t in_use; - unsigned char b[]; + union { + struct { + size_t size; /* Size of allocated block */ + hbool_t in_use; /* Whether the block is in use or is free */ + } info; + double _align; /* Align following buffer (b) to double boundary (unused) */ + } u; + unsigned char b[]; /* Buffer for caller (includes header and footer) */ } H5MM_block_t; #endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ @@ -154,12 +159,12 @@ H5MM__is_our_block(void *mem) static void H5MM__sanity_check_block(const H5MM_block_t *block) { - HDassert(block->size > 0); - HDassert(block->in_use); + HDassert(block->u.info.size > 0); + HDassert(block->u.info.in_use); /* Check for head & tail guards, if not head of linked list */ - if(block->size != SIZET_MAX) { + if(block->u.info.size != SIZET_MAX) { HDassert(0 == HDmemcmp(block->b, H5MM_block_head_guard_s, H5MM_HEAD_GUARD_SIZE)); - HDassert(0 == HDmemcmp(block->b + H5MM_HEAD_GUARD_SIZE + block->size, H5MM_block_tail_guard_s, H5MM_TAIL_GUARD_SIZE)); + HDassert(0 == HDmemcmp(block->b + H5MM_HEAD_GUARD_SIZE + block->u.info.size, H5MM_block_tail_guard_s, H5MM_TAIL_GUARD_SIZE)); } } @@ -271,13 +276,16 @@ H5MM_malloc(size_t size) FUNC_ENTER_NOAPI_NOINIT_NOERR #if defined H5_MEMORY_ALLOC_SANITY_CHECK + /* Make certain that the buffer in the struct is properly aligned */ + HDcompile_assert(offsetof(H5MM_block_t, b) % sizeof(double) == 0); + /* Initialize block list head singleton */ if(!H5MM_init_s) { HDmemcpy(H5MM_block_head_s.sig, H5MM_block_signature_s, H5MM_SIG_SIZE); H5MM_block_head_s.next = &H5MM_block_head_s; H5MM_block_head_s.prev = &H5MM_block_head_s; - H5MM_block_head_s.size = SIZET_MAX; - H5MM_block_head_s.in_use = TRUE; + H5MM_block_head_s.u.info.size = SIZET_MAX; + H5MM_block_head_s.u.info.in_use = TRUE; H5MM_init_s = TRUE; } /* end if */ @@ -295,8 +303,8 @@ H5MM_malloc(size_t size) H5MM_block_head_s.next = block; block->next->prev = block; block->prev = &H5MM_block_head_s; - block->size = size; - block->in_use = TRUE; + block->u.info.size = size; + block->u.info.in_use = TRUE; HDmemcpy(block->b, H5MM_block_head_guard_s, H5MM_HEAD_GUARD_SIZE); HDmemcpy(block->b + H5MM_HEAD_GUARD_SIZE + size, H5MM_block_tail_guard_s, H5MM_TAIL_GUARD_SIZE); @@ -414,7 +422,7 @@ H5MM_realloc(void *mem, size_t size) if(mem) { if(H5MM__is_our_block(mem)) { H5MM_block_t *block = H5MM_BLOCK_FROM_BUF(mem); - size_t old_size = block->size; + size_t old_size = block->u.info.size; H5MM__sanity_check(mem); @@ -545,7 +553,7 @@ H5MM_xfree(void *mem) H5MM__sanity_check_block(block->prev); /* Update statistics */ - H5MM_curr_alloc_bytes_s -= block->size; + H5MM_curr_alloc_bytes_s -= block->u.info.size; H5MM_curr_alloc_blocks_count_s--; /* Reset block info */ @@ -554,7 +562,7 @@ H5MM_xfree(void *mem) block->prev->next = block->next; block->next = NULL; block->prev = NULL; - block->in_use = FALSE; + block->u.info.in_use = FALSE; /* Free the block (finally!) */ HDfree(block); -- cgit v0.12 From b834ac36535d72dd5013514bad5448bf0baa465e Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 6 Jan 2016 13:33:23 -0500 Subject: [svn-r28821] Merge of r28816 from revise_chunks (tarray.c cleanup). Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 serial only --- test/tarray.c | 168 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 84 insertions(+), 84 deletions(-) diff --git a/test/tarray.c b/test/tarray.c index 9c79f41..28798c2 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -178,7 +178,7 @@ test_array_funcs(void) { hid_t type; /* Datatype ID */ hsize_t tdims1[] = {ARRAY1_DIM1}; - int size; + size_t size; H5T_pad_t inpad; H5T_norm_t norm; H5T_cset_t cset; @@ -190,13 +190,13 @@ test_array_funcs(void) CHECK(type, FAIL, "H5Tarray_create2"); size=H5Tget_precision(type); - CHECK(size, FAIL, "H5Tget_precision"); + CHECK(size, 0, "H5Tget_precision"); size=H5Tget_size(type); - CHECK(size, FAIL, "H5Tget_size"); + CHECK(size, 0, "H5Tget_size"); size=H5Tget_ebias(type); - CHECK(size, FAIL, "H5Tget_ebias"); + CHECK(size, 0, "H5Tget_ebias"); ret=H5Tset_pad(type, H5T_PAD_ZERO, H5T_PAD_ONE); CHECK(ret, FAIL, "H5Tset_pad"); @@ -541,7 +541,7 @@ test_array_compound_atomic(void) for(i = 0; i < SPACE1_DIM1; i++) for(j = 0; j < ARRAY1_DIM1; j++) { wdata[i][j].i = i * 10 + j; - wdata[i][j].f = (float)(i * 2.5F + j); + wdata[i][j].f = (float)i * 2.5F + (float)j; } /* end for */ /* Create file */ @@ -745,7 +745,7 @@ test_array_compound_array(void) for(j=0; jnsubfields = 3; /* Initialize the offsets */ /* ----------------------- */ - dtsinfo.offset[0] = HOFFSET(CmpField, a); - dtsinfo.offset[1] = HOFFSET(CmpField, b); - dtsinfo.offset[2] = HOFFSET(CmpField, c); + dtsinfo->offset[0] = HOFFSET(CmpField, a); + dtsinfo->offset[1] = HOFFSET(CmpField, b); + dtsinfo->offset[2] = HOFFSET(CmpField, c); /* Initialize the data type IDs */ /* ---------------------------- */ - dtsinfo.datatype[0] = H5T_NATIVE_INT; - dtsinfo.datatype[1] = H5T_NATIVE_FLOAT; - dtsinfo.datatype[2] = H5T_NATIVE_DOUBLE; + dtsinfo->datatype[0] = H5T_NATIVE_INT; + dtsinfo->datatype[1] = H5T_NATIVE_FLOAT; + dtsinfo->datatype[2] = H5T_NATIVE_DOUBLE; /* Initialize the names of data members */ /* ------------------------------------ */ - for (i = 0; i < dtsinfo.nsubfields; i++) - dtsinfo.name[i] = (char *)HDcalloc((size_t)20, sizeof(char)); + for (i = 0; i < dtsinfo->nsubfields; i++) + dtsinfo->name[i] = (char *)HDcalloc((size_t)20, sizeof(char)); - strcpy(dtsinfo.name[0], "One"); - strcpy(dtsinfo.name[1], "Two"); - strcpy(dtsinfo.name[2], "Three"); + strcpy(dtsinfo->name[0], "One"); + strcpy(dtsinfo->name[1], "Two"); + strcpy(dtsinfo->name[2], "Three"); /* Create file */ @@ -1585,17 +1584,16 @@ test_array_bkg(void) /* Add members to the compound data type */ /* -------------------------------------- */ - for ( i = 0; i < dtsinfo.nsubfields; i++) - { - array_dt = H5Tarray_create2(dtsinfo.datatype[i], ndims[i], dima); + for ( i = 0; i < dtsinfo->nsubfields; i++) { + array_dt = H5Tarray_create2(dtsinfo->datatype[i], ndims[i], dima); CHECK(array_dt, FAIL, "H5Tarray_create2"); - status = H5Tinsert (type, dtsinfo.name[i], dtsinfo.offset[i], array_dt); + status = H5Tinsert (type, dtsinfo->name[i], dtsinfo->offset[i], array_dt); CHECK(status, FAIL, "H5Tinsert"); status = H5Tclose(array_dt); CHECK(status, FAIL, "H5Tclose"); - } + } /* end for */ /* Create the dataset */ /* ------------------ */ @@ -1617,23 +1615,23 @@ test_array_bkg(void) if(cf[i].a[j]!=cfr[i].a[j]) { TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]); continue; - } + } /* end if */ if(!H5_FLT_ABS_EQUAL(cf[i].b[j],cfr[i].b[j])) { TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].b[j],(int)i,(int)j,(double)cfr[i].b[j]); continue; - } + } /* end if */ if(!H5_DBL_ABS_EQUAL(cf[i].c[j],cfr[i].c[j])) { TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].c[j],(int)i,(int)j,(double)cfr[i].c[j]); continue; - } - } - } + } /* end if */ + } /* end for */ + } /* end for */ /* Release memory resources */ /* ------------------------ */ - for (i = 0; i < dtsinfo.nsubfields; i++) - HDfree(dtsinfo.name[i]); + for (i = 0; i < dtsinfo->nsubfields; i++) + HDfree(dtsinfo->name[i]); /* Release IDs */ @@ -1651,9 +1649,9 @@ test_array_bkg(void) CHECK(status, FAIL, "H5Fclose"); -/******************************/ -/* Reopen the file and update */ -/******************************/ + /******************************/ + /* Reopen the file and update */ + /******************************/ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); @@ -1674,7 +1672,7 @@ test_array_bkg(void) /* -------------------------------- */ for (i=0; i< LENGTH; i++) for (j = 0; j < ALEN; j++) - cf[i].b[j]=fld[i].b[j] = 1.313F; + cf[i].b[j] = fld[i].b[j] = 1.313F; status = H5Dwrite (dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, fld); CHECK(status, FAIL, "H5Dwrite"); @@ -1688,7 +1686,7 @@ test_array_bkg(void) if(!H5_FLT_ABS_EQUAL(fld[i].b[j],fldr[i].b[j])) { TestErrPrintf("Field data doesn't match, fld[%d].b[%d]=%f, fldr[%d].b[%d]=%f\n",(int)i,(int)j,(double)fld[i].b[j],(int)i,(int)j,(double)fldr[i].b[j]); continue; - } + } /* end if */ status = H5Tclose (type); CHECK(status, FAIL, "H5Tclose"); @@ -1710,17 +1708,17 @@ test_array_bkg(void) if(cf[i].a[j]!=cfr[i].a[j]) { TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]); continue; - } + } /* end if */ if(!H5_FLT_ABS_EQUAL(cf[i].b[j],cfr[i].b[j])) { TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].b[j],(int)i,(int)j,(double)cfr[i].b[j]); continue; - } + } /* end if */ if(!H5_DBL_ABS_EQUAL(cf[i].c[j],cfr[i].c[j])) { TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].c[j],(int)i,(int)j,(double)cfr[i].c[j]); continue; - } - } - } + } /* end if */ + } /* end for */ + } /* end for */ status = H5Dclose(dataset); CHECK(status, FAIL, "H5Dclose"); @@ -1731,9 +1729,9 @@ test_array_bkg(void) status = H5Fclose(fid); CHECK(status, FAIL, "H5Fclose"); -/****************************************************/ -/* Reopen the file and print out all the data again */ -/****************************************************/ + /****************************************************/ + /* Reopen the file and print out all the data again */ + /****************************************************/ fid = H5Fopen(FILENAME, H5F_ACC_RDWR, H5P_DEFAULT); CHECK(fid, FAIL, "H5Fopen"); @@ -1759,17 +1757,17 @@ test_array_bkg(void) if(cf[i].a[j]!=cfr[i].a[j]) { TestErrPrintf("Field a data doesn't match, cf[%d].a[%d]=%d, cfr[%d].a[%d]=%d\n",(int)i,(int)j,(int)cf[i].a[j],(int)i,(int)j,(int)cfr[i].a[j]); continue; - } + } /* end if */ if(!H5_FLT_ABS_EQUAL(cf[i].b[j],cfr[i].b[j])) { TestErrPrintf("Field b data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].b[j],(int)i,(int)j,(double)cfr[i].b[j]); continue; - } + } /* end if */ if(!H5_DBL_ABS_EQUAL(cf[i].c[j],cfr[i].c[j])) { TestErrPrintf("Field c data doesn't match, cf[%d].b[%d]=%f, cfr[%d].b[%d]=%f\n",(int)i,(int)j,(double)cf[i].c[j],(int)i,(int)j,(double)cfr[i].c[j]); continue; - } - } - } + } /* end if */ + } /* end for */ + } /* end for */ status = H5Dclose(dataset); CHECK(status, FAIL, "H5Dclose"); @@ -1779,6 +1777,8 @@ test_array_bkg(void) status = H5Fclose(fid); CHECK(status, FAIL, "H5Fclose"); + + HDfree(dtsinfo); } /* end test_array_bkg() */ /**************************************************************** -- cgit v0.12 From 971af2d7333584e021564f4f50f3afcfba57716f Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 6 Jan 2016 14:10:21 -0500 Subject: [svn-r28824] Description: Reduce asserts on buffer alignment. Tested on: Linux/32 & Linux/64 2.6.x (jam & myall) w/serial --- src/H5MM.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/H5MM.c b/src/H5MM.c index b830d21..09e6461 100644 --- a/src/H5MM.c +++ b/src/H5MM.c @@ -276,9 +276,6 @@ H5MM_malloc(size_t size) FUNC_ENTER_NOAPI_NOINIT_NOERR #if defined H5_MEMORY_ALLOC_SANITY_CHECK - /* Make certain that the buffer in the struct is properly aligned */ - HDcompile_assert(offsetof(H5MM_block_t, b) % sizeof(double) == 0); - /* Initialize block list head singleton */ if(!H5MM_init_s) { HDmemcpy(H5MM_block_head_s.sig, H5MM_block_signature_s, H5MM_SIG_SIZE); -- cgit v0.12 From e9a63d30df37fba8b879f18f39cf96b3d46bd615 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 6 Jan 2016 15:45:25 -0500 Subject: [svn-r28828] Description: Switch filter plugin to use H5allocate_memory and H5free_memory instead of malloc and free. Tested on: Linux/32 2.6.x (jam) w/serial Linux/64 2.6.x (jam) w/serial MacOSX/64 10.11.2 (amazon) w/serial & parallel --- test/dynlib3.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/dynlib3.c b/test/dynlib3.c index b3a02ed..e509a52 100644 --- a/test/dynlib3.c +++ b/test/dynlib3.c @@ -81,7 +81,7 @@ H5Z_filter_dynlib3(unsigned int flags, size_t cd_nelmts, void *outbuf = NULL; /* Pointer to new buffer */ unsigned char *dst; /* Temporary pointer to destination buffer */ - dst = (unsigned char *)(outbuf = malloc(nbytes + SUFFIX_LEN)); + dst = (unsigned char *)(outbuf = H5allocate_memory(nbytes + SUFFIX_LEN, 0)); /* Copy raw data */ memcpy((void*)dst, (void*)(*buf), nbytes); @@ -91,7 +91,7 @@ H5Z_filter_dynlib3(unsigned int flags, size_t cd_nelmts, memcpy(dst, (void*)GROUP_SUFFIX, SUFFIX_LEN); /* Free input buffer */ - free(*buf); + H5free_memory(*buf); /* Set return values */ *buf_size = nbytes + SUFFIX_LEN; -- cgit v0.12 From dc63336a4a863f1222f698d882e0862b72aa93fc Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 6 Jan 2016 17:05:32 -0500 Subject: [svn-r28832] Description: Reset driver info message when superblock load fails. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel Linux/32 2.6.x (jam) w/serial Linux/64 2.6.x (mayll) w/serial --- src/H5Fsuper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index a0f9536..332dfa6 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -510,8 +510,10 @@ H5F__super_read(H5F_t *f, hid_t dxpl_id) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "driver info message not present") /* Validate and decode driver information */ - if(H5FD_sb_load(f->shared->lf, drvinfo.name, drvinfo.buf) < 0) + if(H5FD_sb_load(f->shared->lf, drvinfo.name, drvinfo.buf) < 0) { + H5O_msg_reset(H5O_DRVINFO_ID, &drvinfo); HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, FAIL, "unable to decode driver information") + } /* end if */ /* Reset driver info message */ H5O_msg_reset(H5O_DRVINFO_ID, &drvinfo); -- cgit v0.12 From ed380746fe131bf1aeb3d8135c5ff31705312cb0 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 7 Jan 2016 12:45:11 -0500 Subject: [svn-r28837] Merged r28836 from revise_chunks (tarray.c fix). Tested on ostrich w/ gcc --- test/tarray.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/tarray.c b/test/tarray.c index 28798c2..cb5fef9 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -1031,8 +1031,8 @@ test_array_vlen_atomic(void) H5T_class_t mclass; /* Datatype class for VL */ hid_t xfer_pid; /* Dataset transfer property list ID */ hsize_t size; /* Number of bytes which will be used */ - int mem_used=0; /* Memory used during allocation */ - int i,j,k; /* counting variables */ + size_t mem_used=0; /* Memory used during allocation */ + int i,j,k; /* counting variables */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ @@ -1242,8 +1242,8 @@ test_array_vlen_array(void) H5T_class_t mclass; /* Datatype class for VL */ hid_t xfer_pid; /* Dataset transfer property list ID */ hsize_t size; /* Number of bytes which will be used */ - int mem_used=0; /* Memory used during allocation */ - int i,j,k,l; /* Index variables */ + size_t mem_used=0; /* Memory used during allocation */ + int i,j,k,l; /* Index variables */ herr_t ret; /* Generic return value */ /* Output message about test being performed */ -- cgit v0.12 From 74fbe507ae0e69d689409560c37974d92d28ad10 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Thu, 7 Jan 2016 15:27:37 -0500 Subject: [svn-r28841] indentations were messed up by some previous commit. Restored them to more readable spacing. No code change. Test: visual inspection. --- bin/cmakehdf5 | 222 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 111 insertions(+), 111 deletions(-) diff --git a/bin/cmakehdf5 b/bin/cmakehdf5 index 48869cf..6e22e17 100755 --- a/bin/cmakehdf5 +++ b/bin/cmakehdf5 @@ -124,12 +124,12 @@ STEP() echo "$banner" with output saved in $logfile (TIMESTAMP; nerror=0 ; - echo "eval $command" - eval $command || nerror=1 ; - TIMESTAMP; exit $nerror) < /dev/null > "$logfile" 2>&1 + echo "eval $command" + eval $command || nerror=1 ; + TIMESTAMP; exit $nerror) < /dev/null > "$logfile" 2>&1 if [ $? -ne 0 ]; then - echo "error in '$banner'. $progname aborted." - exit 1 + echo "error in '$banner'. $progname aborted." + exit 1 fi } @@ -143,26 +143,26 @@ INSTALL_HDF5() { myos="`uname -s`" case "$myos" in - Linux) - install_file=./HDF5-${version}-Linux.sh - $install_file --skip-license $* - ;; - Darwin) # Mac OSX DMG file - install_file=HDF5-${version}-Darwin.dmg - test -d hdf5 || mkdir hdf5 - basename=`basename $install_file .dmg` - # mount the DMG file as /Volumes/$basename - # echo 'Y' as yes for license. - echo Y | hdiutil mount $install_file - # copy the contents to the install location - cp -R "/Volumes/$basename/HDF_Group" hdf5 - # unmount the DMG file - hdiutil unmount /Volumes/$basename - ;; - *) # unknown/unsupported OS. - echo "INSTALL_HDF5: Error--unknown/unsupported OS($myos)" - return 1 - ;; + Linux) + install_file=./HDF5-${version}-Linux.sh + $install_file --skip-license $* + ;; + Darwin) # Mac OSX DMG file + install_file=HDF5-${version}-Darwin.dmg + test -d hdf5 || mkdir hdf5 + basename=`basename $install_file .dmg` + # mount the DMG file as /Volumes/$basename + # echo 'Y' as yes for license. + echo Y | hdiutil mount $install_file + # copy the contents to the install location + cp -R "/Volumes/$basename/HDF_Group" hdf5 + # unmount the DMG file + hdiutil unmount /Volumes/$basename + ;; + *) # unknown/unsupported OS. + echo "INSTALL_HDF5: Error--unknown/unsupported OS($myos)" + return 1 + ;; esac } @@ -172,14 +172,14 @@ INSTALL_HDF5() DUMP_LOGFILE() { for x in $*; do - if [ -f $x ]; then - echo "==================================" - echo "Dumping $x" - echo "==================================" - cat $x - echo "==== END $x =====" - echo - fi + if [ -f $x ]; then + echo "==================================" + echo "Dumping $x" + echo "==================================" + cat $x + echo "==== END $x =====" + echo + fi done } @@ -207,84 +207,84 @@ fi # tools Build tools while [ $# -gt 0 ]; do case "$1" in - --enable-fortran) - build_fortran=-DHDF5_BUILD_FORTRAN:BOOL=ON - ;; - --disable-fortran) - build_fortran=-DHDF5_BUILD_FORTRAN:BOOL=OFF - ;; - --enable-cxx) - build_cpp_lib=-DHDF5_BUILD_CPP_LIB:BOOL=ON - ;; - --disable-cxx) - build_cpp_lib=-DHDF5_BUILD_CPP_LIB:BOOL=OFF - ;; - --enable-hl) - build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=ON - ;; - --disable-hl) - build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=OFF - ;; - --enable-shared) - shared_lib=-DBUILD_SHARED_LIBS:BOOL=ON - ;; - --disable-shared) - shared_lib=-DBUILD_SHARED_LIBS:BOOL=OFF - ;; - --enable-tools) - build_tools=-DHDF5_BUILD_TOOLS:BOOL=ON - ;; - --disable-tools) - build_tools=-DHDF5_BUILD_TOOLS:BOOL=OFF - ;; - --enable-testing) - build_testing=-DBUILD_TESTING:BOOL=ON - ;; - --disable-testing) - build_testing=-DBUILD_TESTING:BOOL=OFF - ;; - --with-zlib) - with_zlib=-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON - ;; - --with-zlib=*) - xarg=`echo $1 | cut -d= -f2-` - with_zlib="-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON -DZLIB_ROOT=$xarg" - ;; - --without-zlib) - with_zlib=-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF - ;; - --with-szlib) - with_szlib=-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=ON - szlib_path="" # szlib is in default paths - ;; - --with-szlib=*) - xarg=`echo $1 | cut -d= -f2-` - with_szlib="-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=ON" - szlib_path="SZIP_INSTALL=$xarg" - ;; - --without-szlib) - with_szlib=-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF - szlib_path="" # reset the path - ;; - --njobs=*) - njobs=`echo $1 | cut -d= -f2-` - ;; - --enable-verbose) - vflag=1 - ;; - --disable-verbose) - vflag=0 - ;; - --help) - # print the detail help page and exit - HELP - exit 0 - ;; - *) - echo "Unknown options: $1" - HELP - exit 1 - ;; + --enable-fortran) + build_fortran=-DHDF5_BUILD_FORTRAN:BOOL=ON + ;; + --disable-fortran) + build_fortran=-DHDF5_BUILD_FORTRAN:BOOL=OFF + ;; + --enable-cxx) + build_cpp_lib=-DHDF5_BUILD_CPP_LIB:BOOL=ON + ;; + --disable-cxx) + build_cpp_lib=-DHDF5_BUILD_CPP_LIB:BOOL=OFF + ;; + --enable-hl) + build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=ON + ;; + --disable-hl) + build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=OFF + ;; + --enable-shared) + shared_lib=-DBUILD_SHARED_LIBS:BOOL=ON + ;; + --disable-shared) + shared_lib=-DBUILD_SHARED_LIBS:BOOL=OFF + ;; + --enable-tools) + build_tools=-DHDF5_BUILD_TOOLS:BOOL=ON + ;; + --disable-tools) + build_tools=-DHDF5_BUILD_TOOLS:BOOL=OFF + ;; + --enable-testing) + build_testing=-DBUILD_TESTING:BOOL=ON + ;; + --disable-testing) + build_testing=-DBUILD_TESTING:BOOL=OFF + ;; + --with-zlib) + with_zlib=-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON + ;; + --with-zlib=*) + xarg=`echo $1 | cut -d= -f2-` + with_zlib="-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON -DZLIB_ROOT=$xarg" + ;; + --without-zlib) + with_zlib=-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF + ;; + --with-szlib) + with_szlib=-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=ON + szlib_path="" # szlib is in default paths + ;; + --with-szlib=*) + xarg=`echo $1 | cut -d= -f2-` + with_szlib="-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=ON" + szlib_path="SZIP_INSTALL=$xarg" + ;; + --without-szlib) + with_szlib=-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF + szlib_path="" # reset the path + ;; + --njobs=*) + njobs=`echo $1 | cut -d= -f2-` + ;; + --enable-verbose) + vflag=1 + ;; + --disable-verbose) + vflag=0 + ;; + --help) + # print the detail help page and exit + HELP + exit 0 + ;; + *) + echo "Unknown options: $1" + HELP + exit 1 + ;; esac shift done -- cgit v0.12 From 887cf130ff773568f90ec8bae66dafa761a77712 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 8 Jan 2016 09:08:00 -0500 Subject: [svn-r28843] Description: Bump number of records for random update test again. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest forthcoming) --- test/btree2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/btree2.c b/test/btree2.c index 3278b67..2c9bbae 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -38,7 +38,7 @@ const char *FILENAME[] = { #define INSERT_SPLIT_ROOT_NREC 63 #define INSERT_SPLIT_ROOT_NREC_REC 64 #define INSERT_MANY (1000 * 1000) -#define INSERT_MANY_REC (2675 * 1000) +#define INSERT_MANY_REC (2700 * 1000) #define FIND_MANY (INSERT_MANY / 100) #define FIND_MANY_REC (INSERT_MANY_REC / 100) #define FIND_NEIGHBOR 2000 -- cgit v0.12 From 67570ce476f334fdafc01a89796808264ab8e6c4 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Mon, 11 Jan 2016 11:16:38 -0500 Subject: [svn-r28853] HDFFV-9649: cmakehdf5 needs a proper implementation to verify the installation images created for Mac OSX. The current implementation for Mac OSX platform is a kludge that sometimes left behind mounted volumes. Temporary screen out the checking of installtion_check step (so that daily test may pass). Tested: by hand running cmakehdf5 in platypus and osx1010test. --- bin/cmakehdf5 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/bin/cmakehdf5 b/bin/cmakehdf5 index 6e22e17..7d9caa8 100755 --- a/bin/cmakehdf5 +++ b/bin/cmakehdf5 @@ -148,6 +148,10 @@ INSTALL_HDF5() $install_file --skip-license $* ;; Darwin) # Mac OSX DMG file + # These steps were a kludge. Need proper support from Cmake engineering. + echo Darwin install step needs proper implementation. Quit. + return 1 + # install_file=HDF5-${version}-Darwin.dmg test -d hdf5 || mkdir hdf5 basename=`basename $install_file .dmg` @@ -313,8 +317,8 @@ fi # setup output of all the log files if verbose is on upon exit trap \ -"if [ $vflag -ne 0 ]; then DUMP_LOGFILE \$configlog \$makelog \$testlog \$packlog \$installlog; fi" \ -0 + "if [ $vflag -ne 0 ]; then DUMP_LOGFILE \$configlog \$makelog \$testlog \$packlog \$installlog; fi" \ + 0 echo Running Cmake for HDF5-${version} ... # 4. Configure the C library, tools and tests with this command: @@ -343,8 +347,13 @@ STEP "Test the library and tools..." "ctest . -C Release $njobs" $testlog # 7. Create an install image with this command: STEP "Create an install image..." "cpack -C Release CPackConfig.cmake" $packlog +# The implementation of installation is imcomplete (only works for linux). +# Screen it out for now till it is completed. +if false; then # 8. Install with this command: STEP "Install..." "INSTALL_HDF5" $installlog +fi + # save the last exit code exit_code=$? -- cgit v0.12 From 2396a172adc0fca7ad56fe6bd89276903dc8af44 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 12 Jan 2016 07:28:39 -0500 Subject: [svn-r28861] Minor warning format string fix (HDFFV-9640). Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools parallel only (MPICH 3.1.4) --- src/H5Eprivate.h | 2 +- test/error_test.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index ba17ada..db413e3 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -125,7 +125,7 @@ extern int H5E_mpi_error_str_len; #define HMPI_ERROR(mpierr){ \ MPI_Error_string(mpierr, H5E_mpi_error_str, &H5E_mpi_error_str_len); \ - HERROR(H5E_INTERNAL, H5E_MPIERRSTR, H5E_mpi_error_str); \ + HERROR(H5E_INTERNAL, H5E_MPIERRSTR, "%s", H5E_mpi_error_str); \ } #define HMPI_DONE_ERROR(retcode, str, mpierr){ \ HMPI_ERROR(mpierr); \ diff --git a/test/error_test.c b/test/error_test.c index 4e4c0ef..ee181b1 100644 --- a/test/error_test.c +++ b/test/error_test.c @@ -498,7 +498,7 @@ test_create(void) if(err_num != 0) TEST_ERROR /* Push an error with a long description */ - if(H5Epush(estack_id, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, err_msg) < 0) TEST_ERROR; + if(H5Epush(estack_id, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s", err_msg) < 0) TEST_ERROR; /* Check the number of errors on stack */ err_num = H5Eget_num(estack_id); @@ -543,7 +543,7 @@ test_copy(void) herr_t ret; /* Generic return value */ /* Push an error with a long description */ - if(H5Epush(H5E_DEFAULT, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, err_msg) < 0) TEST_ERROR; + if(H5Epush(H5E_DEFAULT, __FILE__, err_func, __LINE__, ERR_CLS, ERR_MAJ_TEST, ERR_MIN_SUBROUTINE, "%s", err_msg) < 0) TEST_ERROR; /* Check the number of errors on stack */ err_num = H5Eget_num(H5E_DEFAULT); -- cgit v0.12 From 24443da31663e4f0835e8b966470aff6dfb4f0c9 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 12 Jan 2016 15:31:59 -0500 Subject: [svn-r28865] HDFFV-9639: Fix double-free error by setting freed var to NULL. Verified issue with "h5dump tgroup.h5 non_existing.h5" Applied patch and retested. --- tools/h5dump/CMakeTests.cmake | 39 ++++++++++++--------- tools/h5dump/errfiles/non_existing.err | 1 + tools/h5dump/h5dump.c | 64 +++++++++++++++++++--------------- tools/testfiles/non_existing.ddl | 31 ++++++++++++++++ 4 files changed, 91 insertions(+), 44 deletions(-) create mode 100644 tools/h5dump/errfiles/non_existing.err create mode 100644 tools/testfiles/non_existing.ddl diff --git a/tools/h5dump/CMakeTests.cmake b/tools/h5dump/CMakeTests.cmake index 00ec760..c256e11 100644 --- a/tools/h5dump/CMakeTests.cmake +++ b/tools/h5dump/CMakeTests.cmake @@ -4,7 +4,7 @@ ### T E S T I N G ### ############################################################################## ############################################################################## - + # -------------------------------------------------------------------- # Copy all the HDF5 files from the test directory into the source directory # -------------------------------------------------------------------- @@ -12,6 +12,7 @@ ${HDF5_TOOLS_SRC_DIR}/testfiles/charsets.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/file_space.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/filter_fail.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/non_existing.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/packedbits.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tall-1.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tall-2.ddl @@ -284,6 +285,7 @@ ) set (HDF5_ERROR_REFERENCE_TEST_FILES ${PROJECT_SOURCE_DIR}/errfiles/filter_fail.err + ${PROJECT_SOURCE_DIR}/errfiles/non_existing.err ${PROJECT_SOURCE_DIR}/errfiles/tall-1.err ${PROJECT_SOURCE_DIR}/errfiles/tall-2A.err ${PROJECT_SOURCE_DIR}/errfiles/tall-2A0.err @@ -325,7 +327,7 @@ ARGS -E copy_if_different ${tst_h5_file} ${dest} ) endforeach (tst_h5_file ${HDF5_REFERENCE_TEST_FILES}) - + foreach (tst_exp_file ${HDF5_REFERENCE_EXP_FILES}) if (WIN32) file (READ ${HDF5_TOOLS_SRC_DIR}/testfiles/${tst_exp_file} TEST_STREAM) @@ -373,7 +375,7 @@ COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${HDF5_TOOLS_SOURCE_DIR}/testfiles/tbin1.ddl ${PROJECT_BINARY_DIR}/testfiles/std/tbin1LE.ddl ) - + if (WIN32) file (READ ${HDF5_TOOLS_SRC_DIR}/testfiles/tbinregR.exp TEST_STREAM) file (WRITE ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp "${TEST_STREAM}") @@ -385,7 +387,7 @@ ARGS -E copy_if_different ${HDF5_TOOLS_SRC_DIR}/testfiles/tbinregR.exp ${PROJECT_BINARY_DIR}/testfiles/std/tbinregR.exp ) endif (WIN32) - + ############################################################################## ############################################################################## ### T H E T E S T S M A C R O S ### @@ -730,7 +732,7 @@ add_test ( NAME H5DUMP-clearall-objects COMMAND ${CMAKE_COMMAND} - -E remove + -E remove h5dump-help.out charsets.out charsets.out.err @@ -738,6 +740,8 @@ file_space.out.err filter_fail.out filter_fail.out.err + non_existing.out + non_existing.out.err packedbits.out packedbits.out.err tall-1.out @@ -1075,9 +1079,9 @@ ADD_H5_TEST_EXPORT (trawdatafile packedbits.h5 0 --enable-error-stack -y -o) ADD_H5_TEST_EXPORT (tnoddlfile packedbits.h5 0 --enable-error-stack -O -y -o) ADD_H5_TEST_EXPORT (trawssetfile tdset.h5 0 --enable-error-stack -d "/dset1[1,1;;;]" -y -o) - + ADD_H5_TEST_EXPORT_DDL (twithddlfile packedbits.h5 0 twithddl --enable-error-stack --ddl=twithddl.txt -y -o) - + # test for maximum display datasets ADD_H5_TEST (twidedisplay 0 --enable-error-stack -w0 packedbits.h5) @@ -1147,7 +1151,7 @@ # test for named data types ADD_H5_TEST (tcomp-2 0 --enable-error-stack -t /type1 --datatype /type2 --datatype=/group1/type3 tcompound.h5) ADD_H5_TEST_N (tcomp-2 0 --enable-error-stack -N /type1 --any_path /type2 --any_path=/group1/type3 tcompound.h5) - # test for unamed type + # test for unamed type ADD_H5ERR_MASK_TEST (tcomp-3 0 "--enable-error-stack;-t;/#6632;-g;/group2;tcompound.h5") # test complicated compound datatype ADD_H5_TEST (tcomp-4 0 --enable-error-stack tcompound_complex.h5) @@ -1169,7 +1173,7 @@ # test for loop detection ADD_H5_TEST (tloop-1 0 --enable-error-stack tloop.h5) - # test for string + # test for string ADD_H5_TEST (tstr-1 0 --enable-error-stack tstr.h5) ADD_H5_TEST (tstr-2 0 --enable-error-stack tstr2.h5) @@ -1202,7 +1206,7 @@ #ADD_H5_MASK_TEST (tstarfile 0 --enable-error-stack -H -d Dataset1 tarr*.h5) #ADD_H5_MASK_TEST (tqmarkfile 0 --enable-error-stack -H -d Dataset1 tarray?.h5) ADD_H5_TEST (tmultifile 0 --enable-error-stack -H -d Dataset1 tarray2.h5 tarray3.h5 tarray4.h5 tarray5.h5 tarray6.h5 tarray7.h5) - + # test for files with empty data ADD_H5_TEST (tempty 0 --enable-error-stack tempty.h5) @@ -1263,7 +1267,7 @@ ADD_H5_TEST (tcontiguos 0 --enable-error-stack -H -p -d contiguous tfilters.h5) # chunked ADD_H5_TEST (tchunked 0 --enable-error-stack -H -p -d chunked tfilters.h5) - # external + # external ADD_H5_TEST (texternal 0 --enable-error-stack -H -p -d external tfilters.h5) # fill values @@ -1331,7 +1335,7 @@ # don't have). Do this by searching H5pubconf.h to see which # filters are defined. -# detect whether the encoder is present. +# detect whether the encoder is present. if (H5_HAVE_FILTER_DEFLATE) set (USE_FILTER_DEFLATE "true") endif (H5_HAVE_FILTER_DEFLATE) @@ -1352,12 +1356,12 @@ # test for displaying objects with very long names ADD_H5_TEST (tlonglinks 0 --enable-error-stack tlonglinks.h5) - # dimensions over 4GB, print boundary + # dimensions over 4GB, print boundary ADD_H5_TEST (tbigdims 0 --enable-error-stack -d dset4gb -s 4294967284 -c 22 tbigdims.h5) # hyperslab read ADD_H5_TEST (thyperslab 0 --enable-error-stack thyperslab.h5) - + # test for displaying dataset and attribute of null space ADD_H5_TEST (tnullspace 0 --enable-error-stack tnullspace.h5) @@ -1391,7 +1395,7 @@ ADD_H5_TEST (tbin4 0 --enable-error-stack -d double -b FILE -o tbin4.bin tbinary.h5) endif (NOT HDF5_ENABLE_USING_MEMCHECKER) - # test for dataset region references + # test for dataset region references ADD_H5_TEST (tdatareg 0 --enable-error-stack tdatareg.h5) ADD_H5ERR_MASK_TEST (tdataregR 0 --enable-error-stack -R tdatareg.h5) ADD_H5ERR_MASK_TEST (tattrregR 0 -R --enable-error-stack tattrreg.h5) @@ -1414,7 +1418,7 @@ # tests for link references and order ADD_H5ERR_MASK_TEST (torderlinks1 0 --enable-error-stack --sort_by=name --sort_order=ascending tfcontents1.h5) ADD_H5ERR_MASK_TEST (torderlinks2 0 --enable-error-stack --sort_by=name --sort_order=descending tfcontents1.h5) - + # tests for floating point user defined printf format ADD_H5_TEST (tfpformat 0 --enable-error-stack -m %.7f tfpformat.h5) @@ -1430,3 +1434,6 @@ # test for -o -y for dataset with attributes ADD_H5_TEST_EXPORT (tall-6 tall.h5 0 --enable-error-stack -d /g1/g1.1/dset1.1.1 -y -o) + + # test for non-existing file + ADD_H5_TEST (non_existing 1 --enable-error-stack tgroup.h5 non_existing.h5) diff --git a/tools/h5dump/errfiles/non_existing.err b/tools/h5dump/errfiles/non_existing.err new file mode 100644 index 0000000..f7e3afa --- /dev/null +++ b/tools/h5dump/errfiles/non_existing.err @@ -0,0 +1 @@ +h5dump error: unable to open file "non_existing.h5" diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 68889c9..ffba581 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -620,7 +620,7 @@ parse_hsize_list(const char *h_list, subset_d *d) size_count++; last_digit = 1; - } + } else { last_digit = 0; } @@ -643,7 +643,7 @@ parse_hsize_list(const char *h_list, subset_d *d) } d->data = p_list; d->len = size_count; - + return; } @@ -705,7 +705,7 @@ parse_subset_params(char *dset) * * Purpose: Parse a list of comma or space separated integers and fill * the packed_bits list and counter. The string being passed into this function - * should be at the start of the list you want to parse. + * should be at the start of the list you want to parse. * * Return: Success: SUCCEED * @@ -831,7 +831,7 @@ static void free_handler(struct handler_t *hand, int len) { int i; - + if(hand) { for (i = 0; i < len; i++) { if(hand[i].obj) { @@ -1161,7 +1161,7 @@ parse_start: } if (HDstrcmp(opt_arg,":") == 0) { xmlnsprefix = ""; - } + } else { xmlnsprefix = opt_arg; } @@ -1187,7 +1187,7 @@ parse_start: * the two. */ s = last_dset->subset_info; - } + } else { last_dset->subset_info = s = (struct subset_t *)HDcalloc(1, sizeof(struct subset_t)); } @@ -1358,7 +1358,7 @@ main(int argc, const char *argv[]) /* Disable tools error reporting */ H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata); H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL); - + if((hand = parse_command_line(argc, argv))==NULL) { goto done; } @@ -1444,12 +1444,12 @@ main(int argc, const char *argv[]) if (xml_dtd_uri == NULL) { if (useschema) { xml_dtd_uri = DEFAULT_XSD; - } + } else { xml_dtd_uri = DEFAULT_DTD; xmlnsprefix = ""; } - } + } else { if (useschema && HDstrcmp(xmlnsprefix,"")) { error_msg("Cannot set Schema URL for a qualified namespace--use -X or -U option with -D \n"); @@ -1486,7 +1486,7 @@ main(int argc, const char *argv[]) /* start to dump - display file header information */ if (!doxml) { begin_obj(h5tools_dump_header_format->filebegin, fname, h5tools_dump_header_format->fileblockbegin); - } + } else { PRINTVALSTREAM(rawoutstream, "\n"); @@ -1495,7 +1495,7 @@ main(int argc, const char *argv[]) if (HDstrcmp(xmlnsprefix,"") == 0) { PRINTSTREAM(rawoutstream, "\n", xml_dtd_uri); - } + } else { /* TO DO: make -url option work in this case (may need new option) */ char *ns; @@ -1511,7 +1511,7 @@ main(int argc, const char *argv[]) "http://www.hdfgroup.org/HDF5/XML/schema/HDF5-File.xsd\">\n",xmlnsprefix,ns); HDfree(ns); } - } + } else { PRINTSTREAM(rawoutstream, "\n", xml_dtd_uri); PRINTVALSTREAM(rawoutstream, "\n"); @@ -1570,7 +1570,7 @@ main(int argc, const char *argv[]) if (!doxml) { end_obj(h5tools_dump_header_format->fileend, h5tools_dump_header_format->fileblockend); PRINTVALSTREAM(rawoutstream, "\n"); - } + } else { PRINTSTREAM(rawoutstream, "\n", xmlnsprefix); } @@ -1581,13 +1581,17 @@ main(int argc, const char *argv[]) if (H5Fclose(fid) < 0) h5tools_setstatus(EXIT_FAILURE); - if(prefix) + if(prefix) { HDfree(prefix); - if(fname) + prefix = NULL; + } + if(fname) { HDfree(fname); + fname = NULL; + } } /* end while */ - if(hand) + if(hand) free_handler(hand, argc); /* To Do: clean up XML table */ @@ -1601,13 +1605,17 @@ done: if(fid >=0) if (H5Fclose(fid) < 0) h5tools_setstatus(EXIT_FAILURE); - - if(prefix) + + if(prefix) { HDfree(prefix); - if(fname) + prefix = NULL; + } + if(fname) { HDfree(fname); + fname = NULL; + } - if(hand) + if(hand) free_handler(hand, argc); /* To Do: clean up XML table */ @@ -1660,20 +1668,20 @@ h5_fileaccess(void) if (!HDstrcmp(name, "sec2")) { /* Unix read() and write() system calls */ if (H5Pset_fapl_sec2(fapl)<0) return -1; - } + } else if (!HDstrcmp(name, "stdio")) { /* Standard C fread() and fwrite() system calls */ if (H5Pset_fapl_stdio(fapl)<0) return -1; - } + } else if (!HDstrcmp(name, "core")) { /* In-core temporary file with 1MB increment */ if (H5Pset_fapl_core(fapl, 1024*1024, FALSE)<0) return -1; - } + } else if (!HDstrcmp(name, "split")) { /* Split meta data and raw data each using default driver */ if (H5Pset_fapl_split(fapl, "-m.h5", H5P_DEFAULT, "-r.h5", H5P_DEFAULT) < 0) return -1; - } + } else if (!HDstrcmp(name, "multi")) { /* Multi-file driver, general case of the split driver */ H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; @@ -1699,7 +1707,7 @@ h5_fileaccess(void) if (H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0) return -1; - } + } else if (!HDstrcmp(name, "family")) { hsize_t fam_size = 100*1024*1024; /*100 MB*/ @@ -1708,7 +1716,7 @@ h5_fileaccess(void) fam_size = (hsize_t)(HDstrtod(val, NULL) * 1024*1024); if (H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT)<0) return -1; - } + } else if (!HDstrcmp(name, "log")) { long log_flags = H5FD_LOG_LOC_IO; @@ -1718,12 +1726,12 @@ h5_fileaccess(void) if (H5Pset_fapl_log(fapl, NULL, (unsigned)log_flags, 0) < 0) return -1; - } + } else if (!HDstrcmp(name, "direct")) { /* Substitute Direct I/O driver with sec2 driver temporarily because * some output has sec2 driver as the standard. */ if (H5Pset_fapl_sec2(fapl)<0) return -1; - } + } else { /* Unknown driver */ return -1; diff --git a/tools/testfiles/non_existing.ddl b/tools/testfiles/non_existing.ddl new file mode 100644 index 0000000..4377f8d --- /dev/null +++ b/tools/testfiles/non_existing.ddl @@ -0,0 +1,31 @@ +HDF5 "tgroup.h5" { +GROUP "/" { + GROUP "g1" { + GROUP "g1.1" { + } + GROUP "g1.2" { + } + } + GROUP "g2" { + GROUP "g2.1" { + GROUP "g2.1.1" { + } + GROUP "g2.1.2" { + } + GROUP "g2.1.3" { + } + } + } + GROUP "g3" { + GROUP "g3.1" { + } + GROUP "g3.2" { + } + GROUP "g3.3" { + } + GROUP "g3.4" { + } + } +} +} +h5dump error: unable to open file "non_existing.h5" -- cgit v0.12 From af88e57c263e2361a9bf084338ea463abf6dcbc4 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 12 Jan 2016 15:38:20 -0500 Subject: [svn-r28866] HDFFV-9639: new files --- MANIFEST | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MANIFEST b/MANIFEST index 3923060..d741018 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1363,6 +1363,7 @@ ./tools/testfiles/filter_fail.h5 ./tools/testfiles/filter_fail.ddl ./tools/testfiles/h5dump-help.txt +./tools/testfiles/non_existing.ddl ./tools/testfiles/packedbits.ddl ./tools/testfiles/taindices.h5 ./tools/testfiles/tall-1.ddl @@ -1619,6 +1620,7 @@ # h5dump test error files ./tools/h5dump/errfiles/filter_fail.err +./tools/h5dump/errfiles/non_existing.err ./tools/h5dump/errfiles/tall-1.err ./tools/h5dump/errfiles/tall-2A.err ./tools/h5dump/errfiles/tall-2A0.err -- cgit v0.12 From 0115366eee8364b2f433725026553ebc58678937 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 12 Jan 2016 15:48:23 -0500 Subject: [svn-r28868] HDFFV-9639: autotools script update --- tools/h5dump/testh5dump.sh.in | 65 +++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 95f8091..8be1745 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -27,10 +27,10 @@ EXIT_FAILURE=1 DUMPER=h5dump # The tool name DUMPER_BIN=`pwd`/$DUMPER # The path of the tool binary -H5DIFF=../h5diff/h5diff # The h5diff tool name +H5DIFF=../h5diff/h5diff # The h5diff tool name H5DIFF_BIN=`pwd`/$H5DIFF # The path of the h5diff tool binary -H5IMPORT=../h5import/h5import # The h5import tool name +H5IMPORT=../h5import/h5import # The h5import tool name H5IMPORT_BIN=`pwd`/$H5IMPORT # The path of the h5import tool binary RM='rm -rf' @@ -176,6 +176,7 @@ LIST_OTHER_TEST_FILES=" $SRC_H5DUMP_TESTFILES/charsets.ddl $SRC_H5DUMP_TESTFILES/file_space.ddl $SRC_H5DUMP_TESTFILES/filter_fail.ddl +$SRC_H5DUMP_TESTFILES/non_existing.ddl $SRC_H5DUMP_TESTFILES/packedbits.ddl $SRC_H5DUMP_TESTFILES/tall-1.ddl $SRC_H5DUMP_TESTFILES/tall-2.ddl @@ -266,7 +267,7 @@ $SRC_H5DUMP_TESTFILES/tindicessub4.ddl $SRC_H5DUMP_TESTFILES/tindicesyes.ddl $SRC_H5DUMP_TESTFILES/tintsattrs.ddl $SRC_H5DUMP_TESTFILES/tlarge_objname.ddl -#$SRC_H5DUMP_TESTFILES/tldouble.ddl +#$SRC_H5DUMP_TESTFILES/tldouble.ddl $SRC_H5DUMP_TESTFILES/tlonglinks.ddl $SRC_H5DUMP_TESTFILES/tloop-1.ddl $SRC_H5DUMP_TESTFILES/tmulti.ddl @@ -347,6 +348,7 @@ $SRC_H5DUMP_TESTFILES/tbinregR.exp LIST_ERROR_TEST_FILES=" ${SRC_H5DUMP_ERRORFILES}/filter_fail.err +${SRC_H5DUMP_ERRORFILES}/non_existing.err ${SRC_H5DUMP_ERRORFILES}/tall-1.err ${SRC_H5DUMP_ERRORFILES}/tall-2A.err ${SRC_H5DUMP_ERRORFILES}/tall-2A0.err @@ -393,10 +395,10 @@ COPY_TESTFILES_TO_TESTDIR() INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $CP -f $tstfile $TESTDIR + $CP -f $tstfile $TESTDIR if [ $? -ne 0 ]; then echo "Error: FAILED to copy $tstfile ." - + # Comment out this to CREATE expected file exit $EXIT_FAILURE fi @@ -441,14 +443,14 @@ TESTING() { TOOLTEST() { # check if caseless compare and diff requested if [ "$1" = ignorecase ]; then - caseless="-i" - # replace cmp with diff which runs much longer. - xCMP="$DIFF -i" - shift + caseless="-i" + # replace cmp with diff which runs much longer. + xCMP="$DIFF -i" + shift else - caseless="" - # stick with faster cmp if ignorecase is not requested. - xCMP="$CMP" + caseless="" + # stick with faster cmp if ignorecase is not requested. + xCMP="$CMP" fi expect="$TESTDIR/$1" @@ -537,7 +539,7 @@ TOOLTEST2() { nerrors="`expr $nerrors + 1`" test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' fi - + # Clean up output file if test -z "$HDF5_NOCLEANUP"; then rm -f $actual $actualdata $actual_err @@ -545,7 +547,7 @@ TOOLTEST2() { } -# same as TOOLTEST2 but compares generated file to expected ddl file +# same as TOOLTEST2 but compares generated file to expected ddl file # and compares the generated data file to the expected data file # used for the binary tests that expect a full path in -o without -b # ADD_H5_TEST_EXPORT @@ -603,7 +605,7 @@ TOOLTEST2A() { nerrors="`expr $nerrors + 1`" test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' fi - + # Clean up output file if test -z "$HDF5_NOCLEANUP"; then rm -f $actual $actualdata $actual_err $actualmeta @@ -642,7 +644,7 @@ TOOLTEST2B() { nerrors="`expr $nerrors + 1`" test yes = "$verbose" && $DIFF $expectdata $actualdata |sed 's/^/ /' fi - + # Clean up output file if test -z "$HDF5_NOCLEANUP"; then rm -f $actual $actualdata $actual_err @@ -859,7 +861,7 @@ TOOLTEST_HELP() { echo " Expected output (*.txt) differs from actual output (*.out)" nerrors="`expr $nerrors + 1`" fi - + # Clean up output file if test -z "$HDF5_NOCLEANUP"; then rm -f $actual $actual_err @@ -872,7 +874,7 @@ SKIP() { TESTING $DUMPER $@ echo " -SKIP-" } - + # Print a line-line message left justified in a field of 70 characters # PRINT_H5DIFF() { @@ -883,7 +885,7 @@ PRINT_H5DIFF() { # Call the h5diff tool # -DIFFTEST() +DIFFTEST() { PRINT_H5DIFF $@ ( @@ -897,7 +899,7 @@ DIFFTEST() else echo " PASSED" fi - + } # Print a line-line message left justified in a field of 70 characters @@ -910,7 +912,7 @@ PRINT_H5IMPORT() { # Call the h5import tool # -IMPORTTEST() +IMPORTTEST() { # remove the output hdf5 file if it exists hdf5_file="$TESTDIR/$5" @@ -921,7 +923,7 @@ IMPORTTEST() PRINT_H5IMPORT $@ ( cd $TESTDIR - $RUNSERIAL $H5IMPORT_BIN "$@" + $RUNSERIAL $H5IMPORT_BIN "$@" ) RET=$? if [ $RET != 0 ] ; then @@ -930,7 +932,7 @@ IMPORTTEST() else echo " PASSED" fi - + } @@ -1021,7 +1023,7 @@ TOOLTEST tcomp-1.ddl --enable-error-stack tcompound.h5 # test for named data types TOOLTEST tcomp-2.ddl --enable-error-stack -t /type1 --datatype /type2 --datatype=/group1/type3 tcompound.h5 TOOLTEST tcomp-2.ddl --enable-error-stack -N /type1 --any_path /type2 --any_path=/group1/type3 tcompound.h5 -# test for unamed type +# test for unamed type TOOLTEST4 tcomp-3.ddl --enable-error-stack -t /#6632 -g /group2 tcompound.h5 # test complicated compound datatype TOOLTEST tcomp-4.ddl --enable-error-stack tcompound_complex.h5 @@ -1041,7 +1043,7 @@ TOOLTEST tall-7N.ddl --enable-error-stack -N attr1 tall.h5 # test for loop detection TOOLTEST tloop-1.ddl --enable-error-stack tloop.h5 -# test for string +# test for string TOOLTEST tstr-1.ddl --enable-error-stack tstr.h5 TOOLTEST tstr-2.ddl --enable-error-stack tstr2.h5 @@ -1136,7 +1138,7 @@ TOOLTEST tcompact.ddl --enable-error-stack -H -p -d compact tfilters.h5 TOOLTEST tcontiguos.ddl --enable-error-stack -H -p -d contiguous tfilters.h5 # chunked TOOLTEST tchunked.ddl --enable-error-stack -H -p -d chunked tfilters.h5 -# external +# external TOOLTEST texternal.ddl --enable-error-stack -H -p -d external tfilters.h5 # fill values @@ -1205,7 +1207,7 @@ fi # test for displaying objects with very long names TOOLTEST tlonglinks.ddl --enable-error-stack tlonglinks.h5 -# dimensions over 4GB, print boundary +# dimensions over 4GB, print boundary TOOLTEST tbigdims.ddl --enable-error-stack -d dset4gb -s 4294967284 -c 22 tbigdims.h5 # hyperslab read @@ -1213,7 +1215,7 @@ TOOLTEST thyperslab.ddl --enable-error-stack thyperslab.h5 # - + # test for displaying dataset and attribute of null space TOOLTEST tnullspace.ddl --enable-error-stack tnullspace.h5 @@ -1252,7 +1254,7 @@ IMPORTTEST out3.bin -c tbin3.ddl -o out3D.h5 DIFFTEST tbinary.h5 out3D.h5 /integer /integer TOOLTEST tbin4.ddl --enable-error-stack -d double -b FILE -o out4.bin tbinary.h5 - + # Clean up binary output files if test -z "$HDF5_NOCLEANUP"; then rm -f out[1-4].bin @@ -1260,7 +1262,7 @@ if test -z "$HDF5_NOCLEANUP"; then rm -f out3.h5 fi -# test for dataset region references +# test for dataset region references TOOLTEST tdatareg.ddl --enable-error-stack tdatareg.h5 TOOLTEST4 tdataregR.ddl --enable-error-stack -R tdatareg.h5 TOOLTEST tattrreg.ddl --enable-error-stack tattrreg.h5 @@ -1306,6 +1308,9 @@ TOOLTEST5 filter_fail.ddl --enable-error-stack filter_fail.h5 # test for -o -y for dataset with attributes TOOLTEST2 tall-6.exp --enable-error-stack -y -o tall-6.txt -d /g1/g1.1/dset1.1.1 tall.h5 +# test for non-existing file +TOOLTEST5 non_existing.ddl --enable-error-stack tgroup.h5 non_existing.h5 + # Clean up temporary files/directories CLEAN_TESTFILES_AND_TESTDIR -- cgit v0.12 From 1617502f5e643e38479f8ad106b0a92d36cc8695 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 13 Jan 2016 11:10:19 -0500 Subject: [svn-r28878] Removed some duplicated comment lines from configure.ac. Tested on: N/A --- configure.ac | 3 --- 1 file changed, 3 deletions(-) diff --git a/configure.ac b/configure.ac index 9c1d5b0..b1c26a2 100644 --- a/configure.ac +++ b/configure.ac @@ -2284,9 +2284,6 @@ fi ## ---------------------------------------------------------------------- ## Check if Direct I/O driver is enabled by --enable-direct-vfd ## -## ---------------------------------------------------------------------- -## Check if Direct I/O driver is enabled by --enable-direct-vfd -## AC_CACHE_VAL([hdf5_cv_direct_io], AC_CHECK_DECL([O_DIRECT], [hdf5_cv_direct_io=yes], [hdf5_cv_direct_io=no], [[#include ]])) AC_CACHE_VAL([hdf5_cv_posix_memalign], -- cgit v0.12 From b29d6174e17ddad6482f80c3da477ce9074487b1 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 13 Jan 2016 11:25:11 -0500 Subject: [svn-r28881] Merged r28880 from revise_chunks. Adds a script to flip maint mode. Tested on: linux VM --- MANIFEST | 1 + bin/switch_maint_mode | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100755 bin/switch_maint_mode diff --git a/MANIFEST b/MANIFEST index d741018..4899ab2 100644 --- a/MANIFEST +++ b/MANIFEST @@ -66,6 +66,7 @@ ./bin/runtest _DO_NOT_DISTRIBUTE_ ./bin/snapshot ./bin/snapshot_version _DO_NOT_DISTRIBUTE_ +./bin/switch_maint_mode _DO_NOT_DISTRIBUTE_ ./bin/timekeeper _DO_NOT_DISTRIBUTE_ ./bin/trace ./bin/yodconfigure diff --git a/bin/switch_maint_mode b/bin/switch_maint_mode new file mode 100755 index 0000000..2b62545 --- /dev/null +++ b/bin/switch_maint_mode @@ -0,0 +1,83 @@ +#!/bin/sh +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# +# Switch AM_MAINTAINER_MODE value in configure.ac +# Usage: See USAGE() +# Programmer: Dana Robinson +# Creation date: January 2016 + +USAGE() +{ +cat < + +EOF +} + +MODE="notset" +CONFIG_AC_PATH= + +# Display help/usage if any options were passed in +while [ $# -gt 0 ]; do + case "$1" in + -enable) + MODE="enable" + ;; + -disable) + MODE="disable" + ;; + -help) + USAGE + exit 0 + ;; + *) + CONFIG_AC_PATH="$1" + ;; + esac + shift +done + +# Did we get a file path? +if test -z $CONFIG_AC_PATH ; then + USAGE + exit 1 +fi + +# Did we get a mode? +if test -z $MODE ; then + USAGE + exit 1 +fi + +# Run perl over configure.ac +if test "X-$MODE" = "X-enable" ; then + perl -pi -e 's/^(AM_MAINTAINER_MODE\(\[)([a-z]+)(\]\))/$1enable$3/g' $CONFIG_AC_PATH +fi +if test "X-$MODE" = "X-disable" ; then + perl -pi -e 's/^(AM_MAINTAINER_MODE\(\[)([a-z]+)(\]\))/$1disable$3/g' $CONFIG_AC_PATH +fi + -- cgit v0.12 From 94d03fd874817c9245785b1cfac88457a30a7615 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 13 Jan 2016 12:24:20 -0500 Subject: [svn-r28885] Change TOOLTEST5 to TOOLTEST3, which does not post-process the files. --- tools/h5dump/testh5dump.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 8be1745..267ac44 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -1309,7 +1309,7 @@ TOOLTEST5 filter_fail.ddl --enable-error-stack filter_fail.h5 TOOLTEST2 tall-6.exp --enable-error-stack -y -o tall-6.txt -d /g1/g1.1/dset1.1.1 tall.h5 # test for non-existing file -TOOLTEST5 non_existing.ddl --enable-error-stack tgroup.h5 non_existing.h5 +TOOLTEST3 non_existing.ddl --enable-error-stack tgroup.h5 non_existing.h5 # Clean up temporary files/directories CLEAN_TESTFILES_AND_TESTDIR -- cgit v0.12 From bd44db8a3c39427c7e969f788d344f36bd4b7193 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 13 Jan 2016 23:29:58 -0500 Subject: [svn-r28894] Description: Normalize against changes on phdf5_metadata_opt branch to trunk Tested on: MacoSX/64 10.11.2 (amazon) w/serial & parallel (h5committest forthcoming) --- src/H5A.c | 57 ++++++++++++++------- src/H5AC.c | 28 +++++------ src/H5ACmpio.c | 42 ++++++++-------- src/H5C.c | 145 ++++++++++++++---------------------------------------- src/H5D.c | 9 ++-- src/H5F.c | 10 ++-- src/H5FDmpio.c | 3 +- src/H5Fpublic.h | 22 ++++++--- src/H5G.c | 22 ++++++--- src/H5L.c | 56 ++++++++++++++------- src/H5Lexternal.c | 3 +- src/H5O.c | 26 ++++++---- src/H5Pint.c | 2 +- src/H5Tcommit.c | 8 +-- 14 files changed, 214 insertions(+), 219 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index 7d87505..97d082c 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -252,6 +252,7 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, H5G_loc_t loc; /* Object location */ H5T_t *type; /* Datatype to use for attribute */ H5S_t *space; /* Dataspace to use for attribute */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -271,8 +272,8 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") - /* Go do the real work for attaching the attribute to the dataset */ - if(NULL == (attr = H5A_create(&loc, attr_name, type, space, acpl_id, H5AC_dxpl_id))) + /* Go do the real work for attaching the attribute to the object */ + if(NULL == (attr = H5A_create(&loc, attr_name, type, space, acpl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute") /* Register the new attribute and get an ID for it */ @@ -331,6 +332,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ H5T_t *type; /* Datatype to use for attribute */ H5S_t *space; /* Dataspace to use for attribute */ + hid_t dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -359,12 +361,14 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5G_loc_reset(&obj_loc); /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + dxpl_id = H5AC_ind_dxpl_id; + if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; /* Go do the real work for attaching the attribute to the dataset */ - if(NULL == (attr = H5A_create(&obj_loc, attr_name, type, space, acpl_id, H5AC_dxpl_id))) + dxpl_id = H5AC_dxpl_id; + if(NULL == (attr = H5A_create(&obj_loc, attr_name, type, space, acpl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute") /* Register the new attribute and get an ID for it */ @@ -405,6 +409,7 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t H5_ATTR_UNUSED aapl_id) { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -419,7 +424,7 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t H5_ATTR_UNUSED aapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Read in attribute from object header */ - if(NULL == (attr = H5O_attr_open_by_name(loc.oloc, attr_name, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5O_attr_open_by_name(loc.oloc, attr_name, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to load attribute info from object header for attribute: '%s'", attr_name) /* Finish initializing attribute */ @@ -467,6 +472,7 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -488,7 +494,7 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Open the attribute on the object header */ - if(NULL == (attr = H5A_open_by_name(&loc, obj_name, attr_name, lapl_id, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5A_open_by_name(&loc, obj_name, attr_name, lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") /* Register the attribute and get an ID for it */ @@ -535,6 +541,7 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5A_t *attr = NULL; /* Attribute opened */ H5G_loc_t loc; /* Object location */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -559,7 +566,7 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Open the attribute in the object header */ - if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open attribute") /* Register the attribute and get an ID for it */ @@ -867,6 +874,7 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute object for name */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -891,7 +899,7 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Open the attribute on the object header */ - if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") /* Get the length of the name */ @@ -1005,6 +1013,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute object for name */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1028,7 +1037,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Open the attribute on the object header */ - if(NULL == (attr = H5A_open_by_name(&loc, obj_name, attr_name, lapl_id, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5A_open_by_name(&loc, obj_name, attr_name, lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") /* Get the attribute information */ @@ -1064,6 +1073,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute object for name */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1090,7 +1100,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Open the attribute on the object header */ - if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") /* Get the attribute information */ @@ -1167,6 +1177,7 @@ herr_t H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, const char *new_attr_name, hid_t lapl_id) { + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by the library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1196,7 +1207,7 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Call private attribute rename routine */ - if(H5A_rename_by_name(loc, obj_name, old_attr_name, new_attr_name, lapl_id, H5AC_dxpl_id) < 0) + if(H5A_rename_by_name(loc, obj_name, old_attr_name, new_attr_name, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute") } /* end if */ @@ -1341,6 +1352,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5A_attr_iter_op_t attr_op; /* Attribute operator */ hsize_t start_idx; /* Index of attribute to start iterating at */ hsize_t last_attr; /* Index of last attribute examined */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1370,12 +1382,12 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5G_loc_reset(&obj_loc); /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; /* Open the object */ - if((obj_loc_id = H5O_open_by_loc(&obj_loc, lapl_id, H5AC_ind_dxpl_id, TRUE)) < 0) + if((obj_loc_id = H5O_open_by_loc(&obj_loc, lapl_id, dxpl_id, TRUE)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open object") /* Build attribute operator info */ @@ -1384,7 +1396,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, /* Call attribute iteration routine */ last_attr = start_idx = (idx ? *idx : 0); - if((ret_value = H5O_attr_iterate(obj_loc_id, H5AC_ind_dxpl_id, idx_type, order, start_idx, &last_attr, &attr_op, op_data)) < 0) + if((ret_value = H5O_attr_iterate(obj_loc_id, dxpl_id, idx_type, order, start_idx, &last_attr, &attr_op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); /* Set the last attribute information */ @@ -1469,6 +1481,7 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ + hid_t dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1495,12 +1508,14 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5G_loc_reset(&obj_loc); /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + dxpl_id = H5AC_ind_dxpl_id; + if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; /* Delete the attribute from the location */ - if(H5O_attr_remove(obj_loc.oloc, attr_name, H5AC_dxpl_id) < 0) + dxpl_id = H5AC_dxpl_id; + if(H5O_attr_remove(obj_loc.oloc, attr_name, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1545,6 +1560,7 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ + hid_t dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1573,12 +1589,14 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5G_loc_reset(&obj_loc); /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + dxpl_id = H5AC_ind_dxpl_id; + if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; /* Delete the attribute from the location */ - if(H5O_attr_remove_by_idx(obj_loc.oloc, idx_type, order, n, H5AC_dxpl_id) < 0) + dxpl_id = H5AC_dxpl_id; + if(H5O_attr_remove_by_idx(obj_loc.oloc, idx_type, order, n, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") done: @@ -1684,6 +1702,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t lapl_id) { H5G_loc_t loc; /* Object location */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1704,7 +1723,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") - if((ret_value = H5A_exists_by_name(loc, obj_name, attr_name, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5A_exists_by_name(loc, obj_name, attr_name, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: diff --git a/src/H5AC.c b/src/H5AC.c index f5b331f..34e291d 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -189,7 +189,7 @@ H5AC__init_package(void) HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") /* Get the property list object */ - if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_dxpl_id))) + if(NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_dxpl_id))) HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") /* Insert 'collective metadata write' property */ @@ -260,7 +260,7 @@ H5AC_term_package(void) H5E_clear_stack(NULL); /*ignore error*/ } /* end if */ #endif /* H5_HAVE_PARALLEL */ - + /* Reset static IDs */ H5AC_dxpl_id = (-1); H5AC_ind_dxpl_id = (-1); @@ -478,7 +478,7 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id) #endif /* H5AC__TRACE_FILE_ENABLED */ #ifdef H5_HAVE_PARALLEL - aux_ptr = H5C_get_aux_ptr(f->shared->cache); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache); if(aux_ptr) /* Sanity check */ HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); @@ -766,7 +766,7 @@ H5AC_insert_entry(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t add { H5AC_aux_t *aux_ptr; - if(NULL != (aux_ptr = H5C_get_aux_ptr(f->shared->cache))) { + if(NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache))) { /* Log the new entry */ if(H5AC__log_inserted_entry((H5AC_info_t *)thing) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTINS, FAIL, "H5AC__log_inserted_entry() failed") @@ -832,7 +832,7 @@ H5AC_mark_entry_dirty(void *thing) H5C_t *cache_ptr = entry_ptr->cache_ptr; H5AC_aux_t *aux_ptr; - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); if((!entry_ptr->is_dirty) && (!entry_ptr->is_protected) && (entry_ptr->is_pinned) && (NULL != aux_ptr)) if(H5AC__log_dirtied_entry(entry_ptr) < 0) @@ -901,7 +901,7 @@ H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t ne #ifdef H5_HAVE_PARALLEL /* Log moving the entry */ - if(NULL != (aux_ptr = H5C_get_aux_ptr(f->shared->cache))) + if(NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache))) if(H5AC__log_moved_entry(f, old_addr, new_addr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "can't log moved entry") #endif /* H5_HAVE_PARALLEL */ @@ -1166,7 +1166,7 @@ H5AC_resize_entry(void *thing, size_t new_size) H5C_t *cache_ptr = entry_ptr->cache_ptr; H5AC_aux_t *aux_ptr; - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); if((!entry_ptr->is_dirty) && (NULL != aux_ptr)) if(H5AC__log_dirtied_entry(entry_ptr) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTMARKDIRTY, FAIL, "can't log dirtied entry") @@ -1377,7 +1377,7 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, } /* end if */ #ifdef H5_HAVE_PARALLEL - if(NULL != (aux_ptr = H5C_get_aux_ptr(f->shared->cache))) { + if(NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache))) { if(dirtied && ((H5AC_info_t *)thing)->is_dirty == FALSE) if(H5AC__log_dirtied_entry((H5AC_info_t *)thing) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTUNPROTECT, FAIL, "can't log dirtied entry") @@ -1502,7 +1502,7 @@ H5AC_get_cache_auto_resize_config(const H5AC_t *cache_ptr, { H5AC_aux_t *aux_ptr; - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); if((aux_ptr != NULL) && (aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad aux_ptr on entry.") } @@ -1549,7 +1549,7 @@ H5AC_get_cache_auto_resize_config(const H5AC_t *cache_ptr, { H5AC_aux_t *aux_ptr; - if(NULL != (aux_ptr = H5C_get_aux_ptr(cache_ptr))) { + if(NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr))) { config_ptr->dirty_bytes_threshold = aux_ptr->dirty_bytes_threshold; config_ptr->metadata_write_strategy = aux_ptr->metadata_write_strategy; } /* end if */ @@ -1691,7 +1691,7 @@ H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config { H5AC_aux_t *aux_ptr; - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); if((aux_ptr != NULL) && (aux_ptr->magic != H5AC__H5AC_AUX_T_MAGIC)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "bad aux_ptr on entry.") } @@ -1735,7 +1735,7 @@ H5AC_set_cache_auto_resize_config(H5AC_t *cache_ptr, H5AC_cache_config_t *config /* Set parallel configuration values */ /* (Which are only held in the H5AC layer -QAK) */ - if(NULL != (aux_ptr = H5C_get_aux_ptr(cache_ptr))) { + if(NULL != (aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr))) { aux_ptr->dirty_bytes_threshold = config_ptr->dirty_bytes_threshold; aux_ptr->metadata_write_strategy = config_ptr->metadata_write_strategy; } /* end if */ @@ -1950,7 +1950,7 @@ H5AC_open_trace_file(H5AC_t *cache_ptr, const char *trace_file_name) { H5AC_aux_t * aux_ptr; - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); if(aux_ptr == NULL) sprintf(file_name, "%s", trace_file_name); else { @@ -2131,7 +2131,7 @@ H5_ATTR_UNUSED HDassert(f != NULL); HDassert(f->shared != NULL); HDassert(f->shared->cache != NULL); - aux_ptr = H5C_get_aux_ptr(f->shared->cache); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache); if(aux_ptr != NULL) { HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c index fdad19a..ca2582e 100644 --- a/src/H5ACmpio.c +++ b/src/H5ACmpio.c @@ -159,7 +159,7 @@ H5AC__set_sync_point_done_callback(H5C_t * cache_ptr, /* Sanity checks */ HDassert(cache_ptr); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); @@ -192,7 +192,7 @@ H5AC__set_write_done_callback(H5C_t * cache_ptr, void (* write_done)(void)) /* Sanity checks */ HDassert(cache_ptr); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); @@ -231,7 +231,7 @@ H5AC_add_candidate(H5AC_t * cache_ptr, haddr_t addr) /* Sanity checks */ HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -295,7 +295,7 @@ H5AC__broadcast_candidate_list(H5AC_t *cache_ptr, int *num_entries_ptr, /* Sanity checks */ HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->mpi_rank == 0); @@ -427,7 +427,7 @@ H5AC__broadcast_clean_list(H5AC_t * cache_ptr) /* Sanity checks */ HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->mpi_rank == 0); @@ -624,7 +624,7 @@ H5AC__copy_candidate_list_to_buffer(const H5AC_t *cache_ptr, int *num_entries_pt /* Sanity checks */ HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -700,7 +700,7 @@ H5AC__log_deleted_entry(const H5AC_info_t *entry_ptr) addr = entry_ptr->addr; cache_ptr = entry_ptr->cache_ptr; HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->mpi_rank == 0); @@ -756,7 +756,7 @@ H5AC__log_dirtied_entry(const H5AC_info_t *entry_ptr) HDassert(entry_ptr->is_dirty == FALSE); cache_ptr = entry_ptr->cache_ptr; HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); @@ -839,7 +839,7 @@ H5AC__log_flushed_entry(H5C_t *cache_ptr, haddr_t addr, hbool_t was_dirty, /* Sanity check */ HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->mpi_rank == 0); @@ -907,7 +907,7 @@ H5AC__log_inserted_entry(const H5AC_info_t *entry_ptr) HDassert(entry_ptr); cache_ptr = entry_ptr->cache_ptr; HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); @@ -1010,7 +1010,7 @@ H5AC__log_moved_entry(const H5F_t *f, haddr_t old_addr, haddr_t new_addr) HDassert(f->shared); cache_ptr = (H5AC_t *)f->shared->cache; HDassert(cache_ptr); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); @@ -1188,7 +1188,7 @@ H5AC__propagate_and_apply_candidate_list(H5F_t *f, hid_t dxpl_id) HDassert(f != NULL); cache_ptr = f->shared->cache; HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -1352,7 +1352,7 @@ H5AC__propagate_flushed_and_still_clean_entries_list(H5F_t *f, hid_t dxpl_id) HDassert(f != NULL); cache_ptr = f->shared->cache; HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); @@ -1477,7 +1477,7 @@ H5AC__receive_and_apply_clean_list(H5F_t *f, hid_t dxpl_id) HDassert(f != NULL); cache_ptr = f->shared->cache; HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->mpi_rank != 0); @@ -1537,7 +1537,7 @@ H5AC__receive_candidate_list(const H5AC_t *cache_ptr, int *num_entries_ptr, /* Sanity checks */ HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->mpi_rank != 0); @@ -1621,7 +1621,7 @@ H5AC__rsp__dist_md_write__flush(H5F_t *f, hid_t dxpl_id) HDassert(f != NULL); cache_ptr = f->shared->cache; HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -1761,7 +1761,7 @@ H5AC__rsp__dist_md_write__flush_to_min_clean(H5F_t *f, hid_t dxpl_id) HDassert(f != NULL); cache_ptr = f->shared->cache; HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -1836,7 +1836,7 @@ H5AC__rsp__p0_only__flush(H5F_t *f, hid_t dxpl_id) HDassert(f != NULL); cache_ptr = f->shared->cache; HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); @@ -1938,7 +1938,7 @@ H5AC__rsp__p0_only__flush_to_min_clean(H5F_t *f, hid_t dxpl_id) HDassert(f != NULL); cache_ptr = f->shared->cache; HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); @@ -2047,7 +2047,7 @@ H5AC__run_sync_point(H5F_t *f, hid_t dxpl_id, int sync_point_op) HDassert(f != NULL); cache_ptr = f->shared->cache; HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert((sync_point_op == H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) || @@ -2171,7 +2171,7 @@ H5AC__tidy_cache_0_lists(H5AC_t *cache_ptr, int num_candidates, /* Sanity checks */ HDassert(cache_ptr != NULL); - aux_ptr = H5C_get_aux_ptr(cache_ptr); + aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(cache_ptr); HDassert(aux_ptr != NULL); HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); HDassert(aux_ptr->metadata_write_strategy == H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); diff --git a/src/H5C.c b/src/H5C.c index c78c32c..90609b5 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -456,8 +456,6 @@ H5C_create(size_t max_cache_size, HDassert( max_type_id < H5C__MAX_NUM_TYPE_IDS ); HDassert( type_name_table_ptr ); - HDassert( ( write_permitted == TRUE ) || ( write_permitted == FALSE ) ); - for ( i = 0; i <= max_type_id; i++ ) { HDassert( (type_name_table_ptr)[i] ); @@ -1752,7 +1750,7 @@ H5C_insert_entry(H5F_t * f, void * thing, unsigned int flags) { - H5C_t * cache_ptr; + H5C_t *cache_ptr; H5P_genplist_t *dxpl; H5AC_ring_t ring = H5C_RING_UNDEFINED; hbool_t insert_pinned; @@ -1763,8 +1761,8 @@ H5C_insert_entry(H5F_t * f, hbool_t set_flush_marker; hbool_t write_permitted = TRUE; size_t empty_space; - H5C_cache_entry_t * entry_ptr; - H5C_cache_entry_t * test_entry_ptr; + H5C_cache_entry_t *entry_ptr; + H5C_cache_entry_t *test_entry_ptr; unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1991,11 +1989,8 @@ H5C_insert_entry(H5F_t * f, #if H5C_DO_EXTREME_SANITY_CHECKS if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "an extreme sanity check failed just before done.\n"); - } + ( H5C_validate_lru_list(cache_ptr) < 0 ) ) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed just before done.\n") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ /* If the entry's type has a 'notify' callback send a 'after insertion' @@ -2008,19 +2003,14 @@ H5C_insert_entry(H5F_t * f, H5C__UPDATE_STATS_FOR_INSERTION(cache_ptr, entry_ptr) done: - #if H5C_DO_EXTREME_SANITY_CHECKS if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "an extreme sanity check failed on exit.\n"); - } + ( H5C_validate_lru_list(cache_ptr) < 0 ) ) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit.\n") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_insert_entry() */ @@ -2589,7 +2579,6 @@ H5C_protect(H5F_t * f, unsigned flags) { H5C_t * cache_ptr; - H5P_genplist_t *dxpl; H5AC_ring_t ring = H5C_RING_UNDEFINED; hbool_t hit; hbool_t have_write_permitted = FALSE; @@ -2602,6 +2591,7 @@ H5C_protect(H5F_t * f, size_t empty_space; void * thing; H5C_cache_entry_t * entry_ptr; + H5P_genplist_t * dxpl; /* dataset transfer property list */ void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -2692,7 +2682,6 @@ H5C_protect(H5F_t * f, } entry_ptr = (H5C_cache_entry_t *)thing; - entry_ptr->ring = ring; /* Apply tag to newly protected entry */ @@ -2936,11 +2925,8 @@ done: #if H5C_DO_EXTREME_SANITY_CHECKS if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, \ - "an extreme sanity check failed on exit.\n"); - } + ( H5C_validate_lru_list(cache_ptr) < 0 ) ) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "an extreme sanity check failed on exit.\n") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) @@ -3279,23 +3265,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C_set_evictions_enabled(H5C_t *cache_ptr, - hbool_t evictions_enabled) +H5C_set_evictions_enabled(H5C_t *cache_ptr, hbool_t evictions_enabled) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if ( ( cache_ptr == NULL ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) { - + if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.") - } - - if ( ( evictions_enabled != TRUE ) && ( evictions_enabled != FALSE ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Bad evictions_enabled on entry.") - } /* There is no fundamental reason why we should not permit * evictions to be disabled while automatic resize is enabled. @@ -3303,20 +3280,15 @@ H5C_set_evictions_enabled(H5C_t *cache_ptr, * want to, and allowing it would greatly complicate testing * the feature. Hence the following: */ - if ( ( evictions_enabled != TRUE ) && - ( ( cache_ptr->resize_ctl.incr_mode != H5C_incr__off ) || - ( cache_ptr->resize_ctl.decr_mode != H5C_decr__off ) ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Can't disable evictions when auto resize enabled.") - } + if((evictions_enabled != TRUE) && + ((cache_ptr->resize_ctl.incr_mode != H5C_incr__off) || + (cache_ptr->resize_ctl.decr_mode != H5C_decr__off))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't disable evictions when auto resize enabled.") cache_ptr->evictions_enabled = evictions_enabled; done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_set_evictions_enabled() */ @@ -4679,27 +4651,14 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, if ( (tests & H5C_RESIZE_CFG__VALIDATE_GENERAL) != 0 ) { - if ( ( config_ptr->set_initial_size != TRUE ) && - ( config_ptr->set_initial_size != FALSE ) ) { + if(config_ptr->max_size > H5C__MAX_MAX_CACHE_SIZE) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "max_size too big") - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "set_initial_size must be either TRUE or FALSE"); - } - - if ( config_ptr->max_size > H5C__MAX_MAX_CACHE_SIZE ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "max_size too big"); - } + if(config_ptr->min_size < H5C__MIN_MAX_CACHE_SIZE) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size too small") - if ( config_ptr->min_size < H5C__MIN_MAX_CACHE_SIZE ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size too small"); - } - - if ( config_ptr->min_size > config_ptr->max_size ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size > max_size"); - } + if(config_ptr->min_size > config_ptr->max_size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size > max_size") if ( ( config_ptr->set_initial_size ) && ( ( config_ptr->initial_size < config_ptr->min_size ) || @@ -4738,25 +4697,12 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, if ( config_ptr->incr_mode == H5C_incr__threshold ) { - if ( ( config_ptr->lower_hr_threshold < (double)0.0f ) || - ( config_ptr->lower_hr_threshold > (double)1.0f ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "lower_hr_threshold must be in the range [0.0, 1.0]"); - } - - if ( config_ptr->increment < (double)1.0f ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "increment must be greater than or equal to 1.0"); - } - - if ( ( config_ptr->apply_max_increment != TRUE ) && - ( config_ptr->apply_max_increment != FALSE ) ) { + if((config_ptr->lower_hr_threshold < (double)0.0f) || + (config_ptr->lower_hr_threshold > (double)1.0f)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "lower_hr_threshold must be in the range [0.0, 1.0]") - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "apply_max_increment must be either TRUE or FALSE"); - } + if(config_ptr->increment < (double)1.0f) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "increment must be greater than or equal to 1.0") /* no need to check max_increment, as it is a size_t, * and thus must be non-negative. @@ -4834,26 +4780,13 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, "epochs_before_eviction must be positive"); } - if ( config_ptr->epochs_before_eviction > H5C__MAX_EPOCH_MARKERS ) { + if(config_ptr->epochs_before_eviction > H5C__MAX_EPOCH_MARKERS) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction too big") - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "epochs_before_eviction too big"); - } - - if ( ( config_ptr->apply_empty_reserve != TRUE ) && - ( config_ptr->apply_empty_reserve != FALSE ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "apply_empty_reserve must be either TRUE or FALSE"); - } - - if ( ( config_ptr->apply_empty_reserve ) && - ( ( config_ptr->empty_reserve > (double)1.0f ) || - ( config_ptr->empty_reserve < (double)0.0f ) ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "empty_reserve must be in the interval [0.0, 1.0]"); - } + if((config_ptr->apply_empty_reserve) && + ((config_ptr->empty_reserve > (double)1.0f) || + (config_ptr->empty_reserve < (double)0.0f))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty_reserve must be in the interval [0.0, 1.0]") /* no need to check max_decrement as it is a size_t * and thus must be non-negative. @@ -6041,7 +5974,6 @@ H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * f, prev_ptr = entry_ptr->prev; if ( ! (entry_ptr->is_dirty) ) { - if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush clean entry") } @@ -8440,7 +8372,7 @@ H5C_load_entry(H5F_t * f, #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ /* Get the on-disk entry image */ - if ( 0 == (type->flags & H5C__CLASS_SKIP_READS) ) + if(0 == (type->flags & H5C__CLASS_SKIP_READS)) if(H5F_block_read(f, type->mem_type, addr, len, dxpl_id, image) < 0) HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL, "Can't read image*") @@ -8548,17 +8480,12 @@ H5C_load_entry(H5F_t * f, /* Go get the on-disk image again */ if(H5F_block_read(f, type->mem_type, addr, new_len, dxpl_id, image) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't read image") - /* Deserialize on-disk image into native memory - * form again - */ + /* Deserialize on-disk image into native memory form again */ if(NULL == (thing = type->deserialize(image, new_len, udata, &dirty))) - - HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, \ - "Can't deserialize image") + HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't deserialize image") #ifndef NDEBUG { diff --git a/src/H5D.c b/src/H5D.c index 3efae8e..0fe6c4d 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -109,6 +109,7 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, H5G_loc_t loc; /* Object location to insert dataset into */ H5D_t *dset = NULL; /* New dataset's info */ const H5S_t *space; /* Dataspace for dataset */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -145,7 +146,7 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list") /* Create the new dataset & get its ID */ - if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id, H5AC_dxpl_id))) + if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id, dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") if((ret_value = H5I_register(H5I_DATASET, dset, TRUE)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "unable to register dataset") @@ -201,6 +202,7 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, H5G_loc_t loc; /* Object location to insert dataset into */ H5D_t *dset = NULL; /* New dataset's info */ const H5S_t *space; /* Dataspace for dataset */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -227,7 +229,7 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list") /* build and open the new dataset */ - if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id, H5AC_dxpl_id))) + if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id, dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") /* Register the new dataset to get an ID for it */ @@ -244,7 +246,7 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get object location of dataset") /* Decrement refcount on dataset's object header in memory */ - if(H5O_dec_rc_by_loc(oloc, H5AC_dxpl_id) < 0) + if(H5O_dec_rc_by_loc(oloc, dxpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") } /* end if */ @@ -310,7 +312,6 @@ done: if(ret_value < 0) if(dset && H5D_close(dset) < 0) HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") - FUNC_LEAVE_API(ret_value) } /* end H5Dopen2() */ diff --git a/src/H5F.c b/src/H5F.c index 041bd35..da08de4 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -447,7 +447,8 @@ hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { H5F_t *new_file = NULL; /*file struct for new file */ - hid_t ret_value; /*return value */ + hid_t dxpl_id = H5AC_dxpl_id; /*dxpl used by library */ + hid_t ret_value; /*return value */ FUNC_ENTER_API(FAIL) H5TRACE4("i", "*sIuii", filename, flags, fcpl_id, fapl_id); @@ -490,7 +491,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) /* * Create a new file or truncate an existing file. */ - if(NULL == (new_file = H5F_open(filename, flags, fcpl_id, fapl_id, H5AC_dxpl_id))) + if(NULL == (new_file = H5F_open(filename, flags, fcpl_id, fapl_id, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create file") /* Get an atom for the file */ @@ -553,7 +554,8 @@ hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) { H5F_t *new_file = NULL; /*file struct for new file */ - hid_t ret_value; /*return value */ + hid_t dxpl_id = H5AC_dxpl_id; /*dxpl used by library */ + hid_t ret_value; /*return value */ FUNC_ENTER_API(FAIL) H5TRACE3("i", "*sIui", filename, flags, fapl_id); @@ -572,7 +574,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") /* Open the file */ - if(NULL == (new_file = H5F_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id))) + if(NULL == (new_file = H5F_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to open file") /* Get an atom for the file */ diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index b3ef1f2..d0e2171 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -1436,7 +1436,7 @@ H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t dxpl_id, had #endif /* Only look for MPI views for raw data transfers */ - if(type==H5FD_MEM_DRAW) { + if(type == H5FD_MEM_DRAW) { H5FD_mpio_xfer_t xfer_mode; /* I/O tranfer mode */ /* Obtain the data transfer properties */ @@ -1793,6 +1793,7 @@ H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, if(H5FD_mpio_Debug[(int)'t']) fprintf(stdout, "H5FD_mpio_write: using MPIO collective mode\n"); #endif + /* Get the collective_opt property to check whether the application wants to do IO individually. */ HDassert(plist); /* get the transfer mode from the dxpl */ diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index aa6cc2a..122f711 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -32,6 +32,14 @@ #define H5CHECK #endif /* _H5private_H */ +/* When this header is included from a private HDF5 header, don't make calls to H5open() */ +#undef H5OPEN +#ifndef _H5private_H +#define H5OPEN H5open(), +#else /* _H5private_H */ +#define H5OPEN +#endif /* _H5private_H */ + /* * These are the bits that can be passed to the `flags' argument of * H5Fcreate() and H5Fopen(). Use the bit-wise OR operator (|) to combine @@ -44,16 +52,16 @@ * Note that H5F_ACC_DEBUG is deprecated (nonfuncational) but retained as a * symbol for backward compatibility. */ -#define H5F_ACC_RDONLY (H5CHECK 0x0000u) /*absence of rdwr => rd-only */ -#define H5F_ACC_RDWR (H5CHECK 0x0001u) /*open for read and write */ -#define H5F_ACC_TRUNC (H5CHECK 0x0002u) /*overwrite existing files */ -#define H5F_ACC_EXCL (H5CHECK 0x0004u) /*fail if file already exists*/ +#define H5F_ACC_RDONLY (H5CHECK H5OPEN 0x0000u) /*absence of rdwr => rd-only */ +#define H5F_ACC_RDWR (H5CHECK H5OPEN 0x0001u) /*open for read and write */ +#define H5F_ACC_TRUNC (H5CHECK H5OPEN 0x0002u) /*overwrite existing files */ +#define H5F_ACC_EXCL (H5CHECK H5OPEN 0x0004u) /*fail if file already exists*/ /* NOTE: 0x0008u was H5F_ACC_DEBUG, now deprecated */ -#define H5F_ACC_CREAT (H5CHECK 0x0010u) /*create non-existing files */ +#define H5F_ACC_CREAT (H5CHECK H5OPEN 0x0010u) /*create non-existing files */ /* Value passed to H5Pset_elink_acc_flags to cause flags to be taken from the * parent file. */ -#define H5F_ACC_DEFAULT (H5CHECK 0xffffu) /*ignore setting on lapl */ +#define H5F_ACC_DEFAULT (H5CHECK H5OPEN 0xffffu) /*ignore setting on lapl */ /* Flags for H5Fget_obj_count() & H5Fget_obj_ids() calls */ #define H5F_OBJ_FILE (0x0001u) /* File objects */ @@ -223,7 +231,7 @@ H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag); #ifndef H5_NO_DEPRECATED_SYMBOLS /* Macros */ -#define H5F_ACC_DEBUG (H5CHECK 0x0000u) /*print debug info (deprecated)*/ +#define H5F_ACC_DEBUG (H5CHECK H5OPEN 0x0000u) /*print debug info (deprecated)*/ /* Typedefs */ diff --git a/src/H5G.c b/src/H5G.c index 03fe50a..00a53b8 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -290,6 +290,7 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, { H5G_loc_t loc; /* Location to create group */ H5G_t *grp = NULL; /* New group created */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -323,7 +324,7 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list") /* Create the new group & get its ID */ - if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id, gapl_id, H5AC_dxpl_id))) + if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id, gapl_id, dxpl_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") @@ -378,6 +379,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) H5G_loc_t loc; H5G_t *grp = NULL; H5G_obj_create_t gcrt_info; /* Information for group creation */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -407,7 +409,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); /* Create the new group & get its ID */ - if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info, H5AC_dxpl_id))) + if(NULL == (grp = H5G__create(loc.oloc->file, &gcrt_info, dxpl_id))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group") if((ret_value = H5I_register(H5I_GROUP, grp, TRUE)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to register group") @@ -422,7 +424,7 @@ done: HDONE_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get object location of group") /* Decrement refcount on group's object header in memory */ - if(H5O_dec_rc_by_loc(oloc, H5AC_dxpl_id) < 0) + if(H5O_dec_rc_by_loc(oloc, dxpl_id) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") } /* end if */ @@ -457,6 +459,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) { H5G_t *grp = NULL; /* Group opened */ H5G_loc_t loc; /* Location of parent for group */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -476,7 +479,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list") /* Open the group */ - if((grp = H5G__open_name(&loc, name, gapl_id, H5AC_ind_dxpl_id)) == NULL) + if((grp = H5G__open_name(&loc, name, gapl_id, dxpl_id)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") /* Register an ID for the group */ @@ -595,6 +598,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, H5G_name_t grp_path; /* Opened object group hier. path */ H5O_loc_t grp_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Location at 'name' found */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -619,12 +623,12 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, H5G_loc_reset(&grp_loc); /* Find the group object */ - if(H5G_loc_find(&loc, name, &grp_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find(&loc, name, &grp_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") loc_found = TRUE; /* Retrieve the group's information */ - if(H5G__obj_info(grp_loc.oloc, grp_info/*out*/, H5AC_ind_dxpl_id) < 0) + if(H5G__obj_info(grp_loc.oloc, grp_info/*out*/, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -658,6 +662,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_name_t grp_path; /* Opened object group hier. path */ H5O_loc_t grp_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -687,12 +692,13 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_loc_reset(&grp_loc); /* Find the object's location, according to the order in the index */ - if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &grp_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &grp_loc/*out*/, + lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found") loc_found = TRUE; /* Retrieve the group's information */ - if(H5G__obj_info(grp_loc.oloc, grp_info/*out*/, H5AC_ind_dxpl_id) < 0) + if(H5G__obj_info(grp_loc.oloc, grp_info/*out*/, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: diff --git a/src/H5L.c b/src/H5L.c index 9daf948..264c00e 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -336,6 +336,7 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, { H5G_loc_t src_loc, *src_loc_p; H5G_loc_t dst_loc, *dst_loc_p; + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -366,7 +367,7 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* Move the link */ if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id, - lapl_id, H5AC_dxpl_id) < 0) + lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: @@ -394,6 +395,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, { H5G_loc_t src_loc, *src_loc_p; H5G_loc_t dst_loc, *dst_loc_p; + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -424,7 +426,7 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, /* Copy the link */ if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, TRUE, lcpl_id, - lapl_id, H5AC_dxpl_id) < 0) + lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTMOVE, FAIL, "unable to move link") done: @@ -455,6 +457,7 @@ H5Lcreate_soft(const char *link_target, hid_t link_loc_id, const char *link_name, hid_t lcpl_id, hid_t lapl_id) { H5G_loc_t link_loc; /* Group location for new link */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -471,7 +474,7 @@ H5Lcreate_soft(const char *link_target, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") /* Create the link */ - if(H5L_create_soft(link_target, &link_loc, link_name, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + if(H5L_create_soft(link_target, &link_loc, link_name, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -501,6 +504,7 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, { H5G_loc_t cur_loc, *cur_loc_p; H5G_loc_t new_loc, *new_loc_p; + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -533,7 +537,7 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, /* Create the link */ if(H5L_create_hard(cur_loc_p, cur_name, new_loc_p, new_name, - lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -570,6 +574,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, const void *udata, size_t udata_size, hid_t lcpl_id, hid_t lapl_id) { H5G_loc_t link_loc; + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -585,7 +590,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class") /* Create external link */ - if(H5L_create_ud(&link_loc, link_name, udata, udata_size, link_type, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + if(H5L_create_ud(&link_loc, link_name, udata, udata_size, link_type, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -614,6 +619,7 @@ herr_t H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; /* Group's location */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -626,7 +632,7 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Unlink */ - if(H5L_delete(&loc, name, lapl_id, H5AC_dxpl_id) < 0) + if(H5L_delete(&loc, name, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") done: @@ -659,6 +665,7 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, { H5G_loc_t loc; /* Group's location */ H5L_trav_rmbi_t udata; /* User data for callback */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -686,7 +693,8 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, udata.dxpl_id = H5AC_dxpl_id; /* Traverse the group hierarchy to remove the link */ - if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK|H5G_TARGET_MOUNT, H5L_delete_by_idx_cb, &udata, lapl_id, H5AC_dxpl_id) < 0) + if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK|H5G_TARGET_MOUNT, + H5L_delete_by_idx_cb, &udata, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist") done: @@ -718,6 +726,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, hid_t lapl_id) { H5G_loc_t loc; /* Group location for location to query */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -735,7 +744,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Get the link value */ - if(H5L_get_val(&loc, name, buf, size, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5L_get_val(&loc, name, buf, size, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link value for '%s'", name) done: @@ -768,6 +777,7 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, { H5G_loc_t loc; /* Group location for location to query */ H5L_trav_gvbi_t udata; /* User data for callback */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -793,12 +803,13 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, udata.idx_type = idx_type; udata.order = order; udata.n = n; - udata.dxpl_id = H5AC_ind_dxpl_id; + udata.dxpl_id = dxpl_id; udata.buf = buf; udata.size = size; /* Traverse the group hierarchy to locate the object to get info about */ - if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L_get_val_by_idx_cb, &udata, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L_get_val_by_idx_cb, + &udata, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "name doesn't exist") @@ -824,6 +835,7 @@ htri_t H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ htri_t ret_value; FUNC_ENTER_API(FAIL) @@ -841,7 +853,7 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Check for the existence of the link */ - if((ret_value = H5L__exists(&loc, name, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5L__exists(&loc, name, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") done: @@ -868,6 +880,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, hid_t lapl_id) { H5G_loc_t loc; + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) @@ -885,7 +898,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Get the link information */ - if(H5L_get_info(&loc, name, linfo, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5L_get_info(&loc, name, linfo, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") done: @@ -914,6 +927,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, { H5G_loc_t loc; /* Group location for group to query */ H5L_trav_gibi_t udata; /* User data for callback */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -939,11 +953,12 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, udata.idx_type = idx_type; udata.order = order; udata.n = n; - udata.dxpl_id = H5AC_ind_dxpl_id; + udata.dxpl_id = dxpl_id; udata.linfo = linfo; /* Traverse the group hierarchy to locate the object to get info about */ - if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_get_info_by_idx_cb, &udata, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, + H5L_get_info_by_idx_cb, &udata, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") @@ -1103,6 +1118,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, { H5G_loc_t loc; /* Location of group */ H5L_trav_gnbi_t udata; /* User data for callback */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1128,13 +1144,14 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, udata.idx_type = idx_type; udata.order = order; udata.n = n; - udata.dxpl_id = H5AC_ind_dxpl_id; + udata.dxpl_id = dxpl_id; udata.name = name; udata.size = size; udata.name_len = -1; /* Traverse the group hierarchy to locate the link to get name of */ - if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_get_name_by_idx_cb, &udata, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, + H5L_get_name_by_idx_cb, &udata, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist") /* Set the return value */ @@ -1242,6 +1259,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, H5G_link_iterate_t lnk_op; /* Link operator */ hsize_t last_lnk; /* Index of last object looked at */ hsize_t idx; /* Internal location to hold index */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1272,7 +1290,8 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, lnk_op.op_func.op_new = op; /* Iterate over the links */ - if((ret_value = H5G_iterate(loc_id, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_iterate(loc_id, group_name, idx_type, order, idx, &last_lnk, &lnk_op, + op_data, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") /* Set the index we stopped at */ @@ -1374,6 +1393,7 @@ herr_t H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate_t op, void *op_data, hid_t lapl_id) { + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1396,7 +1416,7 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Call internal group visitation routine */ - if((ret_value = H5G_visit(loc_id, group_name, idx_type, order, op, op_data, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_visit(loc_id, group_name, idx_type, order, op, op_data, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link visitation failed") done: diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 139c5e6..324f2bf 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -563,6 +563,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name, size_t file_name_len; /* Length of file name string */ size_t norm_obj_name_len; /* Length of normalized object name string */ uint8_t *p; /* Pointer into external link buffer */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -598,7 +599,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name, HDstrncpy((char *)p, norm_obj_name, buf_size - (file_name_len + 1)); /* External link's object */ /* Create an external link */ - if(H5L_create_ud(&link_loc, link_name, ext_link_buf, buf_size, H5L_TYPE_EXTERNAL, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + if(H5L_create_ud(&link_loc, link_name, ext_link_buf, buf_size, H5L_TYPE_EXTERNAL, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") done: diff --git a/src/H5O.c b/src/H5O.c index 34fe498..46ce5fa 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -282,6 +282,7 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_loc_t obj_loc; /* Location used to open group */ H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ hid_t ret_value = FAIL; @@ -309,12 +310,12 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_loc_reset(&obj_loc); /* Find the object's location, according to the order in the index */ - if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "group not found") loc_found = TRUE; /* Open the object */ - if((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, H5AC_ind_dxpl_id, TRUE)) < 0) + if((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, dxpl_id, TRUE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") done: @@ -426,6 +427,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, { H5G_loc_t new_loc; H5G_loc_t obj_loc; + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -449,7 +451,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") /* Link to the object */ - if(H5L_link(&new_loc, new_name, &obj_loc, lcpl_id, lapl_id, H5AC_dxpl_id) < 0) + if(H5L_link(&new_loc, new_name, &obj_loc, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -556,6 +558,7 @@ htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; /* Location info */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) @@ -573,7 +576,7 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Check if the object exists */ - if((ret_value = H5G_loc_exists(&loc, name, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_loc_exists(&loc, name, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name) done: @@ -635,6 +638,7 @@ herr_t H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -654,7 +658,7 @@ H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lap HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Retrieve the object's information */ - if(H5G_loc_info(&loc, name, TRUE, oinfo/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_info(&loc, name, TRUE, oinfo/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") done: @@ -685,6 +689,7 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -714,7 +719,7 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_loc_reset(&obj_loc); /* Find the object's location, according to the order in the index */ - if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find_by_idx(&loc, group_name, idx_type, order, n, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "group not found") loc_found = TRUE; @@ -792,6 +797,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -809,7 +815,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* (Re)set the object's comment */ - if(H5G_loc_set_comment(&loc, name, comment, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_set_comment(&loc, name, comment, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") done: @@ -876,6 +882,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -893,7 +900,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Retrieve the object's comment */ - if((ret_value = H5G_loc_get_comment(&loc, name, comment/*out*/, bufsize, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_loc_get_comment(&loc, name, comment/*out*/, bufsize, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") done: @@ -995,6 +1002,7 @@ herr_t H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id) { + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1017,7 +1025,7 @@ H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Call internal object visitation routine */ - if((ret_value = H5O_visit(loc_id, obj_name, idx_type, order, op, op_data, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5O_visit(loc_id, obj_name, idx_type, order, op, op_data, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: diff --git a/src/H5Pint.c b/src/H5Pint.c index 69b2791..443802c 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -1187,7 +1187,7 @@ H5P__find_prop_plist(const H5P_genplist_t *plist, const char *name) /* Check if the property has been deleted from list */ if(H5SL_search(plist->del,name) != NULL) { - HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "can't find property in skip list") + HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, NULL, "property deleted from skip list") } /* end if */ else { /* Get the property data from the skip list */ diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 5ff1c73..0ab3b4e 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -99,6 +99,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, { H5G_loc_t loc; /* Location to create datatype */ H5T_t *type; /* Datatype for ID */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -134,7 +135,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list") /* Commit the type */ - if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id, tapl_id, H5AC_dxpl_id) < 0) + if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id, tapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") done: @@ -248,6 +249,7 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) { H5G_loc_t loc; /* Group location for location */ H5T_t *type = NULL; /* Datatype created */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -274,7 +276,7 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list") /* Commit the type */ - if(H5T__commit(loc.oloc->file, type, tcpl_id, H5AC_dxpl_id) < 0) + if(H5T__commit(loc.oloc->file, type, tcpl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "unable to commit datatype") /* Release the datatype's object header */ @@ -286,7 +288,7 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get object location of committed datatype") /* Decrement refcount on committed datatype's object header in memory */ - if(H5O_dec_rc_by_loc(oloc, H5AC_dxpl_id) < 0) + if(H5O_dec_rc_by_loc(oloc, dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDEC, FAIL, "unable to decrement refcount on newly created object") } /* end if */ -- cgit v0.12 From 06547eb4dd55c637f6c9ceaef75fadeff38bc5e2 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 13 Jan 2016 23:30:50 -0500 Subject: [svn-r28895] Description: Minor code tweaks and cleanups during review. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5comittest not required on this branch) --- src/H5A.c | 3 +- src/H5AC.c | 3 +- src/H5C.c | 235 +++++++++++++++++------------------------------------- src/H5Cpkg.h | 4 +- src/H5D.c | 3 - src/H5F.c | 6 +- src/H5Fpublic.h | 22 +++-- testpar/t_cache.c | 3 +- 8 files changed, 94 insertions(+), 185 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index ea95fdd..56f6307 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -1733,7 +1733,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t lapl_id) { H5G_loc_t loc; /* Object location */ - hid_t dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1749,7 +1749,6 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") - dxpl_id = H5AC_ind_dxpl_id; /* Verify access property list and get correct dxpl */ if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") diff --git a/src/H5AC.c b/src/H5AC.c index 39de07e..7388195 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -191,9 +191,8 @@ H5AC__init_package(void) HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") /* Get the property list object */ - if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_dxpl_id))) + if(NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_dxpl_id))) HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") - HDassert(xfer_plist); /* Insert 'collective metadata write' property */ coll_meta_write = 1; diff --git a/src/H5C.c b/src/H5C.c index 8536ab0..8c80ce7 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -461,8 +461,6 @@ H5C_create(size_t max_cache_size, HDassert( max_type_id < H5C__MAX_NUM_TYPE_IDS ); HDassert( type_name_table_ptr ); - HDassert( ( write_permitted == TRUE ) || ( write_permitted == FALSE ) ); - for ( i = 0; i <= max_type_id; i++ ) { HDassert( (type_name_table_ptr)[i] ); @@ -988,7 +986,7 @@ H5C_expunge_entry(H5F_t *f, hid_t dxpl_id, const H5C_class_t *type, if(entry_ptr->coll_access) { entry_ptr->coll_access = FALSE; H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) - } + } /* end if */ #endif /* H5_HAVE_PARALLEL */ /* If we get this far, call H5C__flush_single_entry() with the @@ -2013,11 +2011,8 @@ H5C_insert_entry(H5F_t * f, #if H5C_DO_EXTREME_SANITY_CHECKS if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "an extreme sanity check failed just before done.\n"); - } + ( H5C_validate_lru_list(cache_ptr) < 0 ) ) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed just before done.\n") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ /* If the entry's type has a 'notify' callback send a 'after insertion' @@ -2040,18 +2035,15 @@ H5C_insert_entry(H5F_t * f, if(!coll_access && H5P_FORCE_FALSE != f->coll_md_read) { H5P_coll_md_read_flag_t prop_value; - /* get the property value */ + /* Get the property value */ if(H5P_get(dxpl, H5_COLL_MD_READ_FLAG_NAME, &prop_value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "Can't get collective metadata access flag") - coll_access = (H5P_USER_TRUE == prop_value ? TRUE : FALSE); - } - //fprintf(stderr, "COLLACCESS = %d.. FILE property = %d\n", coll_access, f->coll_md_read); - } + } /* end if */ + } /* end if */ entry_ptr->coll_access = coll_access; if(coll_access) { - //fprintf(stderr, "NEW (%llu, %s)\n", addr, entry_ptr->type->name); H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, FAIL) /* Make sure the size of the collective entries in the cache remain in check */ @@ -2059,33 +2051,27 @@ H5C_insert_entry(H5F_t * f, if(cache_ptr->max_cache_size*80 < cache_ptr->coll_list_size*100) { if(H5C_clear_coll_entries(cache_ptr, 1) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") - } - } + } /* end if */ + } /* end if */ else { if(cache_ptr->max_cache_size*40 < cache_ptr->coll_list_size*100) { if(H5C_clear_coll_entries(cache_ptr, 1) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") - } - } - - } + } /* end if */ + } /* end else */ + } /* end if */ entry_ptr->ind_access_while_coll = FALSE; #endif done: - #if H5C_DO_EXTREME_SANITY_CHECKS if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "an extreme sanity check failed on exit.\n"); - } + ( H5C_validate_lru_list(cache_ptr) < 0 ) ) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "an extreme sanity check failed on exit.\n") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_insert_entry() */ @@ -2725,11 +2711,9 @@ H5C_protect(H5F_t * f, /* get the property value */ if(H5P_get(dxpl, H5_COLL_MD_READ_FLAG_NAME, &prop_value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "Can't get collective metadata access flag") - coll_access = (H5P_USER_TRUE == prop_value ? TRUE : FALSE); - } - //fprintf(stderr, "COLLACCESS = %d.. FILE property = %d\n", coll_access, f->coll_md_read); - } + } /* end if */ + } /* end if */ #endif /* H5_HAVE_PARALLEL */ /* first check to see if the target is in cache */ @@ -2752,12 +2736,12 @@ H5C_protect(H5F_t * f, bcast. */ #ifdef H5_HAVE_PARALLEL if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && coll_access && - !(entry_ptr->is_dirty) && !(entry_ptr->coll_access)) { + !(entry_ptr->is_dirty) && !(entry_ptr->coll_access)) { MPI_Comm comm; /* File MPI Communicator */ int mpi_code; /* MPI error code */ int buf_size; - if((comm = H5F_mpi_get_comm(f)) == MPI_COMM_NULL) + if(MPI_COMM_NULL == (comm = H5F_mpi_get_comm(f))) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "get_comm request failed") if(entry_ptr->image_ptr == NULL) { @@ -2767,45 +2751,36 @@ H5C_protect(H5F_t * f, if((mpi_rank = H5F_mpi_get_rank(f)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank") - if ( entry_ptr->compressed ) + if(entry_ptr->compressed) image_size = entry_ptr->compressed_size; else image_size = entry_ptr->size; - HDassert(image_size > 0); - entry_ptr->image_ptr = H5MM_malloc(image_size + H5C_IMAGE_EXTRA_SPACE); - - if (NULL == entry_ptr->image_ptr) { - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, \ - "memory allocation failed for on disk image buffer") - } + if(NULL == (entry_ptr->image_ptr = H5MM_malloc(image_size + H5C_IMAGE_EXTRA_SPACE))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer") #if H5C_DO_MEMORY_SANITY_CHECKS HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + image_size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ - if(0 == mpi_rank) { + if(0 == mpi_rank) if(H5C__generate_image(f, cache_ptr, entry_ptr, dxpl_id, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "Can't get Image") - } - } + } /* end if */ HDassert(entry_ptr->image_ptr); H5_CHECKED_ASSIGN(buf_size, int, entry_ptr->size, size_t); - if(MPI_SUCCESS != (mpi_code = MPI_Bcast(entry_ptr->image_ptr, buf_size, - MPI_BYTE, 0, comm))) + if(MPI_SUCCESS != (mpi_code = MPI_Bcast(entry_ptr->image_ptr, buf_size, MPI_BYTE, 0, comm))) HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) entry_ptr->coll_access = TRUE; - //fprintf(stderr, "ONLY INSERT (%llu, %s)\n", addr, entry_ptr->type->name); H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) - } + } /* end if */ else if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && coll_access && entry_ptr->coll_access) { - //fprintf(stderr, "UPDATE (%llu, %s)\n", addr, entry_ptr->type->name); H5C__MOVE_TO_TOP_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) - } + } /* end else-if */ #endif /* H5_HAVE_PARALLEL */ #if H5C_DO_TAGGING_SANITY_CHECKS @@ -2854,13 +2829,8 @@ H5C_protect(H5F_t * f, entry_ptr = (H5C_cache_entry_t *)thing; entry_ptr->ring = ring; #ifdef H5_HAVE_PARALLEL - if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { - if(entry_ptr->coll_access) { - //fprintf(stderr, "LOAD and INSERT (%llu, %s)\n", addr, entry_ptr->type->name); - H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) - } - } - //fprintf(stderr, "LOADED (%llu, %s) - %d\n", addr, entry_ptr->type->name, coll_access); + if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && entry_ptr->coll_access) + H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) #endif /* H5_HAVE_PARALLEL */ /* Apply tag to newly protected entry */ @@ -3102,24 +3072,19 @@ H5C_protect(H5F_t * f, #ifdef H5_HAVE_PARALLEL if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { /* Make sure the size of the collective entries in the cache remain in check */ - if( TRUE == coll_access) { + if(TRUE == coll_access) { if(H5P_USER_TRUE == f->coll_md_read) { - //fprintf(stderr, "COLL entries size = %zu, MAX = %zu\n", cache_ptr->coll_list_size, cache_ptr->max_cache_size); - if(cache_ptr->max_cache_size*80 < cache_ptr->coll_list_size*100) { - //fprintf(stderr, "COLL entries at 80.. CLEARING\n"); + if(cache_ptr->max_cache_size * 80 < cache_ptr->coll_list_size * 100) if(H5C_clear_coll_entries(cache_ptr, 1) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "H5C_clear_coll_entries() failed.") - } - } + } /* end if */ else { - if(cache_ptr->max_cache_size*40 < cache_ptr->coll_list_size*100) { - //fprintf(stderr, "COLL entries at 40.. CLEARING\n"); + if(cache_ptr->max_cache_size * 40 < cache_ptr->coll_list_size * 100) if(H5C_clear_coll_entries(cache_ptr, 1) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "H5C_clear_coll_entries() failed.") - } - } - } - } + } /* end else */ + } /* end if */ + } /* end if */ #endif /* H5_HAVE_PARALLEL */ done: @@ -3127,11 +3092,8 @@ done: #if H5C_DO_EXTREME_SANITY_CHECKS if ( ( H5C_validate_protected_entry_list(cache_ptr) < 0 ) || ( H5C_validate_pinned_entry_list(cache_ptr) < 0 ) || - ( H5C_validate_lru_list(cache_ptr) < 0 ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, \ - "an extreme sanity check failed on exit.\n"); - } + ( H5C_validate_lru_list(cache_ptr) < 0 ) ) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, NULL, "an extreme sanity check failed on exit.\n") #endif /* H5C_DO_EXTREME_SANITY_CHECKS */ FUNC_LEAVE_NOAPI(ret_value) @@ -3470,23 +3432,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C_set_evictions_enabled(H5C_t *cache_ptr, - hbool_t evictions_enabled) +H5C_set_evictions_enabled(H5C_t *cache_ptr, hbool_t evictions_enabled) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - if ( ( cache_ptr == NULL ) || ( cache_ptr->magic != H5C__H5C_T_MAGIC ) ) { - + if((cache_ptr == NULL) || (cache_ptr->magic != H5C__H5C_T_MAGIC)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad cache_ptr on entry.") - } - - if ( ( evictions_enabled != TRUE ) && ( evictions_enabled != FALSE ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Bad evictions_enabled on entry.") - } /* There is no fundamental reason why we should not permit * evictions to be disabled while automatic resize is enabled. @@ -3494,20 +3447,15 @@ H5C_set_evictions_enabled(H5C_t *cache_ptr, * want to, and allowing it would greatly complicate testing * the feature. Hence the following: */ - if ( ( evictions_enabled != TRUE ) && - ( ( cache_ptr->resize_ctl.incr_mode != H5C_incr__off ) || - ( cache_ptr->resize_ctl.decr_mode != H5C_decr__off ) ) ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "Can't disable evictions when auto resize enabled.") - } + if((evictions_enabled != TRUE) && + ((cache_ptr->resize_ctl.incr_mode != H5C_incr__off) || + (cache_ptr->resize_ctl.decr_mode != H5C_decr__off))) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't disable evictions when auto resize enabled.") cache_ptr->evictions_enabled = evictions_enabled; done: - FUNC_LEAVE_NOAPI(ret_value) - } /* H5C_set_evictions_enabled() */ @@ -4870,27 +4818,14 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, if ( (tests & H5C_RESIZE_CFG__VALIDATE_GENERAL) != 0 ) { - if ( ( config_ptr->set_initial_size != TRUE ) && - ( config_ptr->set_initial_size != FALSE ) ) { + if(config_ptr->max_size > H5C__MAX_MAX_CACHE_SIZE) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "max_size too big") - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "set_initial_size must be either TRUE or FALSE"); - } + if(config_ptr->min_size < H5C__MIN_MAX_CACHE_SIZE) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size too small") - if ( config_ptr->max_size > H5C__MAX_MAX_CACHE_SIZE ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "max_size too big"); - } - - if ( config_ptr->min_size < H5C__MIN_MAX_CACHE_SIZE ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size too small"); - } - - if ( config_ptr->min_size > config_ptr->max_size ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size > max_size"); - } + if(config_ptr->min_size > config_ptr->max_size) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "min_size > max_size") if ( ( config_ptr->set_initial_size ) && ( ( config_ptr->initial_size < config_ptr->min_size ) || @@ -4929,25 +4864,12 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, if ( config_ptr->incr_mode == H5C_incr__threshold ) { - if ( ( config_ptr->lower_hr_threshold < (double)0.0f ) || - ( config_ptr->lower_hr_threshold > (double)1.0f ) ) { + if((config_ptr->lower_hr_threshold < (double)0.0f) || + (config_ptr->lower_hr_threshold > (double)1.0f)) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "lower_hr_threshold must be in the range [0.0, 1.0]") - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "lower_hr_threshold must be in the range [0.0, 1.0]"); - } - - if ( config_ptr->increment < (double)1.0f ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "increment must be greater than or equal to 1.0"); - } - - if ( ( config_ptr->apply_max_increment != TRUE ) && - ( config_ptr->apply_max_increment != FALSE ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "apply_max_increment must be either TRUE or FALSE"); - } + if(config_ptr->increment < (double)1.0f) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "increment must be greater than or equal to 1.0") /* no need to check max_increment, as it is a size_t, * and thus must be non-negative. @@ -5025,26 +4947,13 @@ H5C_validate_resize_config(H5C_auto_size_ctl_t * config_ptr, "epochs_before_eviction must be positive"); } - if ( config_ptr->epochs_before_eviction > H5C__MAX_EPOCH_MARKERS ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "epochs_before_eviction too big"); - } - - if ( ( config_ptr->apply_empty_reserve != TRUE ) && - ( config_ptr->apply_empty_reserve != FALSE ) ) { + if(config_ptr->epochs_before_eviction > H5C__MAX_EPOCH_MARKERS) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "epochs_before_eviction too big") - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "apply_empty_reserve must be either TRUE or FALSE"); - } - - if ( ( config_ptr->apply_empty_reserve ) && - ( ( config_ptr->empty_reserve > (double)1.0f ) || - ( config_ptr->empty_reserve < (double)0.0f ) ) ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "empty_reserve must be in the interval [0.0, 1.0]"); - } + if((config_ptr->apply_empty_reserve) && + ((config_ptr->empty_reserve > (double)1.0f) || + (config_ptr->empty_reserve < (double)0.0f))) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "empty_reserve must be in the interval [0.0, 1.0]") /* no need to check max_decrement as it is a size_t * and thus must be non-negative. @@ -8666,20 +8575,20 @@ H5C_load_entry(H5F_t * f, HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank") if((comm = H5F_mpi_get_comm(f)) == MPI_COMM_NULL) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "get_comm request failed") - } + } /* end if */ #endif /* H5_HAVE_PARALLEL */ /* Get the on-disk entry image */ - if ( 0 == (type->flags & H5C__CLASS_SKIP_READS) ) { + if(0 == (type->flags & H5C__CLASS_SKIP_READS)) { #ifdef H5_HAVE_PARALLEL if(!coll_access || 0 == mpi_rank) { #endif /* H5_HAVE_PARALLEL */ - if(H5F_block_read(f, type->mem_type, addr, len, dxpl_id, image) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL, "Can't read image*") + if(H5F_block_read(f, type->mem_type, addr, len, dxpl_id, image) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL, "Can't read image*") #ifdef H5_HAVE_PARALLEL - } + } /* end if */ /* if the collective metadata read optimization is turned on, bcast the metadata read from process 0 to all ranks in the file communicator */ @@ -8689,9 +8598,9 @@ H5C_load_entry(H5F_t * f, H5_CHECKED_ASSIGN(buf_size, int, len, size_t); if(MPI_SUCCESS != (mpi_code = MPI_Bcast(image, buf_size, MPI_BYTE, 0, comm))) HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) - } + } /* end if */ #endif /* H5_HAVE_PARALLEL */ - } + } /* end if */ /* Deserialize the on-disk image into the native memory form */ if(NULL == (thing = type->deserialize(image, len, udata, &dirty))) @@ -8813,7 +8722,7 @@ H5C_load_entry(H5F_t * f, H5_CHECKED_ASSIGN(buf_size, int, new_len, size_t); if(MPI_SUCCESS != (mpi_code = MPI_Bcast(image, buf_size, MPI_BYTE, 0, comm))) HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) - } + } /* end if */ #endif /* H5_HAVE_PARALLEL */ /* Deserialize on-disk image into native memory form again */ @@ -9125,7 +9034,7 @@ H5C_make_space_in_cache(H5F_t * f, if(TRUE == entry_ptr->coll_access) { entry_ptr->coll_access = FALSE; H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) - } + } /* end if */ #endif if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__NO_FLAGS_SET, NULL, NULL) < 0) @@ -9149,7 +9058,7 @@ H5C_make_space_in_cache(H5F_t * f, if(TRUE == entry_ptr->coll_access) { entry_ptr->coll_access = FALSE; H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) - } + } /* end if */ #endif if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0) @@ -9291,10 +9200,10 @@ H5C_make_space_in_cache(H5F_t * f, #ifdef H5_HAVE_PARALLEL if(!(entry_ptr->coll_access)) { #endif /* H5_HAVE_PARALLEL */ - if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") + if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") #ifdef H5_HAVE_PARALLEL - } + } /* end if */ #endif /* H5_HAVE_PARALLEL */ /* we are scanning the clean LRU, so the serialize function diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 33d4abc..2f4d137 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -999,7 +999,7 @@ if ( ( (cache_ptr) == NULL ) || \ } #define H5C__PRE_HT_ENTRY_SIZE_CHANGE_SC(cache_ptr, old_size, new_size, \ - entry_ptr, was_clean) \ + entry_ptr, was_clean) \ if ( ( (cache_ptr) == NULL ) || \ ( (cache_ptr)->index_len <= 0 ) || \ ( (cache_ptr)->index_size <= 0 ) || \ @@ -1242,7 +1242,7 @@ if ( ( (cache_ptr)->index_size != \ H5C__POST_HT_REMOVE_SC(cache_ptr, entry_ptr) \ } -#define H5C__SEARCH_INDEX(cache_ptr, Addr, entry_ptr, fail_val) \ +#define H5C__SEARCH_INDEX(cache_ptr, Addr, entry_ptr, fail_val) \ { \ int k; \ int depth = 0; \ diff --git a/src/H5D.c b/src/H5D.c index 3bb20fb..9f2be83 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -917,6 +917,3 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Dset_extent() */ - -/* LocalWords: buf - */ diff --git a/src/H5F.c b/src/H5F.c index 22e9467..988462c 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -447,7 +447,7 @@ hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { H5F_t *new_file = NULL; /*file struct for new file */ - hid_t dxpl_id; /*dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /*dxpl used by library */ hid_t ret_value; /*return value */ FUNC_ENTER_API(FAIL) @@ -472,7 +472,6 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if(TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file create property list") - dxpl_id = H5AC_dxpl_id; /* Verify access property list and get correct dxpl */ if(H5P_verify_and_set_dxpl(&fapl_id, H5P_FILE_ACCESS, H5P_FILE_ACCESS_DEFAULT, &dxpl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") @@ -552,7 +551,7 @@ hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) { H5F_t *new_file = NULL; /*file struct for new file */ - hid_t dxpl_id; /*dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /*dxpl used by library */ hid_t ret_value; /*return value */ FUNC_ENTER_API(FAIL) @@ -566,7 +565,6 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) (flags & H5F_ACC_TRUNC) || (flags & H5F_ACC_EXCL)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file open flags") - dxpl_id = H5AC_dxpl_id; /* Verify access property list and get correct dxpl */ if(H5P_verify_and_set_dxpl(&fapl_id, H5P_FILE_ACCESS, H5P_FILE_ACCESS_DEFAULT, &dxpl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index aa6cc2a..122f711 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -32,6 +32,14 @@ #define H5CHECK #endif /* _H5private_H */ +/* When this header is included from a private HDF5 header, don't make calls to H5open() */ +#undef H5OPEN +#ifndef _H5private_H +#define H5OPEN H5open(), +#else /* _H5private_H */ +#define H5OPEN +#endif /* _H5private_H */ + /* * These are the bits that can be passed to the `flags' argument of * H5Fcreate() and H5Fopen(). Use the bit-wise OR operator (|) to combine @@ -44,16 +52,16 @@ * Note that H5F_ACC_DEBUG is deprecated (nonfuncational) but retained as a * symbol for backward compatibility. */ -#define H5F_ACC_RDONLY (H5CHECK 0x0000u) /*absence of rdwr => rd-only */ -#define H5F_ACC_RDWR (H5CHECK 0x0001u) /*open for read and write */ -#define H5F_ACC_TRUNC (H5CHECK 0x0002u) /*overwrite existing files */ -#define H5F_ACC_EXCL (H5CHECK 0x0004u) /*fail if file already exists*/ +#define H5F_ACC_RDONLY (H5CHECK H5OPEN 0x0000u) /*absence of rdwr => rd-only */ +#define H5F_ACC_RDWR (H5CHECK H5OPEN 0x0001u) /*open for read and write */ +#define H5F_ACC_TRUNC (H5CHECK H5OPEN 0x0002u) /*overwrite existing files */ +#define H5F_ACC_EXCL (H5CHECK H5OPEN 0x0004u) /*fail if file already exists*/ /* NOTE: 0x0008u was H5F_ACC_DEBUG, now deprecated */ -#define H5F_ACC_CREAT (H5CHECK 0x0010u) /*create non-existing files */ +#define H5F_ACC_CREAT (H5CHECK H5OPEN 0x0010u) /*create non-existing files */ /* Value passed to H5Pset_elink_acc_flags to cause flags to be taken from the * parent file. */ -#define H5F_ACC_DEFAULT (H5CHECK 0xffffu) /*ignore setting on lapl */ +#define H5F_ACC_DEFAULT (H5CHECK H5OPEN 0xffffu) /*ignore setting on lapl */ /* Flags for H5Fget_obj_count() & H5Fget_obj_ids() calls */ #define H5F_OBJ_FILE (0x0001u) /* File objects */ @@ -223,7 +231,7 @@ H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag); #ifndef H5_NO_DEPRECATED_SYMBOLS /* Macros */ -#define H5F_ACC_DEBUG (H5CHECK 0x0000u) /*print debug info (deprecated)*/ +#define H5F_ACC_DEBUG (H5CHECK H5OPEN 0x0000u) /*print debug info (deprecated)*/ /* Typedefs */ diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 5b6b44f..4c2d40e 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -7552,7 +7552,6 @@ main(int argc, char **argv) world_mpi_rank, FUNC); } } - } setup_rand(); @@ -7574,7 +7573,6 @@ main(int argc, char **argv) #if 1 server_smoke_check(); #endif - #if 1 smoke_check_1(H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY); smoke_check_1(H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED); @@ -7644,3 +7642,4 @@ finish: /* cannot just return (failures) because exit code is limited to 1byte */ return(failures != 0); } + -- cgit v0.12 From c09393ed0a2624cc04556249ef5549c2485efe8f Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Thu, 14 Jan 2016 16:56:16 -0500 Subject: [svn-r28902] Remove 3 files in autom4te.cache from MANIFEST. They are generated by autogen.sh and were inadvertently added along with configure and Makefile.in files but are not checked in and should not be installed. Furthermore they are not generated on all systems by autogen.sh and cause chkmanifest to fail when run be release scripts. --- MANIFEST | 3 --- 1 file changed, 3 deletions(-) diff --git a/MANIFEST b/MANIFEST index 4899ab2..eb15f23 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2533,9 +2533,6 @@ # Files generated by autogen ./aclocal.m4 -./autom4te.cache/output.0 -./autom4te.cache/requests -./autom4te.cache/traces.0 ./bin/compile ./bin/config.guess ./bin/config.sub -- cgit v0.12 From 0d68aa89cede07df85eca611510a6271fbbb1d8a Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Fri, 15 Jan 2016 10:53:33 -0500 Subject: [svn-r28905] Purpose: Fix user reported problem Description: User Adam Rosenberger reported a failure when using the member function AbstractDs::getArrayType(). This problem was caused by missing initialization of the ArrayType's members in some cases. Solution: - Added ArrayType::setArrayInfo() to retrieve rank and dimensions of an array and store them in memory for easy access. - Re-factored a few functions to use the new function. - We'll give him 1.8.16 patch Platforms tested: Linux/32 2.6 (jam) Linux/64 (platypus) Darwin (osx1010test) --- c++/src/H5AbstractDs.cpp | 3 + c++/src/H5ArrayType.cpp | 123 ++++++++++++------- c++/src/H5ArrayType.h | 3 + c++/src/H5CompType.cpp | 11 +- c++/test/Makefile.am | 7 +- c++/test/h5cpputil.h | 2 + c++/test/tarray.cpp | 312 +++++++++++++++++++++++++++++++++++++++++++++++ c++/test/testhdf5.cpp | 2 +- c++/test/ttypes.cpp | 1 - 9 files changed, 407 insertions(+), 57 deletions(-) create mode 100644 c++/test/tarray.cpp diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp index 06b3e22..4e9a4d5 100644 --- a/c++/src/H5AbstractDs.cpp +++ b/c++/src/H5AbstractDs.cpp @@ -141,8 +141,11 @@ ArrayType AbstractDs::getArrayType() const // depending on which object invokes getArrayType. Then, create and // return the ArrayType object try { + // Create ArrayType and set values this way to work around the + // problem described in the JIRA issue HDFFV-7947 ArrayType arraytype; f_DataType_setId(&arraytype, p_get_type()); + arraytype.setArrayInfo(); return(arraytype); } catch (DataSetIException E) { diff --git a/c++/src/H5ArrayType.cpp b/c++/src/H5ArrayType.cpp index 85340f8..0f09631 100644 --- a/c++/src/H5ArrayType.cpp +++ b/c++/src/H5ArrayType.cpp @@ -35,12 +35,7 @@ namespace H5 { ///\brief Default constructor: Creates a stub ArrayType // Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- -ArrayType::ArrayType() : DataType() -{ - // Initialize members - rank = -1; - dimensions = NULL; -} +ArrayType::ArrayType() : DataType(), rank(-1), dimensions(NULL) {} //-------------------------------------------------------------------------- // Function: ArrayType overloaded constructor @@ -51,20 +46,7 @@ ArrayType::ArrayType() : DataType() //-------------------------------------------------------------------------- ArrayType::ArrayType( const hid_t existing_id ) : DataType( existing_id ) { - // Get the rank of the existing array and store it in this array - rank = H5Tget_array_ndims(existing_id); - if (rank < 0) - { - throw DataTypeIException("ArrayType constructor (existing id)", "H5Tget_array_ndims failed"); - } - - // Allocate space for the dimensions - dimensions = new hsize_t[rank]; - - // Get the dimensions of the existing array and store it in this array - int ret_value = H5Tget_array_dims2(id, dimensions); - if (ret_value < 0) - throw DataTypeIException("ArrayType constructor (existing id)", "H5Tget_array_dims2 failed"); + setArrayInfo(); } //-------------------------------------------------------------------------- @@ -111,25 +93,67 @@ ArrayType::ArrayType(const DataType& base_type, int ndims, const hsize_t* dims) } //-------------------------------------------------------------------------- +// Function: ArrayType::setArrayInfo +///\brief Retrieves the rank and dimensions from the array datatype +/// and store the info in this ArrayType object. +///\exception H5::DataTypeIException +// Programmer Binh-Minh Ribler - January 2016 +//-------------------------------------------------------------------------- +void ArrayType::setArrayInfo() +{ + // Get the rank of the array type specified by id from the C API + int ndims = H5Tget_array_ndims(id); + if (ndims < 0) + { + throw DataTypeIException("ArrayType::setArrayInfo", "H5Tget_array_ndims failed"); + } + + // Get the dimensions from the C API + hsize_t* dims; + dims = new hsize_t[ndims]; + if (dims != NULL) + { + // Get the dimensions + ndims = H5Tget_array_dims2(id, dims); + if (ndims < 0) + throw DataTypeIException("ArrayType::setArrayInfo", "H5Tget_array_dims2 failed"); + + // Store the array's info in memory + rank = ndims; + dimensions = new hsize_t[rank]; + for (int i = 0; i < rank; i++) + dimensions[i] = dims[i]; + delete []dims; + } +} // setArrayInfo + +//-------------------------------------------------------------------------- // Function: ArrayType::getArrayNDims ///\brief Returns the number of dimensions for an array datatype. ///\return Number of dimensions ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - May 2004 +// Modification +// Modified to use setArrayInfo(). +// If rank is positive, return rank +// If rank is invalid but object has a valid identifier, obtain the +// rank and dimensions, store them in the object, and return rank +// Otherwise, i.e., rank is invalid and object doesn't have a +// valid identifier, throw an exception //-------------------------------------------------------------------------- int ArrayType::getArrayNDims() { - // If the array's rank has not been stored, i.e. rank is init to -1, - // retrieve it via the C API - if (rank < 0) - { - rank = H5Tget_array_ndims(id); - if (rank < 0) - { - throw DataTypeIException("ArrayType::getArrayNDims", "H5Tget_array_ndims failed"); - } - } - return(rank); + // Validate the id first, this object could be a default object + if (!p_valid_id(id)) + throw DataTypeIException("ArrayType::getArrayNDims", "ArrayType object is not a valid array type."); + + // If the array's info has not been stored, i.e. "rank" still has its + // initial value, -1, and "dimensions" is still NULL, retrieve rank and + // dimensions via the C API and store them in this ArrayType object. + if (rank < 0 && dimensions == NULL) + setArrayInfo(); + + return(rank); } //-------------------------------------------------------------------------- @@ -139,25 +163,30 @@ int ArrayType::getArrayNDims() ///\return Number of dimensions ///\exception H5::DataTypeIException // Programmer Binh-Minh Ribler - May 2004 +// Modification +// Jan, 2016 +// Modified to use setArrayInfo(). +// If the array information has not been stored, retrieve rank and +// dimensions of the array type identified by "id" via the C API. +// Copy "dimensions" to the user's buffer //-------------------------------------------------------------------------- int ArrayType::getArrayDims(hsize_t* dims) { - // If the array's dimensions have not been stored, retrieve them via C API - if (dimensions == NULL) - { - int ndims = H5Tget_array_dims2(id, dims); - if (ndims < 0) - throw DataTypeIException("ArrayType::getArrayDims", "H5Tget_array_dims2 failed"); - // Store the array's info in memory - rank = ndims; - dimensions = new hsize_t[rank]; - for (int i = 0; i < rank; i++) - dimensions[i] = dims[i]; - } - // Otherwise, simply copy what's in 'dimensions' to 'dims' - for (int i = 0; i < rank; i++) - dims[i] = dimensions[i]; - return(rank); + // Validate the id first, this object could be a default object + if (!p_valid_id(id)) + throw DataTypeIException("ArrayType::getArrayDims", "ArrayType object is not a valid array type."); + + // If the array's info has not been stored, i.e. "rank" still has its + // initial value, -1, and "dimensions" is still NULL, retrieve rank and + // dimensions via the C API and store them in this ArrayType object. + if (rank < 0 && dimensions == NULL) + setArrayInfo(); + + // Copy what's in "dimensions" to user's buffer "dims" + for (int i = 0; i < rank; i++) + dims[i] = dimensions[i]; + + return(rank); } //-------------------------------------------------------------------------- diff --git a/c++/src/H5ArrayType.h b/c++/src/H5ArrayType.h index 6577a6e..c0f4b38 100644 --- a/c++/src/H5ArrayType.h +++ b/c++/src/H5ArrayType.h @@ -31,6 +31,9 @@ class H5_DLLCPP ArrayType : public DataType { // specified base type. ArrayType(const DataType& base_type, int ndims, const hsize_t* dims); + // Stores the rank and dimensions in memory. + void setArrayInfo(); + // Returns the number of dimensions of this array datatype. int getArrayNDims(); diff --git a/c++/src/H5CompType.cpp b/c++/src/H5CompType.cpp index 6d31a68..82575d6 100644 --- a/c++/src/H5CompType.cpp +++ b/c++/src/H5CompType.cpp @@ -228,12 +228,12 @@ hid_t CompType::p_get_member_type(unsigned member_num) const DataType CompType::getMemberDataType( unsigned member_num ) const { try { - DataType datatype; + DataType datatype; f_DataType_setId(&datatype, p_get_member_type(member_num)); - return(datatype); + return(datatype); } catch (DataTypeIException E) { - throw DataTypeIException("CompType::getMemberDataType", E.getDetailMsg()); + throw DataTypeIException("CompType::getMemberDataType", E.getDetailMsg()); } } @@ -249,9 +249,10 @@ DataType CompType::getMemberDataType( unsigned member_num ) const ArrayType CompType::getMemberArrayType( unsigned member_num ) const { try { - ArrayType arraytype(p_get_member_type(member_num)); + ArrayType arraytype; f_DataType_setId(&arraytype, p_get_member_type(member_num)); - return(arraytype); + arraytype.setArrayInfo(); + return(arraytype); } catch (DataTypeIException E) { throw DataTypeIException("CompType::getMemberArrayType", E.getDetailMsg()); diff --git a/c++/test/Makefile.am b/c++/test/Makefile.am index 705ec72..07fe533 100644 --- a/c++/test/Makefile.am +++ b/c++/test/Makefile.am @@ -31,9 +31,10 @@ check_PROGRAMS=$(TEST_PROG) # The tests depend on the hdf5 library, test library, and the c++ library LDADD=$(LIBH5TEST) $(LIBH5CPP) $(LIBHDF5) -testhdf5_SOURCES=testhdf5.cpp dsets.cpp tattr.cpp tcompound.cpp \ - tdspl.cpp tfile.cpp tfilter.cpp th5s.cpp tlinks.cpp tobject.cpp \ - trefer.cpp ttypes.cpp tvlstr.cpp h5cpputil.cpp +testhdf5_SOURCES=testhdf5.cpp dsets.cpp tattr.cpp tarray.cpp \ + tcompound.cpp tdspl.cpp tfile.cpp tfilter.cpp th5s.cpp \ + tlinks.cpp tobject.cpp trefer.cpp ttypes.cpp tvlstr.cpp \ + h5cpputil.cpp # Tell conclude.am that these are C++ tests. CXX_API=yes diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h index 8625213..b615194 100644 --- a/c++/test/h5cpputil.h +++ b/c++/test/h5cpputil.h @@ -132,6 +132,7 @@ template #ifdef __cplusplus extern "C" { #endif +void test_array(); void test_attr(); void test_compound(); void test_dsproplist(); @@ -146,6 +147,7 @@ void test_vlstrings(); void test_dset(); /* Prototypes for the cleanup routines */ +void cleanup_array(); void cleanup_attr(); void cleanup_compound(); void cleanup_dsproplist(); diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp new file mode 100644 index 0000000..69b4438 --- /dev/null +++ b/c++/test/tarray.cpp @@ -0,0 +1,312 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/***************************************************************************** + FILE + tarray.cpp - HDF5 C++ testing the array datatype functionality + + ***************************************************************************/ + +#ifdef OLD_HEADER_FILENAME +#include +#else +#include +#endif +#include + +#ifndef H5_NO_NAMESPACE +#ifndef H5_NO_STD + using std::cerr; + using std::endl; +#endif // H5_NO_STD +#endif + +#include "H5Cpp.h" // C++ API header file + +#ifndef H5_NO_NAMESPACE + using namespace H5; +#endif + +#include "h5cpputil.h" // C++ utilility header file + +const H5std_string FILENAME("tarray.h5"); +const hsize_t SPACE1_RANK = 1; +const hsize_t SPACE1_DIM1 = 4; +const hsize_t ARRAY1_RANK = 1; +const hsize_t ARRAY1_DIM1 = 4; + +typedef enum flt_t { + FLT_FLOAT, FLT_DOUBLE, FLT_LDOUBLE, FLT_OTHER +} flt_t; + +typedef enum int_t { + INT_CHAR, INT_UCHAR, INT_SHORT, INT_USHORT, INT_INT, INT_UINT, + INT_LONG, INT_ULONG, INT_LLONG, INT_ULLONG, INT_OTHER +} int_t; + + +/*------------------------------------------------------------------------- + * Function: test_array_compound_array + * + * Purpose: Tests 1-D array of compound datatypes (with array fields) + * + * Return: None. + * + * Programmer: Binh-Minh Ribler (using C version) + * January, 2016 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void test_array_compound_array() +{ + SUBTEST("ArrayType::getArrayNDims & ArrayType::getArrayDims"); + typedef struct { // Typedef for compound datatype */ + int i; + float f[ARRAY1_DIM1]; + } s1_t; + s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; // Information to write + s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; // Information read in + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims1[] = {ARRAY1_DIM1}; + int nmemb; // Number of compound members + int ii, jj, kk; // counting variables + H5T_class_t mclass; // Datatype class for field + + // Initialize array data to write + for (ii =0; ii < SPACE1_DIM1; ii++) + for (jj = 0; jj < ARRAY1_DIM1; jj++) { + wdata[ii][jj].i = ii * 10 + jj; + for(kk = 0; kk < ARRAY1_DIM1; kk++) + wdata[ii][jj].f[kk]=(float)(ii * 10.0F + jj * 2.5F + kk); + } // end for + + try { + // Create File + H5File file1(FILENAME, H5F_ACC_TRUNC); + + // Create dataspace for datasets + DataSpace space(SPACE1_RANK, sdims1, NULL); + + /* + * Create an array datatype of compounds, arrtype. Each compound + * datatype, comptype, contains an integer and an array of floats, + * arrfltype. + */ + + // Create a compound datatype + CompType comptype(sizeof(s1_t)); + + // Insert integer field + comptype.insertMember("i", HOFFSET(s1_t, i), PredType::NATIVE_INT); + + // Create an array of floats datatype + ArrayType arrfltype(PredType::NATIVE_FLOAT, ARRAY1_RANK, tdims1); + + // Insert float array field + comptype.insertMember("f", HOFFSET(s1_t, f), arrfltype); + + // Close array of floats field datatype + arrfltype.close(); + + // Create an array datatype of the compound datatype + ArrayType arrtype(comptype, ARRAY1_RANK, tdims1); + + // Close compound datatype comptype + comptype.close(); + + // Create a dataset + DataSet dataset = file1.createDataSet("Dataset1", arrtype, space); + + // Write dataset to disk + dataset.write(wdata, arrtype); + + // Close all + dataset.close(); + arrtype.close(); + space.close(); + file1.close(); + + // Re-open file + file1.openFile(FILENAME, H5F_ACC_RDONLY); + + // Open the dataset + dataset = file1.openDataSet("Dataset1"); + + /* + * Check the datatype array of compounds + */ + + // Verify that it is an array of compounds + DataType dstype = dataset.getDataType(); + mclass = dstype.getClass(); + verify_val(mclass, H5T_ARRAY, "f2_type.getClass", __LINE__, __FILE__); + dstype.close(); + + // Get the array datatype to check + ArrayType atype_check = dataset.getArrayType(); + + // Check the array rank + int ndims = atype_check.getArrayNDims(); + verify_val(ndims, ARRAY1_RANK, "atype_check.getArrayNDims", __LINE__, __FILE__); + + // Get the array dimensions + hsize_t rdims1[H5S_MAX_RANK]; + atype_check.getArrayDims(rdims1); + + // Check the array dimensions + for (ii =0; ii Date: Fri, 15 Jan 2016 10:57:00 -0500 Subject: [svn-r28906] Description: Added c++/test/tarray.cpp. --- MANIFEST | 1 + c++/test/CMakeLists.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/MANIFEST b/MANIFEST index eb15f23..42a1736 100644 --- a/MANIFEST +++ b/MANIFEST @@ -381,6 +381,7 @@ ./c++/test/dsets.cpp ./c++/test/h5cpputil.cpp ./c++/test/h5cpputil.h +./c++/test/tarray.cpp ./c++/test/tattr.cpp ./c++/test/tcompound.cpp ./c++/test/tdspl.cpp diff --git a/c++/test/CMakeLists.txt b/c++/test/CMakeLists.txt index 6f1d857..4bebeac 100644 --- a/c++/test/CMakeLists.txt +++ b/c++/test/CMakeLists.txt @@ -13,6 +13,7 @@ PROJECT (HDF5_CPP_TEST) #----------------------------------------------------------------------------- set (CPP_TEST_SRCS ${HDF5_CPP_TEST_SOURCE_DIR}/testhdf5.cpp + ${HDF5_CPP_TEST_SOURCE_DIR}/tarray.cpp ${HDF5_CPP_TEST_SOURCE_DIR}/tattr.cpp ${HDF5_CPP_TEST_SOURCE_DIR}/tcompound.cpp ${HDF5_CPP_TEST_SOURCE_DIR}/tdspl.cpp -- cgit v0.12 From b10dd41aef81062d8792da89301756bfec996ff0 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 15 Jan 2016 18:06:25 -0500 Subject: [svn-r28915] Description: Review revisions on the way to the trunk. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest not required on this branch) --- src/H5A.c | 82 ++++++++++++++++++++++++-------------------------- src/H5AC.c | 14 ++++----- src/H5ACprivate.h | 2 +- src/H5C.c | 2 +- src/H5D.c | 12 ++++---- src/H5F.c | 8 ++--- src/H5G.c | 20 ++++++------- src/H5L.c | 86 ++++++++++++++++++++++++++--------------------------- src/H5Lexternal.c | 4 +-- src/H5O.c | 32 ++++++++++---------- src/H5Pfapl.c | 89 +++++++++++++++++++++++++++++++++++++++---------------- src/H5Pint.c | 68 ++++++++++++++++++++++++++++-------------- src/H5Ppkg.h | 27 ----------------- src/H5Pprivate.h | 44 ++++++++++++++++++++++----- src/H5Tcommit.c | 12 ++++---- 15 files changed, 278 insertions(+), 224 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index 56f6307..e478610 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -273,9 +273,8 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&aapl_id, H5P_ATTRIBUTE_ACCESS, H5P_ATTRIBUTE_ACCESS_DEFAULT, - &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Go do the real work for attaching the attribute to the object */ if(NULL == (attr = H5A_create(&loc, attr_name, type, space, acpl_id, dxpl_id))) @@ -365,22 +364,20 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, obj_loc.path = &obj_path; H5G_loc_reset(&obj_loc); - dxpl_id = H5AC_ind_dxpl_id; /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&aapl_id, H5P_ATTRIBUTE_ACCESS, H5P_ATTRIBUTE_ACCESS_DEFAULT, - &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + dxpl_id = H5AC_ind_dxpl_id; + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Find the object's location */ if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; - dxpl_id = H5AC_dxpl_id; /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&aapl_id, H5P_ATTRIBUTE_ACCESS, H5P_ATTRIBUTE_ACCESS_DEFAULT, - &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + dxpl_id = H5AC_dxpl_id; + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Go do the real work for attaching the attribute to the dataset */ if(NULL == (attr = H5A_create(&obj_loc, attr_name, type, space, acpl_id, dxpl_id))) @@ -439,9 +436,8 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&aapl_id, H5P_ATTRIBUTE_ACCESS, H5P_ATTRIBUTE_ACCESS_DEFAULT, - &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Read in attribute from object header */ if(NULL == (attr = H5O_attr_open_by_name(loc.oloc, attr_name, dxpl_id))) @@ -514,9 +510,8 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&aapl_id, H5P_ATTRIBUTE_ACCESS, H5P_ATTRIBUTE_ACCESS_DEFAULT, - &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ if(NULL == (attr = H5A_open_by_name(&loc, obj_name, attr_name, lapl_id, dxpl_id))) @@ -591,9 +586,8 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&aapl_id, H5P_ATTRIBUTE_ACCESS, H5P_ATTRIBUTE_ACCESS_DEFAULT, - &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute in the object header */ if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, dxpl_id))) @@ -924,8 +918,8 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, dxpl_id))) @@ -1061,8 +1055,8 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ if(NULL == (attr = H5A_open_by_name(&loc, obj_name, attr_name, lapl_id, dxpl_id))) @@ -1123,8 +1117,8 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, dxpl_id))) @@ -1222,8 +1216,8 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new attribute name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Avoid thrashing things if the names are the same */ if(HDstrcmp(old_attr_name, new_attr_name)) { @@ -1398,8 +1392,8 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1522,10 +1516,10 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") - dxpl_id = H5AC_ind_dxpl_id; /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + dxpl_id = H5AC_ind_dxpl_id; + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1537,10 +1531,10 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; - dxpl_id = H5AC_dxpl_id; /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + dxpl_id = H5AC_dxpl_id; + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Delete the attribute from the location */ if(H5O_attr_remove(obj_loc.oloc, attr_name, dxpl_id) < 0) @@ -1606,10 +1600,10 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - dxpl_id = H5AC_ind_dxpl_id; /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + dxpl_id = H5AC_ind_dxpl_id; + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1621,10 +1615,10 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; - dxpl_id = H5AC_dxpl_id; /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + dxpl_id = H5AC_dxpl_id; + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Delete the attribute from the location */ if(H5O_attr_remove_by_idx(obj_loc.oloc, idx_type, order, n, dxpl_id) < 0) @@ -1750,8 +1744,8 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") if((ret_value = H5A_exists_by_name(loc, obj_name, attr_name, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") diff --git a/src/H5AC.c b/src/H5AC.c index 7388195..371bd01 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -91,8 +91,8 @@ hid_t H5AC_dxpl_id = (-1); H5P_genplist_t *H5AC_ind_dxpl_g = NULL; hid_t H5AC_ind_dxpl_id = (-1); -hid_t H5AC_coll_write_coll_read_dxpl_id=(-1); -hid_t H5AC_ind_write_coll_read_dxpl_id=(-1); +hid_t H5AC_coll_write_coll_read_dxpl_id = (-1); +hid_t H5AC_ind_write_coll_read_dxpl_id = (-1); /*******************/ /* Local Variables */ @@ -175,7 +175,7 @@ H5AC__init_package(void) { #ifdef H5_HAVE_PARALLEL H5P_genplist_t *xfer_plist; /* Dataset transfer property list object */ - unsigned coll_meta_write; /* "collective metadata write" property value */ + hbool_t coll_meta_write; /* "collective metadata write" property value */ H5P_coll_md_read_flag_t coll_meta_read; #endif /* H5_HAVE_PARALLEL */ herr_t ret_value = SUCCEED; /* Return value */ @@ -195,7 +195,7 @@ H5AC__init_package(void) HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") /* Insert 'collective metadata write' property */ - coll_meta_write = 1; + coll_meta_write = TRUE; if(H5P_insert(xfer_plist, H5AC_COLLECTIVE_META_WRITE_NAME, H5AC_COLLECTIVE_META_WRITE_SIZE, &coll_meta_write, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") @@ -209,7 +209,7 @@ H5AC__init_package(void) HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") /* Insert 'collective metadata write' property */ - coll_meta_write = 0; + coll_meta_write = FALSE; if(H5P_insert(H5AC_ind_dxpl_g, H5AC_COLLECTIVE_META_WRITE_NAME, H5AC_COLLECTIVE_META_WRITE_SIZE, &coll_meta_write, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") @@ -223,7 +223,7 @@ H5AC__init_package(void) HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") /* Insert 'collective metadata write' property */ - coll_meta_write = 1; + coll_meta_write = TRUE; if(H5P_insert(xfer_plist, H5AC_COLLECTIVE_META_WRITE_NAME, H5AC_COLLECTIVE_META_WRITE_SIZE, &coll_meta_write, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") @@ -243,7 +243,7 @@ H5AC__init_package(void) HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") /* Insert 'collective metadata write' property */ - coll_meta_write = 0; + coll_meta_write = FALSE; if(H5P_insert(xfer_plist, H5AC_COLLECTIVE_META_WRITE_NAME, H5AC_COLLECTIVE_META_WRITE_SIZE, &coll_meta_write, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index bd23fea..50e7ab1 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -186,7 +186,7 @@ typedef H5C_t H5AC_t; #ifdef H5_HAVE_PARALLEL /* Definitions for "collective metadata write" property */ #define H5AC_COLLECTIVE_META_WRITE_NAME "H5AC_collective_metadata_write" -#define H5AC_COLLECTIVE_META_WRITE_SIZE sizeof(unsigned) +#define H5AC_COLLECTIVE_META_WRITE_SIZE sizeof(hbool_t) #define H5AC_COLLECTIVE_META_WRITE_DEF 0 #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5C.c b/src/H5C.c index 8c80ce7..929e721 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -7828,7 +7828,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ */ if(!clear_only && entry_ptr->is_dirty && H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { H5P_genplist_t *dxpl; /* Dataset transfer property list */ - unsigned coll_meta; /* Collective metadata write flag */ + hbool_t coll_meta; /* Collective metadata write flag */ /* Get the dataset transfer property list */ if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id))) diff --git a/src/H5D.c b/src/H5D.c index 9f2be83..528d341 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -139,8 +139,8 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&dapl_id, H5P_DATASET_ACCESS, H5P_DATASET_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create the new dataset & get its ID */ if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id, dxpl_id))) @@ -219,8 +219,8 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&dapl_id, H5P_DATASET_ACCESS, H5P_DATASET_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* build and open the new dataset */ if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id, dxpl_id))) @@ -288,8 +288,8 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&dapl_id, H5P_DATASET_ACCESS, H5P_DATASET_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the dataset */ if(NULL == (dset = H5D__open_name(&loc, name, dapl_id, dxpl_id))) diff --git a/src/H5F.c b/src/H5F.c index 988462c..cd35182 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -473,8 +473,8 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file create property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&fapl_id, H5P_FILE_ACCESS, H5P_FILE_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* * Adjust bit flags by turning on the creation bit and making sure that @@ -566,8 +566,8 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file open flags") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&fapl_id, H5P_FILE_ACCESS, H5P_FILE_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the file */ if(NULL == (new_file = H5F_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) diff --git a/src/H5G.c b/src/H5G.c index 6a9342c..8798a82 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -317,8 +317,8 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group create property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&gapl_id, H5P_GROUP_ACCESS, H5P_GROUP_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create the new group & get its ID */ if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id, gapl_id, dxpl_id))) @@ -394,8 +394,8 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group create property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&gapl_id, H5P_GROUP_ACCESS, H5P_GROUP_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up group creation info */ gcrt_info.gcpl_id = gcpl_id; @@ -466,8 +466,8 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&gapl_id, H5P_GROUP_ACCESS, H5P_GROUP_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the group */ if((grp = H5G__open_name(&loc, name, gapl_id, dxpl_id)) == NULL) @@ -604,8 +604,8 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ grp_loc.oloc = &grp_oloc; @@ -672,8 +672,8 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ grp_loc.oloc = &grp_oloc; diff --git a/src/H5L.c b/src/H5L.c index 9e0e277..23eb395 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -357,6 +357,10 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Set up src & dst location pointers */ src_loc_p = &src_loc; dst_loc_p = &dst_loc; @@ -365,10 +369,6 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, else if(dst_loc_id == H5L_SAME_LOC) dst_loc_p = src_loc_p; - /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") - /* Move the link */ if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, FALSE, lcpl_id, lapl_id, dxpl_id) < 0) @@ -420,6 +420,10 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Set up src & dst location pointers */ src_loc_p = &src_loc; dst_loc_p = &dst_loc; @@ -428,10 +432,6 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, else if(dst_loc_id == H5L_SAME_LOC) dst_loc_p = src_loc_p; - /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") - /* Copy the link */ if(H5L_move(src_loc_p, src_name, dst_loc_p, dst_name, TRUE, lcpl_id, lapl_id, dxpl_id) < 0) @@ -482,8 +482,8 @@ H5Lcreate_soft(const char *link_target, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create the link */ if(H5L_create_soft(link_target, &link_loc, link_name, lcpl_id, lapl_id, dxpl_id) < 0) @@ -537,6 +537,10 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Set up current & new location pointers */ cur_loc_p = &cur_loc; new_loc_p = &new_loc; @@ -547,10 +551,6 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, else if(cur_loc_p->oloc->file != new_loc_p->oloc->file) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should be in the same file.") - /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") - /* Create the link */ if(H5L_create_hard(cur_loc_p, cur_name, new_loc_p, new_name, lcpl_id, lapl_id, dxpl_id) < 0) @@ -606,8 +606,8 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create external link */ if(H5L_create_ud(&link_loc, link_name, udata, udata_size, link_type, lcpl_id, lapl_id, dxpl_id) < 0) @@ -652,8 +652,8 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Unlink */ if(H5L_delete(&loc, name, lapl_id, dxpl_id) < 0) @@ -706,8 +706,8 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for unlink operation */ udata.idx_type = idx_type; @@ -762,8 +762,8 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Get the link value */ if(H5L_get_val(&loc, name, buf, size, lapl_id, dxpl_id) < 0) @@ -817,8 +817,8 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for retrieving information */ udata.idx_type = idx_type; @@ -869,8 +869,8 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Check for the existence of the link */ if((ret_value = H5L__exists(&loc, name, lapl_id, dxpl_id)) < 0) @@ -913,12 +913,12 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Get the link information */ if(H5L_get_info(&loc, name, linfo, lapl_id, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") done: FUNC_LEAVE_API(ret_value) @@ -964,8 +964,8 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for callback */ udata.idx_type = idx_type; @@ -977,8 +977,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, /* Traverse the group hierarchy to locate the object to get info about */ if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_get_info_by_idx_cb, &udata, lapl_id, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") - + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") done: FUNC_LEAVE_API(ret_value) @@ -1154,8 +1153,8 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for callback */ udata.idx_type = idx_type; @@ -1169,7 +1168,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, /* Traverse the group hierarchy to locate the link to get name of */ if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_get_name_by_idx_cb, &udata, lapl_id, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist") + HGOTO_ERROR(H5E_LINK, H5E_EXISTS, FAIL, "name doesn't exist") /* Set the return value */ ret_value = udata.name_len; @@ -1234,8 +1233,7 @@ H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, lnk_op.op_func.op_new = op; /* Iterate over the links */ - if((ret_value = H5G_iterate(grp_id, ".", idx_type, order, idx, &last_lnk, &lnk_op, - op_data, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_iterate(grp_id, ".", idx_type, order, idx, &last_lnk, &lnk_op, op_data, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") /* Set the index we stopped at */ @@ -1295,8 +1293,8 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up iteration beginning/end info */ idx = (idx_p == NULL ? 0 : *idx_p); @@ -1309,7 +1307,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, /* Iterate over the links */ if((ret_value = H5G_iterate(loc_id, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data, lapl_id, dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") /* Set the index we stopped at */ if(idx_p) @@ -1428,12 +1426,12 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Call internal group visitation routine */ if((ret_value = H5G_visit(loc_id, group_name, idx_type, order, op, op_data, lapl_id, dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link visitation failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index f029ebc..3e8be66 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -599,8 +599,8 @@ H5Lcreate_external(const char *file_name, const char *obj_name, HDstrncpy((char *)p, norm_obj_name, buf_size - (file_name_len + 1)); /* External link's object */ /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create an external link */ if(H5L_create_ud(&link_loc, link_name, ext_link_buf, buf_size, H5L_TYPE_EXTERNAL, lcpl_id, lapl_id, dxpl_id) < 0) diff --git a/src/H5O.c b/src/H5O.c index 26204e5..01be3e6 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -300,8 +300,8 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -450,8 +450,8 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Link to the object */ if(H5L_link(&new_loc, new_name, &obj_loc, lcpl_id, lapl_id, dxpl_id) < 0) @@ -574,8 +574,8 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Check if the object exists */ if((ret_value = H5G_loc_exists(&loc, name, lapl_id, dxpl_id)) < 0) @@ -655,8 +655,8 @@ H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lap HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Retrieve the object's information */ if(H5G_loc_info(&loc, name, TRUE, oinfo/*out*/, lapl_id, dxpl_id) < 0) @@ -710,8 +710,8 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -810,8 +810,8 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* (Re)set the object's comment */ if(H5G_loc_set_comment(&loc, name, comment, lapl_id, dxpl_id) < 0) @@ -894,8 +894,8 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Retrieve the object's comment */ if((ret_value = H5G_loc_get_comment(&loc, name, comment/*out*/, bufsize, lapl_id, dxpl_id)) < 0) @@ -1018,8 +1018,8 @@ H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&lapl_id, H5P_LINK_ACCESS, H5P_LINK_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Call internal object visitation routine */ if((ret_value = H5O_visit(loc_id, obj_name, idx_type, order, op, op_data, lapl_id, dxpl_id)) < 0) diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 9cc8fc7..75f9e7c 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -439,27 +439,25 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the core VFD backing store write tracking flag */ - if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, H5F_ACS_CORE_WRITE_TRACKING_FLAG_SIZE, &H5F_def_core_write_tracking_flag_g , + if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, H5F_ACS_CORE_WRITE_TRACKING_FLAG_SIZE, &H5F_def_core_write_tracking_flag_g, NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_FLAG_ENC, H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of the core VFD backing store page size */ - if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_SIZE, &H5F_def_core_write_tracking_page_size_g , + if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_SIZE, &H5F_def_core_write_tracking_page_size_g, NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_ENC, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the metadata collective read flag */ - if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5F_ACS_COLL_MD_READ_FLAG_SIZE, - &H5F_def_coll_md_read_flag_g, + if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5F_ACS_COLL_MD_READ_FLAG_SIZE, &H5F_def_coll_md_read_flag_g, NULL, NULL, NULL, H5F_ACS_COLL_MD_READ_FLAG_ENC, H5F_ACS_COLL_MD_READ_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the metadata collective write flag */ - if(H5P_register_real(pclass, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, H5F_ACS_COLL_MD_WRITE_FLAG_SIZE, - &H5F_def_coll_md_write_flag_g, + if(H5P_register_real(pclass, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, H5F_ACS_COLL_MD_WRITE_FLAG_SIZE, &H5F_def_coll_md_write_flag_g, NULL, NULL, NULL, H5F_ACS_COLL_MD_WRITE_FLAG_ENC, H5F_ACS_COLL_MD_WRITE_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -3434,6 +3432,9 @@ H5P__facc_multi_type_dec(const void **_pp, void *_value) * * Return: Non-negative on success/Negative on failure * + * Programmer: Dana Robinson + * Tuesday, April 8, 2014 + * *------------------------------------------------------------------------- */ herr_t @@ -3461,7 +3462,7 @@ H5Pset_core_write_tracking(hid_t plist_id, hbool_t is_enabled, size_t page_size) done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pset_core_write_tracking() */ /*------------------------------------------------------------------------- @@ -3472,6 +3473,9 @@ done: * * Return: Non-negative on success/Negative on failure * + * Programmer: Dana Robinson + * Tuesday, April 8, 2014 + * *------------------------------------------------------------------------- */ herr_t @@ -3500,7 +3504,7 @@ H5Pget_core_write_tracking(hid_t plist_id, hbool_t *is_enabled, size_t *page_siz done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pget_core_write_tracking() */ /*------------------------------------------------------------------------- @@ -3512,6 +3516,7 @@ done: * Failure: Negative * * Programmer: Mohamad Chaarawi + * Sunday, June 21, 2015 * *------------------------------------------------------------------------- */ @@ -3549,6 +3554,7 @@ H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size) * Failure: Negative * * Programmer: Mohamad Chaarawi + * Sunday, June 21, 2015 * *------------------------------------------------------------------------- */ @@ -3577,47 +3583,60 @@ H5P__decode_coll_md_read_flag_t(const void **_pp, void *_value) /*------------------------------------------------------------------------- * Function: H5Pset_coll_metadata_read * - * Purpose: Tell the library whether the metadata read operations will - * be done collectively (1) or not (0). Default is independent. With - * collective mode, the library will optimize access to metdata - * operations on the file. + * Purpose: Tell the library whether the metadata read operations will + * be done collectively (1) or not (0). Default is independent. + * With collective mode, the library will optimize access to + * metadata operations on the file. + * + * Note: This routine accepts file access property lists, link + * access property lists, attribute access property lists, + * dataset access property lists, group access property lists, + * named datatype access property lists, + * and dataset transfer property lists. * * Return: Non-negative on success/Negative on failure * + * Programmer: Mohamad Chaarawi + * Sunday, June 21, 2015 + * *------------------------------------------------------------------------- */ herr_t H5Pset_coll_metadata_read(hid_t plist_id, hbool_t is_collective) { H5P_genplist_t *plist; /* Property list pointer */ + H5P_coll_md_read_flag_t coll_meta_read; /* Property value */ herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_API(FAIL) H5TRACE2("e", "ib", plist_id, is_collective); /* Compare the property list's class against the other class */ + /* (Dataset, group, attribute, and named datype access property lists + * are sub-classes of link access property lists -QAK) + */ if(TRUE != H5P_isa_class(plist_id, H5P_LINK_ACCESS) && - TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS) && - TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER)) + TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS) && + TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist") /* set property to either TRUE if > 0, or FALSE otherwise */ - if(is_collective > 0) - is_collective = TRUE; + if(is_collective) + coll_meta_read = H5P_USER_TRUE; else - is_collective = FALSE; + coll_meta_read = H5P_USER_FALSE; /* Get the plist structure */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(plist_id))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Set values */ - if(H5P_set(plist, H5_COLL_MD_READ_FLAG_NAME, &is_collective) < 0) + if(H5P_set(plist, H5_COLL_MD_READ_FLAG_NAME, &coll_meta_read) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set collective metadata read flag") done: FUNC_LEAVE_API(ret_value) -} /* H5Pset_coll_metadata_read */ +} /* end H5Pset_coll_metadata_read() */ /*------------------------------------------------------------------------- @@ -3625,8 +3644,17 @@ done: * * Purpose: Gets information about collective metadata read mode. * + * Note: This routine accepts file access property lists, link + * access property lists, attribute access property lists, + * dataset access property lists, group access property lists, + * named datatype access property lists, + * and dataset transfer property lists. + * * Return: Non-negative on success/Negative on failure * + * Programmer: Mohamad Chaarawi + * Sunday, June 21, 2015 + * *------------------------------------------------------------------------- */ herr_t @@ -3638,9 +3666,12 @@ H5Pget_coll_metadata_read(hid_t plist_id, hbool_t *is_collective) H5TRACE2("e", "i*b", plist_id, is_collective); /* Compare the property list's class against the other class */ + /* (Dataset, group, attribute, and named datype access property lists + * are sub-classes of link access property lists -QAK) + */ if(TRUE != H5P_isa_class(plist_id, H5P_LINK_ACCESS) && - TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS) && - TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER)) + TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS) && + TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist") /* Get value */ @@ -3669,11 +3700,14 @@ done: /*------------------------------------------------------------------------- * Function: H5Pset_coll_metadata_write * - * Purpose: Tell the library whether the metadata write operations will - * be done collectively (1) or not (0). Default is collective. + * Purpose: Tell the library whether the metadata write operations will + * be done collectively (1) or not (0). Default is collective. * * Return: Non-negative on success/Negative on failure * + * Programmer: Mohamad Chaarawi + * Sunday, June 21, 2015 + * *------------------------------------------------------------------------- */ herr_t @@ -3699,7 +3733,7 @@ H5Pset_coll_metadata_write(hid_t plist_id, hbool_t is_collective) done: FUNC_LEAVE_API(ret_value) -} /* H5Pset_coll_metadata_write */ +} /* end H5Pset_coll_metadata_write() */ /*------------------------------------------------------------------------- @@ -3709,6 +3743,9 @@ done: * * Return: Non-negative on success/Negative on failure * + * Programmer: Mohamad Chaarawi + * Sunday, June 21, 2015 + * *------------------------------------------------------------------------- */ herr_t @@ -3733,6 +3770,6 @@ H5Pget_coll_metadata_write(hid_t plist_id, hbool_t *is_collective) done: FUNC_LEAVE_API(ret_value) -} /* H5Pget_coll_metadata_write */ - +} /* end H5Pget_coll_metadata_write() */ #endif /* H5_HAVE_PARALLEL */ + diff --git a/src/H5Pint.c b/src/H5Pint.c index ca56f82..75b9f1e 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -274,13 +274,10 @@ const H5P_libclass_t H5P_CLS_TACC[1] = {{ /* Library property list classes defined in other code modules */ H5_DLLVAR const H5P_libclass_t H5P_CLS_OCRT[1]; /* Object creation */ H5_DLLVAR const H5P_libclass_t H5P_CLS_STRCRT[1]; /* String create */ -H5_DLLVAR const H5P_libclass_t H5P_CLS_LACC[1]; /* Link access */ H5_DLLVAR const H5P_libclass_t H5P_CLS_GCRT[1]; /* Group create */ H5_DLLVAR const H5P_libclass_t H5P_CLS_OCPY[1]; /* Object copy */ H5_DLLVAR const H5P_libclass_t H5P_CLS_FCRT[1]; /* File creation */ -H5_DLLVAR const H5P_libclass_t H5P_CLS_FACC[1]; /* File access */ H5_DLLVAR const H5P_libclass_t H5P_CLS_DCRT[1]; /* Dataset creation */ -H5_DLLVAR const H5P_libclass_t H5P_CLS_DACC[1]; /* Dataset access */ H5_DLLVAR const H5P_libclass_t H5P_CLS_DXFR[1]; /* Data transfer */ H5_DLLVAR const H5P_libclass_t H5P_CLS_FMNT[1]; /* File mount */ H5_DLLVAR const H5P_libclass_t H5P_CLS_ACRT[1]; /* Attribute creation */ @@ -5435,39 +5432,64 @@ H5P_get_class(const H5P_genplist_t *plist) FUNC_LEAVE_NOAPI(plist->pclass) } /* end H5P_get_class() */ + +/*------------------------------------------------------------------------- + * Function: H5P_verify_apl_and_dxpl + * + * Purpose: Validate access property list and/or switch from generic + * property list to default of correct type. + * + * Also, if using internal DXPL and collective flag is set, + * switch to internal collective DXPL. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * Sunday, June 21, 2015 + * + *------------------------------------------------------------------------- + */ herr_t -H5P_verify_and_set_dxpl(hid_t *acspl_id, hid_t pclass_id, hid_t default_id, hid_t *dxpl_id) +H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t *dxpl_id) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT + /* Sanity check */ HDassert(acspl_id); + HDassert(libclass); + HDassert(dxpl_id); - /* Check the access property list */ + /* Set access plist to the default property list of the appropriate class if it's the generic default */ if(H5P_DEFAULT == *acspl_id) - *acspl_id = default_id; - - if(TRUE != H5P_isa_class(*acspl_id, pclass_id)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Not the required access property list") + *acspl_id = *libclass->def_plist_id; + else { + H5P_coll_md_read_flag_t is_collective; /* Collective metadata read flag */ + H5P_genplist_t *plist; /* Property list pointer */ - if(dxpl_id) { - H5P_coll_md_read_flag_t is_collective; - H5P_genplist_t *plist; /* Property list pointer */ + /* Sanity check the access property list class */ + if(TRUE != H5P_isa_class(*acspl_id, *libclass->class_id)) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not the required access property list") - /* Get the plist structure */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object_verify(*acspl_id, H5I_GENPROP_LST))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + /* Get the plist structure for the access property list */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(*acspl_id))) + HGOTO_ERROR(H5E_PLIST, H5E_BADATOM, FAIL, "can't find object for ID") - if(H5P_get(plist, H5_COLL_MD_READ_FLAG_NAME, &is_collective) < 0) + /* Get the collective metadata read flag */ + if(H5P_peek(plist, H5_COLL_MD_READ_FLAG_NAME, &is_collective) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get core collective metadata read flag") - if(TRUE == is_collective && *dxpl_id == H5AC_dxpl_id) - *dxpl_id = H5AC_coll_write_coll_read_dxpl_id; - else if(TRUE == is_collective && *dxpl_id == H5AC_ind_dxpl_id) - *dxpl_id = H5AC_ind_write_coll_read_dxpl_id; - } + /* If collective metadata read requested and using internal DXPL, switch to internal collective DXPL */ + if(H5P_USER_TRUE == is_collective) { + if(*dxpl_id == H5AC_dxpl_id) + *dxpl_id = H5AC_coll_write_coll_read_dxpl_id; + else if(*dxpl_id == H5AC_ind_dxpl_id) + *dxpl_id = H5AC_ind_write_coll_read_dxpl_id; + } /* end if */ + } /* end else */ done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P_verify_and_set_dxpl */ +} /* end H5P_verify_apl_and_dxpl() */ + diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index d10d578..3662cf9 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -115,33 +115,6 @@ struct H5P_genplist_t { H5SL_t *props; /* Skip list containing properties */ }; -/* Function pointer for library classes with properties to register */ -typedef herr_t (*H5P_init_class_op_t)(H5P_genclass_t *pclass); -typedef herr_t (*H5P_reg_prop_func_t)(H5P_genclass_t *pclass); - -/* - * Each library property list class has a variable of this type that contains - * class variables and methods used to initialize the class. - */ -typedef struct H5P_libclass_t { - const char *name; /* Class name */ - H5P_plist_type_t type; /* Class type */ - - H5P_genclass_t * * par_pclass; /* Pointer to global parent class property list class */ - H5P_genclass_t * * pclass; /* Pointer to global property list class */ - hid_t * const class_id; /* Pointer to global property list class ID */ - hid_t * const def_plist_id; /* Pointer to global default property list ID */ - H5P_reg_prop_func_t reg_prop_func; /* Register class's properties */ - - /* Class callback function pointers & info */ - H5P_cls_create_func_t create_func; /* Function to call when a property list is created */ - void *create_data; /* Pointer to user data to pass along to create callback */ - H5P_cls_copy_func_t copy_func; /* Function to call when a property list is copied */ - void *copy_data; /* Pointer to user data to pass along to copy callback */ - H5P_cls_close_func_t close_func; /* Function to call when a property list is closed */ - void *close_data; /* Pointer to user data to pass along to close callback */ -} H5P_libclass_t; - /* Property list/class iterator callback function pointer */ typedef int (*H5P_iterate_int_t)(H5P_genprop_t *prop, void *udata); diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index cff79a6..4e64843 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -85,6 +85,32 @@ typedef enum H5P_plist_type_t { H5P_TYPE_MAX_TYPE } H5P_plist_type_t; +/* Function pointer for library classes with properties to register */ +typedef herr_t (*H5P_reg_prop_func_t)(H5P_genclass_t *pclass); + +/* + * Each library property list class has a variable of this type that contains + * class variables and methods used to initialize the class. + */ +typedef struct H5P_libclass_t { + const char *name; /* Class name */ + H5P_plist_type_t type; /* Class type */ + + H5P_genclass_t * * par_pclass; /* Pointer to global parent class property list class */ + H5P_genclass_t * * pclass; /* Pointer to global property list class */ + hid_t * const class_id; /* Pointer to global property list class ID */ + hid_t * const def_plist_id; /* Pointer to global default property list ID */ + H5P_reg_prop_func_t reg_prop_func; /* Register class's properties */ + + /* Class callback function pointers & info */ + H5P_cls_create_func_t create_func; /* Function to call when a property list is created */ + void *create_data; /* Pointer to user data to pass along to create callback */ + H5P_cls_copy_func_t copy_func; /* Function to call when a property list is copied */ + void *copy_data; /* Pointer to user data to pass along to copy callback */ + H5P_cls_close_func_t close_func; /* Function to call when a property list is closed */ + void *close_data; /* Pointer to user data to pass along to close callback */ +} H5P_libclass_t; + /*****************************/ /* Library Private Variables */ /*****************************/ @@ -109,6 +135,14 @@ H5_DLLVAR H5P_genclass_t *H5P_CLS_LINK_CREATE_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_LINK_ACCESS_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_STRING_CREATE_g; +/* Internal property list classes */ +H5_DLLVAR const struct H5P_libclass_t H5P_CLS_LACC[1]; /* Link access */ +H5_DLLVAR const struct H5P_libclass_t H5P_CLS_AACC[1]; /* Attribute access */ +H5_DLLVAR const struct H5P_libclass_t H5P_CLS_DACC[1]; /* Dataset access */ +H5_DLLVAR const struct H5P_libclass_t H5P_CLS_GACC[1]; /* Group access */ +H5_DLLVAR const struct H5P_libclass_t H5P_CLS_TACC[1]; /* Named datatype access */ +H5_DLLVAR const struct H5P_libclass_t H5P_CLS_FACC[1]; /* File access */ + /******************************/ /* Library Private Prototypes */ @@ -134,6 +168,8 @@ H5_DLL herr_t H5P_remove(H5P_genplist_t *plist, const char *name); H5_DLL htri_t H5P_exist_plist(const H5P_genplist_t *plist, const char *name); H5_DLL htri_t H5P_class_isa(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2); H5_DLL char *H5P_get_class_name(H5P_genclass_t *pclass); + +/* Internal helper routines */ H5_DLL herr_t H5P_get_nprops_pclass(const H5P_genclass_t *pclass, size_t *nprops, hbool_t recurse); H5_DLL hid_t H5P_peek_driver(H5P_genplist_t *plist); @@ -153,6 +189,7 @@ H5_DLL herr_t H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id, unsigned int *flags, size_t *cd_nelmts, unsigned cd_values[], size_t namelen, char name[], unsigned *filter_config); H5_DLL htri_t H5P_filter_in_pline(H5P_genplist_t *plist, H5Z_filter_t id); +H5_DLL herr_t H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t *dxpl_id); /* Query internal fields of the property list struct */ H5_DLL hid_t H5P_get_plist_id(const H5P_genplist_t *plist); @@ -162,18 +199,11 @@ H5_DLL H5P_genclass_t *H5P_get_class(const H5P_genplist_t *plist); H5_DLL htri_t H5P_isa_class(hid_t plist_id, hid_t pclass_id); H5_DLL H5P_genplist_t *H5P_object_verify(hid_t plist_id, hid_t pclass_id); -/* Private functions to "peek" at properties of a certain type */ -H5_DLL unsigned H5P_peek_unsigned(H5P_genplist_t *plist, const char *name); -H5_DLL hid_t H5P_peek_hid_t(H5P_genplist_t *plist, const char *name); -H5_DLL void *H5P_peek_voidp(H5P_genplist_t *plist, const char *name); -H5_DLL size_t H5P_peek_size_t(H5P_genplist_t *plist, const char *name); - /* Private DCPL routines */ H5_DLL herr_t H5P_fill_value_defined(H5P_genplist_t *plist, H5D_fill_value_t *status); H5_DLL herr_t H5P_get_fill_value(H5P_genplist_t *plist, const struct H5T_t *type, void *value, hid_t dxpl_id); -H5_DLL herr_t H5P_verify_and_set_dxpl(hid_t *acspl_id, hid_t pclass_id, hid_t default_id, hid_t *dxpl_id); #endif /* _H5Pprivate_H */ diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index c2833e1..51fb9d2 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -128,8 +128,8 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&tapl_id, H5P_DATATYPE_ACCESS, H5P_DATATYPE_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Commit the type */ if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id, tapl_id, dxpl_id) < 0) @@ -266,8 +266,8 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&tapl_id, H5P_DATATYPE_ACCESS, H5P_DATATYPE_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Commit the type */ if(H5T__commit(loc.oloc->file, type, tcpl_id, dxpl_id) < 0) @@ -542,8 +542,8 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_and_set_dxpl(&tapl_id, H5P_DATATYPE_ACCESS, H5P_DATATYPE_ACCESS_DEFAULT, &dxpl_id) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up datatype location to fill in */ type_loc.oloc = &oloc; -- cgit v0.12 From 8db372877985017e6e9b8eeff543a11471c10248 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 15 Jan 2016 18:08:10 -0500 Subject: [svn-r28916] Description: Normalize against incoming changes from the phdf5_metadata_opt branch. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest forthcoming) --- src/H5A.c | 126 ++++++++++++++++++++++++++++++++---------------------- src/H5D.c | 27 ++++-------- src/H5F.c | 18 +++----- src/H5G.c | 45 ++++++++----------- src/H5L.c | 116 +++++++++++++++++++++++++++---------------------- src/H5Lexternal.c | 4 ++ src/H5O.c | 69 ++++++++++++++---------------- src/H5Pfapl.c | 14 ++++-- src/H5Pint.c | 75 +++++++++++++++++++++++++++++++- src/H5Ppkg.h | 27 ------------ src/H5Pprivate.h | 45 ++++++++++++++++--- src/H5Ppublic.h | 4 ++ src/H5Tcommit.c | 27 ++++-------- 13 files changed, 346 insertions(+), 251 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index 97d082c..e478610 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -246,7 +246,7 @@ H5A_term_package(void) --------------------------------------------------------------------------*/ hid_t H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, - hid_t acpl_id, hid_t H5_ATTR_UNUSED aapl_id) + hid_t acpl_id, hid_t aapl_id) { H5A_t *attr = NULL; /* Attribute created */ H5G_loc_t loc; /* Object location */ @@ -272,6 +272,10 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, if(NULL == (space = (H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Go do the real work for attaching the attribute to the object */ if(NULL == (attr = H5A_create(&loc, attr_name, type, space, acpl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute") @@ -321,7 +325,7 @@ done: --------------------------------------------------------------------------*/ hid_t H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, - hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t H5_ATTR_UNUSED aapl_id, + hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t lapl_id) { H5A_t *attr = NULL; /* Attribute created */ @@ -360,14 +364,22 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, obj_loc.path = &obj_path; H5G_loc_reset(&obj_loc); - /* Find the object's location */ + /* Verify access property list and get correct dxpl */ dxpl_id = H5AC_ind_dxpl_id; + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + + /* Find the object's location */ if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; - /* Go do the real work for attaching the attribute to the dataset */ + /* Verify access property list and get correct dxpl */ dxpl_id = H5AC_dxpl_id; + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + + /* Go do the real work for attaching the attribute to the dataset */ if(NULL == (attr = H5A_create(&obj_loc, attr_name, type, space, acpl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute") @@ -405,7 +417,7 @@ done: H5Aclose or resource leaks will develop. --------------------------------------------------------------------------*/ hid_t -H5Aopen(hid_t loc_id, const char *attr_name, hid_t H5_ATTR_UNUSED aapl_id) +H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ @@ -423,6 +435,10 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t H5_ATTR_UNUSED aapl_id) if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Read in attribute from object header */ if(NULL == (attr = H5O_attr_open_by_name(loc.oloc, attr_name, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to load attribute info from object header for attribute: '%s'", attr_name) @@ -468,7 +484,7 @@ done: --------------------------------------------------------------------------*/ hid_t H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, - hid_t H5_ATTR_UNUSED aapl_id, hid_t lapl_id) + hid_t aapl_id, hid_t lapl_id) { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ @@ -493,6 +509,10 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Open the attribute on the object header */ if(NULL == (attr = H5A_open_by_name(&loc, obj_name, attr_name, lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute") @@ -537,7 +557,7 @@ done: --------------------------------------------------------------------------*/ hid_t H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, - H5_iter_order_t order, hsize_t n, hid_t H5_ATTR_UNUSED aapl_id, hid_t lapl_id) + H5_iter_order_t order, hsize_t n, hid_t aapl_id, hid_t lapl_id) { H5A_t *attr = NULL; /* Attribute opened */ H5G_loc_t loc; /* Object location */ @@ -565,6 +585,10 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Open the attribute in the object header */ if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open attribute") @@ -892,11 +916,10 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, dxpl_id))) @@ -1030,11 +1053,10 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") if(NULL == ainfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ if(NULL == (attr = H5A_open_by_name(&loc, obj_name, attr_name, lapl_id, dxpl_id))) @@ -1093,11 +1115,10 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(NULL == ainfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ if(NULL == (attr = H5A_open_by_idx(&loc, obj_name, idx_type, order, n, lapl_id, dxpl_id))) @@ -1193,11 +1214,10 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no old attribute name") if(!new_attr_name || !*new_attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new attribute name") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Avoid thrashing things if the names are the same */ if(HDstrcmp(old_attr_name, new_attr_name)) { @@ -1370,11 +1390,10 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1496,11 +1515,11 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + dxpl_id = H5AC_ind_dxpl_id; + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1508,13 +1527,16 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5G_loc_reset(&obj_loc); /* Find the object's location */ - dxpl_id = H5AC_ind_dxpl_id; if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; - /* Delete the attribute from the location */ + /* Verify access property list and get correct dxpl */ dxpl_id = H5AC_dxpl_id; + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + + /* Delete the attribute from the location */ if(H5O_attr_remove(obj_loc.oloc, attr_name, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") @@ -1577,11 +1599,11 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + dxpl_id = H5AC_ind_dxpl_id; + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -1589,13 +1611,16 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5G_loc_reset(&obj_loc); /* Find the object's location */ - dxpl_id = H5AC_ind_dxpl_id; if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; - /* Delete the attribute from the location */ + /* Verify access property list and get correct dxpl */ dxpl_id = H5AC_dxpl_id; + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + + /* Delete the attribute from the location */ if(H5O_attr_remove_by_idx(obj_loc.oloc, idx_type, order, n, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") @@ -1717,11 +1742,10 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no object name") if(!attr_name || !*attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") if((ret_value = H5A_exists_by_name(loc, obj_name, attr_name, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") diff --git a/src/H5D.c b/src/H5D.c index 0fe6c4d..d8653a9 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -138,12 +138,9 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") - /* Get correct property list */ - if(H5P_DEFAULT == dapl_id) - dapl_id = H5P_DATASET_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(dapl_id, H5P_DATASET_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create the new dataset & get its ID */ if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, lcpl_id, dcpl_id, dapl_id, dxpl_id))) @@ -221,12 +218,9 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, if(TRUE != H5P_isa_class(dcpl_id, H5P_DATASET_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") - /* Get correct property list */ - if(H5P_DEFAULT == dapl_id) - dapl_id = H5P_DATASET_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(dapl_id, H5P_DATASET_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* build and open the new dataset */ if(NULL == (dset = H5D__create(loc.oloc->file, type_id, space, dcpl_id, dapl_id, dxpl_id))) @@ -293,12 +287,9 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - /* Get correct property list */ - if(H5P_DEFAULT == dapl_id) - dapl_id = H5P_DATASET_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(dapl_id, H5P_DATASET_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the dataset */ if(NULL == (dset = H5D__open_name(&loc, name, dapl_id, dxpl_id))) diff --git a/src/H5F.c b/src/H5F.c index da08de4..cd35182 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -472,12 +472,9 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if(TRUE != H5P_isa_class(fcpl_id, H5P_FILE_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file create property list") - /* Check the file access property list */ - if(H5P_DEFAULT == fapl_id) - fapl_id = H5P_FILE_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* * Adjust bit flags by turning on the creation bit and making sure that @@ -567,11 +564,10 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) if((flags & ~H5F_ACC_PUBLIC_FLAGS) || (flags & H5F_ACC_TRUNC) || (flags & H5F_ACC_EXCL)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file open flags") - if(H5P_DEFAULT == fapl_id) - fapl_id = H5P_FILE_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the file */ if(NULL == (new_file = H5F_open(filename, flags, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) diff --git a/src/H5G.c b/src/H5G.c index 00a53b8..8798a82 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -316,12 +316,9 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, if(TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group create property list") - /* Check the group access property list */ - if(H5P_DEFAULT == gapl_id) - gapl_id = H5P_GROUP_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create the new group & get its ID */ if(NULL == (grp = H5G__create_named(&loc, name, lcpl_id, gcpl_id, gapl_id, dxpl_id))) @@ -396,12 +393,9 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) if(TRUE != H5P_isa_class(gcpl_id, H5P_GROUP_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group create property list") - /* Check the group access property list */ - if(H5P_DEFAULT == gapl_id) - gapl_id = H5P_GROUP_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up group creation info */ gcrt_info.gcpl_id = gcpl_id; @@ -471,12 +465,9 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - /* Check the group access property list */ - if(H5P_DEFAULT == gapl_id) - gapl_id = H5P_GROUP_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(gapl_id, H5P_GROUP_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the group */ if((grp = H5G__open_name(&loc, name, gapl_id, dxpl_id)) == NULL) @@ -611,11 +602,10 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") if(!grp_info) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ grp_loc.oloc = &grp_oloc; @@ -680,11 +670,10 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!grp_info) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ grp_loc.oloc = &grp_oloc; diff --git a/src/H5L.c b/src/H5L.c index 264c00e..23eb395 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -357,6 +357,10 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Set up src & dst location pointers */ src_loc_p = &src_loc; dst_loc_p = &dst_loc; @@ -416,6 +420,10 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Set up src & dst location pointers */ src_loc_p = &src_loc; dst_loc_p = &dst_loc; @@ -473,6 +481,10 @@ H5Lcreate_soft(const char *link_target, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Create the link */ if(H5L_create_soft(link_target, &link_loc, link_name, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") @@ -525,6 +537,10 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Set up current & new location pointers */ cur_loc_p = &cur_loc; new_loc_p = &new_loc; @@ -589,6 +605,10 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, if(link_type < H5L_TYPE_UD_MIN || link_type > H5L_TYPE_MAX) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Create external link */ if(H5L_create_ud(&link_loc, link_name, udata, udata_size, link_type, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") @@ -631,6 +651,10 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Unlink */ if(H5L_delete(&loc, name, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link") @@ -680,11 +704,10 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for unlink operation */ udata.idx_type = idx_type; @@ -737,11 +760,10 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Get the link value */ if(H5L_get_val(&loc, name, buf, size, lapl_id, dxpl_id) < 0) @@ -793,11 +815,10 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for retrieving information */ udata.idx_type = idx_type; @@ -846,11 +867,10 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Check for the existence of the link */ if((ret_value = H5L__exists(&loc, name, lapl_id, dxpl_id)) < 0) @@ -891,15 +911,14 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Get the link information */ if(H5L_get_info(&loc, name, linfo, lapl_id, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") done: FUNC_LEAVE_API(ret_value) @@ -943,11 +962,10 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for callback */ udata.idx_type = idx_type; @@ -959,8 +977,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, /* Traverse the group hierarchy to locate the object to get info about */ if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_get_info_by_idx_cb, &udata, lapl_id, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to get link info") - + HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info") done: FUNC_LEAVE_API(ret_value) @@ -1134,11 +1151,10 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for callback */ udata.idx_type = idx_type; @@ -1152,7 +1168,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, /* Traverse the group hierarchy to locate the link to get name of */ if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK, H5L_get_name_by_idx_cb, &udata, lapl_id, dxpl_id) < 0) - HGOTO_ERROR(H5E_SYM, H5E_EXISTS, FAIL, "name doesn't exist") + HGOTO_ERROR(H5E_LINK, H5E_EXISTS, FAIL, "name doesn't exist") /* Set the return value */ ret_value = udata.name_len; @@ -1275,11 +1291,10 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up iteration beginning/end info */ idx = (idx_p == NULL ? 0 : *idx_p); @@ -1292,7 +1307,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, /* Iterate over the links */ if((ret_value = H5G_iterate(loc_id, group_name, idx_type, order, idx, &last_lnk, &lnk_op, op_data, lapl_id, dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed") /* Set the index we stopped at */ if(idx_p) @@ -1409,15 +1424,14 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Call internal group visitation routine */ if((ret_value = H5G_visit(loc_id, group_name, idx_type, order, op, op_data, lapl_id, dxpl_id)) < 0) - HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link visitation failed") + HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 324f2bf..3e8be66 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -598,6 +598,10 @@ H5Lcreate_external(const char *file_name, const char *obj_name, p += file_name_len; HDstrncpy((char *)p, norm_obj_name, buf_size - (file_name_len + 1)); /* External link's object */ + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Create an external link */ if(H5L_create_ud(&link_loc, link_name, ext_link_buf, buf_size, H5L_TYPE_EXTERNAL, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link") diff --git a/src/H5O.c b/src/H5O.c index 46ce5fa..01be3e6 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -298,11 +298,10 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid index type specified") if(order <= H5_ITER_UNKNOWN || order >= H5_ITER_N) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -450,6 +449,10 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, if(lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Link to the object */ if(H5L_link(&new_loc, new_name, &obj_loc, lcpl_id, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create link") @@ -569,11 +572,10 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Check if the object exists */ if((ret_value = H5G_loc_exists(&loc, name, lapl_id, dxpl_id)) < 0) @@ -651,11 +653,10 @@ H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lap HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") if(!oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Retrieve the object's information */ if(H5G_loc_info(&loc, name, TRUE, oinfo/*out*/, lapl_id, dxpl_id) < 0) @@ -707,11 +708,10 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ obj_loc.oloc = &obj_oloc; @@ -808,11 +808,10 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* (Re)set the object's comment */ if(H5G_loc_set_comment(&loc, name, comment, lapl_id, dxpl_id) < 0) @@ -893,11 +892,10 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Retrieve the object's comment */ if((ret_value = H5G_loc_get_comment(&loc, name, comment/*out*/, bufsize, lapl_id, dxpl_id)) < 0) @@ -1018,11 +1016,10 @@ H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") if(!op) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") - if(H5P_DEFAULT == lapl_id) - lapl_id = H5P_LINK_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(lapl_id, H5P_LINK_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Call internal object visitation routine */ if((ret_value = H5O_visit(loc_id, obj_name, idx_type, order, op, op_data, lapl_id, dxpl_id)) < 0) @@ -1354,7 +1351,7 @@ H5O_open_name(H5G_loc_t *loc, const char *name, hid_t lapl_id, hbool_t app_ref) H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ + hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ hid_t ret_value = FAIL; FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 14e1c91..b92d3e9 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -426,13 +426,13 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the core VFD backing store write tracking flag */ - if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, H5F_ACS_CORE_WRITE_TRACKING_FLAG_SIZE, &H5F_def_core_write_tracking_flag_g , + if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_FLAG_NAME, H5F_ACS_CORE_WRITE_TRACKING_FLAG_SIZE, &H5F_def_core_write_tracking_flag_g, NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_FLAG_ENC, H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the size of the core VFD backing store page size */ - if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_SIZE, &H5F_def_core_write_tracking_page_size_g , + if(H5P_register_real(pclass, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_NAME, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_SIZE, &H5F_def_core_write_tracking_page_size_g, NULL, NULL, NULL, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_ENC, H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") @@ -3407,6 +3407,9 @@ H5P__facc_multi_type_dec(const void **_pp, void *_value) * * Return: Non-negative on success/Negative on failure * + * Programmer: Dana Robinson + * Tuesday, April 8, 2014 + * *------------------------------------------------------------------------- */ herr_t @@ -3434,7 +3437,7 @@ H5Pset_core_write_tracking(hid_t plist_id, hbool_t is_enabled, size_t page_size) done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pset_core_write_tracking() */ /*------------------------------------------------------------------------- @@ -3445,6 +3448,9 @@ done: * * Return: Non-negative on success/Negative on failure * + * Programmer: Dana Robinson + * Tuesday, April 8, 2014 + * *------------------------------------------------------------------------- */ herr_t @@ -3473,5 +3479,5 @@ H5Pget_core_write_tracking(hid_t plist_id, hbool_t *is_enabled, size_t *page_siz done: FUNC_LEAVE_API(ret_value) -} +} /* end H5Pget_core_write_tracking() */ diff --git a/src/H5Pint.c b/src/H5Pint.c index 443802c..d80e66d 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -139,6 +139,8 @@ hid_t H5P_CLS_DATATYPE_ACCESS_ID_g = FAIL; H5P_genclass_t *H5P_CLS_DATATYPE_ACCESS_g = NULL; hid_t H5P_CLS_ATTRIBUTE_CREATE_ID_g = FAIL; H5P_genclass_t *H5P_CLS_ATTRIBUTE_CREATE_g = NULL; +hid_t H5P_CLS_ATTRIBUTE_ACCESS_ID_g = FAIL; +H5P_genclass_t *H5P_CLS_ATTRIBUTE_ACCESS_g = NULL; hid_t H5P_CLS_OBJECT_COPY_ID_g = FAIL; H5P_genclass_t *H5P_CLS_OBJECT_COPY_g = NULL; hid_t H5P_CLS_LINK_CREATE_ID_g = FAIL; @@ -163,6 +165,7 @@ hid_t H5P_LST_GROUP_ACCESS_ID_g = FAIL; hid_t H5P_LST_DATATYPE_CREATE_ID_g = FAIL; hid_t H5P_LST_DATATYPE_ACCESS_ID_g = FAIL; hid_t H5P_LST_ATTRIBUTE_CREATE_ID_g = FAIL; +hid_t H5P_LST_ATTRIBUTE_ACCESS_ID_g = FAIL; hid_t H5P_LST_OBJECT_COPY_ID_g = FAIL; hid_t H5P_LST_LINK_CREATE_ID_g = FAIL; hid_t H5P_LST_LINK_ACCESS_ID_g = FAIL; @@ -186,6 +189,26 @@ const H5P_libclass_t H5P_CLS_ROOT[1] = {{ NULL /* Class close callback info */ }}; +/* Attribute access property list class library initialization object */ +/* (move to proper source code file when used for real) */ +const H5P_libclass_t H5P_CLS_AACC[1] = {{ + "attribute access", /* Class name for debugging */ + H5P_TYPE_ATTRIBUTE_ACCESS, /* Class type */ + + &H5P_CLS_LINK_ACCESS_g, /* Parent class */ + &H5P_CLS_ATTRIBUTE_ACCESS_g, /* Pointer to class */ + &H5P_CLS_ATTRIBUTE_ACCESS_ID_g, /* Pointer to class ID */ + &H5P_LST_ATTRIBUTE_ACCESS_ID_g, /* Pointer to default property list ID */ + NULL, /* Default property registration routine */ + + NULL, /* Class creation callback */ + NULL, /* Class creation callback info */ + NULL, /* Class copy callback */ + NULL, /* Class copy callback info */ + NULL, /* Class close callback */ + NULL /* Class close callback info */ +}}; + /* Group access property list class library initialization object */ /* (move to proper source code file when used for real) */ const H5P_libclass_t H5P_CLS_GACC[1] = {{ @@ -297,6 +320,7 @@ static H5P_libclass_t const * const init_class[] = { H5P_CLS_TCRT, /* Datatype creation */ H5P_CLS_TACC, /* Datatype access */ H5P_CLS_ACRT, /* Attribute creation */ + H5P_CLS_AACC, /* Attribute access */ H5P_CLS_LCRT /* Link creation */ }; @@ -487,6 +511,7 @@ H5P_term_package(void) H5P_LST_DATATYPE_CREATE_ID_g = H5P_LST_DATATYPE_ACCESS_ID_g = H5P_LST_ATTRIBUTE_CREATE_ID_g = + H5P_LST_ATTRIBUTE_ACCESS_ID_g = H5P_LST_OBJECT_COPY_ID_g = H5P_LST_LINK_CREATE_ID_g = H5P_LST_LINK_ACCESS_ID_g = @@ -513,6 +538,7 @@ H5P_term_package(void) H5P_CLS_DATATYPE_ACCESS_g = H5P_CLS_STRING_CREATE_g = H5P_CLS_ATTRIBUTE_CREATE_g = + H5P_CLS_ATTRIBUTE_ACCESS_g = H5P_CLS_OBJECT_COPY_g = H5P_CLS_LINK_CREATE_g = H5P_CLS_LINK_ACCESS_g = @@ -531,6 +557,7 @@ H5P_term_package(void) H5P_CLS_DATATYPE_ACCESS_ID_g = H5P_CLS_STRING_CREATE_ID_g = H5P_CLS_ATTRIBUTE_CREATE_ID_g = + H5P_CLS_ATTRIBUTE_ACCESS_ID_g = H5P_CLS_OBJECT_COPY_ID_g = H5P_CLS_LINK_CREATE_ID_g = H5P_CLS_LINK_ACCESS_ID_g = @@ -5253,7 +5280,7 @@ H5P__new_plist_of_type(H5P_plist_type_t type) FUNC_ENTER_PACKAGE /* Sanity checks */ - HDcompile_assert(H5P_TYPE_LINK_ACCESS == (H5P_TYPE_MAX_TYPE - 1)); + HDcompile_assert(H5P_TYPE_ATTRIBUTE_ACCESS == (H5P_TYPE_MAX_TYPE - 1)); HDassert(type >= H5P_TYPE_USER && type <= H5P_TYPE_LINK_ACCESS); /* Check arguments */ @@ -5316,6 +5343,10 @@ H5P__new_plist_of_type(H5P_plist_type_t type) class_id = H5P_CLS_ATTRIBUTE_CREATE_ID_g; break; + case H5P_TYPE_ATTRIBUTE_ACCESS: + class_id = H5P_CLS_ATTRIBUTE_ACCESS_ID_g; + break; + case H5P_TYPE_OBJECT_COPY: class_id = H5P_CLS_OBJECT_COPY_ID_g; break; @@ -5403,3 +5434,45 @@ H5P_get_class(const H5P_genplist_t *plist) FUNC_LEAVE_NOAPI(plist->pclass) } /* end H5P_get_class() */ + +/*------------------------------------------------------------------------- + * Function: H5P_verify_apl_and_dxpl + * + * Purpose: Validate access property list and/or switch from generic + * property list to default of correct type. + * + * Also, if using internal DXPL and collective flag is set, + * switch to internal collective DXPL. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * Sunday, June 21, 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t *dxpl_id) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + /* Sanity check */ + HDassert(acspl_id); + HDassert(libclass); + HDassert(dxpl_id); + + /* Set access plist to the default property list of the appropriate class if it's the generic default */ + if(H5P_DEFAULT == *acspl_id) + *acspl_id = *libclass->def_plist_id; + else { + /* Sanity check the access property list class */ + if(TRUE != H5P_isa_class(*acspl_id, *libclass->class_id)) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not the required access property list") + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P_verify_apl_and_dxpl() */ + diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index 105baf7..5997845 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -115,33 +115,6 @@ struct H5P_genplist_t { H5SL_t *props; /* Skip list containing properties */ }; -/* Function pointer for library classes with properties to register */ -typedef herr_t (*H5P_init_class_op_t)(H5P_genclass_t *pclass); -typedef herr_t (*H5P_reg_prop_func_t)(H5P_genclass_t *pclass); - -/* - * Each library property list class has a variable of this type that contains - * class variables and methods used to initialize the class. - */ -typedef struct H5P_libclass_t { - const char *name; /* Class name */ - H5P_plist_type_t type; /* Class type */ - - H5P_genclass_t * * par_pclass; /* Pointer to global parent class property list class */ - H5P_genclass_t * * pclass; /* Pointer to global property list class */ - hid_t * const class_id; /* Pointer to global property list class ID */ - hid_t * const def_plist_id; /* Pointer to global default property list ID */ - H5P_reg_prop_func_t reg_prop_func; /* Register class's properties */ - - /* Class callback function pointers & info */ - H5P_cls_create_func_t create_func; /* Function to call when a property list is created */ - void *create_data; /* Pointer to user data to pass along to create callback */ - H5P_cls_copy_func_t copy_func; /* Function to call when a property list is copied */ - void *copy_data; /* Pointer to user data to pass along to copy callback */ - H5P_cls_close_func_t close_func; /* Function to call when a property list is closed */ - void *close_data; /* Pointer to user data to pass along to close callback */ -} H5P_libclass_t; - /* Property list/class iterator callback function pointer */ typedef int (*H5P_iterate_int_t)(H5P_genprop_t *prop, void *udata); diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 05830d1..7e76a4f 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -73,9 +73,36 @@ typedef enum H5P_plist_type_t { H5P_TYPE_OBJECT_COPY = 15, H5P_TYPE_LINK_CREATE = 16, H5P_TYPE_LINK_ACCESS = 17, + H5P_TYPE_ATTRIBUTE_ACCESS = 18, H5P_TYPE_MAX_TYPE } H5P_plist_type_t; +/* Function pointer for library classes with properties to register */ +typedef herr_t (*H5P_reg_prop_func_t)(H5P_genclass_t *pclass); + +/* + * Each library property list class has a variable of this type that contains + * class variables and methods used to initialize the class. + */ +typedef struct H5P_libclass_t { + const char *name; /* Class name */ + H5P_plist_type_t type; /* Class type */ + + H5P_genclass_t * * par_pclass; /* Pointer to global parent class property list class */ + H5P_genclass_t * * pclass; /* Pointer to global property list class */ + hid_t * const class_id; /* Pointer to global property list class ID */ + hid_t * const def_plist_id; /* Pointer to global default property list ID */ + H5P_reg_prop_func_t reg_prop_func; /* Register class's properties */ + + /* Class callback function pointers & info */ + H5P_cls_create_func_t create_func; /* Function to call when a property list is created */ + void *create_data; /* Pointer to user data to pass along to create callback */ + H5P_cls_copy_func_t copy_func; /* Function to call when a property list is copied */ + void *copy_data; /* Pointer to user data to pass along to copy callback */ + H5P_cls_close_func_t close_func; /* Function to call when a property list is closed */ + void *close_data; /* Pointer to user data to pass along to close callback */ +} H5P_libclass_t; + /*****************************/ /* Library Private Variables */ /*****************************/ @@ -94,11 +121,20 @@ H5_DLLVAR H5P_genclass_t *H5P_CLS_GROUP_ACCESS_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_DATATYPE_CREATE_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_DATATYPE_ACCESS_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_ATTRIBUTE_CREATE_g; +H5_DLLVAR H5P_genclass_t *H5P_CLS_ATTRIBUTE_ACCESS_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_OBJECT_COPY_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_LINK_CREATE_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_LINK_ACCESS_g; H5_DLLVAR H5P_genclass_t *H5P_CLS_STRING_CREATE_g; +/* Internal property list classes */ +H5_DLLVAR const struct H5P_libclass_t H5P_CLS_LACC[1]; /* Link access */ +H5_DLLVAR const struct H5P_libclass_t H5P_CLS_AACC[1]; /* Attribute access */ +H5_DLLVAR const struct H5P_libclass_t H5P_CLS_DACC[1]; /* Dataset access */ +H5_DLLVAR const struct H5P_libclass_t H5P_CLS_GACC[1]; /* Group access */ +H5_DLLVAR const struct H5P_libclass_t H5P_CLS_TACC[1]; /* Named datatype access */ +H5_DLLVAR const struct H5P_libclass_t H5P_CLS_FACC[1]; /* File access */ + /******************************/ /* Library Private Prototypes */ @@ -124,6 +160,8 @@ H5_DLL herr_t H5P_remove(H5P_genplist_t *plist, const char *name); H5_DLL htri_t H5P_exist_plist(const H5P_genplist_t *plist, const char *name); H5_DLL htri_t H5P_class_isa(const H5P_genclass_t *pclass1, const H5P_genclass_t *pclass2); H5_DLL char *H5P_get_class_name(H5P_genclass_t *pclass); + +/* Internal helper routines */ H5_DLL herr_t H5P_get_nprops_pclass(const H5P_genclass_t *pclass, size_t *nprops, hbool_t recurse); H5_DLL hid_t H5P_peek_driver(H5P_genplist_t *plist); @@ -143,6 +181,7 @@ H5_DLL herr_t H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id, unsigned int *flags, size_t *cd_nelmts, unsigned cd_values[], size_t namelen, char name[], unsigned *filter_config); H5_DLL htri_t H5P_filter_in_pline(H5P_genplist_t *plist, H5Z_filter_t id); +H5_DLL herr_t H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t *dxpl_id); /* Query internal fields of the property list struct */ H5_DLL hid_t H5P_get_plist_id(const H5P_genplist_t *plist); @@ -152,12 +191,6 @@ H5_DLL H5P_genclass_t *H5P_get_class(const H5P_genplist_t *plist); H5_DLL htri_t H5P_isa_class(hid_t plist_id, hid_t pclass_id); H5_DLL H5P_genplist_t *H5P_object_verify(hid_t plist_id, hid_t pclass_id); -/* Private functions to "peek" at properties of a certain type */ -H5_DLL unsigned H5P_peek_unsigned(H5P_genplist_t *plist, const char *name); -H5_DLL hid_t H5P_peek_hid_t(H5P_genplist_t *plist, const char *name); -H5_DLL void *H5P_peek_voidp(H5P_genplist_t *plist, const char *name); -H5_DLL size_t H5P_peek_size_t(H5P_genplist_t *plist, const char *name); - /* Private DCPL routines */ H5_DLL herr_t H5P_fill_value_defined(H5P_genplist_t *plist, H5D_fill_value_t *status); diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 932472c..6a97918 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -66,6 +66,7 @@ #define H5P_DATATYPE_ACCESS (H5OPEN H5P_CLS_DATATYPE_ACCESS_ID_g) #define H5P_STRING_CREATE (H5OPEN H5P_CLS_STRING_CREATE_ID_g) #define H5P_ATTRIBUTE_CREATE (H5OPEN H5P_CLS_ATTRIBUTE_CREATE_ID_g) +#define H5P_ATTRIBUTE_ACCESS (H5OPEN H5P_CLS_ATTRIBUTE_ACCESS_ID_g) #define H5P_OBJECT_COPY (H5OPEN H5P_CLS_OBJECT_COPY_ID_g) #define H5P_LINK_CREATE (H5OPEN H5P_CLS_LINK_CREATE_ID_g) #define H5P_LINK_ACCESS (H5OPEN H5P_CLS_LINK_ACCESS_ID_g) @@ -84,6 +85,7 @@ #define H5P_DATATYPE_CREATE_DEFAULT (H5OPEN H5P_LST_DATATYPE_CREATE_ID_g) #define H5P_DATATYPE_ACCESS_DEFAULT (H5OPEN H5P_LST_DATATYPE_ACCESS_ID_g) #define H5P_ATTRIBUTE_CREATE_DEFAULT (H5OPEN H5P_LST_ATTRIBUTE_CREATE_ID_g) +#define H5P_ATTRIBUTE_ACCESS_DEFAULT (H5OPEN H5P_LST_ATTRIBUTE_ACCESS_ID_g) #define H5P_OBJECT_COPY_DEFAULT (H5OPEN H5P_LST_OBJECT_COPY_ID_g) #define H5P_LINK_CREATE_DEFAULT (H5OPEN H5P_LST_LINK_CREATE_ID_g) #define H5P_LINK_ACCESS_DEFAULT (H5OPEN H5P_LST_LINK_ACCESS_ID_g) @@ -189,6 +191,7 @@ H5_DLLVAR hid_t H5P_CLS_DATATYPE_CREATE_ID_g; H5_DLLVAR hid_t H5P_CLS_DATATYPE_ACCESS_ID_g; H5_DLLVAR hid_t H5P_CLS_STRING_CREATE_ID_g; H5_DLLVAR hid_t H5P_CLS_ATTRIBUTE_CREATE_ID_g; +H5_DLLVAR hid_t H5P_CLS_ATTRIBUTE_ACCESS_ID_g; H5_DLLVAR hid_t H5P_CLS_OBJECT_COPY_ID_g; H5_DLLVAR hid_t H5P_CLS_LINK_CREATE_ID_g; H5_DLLVAR hid_t H5P_CLS_LINK_ACCESS_ID_g; @@ -206,6 +209,7 @@ H5_DLLVAR hid_t H5P_LST_GROUP_ACCESS_ID_g; H5_DLLVAR hid_t H5P_LST_DATATYPE_CREATE_ID_g; H5_DLLVAR hid_t H5P_LST_DATATYPE_ACCESS_ID_g; H5_DLLVAR hid_t H5P_LST_ATTRIBUTE_CREATE_ID_g; +H5_DLLVAR hid_t H5P_LST_ATTRIBUTE_ACCESS_ID_g; H5_DLLVAR hid_t H5P_LST_OBJECT_COPY_ID_g; H5_DLLVAR hid_t H5P_LST_LINK_CREATE_ID_g; H5_DLLVAR hid_t H5P_LST_LINK_ACCESS_ID_g; diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 0ab3b4e..51fb9d2 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -127,12 +127,9 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, if(TRUE != H5P_isa_class(tcpl_id, H5P_DATATYPE_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list") - /* Get correct property list */ - if(H5P_DEFAULT == tapl_id) - tapl_id = H5P_DATATYPE_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(tapl_id, H5P_DATATYPE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Commit the type */ if(H5T__commit_named(&loc, name, type, lcpl_id, tcpl_id, tapl_id, dxpl_id) < 0) @@ -268,12 +265,9 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) if(TRUE != H5P_isa_class(tcpl_id, H5P_DATATYPE_CREATE)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list") - /* Get correct property list */ - if(H5P_DEFAULT == tapl_id) - tapl_id = H5P_DATATYPE_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(tapl_id, H5P_DATATYPE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Commit the type */ if(H5T__commit(loc.oloc->file, type, tcpl_id, dxpl_id) < 0) @@ -547,12 +541,9 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - /* Get correct property list */ - if(H5P_DEFAULT == tapl_id) - tapl_id = H5P_DATATYPE_ACCESS_DEFAULT; - else - if(TRUE != H5P_isa_class(tapl_id, H5P_DATATYPE_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype access property list") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id) < 0) + HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up datatype location to fill in */ type_loc.oloc = &oloc; -- cgit v0.12 From b9763eee6dd6a81d2696faf430e0cf7f27281462 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 15 Jan 2016 18:28:08 -0500 Subject: [svn-r28918] Description: I missed changes to a couple of expected error output files with the last checkin. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest forthcoming) --- tools/h5dump/errfiles/tdset-2.err | 2 +- tools/h5dump/errfiles/tperror.err | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/h5dump/errfiles/tdset-2.err b/tools/h5dump/errfiles/tdset-2.err index 775351e..e594c1b 100644 --- a/tools/h5dump/errfiles/tdset-2.err +++ b/tools/h5dump/errfiles/tdset-2.err @@ -19,7 +19,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Lget_info(): unable to get link info - major: Symbol table + major: Links minor: Object not found #001: (file name) line (number) in H5L_get_info(): name doesn't exist major: Symbol table diff --git a/tools/h5dump/errfiles/tperror.err b/tools/h5dump/errfiles/tperror.err index 29f9e7f..b469029 100644 --- a/tools/h5dump/errfiles/tperror.err +++ b/tools/h5dump/errfiles/tperror.err @@ -19,7 +19,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Lget_info(): unable to get link info - major: Symbol table + major: Links minor: Object not found #001: (file name) line (number) in H5L_get_info(): name doesn't exist major: Symbol table -- cgit v0.12 From d543f1247312741e0e33dcf6bddc5a73b842e5d0 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 15 Jan 2016 18:28:25 -0500 Subject: [svn-r28919] Description: I missed changes to a couple of expected error output files with the last checkin. Tested on: MacOSX/64 10.11.2 (amazon) w/serial & parallel (h5committest not required on this branch) --- tools/h5dump/errfiles/tdset-2.err | 2 +- tools/h5dump/errfiles/tperror.err | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/h5dump/errfiles/tdset-2.err b/tools/h5dump/errfiles/tdset-2.err index 775351e..e594c1b 100644 --- a/tools/h5dump/errfiles/tdset-2.err +++ b/tools/h5dump/errfiles/tdset-2.err @@ -19,7 +19,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Lget_info(): unable to get link info - major: Symbol table + major: Links minor: Object not found #001: (file name) line (number) in H5L_get_info(): name doesn't exist major: Symbol table diff --git a/tools/h5dump/errfiles/tperror.err b/tools/h5dump/errfiles/tperror.err index 29f9e7f..b469029 100644 --- a/tools/h5dump/errfiles/tperror.err +++ b/tools/h5dump/errfiles/tperror.err @@ -19,7 +19,7 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): minor: Object not found HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #000: (file name) line (number) in H5Lget_info(): unable to get link info - major: Symbol table + major: Links minor: Object not found #001: (file name) line (number) in H5L_get_info(): name doesn't exist major: Symbol table -- cgit v0.12 From 8a60e4f1a4e301a99c9e1bc18de8b1db4745f5fa Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Wed, 20 Jan 2016 14:18:24 -0500 Subject: [svn-r28936] spelling correction --- fortran/src/H5Sff.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fortran/src/H5Sff.F90 b/fortran/src/H5Sff.F90 index aeb3314..fd4226c 100644 --- a/fortran/src/H5Sff.F90 +++ b/fortran/src/H5Sff.F90 @@ -1232,7 +1232,7 @@ CONTAINS ENDIF ! Case of optional parameters. ! - ! Find the rank of the dataspace to allocate memery for + ! Find the rank of the dataspace to allocate memory for ! default stride and block arrays. ! CALL h5sget_simple_extent_ndims_f(space_id, rank, hdferr) @@ -1378,7 +1378,7 @@ CONTAINS ! endif ! Case of optional parameters. ! - ! Find the rank of the dataspace to allocate memery for + ! Find the rank of the dataspace to allocate memory for ! default stride and block arrays. ! ! CALL h5sget_simple_extent_ndims_f(space_id, rank, hdferr) -- cgit v0.12 From 8ca4c2f44b60295ab3f757a9a90ac75ff09cb548 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Thu, 21 Jan 2016 17:11:25 -0500 Subject: [svn-r28949] HDFFV-9660: add an option to enable threadsafe feature in cmakehdf5 Tested: platypus. There are still something strange messages during the configure step. Waiting for Allen to response. --- bin/cmakehdf5 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bin/cmakehdf5 b/bin/cmakehdf5 index 7d9caa8..ccef469 100755 --- a/bin/cmakehdf5 +++ b/bin/cmakehdf5 @@ -46,6 +46,7 @@ cacheinit=$srcdir/config/cmake/cacheinit.cmake build_cpp_lib=-DHDF5_BUILD_CPP_LIB:BOOL=OFF # C++ interface default off build_fortran=-DHDF5_BUILD_FORTRAN:BOOL=OFF # Fortran interface default off build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=ON # High Level interface default on +build_threadsafe=-DHDF5_ENABLE_THREADSAFE:BOOL=OFF # Threadsafe feature default off build_testing=-DBUILD_TESTING:BOOL=ON # Build tests default on build_tools=-DHDF5_BUILD_TOOLS:BOOL=ON # Build tools default on with_zlib=-DHDF5_ENABLE_Z_LIB_SUPPORT=ON # enable zlib filter default on @@ -82,6 +83,8 @@ Usage: $progname [] enable or disable c++ API. Default is off. --enable-hl | --disable-hl: enable or disable high level API. Default is on. + --enable-threadsafe | --disable-threadsafe: + enable or disable threadsafe feature. Default is off --enable-shared | --disable-shared: enable or disable shared lib. Default is on. --enable-tools | --disable-tools: @@ -229,6 +232,12 @@ while [ $# -gt 0 ]; do --disable-hl) build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=OFF ;; + --enable-threadsafe) + build_threadsafe=-DHDF5_ENABLE_THREADSAFE:BOOL=ON + ;; + --disable-threadsafe) + build_threadsafe=-DHDF5_ENABLE_THREADSAFE:BOOL=OFF + ;; --enable-shared) shared_lib=-DBUILD_SHARED_LIBS:BOOL=ON ;; @@ -330,6 +339,7 @@ STEP "Configure..." \ $build_cpp_lib \ $build_fortran \ $build_hl_lib \ + $build_threadsafe \ $shared_lib \ $build_testing \ $build_tools \ -- cgit v0.12 From 91aeb766fafbc4c03d98699de4cac590df9c63a3 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Thu, 21 Jan 2016 17:31:15 -0500 Subject: [svn-r28950] - remove META_FLUSH_COLLECTIVELY property for delayed sanity checks from metadata dxpls - remove H5AC_ind_dxpl_id and use only H5AC_dxpl_id everywhere instead. - remove flush_me_collectively flag from cache entries - add a collective sanity check (MPI_Barrier) for every HDF5 API routine that could possibly touch the file. This is trigerred when the environment variable H5_COLL_API_SANITY_CHECK is set to a non 0 digit. tested on BB-8 with serial and parallel. --- src/H5A.c | 81 ++++++------ src/H5AC.c | 64 ++------- src/H5ACprivate.h | 9 -- src/H5Adeprec.c | 8 +- src/H5Aint.c | 4 +- src/H5Atest.c | 2 +- src/H5C.c | 58 +-------- src/H5Cmpio.c | 5 +- src/H5Cprivate.h | 8 +- src/H5D.c | 12 +- src/H5Dcontig.c | 2 +- src/H5Ddbg.c | 2 +- src/H5Ddeprec.c | 2 +- src/H5Dfill.c | 2 +- src/H5Dint.c | 8 +- src/H5F.c | 18 +-- src/H5FDmpio.c | 6 - src/H5FDprivate.h | 8 ++ src/H5Fdeprec.c | 4 +- src/H5Fint.c | 18 ++- src/H5Fmpi.c | 69 ++++++++++ src/H5Fpkg.h | 3 +- src/H5Fprivate.h | 2 +- src/H5Fsuper_cache.c | 3 - src/H5Ftest.c | 2 +- src/H5G.c | 18 +-- src/H5Gdeprec.c | 22 ++-- src/H5Gint.c | 12 +- src/H5Gtest.c | 16 +-- src/H5I.c | 2 +- src/H5Itest.c | 2 +- src/H5L.c | 52 ++++---- src/H5Lexternal.c | 6 +- src/H5O.c | 42 +++--- src/H5Ocopy.c | 4 +- src/H5Ofill.c | 4 +- src/H5Olayout.c | 2 +- src/H5Otest.c | 50 +++---- src/H5Pdcpl.c | 6 +- src/H5Pint.c | 26 +++- src/H5Pprivate.h | 3 +- src/H5R.c | 8 +- src/H5Rdeprec.c | 4 +- src/H5T.c | 362 +++++++++++++++++++++++++-------------------------- src/H5Tcommit.c | 10 +- src/H5Tdeprec.c | 2 +- src/H5Zscaleoffset.c | 2 +- src/H5private.h | 1 + test/cache_tagging.c | 14 +- 49 files changed, 536 insertions(+), 534 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index e478610..0a2f983 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -273,7 +273,7 @@ H5Acreate2(hid_t loc_id, const char *attr_name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data space") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Go do the real work for attaching the attribute to the object */ @@ -365,8 +365,8 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5G_loc_reset(&obj_loc); /* Verify access property list and get correct dxpl */ - dxpl_id = H5AC_ind_dxpl_id; - if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + dxpl_id = H5AC_dxpl_id; + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Find the object's location */ @@ -374,11 +374,6 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; - /* Verify access property list and get correct dxpl */ - dxpl_id = H5AC_dxpl_id; - if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") - /* Go do the real work for attaching the attribute to the dataset */ if(NULL == (attr = H5A_create(&obj_loc, attr_name, type, space, acpl_id, dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create attribute") @@ -421,7 +416,7 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -436,7 +431,7 @@ H5Aopen(hid_t loc_id, const char *attr_name, hid_t aapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Read in attribute from object header */ @@ -488,7 +483,7 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute opened */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -510,7 +505,7 @@ H5Aopen_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ @@ -561,7 +556,7 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5A_t *attr = NULL; /* Attribute opened */ H5G_loc_t loc; /* Object location */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -586,7 +581,7 @@ H5Aopen_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not link access property list ID") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute in the object header */ @@ -628,6 +623,8 @@ H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf) { H5A_t *attr; /* Attribute object for ID */ H5T_t *mem_type; /* Memory datatype */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ + hid_t aapl_id = H5P_DEFAULT; /* temp access plist */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -641,6 +638,10 @@ H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf) if(NULL == buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id, attr_id, TRUE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Go write the actual data to the attribute */ if((ret_value = H5A__write(attr, mem_type, buf, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute") @@ -671,6 +672,8 @@ H5Aread(hid_t attr_id, hid_t dtype_id, void *buf) { H5A_t *attr; /* Attribute object for ID */ H5T_t *mem_type; /* Memory datatype */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ + hid_t aapl_id = H5P_DEFAULT; /* temp access plist */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -684,8 +687,12 @@ H5Aread(hid_t attr_id, hid_t dtype_id, void *buf) if(NULL == buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "null attribute buffer") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id, attr_id, FALSE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Go write the actual data to the attribute */ - if((ret_value = H5A__read(attr, mem_type, buf, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5A__read(attr, mem_type, buf, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute") done: @@ -898,7 +905,7 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute object for name */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -918,7 +925,7 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ @@ -1036,7 +1043,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute object for name */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1055,7 +1062,7 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ @@ -1095,7 +1102,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, { H5G_loc_t loc; /* Object location */ H5A_t *attr = NULL; /* Attribute object for name */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1117,7 +1124,7 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid info pointer") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the attribute on the object header */ @@ -1216,7 +1223,7 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new attribute name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Avoid thrashing things if the names are the same */ @@ -1303,7 +1310,7 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, /* Call attribute iteration routine */ last_attr = start_idx = (idx ? *idx : 0); - if((ret_value = H5O_attr_iterate(loc_id, H5AC_ind_dxpl_id, idx_type, order, start_idx, &last_attr, &attr_op, op_data)) < 0) + if((ret_value = H5O_attr_iterate(loc_id, H5AC_dxpl_id, idx_type, order, start_idx, &last_attr, &attr_op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); /* Set the last attribute information */ @@ -1372,7 +1379,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5A_attr_iter_op_t attr_op; /* Attribute operator */ hsize_t start_idx; /* Index of attribute to start iterating at */ hsize_t last_attr; /* Index of last attribute examined */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1392,7 +1399,7 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ @@ -1517,8 +1524,8 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Verify access property list and get correct dxpl */ - dxpl_id = H5AC_ind_dxpl_id; - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + dxpl_id = H5AC_dxpl_id; + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ @@ -1531,11 +1538,6 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; - /* Verify access property list and get correct dxpl */ - dxpl_id = H5AC_dxpl_id; - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") - /* Delete the attribute from the location */ if(H5O_attr_remove(obj_loc.oloc, attr_name, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") @@ -1601,8 +1603,8 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - dxpl_id = H5AC_ind_dxpl_id; - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + dxpl_id = H5AC_dxpl_id; + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ @@ -1615,11 +1617,6 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; - /* Verify access property list and get correct dxpl */ - dxpl_id = H5AC_dxpl_id; - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") - /* Delete the attribute from the location */ if(H5O_attr_remove_by_idx(obj_loc.oloc, idx_type, order, n, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute") @@ -1701,7 +1698,7 @@ H5Aexists(hid_t obj_id, const char *attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Check if the attribute exists */ - if((ret_value = H5O_attr_exists(loc.oloc, attr_name, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5O_attr_exists(loc.oloc, attr_name, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists") done: @@ -1727,7 +1724,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t lapl_id) { H5G_loc_t loc; /* Object location */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ htri_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1744,7 +1741,7 @@ H5Aexists_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") if((ret_value = H5A_exists_by_name(loc, obj_name, attr_name, lapl_id, dxpl_id)) < 0) diff --git a/src/H5AC.c b/src/H5AC.c index 34e291d..41fb78d 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -76,22 +76,13 @@ static herr_t H5AC__ext_config_2_int_config(H5AC_cache_config_t *ext_conf_ptr, /* Package initialization variable */ hbool_t H5_PKG_INIT_VAR = FALSE; - /*****************************/ /* Library Private Variables */ /*****************************/ /* Default dataset transfer property list for metadata I/O calls */ -/* (Collective set, "block before metadata write" set and "library internal" set) */ -/* (Global variable definition, declaration is in H5ACprivate.h also) */ hid_t H5AC_dxpl_id = (-1); - -/* Dataset transfer property list for independent metadata I/O calls */ -/* (just "library internal" set - i.e. independent transfer mode) */ -/* (Global variable definition, declaration is in H5ACprivate.h also) */ -H5P_genplist_t *H5AC_ind_dxpl_g = NULL; -hid_t H5AC_ind_dxpl_id = (-1); - +hbool_t H5_coll_api_sanity_check_g = false; /*******************/ /* Local Variables */ @@ -172,55 +163,27 @@ done: herr_t H5AC__init_package(void) { -#ifdef H5_HAVE_PARALLEL - H5P_genplist_t *xfer_plist; /* Dataset transfer property list object */ - unsigned coll_meta_write; /* "collective metadata write" property value */ -#endif /* H5_HAVE_PARALLEL */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE #ifdef H5_HAVE_PARALLEL - /* Sanity check */ - HDassert(H5P_CLS_DATASET_XFER_g != NULL); - - /* Get an ID for the collective H5AC dxpl */ + /* Get an ID for the metadata (H5AC) dxpl */ if((H5AC_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") - /* Get the property list object */ - if(NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_dxpl_id))) - HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") + /* check whether to enable strict collective function calling + sanity checks using MPI barriers */ + { + const char *s; /* String for environment variables */ - /* Insert 'collective metadata write' property */ - coll_meta_write = 1; - if(H5P_insert(xfer_plist, H5AC_COLLECTIVE_META_WRITE_NAME, H5AC_COLLECTIVE_META_WRITE_SIZE, &coll_meta_write, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") - - /* Get an ID for the independent H5AC dxpl */ - if((H5AC_ind_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") - - /* Get the property list object */ - if(NULL == (H5AC_ind_dxpl_g = (H5P_genplist_t *)H5I_object(H5AC_ind_dxpl_id))) - HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") - - /* Insert 'collective metadata write' property */ - coll_meta_write = 0; - if(H5P_insert(H5AC_ind_dxpl_g, H5AC_COLLECTIVE_META_WRITE_NAME, H5AC_COLLECTIVE_META_WRITE_SIZE, &coll_meta_write, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't insert metadata cache dxpl property") + s = HDgetenv("H5_COLL_API_SANITY_CHECK"); + if(s && HDisdigit(*s)) { + H5_coll_api_sanity_check_g = (hbool_t)HDstrtol(s, NULL, 0); + } + } #else /* H5_HAVE_PARALLEL */ - /* Sanity check */ - HDassert(H5P_LST_DATASET_XFER_ID_g!=(-1)); - H5AC_dxpl_id = H5P_DATASET_XFER_DEFAULT; - H5AC_ind_dxpl_id = H5P_DATASET_XFER_DEFAULT; - - /* Get the property list objects for the IDs */ - if(NULL == (H5AC_ind_dxpl_g = (H5P_genplist_t *)H5I_object(H5AC_ind_dxpl_id))) - HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get property list object") #endif /* H5_HAVE_PARALLEL */ done: @@ -251,19 +214,18 @@ H5AC_term_package(void) if(H5_PKG_INIT_VAR) { #ifdef H5_HAVE_PARALLEL - if(H5AC_dxpl_id > 0 || H5AC_ind_dxpl_id > 0) { + if(H5AC_dxpl_id > 0) { /* Indicate more work to do */ n = 1; /* H5I */ /* Close H5AC dxpl */ - if(H5I_dec_ref(H5AC_dxpl_id) < 0 || H5I_dec_ref(H5AC_ind_dxpl_id) < 0) + if(H5I_dec_ref(H5AC_dxpl_id) < 0) H5E_clear_stack(NULL); /*ignore error*/ } /* end if */ #endif /* H5_HAVE_PARALLEL */ /* Reset static IDs */ H5AC_dxpl_id = (-1); - H5AC_ind_dxpl_id = (-1); /* Reset interface initialization flag */ if(0 == n) diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index e634a45..0ed6110 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -197,17 +197,8 @@ typedef H5C_t H5AC_t; #define H5AC_RING_NAME "H5AC_ring_type" /* Dataset transfer property list for flush calls */ -/* (Collective set, "block before metadata write" set and "library internal" set) */ -/* (Global variable declaration, definition is in H5AC.c) */ extern hid_t H5AC_dxpl_id; -/* Dataset transfer property list for independent metadata I/O calls */ -/* (just "library internal" set - i.e. independent transfer mode) */ -/* (Global variable declaration, definition is in H5AC.c) */ -H5_DLLVAR H5P_genplist_t *H5AC_ind_dxpl_g; -H5_DLLVAR hid_t H5AC_ind_dxpl_id; - - /* Default cache configuration. */ #define H5AC__DEFAULT_METADATA_WRITE_STRATEGY \ diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c index ae0f041..58f0da8 100644 --- a/src/H5Adeprec.c +++ b/src/H5Adeprec.c @@ -191,7 +191,7 @@ H5Aopen_name(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Open the attribute on the object header */ - if(NULL == (attr = H5A_open_by_name(&loc, ".", name, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5A_open_by_name(&loc, ".", name, H5P_LINK_ACCESS_DEFAULT, H5AC_dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute: '%s'", name) /* Register the attribute and get an ID for it */ @@ -247,7 +247,7 @@ H5Aopen_idx(hid_t loc_id, unsigned idx) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Open the attribute in the object header */ - if(NULL == (attr = H5A_open_by_idx(&loc, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)idx, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id))) + if(NULL == (attr = H5A_open_by_idx(&loc, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, (hsize_t)idx, H5P_LINK_ACCESS_DEFAULT, H5AC_dxpl_id))) HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open attribute") /* Register the attribute and get an ID for it */ @@ -333,7 +333,7 @@ H5Aget_num_attrs(hid_t loc_id) } /*lint !e788 All appropriate cases are covered */ /* Look up the # of attributes for the object */ - if((ret_value = H5O_attr_count(loc, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5O_attr_count(loc, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTCOUNT, FAIL, "can't get attribute count for object") done: @@ -399,7 +399,7 @@ H5Aiterate1(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data) /* Call attribute iteration routine */ last_attr = start_idx = (hsize_t)(attr_num ? *attr_num : 0); - if((ret_value = H5O_attr_iterate(loc_id, H5AC_ind_dxpl_id, H5_INDEX_CRT_ORDER, H5_ITER_INC, start_idx, &last_attr, &attr_op, op_data)) < 0) + if((ret_value = H5O_attr_iterate(loc_id, H5AC_dxpl_id, H5_INDEX_CRT_ORDER, H5_ITER_INC, start_idx, &last_attr, &attr_op, op_data)) < 0) HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes"); /* Set the last attribute information */ diff --git a/src/H5Aint.c b/src/H5Aint.c index 12ffb7d..785ddc5 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -161,7 +161,7 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, * name, but it's going to be hard to unwind all the special cases on * failure, so just check first, for now - QAK) */ - if((exists = H5O_attr_exists(loc->oloc, name, H5AC_ind_dxpl_id)) < 0) + if((exists = H5O_attr_exists(loc->oloc, name, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "error checking attributes") else if(exists > 0) HGOTO_ERROR(H5E_ATTR, H5E_ALREADYEXISTS, NULL, "attribute already exists") @@ -2397,7 +2397,7 @@ H5A_rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_nam H5G_loc_reset(&obj_loc); /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; diff --git a/src/H5Atest.c b/src/H5Atest.c index d57bbe1..74ed6c4 100644 --- a/src/H5Atest.c +++ b/src/H5Atest.c @@ -140,7 +140,7 @@ H5A_get_shared_rc_test(hid_t attr_id, hsize_t *ref_count) HDassert(H5O_msg_is_shared(H5O_ATTR_ID, attr)); /* Retrieve ref count for shared or shareable attribute */ - if(H5SM_get_refcount(attr->oloc.file, H5AC_ind_dxpl_id, H5O_ATTR_ID, + if(H5SM_get_refcount(attr->oloc.file, H5AC_dxpl_id, H5O_ATTR_ID, &attr->sh_loc, ref_count) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve shared message ref count") diff --git a/src/H5C.c b/src/H5C.c index 90609b5..641e098 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -1755,9 +1755,6 @@ H5C_insert_entry(H5F_t * f, H5AC_ring_t ring = H5C_RING_UNDEFINED; hbool_t insert_pinned; hbool_t flush_last; -#ifdef H5_HAVE_PARALLEL - hbool_t flush_collectively; -#endif /* H5_HAVE_PARALLEL */ hbool_t set_flush_marker; hbool_t write_permitted = TRUE; size_t empty_space; @@ -1795,9 +1792,6 @@ H5C_insert_entry(H5F_t * f, set_flush_marker = ( (flags & H5C__SET_FLUSH_MARKER_FLAG) != 0 ); insert_pinned = ( (flags & H5C__PIN_ENTRY_FLAG) != 0 ); flush_last = ( (flags & H5C__FLUSH_LAST_FLAG) != 0 ); -#ifdef H5_HAVE_PARALLEL - flush_collectively = ( (flags & H5C__FLUSH_COLLECTIVELY_FLAG) != 0 ); -#endif /* H5_HAVE_PARALLEL */ /* Get the dataset transfer property list */ if(NULL == (dxpl = (H5P_genplist_t *)H5I_object_verify(dxpl_id, H5I_GENPROP_LST))) @@ -1842,9 +1836,6 @@ H5C_insert_entry(H5F_t * f, entry_ptr->pinned_from_client = insert_pinned; entry_ptr->pinned_from_cache = FALSE; entry_ptr->flush_me_last = flush_last; -#ifdef H5_HAVE_PARALLEL - entry_ptr->flush_me_collectively = flush_collectively; -#endif /* newly inserted entries are assumed to be dirty */ entry_ptr->is_dirty = TRUE; @@ -2563,10 +2554,10 @@ done: * This allows H5C_protect to accept flags other than * H5C__READ_ONLY_FLAG. * - * Added support for the H5C__FLUSH_LAST_FLAG and - * H5C__FLUSH_COLLECTIVELY_FLAG flags. At present, these - * flags are only applied if the entry is not in cache, and - * is loaded into the cache as a result of this call. + * Added support for the H5C__FLUSH_LAST_FLAG. + * At present, this flag is only applied if the entry is + * not in cache, and is loaded into the cache as a result of + * this call. * *------------------------------------------------------------------------- */ @@ -2584,9 +2575,6 @@ H5C_protect(H5F_t * f, hbool_t have_write_permitted = FALSE; hbool_t read_only = FALSE; hbool_t flush_last; -#ifdef H5_HAVE_PARALLEL - hbool_t flush_collectively; -#endif /* H5_HAVE_PARALLEL */ hbool_t write_permitted; size_t empty_space; void * thing; @@ -2619,9 +2607,6 @@ H5C_protect(H5F_t * f, read_only = ( (flags & H5C__READ_ONLY_FLAG) != 0 ); flush_last = ( (flags & H5C__FLUSH_LAST_FLAG) != 0 ); -#ifdef H5_HAVE_PARALLEL - flush_collectively = ( (flags & H5C__FLUSH_COLLECTIVELY_FLAG) != 0 ); -#endif /* H5_HAVE_PARALLEL */ /* Get the dataset transfer property list */ if(NULL == (dxpl = (H5P_genplist_t *)H5I_object_verify(dxpl_id, H5I_GENPROP_LST))) @@ -2784,20 +2769,16 @@ H5C_protect(H5F_t * f, * * ******************************************* * - * Set the flush_last (and possibly flush_collectively) fields + * Set the flush_last field * of the newly loaded entry before inserting it into the * index. Must do this, as the index tracked the number of * entries with the flush_last field set, but assumes that * the field will not change after insertion into the index. * - * Note that this means that the H5C__FLUSH_LAST_FLAG and - * H5C__FLUSH_COLLECTIVELY_FLAG flags are ignored if the - * entry is already in cache. + * Note that this means that the H5C__FLUSH_LAST_FLAG flag + * is ignored if the entry is already in cache. */ entry_ptr->flush_me_last = flush_last; -#ifdef H5_HAVE_PARALLEL - entry_ptr->flush_me_collectively = flush_collectively; -#endif H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, NULL) @@ -7648,31 +7629,6 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ entry_ptr->flush_in_progress = TRUE; entry_ptr->flush_marker = FALSE; -#ifdef H5_HAVE_PARALLEL -#ifndef NDEBUG - /* If MPI based VFD is used, do special parallel I/O sanity checks. - * Note that we only do these sanity checks when the clear_only flag - * is not set, and the entry to be flushed is dirty. Don't bother - * otherwise as no file I/O can result. - */ - if(!clear_only && entry_ptr->is_dirty && H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { - H5P_genplist_t *dxpl; /* Dataset transfer property list */ - unsigned coll_meta; /* Collective metadata write flag */ - - /* Get the dataset transfer property list */ - if(NULL == (dxpl = (H5P_genplist_t *)H5I_object(dxpl_id))) - HGOTO_ERROR(H5E_CACHE, H5E_BADTYPE, FAIL, "not a dataset transfer property list") - - /* Get the collective metadata write property */ - if(H5P_get(dxpl, H5AC_COLLECTIVE_META_WRITE_NAME, &coll_meta) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't retrieve xfer mode") - - /* Sanity check collective metadata write flag */ - HDassert(coll_meta); - } /* end if */ -#endif /* NDEBUG */ -#endif /* H5_HAVE_PARALLEL */ - /* serialize the entry if necessary, and then write it to disk. */ if(write_entry) { unsigned serialize_flags = H5C__SERIALIZE_NO_FLAGS_SET; diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index 6b63ad5..6e8d94c 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -386,7 +386,7 @@ H5C_apply_candidate_list(H5F_t * f, * Now scan the LRU and PEL lists, flushing or clearing entries as * needed. * - * The flush_me_last and flush_me_collectively flags may dictate how or + * The flush_me_last flag may dictate how or * when some entries can be flushed, and should be addressed here. * However, in their initial implementation, these flags only apply to the * superblock, so there's only a relatively small change to this function @@ -607,11 +607,10 @@ H5C_apply_candidate_list(H5F_t * f, it is the simple case of a single pinned entry needing flushed last and collectively is just a minor addition to this routine, but signficantly buffing up the usage of - flush_me_last or flush_me_collectively will require a more + flush_me_last will require a more intense rework of this function and potentially the function of candidate lists as a whole. */ - HDassert(entry_ptr->flush_me_collectively); entries_to_flush_or_clear_last++; entries_to_flush_collectively++; HDassert(entries_to_flush_or_clear_last == 1); diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 4c65bb4..da9e6f5 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -1383,13 +1383,10 @@ typedef int H5C_ring_t; * flushed from the cache until all other entries without * the flush_me_last flag set have been flushed. * - * flush_me_collectively: Boolean flag indicating that this entry needs - * to be flushed collectively when in a parallel situation. - * * Note: * - * At this time, the flush_me_last and flush_me_collectively - * flags will only be applied to one entry, the superblock, + * At this time, the flush_me_last + * flag will only be applied to one entry, the superblock, * and the code utilizing these flags is protected with HDasserts * to enforce this. This restraint can certainly be relaxed in * the future if the the need for multiple entries getting flushed @@ -1609,7 +1606,6 @@ typedef struct H5C_cache_entry_t { hbool_t flush_marker; hbool_t flush_me_last; #ifdef H5_HAVE_PARALLEL - hbool_t flush_me_collectively; hbool_t clear_on_unprotect; hbool_t flush_immediately; #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5D.c b/src/H5D.c index d8653a9..bcc2888 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -139,7 +139,7 @@ H5Dcreate2(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create the new dataset & get its ID */ @@ -219,7 +219,7 @@ H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* build and open the new dataset */ @@ -275,7 +275,7 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) { H5D_t *dset = NULL; H5G_loc_t loc; /* Object location of group */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl to use to open datset */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl to use to open datset */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -288,7 +288,7 @@ H5Dopen2(hid_t loc_id, const char *name, hid_t dapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&dapl_id, H5P_CLS_DACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the dataset */ @@ -410,7 +410,7 @@ H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") /* Read dataspace address and return */ - if(H5D__get_space_status(dset, allocation, H5AC_ind_dxpl_id) < 0) + if(H5D__get_space_status(dset, allocation, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get space status") done: @@ -579,7 +579,7 @@ H5Dget_storage_size(hid_t dset_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a dataset") /* Set return value */ - if(H5D__get_storage_size(dset, H5AC_ind_dxpl_id, &ret_value) < 0) + if(H5D__get_storage_size(dset, H5AC_dxpl_id, &ret_value) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't get size of dataset's storage") done: diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index b5b9b0d..3edf8b2 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -241,7 +241,7 @@ H5D__contig_fill(const H5D_t *dset, hid_t dxpl_id) using_mpi = TRUE; /* Use the internal "independent" DXPL */ - my_dxpl_id = H5AC_ind_dxpl_id; + my_dxpl_id = H5AC_dxpl_id; } /* end if */ else { #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5Ddbg.c b/src/H5Ddbg.c index 34e0ae9..559dd69 100644 --- a/src/H5Ddbg.c +++ b/src/H5Ddbg.c @@ -90,7 +90,7 @@ H5Ddebug(hid_t dset_id) /* Print B-tree information */ if(H5D_CHUNKED == dset->shared->layout.type) - (void)H5D__chunk_dump_index(dset, H5AC_ind_dxpl_id, stdout); + (void)H5D__chunk_dump_index(dset, H5AC_dxpl_id, stdout); else if(H5D_CONTIGUOUS == dset->shared->layout.type) HDfprintf(stdout, " %-10s %a\n", "Address:", dset->shared->layout.storage.u.contig.addr); diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 5a2b355..a4eb67f 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -180,7 +180,7 @@ H5Dopen1(hid_t loc_id, const char *name) H5D_t *dset = NULL; H5G_loc_t loc; /* Object location of group */ hid_t dapl_id = H5P_DATASET_ACCESS_DEFAULT; /* dapl to use to open dataset */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl to use to open datset */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl to use to open datset */ hid_t ret_value; FUNC_ENTER_API(FAIL) diff --git a/src/H5Dfill.c b/src/H5Dfill.c index 947a177..59925d8 100644 --- a/src/H5Dfill.c +++ b/src/H5Dfill.c @@ -134,7 +134,7 @@ H5Dfill(const void *fill, hid_t fill_type_id, void *buf, hid_t buf_type_id, hid_ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype") /* Fill the selection in the memory buffer */ - if(H5D__fill(fill, fill_type, buf, buf_type, space, H5AC_ind_dxpl_id) < 0) + if(H5D__fill(fill, fill_type, buf, buf_type, space, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed") done: diff --git a/src/H5Dint.c b/src/H5Dint.c index ab2f8d0..a58ca56 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -2769,7 +2769,7 @@ H5D_get_create_plist(H5D_t *dset) HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "can't get property list") /* Retrieve any object creation properties */ - if(H5O_get_create_plist(&dset->oloc, H5AC_ind_dxpl_id, new_plist) < 0) + if(H5O_get_create_plist(&dset->oloc, H5AC_dxpl_id, new_plist) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get object creation info") /* Get the layout property */ @@ -2831,7 +2831,7 @@ H5D_get_create_plist(H5D_t *dset) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy dataset datatype for fill value") /* Set up type conversion function */ - if(NULL == (tpath = H5T_path_find(dset->shared->type, copied_fill.type, NULL, NULL, H5AC_ind_dxpl_id, FALSE))) + if(NULL == (tpath = H5T_path_find(dset->shared->type, copied_fill.type, NULL, NULL, H5AC_dxpl_id, FALSE))) HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types") /* Convert disk form of fill value into memory form */ @@ -2859,7 +2859,7 @@ H5D_get_create_plist(H5D_t *dset) } /* end if */ /* Convert fill value */ - if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, copied_fill.buf, bkg_buf, H5AC_ind_dxpl_id) < 0) { + if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, copied_fill.buf, bkg_buf, H5AC_dxpl_id) < 0) { H5I_dec_ref(src_id); H5I_dec_ref(dst_id); if(bkg_buf) @@ -2992,7 +2992,7 @@ H5D_get_space(H5D_t *dset) /* If the layout is virtual, update the extent */ if(dset->shared->layout.type == H5D_VIRTUAL) - if(H5D__virtual_set_extent_unlim(dset, H5AC_ind_dxpl_id) < 0) + if(H5D__virtual_set_extent_unlim(dset, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update virtual dataset extent") /* Read the data space message and return a data space object */ diff --git a/src/H5F.c b/src/H5F.c index cd35182..6c34e40 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -407,7 +407,7 @@ H5Fis_hdf5(const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "no file name specified") /* call the private is_HDF5 function */ - if((ret_value = H5F_is_hdf5(name)) < 0) + if((ret_value = H5F_is_hdf5(name, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable open file") done: @@ -473,7 +473,7 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file create property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id, H5I_INVALID_HID, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* @@ -566,7 +566,7 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid file open flags") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&fapl_id, H5P_CLS_FACC, &dxpl_id, H5I_INVALID_HID, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the file */ @@ -901,7 +901,7 @@ H5Fget_freespace(hid_t file_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Go get the actual amount of free space in the file */ - if(H5MF_get_freespace(file, H5AC_ind_dxpl_id, &tot_space, NULL) < 0) + if(H5MF_get_freespace(file, H5AC_dxpl_id, &tot_space, NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") ret_value = (hssize_t)tot_space; @@ -1015,7 +1015,7 @@ H5Fget_file_image(hid_t file_id, void *buf_ptr, size_t buf_len) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* call private get_file_image function */ - if((ret_value = H5F_get_file_image(file, buf_ptr, buf_len)) < 0) + if((ret_value = H5F_get_file_image(file, buf_ptr, buf_len, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file image") done: @@ -1348,16 +1348,16 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo) HDmemset(finfo, 0, sizeof(*finfo)); /* Get the size of the superblock and any superblock extensions */ - if(H5F__super_size(f, H5AC_ind_dxpl_id, &finfo->super.super_size, &finfo->super.super_ext_size) < 0) + if(H5F__super_size(f, H5AC_dxpl_id, &finfo->super.super_size, &finfo->super.super_ext_size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve superblock sizes") /* Get the size of any persistent free space */ - if(H5MF_get_freespace(f, H5AC_ind_dxpl_id, &finfo->free.tot_space, &finfo->free.meta_size) < 0) + if(H5MF_get_freespace(f, H5AC_dxpl_id, &finfo->free.tot_space, &finfo->free.meta_size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve free space information") /* Check for SOHM info */ if(H5F_addr_defined(f->shared->sohm_addr)) - if(H5SM_ih_size(f, H5AC_ind_dxpl_id, &finfo->sohm.hdr_size, &finfo->sohm.msgs_info) < 0) + if(H5SM_ih_size(f, H5AC_dxpl_id, &finfo->sohm.hdr_size, &finfo->sohm.msgs_info) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve SOHM index & heap storage info") /* Set version # fields */ @@ -1402,7 +1402,7 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "nsects must be > 0") /* Go get the free-space section information in the file */ - if((ret_value = H5MF_get_free_sections(file, H5AC_ind_dxpl_id, type, nsects, sect_info)) < 0) + if((ret_value = H5MF_get_free_sections(file, H5AC_dxpl_id, type, nsects, sect_info)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file") done: diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index d0e2171..bbd3eca 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -96,12 +96,6 @@ static int H5FD_mpio_mpi_rank(const H5FD_t *_file); static int H5FD_mpio_mpi_size(const H5FD_t *_file); static MPI_Comm H5FD_mpio_communicator(const H5FD_t *_file); -/* MPIO-specific file access properties */ -typedef struct H5FD_mpio_fapl_t { - MPI_Comm comm; /*communicator */ - MPI_Info info; /*file information */ -} H5FD_mpio_fapl_t; - /* The MPIO file driver information */ static const H5FD_class_mpi_t H5FD_mpio_g = { { /* Start of superclass information */ diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index 0f195ce..fe121b3 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -96,6 +96,14 @@ typedef struct { const void *driver_info; /* Driver info, for open callbacks */ } H5FD_driver_prop_t; +#ifdef H5_HAVE_PARALLEL +/* MPIO-specific file access properties */ +typedef struct H5FD_mpio_fapl_t { + MPI_Comm comm; /*communicator */ + MPI_Info info; /*file information */ +} H5FD_mpio_fapl_t; +#endif /* H5_HAVE_PARALLEL */ + /*****************************/ /* Library Private Variables */ diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index d16e2d4..c995d5d 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -133,12 +133,12 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo) HDmemset(finfo, 0, sizeof(*finfo)); /* Get the size of the superblock extension */ - if(H5F__super_size(f, H5AC_ind_dxpl_id, NULL, &finfo->super_ext_size) < 0) + if(H5F__super_size(f, H5AC_dxpl_id, NULL, &finfo->super_ext_size) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve superblock extension size") /* Check for SOHM info */ if(H5F_addr_defined(f->shared->sohm_addr)) - if(H5SM_ih_size(f, H5AC_ind_dxpl_id, &finfo->sohm.hdr_size, &finfo->sohm.msgs_info) < 0) + if(H5SM_ih_size(f, H5AC_dxpl_id, &finfo->sohm.hdr_size, &finfo->sohm.msgs_info) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "Unable to retrieve SOHM index & heap storage info") done: diff --git a/src/H5Fint.c b/src/H5Fint.c index 94a5488..14f5456 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -497,10 +497,11 @@ done: *------------------------------------------------------------------------- */ htri_t -H5F_is_hdf5(const char *name) +H5F_is_hdf5(const char *name, hid_t dxpl_id) { H5FD_t *file = NULL; /* Low-level file struct */ haddr_t sig_addr; /* Addess of hdf5 file signature */ + H5P_genplist_t *xfer_plist= NULL; /* Dataset transfer property list object */ htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -509,8 +510,12 @@ H5F_is_hdf5(const char *name) if(NULL == (file = H5FD_open(name, H5F_ACC_RDONLY, H5P_FILE_ACCESS_DEFAULT, HADDR_UNDEF))) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to open file") + /* Get the property list object */ + if(NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") + /* The file is an hdf5 file if the hdf5 file signature can be found */ - if(H5FD_locate_signature(file, H5AC_ind_dxpl_g, &sig_addr) < 0) + if(H5FD_locate_signature(file, xfer_plist, &sig_addr) < 0) HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to locate file signature") ret_value = (HADDR_UNDEF != sig_addr); @@ -1943,7 +1948,7 @@ H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag) *------------------------------------------------------------------------- */ ssize_t -H5F_get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) +H5F_get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len, hid_t dxpl_id) { H5FD_t *fd_ptr; /* file driver */ haddr_t eoa; /* End of file address */ @@ -2011,6 +2016,7 @@ H5F_get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) /* test to see if a buffer was provided -- if not, we are done */ if(buf_ptr != NULL) { size_t space_needed; /* size of file image */ + H5P_genplist_t *xfer_plist= NULL; /* Dataset transfer property list object */ /* Check for buffer too small */ if((haddr_t)buf_len < eoa) @@ -2018,9 +2024,13 @@ H5F_get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len) space_needed = (size_t)eoa; + /* Get the property list object */ + if(NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") + /* read in the file image */ /* (Note compensation for base address addition in internal routine) */ - if(H5FD_read(fd_ptr, H5AC_ind_dxpl_g, H5FD_MEM_DEFAULT, 0, space_needed, buf_ptr) < 0) + if(H5FD_read(fd_ptr, xfer_plist, H5FD_MEM_DEFAULT, 0, space_needed, buf_ptr) < 0) HGOTO_ERROR(H5E_FILE, H5E_READERROR, FAIL, "file image read request failed") } /* end if */ diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c index fe2a774..9783947 100644 --- a/src/H5Fmpi.c +++ b/src/H5Fmpi.c @@ -258,5 +258,74 @@ H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag) done: FUNC_LEAVE_API(ret_value) } + + +/*------------------------------------------------------------------------- + * Function: H5F_mpi_retrieve_comm + * + * Purpose: Retrieves an MPI communicator from the file the location ID + * is in. If the loc_id is invalid, the fapl_id is used to + * retrieve the communicator. + * + * Return: Success: Non-negative + * + * Failure: Negative + * + * Programmer: Mohamad Chaarawi + * Feb 14, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + HDassert(mpi_comm); + *mpi_comm = MPI_COMM_NULL; + + /* if the loc_id is valid, then get the comm from the file + attached to the loc_id */ + if(H5I_INVALID_HID != loc_id) { + H5G_loc_t loc; + H5F_t *f = NULL; + + /* retrieve the file structure */ + if(H5G_loc(loc_id, &loc) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + f = loc.oloc->file; + HDassert(f); + + /* check if MPIO driver is used */ + if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { + /* retrieve the file communicator */ + if(MPI_COMM_NULL == (*mpi_comm = H5F_mpi_get_comm(f))) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get MPI communicator") + } + } + /* otherwise, this if from H5Fopen or H5Fcreate and has to be collective */ + else { + H5P_genplist_t *plist; /* Property list pointer */ + + HDassert(H5P_isa_class(acspl_id, H5P_FILE_ACCESS)); + + if(NULL == (plist = H5P_object_verify(acspl_id, H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access list") + + if(H5FD_MPIO == H5P_peek_driver(plist)) { + const H5FD_mpio_fapl_t *fa; /* MPIO fapl info */ + + if(NULL == (fa = (const H5FD_mpio_fapl_t *)H5P_peek_driver_info(plist))) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "bad VFL driver info") + + *mpi_comm = fa->comm; + } + } +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F_mpi_retrieve_comm */ + #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 2255085..c62858c 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -337,8 +337,9 @@ H5F_t *H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf); herr_t H5F_dest(H5F_t *f, hid_t dxpl_id, hbool_t flush); H5_DLL herr_t H5F_flush(H5F_t *f, hid_t dxpl_id, hbool_t closing); -H5_DLL htri_t H5F_is_hdf5(const char *name); +H5_DLL htri_t H5F_is_hdf5(const char *name, hid_t dxpl_id); H5_DLL herr_t H5F_get_objects(const H5F_t *f, unsigned types, size_t max_index, hid_t *obj_id_list, hbool_t app_ref, size_t *obj_id_count_ptr); +H5_DLL ssize_t H5F_get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len, hid_t dxpl_id); H5_DLL herr_t H5F_close(H5F_t *f); /* File mount related routines */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index fae8b99..dd2877b 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -604,7 +604,6 @@ H5_DLL unsigned H5F_get_nopen_objs(const H5F_t *f); H5_DLL unsigned H5F_incr_nopen_objs(H5F_t *f); H5_DLL unsigned H5F_decr_nopen_objs(H5F_t *f); H5_DLL hid_t H5F_get_file_id(const H5F_t *f); -H5_DLL ssize_t H5F_get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len); H5_DLL H5F_t *H5F_get_parent(const H5F_t *f); H5_DLL unsigned H5F_get_nmounts(const H5F_t *f); H5_DLL hid_t H5F_get_access_plist(H5F_t *f, hbool_t app_ref); @@ -680,6 +679,7 @@ H5_DLL herr_t H5F_super_dirty(H5F_t *f); H5_DLL int H5F_mpi_get_rank(const H5F_t *f); H5_DLL MPI_Comm H5F_mpi_get_comm(const H5F_t *f); H5_DLL int H5F_mpi_get_size(const H5F_t *f); +H5_DLL herr_t H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm); #endif /* H5_HAVE_PARALLEL */ /* External file cache routines */ diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index c2c7bc9..1e9e4dd 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -625,9 +625,6 @@ H5F__cache_superblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNU /* (We'll rely on the cache to make sure it actually *is* flushed last (and collectively in parallel), but this check doesn't hurt) */ HDassert(sblock->cache_info.flush_me_last); -#ifdef H5_HAVE_PARALLEL - HDassert(sblock->cache_info.flush_me_collectively); -#endif /* Encode the common portion of the file superblock for all versions */ HDmemcpy(image, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN); diff --git a/src/H5Ftest.c b/src/H5Ftest.c index b741e0d..e8cd8f4 100644 --- a/src/H5Ftest.c +++ b/src/H5Ftest.c @@ -109,7 +109,7 @@ H5F_get_sohm_mesg_count_test(hid_t file_id, unsigned type_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* Retrieve count for message type */ - if(H5SM_get_mesg_count_test(file, H5AC_ind_dxpl_id, type_id, mesg_count) < 0) + if(H5SM_get_mesg_count_test(file, H5AC_dxpl_id, type_id, mesg_count) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve shared message count") done: diff --git a/src/H5G.c b/src/H5G.c index 8798a82..b5755ae 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -317,7 +317,7 @@ H5Gcreate2(hid_t loc_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group create property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create the new group & get its ID */ @@ -394,7 +394,7 @@ H5Gcreate_anon(hid_t loc_id, hid_t gcpl_id, hid_t gapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not group create property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up group creation info */ @@ -453,7 +453,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) { H5G_t *grp = NULL; /* Group opened */ H5G_loc_t loc; /* Location of parent for group */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -466,7 +466,7 @@ H5Gopen2(hid_t loc_id, const char *name, hid_t gapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&gapl_id, H5P_CLS_GACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Open the group */ @@ -559,7 +559,7 @@ H5Gget_info(hid_t grp_id, H5G_info_t *grp_info) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Retrieve the group's information */ - if(H5G__obj_info(loc.oloc, grp_info/*out*/, H5AC_ind_dxpl_id) < 0) + if(H5G__obj_info(loc.oloc, grp_info/*out*/, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info") done: @@ -589,7 +589,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, H5G_name_t grp_path; /* Opened object group hier. path */ H5O_loc_t grp_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Location at 'name' found */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -604,7 +604,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *grp_info, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ @@ -652,7 +652,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_name_t grp_path; /* Opened object group hier. path */ H5O_loc_t grp_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -672,7 +672,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c index e0bc78e..919389f 100644 --- a/src/H5Gdeprec.c +++ b/src/H5Gdeprec.c @@ -274,7 +274,7 @@ H5Gopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Open the group */ - if((grp = H5G__open_name(&loc, name, H5P_DEFAULT, H5AC_ind_dxpl_id)) == NULL) + if((grp = H5G__open_name(&loc, name, H5P_DEFAULT, H5AC_dxpl_id)) == NULL) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open group") /* Register an atom for the group */ @@ -602,7 +602,7 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf/*out*/) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Call the new link routine which provides this capability */ - if(H5L_get_val(&loc, name, buf, size, H5P_DEFAULT, H5AC_ind_dxpl_id) < 0) + if(H5L_get_val(&loc, name, buf, size, H5P_DEFAULT, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "couldn't get link info") done: @@ -688,7 +688,7 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf) if(bufsize > 0 && !buf) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no buffer specified") - if((ret_value = (int)H5G_loc_get_comment(&loc, name, buf, bufsize, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if((ret_value = (int)H5G_loc_get_comment(&loc, name, buf, bufsize, H5P_DEFAULT, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to get comment value") done: @@ -752,7 +752,7 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, lnk_op.op_func.op_old = op; /* Call private function. */ - if((ret_value = H5G_iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_iterate(loc_id, name, H5_INDEX_NAME, H5_ITER_INC, idx, &last_obj, &lnk_op, op_data, H5P_DEFAULT, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group iteration failed") /* Set the index we stopped at */ @@ -794,7 +794,7 @@ H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs) /* Check args */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") - if(H5O_obj_type(loc.oloc, &obj_type, H5AC_ind_dxpl_id) < 0) + if(H5O_obj_type(loc.oloc, &obj_type, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object type") if(obj_type != H5O_TYPE_GROUP) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group") @@ -802,7 +802,7 @@ H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad pointer to # of objects") /* Retrieve information about the group */ - if(H5G__obj_info(loc.oloc, &grp_info, H5AC_ind_dxpl_id) < 0) + if(H5G__obj_info(loc.oloc, &grp_info, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "can't determine") /* Set the number of objects [sic: links] in the group */ @@ -847,7 +847,7 @@ H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Get info */ - if(H5G_get_objinfo(&loc, name, follow_link, statbuf, H5AC_ind_dxpl_id) < 0) + if(H5G_get_objinfo(&loc, name, follow_link, statbuf, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "cannot stat object") done: @@ -1040,13 +1040,13 @@ H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name, size_t size) /* Check args */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location ID") - if(H5O_obj_type(loc.oloc, &obj_type, H5AC_ind_dxpl_id) < 0) + if(H5O_obj_type(loc.oloc, &obj_type, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get object type") if(obj_type != H5O_TYPE_GROUP) HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a group") /* Call internal function */ - if((ret_value = H5G_obj_get_name_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_obj_get_name_by_idx(loc.oloc, H5_INDEX_NAME, H5_ITER_INC, idx, name, size, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, FAIL, "can't get object name") done: @@ -1082,13 +1082,13 @@ H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx) /* Check args */ if(H5G_loc(loc_id, &loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "not a location ID") - if(H5O_obj_type(loc.oloc, &obj_type, H5AC_ind_dxpl_id) < 0) + if(H5O_obj_type(loc.oloc, &obj_type, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5G_UNKNOWN, "can't get object type") if(obj_type != H5O_TYPE_GROUP) HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "not a group") /* Call internal function*/ - if((ret_value = H5G_obj_get_type_by_idx(loc.oloc, idx, H5AC_ind_dxpl_id)) == H5G_UNKNOWN) + if((ret_value = H5G_obj_get_type_by_idx(loc.oloc, idx, H5AC_dxpl_id)) == H5G_UNKNOWN) HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object type") done: diff --git a/src/H5Gint.c b/src/H5Gint.c index cba4806..7bd920c 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -1200,17 +1200,17 @@ H5G_get_create_plist(H5G_t *grp) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") /* Retrieve any object creation properties */ - if(H5O_get_create_plist(&grp->oloc, H5AC_ind_dxpl_id, new_plist) < 0) + if(H5O_get_create_plist(&grp->oloc, H5AC_dxpl_id, new_plist) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get object creation info") /* Check for the group having a group info message */ - if((ginfo_exists = H5O_msg_exists(&(grp->oloc), H5O_GINFO_ID, H5AC_ind_dxpl_id)) < 0) + if((ginfo_exists = H5O_msg_exists(&(grp->oloc), H5O_GINFO_ID, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(ginfo_exists) { H5O_ginfo_t ginfo; /* Group info message */ /* Read the group info */ - if(NULL == H5O_msg_read(&(grp->oloc), H5O_GINFO_ID, &ginfo, H5AC_ind_dxpl_id)) + if(NULL == H5O_msg_read(&(grp->oloc), H5O_GINFO_ID, &ginfo, H5AC_dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get group info") /* Set the group info for the property list */ @@ -1219,7 +1219,7 @@ H5G_get_create_plist(H5G_t *grp) } /* end if */ /* Check for the group having a link info message */ - if((linfo_exists = H5G__obj_get_linfo(&(grp->oloc), &linfo, H5AC_ind_dxpl_id)) < 0) + if((linfo_exists = H5G__obj_get_linfo(&(grp->oloc), &linfo, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read object header") if(linfo_exists) { /* Set the link info for the property list */ @@ -1228,13 +1228,13 @@ H5G_get_create_plist(H5G_t *grp) } /* end if */ /* Check for the group having a pipeline message */ - if((pline_exists = H5O_msg_exists(&(grp->oloc), H5O_PLINE_ID, H5AC_ind_dxpl_id)) < 0) + if((pline_exists = H5O_msg_exists(&(grp->oloc), H5O_PLINE_ID, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read object header") if(pline_exists) { H5O_pline_t pline; /* Pipeline message */ /* Read the pipeline */ - if(NULL == H5O_msg_read(&(grp->oloc), H5O_PLINE_ID, &pline, H5AC_ind_dxpl_id)) + if(NULL == H5O_msg_read(&(grp->oloc), H5O_PLINE_ID, &pline, H5AC_dxpl_id)) HGOTO_ERROR(H5E_SYM, H5E_BADMESG, FAIL, "can't get link pipeline") /* Set the pipeline for the property list */ diff --git a/src/H5Gtest.c b/src/H5Gtest.c index a8796fb..6b20ade 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -97,7 +97,7 @@ H5G__is_empty_test(hid_t gid) H5G_t *grp = NULL; /* Pointer to group */ htri_t msg_exists = FALSE; /* Indicate that a header message is present */ htri_t linfo_exists = FALSE;/* Indicate that the 'link info' message is present */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ + hid_t dxpl_id = H5AC_dxpl_id; /* transfer property list used for this operation */ htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_PACKAGE @@ -209,7 +209,7 @@ H5G__has_links_test(hid_t gid, unsigned *nmsgs) { H5G_t *grp = NULL; /* Pointer to group */ htri_t msg_exists = 0; /* Indicate that a header message is present */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ + hid_t dxpl_id = H5AC_dxpl_id; /* transfer property list used for this operation */ htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_PACKAGE @@ -268,7 +268,7 @@ H5G__has_stab_test(hid_t gid) { H5G_t *grp = NULL; /* Pointer to group */ htri_t msg_exists = 0; /* Indicate that a header message is present */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ + hid_t dxpl_id = H5AC_dxpl_id; /* transfer property list used for this operation */ htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_PACKAGE @@ -319,7 +319,7 @@ H5G__is_new_dense_test(hid_t gid) { H5G_t *grp = NULL; /* Pointer to group */ htri_t msg_exists = 0; /* Indicate that a header message is present */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ + hid_t dxpl_id = H5AC_dxpl_id; /* transfer property list used for this operation */ htri_t ret_value = TRUE; /* Return value */ FUNC_ENTER_PACKAGE @@ -390,7 +390,7 @@ H5G__new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count) H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */ H5O_linfo_t linfo; /* Link info message */ H5G_t *grp = NULL; /* Pointer to group */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ + hid_t dxpl_id = H5AC_dxpl_id; /* transfer property list used for this operation */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -471,7 +471,7 @@ H5G__lheap_size_test(hid_t gid, size_t *lheap_size) { H5G_t *grp = NULL; /* Pointer to group */ H5O_stab_t stab; /* Symbol table message */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ + hid_t dxpl_id = H5AC_dxpl_id; /* transfer property list used for this operation */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -613,7 +613,7 @@ H5G__verify_cached_stab_test(H5O_loc_t *grp_oloc, H5G_entry_t *ent) { H5O_stab_t stab; /* Symbol table */ H5HL_t *heap = NULL; /* Pointer to local heap */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ + hid_t dxpl_id = H5AC_dxpl_id; /* transfer property list used for this operation */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(dxpl_id, grp_oloc->addr, FAIL) @@ -770,7 +770,7 @@ H5G__verify_cached_stabs_test(hid_t gid) H5O_stab_t stab; /* Symbol table message */ H5G_bt_common_t udata = {NULL, NULL}; /* Dummy udata so H5B_iterate doesn't freak out */ haddr_t prev_tag = HADDR_UNDEF; /* Previous metadata tag */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* transfer property list used for this operation */ + hid_t dxpl_id = H5AC_dxpl_id; /* transfer property list used for this operation */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE diff --git a/src/H5I.c b/src/H5I.c index 15db6d6..00d69ad 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -2049,7 +2049,7 @@ H5Iget_name(hid_t id, char *name/*out*/, size_t size) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object location") /* Call internal group routine to retrieve object's name */ - if((ret_value = H5G_get_name(&loc, name, size, NULL, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_get_name(&loc, name, size, NULL, H5P_DEFAULT, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name") done: diff --git a/src/H5Itest.c b/src/H5Itest.c index 9d451c6..43966e7 100644 --- a/src/H5Itest.c +++ b/src/H5Itest.c @@ -89,7 +89,7 @@ H5I_get_name_test(hid_t id, char *name/*out*/, size_t size, hbool_t *cached) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object location") /* Call internal group routine to retrieve object's name */ - if((ret_value = H5G_get_name(&loc, name, size, cached, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_get_name(&loc, name, size, cached, H5P_DEFAULT, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name") done: diff --git a/src/H5L.c b/src/H5L.c index 23eb395..efe16aa 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -358,7 +358,9 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, + ((src_loc_id != H5L_SAME_LOC) ? src_loc_id : dst_loc_id), + TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up src & dst location pointers */ @@ -421,7 +423,9 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, + ((src_loc_id != H5L_SAME_LOC) ? src_loc_id : dst_loc_id), + TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up src & dst location pointers */ @@ -482,7 +486,7 @@ H5Lcreate_soft(const char *link_target, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, link_loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create the link */ @@ -538,7 +542,7 @@ H5Lcreate_hard(hid_t cur_loc_id, const char *cur_name, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, cur_loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up current & new location pointers */ @@ -606,7 +610,7 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid link class") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, link_loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create external link */ @@ -652,7 +656,7 @@ H5Ldelete(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Unlink */ @@ -706,7 +710,7 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for unlink operation */ @@ -749,7 +753,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, hid_t lapl_id) { H5G_loc_t loc; /* Group location for location to query */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -762,7 +766,7 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, size_t size, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Get the link value */ @@ -799,7 +803,7 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, { H5G_loc_t loc; /* Group location for location to query */ H5L_trav_gvbi_t udata; /* User data for callback */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -817,7 +821,7 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for retrieving information */ @@ -856,7 +860,7 @@ htri_t H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ htri_t ret_value; FUNC_ENTER_API(FAIL) @@ -869,7 +873,7 @@ H5Lexists(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Check for the existence of the link */ @@ -900,7 +904,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, hid_t lapl_id) { H5G_loc_t loc; - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) @@ -913,7 +917,7 @@ H5Lget_info(hid_t loc_id, const char *name, H5L_info_t *linfo /*out*/, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Get the link information */ @@ -946,7 +950,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, { H5G_loc_t loc; /* Group location for group to query */ H5L_trav_gibi_t udata; /* User data for callback */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -964,7 +968,7 @@ H5Lget_info_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for callback */ @@ -1135,7 +1139,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, { H5G_loc_t loc; /* Location of group */ H5L_trav_gnbi_t udata; /* User data for callback */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1153,7 +1157,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up user data for callback */ @@ -1233,7 +1237,7 @@ H5Literate(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, lnk_op.op_func.op_new = op; /* Iterate over the links */ - if((ret_value = H5G_iterate(grp_id, ".", idx_type, order, idx, &last_lnk, &lnk_op, op_data, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_iterate(grp_id, ".", idx_type, order, idx, &last_lnk, &lnk_op, op_data, H5P_DEFAULT, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link iteration failed") /* Set the index we stopped at */ @@ -1275,7 +1279,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, H5G_link_iterate_t lnk_op; /* Link operator */ hsize_t last_lnk; /* Index of last object looked at */ hsize_t idx; /* Internal location to hold index */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1293,7 +1297,7 @@ H5Literate_by_name(hid_t loc_id, const char *group_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up iteration beginning/end info */ @@ -1368,7 +1372,7 @@ H5Lvisit(hid_t grp_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") /* Call internal group visitation routine */ - if((ret_value = H5G_visit(grp_id, ".", idx_type, order, op, op_data, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_visit(grp_id, ".", idx_type, order, op, op_data, H5P_DEFAULT, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "link visitation failed") done: @@ -1426,7 +1430,7 @@ H5Lvisit_by_name(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Call internal group visitation routine */ diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 3e8be66..732eb7b 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -282,7 +282,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, parent_file_name = H5F_OPEN_NAME(loc.oloc->file); /* Query length of parent group name */ - if((group_name_len = H5G_get_name(&loc, NULL, (size_t) 0, NULL, lapl_id, H5AC_ind_dxpl_id)) < 0) + if((group_name_len = H5G_get_name(&loc, NULL, (size_t) 0, NULL, lapl_id, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve length of group name") /* Account for null terminator */ @@ -297,7 +297,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, parent_group_name = local_group_name; /* Get parent group name */ - if(H5G_get_name(&loc, parent_group_name, (size_t) group_name_len, NULL, lapl_id, H5AC_ind_dxpl_id) < 0) + if(H5G_get_name(&loc, parent_group_name, (size_t) group_name_len, NULL, lapl_id, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve group name") /* Make callback */ @@ -599,7 +599,7 @@ H5Lcreate_external(const char *file_name, const char *obj_name, HDstrncpy((char *)p, norm_obj_name, buf_size - (file_name_len + 1)); /* External link's object */ /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, link_loc_id, TRUE) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Create an external link */ diff --git a/src/H5O.c b/src/H5O.c index 01be3e6..b22528a 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -282,7 +282,7 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_loc_t obj_loc; /* Location used to open group */ H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ hid_t ret_value = FAIL; @@ -300,7 +300,7 @@ H5Oopen_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ @@ -390,7 +390,7 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) H5G_name_reset(obj_loc.path); /* objects opened through this routine don't have a path name */ /* Open the object */ - if((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, H5AC_ind_dxpl_id, TRUE)) < 0) + if((ret_value = H5O_open_by_loc(&obj_loc, lapl_id, H5AC_dxpl_id, TRUE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") done: @@ -450,7 +450,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, obj_id, TRUE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Link to the object */ @@ -561,7 +561,7 @@ htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; /* Location info */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) @@ -574,7 +574,7 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Check if the object exists */ @@ -615,7 +615,7 @@ H5Oget_info(hid_t loc_id, H5O_info_t *oinfo) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Retrieve the object's information */ - if(H5G_loc_info(&loc, ".", TRUE, oinfo/*out*/, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_info(&loc, ".", TRUE, oinfo/*out*/, H5P_LINK_ACCESS_DEFAULT, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") done: @@ -640,7 +640,7 @@ herr_t H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -655,7 +655,7 @@ H5Oget_info_by_name(hid_t loc_id, const char *name, H5O_info_t *oinfo, hid_t lap HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Retrieve the object's information */ @@ -690,7 +690,7 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -710,7 +710,7 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no info struct") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up opened group location to fill in */ @@ -724,7 +724,7 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, loc_found = TRUE; /* Retrieve the object's information */ - if(H5O_get_info(obj_loc.oloc, H5AC_ind_dxpl_id, TRUE, oinfo) < 0) + if(H5O_get_info(obj_loc.oloc, H5AC_dxpl_id, TRUE, oinfo) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") done: @@ -767,7 +767,7 @@ H5Oset_comment(hid_t obj_id, const char *comment) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* (Re)set the object's comment */ - if(H5G_loc_set_comment(&loc, ".", comment, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_set_comment(&loc, ".", comment, H5P_LINK_ACCESS_DEFAULT, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") done: @@ -810,7 +810,7 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* (Re)set the object's comment */ @@ -852,7 +852,7 @@ H5Oget_comment(hid_t obj_id, char *comment, size_t bufsize) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") /* Retrieve the object's comment */ - if((ret_value = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5G_loc_get_comment(&loc, ".", comment/*out*/, bufsize, H5P_LINK_ACCESS_DEFAULT, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found") done: @@ -881,7 +881,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf hid_t lapl_id) { H5G_loc_t loc; /* Location of group */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -894,7 +894,7 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment, size_t buf HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Retrieve the object's comment */ @@ -956,7 +956,7 @@ H5Ovisit(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") /* Call internal object visitation routine */ - if((ret_value = H5O_visit(obj_id, ".", idx_type, order, op, op_data, H5P_LINK_ACCESS_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if((ret_value = H5O_visit(obj_id, ".", idx_type, order, op, op_data, H5P_LINK_ACCESS_DEFAULT, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed") done: @@ -1000,7 +1000,7 @@ herr_t H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t lapl_id) { - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1018,7 +1018,7 @@ H5Ovisit_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no callback operator specified") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Call internal object visitation routine */ @@ -1351,7 +1351,7 @@ H5O_open_name(H5G_loc_t *loc, const char *name, hid_t lapl_id, hbool_t app_ref) H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value = FAIL; FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 70dc560..2bb7a36 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -233,7 +233,7 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination name specified") /* check if destination name already exists */ - if((dst_exists = H5L_exists_tolerant(&dst_loc, dst_name, H5P_DEFAULT, H5AC_ind_dxpl_id)) < 0) + if((dst_exists = H5L_exists_tolerant(&dst_loc, dst_name, H5P_DEFAULT, H5AC_dxpl_id)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check if destination name exists") if(TRUE == dst_exists) HGOTO_ERROR(H5E_OHDR, H5E_EXISTS, FAIL, "destination object already exists") @@ -244,7 +244,7 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, H5G_loc_reset(&src_loc); /* Find the source object to copy */ - if(H5G_loc_find(&loc, src_name, &src_loc/*out*/, H5P_DEFAULT, H5AC_ind_dxpl_id) < 0) + if(H5G_loc_find(&loc, src_name, &src_loc/*out*/, H5P_DEFAULT, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "source object not found") loc_found = TRUE; diff --git a/src/H5Ofill.c b/src/H5Ofill.c index ebcb5d3..f291305 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -527,7 +527,7 @@ H5O_fill_copy(const void *_src, void *_dst) H5T_path_t *tpath; /* Conversion information */ /* Set up type conversion function */ - if(NULL == (tpath = H5T_path_find(src->type, dst->type, NULL, NULL, H5AC_ind_dxpl_id, FALSE))) + if(NULL == (tpath = H5T_path_find(src->type, dst->type, NULL, NULL, H5AC_dxpl_id, FALSE))) HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, NULL, "unable to convert between src and dst data types") /* If necessary, convert fill value datatypes (which copies VL components, etc.) */ @@ -555,7 +555,7 @@ H5O_fill_copy(const void *_src, void *_dst) } /* end if */ /* Convert fill value */ - if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, dst->buf, bkg_buf, H5AC_ind_dxpl_id) < 0) { + if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, dst->buf, bkg_buf, H5AC_dxpl_id) < 0) { H5I_dec_ref(src_id); H5I_dec_ref(dst_id); if(bkg_buf) diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 0c13498..0ece505 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -593,7 +593,7 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, UINT32ENCODE(heap_block_p, chksum) /* Insert block into global heap */ - if(H5HG_insert(f, H5AC_ind_dxpl_id, block_size, heap_block, &((H5O_layout_t *)mesg)->storage.u.virt.serial_list_hobjid) < 0) /* Casting away const OK --NAF */ + if(H5HG_insert(f, H5AC_dxpl_id, block_size, heap_block, &((H5O_layout_t *)mesg)->storage.u.virt.serial_list_hobjid) < 0) /* Casting away const OK --NAF */ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to insert virtual dataset heap block") } /* end if */ diff --git a/src/H5Otest.c b/src/H5Otest.c index 1c149e3..b9ed5be 100644 --- a/src/H5Otest.c +++ b/src/H5Otest.c @@ -108,14 +108,14 @@ H5O_is_attr_dense_test(hid_t oid) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") /* Get the object header */ - if(NULL == (oh = H5O_protect(loc, H5AC_ind_dxpl_id, H5AC__READ_ONLY_FLAG))) + if(NULL == (oh = H5O_protect(loc, H5AC_dxpl_id, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; if(oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ - if(H5A_get_ainfo(loc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0) + if(H5A_get_ainfo(loc->file, H5AC_dxpl_id, oh, &ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") } /* end if */ @@ -130,7 +130,7 @@ H5O_is_attr_dense_test(hid_t oid) ret_value = FALSE; done: - if(oh && H5O_unprotect(loc, H5AC_ind_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + if(oh && H5O_unprotect(loc, H5AC_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -173,13 +173,13 @@ H5O_is_attr_empty_test(hid_t oid) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") /* Get the object header */ - if(NULL == (oh = H5O_protect(loc, H5AC_ind_dxpl_id, H5AC__READ_ONLY_FLAG))) + if(NULL == (oh = H5O_protect(loc, H5AC_dxpl_id, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ if(oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ - if((ainfo_exists = H5A_get_ainfo(loc->file, H5AC_ind_dxpl_id, oh, &ainfo)) < 0) + if((ainfo_exists = H5A_get_ainfo(loc->file, H5AC_dxpl_id, oh, &ainfo)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") } /* end if */ @@ -195,10 +195,10 @@ H5O_is_attr_empty_test(hid_t oid) HDassert(nattrs == 0); /* Set metadata tag in dxpl_id */ - H5_BEGIN_TAG(H5AC_ind_dxpl_id, loc->addr, FAIL); + H5_BEGIN_TAG(H5AC_dxpl_id, loc->addr, FAIL); /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL))) + if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_dxpl_id, ainfo.name_bt2_addr, NULL))) HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Reset metadata tag in dxpl_id */ @@ -221,9 +221,9 @@ H5O_is_attr_empty_test(hid_t oid) done: /* Release resources */ - if(bt2_name && H5B2_close(bt2_name, H5AC_ind_dxpl_id) < 0) + if(bt2_name && H5B2_close(bt2_name, H5AC_dxpl_id) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") - if(oh && H5O_unprotect(loc, H5AC_ind_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + if(oh && H5O_unprotect(loc, H5AC_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -266,14 +266,14 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") /* Get the object header */ - if(NULL == (oh = H5O_protect(loc, H5AC_ind_dxpl_id, H5AC__READ_ONLY_FLAG))) + if(NULL == (oh = H5O_protect(loc, H5AC_dxpl_id, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; if(oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ - if(H5A_get_ainfo(loc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0) + if(H5A_get_ainfo(loc->file, H5AC_dxpl_id, oh, &ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") } /* end if */ @@ -288,10 +288,10 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) HDassert(obj_nattrs == 0); /* Set metadata tag in dxpl_id */ - H5_BEGIN_TAG(H5AC_ind_dxpl_id, loc->addr, FAIL); + H5_BEGIN_TAG(H5AC_dxpl_id, loc->addr, FAIL); /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL))) + if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_dxpl_id, ainfo.name_bt2_addr, NULL))) HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Reset metadata tag in dxpl_id */ @@ -311,9 +311,9 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) done: /* Release resources */ - if(bt2_name && H5B2_close(bt2_name, H5AC_ind_dxpl_id) < 0) + if(bt2_name && H5B2_close(bt2_name, H5AC_dxpl_id) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") - if(oh && H5O_unprotect(loc, H5AC_ind_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + if(oh && H5O_unprotect(loc, H5AC_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -358,17 +358,17 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") /* Set metadata tag in dxpl_id */ - H5_BEGIN_TAG(H5AC_ind_dxpl_id, loc->addr, FAIL); + H5_BEGIN_TAG(H5AC_dxpl_id, loc->addr, FAIL); /* Get the object header */ - if(NULL == (oh = H5O_protect(loc, H5AC_ind_dxpl_id, H5AC__READ_ONLY_FLAG))) + if(NULL == (oh = H5O_protect(loc, H5AC_dxpl_id, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; if(oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ - if(H5A_get_ainfo(loc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0) + if(H5A_get_ainfo(loc->file, H5AC_dxpl_id, oh, &ainfo) < 0) HGOTO_ERROR_TAG(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") } /* end if */ @@ -379,7 +379,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) HGOTO_DONE_TAG(FAIL, FAIL) /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL))) + if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_dxpl_id, ainfo.name_bt2_addr, NULL))) HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Retrieve # of records in name index */ @@ -389,7 +389,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) /* Check if there is a creation order index */ if(H5F_addr_defined(ainfo.corder_bt2_addr)) { /* Open the creation order index v2 B-tree */ - if(NULL == (bt2_corder = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.corder_bt2_addr, NULL))) + if(NULL == (bt2_corder = H5B2_open(loc->file, H5AC_dxpl_id, ainfo.corder_bt2_addr, NULL))) HGOTO_ERROR_TAG(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index") /* Retrieve # of records in creation order index */ @@ -404,11 +404,11 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) done: /* Release resources */ - if(bt2_name && H5B2_close(bt2_name, H5AC_ind_dxpl_id) < 0) + if(bt2_name && H5B2_close(bt2_name, H5AC_dxpl_id) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") - if(bt2_corder && H5B2_close(bt2_corder, H5AC_ind_dxpl_id) < 0) + if(bt2_corder && H5B2_close(bt2_corder, H5AC_dxpl_id) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index") - if(oh && H5O_unprotect(loc, H5AC_ind_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + if(oh && H5O_unprotect(loc, H5AC_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -452,7 +452,7 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") /* Get the object header */ - if(NULL == (oh = H5O_protect(loc, H5AC_ind_dxpl_id, H5AC__READ_ONLY_FLAG))) + if(NULL == (oh = H5O_protect(loc, H5AC_dxpl_id, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Locate "unknown" message */ @@ -471,7 +471,7 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "'unknown' message type not found") done: - if(oh && H5O_unprotect(loc, H5AC_ind_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) + if(oh && H5O_unprotect(loc, H5AC_dxpl_id, oh, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 971394c..2abd24c 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -3125,7 +3125,7 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value) HDmemcpy(fill.buf, value, (size_t)fill.size); /* Set up type conversion function */ - if(NULL == (tpath = H5T_path_find(type, type, NULL, NULL, H5AC_ind_dxpl_id, FALSE))) + if(NULL == (tpath = H5T_path_find(type, type, NULL, NULL, H5AC_dxpl_id, FALSE))) HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types") /* If necessary, convert fill value datatypes (which copies VL components, etc.) */ @@ -3137,7 +3137,7 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Convert the fill value */ - if(H5T_convert(tpath, type_id, type_id, (size_t)1, (size_t)0, (size_t)0, fill.buf, bkg_buf, H5AC_ind_dxpl_id) < 0) { + if(H5T_convert(tpath, type_id, type_id, (size_t)1, (size_t)0, (size_t)0, fill.buf, bkg_buf, H5AC_dxpl_id) < 0) { if(bkg_buf) bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf); HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed") @@ -3292,7 +3292,7 @@ H5Pget_fill_value(hid_t plist_id, hid_t type_id, void *value/*out*/) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* Get the fill value */ - if(H5P_get_fill_value(plist, type, value, H5AC_ind_dxpl_id) < 0) + if(H5P_get_fill_value(plist, type, value, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fill value") done: diff --git a/src/H5Pint.c b/src/H5Pint.c index d80e66d..e16379a 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -30,6 +30,7 @@ /***********/ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* File access */ #include "H5FLprivate.h" /* Free lists */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ @@ -273,13 +274,10 @@ const H5P_libclass_t H5P_CLS_TACC[1] = {{ /* Library property list classes defined in other code modules */ H5_DLLVAR const H5P_libclass_t H5P_CLS_OCRT[1]; /* Object creation */ H5_DLLVAR const H5P_libclass_t H5P_CLS_STRCRT[1]; /* String create */ -H5_DLLVAR const H5P_libclass_t H5P_CLS_LACC[1]; /* Link access */ H5_DLLVAR const H5P_libclass_t H5P_CLS_GCRT[1]; /* Group create */ H5_DLLVAR const H5P_libclass_t H5P_CLS_OCPY[1]; /* Object copy */ H5_DLLVAR const H5P_libclass_t H5P_CLS_FCRT[1]; /* File creation */ -H5_DLLVAR const H5P_libclass_t H5P_CLS_FACC[1]; /* File access */ H5_DLLVAR const H5P_libclass_t H5P_CLS_DCRT[1]; /* Dataset creation */ -H5_DLLVAR const H5P_libclass_t H5P_CLS_DACC[1]; /* Dataset access */ H5_DLLVAR const H5P_libclass_t H5P_CLS_DXFR[1]; /* Data transfer */ H5_DLLVAR const H5P_libclass_t H5P_CLS_FMNT[1]; /* File mount */ H5_DLLVAR const H5P_libclass_t H5P_CLS_ACRT[1]; /* Attribute creation */ @@ -5452,8 +5450,10 @@ H5P_get_class(const H5P_genplist_t *plist) *------------------------------------------------------------------------- */ herr_t -H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t *dxpl_id) +H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, + hid_t *dxpl_id, hid_t loc_id, hbool_t is_collective) { + MPI_Comm mpi_comm; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -5472,7 +5472,23 @@ H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t * HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not the required access property list") } /* end else */ +#ifdef H5_HAVE_PARALLEL + /* If parallel is enabled and the file driver used in the MPI-IO + VFD, issue an MPI barrier for easier debugging if the API function + calling this is supposed to be called collectively. Note that this + happens only when the environment variable H5_COLL_BARRIER is set + to non 0. */ + if(is_collective && H5_coll_api_sanity_check_g) { + /* retrieve the MPI communicator from the loc_id or the fapl_id */ + if(H5F_mpi_retrieve_comm(loc_id, *acspl_id, &mpi_comm) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator") + + /* issue the barrier */ + if(mpi_comm != MPI_COMM_NULL) + MPI_Barrier(mpi_comm); + } +#endif /* H5_HAVE_PARALLEL */ + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_verify_apl_and_dxpl() */ - diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 7e76a4f..d93e199 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -181,7 +181,8 @@ H5_DLL herr_t H5P_get_filter_by_id(H5P_genplist_t *plist, H5Z_filter_t id, unsigned int *flags, size_t *cd_nelmts, unsigned cd_values[], size_t namelen, char name[], unsigned *filter_config); H5_DLL htri_t H5P_filter_in_pline(H5P_genplist_t *plist, H5Z_filter_t id); -H5_DLL herr_t H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t *dxpl_id); +H5_DLL herr_t H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, + hid_t *dxpl_id, hid_t loc_id, hbool_t is_collective); /* Query internal fields of the property list struct */ H5_DLL hid_t H5P_get_plist_id(const H5P_genplist_t *plist); diff --git a/src/H5R.c b/src/H5R.c index 61b45e1..04d61cd 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -621,7 +621,7 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r file = loc.oloc->file; /* Create reference */ - if((ret_value = H5R_dereference(file, oapl_id, H5AC_ind_dxpl_id, ref_type, _ref, TRUE)) < 0) + if((ret_value = H5R_dereference(file, oapl_id, H5AC_dxpl_id, ref_type, _ref, TRUE)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to dereference object") done: @@ -740,7 +740,7 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") /* Get the dataspace with the correct region selected */ - if((space = H5R_get_region(loc.oloc->file, H5AC_ind_dxpl_id, ref)) == NULL) + if((space = H5R_get_region(loc.oloc->file, H5AC_dxpl_id, ref)) == NULL) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create dataspace") /* Atomize */ @@ -880,7 +880,7 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") /* Get the object information */ - if(H5R_get_obj_type(loc.oloc->file, H5AC_ind_dxpl_id, ref_type, ref, obj_type) < 0) + if(H5R_get_obj_type(loc.oloc->file, H5AC_dxpl_id, ref_type, ref, obj_type) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to determine object type") done: @@ -1044,7 +1044,7 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name, file = loc.oloc->file; /* Get name */ - if((ret_value = H5R_get_name(file, H5P_DEFAULT, H5AC_ind_dxpl_id, id, ref_type, _ref, name, size)) < 0) + if((ret_value = H5R_get_name(file, H5P_DEFAULT, H5AC_dxpl_id, id, ref_type, _ref, name, size)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to determine object path") done: diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index b8133b2..4f2f37a 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -125,7 +125,7 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5G_UNKNOWN, "invalid reference pointer") /* Get the object information */ - if(H5R_get_obj_type(loc.oloc->file, H5AC_ind_dxpl_id, ref_type, ref, &obj_type) < 0) + if(H5R_get_obj_type(loc.oloc->file, H5AC_dxpl_id, ref_type, ref, &obj_type) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5G_UNKNOWN, "unable to determine object type") /* Set return value */ @@ -180,7 +180,7 @@ H5Rdereference1(hid_t obj_id, H5R_type_t ref_type, const void *_ref) file = loc.oloc->file; /* Create reference */ - if((ret_value = H5R_dereference(file, H5P_DATASET_ACCESS_DEFAULT, H5AC_ind_dxpl_id, ref_type, _ref, TRUE)) < 0) + if((ret_value = H5R_dereference(file, H5P_DATASET_ACCESS_DEFAULT, H5AC_dxpl_id, ref_type, _ref, TRUE)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable dereference object") done: diff --git a/src/H5T.c b/src/H5T.c index fd362eb..7c2bd9c 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -993,24 +993,24 @@ H5T__init_package(void) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") status = 0; - status |= H5T_register(H5T_PERS_SOFT, "i_i", fixedpt, fixedpt, H5T__conv_i_i, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "i_f", fixedpt, floatpt, H5T__conv_i_f, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "f_f", floatpt, floatpt, H5T__conv_f_f, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "f_i", floatpt, fixedpt, H5T__conv_f_i, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "s_s", string, string, H5T__conv_s_s, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "b_b", bitfield, bitfield, H5T__conv_b_b, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "ibo", fixedpt, fixedpt, H5T__conv_order, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "ibo(opt)", fixedpt, fixedpt, H5T__conv_order_opt, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "fbo", floatpt, floatpt, H5T__conv_order, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "fbo(opt)", floatpt, floatpt, H5T__conv_order_opt, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "struct(no-opt)", compound, compound, H5T__conv_struct, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "struct(opt)", compound, compound, H5T__conv_struct_opt, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "enum", enum_type, enum_type, H5T__conv_enum, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "enum_i", enum_type, fixedpt, H5T__conv_enum_numeric, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "enum_f", enum_type, floatpt, H5T__conv_enum_numeric, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "vlen", vlen, vlen, H5T__conv_vlen, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "array", array, array, H5T__conv_array, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "objref", objref, objref, H5T__conv_order_opt, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "i_i", fixedpt, fixedpt, H5T__conv_i_i, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "i_f", fixedpt, floatpt, H5T__conv_i_f, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "f_f", floatpt, floatpt, H5T__conv_f_f, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "f_i", floatpt, fixedpt, H5T__conv_f_i, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "s_s", string, string, H5T__conv_s_s, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "b_b", bitfield, bitfield, H5T__conv_b_b, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "ibo", fixedpt, fixedpt, H5T__conv_order, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "ibo(opt)", fixedpt, fixedpt, H5T__conv_order_opt, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "fbo", floatpt, floatpt, H5T__conv_order, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "fbo(opt)", floatpt, floatpt, H5T__conv_order_opt, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "struct(no-opt)", compound, compound, H5T__conv_struct, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "struct(opt)", compound, compound, H5T__conv_struct_opt, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "enum", enum_type, enum_type, H5T__conv_enum, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "enum_i", enum_type, fixedpt, H5T__conv_enum_numeric, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "enum_f", enum_type, floatpt, H5T__conv_enum_numeric, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "vlen", vlen, vlen, H5T__conv_vlen, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "array", array, array, H5T__conv_array, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "objref", objref, objref, H5T__conv_order_opt, H5AC_dxpl_id, FALSE); /* * Native conversions should be listed last since we can use hardware to @@ -1021,221 +1021,221 @@ H5T__init_package(void) */ /* floating point */ - status |= H5T_register(H5T_PERS_HARD, "flt_dbl", native_float, native_double, H5T__conv_float_double, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_flt", native_double, native_float, H5T__conv_double_float, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_dbl", native_float, native_double, H5T__conv_float_double, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_flt", native_double, native_float, H5T__conv_double_float, H5AC_dxpl_id, FALSE); #if H5_SIZEOF_LONG_DOUBLE != 0 - status |= H5T_register(H5T_PERS_HARD, "flt_ldbl", native_float, native_ldouble, H5T__conv_float_ldouble, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_ldbl", native_double, native_ldouble, H5T__conv_double_ldouble, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_flt", native_ldouble, native_float, H5T__conv_ldouble_float, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_dbl", native_ldouble, native_double, H5T__conv_ldouble_double, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_ldbl", native_float, native_ldouble, H5T__conv_float_ldouble, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_ldbl", native_double, native_ldouble, H5T__conv_double_ldouble, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_flt", native_ldouble, native_float, H5T__conv_ldouble_float, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_dbl", native_ldouble, native_double, H5T__conv_ldouble_double, H5AC_dxpl_id, FALSE); #endif /* H5_SIZEOF_LONG_DOUBLE != 0 */ /* from long long */ - status |= H5T_register(H5T_PERS_HARD, "llong_ullong", native_llong, native_ullong, H5T__conv_llong_ullong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_llong", native_ullong, native_llong, H5T__conv_ullong_llong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_long", native_llong, native_long, H5T__conv_llong_long, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_ulong", native_llong, native_ulong, H5T__conv_llong_ulong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_long", native_ullong, native_long, H5T__conv_ullong_long, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_ulong", native_ullong, native_ulong, H5T__conv_ullong_ulong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_short", native_llong, native_short, H5T__conv_llong_short, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_ushort", native_llong, native_ushort, H5T__conv_llong_ushort, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_short", native_ullong, native_short, H5T__conv_ullong_short, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_ushort", native_ullong, native_ushort, H5T__conv_ullong_ushort, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_int", native_llong, native_int, H5T__conv_llong_int, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_uint", native_llong, native_uint, H5T__conv_llong_uint, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_int", native_ullong, native_int, H5T__conv_ullong_int, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_uint", native_ullong, native_uint, H5T__conv_ullong_uint, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_schar", native_llong, native_schar, H5T__conv_llong_schar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_uchar", native_llong, native_uchar, H5T__conv_llong_uchar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_schar", native_ullong, native_schar, H5T__conv_ullong_schar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_uchar", native_ullong, native_uchar, H5T__conv_ullong_uchar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_ullong", native_llong, native_ullong, H5T__conv_llong_ullong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_llong", native_ullong, native_llong, H5T__conv_ullong_llong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_long", native_llong, native_long, H5T__conv_llong_long, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_ulong", native_llong, native_ulong, H5T__conv_llong_ulong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_long", native_ullong, native_long, H5T__conv_ullong_long, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_ulong", native_ullong, native_ulong, H5T__conv_ullong_ulong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_short", native_llong, native_short, H5T__conv_llong_short, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_ushort", native_llong, native_ushort, H5T__conv_llong_ushort, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_short", native_ullong, native_short, H5T__conv_ullong_short, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_ushort", native_ullong, native_ushort, H5T__conv_ullong_ushort, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_int", native_llong, native_int, H5T__conv_llong_int, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_uint", native_llong, native_uint, H5T__conv_llong_uint, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_int", native_ullong, native_int, H5T__conv_ullong_int, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_uint", native_ullong, native_uint, H5T__conv_ullong_uint, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_schar", native_llong, native_schar, H5T__conv_llong_schar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_uchar", native_llong, native_uchar, H5T__conv_llong_uchar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_schar", native_ullong, native_schar, H5T__conv_ullong_schar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_uchar", native_ullong, native_uchar, H5T__conv_ullong_uchar, H5AC_dxpl_id, FALSE); /* From long */ - status |= H5T_register(H5T_PERS_HARD, "long_llong", native_long, native_llong, H5T__conv_long_llong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_ullong", native_long, native_ullong, H5T__conv_long_ullong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_llong", native_ulong, native_llong, H5T__conv_ulong_llong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_ullong", native_ulong, native_ullong, H5T__conv_ulong_ullong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_ulong", native_long, native_ulong, H5T__conv_long_ulong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_long", native_ulong, native_long, H5T__conv_ulong_long, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_short", native_long, native_short, H5T__conv_long_short, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_ushort", native_long, native_ushort, H5T__conv_long_ushort, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_short", native_ulong, native_short, H5T__conv_ulong_short, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_ushort", native_ulong, native_ushort, H5T__conv_ulong_ushort, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_int", native_long, native_int, H5T__conv_long_int, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_uint", native_long, native_uint, H5T__conv_long_uint, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_int", native_ulong, native_int, H5T__conv_ulong_int, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_uint", native_ulong, native_uint, H5T__conv_ulong_uint, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_schar", native_long, native_schar, H5T__conv_long_schar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_uchar", native_long, native_uchar, H5T__conv_long_uchar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_schar", native_ulong, native_schar, H5T__conv_ulong_schar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_uchar", native_ulong, native_uchar, H5T__conv_ulong_uchar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_llong", native_long, native_llong, H5T__conv_long_llong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_ullong", native_long, native_ullong, H5T__conv_long_ullong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_llong", native_ulong, native_llong, H5T__conv_ulong_llong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_ullong", native_ulong, native_ullong, H5T__conv_ulong_ullong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_ulong", native_long, native_ulong, H5T__conv_long_ulong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_long", native_ulong, native_long, H5T__conv_ulong_long, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_short", native_long, native_short, H5T__conv_long_short, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_ushort", native_long, native_ushort, H5T__conv_long_ushort, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_short", native_ulong, native_short, H5T__conv_ulong_short, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_ushort", native_ulong, native_ushort, H5T__conv_ulong_ushort, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_int", native_long, native_int, H5T__conv_long_int, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_uint", native_long, native_uint, H5T__conv_long_uint, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_int", native_ulong, native_int, H5T__conv_ulong_int, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_uint", native_ulong, native_uint, H5T__conv_ulong_uint, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_schar", native_long, native_schar, H5T__conv_long_schar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_uchar", native_long, native_uchar, H5T__conv_long_uchar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_schar", native_ulong, native_schar, H5T__conv_ulong_schar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_uchar", native_ulong, native_uchar, H5T__conv_ulong_uchar, H5AC_dxpl_id, FALSE); /* From short */ - status |= H5T_register(H5T_PERS_HARD, "short_llong", native_short, native_llong, H5T__conv_short_llong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_ullong", native_short, native_ullong, H5T__conv_short_ullong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_llong", native_ushort, native_llong, H5T__conv_ushort_llong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_ullong", native_ushort, native_ullong, H5T__conv_ushort_ullong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_long", native_short, native_long, H5T__conv_short_long, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_ulong", native_short, native_ulong, H5T__conv_short_ulong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_long", native_ushort, native_long, H5T__conv_ushort_long, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_ulong", native_ushort, native_ulong, H5T__conv_ushort_ulong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_ushort", native_short, native_ushort, H5T__conv_short_ushort, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_short", native_ushort, native_short, H5T__conv_ushort_short, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_int", native_short, native_int, H5T__conv_short_int, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_uint", native_short, native_uint, H5T__conv_short_uint, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_int", native_ushort, native_int, H5T__conv_ushort_int, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_uint", native_ushort, native_uint, H5T__conv_ushort_uint, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_schar", native_short, native_schar, H5T__conv_short_schar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_uchar", native_short, native_uchar, H5T__conv_short_uchar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_schar", native_ushort, native_schar, H5T__conv_ushort_schar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_uchar", native_ushort, native_uchar, H5T__conv_ushort_uchar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_llong", native_short, native_llong, H5T__conv_short_llong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_ullong", native_short, native_ullong, H5T__conv_short_ullong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_llong", native_ushort, native_llong, H5T__conv_ushort_llong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_ullong", native_ushort, native_ullong, H5T__conv_ushort_ullong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_long", native_short, native_long, H5T__conv_short_long, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_ulong", native_short, native_ulong, H5T__conv_short_ulong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_long", native_ushort, native_long, H5T__conv_ushort_long, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_ulong", native_ushort, native_ulong, H5T__conv_ushort_ulong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_ushort", native_short, native_ushort, H5T__conv_short_ushort, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_short", native_ushort, native_short, H5T__conv_ushort_short, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_int", native_short, native_int, H5T__conv_short_int, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_uint", native_short, native_uint, H5T__conv_short_uint, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_int", native_ushort, native_int, H5T__conv_ushort_int, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_uint", native_ushort, native_uint, H5T__conv_ushort_uint, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_schar", native_short, native_schar, H5T__conv_short_schar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_uchar", native_short, native_uchar, H5T__conv_short_uchar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_schar", native_ushort, native_schar, H5T__conv_ushort_schar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_uchar", native_ushort, native_uchar, H5T__conv_ushort_uchar, H5AC_dxpl_id, FALSE); /* From int */ - status |= H5T_register(H5T_PERS_HARD, "int_llong", native_int, native_llong, H5T__conv_int_llong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_ullong", native_int, native_ullong, H5T__conv_int_ullong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_llong", native_uint, native_llong, H5T__conv_uint_llong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_ullong", native_uint, native_ullong, H5T__conv_uint_ullong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_long", native_int, native_long, H5T__conv_int_long, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_ulong", native_int, native_ulong, H5T__conv_int_ulong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_long", native_uint, native_long, H5T__conv_uint_long, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_ulong", native_uint, native_ulong, H5T__conv_uint_ulong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_short", native_int, native_short, H5T__conv_int_short, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_ushort", native_int, native_ushort, H5T__conv_int_ushort, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_short", native_uint, native_short, H5T__conv_uint_short, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_ushort", native_uint, native_ushort, H5T__conv_uint_ushort, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_uint", native_int, native_uint, H5T__conv_int_uint, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_int", native_uint, native_int, H5T__conv_uint_int, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_schar", native_int, native_schar, H5T__conv_int_schar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_uchar", native_int, native_uchar, H5T__conv_int_uchar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_schar", native_uint, native_schar, H5T__conv_uint_schar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_uchar", native_uint, native_uchar, H5T__conv_uint_uchar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_llong", native_int, native_llong, H5T__conv_int_llong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_ullong", native_int, native_ullong, H5T__conv_int_ullong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_llong", native_uint, native_llong, H5T__conv_uint_llong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_ullong", native_uint, native_ullong, H5T__conv_uint_ullong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_long", native_int, native_long, H5T__conv_int_long, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_ulong", native_int, native_ulong, H5T__conv_int_ulong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_long", native_uint, native_long, H5T__conv_uint_long, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_ulong", native_uint, native_ulong, H5T__conv_uint_ulong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_short", native_int, native_short, H5T__conv_int_short, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_ushort", native_int, native_ushort, H5T__conv_int_ushort, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_short", native_uint, native_short, H5T__conv_uint_short, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_ushort", native_uint, native_ushort, H5T__conv_uint_ushort, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_uint", native_int, native_uint, H5T__conv_int_uint, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_int", native_uint, native_int, H5T__conv_uint_int, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_schar", native_int, native_schar, H5T__conv_int_schar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_uchar", native_int, native_uchar, H5T__conv_int_uchar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_schar", native_uint, native_schar, H5T__conv_uint_schar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_uchar", native_uint, native_uchar, H5T__conv_uint_uchar, H5AC_dxpl_id, FALSE); /* From char */ - status |= H5T_register(H5T_PERS_HARD, "schar_llong", native_schar, native_llong, H5T__conv_schar_llong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_ullong", native_schar, native_ullong, H5T__conv_schar_ullong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_llong", native_uchar, native_llong, H5T__conv_uchar_llong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_ullong", native_uchar, native_ullong, H5T__conv_uchar_ullong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_long", native_schar, native_long, H5T__conv_schar_long, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_ulong", native_schar, native_ulong, H5T__conv_schar_ulong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_long", native_uchar, native_long, H5T__conv_uchar_long, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_ulong", native_uchar, native_ulong, H5T__conv_uchar_ulong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_short", native_schar, native_short, H5T__conv_schar_short, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_ushort", native_schar, native_ushort, H5T__conv_schar_ushort, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_short", native_uchar, native_short, H5T__conv_uchar_short, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_ushort", native_uchar, native_ushort, H5T__conv_uchar_ushort, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_int", native_schar, native_int, H5T__conv_schar_int, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_uint", native_schar, native_uint, H5T__conv_schar_uint, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_int", native_uchar, native_int, H5T__conv_uchar_int, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_uint", native_uchar, native_uint, H5T__conv_uchar_uint, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_uchar", native_schar, native_uchar, H5T__conv_schar_uchar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_schar", native_uchar, native_schar, H5T__conv_uchar_schar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_llong", native_schar, native_llong, H5T__conv_schar_llong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_ullong", native_schar, native_ullong, H5T__conv_schar_ullong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_llong", native_uchar, native_llong, H5T__conv_uchar_llong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_ullong", native_uchar, native_ullong, H5T__conv_uchar_ullong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_long", native_schar, native_long, H5T__conv_schar_long, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_ulong", native_schar, native_ulong, H5T__conv_schar_ulong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_long", native_uchar, native_long, H5T__conv_uchar_long, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_ulong", native_uchar, native_ulong, H5T__conv_uchar_ulong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_short", native_schar, native_short, H5T__conv_schar_short, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_ushort", native_schar, native_ushort, H5T__conv_schar_ushort, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_short", native_uchar, native_short, H5T__conv_uchar_short, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_ushort", native_uchar, native_ushort, H5T__conv_uchar_ushort, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_int", native_schar, native_int, H5T__conv_schar_int, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_uint", native_schar, native_uint, H5T__conv_schar_uint, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_int", native_uchar, native_int, H5T__conv_uchar_int, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_uint", native_uchar, native_uint, H5T__conv_uchar_uint, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_uchar", native_schar, native_uchar, H5T__conv_schar_uchar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_schar", native_uchar, native_schar, H5T__conv_uchar_schar, H5AC_dxpl_id, FALSE); /* From char to floats */ - status |= H5T_register(H5T_PERS_HARD, "schar_flt", native_schar, native_float, H5T__conv_schar_float, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_dbl", native_schar, native_double, H5T__conv_schar_double, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_ldbl", native_schar, native_ldouble, H5T__conv_schar_ldouble, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_flt", native_schar, native_float, H5T__conv_schar_float, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_dbl", native_schar, native_double, H5T__conv_schar_double, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_ldbl", native_schar, native_ldouble, H5T__conv_schar_ldouble, H5AC_dxpl_id, FALSE); /* From unsigned char to floats */ - status |= H5T_register(H5T_PERS_HARD, "uchar_flt", native_uchar, native_float, H5T__conv_uchar_float, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_dbl", native_uchar, native_double, H5T__conv_uchar_double, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_ldbl", native_uchar, native_ldouble, H5T__conv_uchar_ldouble, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_flt", native_uchar, native_float, H5T__conv_uchar_float, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_dbl", native_uchar, native_double, H5T__conv_uchar_double, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_ldbl", native_uchar, native_ldouble, H5T__conv_uchar_ldouble, H5AC_dxpl_id, FALSE); /* From short to floats */ - status |= H5T_register(H5T_PERS_HARD, "short_flt", native_short, native_float, H5T__conv_short_float, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_dbl", native_short, native_double, H5T__conv_short_double, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_ldbl", native_short, native_ldouble, H5T__conv_short_ldouble, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_flt", native_short, native_float, H5T__conv_short_float, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_dbl", native_short, native_double, H5T__conv_short_double, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_ldbl", native_short, native_ldouble, H5T__conv_short_ldouble, H5AC_dxpl_id, FALSE); /* From unsigned short to floats */ - status |= H5T_register(H5T_PERS_HARD, "ushort_flt", native_ushort, native_float, H5T__conv_ushort_float, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_dbl", native_ushort, native_double, H5T__conv_ushort_double, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_ldbl", native_ushort, native_ldouble, H5T__conv_ushort_ldouble, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_flt", native_ushort, native_float, H5T__conv_ushort_float, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_dbl", native_ushort, native_double, H5T__conv_ushort_double, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_ldbl", native_ushort, native_ldouble, H5T__conv_ushort_ldouble, H5AC_dxpl_id, FALSE); /* From int to floats */ - status |= H5T_register(H5T_PERS_HARD, "int_flt", native_int, native_float, H5T__conv_int_float, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_dbl", native_int, native_double, H5T__conv_int_double, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_ldbl", native_int, native_ldouble, H5T__conv_int_ldouble, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_flt", native_int, native_float, H5T__conv_int_float, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_dbl", native_int, native_double, H5T__conv_int_double, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_ldbl", native_int, native_ldouble, H5T__conv_int_ldouble, H5AC_dxpl_id, FALSE); /* From unsigned int to floats */ - status |= H5T_register(H5T_PERS_HARD, "uint_flt", native_uint, native_float, H5T__conv_uint_float, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_dbl", native_uint, native_double, H5T__conv_uint_double, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_ldbl", native_uint, native_ldouble, H5T__conv_uint_ldouble, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_flt", native_uint, native_float, H5T__conv_uint_float, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_dbl", native_uint, native_double, H5T__conv_uint_double, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_ldbl", native_uint, native_ldouble, H5T__conv_uint_ldouble, H5AC_dxpl_id, FALSE); /* From long to floats */ - status |= H5T_register(H5T_PERS_HARD, "long_flt", native_long, native_float, H5T__conv_long_float, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_dbl", native_long, native_double, H5T__conv_long_double, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_ldbl", native_long, native_ldouble, H5T__conv_long_ldouble, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_flt", native_long, native_float, H5T__conv_long_float, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_dbl", native_long, native_double, H5T__conv_long_double, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_ldbl", native_long, native_ldouble, H5T__conv_long_ldouble, H5AC_dxpl_id, FALSE); /* From unsigned long to floats */ - status |= H5T_register(H5T_PERS_HARD, "ulong_flt", native_ulong, native_float, H5T__conv_ulong_float, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_dbl", native_ulong, native_double, H5T__conv_ulong_double, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_ldbl", native_ulong, native_ldouble, H5T__conv_ulong_ldouble, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_flt", native_ulong, native_float, H5T__conv_ulong_float, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_dbl", native_ulong, native_double, H5T__conv_ulong_double, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_ldbl", native_ulong, native_ldouble, H5T__conv_ulong_ldouble, H5AC_dxpl_id, FALSE); /* From long long to floats */ - status |= H5T_register(H5T_PERS_HARD, "llong_flt", native_llong, native_float, H5T__conv_llong_float, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_dbl", native_llong, native_double, H5T__conv_llong_double, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_flt", native_llong, native_float, H5T__conv_llong_float, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_dbl", native_llong, native_double, H5T__conv_llong_double, H5AC_dxpl_id, FALSE); #ifdef H5T_CONV_INTERNAL_LLONG_LDOUBLE - status |= H5T_register(H5T_PERS_HARD, "llong_ldbl", native_llong, native_ldouble, H5T__conv_llong_ldouble, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_ldbl", native_llong, native_ldouble, H5T__conv_llong_ldouble, H5AC_dxpl_id, FALSE); #endif /* H5T_CONV_INTERNAL_LLONG_LDOUBLE */ /* From unsigned long long to floats */ - status |= H5T_register(H5T_PERS_HARD, "ullong_flt", native_ullong, native_float, H5T__conv_ullong_float, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_dbl", native_ullong, native_double, H5T__conv_ullong_double, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_flt", native_ullong, native_float, H5T__conv_ullong_float, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_dbl", native_ullong, native_double, H5T__conv_ullong_double, H5AC_dxpl_id, FALSE); #ifdef H5T_CONV_INTERNAL_ULLONG_LDOUBLE - status |= H5T_register(H5T_PERS_HARD, "ullong_ldbl", native_ullong, native_ldouble, H5T__conv_ullong_ldouble, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_ldbl", native_ullong, native_ldouble, H5T__conv_ullong_ldouble, H5AC_dxpl_id, FALSE); #endif /* H5T_CONV_INTERNAL_ULLONG_LDOUBLE */ /* From floats to char */ - status |= H5T_register(H5T_PERS_HARD, "flt_schar", native_float, native_schar, H5T__conv_float_schar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_schar", native_double, native_schar, H5T__conv_double_schar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_schar", native_ldouble, native_schar, H5T__conv_ldouble_schar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_schar", native_float, native_schar, H5T__conv_float_schar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_schar", native_double, native_schar, H5T__conv_double_schar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_schar", native_ldouble, native_schar, H5T__conv_ldouble_schar, H5AC_dxpl_id, FALSE); /* From floats to unsigned char */ - status |= H5T_register(H5T_PERS_HARD, "flt_uchar", native_float, native_uchar, H5T__conv_float_uchar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_uchar", native_double, native_uchar, H5T__conv_double_uchar, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_uchar", native_ldouble, native_uchar, H5T__conv_ldouble_uchar, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_uchar", native_float, native_uchar, H5T__conv_float_uchar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_uchar", native_double, native_uchar, H5T__conv_double_uchar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_uchar", native_ldouble, native_uchar, H5T__conv_ldouble_uchar, H5AC_dxpl_id, FALSE); /* From floats to short */ - status |= H5T_register(H5T_PERS_HARD, "flt_short", native_float, native_short, H5T__conv_float_short, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_short", native_double, native_short, H5T__conv_double_short, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_short", native_ldouble, native_short, H5T__conv_ldouble_short, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_short", native_float, native_short, H5T__conv_float_short, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_short", native_double, native_short, H5T__conv_double_short, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_short", native_ldouble, native_short, H5T__conv_ldouble_short, H5AC_dxpl_id, FALSE); /* From floats to unsigned short */ - status |= H5T_register(H5T_PERS_HARD, "flt_ushort", native_float, native_ushort, H5T__conv_float_ushort, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_ushort", native_double, native_ushort, H5T__conv_double_ushort, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_ushort", native_ldouble, native_ushort, H5T__conv_ldouble_ushort, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_ushort", native_float, native_ushort, H5T__conv_float_ushort, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_ushort", native_double, native_ushort, H5T__conv_double_ushort, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_ushort", native_ldouble, native_ushort, H5T__conv_ldouble_ushort, H5AC_dxpl_id, FALSE); /* From floats to int */ - status |= H5T_register(H5T_PERS_HARD, "flt_int", native_float, native_int, H5T__conv_float_int, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_int", native_double, native_int, H5T__conv_double_int, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_int", native_ldouble, native_int, H5T__conv_ldouble_int, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_int", native_float, native_int, H5T__conv_float_int, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_int", native_double, native_int, H5T__conv_double_int, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_int", native_ldouble, native_int, H5T__conv_ldouble_int, H5AC_dxpl_id, FALSE); /* From floats to unsigned int */ - status |= H5T_register(H5T_PERS_HARD, "flt_uint", native_float, native_uint, H5T__conv_float_uint, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_uint", native_double, native_uint, H5T__conv_double_uint, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_uint", native_ldouble, native_uint, H5T__conv_ldouble_uint, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_uint", native_float, native_uint, H5T__conv_float_uint, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_uint", native_double, native_uint, H5T__conv_double_uint, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_uint", native_ldouble, native_uint, H5T__conv_ldouble_uint, H5AC_dxpl_id, FALSE); /* From floats to long */ - status |= H5T_register(H5T_PERS_HARD, "flt_long", native_float, native_long, H5T__conv_float_long, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_long", native_double, native_long, H5T__conv_double_long, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_long", native_ldouble, native_long, H5T__conv_ldouble_long, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_long", native_float, native_long, H5T__conv_float_long, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_long", native_double, native_long, H5T__conv_double_long, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_long", native_ldouble, native_long, H5T__conv_ldouble_long, H5AC_dxpl_id, FALSE); /* From floats to unsigned long */ - status |= H5T_register(H5T_PERS_HARD, "flt_ulong", native_float, native_ulong, H5T__conv_float_ulong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_ulong", native_double, native_ulong, H5T__conv_double_ulong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_ulong", native_ldouble, native_ulong, H5T__conv_ldouble_ulong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_ulong", native_float, native_ulong, H5T__conv_float_ulong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_ulong", native_double, native_ulong, H5T__conv_double_ulong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_ulong", native_ldouble, native_ulong, H5T__conv_ldouble_ulong, H5AC_dxpl_id, FALSE); /* From floats to long long */ - status |= H5T_register(H5T_PERS_HARD, "flt_llong", native_float, native_llong, H5T__conv_float_llong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_llong", native_double, native_llong, H5T__conv_double_llong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_llong", native_float, native_llong, H5T__conv_float_llong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_llong", native_double, native_llong, H5T__conv_double_llong, H5AC_dxpl_id, FALSE); #ifdef H5T_CONV_INTERNAL_LDOUBLE_LLONG - status |= H5T_register(H5T_PERS_HARD, "ldbl_llong", native_ldouble, native_llong, H5T__conv_ldouble_llong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_llong", native_ldouble, native_llong, H5T__conv_ldouble_llong, H5AC_dxpl_id, FALSE); #endif /* H5T_CONV_INTERNAL_LDOUBLE_LLONG */ /* From floats to unsigned long long */ - status |= H5T_register(H5T_PERS_HARD, "flt_ullong", native_float, native_ullong, H5T__conv_float_ullong, H5AC_ind_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_ullong", native_double, native_ullong, H5T__conv_double_ullong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_ullong", native_float, native_ullong, H5T__conv_float_ullong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_ullong", native_double, native_ullong, H5T__conv_double_ullong, H5AC_dxpl_id, FALSE); #if H5T_CONV_INTERNAL_LDOUBLE_ULLONG - status |= H5T_register(H5T_PERS_HARD, "ldbl_ullong", native_ldouble, native_ullong, H5T__conv_ldouble_ullong, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_ullong", native_ldouble, native_ullong, H5T__conv_ldouble_ullong, H5AC_dxpl_id, FALSE); #endif /* H5T_CONV_INTERNAL_LDOUBLE_ULLONG */ /* @@ -1243,7 +1243,7 @@ H5T__init_package(void) * data types we use are not important as long as the source and * destination are equal. */ - status |= H5T_register(H5T_PERS_HARD, "no-op", native_int, native_int, H5T__conv_noop, H5AC_ind_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "no-op", native_int, native_int, H5T__conv_noop, H5AC_dxpl_id, FALSE); /* Initialize the +/- Infinity values for floating-point types */ status |= H5T__init_inf(); @@ -1365,7 +1365,7 @@ H5T_top_term_package(void) H5T__print_stats(path, &nprint/*in,out*/); path->cdata.command = H5T_CONV_FREE; if((path->func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, - (size_t)0, (size_t)0, NULL, NULL,H5AC_ind_dxpl_id) < 0) { + (size_t)0, (size_t)0, NULL, NULL,H5AC_dxpl_id) < 0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { fprintf(H5DEBUG(T), "H5T: conversion function " @@ -2460,7 +2460,7 @@ H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no conversion function specified") /* Go register the function */ - if(H5T_register(pers, name, src, dst, func, H5AC_ind_dxpl_id, TRUE) < 0) + if(H5T_register(pers, name, src, dst, func, H5AC_dxpl_id, TRUE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register conversion function") done: @@ -2599,7 +2599,7 @@ H5Tunregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, if(dst_id > 0 && (NULL == (dst = (H5T_t *)H5I_object_verify(dst_id, H5I_DATATYPE)))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dst is not a data type") - if(H5T_unregister(pers, name, src, dst, func, H5AC_ind_dxpl_id) < 0) + if(H5T_unregister(pers, name, src, dst, func, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "internal unregister function failed") done: @@ -2643,7 +2643,7 @@ H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "no address to receive cdata pointer") /* Find it */ - if(NULL == (path = H5T_path_find(src, dst, NULL, NULL, H5AC_ind_dxpl_id, FALSE))) + if(NULL == (path = H5T_path_find(src, dst, NULL, NULL, H5AC_dxpl_id, FALSE))) HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL, "conversion function not found") if(pcdata) @@ -2939,7 +2939,7 @@ H5T_decode(const unsigned char *buf) HGOTO_ERROR(H5E_DATATYPE, H5E_VERSION, NULL, "unknown version of encoded datatype") /* Decode the serialized datatype message */ - if(NULL == (ret_value = (H5T_t *)H5O_msg_decode(f, H5AC_ind_dxpl_id, NULL, H5O_DTYPE_ID, buf))) + if(NULL == (ret_value = (H5T_t *)H5O_msg_decode(f, H5AC_dxpl_id, NULL, H5O_DTYPE_ID, buf))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode object") /* Mark datatype as being in memory now */ @@ -4761,7 +4761,7 @@ H5T_compiler_conv(H5T_t *src, H5T_t *dst) FUNC_ENTER_NOAPI_NOINIT /* Find it */ - if (NULL==(path=H5T_path_find(src, dst, NULL, NULL, H5AC_ind_dxpl_id, FALSE))) + if (NULL==(path=H5T_path_find(src, dst, NULL, NULL, H5AC_dxpl_id, FALSE))) HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "conversion function not found") ret_value = (htri_t)path->is_hard; diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 51fb9d2..b715593 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -128,7 +128,7 @@ H5Tcommit2(hid_t loc_id, const char *name, hid_t type_id, hid_t lcpl_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Commit the type */ @@ -266,7 +266,7 @@ H5Tcommit_anon(hid_t loc_id, hid_t type_id, hid_t tcpl_id, hid_t tapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not datatype creation property list") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Commit the type */ @@ -529,7 +529,7 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) H5O_type_t obj_type; /* Type of object at location */ H5G_loc_t type_loc; /* Group object for datatype */ hbool_t obj_found = FALSE; /* Object at 'name' found */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl to use to open datatype */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl to use to open datatype */ hid_t ret_value = FAIL; /* Return value */ FUNC_ENTER_API(FAIL) @@ -542,7 +542,7 @@ H5Topen2(hid_t loc_id, const char *name, hid_t tapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id) < 0) + if(H5P_verify_apl_and_dxpl(&tapl_id, H5P_CLS_TACC, &dxpl_id, loc_id, FALSE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Set up datatype location to fill in */ @@ -637,7 +637,7 @@ H5Tget_create_plist(hid_t dtype_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") /* Retrieve any object creation properties */ - if(H5O_get_create_plist(&type->oloc, H5AC_ind_dxpl_id, new_plist) < 0) + if(H5O_get_create_plist(&type->oloc, H5AC_dxpl_id, new_plist) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get object creation info") } /* end if */ diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index cd4de1d..89746bf 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -152,7 +152,7 @@ H5Topen1(hid_t loc_id, const char *name) H5O_type_t obj_type; /* Type of object at location */ H5G_loc_t type_loc; /* Group object for datatype */ hbool_t obj_found = FALSE; /* Object at 'name' found */ - hid_t dxpl_id = H5AC_ind_dxpl_id; /* dxpl to use to open datatype */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl to use to open datatype */ hid_t ret_value = FAIL; FUNC_ENTER_API(FAIL) diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 0dc12a3..89aea81 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -1005,7 +1005,7 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot use C integer datatype for cast") /* Get dataset fill value and store in cd_values[] */ - if(H5Z_scaleoffset_set_parms_fillval(dcpl_plist, type, scale_type, cd_values, need_convert, H5AC_ind_dxpl_id) < 0) + if(H5Z_scaleoffset_set_parms_fillval(dcpl_plist, type, scale_type, cd_values, need_convert, H5AC_dxpl_id) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "unable to set fill value") } /* end else */ diff --git a/src/H5private.h b/src/H5private.h index c536566..6a71dc4 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1699,6 +1699,7 @@ typedef struct H5_debug_t { H5_debug_open_stream_t *open_stream; /* Stack of open output streams */ } H5_debug_t; +extern hbool_t H5_coll_api_sanity_check_g; extern H5_debug_t H5_debug_g; #define H5DEBUG(X) (H5_debug_g.pkg[H5_PKG_##X].stream) /* Do not use const else AIX strings does not show it. */ diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 470f7a1..4a1e7ae 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -3866,26 +3866,26 @@ check_invalid_tag_application(void) /* Call H5HL_create, an internal function that calls H5AC_insert_entry without setting up a tag */ /* Ensure this returns FAILURE, as a tag has not been set up. */ - if ( H5HL_create(f, H5AC_ind_dxpl_id, (size_t)1024, &addr) >= 0) TEST_ERROR; + if ( H5HL_create(f, H5AC_dxpl_id, (size_t)1024, &addr) >= 0) TEST_ERROR; /* Now set up a tag in the dxpl */ - if ( H5AC_tag(H5AC_ind_dxpl_id, (haddr_t)25, NULL) < 0) TEST_ERROR; + if ( H5AC_tag(H5AC_dxpl_id, (haddr_t)25, NULL) < 0) TEST_ERROR; /* Verify the same call to H5HL_create now works as intended, with a tag set up. */ - if ( H5HL_create(f, H5AC_ind_dxpl_id, (size_t)1024, &addr) < 0) TEST_ERROR; + if ( H5HL_create(f, H5AC_dxpl_id, (size_t)1024, &addr) < 0) TEST_ERROR; /* Reset dxpl to use invalid tag. */ - if ( H5AC_tag(H5AC_ind_dxpl_id, H5AC__INVALID_TAG, NULL) < 0) TEST_ERROR; + if ( H5AC_tag(H5AC_dxpl_id, H5AC__INVALID_TAG, NULL) < 0) TEST_ERROR; /* Call H5HL_protect to protect the local heap created above. */ /* This should fail as no tag is set up during the protect call */ - if (( lheap = H5HL_protect(f, H5AC_ind_dxpl_id, addr, H5AC__NO_FLAGS_SET)) != NULL ) TEST_ERROR; + if (( lheap = H5HL_protect(f, H5AC_dxpl_id, addr, H5AC__NO_FLAGS_SET)) != NULL ) TEST_ERROR; /* Again, set up a valid tag in the DXPL */ - if ( H5AC_tag(H5AC_ind_dxpl_id, (haddr_t)25, NULL) < 0) TEST_ERROR; + if ( H5AC_tag(H5AC_dxpl_id, (haddr_t)25, NULL) < 0) TEST_ERROR; /* Call H5HL_protect again to protect the local heap. This should succeed. */ - if (( lheap = H5HL_protect(f, H5AC_ind_dxpl_id, addr, H5AC__NO_FLAGS_SET)) == NULL ) TEST_ERROR; + if (( lheap = H5HL_protect(f, H5AC_dxpl_id, addr, H5AC__NO_FLAGS_SET)) == NULL ) TEST_ERROR; /* Now unprotect the heap, as we're done with the test. */ if ( H5HL_unprotect(lheap) < 0 ) TEST_ERROR; -- cgit v0.12 From 43b96df2a4c229b1eeb72084fb78584a9fbf3e2f Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Fri, 22 Jan 2016 10:55:41 -0500 Subject: [svn-r28957] fix non-parallel bug. --- src/H5Pint.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/H5Pint.c b/src/H5Pint.c index e16379a..b3d1976 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -5453,7 +5453,6 @@ herr_t H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t *dxpl_id, hid_t loc_id, hbool_t is_collective) { - MPI_Comm mpi_comm; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -5479,6 +5478,8 @@ H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, happens only when the environment variable H5_COLL_BARRIER is set to non 0. */ if(is_collective && H5_coll_api_sanity_check_g) { + MPI_Comm mpi_comm; /* file communicator */ + /* retrieve the MPI communicator from the loc_id or the fapl_id */ if(H5F_mpi_retrieve_comm(loc_id, *acspl_id, &mpi_comm) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator") -- cgit v0.12 From 0d714830a8d0353e82f88cca214d26e4ba12044f Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Fri, 22 Jan 2016 13:18:04 -0500 Subject: [svn-r28960] Fix for HDFFV-9439 Escape quotes in fortran version output to find fortran version for libhdf5.settings Tested with buildhdf5 on platypus, ostrich, moohan and mayll. --- config/linux-gnulibc1 | 1 + 1 file changed, 1 insertion(+) diff --git a/config/linux-gnulibc1 b/config/linux-gnulibc1 index 465bfed..fb8929c 100644 --- a/config/linux-gnulibc1 +++ b/config/linux-gnulibc1 @@ -177,6 +177,7 @@ case $FC in *mpif90*) fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS -v 2>&1 | grep 'version' |\ sed 's/^[a-z0-9]* for //' |\ + sed ’s/\”/\\\”/g’ |\ sed 's/^\([a-z]* \)/ built with \1/1'` fc_version_info=`echo $fc_version_info` ;; -- cgit v0.12 From 8aa7c27fb717f481d924ea5f7793b10f35c29947 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sat, 23 Jan 2016 19:34:29 -0500 Subject: [svn-r28963] Updated the gnu Fortran configure files to set flags when the gnu compiler is used. The gnu-fflags file was never included. Tested on ostrich --- config/linux-gnulibc1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/linux-gnulibc1 b/config/linux-gnulibc1 index fb8929c..8abbe4a 100644 --- a/config/linux-gnulibc1 +++ b/config/linux-gnulibc1 @@ -92,6 +92,9 @@ else esac fi +# Figure out GNU FC compiler flags +. $srcdir/config/gnu-fflags + # Figure out PGI FC compiler flags . $srcdir/config/pgi-fflags -- cgit v0.12 From 8bbdc947c4f92fc9b1711adc0b00337dae2ed666 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 26 Jan 2016 16:26:12 -0500 Subject: [svn-r28972] Removed option to clear file buffers from autotools, CMake, and library. Buffers that will be written to disk will now always be cleared since not doing this has huge security implications. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0, x86_64) gcc 5.2.1 serial autotools parallel autotools (MPICH 3.1.4) serial CMake --- config/cmake/ConfigureChecks.cmake | 9 --------- config/cmake/H5pubconf.h.in | 4 ---- configure.ac | 26 -------------------------- src/H5B.c | 11 +++++------ src/H5B2cache.c | 4 ---- src/H5B2hdr.c | 4 +--- src/H5B2int.c | 22 ++++++++-------------- src/H5Bcache.c | 2 -- src/H5Dcontig.c | 7 +++---- src/H5FDcore.c | 4 ---- src/H5Faccum.c | 35 +++++++++++++++++------------------ src/H5Gcache.c | 2 -- src/H5HFdblock.c | 4 +--- src/H5HFtiny.c | 5 ++--- src/H5HG.c | 16 ++++++---------- src/H5HLcache.c | 2 -- src/H5SMcache.c | 3 +-- src/H5Zscaleoffset.c | 4 ---- src/libhdf5.settings.in | 1 - test/objcopy.c | 2 -- 20 files changed, 44 insertions(+), 123 deletions(-) diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 8bd6f45..49e9a05 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -6,15 +6,6 @@ include (${HDF_RESOURCES_EXT_DIR}/ConfigureChecks.cmake) include (${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake) #----------------------------------------------------------------------------- -# Option to Clear File Buffers before write --enable-clear-file-buffers -#----------------------------------------------------------------------------- -option (HDF5_Enable_Clear_File_Buffers "Securely clear file buffers before writing to file" ON) -if (HDF5_Enable_Clear_File_Buffers) - set (H5_CLEAR_MEMORY 1) -endif (HDF5_Enable_Clear_File_Buffers) -MARK_AS_ADVANCED (HDF5_Enable_Clear_File_Buffers) - -#----------------------------------------------------------------------------- # Option for --enable-strict-format-checks #----------------------------------------------------------------------------- option (HDF5_STRICT_FORMAT_CHECKS "Whether to perform strict file format checks" OFF) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index ce8219f..31c5afb 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -18,10 +18,6 @@ /* Define if building universal (internal helper macro) */ #cmakedefine H5_AC_APPLE_UNIVERSAL_BUILD @H5_AC_APPLE_UNIVERSAL_BUILD@ -/* Define if the memory buffers being written to disk should be cleared before - writing. */ -#cmakedefine H5_CLEAR_MEMORY @H5_CLEAR_MEMORY@ - /* Define if C++ compiler recognizes offsetof */ #cmakedefine H5_CXX_HAVE_OFFSETOF @H5_CXX_HAVE_OFFSETOF@ diff --git a/configure.ac b/configure.ac index b1c26a2..aeb4cf7 100644 --- a/configure.ac +++ b/configure.ac @@ -2004,32 +2004,6 @@ case "X-$INSTRUMENT" in esac ## ---------------------------------------------------------------------- -## Check if they would like to securely clear file buffers before they are -## written. -## -AC_SUBST([CLEARFILEBUF]) -AC_MSG_CHECKING([whether to clear file buffers]) -AC_ARG_ENABLE([clear-file-buffers], - [AS_HELP_STRING([--enable-clear-file-buffers], - [Securely clear file buffers before writing - to file. Default=yes.])], - [CLEARFILEBUF=$enableval]) - -case "X-$CLEARFILEBUF" in - *) - CLEARFILEBUF=yes - AC_MSG_RESULT([yes]) - AC_DEFINE([CLEAR_MEMORY], [1], - [Define if the memory buffers being written to disk should be - cleared before writing.]) - ;; - X-no) - CLEARFILEBUF=no - AC_MSG_RESULT([no]) - ;; -esac - -## ---------------------------------------------------------------------- ## Check if they would like to use a memory checking tool (like valgrind's ## 'memcheck' tool, or Rational Purify, etc) and the library should be ## more scrupulous with it's memory operations. Enabling this also diff --git a/src/H5B.c b/src/H5B.c index b26c38b..c87e332 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -1731,14 +1731,13 @@ H5B_shared_new(const H5F_t *f, const H5B_class_t *type, size_t sizeof_rkey) (shared->two_k + 1) * shared->sizeof_rkey); /*keys */ HDassert(shared->sizeof_rnode); - /* Allocate shared buffers */ + /* Allocate and clear shared buffers */ if(NULL == (shared->page = H5FL_BLK_MALLOC(page, shared->sizeof_rnode))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree page") -#ifdef H5_CLEAR_MEMORY -HDmemset(shared->page, 0, shared->sizeof_rnode); -#endif /* H5_CLEAR_MEMORY */ + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree page") + HDmemset(shared->page, 0, shared->sizeof_rnode); + if(NULL == (shared->nkey = H5FL_SEQ_MALLOC(size_t, (size_t)(shared->two_k + 1)))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree native keys") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree native keys") /* Initialize the offsets into the native key buffer */ for(u = 0; u < (shared->two_k + 1); u++) diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 57f794b..b899f6a 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -698,10 +698,8 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) <= len); -#ifdef H5_CLEAR_MEMORY /* Clear rest of internal node */ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); -#endif /* H5_CLEAR_MEMORY */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -975,10 +973,8 @@ H5B2__cache_leaf_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED l /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) <= len); -#ifdef H5_CLEAR_MEMORY /* Clear rest of leaf node */ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); -#endif /* H5_CLEAR_MEMORY */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c index ab424b7..49ffb5b 100644 --- a/src/H5B2hdr.c +++ b/src/H5B2hdr.c @@ -152,9 +152,7 @@ H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata, /* Allocate "page" for node I/O */ if(NULL == (hdr->page = H5FL_BLK_MALLOC(node_page, hdr->node_size))) HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "memory allocation failed") -#ifdef H5_CLEAR_MEMORY -HDmemset(hdr->page, 0, hdr->node_size); -#endif /* H5_CLEAR_MEMORY */ + HDmemset(hdr->page, 0, hdr->node_size); /* Allocate array of node info structs */ if(NULL == (hdr->node_info = H5FL_SEQ_MALLOC(H5B2_node_info_t, (size_t)(hdr->depth + 1)))) diff --git a/src/H5B2int.c b/src/H5B2int.c index a69774a..09addce 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -2191,32 +2191,30 @@ H5B2__create_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *node_ptr) /* Increment ref. count on B-tree header */ if(H5B2__hdr_incr(hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, FAIL, "can't increment ref. count on B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, FAIL, "can't increment ref. count on B-tree header") /* Share B-tree header information */ leaf->hdr = hdr; /* Allocate space for the native keys in memory */ if(NULL == (leaf->leaf_native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[0].nat_rec_fac))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree leaf native keys") -#ifdef H5_CLEAR_MEMORY -HDmemset(leaf->leaf_native, 0, hdr->cls->nrec_size * hdr->node_info[0].max_nrec); -#endif /* H5_CLEAR_MEMORY */ + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree leaf native keys") + HDmemset(leaf->leaf_native, 0, hdr->cls->nrec_size * hdr->node_info[0].max_nrec); /* Set number of records */ leaf->nrec = 0; /* Allocate space on disk for the leaf */ if(HADDR_UNDEF == (node_ptr->addr = H5MF_alloc(hdr->f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)hdr->node_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree leaf node") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree leaf node") /* Cache the new B-tree node */ if(H5AC_insert_entry(hdr->f, dxpl_id, H5AC_BT2_LEAF, node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree leaf to cache") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree leaf to cache") done: if(ret_value < 0) { - if(leaf) + if(leaf) if(H5B2__leaf_free(leaf) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to release v2 B-tree leaf node") } /* end if */ @@ -2313,16 +2311,12 @@ H5B2__create_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *node_ptr, /* Allocate space for the native keys in memory */ if(NULL == (internal->int_native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].nat_rec_fac))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal native keys") -#ifdef H5_CLEAR_MEMORY -HDmemset(internal->int_native, 0, hdr->cls->nrec_size * hdr->node_info[depth].max_nrec); -#endif /* H5_CLEAR_MEMORY */ + HDmemset(internal->int_native, 0, hdr->cls->nrec_size * hdr->node_info[depth].max_nrec); /* Allocate space for the node pointers in memory */ if(NULL == (internal->node_ptrs = (H5B2_node_ptr_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].node_ptr_fac))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal node pointers") -#ifdef H5_CLEAR_MEMORY -HDmemset(internal->node_ptrs, 0, sizeof(H5B2_node_ptr_t) * (hdr->node_info[depth].max_nrec + 1)); -#endif /* H5_CLEAR_MEMORY */ + HDmemset(internal->node_ptrs, 0, sizeof(H5B2_node_ptr_t) * (hdr->node_info[depth].max_nrec + 1)); /* Set number of records & depth of the node */ internal->nrec = 0; diff --git a/src/H5Bcache.c b/src/H5Bcache.c index d08f1bc..747e4c4 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -344,10 +344,8 @@ H5B__serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) <= len); -#ifdef H5_CLEAR_MEMORY /* Clear rest of node */ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); -#endif /* H5_CLEAR_MEMORY */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 3edf8b2..484514f 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -1026,10 +1026,9 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, if(NULL == (dset_contig->sieve_buf = H5FL_BLK_CALLOC(sieve_buf, dset_contig->sieve_buf_size))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed") -#ifdef H5_CLEAR_MEMORY -if(dset_contig->sieve_size > len) - HDmemset(dset_contig->sieve_buf + len, 0, (dset_contig->sieve_size - len)); -#endif /* H5_CLEAR_MEMORY */ + /* Clear memory */ + if(dset_contig->sieve_size > len) + HDmemset(dset_contig->sieve_buf + len, 0, (dset_contig->sieve_size - len)); /* Determine the new sieve buffer size & location */ dset_contig->sieve_loc = addr; diff --git a/src/H5FDcore.c b/src/H5FDcore.c index f4aa240..778baa0 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -1295,9 +1295,7 @@ H5FD__core_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate memory block of %llu bytes", (unsigned long long)new_eof) } /* end else */ -#ifdef H5_CLEAR_MEMORY HDmemset(x + file->eof, 0, (size_t)(new_eof - file->eof)); -#endif /* H5_CLEAR_MEMORY */ file->mem = x; file->eof = new_eof; @@ -1469,10 +1467,8 @@ H5FD__core_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate memory block") } /* end else */ -#ifdef H5_CLEAR_MEMORY if(file->eof < new_eof) HDmemset(x + file->eof, 0, (size_t)(new_eof - file->eof)); -#endif /* H5_CLEAR_MEMORY */ file->mem = x; /* Update backing store, if using it and if closing */ diff --git a/src/H5Faccum.c b/src/H5Faccum.c index 53f51ad..73c0bfd 100644 --- a/src/H5Faccum.c +++ b/src/H5Faccum.c @@ -164,9 +164,9 @@ H5F__accum_read(const H5F_io_info_t *fio_info, H5FD_mem_t type, haddr_t addr, /* Note the new buffer size */ accum->alloc_size = new_alloc_size; -#ifdef H5_CLEAR_MEMORY - HDmemset(accum->buf + accum->size, 0, (accum->alloc_size - accum->size)); -#endif /* H5_CLEAR_MEMORY */ + + /* Clear the memory */ + HDmemset(accum->buf + accum->size, 0, (accum->alloc_size - accum->size)); } /* end if */ /* Read the part before the metadata accumulator */ @@ -395,9 +395,9 @@ H5F__accum_adjust(H5F_meta_accum_t *accum, const H5F_io_info_t *fio_info, /* Update accumulator info */ accum->buf = new_buf; accum->alloc_size = new_size; -#ifdef H5_CLEAR_MEMORY -HDmemset(accum->buf + accum->size, 0, (accum->alloc_size - (accum->size + size))); -#endif /* H5_CLEAR_MEMORY */ + + /* Clear the memory */ + HDmemset(accum->buf + accum->size, 0, (accum->alloc_size - (accum->size + size))); } /* end if */ } /* end if */ @@ -623,9 +623,9 @@ H5F__accum_write(const H5F_io_info_t *fio_info, H5FD_mem_t type, haddr_t addr, /* Note the new buffer size */ accum->alloc_size = new_alloc_size; -#ifdef H5_CLEAR_MEMORY -HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); -#endif /* H5_CLEAR_MEMORY */ + + /* Clear the memory */ + HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); } /* end if */ /* Copy the new metadata to the buffer */ @@ -656,6 +656,7 @@ HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); /* Check if we need to resize the buffer */ if(size > accum->alloc_size) { size_t new_size; /* New size of accumulator */ + size_t clear_size; /* Size of memory that needs clearing */ /* Adjust the buffer size to be a power of 2 that is large enough to hold data */ new_size = (size_t)1 << (1 + H5VM_log2_gen((uint64_t)(size - 1))); @@ -666,12 +667,10 @@ HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); /* Note the new buffer size */ accum->alloc_size = new_size; -#ifdef H5_CLEAR_MEMORY -{ -size_t clear_size = MAX(accum->size, size); -HDmemset(accum->buf + clear_size, 0, (accum->alloc_size - clear_size)); -} -#endif /* H5_CLEAR_MEMORY */ + + /* Clear the memory */ + clear_size = MAX(accum->size, size); + HDmemset(accum->buf + clear_size, 0, (accum->alloc_size - clear_size)); } /* end if */ else { /* Check if we should shrink the accumulator buffer */ @@ -716,9 +715,9 @@ HDmemset(accum->buf + clear_size, 0, (accum->alloc_size - clear_size)); /* Note the new buffer size */ accum->alloc_size = new_size; -#ifdef H5_CLEAR_MEMORY -HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); -#endif /* H5_CLEAR_MEMORY */ + + /* Clear the memory */ + HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); } /* end if */ /* Update the metadata accumulator information */ diff --git a/src/H5Gcache.c b/src/H5Gcache.c index e7d44b5..e3303d1 100644 --- a/src/H5Gcache.c +++ b/src/H5Gcache.c @@ -316,10 +316,8 @@ H5G__cache_node_serialize(const H5F_t *f, void *_image, size_t len, if(H5G__ent_encode_vec(f, &image, sym->entry, sym->nsyms) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't serialize") -#ifdef H5_CLEAR_MEMORY /* Clear rest of symbol table node */ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); -#endif /* H5_CLEAR_MEMORY */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index 73db840..1272ab0 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -146,9 +146,7 @@ H5HF_man_dblock_create(hid_t dxpl_id, H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblo /* XXX: Change to using free-list factories */ if((dblock->blk = H5FL_BLK_MALLOC(direct_block, dblock->size)) == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") -#ifdef H5_CLEAR_MEMORY -HDmemset(dblock->blk, 0, dblock->size); -#endif /* H5_CLEAR_MEMORY */ + HDmemset(dblock->blk, 0, dblock->size); dblock->write_buf = NULL; dblock->write_size = 0; diff --git a/src/H5HFtiny.c b/src/H5HFtiny.c index bdfe30d..711ceb9 100644 --- a/src/H5HFtiny.c +++ b/src/H5HFtiny.c @@ -177,10 +177,9 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); ((enc_obj_size & H5HF_TINY_MASK_EXT_1) >> 8)); *id++ = enc_obj_size & H5HF_TINY_MASK_EXT_2; } /* end else */ + HDmemcpy(id, obj, obj_size); -#ifdef H5_CLEAR_MEMORY -HDmemset(id + obj_size, 0, (hdr->id_len - ((size_t)1 + (size_t)hdr->tiny_len_extended + obj_size))); -#endif /* H5_CLEAR_MEMORY */ + HDmemset(id + obj_size, 0, (hdr->id_len - ((size_t)1 + (size_t)hdr->tiny_len_extended + obj_size))); /* Update statistics about heap */ hdr->tiny_size += obj_size; diff --git a/src/H5HG.c b/src/H5HG.c index 57a1cf2..de25bc6 100644 --- a/src/H5HG.c +++ b/src/H5HG.c @@ -154,22 +154,20 @@ H5HG_create(H5F_t *f, hid_t dxpl_id, size_t size) /* Create it */ H5_CHECK_OVERFLOW(size, size_t, hsize_t); if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_GHEAP, dxpl_id, (hsize_t)size))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file space for global heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file space for global heap") if(NULL == (heap = H5FL_MALLOC(H5HG_heap_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") heap->addr = addr; heap->size = size; heap->shared = H5F_SHARED(f); if(NULL == (heap->chunk = H5FL_BLK_MALLOC(gheap_chunk, size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") -#ifdef H5_CLEAR_MEMORY -HDmemset(heap->chunk, 0, size); -#endif /* H5_CLEAR_MEMORY */ + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") + HDmemset(heap->chunk, 0, size); heap->nalloc = H5HG_NOBJS(f, size); heap->nused = 1; /* account for index 0, which is used for the free object */ if(NULL == (heap->obj = H5FL_SEQ_MALLOC(H5HG_obj_t, heap->nalloc))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") /* Initialize the header */ HDmemcpy(heap->chunk, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -452,9 +450,7 @@ H5HG_extend(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t need) /* Re-allocate the heap information in memory */ if(NULL == (new_chunk = H5FL_BLK_REALLOC(gheap_chunk, heap->chunk, (heap->size + need)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "new heap allocation failed") -#ifdef H5_CLEAR_MEMORY -HDmemset(new_chunk + heap->size, 0, need); -#endif /* H5_CLEAR_MEMORY */ + HDmemset(new_chunk + heap->size, 0, need); /* Adjust the size of the heap */ old_size = heap->size; diff --git a/src/H5HLcache.c b/src/H5HLcache.c index faa5ff2..95ab65d 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -572,10 +572,8 @@ H5HL__cache_prefix_serialize(const H5F_t *f, void *_image, size_t len, /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) <= len); -#ifdef H5_CLEAR_MEMORY /* Clear rest of local heap */ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); -#endif /* H5_CLEAR_MEMORY */ } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5SMcache.c b/src/H5SMcache.c index bbd7e87..4de86e2 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -678,9 +678,8 @@ H5SM__cache_list_serialize(const H5F_t *f, void *_image, size_t len, /* sanity check */ HDassert((size_t)(image - (uint8_t *)_image) <= list->header->list_size); -#ifdef H5_CLEAR_MEMORY + /* Clear memory */ HDmemset(image, 0, (list->header->list_size - (size_t)(image - (uint8_t *)_image))); -#endif /* H5_CLEAR_MEMORY */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 89aea81..ae3d2a1 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -883,10 +883,8 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") -#ifdef H5_CLEAR_MEMORY /* Initialize the parameters to a known state */ HDmemset(cd_values, 0, sizeof(cd_values)); -#endif /* H5_CLEAR_MEMORY */ /* Get the filter's current parameters */ if(H5P_get_filter_by_id(dcpl_plist, H5Z_FILTER_SCALEOFFSET, &flags, &cd_nelmts, cd_values, (size_t)0, NULL, NULL) < 0) @@ -1266,13 +1264,11 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value for(i = 0; i < sizeof(unsigned long long); i++) ((unsigned char *)outbuf)[5+i] = (unsigned char)((minval & ((unsigned long long)0xff << i*8)) >> i*8); -#ifdef H5_CLEAR_MEMORY /* Zero out remaining, unused bytes */ /* (Looks like an error in the original determination of how many * bytes would be needed for parameters. - QAK, 2010/08/19) */ HDmemset(outbuf + 13, 0, (size_t)8); -#endif /* H5_CLEAR_MEMORY */ /* special case: minbits equal to full precision */ if(minbits == p.size * 8) { diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index 90224c1..b0e5628 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -64,7 +64,6 @@ Features: MPE: @MPE@ Direct VFD: @DIRECT_VFD@ dmalloc: @HAVE_DMALLOC@ -Clear file buffers before write: @CLEARFILEBUF@ Using memory checker: @USINGMEMCHECKER@ Memory allocation sanity checks: @MEMORYALLOCSANITYCHECK@ Function Stack Tracing: @CODESTACK@ diff --git a/test/objcopy.c b/test/objcopy.c index cd978f2..9bdb50d 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -2309,9 +2309,7 @@ test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t TESTING("H5Ocopy(): compound dataset"); -#ifdef H5_CLEAR_MEMORY HDmemset(buf, 0, sizeof(buf)); -#endif /* H5_CLEAR_MEMORY */ for(i = 0; i < DIM_SIZE_1; i++) { buf[i].a = i; buf[i].d = (double)1.0F / (double)(i + 1); -- cgit v0.12 From 20a3462089f9a70809267552eec392abfaa60361 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 27 Jan 2016 01:23:40 -0500 Subject: [svn-r28977] Added autotools g++ compiler flags/warnings file to config/ Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial w/ C++ --- MANIFEST | 1 + config/gnu-cxxflags | 795 ++++++++++++++++++++++++++++++++++++++++++++++++++ config/linux-gnulibc1 | 3 + 3 files changed, 799 insertions(+) create mode 100644 config/gnu-cxxflags diff --git a/MANIFEST b/MANIFEST index 42a1736..7b0501d 100644 --- a/MANIFEST +++ b/MANIFEST @@ -81,6 +81,7 @@ ./config/conclude_fc.am ./config/examples.am ./config/freebsd +./config/gnu-cxxflags ./config/gnu-fflags ./config/gnu-flags ./config/i386-pc-cygwin32 diff --git a/config/gnu-cxxflags b/config/gnu-cxxflags new file mode 100644 index 0000000..ee690db --- /dev/null +++ b/config/gnu-cxxflags @@ -0,0 +1,795 @@ +# -*- shell-script -*- +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. + + +# This file should be sourced into configure if the compiler is the +# GNU g++ compiler or a derivative. It is careful not to do anything +# if the compiler is not GNU; otherwise `cxx_flags_set' is set to `yes' +# + +# Get the compiler version in a way that works for g++ +# unless a compiler version is already known +# +# cxx_vendor: The compiler name: g++ +# cxx_version: Version number: 2.91.60, 2.7.2.1 +# +if test X = "X$cxx_flags_set"; then + # PathScale compiler spits out gcc version string too. Need to + # filter it out. + # icc beginning with version 12 includes a "gcc version compatiblilty" + # string, causing the gcc H5_CFLAGS to be erroneously added. The line + # "grep -v 'icc version'" causes the discarding of any output + # containing 'icc version'. The cc_version for icc is correctly determined + # and flags added in the intel-flags script. + cxx_version="`$CXX $CXXFLAGS $H5_CXXFLAGS -v 2>&1 | grep -v 'PathScale' |\ + grep -v 'icc version' |\ + grep 'gcc version' | sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`" + cxx_vendor=`echo $cxx_version |sed 's/\([a-z]*\).*/\1/'` + cxx_version=`echo $cxx_version |sed 's/[-a-z]//g'` + if test X = "X$cxx_vendor" -a X != "X$cxx_version"; then + cxx_vendor=g++ + fi + if test "-" != "$cxx_vendor-$cxx_version"; then + echo "compiler '$CXX' is GNU $cxx_vendor-$cxx_version" + fi + + # Some version numbers + cxx_vers_major=`echo $cxx_version | cut -f1 -d.` + cxx_vers_minor=`echo $cxx_version | cut -f2 -d.` + cxx_vers_patch=`echo $cxx_version | cut -f3 -d.` + test -n "$cc_vers_major" || cxx_vers_major=0 + test -n "$cc_vers_minor" || cxx_vers_minor=0 + test -n "$cc_vers_patch" || cxx_vers_patch=0 + cxx_vers_all=`expr $cxx_vers_major '*' 1000000 + $cxx_vers_minor '*' 1000 + $cxx_vers_patch` +fi + +# Common g++ flags for various situations +case "$cxx_vendor-$cxx_version" in + g++*) + # Architecture-specific flags + arch= + case "$host_os-$host_cpu" in + # FreeBSD sets the information from "uname -m" to the general machine + # architecture, not the specific CPU for the machine, so even our + # Pentium II Xeon server is set to "i386". Once we know we are on a FreeBSD + # machine, use the "sysctl" command to get the CPU hardware model. + freebsd*-i386) + host_cpu_model=`sysctl -n hw.model` + case "$host_cpu_model" in + # Hmm.. this might not catch Celerons, but it won't hurt them either... + *Pro*|*II*|*III*|*IV*|*Athlon*) + # architecture-specific optimizations cause problems + # for some users who build binaries to be used on + # multiple architectures. + # arch="-march=i686" + ;; + esac + ;; + + *-i686) + # architecture-specific optimizations cause problems + # for some users who build binaries to be used on + # multiple architectures. + # arch="-march=i686" + ;; + esac + + # Host-specific flags + case "`hostname`" in + sleipnir.ncsa.uiuc.edu) + arch="$arch -pipe" + ;; + esac + + # General (copied from H5_CFLAGS) + H5_CXXFLAGS="$H5_CXXFLAGS $arch -pedantic -Wall -W -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wmissing-declarations -Wredundant-decls -Winline" + + # C++-specific + H5_CXXFLAGS="$H5_CXXFLAGS -Wsign-promo -Woverloaded-virtual -Wold-style-cast -Weffc++ -Wreorder -Wnon-virtual-dtor -Wctor-dtor-privacy -Wabi" + + # Production + case "$cxx_vendor-$cxx_version" in + g++-[34].*) + PROD_CXXFLAGS="-O3" + ;; + g++-5.*) + PROD_CXXFLAGS="-O3 -fstdarg-opt" + ;; + *) + PROD_CXXFLAGS="-O -finline-functions" + ;; + esac + + # Debug + case "$cxx_vendor-$cxx_version" in + g++-5.*) + DEBUG_CXXFLAGS="-Og -g -ftrapv -fno-common" + ;; + *) + DEBUG_CXXFLAGS="-g" + ;; + esac + + # Profile + PROFILE_CXXFLAGS="-Og -g -pg" + + # Flags are set + cxx_flags_set=yes + ;; +esac + +# Version-specific g++ flags +# +# Please follow the pattern below by adding new versions at the top, copying +# the information from the previous version and adding modifications to that. +case "$cxx_vendor-$cxx_version" in + +# Closer to the g++ 5.2 release, we should check for additional flags to +# include and break it out into it's own section, like the other versions +# below. -QAK + g++-5*) + + # Append warning flags from gcc-3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + + # Append more extra warning flags that only gcc 4.4+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Append more extra warning flags that only gcc 4.5+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow=5" + + # Append more extra warning flags that only gcc 4.6+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines" + + # Append more extra warning flags that only gcc 4.7+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" + + # Append more extra warning flags that only gcc 4.8+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsuggest-attribute=format" + + # Append more extra warning flags that only gcc 4.9+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wdate-time -Wopenmp-simd" + + # (There was no release of gcc 5.0) + + # Append more extra warning flags that only gcc 5.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Warray-bounds=2" + ;; + + g++-4.9*) + # Append warning flags + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc 3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc 3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + + # Append more extra warning flags that only gcc 4.4+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Append more extra warning flags that only gcc 4.5+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow=5" + + # Append more extra warning flags that only gcc 4.6+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines" + + # Append more extra warning flags that only gcc 4.7+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" + + # Append more extra warning flags that only gcc 4.8+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsuggest-attribute=format" + + # Append more extra warning flags that only gcc 4.9+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wdate-time -Wopenmp-simd" + ;; + + g++-4.8*) + # Append warning flags + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + + # Append more extra warning flags that only gcc 4.4+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Append more extra warning flags that only gcc 4.5+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow=5" + + # Append more extra warning flags that only gcc 4.6+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines" + + # Append more extra warning flags that only gcc 4.7+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" + + # Append more extra warning flags that only gcc 4.8+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsuggest-attribute=format" + ;; + + g++-4.7*) + # Append warning flags + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + # (this warning was removed in gcc 4.5+) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + + # Append more extra warning flags that only gcc 4.4+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Append more extra warning flags that only gcc 4.5+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow=5" + + # Append more extra warning flags that only gcc 4.6+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines" + + # Append more extra warning flags that only gcc 4.7+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" + ;; + + g++-4.6*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + # (this warning was removed in gcc 4.5+) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + + # Append more extra warning flags that only gcc 4.4+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Append more extra warning flags that only gcc 4.5+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-aliasing -Wstrict-overflow=5" + + # Append more extra warning flags that only gcc 4.6+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines" + ;; + + g++-4.5*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + # (this warning was removed in gcc 4.5+) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + + # Append more extra warning flags that only gcc 4.4+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Append more extra warning flags that only gcc 4.5+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-aliasing -Wstrict-overflow=5" + ;; + + g++-4.4*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + + # Append more extra warning flags that only gcc 4.4+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + ;; + + g++-4.3*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations -Wvolatile-register-var" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wvla" + ;; + + g++-4.2*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning does not appear to be reliable yet... + H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations -Wvolatile-register-var" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + ;; + + g++-4.1.*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning does not appear to be reliable yet... + H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations -Wvolatile-register-var" + ;; + + g++-4.0*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # The "format=2" warning generates too many warnings about valid + # usage in the library. + #CXXFLAGS="$CXXFLAGS -Wformat=2" + + # The "unreachable code" warning does not appear to be reliable yet... + #CXXFLAGS="$CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + ;; + + g++-3.4*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # The "format=2" warning generates too many warnings about valid + # usage in the library. + #CXXFLAGS="$CXXFLAGS -Wformat=2" + + # The "unreachable code" warning does not appear to be reliable yet... + #CXXFLAGS="$CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append more extra warning flags that only gcc3.4+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + ;; + + g++-3.3*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # The "format=2" warning generates too many warnings about valid + # usage in the library. + #CXXFLAGS="$CXXFLAGS -Wformat=2" + + # The "unreachable code" warning does not appear to be reliable yet... + #CXXFLAGS="$CXXFLAGS -Wunreachable-code" + + # Append more extra warning flags that only gcc3.3+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + ;; + + g++-3.2*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append more extra warning flags that only gcc3.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # The "format=2" warning generates too many warnings about valid + # usage in the library. + #CXXFLAGS="$CXXFLAGS -Wformat=2" + + # The "unreachable code" warning does not appear to be reliable yet... + #CXXFLAGS="$CXXFLAGS -Wunreachable-code" + ;; + + g++-3*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append some extra warning flags that only gcc3+ know about + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + ;; +esac + +# Clear cxx info if no flags set +if test "X$cxx_flags_set" = "X"; then + cxx_vendor= + cxx_version= +fi diff --git a/config/linux-gnulibc1 b/config/linux-gnulibc1 index 8abbe4a..405fa34 100644 --- a/config/linux-gnulibc1 +++ b/config/linux-gnulibc1 @@ -133,6 +133,9 @@ if test -z "$CXX"; then CXX_BASENAME=g++ fi +# Figure out GNU CXX compiler flags +. $srcdir/config/gnu-cxxflags + # compiler version strings # check if the compiler_version_info is already set -- cgit v0.12 From ad617b9bfca90714119cfce3f1d02068a613f198 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 27 Jan 2016 11:48:37 -0500 Subject: [svn-r28982] Fixed H5ST_dump signature problem and added st to the list of packages with extra debugging output. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 serial autotools --- configure.ac | 2 +- src/H5STprivate.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index aeb4cf7..6335ac8 100644 --- a/configure.ac +++ b/configure.ac @@ -1863,7 +1863,7 @@ if test "X-$DEBUG_PKG" = X- ; then fi AC_SUBST([DEBUG_PKG]) -all_packages="ac,b,b2,d,e,f,g,hg,hl,i,mf,mm,o,p,s,t,v,z" +all_packages="ac,b,b2,d,e,f,g,hg,hl,i,mf,mm,o,p,s,st,t,v,z" case "X-$DEBUG_PKG" in X-yes) DEBUG_PKG="d,e,f,g,hg,i,mm,o,p,s,t,v,z" diff --git a/src/H5STprivate.h b/src/H5STprivate.h index 892f04a..9b49b07 100644 --- a/src/H5STprivate.h +++ b/src/H5STprivate.h @@ -58,7 +58,9 @@ H5_DLL H5ST_ptr_t H5ST_findfirst(H5ST_tree_t *p); H5_DLL H5ST_ptr_t H5ST_findnext(H5ST_ptr_t p); H5_DLL void *H5ST_remove(H5ST_tree_t *root, const char *s); H5_DLL herr_t H5ST_delete(H5ST_tree_t *root, H5ST_ptr_t p); -H5_DLL herr_t H5ST_dump(H5ST_ptr_t p); +#ifdef H5ST_DEBUG +H5_DLL herr_t H5ST_dump(H5ST_tree_t *tree); +#endif /* H5ST_DEBUG */ #endif /* _H5STprivate_H */ -- cgit v0.12 From 5c276d9dfc3e0737b49ff03701cfbeba2a9c447d Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 27 Jan 2016 12:28:33 -0500 Subject: [svn-r28986] Added H5_DLLVAR to H5AC_dxpl_id. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 serial and parallel autotools --- src/H5ACprivate.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 0ed6110..3101abe 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -197,7 +197,7 @@ typedef H5C_t H5AC_t; #define H5AC_RING_NAME "H5AC_ring_type" /* Dataset transfer property list for flush calls */ -extern hid_t H5AC_dxpl_id; +H5_DLLVAR hid_t H5AC_dxpl_id; /* Default cache configuration. */ -- cgit v0.12 From 7abd70b809d1ee24d697520030587022c7b8d4e7 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 27 Jan 2016 14:12:38 -0500 Subject: [svn-r28990] Removed spurious BIND() warnings from Fortran. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 serial autotools w/ Fortran --- config/gnu-fflags | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/gnu-fflags b/config/gnu-fflags index 1d6caa1..911a264 100644 --- a/config/gnu-fflags +++ b/config/gnu-fflags @@ -78,6 +78,10 @@ if test "X-gfortran" = "X-$f9x_vendor"; then FSEARCH_DIRS="" H5_FCFLAGS="$H5_FCFLAGS -pedantic -Wall -Wconversion -Wunderflow -Wimplicit-interface -W" + # Turn off warnings for passing non-ANSI types to BIND(). + # We pass a lot of hid_t, etc. types so this generates a LOT of spurious warnings. + H5_FCFLAGS="$H5_FCFLAGS -Wno-c-binding-type" + # Production PROD_FCFLAGS="-O2 -s" -- cgit v0.12 From 7afa7bb6afd1cf4daee58010e4f9411262abeab9 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 27 Jan 2016 15:51:40 -0500 Subject: [svn-r28995] Removed unused packages from list in --enable-debug= configure option (also updated CMake). Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 serial autotools serial CMake (CMake 3.3.2) --- configure.ac | 4 ++-- src/CMakeLists.txt | 2 +- src/H5Gprivate.h | 7 ------- src/H5MFprivate.h | 9 --------- 4 files changed, 3 insertions(+), 19 deletions(-) diff --git a/configure.ac b/configure.ac index 6335ac8..ce303b9 100644 --- a/configure.ac +++ b/configure.ac @@ -1863,10 +1863,10 @@ if test "X-$DEBUG_PKG" = X- ; then fi AC_SUBST([DEBUG_PKG]) -all_packages="ac,b,b2,d,e,f,g,hg,hl,i,mf,mm,o,p,s,st,t,v,z" +all_packages="AC,B,B2,D,F,I,HL,O,S,ST,T,Z" case "X-$DEBUG_PKG" in X-yes) - DEBUG_PKG="d,e,f,g,hg,i,mm,o,p,s,t,v,z" + DEBUG_PKG="D,F,I,O,S,T,Z" ## H5_CPPFLAGS="$H5_CPPFLAGS -UNDEBUG" AC_MSG_RESULT([default ($DEBUG_PKG)]) ;; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2c9ca8a..8b90cd5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -860,7 +860,7 @@ option (HDF5_ENABLE_DEBUG_APIS "Turn on debugging in all packages" OFF) if (HDF5_ENABLE_DEBUG_APIS) set_target_properties (${HDF5_LIB_TARGET} PROPERTIES COMPILE_DEFINITIONS - "H5Z_DEBUG;H5VM_DEBUG;H5T_DEBUG;H5S_DEBUG;H5P_DEBUG;H5O_DEBUG;H5MM_DEBUG;H5MF_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5HG_DEBUG;H5G_DEBUG;H5F_DEBUG;H5E_DEBUG;H5D_DEBUG;H5B_DEBUG;H5AC_DEBUG" + "H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5B_DEBUG;H5AC_DEBUG" ) endif (HDF5_ENABLE_DEBUG_APIS) set (install_targets ${HDF5_LIB_TARGET}) diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index 1ab5522..2ef99fd 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -37,13 +37,6 @@ #include "H5RSprivate.h" /* Reference-counted strings */ /* - * Define this to enable debugging. - */ -#ifdef NDEBUG -# undef H5G_DEBUG -#endif - -/* * The disk size for a symbol table entry... */ #define H5G_SIZEOF_SCRATCH 16 diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index 024cc91..766834d 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -21,8 +21,6 @@ * * Purpose: Private header file for file memory management. * - * Modifications: - * *------------------------------------------------------------------------- */ #ifndef _H5MFprivate_H @@ -36,13 +34,6 @@ /* Library Private Macros */ /**************************/ -/* - * Feature: Define H5MF_DEBUG on the compiler command line if you want to - * see diagnostics from this layer. - */ -#ifdef NDEBUG -# undef H5MF_DEBUG -#endif /****************************/ /* Library Private Typedefs */ -- cgit v0.12 From 1454a458262dd012c94f56ccc55ccbbe57b63399 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 27 Jan 2016 16:45:23 -0500 Subject: [svn-r28996] Autotools configure updates to allow separation of build type, debug symbols, asserts, profiling, and optimization. Also much refactoring, improved help, and --enable- options will now emit errors on nonsense (e.g.: --enable-foo="asdfasdf"). The libhdf5.settings.in file was also reformatted. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 serial and parallel autotools w/ various options --- config/cce-fflags | 17 +- config/cce-flags | 18 +- config/gnu-fflags | 16 +- config/gnu-flags | 47 ++- config/ibm-flags | 29 +- config/intel-fflags | 16 +- config/intel-flags | 20 +- config/linux-gnulibc1 | 2 +- config/pgi-fflags | 16 +- config/pgi-flags | 36 ++- configure.ac | 799 ++++++++++++++++++++++++++++++++++-------------- src/CMakeLists.txt | 2 +- src/H5.c | 133 ++++---- src/libhdf5.settings.in | 70 +++-- 14 files changed, 848 insertions(+), 373 deletions(-) diff --git a/config/cce-fflags b/config/cce-fflags index 896e711..b96551d 100644 --- a/config/cce-fflags +++ b/config/cce-fflags @@ -53,14 +53,23 @@ if test "X-cce" = "X-$f9x_vendor"; then # Production # -Wl,-s to remove all symbols for smaller file - PROD_FCFLAGS="-O3 -Wl,-s" + # Note that this will likely override the symbols flag + PROD_FCFLAGS="-Wl,-s" # Debug - DEBUG_FCFLAGS="-g -O0" + DEBUG_FCFLAGS= - # Profile + # Symbols + SYMBOLS_FCFLAGS="-g" + + # Profiling # Use this for profiling with gprof - PROFILE_FCFLAGS="-g -p" + PROFILE_FCFLAGS="-p" + + # Optimization + HIGH_OPT_FCFLAGS="-O3" + DEBUG_OPT_FCFLAGS="-O0" + NO_OPT_FCFLAGS="-O0" # Flags are set f9x_flags_set=yes diff --git a/config/cce-flags b/config/cce-flags index a34fcbe..bdfb5f9 100644 --- a/config/cce-flags +++ b/config/cce-flags @@ -55,18 +55,28 @@ if test "X-cce" = "X-$cc_vendor"; then # Production # -Wl,-s to remove all symbols for smaller file - PROD_CFLAGS="-O3 -Wl,-s" + PROD_CFLAGS="-Wl,-s" PROD_CPPFLAGS= # Debug - DEBUG_CFLAGS="-g -O0" + # NDEBUG is handled explicitly in configure + DEBUG_CFLAGS= DEBUG_CPPFLAGS= - # Profile + # Symbols + SYMBOL_CFLAGS="-g" + SYMBOL_CPPFLAGS= + + # Profiling # Use this for profiling with gprof - PROFILE_CFLAGS="-g -p" + PROFILE_CFLAGS="-p" PROFILE_CPPFLAGS= + # Optimization + HIGH_OPT_CFLAGS="-O3" + DEBUG_OPT_CFLAGS="-O0" + NO_OPT_CFLAGS="-O0" + # Flags are set cc_flags_set=yes diff --git a/config/gnu-fflags b/config/gnu-fflags index 911a264..3a90c10 100644 --- a/config/gnu-fflags +++ b/config/gnu-fflags @@ -83,13 +83,21 @@ if test "X-gfortran" = "X-$f9x_vendor"; then H5_FCFLAGS="$H5_FCFLAGS -Wno-c-binding-type" # Production - PROD_FCFLAGS="-O2 -s" + PROD_FCFLAGS="-s" # Debug - DEBUG_FCFLAGS="-g -fbounds-check" + DEBUG_FCFLAGS="-fbounds-check" - # Profile - PROFILE_FCFLAGS="-g -pg" + # Symbols + SYMBOLS_FCFLAGS="-g" + + # Profiling + PROFILE_FCFLAGS="-pg" + + # Optimization + HIGH_OPT_FCFLAGS="-O2" + DEBUG_OPT_FCFLAGS="-O0" + NO_OPT_FCFLAGS="-O0" # Flags are set f9x_flags_set=yes diff --git a/config/gnu-flags b/config/gnu-flags index e7f8f14..232bf05 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -97,39 +97,64 @@ case "$cc_vendor-$cc_version" in H5_CFLAGS="$H5_CFLAGS $arch -std=c99 -pedantic -Wall -W -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline" # Production + # NDEBUG is handled explicitly by the configure script case "$cc_vendor-$cc_version" in gcc-[34].*) - PROD_CFLAGS="-O3" + PROD_CFLAGS= ;; gcc-5.*) - PROD_CFLAGS="-O3 -fstdarg-opt" + PROD_CFLAGS="-fstdarg-opt" ;; *) - PROD_CFLAGS="-O -finline-functions" + # gcc automatically inlines based on the optimization level + # this is just a failsafe + PROD_CFLAGS="-finline-functions" ;; esac - PROD_CPPFLAGS= # Debug + # NDEBUG is handled explicitly by the configure script + # -g is hanled by the symbols flags case "$cc_vendor-$cc_version" in gcc-5.*) - DEBUG_CFLAGS="-Og -g -ftrapv -fno-common" + DEBUG_CFLAGS="-ftrapv -fno-common" ;; *) - DEBUG_CFLAGS="-g" + DEBUG_CFLAGS= ;; esac - #DEBUG_CFLAGS="$DEBUG_CFLAGS -fsanitize=undefined" + #DEBUG_CFLAGS="-fsanitize=undefined" DEBUG_CPPFLAGS= - # Try out the new "stack protector" feature introduced in gcc 4.1 - # (We should also think about adding some of the other memory protection options) - #DEBUG_CFLAGS="$DEBUG_CFLAGS -Wstack-protector -fstack-protector-all" + # Symbols + SYMBOL_CFLAGS="-g" + SYMBOL_CPPFLAGS= # Profile - PROFILE_CFLAGS="-Og -g -pg" + PROFILE_CFLAGS="-pg" PROFILE_CPPFLAGS= + # Optimization (only CFLAGS at this time) + case "$cc_vendor-$cc_version" in + gcc-[34].*) + HIGH_OPT_CFLAGS="-O3" + DEBUG_OPT_CFLAGS= + ;; + gcc-5.*) + HIGH_OPT_CFLAGS="-O3" + DEBUG_OPT_CFLAGS="-Og" + ;; + *) + HIGH_OPT_CFLAGS="-O" + DEBUG_OPT_CFLAGS= + ;; + esac + NO_OPT_CFLAGS="-O0" + + # Try out the new "stack protector" feature introduced in gcc 4.1 + # (We should also think about adding some of the other memory protection options) + #DEBUG_CFLAGS="$DEBUG_CFLAGS -Wstack-protector -fstack-protector-all" + # Flags are set cc_flags_set=yes ;; diff --git a/config/ibm-flags b/config/ibm-flags index 462372d..731968d 100644 --- a/config/ibm-flags +++ b/config/ibm-flags @@ -55,19 +55,38 @@ if test "XL" = "$cc_vendor"; then # Turn off shared lib option. It causes some test suite to fail. enable_shared="${enable_shared:-no}" + # Make sure this is applied to other API compile options such as C++. AM_CFLAGS="$AM_CFLAGS" + # -qflag=w:w makes the lowest level of reported compile issues to be "warning" # instead of "information". This suppresses a very large number of messages # concerning the portability of __inline__. H5_CFLAGS="-qlanglvl=stdc99 -qflag=w:w $H5_CFLAGS" - DEBUG_CFLAGS="-g -qfullpath" - DEBUG_CPPFLAGS= - # -O causes test/dtypes to fail badly. Turn it off for now. - PROD_CFLAGS="" + + # Produciton + PROD_CFLAGS= PROD_CPPFLAGS= - PROFILE_CFLAGS="-g -qfullpath -pg" + + # Debug + # NDEBUG is handled explicitly in configure + DEBUG_CFLAGS="-qfullpath" + DEBUG_CPPFLAGS= + + # Symbols + SYMBOL_CFLAGS="-g" + SYMBOL_CPPFLAGS= + + # Profiling + PROFILE_CFLAGS="-pg" PROFILE_CPPFLAGS= + + # Optimization + # -O causes test/dtypes to fail badly. Turn it off for now. + HIGH_OPT_CFLAGS= + DEBUG_OPT_CFLAGS= + NO_OPT_CFLAGS= + # Flags are set cc_flags_set=yes fi diff --git a/config/intel-fflags b/config/intel-fflags index 3e33fc9..1f7cf78 100644 --- a/config/intel-fflags +++ b/config/intel-fflags @@ -73,14 +73,22 @@ if test "X-ifort" = "X-$f9x_vendor"; then H5_FCFLAGS="$H5_FCFLAGS" # Production - PROD_FCFLAGS="-O3" + PROD_FCFLAGS= # Debug - DEBUG_FCFLAGS="-g -check all" + DEBUG_FCFLAGS="-check all" - # Profile + # Symbols + SYMBOLS_FCFLAGS="-g" + + # Profiling # Use this for profiling with gprof - PROFILE_FCFLAGS="-g -p" + PROFILE_FCFLAGS="-p" + + # Optimization + HIGH_OPT_FCFLAGS="-O3" + DEBUG_OPT_FCFLAGS= + NO_OPT_FCFLAGS= # Flags are set f9x_flags_set=yes diff --git a/config/intel-flags b/config/intel-flags index 3187daf..a3238fa 100644 --- a/config/intel-flags +++ b/config/intel-flags @@ -68,21 +68,31 @@ if test "X-icc" = "X-$cc_vendor"; then # General # Default to C99 standard. - H5_CFLAGS="${H5_CFLAGS:--std=c99 $arch}" + H5_CFLAGS="${H5_CFLAGS:--std=c99 $arch} -Wcheck -Wall" # Production is set to default; see settings for specific version further down - PROD_CFLAGS="-O" + PROD_CFLAGS= PROD_CPPFLAGS= # Debug - DEBUG_CFLAGS="-Wcheck -Wall -g -O0" + # NDEBUG is handled explicitly in configure + DEBUG_CFLAGS= DEBUG_CPPFLAGS= - # Profile + # Symbols + SYMBOL_CFLAGS="-g" + SYMBOL_CPPFLAGS= + + # Profiling # Use this for profiling with gprof - PROFILE_CFLAGS="-g -p" + PROFILE_CFLAGS="-p" PROFILE_CPPFLAGS= + # Optimization + HIGH_OPT_CFLAGS="-O" + DEBUG_OPT_CFLAGS="-O0" + NO_OPT_CFLAGS="-O0" + # Flags are set cc_flags_set=yes diff --git a/config/linux-gnulibc1 b/config/linux-gnulibc1 index 405fa34..46771dc 100644 --- a/config/linux-gnulibc1 +++ b/config/linux-gnulibc1 @@ -51,7 +51,7 @@ if test "X-" = "X-$FC"; then FC=gfortran FC_BASENAME=gfortran ;; - pgcc*) + pgcc*) FC=pgf90 FC_BASENAME=pgf90 ;; diff --git a/config/pgi-fflags b/config/pgi-fflags index 8e574e4..fbcba52 100644 --- a/config/pgi-fflags +++ b/config/pgi-fflags @@ -87,12 +87,20 @@ if test "X-pgf90" = "X-$f9x_vendor"; then PROD_FCFLAGS="-fast -s -Mnoframe" # Debug - DEBUG_FCFLAGS="-g -Mbounds -Mchkptr -Mdclchk" + DEBUG_FCFLAGS="-Mbounds -Mchkptr -Mdclchk" - # Profile - PROFILE_FCFLAGS="-g -Mprof=func,line" + # Symbols + SYMBOLS_FCFLAGS="-g" + + # Profiling + PROFILE_FCFLAGS="-Mprof=func,line" # Use this for profiling with gprof - #PROFILE_FCFLAGS="-g -pg" + #PROFILE_FCFLAGS="-pg" + + # Optimization + HIGH_OPT_FCFLAGS= + DEBUG_OPT_FCFLAGS= + NO_OPT_FCFLAGS= # Flags are set f9x_flags_set=yes diff --git a/config/pgi-flags b/config/pgi-flags index 29e6f05..674f60e 100644 --- a/config/pgi-flags +++ b/config/pgi-flags @@ -72,13 +72,11 @@ if test "X-pgcc" = "X-$cc_vendor"; then # Production case "$cc_vendor-$cc_version" in - # Tweak down compiler optimizations for v10.6, it has a bug pgcc-10.6*) - PROD_CFLAGS="-O1 -s" + PROD_CFLAGS="-s" ;; - # Tweak down compiler optimizations for v9.x pgcc-9.*) - PROD_CFLAGS="-O1 -s" + PROD_CFLAGS="-s" ;; *) PROD_CFLAGS="-fast -s" @@ -87,15 +85,37 @@ if test "X-pgcc" = "X-$cc_vendor"; then PROD_CPPFLAGS= # Debug - DEBUG_CFLAGS="-g -Mbounds" + # NDEBUG is handled explicitly by the configure script + DEBUG_CFLAGS="-Mbounds" DEBUG_CPPFLAGS= - # Profile - PROFILE_CFLAGS="-g -Mprof=func,line" + # Symbols + SYMBOL_CFLAGS="-g" + SYMBOL_CPPFLAGS= + + # Profiling + PROFILE_CFLAGS="-Mprof=func,line" # Use this for profiling with gprof - #PROFILE_CFLAGS="-g -pg" + #PROFILE_CFLAGS="-pg" PROFILE_CPPFLAGS= + # Optimization + case "$cc_vendor-$cc_version" in + # Tweak down compiler optimizations for v10.6, it has a bug + pgcc-10.6*) + HIGH_OPT_CFLAGS="-O1" + ;; + # Tweak down compiler optimizations for v9.x + pgcc-9.*) + HIGH_OPT_CFLAGS="-O1" + ;; + *) + HIGH_OPT_CFLAGS= + ;; + esac + DEBUG_OPT_CFLAGS= + NO_OPT_CFLAGS= + # Flags are set cc_flags_set=yes diff --git a/configure.ac b/configure.ac index ce303b9..2f81607 100644 --- a/configure.ac +++ b/configure.ac @@ -151,46 +151,64 @@ AC_MSG_CHECKING([shell variables initial values]) set >&AS_MESSAGE_LOG_FD AC_MSG_RESULT([done]) -## Define all symbol variables used for configure summary. -## EXTERNAL_FILTERS equals all external filters. Default none. -## MPE: whether MPE option is enabled. Default no. -## STATIC_EXEC: whether static-exec is enabled. Default no. -## HDF_FORTRAN: whether Fortran is enabled. Default no. -## FC: Fortran compiler. -## HDF_CXX: whether C++ is enabled. Default no. -## CXX: C++ compiler. -## HDF5_HL: whether high-level library is enabled. Default is yes. -## INSTRUMENT: whether INSTRUMENT is enabled. No default set here. -## CODESTACK: whether CODESTACK is enabled. Default no. -## HAVE_DMALLOC: whether system has dmalloc support. Default no. -## HAVE_FLOAT128: whether system has Quad-Precision Math Library. Default no. -## DIRECT_VFD: whether DIRECT_VFD is enabled. Default no. -## THREADSAFE: whether THREADSAFE is enabled. Default no. -## STATIC_SHARED: whether static and/or shared libraries are requested. -## enable_shared: whether shared lib is enabled. -## enable_static: whether static lib is enabled. -## UNAME_INFO: System information. +## ---------------------------------------------------------------------- +## Save system information for the library settings file. +## +AC_SUBST([UNAME_INFO]) +UNAME_INFO=`uname -a` + +## ---------------------------------------------------------------------- +## Determine build mode (debug, production, clean). +## This has to be done early since the build mode is referred to +## frequently. +## +AC_MSG_CHECKING([build mode]) +AC_ARG_ENABLE([build-mode], + [AS_HELP_STRING([--enable-build-mode=(debug|production|clean)], + [Sets the build mode. Debug turns on symbols, API + tracing, asserts, and debug optimization, + as well as several other minor configure options + that aid in debugging. + Production turns high optimizations on. + Clean turns nothing on and disables optimization + (i.e.: a 'clean slate' configuration). + All these settings can be overridden by using + specific configure flags. + [default=debug] + ])], + [BUILD_MODE=$enableval]) -AC_SUBST([EXTERNAL_FILTERS]) -AC_SUBST([MPE]) MPE=no -AC_SUBST([STATIC_EXEC]) STATIC_EXEC=no -AC_SUBST([HDF_FORTRAN]) HDF_FORTRAN=no -AC_SUBST([FC]) HDF_FORTRAN=no -AC_SUBST([HDF_CXX]) HDF_CXX=no -AC_SUBST([CXX]) HDF_CXX=no -AC_SUBST([HDF5_HL]) HDF5_HL=yes -AC_SUBST([INSTRUMENT]) -AC_SUBST([CODESTACK]) CODESTACK=no -AC_SUBST([HAVE_DMALLOC]) HAVE_DMALLOC=no -AC_SUBST([DIRECT_VFD]) DIRECT_VFD=no -AC_SUBST([THREADSAFE]) THREADSAFE=no -AC_SUBST([STATIC_SHARED]) -AC_SUBST([enable_shared]) -AC_SUBST([enable_static]) -AC_SUBST([UNAME_INFO]) UNAME_INFO=`uname -a` -AC_SUBST([PAC_C_MAX_REAL_PRECISION]) -AC_SUBST([Fortran_COMPILER_ID]) -Fortran_COMPILER_ID=none +## Set the default +## Depends on branch, set via script at branch creation time +if test "X-$BUILD_MODE" = X- ; then + BUILD_MODE=debug +fi + +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([BUILD_MODE]) + +case "X-$BUILD_MODE" in + X-clean) + AC_MSG_RESULT([clean]) + ;; + X-debug) + H5_CFLAGS="$H5_CFLAGS $DEBUG_CFLAGS" + H5_CPPFLAGS="$H5_CPPFLAGS $DEBUG_CPPFLAGS" + H5_CXXFLAGS="$H5_CXXFLAGS $DEBUG_CXXFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $DEBUG_FCFLAGS" + AC_MSG_RESULT([debug]) + ;; + X-production) + H5_CFLAGS="$H5_CFLAGS $PROD_CFLAGS" + H5_CPPFLAGS="$H5_CPPFLAGS $PROD_CPPFLAGS" + H5_CXXFLAGS="$H5_CXXFLAGS $PROD_CXXFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $PROD_FCFLAGS" + AC_MSG_RESULT([production]) + ;; + *) + AC_MSG_ERROR([Unrecognized build mode: $BUILD_MODE. Use debug, production, or clean.]) +esac ## ---------------------------------------------------------------------- ## Some platforms have broken basename, and/or xargs programs. Check @@ -373,7 +391,9 @@ AC_CHECK_SIZEOF([float]) AC_CHECK_SIZEOF([double]) AC_CHECK_SIZEOF([long double]) +## ---------------------------------------------------------------------- ## Check for non-standard extenstion __FLOAT128 +## HAVE_FLOAT128=0 HAVE_QUADMATH=0 FLT128_DIG=0 @@ -384,6 +404,8 @@ AC_CHECK_SIZEOF([_Quad]) AC_CHECK_HEADERS([quadmath.h], [HAVE_QUADMATH=1], []) PAC_FC_LDBL_DIG +AC_SUBST([PAC_C_MAX_REAL_PRECISION]) + if test "$ac_cv_sizeof___float128" != 0 && test "$FLT128_DIG" != 0 ; then AC_DEFINE([HAVE_FLOAT128], [1], [Determine if __float128 is available]) PAC_C_MAX_REAL_PRECISION=$FLT128_DIG @@ -392,9 +414,17 @@ else fi AC_DEFINE_UNQUOTED([PAC_C_MAX_REAL_PRECISION], $PAC_C_MAX_REAL_PRECISION, [Determine the maximum decimal precision in C]) AC_MSG_RESULT([$PAC_C_MAX_REAL_PRECISION]) + ## ---------------------------------------------------------------------- ## Check if they would like the Fortran interface compiled ## + +## This needs to be exposed for the library info file even if Fortran is disabled. +AC_SUBST([HDF_FORTRAN]) + +## Default is no Fortran +HDF_FORTRAN=no + AC_SUBST([HDF5_INTERFACES]) HDF5_INTERFACES="" AC_MSG_CHECKING([if Fortran interface enabled]) AC_ARG_ENABLE([fortran], @@ -417,7 +447,7 @@ if test "X$HDF_FORTRAN" = "Xyes"; then AC_CONFIG_HEADERS([fortran/src/H5config_f.inc], [cat fortran/src/H5config_f.inc | sed '1d;s%^/\* \(.*\) \*/%\1%;s/#define /#define H5_/;s/#undef /#undef H5_/' >fortran/src/H5config_f.inc.tmp; mv -f fortran/src/H5config_f.inc.tmp fortran/src/H5config_f.inc]) - AC_SUBST([FC]) HDF_FORTRAN=yes + AC_SUBST([FC]) HDF5_INTERFACES="$HDF5_INTERFACES fortran" @@ -520,6 +550,8 @@ if test "X$HDF_FORTRAN" = "Xyes"; then AC_SUBST([H5CONFIG_F_RKIND_SIZEOF]) AC_SUBST([H5CONFIG_F_NUM_IKIND]) AC_SUBST([H5CONFIG_F_IKIND]) + AC_SUBST([Fortran_COMPILER_ID]) + Fortran_COMPILER_ID=none AC_DEFINE_UNQUOTED([Fortran_COMPILER_ID], $Fortran_COMPILER_ID, [Define Fortran compiler ID]) ## Setting definition if there is a 16 byte fortran integer @@ -609,11 +641,17 @@ fi ## ---------------------------------------------------------------------- ## Check if they would like the C++ interface compiled ## +## This needs to be exposed for the library info file even if C++ is disabled. +AC_SUBST([HDF_CXX]) + +## Default is no C++ +HDF_CXX=no + ## We need to check for a C++ compiler unconditionally, since ## AC_PROG_CXX defines some macros that Automake 1.9.x uses and will ## miss even if c++ is not enabled. - AC_PROG_CXX - AC_PROG_CXXCPP ## this is checked for when AC_HEADER_STDC is done +AC_PROG_CXX +AC_PROG_CXXCPP ## this is checked for when AC_HEADER_STDC is done AC_MSG_CHECKING([if c++ interface enabled]) @@ -626,19 +664,22 @@ if test "X$HDF_CXX" = "Xyes"; then echo "yes" HDF5_INTERFACES="$HDF5_INTERFACES c++" + ## Expose the compiler for *.in files + AC_SUBST([CXX]) + ## Change to the C++ language AC_LANG_PUSH(C++) - # Checking if C++ needs old style header files in includes + ## Checking if C++ needs old style header files in includes PAC_PROG_CXX_HEADERS - # Checking if C++ can handle namespaces + ## Checking if C++ can handle namespaces PAC_PROG_CXX_NAMESPACE - # Checking if C++ has offsetof extension + ## Checking if C++ has offsetof extension PAC_PROG_CXX_OFFSETOF - # if C++ can handle static cast + ## if C++ can handle static cast PAC_PROG_CXX_STATIC_CAST else @@ -654,23 +695,41 @@ AC_LANG_POP(C++) ## Check if they would like the High Level library compiled ## -AC_SUBST(HL) HL="" -## name of fortran folder inside "hl", if FORTRAN compile is requested -AC_SUBST(HL_FOR) HL_FOR="" -AC_MSG_CHECKING([if high level library is enabled]) +## This needs to be exposed for the library info file even if the HL +## library is disabled. +AC_SUBST([HDF5_HL]) + +## The high-level library is enabled unless the build mode is clean. +if test "X-$BUILD_MODE" = "X-clean" ; then + HDF5_HL=no +else + HDF5_HL=yes +fi + +## high-level library directories (set when needed, blank until then) +## +## main high-level library +AC_SUBST(HL) +HL="" +## Fortran high-level library +AC_SUBST(HL_FOR) +HL_FOR="" + +AC_MSG_CHECKING([if the high-level library is enabled]) AC_ARG_ENABLE([hl], [AS_HELP_STRING([--enable-hl], - [Enable the high level library [default=yes]])], - [HDF5_HL=$enableval], - [HDF5_HL=yes]) + [Enable the high-level library. + [default=yes (unless build mode = clean)] + ])], + [HDF5_HL=$enableval]) -if test "X$HDF5_HL" = "Xyes"; then - echo "yes" +if test "X-$HDF5_HL" = "X-yes"; then + AC_MSG_RESULT([yes]) HL="hl" AC_DEFINE([INCLUDE_HL], [1], - [Define if HDF5's high-level library headers should be included in hdf5.h]) + [Define if the high-level library headers should be included in hdf5.h]) else - echo "no" + AC_MSG_RESULT([no]) fi @@ -693,7 +752,8 @@ AC_PROG_INSTALL ## ---------------------------------------------------------------------- -## Set up ${TR} which is used to process DEBUG_PKG. +## Set up ${TR} which is used to process the package list for extra +## debugging output in the C library. AC_PATH_PROG([TR], [tr]) @@ -829,6 +889,11 @@ LT_INIT([dlopen,win32-dll]) ## This check needs to occur after libtool is initialized because ## we check a libtool cache value and may issue a warning based ## on its result. +AC_SUBST([STATIC_EXEC]) + +## Default is no +STATIC_EXEC=no + AC_MSG_CHECKING([if we should install only statically linked executables]) AC_ARG_ENABLE([static_exec], [AS_HELP_STRING([--enable-static-exec], @@ -840,8 +905,8 @@ if test "X$STATIC_EXEC" = "Xyes"; then echo "yes" ## Issue a warning if -static flag is not supported. if test "X$lt_cv_prog_compiler_static_works" = "Xno"; then - echo " warning: -static flag not supported on this system; executable won't statically link shared system libraries." - LT_STATIC_EXEC="" + echo " warning: -static flag not supported on this system; executable won't statically link shared system libraries." + LT_STATIC_EXEC="" else LT_STATIC_EXEC="-all-static" fi @@ -890,50 +955,6 @@ case "X-$RPATH" in esac ## ---------------------------------------------------------------------- -## Production flags? Save the value in $CONFIG_MODE so we have it for -## the record. -## -AC_MSG_CHECKING([for production mode]) -AC_ARG_ENABLE([production], - [AS_HELP_STRING([--enable-production], - [Determines how to run the compiler.])]) - -case "X-$enable_production" in - X-yes) - enable_production="yes" - AC_MSG_RESULT([production]) - CONFIG_MODE=production - H5_CFLAGS="$H5_CFLAGS $PROD_CFLAGS" - H5_CPPFLAGS="$H5_CPPFLAGS $PROD_CPPFLAGS" - H5_CXXFLAGS="$H5_CXXFLAGS $PROD_CXXFLAGS" - H5_FCFLAGS="$H5_FCFLAGS $PROD_FCFLAGS" - ;; - X-|X-no) - enable_production="no" - AC_MSG_RESULT([development]) - CONFIG_MODE=development - H5_CFLAGS="$H5_CFLAGS $DEBUG_CFLAGS" - H5_CPPFLAGS="$H5_CPPFLAGS $DEBUG_CPPFLAGS" - H5_CXXFLAGS="$H5_CXXFLAGS $DEBUG_CXXFLAGS" - H5_FCFLAGS="$H5_FCFLAGS $DEBUG_FCFLAGS" - ;; - X-pg|X-profile) - enable_production="profile" - AC_MSG_RESULT([profile]) - CONFIG_MODE=profile - H5_CFLAGS="$H5_CFLAGS $PROFILE_CFLAGS" - H5_CPPFLAGS="$H5_CPPFLAGS $PROFILE_CPPFLAGS" - H5_CXXFLAGS="$H5_CXXFLAGS $PROFILE_CXXFLAGS" - H5_FCFLAGS="$H5_FCFLAGS $PROFILE_FCFLAGS" - ;; - *) - enable_production="user-defined" - AC_MSG_RESULT([user-defined]) - CONFIG_MODE="$enableval" - ;; -esac - -## ---------------------------------------------------------------------- ## Check for system libraries. "dl" stands for dynamically loaded library ## AC_CHECK_LIB([m], [ceil]) @@ -1182,6 +1203,11 @@ AC_ARG_WITH([fnord], ## command-line switch. The value is an include path and/or a library path. ## If the library path is specified then it must be preceded by a comma. ## +AC_SUBST([HAVE_DMALLOC]) + +## Default is not present +HAVE_DMALLOC=no + AC_ARG_WITH([dmalloc], [AS_HELP_STRING([--with-dmalloc=DIR], [Use dmalloc memory debugging aid [default=no]])],, @@ -1246,6 +1272,14 @@ case $withval in esac ## ---------------------------------------------------------------------- +## Make the external filters list available to *.in files +## At this point it's unset (no external filters by default) but it +## will be filled in during the deflate (zlib) and szip processing +## below. +## +AC_SUBST([EXTERNAL_FILTERS]) + +## ---------------------------------------------------------------------- ## Is the GNU zlib present? It has a header file `zlib.h' and a library ## `-lz' and their locations might be specified with the `--with-zlib' ## command-line switch. The value is an include path and/or a library path. @@ -1335,7 +1369,7 @@ if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes" -a "x$HAVE_COMPRESS2" if test "X$EXTERNAL_FILTERS" != "X"; then EXTERNAL_FILTERS="${EXTERNAL_FILTERS}," fi - EXTERNAL_FILTERS="${EXTERNAL_FILTERS}deflate(zlib)" + EXTERNAL_FILTERS="${EXTERNAL_FILTERS}deflate(zlib)" fi @@ -1458,13 +1492,13 @@ if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then if test "X$EXTERNAL_FILTERS" != "X"; then EXTERNAL_FILTERS="${EXTERNAL_FILTERS}," fi - EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(encoder)" + EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(encoder)" fi if test ${hdf5_cv_szlib_can_encode} = "no"; then if test "X$EXTERNAL_FILTERS" != "X"; then EXTERNAL_FILTERS="${EXTERNAL_FILTERS}," fi - EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(no encoder)" + EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(no encoder)" fi fi @@ -1477,6 +1511,11 @@ AC_CACHE_SAVE ## Enable thread-safe version of library. It requires Pthreads support ## on POSIX systems. ## +AC_SUBST([THREADSAFE]) + +## Default is no thread-safety +THREADSAFE=no + AC_MSG_CHECKING([for thread safe support]) AC_ARG_ENABLE([threadsafe], [AS_HELP_STRING([--enable-threadsafe], @@ -1484,7 +1523,7 @@ AC_ARG_ENABLE([threadsafe], [default=no]])], [THREADSAFE=$enableval]) -## NOTE: The high-level, C++, and Fortran interfaces are not compatible +## The high-level, C++, and Fortran interfaces are not compatible ## with the thread-safety option because the lock is not hoisted ## into the higher-level API calls. @@ -1837,56 +1876,277 @@ AC_MSG_RESULT([%${hdf5_cv_printf_ll}d and %${hdf5_cv_printf_ll}u]) AC_DEFINE_UNQUOTED([PRINTF_LL_WIDTH], ["$hdf5_cv_printf_ll"], [Width for printf() for type `long long' or `__int64', use `ll']) - ## ---------------------------------------------------------------------- -## Turn on debugging by setting compiler flags -## This must come after the enable-production since it depends on production. +## Deprecate old ways of determining debug/production build +## These can probably be removed in the future (1.10.1?) ## -AC_MSG_CHECKING([for debug flags]) AC_ARG_ENABLE([debug], - [AS_HELP_STRING([--enable-debug=all], - [Turn on debugging in all packages. One may - also specify a comma-separated list of - package names without the leading H5 or - the word no. The default is most packages - if production is disabled; no if it is enabled. + [AS_HELP_STRING([--enable-debug], + [DEPRECATED: use --enable-build-mode=debug])], + [DEPRECATED_DEBUG=$enableval]) + +if test "X-$DEPRECATED_DEBUG" != "X-" ; then + AC_MSG_ERROR([--enable-debug is deprecated, use --enable-build-mode=debug instead.]) +fi + +AC_ARG_ENABLE([production], + [AS_HELP_STRING([--enable-production], + [DEPRECATED: use --enable-build-mode=production])], + [DEPRECATED_PRODUCTION=$enableval]) + +if test "X-$DEPRECATED_PRODUCTION" != "X-" ; then + AC_MSG_ERROR([--enable-production is deprecated, use --enable-build-mode=production instead.]) +fi + + +## ---------------------------------------------------------------------- +## Check if the compiler should include symbols +## +AC_MSG_CHECKING([enable debugging symbols]) +AC_ARG_ENABLE([symbols], + [AS_HELP_STRING([--enable-symbols=(yes|no|)], + [Add debug symbols to the library (e.g.: build with -g). + This is independent of the build mode and optimization + level. The custom string allows special settings like + -ggdb, etc. to be used. + [default=yes if debug build, otherwise no] ])], - [DEBUG_PKG=$enableval]) + [SYMBOLS=$enableval]) -## Default to no if producton is enabled -if test "X-$DEBUG_PKG" = X- ; then - if test "$enable_production" = yes ; then - DEBUG_PKG=no - else - DEBUG_PKG=yes - fi +## Set default +if test "X-$SYMBOLS" = X- ; then + if test "X-$BUILD_MODE" = "X-debug" ; then + SYMBOLS=yes + else + SYMBOLS=no + fi fi -AC_SUBST([DEBUG_PKG]) -all_packages="AC,B,B2,D,F,I,HL,O,S,ST,T,Z" -case "X-$DEBUG_PKG" in +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([SYMBOLS]) + +case "X-$SYMBOLS" in X-yes) - DEBUG_PKG="D,F,I,O,S,T,Z" -## H5_CPPFLAGS="$H5_CPPFLAGS -UNDEBUG" - AC_MSG_RESULT([default ($DEBUG_PKG)]) + H5_CFLAGS="$H5_CFLAGS $SYMBOLS_CFLAGS" + H5_CXXFLAGS="$H5_CXXFLAGS $SYMBOLS_CXXFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $SYMBOLS_FCFLAGS" + AC_MSG_RESULT([yes]) + ;; + X-no) + AC_MSG_RESULT([no]) ;; - X-all) - DEBUG_PKG=$all_packages -## H5_CPPFLAGS="$H5_CPPFLAGS -UNDEBUG" - AC_MSG_RESULT([all ($DEBUG_PKG)]) + *) + H5_CFLAGS="$H5_CFLAGS $SYMBOLS" + H5_CXXFLAGS="$H5_CXXFLAGS $SYMBOLS" + H5_FCFLAGS="$H5_FCFLAGS $SYMBOLS" + SYMBOLS="custom ($SYMBOLS)" + AC_MSG_RESULT([$SYMBOLS]) ;; - X-no|X-none) +esac + +## ---------------------------------------------------------------------- +## Check if the assert macro should be enabled +## +AC_MSG_CHECKING([enable asserts]) +AC_ARG_ENABLE([asserts], + [AS_HELP_STRING([--enable-asserts], + [Determines whether NDEBUG is defined or not, which + controls assertions. + This is independent of the build mode and presence + of debugging symbols. + [default=yes if debug build, otherwise no] + ])], + [ASSERTS=$enableval]) + +## Set default +if test "X-$ASSERTS" = X- ; then + if test "X-$BUILD_MODE" = "X-debug" ; then + ASSERTS=yes + else + ASSERTS=no + fi +fi + +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([ASSERTS]) + +case "X-$ASSERTS" in + X-yes) + H5_CPPFLAGS="$H5_CPPFLAGS -UNDEBUG" + AC_MSG_RESULT([yes]) + ;; + X-no) + H5_CPPFLAGS="$H5_CPPFLAGS -DNDEBUG" + AC_MSG_RESULT([no]) + ;; + *) + AC_MSG_ERROR([Unrecognized value: $ASSERTS]) + ;; +esac + +## ---------------------------------------------------------------------- +## Check if the compiler should use profiling flags/settings +## +AC_MSG_CHECKING([profiling]) +AC_ARG_ENABLE([profiling], + [AS_HELP_STRING([--enable-profiling=(yes|no|)], + [Enable profiling flags (e.g.: -pg). + This can be set independently from the build mode. + The custom setting can be used to pass alternative + profiling flags (e.g.: -P for using Prof with gcc). + [default=no] + ])], + [PROFILING=$enableval]) + +## Default is no profiling +if test "X-$PROFILING" = X- ; then + PROFILING=no +fi + +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([PROFILING]) + +case "X-$PROFILING" in + X-yes) + H5_CFLAGS="$H5_CFLAGS $PROFILE_CFLAGS" + H5_CXXFLAGS="$H5_CXXFLAGS $PROFILE_CXXFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $PROFILE_FCFLAGS" + AC_MSG_RESULT([yes]) + ;; + X-no) + AC_MSG_RESULT([no]) + ;; + *) + H5_CFLAGS="$H5_CFLAGS $PROFILING" + H5_CXXFLAGS="$H5_CXXFLAGS $PROFILING" + H5_FCFLAGS="$H5_FCFLAGS $PROFILING" + PROFILING="custom ($PROFILING)" + AC_MSG_RESULT([$PROFILING]) + ;; +esac + +## ---------------------------------------------------------------------- +## Check if the compiler should use a particular optimization setting +## +AC_MSG_CHECKING([optimization level]) +AC_ARG_ENABLE([optimization], + [AS_HELP_STRING([--enable-optimization=(high|debug|none|)], + [Enable optimization flags/settings (e.g.: -O3). + This can be set independently from the build mode. + Optimizations for a given compiler can be specified + at several levels: High, with aggressive optimizations + turned on; debug, with optimizations that are + unlikely to interfere with debugging or profiling; + and none, with no optimizations at all. + See the compiler-specific config/*-flags file for more + details. + Alternatively, optimization options can + be specified directly by specifying them as a + string value. These custom optimzation flags will + completely replace all other optimization flags. + [default depends on build mode: debug=debug, + production=high, clean=none] + ])], + [OPTIMIZATION=$enableval]) + +## Set the default optimization level. This depends on the compiler mode. +if test "X-$OPTIMIZATION" = X- ; then + case "X-$BUILD_MODE" in + X-debug) + OPTIMIZATION=debug + ;; + X-production) + OPTIMIZATION=high + ;; + X-clean) + OPTIMIZATION=none + ;; + esac +fi + +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([OPTIMIZATION]) + +case "X-$OPTIMIZATION" in + X-high) + H5_CFLAGS="$H5_CFLAGS $HIGH_OPT_CFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $HIGH_OPT_FCFLAGS" + AC_MSG_RESULT([high]) + ;; + X-debug) + H5_CFLAGS="$H5_CFLAGS $DEBUG_OPT_CFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $DEBUG_OPT_FCFLAGS" + AC_MSG_RESULT([debug]) + ;; + X-none) + H5_CFLAGS="$H5_CFLAGS $NO_OPT_CFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $NO_OPT_FCFLAGS" AC_MSG_RESULT([none]) - DEBUG_PKG= -## H5_CPPFLAGS="$H5_CPPFLAGS -DNDEBUG" ;; *) - AC_MSG_RESULT([$DEBUG_PKG]) + H5_CFLAGS="$H5_CFLAGS $OPTIMIZATION" + H5_FCFLAGS="$H5_FCFLAGS $OPTIMIZATION" + OPTIMIZATION="custom ($OPTIMIZATION)" + AC_MSG_RESULT([$OPTIMIZATION]) + ;; +esac + +## ---------------------------------------------------------------------- +## Enable/disable internal package-level debugging output +## +AC_MSG_CHECKING([for internal debug output]) +AC_ARG_ENABLE([internal-debug], + [AS_HELP_STRING([--enable-internal-debug=(yes|all|no|none|)], + [Enable extra debugging output on HDF5 library + errors. One may also specify a comma-separated + list of package names without the leading H5. + This is independent of the build mode + and is mainly of interest to HDF Group developers. + Yes/all and no/none are synonymous. + [default=all if debug build, otherwise none] + ])], + [INTERNAL_DEBUG_OUTPUT=$enableval]) + +## Set default +if test "X-$INTERNAL_DEBUG_OUTPUT" = X- ; then + if test "X-$BUILD_MODE" = "X-debug" ; then + INTERNAL_DEBUG_OUTPUT=all + else + INTERNAL_DEBUG_OUTPUT=none + fi +fi + +AC_SUBST([INTERNAL_DEBUG_OUTPUT]) + +## These are all the packages that use H5*_DEBUG. +## There is no harm in specifying a package not in this list; +## you'll just get an unused H5_DEBUG symbol. +## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z" +all_packages="AC,B,B2,D,F,HL,I,O,S,ST,T,Z" + +case "X-$INTERNAL_DEBUG_OUTPUT" in + X-yes|X-all) + INTERNAL_DEBUG_OUTPUT=$all_packages + DEBUG_PKG_LIST=$all_packages + ;; + X-no|X-none) + INTERNAL_DEBUG_OUTPUT=none + DEBUG_PKG_LIST= + ;; + *) + DEBUG_PKG_LIST=$INTERNAL_DEBUG_OUTPUT ;; esac +AC_MSG_RESULT([$INTERNAL_DEBUG_OUTPUT]) -if test -n "$DEBUG_PKG"; then - for pkg in `echo $DEBUG_PKG | ${TR} ${as_cr_letters}"," ${as_cr_LETTERS}" "`; do +## Define H5*_DEBUG symbols that control package output +## NOTE: No sanity checking done here! +if test -n "$DEBUG_PKG_LIST"; then + for pkg in `echo $DEBUG_PKG_LIST | ${TR} ${as_cr_letters}"," ${as_cr_LETTERS}" "`; do H5_CPPFLAGS="$H5_CPPFLAGS -DH5${pkg}_DEBUG" done fi @@ -1897,20 +2157,32 @@ fi AC_MSG_CHECKING([whether function stack tracking is enabled]) AC_ARG_ENABLE([codestack], [AS_HELP_STRING([--enable-codestack], - [Enable the function stack tracing (for developer debugging).])], + [Enable the function stack tracing (for developer debugging). + [default=no] + ])], [CODESTACK=$enableval]) +## Set the default level. +if test "X-$CODESTACK" = X- ; then + CODESTACK=no +fi + +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([CODESTACK]) + case "X-$CODESTACK" in X-yes) - CODESTACK=yes AC_MSG_RESULT([yes]) AC_DEFINE([HAVE_CODESTACK], [1], [Define if the function stack tracing code is to be compiled in]) ;; - *) - CODESTACK=no + X-no) AC_MSG_RESULT([no]) ;; + *) + AC_MSG_ERROR([Unrecognized value: $CODESTACK]) + ;; esac ## ---------------------------------------------------------------------- @@ -1919,87 +2191,69 @@ esac AC_MSG_CHECKING([whether metadata trace file code is enabled]) AC_ARG_ENABLE([metadata-trace-file], [AS_HELP_STRING([--enable-metadata-trace-file], - [Enable metadata trace file collection.])], + [Enable metadata trace file collection. + [default=no] + ])], [METADATATRACEFILE=$enableval]) +## Set the default level. +if test "X-$METADATATRACEFILE" = X- ; then + METADATATRACEFILE=no +fi + +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([METADATATRACEFILE]) + case "X-$METADATATRACEFILE" in X-yes) - METADATATRACEFILE=yes AC_MSG_RESULT([yes]) AC_DEFINE([METADATA_TRACE_FILE], [1], [Define if the metadata trace file code is to be compiled in]) ;; - *) - METADATATRACEFILE=no + X-no) AC_MSG_RESULT([no]) ;; + *) + AC_MSG_ERROR([Unrecognized value: $METADATATRACEFILE]) + ;; esac ## ---------------------------------------------------------------------- ## Enable tracing of the API -## This must come after the enable-debug since it depends on debug. ## -AC_SUBST([TRACE_API]) AC_MSG_CHECKING([for API tracing]); AC_ARG_ENABLE([trace], [AS_HELP_STRING([--enable-trace], - [Enable API tracing capability. Default=no - if debug is disabled.])], - [TRACE=$enableval]) - -## Default to no if debug is disabled -if test "X-$TRACE" = X- ; then - if test -z "$DEBUG_PKG" ; then - TRACE=no + [Enable HDF5 API tracing capability. + [default=yes if debug build, otherwise no] + ])], + [TRACE_API=$enableval]) + +## Set the default level. +if test "X-$TRACE_API" = X- ; then + if test "X-$BUILD_MODE" = "X-debug" ; then + TRACE_API=yes else - TRACE=yes + TRACE_API=no fi fi -case "X-$TRACE" in +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([TRACE_API]) + +case "X-$TRACE_API" in X-yes) AC_MSG_RESULT([yes]) - TRACE_API=yes H5_CPPFLAGS="$H5_CPPFLAGS -DH5_DEBUG_API" ;; - X-no|*) + X-no) AC_MSG_RESULT([no]) - TRACE_API=no H5_CPPFLAGS="$H5_CPPFLAGS -UH5_DEBUG_API" ;; -esac - -## ---------------------------------------------------------------------- -## Enable instrumenting of the library's internal operations -## This must come after the enable-debug since it depends on debug. -## -AC_SUBST([INSTRUMENT_LIBRARY]) -AC_MSG_CHECKING([for instrumented library]); -AC_ARG_ENABLE([instrument], - [AS_HELP_STRING([--enable-instrument], - [Enable library instrumentation of optimization - tracing. Default=no if debug is disabled.])], - [INSTRUMENT=$enableval]) - -## Default to no if debug is disabled -if test "X-$INSTRUMENT" = X- ; then - if test -z "$DEBUG_PKG" ; then - INSTRUMENT=no - else - INSTRUMENT=yes - fi -fi - -case "X-$INSTRUMENT" in - X-yes) - AC_MSG_RESULT([yes]) - INSTRUMENT_LIBRARY=yes - AC_DEFINE([HAVE_INSTRUMENTED_LIBRARY], [1], - [Define if library will contain instrumentation to detect correct optimization operation]) - ;; - X-no|*) - AC_MSG_RESULT([no]) - INSTRUMENT_LIBRARY=no + *) + AC_MSG_ERROR([Unrecognized value: $TRACE_API]) ;; esac @@ -2009,40 +2263,49 @@ esac ## more scrupulous with it's memory operations. Enabling this also ## disables the library's free space manager code. ## -AC_SUBST([USINGMEMCHECKER]) AC_MSG_CHECKING([whether a memory checking tool will be used]) AC_ARG_ENABLE([using-memchecker], [AS_HELP_STRING([--enable-using-memchecker], [Enable this option if a memory allocation and/or bounds checking tool will be used on the HDF5 library. Enabling this causes the library to be - more picky about it's memory operations and also + more picky about its memory operations and also disables the library's free space manager code. This option is orthogonal to the --enable-memory-alloc-sanity-check option. - Default=no.])], + [default=no] + ])], [USINGMEMCHECKER=$enableval]) +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([USINGMEMCHECKER]) + +## Set the default level. +if test "X-$USINGMEMCHECKER" = X- ; then + USINGMEMCHECKER=no +fi + case "X-$USINGMEMCHECKER" in X-yes) - USINGMEMCHECKER=yes - AC_MSG_RESULT([yes]) AC_DEFINE([USING_MEMCHECKER], [1], [Define if a memory checking tool will be used on the library, to cause library to be very picky about memory operations and also disable the internal free list manager code.]) + AC_MSG_RESULT([yes]) ;; - *) - USINGMEMCHECKER=no + X-no) AC_MSG_RESULT([no]) ;; + *) + AC_MSG_ERROR([Unrecognized value: $USINGMEMCHECKER]) + ;; esac ## ---------------------------------------------------------------------- ## Check if they would like to enable the internal memory allocation sanity ## checking code. ## -AC_SUBST([MEMORYALLOCSANITYCHECK]) AC_MSG_CHECKING([whether internal memory allocation sanity checking is used]) AC_ARG_ENABLE([memory-alloc-sanity-check], [AS_HELP_STRING([--enable-memory-alloc-sanity-check], @@ -2051,20 +2314,35 @@ AC_ARG_ENABLE([memory-alloc-sanity-check], more memory use and somewhat slower allocation. This option is orthogonal to the --enable-using-memchecker option. - Default=no.])], + [default=yes if debug build, otherwise no] + ])], [MEMORYALLOCSANITYCHECK=$enableval]) +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([MEMORYALLOCSANITYCHECK]) + +## Set default +if test "X-$MEMORYALLOCSANITYCHECK" = X- ; then + if test "X-$BUILD_MODE" = "X-debug" ; then + MEMORYALLOCSANITYCHECK=yes + else + MEMORYALLOCSANITYCHECK=no + fi +fi + case "X-$MEMORYALLOCSANITYCHECK" in X-yes) - MEMORYALLOCSANITYCHECK=yes - AC_MSG_RESULT([yes]) AC_DEFINE([MEMORY_ALLOC_SANITY_CHECK], [1], [Define to enable internal memory allocation sanity checking.]) + AC_MSG_RESULT([yes]) ;; - *) - MEMORYALLOCSANITYCHECK=no + X-no) AC_MSG_RESULT([no]) ;; + *) + AC_MSG_ERROR([Unrecognized value: $MEMORYALLOCSANITYCHECK]) + ;; esac ## Checkpoint the cache @@ -2135,8 +2413,12 @@ esac ## ---------------------------------------------------------------------- ## Print some other parallel information and do some sanity checks. +## Needs to be done outside of the PARALLEL block since the serial +## build also needs to have values defined. ## AC_SUBST([ADD_PARALLEL_FILES]) ADD_PARALLEL_FILES="no" +AC_SUBST([MPE]) MPE=no +AC_SUBST([INSTRUMENT_LIBRARY]) INSTRUMENT_LIBRARY=no if test -n "$PARALLEL"; then ## The 'testpar' directory should participate in the build @@ -2191,6 +2473,45 @@ if test -n "$PARALLEL"; then ) fi + ## ---------------------------------------------------------------------- + ## Enable instrumenting of the library's internal operations + ## in parallel builds. + ## + + ## Set default + if test "X-$BUILD_MODE" = "X-debug" ; then + INSTRUMENT_LIBRARY=yes + else + INSTRUMENT_LIBRARY=no + fi + + AC_MSG_CHECKING([for instrumented library]); + AC_ARG_ENABLE([instrument], + [AS_HELP_STRING([--enable-instrument], + [Enable library instrumentation of optimization + tracing (only used with parallel builds). + [default=yes if a parallel debug build, otherwise no] + ])], + [INSTRUMENT_LIBRARY=$enableval]) + + ## Allow this variable to be substituted in + ## other files (src/libhdf5.settings.in, etc.) + AC_SUBST([INSTRUMENT_LIBRARY]) + + case "X-$INSTRUMENT_LIBRARY" in + X-yes) + AC_DEFINE([HAVE_INSTRUMENTED_LIBRARY], [1], + [Define if parallel library will contain instrumentation to detect correct optimization operation]) + AC_MSG_RESULT([yes]) + ;; + X-no) + AC_MSG_RESULT([no]) + ;; + *) + AC_MSG_ERROR([Unrecognized value: $INSTRUMENT_LIBRARY]) + ;; + esac + ## -------------------------------------------------------------------- ## Do we want MPE instrumentation feature on? ## @@ -2258,6 +2579,11 @@ fi ## ---------------------------------------------------------------------- ## Check if Direct I/O driver is enabled by --enable-direct-vfd ## +AC_SUBST([DIRECT_VFD]) + +## Default is no direct VFD +DIRECT_VFD=no + AC_CACHE_VAL([hdf5_cv_direct_io], AC_CHECK_DECL([O_DIRECT], [hdf5_cv_direct_io=yes], [hdf5_cv_direct_io=no], [[#include ]])) AC_CACHE_VAL([hdf5_cv_posix_memalign], @@ -2290,6 +2616,7 @@ else AC_MSG_RESULT([no]) fi +## Direct VFD files are not built if not required. AM_CONDITIONAL([DIRECT_VFD_CONDITIONAL], [test "X$DIRECT_VFD" = "Xyes"]) ## ---------------------------------------------------------------------- @@ -2684,7 +3011,7 @@ if test -n "$ORGANIZATION"; then CONFIG_USER="$CONFIG_USER at $ORGANIZATION" fi -## Configuration mode (production, development, profile, etc) saved above. +## Configuration mode (production, debug, etc.) saved above. AC_SUBST([CONFIG_MODE]) ## Byte sex from the AC_C_BIGENDIAN macro. @@ -2800,13 +3127,22 @@ AM_CONDITIONAL([BUILD_ALL_CONDITIONAL], [test "X$BUILD_ALL" = "Xyes"]) ## ---------------------------------------------------------------------- ## Enable deprecated public API symbols ## + +## Enabled unless the build mode is clean. +if test "X-$BUILD_MODE" = "X-clean" ; then + DEPREC_SYMBOLS=no +else + DEPREC_SYMBOLS=yes +fi + AC_SUBST([DEPRECATED_SYMBOLS]) AC_MSG_CHECKING([if deprecated public symbols are available]); AC_ARG_ENABLE([deprecated-symbols], [AS_HELP_STRING([--enable-deprecated-symbols], - [Enable deprecated public API symbols [default=yes]])], - [DEPREC_SYMBOLS=$enableval], - [DEPREC_SYMBOLS=yes]) + [Enable deprecated public API symbols. + [default=yes (unless build mode = clean)] + ])], + [DEPREC_SYMBOLS=$enableval]) case "X-$DEPREC_SYMBOLS" in X-yes) @@ -2865,29 +3201,31 @@ AC_SUBST([STRICT_FORMAT_CHECKS]) AC_MSG_CHECKING([whether to perform strict file format checks]); AC_ARG_ENABLE([strict-format-checks], [AS_HELP_STRING([--enable-strict-format-checks], - [Enable strict file format checks, default=yes if - debug flag is enabled, no otherwise])], - [STRICT_CHECKS=$enableval]) - -## Default to yes if debug is enabled -if test "X-$STRICT_CHECKS" = X- ; then - if test -z "$DEBUG_PKG" ; then - STRICT_CHECKS=no + [Enable strict file format checks. + [default=yes if debug build, otherwise no] + ])], + [STRICT_FORMAT_CHECKS=$enableval]) + +## Set the default level. This depends on the compiler mode. +if test "X-$STRICT_FORMAT_CHECKS" = X- ; then + if test "X-$BUILD_MODE" = "X-debug" ; then + STRICT_FORMAT_CHECKS=yes else - STRICT_CHECKS=yes + STRICT_FORMAT_CHECKS=no fi fi -case "X-$STRICT_CHECKS" in +case "X-$STRICT_FORMAT_CHECKS" in X-yes) AC_MSG_RESULT([yes]) - STRICT_FORMAT_CHECKS=yes AC_DEFINE([STRICT_FORMAT_CHECKS], [1], [Define if strict file format checks are enabled]) ;; - X-no|*) + X-no) AC_MSG_RESULT([no]) - STRICT_FORMAT_CHECKS=no + ;; + *) + AC_MSG_ERROR([Unrecognized value: $STRICT_FORMAT_CHECKS]) ;; esac @@ -3039,6 +3377,11 @@ else enable_static=no fi +## Expose things for *.in markup +AC_SUBST([STATIC_SHARED]) +AC_SUBST([enable_shared]) +AC_SUBST([enable_static]) + if test "X$enable_static" = "Xyes" && test "X$enable_shared" = "Xyes"; then STATIC_SHARED="static, shared" elif test "X$enable_static" = "Xyes"; then diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8b90cd5..60f043f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -856,7 +856,7 @@ set_target_properties (${HDF5_LIB_TARGET} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "$/include>" ) -option (HDF5_ENABLE_DEBUG_APIS "Turn on debugging in all packages" OFF) +option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) if (HDF5_ENABLE_DEBUG_APIS) set_target_properties (${HDF5_LIB_TARGET} PROPERTIES COMPILE_DEFINITIONS diff --git a/src/H5.c b/src/H5.c index a522398..4de5731 100644 --- a/src/H5.c +++ b/src/H5.c @@ -552,30 +552,29 @@ done: /*------------------------------------------------------------------------- - * Function: H5_debug_mask + * Function: H5_debug_mask * - * Purpose: Set runtime debugging flags according to the string S. The - * string should contain file numbers and package names - * separated by other characters. A file number applies to all - * following package names up to the next file number. The - * initial file number is `2' (the standard error stream). Each - * package name can be preceded by a `+' or `-' to add or remove - * the package from the debugging list (`+' is the default). The - * special name `all' means all packages. + * Purpose: Set runtime debugging flags according to the string S. The + * string should contain file numbers and package names + * separated by other characters. A file number applies to all + * following package names up to the next file number. The + * initial file number is `2' (the standard error stream). Each + * package name can be preceded by a `+' or `-' to add or remove + * the package from the debugging list (`+' is the default). The + * special name `all' means all packages. * - * The name `trace' indicates that API tracing is to be turned - * on or off. + * The name `trace' indicates that API tracing is to be turned + * on or off. * - * Return: void + * The name 'ttop' indicates that only top-level API calls + * should be shown. This also turns on tracing as if the + * 'trace' word was shown. * - * Programmer: Robb Matzke + * Return: void + * + * Programmer: Robb Matzke * Wednesday, August 19, 1998 * - * Modifications: - * Robb Matzke, 2002-08-08 - * Accepts the `ttop' word. If enabled then show only the - * top level API calls, otherwise show all API calls. Also - * turns on tracing as if the `trace' word was present. *------------------------------------------------------------------------- */ static void @@ -587,55 +586,57 @@ H5_debug_mask(const char *s) hbool_t clear; while (s && *s) { - if (HDisalpha(*s) || '-'==*s || '+'==*s) { - /* Enable or Disable debugging? */ - if ('-'==*s) { - clear = TRUE; - s++; - } else if ('+'==*s) { - clear = FALSE; - s++; - } else { - clear = FALSE; - } - - /* Get the name */ - for (i=0; HDisalpha(*s); i++, s++) - if (i=(size_t)H5_NPKGS) - fprintf(stderr, "HDF5_DEBUG: ignored %s\n", pkg_name); - } - - } else if (HDisdigit(*s)) { - int fd = (int)HDstrtol(s, &rest, 0); - H5_debug_open_stream_t *open_stream; - - if((stream = HDfdopen(fd, "w")) != NULL) { - (void)HDsetvbuf(stream, NULL, _IOLBF, (size_t)0); - - if(NULL == (open_stream = (H5_debug_open_stream_t *)H5MM_malloc(sizeof(H5_debug_open_stream_t)))) { + } else if (!HDstrcmp(pkg_name, "all")) { + for (i=0; i<(size_t)H5_NPKGS; i++) + H5_debug_g.pkg[i].stream = clear ? NULL : stream; + } else { + for (i=0; i<(size_t)H5_NPKGS; i++) { + if (!HDstrcmp(H5_debug_g.pkg[i].name, pkg_name)) { + H5_debug_g.pkg[i].stream = clear ? NULL : stream; + break; + } /* end if */ + } /* end for */ + if (i>=(size_t)H5_NPKGS) + fprintf(stderr, "HDF5_DEBUG: ignored %s\n", pkg_name); + } /* end if-else */ + + } else if (HDisdigit(*s)) { + int fd = (int)HDstrtol(s, &rest, 0); + H5_debug_open_stream_t *open_stream; + + if((stream = HDfdopen(fd, "w")) != NULL) { + (void)HDsetvbuf(stream, NULL, _IOLBF, (size_t)0); + + if(NULL == (open_stream = (H5_debug_open_stream_t *)H5MM_malloc(sizeof(H5_debug_open_stream_t)))) { (void)HDfclose(stream); return; } /* end if */ @@ -644,11 +645,15 @@ H5_debug_mask(const char *s) open_stream->next = H5_debug_g.open_stream; H5_debug_g.open_stream = open_stream; } /* end if */ - s = rest; - } else { - s++; - } - } + + s = rest; + } else { + s++; + } /* end if-else */ + } /* end while */ + + return; + } /* end H5_debug_mask() */ #ifdef H5_HAVE_PARALLEL diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index b0e5628..3bb2936 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -3,40 +3,47 @@ General Information: ------------------- - HDF5 Version: @H5_VERSION@ - Configured on: @CONFIG_DATE@ - Configured by: @CONFIG_USER@ - Configure mode: @CONFIG_MODE@ - Host system: @host_cpu@-@host_vendor@-@host_os@ - Uname information: @UNAME_INFO@ - Byte sex: @BYTESEX@ - Libraries: @STATIC_SHARED@ - Installation point: @prefix@ + HDF5 Version: @H5_VERSION@ + Configured on: @CONFIG_DATE@ + Configured by: @CONFIG_USER@ + Host system: @host_cpu@-@host_vendor@-@host_os@ + Uname information: @UNAME_INFO@ + Byte sex: @BYTESEX@ + Installation point: @prefix@ Compiling Options: ------------------ - Compilation Mode: @CONFIG_MODE@ - C Compiler: @CC_VERSION@ - CFLAGS: @CFLAGS@ - H5_CFLAGS: @H5_CFLAGS@ - AM_CFLAGS: @AM_CFLAGS@ - CPPFLAGS: @CPPFLAGS@ - H5_CPPFLAGS: @H5_CPPFLAGS@ - AM_CPPFLAGS: @AM_CPPFLAGS@ - Shared C Library: @enable_shared@ - Static C Library: @enable_static@ + Build Mode: @BUILD_MODE@ + Debugging Symbols: @SYMBOLS@ + Asserts: @ASSERTS@ + Profiling: @PROFILING@ + Optimization Level: @OPTIMIZATION@ + +Linking Options: +---------------- + Libraries: @STATIC_SHARED@ Statically Linked Executables: @LT_STATIC_EXEC@ LDFLAGS: @LDFLAGS@ H5_LDFLAGS: @H5_LDFLAGS@ AM_LDFLAGS: @AM_LDFLAGS@ - Extra libraries: @LIBS@ - Archiver: @AR@ - Ranlib: @RANLIB@ - Debugged Packages: @DEBUG_PKG@ - API Tracing: @TRACE_API@ + Extra libraries: @LIBS@ + Archiver: @AR@ + Ranlib: @RANLIB@ Languages: ---------- + C: yes + C Compiler: @CC_VERSION@ + CPPFLAGS: @CPPFLAGS@ + H5_CPPFLAGS: @H5_CPPFLAGS@ + AM_CPPFLAGS: @AM_CPPFLAGS@ + C Flags: @CFLAGS@ + H5 C Flags: @H5_CFLAGS@ + AM C Flags: @AM_CFLAGS@ + Shared C Library: @enable_shared@ + Static C Library: @enable_static@ + + Fortran: @HDF_FORTRAN@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Compiler: @FC_VERSION@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Flags: @FCFLAGS@ @@ -56,16 +63,19 @@ Languages: Features: --------- Parallel HDF5: @PARALLEL@ - High Level library: @HDF5_HL@ + High-level library: @HDF5_HL@ Threadsafety: @THREADSAFE@ - Default API Mapping: @DEFAULT_API_VERSION@ - With Deprecated Public Symbols: @DEPRECATED_SYMBOLS@ + Default API mapping: @DEFAULT_API_VERSION@ + With deprecated public symbols: @DEPRECATED_SYMBOLS@ I/O filters (external): @EXTERNAL_FILTERS@ MPE: @MPE@ Direct VFD: @DIRECT_VFD@ dmalloc: @HAVE_DMALLOC@ + Packages w/ extra debug output: @INTERNAL_DEBUG_OUTPUT@ + API tracing: @TRACE_API@ Using memory checker: @USINGMEMCHECKER@ Memory allocation sanity checks: @MEMORYALLOCSANITYCHECK@ - Function Stack Tracing: @CODESTACK@ - Strict File Format Checks: @STRICT_FORMAT_CHECKS@ - Optimization Instrumentation: @INSTRUMENT@ + Metadata trace file: @METADATATRACEFILE@ + Function stack tracing: @CODESTACK@ + Strict file format checks: @STRICT_FORMAT_CHECKS@ + Optimization instrumentation: @INSTRUMENT_LIBRARY@ -- cgit v0.12 From 72bc67f464dfb6f0dbbf6dc985db24d15f01ce8d Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Thu, 28 Jan 2016 11:26:08 -0500 Subject: [svn-r29004] Description: Removed extra ';'. Platform tested jam (very minor) --- c++/src/H5Library.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/c++/src/H5Library.cpp b/c++/src/H5Library.cpp index 40c766a..be80fe4 100644 --- a/c++/src/H5Library.cpp +++ b/c++/src/H5Library.cpp @@ -262,10 +262,10 @@ void H5Library::setFreeListLimits(int reg_global_lim, int reg_list_lim, } // Default constructor - private -H5Library::H5Library(){}; +H5Library::H5Library(){} // Destructor - private -H5Library::~H5Library(){}; +H5Library::~H5Library(){} #ifndef H5_NO_NAMESPACE } // end namespace -- cgit v0.12 From a6da81e49ba88fac85b5a77759b738dfbdc7eb62 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 28 Jan 2016 13:24:01 -0500 Subject: [svn-r29007] Fixed typos in h52gif test. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 serial autotools --- hl/tools/gif2h5/h52giftest.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hl/tools/gif2h5/h52giftest.sh.in b/hl/tools/gif2h5/h52giftest.sh.in index 7aec219..90931f2 100644 --- a/hl/tools/gif2h5/h52giftest.sh.in +++ b/hl/tools/gif2h5/h52giftest.sh.in @@ -77,7 +77,7 @@ TOOLTEST ./h52gif $TESTFILE1 image1.gif -i image echo "" # Negative tests. -echo "**verify the the h52gif tool handle error conditions correctly..." +echo "**verify that the h52gif tool handles error conditions correctly..." # nonexisting dataset name TESTING "./h52gif h52giftst.h5 image.gif -i nosuch_image" TOOLTESTFAIL "./h52gif $TESTFILE1 image.gif -i nosuch_image" -- cgit v0.12 From a969fbf6040707b4d4b099a7b2c19be787908230 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Thu, 28 Jan 2016 13:58:59 -0500 Subject: [svn-r29009] Corrected the API descriptions for H5Pget_virtual_dsetname and H5Pget_virtual_filename. --- src/H5Pdcpl.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 2abd24c..c60e4b0 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -2517,8 +2517,8 @@ done: * * If the length of the filename, which determines the * required value of size, is unknown, a preliminary call to - * H5Pget_virtual_filename with the last two parameters set - * to NULL can be made. The return value of this call will + * H5Pget_virtual_filename with 'name' set to NULL and 'size' + * set to zero can be made. The return value of this call will * be the size in bytes of the filename. That value, plus 1 * for a NULL terminator, is then assigned to size for a * second H5Pget_virtual_filename call, which will retrieve @@ -2578,14 +2578,14 @@ done: * additional characters, if any, are not returned to the * user application. * - * If the length of the filename, which determines the + * If the length of the dataset name, which determines the * required value of size, is unknown, a preliminary call to - * H5Pget_virtual_dsetname with the last two parameters set - * to NULL can be made. The return value of this call will - * be the size in bytes of the filename. That value, plus 1 + * H5Pget_virtual_dsetname with 'name' set to NULL and 'size' + * set to zero can be made. The return value of this call will + * be the size in bytes of the dataset name. That value, plus 1 * for a NULL terminator, is then assigned to size for a * second H5Pget_virtual_dsetname call, which will retrieve - * the actual filename. + * the actual dataset name. * * Return: Returns the length of the name if successful, otherwise * returns a negative value. -- cgit v0.12 From 6dc56e664bfd9d71951842cf006b7a76eb35cc34 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 28 Jan 2016 15:44:11 -0500 Subject: [svn-r29011] LFS changes in the autotools and library. * We assume that fseeko and ftello exist. * The *64 IO functions and types are no longer explicitly used. We now rely on a mapping provided by _FILE_OFFSET_BITS (or its equivalent). * _LARGEFILE(64)_SOURCE is no longer exposed via AM_CPPFLAGS. The CMake files have not yet been updated but CMake is still functional. The CMake configure files will just run a few unecessary tests and create unneeded #defines until they are updated in a few days. Tested on: Linux, OS X, Solaris, z/OS --- configure.ac | 22 ------------------- src/H5FDstdio.c | 21 +++++------------- src/H5private.h | 68 +++++++++++++++------------------------------------------ 3 files changed, 23 insertions(+), 88 deletions(-) diff --git a/configure.ac b/configure.ac index 2f81607..4ab4245 100644 --- a/configure.ac +++ b/configure.ac @@ -1045,10 +1045,6 @@ fi ## case "$host_cpu-$host_vendor-$host_os" in *linux*) - ## Make available various LFS-related routines using the following - ## _LARGEFILE*_SOURCE macros. - AM_CPPFLAGS="-D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE $AM_CPPFLAGS" - ## Add POSIX support on Linux systems, so defines ## __USE_POSIX, which is required to get the prototype for fdopen ## defined correctly in . @@ -1083,23 +1079,6 @@ esac CPPFLAGS="$H5_CPPFLAGS $AM_CPPFLAGS $CPPFLAGS" CFLAGS="$H5_CFLAGS $AM_CFLAGS $CFLAGS" -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -]], - [[off64_t n = 0;]])], - [AC_CHECK_FUNCS([lseek64 fseeko64 ftello64 ftruncate64])], - [AC_MSG_RESULT([skipping test for lseek64, fseeko64 , ftello64, ftruncate64 because off64_t is not defined])]) - -AC_CHECK_FUNCS([fseeko ftello]) - -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#include -#include -]], -[[struct stat64 sb;]])], -[AC_CHECK_FUNCS([stat64 fstat64])], -[AC_MSG_RESULT([skipping test for stat64 and fstat64])]) - ## Checkpoint the cache AC_CACHE_SAVE @@ -1150,7 +1129,6 @@ cat >>confdefs.h <<\EOF #include /*for off_t definition*/ EOF AC_CHECK_SIZEOF([off_t]) -AC_CHECK_SIZEOF([off64_t]) if test "X$C9x" = "Xyes"; then cat >>confdefs.h <<\EOF diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c index d5b3d40..bc85c74 100644 --- a/src/H5FDstdio.c +++ b/src/H5FDstdio.c @@ -126,23 +126,14 @@ typedef struct H5FD_stdio_t { #endif /* H5_HAVE_MINGW */ #endif /* H5_HAVE_WIN32_API */ -/* Use file_xxx to indicate these are local macros, avoiding confusing - * with the global HD_xxx macros. - * Assume fseeko, which is POSIX standard, is always supported; - * but prefer to use fseeko64 if supported. +/* If these functions weren't re-defined for Windows, give them + * more platform-independent names. */ #ifndef file_fseek - #ifdef H5_HAVE_FSEEKO64 - #define file_fseek fseeko64 - #define file_offset_t off64_t - #define file_ftruncate ftruncate64 - #define file_ftell ftello64 - #else - #define file_fseek fseeko - #define file_offset_t off_t - #define file_ftruncate ftruncate - #define file_ftell ftello - #endif /* H5_HAVE_FSEEKO64 */ + #define file_fseek fseeko + #define file_offset_t off_t + #define file_ftruncate ftruncate + #define file_ftell ftello #endif /* file_fseek */ /* These macros check for overflow of various quantities. These macros diff --git a/src/H5private.h b/src/H5private.h index 6a71dc4..4ce6431 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -870,58 +870,31 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #endif /* HDfrexpl */ /* fscanf() variable arguments */ #ifndef HDfseek - #ifdef H5_HAVE_FSEEKO - #define HDfseek(F,O,W) fseeko(F,O,W) - #else /* H5_HAVE_FSEEKO */ - #define HDfseek(F,O,W) fseek(F,O,W) - #endif /* H5_HAVE_FSEEKO */ + #define HDfseek(F,O,W) fseeko(F,O,W) #endif /* HDfseek */ #ifndef HDfsetpos #define HDfsetpos(F,P) fsetpos(F,P) #endif /* HDfsetpos */ -/* definitions related to the file stat utilities. - * For Unix, if off_t is not 64bit big, try use the pseudo-standard - * xxx64 versions if available. - */ -#if !defined(HDfstat) || !defined(HDstat) || !defined(HDlstat) - #if H5_SIZEOF_OFF_T!=8 && H5_SIZEOF_OFF64_T==8 && defined(H5_HAVE_STAT64) - #ifndef HDfstat - #define HDfstat(F,B) fstat64(F,B) - #endif /* HDfstat */ - #ifndef HDlstat - #define HDlstat(S,B) lstat64(S,B) - #endif /* HDlstat */ - #ifndef HDstat - #define HDstat(S,B) stat64(S,B) - #endif /* HDstat */ - typedef struct stat64 h5_stat_t; - typedef off64_t h5_stat_size_t; - #define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF64_T - #else /* H5_SIZEOF_OFF_T!=8 && ... */ - #ifndef HDfstat - #define HDfstat(F,B) fstat(F,B) - #endif /* HDfstat */ - #ifndef HDlstat - #define HDlstat(S,B) lstat(S,B) - #endif /* HDlstat */ - #ifndef HDstat - #define HDstat(S,B) stat(S,B) - #endif /* HDstat */ - typedef struct stat h5_stat_t; - typedef off_t h5_stat_size_t; - #define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T - #endif /* H5_SIZEOF_OFF_T!=8 && ... */ -#endif /* !defined(HDfstat) || !defined(HDstat) */ +#ifndef HDfstat + #define HDfstat(F,B) fstat(F,B) +#endif /* HDfstat */ +#ifndef HDlstat + #define HDlstat(S,B) lstat(S,B) +#endif /* HDlstat */ +#ifndef HDstat + #define HDstat(S,B) stat(S,B) +#endif /* HDstat */ + +typedef struct stat h5_stat_t; +typedef off_t h5_stat_size_t; +#define HDoff_t off_t +#define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T #ifndef HDftell - #define HDftell(F) ftell(F) + #define HDftell(F) ftello(F) #endif /* HDftell */ #ifndef HDftruncate - #ifdef H5_HAVE_FTRUNCATE64 - #define HDftruncate(F,L) ftruncate64(F,L) - #else #define HDftruncate(F,L) ftruncate(F,L) - #endif #endif /* HDftruncate */ #ifndef HDfwrite #define HDfwrite(M,Z,N,F) fwrite(M,Z,N,F) @@ -1064,15 +1037,8 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #ifndef HDlongjmp #define HDlongjmp(J,N) longjmp(J,N) #endif /* HDlongjmp */ -/* HDlseek and HDoff_t must be defined together for consistency. */ #ifndef HDlseek - #ifdef H5_HAVE_LSEEK64 - #define HDlseek(F,O,W) lseek64(F,O,W) - #define HDoff_t off64_t - #else - #define HDlseek(F,O,W) lseek(F,O,W) - #define HDoff_t off_t - #endif + #define HDlseek(F,O,W) lseek(F,O,W) #endif /* HDlseek */ #ifndef HDmalloc #define HDmalloc(Z) malloc(Z) -- cgit v0.12 From 6a566cdc8457eed5c0b80f8e7a82b6efcea51fe7 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 29 Jan 2016 12:57:53 -0500 Subject: [svn-r29019] Fixed double declaration of a few types that only appears on Windows. Tested on: 64-bit Windows 10 with VS 2015 Pro --- src/H5private.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/H5private.h b/src/H5private.h index 4ce6431..c78e72c 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -885,9 +885,15 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #define HDstat(S,B) stat(S,B) #endif /* HDstat */ +#ifndef H5_HAVE_WIN32_API +/* These definitions differ in Windows and are defined in + * H5win32defs for that platform. + */ typedef struct stat h5_stat_t; typedef off_t h5_stat_size_t; -#define HDoff_t off_t +#define HDoff_t off_t +#endif /* H5_HAVE_WIN32_API */ + #define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T #ifndef HDftell -- cgit v0.12 From 2fb4f0b35eab57f136852ba600572874fd7e37bd Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 1 Feb 2016 14:28:38 -0500 Subject: [svn-r29023] Fixed typos in symbols flags that prevented using -g, etc. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 serial autotools --- config/cce-flags | 4 ++-- config/gnu-flags | 4 ++-- config/ibm-flags | 4 ++-- config/intel-flags | 4 ++-- config/pgi-flags | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/config/cce-flags b/config/cce-flags index bdfb5f9..e479363 100644 --- a/config/cce-flags +++ b/config/cce-flags @@ -64,8 +64,8 @@ if test "X-cce" = "X-$cc_vendor"; then DEBUG_CPPFLAGS= # Symbols - SYMBOL_CFLAGS="-g" - SYMBOL_CPPFLAGS= + SYMBOLS_CFLAGS="-g" + SYMBOLS_CPPFLAGS= # Profiling # Use this for profiling with gprof diff --git a/config/gnu-flags b/config/gnu-flags index 232bf05..ecb5859 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -127,8 +127,8 @@ case "$cc_vendor-$cc_version" in DEBUG_CPPFLAGS= # Symbols - SYMBOL_CFLAGS="-g" - SYMBOL_CPPFLAGS= + SYMBOLS_CFLAGS="-g" + SYMBOLS_CPPFLAGS= # Profile PROFILE_CFLAGS="-pg" diff --git a/config/ibm-flags b/config/ibm-flags index 731968d..60a7af9 100644 --- a/config/ibm-flags +++ b/config/ibm-flags @@ -74,8 +74,8 @@ if test "XL" = "$cc_vendor"; then DEBUG_CPPFLAGS= # Symbols - SYMBOL_CFLAGS="-g" - SYMBOL_CPPFLAGS= + SYMBOLS_CFLAGS="-g" + SYMBOLS_CPPFLAGS= # Profiling PROFILE_CFLAGS="-pg" diff --git a/config/intel-flags b/config/intel-flags index a3238fa..060e78a 100644 --- a/config/intel-flags +++ b/config/intel-flags @@ -80,8 +80,8 @@ if test "X-icc" = "X-$cc_vendor"; then DEBUG_CPPFLAGS= # Symbols - SYMBOL_CFLAGS="-g" - SYMBOL_CPPFLAGS= + SYMBOLS_CFLAGS="-g" + SYMBOLS_CPPFLAGS= # Profiling # Use this for profiling with gprof diff --git a/config/pgi-flags b/config/pgi-flags index 674f60e..a6dcba3 100644 --- a/config/pgi-flags +++ b/config/pgi-flags @@ -90,8 +90,8 @@ if test "X-pgcc" = "X-$cc_vendor"; then DEBUG_CPPFLAGS= # Symbols - SYMBOL_CFLAGS="-g" - SYMBOL_CPPFLAGS= + SYMBOLS_CFLAGS="-g" + SYMBOLS_CPPFLAGS= # Profiling PROFILE_CFLAGS="-Mprof=func,line" -- cgit v0.12 From e25aa5f97d7605efb07b303eeba10d4a8a34485d Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 2 Feb 2016 05:30:48 -0500 Subject: [svn-r29030] Cleanup of test/externals before merging user patch. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 serial autotools --- src/H5private.h | 4 +- test/external.c | 1134 +++++++++++++++++++++++++++++-------------------------- 2 files changed, 596 insertions(+), 542 deletions(-) diff --git a/src/H5private.h b/src/H5private.h index c78e72c..74763a5 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1255,7 +1255,9 @@ typedef off_t h5_stat_size_t; #ifndef HDsnprintf #define HDsnprintf snprintf /*varargs*/ #endif /* HDsnprintf */ -/* sprintf() variable arguments */ +#ifndef HDsprintf + #define HDsprintf sprintf /*varargs*/ +#endif /* HDsprintf */ #ifndef HDsqrt #define HDsqrt(X) sqrt(X) #endif /* HDsqrt */ diff --git a/test/external.c b/test/external.c index cbc9fc6..5492d37 100644 --- a/test/external.c +++ b/test/external.c @@ -29,879 +29,918 @@ const char *FILENAME[] = { "extern_1", "extern_2", "extern_3", - "extern_4", + "extern_4", /* Remove when links test is moved */ NULL }; /*------------------------------------------------------------------------- - * Function: same_contents + * Function: files_have_same_contents * - * Purpose: Determines whether two files are exactly the same. + * Purpose: Determines whether two files contain the same data. * - * Return: Success: nonzero if same, zero if different. + * Return: Success: nonzero if same, zero if different. + * Failure: zero * - * Failure: zero - * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, March 4, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ -static int -same_contents (const char *name1, const char *name2) +static hbool_t +files_have_same_contents(const char *name1, const char *name2) { - int fd1, fd2; + int fd1 = 0, fd2 = 0; ssize_t n1, n2; char buf1[1024], buf2[1024]; + hbool_t ret = false; /* not equal until proven otherwise */ - fd1 = HDopen(name1, O_RDONLY, 0666); - fd2 = HDopen(name2, O_RDONLY, 0666); - assert(fd1 >= 0 && fd2 >= 0); + if((fd1 = HDopen(name1, O_RDONLY, 0666)) < 0) + goto out; + if((fd2 = HDopen(name2, O_RDONLY, 0666)) < 0) + goto out; + /* Loop until files are empty or we encounter a problem */ while(1) { - /* Asserts will catch negative return values */ + HDmemset(buf1, 0, sizeof(buf1)); + HDmemset(buf2, 0, sizeof(buf2)); + n1 = HDread(fd1, buf1, sizeof(buf1)); + if(n1 < 0 || (size_t)n1 > sizeof(buf1)) + break; n2 = HDread(fd2, buf2, sizeof(buf2)); - assert(n1 >= 0 && (size_t)n1 <= sizeof(buf1)); - assert(n2 >= 0 && (size_t)n2 <= sizeof(buf2)); - assert(n1 == n2); + if(n2 < 0 || (size_t)n2 > sizeof(buf2)) + break; - if(n1 == 0 && n2 == 0) + if(n1 != n2) + break; + + if(n1 == 0 && n2 == 0) { + ret = true; break; - if(HDmemcmp(buf1, buf2, (size_t)n1)) { - HDclose(fd1); - HDclose(fd2); - return 0; } - } - HDclose(fd1); - HDclose(fd2); - return 1; -} + + if(HDmemcmp(buf1, buf2, (size_t)n1)) + break; + + } /* end while */ + +out: + if(fd1) + HDclose(fd1); + if(fd2) + HDclose(fd2); + return ret; +} /* end files_have_same_contents() */ /*------------------------------------------------------------------------- - * Function: test_1a + * Function: test_non_extendible * - * Purpose: Tests a non-extendible dataset with a single external file. + * Purpose: Tests a non-extendible dataset with a single external file. * - * Return: Success: 0 + * Return: Success: 0 + * Failure: 1 * - * Failure: number of errors - * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 23, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -test_1a(hid_t file) +test_non_extendible(hid_t file) { - hid_t dcpl=-1; /*dataset creation properties */ - hid_t space=-1; /*data space */ - hid_t dset=-1; /*dataset */ - hsize_t cur_size[1]; /*data space current size */ - hsize_t max_size[1]; /*data space maximum size */ - int n; /*number of external files */ - char name[256]; /*external file name */ - off_t file_offset; /*external file offset */ - hsize_t file_size; /*sizeof external file segment */ - haddr_t dset_addr; /*address of dataset */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* data space current size */ + hsize_t max_size[1]; /* data space maximum size */ + int n; /* number of external files */ + char name[256]; /* external file name */ + HDoff_t file_offset; /* external file offset */ + hsize_t file_size; /* sizeof external file segment */ + haddr_t dset_addr; /* address of dataset */ TESTING("fixed-size data space, exact storage"); /* Create the dataset */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR cur_size[0] = max_size[0] = 100; - if(H5Pset_external(dcpl, "ext1.data", (off_t)0, - (hsize_t)(max_size[0] * sizeof(int))) < 0) goto error; - if((space = H5Screate_simple(1, cur_size, max_size)) < 0) goto error; + if(H5Pset_external(dcpl, "ext1.data", (HDoff_t)0, (hsize_t)(max_size[0] * sizeof(int))) < 0) + FAIL_STACK_ERROR + if((space = H5Screate_simple(1, cur_size, max_size)) < 0) + FAIL_STACK_ERROR if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; - if(H5Dclose(dset) < 0) goto error; - if(H5Sclose(space) < 0) goto error; - if(H5Pclose(dcpl) < 0) goto error; + FAIL_STACK_ERROR + if(H5Dclose(dset) < 0) + FAIL_STACK_ERROR + if(H5Sclose(space) < 0) + FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) + FAIL_STACK_ERROR /* Read dataset creation information */ - if((dset = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0) goto error; + if((dset = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR /* Test dataset address. Should be undefined. */ H5E_BEGIN_TRY { dset_addr = H5Dget_offset(dset); } H5E_END_TRY; - if(dset_addr != HADDR_UNDEF) goto error; - - if((dcpl = H5Dget_create_plist(dset)) < 0) goto error; - if((n = H5Pget_external_count(dcpl)) < 0) goto error; + if(dset_addr != HADDR_UNDEF) + FAIL_STACK_ERROR + + /* Check external count */ + if((dcpl = H5Dget_create_plist(dset)) < 0) + FAIL_STACK_ERROR + if((n = H5Pget_external_count(dcpl)) < 0) + FAIL_STACK_ERROR if(1 != n) { - H5_FAILED(); - puts(" Returned external count is wrong."); - printf(" got: %d\n ans: 1\n", n); - goto error; - } + H5_FAILED(); + HDputs(" Returned external count is wrong."); + printf(" got: %d\n ans: 1\n", n); + goto error; + } /* end if */ + HDstrcpy(name + sizeof(name) - 4, "..."); - if(H5Pget_external(dcpl, 0, sizeof(name) - 4, name, &file_offset, - &file_size) < 0) goto error; + if(H5Pget_external(dcpl, 0, sizeof(name) - 4, name, &file_offset, &file_size) < 0) + FAIL_STACK_ERROR + + /* Check file offset */ if(file_offset != 0) { - H5_FAILED(); - puts(" Wrong file offset."); - printf(" got: %lu\n ans: 0\n", (unsigned long)file_offset); - goto error; - } + H5_FAILED(); + HDputs(" Wrong file offset."); + printf(" got: %lu\n ans: 0\n", (unsigned long)file_offset); + goto error; + } /* end if */ + + /* Check file size */ if(file_size != (max_size[0] * sizeof(int))) { - H5_FAILED(); - puts(" Wrong file size."); - printf(" got: %lu\n ans: %lu\n", (unsigned long)file_size, - (unsigned long)max_size[0]*sizeof(int)); - goto error; - } - if (H5Pclose (dcpl) < 0) goto error; - if (H5Dclose (dset) < 0) goto error; + H5_FAILED(); + HDputs(" Wrong file size."); + printf(" got: %lu\n ans: %lu\n", (unsigned long)file_size, (unsigned long)max_size[0]*sizeof(int)); + goto error; + } /* end if */ + + /* Done (dataspace was previously closed) */ + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR + if(H5Dclose(dset) < 0) FAIL_STACK_ERROR PASSED(); return 0; + error: H5E_BEGIN_TRY { - H5Pclose(dcpl); - H5Sclose(space); - H5Dclose(dset); + H5Pclose(dcpl); + H5Sclose(space); + H5Dclose(dset); } H5E_END_TRY; return 1; -} +} /* end test_non_extendible() */ /*------------------------------------------------------------------------- - * Function: test_1b - * - * Purpose: Test a single external file which is too small to represent - * all the data. + * Function: test_too_small * - * Return: Success: 0 + * Purpose: Test a single external file which is too small to represent + * all the data. * - * Failure: number of errors + * Return: Success: 0 + * Failure: 1 * * Programmer: Robb Matzke * Monday, November 23, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -test_1b(hid_t file) +test_too_small(hid_t file) { - hid_t dcpl = -1; /*dataset creation properties */ - hid_t space = -1; /*data space */ - hid_t dset = -1; /*dataset */ - hsize_t cur_size[1]; /*current data space size */ - hsize_t max_size[1]; /*maximum data space size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* current data space size */ + hsize_t max_size[1]; /* maximum data space size */ TESTING("external storage is too small"); - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR cur_size[0] = max_size[0] = 100; - if(H5Pset_external(dcpl, "ext1.data", (off_t)0, - (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) goto error; - if((space = H5Screate_simple(1, cur_size, max_size)) < 0) goto error; + if(H5Pset_external(dcpl, "ext1.data", (HDoff_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) + FAIL_STACK_ERROR + if((space = H5Screate_simple(1, cur_size, max_size)) < 0) + FAIL_STACK_ERROR + H5E_BEGIN_TRY { - dset = H5Dcreate2(file, "dset2", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); + dset = H5Dcreate2(file, "dset2", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); } H5E_END_TRY; - if(dset >= 0) { - H5_FAILED(); - puts(" Small external file succeeded instead of failing."); - goto error; - } - if(H5Sclose(space) < 0) goto error; - if(H5Pclose(dcpl) < 0) goto error; + if(dset >= 0) + FAIL_PUTS_ERROR(" Small external file succeeded instead of failing."); + if(H5Sclose(space) < 0) + FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) + FAIL_STACK_ERROR PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Sclose(space); - H5Pclose(dcpl); - H5Dclose(dset); + H5Sclose(space); + H5Pclose(dcpl); + H5Dclose(dset); } H5E_END_TRY; return 1; -} +} /* end test_too_small() */ /*------------------------------------------------------------------------- - * Function: test_1c + * Function: test_large_enough_current_eventual * - * Purpose: Test a single external file which is large enough to - * represent the current data and large enough to represent the - * eventual size of the data. + * Purpose: Test a single external file which is large enough to + * represent the current data and large enough to represent the + * eventual size of the data. * - * Return: Success: 0 - * - * Failure: number of errors + * Return: Success: 0 + * Failure: 1 * * Programmer: Robb Matzke * Monday, November 23, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -test_1c(hid_t file) +test_large_enough_current_eventual(hid_t file) { - hid_t dcpl=-1; /*dataset creation properties */ - hid_t space=-1; /*data space */ - hid_t dset=-1; /*dataset */ - hsize_t cur_size[1]; /*current data space size */ - hsize_t max_size[1]; /*maximum data space size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* current data space size */ + hsize_t max_size[1]; /* maximum data space size */ TESTING("extendible dataspace, exact external size"); - if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0) goto error; + if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR cur_size[0] = 100; max_size[0] = 200; - if(H5Pset_external(dcpl, "ext1.data", (off_t)0, - (hsize_t)(max_size[0] * sizeof(int))) < 0) goto error; - if((space = H5Screate_simple(1, cur_size, max_size)) < 0) goto error; + if(H5Pset_external(dcpl, "ext1.data", (HDoff_t)0, (hsize_t)(max_size[0] * sizeof(int))) < 0) + FAIL_STACK_ERROR + if((space = H5Screate_simple(1, cur_size, max_size)) < 0) + FAIL_STACK_ERROR if((dset = H5Dcreate2(file, "dset3", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; - if(H5Dclose(dset) < 0) goto error; - if(H5Sclose(space) < 0) goto error; - if(H5Pclose(dcpl) < 0) goto error; + FAIL_STACK_ERROR + + if(H5Dclose(dset) < 0) FAIL_STACK_ERROR + if(H5Sclose(space) < 0) FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Dclose(dset); - H5Pclose(dcpl); - H5Sclose(space); + H5Dclose(dset); + H5Pclose(dcpl); + H5Sclose(space); } H5E_END_TRY; return 1; -} +} /* end test_large_enough_current_eventual() */ /*------------------------------------------------------------------------- - * Function: test_1d - * - * Purpose: Test a single external file which is large enough for the - * current data size but not large enough for the eventual size. + * Function: test_large_enough_current_not_eventual * - * Return: Success: 0 + * Purpose: Test a single external file which is large enough for the + * current data size but not large enough for the eventual size. * - * Failure: number of errors + * Return: Success: 0 + * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 23, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -test_1d(hid_t file) +test_large_enough_current_not_eventual(hid_t file) { - hid_t dcpl=-1; /*dataset creation properties */ - hid_t space=-1; /*data space */ - hid_t dset=-1; /*dataset */ - hsize_t cur_size[1]; /*current data space size */ - hsize_t max_size[1]; /*maximum data space size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* current data space size */ + hsize_t max_size[1]; /* maximum data space size */ TESTING("extendible dataspace, external storage is too small"); - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR cur_size[0] = 100; max_size[0] = 200; - if(H5Pset_external(dcpl, "ext1.data", (off_t)0, - (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) goto error; - if((space = H5Screate_simple(1, cur_size, max_size)) < 0) goto error; + if(H5Pset_external(dcpl, "ext1.data", (HDoff_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) + FAIL_STACK_ERROR + if((space = H5Screate_simple(1, cur_size, max_size)) < 0) + FAIL_STACK_ERROR + H5E_BEGIN_TRY { - dset = H5Dcreate2(file, "dset4", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); + dset = H5Dcreate2(file, "dset4", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT); } H5E_END_TRY; - if(dset >= 0) { - H5_FAILED(); - puts(" Small external file succeeded instead of failing."); - goto error; - } - if(H5Sclose(space) < 0) goto error; - if(H5Pclose(dcpl) < 0) goto error; + if(dset >= 0) + FAIL_PUTS_ERROR(" Small external file succeeded instead of failing."); + + if(H5Sclose(space) < 0) FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Dclose(dset); - H5Pclose(dcpl); - H5Sclose(space); + H5Dclose(dset); + H5Pclose(dcpl); + H5Sclose(space); } H5E_END_TRY; return 1; -} +} /* end test_large_enough_current_not_eventual() */ /*------------------------------------------------------------------------- - * Function: test_1e - * - * Purpose: Test a single external file of unlimited size and an - * unlimited data space. + * Function: test_1e * - * Return: Success: 0 + * Purpose: Test a single external file of unlimited size and an + * unlimited data space. * - * Failure: number of errors + * Return: Success: 0 + * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 23, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -test_1e(hid_t file) +test_unlimited(hid_t file) { - hid_t dcpl=-1; /*dataset creation properties */ - hid_t space=-1; /*data space */ - hid_t dset=-1; /*dataset */ - hsize_t cur_size[1]; /*data space current size */ - hsize_t max_size[1]; /*data space maximum size */ - int n; /*number of external files */ - char name[256]; /*external file name */ - off_t file_offset; /*external file offset */ - hsize_t file_size; /*sizeof external file segment */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* data space current size */ + hsize_t max_size[1]; /* data space maximum size */ + int n; /* number of external files */ + char name[256]; /* external file name */ + HDoff_t file_offset; /* external file offset */ + hsize_t file_size; /* sizeof external file segment */ TESTING("unlimited dataspace, unlimited external storage"); /* Create dataset */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if(H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0) goto error; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR + if(H5Pset_external(dcpl, "ext1.data", (HDoff_t)0, H5F_UNLIMITED) < 0) + FAIL_STACK_ERROR cur_size[0] = 100; max_size[0] = H5S_UNLIMITED; - if((space = H5Screate_simple(1, cur_size, max_size)) < 0) goto error; + if((space = H5Screate_simple(1, cur_size, max_size)) < 0) + FAIL_STACK_ERROR if((dset = H5Dcreate2(file, "dset5", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; - if(H5Dclose(dset) < 0) goto error; - if(H5Sclose(space) < 0) goto error; - if(H5Pclose(dcpl) < 0) goto error; + FAIL_STACK_ERROR + + if(H5Dclose(dset) < 0) FAIL_STACK_ERROR + if(H5Sclose(space) < 0) FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR /* Read dataset creation information */ - if((dset = H5Dopen2(file, "dset5", H5P_DEFAULT)) < 0) goto error; - if((dcpl = H5Dget_create_plist(dset)) < 0) goto error; - if((n = H5Pget_external_count(dcpl)) < 0) goto error; + if((dset = H5Dopen2(file, "dset5", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if((dcpl = H5Dget_create_plist(dset)) < 0) + FAIL_STACK_ERROR + if((n = H5Pget_external_count(dcpl)) < 0) + FAIL_STACK_ERROR if(1 != n) { - H5_FAILED(); - puts(" Returned external count is wrong."); - printf(" got: %d\n ans: 1\n", n); - goto error; - } + H5_FAILED(); + HDputs(" Returned external count is wrong."); + printf(" got: %d\n ans: 1\n", n); + goto error; + } /* end if */ + HDstrcpy(name + sizeof(name) - 4, "..."); - if(H5Pget_external(dcpl, 0, sizeof(name) - 4, name, &file_offset, - &file_size) < 0) goto error; + if(H5Pget_external(dcpl, 0, sizeof(name) - 4, name, &file_offset, &file_size) < 0) + FAIL_STACK_ERROR if(file_offset != 0) { - H5_FAILED(); - puts(" Wrong file offset."); - printf(" got: %lu\n ans: 0\n", (unsigned long)file_offset); - goto error; - } + H5_FAILED(); + HDputs(" Wrong file offset."); + printf(" got: %lu\n ans: 0\n", (unsigned long)file_offset); + goto error; + } /* end if */ + if(H5F_UNLIMITED != file_size) { - H5_FAILED(); - puts(" Wrong file size."); - printf(" got: %lu\n ans: INF\n", (unsigned long)file_size); - goto error; - } - if(H5Pclose(dcpl) < 0) goto error; - if(H5Dclose(dset) < 0) goto error; + H5_FAILED(); + HDputs(" Wrong file size."); + printf(" got: %lu\n ans: INF\n", (unsigned long)file_size); + goto error; + } /* end if */ + + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR + if(H5Dclose(dset) < 0) FAIL_STACK_ERROR PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Dclose(dset); - H5Pclose(dcpl); - H5Sclose(space); + H5Dclose(dset); + H5Pclose(dcpl); + H5Sclose(space); } H5E_END_TRY; return 1; -} +} /* end test_unlimited() */ /*------------------------------------------------------------------------- - * Function: test_1f - * - * Purpose: Test multiple external files for a dataset. + * Function: test_multiple_files * - * Return: Success: 0 + * Purpose: Test multiple external files for a dataset. * - * Failure: number of errors + * Return: Success: 0 + * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 23, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -test_1f(hid_t file) +test_multiple_files(hid_t file) { - hid_t dcpl=-1; /*dataset creation properties */ - hid_t space=-1; /*data space */ - hid_t dset=-1; /*dataset */ - hsize_t cur_size[1]; /*data space current size */ - hsize_t max_size[1]; /*data space maximum size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* dataspace */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* data space current size */ + hsize_t max_size[1]; /* data space maximum size */ TESTING("multiple external files"); - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR + cur_size[0] = max_size[0] = 100; - if(H5Pset_external(dcpl, "ext1.data", (off_t)0, - (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) goto error; - if(H5Pset_external(dcpl, "ext2.data", (off_t)0, - (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) goto error; - if(H5Pset_external(dcpl, "ext3.data", (off_t)0, - (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) goto error; - if(H5Pset_external(dcpl, "ext4.data", (off_t)0, - (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) goto error; - if((space = H5Screate_simple(1, cur_size, max_size)) < 0) goto error; + + if(H5Pset_external(dcpl, "ext1.data", (HDoff_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) + FAIL_STACK_ERROR + if(H5Pset_external(dcpl, "ext2.data", (HDoff_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) + FAIL_STACK_ERROR + if(H5Pset_external(dcpl, "ext3.data", (HDoff_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) + FAIL_STACK_ERROR + if(H5Pset_external(dcpl, "ext4.data", (HDoff_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) + FAIL_STACK_ERROR + if((space = H5Screate_simple(1, cur_size, max_size)) < 0) + FAIL_STACK_ERROR if((dset = H5Dcreate2(file, "dset6", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) - goto error; - if(H5Dclose(dset) < 0) goto error; - if(H5Sclose(space) < 0) goto error; - if(H5Pclose(dcpl) < 0) goto error; + FAIL_STACK_ERROR + + if(H5Dclose(dset) < 0) FAIL_STACK_ERROR + if(H5Sclose(space) < 0) FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Dclose(dset); - H5Pclose(dcpl); - H5Sclose(space); + H5Dclose(dset); + H5Pclose(dcpl); + H5Sclose(space); } H5E_END_TRY; return 1; -} +} /* end test_multiple_files() */ /*------------------------------------------------------------------------- - * Function: test_1g - * - * Purpose: It should be impossible to define an unlimited external file - * and then follow it with another external file. + * Function: test_add_to_unlimited * - * Return: Success: 0 + * Purpose: It should be impossible to define an unlimited external file + * and then follow it with another external file. * - * Failure: number of errors + * Return: Success: 0 + * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 23, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -test_1g(void) +test_add_to_unlimited(void) { - hid_t dcpl=-1; /*dataset creation properties */ - herr_t status; /*function return status */ - int n; /*number of external files */ + hid_t dcpl = -1; /* dataset creation properties */ + herr_t status; /* function return status */ + int n; /* number of external files */ TESTING("external file following unlimited file"); - if ((dcpl=H5Pcreate (H5P_DATASET_CREATE)) < 0) goto error; - if (H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0) goto error; + + if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR + if(H5Pset_external(dcpl, "ext1.data", (HDoff_t)0, H5F_UNLIMITED) < 0) + FAIL_STACK_ERROR + H5E_BEGIN_TRY { - status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100); + status = H5Pset_external(dcpl, "ext2.data", (HDoff_t)0, (hsize_t)100); } H5E_END_TRY; - if (status>=0) { - H5_FAILED(); - puts (" H5Pset_external() succeeded when it should have failed."); - goto error; - } - if ((n = H5Pget_external_count(dcpl)) < 0) goto error; - if (1!=n) { - H5_FAILED(); - puts(" Wrong external file count returned."); - goto error; - } - if (H5Pclose(dcpl) < 0) goto error; + if(status >= 0) + FAIL_PUTS_ERROR(" H5Pset_external() succeeded when it should have failed."); + + if((n = H5Pget_external_count(dcpl)) < 0) + FAIL_STACK_ERROR + if(1 != n) + FAIL_PUTS_ERROR(" Wrong external file count returned."); + + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Pclose(dcpl); + H5Pclose(dcpl); } H5E_END_TRY; return 1; -} +} /* end test_add_to_unlimited() */ /*------------------------------------------------------------------------- - * Function: test_1h - * - * Purpose: It should be impossible to create a set of external files - * whose total size overflows a size_t integer. + * Function: test_overflow * - * Return: Success: 0 + * Purpose: It should be impossible to create a set of external files + * whose total size overflows a size_t integer. * - * Failure: number of errors + * Return: Success: 0 + * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 23, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -test_1h(void) +test_overflow(void) { - hid_t dcpl=-1; /*dataset creation properties */ - herr_t status; /*return status */ + hid_t dcpl = -1; /* dataset creation properties */ + herr_t status; /* return status */ TESTING("address overflow in external files"); - if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if (H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED-1) < 0) goto error; + + if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR + if(H5Pset_external(dcpl, "ext1.data", (HDoff_t)0, H5F_UNLIMITED-1) < 0) + FAIL_STACK_ERROR + H5E_BEGIN_TRY { - status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100); + status = H5Pset_external(dcpl, "ext2.data", (HDoff_t)0, (hsize_t)100); } H5E_END_TRY; - if (status>=0) { - H5_FAILED(); - puts(" H5Pset_external() succeeded when it should have failed."); - goto error; - } - if (H5Pclose(dcpl) < 0) goto error; + if(status >= 0) + FAIL_PUTS_ERROR(" H5Pset_external() succeeded when it should have failed."); + + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR + PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Pclose(dcpl); + H5Pclose(dcpl); } H5E_END_TRY; return 1; -} +} /* end test_overflow() */ /*------------------------------------------------------------------------- - * Function: test_2 - * - * Purpose: Tests reading from an external file set. + * Function: test_read_file_set * - * Return: Success: 0 + * Purpose: Tests reading from an external file set. * - * Failure: number of errors + * Return: Success: 0 + * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, March 4, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -test_2 (hid_t fapl) +test_read_file_set(hid_t fapl) { - hid_t file=-1; /*file to write to */ - hid_t dcpl=-1; /*dataset creation properties */ - hid_t space=-1; /*data space */ - hid_t dset=-1; /*dataset */ - hid_t grp=-1; /*group to emit diagnostics */ - int fd; /*external file descriptors */ - size_t i, j; /*miscellaneous counters */ - hssize_t n; /*bytes of I/O */ - char filename[1024]; /*file names */ - int part[25], whole[100]; /*raw data buffers */ - hsize_t cur_size; /*current data space size */ - hid_t hs_space; /*hyperslab data space */ - hsize_t hs_start = 30; /*hyperslab starting offset */ - hsize_t hs_count = 25; /*hyperslab size */ + hid_t file = -1; /* file to write to */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hid_t grp = -1; /* group to emit diagnostics */ + int fd = -1; /* external file descriptors */ + size_t i, j; /* miscellaneous counters */ + hssize_t n; /* bytes of I/O */ + char filename[1024]; /* file names */ + int part[25], whole[100]; /* raw data buffers */ + hsize_t cur_size; /* current data space size */ + hid_t hs_space; /* hyperslab data space */ + hsize_t hs_start = 30; /* hyperslab starting offset */ + hsize_t hs_count = 25; /* hyperslab size */ int temparray[10] = {0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f}; TESTING("read external dataset"); /* Write the data to external files directly */ - for (i=0; i<4; i++) { - for (j=0; j<25; j++) { - part[j] = (int)(i*25+j); - } - sprintf (filename, "extern_%lua.raw", (unsigned long)i+1); - fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666); - assert (fd>=0); -/* n = lseek (fd, (off_t)(i*10), SEEK_SET); -*/ - n = HDwrite(fd,temparray,(size_t)i*10); - assert (n>=0 && (size_t)n==i*10); - n = HDwrite(fd, part, sizeof(part)); - assert (n==sizeof(part)); - HDclose(fd); - } + for(i=0; i<4; i++) { + for(j=0; j<25; j++) { + part[j] = (int)(i*25+j); + } /* end for */ + HDsprintf(filename, "extern_%lua.raw", (unsigned long)i+1); + if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) + TEST_ERROR + n = HDwrite(fd, temparray, (size_t)i*10); + if(n < 0 || (size_t)n != i*10) + TEST_ERROR + n = HDwrite(fd, part, sizeof(part)); + if(n != sizeof(part)) + TEST_ERROR + HDclose(fd); + } /* end for */ /* * Create the file and an initial group. This causes messages about * debugging to be emitted before we start playing games with what the * output looks like. */ - h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR - if((grp = H5Gcreate2(file, "emit-diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + h5_fixname(FILENAME[1], fapl, filename, sizeof(filename)); + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + FAIL_STACK_ERROR + if((grp = H5Gcreate2(file, "emit-diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR if(H5Gclose(grp) < 0) FAIL_STACK_ERROR /* Create the dataset */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; - if(H5Pset_external(dcpl, "extern_1a.raw", (off_t)0, (hsize_t)sizeof part) < 0 || - H5Pset_external(dcpl, "extern_2a.raw", (off_t)10, (hsize_t)sizeof part) < 0 || - H5Pset_external(dcpl, "extern_3a.raw", (off_t)20, (hsize_t)sizeof part) < 0 || - H5Pset_external(dcpl, "extern_4a.raw", (off_t)30, (hsize_t)sizeof part) < 0) - goto error; + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR + if(H5Pset_external(dcpl, "extern_1a.raw", (HDoff_t)0, (hsize_t)sizeof part) < 0 || + H5Pset_external(dcpl, "extern_2a.raw", (HDoff_t)10, (hsize_t)sizeof part) < 0 || + H5Pset_external(dcpl, "extern_3a.raw", (HDoff_t)20, (hsize_t)sizeof part) < 0 || + H5Pset_external(dcpl, "extern_4a.raw", (HDoff_t)30, (hsize_t)sizeof part) < 0) + FAIL_STACK_ERROR cur_size = 100; - if((space = H5Screate_simple(1, &cur_size, NULL)) < 0) goto error; - if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; + if((space = H5Screate_simple(1, &cur_size, NULL)) < 0) + FAIL_STACK_ERROR + if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR /* * Read the entire dataset and compare with the original */ - memset(whole, 0, sizeof(whole)); - if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0) goto error; - for(i = 0; i < 100; i++) - if(whole[i] != (signed)i) { - H5_FAILED(); - puts(" Incorrect value(s) read."); - goto error; - } /* end if */ - - /* - * Read the middle of the dataset - */ - if((hs_space = H5Scopy(space)) < 0) goto error; - if(H5Sselect_hyperslab(hs_space, H5S_SELECT_SET, &hs_start, NULL, - &hs_count, NULL) < 0) goto error; HDmemset(whole, 0, sizeof(whole)); - if(H5Dread(dset, H5T_NATIVE_INT, hs_space, hs_space, H5P_DEFAULT, - whole) < 0) goto error; - if(H5Sclose(hs_space) < 0) goto error; - for(i = hs_start; i0) goto error; - - if (H5Fclose(file) < 0) goto error; - puts("All external storage tests passed."); - if (h5_cleanup(FILENAME, fapl)) { - remove("extern_1a.raw"); - remove("extern_1b.raw"); - remove("extern_2a.raw"); - remove("extern_2b.raw"); - remove("extern_3a.raw"); - remove("extern_3b.raw"); - remove("extern_4a.raw"); - remove("extern_4b.raw"); - } + nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0); - return 0; + if(nerrors > 0) goto error; + + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + + HDputs("All external storage tests passed."); + + /* Clean up files used by file set tests */ + if(h5_cleanup(FILENAME, fapl_id)) { + HDremove("extern_1a.raw"); + HDremove("extern_1b.raw"); + HDremove("extern_2a.raw"); + HDremove("extern_2b.raw"); + HDremove("extern_3a.raw"); + HDremove("extern_3b.raw"); + HDremove("extern_4a.raw"); + HDremove("extern_4b.raw"); + } /* end if */ + + return EXIT_SUCCESS; error: H5E_BEGIN_TRY { - H5Fclose(file); - H5Pclose(fapl); + H5Fclose(fid); + H5Pclose(fapl_id); + H5Gclose(gid); } H5E_END_TRY; nerrors = MAX(1, nerrors); printf ("%d TEST%s FAILED.\n", nerrors, 1==nerrors?"":"s"); - return 1; -} + return EXIT_FAILURE; +} /* end main() */ + -- cgit v0.12 From 28b16f19b2d75e6d792f14ecb139c710f70289fe Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Tue, 2 Feb 2016 08:28:53 -0500 Subject: [svn-r29032] capture the entry address before the entry is freed to avoid triggering a segfault in the log_flush call in H5C__flush_single_entry(). tested on Jam with Parallel. --- src/H5C.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/H5C.c b/src/H5C.c index 641e098..ac786b5 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -7549,6 +7549,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ hbool_t was_dirty; haddr_t new_addr = HADDR_UNDEF; haddr_t old_addr = HADDR_UNDEF; + haddr_t entry_addr = HADDR_UNDEF; size_t new_len = 0; size_t new_compressed_len = 0; herr_t ret_value = SUCCEED; /* Return value */ @@ -8019,6 +8020,10 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ /* reset the flush_in progress flag */ entry_ptr->flush_in_progress = FALSE; + /* capture the cache entry address for the log_flush call at the + end before the entry_ptr gets freed */ + entry_addr = entry_ptr->addr; + /* Internal cache data structures should now be up to date, and * consistant with the status of the entry. * @@ -8130,7 +8135,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ } /* if (destroy) */ if(cache_ptr->log_flush) - if((cache_ptr->log_flush)(cache_ptr, entry_ptr->addr, was_dirty, flags) < 0) + if((cache_ptr->log_flush)(cache_ptr, entry_addr, was_dirty, flags) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "log_flush callback failed.") done: -- cgit v0.12 From 2b2b95814e62d70b3b9006ede06b3f66b9825864 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 2 Feb 2016 09:17:31 -0500 Subject: [svn-r29034] Update the external test to use the default and latest file format. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 serial autotools --- test/external.c | 88 +++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 60 insertions(+), 28 deletions(-) diff --git a/test/external.c b/test/external.c index 5492d37..09ce74e 100644 --- a/test/external.c +++ b/test/external.c @@ -974,52 +974,83 @@ test_open_ext_link_twice(hid_t fapl) int main(void) { - hid_t fapl_id = -1; /* file access properties */ + hid_t fapl_id_old = -1; /* file access properties (old format) */ + hid_t fapl_id_new = -1; /* file access properties (new format) */ hid_t fid = -1; /* file for test_1* functions */ - char filename[1024]; /* file name for test_1* funcs */ hid_t gid = -1; /* group to emit diagnostics */ + char filename[1024]; /* file name for test_1* funcs */ + unsigned latest_format; /* default or latest file format */ int nerrors = 0; /* number of errors */ h5_reset(); - fapl_id = h5_fileaccess(); - h5_fixname(FILENAME[0], fapl_id, filename, sizeof filename); - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) - FAIL_STACK_ERROR + /* Get a fapl for the old (default) file format */ + fapl_id_old = h5_fileaccess(); + h5_fixname(FILENAME[0], fapl_id_old, filename, sizeof(filename)); - /* Create a group that will be used in the file set read test */ - if((gid = H5Gcreate2(fid, "emit-diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + /* Copy and set up a fapl for the latest file format */ + if((fapl_id_new = H5Pcopy(fapl_id_old)) < 0) + FAIL_STACK_ERROR + if(H5Pset_libver_bounds(fapl_id_new, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) FAIL_STACK_ERROR - if(H5Gclose(gid) < 0) FAIL_STACK_ERROR - /* These tests use a common file */ - nerrors += test_non_extendible(fid); - nerrors += test_too_small(fid); - nerrors += test_large_enough_current_eventual(fid); - nerrors += test_large_enough_current_not_eventual(fid); - nerrors += test_unlimited(fid); - nerrors += test_multiple_files(fid); + /* Test with old & new format groups */ + for(latest_format = FALSE; latest_format <= TRUE; latest_format++) { + hid_t current_fapl_id = -1; + + /* Set the fapl for different file formats */ + if(latest_format) { + puts("\nTesting with the latest file format:"); + current_fapl_id = fapl_id_new; + } /* end if */ + else { + puts("Testing with the default file format:"); + current_fapl_id = fapl_id_old; + } /* end else */ + + /* Create the common file used by some of the tests */ + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, current_fapl_id)) < 0) + FAIL_STACK_ERROR + + /* Create a group that will be used in the file set read test */ + if((gid = H5Gcreate2(fid, "emit-diagnostics", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + if(H5Gclose(gid) < 0) FAIL_STACK_ERROR + + /* These tests use a common file */ + nerrors += test_non_extendible(fid); + nerrors += test_too_small(fid); + nerrors += test_large_enough_current_eventual(fid); + nerrors += test_large_enough_current_not_eventual(fid); + nerrors += test_unlimited(fid); + nerrors += test_multiple_files(fid); - /* These tests use no file */ - nerrors += test_add_to_unlimited(); - nerrors += test_overflow(); + /* These tests use no file */ + nerrors += test_add_to_unlimited(); + nerrors += test_overflow(); - /* These tests use the VFD-aware fapl */ - nerrors += test_read_file_set(fapl_id); - nerrors += test_write_file_set(fapl_id); - nerrors += test_open_ext_link_twice(fapl_id); + /* These tests use the VFD-aware fapl */ + nerrors += test_read_file_set(current_fapl_id); + nerrors += test_write_file_set(current_fapl_id); + nerrors += test_open_ext_link_twice(current_fapl_id); - /* Verify symbol table messages are cached */ - nerrors += (h5_verify_cached_stabs(FILENAME, fapl_id) < 0 ? 1 : 0); + /* Verify symbol table messages are cached */ + nerrors += (h5_verify_cached_stabs(FILENAME, current_fapl_id) < 0 ? 1 : 0); + + /* Close the common file */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + + } /* end for */ if(nerrors > 0) goto error; - if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + /* Close the new ff fapl. h5_cleanup will take care of the old ff fapl */ + if(H5Pclose(fapl_id_new) < 0) FAIL_STACK_ERROR HDputs("All external storage tests passed."); /* Clean up files used by file set tests */ - if(h5_cleanup(FILENAME, fapl_id)) { + if(h5_cleanup(FILENAME, fapl_id_old)) { HDremove("extern_1a.raw"); HDremove("extern_1b.raw"); HDremove("extern_2a.raw"); @@ -1035,7 +1066,8 @@ main(void) error: H5E_BEGIN_TRY { H5Fclose(fid); - H5Pclose(fapl_id); + H5Pclose(fapl_id_old); + H5Pclose(fapl_id_new); H5Gclose(gid); } H5E_END_TRY; nerrors = MAX(1, nerrors); -- cgit v0.12 From e9139733f2e6d90c5474d2593519ee7c45b00155 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 2 Feb 2016 09:36:28 -0500 Subject: [svn-r29035] Removed external links test from external storage test. This test is duplicated more comprehensively in the links.c file so there is no need to copy it over. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 serial autotools --- test/external.c | 104 ----------------------------------------------------- test/gen_udlinks.c | 3 -- test/links.c | 2 +- 3 files changed, 1 insertion(+), 108 deletions(-) diff --git a/test/external.c b/test/external.c index 09ce74e..a37dc94 100644 --- a/test/external.c +++ b/test/external.c @@ -20,16 +20,11 @@ * Purpose: Tests datasets stored in external raw files. */ #include "h5test.h" -#include "H5srcdir.h" - -/* File for external link test. Created with gen_udlinks.c */ -#define LINKED_FILE "be_extlink2.h5" const char *FILENAME[] = { "extern_1", "extern_2", "extern_3", - "extern_4", /* Remove when links test is moved */ NULL }; @@ -860,104 +855,6 @@ test_write_file_set(hid_t fapl) /*------------------------------------------------------------------------- - * Function: test_open_ext_link_twice - * - * Purpose: Tests opening an external link twice. It exposed a bug - * in the library. This function tests the fix. This test - * doesn't work with MULTI driver. - * - * TODO: Fix to work with multiple VFDs instead of blindly - * switching to sec2. - * - * TODO: Move this test to the links test, where it belongs. - * - * Return: Success: 0 - * Failure: 1 - * - * Programmer: Raymond Lu - * 5 November 2007 - * - *------------------------------------------------------------------------- - */ -static int -test_open_ext_link_twice(hid_t fapl) -{ - hid_t fid = -1; /* file ID */ - hid_t gid = -1; /* group ID */ - hid_t xid = -1; /* external link ID */ - hid_t xid2 = -1; /* external link ID (2nd opening) */ - char filename[1024]; /* file name */ - const char *pathname = H5_get_srcdir_filename(LINKED_FILE); /* Corrected test file name */ - - TESTING("opening external link twice"); - - /* Make a copy of the FAPL, in order to switch to the sec2 driver */ - /* (useful when running test with another VFD) */ - if((fapl = H5Pcopy(fapl)) < 0) - FAIL_STACK_ERROR - - /* Switch local copy of the fapl to the sec2 driver */ - if(H5Pset_fapl_sec2(fapl) < 0) - FAIL_STACK_ERROR - - h5_fixname(FILENAME[3], fapl, filename, sizeof filename); - - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - FAIL_STACK_ERROR - - if((gid = H5Gopen2(fid, "/", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - - /* Create an external link to an existing file */ - if(H5Lcreate_external(pathname, "/group", gid, " link", H5P_DEFAULT, H5P_DEFAULT) < 0) - FAIL_STACK_ERROR - - if(H5Gclose(gid) < 0) - FAIL_STACK_ERROR - - if(H5Fclose(fid) < 0) - FAIL_STACK_ERROR - - /* Reopen the file */ - if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) - FAIL_STACK_ERROR - - /* Open the external link which is "/ link" as created previously via H5Lcreate_external() */ - if((xid = H5Gopen2(fid, "/ link", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - - /* Open the external link twice */ - if((xid2 = H5Gopen2(xid, ".", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - - if(H5Gclose(xid2) < 0) - FAIL_STACK_ERROR - - if(H5Gclose(xid) < 0) - FAIL_STACK_ERROR - - if(H5Fclose(fid) < 0) - FAIL_STACK_ERROR - - if(H5Pclose(fapl) < 0) - FAIL_STACK_ERROR - - PASSED(); - - return 0; - - error: - H5E_BEGIN_TRY { - H5Gclose(gid); - H5Gclose(xid); - H5Gclose(xid2); - H5Fclose(fid); - } H5E_END_TRY; - return 1; -} /* end test_open_ext_link_twice() */ - - -/*------------------------------------------------------------------------- * Function: main * * Purpose: Runs external dataset tests. @@ -1032,7 +929,6 @@ main(void) /* These tests use the VFD-aware fapl */ nerrors += test_read_file_set(current_fapl_id); nerrors += test_write_file_set(current_fapl_id); - nerrors += test_open_ext_link_twice(current_fapl_id); /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, current_fapl_id) < 0 ? 1 : 0); diff --git a/test/gen_udlinks.c b/test/gen_udlinks.c index fc044da..55abab0 100644 --- a/test/gen_udlinks.c +++ b/test/gen_udlinks.c @@ -22,9 +22,6 @@ * They will be named according to the platform and should * be placed in the hdf5/test directory so that the links test can use them. * - * Note: The be_extlink2.h5 is also used by external.c to test opening - * external link twice. -SLU 2007/11/7 - * */ #include "hdf5.h" diff --git a/test/links.c b/test/links.c index c87d2b6..639a2d8 100644 --- a/test/links.c +++ b/test/links.c @@ -7299,7 +7299,7 @@ error: } H5E_END_TRY return -1; -} /* end efc_open_twice */ +} /* end external_open_twice() */ /*------------------------------------------------------------------------- -- cgit v0.12 From c746447b0dccc66e89038e2eae93cc88db67f825 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 4 Feb 2016 10:35:17 -0500 Subject: [svn-r29041] Patch from Steffen Kiess that allows a relative path to be specified for external dataset files set via H5Pset_external(). Resolves HDFFV-8740 Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial --- src/H5.c | 3 +- src/H5Defl.c | 172 +++++++------ src/H5Dint.c | 113 ++++++++- src/H5Dpkg.h | 2 + src/H5Dprivate.h | 1 + src/H5Fquery.c | 2 +- src/H5MM.c | 44 ++-- src/H5Pdapl.c | 384 +++++++++++++++++++++++++++- src/H5Plapl.c | 3 +- src/H5Ppublic.h | 2 + src/H5private.h | 6 +- src/H5system.c | 129 +++++++++- src/H5win32defs.h | 23 +- test/Makefile.am | 2 +- test/external.c | 735 +++++++++++++++++++++++++++++++++++++++++++++++------- 15 files changed, 1405 insertions(+), 216 deletions(-) diff --git a/src/H5.c b/src/H5.c index 4de5731..41fb3ba 100644 --- a/src/H5.c +++ b/src/H5.c @@ -193,7 +193,8 @@ H5_init_library(void) /* Normal library termination code */ (void)HDatexit(H5_term_library); - H5_dont_atexit_g = TRUE; + + H5_dont_atexit_g = TRUE; } /* end if */ /* diff --git a/src/H5Defl.c b/src/H5Defl.c index ec96ae7..cf1b36c 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -28,12 +28,13 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* Files */ -#include "H5HLprivate.h" /* Local Heaps */ -#include "H5VMprivate.h" /* Vector and array functions */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5HLprivate.h" /* Local Heaps */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5VMprivate.h" /* Vector and array functions */ /****************/ @@ -48,12 +49,14 @@ /* Callback info for readvv operation */ typedef struct H5D_efl_readvv_ud_t { const H5O_efl_t *efl; /* Pointer to efl info */ + const H5D_t *dset; /* The dataset */ unsigned char *rbuf; /* Read buffer */ } H5D_efl_readvv_ud_t; /* Callback info for writevv operation */ typedef struct H5D_efl_writevv_ud_t { const H5O_efl_t *efl; /* Pointer to efl info */ + const H5D_t *dset; /* The dataset */ const unsigned char *wbuf; /* Write buffer */ } H5D_efl_writevv_ud_t; @@ -75,9 +78,9 @@ static ssize_t H5D__efl_writevv(const H5D_io_info_t *io_info, size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]); /* Helper routines */ -static herr_t H5D__efl_read(const H5O_efl_t *efl, haddr_t addr, size_t size, +static herr_t H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size, uint8_t *buf); -static herr_t H5D__efl_write(const H5O_efl_t *efl, haddr_t addr, size_t size, +static herr_t H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size, const uint8_t *buf); @@ -232,25 +235,22 @@ H5D__efl_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNU /*------------------------------------------------------------------------- - * Function: H5D__efl_read + * Function: H5D__efl_read * - * Purpose: Reads data from an external file list. It is an error to - * read past the logical end of file, but reading past the end - * of any particular member of the external file list results in - * zeros. + * Purpose: Reads data from an external file list. It is an error to + * read past the logical end of file, but reading past the end + * of any particular member of the external file list results in + * zeros. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, March 4, 1998 * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. *------------------------------------------------------------------------- */ static herr_t -H5D__efl_read(const H5O_efl_t *efl, haddr_t addr, size_t size, uint8_t *buf) +H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size, uint8_t *buf) { int fd = -1; size_t to_read; @@ -261,6 +261,7 @@ H5D__efl_read(const H5O_efl_t *efl, haddr_t addr, size_t size, uint8_t *buf) haddr_t cur; ssize_t n; size_t u; /* Local index variable */ + char *full_name = NULL; /* File name with prefix */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -273,44 +274,49 @@ H5D__efl_read(const H5O_efl_t *efl, haddr_t addr, size_t size, uint8_t *buf) /* Find the first efl member from which to read */ for (u=0, cur=0; unused; u++) { - if(H5O_EFL_UNLIMITED == efl->slot[u].size || addr < cur + efl->slot[u].size) { - skip = addr - cur; - break; - } /* end if */ - cur += efl->slot[u].size; + if(H5O_EFL_UNLIMITED == efl->slot[u].size || addr < cur + efl->slot[u].size) { + skip = addr - cur; + break; + } /* end if */ + cur += efl->slot[u].size; } /* end for */ /* Read the data */ while(size) { HDassert(buf); - if(u >= efl->nused) - HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "read past logical end of file") - if(H5F_OVERFLOW_HSIZET2OFFT(efl->slot[u].offset + skip)) - HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed") - if((fd = HDopen(efl->slot[u].name, O_RDONLY, 0)) < 0) - HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file") - if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0) - HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file") + if(u >= efl->nused) + HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "read past logical end of file") + if(H5F_OVERFLOW_HSIZET2OFFT(efl->slot[u].offset + skip)) + HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed") + if(H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0) + HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name") + if((fd = HDopen(full_name, O_RDONLY, 0)) < 0) + HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file") + if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0) + HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file") #ifndef NDEBUG - tempto_read = MIN(efl->slot[u].size-skip, (hsize_t)size); + tempto_read = MIN((size_t)(efl->slot[u].size-skip), (hsize_t)size); H5_CHECK_OVERFLOW(tempto_read, hsize_t, size_t); - to_read = (size_t)tempto_read; + to_read = (size_t)tempto_read; #else /* NDEBUG */ - to_read = MIN((size_t)(efl->slot[u].size - skip), size); + to_read = MIN((size_t)(efl->slot[u].size - skip), (hsize_t)size); #endif /* NDEBUG */ - if((n = HDread(fd, buf, to_read)) < 0) - HGOTO_ERROR(H5E_EFL, H5E_READERROR, FAIL, "read error in external raw data file") - else if((size_t)n < to_read) - HDmemset(buf + n, 0, to_read - (size_t)n); - HDclose(fd); - fd = -1; - size -= to_read; - buf += to_read; - skip = 0; - u++; + if((n = HDread(fd, buf, to_read)) < 0) + HGOTO_ERROR(H5E_EFL, H5E_READERROR, FAIL, "read error in external raw data file") + else if((size_t)n < to_read) + HDmemset(buf + n, 0, to_read - (size_t)n); + full_name = (char *)H5MM_xfree(full_name); + HDclose(fd); + fd = -1; + size -= to_read; + buf += to_read; + skip = 0; + u++; } /* end while */ done: + if(full_name) + full_name = (char *)H5MM_xfree(full_name); if(fd >= 0) HDclose(fd); @@ -337,7 +343,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D__efl_write(const H5O_efl_t *efl, haddr_t addr, size_t size, const uint8_t *buf) +H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size, const uint8_t *buf) { int fd = -1; size_t to_write; @@ -346,7 +352,8 @@ H5D__efl_write(const H5O_efl_t *efl, haddr_t addr, size_t size, const uint8_t *b #endif /* NDEBUG */ haddr_t cur; hsize_t skip = 0; - size_t u; /* Local index variable */ + size_t u; /* Local index variable */ + char *full_name = NULL; /* File name with prefix */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -359,46 +366,51 @@ H5D__efl_write(const H5O_efl_t *efl, haddr_t addr, size_t size, const uint8_t *b /* Find the first efl member in which to write */ for(u = 0, cur = 0; u < efl->nused; u++) { - if(H5O_EFL_UNLIMITED == efl->slot[u].size || addr < cur + efl->slot[u].size) { - skip = addr - cur; - break; - } /* end if */ - cur += efl->slot[u].size; + if(H5O_EFL_UNLIMITED == efl->slot[u].size || addr < cur + efl->slot[u].size) { + skip = addr - cur; + break; + } /* end if */ + cur += efl->slot[u].size; } /* end for */ /* Write the data */ while(size) { HDassert(buf); - if(u >= efl->nused) - HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "write past logical end of file") - if(H5F_OVERFLOW_HSIZET2OFFT(efl->slot[u].offset + skip)) - HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed") - if((fd = HDopen(efl->slot[u].name, O_CREAT | O_RDWR, 0666)) < 0) { - if(HDaccess(efl->slot[u].name, F_OK) < 0) - HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "external raw data file does not exist") - else - HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file") - } /* end if */ - if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0) - HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file") + if(u >= efl->nused) + HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "write past logical end of file") + if(H5F_OVERFLOW_HSIZET2OFFT(efl->slot[u].offset + skip)) + HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed") + if(H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0) + HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name") + if((fd = HDopen(full_name, O_CREAT | O_RDWR, 0666)) < 0) { + if(HDaccess(full_name, F_OK) < 0) + HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "external raw data file does not exist") + else + HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file") + } /* end if */ + if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0) + HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file") #ifndef NDEBUG - tempto_write = MIN(efl->slot[u].size - skip, (hsize_t)size); + tempto_write = MIN(efl->slot[u].size - skip, (hsize_t)size); H5_CHECK_OVERFLOW(tempto_write, hsize_t, size_t); to_write = (size_t)tempto_write; #else /* NDEBUG */ - to_write = MIN((size_t)(efl->slot[u].size - skip), size); + to_write = MIN((size_t)(efl->slot[u].size - skip), size); #endif /* NDEBUG */ - if((size_t)HDwrite(fd, buf, to_write) != to_write) - HGOTO_ERROR(H5E_EFL, H5E_READERROR, FAIL, "write error in external raw data file") - HDclose (fd); - fd = -1; - size -= to_write; - buf += to_write; - skip = 0; - u++; + if((size_t)HDwrite(fd, buf, to_write) != to_write) + HGOTO_ERROR(H5E_EFL, H5E_READERROR, FAIL, "write error in external raw data file") + full_name = (char *)H5MM_xfree(full_name); + HDclose (fd); + fd = -1; + size -= to_write; + buf += to_write; + skip = 0; + u++; } /* end while */ done: + if(full_name) + full_name = (char *)H5MM_xfree(full_name); if(fd >= 0) HDclose(fd); @@ -427,7 +439,7 @@ H5D__efl_readvv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata) FUNC_ENTER_STATIC /* Read data */ - if(H5D__efl_read(udata->efl, dst_off, len, (udata->rbuf + src_off)) < 0) + if(H5D__efl_read(udata->efl, udata->dset, dst_off, len, (udata->rbuf + src_off)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "EFL read failed") done: @@ -464,6 +476,9 @@ H5D__efl_readvv(const H5D_io_info_t *io_info, HDassert(io_info); HDassert(io_info->store->efl.nused > 0); HDassert(io_info->u.rbuf); + HDassert(io_info->dset); + HDassert(io_info->dset->shared); + HDassert(io_info->dset->shared->extfile_prefix); HDassert(dset_curr_seq); HDassert(dset_len_arr); HDassert(dset_off_arr); @@ -473,6 +488,7 @@ H5D__efl_readvv(const H5D_io_info_t *io_info, /* Set up user data for H5VM_opvv() */ udata.efl = &(io_info->store->efl); + udata.dset = io_info->dset; udata.rbuf = (unsigned char *)io_info->u.rbuf; /* Call generic sequence operation routine */ @@ -507,7 +523,7 @@ H5D__efl_writevv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata) FUNC_ENTER_STATIC /* Write data */ - if(H5D__efl_write(udata->efl, dst_off, len, (udata->wbuf + src_off)) < 0) + if(H5D__efl_write(udata->efl, udata->dset, dst_off, len, (udata->wbuf + src_off)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "EFL write failed") done: @@ -544,6 +560,9 @@ H5D__efl_writevv(const H5D_io_info_t *io_info, HDassert(io_info); HDassert(io_info->store->efl.nused > 0); HDassert(io_info->u.wbuf); + HDassert(io_info->dset); + HDassert(io_info->dset->shared); + HDassert(io_info->dset->shared->extfile_prefix); HDassert(dset_curr_seq); HDassert(dset_len_arr); HDassert(dset_off_arr); @@ -553,6 +572,7 @@ H5D__efl_writevv(const H5D_io_info_t *io_info, /* Set up user data for H5VM_opvv() */ udata.efl = &(io_info->store->efl); + udata.dset = io_info->dset; udata.wbuf = (const unsigned char *)io_info->u.wbuf; /* Call generic sequence operation routine */ diff --git a/src/H5Dint.c b/src/H5Dint.c index a58ca56..d35e9f5 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -63,6 +63,8 @@ static herr_t H5D__cache_dataspace_info(const H5D_t *dset); static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space); static herr_t H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id); +static herr_t H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, + char **extfile_prefix); static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id); static herr_t H5D__init_storage(const H5D_t *dataset, hbool_t full_overwrite, hsize_t old_dim[], hid_t dxpl_id); @@ -982,6 +984,84 @@ done: } /* end H5D__update_oh_info() */ +/*-------------------------------------------------------------------------- + * Function: H5D_build_extfile_prefix + * + * Purpose: Determine the external file prefix to be used and store + * it in extfile_prefix. Stores an empty string if no prefix + * should be used. + * + * Return: SUCCEED/FAIL + * + * Programmer: Steffen Kiess + * October 16, 2015 + *-------------------------------------------------------------------------- + */ +static herr_t +H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, char **extfile_prefix /*out*/) +{ + char *prefix = NULL; /* prefix used to look for the file */ + char *extpath = NULL; /* absolute path of directory the HDF5 file is in */ + size_t extpath_len; /* length of extpath */ + size_t prefix_len; /* length of prefix */ + size_t extfile_prefix_len; /* length of expanded prefix */ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(dset); + HDassert(dset->oloc.file); + + extpath = H5F_EXTPATH(dset->oloc.file); + HDassert(extpath); + + /* XXX: Future thread-safety note - getenv is not required + * to be reentrant. + */ + prefix = HDgetenv("HDF5_EXTFILE_PREFIX"); + + if(prefix == NULL || *prefix == '\0') { + /* Set prefix to value of H5D_ACS_EFILE_PREFIX_NAME property */ + if(NULL == (plist = H5P_object_verify(dapl_id, H5P_DATASET_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + if(H5P_peek(plist, H5D_ACS_EFILE_PREFIX_NAME, &prefix) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file prefix") + } /* end if */ + + /* Prefix has to be checked for NULL / empty string again because the + * code above might have updated it. + */ + if(prefix == NULL || *prefix == '\0' || HDstrcmp(prefix, ".") == 0) { + /* filename is interpreted as relative to the current directory, + * does not need to be expanded + */ + if(NULL == (*extfile_prefix = (char *)H5MM_strdup(""))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + } /* end if */ + else { + if (HDstrncmp(prefix, "${ORIGIN}", HDstrlen("${ORIGIN}")) == 0) { + /* Replace ${ORIGIN} at beginning of prefix by directory of HDF5 file */ + extpath_len = HDstrlen(extpath); + prefix_len = HDstrlen(prefix); + extfile_prefix_len = extpath_len + prefix_len - HDstrlen("${ORIGIN}") + 1; + + if(NULL == (*extfile_prefix = (char *)H5MM_malloc(extfile_prefix_len))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate buffer") + HDsnprintf(*extfile_prefix, extfile_prefix_len, "%s%s", extpath, prefix + HDstrlen("${ORIGIN}")); + } /* end if */ + else { + if(NULL == (*extfile_prefix = (char *)H5MM_strdup(prefix))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + } /* end else */ + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D_build_extfile_prefix() */ + + /*------------------------------------------------------------------------- * Function: H5D__create * @@ -1151,6 +1231,10 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, /* Indicate that the layout information was initialized */ layout_init = TRUE; + /* Set the external file prefix */ + if(H5D_build_extfile_prefix(new_dset, dapl_id, &new_dset->shared->extfile_prefix) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix") + /* Add the dataset to the list of opened objects in the file */ if(H5FO_top_incr(new_dset->oloc.file, new_dset->oloc.addr) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't incr object ref. count") @@ -1195,6 +1279,7 @@ done: } /* end if */ if(new_dset->shared->dcpl_id != 0 && H5I_dec_ref(new_dset->shared->dcpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list") + new_dset->shared->extfile_prefix = (char *)H5MM_xfree(new_dset->shared->extfile_prefix); new_dset->shared = H5FL_FREE(H5D_shared_t, new_dset->shared); } /* end if */ new_dset->oloc.file = NULL; @@ -1288,7 +1373,8 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) { H5D_shared_t *shared_fo = NULL; H5D_t *dataset = NULL; - H5D_t *ret_value = NULL; /* Return value */ + char *extfile_prefix = NULL; /* Expanded external file prefix */ + H5D_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1307,6 +1393,10 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) if(H5G_name_copy(&(dataset->path), loc->path, H5_COPY_SHALLOW) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, NULL, "can't copy path") + /* Get the external file prefix */ + if(H5D_build_extfile_prefix(dataset, dapl_id, &extfile_prefix) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix") + /* Check if dataset was already open */ if(NULL == (shared_fo = (H5D_shared_t *)H5FO_opened(dataset->oloc.file, dataset->oloc.addr))) { /* Clear any errors from H5FO_opened() */ @@ -1326,6 +1416,12 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) /* We're the first dataset to use the the shared info */ dataset->shared->fo_count = 1; + + /* Set the external file prefix */ + dataset->shared->extfile_prefix = extfile_prefix; + /* Prevent string from being freed during done: */ + extfile_prefix = NULL; + } /* end if */ else { /* Point to shared info */ @@ -1334,6 +1430,12 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) /* Increment # of datasets using shared information */ shared_fo->fo_count++; + /* Check whether the external file prefix of the already open dataset + * matches the new external file prefix + */ + if(HDstrcmp(extfile_prefix, dataset->shared->extfile_prefix) != 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "new external file prefix does not match external file prefix of already open dataset") + /* Check if the object has been opened through the top file yet */ if(H5FO_top_count(dataset->oloc.file, dataset->oloc.addr) == 0) { /* Open the object through this top file */ @@ -1350,11 +1452,15 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) ret_value = dataset; done: + extfile_prefix = (char *)H5MM_xfree(extfile_prefix); + if(ret_value == NULL) { /* Free the location--casting away const*/ if(dataset) { - if(shared_fo == NULL) /* Need to free shared fo */ + if(shared_fo == NULL && dataset->shared) { /* Need to free shared fo */ + dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix); dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared); + } H5O_loc_free(&(dataset->oloc)); H5G_name_free(&(dataset->path)); @@ -1652,6 +1758,9 @@ H5D_close(H5D_t *dataset) if(dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset, H5AC_dxpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info") + /* Free the external file prefix */ + dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix); + /* Release layout, fill-value, efl & pipeline messages */ if(dataset->shared->dcpl_id != H5P_DATASET_CREATE_DEFAULT) free_failed |= (H5O_msg_reset(H5O_PLINE_ID, &dataset->shared->dcpl_cache.pline) < 0) || diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 97fc442..f9c585a 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -438,6 +438,8 @@ typedef struct H5D_shared_t { */ H5D_rdcc_t chunk; /* Information about chunked data */ } cache; + + char *extfile_prefix; /* expanded external file prefix */ } H5D_shared_t; struct H5D_t { diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index 3b43aaf..ab60a50 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -54,6 +54,7 @@ #define H5D_ACS_PREEMPT_READ_CHUNKS_NAME "rdcc_w0" /* Preemption read chunks first */ #define H5D_ACS_VDS_VIEW_NAME "vds_view" /* VDS view option */ #define H5D_ACS_VDS_PRINTF_GAP_NAME "vds_printf_gap" /* VDS printf gap size */ +#define H5D_ACS_EFILE_PREFIX_NAME "external file prefix" /* External file prefix */ /* ======== Data transfer properties ======== */ #define H5D_XFER_MAX_TEMP_BUF_NAME "max_temp_buf" /* Maximum temp buffer size */ diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 05667ac..75fc216 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -158,7 +158,7 @@ H5F_get_actual_name(const H5F_t *f) * Function: H5F_get_extpath * * Purpose: Retrieve the file's 'extpath' flags - * This is used by H5L_extern_traverse() to retrieve the main file's location + * This is used by H5L_extern_traverse() and H5D_build_extfile_prefix() to retrieve the main file's location * when searching the target file. * * Return: 'extpath' on success/abort on failure (shouldn't fail) diff --git a/src/H5MM.c b/src/H5MM.c index 09e6461..5c2a731 100644 --- a/src/H5MM.c +++ b/src/H5MM.c @@ -125,10 +125,10 @@ static size_t H5MM_peak_alloc_blocks_count_s = 0; * Function: H5MM__is_our_block * * Purpose: Try to determine if a memory buffer has been allocated through - * the H5MM* interface, instead of the system's malloc() routines. + * the H5MM* interface, instead of the system's malloc() routines. * - * Return: Success: TRUE/FALSE - * Failure: (Can't fail) + * Return: Success: TRUE/FALSE + * Failure: (Can't fail) * * Programmer: Quincey Koziol * Dec 30 2015 @@ -149,7 +149,7 @@ H5MM__is_our_block(void *mem) * * Purpose: Check a block wrapper around a buffer to validate it. * - * Return: N/A (void) + * Return: N/A (void) * * Programmer: Quincey Koziol * Dec 30 2015 @@ -173,9 +173,9 @@ H5MM__sanity_check_block(const H5MM_block_t *block) * Function: H5MM__sanity_check * * Purpose: Check a buffer to validate it (just calls - * H5MM__sanity_check_block after finding block for buffer) + * H5MM__sanity_check_block after finding block for buffer) * - * Return: N/A (void) + * Return: N/A (void) * * Programmer: Quincey Koziol * Dec 30 2015 @@ -196,7 +196,7 @@ H5MM__sanity_check(void *mem) * * Purpose: Sanity check all current memory allocations. * - * Return: N/A (void) + * Return: N/A (void) * * Programmer: Quincey Koziol * Jan 5 2016 @@ -206,7 +206,7 @@ H5MM__sanity_check(void *mem) void H5MM_sanity_check_all(void) { - H5MM_block_t *curr; + H5MM_block_t *curr = NULL; curr = H5MM_block_head_s.next; while(curr != &H5MM_block_head_s) { @@ -221,7 +221,7 @@ H5MM_sanity_check_all(void) * * Purpose: Final sanity checks on memory allocation. * - * Return: N/A (void) + * Return: N/A (void) * * Programmer: Quincey Koziol * Jan 1 2016 @@ -257,8 +257,8 @@ H5MM_final_sanity_check(void) * considered an error condition since allocations of zero * bytes usually indicate problems. * - * Return: Success: Pointer new memory - * Failure: NULL + * Return: Success: Pointer to new memory + * Failure: NULL * * Programmer: Quincey Koziol * Nov 8 2003 @@ -268,7 +268,7 @@ H5MM_final_sanity_check(void) void * H5MM_malloc(size_t size) { - void *ret_value; + void *ret_value = NULL; HDassert(size); @@ -346,8 +346,8 @@ H5MM_malloc(size_t size) * bytes usually indicate problems. * * - * Return: Success: Pointer new memory - * Failure: NULL + * Return: Success: Pointer to new memory + * Failure: NULL * * Programmer: Quincey Koziol * Nov 8 2003 @@ -357,7 +357,7 @@ H5MM_malloc(size_t size) void * H5MM_calloc(size_t size) { - void *ret_value; + void *ret_value = NULL; HDassert(size); @@ -392,8 +392,9 @@ H5MM_calloc(size_t size) * Note that the (NULL, 0) combination is undefined behavior * in the C standard. * - * Return: Success: Ptr to new memory if size > 0, NULL if size is zero - * Failure: NULL (input buffer is unchanged on failure) + * Return: Success: Ptr to new memory if size > 0 + * NULL if size is zero + * Failure: NULL (input buffer is unchanged on failure) * * Programmer: Robb Matzke * Jul 10 1997 @@ -403,7 +404,7 @@ H5MM_calloc(size_t size) void * H5MM_realloc(void *mem, size_t size) { - void *ret_value; + void *ret_value = NULL; /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -458,7 +459,6 @@ H5MM_realloc(void *mem, size_t size) * Failure: abort() * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 10 1997 *------------------------------------------------------------------------- */ @@ -490,17 +490,16 @@ done: * an error will be raised. * * Return: Success: Pointer to a new string - * Failure: abort() + * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 10 1997 *------------------------------------------------------------------------- */ char * H5MM_strdup(const char *s) { - char *ret_value; + char *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) @@ -528,7 +527,6 @@ done: * Failure: never fails * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 10 1997 * *------------------------------------------------------------------------- diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index eab9337..6407d4c 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -16,8 +16,8 @@ /*------------------------------------------------------------------------- * * Created: H5Pdapl.c - * October 27, 2008 - * Neil Fortner + * October 27, 2008 + * Neil Fortner * * Purpose: Dataset access property list class routines * @@ -39,7 +39,8 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* Files */ #include "H5Iprivate.h" /* IDs */ -#include "H5Ppkg.h" /* Property lists */ +#include "H5Ppkg.h" /* Property lists */ +#include "H5MMprivate.h" /* Memory management */ /****************/ @@ -72,6 +73,17 @@ #define H5D_ACS_VDS_PRINTF_GAP_DEF (hsize_t)0 #define H5D_ACS_VDS_PRINTF_GAP_ENC H5P__encode_hsize_t #define H5D_ACS_VDS_PRINTF_GAP_DEC H5P__decode_hsize_t +/* Definitions for external file prefix */ +#define H5D_ACS_EFILE_PREFIX_SIZE sizeof(char *) +#define H5D_ACS_EFILE_PREFIX_DEF NULL /*default is no prefix */ +#define H5D_ACS_EFILE_PREFIX_SET H5P__dapl_efile_pref_set +#define H5D_ACS_EFILE_PREFIX_GET H5P__dapl_efile_pref_get +#define H5D_ACS_EFILE_PREFIX_ENC H5P__dapl_efile_pref_enc +#define H5D_ACS_EFILE_PREFIX_DEC H5P__dapl_efile_pref_dec +#define H5D_ACS_EFILE_PREFIX_DEL H5P__dapl_efile_pref_del +#define H5D_ACS_EFILE_PREFIX_COPY H5P__dapl_efile_pref_copy +#define H5D_ACS_EFILE_PREFIX_CMP H5P__dapl_efile_pref_cmp +#define H5D_ACS_EFILE_PREFIX_CLOSE H5P__dapl_efile_pref_close /******************/ /* Local Typedefs */ @@ -100,6 +112,16 @@ static herr_t H5P__decode_chunk_cache_nbytes(const void **_pp, void *_value); static herr_t H5P__dacc_vds_view_enc(const void *value, void **pp, size_t *size); static herr_t H5P__dacc_vds_view_dec(const void **pp, void *value); +/* Property list callbacks */ +static herr_t H5P__dapl_efile_pref_set(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__dapl_efile_pref_get(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__dapl_efile_pref_dec(const void **_pp, void *value); +static herr_t H5P__dapl_efile_pref_del(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__dapl_efile_pref_copy(const char* name, size_t size, void* value); +static int H5P__dapl_efile_pref_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__dapl_efile_pref_close(const char* name, size_t size, void* value); + /*********************/ /* Package Variables */ @@ -134,6 +156,9 @@ const H5P_libclass_t H5P_CLS_DACC[1] = {{ /* Local Variables */ /*******************/ +/* Property value defaults */ +static const char *H5D_def_efile_prefix_g = H5D_ACS_EFILE_PREFIX_DEF; /* Default external file prefix string */ + /*------------------------------------------------------------------------- @@ -187,12 +212,274 @@ H5P__dacc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register property for external file prefix */ + if(H5P_register_real(pclass, H5D_ACS_EFILE_PREFIX_NAME, H5D_ACS_EFILE_PREFIX_SIZE, &H5D_def_efile_prefix_g, + NULL, H5D_ACS_EFILE_PREFIX_SET, H5D_ACS_EFILE_PREFIX_GET, H5D_ACS_EFILE_PREFIX_ENC, H5D_ACS_EFILE_PREFIX_DEC, + H5D_ACS_EFILE_PREFIX_DEL, H5D_ACS_EFILE_PREFIX_COPY, H5D_ACS_EFILE_PREFIX_CMP, H5D_ACS_EFILE_PREFIX_CLOSE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__dacc_reg_prop() */ /*------------------------------------------------------------------------- + * Function: H5P__dapl_efile_pref_set + * + * Purpose: Copies an external file prefix property when it's set + * for a property list + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_efile_pref_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(value); + + /* Copy the prefix */ + *(char **)value = H5MM_xstrdup(*(const char **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dapl_efile_pref_set() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_efile_pref_get + * + * Purpose: Copies an external file prefix property when it's retrieved + * from a property list + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_efile_pref_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(value); + + /* Copy the prefix */ + *(char **)value = H5MM_xstrdup(*(const char **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dapl_efile_pref_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_efile_pref_enc + * + * Purpose: Callback routine which is called whenever the efile flags + * property in the dataset access property list is + * encoded. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size) +{ + const char *efile_pref = *(const char * const *)value; + uint8_t **pp = (uint8_t **)_pp; + size_t len = 0; + uint64_t enc_value; + unsigned enc_size; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + + /* calculate prefix length */ + if(NULL != efile_pref) + len = HDstrlen(efile_pref); + + enc_value = (uint64_t)len; + enc_size = H5VM_limit_enc_size(enc_value); + HDassert(enc_size < 256); + + if(NULL != *pp) { + /* encode the length of the prefix */ + *(*pp)++ = (uint8_t)enc_size; + UINT64ENCODE_VAR(*pp, enc_value, enc_size); + + /* encode the prefix */ + if(NULL != efile_pref) { + HDmemcpy(*(char **)pp, efile_pref, len); + *pp += len; + } /* end if */ + } /* end if */ + + *size += (1 + enc_size); + if(NULL != efile_pref) + *size += len; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dapl_efile_pref_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_efile_pref_dec + * + * Purpose: Callback routine which is called whenever the efile prefix + * property in the dataset access property list is + * decoded. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_efile_pref_dec(const void **_pp, void *_value) +{ + char **efile_pref = (char **)_value; + const uint8_t **pp = (const uint8_t **)_pp; + size_t len; + uint64_t enc_value; /* Decoded property value */ + unsigned enc_size; /* Size of encoded property */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(pp); + HDassert(*pp); + HDassert(efile_pref); + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + + /* Decode the size */ + enc_size = *(*pp)++; + HDassert(enc_size < 256); + + /* Decode the value */ + UINT64DECODE_VAR(*pp, enc_value, enc_size); + len = (size_t)enc_value; + + if(0 != len) { + /* Make a copy of the user's prefix string */ + if(NULL == (*efile_pref = (char *)H5MM_malloc(len + 1))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for prefix") + HDstrncpy(*efile_pref, *(const char **)pp, len); + (*efile_pref)[len] = '\0'; + + *pp += len; + } /* end if */ + else + *efile_pref = NULL; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dapl_efile_pref_dec() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_efile_pref_del + * + * Purpose: Frees memory used to store the external file prefix string + * + * Return: SUCCEED (Can't fail) + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_efile_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(value); + + H5MM_xfree(*(void **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dapl_efile_pref_del() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_efile_pref_copy + * + * Purpose: Creates a copy of the external file prefix string + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_efile_pref_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(value); + + *(char **)value = H5MM_xstrdup(*(const char **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dapl_efile_pref_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_efile_pref_cmp + * + * Purpose: Callback routine which is called whenever the efile prefix + * property in the dataset creation property list is + * compared. + * + * Return: zero if VALUE1 and VALUE2 are equal, non zero otherwise. + * + *------------------------------------------------------------------------- + */ +static int +H5P__dapl_efile_pref_cmp(const void *value1, const void *value2, size_t H5_ATTR_UNUSED size) +{ + const char *pref1 = *(const char * const *)value1; + const char *pref2 = *(const char * const *)value2; + int ret_value = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(NULL == pref1 && NULL != pref2) + HGOTO_DONE(1); + if(NULL != pref1 && NULL == pref2) + HGOTO_DONE(-1); + if(NULL != pref1 && NULL != pref2) + ret_value = HDstrcmp(pref1, pref2); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dapl_efile_pref_cmp() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_efile_pref_close + * + * Purpose: Frees memory used to store the external file prefix string + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_efile_pref_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(value); + + H5MM_xfree(*(void **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dapl_efile_pref_close() */ + + +/*------------------------------------------------------------------------- * Function: H5Pset_chunk_cache * * Purpose: Set the number of objects in the meta data cache and the @@ -787,3 +1074,94 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_virtual_printf_gap() */ + +/*------------------------------------------------------------------------- + * Function: H5Pset_efile_prefix + * + * Purpose: Set a prefix to be used for any external files. + * + * If the prefix starts with ${ORIGIN}, this will be replaced by + * the absolute path of the directory of the HDF5 file containing + * the dataset. + * + * If the prefix is ".", no prefix will be applied. + * + * This property can be overwritten by the environment variable + * HDF5_EXTFILE_PREFIX. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_efile_prefix(hid_t plist_id, const char *prefix) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*s", plist_id, prefix); + + /* Get the plist structure */ + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Set prefix */ + if(H5P_set(plist, H5D_ACS_EFILE_PREFIX_NAME, &prefix) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set prefix info") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_efile_prefix() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_efile_prefix + * + * Purpose: Gets the prefix to be used for any external files. + * + * If the pointer is not NULL, it points to a user-allocated + * buffer. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +ssize_t +H5Pget_efile_prefix(hid_t plist_id, char *prefix, size_t size) +{ + H5P_genplist_t *plist; /* Property list pointer */ + char *my_prefix; /* Library's copy of the prefix */ + size_t len; /* Length of prefix string */ + ssize_t ret_value; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("Zs", "i*sz", plist_id, prefix, size); + + /* Get the plist structure */ + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Get the current prefix */ + if(H5P_peek(plist, H5D_ACS_EFILE_PREFIX_NAME, &my_prefix) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file prefix") + + /* Check for prefix being set */ + if(my_prefix) { + /* Copy to user's buffer, if given */ + len = HDstrlen(my_prefix); + if(prefix) { + HDstrncpy(prefix, my_prefix, MIN(len + 1, size)); + if(len >= size) + prefix[size - 1] = '\0'; + } /* end if */ + } /* end if */ + else + len = 0; + + /* Set return value */ + ret_value = (ssize_t)len; + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_efile_prefix() */ diff --git a/src/H5Plapl.c b/src/H5Plapl.c index b7c682c..239f2a5 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -783,7 +783,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__lacc_elink_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +H5P__lacc_elink_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) { FUNC_ENTER_STATIC_NOERR diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 6a97918..e102776 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -400,6 +400,8 @@ H5_DLL herr_t H5Pset_virtual_view(hid_t plist_id, H5D_vds_view_t view); H5_DLL herr_t H5Pget_virtual_view(hid_t plist_id, H5D_vds_view_t *view); H5_DLL herr_t H5Pset_virtual_printf_gap(hid_t plist_id, hsize_t gap_size); H5_DLL herr_t H5Pget_virtual_printf_gap(hid_t plist_id, hsize_t *gap_size); +H5_DLL herr_t H5Pset_efile_prefix(hid_t dapl_id, const char* prefix); +H5_DLL ssize_t H5Pget_efile_prefix(hid_t dapl_id, char* prefix /*out*/, size_t size); /* Dataset xfer property list (DXPL) routines */ H5_DLL herr_t H5Pset_data_transform(hid_t plist_id, const char* expression); diff --git a/src/H5private.h b/src/H5private.h index 74763a5..0331e2c 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1189,6 +1189,9 @@ typedef off_t h5_stat_size_t; #ifndef HDsetbuf #define HDsetbuf(F,S) setbuf(F,S) #endif /* HDsetbuf */ +#ifndef HDsetenv + #define HDsetenv(N,V,O) setenv(N,V,O) +#endif /* HDsetenv */ #ifndef HDsetgid #define HDsetgid(G) setgid(G) #endif /* HDsetgid */ @@ -2557,7 +2560,8 @@ H5_DLL uint32_t H5_hash_string(const char *str); H5_DLL time_t H5_make_time(struct tm *tm); /* Functions for building paths, etc. */ -H5_DLL herr_t H5_build_extpath(const char *, char ** /*out*/ ); +H5_DLL herr_t H5_build_extpath(const char *name, char **extpath /*out*/); +H5_DLL herr_t H5_combine_path(const char *path1, const char *path2, char **full_name /*out*/); /* Functions for debugging */ H5_DLL herr_t H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf, diff --git a/src/H5system.c b/src/H5system.c index 4baebc5..420ec85 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -757,7 +757,7 @@ done: */ int Wgettimeofday(struct timeval *tv, struct timezone *tz) - { +{ union { unsigned long long ns100; /*time since 1 Jan 1601 in 100ns units */ FILETIME ft; @@ -783,7 +783,42 @@ Wgettimeofday(struct timeval *tv, struct timezone *tz) /* Always return 0 as per Open Group Base Specifications Issue 6. Do not set errno on error. */ return 0; -} +} /* end Wgettimeofday() */ + + +/*------------------------------------------------------------------------- + * Function: Wsetenv + * + * Purpose: Wrapper function for setenv on Windows systems. + * Interestingly, getenv *is* available in the Windows + * POSIX layer, just not setenv. + * + * Return: Success: 0 + * Failure: non-zero error code + * + * Programmer: Dana Robinson + * February 2016 + * + *------------------------------------------------------------------------- + */ +int +Wsetenv(const char *name, const char *value, int overwrite) +{ + size_t bufsize; + errno_t err; + + /* If we're not overwriting, check if the environment variable exists. + * If it does (i.e.: the required buffer size to store the variable's + * value is non-zero), then return an error code. + */ + if(!overwrite) { + err = getenv_s(&bufsize, NULL, 0, name); + if(err || bufsize) + return (int)err + } /* end if */ + + return (int)_putenv_s(name, value); +} /* end Wsetenv() */ #ifdef H5_HAVE_WINSOCK2_H #pragma comment(lib, "advapi32.lib") @@ -881,26 +916,25 @@ Wflock(int fd, int operation) { /*------------------------------------------------------------------------- - * Function: H5_build_extpath + * Function: H5_build_extpath * - * Purpose: To build the path for later searching of target file for external - * link. This path can be either: + * Purpose: To build the path for later searching of target file for external + * links and external files. This path can be either: * 1. The absolute path of NAME * or * 2. The current working directory + relative path of NAME * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * * Programmer: Vailin Choi - * April 2, 2008 + * April 2, 2008 * *------------------------------------------------------------------------- */ #define MAX_PATH_LEN 1024 herr_t -H5_build_extpath(const char *name, char **extpath/*out*/) +H5_build_extpath(const char *name, char **extpath /*out*/) { char *full_path = NULL; /* Pointer to the full path, as built or passed in */ char *cwdpath = NULL; /* Pointer to the current working directory path */ @@ -998,5 +1032,80 @@ done: H5MM_xfree(new_name); FUNC_LEAVE_NOAPI(ret_value) -} /* H5_build_extpath() */ +} /* end H5_build_extpath() */ + + +/*-------------------------------------------------------------------------- + * Function: H5_combine_path + * + * Purpose: If path2 is relative, interpret path2 as relative to path1 + * and store the result in full_name. Otherwise store path2 + * in full_name. + * + * Return: SUCCEED/FAIL + * + * Programmer: Steffen Kiess + * June 22, 2015 + *-------------------------------------------------------------------------- + */ +herr_t +H5_combine_path(const char* path1, const char* path2, char **full_name /*out*/) +{ + size_t path1_len; /* length of path1 */ + size_t path2_len; /* length of path2 */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(path1); + HDassert(path2); + + path1_len = HDstrlen(path1); + path2_len = HDstrlen(path2); + + if(*path1 == '\0' || H5_CHECK_ABSOLUTE(path2)) { + + /* If path1 is empty or path2 is absolute, simply use path2 */ + if(NULL == (*full_name = (char *)H5MM_strdup(path2))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + + } /* end if */ + else if(H5_CHECK_ABS_PATH(path2)) { + + /* On windows path2 is a path absolute name */ + if (H5_CHECK_ABSOLUTE(path1) || H5_CHECK_ABS_DRIVE(path1)) { + /* path1 is absolute or drive absolute and path2 is path absolute. + * Use the drive letter of path1 + path2 + */ + if(NULL == (*full_name = (char *)H5MM_malloc(path2_len + 3))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate path2 buffer") + HDsnprintf(*full_name, (path2_len + 3), "%c:%s", path1[0], path2); + } /* end if */ + else { + /* On windows path2 is path absolute name ("\foo\bar"), + * path1 does not have a drive letter (i.e. is "a\b" or "\a\b"). + * Use path2. + */ + if(NULL == (*full_name = (char *)H5MM_strdup(path2))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + } /* end else */ + + } /* end else if */ + else { + + /* Relative path2: + * Allocate a buffer to hold path1 + path2 + possibly the delimiter + * + terminating null byte + */ + if(NULL == (*full_name = (char *)H5MM_malloc(path1_len + path2_len + 2))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate filename buffer") + + /* Compose the full file name */ + HDsnprintf(*full_name, (path1_len + path2_len + 2), "%s%s%s", path1, + (H5_CHECK_DELIMITER(path1[path1_len - 1]) ? "" : H5_DIR_SEPS), path2); + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5_combine_name() */ diff --git a/src/H5win32defs.h b/src/H5win32defs.h index e84def9..2a0f22d 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -71,21 +71,24 @@ struct timezone { }; #ifdef __cplusplus - extern "C" { +extern "C" { #endif /* __cplusplus */ - H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz); - H5_DLL int Wflock(int fd, int operation); - H5_DLL char* Wgetlogin(void); - H5_DLL int c99_snprintf(char* str, size_t size, const char* format, ...); - H5_DLL int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap); + H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz); + H5_DLL int Wsetenv(const char *name, const char *value, int overwrite); + H5_DLL int Wflock(int fd, int operation); + H5_DLL char* Wgetlogin(void); + H5_DLL int c99_snprintf(char* str, size_t size, const char* format, ...); + H5_DLL int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap); #ifdef __cplusplus - } +} #endif /* __cplusplus */ + #define HDgettimeofday(V,Z) Wgettimeofday(V,Z) +#define HDsetenv(N,V,O) Wsetenv(N,V,O) #define HDflock(F,L) Wflock(F,L) #define HDgetlogin() Wgetlogin() #define HDsnprintf c99_snprintf /*varargs*/ -#define HDvsnprintf c99_vsnprintf +#define HDvsnprintf c99_vsnprintf /*varargs*/ #endif /* H5_HAVE_VISUAL_STUDIO */ @@ -98,5 +101,7 @@ struct timezone { #ifndef H5_HAVE_MINGW #define HDftruncate(F,L) _chsize_s(F,L) #define HDfseek(F,O,W) _fseeki64(F,O,W) -#endif +#endif /* H5_HAVE_MINGW */ + #endif /* H5_HAVE_WIN32_API */ + diff --git a/test/Makefile.am b/test/Makefile.am index 8389cc4..c3761b7 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -129,7 +129,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse huge_chunks.h5 chunk_cache.h5 big_chunk.h5 chunk_expand.h5 \ copy_dcpl_newfile.h5 extend.h5 istore.h5 extlinks*.h5 frspace.h5 links*.h5 \ sys_file1 tfile[1-7].h5 th5s[1-4].h5 lheap.h5 fheap.h5 ohdr.h5 \ - stab.h5 extern_[1-3].h5 extern_[1-4][ab].raw gheap[0-4].h5 \ + stab.h5 extern_[1-4].h5 extern_[1-4][rw].raw gheap[0-4].h5 \ dt_arith[1-2] links.h5 links[0-6]*.h5 extlinks[0-15].h5 tmp \ big.data big[0-9][0-9][0-9][0-9][0-9].h5 \ stdio.h5 sec2.h5 dtypes[0-9].h5 dtypes1[0].h5 dt_arith[1-2].h5 tattr.h5 \ diff --git a/test/external.c b/test/external.c index a37dc94..3bf62c4 100644 --- a/test/external.c +++ b/test/external.c @@ -25,9 +25,19 @@ const char *FILENAME[] = { "extern_1", "extern_2", "extern_3", + "extern_4", + "extern_dir/file_1", NULL }; +/* A similar collection of files is used for the tests that + * perform file I/O. + */ +#define N_EXT_FILES 4 +#define PART_SIZE 25 +#define TOTAL_SIZE 100 +#define GARBAGE_PER_FILE 10 + /*------------------------------------------------------------------------- * Function: files_have_same_contents @@ -90,6 +100,106 @@ out: /*------------------------------------------------------------------------- + * Function: reset_raw_data_files + * + * Purpose: Resets the data in the raw data files for tests that + * perform dataset I/O on a set of files. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * February 2016 + * + *------------------------------------------------------------------------- + */ +static herr_t +reset_raw_data_files(void) +{ + int fd = 0; /* external file descriptor */ + size_t i, j; /* iterators */ + hssize_t n; /* bytes of I/O */ + char filename[1024]; /* file name */ + int data[PART_SIZE]; /* raw data buffer */ + uint8_t *garbage = NULL; /* buffer of garbage data */ + size_t garbage_count; /* size of garbage buffer */ + size_t garbage_bytes; /* # of garbage bytes written to file */ + + /* Set up garbage buffer */ + garbage_count = N_EXT_FILES * GARBAGE_PER_FILE; + if(NULL == (garbage = (uint8_t *)HDcalloc(garbage_count, sizeof(uint8_t)))) + goto error; + for(i = 0; i < garbage_count; i++) + garbage[i] = 0xFF; + + /* The *r files are pre-filled with data and are used to + * verify that read operations work correctly. + */ + for(i = 0; i < N_EXT_FILES; i++) { + + /* Open file */ + HDsprintf(filename, "extern_%lur.raw", (unsigned long)i + 1); + if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) + goto error; + + /* Write garbage data to the file. This allows us to test the + * the ability to set an offset in the raw data file. + */ + garbage_bytes = i * 10; + n = HDwrite(fd, garbage, garbage_bytes); + if(n < 0 || (size_t)n != garbage_bytes) + goto error; + + /* Fill array with data */ + for(j = 0; j < PART_SIZE; j++) { + data[j] = (int)(i * 25 + j); + } /* end for */ + + /* Write raw data to the file. */ + n = HDwrite(fd, data, sizeof(data)); + if(n != sizeof(data)) + goto error; + + /* Close this file */ + HDclose(fd); + + } /* end for */ + + /* The *w files are only pre-filled with the garbage data and are + * used to verify that write operations work correctly. The individual + * tests fill in the actual data. + */ + for(i = 0; i < N_EXT_FILES; i++) { + + /* Open file */ + HDsprintf(filename, "extern_%luw.raw", (unsigned long)i + 1); + if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) + goto error; + + /* Write garbage data to the file. This allows us to test the + * the ability to set an offset in the raw data file. + */ + garbage_bytes = i * 10; + n = HDwrite(fd, garbage, garbage_bytes); + if(n < 0 || (size_t)n != garbage_bytes) + goto error; + + /* Close this file */ + HDclose(fd); + + } /* end for */ + HDfree(garbage); + return SUCCEED; + +error: + if(fd) + HDclose(fd); + if(garbage) + HDfree(garbage); + return FAIL; +} /* end reset_raw_data_files() */ + + +/*------------------------------------------------------------------------- * Function: test_non_extendible * * Purpose: Tests a non-extendible dataset with a single external file. @@ -361,7 +471,7 @@ test_large_enough_current_not_eventual(hid_t file) /*------------------------------------------------------------------------- - * Function: test_1e + * Function: test_unlimited * * Purpose: Test a single external file of unlimited size and an * unlimited data space. @@ -629,38 +739,25 @@ test_read_file_set(hid_t fapl) hid_t space = -1; /* data space */ hid_t dset = -1; /* dataset */ hid_t grp = -1; /* group to emit diagnostics */ - int fd = -1; /* external file descriptors */ - size_t i, j; /* miscellaneous counters */ - hssize_t n; /* bytes of I/O */ + size_t i; /* miscellaneous counter */ char filename[1024]; /* file names */ - int part[25], whole[100]; /* raw data buffers */ + int part[PART_SIZE]; /* raw data buffer (partial) */ + int whole[TOTAL_SIZE]; /* raw data buffer (total) */ hsize_t cur_size; /* current data space size */ - hid_t hs_space; /* hyperslab data space */ + hid_t hs_space = -1; /* hyperslab data space */ hsize_t hs_start = 30; /* hyperslab starting offset */ hsize_t hs_count = 25; /* hyperslab size */ - int temparray[10] = {0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f}; TESTING("read external dataset"); - /* Write the data to external files directly */ - for(i=0; i<4; i++) { - for(j=0; j<25; j++) { - part[j] = (int)(i*25+j); - } /* end for */ - HDsprintf(filename, "extern_%lua.raw", (unsigned long)i+1); - if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) - TEST_ERROR - n = HDwrite(fd, temparray, (size_t)i*10); - if(n < 0 || (size_t)n != i*10) - TEST_ERROR - n = HDwrite(fd, part, sizeof(part)); - if(n != sizeof(part)) + if(HDsetenv("HDF5_EXTFILE_PREFIX", "", 1) < 0) TEST_ERROR - HDclose(fd); - } /* end for */ - /* - * Create the file and an initial group. This causes messages about + /* Reset the raw data files */ + if(reset_raw_data_files() < 0) + TEST_ERROR + + /* Create the file and an initial group. This causes messages about * debugging to be emitted before we start playing games with what the * output looks like. */ @@ -671,50 +768,57 @@ test_read_file_set(hid_t fapl) FAIL_STACK_ERROR if(H5Gclose(grp) < 0) FAIL_STACK_ERROR - /* Create the dataset */ + /* Create the dcpl */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - if(H5Pset_external(dcpl, "extern_1a.raw", (HDoff_t)0, (hsize_t)sizeof part) < 0 || - H5Pset_external(dcpl, "extern_2a.raw", (HDoff_t)10, (hsize_t)sizeof part) < 0 || - H5Pset_external(dcpl, "extern_3a.raw", (HDoff_t)20, (hsize_t)sizeof part) < 0 || - H5Pset_external(dcpl, "extern_4a.raw", (HDoff_t)30, (hsize_t)sizeof part) < 0) - FAIL_STACK_ERROR - cur_size = 100; + for(i = 0; i < N_EXT_FILES; i++) { + HDsnprintf(filename, sizeof(filename), "extern_%dr.raw", (int) i + 1); + if(H5Pset_external(dcpl, filename, (HDoff_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Create the dataspace */ + cur_size = TOTAL_SIZE; if((space = H5Screate_simple(1, &cur_size, NULL)) < 0) FAIL_STACK_ERROR + + /* Create the dataset */ if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* - * Read the entire dataset and compare with the original - */ + /* Read the entire dataset */ HDmemset(whole, 0, sizeof(whole)); if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0) FAIL_STACK_ERROR - for(i = 0; i < 100; i++) + + /* Compare data */ + for(i = 0; i < TOTAL_SIZE; i++) if(whole[i] != (signed)i) - FAIL_PUTS_ERROR(" Incorrect value(s) read."); + FAIL_PUTS_ERROR("Incorrect value(s) read."); - /* Read the middle of the dataset */ - if((hs_space = H5Scopy(space)) < 0) - FAIL_STACK_ERROR - if(H5Sselect_hyperslab(hs_space, H5S_SELECT_SET, &hs_start, NULL, &hs_count, NULL) < 0) - FAIL_STACK_ERROR + /* Read via a hypserslab in the middle of the dataset */ - HDmemset(whole, 0, sizeof(whole)); - if(H5Dread(dset, H5T_NATIVE_INT, hs_space, hs_space, H5P_DEFAULT, whole) < 0) - FAIL_STACK_ERROR + /* Set up dataspace */ + if((hs_space = H5Scopy(space)) < 0) + FAIL_STACK_ERROR + if(H5Sselect_hyperslab(hs_space, H5S_SELECT_SET, &hs_start, NULL, &hs_count, NULL) < 0) + FAIL_STACK_ERROR - if(H5Sclose(hs_space) < 0) FAIL_STACK_ERROR + /* Read */ + HDmemset(whole, 0, sizeof(whole)); + if(H5Dread(dset, H5T_NATIVE_INT, hs_space, hs_space, H5P_DEFAULT, whole) < 0) + FAIL_STACK_ERROR - for(i = hs_start; i= 0) + FAIL_PUTS_ERROR("reopening the dataset with a different efile_prefix succeded"); + + /* Read the entire dataset and compare with the original */ + HDmemset(whole, 0, sizeof(whole)); + if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0) + FAIL_STACK_ERROR + for(i = 0; i < TOTAL_SIZE; i++) + if(whole[i] != (signed)i) + FAIL_PUTS_ERROR("Incorrect value(s) read."); + + /* Close dataset */ + if(H5Dclose(dset2) < 0) FAIL_STACK_ERROR + if(H5Dclose(dset) < 0) FAIL_STACK_ERROR + + /* Open dataset (use a differend prefix than for create. + * This works because the dataset was closed. + */ + if(H5Pset_efile_prefix(dapl2, "${ORIGIN}/.") < 0) + FAIL_STACK_ERROR + if((dset = H5Dopen2(file, "dset1", dapl2)) < 0) + FAIL_STACK_ERROR + + /* Reopen dataset with same efile_prefix property */ + if((dset2 = H5Dopen2(file, "dset1", dapl2)) < 0) + FAIL_STACK_ERROR + + /* Reopen dataset with different efile_prefix property */ + if(H5Pset_efile_prefix(dapl, NULL) < 0) + FAIL_STACK_ERROR + H5E_BEGIN_TRY { + dset3 = H5Dopen2(file, "dset1", dapl); + } H5E_END_TRY; + if(dset3 >= 0) + FAIL_PUTS_ERROR("reopening the dataset with a different efile_prefix succeded"); + + /* Read the entire dataset and compare with the original */ + HDmemset(whole, 0, sizeof(whole)); + if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0) + FAIL_STACK_ERROR + for(i = 0; i < TOTAL_SIZE; i++) + if(whole[i] != (signed)i) + FAIL_PUTS_ERROR("Incorrect value(s) read."); + + if(H5Dclose(dset2) < 0) FAIL_STACK_ERROR + if(H5Dclose(dset) < 0) FAIL_STACK_ERROR + if(H5Pclose(dapl2) < 0) FAIL_STACK_ERROR + if(H5Pclose(dapl) < 0) FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR + if(H5Sclose(space) < 0) FAIL_STACK_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Pclose(dapl2); + H5Pclose(dapl); + H5Dclose(dset3); + H5Dclose(dset2); + H5Dclose(dset); + H5Pclose(dcpl); + H5Sclose(space); + H5Fclose(file); + } H5E_END_TRY; + return 1; +} /* end test_path_relative_cwd() */ + + +/*------------------------------------------------------------------------- + * Function: test_path_env + * + * Purpose: Test whether the value of HDF5_EXTFILE_PREFIX will overwrite + * the efile_prefix dataset access property. + * This will create an HDF5 file in a subdirectory which will + * refer to ../extern_*a.raw + * The files are then accessed by setting the HDF5_EXTFILE_PREFIX + * environment variable to "${ORIGIN}". + * The efile_prefix dataset access property is set to "someprefix", + * which will cause an error if the value is not overwritten by + * the environment variable. + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Steffen Kiess + * March 10, 2015 + * + *------------------------------------------------------------------------- + */ +static int +test_path_env(hid_t fapl) +{ + hid_t file = -1; /* file to write to */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dapl = -1; /* dataset access property list */ + hid_t dset = -1; /* dataset */ + size_t i; /* miscellaneous counters */ + char cwdpath[1024]; /* working directory */ + char filename[1024]; /* file name */ + int part[PART_SIZE]; /* raw data buffer (partial) */ + int whole[TOTAL_SIZE]; /* raw data buffer (total) */ + hsize_t cur_size; /* current data space size */ + char buffer[1024]; /* buffer to read efile_prefix */ + + TESTING("prefix in HDF5_EXTFILE_PREFIX"); + + if(HDsetenv("HDF5_EXTFILE_PREFIX", "${ORIGIN}", 1)) + TEST_ERROR + + if(HDmkdir("extern_dir", (mode_t)0755) < 0 && errno != EEXIST) + TEST_ERROR; + + h5_fixname(FILENAME[4], fapl, filename, sizeof(filename)); + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + FAIL_STACK_ERROR + + /* Reset the raw data files */ + if(reset_raw_data_files() < 0) + TEST_ERROR + + /* Create the dataset */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR + if(NULL == HDgetcwd(cwdpath, sizeof(cwdpath))) + TEST_ERROR + for(i = 0; i < N_EXT_FILES; i++) { + HDsnprintf(filename, sizeof(filename), "..%sextern_%dr.raw", H5_DIR_SEPS, (int) i + 1); + if(H5Pset_external(dcpl, filename, (HDoff_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0) + FAIL_STACK_ERROR + } /* end for */ + + cur_size = TOTAL_SIZE; + if((space = H5Screate_simple(1, &cur_size, NULL)) < 0) + FAIL_STACK_ERROR + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + FAIL_STACK_ERROR + + /* Set prefix to a nonexistent directory, will be overwritten by environment variable */ + if(H5Pset_efile_prefix(dapl, "someprefix") < 0) + FAIL_STACK_ERROR + if(H5Pget_efile_prefix(dapl, buffer, sizeof(buffer)) < 0) + FAIL_STACK_ERROR + if(HDstrcmp(buffer, "someprefix") != 0) + FAIL_PUTS_ERROR("efile prefix not set correctly"); + + /* Create dataset */ + if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, dapl)) < 0) + FAIL_STACK_ERROR + + /* Read the entire dataset and compare with the original */ + HDmemset(whole, 0, sizeof(whole)); + if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0) + FAIL_STACK_ERROR + for(i = 0; i < TOTAL_SIZE; i++) + if(whole[i] != (signed)i) + FAIL_PUTS_ERROR("Incorrect value(s) read."); + + if(H5Dclose(dset) < 0) FAIL_STACK_ERROR + if(H5Pclose(dapl) < 0) FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR + if(H5Sclose(space) < 0) FAIL_STACK_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Pclose(dapl); + H5Dclose(dset); + H5Pclose(dcpl); + H5Sclose(space); + H5Fclose(file); + } H5E_END_TRY; + return 1; +} /* end test_path_env() */ + /*------------------------------------------------------------------------- * Function: main @@ -926,10 +1478,14 @@ main(void) nerrors += test_add_to_unlimited(); nerrors += test_overflow(); - /* These tests use the VFD-aware fapl */ + /* These file set tests use the VFD-aware fapl */ nerrors += test_read_file_set(current_fapl_id); nerrors += test_write_file_set(current_fapl_id); - + nerrors += test_path_absolute(current_fapl_id); + nerrors += test_path_relative(current_fapl_id); + nerrors += test_path_relative_cwd(current_fapl_id); + nerrors += test_path_env(current_fapl_id); + /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, current_fapl_id) < 0 ? 1 : 0); @@ -947,14 +1503,17 @@ main(void) /* Clean up files used by file set tests */ if(h5_cleanup(FILENAME, fapl_id_old)) { - HDremove("extern_1a.raw"); - HDremove("extern_1b.raw"); - HDremove("extern_2a.raw"); - HDremove("extern_2b.raw"); - HDremove("extern_3a.raw"); - HDremove("extern_3b.raw"); - HDremove("extern_4a.raw"); - HDremove("extern_4b.raw"); + HDremove("extern_1r.raw"); + HDremove("extern_2r.raw"); + HDremove("extern_3r.raw"); + HDremove("extern_4r.raw"); + + HDremove("extern_1w.raw"); + HDremove("extern_2w.raw"); + HDremove("extern_3w.raw"); + HDremove("extern_4w.raw"); + + HDrmdir("extern_dir"); } /* end if */ return EXIT_SUCCESS; -- cgit v0.12 From 57da3b7db60ab6dd29edfef4116b58dfc6f66b08 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 4 Feb 2016 11:06:38 -0500 Subject: [svn-r29043] Fixes to make relative external storage work on Windows. Part of HDFFV-8740. - Fixed typo in Wsetenv(). - Changed HDoff_t back to off_t in test/external.c. The function signature is off_t so the types must match or you can get conversion errors. Tested on 64-bit Windows 10 w/ VS 2015 --- src/H5system.c | 4 ++-- test/external.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/H5system.c b/src/H5system.c index 420ec85..eb09b15 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -813,8 +813,8 @@ Wsetenv(const char *name, const char *value, int overwrite) */ if(!overwrite) { err = getenv_s(&bufsize, NULL, 0, name); - if(err || bufsize) - return (int)err + if (err || bufsize) + return (int)err; } /* end if */ return (int)_putenv_s(name, value); diff --git a/test/external.c b/test/external.c index 3bf62c4..67fa2ec 100644 --- a/test/external.c +++ b/test/external.c @@ -222,7 +222,7 @@ test_non_extendible(hid_t file) hsize_t max_size[1]; /* data space maximum size */ int n; /* number of external files */ char name[256]; /* external file name */ - HDoff_t file_offset; /* external file offset */ + off_t file_offset; /* external file offset */ hsize_t file_size; /* sizeof external file segment */ haddr_t dset_addr; /* address of dataset */ @@ -494,7 +494,7 @@ test_unlimited(hid_t file) hsize_t max_size[1]; /* data space maximum size */ int n; /* number of external files */ char name[256]; /* external file name */ - HDoff_t file_offset; /* external file offset */ + off_t file_offset; /* external file offset */ hsize_t file_size; /* sizeof external file segment */ TESTING("unlimited dataspace, unlimited external storage"); @@ -810,7 +810,7 @@ test_read_file_set(hid_t fapl) FAIL_STACK_ERROR /* Verify data */ - for(i = hs_start; i < hs_start + hs_count; i++) { + for(i = (size_t)hs_start; i < (size_t)(hs_start + hs_count); i++) { if(whole[i] != (signed)i) FAIL_PUTS_ERROR("Incorrect value(s) read (hyperslab)."); } /* end for */ -- cgit v0.12 From 66947641209890553871e69f4474b450ed502ae5 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 5 Feb 2016 16:27:12 -0500 Subject: [svn-r29050] Setting --enable-build-mode=debug now creates an H5_DEBUG_BUILD definition. Tested on: linux VM (minor change) --- configure.ac | 1 + 1 file changed, 1 insertion(+) diff --git a/configure.ac b/configure.ac index 4ab4245..2fc71c8 100644 --- a/configure.ac +++ b/configure.ac @@ -193,6 +193,7 @@ case "X-$BUILD_MODE" in AC_MSG_RESULT([clean]) ;; X-debug) + AC_DEFINE([DEBUG_BUILD], [1], [Define if this is a debug build.]) H5_CFLAGS="$H5_CFLAGS $DEBUG_CFLAGS" H5_CPPFLAGS="$H5_CPPFLAGS $DEBUG_CPPFLAGS" H5_CXXFLAGS="$H5_CXXFLAGS $DEBUG_CXXFLAGS" -- cgit v0.12 From 48bebcc39ef565796356c159d16f09bfb0efba4d Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Sun, 7 Feb 2016 10:37:33 -0500 Subject: [svn-r29057] added dxpl type checking when debug mode is enabled (H5_DEBUG_BUILD) tested on bb-8 with Serial and Parallel, debug and production builds. --- src/H5A.c | 25 +- src/H5AC.c | 86 +++++-- src/H5ACmpio.c | 2 +- src/H5ACprivate.h | 13 +- src/H5Aint.c | 6 +- src/H5B.c | 2 +- src/H5Dchunk.c | 99 +++++--- src/H5Dcompact.c | 2 +- src/H5Dcontig.c | 51 ++-- src/H5Ddeprec.c | 12 +- src/H5Dfill.c | 6 +- src/H5Dint.c | 53 ++-- src/H5Dio.c | 126 ++++++++-- src/H5Dlayout.c | 12 +- src/H5Dmpio.c | 24 +- src/H5Dpkg.h | 22 +- src/H5Dscatgath.c | 8 +- src/H5Dselect.c | 2 +- src/H5Dvirtual.c | 15 +- src/H5FDint.c | 38 +++ src/H5FDmulti.c | 12 +- src/H5FDprivate.h | 11 + src/H5FS.c | 4 +- src/H5FScache.c | 6 +- src/H5FSpkg.h | 4 +- src/H5FSprivate.h | 2 +- src/H5FSsection.c | 8 +- src/H5Faccum.c | 12 +- src/H5Fio.c | 30 ++- src/H5HFcache.c | 10 +- src/H5HFhuge.c | 6 +- src/H5HFiblock.c | 4 +- src/H5HFsection.c | 13 +- src/H5HLdblk.c | 2 +- src/H5MFsection.c | 4 +- src/H5Ofill.c | 6 +- src/H5Pdxpl.c | 17 +- src/H5Pprivate.h | 1 - src/H5T.c | 362 +++++++++++++-------------- src/H5Tnative.c | 4 +- src/H5Zscaleoffset.c | 2 +- src/H5private.h | 3 + test/accum.c | 6 +- test/btree2.c | 98 ++++---- test/cache.c | 104 ++++---- test/cache_common.c | 20 +- test/earray.c | 190 +++++++------- test/efc.c | 4 +- test/farray.c | 114 ++++----- test/fheap.c | 332 ++++++++++++------------- test/freespace.c | 298 +++++++++++----------- test/gheap.c | 23 +- test/lheap.c | 8 +- test/mf.c | 680 +++++++++++++++++++++++++-------------------------- test/ohdr.c | 140 +++++------ testpar/t_cache.c | 10 +- tools/misc/h5debug.c | 46 ++-- 57 files changed, 1722 insertions(+), 1478 deletions(-) diff --git a/src/H5A.c b/src/H5A.c index 0a2f983..8f5380f 100644 --- a/src/H5A.c +++ b/src/H5A.c @@ -336,7 +336,7 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ H5T_t *type; /* Datatype to use for attribute */ H5S_t *space; /* Dataspace to use for attribute */ - hid_t dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; /* Return value */ FUNC_ENTER_API(FAIL) @@ -365,7 +365,6 @@ H5Acreate_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5G_loc_reset(&obj_loc); /* Verify access property list and get correct dxpl */ - dxpl_id = H5AC_dxpl_id; if(H5P_verify_apl_and_dxpl(&aapl_id, H5P_CLS_AACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") @@ -643,7 +642,7 @@ H5Awrite(hid_t attr_id, hid_t dtype_id, const void *buf) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Go write the actual data to the attribute */ - if((ret_value = H5A__write(attr, mem_type, buf, H5AC_dxpl_id)) < 0) + if((ret_value = H5A__write(attr, mem_type, buf, dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_WRITEERROR, FAIL, "unable to write attribute") done: @@ -692,7 +691,7 @@ H5Aread(hid_t attr_id, hid_t dtype_id, void *buf) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Go write the actual data to the attribute */ - if((ret_value = H5A__read(attr, mem_type, buf, H5AC_dxpl_id)) < 0) + if((ret_value = H5A__read(attr, mem_type, buf, dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_READERROR, FAIL, "unable to read attribute") done: @@ -1173,7 +1172,7 @@ H5Arename(hid_t loc_id, const char *old_name, const char *new_name) /* Avoid thrashing things if the names are the same */ if(HDstrcmp(old_name, new_name)) { - H5G_loc_t loc; /* Object location */ + H5G_loc_t loc; /* Object location */ if(H5G_loc(loc_id, & loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") @@ -1205,7 +1204,6 @@ herr_t H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, const char *new_attr_name, hid_t lapl_id) { - hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by the library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1222,13 +1220,14 @@ H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name, if(!new_attr_name || !*new_attr_name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no new attribute name") - /* Verify access property list and get correct dxpl */ - if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, TRUE) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") - /* Avoid thrashing things if the names are the same */ if(HDstrcmp(old_attr_name, new_attr_name)) { H5G_loc_t loc; /* Object location */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by the library */ + + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, TRUE) < 0) + HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") if(H5G_loc(loc_id, & loc) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") @@ -1507,7 +1506,7 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ - hid_t dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1524,7 +1523,6 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name") /* Verify access property list and get correct dxpl */ - dxpl_id = H5AC_dxpl_id; if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") @@ -1584,7 +1582,7 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'obj_name' found */ - hid_t dxpl_id; /* dxpl used by library */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -1603,7 +1601,6 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified") /* Verify access property list and get correct dxpl */ - dxpl_id = H5AC_dxpl_id; if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, TRUE) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") diff --git a/src/H5AC.c b/src/H5AC.c index 41fb78d..a58a211 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -82,7 +82,18 @@ hbool_t H5_PKG_INIT_VAR = FALSE; /* Default dataset transfer property list for metadata I/O calls */ hid_t H5AC_dxpl_id = (-1); + +/* DXPL to be used in operations that will not result in I/O calls */ +hid_t H5AC_noio_dxpl_id = (-1); + +/* Default DXPL to be used for raw data I/O operations when one is not + provided by the user (fill values in H5Dcreate) */ +hid_t H5AC_rawdata_dxpl_id = (-1); + +#ifdef H5_HAVE_PARALLEL +/* Environment variable for collective API sanity checks */ hbool_t H5_coll_api_sanity_check_g = false; +#endif /* H5_HAVE_PARALLEL */ /*******************/ /* Local Variables */ @@ -163,15 +174,15 @@ done: herr_t H5AC__init_package(void) { +#ifdef H5_DEBUG_BUILD + H5P_genplist_t *xfer_plist; /* Dataset transfer property list object */ + H5FD_dxpl_type_t dxpl_type; /* Property indicating the type of the internal dxpl */ +#endif /* H5_DEBUG_BUILD */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE #ifdef H5_HAVE_PARALLEL - /* Get an ID for the metadata (H5AC) dxpl */ - if((H5AC_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") - /* check whether to enable strict collective function calling sanity checks using MPI barriers */ { @@ -182,10 +193,47 @@ H5AC__init_package(void) H5_coll_api_sanity_check_g = (hbool_t)HDstrtol(s, NULL, 0); } } -#else /* H5_HAVE_PARALLEL */ - H5AC_dxpl_id = H5P_DATASET_XFER_DEFAULT; #endif /* H5_HAVE_PARALLEL */ +#ifdef H5_DEBUG_BUILD + /* Get an ID for the metadata (H5AC) dxpl */ + if((H5AC_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") + /* Get the property list object */ + if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_dxpl_id))) + HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") + /* Insert the dxpl type property */ + dxpl_type = H5FD_METADATA_DXPL; + if(H5P_set(xfer_plist, H5FD_DXPL_TYPE_NAME, &dxpl_type) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set dxpl type property") + + /* Get an ID for the no I/O internal dxpl */ + if((H5AC_noio_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") + /* Get the property list object */ + if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_noio_dxpl_id))) + HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") + /* Insert the dxpl type property */ + dxpl_type = H5FD_NOIO_DXPL; + if(H5P_set(xfer_plist, H5FD_DXPL_TYPE_NAME, &dxpl_type) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set dxpl type property") + + /* Get an ID for the metadata (H5AC) dxpl */ + if((H5AC_rawdata_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") + /* Get the property list object */ + if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_rawdata_dxpl_id))) + HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") + /* Insert the dxpl type property */ + dxpl_type = H5FD_RAWDATA_DXPL; + if(H5P_set(xfer_plist, H5FD_DXPL_TYPE_NAME, &dxpl_type) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set dxpl type property") +#else /* H5_DEBUG_BUILD */ + H5AC_dxpl_id = H5P_DATASET_XFER_DEFAULT; + H5AC_noio_dxpl_id = H5P_DATASET_XFER_DEFAULT; + H5AC_rawdata_dxpl_id = H5P_DATASET_XFER_DEFAULT; +#endif /* H5_DEBUG_BUILD */ + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5AC__init_package() */ @@ -213,19 +261,22 @@ H5AC_term_package(void) FUNC_ENTER_NOAPI_NOINIT_NOERR if(H5_PKG_INIT_VAR) { -#ifdef H5_HAVE_PARALLEL - if(H5AC_dxpl_id > 0) { + if(H5AC_dxpl_id > 0 || H5AC_noio_dxpl_id > 0 || H5AC_rawdata_dxpl_id > 0) { +#ifdef H5_DEBUG_BUILD /* Indicate more work to do */ n = 1; /* H5I */ /* Close H5AC dxpl */ - if(H5I_dec_ref(H5AC_dxpl_id) < 0) + if(H5I_dec_ref(H5AC_dxpl_id) < 0 || + H5I_dec_ref(H5AC_noio_dxpl_id) < 0 || + H5I_dec_ref(H5AC_rawdata_dxpl_id) < 0) H5E_clear_stack(NULL); /*ignore error*/ +#endif /* H5_DEBUG_BUILD */ + /* Reset static IDs */ + H5AC_dxpl_id = (-1); + H5AC_noio_dxpl_id = (-1); + H5AC_rawdata_dxpl_id = (-1); } /* end if */ -#endif /* H5_HAVE_PARALLEL */ - - /* Reset static IDs */ - H5AC_dxpl_id = (-1); /* Reset interface initialization flag */ if(0 == n) @@ -735,7 +786,7 @@ H5AC_insert_entry(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t add /* Check if we should try to flush */ if(aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold) - if(H5AC__run_sync_point(f, H5AC_dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) + if(H5AC__run_sync_point(f, dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point.") } /* end if */ } @@ -830,7 +881,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t new_addr) +H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, + haddr_t new_addr, hid_t dxpl_id) { #if H5AC__TRACE_FILE_ENABLED char trace[128] = ""; @@ -874,7 +926,7 @@ H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, haddr_t old_addr, haddr_t ne #ifdef H5_HAVE_PARALLEL /* Check if we should try to flush */ if(NULL != aux_ptr && aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold) - if(H5AC__run_sync_point(f, H5AC_dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) + if(H5AC__run_sync_point(f, dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point.") #endif /* H5_HAVE_PARALLEL */ @@ -1356,7 +1408,7 @@ H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, #ifdef H5_HAVE_PARALLEL /* Check if we should try to flush */ if((aux_ptr != NULL) && (aux_ptr->dirty_bytes >= aux_ptr->dirty_bytes_threshold)) - if(H5AC__run_sync_point(f, H5AC_dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) + if(H5AC__run_sync_point(f, dxpl_id, H5AC_SYNC_POINT_OP__FLUSH_TO_MIN_CLEAN) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't run sync point.") #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c index ca2582e..79b0b54 100644 --- a/src/H5ACmpio.c +++ b/src/H5ACmpio.c @@ -1874,7 +1874,7 @@ H5AC__rsp__p0_only__flush(H5F_t *f, hid_t dxpl_id) } /* end if */ /* Propagate cleaned entries to other ranks. */ - if(H5AC__propagate_flushed_and_still_clean_entries_list(f, H5AC_dxpl_id) < 0) + if(H5AC__propagate_flushed_and_still_clean_entries_list(f, dxpl_id) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't propagate clean entries list.") done: diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 3101abe..f441854 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -181,8 +181,6 @@ typedef H5C_cache_entry_t H5AC_info_t; /* Typedef for metadata cache (defined in H5Cpkg.h) */ typedef H5C_t H5AC_t; -/* Metadata specific properties for FAPL */ -/* (Only used for parallel I/O) */ #ifdef H5_HAVE_PARALLEL /* Definitions for "collective metadata write" property */ #define H5AC_COLLECTIVE_META_WRITE_NAME "H5AC_collective_metadata_write" @@ -196,9 +194,16 @@ typedef H5C_t H5AC_t; #define H5AC_RING_NAME "H5AC_ring_type" -/* Dataset transfer property list for flush calls */ +/* Dataset transfer property list for metadata calls */ H5_DLLVAR hid_t H5AC_dxpl_id; +/* DXPL to be used in operations that will not result in I/O calls */ +extern hid_t H5AC_noio_dxpl_id; + +/* DXPL to be used for raw data I/O operations when one is not + provided by the user (fill values in H5Dcreate) */ +extern hid_t H5AC_rawdata_dxpl_id; + /* Default cache configuration. */ #define H5AC__DEFAULT_METADATA_WRITE_STRATEGY \ @@ -337,7 +342,7 @@ H5_DLL herr_t H5AC_unprotect(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, H5_DLL herr_t H5AC_flush(H5F_t *f, hid_t dxpl_id); H5_DLL herr_t H5AC_mark_entry_dirty(void *thing); H5_DLL herr_t H5AC_move_entry(H5F_t *f, const H5AC_class_t *type, - haddr_t old_addr, haddr_t new_addr); + haddr_t old_addr, haddr_t new_addr, hid_t dxpl_id); H5_DLL herr_t H5AC_dest(H5F_t *f, hid_t dxpl_id); H5_DLL herr_t H5AC_expunge_entry(H5F_t *f, hid_t dxpl_id, const H5AC_class_t *type, haddr_t addr, unsigned flags); diff --git a/src/H5Aint.c b/src/H5Aint.c index 785ddc5..1736dc0 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -161,7 +161,7 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, * name, but it's going to be hard to unwind all the special cases on * failure, so just check first, for now - QAK) */ - if((exists = H5O_attr_exists(loc->oloc, name, H5AC_dxpl_id)) < 0) + if((exists = H5O_attr_exists(loc->oloc, name, dxpl_id)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "error checking attributes") else if(exists > 0) HGOTO_ERROR(H5E_ATTR, H5E_ALREADYEXISTS, NULL, "attribute already exists") @@ -2105,7 +2105,7 @@ H5A_attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_si HDmemcpy(attr_dst->shared->data, buf, attr_dst->shared->data_size); - if(H5D_vlen_reclaim(tid_mem, buf_space, H5P_DATASET_XFER_DEFAULT, reclaim_buf) < 0) + if(H5D_vlen_reclaim(tid_mem, buf_space, dxpl_id, reclaim_buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_BADITER, NULL, "unable to reclaim variable-length data") } /* end if */ else { @@ -2397,7 +2397,7 @@ H5A_rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_nam H5G_loc_reset(&obj_loc); /* Find the object's location */ - if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, H5AC_dxpl_id) < 0) + if(H5G_loc_find(&loc, obj_name, &obj_loc/*out*/, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "object not found") loc_found = TRUE; diff --git a/src/H5B.c b/src/H5B.c index c87e332..fcf61e1 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -653,7 +653,7 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void bt_ud.bt = NULL; /* Make certain future references will be caught */ /* Move the location of the old root on the disk */ - if(H5AC_move_entry(f, H5AC_BT, bt_ud.addr, old_root_addr) < 0) + if(H5AC_move_entry(f, H5AC_BT, bt_ud.addr, old_root_addr, dxpl_id) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to move B-tree root node") bt_ud.addr = old_root_addr; diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index b0abdf1..5657e6e 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -362,22 +362,35 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, H5D_chk_idx_info_t idx_info; /* Chunked index info */ hsize_t scaled[H5S_MAX_RANK]; /* Scaled coordinates for this chunk */ hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */ + H5D_io_info_t io_info; /* to hold the dset and two dxpls (meta and raw data) */ + hbool_t md_dxpl_generated = FALSE; /* bool to indicate whether we should free the md_dxpl_id at exit */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC_TAG(dxpl_id, dset->oloc.addr, FAIL) + io_info.dset = dset; + io_info.raw_dxpl_id = dxpl_id; + io_info.md_dxpl_id = dxpl_id; + + /* set the dxpl IO type for sanity checking at the FD layer */ +#ifdef H5_DEBUG_BUILD + if(H5D_set_io_info_dxpls(&io_info, dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't set metadata and raw data dxpls") + md_dxpl_generated = TRUE; +#endif /* H5_DEBUG_BUILD */ + /* Allocate dataspace and initialize it if it hasn't been. */ - if(!(*layout->ops->is_space_alloc)(&layout->storage)) + if(!(*layout->ops->is_space_alloc)(&layout->storage)) { /* Allocate storage */ - if(H5D__alloc_storage(dset, dxpl_id, H5D_ALLOC_WRITE, FALSE, NULL) < 0) + if(H5D__alloc_storage(&io_info, H5D_ALLOC_WRITE, FALSE, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage") - + } /* Calculate the index of this chunk */ H5VM_chunk_scaled(dset->shared->ndims, offset, layout->u.chunk.dim, scaled); scaled[dset->shared->ndims] = 0; /* Find out the file address of the chunk (if any) */ - if(H5D__chunk_lookup(dset, dxpl_id, scaled, &udata) < 0) + if(H5D__chunk_lookup(dset, io_info.md_dxpl_id, scaled, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") /* Sanity check */ @@ -395,7 +408,7 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; - idx_info.dxpl_id = dxpl_id; + idx_info.dxpl_id = io_info.md_dxpl_id; idx_info.pline = &(dset->shared->dcpl_cache.pline); idx_info.layout = &(dset->shared->layout.u.chunk); idx_info.storage = &(dset->shared->layout.storage.u.chunk); @@ -421,15 +434,15 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, const H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache */ /* Fill the DXPL cache values for later use */ - if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0) + if(H5D__get_dxpl_cache(io_info.raw_dxpl_id, &dxpl_cache) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") - if(H5D__chunk_cache_evict(dset, dxpl_id, dxpl_cache, rdcc->slot[udata.idx_hint], FALSE) < 0) + if(H5D__chunk_cache_evict(dset, io_info.md_dxpl_id, dxpl_cache, rdcc->slot[udata.idx_hint], FALSE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "unable to evict chunk") } /* end if */ /* Write the data to the file */ - if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, data_size, dxpl_id, buf) < 0) + if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, data_size, io_info.raw_dxpl_id, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file") /* Insert the chunk record into the index */ @@ -442,6 +455,10 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, } /* end if */ done: +#ifdef H5_DEBUG_BUILD + if(md_dxpl_generated && H5I_dec_ref(io_info.md_dxpl_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close metadata dxpl") +#endif /* H5_DEBUG_BUILD */ FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5D__chunk_direct_write() */ @@ -1911,7 +1928,7 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, chunk_info = H5D_CHUNK_GET_NODE_INFO(fm, chunk_node); /* Get the info for the chunk in the file */ - if(H5D__chunk_lookup(io_info->dset, io_info->dxpl_id, chunk_info->scaled, &udata) < 0) + if(H5D__chunk_lookup(io_info->dset, io_info->md_dxpl_id, chunk_info->scaled, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") /* Sanity check */ @@ -2044,7 +2061,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, chunk_info = H5D_CHUNK_GET_NODE_INFO(fm, chunk_node); /* Look up the chunk */ - if(H5D__chunk_lookup(io_info->dset, io_info->dxpl_id, chunk_info->scaled, &udata) < 0) + if(H5D__chunk_lookup(io_info->dset, io_info->md_dxpl_id, chunk_info->scaled, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") /* Sanity check */ @@ -2087,7 +2104,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, if(!H5F_addr_defined(udata.chunk_block.offset)) { /* Compose chunked index info struct */ idx_info.f = io_info->dset->oloc.file; - idx_info.dxpl_id = io_info->dxpl_id; + idx_info.dxpl_id = io_info->md_dxpl_id; idx_info.pline = &(io_info->dset->shared->dcpl_cache.pline); idx_info.layout = &(io_info->dset->shared->layout.u.chunk); idx_info.storage = &(io_info->dset->shared->layout.storage.u.chunk); @@ -2773,7 +2790,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t /* Write the data to the file */ HDassert(H5F_addr_defined(udata.chunk_block.offset)); H5_CHECK_OVERFLOW(udata.chunk_block.length, hsize_t, size_t); - if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, (size_t)udata.chunk_block.length, dxpl_id, buf) < 0) + if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, (size_t)udata.chunk_block.length, H5AC_rawdata_dxpl_id, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data to file") /* Insert the chunk record into the index */ @@ -3055,7 +3072,8 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, HDassert(io_info->store); HDassert(udata); HDassert(dset); - HDassert(TRUE == H5P_isa_class(io_info->dxpl_id, H5P_DATASET_XFER)); + HDassert(TRUE == H5P_isa_class(io_info->md_dxpl_id, H5P_DATASET_XFER)); + HDassert(TRUE == H5P_isa_class(io_info->raw_dxpl_id, H5P_DATASET_XFER)); HDassert(!rdcc->tmp_head); /* Get the chunk's size */ @@ -3145,7 +3163,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, * size in memory, so allocate memory big enough. */ if(NULL == (chunk = H5D__chunk_mem_alloc(my_chunk_alloc, pline))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk") - if(H5F_block_read(dset->oloc.file, H5FD_MEM_DRAW, chunk_addr, my_chunk_alloc, io_info->dxpl_id, chunk) < 0) + if(H5F_block_read(dset->oloc.file, H5FD_MEM_DRAW, chunk_addr, my_chunk_alloc, io_info->raw_dxpl_id, chunk) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "unable to read raw data chunk") if(pline->nused) @@ -3183,14 +3201,14 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, /* (use the compact dataset storage buffer as the fill value buffer) */ if(H5D__fill_init(&fb_info, chunk, NULL, NULL, NULL, NULL, &dset->shared->dcpl_cache.fill, dset->shared->type, - dset->shared->type_id, (size_t)0, chunk_size, io_info->dxpl_id) < 0) + dset->shared->type_id, (size_t)0, chunk_size, io_info->md_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "can't initialize fill buffer info") fb_info_init = TRUE; /* Check for VL datatype & non-default fill value */ if(fb_info.has_vlen_fill_type) /* Fill the buffer with VL datatype fill values */ - if(H5D__fill_refill_vl(&fb_info, fb_info.elmts_per_buf, io_info->dxpl_id) < 0) + if(H5D__fill_refill_vl(&fb_info, fb_info.elmts_per_buf, io_info->md_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, NULL, "can't refill fill value buffer") } /* end if */ else @@ -3211,10 +3229,10 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, if(!ent || !ent->locked) { /* Preempt enough things from the cache to make room */ if(ent) { - if(H5D__chunk_cache_evict(io_info->dset, io_info->dxpl_id, io_info->dxpl_cache, ent, TRUE) < 0) + if(H5D__chunk_cache_evict(io_info->dset, io_info->md_dxpl_id, io_info->dxpl_cache, ent, TRUE) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk from cache") } /* end if */ - if(H5D__chunk_cache_prune(io_info->dset, io_info->dxpl_id, io_info->dxpl_cache, chunk_size) < 0) + if(H5D__chunk_cache_prune(io_info->dset, io_info->md_dxpl_id, io_info->dxpl_cache, chunk_size) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, NULL, "unable to preempt chunk(s) from cache") /* Create a new entry */ @@ -3342,7 +3360,7 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, fake_ent.chunk_block.length = udata->chunk_block.length; fake_ent.chunk = (uint8_t *)chunk; - if(H5D__chunk_flush_entry(io_info->dset, io_info->dxpl_id, io_info->dxpl_cache, &fake_ent, TRUE) < 0) + if(H5D__chunk_flush_entry(io_info->dset, io_info->md_dxpl_id, io_info->dxpl_cache, &fake_ent, TRUE) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "cannot flush indexed storage buffer") } /* end if */ else { @@ -3480,9 +3498,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, - hsize_t old_dim[]) +H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]) { + const H5D_t *dset = io_info->dset; /* the dataset pointer */ H5D_chk_idx_info_t idx_info; /* Chunked index info */ const H5D_chunk_ops_t *ops = dset->shared->layout.storage.u.chunk.ops; /* Chunk operations */ hsize_t min_unalloc[H5O_LAYOUT_NDIMS]; /* First chunk in each dimension that is unallocated (in scaled coordinates) */ @@ -3503,6 +3521,8 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, hbool_t using_mpi = FALSE; /* Flag to indicate that the file is being accessed with an MPI-capable file driver */ H5D_chunk_coll_info_t chunk_info; /* chunk address information for doing I/O */ #endif /* H5_HAVE_PARALLEL */ + hid_t md_dxpl_id = io_info->md_dxpl_id; + hid_t raw_dxpl_id = io_info->raw_dxpl_id; hbool_t carry; /* Flag to indicate that chunk increment carrys to higher dimension (sorta) */ unsigned space_ndims; /* Dataset's space rank */ const hsize_t *space_dim; /* Dataset's dataspace dimensions */ @@ -3513,13 +3533,14 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, const H5O_storage_chunk_t *sc = &(layout->storage.u.chunk); herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_PACKAGE_TAG(dxpl_id, dset->oloc.addr, FAIL) + FUNC_ENTER_PACKAGE_TAG(md_dxpl_id, dset->oloc.addr, FAIL) /* Check args */ HDassert(dset && H5D_CHUNKED == layout->type); HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS); H5D_CHUNK_STORAGE_INDEX_CHK(sc); - HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER)); + HDassert(TRUE == H5P_isa_class(md_dxpl_id, H5P_DATASET_XFER)); + HDassert(TRUE == H5P_isa_class(raw_dxpl_id, H5P_DATASET_XFER)); /* Retrieve the dataset dimensions */ space_dim = dset->shared->curr_dims; @@ -3550,7 +3571,7 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, #endif /* H5_HAVE_PARALLEL */ /* Fill the DXPL cache values for later use */ - if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0) + if(H5D__get_dxpl_cache(raw_dxpl_id, &dxpl_cache) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") /* Get original chunk size */ @@ -3580,7 +3601,7 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, if(H5D__fill_init(&fb_info, NULL, (H5MM_allocate_t)H5D__chunk_mem_alloc, (void *)pline, (H5MM_free_t)H5D__chunk_mem_xfree, (void *)pline, &dset->shared->dcpl_cache.fill, dset->shared->type, - dset->shared->type_id, (size_t)0, orig_chunk_size, dxpl_id) < 0) + dset->shared->type_id, (size_t)0, orig_chunk_size, md_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info") fb_info_init = TRUE; @@ -3604,7 +3625,7 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; - idx_info.dxpl_id = dxpl_id; + idx_info.dxpl_id = md_dxpl_id; idx_info.pline = &dset->shared->dcpl_cache.pline; idx_info.layout = &dset->shared->layout.u.chunk; idx_info.storage = &dset->shared->layout.storage.u.chunk; @@ -3658,7 +3679,7 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, hbool_t need_insert = FALSE; /* Whether the chunk needs to be inserted into the index */ /* Look up this chunk */ - if(H5D__chunk_lookup(dset, dxpl_id, scaled, &udata) < 0) + if(H5D__chunk_lookup(dset, md_dxpl_id, scaled, &udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") #ifndef NDEBUG /* None of the chunks should be allocated */ @@ -3696,7 +3717,7 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, } /* end if */ /* Fill the buffer with VL datatype fill values */ - if(H5D__fill_refill_vl(&fb_info, fb_info.elmts_per_buf, dxpl_id) < 0) + if(H5D__fill_refill_vl(&fb_info, fb_info.elmts_per_buf, md_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer") /* Check if there are filters which need to be applied to the chunk */ @@ -3758,7 +3779,7 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, } /* end if */ else { #endif /* H5_HAVE_PARALLEL */ - if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, chunk_size, dxpl_id, fb_info.fill_buf) < 0) + if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, chunk_size, raw_dxpl_id, fb_info.fill_buf) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file") #ifdef H5_HAVE_PARALLEL } /* end else */ @@ -3799,7 +3820,7 @@ H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, hbool_t full_overwrite, #ifdef H5_HAVE_PARALLEL /* do final collective I/O */ if(using_mpi && blocks_written) - if(H5D__chunk_collective_fill(dset, dxpl_id, &chunk_info, chunk_size, fb_info.fill_buf) < 0) + if(H5D__chunk_collective_fill(dset, raw_dxpl_id, &chunk_info, chunk_size, fb_info.fill_buf) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file") #endif /* H5_HAVE_PARALLEL */ @@ -4014,7 +4035,7 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata) H5_CHECKED_ASSIGN(chunk_size, size_t, layout->u.chunk.size, uint32_t); /* Get the info for the chunk in the file */ - if(H5D__chunk_lookup(dset, io_info->dxpl_id, scaled, &chk_udata) < 0) + if(H5D__chunk_lookup(dset, io_info->md_dxpl_id, scaled, &chk_udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") /* If this chunk does not exist in cache or on disk, no need to do anything */ @@ -4027,7 +4048,7 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata) if(H5D__fill_init(&udata->fb_info, NULL, NULL, NULL, NULL, NULL, &dset->shared->dcpl_cache.fill, dset->shared->type, dset->shared->type_id, (size_t)udata->elmts_per_chunk, - chunk_size, io_info->dxpl_id) < 0) + chunk_size, io_info->md_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info") udata->fb_info_init = TRUE; } /* end if */ @@ -4064,7 +4085,7 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata) /* Check for VL datatype & non-default fill value */ if(udata->fb_info.has_vlen_fill_type) /* Re-fill the buffer to use for this I/O operation */ - if(H5D__fill_refill_vl(&udata->fb_info, (size_t)sel_nelmts, io_info->dxpl_id) < 0) + if(H5D__fill_refill_vl(&udata->fb_info, (size_t)sel_nelmts, io_info->md_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer") /* Create a selection iterator for scattering the elements to memory buffer */ @@ -4276,6 +4297,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) * will never change. */ chk_store.chunk.scaled = scaled; H5D_BUILD_IO_INFO_RD(&chk_io_info, dset, dxpl_cache, dxpl_id, &chk_store, NULL); + chk_io_info.raw_dxpl_id = H5AC_rawdata_dxpl_id; /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; @@ -4548,7 +4570,7 @@ H5D__chunk_addrmap(const H5D_io_info_t *io_info, haddr_t chunk_addr[]) /* Compose chunked index info struct */ idx_info.f = dset->oloc.file; - idx_info.dxpl_id = io_info->dxpl_id; + idx_info.dxpl_id = io_info->md_dxpl_id; idx_info.pline = &dset->shared->dcpl_cache.pline; idx_info.layout = &dset->shared->layout.u.chunk; idx_info.storage = &dset->shared->layout.storage.u.chunk; @@ -4793,7 +4815,6 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) hbool_t must_filter = FALSE; /* Whether chunk must be filtered during copy */ size_t nbytes; /* Size of chunk in file (in bytes) */ H5Z_cb_t cb_struct; /* Filter failure callback struct */ - int ret_value = H5_ITER_CONT; /* Return value */ FUNC_ENTER_STATIC @@ -4840,7 +4861,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) } /* end if */ /* read chunk data from the source file */ - if(H5F_block_read(udata->file_src, H5FD_MEM_DRAW, chunk_rec->chunk_addr, nbytes, udata->idx_info_dst->dxpl_id, buf) < 0) + if(H5F_block_read(udata->file_src, H5FD_MEM_DRAW, chunk_rec->chunk_addr, nbytes, H5AC_rawdata_dxpl_id, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, H5_ITER_ERROR, "unable to read raw data chunk") /* Need to uncompress variable-length & reference data elements */ @@ -4878,7 +4899,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "datatype conversion failed") /* Reclaim space from variable length data */ - if(H5D_vlen_reclaim(tid_mem, buf_space, H5P_DATASET_XFER_DEFAULT, reclaim_buf) < 0) + if(H5D_vlen_reclaim(tid_mem, buf_space, udata->idx_info_dst->dxpl_id, reclaim_buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_BADITER, H5_ITER_ERROR, "unable to reclaim variable-length data") } /* end if */ else if(fix_ref) { @@ -4930,7 +4951,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) /* Write chunk data to destination file */ HDassert(H5F_addr_defined(udata_dst.chunk_block.offset)); - if(H5F_block_write(udata->idx_info_dst->f, H5FD_MEM_DRAW, udata_dst.chunk_block.offset, nbytes, udata->idx_info_dst->dxpl_id, buf) < 0) + if(H5F_block_write(udata->idx_info_dst->f, H5FD_MEM_DRAW, udata_dst.chunk_block.offset, nbytes, H5AC_rawdata_dxpl_id, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, H5_ITER_ERROR, "unable to write raw data to file") /* Set metadata tag in dxpl_id */ @@ -5548,7 +5569,7 @@ H5D__nonexistent_readvv(const H5D_io_info_t *io_info, /* Set up user data for H5VM_opvv() */ udata.rbuf = (unsigned char *)io_info->u.rbuf; udata.dset = io_info->dset; - udata.dxpl_id = io_info->dxpl_id; + udata.dxpl_id = io_info->md_dxpl_id; /* Call generic sequence operation routine */ if((ret_value = H5VM_opvv(chunk_max_nseq, chunk_curr_seq, chunk_len_arr, chunk_off_arr, diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index df2a740..224a1d1 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -546,7 +546,7 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *storage_src, H5F_t *f_dst HDmemcpy(storage_dst->buf, buf, storage_dst->size); - if(H5D_vlen_reclaim(tid_mem, buf_space, H5P_DATASET_XFER_DEFAULT, reclaim_buf) < 0) + if(H5D_vlen_reclaim(tid_mem, buf_space, dxpl_id, reclaim_buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to reclaim variable-length data") } /* end if */ else if(H5T_get_class(dt_src, FALSE) == H5T_REFERENCE) { diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 484514f..c75ae43 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -195,8 +195,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5D__contig_fill(const H5D_t *dset, hid_t dxpl_id) +H5D__contig_fill(const H5D_io_info_t *io_info) { + const H5D_t *dset = io_info->dset; /* the dataset pointer */ H5D_io_info_t ioinfo; /* Dataset I/O info */ H5D_storage_t store; /* Union of storage info for dataset */ H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */ @@ -211,15 +212,17 @@ H5D__contig_fill(const H5D_t *dset, hid_t dxpl_id) hbool_t blocks_written = FALSE; /* Flag to indicate that chunk was actually written */ hbool_t using_mpi = FALSE; /* Flag to indicate that the file is being accessed with an MPI-capable file driver */ #endif /* H5_HAVE_PARALLEL */ + hid_t md_dxpl_id = io_info->md_dxpl_id; + hid_t raw_dxpl_id = io_info->raw_dxpl_id; H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */ hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */ - hid_t my_dxpl_id; /* DXPL ID to use for this operation */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE /* Check args */ - HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER)); + HDassert(TRUE == H5P_isa_class(md_dxpl_id, H5P_DATASET_XFER)); + HDassert(TRUE == H5P_isa_class(raw_dxpl_id, H5P_DATASET_XFER)); HDassert(dset && H5D_CONTIGUOUS == dset->shared->layout.type); HDassert(H5F_addr_defined(dset->shared->layout.storage.u.contig.addr)); HDassert(dset->shared->layout.storage.u.contig.size > 0); @@ -239,20 +242,11 @@ H5D__contig_fill(const H5D_t *dset, hid_t dxpl_id) /* Set the MPI-capable file driver flag */ using_mpi = TRUE; - - /* Use the internal "independent" DXPL */ - my_dxpl_id = H5AC_dxpl_id; } /* end if */ - else { -#endif /* H5_HAVE_PARALLEL */ - /* Use the DXPL we were given */ - my_dxpl_id = dxpl_id; -#ifdef H5_HAVE_PARALLEL - } /* end else */ #endif /* H5_HAVE_PARALLEL */ /* Fill the DXPL cache values for later use */ - if(H5D__get_dxpl_cache(my_dxpl_id, &dxpl_cache) < 0) + if(H5D__get_dxpl_cache(raw_dxpl_id, &dxpl_cache) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") /* Initialize storage info for this dataset */ @@ -268,7 +262,7 @@ H5D__contig_fill(const H5D_t *dset, hid_t dxpl_id) if(H5D__fill_init(&fb_info, NULL, NULL, NULL, NULL, NULL, &dset->shared->dcpl_cache.fill, dset->shared->type, dset->shared->type_id, npoints, - dxpl_cache->max_temp_buf, my_dxpl_id) < 0) + dxpl_cache->max_temp_buf, md_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info") fb_info_init = TRUE; @@ -276,7 +270,7 @@ H5D__contig_fill(const H5D_t *dset, hid_t dxpl_id) offset = 0; /* Simple setup for dataset I/O info struct */ - H5D_BUILD_IO_INFO_WRT(&ioinfo, dset, dxpl_cache, my_dxpl_id, &store, fb_info.fill_buf); + H5D_BUILD_IO_INFO_WRT(&ioinfo, dset, dxpl_cache, raw_dxpl_id, &store, fb_info.fill_buf); /* * Fill the entire current extent with the fill value. We can do @@ -296,7 +290,7 @@ H5D__contig_fill(const H5D_t *dset, hid_t dxpl_id) /* Check for VL datatype & non-default fill value */ if(fb_info.has_vlen_fill_type) /* Re-fill the buffer to use for this I/O operation */ - if(H5D__fill_refill_vl(&fb_info, curr_points, my_dxpl_id) < 0) + if(H5D__fill_refill_vl(&fb_info, curr_points, md_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer") #ifdef H5_HAVE_PARALLEL @@ -940,7 +934,7 @@ H5D__contig_readvv(const H5D_io_info_t *io_info, udata.dset_contig = &(io_info->dset->shared->cache.contig); udata.store_contig = &(io_info->store->contig); udata.rbuf = (unsigned char *)io_info->u.rbuf; - udata.dxpl_id = io_info->dxpl_id; + udata.dxpl_id = io_info->raw_dxpl_id; /* Call generic sequence operation routine */ if((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, @@ -955,7 +949,7 @@ H5D__contig_readvv(const H5D_io_info_t *io_info, udata.file = io_info->dset->oloc.file; udata.dset_addr = io_info->store->contig.dset_addr; udata.rbuf = (unsigned char *)io_info->u.rbuf; - udata.dxpl_id = io_info->dxpl_id; + udata.dxpl_id = io_info->raw_dxpl_id; /* Call generic sequence operation routine */ if((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, @@ -1266,7 +1260,7 @@ H5D__contig_writevv(const H5D_io_info_t *io_info, udata.dset_contig = &(io_info->dset->shared->cache.contig); udata.store_contig = &(io_info->store->contig); udata.wbuf = (const unsigned char *)io_info->u.wbuf; - udata.dxpl_id = io_info->dxpl_id; + udata.dxpl_id = io_info->raw_dxpl_id; /* Call generic sequence operation routine */ if((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, @@ -1281,7 +1275,7 @@ H5D__contig_writevv(const H5D_io_info_t *io_info, udata.file = io_info->dset->oloc.file; udata.dset_addr = io_info->store->contig.dset_addr; udata.wbuf = (const unsigned char *)io_info->u.wbuf; - udata.dxpl_id = io_info->dxpl_id; + udata.dxpl_id = io_info->raw_dxpl_id; /* Call generic sequence operation routine */ if((ret_value = H5VM_opvv(dset_max_nseq, dset_curr_seq, dset_len_arr, dset_off_arr, @@ -1308,7 +1302,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D__contig_flush(H5D_t *dset, hid_t dxpl_id) +H5D__contig_flush(H5D_t *dset, hid_t H5_ATTR_UNUSED dxpl_id) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1317,8 +1311,9 @@ H5D__contig_flush(H5D_t *dset, hid_t dxpl_id) /* Sanity check */ HDassert(dset); - /* Flush any data in sieve buffer */ - if(H5D__flush_sieve_buf(dset, dxpl_id) < 0) + /* Flush any data in sieve buffer - use the raw data dxpl since + the one passed in is a metadata dxpl. */ + if(H5D__flush_sieve_buf(dset, H5AC_rawdata_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush sieve buffer") done: @@ -1517,8 +1512,8 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, dst_nbytes = mem_nbytes = src_nbytes; } /* end if */ - /* Read raw data from source file */ - if(H5F_block_read(f_src, H5FD_MEM_DRAW, addr_src, src_nbytes, H5P_DATASET_XFER_DEFAULT, buf) < 0) + /* Read raw data from source file - use raw dxpl because passed in one is metadata */ + if(H5F_block_read(f_src, H5FD_MEM_DRAW, addr_src, src_nbytes, H5AC_rawdata_dxpl_id, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to read raw data") /* Perform datatype conversion, if necessary */ @@ -1538,7 +1533,7 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed") /* Reclaim space from variable length data */ - if(H5D_vlen_reclaim(tid_mem, buf_space, H5P_DATASET_XFER_DEFAULT, reclaim_buf) < 0) + if(H5D_vlen_reclaim(tid_mem, buf_space, dxpl_id, reclaim_buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to reclaim variable-length data") } /* end if */ else if(fix_ref) { @@ -1561,8 +1556,8 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, HDmemset(buf, 0, src_nbytes); } /* end if */ - /* Write raw data to destination file */ - if(H5F_block_write(f_dst, H5FD_MEM_DRAW, addr_dst, dst_nbytes, H5P_DATASET_XFER_DEFAULT, buf) < 0) + /* Write raw data to destination file - use raw dxpl because passed in one is metadata */ + if(H5F_block_write(f_dst, H5FD_MEM_DRAW, addr_dst, dst_nbytes, H5AC_rawdata_dxpl_id, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write raw data") /* Adjust loop variables */ diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index a4eb67f..c5d6929 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -360,10 +360,16 @@ H5D__extend(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id) /* Allocate space for the new parts of the dataset, if appropriate */ fill = &dataset->shared->dcpl_cache.fill; - if(fill->alloc_time == H5D_ALLOC_TIME_EARLY) - if(H5D__alloc_storage(dataset, dxpl_id, H5D_ALLOC_EXTEND, FALSE, old_dims) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize dataset with fill value") + if(fill->alloc_time == H5D_ALLOC_TIME_EARLY) { + H5D_io_info_t io_info; + + io_info.dset = dataset; + io_info.raw_dxpl_id = H5AC_rawdata_dxpl_id; + io_info.md_dxpl_id = dxpl_id; + if(H5D__alloc_storage(&io_info, H5D_ALLOC_EXTEND, FALSE, old_dims) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize dataset with fill value") + } /* Mark the dataspace as dirty, for later writing to the file */ if(H5D__mark(dataset, dxpl_id, H5D_MARK_SPACE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark dataspace as dirty") diff --git a/src/H5Dfill.c b/src/H5Dfill.c index 59925d8..e5b2161 100644 --- a/src/H5Dfill.c +++ b/src/H5Dfill.c @@ -134,7 +134,7 @@ H5Dfill(const void *fill, hid_t fill_type_id, void *buf, hid_t buf_type_id, hid_ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not a datatype") /* Fill the selection in the memory buffer */ - if(H5D__fill(fill, fill_type, buf, buf_type, space, H5AC_dxpl_id) < 0) + if(H5D__fill(fill, fill_type, buf, buf_type, space, H5AC_noio_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTENCODE, FAIL, "filling selection failed") done: @@ -172,7 +172,7 @@ done: --------------------------------------------------------------------------*/ herr_t H5D__fill(const void *fill, const H5T_t *fill_type, void *buf, - const H5T_t *buf_type, const H5S_t *space, hid_t dxpl_id) + const H5T_t *buf_type, const H5S_t *space, hid_t dxpl_id) { H5WB_t *elem_wb = NULL; /* Wrapped buffer for element data */ uint8_t elem_buf[H5T_ELEM_BUF_SIZE]; /* Buffer for element data */ @@ -565,7 +565,7 @@ done: */ herr_t H5D__fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts, hid_t dxpl_id) -{ +{ herr_t ret_value = SUCCEED; /* Return value */ void * buf = NULL; /* Temporary fill buffer */ diff --git a/src/H5Dint.c b/src/H5Dint.c index d35e9f5..9d588ae 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -66,8 +66,8 @@ static herr_t H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, static herr_t H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, char **extfile_prefix); static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id); -static herr_t H5D__init_storage(const H5D_t *dataset, hbool_t full_overwrite, - hsize_t old_dim[], hid_t dxpl_id); +static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, + hsize_t old_dim[]); /*********************/ @@ -1610,7 +1610,13 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id) if((H5F_INTENT(dataset->oloc.file) & H5F_ACC_RDWR) && !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage) && H5F_HAS_FEATURE(dataset->oloc.file, H5FD_FEAT_ALLOCATE_EARLY)) { - if(H5D__alloc_storage(dataset, dxpl_id, H5D_ALLOC_OPEN, FALSE, NULL) < 0) + H5D_io_info_t io_info; + + io_info.dset = dataset; + io_info.raw_dxpl_id = H5AC_rawdata_dxpl_id; + io_info.md_dxpl_id = dxpl_id; + + if(H5D__alloc_storage(&io_info, H5D_ALLOC_OPEN, FALSE, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize file storage") } /* end if */ @@ -1916,9 +1922,10 @@ H5D_typeof(const H5D_t *dset) *------------------------------------------------------------------------- */ herr_t -H5D__alloc_storage(const H5D_t *dset, hid_t dxpl_id, H5D_time_alloc_t time_alloc, +H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, hbool_t full_overwrite, hsize_t old_dim[]) { + const H5D_t *dset = io_info->dset; /* The dataset object */ H5F_t *f = dset->oloc.file; /* The dataset's file pointer */ H5O_layout_t *layout; /* The dataset's layout information */ hbool_t must_init_space = FALSE; /* Flag to indicate that space should be initialized */ @@ -1945,7 +1952,7 @@ H5D__alloc_storage(const H5D_t *dset, hid_t dxpl_id, H5D_time_alloc_t time_alloc /* Check if we have a zero-sized dataset */ if(layout->storage.u.contig.size > 0) { /* Reserve space in the file for the entire array */ - if(H5D__contig_alloc(f, dxpl_id, &layout->storage.u.contig/*out*/) < 0) + if(H5D__contig_alloc(f, io_info->md_dxpl_id, &layout->storage.u.contig/*out*/) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize contiguous storage") /* Indicate that we should initialize storage space */ @@ -1962,7 +1969,7 @@ H5D__alloc_storage(const H5D_t *dset, hid_t dxpl_id, H5D_time_alloc_t time_alloc case H5D_CHUNKED: if(!(*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage)) { /* Create the root of the index that manages chunked storage */ - if(H5D__chunk_create(dset /*in,out*/, dxpl_id) < 0) + if(H5D__chunk_create(dset /*in,out*/, io_info->md_dxpl_id) < 0) HGOTO_ERROR(H5E_IO, H5E_CANTINIT, FAIL, "unable to initialize chunked storage") /* Indicate that we set the storage addr */ @@ -2035,7 +2042,7 @@ H5D__alloc_storage(const H5D_t *dset, hid_t dxpl_id, H5D_time_alloc_t time_alloc * this is icky. -QAK */ if(!(dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_INCR && time_alloc == H5D_ALLOC_WRITE)) - if(H5D__init_storage(dset, full_overwrite, old_dim, dxpl_id) < 0) + if(H5D__init_storage(io_info, full_overwrite, old_dim) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize dataset with fill value") } /* end if */ else { @@ -2049,7 +2056,7 @@ H5D__alloc_storage(const H5D_t *dset, hid_t dxpl_id, H5D_time_alloc_t time_alloc * the fill value _is_ set, do that now */ if(dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_ALLOC || (dset->shared->dcpl_cache.fill.fill_time == H5D_FILL_TIME_IFSET && fill_status == H5D_FILL_VALUE_USER_DEFINED)) - if(H5D__init_storage(dset, full_overwrite, old_dim, dxpl_id) < 0) + if(H5D__init_storage(io_info, full_overwrite, old_dim) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize dataset with fill value") } /* end else */ } /* end if */ @@ -2063,7 +2070,7 @@ H5D__alloc_storage(const H5D_t *dset, hid_t dxpl_id, H5D_time_alloc_t time_alloc */ if(time_alloc != H5D_ALLOC_CREATE && addr_set) /* Mark the layout as dirty, for later writing to the file */ - if(H5D__mark(dset, dxpl_id, H5D_MARK_LAYOUT) < 0) + if(H5D__mark(dset, io_info->md_dxpl_id, H5D_MARK_LAYOUT) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to mark dataspace as dirty") } /* end if */ @@ -2087,10 +2094,10 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D__init_storage(const H5D_t *dset, hbool_t full_overwrite, hsize_t old_dim[], - hid_t dxpl_id) +H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]) { - herr_t ret_value = SUCCEED; /* Return value */ + const H5D_t *dset = io_info->dset; /* dataset pointer */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -2101,7 +2108,7 @@ H5D__init_storage(const H5D_t *dset, hbool_t full_overwrite, hsize_t old_dim[], /* If we will be immediately overwriting the values, don't bother to clear them */ if(!full_overwrite) { /* Fill the compact dataset storage */ - if(H5D__compact_fill(dset, dxpl_id) < 0) + if(H5D__compact_fill(dset, io_info->md_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize compact dataset storage") } /* end if */ break; @@ -2110,7 +2117,7 @@ H5D__init_storage(const H5D_t *dset, hbool_t full_overwrite, hsize_t old_dim[], /* Don't write default fill values to external files */ /* If we will be immediately overwriting the values, don't bother to clear them */ if((dset->shared->dcpl_cache.efl.nused == 0 || dset->shared->dcpl_cache.fill.buf) && !full_overwrite) - if(H5D__contig_fill(dset, dxpl_id) < 0) + if(H5D__contig_fill(io_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to allocate all chunks of dataset") break; @@ -2126,7 +2133,7 @@ H5D__init_storage(const H5D_t *dset, hbool_t full_overwrite, hsize_t old_dim[], if(old_dim == NULL) old_dim = zero_dim; - if(H5D__chunk_allocate(dset, dxpl_id, full_overwrite, old_dim) < 0) + if(H5D__chunk_allocate(io_info, full_overwrite, old_dim) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to allocate all chunks of dataset") break; } /* end block */ @@ -2595,10 +2602,16 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) } /* end if */ /* Allocate space for the new parts of the dataset, if appropriate */ - if(expand && dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_EARLY) - if(H5D__alloc_storage(dset, dxpl_id, H5D_ALLOC_EXTEND, FALSE, curr_dims) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset storage") + if(expand && dset->shared->dcpl_cache.fill.alloc_time == H5D_ALLOC_TIME_EARLY) { + H5D_io_info_t io_info; + + io_info.dset = dset; + io_info.raw_dxpl_id = H5AC_rawdata_dxpl_id; + io_info.md_dxpl_id = dxpl_id; + if(H5D__alloc_storage(&io_info, H5D_ALLOC_EXTEND, FALSE, curr_dims) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to extend dataset storage") + } /*------------------------------------------------------------------------- * Remove chunk information in the case of chunked datasets * This removal takes place only in case we are shrinking the dateset @@ -2940,7 +2953,7 @@ H5D_get_create_plist(H5D_t *dset) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to copy dataset datatype for fill value") /* Set up type conversion function */ - if(NULL == (tpath = H5T_path_find(dset->shared->type, copied_fill.type, NULL, NULL, H5AC_dxpl_id, FALSE))) + if(NULL == (tpath = H5T_path_find(dset->shared->type, copied_fill.type, NULL, NULL, H5AC_noio_dxpl_id, FALSE))) HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to convert between src and dest data types") /* Convert disk form of fill value into memory form */ @@ -2968,7 +2981,7 @@ H5D_get_create_plist(H5D_t *dset) } /* end if */ /* Convert fill value */ - if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, copied_fill.buf, bkg_buf, H5AC_dxpl_id) < 0) { + if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, copied_fill.buf, bkg_buf, H5AC_noio_dxpl_id) < 0) { H5I_dec_ref(src_id); H5I_dec_ref(dst_id); if(bkg_buf) diff --git a/src/H5Dio.c b/src/H5Dio.c index c0aa83e..3a022c3 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -386,9 +386,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, H5D_storage_t store; /*union of EFL and chunk pointer in file space */ hssize_t snelmts; /*total number of elmts (signed) */ hsize_t nelmts; /*total number of elmts */ -#ifdef H5_HAVE_PARALLEL hbool_t io_info_init = FALSE; /* Whether the I/O info has been initialized */ -#endif /*H5_HAVE_PARALLEL*/ hbool_t io_op_init = FALSE; /* Whether the I/O op has been initialized */ H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */ H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */ @@ -505,7 +503,8 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, HGOTO_DONE(SUCCEED) /* Go fill the user's selection with the dataset's fill value */ - if(H5D__fill(dataset->shared->dcpl_cache.fill.buf, dataset->shared->type, buf, type_info.mem_type, mem_space, dxpl_id) < 0) + if(H5D__fill(dataset->shared->dcpl_cache.fill.buf, dataset->shared->type, buf, + type_info.mem_type, mem_space, dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "filling buf failed") else HGOTO_DONE(SUCCEED) @@ -516,9 +515,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, io_info.u.rbuf = buf; if(H5D__ioinfo_init(dataset, dxpl_cache, dxpl_id, &type_info, &store, &io_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unable to set up I/O operation") -#ifdef H5_HAVE_PARALLEL io_info_init = TRUE; -#endif /*H5_HAVE_PARALLEL*/ /* Sanity check that space is allocated, if there are elements */ if(nelmts > 0) @@ -546,12 +543,20 @@ done: /* Shut down the I/O op information */ if(io_op_init && io_info.layout_ops.io_term && (*io_info.layout_ops.io_term)(&fm) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down I/O op info") + + if(io_info_init) { +#ifdef H5_DEBUG_BUILD + /* release the metadata dxpl that was copied in the init function */ + if(H5I_dec_ref(io_info.md_dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close metadata dxpl") +#endif /* H5_DEBUG_BUILD */ #ifdef H5_HAVE_PARALLEL - /* Shut down io_info struct */ - if(io_info_init) + /* Shut down io_info struct */ if(H5D__ioinfo_term(&io_info) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't shut down io_info") #endif /*H5_HAVE_PARALLEL*/ + } + /* Shut down datatype info for operation */ if(type_info_init && H5D__typeinfo_term(&type_info) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down type info") @@ -602,9 +607,7 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, H5D_storage_t store; /*union of EFL and chunk pointer in file space */ hssize_t snelmts; /*total number of elmts (signed) */ hsize_t nelmts; /*total number of elmts */ -#ifdef H5_HAVE_PARALLEL hbool_t io_info_init = FALSE; /* Whether the I/O info has been initialized */ -#endif /*H5_HAVE_PARALLEL*/ hbool_t io_op_init = FALSE; /* Whether the I/O op has been initialized */ H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */ H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */ @@ -734,6 +737,13 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, /* Retrieve dataset properties */ /* */ + /* Set up I/O operation */ + io_info.op_type = H5D_IO_OP_WRITE; + io_info.u.wbuf = buf; + if(H5D__ioinfo_init(dataset, dxpl_cache, dxpl_id, &type_info, &store, &io_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up I/O operation") + io_info_init = TRUE; + /* Allocate data space and initialize it if it hasn't been. */ if(nelmts > 0 && dataset->shared->dcpl_cache.efl.nused == 0 && !(*dataset->shared->layout.ops->is_space_alloc)(&dataset->shared->layout.storage)) { @@ -751,19 +761,10 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, full_overwrite = (hbool_t)((hsize_t)file_nelmts == nelmts ? TRUE : FALSE); /* Allocate storage */ - if(H5D__alloc_storage(dataset, dxpl_id, H5D_ALLOC_WRITE, full_overwrite, NULL) < 0) + if(H5D__alloc_storage(&io_info, H5D_ALLOC_WRITE, full_overwrite, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage") } /* end if */ - /* Set up I/O operation */ - io_info.op_type = H5D_IO_OP_WRITE; - io_info.u.wbuf = buf; - if(H5D__ioinfo_init(dataset, dxpl_cache, dxpl_id, &type_info, &store, &io_info) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set up I/O operation") -#ifdef H5_HAVE_PARALLEL - io_info_init = TRUE; -#endif /*H5_HAVE_PARALLEL*/ - /* Call storage method's I/O initialization routine */ HDmemset(&fm, 0, sizeof(H5D_chunk_map_t)); if(io_info.layout_ops.io_init && (*io_info.layout_ops.io_init)(&io_info, &type_info, nelmts, file_space, mem_space, &fm) < 0) @@ -802,11 +803,20 @@ done: /* Shut down the I/O op information */ if(io_op_init && io_info.layout_ops.io_term && (*io_info.layout_ops.io_term)(&fm) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down I/O op info") + + if(io_info_init) { +#ifdef H5_DEBUG_BUILD + /* release the metadata dxpl that was copied in the init function */ + if(H5I_dec_ref(io_info.md_dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close metadata dxpl") +#endif /* H5_DEBUG_BUILD */ #ifdef H5_HAVE_PARALLEL - /* Shut down io_info struct */ - if(io_info_init && H5D__ioinfo_term(&io_info) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't shut down io_info") + /* Shut down io_info struct */ + if(H5D__ioinfo_term(&io_info) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't shut down io_info") #endif /*H5_HAVE_PARALLEL*/ + } + /* Shut down datatype info for operation */ if(type_info_init && H5D__typeinfo_term(&type_info) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to shut down type info") @@ -841,7 +851,9 @@ const H5D_dxpl_cache_t *dxpl_cache, hid_t dxpl_id, const H5D_type_info_t *type_info, H5D_storage_t *store, H5D_io_info_t *io_info) { - FUNC_ENTER_STATIC_NOERR + herr_t ret_value = SUCCEED; + + FUNC_ENTER_STATIC /* check args */ HDassert(dset); @@ -850,10 +862,19 @@ const HDassert(type_info->tpath); HDassert(io_info); + /* init both dxpls to the original one */ + io_info->md_dxpl_id = dxpl_id; + io_info->raw_dxpl_id = dxpl_id; + + /* set the dxpl IO type for sanity checking at the FD layer */ +#ifdef H5_DEBUG_BUILD + if(H5D_set_io_info_dxpls(io_info, dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't set metadata and raw data dxpls") +#endif /* H5_DEBUG_BUILD */ + /* Set up "normal" I/O fields */ io_info->dset = dset; io_info->dxpl_cache = dxpl_cache; - io_info->dxpl_id = dxpl_id; io_info->store = store; /* Set I/O operations to initial values */ @@ -885,7 +906,8 @@ const io_info->using_mpi_vfd = H5F_HAS_FEATURE(dset->oloc.file, H5FD_FEAT_HAS_MPI); #endif /* H5_HAVE_PARALLEL */ - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__ioinfo_init() */ @@ -1165,7 +1187,7 @@ H5D__ioinfo_term(H5D_io_info_t *io_info) H5P_genplist_t *dx_plist; /* Data transer property list */ /* Get the dataset transfer property list */ - if(NULL == (dx_plist = (H5P_genplist_t *)H5I_object(io_info->dxpl_id))) + if(NULL == (dx_plist = (H5P_genplist_t *)H5I_object(io_info->raw_dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list") /* Restore the original parallel I/O mode */ @@ -1178,7 +1200,7 @@ H5D__ioinfo_term(H5D_io_info_t *io_info) H5P_genplist_t *dx_plist; /* Data transer property list */ /* Get the dataset transfer property list */ - if(NULL == (dx_plist = (H5P_genplist_t *)H5I_object(io_info->dxpl_id))) + if(NULL == (dx_plist = (H5P_genplist_t *)H5I_object(io_info->raw_dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset transfer property list") /* Restore the original parallel I/O mode */ @@ -1224,3 +1246,53 @@ H5D__typeinfo_term(const H5D_type_info_t *type_info) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__typeinfo_term() */ +#ifdef H5_DEBUG_BUILD + +/*------------------------------------------------------------------------- + * Function: H5D_set_io_info_dxpls + * + * Purpose: Set the metadata and raw data dxpls in an io_info struct + * for sanity checking at the H5FD layer. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * January 2016 + * + *------------------------------------------------------------------------- + */ +herr_t +H5D_set_io_info_dxpls(H5D_io_info_t *io_info, hid_t dxpl_id) +{ + H5P_genplist_t *xfer_plist = NULL; /* Dataset transfer property list object */ + H5FD_dxpl_type_t dxpl_type; /* Property indicating the type of the internal dxpl */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Get the property list object */ + if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(dxpl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_BADATOM, FAIL, "can't get new property list object") + + /* create the metadata dxpl */ + if((io_info->md_dxpl_id = H5P_copy_plist(xfer_plist, FALSE)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "can't copy dxpl") + + /* Set the dxpl type property */ + dxpl_type = H5FD_RAWDATA_DXPL; + if(H5P_set(xfer_plist, H5FD_DXPL_TYPE_NAME, &dxpl_type) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set dxpl type property") + + /* Get the property list object */ + if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(io_info->md_dxpl_id))) + HGOTO_ERROR(H5E_DATASET, H5E_BADATOM, FAIL, "can't get new property list object") + + /* Set the dxpl type property */ + dxpl_type = H5FD_METADATA_DXPL; + if(H5P_set(xfer_plist, H5FD_DXPL_TYPE_NAME, &dxpl_type) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set dxpl type property") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D_set_io_info_dxpls */ +#endif /* H5_DEBUG_BUILD */ diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index 16ff81b..e61dae0 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -244,10 +244,16 @@ H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset, * Allocate storage if space allocate time is early; otherwise delay * allocation until later. */ - if(fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY) - if(H5D__alloc_storage(dset, dxpl_id, H5D_ALLOC_CREATE, FALSE, NULL) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage") + if(fill_prop->alloc_time == H5D_ALLOC_TIME_EARLY) { + H5D_io_info_t io_info; + + io_info.dset = dset; + io_info.raw_dxpl_id = H5AC_rawdata_dxpl_id; + io_info.md_dxpl_id = dxpl_id; + if(H5D__alloc_storage(&io_info, H5D_ALLOC_CREATE, FALSE, NULL) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage") + } /* Update external storage message, if it's used */ if(dset->shared->dcpl_cache.efl.nused > 0) { H5O_efl_t *efl = &dset->shared->dcpl_cache.efl; /* Dataset's external file list */ diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 0ba340a..441cc96 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -263,7 +263,7 @@ H5D__mpio_select_read(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATT FUNC_ENTER_PACKAGE H5_CHECK_OVERFLOW(mpi_buf_count, hsize_t, size_t); - if(H5F_block_read(io_info->dset->oloc.file, H5FD_MEM_DRAW, store_contig->dset_addr, (size_t)mpi_buf_count, io_info->dxpl_id, io_info->u.rbuf) < 0) + if(H5F_block_read(io_info->dset->oloc.file, H5FD_MEM_DRAW, store_contig->dset_addr, (size_t)mpi_buf_count, io_info->raw_dxpl_id, io_info->u.rbuf) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "can't finish collective parallel read") done: @@ -293,7 +293,7 @@ H5D__mpio_select_write(const H5D_io_info_t *io_info, const H5D_type_info_t H5_AT /*OKAY: CAST DISCARDS CONST QUALIFIER*/ H5_CHECK_OVERFLOW(mpi_buf_count, hsize_t, size_t); - if(H5F_block_write(io_info->dset->oloc.file, H5FD_MEM_DRAW, store_contig->dset_addr, (size_t)mpi_buf_count, io_info->dxpl_id, io_info->u.wbuf) < 0) + if(H5F_block_write(io_info->dset->oloc.file, H5FD_MEM_DRAW, store_contig->dset_addr, (size_t)mpi_buf_count, io_info->raw_dxpl_id, io_info->u.wbuf) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "can't finish collective parallel write") done: @@ -475,14 +475,14 @@ H5D__contig_collective_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_ /* Sanity check */ HDassert(H5FD_MPIO == H5F_DRIVER_ID(io_info->dset->oloc.file)); - HDassert(TRUE == H5P_isa_class(io_info->dxpl_id, H5P_DATASET_XFER)); + HDassert(TRUE == H5P_isa_class(io_info->raw_dxpl_id, H5P_DATASET_XFER)); /* Call generic internal collective I/O routine */ if(H5D__inter_collective_io(io_info, type_info, file_space, mem_space) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "couldn't finish shared collective MPI-IO") /* Obtain the data transfer properties */ - if(NULL == (dx_plist = H5I_object(io_info->dxpl_id))) + if(NULL == (dx_plist = H5I_object(io_info->raw_dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") /* Set the actual I/O mode property. internal_collective_io will not break to @@ -522,14 +522,14 @@ H5D__contig_collective_write(H5D_io_info_t *io_info, const H5D_type_info_t *type /* Sanity check */ HDassert(H5FD_MPIO == H5F_DRIVER_ID(io_info->dset->oloc.file)); - HDassert(TRUE == H5P_isa_class(io_info->dxpl_id, H5P_DATASET_XFER)); + HDassert(TRUE == H5P_isa_class(io_info->raw_dxpl_id, H5P_DATASET_XFER)); /* Call generic internal collective I/O routine */ if(H5D__inter_collective_io(io_info, type_info, file_space, mem_space) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "couldn't finish shared collective MPI-IO") /* Obtain the data transfer properties */ - if(NULL == (dx_plist = H5I_object(io_info->dxpl_id))) + if(NULL == (dx_plist = H5I_object(io_info->raw_dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") /* Set the actual I/O mode property. internal_collective_io will not break to @@ -601,7 +601,7 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf HDassert(fm); /* Obtain the data transfer properties */ - if(NULL == (dx_plist = H5I_object(io_info->dxpl_id))) + if(NULL == (dx_plist = H5I_object(io_info->raw_dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") /* Check the optional property list on what to do with collective chunk IO. */ @@ -643,7 +643,7 @@ H5D__chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf int new_value; /* Get the dataset transfer property list */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(io_info->dxpl_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(io_info->raw_dxpl_id))) HGOTO_ERROR(H5E_IO, H5E_BADTYPE, FAIL, "not a dataset transfer property list") /*** Test collective chunk user-input optimization APIs. ***/ @@ -863,7 +863,7 @@ H5D__link_chunk_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *typ mspace = chunk_info->mspace; /* Look up address of chunk */ - if(H5D__chunk_lookup(io_info->dset, io_info->dxpl_id, chunk_info->scaled, &udata) < 0) + if(H5D__chunk_lookup(io_info->dset, io_info->md_dxpl_id, chunk_info->scaled, &udata) < 0) HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "couldn't get chunk address") ctg_store.contig.dset_addr = udata.chunk_block.offset; } /* end else */ @@ -1436,7 +1436,7 @@ H5D__final_collective_io(H5D_io_info_t *io_info, const H5D_type_info_t *type_inf FUNC_ENTER_STATIC /* Pass buf type, file type to the file driver. */ - if(H5FD_mpi_setup_collective(io_info->dxpl_id, mpi_buf_type, mpi_file_type) < 0) + if(H5FD_mpi_setup_collective(io_info->raw_dxpl_id, mpi_buf_type, mpi_file_type) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O properties") if(io_info->op_type == H5D_IO_OP_WRITE) { @@ -1590,7 +1590,7 @@ if(H5DEBUG(D)) H5D_chunk_ud_t udata; /* User data for querying chunk info */ /* Get address of chunk */ - if(H5D__chunk_lookup(io_info->dset, io_info->dxpl_id, chunk_info->scaled, &udata) < 0) + if(H5D__chunk_lookup(io_info->dset, io_info->md_dxpl_id, chunk_info->scaled, &udata) < 0) HGOTO_ERROR(H5E_STORAGE, H5E_CANTGET, FAIL, "couldn't get chunk info from skipped list") chunk_addr = udata.chunk_block.offset; } /* end if */ @@ -1791,7 +1791,7 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm, H5P_genplist_t *plist; /* Property list pointer */ /* Get the dataset transfer property list */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(io_info->dxpl_id))) + if(NULL == (plist = (H5P_genplist_t *)H5I_object(io_info->raw_dxpl_id))) HGOTO_ERROR(H5E_IO, H5E_BADTYPE, FAIL, "not a dataset transfer property list") check_prop = H5P_exist_plist(plist, H5D_XFER_COLL_CHUNK_MULTI_RATIO_COLL_NAME); diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index f9c585a..bc04300 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -49,14 +49,16 @@ #define H5D_BUILD_IO_INFO_WRT(io_info, ds, dxpl_c, dxpl_i, str, buf) \ (io_info)->dset = ds; \ (io_info)->dxpl_cache = dxpl_c; \ - (io_info)->dxpl_id = dxpl_i; \ + (io_info)->raw_dxpl_id = dxpl_i; \ + (io_info)->md_dxpl_id = dxpl_i; \ (io_info)->store = str; \ (io_info)->op_type = H5D_IO_OP_WRITE; \ (io_info)->u.wbuf = buf #define H5D_BUILD_IO_INFO_RD(io_info, ds, dxpl_c, dxpl_i, str, buf) \ (io_info)->dset = ds; \ (io_info)->dxpl_cache = dxpl_c; \ - (io_info)->dxpl_id = dxpl_i; \ + (io_info)->raw_dxpl_id = dxpl_i; \ + (io_info)->md_dxpl_id = dxpl_i; \ (io_info)->store = str; \ (io_info)->op_type = H5D_IO_OP_READ; \ (io_info)->u.rbuf = buf @@ -192,7 +194,8 @@ typedef struct H5D_io_info_t { const #endif /* H5_HAVE_PARALLEL */ H5D_dxpl_cache_t *dxpl_cache; /* Pointer to cached DXPL info */ - hid_t dxpl_id; /* Original DXPL ID */ + hid_t raw_dxpl_id; /* Original DXPL ID */ + hid_t md_dxpl_id; /* metadata dxpl needed for parallel HDF5 */ #ifdef H5_HAVE_PARALLEL MPI_Comm comm; /* MPI communicator for file */ hbool_t using_mpi_vfd; /* Whether the file is using an MPI-based VFD */ @@ -530,7 +533,7 @@ H5_DLL H5D_t *H5D__open_name(const H5G_loc_t *loc, const char *name, hid_t dapl_id, hid_t dxpl_id); H5_DLL herr_t H5D__get_space_status(H5D_t *dset, H5D_space_status_t *allocation, hid_t dxpl_id); -H5_DLL herr_t H5D__alloc_storage(const H5D_t *dset, hid_t dxpl_id, H5D_time_alloc_t time_alloc, +H5_DLL herr_t H5D__alloc_storage(const H5D_io_info_t *io_info, H5D_time_alloc_t time_alloc, hbool_t full_overwrite, hsize_t old_dim[]); H5_DLL herr_t H5D__get_storage_size(H5D_t *dset, hid_t dxpl_id, hsize_t *storage_size); H5_DLL haddr_t H5D__get_offset(const H5D_t *dset); @@ -543,6 +546,9 @@ H5_DLL herr_t H5D__get_dxpl_cache(hid_t dxpl_id, H5D_dxpl_cache_t **cache); H5_DLL herr_t H5D__flush_sieve_buf(H5D_t *dataset, hid_t dxpl_id); H5_DLL herr_t H5D__mark(const H5D_t *dataset, hid_t dxpl_id, unsigned flags); H5_DLL herr_t H5D__flush_real(H5D_t *dataset, hid_t dxpl_id); +#ifdef H5_DEBUG_BUILD +H5_DLL herr_t H5D_set_io_info_dxpls(H5D_io_info_t *io_info, hid_t dxpl_id); +#endif /* H5_DEBUG_BUILD */ /* Internal I/O routines */ H5_DLL herr_t H5D__read(H5D_t *dataset, hid_t mem_type_id, @@ -586,7 +592,7 @@ H5_DLL herr_t H5D__layout_oh_write(H5D_t *dataset, hid_t dxpl_id, H5O_t *oh, H5_DLL herr_t H5D__contig_alloc(H5F_t *f, hid_t dxpl_id, H5O_storage_contig_t *storage); H5_DLL hbool_t H5D__contig_is_space_alloc(const H5O_storage_t *storage); -H5_DLL herr_t H5D__contig_fill(const H5D_t *dset, hid_t dxpl_id); +H5_DLL herr_t H5D__contig_fill(const H5D_io_info_t *io_info); H5_DLL herr_t H5D__contig_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, hsize_t nelmts, const H5S_t *file_space, const H5S_t *mem_space, H5D_chunk_map_t *fm); @@ -608,8 +614,7 @@ H5_DLL hbool_t H5D__chunk_is_space_alloc(const H5O_storage_t *storage); H5_DLL herr_t H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, H5D_chunk_ud_t *udata); H5_DLL herr_t H5D__chunk_allocated(H5D_t *dset, hid_t dxpl_id, hsize_t *nbytes); -H5_DLL herr_t H5D__chunk_allocate(const H5D_t *dset, hid_t dxpl_id, - hbool_t full_overwrite, hsize_t old_dim[]); +H5_DLL herr_t H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]); H5_DLL herr_t H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim); #ifdef H5_HAVE_PARALLEL @@ -661,8 +666,7 @@ H5_DLL herr_t H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf H5MM_free_t free_func, void *free_info, const H5O_fill_t *fill, const H5T_t *dset_type, hid_t dset_type_id, size_t nelmts, size_t min_buf_size, hid_t dxpl_id); -H5_DLL herr_t H5D__fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts, - hid_t dxpl_id); +H5_DLL herr_t H5D__fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts, hid_t dxpl_id); H5_DLL herr_t H5D__fill_term(H5D_fill_buf_info_t *fb_info); #ifdef H5_HAVE_PARALLEL diff --git a/src/H5Dscatgath.c b/src/H5Dscatgath.c index 9902b7b..7c1abca 100644 --- a/src/H5Dscatgath.c +++ b/src/H5Dscatgath.c @@ -538,7 +538,7 @@ H5D__scatgath_read(const H5D_io_info_t *io_info, const H5D_type_info_t *type_inf */ if(H5T_convert(type_info->tpath, type_info->src_type_id, type_info->dst_type_id, smine_nelmts, (size_t)0, (size_t)0, type_info->tconv_buf, - type_info->bkg_buf, io_info->dxpl_id) < 0) + type_info->bkg_buf, io_info->md_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed") /* Do the data transform after the conversion (since we're using type mem_type) */ @@ -674,7 +674,7 @@ H5D__scatgath_write(const H5D_io_info_t *io_info, const H5D_type_info_t *type_in */ if(H5T_convert(type_info->tpath, type_info->src_type_id, type_info->dst_type_id, smine_nelmts, (size_t)0, (size_t)0, type_info->tconv_buf, - type_info->bkg_buf, io_info->dxpl_id) < 0) + type_info->bkg_buf, io_info->md_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed") } /* end else */ @@ -948,7 +948,7 @@ H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination buffer provided") /* Fill the DXPL cache values for later use */ - if(H5D__get_dxpl_cache(H5P_DATASET_XFER_DEFAULT, &dxpl_cache) < 0) + if(H5D__get_dxpl_cache(H5AC_noio_dxpl_id, &dxpl_cache) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") /* Get datatype element size */ @@ -1050,7 +1050,7 @@ H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination buffer provided") /* Fill the DXPL cache values for later use */ - if(H5D__get_dxpl_cache(H5P_DATASET_XFER_DEFAULT, &dxpl_cache) < 0) + if(H5D__get_dxpl_cache(H5AC_noio_dxpl_id, &dxpl_cache) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") /* Get datatype element size */ diff --git a/src/H5Dselect.c b/src/H5Dselect.c index ce6073c..312beba 100644 --- a/src/H5Dselect.c +++ b/src/H5Dselect.c @@ -111,7 +111,7 @@ H5D__select_io(const H5D_io_info_t *io_info, size_t elmt_size, HDassert(io_info); HDassert(io_info->dset); HDassert(io_info->store); - HDassert(TRUE == H5P_isa_class(io_info->dxpl_id, H5P_DATASET_XFER)); + HDassert(TRUE == H5P_isa_class(io_info->raw_dxpl_id, H5P_DATASET_XFER)); HDassert(io_info->u.rbuf); /* Allocate the vector I/O arrays */ diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index bf754cb..c516c58 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -2099,7 +2099,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, /* Initialize layout if necessary */ if(!storage->init) - if(H5D__virtual_init_all(io_info->dset, io_info->dxpl_id) < 0) + if(H5D__virtual_init_all(io_info->dset, io_info->md_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize virtual layout") /* Initialize tot_nelmts */ @@ -2157,7 +2157,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, * open the source dataset to patch it */ if(storage->list[i].source_space_status != H5O_VIRTUAL_STATUS_CORRECT) { HDassert(!storage->list[i].sub_dset[j].dset); - if(H5D__virtual_open_source_dset(io_info->dset, &storage->list[i], &storage->list[i].sub_dset[j], io_info->dxpl_id) < 0) + if(H5D__virtual_open_source_dset(io_info->dset, &storage->list[i], &storage->list[i].sub_dset[j], io_info->md_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset") } /* end if */ @@ -2229,7 +2229,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, /* Open source dataset */ if(!storage->list[i].sub_dset[j].dset) /* Try to open dataset */ - if(H5D__virtual_open_source_dset(io_info->dset, &storage->list[i], &storage->list[i].sub_dset[j], io_info->dxpl_id) < 0) + if(H5D__virtual_open_source_dset(io_info->dset, &storage->list[i], &storage->list[i].sub_dset[j], io_info->md_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset") /* If the source dataset is not open, mark the selected @@ -2266,7 +2266,7 @@ H5D__virtual_pre_io(H5D_io_info_t *io_info, /* Open source dataset */ if(!storage->list[i].source_dset.dset) /* Try to open dataset */ - if(H5D__virtual_open_source_dset(io_info->dset, &storage->list[i], &storage->list[i].source_dset, io_info->dxpl_id) < 0) + if(H5D__virtual_open_source_dset(io_info->dset, &storage->list[i], &storage->list[i].source_dset, io_info->md_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open source dataset") /* If the source dataset is not open, mark the selected elements @@ -2388,7 +2388,7 @@ H5D__virtual_read_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto source space") /* Perform read on source dataset */ - if(H5D__read(source_dset->dset, type_info->dst_type_id, source_dset->projected_mem_space, projected_src_space, io_info->dxpl_id, io_info->u.rbuf) < 0) + if(H5D__read(source_dset->dset, type_info->dst_type_id, source_dset->projected_mem_space, projected_src_space, io_info->raw_dxpl_id, io_info->u.rbuf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read source dataset") /* Close projected_src_space */ @@ -2505,7 +2505,8 @@ H5D__virtual_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "unable to clip fill selection") /* Write fill values to memory buffer */ - if(H5D__fill(io_info->dset->shared->dcpl_cache.fill.buf, io_info->dset->shared->type, io_info->u.rbuf, type_info->mem_type, fill_space, io_info->dxpl_id) < 0) + if(H5D__fill(io_info->dset->shared->dcpl_cache.fill.buf, io_info->dset->shared->type, io_info->u.rbuf, + type_info->mem_type, fill_space, io_info->md_dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "filling buf failed") #ifndef NDEBUG @@ -2579,7 +2580,7 @@ H5D__virtual_write_one(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, HGOTO_ERROR(H5E_DATASET, H5E_CANTCLIP, FAIL, "can't project virtual intersection onto source space") /* Perform write on source dataset */ - if(H5D__write(source_dset->dset, type_info->dst_type_id, source_dset->projected_mem_space, projected_src_space, io_info->dxpl_id, io_info->u.wbuf) < 0) + if(H5D__write(source_dset->dset, type_info->dst_type_id, source_dset->projected_mem_space, projected_src_space, io_info->raw_dxpl_id, io_info->u.wbuf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write to source dataset") /* Close projected_src_space */ diff --git a/src/H5FDint.c b/src/H5FDint.c index e7cb2c0..128f30f 100644 --- a/src/H5FDint.c +++ b/src/H5FDint.c @@ -170,6 +170,25 @@ H5FD_read(H5FD_t *file, const H5P_genplist_t *dxpl, H5FD_mem_t type, haddr_t add HDassert(TRUE == H5P_class_isa(H5P_CLASS(dxpl), H5P_CLS_DATASET_XFER_g)); HDassert(buf); + /* Sanity check the dxpl type against the mem type */ +#ifdef H5_DEBUG_BUILD + { + H5FD_dxpl_type_t dxpl_type; /* Property indicating the type of the internal dxpl */ + + /* get the dxpl type */ + if(H5P_get(dxpl, H5FD_DXPL_TYPE_NAME, &dxpl_type) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't retrieve dxpl type") + + /* we shouldn't be here if the dxpl is labeled with NO I/O */ + HDassert(H5FD_NOIO_DXPL != dxpl_type); + + if(H5FD_MEM_DRAW == type) + HDassert(H5FD_RAWDATA_DXPL == dxpl_type); + else + HDassert(H5FD_METADATA_DXPL == dxpl_type); + } +#endif /* H5_DEBUG_BUILD */ + #ifndef H5_HAVE_PARALLEL /* Do not return early for Parallel mode since the I/O could be a */ /* collective transfer. */ @@ -219,6 +238,25 @@ H5FD_write(H5FD_t *file, const H5P_genplist_t *dxpl, H5FD_mem_t type, haddr_t ad HDassert(TRUE == H5P_class_isa(H5P_CLASS(dxpl), H5P_CLS_DATASET_XFER_g)); HDassert(buf); + /* Sanity check the dxpl type against the mem type */ +#ifdef H5_DEBUG_BUILD + { + H5FD_dxpl_type_t dxpl_type; /* Property indicating the type of the internal dxpl */ + + /* get the dxpl type */ + if(H5P_get(dxpl, H5FD_DXPL_TYPE_NAME, &dxpl_type) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't retrieve dxpl type") + + /* we shouldn't be here if the dxpl is labeled with NO I/O */ + HDassert(H5FD_NOIO_DXPL != dxpl_type); + + if(H5FD_MEM_DRAW == type) + HDassert(H5FD_RAWDATA_DXPL == dxpl_type); + else + HDassert(H5FD_METADATA_DXPL == dxpl_type); + } +#endif /* H5_DEBUG_BUILD */ + #ifndef H5_HAVE_PARALLEL /* Do not return early for Parallel mode since the I/O could be a */ /* collective transfer. */ diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c index 181ad39..b4460b8 100644 --- a/src/H5FDmulti.c +++ b/src/H5FDmulti.c @@ -1592,11 +1592,8 @@ H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, void *_buf/*out*/) { H5FD_multi_t *file = (H5FD_multi_t*)_file; - H5FD_multi_dxpl_t dx; - htri_t prop_exists = FALSE; /* Whether the multi VFD DXPL property already exists */ H5FD_mem_t mt, mmt, hi = H5FD_MEM_DEFAULT; haddr_t start_addr = 0; - dxpl_id = dxpl_id; /* Suppress compiler warning */ /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -1618,8 +1615,7 @@ H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, assert(hi > 0); /* Read from that member */ - return H5FDread(file->memb[hi], type, (prop_exists ? dx.memb_dxpl[hi] : H5P_DEFAULT), - addr - start_addr, size, _buf); + return H5FDread(file->memb[hi], type, dxpl_id, addr - start_addr, size, _buf); } /* end H5FD_multi_read() */ @@ -1644,11 +1640,8 @@ H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size, const void *_buf) { H5FD_multi_t *file = (H5FD_multi_t*)_file; - H5FD_multi_dxpl_t dx; - htri_t prop_exists = FALSE; /* Whether the multi VFD DXPL property already exists */ H5FD_mem_t mt, mmt, hi = H5FD_MEM_DEFAULT; haddr_t start_addr = 0; - dxpl_id = dxpl_id; /* Suppress compiler warning */ /* Clear the error stack */ H5Eclear2(H5E_DEFAULT); @@ -1670,8 +1663,7 @@ H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, assert(hi > 0); /* Write to that member */ - return H5FDwrite(file->memb[hi], type, (prop_exists ? dx.memb_dxpl[hi] : H5P_DEFAULT), - addr - start_addr, size, _buf); + return H5FDwrite(file->memb[hi], type, dxpl_id, addr - start_addr, size, _buf); } /* end H5FD_multi_write() */ diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h index fe121b3..639f3eb 100644 --- a/src/H5FDprivate.h +++ b/src/H5FDprivate.h @@ -104,6 +104,17 @@ typedef struct H5FD_mpio_fapl_t { } H5FD_mpio_fapl_t; #endif /* H5_HAVE_PARALLEL */ +#ifdef H5_DEBUG_BUILD +/* Definitions for the internal DXPL types created in H5AC__init_package() */ +typedef enum { + H5FD_METADATA_DXPL = 0, + H5FD_NOIO_DXPL, + H5FD_RAWDATA_DXPL +} H5FD_dxpl_type_t; + +#define H5FD_DXPL_TYPE_NAME "H5P_dxpl_type" +#endif /* H5_DEBUG_BUILD */ + /*****************************/ /* Library Private Variables */ diff --git a/src/H5FS.c b/src/H5FS.c index 90f04ac..19ff8e4 100644 --- a/src/H5FS.c +++ b/src/H5FS.c @@ -1184,7 +1184,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FS_assert(const H5FS_t *fspace) +H5FS_assert(const H5FS_t *fspace, hid_t dxpl_id) { FUNC_ENTER_NOAPI_NOINIT_NOERR #ifdef QAK @@ -1194,7 +1194,7 @@ HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", "H5FS_assert", fspace->t /* Checks for section info, if it's available */ if(fspace->sinfo) { /* Sanity check sections */ - H5FS_sect_assert(fspace); + H5FS_sect_assert(fspace, dxpl_id); /* General assumptions about the section size counts */ HDassert(fspace->sinfo->tot_size_count >= fspace->sinfo->serial_size_count); diff --git a/src/H5FScache.c b/src/H5FScache.c index 2f7dda8..1d27972 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -529,7 +529,7 @@ H5FS__cache_hdr_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, HDassert(fspace->sinfo->cache_info.size == fspace->alloc_sect_size); /* Let the metadata cache know the section info moved */ - if(H5AC_move_entry((H5F_t *)f, H5AC_FSPACE_SINFO, fspace->sect_addr, new_sect_addr) < 0) + if(H5AC_move_entry((H5F_t *)f, H5AC_FSPACE_SINFO, fspace->sect_addr, new_sect_addr, dxpl_id) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move section info") fspace->sect_addr = new_sect_addr; @@ -591,7 +591,7 @@ H5FS__cache_hdr_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, HDassert(!H5F_addr_eq(fspace->sect_addr, new_sect_addr)); /* Let the metadata cache know the section info moved */ - if(H5AC_move_entry((H5F_t *)f, H5AC_FSPACE_SINFO, fspace->sect_addr, new_sect_addr) < 0) + if(H5AC_move_entry((H5F_t *)f, H5AC_FSPACE_SINFO, fspace->sect_addr, new_sect_addr, dxpl_id) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMOVE, FAIL, "unable to move section info") /* Update the internal address for the section info */ @@ -1080,7 +1080,7 @@ H5FS__cache_sinfo_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, HDassert(!H5F_addr_eq(sinfo->fspace->sect_addr, sinfo_addr)); /* Let the metadata cache know the section info moved */ - if(H5AC_move_entry((H5F_t *)f, H5AC_FSPACE_SINFO, sinfo->fspace->sect_addr, sinfo_addr) < 0) + if(H5AC_move_entry((H5F_t *)f, H5AC_FSPACE_SINFO, sinfo->fspace->sect_addr, sinfo_addr, dxpl_id) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTMOVE, FAIL, "unable to move section info") /* Update the internal address for the section info */ diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h index 08c2529..eafe3c2 100644 --- a/src/H5FSpkg.h +++ b/src/H5FSpkg.h @@ -238,8 +238,8 @@ H5_DLL herr_t H5FS_sinfo_dest(H5FS_sinfo_t *sinfo); /* Sanity check routines */ #ifdef H5FS_DEBUG -H5_DLL herr_t H5FS_assert(const H5FS_t *fspace); -H5_DLL herr_t H5FS_sect_assert(const H5FS_t *fspace); +H5_DLL herr_t H5FS_assert(const H5FS_t *fspace, hid_t dxpl_id); +H5_DLL herr_t H5FS_sect_assert(const H5FS_t *fspace, hid_t dxpl_id); #endif /* H5FS_DEBUG */ /* Testing routines */ diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h index c5ad38f..20fdff1 100644 --- a/src/H5FSprivate.h +++ b/src/H5FSprivate.h @@ -106,7 +106,7 @@ typedef struct H5FS_section_class_t { htri_t (*can_shrink)(const H5FS_section_info_t *, void *); /* Routine to determine if node can shrink container */ herr_t (*shrink)(H5FS_section_info_t **, void *); /* Routine to shrink container */ herr_t (*free)(H5FS_section_info_t *); /* Routine to free node */ - herr_t (*valid)(const struct H5FS_section_class_t *, const H5FS_section_info_t *); /* Routine to check if a section is valid */ + herr_t (*valid)(const struct H5FS_section_class_t *, const H5FS_section_info_t *, hid_t dxpl_id); /* Routine to check if a section is valid */ H5FS_section_info_t *(*split)(H5FS_section_info_t *, hsize_t); /* Routine to create the split section */ herr_t (*debug)(const H5FS_section_info_t *, FILE *, int , int ); /* Routine to dump debugging information about a section */ } H5FS_section_class_t; diff --git a/src/H5FSsection.c b/src/H5FSsection.c index 62500e7..5638f4f 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -1421,7 +1421,7 @@ done: #ifdef H5FS_DEBUG_ASSERT if(!(flags & (H5FS_ADD_DESERIALIZING | H5FS_ADD_SKIP_VALID))) - H5FS_assert(fspace); + H5FS_assert(fspace, dxpl_id); #endif /* H5FS_DEBUG_ASSERT */ #ifdef H5FS_SINFO_DEBUG HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); @@ -1840,7 +1840,7 @@ done: HDONE_ERROR(H5E_FSPACE, H5E_CANTRELEASE, FAIL, "can't release section info") #ifdef H5FS_DEBUG_ASSERT - H5FS_assert(fspace); + H5FS_assert(fspace, dxpl_id); #endif /* H5FS_DEBUG_ASSERT */ FUNC_LEAVE_NOAPI(ret_value) } /* H5FS_sect_find() */ @@ -2198,7 +2198,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5FS_sect_assert(const H5FS_t *fspace) +H5FS_sect_assert(const H5FS_t *fspace, hid_t dxpl_id) { hsize_t separate_obj; /* The number of separate objects managed */ @@ -2270,7 +2270,7 @@ HDfprintf(stderr, "%s: sect->size = %Hu, sect->addr = %a, sect->type = %u\n", "H HDassert(H5F_addr_defined(sect->addr)); HDassert(fspace_node->sect_size == sect->size); if(cls->valid) - (*cls->valid)(cls, sect); + (*cls->valid)(cls, sect, dxpl_id); /* Add to correct count */ if(cls->flags & H5FS_CLS_GHOST_OBJ) diff --git a/src/H5Faccum.c b/src/H5Faccum.c index 73c0bfd..3fac184 100644 --- a/src/H5Faccum.c +++ b/src/H5Faccum.c @@ -112,10 +112,9 @@ H5FL_BLK_DEFINE_STATIC(meta_accum); *------------------------------------------------------------------------- */ herr_t -H5F__accum_read(const H5F_io_info_t *fio_info, H5FD_mem_t type, haddr_t addr, +H5F__accum_read(const H5F_io_info_t *fio_info, H5FD_mem_t map_type, haddr_t addr, size_t size, void *buf/*out*/) { - H5FD_mem_t map_type; /* Mapped memory type */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -125,9 +124,6 @@ H5F__accum_read(const H5F_io_info_t *fio_info, H5FD_mem_t type, haddr_t addr, HDassert(fio_info->dxpl); HDassert(buf); - /* Treat global heap as raw data */ - map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; - /* Check if this information is in the metadata accumulator */ if((fio_info->f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && map_type != H5FD_MEM_DRAW) { H5F_meta_accum_t *accum; /* Alias for file's metadata accumulator */ @@ -421,10 +417,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F__accum_write(const H5F_io_info_t *fio_info, H5FD_mem_t type, haddr_t addr, +H5F__accum_write(const H5F_io_info_t *fio_info, H5FD_mem_t map_type, haddr_t addr, size_t size, const void *buf) { - H5FD_mem_t map_type; /* Mapped memory type */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -435,9 +430,6 @@ H5F__accum_write(const H5F_io_info_t *fio_info, H5FD_mem_t type, haddr_t addr, HDassert(fio_info->dxpl); HDassert(buf); - /* Treat global heap as raw data */ - map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; - /* Check for accumulating metadata */ if((fio_info->f->shared->feature_flags & H5FD_FEAT_ACCUMULATE_METADATA) && map_type != H5FD_MEM_DRAW) { H5F_meta_accum_t *accum; /* Alias for file's metadata accumulator */ diff --git a/src/H5Fio.c b/src/H5Fio.c index 04c4055..d001bc0 100644 --- a/src/H5Fio.c +++ b/src/H5Fio.c @@ -97,6 +97,8 @@ H5F_block_read(const H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, hid_t dxpl_id, void *buf/*out*/) { H5F_io_info_t fio_info; /* I/O info for operation */ + H5FD_mem_t map_type; /* Mapped memory type */ + hid_t my_dxpl_id = dxpl_id; /* transfer property to use for I/O */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -113,13 +115,22 @@ HDfprintf(stderr, "%s: read from addr = %a, size = %Zu\n", FUNC, addr, size); if(H5F_addr_le(f->shared->tmp_addr, (addr + size))) HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space") + /* Treat global heap as raw data */ + map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; + +#ifdef H5_DEBUG_BUILD + /* GHEAP type is treated as RAW, so update the dxpl type property too */ + if(H5FD_MEM_GHEAP == type) + my_dxpl_id = H5AC_rawdata_dxpl_id; +#endif /* H5_DEBUG_BUILD */ + /* Set up I/O info for operation */ fio_info.f = f; - if(NULL == (fio_info.dxpl = (H5P_genplist_t *)H5I_object(dxpl_id))) + if(NULL == (fio_info.dxpl = (H5P_genplist_t *)H5I_object(my_dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") /* Pass through metadata accumulator layer */ - if(H5F__accum_read(&fio_info, type, addr, size, buf) < 0) + if(H5F__accum_read(&fio_info, map_type, addr, size, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "read through metadata accumulator failed") done: @@ -147,6 +158,8 @@ H5F_block_write(const H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, hid_t dxpl_id, const void *buf) { H5F_io_info_t fio_info; /* I/O info for operation */ + H5FD_mem_t map_type; /* Mapped memory type */ + hid_t my_dxpl_id = dxpl_id; /* transfer property to use for I/O */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -164,13 +177,22 @@ HDfprintf(stderr, "%s: write to addr = %a, size = %Zu\n", FUNC, addr, size); if(H5F_addr_le(f->shared->tmp_addr, (addr + size))) HGOTO_ERROR(H5E_IO, H5E_BADRANGE, FAIL, "attempting I/O in temporary file space") + /* Treat global heap as raw data */ + map_type = (type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type; + +#ifdef H5_DEBUG_BUILD + /* GHEAP type is treated as RAW, so update the dxpl type property too */ + if(H5FD_MEM_GHEAP == type) + my_dxpl_id = H5AC_rawdata_dxpl_id; +#endif /* H5_DEBUG_BUILD */ + /* Set up I/O info for operation */ fio_info.f = f; - if(NULL == (fio_info.dxpl = (H5P_genplist_t *)H5I_object(dxpl_id))) + if(NULL == (fio_info.dxpl = (H5P_genplist_t *)H5I_object(my_dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get property list") /* Pass through metadata accumulator layer */ - if(H5F__accum_write(&fio_info, type, addr, size, buf) < 0) + if(H5F__accum_write(&fio_info, map_type, addr, size, buf) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "write through metadata accumulator failed") done: diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 4f3dfc3..38556b7 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -1185,7 +1185,7 @@ H5HF__cache_iblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, HDassert(!H5F_addr_eq(iblock->addr, iblock_addr)); /* Let the metadata cache know the block moved */ - if(H5AC_move_entry((H5F_t *)f, H5AC_FHEAP_IBLOCK, iblock->addr, iblock_addr) < 0) + if(H5AC_move_entry((H5F_t *)f, H5AC_FHEAP_IBLOCK, iblock->addr, iblock_addr, dxpl_id) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move indirect block") /* Update the internal address for the block */ @@ -2101,7 +2101,7 @@ H5HF__cache_dblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, /* Let the metadata cache know, if the block moved */ if(!H5F_addr_eq(hdr->man_dtable.table_addr, dblock_addr)) - if(H5AC_move_entry((H5F_t *)f, H5AC_FHEAP_DBLOCK, hdr->man_dtable.table_addr, dblock_addr) < 0) + if(H5AC_move_entry((H5F_t *)f, H5AC_FHEAP_DBLOCK, hdr->man_dtable.table_addr, dblock_addr, dxpl_id) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move direct block") /* Update information about compressed direct block's @@ -2159,7 +2159,7 @@ H5HF__cache_dblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, /* Let the metadata cache know, if the block moved */ if(!H5F_addr_eq(par_iblock->ents[par_entry].addr, dblock_addr)) - if(H5AC_move_entry((H5F_t *)f, H5AC_FHEAP_DBLOCK, par_iblock->ents[par_entry].addr, dblock_addr) < 0) + if(H5AC_move_entry((H5F_t *)f, H5AC_FHEAP_DBLOCK, par_iblock->ents[par_entry].addr, dblock_addr, dxpl_id) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move direct block") /* Update information about compressed direct block's @@ -2211,7 +2211,7 @@ H5HF__cache_dblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, HDassert(!H5F_addr_eq(hdr->man_dtable.table_addr, dblock_addr)); /* Let the metadata cache know the block moved */ - if(H5AC_move_entry((H5F_t *)f, H5AC_FHEAP_DBLOCK, hdr->man_dtable.table_addr, dblock_addr) < 0) + if(H5AC_move_entry((H5F_t *)f, H5AC_FHEAP_DBLOCK, hdr->man_dtable.table_addr, dblock_addr, dxpl_id) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move direct block") /* Update information about direct block's location */ @@ -2235,7 +2235,7 @@ H5HF__cache_dblock_pre_serialize(const H5F_t *f, hid_t dxpl_id, void *_thing, HDassert(!H5F_addr_eq(par_iblock->ents[par_entry].addr, dblock_addr)); /* Let the metadata cache know the block moved */ - if(H5AC_move_entry((H5F_t *)f, H5AC_FHEAP_DBLOCK, par_iblock->ents[par_entry].addr, dblock_addr) < 0) + if(H5AC_move_entry((H5F_t *)f, H5AC_FHEAP_DBLOCK, par_iblock->ents[par_entry].addr, dblock_addr, dxpl_id) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move direct block") /* Update information about direct block's location */ diff --git a/src/H5HFhuge.c b/src/H5HFhuge.c index ccee89e..94433c4 100644 --- a/src/H5HFhuge.c +++ b/src/H5HFhuge.c @@ -379,7 +379,7 @@ HDfprintf(stderr, "%s: obj_size = %Zu, obj = %p\n", FUNC, obj_size, obj); HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap huge object") /* Write the object's data to disk */ - if(H5F_block_write(hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, obj_addr, write_size, dxpl_id, write_buf) < 0) + if(H5F_block_write(hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, obj_addr, write_size, H5AC_rawdata_dxpl_id, write_buf) < 0) HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "writing 'huge' object to file failed") /* Release buffer for writing, if we had one */ @@ -770,7 +770,7 @@ H5HF_huge_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, /* Read the object's (possibly filtered) data from the file */ /* (reads directly into application's buffer if no filters are present) */ - if(H5F_block_read(hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, obj_addr, (size_t)obj_size, dxpl_id, read_buf) < 0) + if(H5F_block_read(hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, obj_addr, (size_t)obj_size, H5AC_rawdata_dxpl_id, read_buf) < 0) HGOTO_ERROR(H5E_HEAP, H5E_READERROR, FAIL, "can't read 'huge' object's data from the file") /* Check for I/O pipeline filter on heap */ @@ -889,7 +889,7 @@ H5HF_huge_write(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, /* Write the object's data to the file */ /* (writes directly from application's buffer) */ - if(H5F_block_write(hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, obj_addr, obj_size, dxpl_id, obj) < 0) + if(H5F_block_write(hdr->f, H5FD_MEM_FHEAP_HUGE_OBJ, obj_addr, obj_size, H5AC_rawdata_dxpl_id, obj) < 0) HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "writing 'huge' object to file failed") done: diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index f3ec78f..ce485fe 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -630,7 +630,7 @@ H5HF_man_iblock_root_double(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_si /* Move object in cache, if it actually was relocated */ if(H5F_addr_ne(iblock->addr, new_addr)) { - if(H5AC_move_entry(hdr->f, H5AC_FHEAP_IBLOCK, iblock->addr, new_addr) < 0) + if(H5AC_move_entry(hdr->f, H5AC_FHEAP_IBLOCK, iblock->addr, new_addr, dxpl_id) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTMOVE, FAIL, "unable to move fractal heap root indirect block") iblock->addr = new_addr; } /* end if */ @@ -799,7 +799,7 @@ H5HF_man_iblock_root_halve(H5HF_indirect_t *iblock, hid_t dxpl_id) /* Move object in cache, if it actually was relocated */ if(H5F_addr_ne(iblock->addr, new_addr)) { - if(H5AC_move_entry(hdr->f, H5AC_FHEAP_IBLOCK, iblock->addr, new_addr) < 0) + if(H5AC_move_entry(hdr->f, H5AC_FHEAP_IBLOCK, iblock->addr, new_addr, dxpl_id) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTSPLIT, FAIL, "unable to move fractal heap root indirect block") iblock->addr = new_addr; } /* end if */ diff --git a/src/H5HFsection.c b/src/H5HFsection.c index 8699827..37ff8f4 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -99,7 +99,7 @@ static htri_t H5HF_sect_single_can_shrink(const H5FS_section_info_t *sect, static herr_t H5HF_sect_single_shrink(H5FS_section_info_t **_sect, void *udata); static herr_t H5HF_sect_single_valid(const H5FS_section_class_t *cls, - const H5FS_section_info_t *sect); + const H5FS_section_info_t *sect, hid_t dxpl_id); /* 'row' section routines */ static H5HF_free_section_t *H5HF_sect_row_create(haddr_t sect_off, @@ -129,7 +129,7 @@ static herr_t H5HF_sect_row_shrink(H5FS_section_info_t **sect, void *udata); static herr_t H5HF_sect_row_free(H5FS_section_info_t *sect); static herr_t H5HF_sect_row_valid(const H5FS_section_class_t *cls, - const H5FS_section_info_t *sect); + const H5FS_section_info_t *sect, hid_t dxpl_id); static herr_t H5HF_sect_row_debug(const H5FS_section_info_t *sect, FILE *stream, int indent, int fwidth); @@ -1172,7 +1172,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_sect_single_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5FS_section_info_t *_sect) +H5HF_sect_single_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5FS_section_info_t *_sect, hid_t dxpl_id) { const H5HF_free_section_t *sect = (const H5HF_free_section_t *)_sect; /* Pointer to section to check */ @@ -1222,7 +1222,7 @@ H5HF_sect_single_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5F H5HF_direct_t *dblock; /* Direct block for section */ /* Protect the direct block for the section */ - dblock = H5HF_man_dblock_protect(iblock->hdr, H5AC_dxpl_id, dblock_addr, dblock_size, iblock, sect->u.single.par_entry, H5AC__READ_ONLY_FLAG); + dblock = H5HF_man_dblock_protect(iblock->hdr, dxpl_id, dblock_addr, dblock_size, iblock, sect->u.single.par_entry, H5AC__READ_ONLY_FLAG); HDassert(dblock); /* Sanity check settings for section */ @@ -1233,7 +1233,7 @@ H5HF_sect_single_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, const H5F (sect->sect_info.addr + sect->sect_info.size))); /* Release direct block */ - status = H5AC_unprotect(iblock->hdr->f, H5AC_dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET); + status = H5AC_unprotect(iblock->hdr->f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, dblock, H5AC__NO_FLAGS_SET); HDassert(status >= 0); } /* end if */ } /* end if */ @@ -1992,7 +1992,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5HF_sect_row_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t *_sect) +H5HF_sect_row_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t *_sect, + hid_t H5_ATTR_UNUSED dxpl_id) { H5HF_sect_private_t *cls_prvt; /* Pointer to class private info */ const H5HF_hdr_t *hdr; /* Fractal heap header */ diff --git a/src/H5HLdblk.c b/src/H5HLdblk.c index 6a4d8ce..69e0334 100644 --- a/src/H5HLdblk.c +++ b/src/H5HLdblk.c @@ -266,7 +266,7 @@ H5HL__dblk_realloc(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t new_heap_size)) H5E_THROW(H5E_CANTRESIZE, "unable to resize heap data block in cache"); /* Relocate the heap data block in the cache */ - if(FAIL == H5AC_move_entry(f, H5AC_LHEAP_DBLK, old_addr, new_addr)) + if(FAIL == H5AC_move_entry(f, H5AC_LHEAP_DBLK, old_addr, new_addr, dxpl_id)) H5E_THROW(H5E_CANTMOVE, "unable to move heap data block in cache"); } /* end else */ diff --git a/src/H5MFsection.c b/src/H5MFsection.c index f333356..e5a0cf0 100644 --- a/src/H5MFsection.c +++ b/src/H5MFsection.c @@ -66,7 +66,7 @@ static htri_t H5MF_sect_simple_can_merge(const H5FS_section_info_t *sect1, static herr_t H5MF_sect_simple_merge(H5FS_section_info_t *sect1, H5FS_section_info_t *sect2, void *udata); static herr_t H5MF_sect_simple_valid(const H5FS_section_class_t *cls, - const H5FS_section_info_t *sect); + const H5FS_section_info_t *sect, hid_t dxpl_id); static H5FS_section_info_t *H5MF_sect_simple_split(H5FS_section_info_t *sect, hsize_t frag_size); @@ -488,7 +488,7 @@ H5MF_sect_simple_valid(const H5FS_section_class_t H5_ATTR_UNUSED *cls, #ifdef NDEBUG H5_ATTR_UNUSED #endif /* NDEBUG */ - *_sect) + *_sect, hid_t H5_ATTR_UNUSED dxpl_id) { #ifndef NDEBUG const H5MF_free_section_t *sect = (const H5MF_free_section_t *)_sect; /* File free section */ diff --git a/src/H5Ofill.c b/src/H5Ofill.c index f291305..745d027 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -527,7 +527,7 @@ H5O_fill_copy(const void *_src, void *_dst) H5T_path_t *tpath; /* Conversion information */ /* Set up type conversion function */ - if(NULL == (tpath = H5T_path_find(src->type, dst->type, NULL, NULL, H5AC_dxpl_id, FALSE))) + if(NULL == (tpath = H5T_path_find(src->type, dst->type, NULL, NULL, H5AC_noio_dxpl_id, FALSE))) HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, NULL, "unable to convert between src and dst data types") /* If necessary, convert fill value datatypes (which copies VL components, etc.) */ @@ -555,7 +555,7 @@ H5O_fill_copy(const void *_src, void *_dst) } /* end if */ /* Convert fill value */ - if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, dst->buf, bkg_buf, H5AC_dxpl_id) < 0) { + if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, dst->buf, bkg_buf, H5AC_noio_dxpl_id) < 0) { H5I_dec_ref(src_id); H5I_dec_ref(dst_id); if(bkg_buf) @@ -709,7 +709,7 @@ H5O_fill_reset_dyn(H5O_fill_t *fill) HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "can't create scalar dataspace") /* Reclaim any variable length components of the fill value */ - if(H5D_vlen_reclaim(fill_type_id, fill_space, H5P_DATASET_XFER_DEFAULT, fill->buf) < 0) { + if(H5D_vlen_reclaim(fill_type_id, fill_space, H5AC_noio_dxpl_id, fill->buf) < 0) { H5S_close(fill_space); HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "unable to reclaim variable-length fill value data") } /* end if */ diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index d56a52a..89dcd16 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -38,6 +38,7 @@ #include "H5ACprivate.h" /* Cache */ #include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ +#include "H5FDprivate.h" /* File drivers */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Ppkg.h" /* Property lists */ @@ -175,6 +176,11 @@ #define H5AC_XFER_RING_DEF H5AC_RING_US #define H5AC_XFER_RING_ENC H5P__encode_unsigned #define H5AC_XFER_RING_DEC H5P__decode_unsigned +#ifdef H5_DEBUG_BUILD +/* dxpl I/O type - private property */ +#define H5FD_DXPL_TYPE_SIZE sizeof(H5FD_dxpl_type_t) +#define H5FD_DXPL_TYPE_DEF H5FD_NOIO_DXPL +#endif /* H5_DEBUG_BUILD */ /******************/ /* Local Typedefs */ @@ -282,6 +288,9 @@ static const uint32_t H5D_def_direct_chunk_filters_g = H5D_XFER_DIRECT_CHUNK_WRI static const hsize_t *H5D_def_direct_chunk_offset_g = H5D_XFER_DIRECT_CHUNK_WRITE_OFFSET_DEF; /* Default value for the offset of direct chunk write */ static const uint32_t H5D_def_direct_chunk_datasize_g = H5D_XFER_DIRECT_CHUNK_WRITE_DATASIZE_DEF; /* Default value for the datasize of direct chunk write */ static const H5AC_ring_t H5D_ring_g = H5AC_XFER_RING_DEF; /* Default value for the cache entry ring type */ +#ifdef H5_DEBUG_BUILD +static const H5FD_dxpl_type_t H5D_dxpl_type_g = H5FD_NOIO_DXPL; /* Default value for the dxpl type */ +#endif /* H5_DEBUG_BUILD */ /*------------------------------------------------------------------------- @@ -476,11 +485,17 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - /* Register the data transform property */ + /* Register the ring property */ if(H5P_register_real(pclass, H5AC_RING_NAME, H5AC_XFER_RING_SIZE, &H5D_ring_g, NULL, NULL, NULL, H5AC_XFER_RING_ENC, H5AC_XFER_RING_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") +#ifdef H5_DEBUG_BUILD + /* Register the dxpl IO type property */ + if(H5P_register_real(pclass, H5FD_DXPL_TYPE_NAME, H5FD_DXPL_TYPE_SIZE, &H5D_dxpl_type_g, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") +#endif /* H5_DEBUG_BUILD */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index d93e199..9be6e2a 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -135,7 +135,6 @@ H5_DLLVAR const struct H5P_libclass_t H5P_CLS_GACC[1]; /* Group access */ H5_DLLVAR const struct H5P_libclass_t H5P_CLS_TACC[1]; /* Named datatype access */ H5_DLLVAR const struct H5P_libclass_t H5P_CLS_FACC[1]; /* File access */ - /******************************/ /* Library Private Prototypes */ /******************************/ diff --git a/src/H5T.c b/src/H5T.c index 7c2bd9c..e2f55b3 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -993,24 +993,24 @@ H5T__init_package(void) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") status = 0; - status |= H5T_register(H5T_PERS_SOFT, "i_i", fixedpt, fixedpt, H5T__conv_i_i, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "i_f", fixedpt, floatpt, H5T__conv_i_f, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "f_f", floatpt, floatpt, H5T__conv_f_f, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "f_i", floatpt, fixedpt, H5T__conv_f_i, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "s_s", string, string, H5T__conv_s_s, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "b_b", bitfield, bitfield, H5T__conv_b_b, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "ibo", fixedpt, fixedpt, H5T__conv_order, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "ibo(opt)", fixedpt, fixedpt, H5T__conv_order_opt, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "fbo", floatpt, floatpt, H5T__conv_order, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "fbo(opt)", floatpt, floatpt, H5T__conv_order_opt, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "struct(no-opt)", compound, compound, H5T__conv_struct, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "struct(opt)", compound, compound, H5T__conv_struct_opt, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "enum", enum_type, enum_type, H5T__conv_enum, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "enum_i", enum_type, fixedpt, H5T__conv_enum_numeric, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "enum_f", enum_type, floatpt, H5T__conv_enum_numeric, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "vlen", vlen, vlen, H5T__conv_vlen, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "array", array, array, H5T__conv_array, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_SOFT, "objref", objref, objref, H5T__conv_order_opt, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "i_i", fixedpt, fixedpt, H5T__conv_i_i, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "i_f", fixedpt, floatpt, H5T__conv_i_f, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "f_f", floatpt, floatpt, H5T__conv_f_f, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "f_i", floatpt, fixedpt, H5T__conv_f_i, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "s_s", string, string, H5T__conv_s_s, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "b_b", bitfield, bitfield, H5T__conv_b_b, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "ibo", fixedpt, fixedpt, H5T__conv_order, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "ibo(opt)", fixedpt, fixedpt, H5T__conv_order_opt, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "fbo", floatpt, floatpt, H5T__conv_order, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "fbo(opt)", floatpt, floatpt, H5T__conv_order_opt, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "struct(no-opt)", compound, compound, H5T__conv_struct, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "struct(opt)", compound, compound, H5T__conv_struct_opt, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "enum", enum_type, enum_type, H5T__conv_enum, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "enum_i", enum_type, fixedpt, H5T__conv_enum_numeric, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "enum_f", enum_type, floatpt, H5T__conv_enum_numeric, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "vlen", vlen, vlen, H5T__conv_vlen, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "array", array, array, H5T__conv_array, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_SOFT, "objref", objref, objref, H5T__conv_order_opt, H5AC_noio_dxpl_id, FALSE); /* * Native conversions should be listed last since we can use hardware to @@ -1021,221 +1021,221 @@ H5T__init_package(void) */ /* floating point */ - status |= H5T_register(H5T_PERS_HARD, "flt_dbl", native_float, native_double, H5T__conv_float_double, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_flt", native_double, native_float, H5T__conv_double_float, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_dbl", native_float, native_double, H5T__conv_float_double, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_flt", native_double, native_float, H5T__conv_double_float, H5AC_noio_dxpl_id, FALSE); #if H5_SIZEOF_LONG_DOUBLE != 0 - status |= H5T_register(H5T_PERS_HARD, "flt_ldbl", native_float, native_ldouble, H5T__conv_float_ldouble, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_ldbl", native_double, native_ldouble, H5T__conv_double_ldouble, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_flt", native_ldouble, native_float, H5T__conv_ldouble_float, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_dbl", native_ldouble, native_double, H5T__conv_ldouble_double, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_ldbl", native_float, native_ldouble, H5T__conv_float_ldouble, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_ldbl", native_double, native_ldouble, H5T__conv_double_ldouble, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_flt", native_ldouble, native_float, H5T__conv_ldouble_float, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_dbl", native_ldouble, native_double, H5T__conv_ldouble_double, H5AC_noio_dxpl_id, FALSE); #endif /* H5_SIZEOF_LONG_DOUBLE != 0 */ /* from long long */ - status |= H5T_register(H5T_PERS_HARD, "llong_ullong", native_llong, native_ullong, H5T__conv_llong_ullong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_llong", native_ullong, native_llong, H5T__conv_ullong_llong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_long", native_llong, native_long, H5T__conv_llong_long, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_ulong", native_llong, native_ulong, H5T__conv_llong_ulong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_long", native_ullong, native_long, H5T__conv_ullong_long, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_ulong", native_ullong, native_ulong, H5T__conv_ullong_ulong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_short", native_llong, native_short, H5T__conv_llong_short, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_ushort", native_llong, native_ushort, H5T__conv_llong_ushort, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_short", native_ullong, native_short, H5T__conv_ullong_short, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_ushort", native_ullong, native_ushort, H5T__conv_ullong_ushort, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_int", native_llong, native_int, H5T__conv_llong_int, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_uint", native_llong, native_uint, H5T__conv_llong_uint, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_int", native_ullong, native_int, H5T__conv_ullong_int, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_uint", native_ullong, native_uint, H5T__conv_ullong_uint, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_schar", native_llong, native_schar, H5T__conv_llong_schar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_uchar", native_llong, native_uchar, H5T__conv_llong_uchar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_schar", native_ullong, native_schar, H5T__conv_ullong_schar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_uchar", native_ullong, native_uchar, H5T__conv_ullong_uchar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_ullong", native_llong, native_ullong, H5T__conv_llong_ullong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_llong", native_ullong, native_llong, H5T__conv_ullong_llong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_long", native_llong, native_long, H5T__conv_llong_long, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_ulong", native_llong, native_ulong, H5T__conv_llong_ulong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_long", native_ullong, native_long, H5T__conv_ullong_long, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_ulong", native_ullong, native_ulong, H5T__conv_ullong_ulong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_short", native_llong, native_short, H5T__conv_llong_short, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_ushort", native_llong, native_ushort, H5T__conv_llong_ushort, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_short", native_ullong, native_short, H5T__conv_ullong_short, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_ushort", native_ullong, native_ushort, H5T__conv_ullong_ushort, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_int", native_llong, native_int, H5T__conv_llong_int, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_uint", native_llong, native_uint, H5T__conv_llong_uint, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_int", native_ullong, native_int, H5T__conv_ullong_int, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_uint", native_ullong, native_uint, H5T__conv_ullong_uint, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_schar", native_llong, native_schar, H5T__conv_llong_schar, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_uchar", native_llong, native_uchar, H5T__conv_llong_uchar, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_schar", native_ullong, native_schar, H5T__conv_ullong_schar, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_uchar", native_ullong, native_uchar, H5T__conv_ullong_uchar, H5AC_noio_dxpl_id, FALSE); /* From long */ - status |= H5T_register(H5T_PERS_HARD, "long_llong", native_long, native_llong, H5T__conv_long_llong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_ullong", native_long, native_ullong, H5T__conv_long_ullong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_llong", native_ulong, native_llong, H5T__conv_ulong_llong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_ullong", native_ulong, native_ullong, H5T__conv_ulong_ullong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_ulong", native_long, native_ulong, H5T__conv_long_ulong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_long", native_ulong, native_long, H5T__conv_ulong_long, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_short", native_long, native_short, H5T__conv_long_short, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_ushort", native_long, native_ushort, H5T__conv_long_ushort, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_short", native_ulong, native_short, H5T__conv_ulong_short, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_ushort", native_ulong, native_ushort, H5T__conv_ulong_ushort, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_int", native_long, native_int, H5T__conv_long_int, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_uint", native_long, native_uint, H5T__conv_long_uint, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_int", native_ulong, native_int, H5T__conv_ulong_int, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_uint", native_ulong, native_uint, H5T__conv_ulong_uint, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_schar", native_long, native_schar, H5T__conv_long_schar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_uchar", native_long, native_uchar, H5T__conv_long_uchar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_schar", native_ulong, native_schar, H5T__conv_ulong_schar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_uchar", native_ulong, native_uchar, H5T__conv_ulong_uchar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_llong", native_long, native_llong, H5T__conv_long_llong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_ullong", native_long, native_ullong, H5T__conv_long_ullong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_llong", native_ulong, native_llong, H5T__conv_ulong_llong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_ullong", native_ulong, native_ullong, H5T__conv_ulong_ullong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_ulong", native_long, native_ulong, H5T__conv_long_ulong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_long", native_ulong, native_long, H5T__conv_ulong_long, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_short", native_long, native_short, H5T__conv_long_short, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_ushort", native_long, native_ushort, H5T__conv_long_ushort, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_short", native_ulong, native_short, H5T__conv_ulong_short, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_ushort", native_ulong, native_ushort, H5T__conv_ulong_ushort, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_int", native_long, native_int, H5T__conv_long_int, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_uint", native_long, native_uint, H5T__conv_long_uint, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_int", native_ulong, native_int, H5T__conv_ulong_int, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_uint", native_ulong, native_uint, H5T__conv_ulong_uint, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_schar", native_long, native_schar, H5T__conv_long_schar, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_uchar", native_long, native_uchar, H5T__conv_long_uchar, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_schar", native_ulong, native_schar, H5T__conv_ulong_schar, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_uchar", native_ulong, native_uchar, H5T__conv_ulong_uchar, H5AC_noio_dxpl_id, FALSE); /* From short */ - status |= H5T_register(H5T_PERS_HARD, "short_llong", native_short, native_llong, H5T__conv_short_llong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_ullong", native_short, native_ullong, H5T__conv_short_ullong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_llong", native_ushort, native_llong, H5T__conv_ushort_llong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_ullong", native_ushort, native_ullong, H5T__conv_ushort_ullong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_long", native_short, native_long, H5T__conv_short_long, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_ulong", native_short, native_ulong, H5T__conv_short_ulong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_long", native_ushort, native_long, H5T__conv_ushort_long, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_ulong", native_ushort, native_ulong, H5T__conv_ushort_ulong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_ushort", native_short, native_ushort, H5T__conv_short_ushort, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_short", native_ushort, native_short, H5T__conv_ushort_short, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_int", native_short, native_int, H5T__conv_short_int, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_uint", native_short, native_uint, H5T__conv_short_uint, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_int", native_ushort, native_int, H5T__conv_ushort_int, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_uint", native_ushort, native_uint, H5T__conv_ushort_uint, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_schar", native_short, native_schar, H5T__conv_short_schar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_uchar", native_short, native_uchar, H5T__conv_short_uchar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_schar", native_ushort, native_schar, H5T__conv_ushort_schar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_uchar", native_ushort, native_uchar, H5T__conv_ushort_uchar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_llong", native_short, native_llong, H5T__conv_short_llong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_ullong", native_short, native_ullong, H5T__conv_short_ullong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_llong", native_ushort, native_llong, H5T__conv_ushort_llong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_ullong", native_ushort, native_ullong, H5T__conv_ushort_ullong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_long", native_short, native_long, H5T__conv_short_long, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_ulong", native_short, native_ulong, H5T__conv_short_ulong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_long", native_ushort, native_long, H5T__conv_ushort_long, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_ulong", native_ushort, native_ulong, H5T__conv_ushort_ulong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_ushort", native_short, native_ushort, H5T__conv_short_ushort, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_short", native_ushort, native_short, H5T__conv_ushort_short, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_int", native_short, native_int, H5T__conv_short_int, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_uint", native_short, native_uint, H5T__conv_short_uint, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_int", native_ushort, native_int, H5T__conv_ushort_int, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_uint", native_ushort, native_uint, H5T__conv_ushort_uint, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_schar", native_short, native_schar, H5T__conv_short_schar, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_uchar", native_short, native_uchar, H5T__conv_short_uchar, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_schar", native_ushort, native_schar, H5T__conv_ushort_schar, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_uchar", native_ushort, native_uchar, H5T__conv_ushort_uchar, H5AC_noio_dxpl_id, FALSE); /* From int */ - status |= H5T_register(H5T_PERS_HARD, "int_llong", native_int, native_llong, H5T__conv_int_llong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_ullong", native_int, native_ullong, H5T__conv_int_ullong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_llong", native_uint, native_llong, H5T__conv_uint_llong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_ullong", native_uint, native_ullong, H5T__conv_uint_ullong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_long", native_int, native_long, H5T__conv_int_long, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_ulong", native_int, native_ulong, H5T__conv_int_ulong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_long", native_uint, native_long, H5T__conv_uint_long, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_ulong", native_uint, native_ulong, H5T__conv_uint_ulong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_short", native_int, native_short, H5T__conv_int_short, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_ushort", native_int, native_ushort, H5T__conv_int_ushort, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_short", native_uint, native_short, H5T__conv_uint_short, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_ushort", native_uint, native_ushort, H5T__conv_uint_ushort, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_uint", native_int, native_uint, H5T__conv_int_uint, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_int", native_uint, native_int, H5T__conv_uint_int, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_schar", native_int, native_schar, H5T__conv_int_schar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_uchar", native_int, native_uchar, H5T__conv_int_uchar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_schar", native_uint, native_schar, H5T__conv_uint_schar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_uchar", native_uint, native_uchar, H5T__conv_uint_uchar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_llong", native_int, native_llong, H5T__conv_int_llong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_ullong", native_int, native_ullong, H5T__conv_int_ullong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_llong", native_uint, native_llong, H5T__conv_uint_llong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_ullong", native_uint, native_ullong, H5T__conv_uint_ullong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_long", native_int, native_long, H5T__conv_int_long, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_ulong", native_int, native_ulong, H5T__conv_int_ulong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_long", native_uint, native_long, H5T__conv_uint_long, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_ulong", native_uint, native_ulong, H5T__conv_uint_ulong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_short", native_int, native_short, H5T__conv_int_short, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_ushort", native_int, native_ushort, H5T__conv_int_ushort, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_short", native_uint, native_short, H5T__conv_uint_short, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_ushort", native_uint, native_ushort, H5T__conv_uint_ushort, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_uint", native_int, native_uint, H5T__conv_int_uint, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_int", native_uint, native_int, H5T__conv_uint_int, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_schar", native_int, native_schar, H5T__conv_int_schar, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_uchar", native_int, native_uchar, H5T__conv_int_uchar, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_schar", native_uint, native_schar, H5T__conv_uint_schar, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_uchar", native_uint, native_uchar, H5T__conv_uint_uchar, H5AC_noio_dxpl_id, FALSE); /* From char */ - status |= H5T_register(H5T_PERS_HARD, "schar_llong", native_schar, native_llong, H5T__conv_schar_llong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_ullong", native_schar, native_ullong, H5T__conv_schar_ullong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_llong", native_uchar, native_llong, H5T__conv_uchar_llong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_ullong", native_uchar, native_ullong, H5T__conv_uchar_ullong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_long", native_schar, native_long, H5T__conv_schar_long, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_ulong", native_schar, native_ulong, H5T__conv_schar_ulong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_long", native_uchar, native_long, H5T__conv_uchar_long, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_ulong", native_uchar, native_ulong, H5T__conv_uchar_ulong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_short", native_schar, native_short, H5T__conv_schar_short, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_ushort", native_schar, native_ushort, H5T__conv_schar_ushort, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_short", native_uchar, native_short, H5T__conv_uchar_short, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_ushort", native_uchar, native_ushort, H5T__conv_uchar_ushort, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_int", native_schar, native_int, H5T__conv_schar_int, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_uint", native_schar, native_uint, H5T__conv_schar_uint, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_int", native_uchar, native_int, H5T__conv_uchar_int, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_uint", native_uchar, native_uint, H5T__conv_uchar_uint, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_uchar", native_schar, native_uchar, H5T__conv_schar_uchar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_schar", native_uchar, native_schar, H5T__conv_uchar_schar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_llong", native_schar, native_llong, H5T__conv_schar_llong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_ullong", native_schar, native_ullong, H5T__conv_schar_ullong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_llong", native_uchar, native_llong, H5T__conv_uchar_llong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_ullong", native_uchar, native_ullong, H5T__conv_uchar_ullong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_long", native_schar, native_long, H5T__conv_schar_long, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_ulong", native_schar, native_ulong, H5T__conv_schar_ulong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_long", native_uchar, native_long, H5T__conv_uchar_long, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_ulong", native_uchar, native_ulong, H5T__conv_uchar_ulong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_short", native_schar, native_short, H5T__conv_schar_short, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_ushort", native_schar, native_ushort, H5T__conv_schar_ushort, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_short", native_uchar, native_short, H5T__conv_uchar_short, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_ushort", native_uchar, native_ushort, H5T__conv_uchar_ushort, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_int", native_schar, native_int, H5T__conv_schar_int, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_uint", native_schar, native_uint, H5T__conv_schar_uint, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_int", native_uchar, native_int, H5T__conv_uchar_int, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_uint", native_uchar, native_uint, H5T__conv_uchar_uint, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_uchar", native_schar, native_uchar, H5T__conv_schar_uchar, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_schar", native_uchar, native_schar, H5T__conv_uchar_schar, H5AC_noio_dxpl_id, FALSE); /* From char to floats */ - status |= H5T_register(H5T_PERS_HARD, "schar_flt", native_schar, native_float, H5T__conv_schar_float, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_dbl", native_schar, native_double, H5T__conv_schar_double, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "schar_ldbl", native_schar, native_ldouble, H5T__conv_schar_ldouble, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_flt", native_schar, native_float, H5T__conv_schar_float, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_dbl", native_schar, native_double, H5T__conv_schar_double, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "schar_ldbl", native_schar, native_ldouble, H5T__conv_schar_ldouble, H5AC_noio_dxpl_id, FALSE); /* From unsigned char to floats */ - status |= H5T_register(H5T_PERS_HARD, "uchar_flt", native_uchar, native_float, H5T__conv_uchar_float, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_dbl", native_uchar, native_double, H5T__conv_uchar_double, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uchar_ldbl", native_uchar, native_ldouble, H5T__conv_uchar_ldouble, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_flt", native_uchar, native_float, H5T__conv_uchar_float, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_dbl", native_uchar, native_double, H5T__conv_uchar_double, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uchar_ldbl", native_uchar, native_ldouble, H5T__conv_uchar_ldouble, H5AC_noio_dxpl_id, FALSE); /* From short to floats */ - status |= H5T_register(H5T_PERS_HARD, "short_flt", native_short, native_float, H5T__conv_short_float, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_dbl", native_short, native_double, H5T__conv_short_double, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "short_ldbl", native_short, native_ldouble, H5T__conv_short_ldouble, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_flt", native_short, native_float, H5T__conv_short_float, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_dbl", native_short, native_double, H5T__conv_short_double, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "short_ldbl", native_short, native_ldouble, H5T__conv_short_ldouble, H5AC_noio_dxpl_id, FALSE); /* From unsigned short to floats */ - status |= H5T_register(H5T_PERS_HARD, "ushort_flt", native_ushort, native_float, H5T__conv_ushort_float, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_dbl", native_ushort, native_double, H5T__conv_ushort_double, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ushort_ldbl", native_ushort, native_ldouble, H5T__conv_ushort_ldouble, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_flt", native_ushort, native_float, H5T__conv_ushort_float, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_dbl", native_ushort, native_double, H5T__conv_ushort_double, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ushort_ldbl", native_ushort, native_ldouble, H5T__conv_ushort_ldouble, H5AC_noio_dxpl_id, FALSE); /* From int to floats */ - status |= H5T_register(H5T_PERS_HARD, "int_flt", native_int, native_float, H5T__conv_int_float, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_dbl", native_int, native_double, H5T__conv_int_double, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "int_ldbl", native_int, native_ldouble, H5T__conv_int_ldouble, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_flt", native_int, native_float, H5T__conv_int_float, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_dbl", native_int, native_double, H5T__conv_int_double, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "int_ldbl", native_int, native_ldouble, H5T__conv_int_ldouble, H5AC_noio_dxpl_id, FALSE); /* From unsigned int to floats */ - status |= H5T_register(H5T_PERS_HARD, "uint_flt", native_uint, native_float, H5T__conv_uint_float, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_dbl", native_uint, native_double, H5T__conv_uint_double, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "uint_ldbl", native_uint, native_ldouble, H5T__conv_uint_ldouble, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_flt", native_uint, native_float, H5T__conv_uint_float, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_dbl", native_uint, native_double, H5T__conv_uint_double, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "uint_ldbl", native_uint, native_ldouble, H5T__conv_uint_ldouble, H5AC_noio_dxpl_id, FALSE); /* From long to floats */ - status |= H5T_register(H5T_PERS_HARD, "long_flt", native_long, native_float, H5T__conv_long_float, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_dbl", native_long, native_double, H5T__conv_long_double, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "long_ldbl", native_long, native_ldouble, H5T__conv_long_ldouble, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_flt", native_long, native_float, H5T__conv_long_float, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_dbl", native_long, native_double, H5T__conv_long_double, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "long_ldbl", native_long, native_ldouble, H5T__conv_long_ldouble, H5AC_noio_dxpl_id, FALSE); /* From unsigned long to floats */ - status |= H5T_register(H5T_PERS_HARD, "ulong_flt", native_ulong, native_float, H5T__conv_ulong_float, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_dbl", native_ulong, native_double, H5T__conv_ulong_double, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ulong_ldbl", native_ulong, native_ldouble, H5T__conv_ulong_ldouble, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_flt", native_ulong, native_float, H5T__conv_ulong_float, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_dbl", native_ulong, native_double, H5T__conv_ulong_double, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ulong_ldbl", native_ulong, native_ldouble, H5T__conv_ulong_ldouble, H5AC_noio_dxpl_id, FALSE); /* From long long to floats */ - status |= H5T_register(H5T_PERS_HARD, "llong_flt", native_llong, native_float, H5T__conv_llong_float, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "llong_dbl", native_llong, native_double, H5T__conv_llong_double, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_flt", native_llong, native_float, H5T__conv_llong_float, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_dbl", native_llong, native_double, H5T__conv_llong_double, H5AC_noio_dxpl_id, FALSE); #ifdef H5T_CONV_INTERNAL_LLONG_LDOUBLE - status |= H5T_register(H5T_PERS_HARD, "llong_ldbl", native_llong, native_ldouble, H5T__conv_llong_ldouble, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "llong_ldbl", native_llong, native_ldouble, H5T__conv_llong_ldouble, H5AC_noio_dxpl_id, FALSE); #endif /* H5T_CONV_INTERNAL_LLONG_LDOUBLE */ /* From unsigned long long to floats */ - status |= H5T_register(H5T_PERS_HARD, "ullong_flt", native_ullong, native_float, H5T__conv_ullong_float, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ullong_dbl", native_ullong, native_double, H5T__conv_ullong_double, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_flt", native_ullong, native_float, H5T__conv_ullong_float, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_dbl", native_ullong, native_double, H5T__conv_ullong_double, H5AC_noio_dxpl_id, FALSE); #ifdef H5T_CONV_INTERNAL_ULLONG_LDOUBLE - status |= H5T_register(H5T_PERS_HARD, "ullong_ldbl", native_ullong, native_ldouble, H5T__conv_ullong_ldouble, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ullong_ldbl", native_ullong, native_ldouble, H5T__conv_ullong_ldouble, H5AC_noio_dxpl_id, FALSE); #endif /* H5T_CONV_INTERNAL_ULLONG_LDOUBLE */ /* From floats to char */ - status |= H5T_register(H5T_PERS_HARD, "flt_schar", native_float, native_schar, H5T__conv_float_schar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_schar", native_double, native_schar, H5T__conv_double_schar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_schar", native_ldouble, native_schar, H5T__conv_ldouble_schar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_schar", native_float, native_schar, H5T__conv_float_schar, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_schar", native_double, native_schar, H5T__conv_double_schar, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_schar", native_ldouble, native_schar, H5T__conv_ldouble_schar, H5AC_noio_dxpl_id, FALSE); /* From floats to unsigned char */ - status |= H5T_register(H5T_PERS_HARD, "flt_uchar", native_float, native_uchar, H5T__conv_float_uchar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_uchar", native_double, native_uchar, H5T__conv_double_uchar, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_uchar", native_ldouble, native_uchar, H5T__conv_ldouble_uchar, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_uchar", native_float, native_uchar, H5T__conv_float_uchar, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_uchar", native_double, native_uchar, H5T__conv_double_uchar, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_uchar", native_ldouble, native_uchar, H5T__conv_ldouble_uchar, H5AC_noio_dxpl_id, FALSE); /* From floats to short */ - status |= H5T_register(H5T_PERS_HARD, "flt_short", native_float, native_short, H5T__conv_float_short, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_short", native_double, native_short, H5T__conv_double_short, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_short", native_ldouble, native_short, H5T__conv_ldouble_short, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_short", native_float, native_short, H5T__conv_float_short, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_short", native_double, native_short, H5T__conv_double_short, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_short", native_ldouble, native_short, H5T__conv_ldouble_short, H5AC_noio_dxpl_id, FALSE); /* From floats to unsigned short */ - status |= H5T_register(H5T_PERS_HARD, "flt_ushort", native_float, native_ushort, H5T__conv_float_ushort, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_ushort", native_double, native_ushort, H5T__conv_double_ushort, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_ushort", native_ldouble, native_ushort, H5T__conv_ldouble_ushort, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_ushort", native_float, native_ushort, H5T__conv_float_ushort, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_ushort", native_double, native_ushort, H5T__conv_double_ushort, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_ushort", native_ldouble, native_ushort, H5T__conv_ldouble_ushort, H5AC_noio_dxpl_id, FALSE); /* From floats to int */ - status |= H5T_register(H5T_PERS_HARD, "flt_int", native_float, native_int, H5T__conv_float_int, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_int", native_double, native_int, H5T__conv_double_int, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_int", native_ldouble, native_int, H5T__conv_ldouble_int, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_int", native_float, native_int, H5T__conv_float_int, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_int", native_double, native_int, H5T__conv_double_int, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_int", native_ldouble, native_int, H5T__conv_ldouble_int, H5AC_noio_dxpl_id, FALSE); /* From floats to unsigned int */ - status |= H5T_register(H5T_PERS_HARD, "flt_uint", native_float, native_uint, H5T__conv_float_uint, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_uint", native_double, native_uint, H5T__conv_double_uint, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_uint", native_ldouble, native_uint, H5T__conv_ldouble_uint, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_uint", native_float, native_uint, H5T__conv_float_uint, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_uint", native_double, native_uint, H5T__conv_double_uint, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_uint", native_ldouble, native_uint, H5T__conv_ldouble_uint, H5AC_noio_dxpl_id, FALSE); /* From floats to long */ - status |= H5T_register(H5T_PERS_HARD, "flt_long", native_float, native_long, H5T__conv_float_long, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_long", native_double, native_long, H5T__conv_double_long, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_long", native_ldouble, native_long, H5T__conv_ldouble_long, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_long", native_float, native_long, H5T__conv_float_long, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_long", native_double, native_long, H5T__conv_double_long, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_long", native_ldouble, native_long, H5T__conv_ldouble_long, H5AC_noio_dxpl_id, FALSE); /* From floats to unsigned long */ - status |= H5T_register(H5T_PERS_HARD, "flt_ulong", native_float, native_ulong, H5T__conv_float_ulong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_ulong", native_double, native_ulong, H5T__conv_double_ulong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "ldbl_ulong", native_ldouble, native_ulong, H5T__conv_ldouble_ulong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_ulong", native_float, native_ulong, H5T__conv_float_ulong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_ulong", native_double, native_ulong, H5T__conv_double_ulong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_ulong", native_ldouble, native_ulong, H5T__conv_ldouble_ulong, H5AC_noio_dxpl_id, FALSE); /* From floats to long long */ - status |= H5T_register(H5T_PERS_HARD, "flt_llong", native_float, native_llong, H5T__conv_float_llong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_llong", native_double, native_llong, H5T__conv_double_llong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_llong", native_float, native_llong, H5T__conv_float_llong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_llong", native_double, native_llong, H5T__conv_double_llong, H5AC_noio_dxpl_id, FALSE); #ifdef H5T_CONV_INTERNAL_LDOUBLE_LLONG - status |= H5T_register(H5T_PERS_HARD, "ldbl_llong", native_ldouble, native_llong, H5T__conv_ldouble_llong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_llong", native_ldouble, native_llong, H5T__conv_ldouble_llong, H5AC_noio_dxpl_id, FALSE); #endif /* H5T_CONV_INTERNAL_LDOUBLE_LLONG */ /* From floats to unsigned long long */ - status |= H5T_register(H5T_PERS_HARD, "flt_ullong", native_float, native_ullong, H5T__conv_float_ullong, H5AC_dxpl_id, FALSE); - status |= H5T_register(H5T_PERS_HARD, "dbl_ullong", native_double, native_ullong, H5T__conv_double_ullong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "flt_ullong", native_float, native_ullong, H5T__conv_float_ullong, H5AC_noio_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "dbl_ullong", native_double, native_ullong, H5T__conv_double_ullong, H5AC_noio_dxpl_id, FALSE); #if H5T_CONV_INTERNAL_LDOUBLE_ULLONG - status |= H5T_register(H5T_PERS_HARD, "ldbl_ullong", native_ldouble, native_ullong, H5T__conv_ldouble_ullong, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "ldbl_ullong", native_ldouble, native_ullong, H5T__conv_ldouble_ullong, H5AC_noio_dxpl_id, FALSE); #endif /* H5T_CONV_INTERNAL_LDOUBLE_ULLONG */ /* @@ -1243,7 +1243,7 @@ H5T__init_package(void) * data types we use are not important as long as the source and * destination are equal. */ - status |= H5T_register(H5T_PERS_HARD, "no-op", native_int, native_int, H5T__conv_noop, H5AC_dxpl_id, FALSE); + status |= H5T_register(H5T_PERS_HARD, "no-op", native_int, native_int, H5T__conv_noop, H5AC_noio_dxpl_id, FALSE); /* Initialize the +/- Infinity values for floating-point types */ status |= H5T__init_inf(); @@ -1365,7 +1365,7 @@ H5T_top_term_package(void) H5T__print_stats(path, &nprint/*in,out*/); path->cdata.command = H5T_CONV_FREE; if((path->func)((hid_t)FAIL, (hid_t)FAIL, &(path->cdata), (size_t)0, - (size_t)0, (size_t)0, NULL, NULL,H5AC_dxpl_id) < 0) { + (size_t)0, (size_t)0, NULL, NULL,H5AC_noio_dxpl_id) < 0) { #ifdef H5T_DEBUG if (H5DEBUG(T)) { fprintf(H5DEBUG(T), "H5T: conversion function " @@ -2460,7 +2460,7 @@ H5Tregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no conversion function specified") /* Go register the function */ - if(H5T_register(pers, name, src, dst, func, H5AC_dxpl_id, TRUE) < 0) + if(H5T_register(pers, name, src, dst, func, H5AC_noio_dxpl_id, TRUE) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't register conversion function") done: @@ -2599,7 +2599,7 @@ H5Tunregister(H5T_pers_t pers, const char *name, hid_t src_id, hid_t dst_id, if(dst_id > 0 && (NULL == (dst = (H5T_t *)H5I_object_verify(dst_id, H5I_DATATYPE)))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dst is not a data type") - if(H5T_unregister(pers, name, src, dst, func, H5AC_dxpl_id) < 0) + if(H5T_unregister(pers, name, src, dst, func, H5AC_noio_dxpl_id) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDELETE, FAIL, "internal unregister function failed") done: @@ -2643,7 +2643,7 @@ H5Tfind(hid_t src_id, hid_t dst_id, H5T_cdata_t **pcdata) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "no address to receive cdata pointer") /* Find it */ - if(NULL == (path = H5T_path_find(src, dst, NULL, NULL, H5AC_dxpl_id, FALSE))) + if(NULL == (path = H5T_path_find(src, dst, NULL, NULL, H5AC_noio_dxpl_id, FALSE))) HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, NULL, "conversion function not found") if(pcdata) @@ -2939,7 +2939,7 @@ H5T_decode(const unsigned char *buf) HGOTO_ERROR(H5E_DATATYPE, H5E_VERSION, NULL, "unknown version of encoded datatype") /* Decode the serialized datatype message */ - if(NULL == (ret_value = (H5T_t *)H5O_msg_decode(f, H5AC_dxpl_id, NULL, H5O_DTYPE_ID, buf))) + if(NULL == (ret_value = (H5T_t *)H5O_msg_decode(f, H5AC_noio_dxpl_id, NULL, H5O_DTYPE_ID, buf))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDECODE, NULL, "can't decode object") /* Mark datatype as being in memory now */ @@ -4761,7 +4761,7 @@ H5T_compiler_conv(H5T_t *src, H5T_t *dst) FUNC_ENTER_NOAPI_NOINIT /* Find it */ - if (NULL==(path=H5T_path_find(src, dst, NULL, NULL, H5AC_dxpl_id, FALSE))) + if (NULL==(path=H5T_path_find(src, dst, NULL, NULL, H5AC_noio_dxpl_id, FALSE))) HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "conversion function not found") ret_value = (htri_t)path->is_hard; diff --git a/src/H5Tnative.c b/src/H5Tnative.c index 229fe94..9dbce09 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -358,7 +358,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unable to create enum type") /* Find the conversion function */ - if(NULL == (tpath = H5T_path_find(super_type, nat_super_type, NULL, NULL, H5P_DEFAULT, FALSE))) + if(NULL == (tpath = H5T_path_find(super_type, nat_super_type, NULL, NULL, H5AC_noio_dxpl_id, FALSE))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to convert between src and dst data types") /* Retrieve member info and insert members into new enum type */ @@ -372,7 +372,7 @@ H5T_get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_alig HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value") HDmemcpy(memb_value, tmp_memb_value, H5T_get_size(super_type)); - if(H5T_convert(tpath, super_type_id, nat_super_type_id, (size_t)1, (size_t)0, (size_t)0, memb_value, NULL, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5T_convert(tpath, super_type_id, nat_super_type_id, (size_t)1, (size_t)0, (size_t)0, memb_value, NULL, H5AC_noio_dxpl_id) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value") if(H5T__enum_insert(new_type, memb_name, memb_value) < 0) diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index ae3d2a1..7c9dbf9 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -1003,7 +1003,7 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot use C integer datatype for cast") /* Get dataset fill value and store in cd_values[] */ - if(H5Z_scaleoffset_set_parms_fillval(dcpl_plist, type, scale_type, cd_values, need_convert, H5AC_dxpl_id) < 0) + if(H5Z_scaleoffset_set_parms_fillval(dcpl_plist, type, scale_type, cd_values, need_convert, H5AC_noio_dxpl_id) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTSET, FAIL, "unable to set fill value") } /* end else */ diff --git a/src/H5private.h b/src/H5private.h index 0331e2c..fa5a114 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1676,7 +1676,10 @@ typedef struct H5_debug_t { H5_debug_open_stream_t *open_stream; /* Stack of open output streams */ } H5_debug_t; +#ifdef H5_HAVE_PARALLEL extern hbool_t H5_coll_api_sanity_check_g; +#endif /* H5_HAVE_PARALLEL */ + extern H5_debug_t H5_debug_g; #define H5DEBUG(X) (H5_debug_g.pkg[H5_PKG_##X].stream) /* Do not use const else AIX strings does not show it. */ diff --git a/test/accum.c b/test/accum.c index edfc751..3249330 100644 --- a/test/accum.c +++ b/test/accum.c @@ -55,8 +55,8 @@ unsigned test_random_write(const H5F_io_info_t *fio_info); void accum_printf(void); /* Private Test H5Faccum Function Wrappers */ -#define accum_write(a,s,b) H5F_block_write(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), H5P_DATASET_XFER_DEFAULT, (b)) -#define accum_read(a,s,b) H5F_block_read(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), H5P_DATASET_XFER_DEFAULT, (b)) +#define accum_write(a,s,b) H5F_block_write(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), H5AC_dxpl_id, (b)) +#define accum_read(a,s,b) H5F_block_read(f, H5FD_MEM_DEFAULT, (haddr_t)(a), (size_t)(s), H5AC_dxpl_id, (b)) #define accum_free(fio_info,a,s) H5F__accum_free(fio_info, H5FD_MEM_DEFAULT, (haddr_t)(a), (hsize_t)(s)) #define accum_flush(fio_info) H5F__accum_flush(fio_info) #define accum_reset(fio_info) H5F__accum_reset(fio_info, TRUE) @@ -101,7 +101,7 @@ main(void) /* Set up I/O info for operation */ fio_info.f = f; - if(NULL == (fio_info.dxpl = (H5P_genplist_t *)H5I_object(H5P_DATASET_XFER_DEFAULT))) FAIL_STACK_ERROR + if(NULL == (fio_info.dxpl = (H5P_genplist_t *)H5I_object(H5AC_dxpl_id))) FAIL_STACK_ERROR /* Reset metadata accumulator for the file */ if(accum_reset(&fio_info) < 0) FAIL_STACK_ERROR diff --git a/test/btree2.c b/test/btree2.c index 2c9bbae..cc2c418 100644 --- a/test/btree2.c +++ b/test/btree2.c @@ -657,7 +657,7 @@ test_insert_basic(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -871,7 +871,7 @@ test_insert_split_root(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -1048,7 +1048,7 @@ test_insert_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -1203,7 +1203,7 @@ test_insert_level1_side_split(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -1365,7 +1365,7 @@ test_insert_level1_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -1508,7 +1508,7 @@ test_insert_level1_middle_split(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -1627,7 +1627,7 @@ test_insert_make_level2(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -1809,7 +1809,7 @@ test_insert_level2_leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -2038,7 +2038,7 @@ test_insert_level2_leaf_split(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -2272,7 +2272,7 @@ test_insert_level2_2internal_redistrib(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -2444,7 +2444,7 @@ test_insert_level2_2internal_split(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -2623,7 +2623,7 @@ test_insert_level2_3internal_redistrib(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -2801,7 +2801,7 @@ test_insert_level2_3internal_split(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -2981,7 +2981,7 @@ test_insert_lots(hid_t fapl, const H5B2_create_t *cparam, hid_t file = -1; /* File ID */ char filename[1024]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -3211,7 +3211,7 @@ test_update_basic(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ H5B2_test_rec_t record; /* Record to insert into tree */ @@ -3581,7 +3581,7 @@ test_update_split_root(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ H5B2_test_rec_t record; /* Record to insert into tree */ @@ -3834,7 +3834,7 @@ test_update_level1_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ H5B2_test_rec_t record; /* Record to insert into tree */ @@ -3993,7 +3993,7 @@ test_update_level1_side_split(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ H5B2_test_rec_t record; /* Record to insert into tree */ @@ -4159,7 +4159,7 @@ test_update_level1_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ H5B2_test_rec_t record; /* Record to insert into tree */ @@ -4306,7 +4306,7 @@ test_update_level1_middle_split(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ H5B2_test_rec_t record; /* Record to insert into tree */ @@ -4428,7 +4428,7 @@ test_update_make_level2(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ H5B2_test_rec_t record; /* Record to insert into tree */ @@ -4982,7 +4982,7 @@ test_update_lots(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ time_t curr_time; /* Current time, for seeding random number generator */ @@ -5224,7 +5224,7 @@ test_remove_basic(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -5532,7 +5532,7 @@ test_remove_level1_noredistrib(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -5755,7 +5755,7 @@ test_remove_level1_redistrib(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -5952,7 +5952,7 @@ test_remove_level1_2leaf_merge(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -6131,7 +6131,7 @@ test_remove_level1_3leaf_merge(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -6257,7 +6257,7 @@ test_remove_level1_promote(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -6484,7 +6484,7 @@ test_remove_level1_promote_2leaf_redistrib(hid_t fapl, const H5B2_create_t *cpar { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -6632,7 +6632,7 @@ test_remove_level1_promote_3leaf_redistrib(hid_t fapl, const H5B2_create_t *cpar { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -6780,7 +6780,7 @@ test_remove_level1_promote_2leaf_merge(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -6925,7 +6925,7 @@ test_remove_level1_promote_3leaf_merge(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -7070,7 +7070,7 @@ test_remove_level1_collapse(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -7209,7 +7209,7 @@ test_remove_level2_promote(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -7495,7 +7495,7 @@ test_remove_level2_promote_2internal_redistrib(hid_t fapl, const H5B2_create_t * { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -7645,7 +7645,7 @@ test_remove_level2_promote_3internal_redistrib(hid_t fapl, const H5B2_create_t * { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -7795,7 +7795,7 @@ test_remove_level2_promote_2internal_merge(hid_t fapl, const H5B2_create_t *cpar { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -7946,7 +7946,7 @@ test_remove_level2_promote_3internal_merge(hid_t fapl, const H5B2_create_t *cpar { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -8097,7 +8097,7 @@ test_remove_level2_2internal_merge_left(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -8223,7 +8223,7 @@ test_remove_level2_2internal_merge_right(hid_t fapl, const H5B2_create_t *cparam { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -8349,7 +8349,7 @@ test_remove_level2_3internal_merge(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -8475,7 +8475,7 @@ test_remove_level2_collapse_right(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -8601,7 +8601,7 @@ gen_l4_btree2(const char *filename, hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ hsize_t record; /* Record to insert into tree */ unsigned u; /* Local index variable */ @@ -8682,7 +8682,7 @@ test_remove_lots(const char *env_h5_drvr, hid_t fapl, const H5B2_create_t *cpara int fd = -1; /* File descriptor */ h5_stat_t sb; /* Stat buffer for file */ void *file_data = NULL; /* Copy of file data */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -9130,7 +9130,7 @@ test_find_neighbor(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -9354,7 +9354,7 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam) H5F_t *f = NULL; /* Internal file object pointer */ h5_stat_size_t empty_size; /* Size of an empty file */ h5_stat_size_t file_size; /* Size of each file created */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -9461,7 +9461,7 @@ test_delete(hid_t fapl, const H5B2_create_t *cparam) /* * Delete v2 B-tree */ - if(H5B2_delete(f, H5P_DATASET_XFER_DEFAULT, bt2_addr, f, NULL, NULL) < 0) + if(H5B2_delete(f, H5AC_dxpl_id, bt2_addr, f, NULL, NULL) < 0) FAIL_STACK_ERROR /* Close file */ @@ -9624,7 +9624,7 @@ test_modify(hid_t fapl, const H5B2_create_t *cparam, { hid_t file = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ hsize_t record; /* Record to insert into tree */ @@ -9858,7 +9858,7 @@ test_open_twice_diff(hid_t fapl, const H5B2_create_t *cparam) hid_t file00 = -1; /* File ID */ H5F_t *f = NULL; /* Internal file object pointer */ H5F_t *f2 = NULL; /* Internal file object pointer */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ H5B2_t *bt2 = NULL; /* v2 B-tree wrapper */ H5B2_t *bt2_2 = NULL; /* Second v2 B-tree wrapper */ haddr_t bt2_addr; /* Address of B-tree created */ diff --git a/test/cache.c b/test/cache.c index 38adbda..e95a83f 100644 --- a/test/cache.c +++ b/test/cache.c @@ -3225,7 +3225,7 @@ check_flush_cache__empty_cache(H5F_t * file_ptr) if ( pass ) { - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__NO_FLAGS_SET); if ( result < 0 ) { @@ -3236,7 +3236,7 @@ check_flush_cache__empty_cache(H5F_t * file_ptr) if ( pass ) { - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__FLUSH_INVALIDATE_FLAG); if ( result < 0 ) { @@ -3247,7 +3247,7 @@ check_flush_cache__empty_cache(H5F_t * file_ptr) if ( pass ) { - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_CLEAR_ONLY_FLAG); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__FLUSH_CLEAR_ONLY_FLAG); if ( result < 0 ) { @@ -3259,7 +3259,7 @@ check_flush_cache__empty_cache(H5F_t * file_ptr) if ( pass ) { - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_MARKED_ENTRIES_FLAG); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__FLUSH_MARKED_ENTRIES_FLAG); if ( result < 0 ) { @@ -4930,7 +4930,7 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr, if ( pass ) { - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, flush_flags); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, flush_flags); if ( result < 0 ) { @@ -5004,7 +5004,7 @@ check_flush_cache__multi_entry_test(H5F_t * file_ptr, /* clean up the cache to prep for the next test */ if ( pass ) { - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__FLUSH_INVALIDATE_FLAG); if ( result < 0 ) { @@ -5161,7 +5161,7 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, if ( pass ) { - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, flush_flags); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, flush_flags); if ( result < 0 ) { @@ -5235,7 +5235,7 @@ check_flush_cache__pe_multi_entry_test(H5F_t * file_ptr, /* clean up the cache to prep for the next test */ if ( pass ) { - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__FLUSH_INVALIDATE_FLAG); if ( result < 0 ) { @@ -9232,7 +9232,7 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, if ( pass ) { - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, flush_flags); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, flush_flags); if ( result < 0 ) { @@ -9424,7 +9424,7 @@ check_flush_cache__flush_op_test(H5F_t * file_ptr, /* clean up the cache to prep for the next test */ if ( pass ) { - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__FLUSH_INVALIDATE_FLAG); if ( result < 0 ) { @@ -10685,7 +10685,7 @@ check_flush_cache__flush_op_eviction_test(H5F_t * file_ptr) if ( pass ) { - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__FLUSH_INVALIDATE_FLAG); if ( result < 0 ) { @@ -12414,7 +12414,7 @@ check_flush_cache__single_entry_test(H5F_t * file_ptr, if ( pass ) { - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, flush_flags); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, flush_flags); if ( result < 0 ) { @@ -12473,7 +12473,7 @@ check_flush_cache__single_entry_test(H5F_t * file_ptr, /* clean up the cache to prep for the next test */ if ( pass ) { - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__FLUSH_INVALIDATE_FLAG); if ( result < 0 ) { @@ -12606,7 +12606,7 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr, if ( pass ) { - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, flush_flags); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, flush_flags); if ( result < 0 ) { @@ -12681,7 +12681,7 @@ check_flush_cache__pinned_single_entry_test(H5F_t * file_ptr, if ( pass ) { - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__FLUSH_INVALIDATE_FLAG); if ( result < 0 ) { @@ -14206,7 +14206,7 @@ check_resize_entry(void) } else { - result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, + result = H5C_unprotect(file_ptr, H5AC_dxpl_id, entry_ptr->addr, (void *)entry_ptr, H5C__DIRTIED_FLAG); if ( result < 0 ) { @@ -14291,7 +14291,7 @@ check_resize_entry(void) } else { - result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, + result = H5C_unprotect(file_ptr, H5AC_dxpl_id, entry_ptr->addr, (void *)entry_ptr, H5C__DIRTIED_FLAG); if ( result < 0 ) { @@ -14651,7 +14651,7 @@ check_resize_entry(void) } else { - result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, + result = H5C_unprotect(file_ptr, H5AC_dxpl_id, entry_ptr->addr, (void *)entry_ptr, H5C__DIRTIED_FLAG); if ( result < 0 ) { @@ -14738,7 +14738,7 @@ check_resize_entry(void) } else { - result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, + result = H5C_unprotect(file_ptr, H5AC_dxpl_id, entry_ptr->addr, (void *)entry_ptr, H5C__DIRTIED_FLAG); if ( result < 0 ) { @@ -15806,7 +15806,7 @@ check_flush_protected_err(void) protect_entry(file_ptr, 0, 0); - if ( H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET) >= 0 ) { + if ( H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__NO_FLAGS_SET) >= 0 ) { pass = FALSE; failure_mssg = "flush succeeded on cache with protected entry.\n"; @@ -15815,7 +15815,7 @@ check_flush_protected_err(void) unprotect_entry(file_ptr, 0, 0, H5C__DIRTIED_FLAG); - if ( H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET) < 0 ) { + if ( H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__NO_FLAGS_SET) < 0 ) { pass = FALSE; failure_mssg = "flush failed after unprotect.\n"; @@ -15884,7 +15884,7 @@ check_destroy_pinned_err(void) protect_entry(file_ptr, 0, 0); unprotect_entry(file_ptr, 0, 0, H5C__PIN_ENTRY_FLAG); - if ( H5C_dest(file_ptr, H5P_DATASET_XFER_DEFAULT) >= 0 ) { + if ( H5C_dest(file_ptr, H5AC_dxpl_id) >= 0 ) { pass = FALSE; failure_mssg = "destroy succeeded on cache with pinned entry.\n"; @@ -15893,7 +15893,7 @@ check_destroy_pinned_err(void) unpin_entry(0, 0); - if ( H5C_dest(file_ptr, H5P_DATASET_XFER_DEFAULT) < 0 ) { + if ( H5C_dest(file_ptr, H5AC_dxpl_id) < 0 ) { pass = FALSE; failure_mssg = "destroy failed after unpin.\n"; @@ -15970,7 +15970,7 @@ check_destroy_protected_err(void) protect_entry(file_ptr, 0, 0); - if ( H5C_dest(file_ptr, H5P_DATASET_XFER_DEFAULT) >= 0 ) { + if ( H5C_dest(file_ptr, H5AC_dxpl_id) >= 0 ) { pass = FALSE; failure_mssg = "destroy succeeded on cache with protected entry.\n"; @@ -15979,7 +15979,7 @@ check_destroy_protected_err(void) unprotect_entry(file_ptr, 0, 0, H5C__DIRTIED_FLAG); - if ( H5C_dest(file_ptr, H5P_DATASET_XFER_DEFAULT) < 0 ) { + if ( H5C_dest(file_ptr, H5AC_dxpl_id) < 0 ) { pass = FALSE; failure_mssg = "destroy failed after unprotect.\n"; @@ -16063,7 +16063,7 @@ check_duplicate_insert_err(void) base_addr = entries[0]; entry_ptr = &(base_addr[0]); - result = H5C_insert_entry(file_ptr, H5P_DATASET_XFER_DEFAULT, + result = H5C_insert_entry(file_ptr, H5AC_dxpl_id, &(types[0]), entry_ptr->addr, (void *)entry_ptr, H5C__NO_FLAGS_SET); @@ -16241,7 +16241,7 @@ check_double_pin_err(void) if ( pass ) { - result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, + result = H5C_unprotect(file_ptr, H5AC_dxpl_id, entry_ptr->addr, (void *)entry_ptr, H5C__PIN_ENTRY_FLAG); if ( result > 0 ) { @@ -16325,7 +16325,7 @@ check_double_unpin_err(void) if ( pass ) { - result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, + result = H5C_unprotect(file_ptr, H5AC_dxpl_id, entry_ptr->addr, (void *)entry_ptr, H5C__UNPIN_ENTRY_FLAG); if ( result > 0 ) { @@ -16525,7 +16525,7 @@ check_double_protect_err(void) if ( pass ) { - cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, + cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5AC_dxpl_id, &(types[0]), entry_ptr->addr, &entry_ptr->addr, H5C__NO_FLAGS_SET); @@ -16605,7 +16605,7 @@ check_double_unprotect_err(void) if ( pass ) { - result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, + result = H5C_unprotect(file_ptr, H5AC_dxpl_id, entry_ptr->addr, (void *)entry_ptr, H5C__NO_FLAGS_SET); if ( result > 0 ) { @@ -16769,7 +16769,7 @@ check_expunge_entry_errs(void) if ( pass ) { - result = H5C_expunge_entry(file_ptr, H5P_DATASET_XFER_DEFAULT, + result = H5C_expunge_entry(file_ptr, H5AC_dxpl_id, &(types[0]), entry_ptr->addr, H5C__NO_FLAGS_SET); if ( result > 0 ) { @@ -16787,7 +16787,7 @@ check_expunge_entry_errs(void) if ( pass ) { - result = H5C_expunge_entry(file_ptr, H5P_DATASET_XFER_DEFAULT, + result = H5C_expunge_entry(file_ptr, H5AC_dxpl_id, &(types[0]), entry_ptr->addr, H5C__NO_FLAGS_SET); if ( result > 0 ) { @@ -16805,7 +16805,7 @@ check_expunge_entry_errs(void) if ( pass ) { - result = H5C_expunge_entry(file_ptr, H5P_DATASET_XFER_DEFAULT, + result = H5C_expunge_entry(file_ptr, H5AC_dxpl_id, &(types[0]), entry_ptr->addr, H5C__NO_FLAGS_SET); if ( result < 0 ) { @@ -16981,7 +16981,7 @@ check_unprotect_ro_dirty_err(void) if ( pass ) { - result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, + result = H5C_unprotect(file_ptr, H5AC_dxpl_id, entry_ptr->addr, (void *)entry_ptr, H5C__DIRTIED_FLAG); if ( result >= 0 ) { @@ -17024,7 +17024,7 @@ check_unprotect_ro_dirty_err(void) if ( pass ) { - result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, + result = H5C_unprotect(file_ptr, H5AC_dxpl_id, entry_ptr->addr, (void *)entry_ptr, H5C__DIRTIED_FLAG); if ( result > 0 ) { @@ -17109,7 +17109,7 @@ check_protect_ro_rw_err(void) if ( pass ) { - thing_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, + thing_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5AC_dxpl_id, &(types[0]), entry_ptr->addr, &entry_ptr->addr, H5C__NO_FLAGS_SET); @@ -30888,7 +30888,7 @@ check_flush_deps_order(void) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__NO_FLAGS_SET); if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -30995,7 +30995,7 @@ check_flush_deps_order(void) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__NO_FLAGS_SET); if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -31108,7 +31108,7 @@ check_flush_deps_order(void) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__NO_FLAGS_SET); if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -31229,7 +31229,7 @@ check_flush_deps_order(void) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__NO_FLAGS_SET); if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -31408,7 +31408,7 @@ check_flush_deps_order(void) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__NO_FLAGS_SET); if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -31633,7 +31633,7 @@ check_flush_deps_order(void) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__NO_FLAGS_SET); if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -31806,7 +31806,7 @@ check_flush_deps_order(void) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__NO_FLAGS_SET); if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -31942,7 +31942,7 @@ check_flush_deps_order(void) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__NO_FLAGS_SET); if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -32140,7 +32140,7 @@ check_flush_deps_order(void) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__NO_FLAGS_SET); if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -32391,7 +32391,7 @@ check_flush_deps_order(void) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__NO_FLAGS_SET); if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -32658,7 +32658,7 @@ check_flush_deps_order(void) /* Reset index for tracking flush order */ flush_order = 0; - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__NO_FLAGS_SET); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__NO_FLAGS_SET); if( result < 0 ) CACHE_ERROR("flushing entries with flush dependendices") /* Change expected values, and verify the status of the entries @@ -33243,7 +33243,7 @@ cedds__expunge_dirty_entry_in_flush_test(H5F_t * file_ptr) if ( pass ) { - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__FLUSH_INVALIDATE_FLAG); if ( result < 0 ) { @@ -33604,7 +33604,7 @@ cedds__H5C_make_space_in_cache(H5F_t * file_ptr) if ( pass ) { - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__FLUSH_INVALIDATE_FLAG); if ( result < 0 ) { @@ -34047,7 +34047,7 @@ cedds__H5C__autoadjust__ageout__evict_aged_out_entries(H5F_t * file_ptr) if ( pass ) { - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__FLUSH_INVALIDATE_FLAG); if ( result < 0 ) { @@ -34422,7 +34422,7 @@ cedds__H5C_flush_invalidate_cache__bucket_scan(H5F_t * file_ptr) if ( pass ) { - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__FLUSH_INVALIDATE_FLAG); if ( result < 0 ) { @@ -34929,7 +34929,7 @@ check_stats__smoke_check_1(H5F_t * file_ptr) if ( pass ) { - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, H5C__FLUSH_INVALIDATE_FLAG); + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__FLUSH_INVALIDATE_FLAG); if ( result < 0 ) { diff --git a/test/cache_common.c b/test/cache_common.c index a3287cf..2b357b9 100644 --- a/test/cache_common.c +++ b/test/cache_common.c @@ -3061,7 +3061,7 @@ setup_cache(size_t max_cache_size, if ( pass ) { /* allocate space for test entries */ - actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, H5P_DATASET_XFER_DEFAULT, + actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, H5AC_dxpl_id, (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR)); if ( actual_base_addr == HADDR_UNDEF ) { @@ -3146,7 +3146,7 @@ takedown_cache(H5F_t * file_ptr, flush_cache(file_ptr, TRUE, FALSE, FALSE); - H5C_dest(file_ptr, H5P_DATASET_XFER_DEFAULT); + H5C_dest(file_ptr, H5AC_dxpl_id); if ( saved_cache != NULL ) { @@ -3171,7 +3171,7 @@ takedown_cache(H5F_t * file_ptr, HDassert ( file_ptr ); } - H5MF_xfree(file_ptr, H5FD_MEM_DEFAULT, H5P_DATASET_XFER_DEFAULT, saved_actual_base_addr, + H5MF_xfree(file_ptr, H5FD_MEM_DEFAULT, H5AC_dxpl_id, saved_actual_base_addr, (hsize_t)(ADDR_SPACE_SIZE + BASE_ADDR)); saved_actual_base_addr = HADDR_UNDEF; } @@ -3260,7 +3260,7 @@ expunge_entry(H5F_t * file_ptr, HDassert( ! ( entry_ptr->header.is_pinned ) ); HDassert( ! ( entry_ptr->is_pinned ) ); - result = H5C_expunge_entry(file_ptr, H5P_DATASET_XFER_DEFAULT, + result = H5C_expunge_entry(file_ptr, H5AC_dxpl_id, &(types[type]), entry_ptr->addr, H5C__NO_FLAGS_SET); if ( result < 0 ) { @@ -3312,11 +3312,11 @@ flush_cache(H5F_t * file_ptr, cache_ptr = file_ptr->shared->cache; if(destroy_entries) - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__FLUSH_INVALIDATE_FLAG); else - result = H5C_flush_cache(file_ptr, H5P_DATASET_XFER_DEFAULT, + result = H5C_flush_cache(file_ptr, H5AC_dxpl_id, H5C__NO_FLAGS_SET); if(dump_stats) @@ -3397,7 +3397,7 @@ insert_entry(H5F_t * file_ptr, entry_ptr->is_dirty = TRUE; - result = H5C_insert_entry(file_ptr, H5P_DATASET_XFER_DEFAULT, + result = H5C_insert_entry(file_ptr, H5AC_dxpl_id, &(types[type]), entry_ptr->addr, (void *)entry_ptr, flags); if ( ( result < 0 ) || @@ -3651,7 +3651,7 @@ protect_entry(H5F_t * file_ptr, HDassert( entry_ptr == entry_ptr->self ); HDassert( !(entry_ptr->is_protected) ); - cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, + cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5AC_dxpl_id, &(types[type]), entry_ptr->addr, &entry_ptr->addr, H5C__NO_FLAGS_SET); if ( ( cache_entry_ptr != (void *)entry_ptr ) || @@ -3748,7 +3748,7 @@ protect_entry_ro(H5F_t * file_ptr, ( ( entry_ptr->is_read_only ) && ( entry_ptr->ro_ref_count > 0 ) ) ); - cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5P_DATASET_XFER_DEFAULT, + cache_entry_ptr = (H5C_cache_entry_t *)H5C_protect(file_ptr, H5AC_dxpl_id, &(types[type]), entry_ptr->addr, &entry_ptr->addr, H5C__READ_ONLY_FLAG); if ( ( cache_entry_ptr != (void *)entry_ptr ) || @@ -3958,7 +3958,7 @@ unprotect_entry(H5F_t * file_ptr, if(flags & H5C__DIRTIED_FLAG) entry_ptr->is_dirty = TRUE; - result = H5C_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, + result = H5C_unprotect(file_ptr, H5AC_dxpl_id, entry_ptr->addr, (void *)entry_ptr, flags); if ( ( result < 0 ) || diff --git a/test/earray.c b/test/earray.c index 95733e9..0dfdb7a 100644 --- a/test/earray.c +++ b/test/earray.c @@ -596,7 +596,7 @@ finish(hid_t file, hid_t fapl, H5F_t *f, H5EA_t *ea, haddr_t ea_addr) h5_stat_size_t file_size; /* File size, after deleting array */ /* Close the extensible array */ - if(H5EA_close(ea, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5EA_close(ea, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR #ifdef QAK @@ -606,7 +606,7 @@ HDsystem("cp earray.h5 earray.h5.save"); #endif /* QAK */ /* Delete array */ - if(H5EA_delete(f, H5P_DATASET_XFER_DEFAULT, ea_addr, NULL) < 0) + if(H5EA_delete(f, H5AC_dxpl_id, ea_addr, NULL) < 0) FAIL_STACK_ERROR /* Close the file */ @@ -909,11 +909,11 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.raw_elmt_size = 0; H5E_BEGIN_TRY { - ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL); + ea = H5EA_create(f, H5AC_dxpl_id, &test_cparam, NULL); } H5E_END_TRY; if(ea) { /* Close opened extensible array */ - H5EA_close(ea, H5P_DATASET_XFER_DEFAULT); + H5EA_close(ea, H5AC_dxpl_id); ea = NULL; /* Indicate error */ @@ -924,11 +924,11 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.max_nelmts_bits = 0; H5E_BEGIN_TRY { - ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL); + ea = H5EA_create(f, H5AC_dxpl_id, &test_cparam, NULL); } H5E_END_TRY; if(ea) { /* Close opened extensible array */ - H5EA_close(ea, H5P_DATASET_XFER_DEFAULT); + H5EA_close(ea, H5AC_dxpl_id); ea = NULL; /* Indicate error */ @@ -938,11 +938,11 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.max_nelmts_bits = 65; H5E_BEGIN_TRY { - ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL); + ea = H5EA_create(f, H5AC_dxpl_id, &test_cparam, NULL); } H5E_END_TRY; if(ea) { /* Close opened extensible array */ - H5EA_close(ea, H5P_DATASET_XFER_DEFAULT); + H5EA_close(ea, H5AC_dxpl_id); ea = NULL; /* Indicate error */ @@ -953,11 +953,11 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.sup_blk_min_data_ptrs = 0; H5E_BEGIN_TRY { - ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL); + ea = H5EA_create(f, H5AC_dxpl_id, &test_cparam, NULL); } H5E_END_TRY; if(ea) { /* Close opened extensible array */ - H5EA_close(ea, H5P_DATASET_XFER_DEFAULT); + H5EA_close(ea, H5AC_dxpl_id); ea = NULL; /* Indicate error */ @@ -966,11 +966,11 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.sup_blk_min_data_ptrs = 1; H5E_BEGIN_TRY { - ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL); + ea = H5EA_create(f, H5AC_dxpl_id, &test_cparam, NULL); } H5E_END_TRY; if(ea) { /* Close opened extensible array */ - H5EA_close(ea, H5P_DATASET_XFER_DEFAULT); + H5EA_close(ea, H5AC_dxpl_id); ea = NULL; /* Indicate error */ @@ -979,11 +979,11 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.sup_blk_min_data_ptrs = 6; H5E_BEGIN_TRY { - ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL); + ea = H5EA_create(f, H5AC_dxpl_id, &test_cparam, NULL); } H5E_END_TRY; if(ea) { /* Close opened extensible array */ - H5EA_close(ea, H5P_DATASET_XFER_DEFAULT); + H5EA_close(ea, H5AC_dxpl_id); ea = NULL; /* Indicate error */ @@ -994,11 +994,11 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.data_blk_min_elmts = 0; H5E_BEGIN_TRY { - ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL); + ea = H5EA_create(f, H5AC_dxpl_id, &test_cparam, NULL); } H5E_END_TRY; if(ea) { /* Close opened extensible array */ - H5EA_close(ea, H5P_DATASET_XFER_DEFAULT); + H5EA_close(ea, H5AC_dxpl_id); ea = NULL; /* Indicate error */ @@ -1010,11 +1010,11 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.max_dblk_page_nelmts_bits = (uint8_t)(H5VM_log2_gen((uint64_t)test_cparam.idx_blk_elmts) - 1); H5E_BEGIN_TRY { - ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL); + ea = H5EA_create(f, H5AC_dxpl_id, &test_cparam, NULL); } H5E_END_TRY; if(ea) { /* Close opened extensible array */ - H5EA_close(ea, H5P_DATASET_XFER_DEFAULT); + H5EA_close(ea, H5AC_dxpl_id); ea = NULL; /* Indicate error */ @@ -1024,11 +1024,11 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.max_dblk_page_nelmts_bits = 4; /* corresponds to 16 elements in data block page, which is less than the 64 elements for the default settings */ H5E_BEGIN_TRY { - ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL); + ea = H5EA_create(f, H5AC_dxpl_id, &test_cparam, NULL); } H5E_END_TRY; if(ea) { /* Close opened extensible array */ - H5EA_close(ea, H5P_DATASET_XFER_DEFAULT); + H5EA_close(ea, H5AC_dxpl_id); ea = NULL; /* Indicate error */ @@ -1037,11 +1037,11 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.max_dblk_page_nelmts_bits = (uint8_t)(test_cparam.max_nelmts_bits + 1); H5E_BEGIN_TRY { - ea = H5EA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL); + ea = H5EA_create(f, H5AC_dxpl_id, &test_cparam, NULL); } H5E_END_TRY; if(ea) { /* Close opened extensible array */ - H5EA_close(ea, H5P_DATASET_XFER_DEFAULT); + H5EA_close(ea, H5AC_dxpl_id); ea = NULL; /* Indicate error */ @@ -1061,7 +1061,7 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE TESTING("extensible array creation"); /* Create array */ - if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &ea, &ea_addr, NULL) < 0) + if(create_array(f, H5AC_dxpl_id, cparam, &ea, &ea_addr, NULL) < 0) TEST_ERROR PASSED() @@ -1085,7 +1085,7 @@ test_create(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSE error: H5E_BEGIN_TRY { if(ea) - H5EA_close(ea, H5P_DATASET_XFER_DEFAULT); + H5EA_close(ea, H5AC_dxpl_id); H5Fclose(file); } H5E_END_TRY; @@ -1124,19 +1124,19 @@ test_reopen(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam) TESTING("create, close & reopen extensible array"); /* Create array */ - if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &ea, &ea_addr, NULL) < 0) + if(create_array(f, H5AC_dxpl_id, cparam, &ea, &ea_addr, NULL) < 0) TEST_ERROR /* Close the extensible array */ - if(H5EA_close(ea, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5EA_close(ea, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, NULL, HADDR_UNDEF, tparam) < 0) + if(reopen_file(&file, &f, fapl, H5AC_dxpl_id, NULL, HADDR_UNDEF, tparam) < 0) TEST_ERROR /* Re-open the array */ - if(NULL == (ea = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, NULL))) + if(NULL == (ea = H5EA_open(f, H5AC_dxpl_id, ea_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ @@ -1155,7 +1155,7 @@ test_reopen(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam) error: H5E_BEGIN_TRY { if(ea) - H5EA_close(ea, H5P_DATASET_XFER_DEFAULT); + H5EA_close(ea, H5AC_dxpl_id); H5Fclose(file); } H5E_END_TRY; @@ -1197,11 +1197,11 @@ test_open_twice(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam) TESTING("open extensible array twice"); /* Create array */ - if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &ea, &ea_addr, NULL) < 0) + if(create_array(f, H5AC_dxpl_id, cparam, &ea, &ea_addr, NULL) < 0) TEST_ERROR /* Open the array again, through the first file handle */ - if(NULL == (ea2 = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, NULL))) + if(NULL == (ea2 = H5EA_open(f, H5AC_dxpl_id, ea_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ @@ -1211,12 +1211,12 @@ test_open_twice(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam) TEST_ERROR /* Close the second extensible array wrapper */ - if(H5EA_close(ea2, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5EA_close(ea2, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR ea2 = NULL; /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, &ea, ea_addr, tparam) < 0) + if(reopen_file(&file, &f, fapl, H5AC_dxpl_id, &ea, ea_addr, tparam) < 0) TEST_ERROR /* Re-open the file */ @@ -1228,7 +1228,7 @@ test_open_twice(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam) FAIL_STACK_ERROR /* Open the extensible array through the second file handle */ - if(NULL == (ea2 = H5EA_open(f2, H5P_DATASET_XFER_DEFAULT, ea_addr, NULL))) + if(NULL == (ea2 = H5EA_open(f2, H5AC_dxpl_id, ea_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ @@ -1236,7 +1236,7 @@ test_open_twice(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam) TEST_ERROR /* Close the first extensible array wrapper */ - if(H5EA_close(ea, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5EA_close(ea, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR ea = NULL; @@ -1259,9 +1259,9 @@ test_open_twice(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam) error: H5E_BEGIN_TRY { if(ea) - H5EA_close(ea, H5P_DATASET_XFER_DEFAULT); + H5EA_close(ea, H5AC_dxpl_id); if(ea2) - H5EA_close(ea2, H5P_DATASET_XFER_DEFAULT); + H5EA_close(ea2, H5AC_dxpl_id); H5Fclose(file); H5Fclose(file2); } H5E_END_TRY; @@ -1309,11 +1309,11 @@ test_open_twice_diff(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tpa TESTING("open extensible array twice, through different file handles"); /* Create array */ - if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &ea, &ea_addr, NULL) < 0) + if(create_array(f, H5AC_dxpl_id, cparam, &ea, &ea_addr, NULL) < 0) TEST_ERROR /* Open the array again, through the first file handle */ - if(NULL == (ea2 = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, NULL))) + if(NULL == (ea2 = H5EA_open(f, H5AC_dxpl_id, ea_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ @@ -1323,7 +1323,7 @@ test_open_twice_diff(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tpa TEST_ERROR /* Close the second extensible array wrapper */ - if(H5EA_close(ea2, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5EA_close(ea2, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR ea2 = NULL; @@ -1335,7 +1335,7 @@ test_open_twice_diff(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tpa FAIL_STACK_ERROR /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, &ea, ea_addr, tparam) < 0) + if(reopen_file(&file, &f, fapl, H5AC_dxpl_id, &ea, ea_addr, tparam) < 0) TEST_ERROR /* Verify the creation parameters */ @@ -1343,7 +1343,7 @@ test_open_twice_diff(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tpa TEST_ERROR /* Close the first extensible array wrapper */ - if(H5EA_close(ea, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5EA_close(ea, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR ea = NULL; @@ -1374,7 +1374,7 @@ test_open_twice_diff(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tpa FAIL_STACK_ERROR /* Open the extensible array through the second file handle */ - if(NULL == (ea2 = H5EA_open(f2, H5P_DATASET_XFER_DEFAULT, ea_addr, NULL))) + if(NULL == (ea2 = H5EA_open(f2, H5AC_dxpl_id, ea_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ @@ -1399,9 +1399,9 @@ test_open_twice_diff(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tpa error: H5E_BEGIN_TRY { if(ea) - H5EA_close(ea, H5P_DATASET_XFER_DEFAULT); + H5EA_close(ea, H5AC_dxpl_id); if(ea2) - H5EA_close(ea2, H5P_DATASET_XFER_DEFAULT); + H5EA_close(ea2, H5AC_dxpl_id); H5Fclose(file); H5Fclose(file2); H5Fclose(file0); @@ -1445,15 +1445,15 @@ test_delete_open(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam) TESTING("deleting open extensible array"); /* Create array */ - if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &ea, &ea_addr, NULL) < 0) + if(create_array(f, H5AC_dxpl_id, cparam, &ea, &ea_addr, NULL) < 0) TEST_ERROR /* Open the array again */ - if(NULL == (ea2 = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, NULL))) + if(NULL == (ea2 = H5EA_open(f, H5AC_dxpl_id, ea_addr, NULL))) FAIL_STACK_ERROR /* Request that the array be deleted */ - if(H5EA_delete(f, H5P_DATASET_XFER_DEFAULT, ea_addr, NULL) < 0) + if(H5EA_delete(f, H5AC_dxpl_id, ea_addr, NULL) < 0) FAIL_STACK_ERROR /* Verify the creation parameters */ @@ -1463,38 +1463,38 @@ test_delete_open(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam) TEST_ERROR /* Close the second extensible array wrapper */ - if(H5EA_close(ea2, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5EA_close(ea2, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR ea2 = NULL; /* Try re-opening the array again (should fail, as array will be deleted) */ H5E_BEGIN_TRY { - ea2 = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, NULL); + ea2 = H5EA_open(f, H5AC_dxpl_id, ea_addr, NULL); } H5E_END_TRY; if(ea2) { /* Close opened array */ - H5EA_close(ea2, H5P_DATASET_XFER_DEFAULT); + H5EA_close(ea2, H5AC_dxpl_id); /* Indicate error */ TEST_ERROR } /* end if */ /* Close the first extensible array wrapper */ - if(H5EA_close(ea, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5EA_close(ea, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR ea = NULL; /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, NULL, HADDR_UNDEF, tparam) < 0) + if(reopen_file(&file, &f, fapl, H5AC_dxpl_id, NULL, HADDR_UNDEF, tparam) < 0) TEST_ERROR /* Try re-opening the array again (should fail, as array is now deleted) */ H5E_BEGIN_TRY { - ea = H5EA_open(f, H5P_DATASET_XFER_DEFAULT, ea_addr, NULL); + ea = H5EA_open(f, H5AC_dxpl_id, ea_addr, NULL); } H5E_END_TRY; if(ea) { /* Close opened array */ - H5EA_close(ea, H5P_DATASET_XFER_DEFAULT); + H5EA_close(ea, H5AC_dxpl_id); /* Indicate error */ TEST_ERROR @@ -1520,9 +1520,9 @@ test_delete_open(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam) error: H5E_BEGIN_TRY { if(ea) - H5EA_close(ea, H5P_DATASET_XFER_DEFAULT); + H5EA_close(ea, H5AC_dxpl_id); if(ea2) - H5EA_close(ea2, H5P_DATASET_XFER_DEFAULT); + H5EA_close(ea2, H5AC_dxpl_id); H5Fclose(file); } H5E_END_TRY; @@ -1637,7 +1637,7 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR cb.encode = test_flush_depend_cb; HDmemset(&fd_info, 0, sizeof(earray_flush_depend_ctx_t)); cb.udata = &fd_info; - if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &ea, &ea_addr, &cb) < 0) + if(create_array(f, H5AC_dxpl_id, cparam, &ea, &ea_addr, &cb) < 0) TEST_ERROR /* Verify the creation parameters */ @@ -1653,7 +1653,7 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR /* Insert test entry into cache */ base_addr = HADDR_MAX; - if(H5AC_insert_entry(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, base_addr, base_entry, H5AC__PIN_ENTRY_FLAG) < 0) + if(H5AC_insert_entry(f, H5AC_dxpl_id, H5AC_EARRAY_TEST, base_addr, base_entry, H5AC__PIN_ENTRY_FLAG) < 0) TEST_ERROR /* Set the base entry as a flush dependency for the array */ @@ -1668,17 +1668,17 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR /* Insert test entry into cache */ addr1 = HADDR_MAX - 1; - if(H5AC_insert_entry(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr1, entry1, H5AC__PIN_ENTRY_FLAG) < 0) + if(H5AC_insert_entry(f, H5AC_dxpl_id, H5AC_EARRAY_TEST, addr1, entry1, H5AC__PIN_ENTRY_FLAG) < 0) TEST_ERROR /* Set the test entry as a flush dependency for 0th index in the array */ - if(H5EA_support(ea, H5P_DATASET_XFER_DEFAULT, (hsize_t)0, (H5AC_info_t *)entry1) < 0) + if(H5EA_support(ea, H5AC_dxpl_id, (hsize_t)0, (H5AC_info_t *)entry1) < 0) TEST_ERROR /* Set element of array */ welmt = (uint64_t)0; idx = 0; - if(H5EA_set(ea, H5P_DATASET_XFER_DEFAULT, idx, &welmt) < 0) + if(H5EA_set(ea, H5AC_dxpl_id, idx, &welmt) < 0) FAIL_STACK_ERROR /* Create entry #2 to insert */ @@ -1690,17 +1690,17 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR /* Insert test entry into cache */ addr2 = HADDR_MAX - 2; - if(H5AC_insert_entry(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr2, entry2, H5AC__PIN_ENTRY_FLAG) < 0) + if(H5AC_insert_entry(f, H5AC_dxpl_id, H5AC_EARRAY_TEST, addr2, entry2, H5AC__PIN_ENTRY_FLAG) < 0) TEST_ERROR /* Set the test entry as a flush dependency for 1st index in the array */ - if(H5EA_support(ea, H5P_DATASET_XFER_DEFAULT, (hsize_t)1, (H5AC_info_t *)entry2) < 0) + if(H5EA_support(ea, H5AC_dxpl_id, (hsize_t)1, (H5AC_info_t *)entry2) < 0) TEST_ERROR /* Set element of array */ welmt = (uint64_t)1; idx = 1; - if(H5EA_set(ea, H5P_DATASET_XFER_DEFAULT, idx, &welmt) < 0) + if(H5EA_set(ea, H5AC_dxpl_id, idx, &welmt) < 0) FAIL_STACK_ERROR /* Create entry #3 to insert */ @@ -1712,17 +1712,17 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR /* Insert test entry into cache */ addr3 = HADDR_MAX - 3; - if(H5AC_insert_entry(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr3, entry3, H5AC__PIN_ENTRY_FLAG) < 0) + if(H5AC_insert_entry(f, H5AC_dxpl_id, H5AC_EARRAY_TEST, addr3, entry3, H5AC__PIN_ENTRY_FLAG) < 0) TEST_ERROR /* Set the test entry as a flush dependency for 10,000th index in the array */ - if(H5EA_support(ea, H5P_DATASET_XFER_DEFAULT, (hsize_t)10000, (H5AC_info_t *)entry3) < 0) + if(H5EA_support(ea, H5AC_dxpl_id, (hsize_t)10000, (H5AC_info_t *)entry3) < 0) TEST_ERROR /* Set element of array */ welmt = (uint64_t)10000; idx = 10000; - if(H5EA_set(ea, H5P_DATASET_XFER_DEFAULT, idx, &welmt) < 0) + if(H5EA_set(ea, H5AC_dxpl_id, idx, &welmt) < 0) FAIL_STACK_ERROR @@ -1752,51 +1752,51 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR TEST_ERROR /* Protect the base entry */ - if(NULL == (base_entry = (earray_test_t *)H5AC_protect(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, base_addr, NULL, H5AC__NO_FLAGS_SET))) + if(NULL == (base_entry = (earray_test_t *)H5AC_protect(f, H5AC_dxpl_id, H5AC_EARRAY_TEST, base_addr, NULL, H5AC__NO_FLAGS_SET))) TEST_ERROR /* Unprotect & unpin the base entry */ - if(H5AC_unprotect(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, base_addr, base_entry, (H5AC__UNPIN_ENTRY_FLAG | H5AC__DELETED_FLAG)) < 0) + if(H5AC_unprotect(f, H5AC_dxpl_id, H5AC_EARRAY_TEST, base_addr, base_entry, (H5AC__UNPIN_ENTRY_FLAG | H5AC__DELETED_FLAG)) < 0) TEST_ERROR /* Remove the test entry as a flush dependency for 0th index in the array */ - if(H5EA_unsupport(ea, H5P_DATASET_XFER_DEFAULT, (hsize_t)0, (H5AC_info_t *)entry1) < 0) + if(H5EA_unsupport(ea, H5AC_dxpl_id, (hsize_t)0, (H5AC_info_t *)entry1) < 0) TEST_ERROR /* Protect the test entry */ - if(NULL == (entry1 = (earray_test_t *)H5AC_protect(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr1, NULL, H5AC__NO_FLAGS_SET))) + if(NULL == (entry1 = (earray_test_t *)H5AC_protect(f, H5AC_dxpl_id, H5AC_EARRAY_TEST, addr1, NULL, H5AC__NO_FLAGS_SET))) TEST_ERROR /* Unprotect & unpin the test entry */ - if(H5AC_unprotect(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr1, entry1, (H5AC__UNPIN_ENTRY_FLAG | H5AC__DELETED_FLAG)) < 0) + if(H5AC_unprotect(f, H5AC_dxpl_id, H5AC_EARRAY_TEST, addr1, entry1, (H5AC__UNPIN_ENTRY_FLAG | H5AC__DELETED_FLAG)) < 0) TEST_ERROR /* Remove the test entry as a flush dependency for 1st index in the array */ - if(H5EA_unsupport(ea, H5P_DATASET_XFER_DEFAULT, (hsize_t)1, (H5AC_info_t *)entry2) < 0) + if(H5EA_unsupport(ea, H5AC_dxpl_id, (hsize_t)1, (H5AC_info_t *)entry2) < 0) TEST_ERROR /* Protect the test entry */ - if(NULL == (entry2 = (earray_test_t *)H5AC_protect(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr2, NULL, H5AC__NO_FLAGS_SET))) + if(NULL == (entry2 = (earray_test_t *)H5AC_protect(f, H5AC_dxpl_id, H5AC_EARRAY_TEST, addr2, NULL, H5AC__NO_FLAGS_SET))) TEST_ERROR /* Unprotect & unpin the test entry */ - if(H5AC_unprotect(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr2, entry2, (H5AC__UNPIN_ENTRY_FLAG | H5AC__DELETED_FLAG)) < 0) + if(H5AC_unprotect(f, H5AC_dxpl_id, H5AC_EARRAY_TEST, addr2, entry2, (H5AC__UNPIN_ENTRY_FLAG | H5AC__DELETED_FLAG)) < 0) TEST_ERROR /* Remove the test entry as a flush dependency for 10,000th index in the array */ - if(H5EA_unsupport(ea, H5P_DATASET_XFER_DEFAULT, (hsize_t)10000, (H5AC_info_t *)entry3) < 0) + if(H5EA_unsupport(ea, H5AC_dxpl_id, (hsize_t)10000, (H5AC_info_t *)entry3) < 0) TEST_ERROR /* Protect the test entry */ - if(NULL == (entry3 = (earray_test_t *)H5AC_protect(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr3, NULL, H5AC__NO_FLAGS_SET))) + if(NULL == (entry3 = (earray_test_t *)H5AC_protect(f, H5AC_dxpl_id, H5AC_EARRAY_TEST, addr3, NULL, H5AC__NO_FLAGS_SET))) TEST_ERROR /* Unprotect & unpin the test entry */ - if(H5AC_unprotect(f, H5P_DATASET_XFER_DEFAULT, H5AC_EARRAY_TEST, addr3, entry3, (H5AC__UNPIN_ENTRY_FLAG | H5AC__DELETED_FLAG)) < 0) + if(H5AC_unprotect(f, H5AC_dxpl_id, H5AC_EARRAY_TEST, addr3, entry3, (H5AC__UNPIN_ENTRY_FLAG | H5AC__DELETED_FLAG)) < 0) TEST_ERROR /* Close the extensible array */ - if(H5EA_close(ea, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5EA_close(ea, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR ea = NULL; @@ -1812,7 +1812,7 @@ test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR error: H5E_BEGIN_TRY { if(ea) - H5EA_close(ea, H5P_DATASET_XFER_DEFAULT); + H5EA_close(ea, H5AC_dxpl_id); H5Fclose(file); } H5E_END_TRY; @@ -2683,7 +2683,7 @@ test_set_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam, TEST_ERROR /* Create array */ - if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &ea, &ea_addr, NULL) < 0) + if(create_array(f, H5AC_dxpl_id, cparam, &ea, &ea_addr, NULL) < 0) TEST_ERROR /* Verify the creation parameters */ @@ -2691,7 +2691,7 @@ test_set_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam, TEST_ERROR /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, &ea, ea_addr, tparam) < 0) + if(reopen_file(&file, &f, fapl, H5AC_dxpl_id, &ea, ea_addr, tparam) < 0) TEST_ERROR /* Verify high-water # of elements written */ @@ -2722,7 +2722,7 @@ test_set_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam, /* Retrieve element of array (not set yet) */ relmt = (uint64_t)0; - if(H5EA_get(ea, H5P_DATASET_XFER_DEFAULT, idx, &relmt) < 0) + if(H5EA_get(ea, H5AC_dxpl_id, idx, &relmt) < 0) FAIL_STACK_ERROR /* Verify element is fill value for array */ @@ -2750,7 +2750,7 @@ test_set_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam, /* Retrieve element of array (not set yet) */ relmt = (uint64_t)0; - if(H5EA_get(ea, H5P_DATASET_XFER_DEFAULT, idx, &relmt) < 0) + if(H5EA_get(ea, H5AC_dxpl_id, idx, &relmt) < 0) FAIL_STACK_ERROR /* Verify element is fill value for array */ @@ -2759,7 +2759,7 @@ test_set_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam, /* Set element of array */ welmt = (uint64_t)7 + idx; - if(H5EA_set(ea, H5P_DATASET_XFER_DEFAULT, idx, &welmt) < 0) + if(H5EA_set(ea, H5AC_dxpl_id, idx, &welmt) < 0) FAIL_STACK_ERROR /* Get the max. array index */ @@ -2787,7 +2787,7 @@ test_set_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam, /* Retrieve element of array (set now) */ relmt = (uint64_t)0; - if(H5EA_get(ea, H5P_DATASET_XFER_DEFAULT, idx, &relmt) < 0) + if(H5EA_get(ea, H5AC_dxpl_id, idx, &relmt) < 0) FAIL_STACK_ERROR /* Verify element is value written */ @@ -2811,7 +2811,7 @@ test_set_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam, error: H5E_BEGIN_TRY { if(ea) - H5EA_close(ea, H5P_DATASET_XFER_DEFAULT); + H5EA_close(ea, H5AC_dxpl_id); H5Fclose(file); } H5E_END_TRY; @@ -2857,7 +2857,7 @@ test_skip_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam, TEST_ERROR /* Create array */ - if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &ea, &ea_addr, NULL) < 0) + if(create_array(f, H5AC_dxpl_id, cparam, &ea, &ea_addr, NULL) < 0) TEST_ERROR /* Verify the creation parameters */ @@ -2865,7 +2865,7 @@ test_skip_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam, TEST_ERROR /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, &ea, ea_addr, tparam) < 0) + if(reopen_file(&file, &f, fapl, H5AC_dxpl_id, &ea, ea_addr, tparam) < 0) TEST_ERROR /* Verify high-water # of elements written */ @@ -2886,7 +2886,7 @@ test_skip_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam, /* Retrieve element of array (not set yet) */ relmt = (uint64_t)0; - if(H5EA_get(ea, H5P_DATASET_XFER_DEFAULT, idx, &relmt) < 0) + if(H5EA_get(ea, H5AC_dxpl_id, idx, &relmt) < 0) FAIL_STACK_ERROR /* Verify element is fill value for array */ @@ -2895,7 +2895,7 @@ test_skip_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam, /* Set element of array */ welmt = (uint64_t)7 + idx; - if(H5EA_set(ea, H5P_DATASET_XFER_DEFAULT, idx, &welmt) < 0) + if(H5EA_set(ea, H5AC_dxpl_id, idx, &welmt) < 0) FAIL_STACK_ERROR /* Verify high-water # of elements written */ @@ -2937,7 +2937,7 @@ test_skip_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam, /* Retrieve element of array (set now) */ relmt = (uint64_t)0; - if(H5EA_get(ea, H5P_DATASET_XFER_DEFAULT, idx, &relmt) < 0) + if(H5EA_get(ea, H5AC_dxpl_id, idx, &relmt) < 0) FAIL_STACK_ERROR /* Verify element is value written */ @@ -2948,7 +2948,7 @@ test_skip_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam, for(cnt = 0; cnt < skip_elmts; cnt++) { /* Retrieve element of array (not set yet) */ relmt = (uint64_t)0; - if(H5EA_get(ea, H5P_DATASET_XFER_DEFAULT, cnt, &relmt) < 0) + if(H5EA_get(ea, H5AC_dxpl_id, cnt, &relmt) < 0) FAIL_STACK_ERROR /* Verify element is fill value for array */ @@ -2968,7 +2968,7 @@ test_skip_elmts(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t *tparam, error: H5E_BEGIN_TRY { if(ea) - H5EA_close(ea, H5P_DATASET_XFER_DEFAULT); + H5EA_close(ea, H5AC_dxpl_id); H5Fclose(file); } H5E_END_TRY; diff --git a/test/efc.c b/test/efc.c index a8d77e0..2d31713 100644 --- a/test/efc.c +++ b/test/efc.c @@ -3171,7 +3171,7 @@ main(void) /* Create property lists */ fcpl_id = H5Pcreate(H5P_FILE_CREATE); fapl_id = h5_fileaccess(); - dxpl_id = H5Pcreate(H5P_DATASET_XFER); + dxpl_id = H5AC_dxpl_id; /* Patch filenames */ h5_fixname(FILENAME[0], fapl_id, filename[0], sizeof(filename[0])); @@ -3187,8 +3187,6 @@ main(void) nerrors += test_graph_cycle(); /* Close property lists */ - if(H5Pclose(dxpl_id) < 0) - TEST_ERROR if(H5Pclose(fcpl_id) < 0) TEST_ERROR diff --git a/test/farray.c b/test/farray.c index 50a9856..ac9132a 100644 --- a/test/farray.c +++ b/test/farray.c @@ -402,11 +402,11 @@ finish(hid_t file, hid_t fapl, H5F_t *f, H5FA_t *fa, haddr_t fa_addr) h5_stat_size_t file_size; /* File size, after deleting array */ /* Close the fixed array */ - if(H5FA_close(fa, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5FA_close(fa, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR /* Delete array */ - if(H5FA_delete(f, H5P_DATASET_XFER_DEFAULT, fa_addr, NULL) < 0) + if(H5FA_delete(f, H5AC_dxpl_id, fa_addr, NULL) < 0) FAIL_STACK_ERROR /* Close the file */ @@ -464,11 +464,11 @@ test_create(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t H5_ATTR_UNUSE HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.raw_elmt_size = 0; H5E_BEGIN_TRY { - fa = H5FA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL); + fa = H5FA_create(f, H5AC_dxpl_id, &test_cparam, NULL); } H5E_END_TRY; if(fa) { /* Close opened fixed array */ - H5FA_close(fa, H5P_DATASET_XFER_DEFAULT); + H5FA_close(fa, H5AC_dxpl_id); fa = NULL; /* Indicate error */ @@ -479,11 +479,11 @@ test_create(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t H5_ATTR_UNUSE HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.max_dblk_page_nelmts_bits = 0; H5E_BEGIN_TRY { - fa = H5FA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL); + fa = H5FA_create(f, H5AC_dxpl_id, &test_cparam, NULL); } H5E_END_TRY; if(fa) { /* Close opened fixed array */ - H5FA_close(fa, H5P_DATASET_XFER_DEFAULT); + H5FA_close(fa, H5AC_dxpl_id); fa = NULL; /* Indicate error */ @@ -494,11 +494,11 @@ test_create(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t H5_ATTR_UNUSE HDmemcpy(&test_cparam, cparam, sizeof(test_cparam)); test_cparam.nelmts = 0; H5E_BEGIN_TRY { - fa = H5FA_create(f, H5P_DATASET_XFER_DEFAULT, &test_cparam, NULL); + fa = H5FA_create(f, H5AC_dxpl_id, &test_cparam, NULL); } H5E_END_TRY; if(fa) { /* Close opened fixed array */ - H5FA_close(fa, H5P_DATASET_XFER_DEFAULT); + H5FA_close(fa, H5AC_dxpl_id); fa = NULL; /* Indicate error */ @@ -518,7 +518,7 @@ test_create(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t H5_ATTR_UNUSE TESTING("fixed array creation"); /* Create array */ - if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &fa, &fa_addr) < 0) + if(create_array(f, H5AC_dxpl_id, cparam, &fa, &fa_addr) < 0) TEST_ERROR PASSED() @@ -542,7 +542,7 @@ test_create(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t H5_ATTR_UNUSE error: H5E_BEGIN_TRY { if(fa) - H5FA_close(fa, H5P_DATASET_XFER_DEFAULT); + H5FA_close(fa, H5AC_dxpl_id); H5Fclose(file); } H5E_END_TRY; @@ -578,19 +578,19 @@ test_reopen(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) TESTING("create, close & reopen fixed array"); /* Create array */ - if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &fa, &fa_addr) < 0) + if(create_array(f, H5AC_dxpl_id, cparam, &fa, &fa_addr) < 0) TEST_ERROR /* Close the fixed array */ - if(H5FA_close(fa, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5FA_close(fa, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, NULL, HADDR_UNDEF, tparam) < 0) + if(reopen_file(&file, &f, fapl, H5AC_dxpl_id, NULL, HADDR_UNDEF, tparam) < 0) TEST_ERROR /* Re-open the array */ - if(NULL == (fa = H5FA_open(f, H5P_DATASET_XFER_DEFAULT, fa_addr, NULL))) + if(NULL == (fa = H5FA_open(f, H5AC_dxpl_id, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ @@ -609,7 +609,7 @@ test_reopen(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) error: H5E_BEGIN_TRY { if(fa) - H5FA_close(fa, H5P_DATASET_XFER_DEFAULT); + H5FA_close(fa, H5AC_dxpl_id); H5Fclose(file); } H5E_END_TRY; @@ -648,11 +648,11 @@ test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) TESTING("open fixed array twice"); /* Create array */ - if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &fa, &fa_addr) < 0) + if(create_array(f, H5AC_dxpl_id, cparam, &fa, &fa_addr) < 0) TEST_ERROR /* Open the array again, through the first file handle */ - if(NULL == (fa2 = H5FA_open(f, H5P_DATASET_XFER_DEFAULT, fa_addr, NULL))) + if(NULL == (fa2 = H5FA_open(f, H5AC_dxpl_id, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ @@ -662,12 +662,12 @@ test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) TEST_ERROR /* Close the second fixed array wrapper */ - if(H5FA_close(fa2, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5FA_close(fa2, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR fa2 = NULL; /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, &fa, fa_addr, tparam) < 0) + if(reopen_file(&file, &f, fapl, H5AC_dxpl_id, &fa, fa_addr, tparam) < 0) TEST_ERROR /* Re-open the file */ @@ -679,7 +679,7 @@ test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) FAIL_STACK_ERROR /* Open the fixed array through the second file handle */ - if(NULL == (fa2 = H5FA_open(f2, H5P_DATASET_XFER_DEFAULT, fa_addr, NULL))) + if(NULL == (fa2 = H5FA_open(f2, H5AC_dxpl_id, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ @@ -687,7 +687,7 @@ test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) TEST_ERROR /* Close the first extensible array wrapper */ - if(H5FA_close(fa, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5FA_close(fa, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR fa = NULL; @@ -710,9 +710,9 @@ test_open_twice(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) error: H5E_BEGIN_TRY { if(fa) - H5FA_close(fa, H5P_DATASET_XFER_DEFAULT); + H5FA_close(fa, H5AC_dxpl_id); if(fa2) - H5FA_close(fa2, H5P_DATASET_XFER_DEFAULT); + H5FA_close(fa2, H5AC_dxpl_id); H5Fclose(file); H5Fclose(file2); } H5E_END_TRY; @@ -760,11 +760,11 @@ test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tpa TEST_ERROR /* Create array */ - if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &fa, &fa_addr) < 0) + if(create_array(f, H5AC_dxpl_id, cparam, &fa, &fa_addr) < 0) TEST_ERROR /* Open the array again, through the first file handle */ - if(NULL == (fa2 = H5FA_open(f, H5P_DATASET_XFER_DEFAULT, fa_addr, NULL))) + if(NULL == (fa2 = H5FA_open(f, H5AC_dxpl_id, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ @@ -774,7 +774,7 @@ test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tpa TEST_ERROR /* Close the second fixed array wrapper */ - if(H5FA_close(fa2, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5FA_close(fa2, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR fa2 = NULL; @@ -786,11 +786,11 @@ test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tpa FAIL_STACK_ERROR /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, &fa, fa_addr, tparam) < 0) + if(reopen_file(&file, &f, fapl, H5AC_dxpl_id, &fa, fa_addr, tparam) < 0) TEST_ERROR /* Close the first fixed array wrapper */ - if(H5FA_close(fa, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5FA_close(fa, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR fa = NULL; @@ -821,7 +821,7 @@ test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tpa FAIL_STACK_ERROR /* Open the fixed array through the second file handle */ - if(NULL == (fa2 = H5FA_open(f2, H5P_DATASET_XFER_DEFAULT, fa_addr, NULL))) + if(NULL == (fa2 = H5FA_open(f2, H5AC_dxpl_id, fa_addr, NULL))) FAIL_STACK_ERROR /* Verify the creation parameters */ @@ -846,9 +846,9 @@ test_open_twice_diff(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tpa error: H5E_BEGIN_TRY { if(fa) - H5FA_close(fa, H5P_DATASET_XFER_DEFAULT); + H5FA_close(fa, H5AC_dxpl_id); if(fa2) - H5FA_close(fa2, H5P_DATASET_XFER_DEFAULT); + H5FA_close(fa2, H5AC_dxpl_id); H5Fclose(file); H5Fclose(file2); H5Fclose(file0); @@ -889,15 +889,15 @@ test_delete_open(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) TESTING("deleting open fixed array"); /* Create array */ - if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &fa, &fa_addr) < 0) + if(create_array(f, H5AC_dxpl_id, cparam, &fa, &fa_addr) < 0) TEST_ERROR /* Open the array again */ - if(NULL == (fa2 = H5FA_open(f, H5P_DATASET_XFER_DEFAULT, fa_addr, NULL))) + if(NULL == (fa2 = H5FA_open(f, H5AC_dxpl_id, fa_addr, NULL))) FAIL_STACK_ERROR /* Request that the array be deleted */ - if(H5FA_delete(f, H5P_DATASET_XFER_DEFAULT, fa_addr, NULL) < 0) + if(H5FA_delete(f, H5AC_dxpl_id, fa_addr, NULL) < 0) FAIL_STACK_ERROR /* Verify the creation parameters */ @@ -907,38 +907,38 @@ test_delete_open(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) TEST_ERROR /* Close the second fixed array wrapper */ - if(H5FA_close(fa2, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5FA_close(fa2, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR fa2 = NULL; /* Try re-opening the array again (should fail, as array will be deleted) */ H5E_BEGIN_TRY { - fa2 = H5FA_open(f, H5P_DATASET_XFER_DEFAULT, fa_addr, NULL); + fa2 = H5FA_open(f, H5AC_dxpl_id, fa_addr, NULL); } H5E_END_TRY; if(fa2) { /* Close opened array */ - H5FA_close(fa2, H5P_DATASET_XFER_DEFAULT); + H5FA_close(fa2, H5AC_dxpl_id); /* Indicate error */ TEST_ERROR } /* end if */ /* Close the first fixed array wrapper */ - if(H5FA_close(fa, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5FA_close(fa, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR fa = NULL; /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, NULL, HADDR_UNDEF, tparam) < 0) + if(reopen_file(&file, &f, fapl, H5AC_dxpl_id, NULL, HADDR_UNDEF, tparam) < 0) TEST_ERROR /* Try re-opening the array again (should fail, as array is now deleted) */ H5E_BEGIN_TRY { - fa = H5FA_open(f, H5P_DATASET_XFER_DEFAULT, fa_addr, NULL); + fa = H5FA_open(f, H5AC_dxpl_id, fa_addr, NULL); } H5E_END_TRY; if(fa) { /* Close opened array */ - H5FA_close(fa, H5P_DATASET_XFER_DEFAULT); + H5FA_close(fa, H5AC_dxpl_id); /* Indicate error */ TEST_ERROR @@ -964,9 +964,9 @@ test_delete_open(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam) error: H5E_BEGIN_TRY { if(fa) - H5FA_close(fa, H5P_DATASET_XFER_DEFAULT); + H5FA_close(fa, H5AC_dxpl_id); if(fa2) - H5FA_close(fa2, H5P_DATASET_XFER_DEFAULT); + H5FA_close(fa2, H5AC_dxpl_id); H5Fclose(file); } H5E_END_TRY; @@ -1393,7 +1393,7 @@ test_set_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, TEST_ERROR /* Create array */ - if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &fa, &fa_addr) < 0) + if(create_array(f, H5AC_dxpl_id, cparam, &fa, &fa_addr) < 0) TEST_ERROR /* Verify the creation parameters */ @@ -1401,7 +1401,7 @@ test_set_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, TEST_ERROR /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, &fa, fa_addr, tparam) < 0) + if(reopen_file(&file, &f, fapl, H5AC_dxpl_id, &fa, fa_addr, tparam) < 0) TEST_ERROR if(H5FA_get_nelmts(fa, &fa_nelmts) < 0) @@ -1433,7 +1433,7 @@ test_set_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, /* Retrieve element of array (not set yet) */ relmt = (uint64_t)0; - if(H5FA_get(fa, H5P_DATASET_XFER_DEFAULT, idx, &relmt) < 0) + if(H5FA_get(fa, H5AC_dxpl_id, idx, &relmt) < 0) FAIL_STACK_ERROR /* Verify that the retrieved is correct */ @@ -1460,7 +1460,7 @@ test_set_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, idx = (hsize_t)sidx; relmt = (uint64_t)0; - if(H5FA_get(fa, H5P_DATASET_XFER_DEFAULT, idx, &relmt) < 0) + if(H5FA_get(fa, H5AC_dxpl_id, idx, &relmt) < 0) FAIL_STACK_ERROR /* Verify that the retrieved element is correct */ @@ -1469,12 +1469,12 @@ test_set_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, /* Set element of array */ welmt = (uint64_t)7 + idx; - if(H5FA_set(fa, H5P_DATASET_XFER_DEFAULT, idx, &welmt) < 0) + if(H5FA_set(fa, H5AC_dxpl_id, idx, &welmt) < 0) FAIL_STACK_ERROR /* Retrieve element of array (set now) */ relmt = (uint64_t)0; - if(H5FA_get(fa, H5P_DATASET_XFER_DEFAULT, idx, &relmt) < 0) + if(H5FA_get(fa, H5AC_dxpl_id, idx, &relmt) < 0) FAIL_STACK_ERROR /* Verify that the retrieved element is correct */ @@ -1504,7 +1504,7 @@ test_set_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, error: H5E_BEGIN_TRY { if(fa) - H5FA_close(fa, H5P_DATASET_XFER_DEFAULT); + H5FA_close(fa, H5AC_dxpl_id); H5Fclose(file); } H5E_END_TRY; @@ -1548,7 +1548,7 @@ test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, TEST_ERROR /* Create array */ - if(create_array(f, H5P_DATASET_XFER_DEFAULT, cparam, &fa, &fa_addr) < 0) + if(create_array(f, H5AC_dxpl_id, cparam, &fa, &fa_addr) < 0) TEST_ERROR /* Verify the creation parameters */ @@ -1556,7 +1556,7 @@ test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, TEST_ERROR /* Check for closing & re-opening the file */ - if(reopen_file(&file, &f, fapl, H5P_DATASET_XFER_DEFAULT, &fa, fa_addr, tparam) < 0) + if(reopen_file(&file, &f, fapl, H5AC_dxpl_id, &fa, fa_addr, tparam) < 0) TEST_ERROR if(H5FA_get_nelmts(fa, &fa_nelmts) < 0) @@ -1578,7 +1578,7 @@ test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, /* Retrieve element of array (not set yet) */ relmt = (uint64_t)0; - if(H5FA_get(fa, H5P_DATASET_XFER_DEFAULT, idx, &relmt) < 0) + if(H5FA_get(fa, H5AC_dxpl_id, idx, &relmt) < 0) FAIL_STACK_ERROR /* Verify that the retrieved is correct */ @@ -1587,7 +1587,7 @@ test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, /* Set element of array */ welmt = (uint64_t)7 + idx; - if(H5FA_set(fa, H5P_DATASET_XFER_DEFAULT, idx, &welmt) < 0) + if(H5FA_set(fa, H5AC_dxpl_id, idx, &welmt) < 0) FAIL_STACK_ERROR /* Verify array state */ @@ -1598,7 +1598,7 @@ test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, /* Retrieve element of array (set now) */ relmt = (uint64_t)0; - if(H5FA_get(fa, H5P_DATASET_XFER_DEFAULT, idx, &relmt) < 0) + if(H5FA_get(fa, H5AC_dxpl_id, idx, &relmt) < 0) FAIL_STACK_ERROR /* Verify that the retrieved is correct */ @@ -1610,7 +1610,7 @@ test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, for(cnt = 0; cnt < skip_elmts; cnt++) { /* Retrieve element of array (not set yet) */ relmt = (uint64_t)0; - if(H5FA_get(fa, H5P_DATASET_XFER_DEFAULT, cnt, &relmt) < 0) + if(H5FA_get(fa, H5AC_dxpl_id, cnt, &relmt) < 0) FAIL_STACK_ERROR /* Verify that the retrieved is correct */ @@ -1631,7 +1631,7 @@ test_skip_elmts(hid_t fapl, H5FA_create_t *cparam, farray_test_param_t *tparam, error: H5E_BEGIN_TRY { if(fa) - H5FA_close(fa, H5P_DATASET_XFER_DEFAULT); + H5FA_close(fa, H5AC_dxpl_id); H5Fclose(file); } H5E_END_TRY; diff --git a/test/fheap.c b/test/fheap.c index 61a8298..2ea1a61 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -1872,7 +1872,7 @@ test_create(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UNUSED */ TESTING("fractal heap creation"); - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -1896,11 +1896,11 @@ test_create(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UNUSED TEST_ERROR /* Close the fractal heap */ - if(H5HF_close(fh, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5HF_close(fh, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR /* Delete heap */ - if(H5HF_delete(f, H5P_DATASET_XFER_DEFAULT, fh_addr) < 0) + if(H5HF_delete(f, H5AC_dxpl_id, fh_addr) < 0) FAIL_STACK_ERROR /* Close the file */ @@ -1923,7 +1923,7 @@ test_create(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UNUSED error: H5E_BEGIN_TRY { if(fh) - H5HF_close(fh, H5P_DATASET_XFER_DEFAULT); + H5HF_close(fh, H5AC_dxpl_id); H5Fclose(file); } H5E_END_TRY; return(1); @@ -1991,7 +1991,7 @@ test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UNUSED TESTING("create, close & reopen fractal heap"); /* Create heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -2006,7 +2006,7 @@ test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UNUSED TEST_ERROR /* Close the fractal heap */ - if(H5HF_close(fh, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5HF_close(fh, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR /* Check for closing & re-opening the file */ @@ -2030,7 +2030,7 @@ test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UNUSED } /* end if */ /* Re-open the heap */ - if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) + if(NULL == (fh = H5HF_open(f, H5AC_dxpl_id, fh_addr))) FAIL_STACK_ERROR /* Query the creation parameters */ @@ -2041,12 +2041,12 @@ test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UNUSED TEST_ERROR /* Close the fractal heap */ - if(H5HF_close(fh, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5HF_close(fh, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR fh = NULL; /* Delete heap */ - if(H5HF_delete(f, H5P_DATASET_XFER_DEFAULT, fh_addr) < 0) + if(H5HF_delete(f, H5AC_dxpl_id, fh_addr) < 0) FAIL_STACK_ERROR /* Close the file */ @@ -2069,7 +2069,7 @@ test_reopen(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UNUSED error: H5E_BEGIN_TRY { if(fh) - H5HF_close(fh, H5P_DATASET_XFER_DEFAULT); + H5HF_close(fh, H5AC_dxpl_id); H5Fclose(file); } H5E_END_TRY; return(1); @@ -2139,7 +2139,7 @@ test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UN TESTING("open fractal heap twice"); /* Create heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -2154,7 +2154,7 @@ test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UN TEST_ERROR /* Open the heap again, through the first file handle */ - if(NULL == (fh2 = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) + if(NULL == (fh2 = H5HF_open(f, H5AC_dxpl_id, fh_addr))) FAIL_STACK_ERROR /* Verify the creation parameters */ @@ -2165,12 +2165,12 @@ test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UN TEST_ERROR /* Close the second fractal heap wrapper */ - if(H5HF_close(fh2, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5HF_close(fh2, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR fh2 = NULL; /* Check for closing & re-opening the heap & file */ - if(reopen_file(&file, &f, filename, fapl, H5P_DATASET_XFER_DEFAULT, &fh, fh_addr, tparam) < 0) + if(reopen_file(&file, &f, filename, fapl, H5AC_dxpl_id, &fh, fh_addr, tparam) < 0) TEST_ERROR /* Re-open the file */ @@ -2186,7 +2186,7 @@ test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UN FAIL_STACK_ERROR /* Open the fractal heap through the second file handle */ - if(NULL == (fh2 = H5HF_open(f2, H5P_DATASET_XFER_DEFAULT, fh_addr))) + if(NULL == (fh2 = H5HF_open(f2, H5AC_dxpl_id, fh_addr))) FAIL_STACK_ERROR /* Verify the creation parameters */ @@ -2197,7 +2197,7 @@ test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UN TEST_ERROR /* Close the first fractal heap wrapper */ - if(H5HF_close(fh, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5HF_close(fh, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR fh = NULL; @@ -2209,12 +2209,12 @@ test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UN FAIL_STACK_ERROR /* Close the second fractal heap wrapper */ - if(H5HF_close(fh2, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5HF_close(fh2, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR fh2 = NULL; /* Delete heap */ - if(H5HF_delete(f2, H5P_DATASET_XFER_DEFAULT, fh_addr) < 0) + if(H5HF_delete(f2, H5AC_dxpl_id, fh_addr) < 0) FAIL_STACK_ERROR /* Close the second file */ @@ -2237,9 +2237,9 @@ test_open_twice(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_UN error: H5E_BEGIN_TRY { if(fh) - H5HF_close(fh, H5P_DATASET_XFER_DEFAULT); + H5HF_close(fh, H5AC_dxpl_id); if(fh2) - H5HF_close(fh2, H5P_DATASET_XFER_DEFAULT); + H5HF_close(fh2, H5AC_dxpl_id); H5Fclose(file); H5Fclose(file2); } H5E_END_TRY; @@ -2307,7 +2307,7 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_U TESTING("deleting open fractal heap"); /* Create heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -2322,11 +2322,11 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_U TEST_ERROR /* Open the heap again */ - if(NULL == (fh2 = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) + if(NULL == (fh2 = H5HF_open(f, H5AC_dxpl_id, fh_addr))) FAIL_STACK_ERROR /* Request that the heap be deleted */ - if(H5HF_delete(f, H5P_DATASET_XFER_DEFAULT, fh_addr) < 0) + if(H5HF_delete(f, H5AC_dxpl_id, fh_addr) < 0) FAIL_STACK_ERROR /* Verify the creation parameters */ @@ -2337,24 +2337,24 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_U TEST_ERROR /* Close the second fractal heap wrapper */ - if(H5HF_close(fh2, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5HF_close(fh2, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR fh2 = NULL; /* Try re-opening the heap again (should fail, as heap will be deleted) */ H5E_BEGIN_TRY { - fh2 = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr); + fh2 = H5HF_open(f, H5AC_dxpl_id, fh_addr); } H5E_END_TRY; if(fh2) { /* Close opened heap */ - H5HF_close(fh2, H5P_DATASET_XFER_DEFAULT); + H5HF_close(fh2, H5AC_dxpl_id); /* Indicate error */ TEST_ERROR } /* end if */ /* Close the first fractal heap wrapper */ - if(H5HF_close(fh, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5HF_close(fh, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR fh = NULL; @@ -2380,11 +2380,11 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_U /* Try re-opening the heap again (should fail, as heap is now deleted) */ H5E_BEGIN_TRY { - fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr); + fh = H5HF_open(f, H5AC_dxpl_id, fh_addr); } H5E_END_TRY; if(fh) { /* Close opened heap */ - H5HF_close(fh, H5P_DATASET_XFER_DEFAULT); + H5HF_close(fh, H5AC_dxpl_id); /* Indicate error */ TEST_ERROR @@ -2410,9 +2410,9 @@ test_delete_open(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t H5_ATTR_U error: H5E_BEGIN_TRY { if(fh) - H5HF_close(fh, H5P_DATASET_XFER_DEFAULT); + H5HF_close(fh, H5AC_dxpl_id); if(fh2) - H5HF_close(fh2, H5P_DATASET_XFER_DEFAULT); + H5HF_close(fh2, H5AC_dxpl_id); H5Fclose(file); } H5E_END_TRY; return(1); @@ -2436,7 +2436,7 @@ static unsigned test_id_limits(hid_t fapl, H5HF_create_t *cparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -2781,7 +2781,7 @@ static unsigned test_filtered_create(hid_t fapl, H5HF_create_t *cparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -2849,7 +2849,7 @@ test_filtered_create(hid_t fapl, H5HF_create_t *cparam) FAIL_STACK_ERROR /* Re-open the heap */ - if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) + if(NULL == (fh = H5HF_open(f, H5AC_dxpl_id, fh_addr))) FAIL_STACK_ERROR /* Query the heap creation parameters */ @@ -2860,7 +2860,7 @@ test_filtered_create(hid_t fapl, H5HF_create_t *cparam) FAIL_STACK_ERROR /* Close the fractal heap */ - if(H5HF_close(fh, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5HF_close(fh, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR @@ -2904,7 +2904,7 @@ static unsigned test_size(hid_t fapl, H5HF_create_t *cparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -3005,7 +3005,7 @@ test_size(hid_t fapl, H5HF_create_t *cparam) TEST_ERROR /* Close the fractal heap */ - if(H5HF_close(fh, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5HF_close(fh, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR @@ -3049,7 +3049,7 @@ test_reopen_hdr(hid_t fapl, H5HF_create_t *cparam) { hid_t file1 = -1; /* File ID */ hid_t file2 = -2; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -3143,7 +3143,7 @@ test_reopen_hdr(hid_t fapl, H5HF_create_t *cparam) FAIL_STACK_ERROR /* Close the fractal heap */ - if(H5HF_close(fh, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5HF_close(fh, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR @@ -3185,7 +3185,7 @@ static unsigned test_man_insert_weird(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -3297,7 +3297,7 @@ static unsigned test_man_insert_first(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -3398,7 +3398,7 @@ static unsigned test_man_insert_second(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -3494,7 +3494,7 @@ static unsigned test_man_insert_root_mult(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -3593,7 +3593,7 @@ static unsigned test_man_insert_force_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -3618,7 +3618,7 @@ test_man_insert_force_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_par STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -3699,7 +3699,7 @@ static unsigned test_man_insert_fill_second(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -3724,7 +3724,7 @@ test_man_insert_fill_second(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -3806,7 +3806,7 @@ static unsigned test_man_insert_third_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -3831,7 +3831,7 @@ test_man_insert_third_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -3917,7 +3917,7 @@ static unsigned test_man_fill_first_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -3942,7 +3942,7 @@ test_man_fill_first_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *t STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -4013,7 +4013,7 @@ static unsigned test_man_start_second_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -4038,7 +4038,7 @@ test_man_start_second_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -4116,7 +4116,7 @@ static unsigned test_man_fill_second_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -4141,7 +4141,7 @@ test_man_fill_second_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t * STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -4217,7 +4217,7 @@ static unsigned test_man_start_third_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -4242,7 +4242,7 @@ test_man_start_third_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t * STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -4327,7 +4327,7 @@ static unsigned test_man_fill_fourth_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -4353,7 +4353,7 @@ test_man_fill_fourth_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t * STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -4425,7 +4425,7 @@ static unsigned test_man_fill_all_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -4450,7 +4450,7 @@ test_man_fill_all_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_para STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -4521,7 +4521,7 @@ static unsigned test_man_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -4546,7 +4546,7 @@ test_man_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_ STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -4623,7 +4623,7 @@ static unsigned test_man_second_direct_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -4648,7 +4648,7 @@ test_man_second_direct_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fhe STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -4733,7 +4733,7 @@ static unsigned test_man_fill_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -4758,7 +4758,7 @@ test_man_fill_first_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_ STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -4836,7 +4836,7 @@ static unsigned test_man_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -4861,7 +4861,7 @@ test_man_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -4947,7 +4947,7 @@ static unsigned test_man_fill_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -4972,7 +4972,7 @@ test_man_fill_second_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -5055,7 +5055,7 @@ static unsigned test_man_fill_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -5076,7 +5076,7 @@ test_man_fill_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fheap_te STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -5153,7 +5153,7 @@ static unsigned test_man_start_2nd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -5178,7 +5178,7 @@ test_man_start_2nd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -5262,7 +5262,7 @@ static unsigned test_man_recursive_indirect_two_deep(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -5287,7 +5287,7 @@ test_man_recursive_indirect_two_deep(hid_t fapl, H5HF_create_t *cparam, fheap_te STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -5365,7 +5365,7 @@ static unsigned test_man_start_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -5390,7 +5390,7 @@ test_man_start_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -5475,7 +5475,7 @@ static unsigned test_man_fill_first_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -5500,7 +5500,7 @@ test_man_fill_first_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fh STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -5586,7 +5586,7 @@ static unsigned test_man_fill_3rd_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -5611,7 +5611,7 @@ test_man_fill_3rd_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fhea STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -5693,7 +5693,7 @@ static unsigned test_man_fill_all_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -5718,7 +5718,7 @@ test_man_fill_all_3rd_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fhea STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -5801,7 +5801,7 @@ static unsigned test_man_start_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -5826,7 +5826,7 @@ test_man_start_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -5916,7 +5916,7 @@ static unsigned test_man_fill_first_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -5941,7 +5941,7 @@ test_man_fill_first_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fh STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -6036,7 +6036,7 @@ static unsigned test_man_fill_4th_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -6061,7 +6061,7 @@ test_man_fill_4th_recursive_indirect_row(hid_t fapl, H5HF_create_t *cparam, fhea STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -6148,7 +6148,7 @@ static unsigned test_man_fill_all_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -6173,7 +6173,7 @@ test_man_fill_all_4th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fhea STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -6263,7 +6263,7 @@ static unsigned test_man_start_5th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -6288,7 +6288,7 @@ test_man_start_5th_recursive_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_t STACK_ERROR /* Create absolute heap */ - if(NULL == (fh = H5HF_create(f, H5P_DATASET_XFER_DEFAULT, cparam))) + if(NULL == (fh = H5HF_create(f, H5AC_dxpl_id, cparam))) FAIL_STACK_ERROR if(H5HF_get_id_len(fh, &id_len) < 0) FAIL_STACK_ERROR @@ -6392,7 +6392,7 @@ static unsigned test_man_remove_bogus(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -6546,7 +6546,7 @@ static unsigned test_man_remove_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -6709,7 +6709,7 @@ static unsigned test_man_remove_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -6902,7 +6902,7 @@ static unsigned test_man_remove_one_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -7070,7 +7070,7 @@ static unsigned test_man_remove_two_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -7313,7 +7313,7 @@ static unsigned test_man_remove_three_larger(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -7614,7 +7614,7 @@ static unsigned test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -7729,7 +7729,7 @@ static unsigned test_man_remove_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -7803,7 +7803,7 @@ static unsigned test_man_remove_two_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -7892,7 +7892,7 @@ static unsigned test_man_remove_first_row(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -7963,7 +7963,7 @@ static unsigned test_man_remove_first_two_rows(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -8036,7 +8036,7 @@ static unsigned test_man_remove_first_four_rows(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -8113,7 +8113,7 @@ static unsigned test_man_remove_all_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -8184,7 +8184,7 @@ static unsigned test_man_remove_2nd_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -8259,7 +8259,7 @@ static unsigned test_man_remove_3rd_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -8343,7 +8343,7 @@ static unsigned test_man_skip_start_block(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -8421,7 +8421,7 @@ static unsigned test_man_skip_start_block_add_back(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -8520,7 +8520,7 @@ static unsigned test_man_skip_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -8630,7 +8630,7 @@ static unsigned test_man_skip_2nd_block(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -8727,7 +8727,7 @@ static unsigned test_man_skip_2nd_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -8872,7 +8872,7 @@ static unsigned test_man_fill_one_partial_skip_2nd_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -9038,7 +9038,7 @@ static unsigned test_man_fill_row_skip_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -9165,7 +9165,7 @@ static unsigned test_man_skip_direct_skip_indirect_two_rows_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -9292,7 +9292,7 @@ static unsigned test_man_fill_direct_skip_indirect_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -9416,7 +9416,7 @@ static unsigned test_man_fill_direct_skip_2nd_indirect_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -9545,7 +9545,7 @@ static unsigned test_man_fill_2nd_direct_less_one_wrap_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -9691,7 +9691,7 @@ static unsigned test_man_fill_direct_skip_2nd_indirect_skip_2nd_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -9861,7 +9861,7 @@ static unsigned test_man_fill_direct_skip_indirect_two_rows_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -10015,7 +10015,7 @@ static unsigned test_man_fill_direct_skip_indirect_two_rows_skip_indirect_row_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -10195,7 +10195,7 @@ static unsigned test_man_fill_2nd_direct_skip_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -10324,7 +10324,7 @@ static unsigned test_man_fill_2nd_direct_skip_2nd_indirect_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -10462,7 +10462,7 @@ static unsigned test_man_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -10614,7 +10614,7 @@ static unsigned test_man_fill_2nd_direct_fill_direct_skip2_3rd_indirect_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -10777,7 +10777,7 @@ static unsigned test_man_fill_3rd_direct_less_one_fill_direct_wrap_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -10940,7 +10940,7 @@ static unsigned test_man_fill_1st_row_3rd_direct_fill_2nd_direct_less_one_wrap_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -11107,7 +11107,7 @@ static unsigned test_man_fill_3rd_direct_fill_direct_skip_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -11269,7 +11269,7 @@ static unsigned test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -11449,7 +11449,7 @@ static unsigned test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_two_rows_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -11664,7 +11664,7 @@ static unsigned test_man_fill_3rd_direct_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -11861,7 +11861,7 @@ static unsigned test_man_fill_4th_direct_less_one_fill_2nd_direct_fill_direct_skip_3rd_indirect_wrap_start_block_add_skipped(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -12089,7 +12089,7 @@ static unsigned test_man_frag_simple(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -12221,7 +12221,7 @@ static unsigned test_man_frag_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -12393,7 +12393,7 @@ static unsigned test_man_frag_2nd_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -12507,7 +12507,7 @@ static unsigned test_man_frag_3rd_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -12622,7 +12622,7 @@ static unsigned test_huge_insert_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -12775,7 +12775,7 @@ static unsigned test_huge_insert_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -13008,7 +13008,7 @@ static unsigned test_huge_insert_three(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -13316,7 +13316,7 @@ static unsigned test_huge_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -13742,7 +13742,7 @@ static unsigned test_filtered_huge(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -13847,7 +13847,7 @@ test_filtered_huge(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam STACK_ERROR /* Re-open the heap */ - if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) + if(NULL == (fh = H5HF_open(f, H5AC_dxpl_id, fh_addr))) FAIL_STACK_ERROR #endif /* QAK */ /* QAK */ @@ -13958,7 +13958,7 @@ static unsigned test_tiny_insert_one(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -14111,7 +14111,7 @@ static unsigned test_tiny_insert_two(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -14345,7 +14345,7 @@ static unsigned test_tiny_insert_mix(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -14956,7 +14956,7 @@ static unsigned test_filtered_man_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -15027,7 +15027,7 @@ test_filtered_man_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_para FAIL_STACK_ERROR /* Re-open the heap */ - if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) + if(NULL == (fh = H5HF_open(f, H5AC_dxpl_id, fh_addr))) FAIL_STACK_ERROR /* Check up on heap... */ @@ -15068,7 +15068,7 @@ test_filtered_man_root_direct(hid_t fapl, H5HF_create_t *cparam, fheap_test_para } /* end if */ /* Close the fractal heap */ - if(H5HF_close(fh, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5HF_close(fh, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR fh = NULL; @@ -15132,7 +15132,7 @@ static unsigned test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -15213,7 +15213,7 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa FAIL_STACK_ERROR /* Re-open the heap */ - if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) + if(NULL == (fh = H5HF_open(f, H5AC_dxpl_id, fh_addr))) FAIL_STACK_ERROR /* Check up on heap... */ @@ -15277,7 +15277,7 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa FAIL_STACK_ERROR /* Re-open the heap */ - if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) + if(NULL == (fh = H5HF_open(f, H5AC_dxpl_id, fh_addr))) FAIL_STACK_ERROR /* Remove object #2 from heap */ @@ -15313,7 +15313,7 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa FAIL_STACK_ERROR /* Re-open the heap */ - if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) + if(NULL == (fh = H5HF_open(f, H5AC_dxpl_id, fh_addr))) FAIL_STACK_ERROR /* Check up on heap... */ @@ -15350,7 +15350,7 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa FAIL_STACK_ERROR /* Re-open the heap */ - if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) + if(NULL == (fh = H5HF_open(f, H5AC_dxpl_id, fh_addr))) FAIL_STACK_ERROR /* Remove object #1 from heap */ @@ -15386,7 +15386,7 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa FAIL_STACK_ERROR /* Re-open the heap */ - if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) + if(NULL == (fh = H5HF_open(f, H5AC_dxpl_id, fh_addr))) FAIL_STACK_ERROR /* Check up on heap... */ @@ -15397,7 +15397,7 @@ test_filtered_man_root_indirect(hid_t fapl, H5HF_create_t *cparam, fheap_test_pa } /* end if */ /* Close the fractal heap */ - if(H5HF_close(fh, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5HF_close(fh, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR fh = NULL; @@ -15467,7 +15467,7 @@ static unsigned test_random(hsize_t size_limit, hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -15671,7 +15671,7 @@ static unsigned test_random_pow2(hsize_t size_limit, hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -15897,7 +15897,7 @@ static unsigned test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -16027,7 +16027,7 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Re-open the heap */ - if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) + if(NULL == (fh = H5HF_open(f, H5AC_dxpl_id, fh_addr))) FAIL_STACK_ERROR /* Initialize data to overwrite with */ @@ -16094,7 +16094,7 @@ test_write(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Re-open the heap */ - if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) + if(NULL == (fh = H5HF_open(f, H5AC_dxpl_id, fh_addr))) FAIL_STACK_ERROR /* Verify changed objects */ @@ -16174,7 +16174,7 @@ static unsigned test_bug1(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) { hid_t file = -1; /* File ID */ - hid_t dxpl = H5P_DATASET_XFER_DEFAULT; /* DXPL to use */ + hid_t dxpl = H5AC_dxpl_id; /* DXPL to use */ char filename[FHEAP_FILENAME_LEN]; /* Filename to use */ H5F_t *f = NULL; /* Internal file object pointer */ H5HF_t *fh = NULL; /* Fractal heap wrapper */ @@ -16259,7 +16259,7 @@ test_bug1(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Re-open the heap */ - if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) + if(NULL == (fh = H5HF_open(f, H5AC_dxpl_id, fh_addr))) FAIL_STACK_ERROR /* Remove one of the objects */ @@ -16289,7 +16289,7 @@ test_bug1(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_t *tparam) FAIL_STACK_ERROR /* Re-open the heap */ - if(NULL == (fh = H5HF_open(f, H5P_DATASET_XFER_DEFAULT, fh_addr))) + if(NULL == (fh = H5HF_open(f, H5AC_dxpl_id, fh_addr))) FAIL_STACK_ERROR /* Insert another object */ diff --git a/test/freespace.c b/test/freespace.c index 1b87974..2481c94 100644 --- a/test/freespace.c +++ b/test/freespace.c @@ -487,7 +487,7 @@ test_fs_create(hid_t fapl) init_cparam(&cparam); nclasses = NELMTS(test_classes); - if(NULL == (frsp = H5FS_create(f, H5P_DATASET_XFER_DEFAULT, &fs_addr, + if(NULL == (frsp = H5FS_create(f, H5AC_dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -507,12 +507,12 @@ test_fs_create(hid_t fapl) FAIL_STACK_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0) + if(H5FS_close(f, H5AC_dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* reopen the free-space manager */ - if(NULL == (frsp = H5FS_open(f, H5P_DATASET_XFER_DEFAULT, fs_addr, + if(NULL == (frsp = H5FS_open(f, H5AC_dxpl_id, fs_addr, nclasses, test_classes, NULL, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -522,12 +522,12 @@ test_fs_create(hid_t fapl) TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0) + if(H5FS_close(f, H5AC_dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5P_DATASET_XFER_DEFAULT, fs_addr) < 0) + if(H5FS_delete(f, H5AC_dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -550,7 +550,7 @@ test_fs_create(hid_t fapl) error: H5E_BEGIN_TRY { if(frsp) - H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp); + H5FS_close(f, H5AC_dxpl_id, frsp); H5Fclose(file); } H5E_END_TRY; return(1); @@ -625,7 +625,7 @@ test_fs_sect_add(hid_t fapl) init_cparam(&cparam); nclasses = NELMTS(test_classes); - if(NULL == (frsp = H5FS_create(f, H5P_DATASET_XFER_DEFAULT, &fs_addr, + if(NULL == (frsp = H5FS_create(f, H5AC_dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -637,7 +637,7 @@ test_fs_sect_add(hid_t fapl) init_sect_node(sect_node, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -652,7 +652,7 @@ test_fs_sect_add(hid_t fapl) fr_meta_size = H5FS_HEADER_SIZE(f) + H5FS_SINFO_PREFIX_SIZE(f); /* Close the free space manager */ - if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0) + if(H5FS_close(f, H5AC_dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; @@ -687,7 +687,7 @@ test_fs_sect_add(hid_t fapl) nclasses = NELMTS(test_classes); init_flags = H5FS_CLS_GHOST_OBJ; - if(NULL == (frsp = H5FS_create(f, H5P_DATASET_XFER_DEFAULT, &fs_addr, + if(NULL == (frsp = H5FS_create(f, H5AC_dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -700,7 +700,7 @@ test_fs_sect_add(hid_t fapl) init_sect_node(sect_node, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node, 0, NULL) < 0) FAIL_STACK_ERROR @@ -715,7 +715,7 @@ test_fs_sect_add(hid_t fapl) fr_meta_size = H5FS_HEADER_SIZE(f); /* Close the free space manager */ - if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0) + if(H5FS_close(f, H5AC_dxpl_id, frsp) < 0) FAIL_STACK_ERROR /* Close the file */ @@ -759,7 +759,7 @@ test_fs_sect_add(hid_t fapl) nclasses = NELMTS(test_classes); init_flags = 0; - if(NULL == (frsp = H5FS_create(f, H5P_DATASET_XFER_DEFAULT, &fs_addr, + if(NULL == (frsp = H5FS_create(f, H5AC_dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -774,7 +774,7 @@ test_fs_sect_add(hid_t fapl) */ init_sect_node(sect_node, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0) FAIL_STACK_ERROR @@ -785,12 +785,12 @@ test_fs_sect_add(hid_t fapl) TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0) + if(H5FS_close(f, H5AC_dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5P_DATASET_XFER_DEFAULT, fs_addr) < 0) + if(H5FS_delete(f, H5AC_dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -828,7 +828,7 @@ test_fs_sect_add(hid_t fapl) nclasses = NELMTS(test_classes); init_flags = 0; - if(NULL == (frsp = H5FS_create(f, H5P_DATASET_XFER_DEFAULT, &fs_addr, + if(NULL == (frsp = H5FS_create(f, H5AC_dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -843,7 +843,7 @@ test_fs_sect_add(hid_t fapl) */ init_sect_node(sect_node, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node, H5FS_ADD_DESERIALIZING, &can_shrink) < 0) FAIL_STACK_ERROR @@ -855,7 +855,7 @@ test_fs_sect_add(hid_t fapl) if(check_stats(f, frsp, &state)) TEST_ERROR - if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node) < 0) + if(H5FS_sect_remove(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node) < 0) FAIL_STACK_ERROR /* Free the section node(s) */ @@ -864,12 +864,12 @@ test_fs_sect_add(hid_t fapl) sect_node = NULL; /* Close the free space manager */ - if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0) + if(H5FS_close(f, H5AC_dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5P_DATASET_XFER_DEFAULT, fs_addr) < 0) + if(H5FS_delete(f, H5AC_dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -886,7 +886,7 @@ error: if(sect_node) TEST_sect_free((H5FS_section_info_t *)sect_node); if(frsp) - H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp); + H5FS_close(f, H5AC_dxpl_id, frsp); H5Fclose(file); } H5E_END_TRY; return(1); @@ -946,7 +946,7 @@ test_fs_sect_find(hid_t fapl) init_cparam(&cparam); nclasses = NELMTS(test_classes); - if(NULL == (frsp = H5FS_create(f, H5P_DATASET_XFER_DEFAULT, &fs_addr, + if(NULL == (frsp = H5FS_create(f, H5AC_dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -958,7 +958,7 @@ test_fs_sect_find(hid_t fapl) if(check_stats(f, frsp, &state)) TEST_ERROR - if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, + if((node_found = H5FS_sect_find(f, H5AC_dxpl_id, frsp, (hsize_t)TEST_SECT_SIZE30, (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR @@ -968,7 +968,7 @@ test_fs_sect_find(hid_t fapl) TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0) + if(H5FS_close(f, H5AC_dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; @@ -977,7 +977,7 @@ test_fs_sect_find(hid_t fapl) TESTING("H5FS_sect_find() a section equal to requested-size from free-space"); /* reopen the free-space manager */ - if(NULL == (frsp = H5FS_open(f, H5P_DATASET_XFER_DEFAULT, fs_addr, nclasses, + if(NULL == (frsp = H5FS_open(f, H5AC_dxpl_id, fs_addr, nclasses, test_classes, NULL, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -994,7 +994,7 @@ test_fs_sect_find(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1015,7 +1015,7 @@ test_fs_sect_find(hid_t fapl) init_sect_node(sect_node3, (haddr_t)(TEST_SECT_ADDR200), (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node3, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node3, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1034,7 +1034,7 @@ test_fs_sect_find(hid_t fapl) init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1053,7 +1053,7 @@ test_fs_sect_find(hid_t fapl) init_sect_node(sect_node4, (haddr_t)TEST_SECT_ADDR300, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node4, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node4, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1064,7 +1064,7 @@ test_fs_sect_find(hid_t fapl) if(check_stats(f, frsp, &state)) TEST_ERROR - if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, + if((node_found = H5FS_sect_find(f, H5AC_dxpl_id, frsp, (hsize_t)TEST_SECT_SIZE50, (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR @@ -1077,11 +1077,11 @@ test_fs_sect_find(hid_t fapl) TEST_ERROR /* remove sections A, C and D */ - if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1) < 0) + if(H5FS_sect_remove(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1) < 0) FAIL_STACK_ERROR - if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node3) < 0) + if(H5FS_sect_remove(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node3) < 0) FAIL_STACK_ERROR - if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node4) < 0) + if(H5FS_sect_remove(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node4) < 0) FAIL_STACK_ERROR /* Free the section node(s) */ @@ -1096,7 +1096,7 @@ test_fs_sect_find(hid_t fapl) sect_node4 = NULL; /* Close the free space manager */ - if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0) + if(H5FS_close(f, H5AC_dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; @@ -1105,7 +1105,7 @@ test_fs_sect_find(hid_t fapl) TESTING("H5FS_sect_find() a section greater than requested-size from free-space"); /* reopen the free-space manager */ - if(NULL == (frsp = H5FS_open(f, H5P_DATASET_XFER_DEFAULT, fs_addr, nclasses, + if(NULL == (frsp = H5FS_open(f, H5AC_dxpl_id, fs_addr, nclasses, test_classes, NULL, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -1122,7 +1122,7 @@ test_fs_sect_find(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1142,7 +1142,7 @@ test_fs_sect_find(hid_t fapl) init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR200, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1153,7 +1153,7 @@ test_fs_sect_find(hid_t fapl) if(check_stats(f, frsp, &state)) TEST_ERROR - if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, + if((node_found = H5FS_sect_find(f, H5AC_dxpl_id, frsp, (hsize_t)TEST_SECT_SIZE50, (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR @@ -1166,7 +1166,7 @@ test_fs_sect_find(hid_t fapl) node = NULL; /* remove sections A */ - if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1) < 0) + if(H5FS_sect_remove(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1) < 0) FAIL_STACK_ERROR /* Free the section node(s) */ @@ -1175,7 +1175,7 @@ test_fs_sect_find(hid_t fapl) sect_node1 = NULL; /* Close the free space manager */ - if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0) + if(H5FS_close(f, H5AC_dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; @@ -1184,7 +1184,7 @@ test_fs_sect_find(hid_t fapl) TESTING("H5FS_sect_find(): cannot find a section with requested-size from free-space"); /* reopen the free-space manager */ - if(NULL == (frsp = H5FS_open(f, H5P_DATASET_XFER_DEFAULT, fs_addr, nclasses, + if(NULL == (frsp = H5FS_open(f, H5AC_dxpl_id, fs_addr, nclasses, test_classes, NULL, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -1201,7 +1201,7 @@ test_fs_sect_find(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1213,14 +1213,14 @@ test_fs_sect_find(hid_t fapl) if(check_stats(f, frsp, &state)) TEST_ERROR - if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, + if((node_found = H5FS_sect_find(f, H5AC_dxpl_id, frsp, (hsize_t)TEST_SECT_SIZE50, (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR if (node_found) TEST_ERROR /* remove sections A */ - if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1) < 0) + if(H5FS_sect_remove(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1) < 0) FAIL_STACK_ERROR /* Free the section node(s) */ @@ -1229,12 +1229,12 @@ test_fs_sect_find(hid_t fapl) sect_node1 = NULL; /* Close the free space manager */ - if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0) + if(H5FS_close(f, H5AC_dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5P_DATASET_XFER_DEFAULT, fs_addr) < 0) + if(H5FS_delete(f, H5AC_dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -1255,7 +1255,7 @@ error: if(sect_node4) TEST_sect_free((H5FS_section_info_t *)sect_node4); if(frsp) - H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp); + H5FS_close(f, H5AC_dxpl_id, frsp); H5Fclose(file); } H5E_END_TRY; return(1); @@ -1330,7 +1330,7 @@ test_fs_sect_merge(hid_t fapl) init_cparam(&cparam); nclasses = NELMTS(test_classes); - if(NULL == (frsp = H5FS_create(f, H5P_DATASET_XFER_DEFAULT, &fs_addr, + if(NULL == (frsp = H5FS_create(f, H5AC_dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -1345,7 +1345,7 @@ test_fs_sect_merge(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1365,7 +1365,7 @@ test_fs_sect_merge(hid_t fapl) init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1383,7 +1383,7 @@ test_fs_sect_merge(hid_t fapl) init_sect_node(sect_node3, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE10, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node3, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node3, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1401,7 +1401,7 @@ test_fs_sect_merge(hid_t fapl) init_sect_node(sect_node4, (haddr_t)TEST_SECT_ADDR150, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node4, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node4, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1413,7 +1413,7 @@ test_fs_sect_merge(hid_t fapl) /* should be able to find the merged section of A, B, C & D */ - if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, + if((node_found = H5FS_sect_find(f, H5AC_dxpl_id, frsp, (hsize_t)(TEST_SECT_SIZE10+TEST_SECT_SIZE30+TEST_SECT_SIZE50+TEST_SECT_SIZE80), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR @@ -1426,12 +1426,12 @@ test_fs_sect_merge(hid_t fapl) TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0) + if(H5FS_close(f, H5AC_dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5P_DATASET_XFER_DEFAULT, fs_addr) < 0) + if(H5FS_delete(f, H5AC_dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -1458,7 +1458,7 @@ test_fs_sect_merge(hid_t fapl) nclasses = NELMTS(test_classes); init_flags = H5FS_CLS_SEPAR_OBJ; - if(NULL == (frsp = H5FS_create(f, H5P_DATASET_XFER_DEFAULT, &fs_addr, + if(NULL == (frsp = H5FS_create(f, H5AC_dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -1473,7 +1473,7 @@ test_fs_sect_merge(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1493,7 +1493,7 @@ test_fs_sect_merge(hid_t fapl) init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1506,17 +1506,17 @@ test_fs_sect_merge(hid_t fapl) TEST_ERROR /* should not be able to find the merged section of A & B */ - if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, + if((node_found = H5FS_sect_find(f, H5AC_dxpl_id, frsp, (hsize_t)(TEST_SECT_SIZE30+TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR if (node_found) TEST_ERROR /* remove section A from free-space */ - if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1) < 0) + if(H5FS_sect_remove(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1) < 0) FAIL_STACK_ERROR /* remove section B from free-space */ - if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node2) < 0) + if(H5FS_sect_remove(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2) < 0) FAIL_STACK_ERROR /* Free the section node(s) */ @@ -1528,12 +1528,12 @@ test_fs_sect_merge(hid_t fapl) sect_node2 = NULL; /* Close the free space manager */ - if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0) + if(H5FS_close(f, H5AC_dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5P_DATASET_XFER_DEFAULT, fs_addr) < 0) + if(H5FS_delete(f, H5AC_dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -1560,7 +1560,7 @@ test_fs_sect_merge(hid_t fapl) nclasses = NELMTS(test_classes); init_flags = 0; /* reset */ - if(NULL == (frsp = H5FS_create(f, H5P_DATASET_XFER_DEFAULT, &fs_addr, + if(NULL == (frsp = H5FS_create(f, H5AC_dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -1575,7 +1575,7 @@ test_fs_sect_merge(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE10, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1595,7 +1595,7 @@ test_fs_sect_merge(hid_t fapl) init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE_NEW, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1615,7 +1615,7 @@ test_fs_sect_merge(hid_t fapl) init_sect_node(sect_node3, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE_NEW, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node3, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node3, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1633,7 +1633,7 @@ test_fs_sect_merge(hid_t fapl) init_sect_node(sect_node4, (haddr_t)TEST_SECT_ADDR150, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node4, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node4, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -1649,14 +1649,14 @@ test_fs_sect_merge(hid_t fapl) TEST_ERROR /* should not be able to find a merged section of A, B, C & D */ - if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, + if((node_found = H5FS_sect_find(f, H5AC_dxpl_id, frsp, (hsize_t)(TEST_SECT_SIZE10+TEST_SECT_SIZE30+TEST_SECT_SIZE50+TEST_SECT_SIZE80), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR if (node_found) TEST_ERROR /* should be able to find the merged section of B & C */ - if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, + if((node_found = H5FS_sect_find(f, H5AC_dxpl_id, frsp, (hsize_t)(TEST_SECT_SIZE30+TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR @@ -1670,7 +1670,7 @@ test_fs_sect_merge(hid_t fapl) TEST_ERROR /* should be able to find section A */ - if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, + if((node_found = H5FS_sect_find(f, H5AC_dxpl_id, frsp, (hsize_t)(TEST_SECT_SIZE10), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR @@ -1683,7 +1683,7 @@ test_fs_sect_merge(hid_t fapl) TEST_ERROR /* should be able to find section D */ - if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, + if((node_found = H5FS_sect_find(f, H5AC_dxpl_id, frsp, (hsize_t)(TEST_SECT_SIZE80), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR @@ -1696,12 +1696,12 @@ test_fs_sect_merge(hid_t fapl) TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0) + if(H5FS_close(f, H5AC_dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5P_DATASET_XFER_DEFAULT, fs_addr) < 0) + if(H5FS_delete(f, H5AC_dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -1720,7 +1720,7 @@ error: if(sect_node2) TEST_sect_free((H5FS_section_info_t *)sect_node2); if(frsp) - H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp); + H5FS_close(f, H5AC_dxpl_id, frsp); H5Fclose(file); } H5E_END_TRY; return(1); @@ -1796,7 +1796,7 @@ test_fs_sect_shrink(hid_t fapl) TEST_set_eoa((haddr_t)TEST_SECT_ADDR150); /* set end of file address for shrinking */ - if(NULL == (frsp = H5FS_create(f, H5P_DATASET_XFER_DEFAULT, &fs_addr, + if(NULL == (frsp = H5FS_create(f, H5AC_dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -1812,7 +1812,7 @@ test_fs_sect_shrink(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE_NEW, H5FS_SECT_LIVE); can_shrink = FALSE; - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0) FAIL_STACK_ERROR @@ -1825,7 +1825,7 @@ test_fs_sect_shrink(hid_t fapl) TEST_ERROR /* section A should still be there in free-space */ - if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, + if((node_found = H5FS_sect_find(f, H5AC_dxpl_id, frsp, (hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR @@ -1846,7 +1846,7 @@ test_fs_sect_shrink(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); can_shrink = FALSE; - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0) FAIL_STACK_ERROR @@ -1857,19 +1857,19 @@ test_fs_sect_shrink(hid_t fapl) TEST_ERROR /* section A should not be there in free-space */ - if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, + if((node_found = H5FS_sect_find(f, H5AC_dxpl_id, frsp, (hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR if (node_found) TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0) + if(H5FS_close(f, H5AC_dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5P_DATASET_XFER_DEFAULT, fs_addr) < 0) + if(H5FS_delete(f, H5AC_dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -1897,7 +1897,7 @@ test_fs_sect_shrink(hid_t fapl) /* does not allow merging */ init_flags = H5FS_CLS_SEPAR_OBJ; - if(NULL == (frsp = H5FS_create(f, H5P_DATASET_XFER_DEFAULT, &fs_addr, + if(NULL == (frsp = H5FS_create(f, H5AC_dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -1912,7 +1912,7 @@ test_fs_sect_shrink(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0) FAIL_STACK_ERROR @@ -1932,7 +1932,7 @@ test_fs_sect_shrink(hid_t fapl) init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0) FAIL_STACK_ERROR @@ -1941,7 +1941,7 @@ test_fs_sect_shrink(hid_t fapl) TEST_ERROR /* section B should not be there in free-space */ - if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, + if((node_found = H5FS_sect_find(f, H5AC_dxpl_id, frsp, (hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR @@ -1952,7 +1952,7 @@ test_fs_sect_shrink(hid_t fapl) /* section A should still be there in free-space */ - if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, + if((node_found = H5FS_sect_find(f, H5AC_dxpl_id, frsp, (hsize_t)(TEST_SECT_SIZE20), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR @@ -1965,12 +1965,12 @@ test_fs_sect_shrink(hid_t fapl) TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0) + if(H5FS_close(f, H5AC_dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5P_DATASET_XFER_DEFAULT, fs_addr) < 0) + if(H5FS_delete(f, H5AC_dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -1996,7 +1996,7 @@ test_fs_sect_shrink(hid_t fapl) TEST_set_eoa((haddr_t)TEST_SECT_ADDR150); /* set end of file address for shrinking */ init_flags = 0; /* reset */ - if(NULL == (frsp = H5FS_create(f, H5P_DATASET_XFER_DEFAULT, &fs_addr, + if(NULL == (frsp = H5FS_create(f, H5AC_dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -2011,7 +2011,7 @@ test_fs_sect_shrink(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0) FAIL_STACK_ERROR @@ -2031,7 +2031,7 @@ test_fs_sect_shrink(hid_t fapl) init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, &can_shrink) < 0) FAIL_STACK_ERROR @@ -2041,26 +2041,26 @@ test_fs_sect_shrink(hid_t fapl) TEST_ERROR /* section B should not be there in free-space */ - if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, + if((node_found = H5FS_sect_find(f, H5AC_dxpl_id, frsp, (hsize_t)(TEST_SECT_SIZE50), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR if (node_found) TEST_ERROR /* section A should not be there in free-space */ - if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, + if((node_found = H5FS_sect_find(f, H5AC_dxpl_id, frsp, (hsize_t)(TEST_SECT_SIZE30), (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR if (node_found) TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0) + if(H5FS_close(f, H5AC_dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5P_DATASET_XFER_DEFAULT, fs_addr) < 0) + if(H5FS_delete(f, H5AC_dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -2075,7 +2075,7 @@ test_fs_sect_shrink(hid_t fapl) error: H5E_BEGIN_TRY { if(frsp) - H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp); + H5FS_close(f, H5AC_dxpl_id, frsp); H5Fclose(file); } H5E_END_TRY; return(1); @@ -2131,7 +2131,7 @@ test_fs_sect_change_class(hid_t fapl) nclasses = NELMTS(test_classes); init_flags = H5FS_CLS_GHOST_OBJ; - if(NULL == (frsp = H5FS_create(f, H5P_DATASET_XFER_DEFAULT, &fs_addr, + if(NULL == (frsp = H5FS_create(f, H5AC_dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -2146,7 +2146,7 @@ test_fs_sect_change_class(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR60, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -2166,7 +2166,7 @@ test_fs_sect_change_class(hid_t fapl) init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE_NONE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -2177,7 +2177,7 @@ test_fs_sect_change_class(hid_t fapl) if(check_stats(f, frsp, &state)) TEST_ERROR - if (H5FS_sect_change_class(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1, + if (H5FS_sect_change_class(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, TEST_FSPACE_SECT_TYPE_NONE) < 0) TEST_ERROR @@ -2186,7 +2186,7 @@ test_fs_sect_change_class(hid_t fapl) if(check_stats(f, frsp, &state)) TEST_ERROR - if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, + if(H5FS_sect_find(f, H5AC_dxpl_id, frsp, (hsize_t)TEST_SECT_SIZE30, (H5FS_section_info_t **)&node) < 0) FAIL_STACK_ERROR @@ -2196,7 +2196,7 @@ test_fs_sect_change_class(hid_t fapl) if(TEST_sect_free((H5FS_section_info_t *)node) < 0) TEST_ERROR - if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node2) < 0) + if(H5FS_sect_remove(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2) < 0) FAIL_STACK_ERROR /* Free the section node(s) */ @@ -2205,12 +2205,12 @@ test_fs_sect_change_class(hid_t fapl) sect_node2 = NULL; /* Close the free space manager */ - if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0) + if(H5FS_close(f, H5AC_dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5P_DATASET_XFER_DEFAULT, fs_addr) < 0) + if(H5FS_delete(f, H5AC_dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -2237,7 +2237,7 @@ test_fs_sect_change_class(hid_t fapl) nclasses = NELMTS(test_classes); init_flags = H5FS_CLS_SEPAR_OBJ; - if(NULL == (frsp = H5FS_create(f, H5P_DATASET_XFER_DEFAULT, &fs_addr, + if(NULL == (frsp = H5FS_create(f, H5AC_dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -2252,7 +2252,7 @@ test_fs_sect_change_class(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE30, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -2264,7 +2264,7 @@ test_fs_sect_change_class(hid_t fapl) init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE50, TEST_FSPACE_SECT_TYPE_NONE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -2276,17 +2276,17 @@ test_fs_sect_change_class(hid_t fapl) init_sect_node(sect_node3, (haddr_t)TEST_SECT_ADDR200, (hsize_t)TEST_SECT_SIZE80, TEST_FSPACE_SECT_TYPE_NONE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node3, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node3, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR /* change the class of B to A's class */ - if (H5FS_sect_change_class(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node2, + if (H5FS_sect_change_class(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, TEST_FSPACE_SECT_TYPE) < 0) TEST_ERROR /* change the class of C to A's class */ - if (H5FS_sect_change_class(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node3, + if (H5FS_sect_change_class(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node3, TEST_FSPACE_SECT_TYPE) < 0) TEST_ERROR @@ -2296,7 +2296,7 @@ test_fs_sect_change_class(hid_t fapl) TEST_ERROR /* verify that section B has changed class */ - if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, + if(H5FS_sect_find(f, H5AC_dxpl_id, frsp, (hsize_t)TEST_SECT_SIZE50, (H5FS_section_info_t **)&node) < 0) FAIL_STACK_ERROR @@ -2307,7 +2307,7 @@ test_fs_sect_change_class(hid_t fapl) TEST_ERROR /* verify that section C has changed class */ - if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, frsp, + if(H5FS_sect_find(f, H5AC_dxpl_id, frsp, (hsize_t)TEST_SECT_SIZE80, (H5FS_section_info_t **)&node) < 0) FAIL_STACK_ERROR @@ -2318,7 +2318,7 @@ test_fs_sect_change_class(hid_t fapl) TEST_ERROR /* remove section A from free-space */ - if(H5FS_sect_remove(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1) < 0) + if(H5FS_sect_remove(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1) < 0) FAIL_STACK_ERROR /* Free the section node(s) */ @@ -2327,12 +2327,12 @@ test_fs_sect_change_class(hid_t fapl) sect_node1 = NULL; /* Close the free space manager */ - if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0) + if(H5FS_close(f, H5AC_dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5P_DATASET_XFER_DEFAULT, fs_addr) < 0) + if(H5FS_delete(f, H5AC_dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -2351,7 +2351,7 @@ error: if(sect_node2) TEST_sect_free((H5FS_section_info_t *)sect_node2); if(frsp) - H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp); + H5FS_close(f, H5AC_dxpl_id, frsp); H5Fclose(file); } H5E_END_TRY; return(1); @@ -2421,7 +2421,7 @@ test_fs_sect_extend(hid_t fapl) init_cparam(&cparam); nclasses = NELMTS(test_classes); - if(NULL == (frsp = H5FS_create(f, H5P_DATASET_XFER_DEFAULT, &fs_addr, + if(NULL == (frsp = H5FS_create(f, H5AC_dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -2436,7 +2436,7 @@ test_fs_sect_extend(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE5, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -2456,7 +2456,7 @@ test_fs_sect_extend(hid_t fapl) init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE40, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -2468,7 +2468,7 @@ test_fs_sect_extend(hid_t fapl) TEST_ERROR /* Extend a block by requested-size */ - if((status = H5FS_sect_try_extend(f, H5P_DATASET_XFER_DEFAULT, frsp, (haddr_t)TEST_SECT_SIZE80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE40)) < 0) + if((status = H5FS_sect_try_extend(f, H5AC_dxpl_id, frsp, (haddr_t)TEST_SECT_SIZE80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE40)) < 0) FAIL_STACK_ERROR if(FALSE == status) TEST_ERROR @@ -2481,12 +2481,12 @@ test_fs_sect_extend(hid_t fapl) TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0) + if(H5FS_close(f, H5AC_dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5P_DATASET_XFER_DEFAULT, fs_addr) < 0) + if(H5FS_delete(f, H5AC_dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -2497,7 +2497,7 @@ test_fs_sect_extend(hid_t fapl) */ TESTING("a block's extension by requested-size which is > adjoining free section's size: Test 2"); - if(NULL == (frsp = H5FS_create(f, H5P_DATASET_XFER_DEFAULT, &fs_addr, + if(NULL == (frsp = H5FS_create(f, H5AC_dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -2512,7 +2512,7 @@ test_fs_sect_extend(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE5, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -2532,7 +2532,7 @@ test_fs_sect_extend(hid_t fapl) init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE40, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -2544,7 +2544,7 @@ test_fs_sect_extend(hid_t fapl) TEST_ERROR /* Extend the block by requested-size */ - if((status = H5FS_sect_try_extend(f, H5P_DATASET_XFER_DEFAULT, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE50)) < 0) + if((status = H5FS_sect_try_extend(f, H5AC_dxpl_id, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE50)) < 0) FAIL_STACK_ERROR if(TRUE == status) TEST_ERROR @@ -2554,12 +2554,12 @@ test_fs_sect_extend(hid_t fapl) TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0) + if(H5FS_close(f, H5AC_dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5P_DATASET_XFER_DEFAULT, fs_addr) < 0) + if(H5FS_delete(f, H5AC_dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -2570,7 +2570,7 @@ test_fs_sect_extend(hid_t fapl) */ TESTING("a block's extension by requested-size which is < adjoining free section's size: Test 3"); - if(NULL == (frsp = H5FS_create(f, H5P_DATASET_XFER_DEFAULT, &fs_addr, + if(NULL == (frsp = H5FS_create(f, H5AC_dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -2585,7 +2585,7 @@ test_fs_sect_extend(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE5, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -2605,7 +2605,7 @@ test_fs_sect_extend(hid_t fapl) init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE40, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -2617,7 +2617,7 @@ test_fs_sect_extend(hid_t fapl) TEST_ERROR /* Extend the block by requested-size */ - if((status = H5FS_sect_try_extend(f, H5P_DATASET_XFER_DEFAULT, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE30)) < 0) + if((status = H5FS_sect_try_extend(f, H5AC_dxpl_id, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE20, (hsize_t)TEST_SECT_SIZE30)) < 0) TEST_ERROR if(FALSE == status) TEST_ERROR @@ -2628,12 +2628,12 @@ test_fs_sect_extend(hid_t fapl) TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0) + if(H5FS_close(f, H5AC_dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5P_DATASET_XFER_DEFAULT, fs_addr) < 0) + if(H5FS_delete(f, H5AC_dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -2644,7 +2644,7 @@ test_fs_sect_extend(hid_t fapl) */ TESTING("a block's extension by requested-size which does not adjoin any free section: Test 4"); - if(NULL == (frsp = H5FS_create(f, H5P_DATASET_XFER_DEFAULT, &fs_addr, + if(NULL == (frsp = H5FS_create(f, H5AC_dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -2659,7 +2659,7 @@ test_fs_sect_extend(hid_t fapl) init_sect_node(sect_node1, (haddr_t)TEST_SECT_ADDR70, (hsize_t)TEST_SECT_SIZE5, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node1, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -2679,7 +2679,7 @@ test_fs_sect_extend(hid_t fapl) init_sect_node(sect_node2, (haddr_t)TEST_SECT_ADDR100, (hsize_t)TEST_SECT_SIZE40, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node2, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR @@ -2691,7 +2691,7 @@ test_fs_sect_extend(hid_t fapl) TEST_ERROR /* Extend the block by requested-size */ - if((status = H5FS_sect_try_extend(f, H5P_DATASET_XFER_DEFAULT, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE15, (hsize_t)TEST_SECT_SIZE40)) < 0) + if((status = H5FS_sect_try_extend(f, H5AC_dxpl_id, frsp, (haddr_t)TEST_SECT_ADDR80, (hsize_t)TEST_SECT_SIZE15, (hsize_t)TEST_SECT_SIZE40)) < 0) TEST_ERROR if(TRUE == status) TEST_ERROR @@ -2701,12 +2701,12 @@ test_fs_sect_extend(hid_t fapl) TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0) + if(H5FS_close(f, H5AC_dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5P_DATASET_XFER_DEFAULT, fs_addr) < 0) + if(H5FS_delete(f, H5AC_dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -2721,7 +2721,7 @@ test_fs_sect_extend(hid_t fapl) error: H5E_BEGIN_TRY { if(frsp) - H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp); + H5FS_close(f, H5AC_dxpl_id, frsp); H5Fclose(file); } H5E_END_TRY; return(1); @@ -2772,7 +2772,7 @@ test_fs_sect_iterate(hid_t fapl) udata.tot_sect_count = 0; init_flags = H5FS_CLS_SEPAR_OBJ; - if(NULL == (frsp = H5FS_create(f, H5P_DATASET_XFER_DEFAULT, &fs_addr, + if(NULL == (frsp = H5FS_create(f, H5AC_dxpl_id, &fs_addr, &cparam, nclasses, test_classes, &init_flags, (hsize_t)FSPACE_THRHD_DEF, (hsize_t)FSPACE_ALIGN_DEF))) FAIL_STACK_ERROR @@ -2786,12 +2786,12 @@ test_fs_sect_iterate(hid_t fapl) sect_size = (unsigned)((i-1) % 9) + 1; init_sect_node(sect_node, (haddr_t)i*10, (hsize_t)sect_size, TEST_FSPACE_SECT_TYPE, H5FS_SECT_LIVE); - if(H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, frsp, (H5FS_section_info_t *)sect_node, + if(H5FS_sect_add(f, H5AC_dxpl_id, frsp, (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, NULL) < 0) FAIL_STACK_ERROR } - if(H5FS_sect_iterate(f, H5P_DATASET_XFER_DEFAULT, frsp, TEST_sects_cb, &udata) < 0) + if(H5FS_sect_iterate(f, H5AC_dxpl_id, frsp, TEST_sects_cb, &udata) < 0) TEST_ERROR H5FS_sect_stats(frsp, &tot_space, &nsects); @@ -2802,12 +2802,12 @@ test_fs_sect_iterate(hid_t fapl) TEST_ERROR /* Close the free space manager */ - if(H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp) < 0) + if(H5FS_close(f, H5AC_dxpl_id, frsp) < 0) FAIL_STACK_ERROR frsp = NULL; /* Delete free space manager */ - if(H5FS_delete(f, H5P_DATASET_XFER_DEFAULT, fs_addr) < 0) + if(H5FS_delete(f, H5AC_dxpl_id, fs_addr) < 0) FAIL_STACK_ERROR fs_addr = HADDR_UNDEF; @@ -2822,7 +2822,7 @@ test_fs_sect_iterate(hid_t fapl) error: H5E_BEGIN_TRY { if(frsp) - H5FS_close(f, H5P_DATASET_XFER_DEFAULT, frsp); + H5FS_close(f, H5AC_dxpl_id, frsp); H5Fclose(file); } H5E_END_TRY; return(1); diff --git a/test/gheap.c b/test/gheap.c index f30935a..fa73dcb 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -23,6 +23,7 @@ */ #include "h5test.h" #include "H5private.h" +#include "H5ACprivate.h" #include "H5Eprivate.h" #include "H5Fprivate.h" #include "H5Gprivate.h" @@ -107,7 +108,7 @@ test_1 (hid_t fapl) size = i + 1; HDmemset(out, 'A' + i % 26, size); H5Eclear2(H5E_DEFAULT); - status = H5HG_insert(f, H5P_DATASET_XFER_DEFAULT, size, out, obj + i); + status = H5HG_insert(f, H5AC_dxpl_id, size, out, obj + i); if(status < 0) { H5_FAILED(); puts(" Unable to insert object into global heap"); @@ -126,7 +127,7 @@ test_1 (hid_t fapl) size = i + 1; HDmemset(out, 'A' + i % 26, size); H5Eclear2(H5E_DEFAULT); - if(NULL == H5HG_read(f, H5P_DATASET_XFER_DEFAULT, obj + i, in, NULL)) { + if(NULL == H5HG_read(f, H5AC_dxpl_id, obj + i, in, NULL)) { H5_FAILED(); puts(" Unable to read object"); nerrors++; @@ -200,7 +201,7 @@ test_2 (hid_t fapl) size = 1024-i; memset (out, 'A'+i%26, size); H5Eclear2(H5E_DEFAULT); - if (H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i)<0) { + if (H5HG_insert (f, H5AC_dxpl_id, size, out, obj+i)<0) { H5_FAILED(); puts(" Unable to insert object into global heap"); nerrors++; @@ -214,7 +215,7 @@ test_2 (hid_t fapl) size = 1024-i; memset (out, 'A'+i%26, size); H5Eclear2(H5E_DEFAULT); - if (NULL==H5HG_read (f, H5P_DATASET_XFER_DEFAULT, obj+i, in, NULL)) { + if (NULL==H5HG_read (f, H5AC_dxpl_id, obj+i, in, NULL)) { H5_FAILED(); puts(" Unable to read object"); nerrors++; @@ -285,7 +286,7 @@ test_3 (hid_t fapl) size = i%30+100; memset (out, 'A'+i%26, size); H5Eclear2(H5E_DEFAULT); - status = H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i); + status = H5HG_insert (f, H5AC_dxpl_id, size, out, obj+i); if (status<0) { H5_FAILED(); puts(" Unable to insert object into global heap"); @@ -295,7 +296,7 @@ test_3 (hid_t fapl) /* Remove everything */ for (i=0; i<1024; i++) { - status = H5HG_remove (f, H5P_DATASET_XFER_DEFAULT, obj+i); + status = H5HG_remove (f, H5AC_dxpl_id, obj+i); if (status<0) { H5_FAILED(); puts(" Unable to remove object"); @@ -364,7 +365,7 @@ test_4 (hid_t fapl) size = i%30+100; memset (out, 'A'+i%26, size); H5Eclear2(H5E_DEFAULT); - status = H5HG_insert (f, H5P_DATASET_XFER_DEFAULT, size, out, obj+i); + status = H5HG_insert (f, H5AC_dxpl_id, size, out, obj+i); if (status<0) { H5_FAILED(); puts(" Unable to insert object into global heap"); @@ -378,7 +379,7 @@ test_4 (hid_t fapl) */ if (1==i%3) { H5Eclear2(H5E_DEFAULT); - status = H5HG_remove (f, H5P_DATASET_XFER_DEFAULT, obj+i-1); + status = H5HG_remove (f, H5AC_dxpl_id, obj+i-1); if (status<0) { H5_FAILED(); puts(" Unable to remove object"); @@ -454,7 +455,7 @@ test_ooo_indices(hid_t fapl) * can be deleted. */ for(j=1000*((~i&1)); j<1000*((~i&1)+1); j++) { H5Eclear2(H5E_DEFAULT); - status = H5HG_insert(f, H5P_DATASET_XFER_DEFAULT, sizeof(j), &j, &obj[j]); + status = H5HG_insert(f, H5AC_dxpl_id, sizeof(j), &j, &obj[j]); if (status<0) GHEAP_REPEATED_ERR(" Unable to insert object into global heap") @@ -467,7 +468,7 @@ test_ooo_indices(hid_t fapl) if(i>0) for(j=1000*(i&1); j<1000*((i&1)+1); j++) { H5Eclear2(H5E_DEFAULT); - status = H5HG_remove(f, H5P_DATASET_XFER_DEFAULT, &obj[j]); + status = H5HG_remove(f, H5AC_dxpl_id, &obj[j]); if (status<0) GHEAP_REPEATED_ERR(" Unable to remove object from global heap"); } /* end for */ @@ -489,7 +490,7 @@ test_ooo_indices(hid_t fapl) /* Read the objects to make sure the heap is still readable */ for(i=0; i<1000; i++) { - if(NULL == H5HG_read(f, H5P_DATASET_XFER_DEFAULT, &obj[i], &j, NULL)) + if(NULL == H5HG_read(f, H5AC_dxpl_id, &obj[i], &j, NULL)) goto error; if(i != j) { H5_FAILED(); diff --git a/test/lheap.c b/test/lheap.c index 60b29f3..772870c 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -87,12 +87,12 @@ main(void) H5Eprint2(H5E_DEFAULT, stdout); goto error; } - if(FAIL == H5HL_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)0, &heap_addr/*out*/)) { + if(FAIL == H5HL_create(f, H5AC_dxpl_id, (size_t)0, &heap_addr/*out*/)) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; } - if (NULL == (heap = H5HL_protect(f, H5P_DATASET_XFER_DEFAULT, heap_addr, H5AC__NO_FLAGS_SET))) { + if (NULL == (heap = H5HL_protect(f, H5AC_dxpl_id, heap_addr, H5AC__NO_FLAGS_SET))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; @@ -104,7 +104,7 @@ main(void) if(j > 4) buf[j] = '\0'; - if(UFAIL == (obj[i] = H5HL_insert(f, H5P_DATASET_XFER_DEFAULT, heap, strlen(buf) + 1, buf))) { + if(UFAIL == (obj[i] = H5HL_insert(f, H5AC_dxpl_id, heap, strlen(buf) + 1, buf))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; @@ -144,7 +144,7 @@ main(void) if(j > 4) buf[j] = '\0'; - if (NULL == (heap = H5HL_protect(f, H5P_DATASET_XFER_DEFAULT, heap_addr, H5AC__READ_ONLY_FLAG))) { + if (NULL == (heap = H5HL_protect(f, H5AC_dxpl_id, heap_addr, H5AC__READ_ONLY_FLAG))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; diff --git a/test/mf.c b/test/mf.c index 6b5cfac..49a40fd 100644 --- a/test/mf.c +++ b/test/mf.c @@ -234,7 +234,7 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl) H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); type = H5FD_MEM_SUPER; - addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); /* nothing should be changed in meta_aggr */ H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size); @@ -244,7 +244,7 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl) if (addr1 < (haddr_t)file_size) TEST_ERROR - addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + addr2 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50); /* nothing should be changed in meta_aggr */ H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &ma_size); @@ -273,8 +273,8 @@ test_mf_eoa(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30); - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE50); + H5MF_xfree(f, type, H5AC_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30); + H5MF_xfree(f, type, H5AC_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE50); if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -377,7 +377,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); type = H5FD_MEM_SUPER; - addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); if (addr < (haddr_t)file_size) TEST_ERROR @@ -409,7 +409,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); /* should succeed */ - if(H5MF_try_shrink(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE30) <= 0) + if(H5MF_try_shrink(f, type, H5AC_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE30) <= 0) TEST_ERROR /* nothing should be changed in meta_aggr */ @@ -453,13 +453,13 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); - addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); if (addr < (haddr_t)file_size) TEST_ERROR /* should not succeed in shrinking */ - if(H5MF_try_shrink(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE30 - 10) > 0) + if(H5MF_try_shrink(f, type, H5AC_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE30 - 10) > 0) TEST_ERROR /* nothing should be changed in meta_aggr */ @@ -503,7 +503,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); /* should not succeed in shrinking */ - if(H5MF_try_shrink(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE30 + 10) > 0) + if(H5MF_try_shrink(f, type, H5AC_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE30 + 10) > 0) TEST_ERROR /* nothing should be changed in meta_aggr */ @@ -546,7 +546,7 @@ test_mf_eoa_shrink(const char *env_h5_drvr, hid_t fapl) H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); /* should succeed in shrinking */ - if(H5MF_try_shrink(f, type, H5P_DATASET_XFER_DEFAULT, addr+10, (hsize_t)(TEST_BLOCK_SIZE30 - 10)) <= 0) + if(H5MF_try_shrink(f, type, H5AC_dxpl_id, addr+10, (hsize_t)(TEST_BLOCK_SIZE30 - 10)) <= 0) TEST_ERROR /* nothing should be changed in meta_aggr */ @@ -656,7 +656,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); type = H5FD_MEM_SUPER; - addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); if (addr < (haddr_t)file_size) TEST_ERROR @@ -685,7 +685,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* should succeed */ - was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)addr, (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)TEST_BLOCK_SIZE50); + was_extended = H5MF_try_extend(f, H5AC_dxpl_id, type, (haddr_t)addr, (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)TEST_BLOCK_SIZE50); if(was_extended <= 0) TEST_ERROR @@ -734,7 +734,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); type = H5FD_MEM_SUPER; - addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); if(addr < (haddr_t)file_size) TEST_ERROR @@ -744,7 +744,7 @@ test_mf_eoa_extend(const char *env_h5_drvr, hid_t fapl) if(new_ma_addr != ma_addr) TEST_ERROR - was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)addr, (hsize_t)(TEST_BLOCK_SIZE30-10), (hsize_t)(TEST_BLOCK_SIZE50)); + was_extended = H5MF_try_extend(f, H5AC_dxpl_id, type, (haddr_t)addr, (hsize_t)(TEST_BLOCK_SIZE30-10), (hsize_t)(TEST_BLOCK_SIZE50)); /* should not succeed */ if(was_extended > 0) @@ -866,19 +866,19 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl) /* Reading & writing with a temporary address value should fail */ H5E_BEGIN_TRY { - status = H5F_block_read(f, H5FD_MEM_SUPER, tmp_addr, sizeof(buf), H5P_DATASET_XFER_DEFAULT, &buf); + status = H5F_block_read(f, H5FD_MEM_SUPER, tmp_addr, sizeof(buf), H5AC_dxpl_id, &buf); } H5E_END_TRY; if(status >= 0) TEST_ERROR H5E_BEGIN_TRY { - status = H5F_block_write(f, H5FD_MEM_SUPER, tmp_addr, sizeof(buf), H5P_DATASET_XFER_DEFAULT, &buf); + status = H5F_block_write(f, H5FD_MEM_SUPER, tmp_addr, sizeof(buf), H5AC_dxpl_id, &buf); } H5E_END_TRY; if(status >= 0) TEST_ERROR /* Freeing a temporary address value should fail */ H5E_BEGIN_TRY { - status = H5MF_xfree(f, H5FD_MEM_SUPER, H5P_DATASET_XFER_DEFAULT, tmp_addr, (hsize_t)TEST_BLOCK_SIZE30); + status = H5MF_xfree(f, H5FD_MEM_SUPER, H5AC_dxpl_id, tmp_addr, (hsize_t)TEST_BLOCK_SIZE30); } H5E_END_TRY; if(status >= 0) TEST_ERROR @@ -911,7 +911,7 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Allocate 1/3 of the file as normal address space */ - if(HADDR_UNDEF == (norm_addr = H5MF_alloc(f, H5FD_MEM_DRAW, H5P_DATASET_XFER_DEFAULT, (hsize_t)(maxaddr / 3)))) + if(HADDR_UNDEF == (norm_addr = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_dxpl_id, (hsize_t)(maxaddr / 3)))) FAIL_STACK_ERROR if(H5F_IS_TMP_ADDR(f, norm_addr)) TEST_ERROR @@ -925,13 +925,13 @@ test_mf_tmp(const char *env_h5_drvr, hid_t fapl) /* Test that pushing normal space allocation into temporary space fails */ H5E_BEGIN_TRY { - check_addr = H5MF_alloc(f, H5FD_MEM_DRAW, H5P_DATASET_XFER_DEFAULT, (hsize_t)(maxaddr / 3)); + check_addr = H5MF_alloc(f, H5FD_MEM_DRAW, H5AC_dxpl_id, (hsize_t)(maxaddr / 3)); } H5E_END_TRY; if(H5F_addr_defined(check_addr)) TEST_ERROR /* Free the normal block (so the file doesn't blow up to a huge size) */ - if(H5MF_xfree(f, H5FD_MEM_DRAW, H5P_DATASET_XFER_DEFAULT, norm_addr, (hsize_t)(maxaddr / 3)) < 0) + if(H5MF_xfree(f, H5FD_MEM_DRAW, H5AC_dxpl_id, norm_addr, (hsize_t)(maxaddr / 3)) < 0) FAIL_STACK_ERROR /* Close the file */ @@ -1014,7 +1014,7 @@ test_mf_fs_start(hid_t fapl) /* Start up free-space manager */ type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + if(H5MF_alloc_start(f, H5AC_dxpl_id, type) < 0) TEST_ERROR if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) @@ -1131,7 +1131,7 @@ test_mf_fs_alloc_free(hid_t fapl) type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + if(H5MF_alloc_start(f, H5AC_dxpl_id, type) < 0) TEST_ERROR if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) @@ -1144,13 +1144,13 @@ test_mf_fs_alloc_free(hid_t fapl) /* Construct user data for callbacks */ udata.f = f; - udata.dxpl_id = H5P_DATASET_XFER_DEFAULT; + udata.dxpl_id = H5AC_dxpl_id; udata.alloc_type = type; udata.allow_sect_absorb = TRUE; udata.allow_eoa_shrink_only = FALSE; /* Add section A to free-space manager */ - if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata)) + if (H5FS_sect_add(f, H5AC_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata)) FAIL_STACK_ERROR HDmemset(&state, 0, sizeof(frspace_state_t)); @@ -1162,7 +1162,7 @@ test_mf_fs_alloc_free(hid_t fapl) TEST_ERROR /* Allocate a block of 30 */ - addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); /* Verify that the allocated block is section A in free-space */ if (addr != TEST_BLOCK_ADDR70) @@ -1176,7 +1176,7 @@ test_mf_fs_alloc_free(hid_t fapl) TEST_ERROR /* Free the block to free-space */ - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE30); + H5MF_xfree(f, type, H5AC_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE30); state.tot_space += TEST_BLOCK_SIZE30; state.tot_sect_count += 1; @@ -1185,7 +1185,7 @@ test_mf_fs_alloc_free(hid_t fapl) TEST_ERROR /* Remove section A from free-space */ - if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], + if(H5FS_sect_find(f, H5AC_dxpl_id, f->shared->fs_man[type], (hsize_t)TEST_BLOCK_SIZE30, (H5FS_section_info_t **)&node) < 0) TEST_ERROR @@ -1218,7 +1218,7 @@ test_mf_fs_alloc_free(hid_t fapl) type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + if(H5MF_alloc_start(f, H5AC_dxpl_id, type) < 0) TEST_ERROR if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) @@ -1231,13 +1231,13 @@ test_mf_fs_alloc_free(hid_t fapl) /* Construct user data for callbacks */ udata.f = f; - udata.dxpl_id = H5P_DATASET_XFER_DEFAULT; + udata.dxpl_id = H5AC_dxpl_id; udata.alloc_type = type; udata.allow_sect_absorb = TRUE; udata.allow_eoa_shrink_only = FALSE; /* Add section A to free-space manager */ - if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata)) + if (H5FS_sect_add(f, H5AC_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata)) FAIL_STACK_ERROR HDmemset(&state, 0, sizeof(frspace_state_t)); @@ -1249,7 +1249,7 @@ test_mf_fs_alloc_free(hid_t fapl) TEST_ERROR /* Allocate a block of 20 */ - addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)(TEST_BLOCK_SIZE20)); + addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)(TEST_BLOCK_SIZE20)); /* Verify that the allocated block is section A in free-space manager */ if (addr != TEST_BLOCK_ADDR70) @@ -1262,7 +1262,7 @@ test_mf_fs_alloc_free(hid_t fapl) TEST_ERROR /* Free the block to free-space manager */ - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)(TEST_BLOCK_SIZE20)); + H5MF_xfree(f, type, H5AC_dxpl_id, addr, (hsize_t)(TEST_BLOCK_SIZE20)); /* Still 1 section in free-space because of merging */ state.tot_space += TEST_BLOCK_SIZE20; @@ -1270,7 +1270,7 @@ test_mf_fs_alloc_free(hid_t fapl) TEST_ERROR /* Remove section A from free-space manager */ - if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], + if(H5FS_sect_find(f, H5AC_dxpl_id, f->shared->fs_man[type], (hsize_t)TEST_BLOCK_SIZE30, (H5FS_section_info_t **)&node) < 0) FAIL_STACK_ERROR @@ -1303,7 +1303,7 @@ test_mf_fs_alloc_free(hid_t fapl) type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + if(H5MF_alloc_start(f, H5AC_dxpl_id, type) < 0) TEST_ERROR if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) @@ -1316,13 +1316,13 @@ test_mf_fs_alloc_free(hid_t fapl) /* Construct user data for callbacks */ udata.f = f; - udata.dxpl_id = H5P_DATASET_XFER_DEFAULT; + udata.dxpl_id = H5AC_dxpl_id; udata.alloc_type = type; udata.allow_sect_absorb = TRUE; udata.allow_eoa_shrink_only = FALSE; /* Add section A to free-space manager */ - if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata)) + if (H5FS_sect_add(f, H5AC_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata)) FAIL_STACK_ERROR HDmemset(&state, 0, sizeof(frspace_state_t)); @@ -1338,7 +1338,7 @@ test_mf_fs_alloc_free(hid_t fapl) * Since free-space manager cannot fulfull the request, * the block is obtained from file allocation */ - addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)(TEST_BLOCK_SIZE40)); + addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)(TEST_BLOCK_SIZE40)); /* Verify that the allocated block is not section A in free-space */ if (addr == TEST_BLOCK_ADDR70) @@ -1349,7 +1349,7 @@ test_mf_fs_alloc_free(hid_t fapl) TEST_ERROR /* Remove section A from free-space */ - if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], + if(H5FS_sect_find(f, H5AC_dxpl_id, f->shared->fs_man[type], (hsize_t)TEST_BLOCK_SIZE30, (H5FS_section_info_t **)&node) < 0) FAIL_STACK_ERROR @@ -1362,7 +1362,7 @@ test_mf_fs_alloc_free(hid_t fapl) TEST_ERROR /* Free the block of size 40 to free-space */ - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)(TEST_BLOCK_SIZE40)); + H5MF_xfree(f, type, H5AC_dxpl_id, addr, (hsize_t)(TEST_BLOCK_SIZE40)); /* * Free-space info is the same. @@ -1489,7 +1489,7 @@ test_mf_fs_extend(hid_t fapl) type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + if(H5MF_alloc_start(f, H5AC_dxpl_id, type) < 0) TEST_ERROR if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) @@ -1502,13 +1502,13 @@ test_mf_fs_extend(hid_t fapl) /* Construct user data for callbacks */ udata.f = f; - udata.dxpl_id = H5P_DATASET_XFER_DEFAULT; + udata.dxpl_id = H5AC_dxpl_id; udata.alloc_type = type; udata.allow_sect_absorb = TRUE; udata.allow_eoa_shrink_only = FALSE; /* Add section A to free-space manager */ - if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &udata)) + if (H5FS_sect_add(f, H5AC_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &udata)) FAIL_STACK_ERROR HDmemset(&state, 0, sizeof(frspace_state_t)); @@ -1520,7 +1520,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Allocate a block of 30 */ - addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); /* Verify that the allocated block is section A in free-space manager */ if (addr != TEST_BLOCK_ADDR70) @@ -1537,7 +1537,7 @@ test_mf_fs_extend(hid_t fapl) sect_node2 = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR100, (hsize_t)TEST_BLOCK_SIZE50); /* Add section B to free-space manager */ - if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, &udata)) + if (H5FS_sect_add(f, H5AC_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, &udata)) FAIL_STACK_ERROR state.tot_space += TEST_BLOCK_SIZE50; @@ -1548,7 +1548,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Try to extend the allocated block */ - was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)TEST_BLOCK_SIZE50); + was_extended = H5MF_try_extend(f, H5AC_dxpl_id, type, (haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)TEST_BLOCK_SIZE50); /* should succeed */ if(was_extended <= 0) @@ -1563,7 +1563,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Free the extended block to free-space manager */ - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)(TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50)); + H5MF_xfree(f, type, H5AC_dxpl_id, addr, (hsize_t)(TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50)); /* Verify that the extended block is back into free-space */ state.tot_space += TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50; @@ -1574,7 +1574,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Remove the extended block */ - if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], + if(H5FS_sect_find(f, H5AC_dxpl_id, f->shared->fs_man[type], (hsize_t)(TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50), (H5FS_section_info_t **)&node) < 0) TEST_ERROR @@ -1607,7 +1607,7 @@ test_mf_fs_extend(hid_t fapl) type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + if(H5MF_alloc_start(f, H5AC_dxpl_id, type) < 0) TEST_ERROR if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) @@ -1620,13 +1620,13 @@ test_mf_fs_extend(hid_t fapl) /* Construct user data for callbacks */ udata.f = f; - udata.dxpl_id = H5P_DATASET_XFER_DEFAULT; + udata.dxpl_id = H5AC_dxpl_id; udata.alloc_type = type; udata.allow_sect_absorb = TRUE; udata.allow_eoa_shrink_only = FALSE; /* Add section A to free-space */ - if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &udata)) + if (H5FS_sect_add(f, H5AC_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &udata)) FAIL_STACK_ERROR HDmemset(&state, 0, sizeof(frspace_state_t)); @@ -1638,7 +1638,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Allocate a block of 30 */ - addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); /* Verify that the allocated block is section A in free-space manager */ if (addr != TEST_BLOCK_ADDR70) @@ -1655,7 +1655,7 @@ test_mf_fs_extend(hid_t fapl) sect_node2 = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR100, (hsize_t)TEST_BLOCK_SIZE50); /* Add section B to free-space manager */ - if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, &udata)) + if (H5FS_sect_add(f, H5AC_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, &udata)) FAIL_STACK_ERROR state.tot_space += TEST_BLOCK_SIZE50; @@ -1666,7 +1666,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Try to extend the allocated block */ - was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)(TEST_BLOCK_SIZE50+10)); + was_extended = H5MF_try_extend(f, H5AC_dxpl_id, type, (haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)(TEST_BLOCK_SIZE50+10)); /* Should not be able to extend the allocated block */ if(was_extended) @@ -1677,7 +1677,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Free the allocated block A to free-space */ - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE30); + H5MF_xfree(f, type, H5AC_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE30); /* the returned section A is merged with section B in free-space */ /* rest of the info remains the same */ @@ -1687,7 +1687,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Remove the merged sections A & B from free-space */ - if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], + if(H5FS_sect_find(f, H5AC_dxpl_id, f->shared->fs_man[type], (hsize_t)(TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50), (H5FS_section_info_t **)&node) < 0) TEST_ERROR @@ -1720,7 +1720,7 @@ test_mf_fs_extend(hid_t fapl) type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + if(H5MF_alloc_start(f, H5AC_dxpl_id, type) < 0) TEST_ERROR if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) @@ -1733,13 +1733,13 @@ test_mf_fs_extend(hid_t fapl) /* Construct user data for callbacks */ udata.f = f; - udata.dxpl_id = H5P_DATASET_XFER_DEFAULT; + udata.dxpl_id = H5AC_dxpl_id; udata.alloc_type = type; udata.allow_sect_absorb = TRUE; udata.allow_eoa_shrink_only = FALSE; /* Add section A to free-space */ - if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &udata)) + if (H5FS_sect_add(f, H5AC_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &udata)) FAIL_STACK_ERROR HDmemset(&state, 0, sizeof(frspace_state_t)); @@ -1751,7 +1751,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Allocate a block of 30 */ - addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); /* Verify that the allocated block is section A in free-space manager */ if (addr != TEST_BLOCK_ADDR70) @@ -1768,7 +1768,7 @@ test_mf_fs_extend(hid_t fapl) sect_node2 = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR100, (hsize_t)TEST_BLOCK_SIZE50); /* Add section B to free-space manager */ - if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, &udata)) + if (H5FS_sect_add(f, H5AC_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, &udata)) FAIL_STACK_ERROR state.tot_space += TEST_BLOCK_SIZE50; @@ -1779,7 +1779,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Try to extend the allocated block */ - was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)(TEST_BLOCK_SIZE40)); + was_extended = H5MF_try_extend(f, H5AC_dxpl_id, type, (haddr_t)TEST_BLOCK_ADDR70, (hsize_t)TEST_BLOCK_SIZE30, (hsize_t)(TEST_BLOCK_SIZE40)); /* Should succeed in extending the allocated block */ if(was_extended <=0) @@ -1791,7 +1791,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Free the extended block */ - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)(TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE40)); + H5MF_xfree(f, type, H5AC_dxpl_id, addr, (hsize_t)(TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE40)); /* rest info is same, the extended section returned is merged with the section in free-space */ state.tot_space += (TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE40); @@ -1800,7 +1800,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Remove the merged sections A & B from free-space */ - if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], + if(H5FS_sect_find(f, H5AC_dxpl_id, f->shared->fs_man[type], (hsize_t)(TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50), (H5FS_section_info_t **)&node) < 0) TEST_ERROR @@ -1833,7 +1833,7 @@ test_mf_fs_extend(hid_t fapl) type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + if(H5MF_alloc_start(f, H5AC_dxpl_id, type) < 0) TEST_ERROR if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) @@ -1846,13 +1846,13 @@ test_mf_fs_extend(hid_t fapl) /* Construct user data for callbacks */ udata.f = f; - udata.dxpl_id = H5P_DATASET_XFER_DEFAULT; + udata.dxpl_id = H5AC_dxpl_id; udata.alloc_type = type; udata.allow_sect_absorb = TRUE; udata.allow_eoa_shrink_only = FALSE; /* Add section A of size=20 to free-space */ - if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &udata)) + if (H5FS_sect_add(f, H5AC_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node1, H5FS_ADD_RETURNED_SPACE, &udata)) FAIL_STACK_ERROR HDmemset(&state, 0, sizeof(frspace_state_t)); @@ -1864,7 +1864,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Allocate a block of size=20 */ - addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)(TEST_BLOCK_SIZE30-10)); + addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)(TEST_BLOCK_SIZE30-10)); /* Verify that the allocated block is section A in free-space manager */ if (addr != TEST_BLOCK_ADDR70) @@ -1881,7 +1881,7 @@ test_mf_fs_extend(hid_t fapl) sect_node2 = H5MF_sect_simple_new((haddr_t)TEST_BLOCK_ADDR100, (hsize_t)TEST_BLOCK_SIZE50); /* Add section B to free-space manager */ - if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, &udata)) + if (H5FS_sect_add(f, H5AC_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node2, H5FS_ADD_RETURNED_SPACE, &udata)) FAIL_STACK_ERROR state.tot_space += TEST_BLOCK_SIZE50; @@ -1892,7 +1892,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Try to extend the allocated block */ - was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)TEST_BLOCK_ADDR70, (hsize_t)(TEST_BLOCK_SIZE30-10), (hsize_t)TEST_BLOCK_SIZE50); + was_extended = H5MF_try_extend(f, H5AC_dxpl_id, type, (haddr_t)TEST_BLOCK_ADDR70, (hsize_t)(TEST_BLOCK_SIZE30-10), (hsize_t)TEST_BLOCK_SIZE50); /* Should not succeed in extending the allocated block */ if(was_extended) @@ -1903,7 +1903,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Free the allocated block */ - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)(TEST_BLOCK_SIZE30-10)); + H5MF_xfree(f, type, H5AC_dxpl_id, addr, (hsize_t)(TEST_BLOCK_SIZE30-10)); state.tot_space += (TEST_BLOCK_SIZE30-10); state.tot_sect_count += 1; @@ -1913,7 +1913,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Remove section A from free-space manger */ - if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], + if(H5FS_sect_find(f, H5AC_dxpl_id, f->shared->fs_man[type], (hsize_t)(TEST_BLOCK_SIZE30-10), (H5FS_section_info_t **)&node) < 0) TEST_ERROR @@ -1922,7 +1922,7 @@ test_mf_fs_extend(hid_t fapl) TEST_ERROR /* Remove section B from free-space manager */ - if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], + if(H5FS_sect_find(f, H5AC_dxpl_id, f->shared->fs_man[type], (hsize_t)TEST_BLOCK_SIZE50, (H5FS_section_info_t **)&node) < 0) TEST_ERROR @@ -2025,7 +2025,7 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + if(H5MF_alloc_start(f, H5AC_dxpl_id, type) < 0) TEST_ERROR if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) @@ -2034,7 +2034,7 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Allocate a section from meta_aggr */ - addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -2043,17 +2043,17 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) /* Construct user data for callbacks */ udata.f = f; - udata.dxpl_id = H5P_DATASET_XFER_DEFAULT; + udata.dxpl_id = H5AC_dxpl_id; udata.alloc_type = type; udata.allow_sect_absorb = TRUE; udata.allow_eoa_shrink_only = FALSE; /* When adding, meta_aggr is absorbed onto the beginning of the section */ - if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata)) + if (H5FS_sect_add(f, H5AC_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata)) FAIL_STACK_ERROR /* Verify that the section did absorb the aggregator */ - if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], + if(H5FS_sect_find(f, H5AC_dxpl_id, f->shared->fs_man[type], (hsize_t)TEST_BLOCK_SIZE2048, (H5FS_section_info_t **)&node) < 0) TEST_ERROR @@ -2069,7 +2069,7 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) f->shared->meta_aggr.size = ma_size; /* Remove section from meta_aggr */ - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE30); + H5MF_xfree(f, type, H5AC_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE30); if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -2095,7 +2095,7 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + if(H5MF_alloc_start(f, H5AC_dxpl_id, type) < 0) TEST_ERROR if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) @@ -2104,29 +2104,29 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Allocate a section from meta_aggr */ - addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); /* Allocate a section from sdata_aggr */ stype = H5FD_MEM_DRAW; - saddr = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + saddr = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50); /* Add a section to free-space that adjoins the beginning of meta_aggr */ sect_node = H5MF_sect_simple_new((haddr_t)addr, (hsize_t)TEST_BLOCK_SIZE30); /* Construct user data for callbacks */ udata.f = f; - udata.dxpl_id = H5P_DATASET_XFER_DEFAULT; + udata.dxpl_id = H5AC_dxpl_id; udata.alloc_type = type; udata.allow_sect_absorb = TRUE; udata.allow_eoa_shrink_only = FALSE; /* When adding, meta_aggr is absorbed onto the end of the section */ - if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata)) + if (H5FS_sect_add(f, H5AC_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata)) FAIL_STACK_ERROR /* Verify that the section did absorb the aggregator */ - if(H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], + if(H5FS_sect_find(f, H5AC_dxpl_id, f->shared->fs_man[type], (hsize_t)(ma_size+TEST_BLOCK_SIZE30), (H5FS_section_info_t **)&node) < 0) TEST_ERROR @@ -2142,9 +2142,9 @@ test_mf_fs_absorb(const char *env_h5_drvr, hid_t fapl) f->shared->meta_aggr.size = ma_size; /* Remove section from meta_aggr */ - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE30); + H5MF_xfree(f, type, H5AC_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE30); /* Remove section from sdata_aggr */ - H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr, (hsize_t)TEST_BLOCK_SIZE50); + H5MF_xfree(f, stype, H5AC_dxpl_id, saddr, (hsize_t)TEST_BLOCK_SIZE50); if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -2224,14 +2224,14 @@ test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl) /* Allocate first block from meta_aggr */ type = H5FD_MEM_SUPER; - addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if ((addr1+TEST_BLOCK_SIZE30) != ma_addr) TEST_ERROR /* Allocate second block from meta_aggr */ - addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + addr2 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50); H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if ((addr2+TEST_BLOCK_SIZE50) != ma_addr) @@ -2259,8 +2259,8 @@ test_mf_aggr_alloc1(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR /* Free the two blocks */ - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30); - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE50); + H5MF_xfree(f, type, H5AC_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30); + H5MF_xfree(f, type, H5AC_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE50); if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -2354,13 +2354,13 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl) FAIL_STACK_ERROR type = H5FD_MEM_SUPER; - addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if ((addr1+TEST_BLOCK_SIZE30) != ma_addr) TEST_ERROR - addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + addr2 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50); H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if ((addr2+TEST_BLOCK_SIZE50) != ma_addr) @@ -2369,7 +2369,7 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl) if (ma_size != (TEST_BLOCK_SIZE2048 - (TEST_BLOCK_SIZE30 + TEST_BLOCK_SIZE50))) TEST_ERROR - addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2058); + addr3 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2058); H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -2399,7 +2399,7 @@ test_mf_aggr_alloc2(const char *env_h5_drvr, hid_t fapl) if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50+TEST_BLOCK_SIZE2058); + H5MF_xfree(f, type, H5AC_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50+TEST_BLOCK_SIZE2058); if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -2509,14 +2509,14 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl) /* Allocate first block from meta_aggr */ type = H5FD_MEM_SUPER; - addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if ((addr1+TEST_BLOCK_SIZE30) != ma_addr) TEST_ERROR /* Allocate second block from meta_aggr */ - addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + addr2 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50); H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -2527,14 +2527,14 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl) /* Allocate first block from sdata_aggr */ stype = H5FD_MEM_DRAW; - saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + saddr1 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if ((saddr1+TEST_BLOCK_SIZE30) != sdata_addr) TEST_ERROR if (sdata_size != (TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30)) TEST_ERROR /* Allocate third block, which is from file allocation not from meta_aggr */ - addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)(TEST_BLOCK_SIZE2058)); + addr3 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)(TEST_BLOCK_SIZE2058)); H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); @@ -2544,7 +2544,7 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl) if ((new_ma_addr != ma_addr) || (new_ma_size != ma_size)) TEST_ERROR /* Allocate fourth block, which should be from meta_aggr */ - addr4 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + addr4 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50); H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if ((addr4+TEST_BLOCK_SIZE50) != ma_addr) @@ -2553,11 +2553,11 @@ test_mf_aggr_alloc3(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Free all the allocated blocks */ - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30); - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE50); - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE2058); - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr4, (hsize_t)TEST_BLOCK_SIZE50); - H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr1, (hsize_t)TEST_BLOCK_SIZE30); + H5MF_xfree(f, type, H5AC_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30); + H5MF_xfree(f, type, H5AC_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE50); + H5MF_xfree(f, type, H5AC_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE2058); + H5MF_xfree(f, type, H5AC_dxpl_id, addr4, (hsize_t)TEST_BLOCK_SIZE50); + H5MF_xfree(f, stype, H5AC_dxpl_id, saddr1, (hsize_t)TEST_BLOCK_SIZE30); if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -2670,7 +2670,7 @@ test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl) /* Allocate first block from meta_aggr */ type = H5FD_MEM_SUPER; - addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); @@ -2681,19 +2681,19 @@ test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl) /* Allocate first block from sdata_aggr */ stype = H5FD_MEM_DRAW; - saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + saddr1 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if ((saddr1+TEST_BLOCK_SIZE30) != sdata_addr) TEST_ERROR /* Allocate second block from sdata_aggr */ - saddr2 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)(TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30)); + saddr2 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)(TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30)); H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if (saddr2+(TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30) != sdata_addr) TEST_ERROR /* Allocate third block from sdata_aggr */ - saddr3 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + saddr3 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50); H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if ((saddr3+TEST_BLOCK_SIZE50) != sdata_addr) @@ -2702,7 +2702,7 @@ test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Allocate second block of 2058, which is from file allocation, not from meta_aggr */ - addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2058); + addr2 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2058); if (addr2 != sdata_addr) TEST_ERROR @@ -2718,11 +2718,11 @@ test_mf_aggr_alloc4(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Free all the allocated blocks */ - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30); - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE2058); - H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr1, (hsize_t)TEST_BLOCK_SIZE30); - H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr2, (hsize_t)TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30); - H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr3, (hsize_t)TEST_BLOCK_SIZE50); + H5MF_xfree(f, type, H5AC_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30); + H5MF_xfree(f, type, H5AC_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE2058); + H5MF_xfree(f, stype, H5AC_dxpl_id, saddr1, (hsize_t)TEST_BLOCK_SIZE30); + H5MF_xfree(f, stype, H5AC_dxpl_id, saddr2, (hsize_t)TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30); + H5MF_xfree(f, stype, H5AC_dxpl_id, saddr3, (hsize_t)TEST_BLOCK_SIZE50); if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -2816,14 +2816,14 @@ test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl) /* Allocate first block from meta_aggr */ type = H5FD_MEM_SUPER; - addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if ((addr1+TEST_BLOCK_SIZE30) != ma_addr) TEST_ERROR /* Allocate second block from meta_aggr */ - addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + addr2 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50); H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if (addr2+TEST_BLOCK_SIZE50 != ma_addr) @@ -2832,7 +2832,7 @@ test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Allocate third block from meta_aggr */ - addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1970); + addr3 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1970); H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); if (addr3 != ma_addr) TEST_ERROR @@ -2841,9 +2841,9 @@ test_mf_aggr_alloc5(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Free all the allocated blocks */ - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30); - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE50); - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE1970); + H5MF_xfree(f, type, H5AC_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30); + H5MF_xfree(f, type, H5AC_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE50); + H5MF_xfree(f, type, H5AC_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE1970); if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -2949,14 +2949,14 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl) type = H5FD_MEM_SUPER; /* Allocate first block from meta_aggr */ - addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if ((addr1+TEST_BLOCK_SIZE30) != ma_addr) TEST_ERROR /* Allocate second block from meta_aggr */ - addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + addr2 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50); H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if (addr2+TEST_BLOCK_SIZE50 != ma_addr) @@ -2966,14 +2966,14 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl) /* Allocate first block from sdata_aggr */ stype = H5FD_MEM_DRAW; - saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + saddr1 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if ((saddr1+TEST_BLOCK_SIZE30) != sdata_addr) TEST_ERROR if (sdata_size != (TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30)) TEST_ERROR /* Allocate third block from meta_aggr */ - addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1970); + addr3 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1970); H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); @@ -2994,10 +2994,10 @@ test_mf_aggr_alloc6(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Free all the allocated blocks */ - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30); - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE50); - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE1970); - H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr1, (hsize_t)TEST_BLOCK_SIZE30); + H5MF_xfree(f, type, H5AC_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30); + H5MF_xfree(f, type, H5AC_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE50); + H5MF_xfree(f, type, H5AC_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE1970); + H5MF_xfree(f, stype, H5AC_dxpl_id, saddr1, (hsize_t)TEST_BLOCK_SIZE30); if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -3113,13 +3113,13 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl) /* Allocate the first block from meta_aggr */ type = H5FD_MEM_SUPER; - addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if ((addr1+TEST_BLOCK_SIZE30) != ma_addr) TEST_ERROR /* Allocate the second block from meta_aggr */ - addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + addr2 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50); H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if (addr2+TEST_BLOCK_SIZE50 != ma_addr) @@ -3129,13 +3129,13 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl) /* Allocate the first block from sdata_aggr */ stype = H5FD_MEM_DRAW; - saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + saddr1 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if ((saddr1+TEST_BLOCK_SIZE30) != sdata_addr) TEST_ERROR /* Allocate the second block from sdata_aggr */ - saddr2 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30); + saddr2 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30); H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if ((saddr2+(TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30)) != sdata_addr) @@ -3143,7 +3143,7 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl) if (sdata_size != 0) TEST_ERROR /* Allocate the third block from sdata_aggr */ - saddr3 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + saddr3 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50); H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if ((saddr3+TEST_BLOCK_SIZE50) != sdata_addr) @@ -3152,7 +3152,7 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Allocate the third block from meta_aggr */ - addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1970); + addr3 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1970); H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if (addr3 != sdata_addr) TEST_ERROR @@ -3174,12 +3174,12 @@ test_mf_aggr_alloc7(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Free all the allocated blocks */ - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30); - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE50); - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE1970); - H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr1, (hsize_t)TEST_BLOCK_SIZE30); - H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr2, (hsize_t)(TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30)); - H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr3, (hsize_t)TEST_BLOCK_SIZE50); + H5MF_xfree(f, type, H5AC_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30); + H5MF_xfree(f, type, H5AC_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE50); + H5MF_xfree(f, type, H5AC_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE1970); + H5MF_xfree(f, stype, H5AC_dxpl_id, saddr1, (hsize_t)TEST_BLOCK_SIZE30); + H5MF_xfree(f, stype, H5AC_dxpl_id, saddr2, (hsize_t)(TEST_BLOCK_SIZE2048 - TEST_BLOCK_SIZE30)); + H5MF_xfree(f, stype, H5AC_dxpl_id, saddr3, (hsize_t)TEST_BLOCK_SIZE50); if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -3274,7 +3274,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) /* Allocate the first block from meta_aggr */ type = H5FD_MEM_SUPER; - addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if ((addr+TEST_BLOCK_SIZE30) != ma_addr) TEST_ERROR @@ -3286,7 +3286,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) new_addr = addr - 10; /* Try to extend the block by an amount < (% * aggr->alloc_size) */ - was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE50)); + was_extended = H5MF_try_extend(f, H5AC_dxpl_id, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE50)); /* should succeed */ if(!was_extended) @@ -3299,10 +3299,10 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) if (new_ma_size != (f->shared->meta_aggr.alloc_size - TEST_BLOCK_SIZE50)) TEST_ERROR /* Free the allocated blocks */ - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE50); + H5MF_xfree(f, type, H5AC_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE50); /* Try to extend the block by an amount > (% * aggr->alloc_size) but amount < aggr->alloc_size */ - was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE700)); + was_extended = H5MF_try_extend(f, H5AC_dxpl_id, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE700)); /* should succeed */ if(!was_extended) @@ -3315,10 +3315,10 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) if (new_ma_size != (f->shared->meta_aggr.alloc_size * 2 - TEST_BLOCK_SIZE700)) TEST_ERROR /* Free the allocated blocks */ - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE700); + H5MF_xfree(f, type, H5AC_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE700); /* Try to extend the block by an amount > (% * aggr->alloc_size) but amount > aggr->alloc_size */ - was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE2058)); + was_extended = H5MF_try_extend(f, H5AC_dxpl_id, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE2058)); /* should succeed */ if(!was_extended) @@ -3331,7 +3331,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) if (new_ma_size != f->shared->meta_aggr.size) TEST_ERROR /* Free the allocated blocks */ - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE2058); + H5MF_xfree(f, type, H5AC_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE2058); if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -3365,14 +3365,14 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) /* Allocate the first block from meta_aggr */ type = H5FD_MEM_SUPER; - addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if ((addr+TEST_BLOCK_SIZE30) != ma_addr) TEST_ERROR /* Allocate the first block from sdata_aggr */ stype = H5FD_MEM_DRAW; - saddr = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + saddr = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50); H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if ((saddr+TEST_BLOCK_SIZE50) != sdata_addr) TEST_ERROR @@ -3384,7 +3384,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) new_addr = addr - 10; /* should be able to fulfill request from the aggreqator itself */ - was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE50)); + was_extended = H5MF_try_extend(f, H5AC_dxpl_id, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE50)); if(!was_extended) TEST_ERROR @@ -3400,8 +3400,8 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) f->shared->meta_aggr.addr = ma_addr; f->shared->meta_aggr.size = ma_size; - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE30); - H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr, (hsize_t)TEST_BLOCK_SIZE50); + H5MF_xfree(f, type, H5AC_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE30); + H5MF_xfree(f, stype, H5AC_dxpl_id, saddr, (hsize_t)TEST_BLOCK_SIZE50); if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -3435,14 +3435,14 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) /* Allocate first block from meta_aggr */ type = H5FD_MEM_SUPER; - addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if ((addr+TEST_BLOCK_SIZE30) != ma_addr) TEST_ERROR /* Allocate first block from sdata_aggr */ stype = H5FD_MEM_DRAW; - saddr = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + saddr = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50); H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sdata_addr, &sdata_size); if ((saddr+TEST_BLOCK_SIZE50) != sdata_addr) TEST_ERROR @@ -3454,7 +3454,7 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) new_addr = addr - 10; /* unable to fulfill request from the aggreqator itself */ - was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE50)); + was_extended = H5MF_try_extend(f, H5AC_dxpl_id, type, (haddr_t)new_addr, (hsize_t)10, (hsize_t)(TEST_BLOCK_SIZE50)); if(was_extended) TEST_ERROR @@ -3468,8 +3468,8 @@ test_mf_aggr_extend(const char *env_h5_drvr, hid_t fapl) f->shared->meta_aggr.addr = ma_addr; f->shared->meta_aggr.size = ma_size; - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE30); - H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr, (hsize_t)TEST_BLOCK_SIZE50); + H5MF_xfree(f, type, H5AC_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE30); + H5MF_xfree(f, stype, H5AC_dxpl_id, saddr, (hsize_t)TEST_BLOCK_SIZE50); if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -3567,7 +3567,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) /* Allocate block A from meta_aggr */ type = H5FD_MEM_SUPER; - addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); ma_addr = new_ma_addr - TEST_BLOCK_SIZE30; @@ -3575,7 +3575,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* should succeed */ - if(H5MF_try_shrink(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30) <= 0) + if(H5MF_try_shrink(f, type, H5AC_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30) <= 0) TEST_ERROR H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); @@ -3614,7 +3614,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) /* Allocate block A from meta_aggr */ type = H5FD_MEM_SUPER; - addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if ((addr1+TEST_BLOCK_SIZE30) != ma_addr) TEST_ERROR @@ -3622,12 +3622,12 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) /* Allocate block B from sdata_aggr */ stype = H5FD_MEM_DRAW; - saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + saddr1 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50); H5MF_aggr_query(f, &(f->shared->sdata_aggr), NULL, &sdata_size); /* should succeed */ - if(H5MF_try_shrink(f, stype, H5P_DATASET_XFER_DEFAULT, saddr1, (hsize_t)TEST_BLOCK_SIZE50) <= 0) + if(H5MF_try_shrink(f, stype, H5AC_dxpl_id, saddr1, (hsize_t)TEST_BLOCK_SIZE50) <= 0) TEST_ERROR H5MF_aggr_query(f, &(f->shared->sdata_aggr), &new_sdata_addr, &new_sdata_size); @@ -3639,7 +3639,7 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) if (new_ma_addr != ma_addr) TEST_ERROR if (new_ma_size != (ma_size)) TEST_ERROR - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30); + H5MF_xfree(f, type, H5AC_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30); if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -3673,35 +3673,35 @@ test_mf_aggr_absorb(const char *env_h5_drvr, hid_t fapl) /* Allocate block A from meta_aggr */ type = H5FD_MEM_SUPER; - addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if ((addr1+TEST_BLOCK_SIZE30) != ma_addr) TEST_ERROR /* Allocate block B from meta_aggr */ - addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + addr2 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50); H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if ((addr2+TEST_BLOCK_SIZE50) != ma_addr) TEST_ERROR /* Allocate block C from meta_aggr */ - addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)(TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50)); + addr3 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)(TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50)); H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); if ((addr3+TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50) != ma_addr) TEST_ERROR /* should not succeed */ - if(H5MF_try_shrink(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE50) > 0) + if(H5MF_try_shrink(f, type, H5AC_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE50) > 0) TEST_ERROR /* aggregator info should be the same as before */ H5MF_aggr_query(f, &(f->shared->meta_aggr), &new_ma_addr, &new_ma_size); if (new_ma_addr != ma_addr) TEST_ERROR - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30); - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE50); - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)(TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50)); + H5MF_xfree(f, type, H5AC_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30); + H5MF_xfree(f, type, H5AC_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE50); + H5MF_xfree(f, type, H5AC_dxpl_id, addr3, (hsize_t)(TEST_BLOCK_SIZE30+TEST_BLOCK_SIZE50)); if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -3826,7 +3826,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Allocate a block of 30 from file allocation */ type = H5FD_MEM_SUPER; - addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); /* Verify that the allocated block is aligned */ if (addr1 % alignment) TEST_ERROR @@ -3850,7 +3850,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) mis_align = alignment - tmp; accum += (mis_align + TEST_BLOCK_SIZE50); - addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + addr2 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50); /* Verify that the allocated block is aligned */ if (addr2 % alignment) TEST_ERROR @@ -3867,8 +3867,8 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) TEST_ERROR } - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30); - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE50); + H5MF_xfree(f, type, H5AC_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30); + H5MF_xfree(f, type, H5AC_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE50); if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -3902,7 +3902,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* allocate a block of 50 from meta_aggr */ type = H5FD_MEM_SUPER; - addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50); /* address should be aligned */ if (addr1 % alignment) TEST_ERROR @@ -3923,7 +3923,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* shrink the block */ - if(H5MF_try_shrink(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE50) <= 0) + if(H5MF_try_shrink(f, type, H5AC_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE50) <= 0) TEST_ERROR if(H5Fclose(file) < 0) @@ -3957,7 +3957,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* allocate a block of 50 */ type = H5FD_MEM_SUPER; - addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50); /* address should be aligned */ if (addr1 % alignment) TEST_ERROR @@ -3978,7 +3978,7 @@ test_mf_align_eoa(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) FAIL_STACK_ERROR /* try to extend the block */ - was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)addr1, (hsize_t)TEST_BLOCK_SIZE50, (hsize_t)TEST_BLOCK_SIZE30); + was_extended = H5MF_try_extend(f, H5AC_dxpl_id, type, (haddr_t)addr1, (hsize_t)TEST_BLOCK_SIZE50, (hsize_t)TEST_BLOCK_SIZE30); if (was_extended <=0) TEST_ERROR @@ -4083,7 +4083,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + if(H5MF_alloc_start(f, H5AC_dxpl_id, type) < 0) TEST_ERROR if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) @@ -4095,13 +4095,13 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Construct user data for callbacks */ udata.f = f; - udata.dxpl_id = H5P_DATASET_XFER_DEFAULT; + udata.dxpl_id = H5AC_dxpl_id; udata.alloc_type = type; udata.allow_sect_absorb = TRUE; udata.allow_eoa_shrink_only = FALSE; /* Add section A to free-space manager */ - if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata)) + if (H5FS_sect_add(f, H5AC_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata)) FAIL_STACK_ERROR HDmemset(&state, 0, sizeof(frspace_state_t)); @@ -4113,7 +4113,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) TEST_ERROR /* Allocate a block of 50 */ - addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50); /* Verify that the allocated block is section A in free-space */ if (addr != (haddr_t)alignment) TEST_ERROR @@ -4127,7 +4127,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) TEST_ERROR /* Free the block to free-space */ - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)TEST_BLOCK_SIZE50); + H5MF_xfree(f, type, H5AC_dxpl_id, addr, (hsize_t)TEST_BLOCK_SIZE50); state.tot_space += TEST_BLOCK_SIZE50; state.tot_sect_count += 1; @@ -4153,7 +4153,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + if(H5MF_alloc_start(f, H5AC_dxpl_id, type) < 0) TEST_ERROR if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) @@ -4165,13 +4165,13 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Construct user data for callbacks */ udata.f = f; - udata.dxpl_id = H5P_DATASET_XFER_DEFAULT; + udata.dxpl_id = H5AC_dxpl_id; udata.alloc_type = type; udata.allow_sect_absorb = TRUE; udata.allow_eoa_shrink_only = FALSE; /* Add section A to free-space manager */ - if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata)) + if (H5FS_sect_add(f, H5AC_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata)) FAIL_STACK_ERROR HDmemset(&state, 0, sizeof(frspace_state_t)); @@ -4183,7 +4183,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) TEST_ERROR /* Allocate a block of 600 */ - addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE600); + addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE600); /* Verify that the allocated block is aligned */ if (addr % alignment) TEST_ERROR @@ -4197,7 +4197,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) TEST_ERROR /* try to extend the block */ - was_extended = H5MF_try_extend(f, H5P_DATASET_XFER_DEFAULT, type, (haddr_t)addr, (hsize_t)TEST_BLOCK_SIZE600, (hsize_t)TEST_BLOCK_SIZE200); + was_extended = H5MF_try_extend(f, H5AC_dxpl_id, type, (haddr_t)addr, (hsize_t)TEST_BLOCK_SIZE600, (hsize_t)TEST_BLOCK_SIZE200); if (was_extended <=0) TEST_ERROR @@ -4208,7 +4208,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) TEST_ERROR /* Free the block to free-space manager */ - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr, (hsize_t)(TEST_BLOCK_SIZE600+TEST_BLOCK_SIZE200)); + H5MF_xfree(f, type, H5AC_dxpl_id, addr, (hsize_t)(TEST_BLOCK_SIZE600+TEST_BLOCK_SIZE200)); /* only 1 section in free-space because of merging */ state.tot_space += (TEST_BLOCK_SIZE600+TEST_BLOCK_SIZE200); @@ -4243,7 +4243,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) type = H5FD_MEM_SUPER; - if(H5MF_alloc_start(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + if(H5MF_alloc_start(f, H5AC_dxpl_id, type) < 0) TEST_ERROR if (f->shared->fs_state[type] != H5F_FS_STATE_OPEN) @@ -4255,13 +4255,13 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Construct user data for callbacks */ udata.f = f; - udata.dxpl_id = H5P_DATASET_XFER_DEFAULT; + udata.dxpl_id = H5AC_dxpl_id; udata.alloc_type = type; udata.allow_sect_absorb = TRUE; udata.allow_eoa_shrink_only = FALSE; /* Add section A to free-space manager */ - if (H5FS_sect_add(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata)) + if (H5FS_sect_add(f, H5AC_dxpl_id, f->shared->fs_man[type], (H5FS_section_info_t *)sect_node, H5FS_ADD_RETURNED_SPACE, &udata)) FAIL_STACK_ERROR HDmemset(&state, 0, sizeof(frspace_state_t)); @@ -4276,7 +4276,7 @@ test_mf_align_fs(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) * Since free-space manager cannot fulfull the request because of alignment, * the block is obtained from file allocation */ - addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)(TEST_BLOCK_SIZE40)); + addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)(TEST_BLOCK_SIZE40)); /* Verify that the allocated block is aligned */ if (addr % alignment) @@ -4472,7 +4472,7 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Allocate a block of 30 from meta_aggr */ type = H5FD_MEM_SUPER; - addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); /* Verify that the allocated block is aligned */ if (addr1 % alignment) TEST_ERROR @@ -4496,7 +4496,7 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) mis_align = alignment - tmp; /* Allocate a block of 50 from meta_aggr */ - addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + addr2 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50); /* Verify that the allocated block is aligned */ if (addr2 % alignment) TEST_ERROR @@ -4518,7 +4518,7 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) if ((tmp = ma_addr % alignment)) mis_align = alignment - tmp; - addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE80); + addr3 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE80); /* Verify that the allocated block is aligned */ if (addr3 % alignment) TEST_ERROR @@ -4541,7 +4541,7 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) mis_align = alignment - tmp; /* Allocate a block of 1970 from meta_aggr */ - addr4 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1970); + addr4 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1970); /* Verify that the allocated block is aligned */ if (addr4 % alignment) TEST_ERROR @@ -4562,10 +4562,10 @@ test_mf_align_alloc1(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30); - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE50); - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE80); - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE1970); + H5MF_xfree(f, type, H5AC_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30); + H5MF_xfree(f, type, H5AC_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE50); + H5MF_xfree(f, type, H5AC_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE80); + H5MF_xfree(f, type, H5AC_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE1970); if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -4730,7 +4730,7 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Allocate a block of 30 from meta_aggr */ type = H5FD_MEM_SUPER; - addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); /* Verify that the allocated block is aligned */ if (addr1 % alignment) TEST_ERROR @@ -4753,7 +4753,7 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) if ((tmp = ma_addr % alignment)) mis_align = alignment - tmp; - addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + addr2 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50); /* Verify that the allocated block is aligned */ if (addr2 % alignment) TEST_ERROR @@ -4789,7 +4789,7 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Allocate a block of 30 from sdata_aggr */ stype = H5FD_MEM_DRAW; - saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + saddr1 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); /* fragment for alignment of block 30 for sdata_aggr is freed to free-space */ if (mis_align) { @@ -4822,7 +4822,7 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) mis_align = alignment - tmp; /* Allocate a block of 80 from meta_aggr */ - addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE80); + addr3 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE80); /* Verify that the allocated block is aligned */ if (addr3 % alignment) TEST_ERROR @@ -4850,10 +4850,10 @@ test_mf_align_alloc2(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) TEST_ERROR } - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30); - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE50); - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE80); - H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr1, (hsize_t)TEST_BLOCK_SIZE30); + H5MF_xfree(f, type, H5AC_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30); + H5MF_xfree(f, type, H5AC_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE50); + H5MF_xfree(f, type, H5AC_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE80); + H5MF_xfree(f, stype, H5AC_dxpl_id, saddr1, (hsize_t)TEST_BLOCK_SIZE30); if(H5Fclose(file) < 0) FAIL_STACK_ERROR @@ -5072,7 +5072,7 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Allocate a block of 30 from meta_aggr */ type = H5FD_MEM_SUPER; - addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); /* Verify that the allocated block is aligned */ if (addr1 % alignment) TEST_ERROR @@ -5095,7 +5095,7 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) mis_align = alignment - tmp; /* Allocate a block of 50 from meta_aggr */ - addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + addr2 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50); /* Verify that the allocated block is aligned */ if (addr2 % alignment) TEST_ERROR @@ -5130,7 +5130,7 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Allocate a block of 30 from sdata_aggr */ stype = H5FD_MEM_DRAW; - saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + saddr1 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); /* Verify that the allocated block is aligned */ if (saddr1 % alignment) TEST_ERROR @@ -5151,7 +5151,7 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) mis_align = alignment - tmp; /* Allocate a block of 50 from sdata_aggr */ - saddr2 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + saddr2 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50); /* Verify that the allocated block is aligned */ if (saddr2 % alignment) TEST_ERROR @@ -5172,7 +5172,7 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) mis_align = alignment - tmp; /* Allocate a block of 80 from sdata_aggr */ - saddr3 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE80); + saddr3 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE80); /* Verify that the allocated block is aligned */ if (saddr3 % alignment) TEST_ERROR @@ -5194,7 +5194,7 @@ test_mf_align_alloc3(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) mis_align = alignment - tmp; /* Allocate a block of 1034 for meta_aggr */ - addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1034); + addr3 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1034); /* Verify that the allocated block is aligned */ if (addr3 % alignment) TEST_ERROR @@ -5375,7 +5375,7 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Allocate a block of 30 from meta_aggr */ type = H5FD_MEM_SUPER; - addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); /* Verify that the allocated block is aligned */ if (addr1 % alignment) TEST_ERROR @@ -5398,7 +5398,7 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) mis_align = alignment - tmp; /* Allocate a block of 2058 from meta_aggr */ - addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2058); + addr2 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2058); /* Verify that the allocated block is aligned */ if (addr2 % alignment) TEST_ERROR @@ -5423,7 +5423,7 @@ test_mf_align_alloc4(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) mis_align = alignment - tmp; /* Allocate a block of 5 from meta_aggr */ - addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE5); + addr3 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE5); /* fragment for alignment of block 5 is freed to free-space */ if (mis_align) { @@ -5588,7 +5588,7 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Allocate a block of 30 from meta_aggr */ type = H5FD_MEM_SUPER; - addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); /* Verify that the allocated block is aligned */ if (addr1 % alignment) TEST_ERROR @@ -5612,7 +5612,7 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Allocate a block of 30 from sdata_aggr */ stype = H5FD_MEM_DRAW; - saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + saddr1 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); /* Verify that the allocated block is aligned */ if (saddr1 % alignment) TEST_ERROR @@ -5633,7 +5633,7 @@ test_mf_align_alloc5(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) mis_align = alignment - tmp; /* Allocate a block of 2058 from meta_aggr */ - addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2058); + addr2 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2058); /* Verify that the allocated block is aligned */ if (addr2 % alignment) TEST_ERROR @@ -5854,7 +5854,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Allocate a block of 30 from meta_aggr */ type = H5FD_MEM_SUPER; - addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); /* Verify that the allocated block is aligned */ if (addr1 % alignment) TEST_ERROR @@ -5878,7 +5878,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) /* Allocate a block of 30 from sdata_aggr */ stype = H5FD_MEM_DRAW; - saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + saddr1 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); /* Verify that the allocated block is aligned */ if (saddr1 % alignment) TEST_ERROR @@ -5899,7 +5899,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) mis_align = alignment - tmp; /* Allocate a block of 50 from sdata_aggr */ - saddr2 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + saddr2 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50); /* Verify that the allocated block is aligned */ if (saddr2 % alignment) TEST_ERROR @@ -5920,7 +5920,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) mis_align = alignment - tmp; /* Allocate a block of 80 from sdata_aggr */ - saddr3 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE80); + saddr3 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE80); /* Verify that the allocated block is aligned */ if (saddr3 % alignment) TEST_ERROR @@ -5942,7 +5942,7 @@ test_mf_align_alloc6(const char *env_h5_drvr, hid_t fapl, hid_t new_fapl) mis_align = alignment - tmp; /* Allocate a block of 2058 from meta_aggr */ - addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2058); + addr2 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2058); /* Verify that the allocated block is aligned */ if (addr2 % alignment) TEST_ERROR @@ -6023,25 +6023,25 @@ test_mf_fs_persist(hid_t fapl_new, hid_t fcpl) /* Allocate 6 blocks */ type = H5FD_MEM_SUPER; - if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1))) + if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2))) + if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3))) + if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE4))) + if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE4))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (addr5 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE5))) + if(HADDR_UNDEF == (addr5 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE5))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE6))) + if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE6))) FAIL_STACK_ERROR /* Put block #1, #3, #5 to H5FD_MEM_SUPER free-space manager */ - if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE1) < 0) + if(H5MF_xfree(f, type, H5AC_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE1) < 0) FAIL_STACK_ERROR - if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0) + if(H5MF_xfree(f, type, H5AC_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0) FAIL_STACK_ERROR - if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr5, (hsize_t)TEST_BLOCK_SIZE5) < 0) + if(H5MF_xfree(f, type, H5AC_dxpl_id, addr5, (hsize_t)TEST_BLOCK_SIZE5) < 0) FAIL_STACK_ERROR if(H5Fclose(file) < 0) @@ -6060,7 +6060,7 @@ test_mf_fs_persist(hid_t fapl_new, hid_t fcpl) TEST_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ - if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + if(H5MF_alloc_open(f, H5AC_dxpl_id, type) < 0) FAIL_STACK_ERROR /* Get info for free-space manager */ @@ -6075,13 +6075,13 @@ test_mf_fs_persist(hid_t fapl_new, hid_t fcpl) TEST_ERROR /* Retrieve block #3 from H5FD_MEM_SUPER free-space manager */ - if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3))) + if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3))) FAIL_STACK_ERROR if(tmp_addr != addr3) TEST_ERROR /* Retrieve block #1 from H5FD_MEM_SUPER free-space manager */ - if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1))) + if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1))) FAIL_STACK_ERROR if(tmp_addr != addr1) TEST_ERROR @@ -6102,7 +6102,7 @@ test_mf_fs_persist(hid_t fapl_new, hid_t fcpl) TEST_ERROR /* Retrieve block #5 from H5FD_MEM_SUPER free-space manager */ - if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE5))) + if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE5))) FAIL_STACK_ERROR if(tmp_addr != addr5) TEST_ERROR @@ -6149,25 +6149,25 @@ test_mf_fs_gone(hid_t fapl_new, hid_t fcpl) /* Allocate 4 blocks */ type = H5FD_MEM_SUPER; - if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1))) + if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2))) + if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3))) + if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE4))) + if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE4))) FAIL_STACK_ERROR /* Put block #1, #3 to H5FD_MEM_SUPER free-space manager */ - if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE1) < 0) + if(H5MF_xfree(f, type, H5AC_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE1) < 0) FAIL_STACK_ERROR - if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0) + if(H5MF_xfree(f, type, H5AC_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0) FAIL_STACK_ERROR /* Retrieve block #1, #3 from H5FD_MEM_SUPER free-space manager */ - if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3))) + if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1))) + if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1))) FAIL_STACK_ERROR if(H5Fclose(file) < 0) @@ -6186,7 +6186,7 @@ test_mf_fs_gone(hid_t fapl_new, hid_t fcpl) TEST_ERROR /* Put block #3 to H5FD_MEM_SUPER free-space manager */ - if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0) + if(H5MF_xfree(f, type, H5AC_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0) FAIL_STACK_ERROR if(H5Fclose(file) < 0) @@ -6205,7 +6205,7 @@ test_mf_fs_gone(hid_t fapl_new, hid_t fcpl) TEST_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ - if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + if(H5MF_alloc_open(f, H5AC_dxpl_id, type) < 0) FAIL_STACK_ERROR /* Get info for H5FD_MEM_SUPER free-space manager */ @@ -6219,7 +6219,7 @@ test_mf_fs_gone(hid_t fapl_new, hid_t fcpl) TEST_ERROR /* Put block #4 to H5FD_MEM_SUPER free-space manager */ - if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr4, (hsize_t)TEST_BLOCK_SIZE4) < 0) + if(H5MF_xfree(f, type, H5AC_dxpl_id, addr4, (hsize_t)TEST_BLOCK_SIZE4) < 0) FAIL_STACK_ERROR /* The H5FD_MEM_SUPER free-space manager will go away at H5MF_close() */ @@ -6284,36 +6284,36 @@ test_mf_fs_split(hid_t fapl_new, hid_t fcpl) /* Allocate 4 blocks of type H5FD_MEM_SUPER */ type = H5FD_MEM_SUPER; - if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1))) + if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2))) + if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3))) + if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE4))) + if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE4))) FAIL_STACK_ERROR /* Put block #1, #3 into H5FD_MEM_SUPER free-space manager */ - if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE1) < 0) + if(H5MF_xfree(f, type, H5AC_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE1) < 0) FAIL_STACK_ERROR - if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0) + if(H5MF_xfree(f, type, H5AC_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0) FAIL_STACK_ERROR /* Allocate 4 blocks of type H5FD_MEM_DRAW */ stype = H5FD_MEM_DRAW; - if(HADDR_UNDEF == (saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1))) + if(HADDR_UNDEF == (saddr1 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (saddr2 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2))) + if(HADDR_UNDEF == (saddr2 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (saddr3 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3))) + if(HADDR_UNDEF == (saddr3 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (saddr4 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE4))) + if(HADDR_UNDEF == (saddr4 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE4))) FAIL_STACK_ERROR /* Put block #1, #3 into H5FD_MEM_DRAW free-space manager */ - if(H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr1, (hsize_t)TEST_BLOCK_SIZE1) < 0) + if(H5MF_xfree(f, stype, H5AC_dxpl_id, saddr1, (hsize_t)TEST_BLOCK_SIZE1) < 0) FAIL_STACK_ERROR - if(H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr3, (hsize_t)TEST_BLOCK_SIZE3) < 0) + if(H5MF_xfree(f, stype, H5AC_dxpl_id, saddr3, (hsize_t)TEST_BLOCK_SIZE3) < 0) FAIL_STACK_ERROR if(H5Fclose(file) < 0) @@ -6332,7 +6332,7 @@ test_mf_fs_split(hid_t fapl_new, hid_t fcpl) TEST_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ - if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + if(H5MF_alloc_open(f, H5AC_dxpl_id, type) < 0) FAIL_STACK_ERROR /* Get free-space info */ @@ -6346,7 +6346,7 @@ test_mf_fs_split(hid_t fapl_new, hid_t fcpl) TEST_ERROR /* Retrieve block #1 from H5FD_MEM_SUPER free-space manager; block #2 still in free-space */ - if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1))) + if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1))) FAIL_STACK_ERROR if(tmp_addr != addr1) TEST_ERROR @@ -6356,7 +6356,7 @@ test_mf_fs_split(hid_t fapl_new, hid_t fcpl) TEST_ERROR /* Start up H5FD_MEM_DRAW free-space manager */ - if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, stype) < 0) + if(H5MF_alloc_open(f, H5AC_dxpl_id, stype) < 0) FAIL_STACK_ERROR /* Get free-space info */ @@ -6370,13 +6370,13 @@ test_mf_fs_split(hid_t fapl_new, hid_t fcpl) TEST_ERROR /* Retrieve blocks #1 from H5FD_MEM_DRAW free-space manager */ - if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1))) + if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1))) FAIL_STACK_ERROR if(tmp_addr != saddr1) TEST_ERROR /* Retrieve blocks #3 from H5FD_MEM_DRAW free-space manager */ - if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3))) + if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3))) FAIL_STACK_ERROR if(tmp_addr != saddr3) TEST_ERROR @@ -6385,19 +6385,19 @@ test_mf_fs_split(hid_t fapl_new, hid_t fcpl) /* Allocate 4 blocks of type H5FD_MEM_BTREE */ btype = H5FD_MEM_BTREE; - if(HADDR_UNDEF == (baddr5 = H5MF_alloc(f, btype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE5))) + if(HADDR_UNDEF == (baddr5 = H5MF_alloc(f, btype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE5))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (baddr6 = H5MF_alloc(f, btype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE6))) + if(HADDR_UNDEF == (baddr6 = H5MF_alloc(f, btype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE6))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (baddr7 = H5MF_alloc(f, btype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE7))) + if(HADDR_UNDEF == (baddr7 = H5MF_alloc(f, btype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE7))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (baddr8 = H5MF_alloc(f, btype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE8))) + if(HADDR_UNDEF == (baddr8 = H5MF_alloc(f, btype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE8))) FAIL_STACK_ERROR /* Put block #5 & #7 into H5FD_MEM_BTREE free-space manager */ - if(H5MF_xfree(f, btype, H5P_DATASET_XFER_DEFAULT, baddr5, (hsize_t)TEST_BLOCK_SIZE5) < 0) + if(H5MF_xfree(f, btype, H5AC_dxpl_id, baddr5, (hsize_t)TEST_BLOCK_SIZE5) < 0) FAIL_STACK_ERROR - if(H5MF_xfree(f, btype, H5P_DATASET_XFER_DEFAULT, baddr7, (hsize_t)TEST_BLOCK_SIZE7) < 0) + if(H5MF_xfree(f, btype, H5AC_dxpl_id, baddr7, (hsize_t)TEST_BLOCK_SIZE7) < 0) FAIL_STACK_ERROR if(H5Fclose(file) < 0) @@ -6420,7 +6420,7 @@ test_mf_fs_split(hid_t fapl_new, hid_t fcpl) TEST_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ - if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + if(H5MF_alloc_open(f, H5AC_dxpl_id, type) < 0) FAIL_STACK_ERROR /* Get free-space info */ @@ -6432,13 +6432,13 @@ test_mf_fs_split(hid_t fapl_new, hid_t fcpl) TEST_ERROR /* Retrieve block #3 from H5FD_MEM_SUPER free-space manager */ - if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3))) + if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3))) FAIL_STACK_ERROR if(tmp_addr != addr3) TEST_ERROR /* Retrieve block #7 from H5FD_MEM_BTREE free-space manager */ - if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, btype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE7))) + if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, btype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE7))) FAIL_STACK_ERROR if(tmp_addr != baddr7) TEST_ERROR @@ -6460,7 +6460,7 @@ test_mf_fs_split(hid_t fapl_new, hid_t fcpl) TEST_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ - if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + if(H5MF_alloc_open(f, H5AC_dxpl_id, type) < 0) FAIL_STACK_ERROR /* Get free-space info */ @@ -6519,36 +6519,36 @@ test_mf_fs_multi(hid_t fapl_new, hid_t fcpl) /* Allocate 4 blocks of type H5FD_MEM_SUPER */ type = H5FD_MEM_SUPER; - if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1))) + if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2))) + if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3))) + if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE4))) + if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE4))) FAIL_STACK_ERROR /* Put block #1, #3 into H5FD_MEM_SUPER free-space manager */ - if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE1) < 0) + if(H5MF_xfree(f, type, H5AC_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE1) < 0) FAIL_STACK_ERROR - if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0) + if(H5MF_xfree(f, type, H5AC_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0) FAIL_STACK_ERROR /* Allocate 4 blocks of type H5FD_MEM_DRAW */ stype = H5FD_MEM_DRAW; - if(HADDR_UNDEF == (saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1))) + if(HADDR_UNDEF == (saddr1 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (saddr2 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2))) + if(HADDR_UNDEF == (saddr2 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (saddr3 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3))) + if(HADDR_UNDEF == (saddr3 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (saddr4 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE4))) + if(HADDR_UNDEF == (saddr4 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE4))) FAIL_STACK_ERROR /* Put block #1, #3 into H5FD_MEM_DRAW free-space manager */ - if(H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr1, (hsize_t)TEST_BLOCK_SIZE1) < 0) + if(H5MF_xfree(f, stype, H5AC_dxpl_id, saddr1, (hsize_t)TEST_BLOCK_SIZE1) < 0) FAIL_STACK_ERROR - if(H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr3, (hsize_t)TEST_BLOCK_SIZE3) < 0) + if(H5MF_xfree(f, stype, H5AC_dxpl_id, saddr3, (hsize_t)TEST_BLOCK_SIZE3) < 0) FAIL_STACK_ERROR if(H5Fclose(file) < 0) @@ -6567,7 +6567,7 @@ test_mf_fs_multi(hid_t fapl_new, hid_t fcpl) TEST_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ - if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + if(H5MF_alloc_open(f, H5AC_dxpl_id, type) < 0) FAIL_STACK_ERROR /* Get free-space info */ @@ -6581,7 +6581,7 @@ test_mf_fs_multi(hid_t fapl_new, hid_t fcpl) TEST_ERROR /* Retrieve block #1 from H5FD_MEM_SUPER free-space manager; block #2 still in free-space */ - if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1))) + if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1))) FAIL_STACK_ERROR if(tmp_addr != addr1) TEST_ERROR @@ -6591,7 +6591,7 @@ test_mf_fs_multi(hid_t fapl_new, hid_t fcpl) TEST_ERROR /* Start up H5FD_MEM_DRAW free-space manager */ - if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, stype) < 0) + if(H5MF_alloc_open(f, H5AC_dxpl_id, stype) < 0) FAIL_STACK_ERROR /* Get free-space info */ @@ -6605,32 +6605,32 @@ test_mf_fs_multi(hid_t fapl_new, hid_t fcpl) TEST_ERROR /* Retrieve blocks #1 from H5FD_MEM_DRAW free-space manager */ - if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1))) + if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1))) FAIL_STACK_ERROR if(tmp_addr != saddr1) TEST_ERROR /* Retrieve blocks #3 from H5FD_MEM_DRAW free-space manager */ - if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3))) + if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3))) FAIL_STACK_ERROR if(tmp_addr != saddr3) TEST_ERROR /* Allocate 4 blocks of type H5FD_MEM_BTREE */ btype = H5FD_MEM_BTREE; - if(HADDR_UNDEF == (baddr1 = H5MF_alloc(f, btype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1))) + if(HADDR_UNDEF == (baddr1 = H5MF_alloc(f, btype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (baddr2 = H5MF_alloc(f, btype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2))) + if(HADDR_UNDEF == (baddr2 = H5MF_alloc(f, btype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (baddr3 = H5MF_alloc(f, btype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3))) + if(HADDR_UNDEF == (baddr3 = H5MF_alloc(f, btype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (baddr4 = H5MF_alloc(f, btype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE4))) + if(HADDR_UNDEF == (baddr4 = H5MF_alloc(f, btype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE4))) FAIL_STACK_ERROR /* Put block #1 & #3 into H5FD_MEM_BTREE free-space manager */ - if(H5MF_xfree(f, btype, H5P_DATASET_XFER_DEFAULT, baddr1, (hsize_t)TEST_BLOCK_SIZE1) < 0) + if(H5MF_xfree(f, btype, H5AC_dxpl_id, baddr1, (hsize_t)TEST_BLOCK_SIZE1) < 0) FAIL_STACK_ERROR - if(H5MF_xfree(f, btype, H5P_DATASET_XFER_DEFAULT, baddr3, (hsize_t)TEST_BLOCK_SIZE3) < 0) + if(H5MF_xfree(f, btype, H5AC_dxpl_id, baddr3, (hsize_t)TEST_BLOCK_SIZE3) < 0) FAIL_STACK_ERROR if(H5Fclose(file) < 0) @@ -6649,7 +6649,7 @@ test_mf_fs_multi(hid_t fapl_new, hid_t fcpl) TEST_ERROR /* Start up H5FD_MEM_SUPER free-space manager */ - if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + if(H5MF_alloc_open(f, H5AC_dxpl_id, type) < 0) FAIL_STACK_ERROR /* Get free-space info */ @@ -6661,7 +6661,7 @@ test_mf_fs_multi(hid_t fapl_new, hid_t fcpl) TEST_ERROR /* Retrieve block #3 from H5FD_MEM_SUPER free-space manager */ - if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3))) + if(HADDR_UNDEF == (tmp_addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3))) FAIL_STACK_ERROR if(tmp_addr != addr3) TEST_ERROR @@ -6675,7 +6675,7 @@ test_mf_fs_multi(hid_t fapl_new, hid_t fcpl) TEST_ERROR /* Start up H5FD_MEM_BTREE free-space manager */ - if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, btype) < 0) + if(H5MF_alloc_open(f, H5AC_dxpl_id, btype) < 0) FAIL_STACK_ERROR /* Get free-space info */ @@ -6690,13 +6690,13 @@ test_mf_fs_multi(hid_t fapl_new, hid_t fcpl) /* Allocate 2 blocks of type H5FD_MEM_GHEAP */ gtype = H5FD_MEM_GHEAP; - if(HADDR_UNDEF == (gaddr2 = H5MF_alloc(f, gtype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2))) + if(HADDR_UNDEF == (gaddr2 = H5MF_alloc(f, gtype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (gaddr1 = H5MF_alloc(f, gtype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1))) + if(HADDR_UNDEF == (gaddr1 = H5MF_alloc(f, gtype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1))) FAIL_STACK_ERROR /* Put block #2 into H5FD_MEM_GHEAP free-space manager */ - if(H5MF_xfree(f, gtype, H5P_DATASET_XFER_DEFAULT, gaddr2, (hsize_t)TEST_BLOCK_SIZE2) < 0) + if(H5MF_xfree(f, gtype, H5AC_dxpl_id, gaddr2, (hsize_t)TEST_BLOCK_SIZE2) < 0) FAIL_STACK_ERROR if(H5Fclose(file) < 0) @@ -6713,15 +6713,15 @@ test_mf_fs_multi(hid_t fapl_new, hid_t fcpl) /* If H5FD_MEM_SUPER is there, should not find block #1 & #3 */ if(H5F_addr_defined(f->shared->fs_addr[type])) { /* Start up H5FD_MEM_SUPER free-space manager */ - if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + if(H5MF_alloc_open(f, H5AC_dxpl_id, type) < 0) FAIL_STACK_ERROR - if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], + if((node_found = H5FS_sect_find(f, H5AC_dxpl_id, f->shared->fs_man[type], (hsize_t)TEST_BLOCK_SIZE1, (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR if(node_found) TEST_ERROR - if((node_found = H5FS_sect_find(f, H5P_DATASET_XFER_DEFAULT, f->shared->fs_man[type], + if((node_found = H5FS_sect_find(f, H5AC_dxpl_id, f->shared->fs_man[type], (hsize_t)TEST_BLOCK_SIZE3, (H5FS_section_info_t **)&node)) < 0) FAIL_STACK_ERROR if(node_found) TEST_ERROR @@ -6732,7 +6732,7 @@ test_mf_fs_multi(hid_t fapl_new, hid_t fcpl) TEST_ERROR /* Start up H5FD_MEM_GHEAP free-space manager */ - if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, gtype) < 0) + if(H5MF_alloc_open(f, H5AC_dxpl_id, gtype) < 0) FAIL_STACK_ERROR /* Get free-space info */ @@ -6977,25 +6977,25 @@ test_filespace_strategy_threshold(hid_t fapl_new) /* Allocate 6 blocks */ type = H5FD_MEM_SUPER; - if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1))) + if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2))) + if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3))) + if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE4))) + if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE4))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (addr5 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE5))) + if(HADDR_UNDEF == (addr5 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE5))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE6))) + if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE6))) FAIL_STACK_ERROR /* Put block #1, #3, #5 to H5FD_MEM_SUPER free-space manager */ - if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE1) < 0) + if(H5MF_xfree(f, type, H5AC_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE1) < 0) FAIL_STACK_ERROR - if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0) + if(H5MF_xfree(f, type, H5AC_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0) FAIL_STACK_ERROR - if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr5, (hsize_t)TEST_BLOCK_SIZE5) < 0) + if(H5MF_xfree(f, type, H5AC_dxpl_id, addr5, (hsize_t)TEST_BLOCK_SIZE5) < 0) FAIL_STACK_ERROR /* Retrieve the total amount of free space and # of free-space sections */ @@ -7026,7 +7026,7 @@ test_filespace_strategy_threshold(hid_t fapl_new) TEST_ERROR /* Open the free-space manager */ - if(H5MF_alloc_open(f, H5P_DATASET_XFER_DEFAULT, type) < 0) + if(H5MF_alloc_open(f, H5AC_dxpl_id, type) < 0) FAIL_STACK_ERROR /* Retrieve the total amount of free space and # of free-space sections */ @@ -7040,7 +7040,7 @@ test_filespace_strategy_threshold(hid_t fapl_new) /* Retrieve block #5 from H5FD_MEM_SUPER free-space manager */ if(HADDR_UNDEF == - (tmp_addr = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE5))) + (tmp_addr = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE5))) FAIL_STACK_ERROR /* Should be the same as before */ @@ -7129,23 +7129,23 @@ test_filespace_gone(hid_t fapl_new) /* Allocate 6 blocks */ type = H5FD_MEM_SUPER; - if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE1))) + if(HADDR_UNDEF == (addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE1))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE2))) + if(HADDR_UNDEF == (addr2 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE2))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE3))) + if(HADDR_UNDEF == (addr3 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE3))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE4))) + if(HADDR_UNDEF == (addr4 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE4))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (addr5 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE5))) + if(HADDR_UNDEF == (addr5 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE5))) FAIL_STACK_ERROR - if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE6))) + if(HADDR_UNDEF == (addr6 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE6))) FAIL_STACK_ERROR /* Put block #3, #5 to H5FD_MEM_SUPER free-space manager */ - if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0) + if(H5MF_xfree(f, type, H5AC_dxpl_id, addr3, (hsize_t)TEST_BLOCK_SIZE3) < 0) FAIL_STACK_ERROR - if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr5, (hsize_t)TEST_BLOCK_SIZE5) < 0) + if(H5MF_xfree(f, type, H5AC_dxpl_id, addr5, (hsize_t)TEST_BLOCK_SIZE5) < 0) FAIL_STACK_ERROR HDmemset(&state, 0, sizeof(frspace_state_t)); @@ -7157,17 +7157,17 @@ test_filespace_gone(hid_t fapl_new) TEST_ERROR /* section #2 is less than threshold but is merged into section #3 */ - if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr2, (hsize_t)TEST_BLOCK_SIZE2) < 0) + if(H5MF_xfree(f, type, H5AC_dxpl_id, addr2, (hsize_t)TEST_BLOCK_SIZE2) < 0) FAIL_STACK_ERROR state.tot_space += TEST_BLOCK_SIZE2; if(check_stats(f, f->shared->fs_man[type], &state)) TEST_ERROR - if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr4, (hsize_t)TEST_BLOCK_SIZE4) < 0) + if(H5MF_xfree(f, type, H5AC_dxpl_id, addr4, (hsize_t)TEST_BLOCK_SIZE4) < 0) FAIL_STACK_ERROR - if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr6, (hsize_t)TEST_BLOCK_SIZE6) < 0) + if(H5MF_xfree(f, type, H5AC_dxpl_id, addr6, (hsize_t)TEST_BLOCK_SIZE6) < 0) FAIL_STACK_ERROR /* all sections should be shrunk away except section #1 */ @@ -7176,7 +7176,7 @@ test_filespace_gone(hid_t fapl_new) TEST_ERROR /* section #1 is less than threshold but is shrunk away */ - if(H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE1) < 0) + if(H5MF_xfree(f, type, H5AC_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE1) < 0) FAIL_STACK_ERROR /* free-space manager should be empty */ @@ -7396,29 +7396,29 @@ test_dichotomy(const char *env_h5_drvr, hid_t fapl) /* Allocate the first block of type H5FD_MEM_SUPER */ type = H5FD_MEM_SUPER; - addr1 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr1 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); /* Allocate the second block of type H5FD_MEM_SUPER */ - H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE50); + H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE50); /* Allocate the first block of type H5FD_MEM_DRAW */ stype = H5FD_MEM_DRAW; - saddr1 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + saddr1 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); /* Free the first block of type H5FD_MEM_SUPER */ - H5MF_xfree(f, type, H5P_DATASET_XFER_DEFAULT, addr1, (hsize_t)TEST_BLOCK_SIZE30); + H5MF_xfree(f, type, H5AC_dxpl_id, addr1, (hsize_t)TEST_BLOCK_SIZE30); /* Allocate the second block of type H5FD_MEM_DRAW */ - saddr2 = H5MF_alloc(f, stype, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + saddr2 = H5MF_alloc(f, stype, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); /* Verify that saddr1 is not addr1 */ if(saddr2 == addr1) TEST_ERROR /* Free the first block of type H5FD_MEM_DRAW */ - H5MF_xfree(f, stype, H5P_DATASET_XFER_DEFAULT, saddr1, (hsize_t)TEST_BLOCK_SIZE30); + H5MF_xfree(f, stype, H5AC_dxpl_id, saddr1, (hsize_t)TEST_BLOCK_SIZE30); /* Allocate the third block of type H5FD_MEM_SUPER */ - addr3 = H5MF_alloc(f, type, H5P_DATASET_XFER_DEFAULT, (hsize_t)TEST_BLOCK_SIZE30); + addr3 = H5MF_alloc(f, type, H5AC_dxpl_id, (hsize_t)TEST_BLOCK_SIZE30); /* Verify that addr3 is not saddr1 */ if(addr3 == saddr1) TEST_ERROR diff --git a/test/ohdr.c b/test/ohdr.c index 87c0b46..53703e4 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -80,51 +80,51 @@ test_cont(char *filename, hid_t fapl) goto error; } - if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)H5O_MIN_SIZE, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_locA/*out*/) < 0) + if(H5O_create(f, H5AC_dxpl_id, (size_t)H5O_MIN_SIZE, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_locA/*out*/) < 0) FAIL_STACK_ERROR - if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)H5O_MIN_SIZE, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_locB/*out*/) < 0) + if(H5O_create(f, H5AC_dxpl_id, (size_t)H5O_MIN_SIZE, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_locB/*out*/) < 0) FAIL_STACK_ERROR time_new = 11111111; - if(H5O_msg_create(&oh_locA, H5O_NAME_ID, 0, 0, &long_name, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_msg_create(&oh_locA, H5O_NAME_ID, 0, 0, &long_name, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR - if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR - if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR - if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR - if(H5O_msg_create(&oh_locA, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_msg_create(&oh_locA, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR - if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR - if(H5O_msg_create(&oh_locA, H5O_NAME_ID, 0, 0, &short_name, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_msg_create(&oh_locA, H5O_NAME_ID, 0, 0, &short_name, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR - if(1 != H5O_link(&oh_locA, 1, H5P_DATASET_XFER_DEFAULT)) + if(1 != H5O_link(&oh_locA, 1, H5AC_dxpl_id)) FAIL_STACK_ERROR - if(1 != H5O_link(&oh_locB, 1, H5P_DATASET_XFER_DEFAULT)) + if(1 != H5O_link(&oh_locB, 1, H5AC_dxpl_id)) FAIL_STACK_ERROR - if(H5AC_flush(f, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5AC_flush(f, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR - if(H5O_expunge_chunks_test(&oh_locA, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_expunge_chunks_test(&oh_locA, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR - if(H5O_get_hdr_info(&oh_locA, H5P_DATASET_XFER_DEFAULT, &hdr_info) < 0) + if(H5O_get_hdr_info(&oh_locA, H5AC_dxpl_id, &hdr_info) < 0) FAIL_STACK_ERROR nchunks = hdr_info.nchunks; /* remove the 1st H5O_NAME_ID message */ - if(H5O_msg_remove(&oh_locA, H5O_NAME_ID, 0, FALSE, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_msg_remove(&oh_locA, H5O_NAME_ID, 0, FALSE, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR - if(H5O_get_hdr_info(&oh_locA, H5P_DATASET_XFER_DEFAULT, &hdr_info) < 0) + if(H5O_get_hdr_info(&oh_locA, H5AC_dxpl_id, &hdr_info) < 0) FAIL_STACK_ERROR if(hdr_info.nchunks >= nchunks) @@ -192,7 +192,7 @@ test_ohdr_cache(char *filename, hid_t fapl) FAIL_STACK_ERROR /* Make a copy of the default DXPL */ - if((my_dxpl = H5Pcopy(H5P_DATASET_XFER_DEFAULT)) < 0) + if((my_dxpl = H5Pcopy(H5AC_dxpl_id)) < 0) FAIL_STACK_ERROR /* Create the file to operate on */ @@ -363,7 +363,7 @@ main(void) */ TESTING("object header creation"); HDmemset(&oh_loc, 0, sizeof(oh_loc)); - if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)64, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_loc/*out*/) < 0) + if(H5O_create(f, H5AC_dxpl_id, (size_t)64, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_loc/*out*/) < 0) FAIL_STACK_ERROR PASSED(); @@ -371,15 +371,15 @@ main(void) /* create a new message */ TESTING("message creation"); time_new = 11111111; - if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR - if(1 != H5O_link(&oh_loc, 1, H5P_DATASET_XFER_DEFAULT)) + if(1 != H5O_link(&oh_loc, 1, H5AC_dxpl_id)) FAIL_STACK_ERROR - if(H5AC_flush(f, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5AC_flush(f, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR - if(H5AC_expunge_entry(f, H5P_DATASET_XFER_DEFAULT, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_expunge_entry(f, H5AC_dxpl_id, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0) FAIL_STACK_ERROR - if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro, H5P_DATASET_XFER_DEFAULT)) + if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro, H5AC_dxpl_id)) FAIL_STACK_ERROR if(ro != time_new) TEST_ERROR @@ -391,19 +391,19 @@ main(void) */ TESTING("message modification"); time_new = 33333333; - if(H5O_msg_write(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_msg_write(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR - if(H5AC_flush(f, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5AC_flush(f, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR - if(H5AC_expunge_entry(f, H5P_DATASET_XFER_DEFAULT, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_expunge_entry(f, H5AC_dxpl_id, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0) FAIL_STACK_ERROR - if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro, H5P_DATASET_XFER_DEFAULT)) + if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro, H5AC_dxpl_id)) FAIL_STACK_ERROR if(ro != time_new) TEST_ERROR /* Make certain that chunk #0 in the object header can be encoded with a 1-byte size */ - if(H5O_get_hdr_info(&oh_loc, H5P_DATASET_XFER_DEFAULT, &hdr_info) < 0) + if(H5O_get_hdr_info(&oh_loc, H5AC_dxpl_id, &hdr_info) < 0) FAIL_STACK_ERROR if(hdr_info.space.total >=256) TEST_ERROR @@ -421,16 +421,16 @@ main(void) TESTING("object header overflow in memory"); for(i = 0; i < 40; i++) { time_new = (i + 1) * 1000 + 1000000; - if(H5O_msg_create(&oh_loc, H5O_MTIME_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_msg_create(&oh_loc, H5O_MTIME_ID, 0, 0, &time_new, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR } /* end for */ - if(H5AC_flush(f, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5AC_flush(f, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR - if(H5AC_expunge_entry(f, H5P_DATASET_XFER_DEFAULT, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_expunge_entry(f, H5AC_dxpl_id, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0) FAIL_STACK_ERROR /* Make certain that chunk #0 in the object header will be encoded with a 2-byte size */ - if(H5O_get_hdr_info(&oh_loc, H5P_DATASET_XFER_DEFAULT, &hdr_info) < 0) + if(H5O_get_hdr_info(&oh_loc, H5AC_dxpl_id, &hdr_info) < 0) FAIL_STACK_ERROR if(hdr_info.space.total < 256) TEST_ERROR @@ -465,11 +465,11 @@ main(void) TESTING("object header overflow on disk"); for(i = 0; i < 10; i++) { time_new = (i + 1) * 1000 + 10; - if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR - if(H5AC_flush(f, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5AC_flush(f, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR - if(H5AC_expunge_entry(f, H5P_DATASET_XFER_DEFAULT, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_expunge_entry(f, H5AC_dxpl_id, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0) FAIL_STACK_ERROR } /* end for */ PASSED(); @@ -478,13 +478,13 @@ main(void) * Delete all time messages. */ TESTING("message deletion"); - if(H5O_msg_remove(&oh_loc, H5O_MTIME_NEW_ID, H5O_ALL, TRUE, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_msg_remove(&oh_loc, H5O_MTIME_NEW_ID, H5O_ALL, TRUE, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR - if(H5O_msg_remove(&oh_loc, H5O_MTIME_ID, H5O_ALL, TRUE, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_msg_remove(&oh_loc, H5O_MTIME_ID, H5O_ALL, TRUE, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR - if(H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro, H5P_DATASET_XFER_DEFAULT)) + if(H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro, H5AC_dxpl_id)) FAIL_STACK_ERROR - if(H5O_msg_read(&oh_loc, H5O_MTIME_ID, &ro, H5P_DATASET_XFER_DEFAULT)) + if(H5O_msg_read(&oh_loc, H5O_MTIME_ID, &ro, H5AC_dxpl_id)) FAIL_STACK_ERROR PASSED(); @@ -495,23 +495,23 @@ main(void) */ TESTING("constant message handling"); time_new = 22222222; - if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, H5O_MSG_FLAG_CONSTANT, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, H5O_MSG_FLAG_CONSTANT, 0, &time_new, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR - if(H5AC_flush(f, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5AC_flush(f, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR - if(H5AC_expunge_entry(f, H5P_DATASET_XFER_DEFAULT, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0) + if(H5AC_expunge_entry(f, H5AC_dxpl_id, H5AC_OHDR, oh_loc.addr, H5AC__NO_FLAGS_SET) < 0) FAIL_STACK_ERROR - if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro, H5P_DATASET_XFER_DEFAULT)) + if(NULL == H5O_msg_read(&oh_loc, H5O_MTIME_NEW_ID, &ro, H5AC_dxpl_id)) FAIL_STACK_ERROR if(ro != time_new) TEST_ERROR time_new = 33333333; H5E_BEGIN_TRY { - ret = H5O_msg_write(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT); + ret = H5O_msg_write(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5AC_dxpl_id); } H5E_END_TRY; if(ret >= 0) TEST_ERROR - if(H5O_msg_remove(&oh_loc, H5O_MTIME_NEW_ID, H5O_ALL, TRUE, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_msg_remove(&oh_loc, H5O_MTIME_NEW_ID, H5O_ALL, TRUE, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR PASSED(); @@ -527,49 +527,49 @@ main(void) */ TESTING("locking messages"); HDmemset(&oh_loc, 0, sizeof(oh_loc)); - if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)64, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_loc/*out*/) < 0) + if(H5O_create(f, H5AC_dxpl_id, (size_t)64, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_loc/*out*/) < 0) FAIL_STACK_ERROR - if(1 != H5O_link(&oh_loc, 1, H5P_DATASET_XFER_DEFAULT)) + if(1 != H5O_link(&oh_loc, 1, H5AC_dxpl_id)) FAIL_STACK_ERROR /* Create second object header, to guarantee that first object header uses multiple chunks */ HDmemset(&oh_loc2, 0, sizeof(oh_loc2)); - if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)64, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_loc2/*out*/) < 0) + if(H5O_create(f, H5AC_dxpl_id, (size_t)64, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_loc2/*out*/) < 0) FAIL_STACK_ERROR - if(1 != H5O_link(&oh_loc2, 1, H5P_DATASET_XFER_DEFAULT)) + if(1 != H5O_link(&oh_loc2, 1, H5AC_dxpl_id)) FAIL_STACK_ERROR /* Fill object header with messages, creating multiple chunks */ for(i = 0; i < 10; i++) { time_new = (i + 1) * 1000 + 10; - if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR } /* end for */ /* Get # of object header chunks */ - if(H5O_get_hdr_info(&oh_loc, H5P_DATASET_XFER_DEFAULT, &hdr_info) < 0) + if(H5O_get_hdr_info(&oh_loc, H5AC_dxpl_id, &hdr_info) < 0) FAIL_STACK_ERROR if(hdr_info.nchunks != 2) TEST_ERROR /* Add message to lock to object header */ time_new = 11111111; - if(H5O_msg_create(&oh_loc, H5O_MTIME_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_msg_create(&oh_loc, H5O_MTIME_ID, 0, 0, &time_new, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR /* Verify chunk index for message */ - if((chunkno = H5O_msg_get_chunkno(&oh_loc, H5O_MTIME_ID, H5P_DATASET_XFER_DEFAULT)) < 0) + if((chunkno = H5O_msg_get_chunkno(&oh_loc, H5O_MTIME_ID, H5AC_dxpl_id)) < 0) FAIL_STACK_ERROR if(chunkno != 1) TEST_ERROR /* Lock the message into the chunk */ - if(H5O_msg_lock(&oh_loc, H5O_MTIME_ID, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_msg_lock(&oh_loc, H5O_MTIME_ID, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR /* Attempt to lock the message twice */ H5E_BEGIN_TRY { - ret = H5O_msg_lock(&oh_loc, H5O_MTIME_ID, H5P_DATASET_XFER_DEFAULT); + ret = H5O_msg_lock(&oh_loc, H5O_MTIME_ID, H5AC_dxpl_id); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -577,22 +577,22 @@ main(void) /* Delete all the other messages, which would move the message into * chunk #0, if it wasn't locked */ - if(H5O_msg_remove(&oh_loc, H5O_MTIME_NEW_ID, H5O_ALL, TRUE, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_msg_remove(&oh_loc, H5O_MTIME_NEW_ID, H5O_ALL, TRUE, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR /* Verify chunk index for message */ - if((chunkno = H5O_msg_get_chunkno(&oh_loc, H5O_MTIME_ID, H5P_DATASET_XFER_DEFAULT)) < 0) + if((chunkno = H5O_msg_get_chunkno(&oh_loc, H5O_MTIME_ID, H5AC_dxpl_id)) < 0) FAIL_STACK_ERROR if(chunkno != 1) TEST_ERROR /* Unlock the message */ - if(H5O_msg_unlock(&oh_loc, H5O_MTIME_ID, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_msg_unlock(&oh_loc, H5O_MTIME_ID, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR /* Attempt to unlock the message twice */ H5E_BEGIN_TRY { - ret = H5O_msg_unlock(&oh_loc, H5O_MTIME_ID, H5P_DATASET_XFER_DEFAULT); + ret = H5O_msg_unlock(&oh_loc, H5O_MTIME_ID, H5AC_dxpl_id); } H5E_END_TRY; if(ret >= 0) TEST_ERROR @@ -605,55 +605,55 @@ main(void) /* Open first object header */ HDmemset(&oh_loc, 0, sizeof(oh_loc)); - if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)64, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_loc/*out*/) < 0) + if(H5O_create(f, H5AC_dxpl_id, (size_t)64, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_loc/*out*/) < 0) FAIL_STACK_ERROR - if(1 != H5O_link(&oh_loc, 1, H5P_DATASET_XFER_DEFAULT)) + if(1 != H5O_link(&oh_loc, 1, H5AC_dxpl_id)) FAIL_STACK_ERROR /* Create second object header, to guarantee that first object header uses multiple chunks */ HDmemset(&oh_loc2, 0, sizeof(oh_loc2)); - if(H5O_create(f, H5P_DATASET_XFER_DEFAULT, (size_t)64, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_loc2/*out*/) < 0) + if(H5O_create(f, H5AC_dxpl_id, (size_t)64, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_loc2/*out*/) < 0) FAIL_STACK_ERROR - if(1 != H5O_link(&oh_loc2, 1, H5P_DATASET_XFER_DEFAULT)) + if(1 != H5O_link(&oh_loc2, 1, H5AC_dxpl_id)) FAIL_STACK_ERROR /* Add message to move to object header */ time_new = 11111111; - if(H5O_msg_create(&oh_loc, H5O_MTIME_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_msg_create(&oh_loc, H5O_MTIME_ID, 0, 0, &time_new, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR /* Verify chunk index for message */ - if((chunkno = H5O_msg_get_chunkno(&oh_loc, H5O_MTIME_ID, H5P_DATASET_XFER_DEFAULT)) < 0) + if((chunkno = H5O_msg_get_chunkno(&oh_loc, H5O_MTIME_ID, H5AC_dxpl_id)) < 0) FAIL_STACK_ERROR if(chunkno != 0) TEST_ERROR /* Lock the message into the chunk */ - if(H5O_msg_lock(&oh_loc, H5O_MTIME_ID, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_msg_lock(&oh_loc, H5O_MTIME_ID, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR /* Fill object header with messages, creating multiple chunks */ /* (would normally move locked message to new chunk) */ for(i = 0; i < 10; i++) { time_new = (i + 1) * 1000 + 10; - if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_msg_create(&oh_loc, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR } /* end for */ /* Get # of object header chunks */ - if(H5O_get_hdr_info(&oh_loc, H5P_DATASET_XFER_DEFAULT, &hdr_info) < 0) + if(H5O_get_hdr_info(&oh_loc, H5AC_dxpl_id, &hdr_info) < 0) FAIL_STACK_ERROR if(hdr_info.nchunks != 2) TEST_ERROR /* Verify chunk index for message */ - if((chunkno = H5O_msg_get_chunkno(&oh_loc, H5O_MTIME_ID, H5P_DATASET_XFER_DEFAULT)) < 0) + if((chunkno = H5O_msg_get_chunkno(&oh_loc, H5O_MTIME_ID, H5AC_dxpl_id)) < 0) FAIL_STACK_ERROR if(chunkno != 0) TEST_ERROR /* Unlock the message */ - if(H5O_msg_unlock(&oh_loc, H5O_MTIME_ID, H5P_DATASET_XFER_DEFAULT) < 0) + if(H5O_msg_unlock(&oh_loc, H5O_MTIME_ID, H5AC_dxpl_id) < 0) FAIL_STACK_ERROR /* Close object headers */ diff --git a/testpar/t_cache.c b/testpar/t_cache.c index b848827..bb16f41 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -3123,7 +3123,7 @@ insert_entry(H5C_t * cache_ptr, (entry_ptr->ver)++; entry_ptr->dirty = TRUE; - result = H5AC_insert_entry(file_ptr, H5P_DATASET_XFER_DEFAULT, &(types[0]), + result = H5AC_insert_entry(file_ptr, H5AC_dxpl_id, &(types[0]), entry_ptr->base_addr, (void *)(&(entry_ptr->header)), flags); if ( ( result < 0 ) || @@ -3522,7 +3522,7 @@ lock_entry(H5F_t * file_ptr, HDassert( ! (entry_ptr->locked) ); cache_entry_ptr = (H5C_cache_entry_t *)H5AC_protect(file_ptr, - H5P_DATASET_XFER_DEFAULT, + H5AC_dxpl_id, &(types[0]), entry_ptr->base_addr, &entry_ptr->base_addr, H5AC__NO_FLAGS_SET); @@ -3819,7 +3819,7 @@ move_entry(H5F_t * file_ptr, new_entry_ptr->local_len = tmp_len; } /* end if */ - result = H5AC_move_entry(file_ptr, &(types[0]), old_addr, new_addr); + result = H5AC_move_entry(file_ptr, &(types[0]), old_addr, new_addr, H5AC_dxpl_id); if ( ( result < 0 ) || ( old_entry_ptr->header.addr != new_addr ) ) { @@ -4202,7 +4202,7 @@ setup_cache_for_test(hid_t * fid_ptr, */ if ( success ) { /* allocate space for test entries */ - actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, H5P_DATASET_XFER_DEFAULT, + actual_base_addr = H5MF_alloc(file_ptr, H5FD_MEM_DEFAULT, H5AC_dxpl_id, (hsize_t)(max_addr + BASE_ADDR)); if ( actual_base_addr == HADDR_UNDEF ) { @@ -4985,7 +4985,7 @@ unlock_entry(H5F_t * file_ptr, entry_ptr->dirty = TRUE; } - result = H5AC_unprotect(file_ptr, H5P_DATASET_XFER_DEFAULT, &(types[0]), + result = H5AC_unprotect(file_ptr, H5AC_dxpl_id, &(types[0]), entry_ptr->base_addr, (void *)(&(entry_ptr->header)), flags); if ( ( result < 0 ) || diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c index 817f583..37b0c3d 100644 --- a/tools/misc/h5debug.c +++ b/tools/misc/h5debug.c @@ -306,13 +306,13 @@ main(int argc, char *argv[]) /* * Debug a local heap. */ - status = H5HL_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL); + status = H5HL_debug(f, H5AC_dxpl_id, addr, stdout, 0, VCOL); } else if(!HDmemcmp (sig, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* * Debug a global heap collection. */ - status = H5HG_debug (f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL); + status = H5HG_debug (f, H5AC_dxpl_id, addr, stdout, 0, VCOL); } else if(!HDmemcmp(sig, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -326,7 +326,7 @@ main(int argc, char *argv[]) HDfprintf(stderr, "\th5debug
\n\n"); } /* end if */ - status = H5G_node_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra); + status = H5G_node_debug(f, H5AC_dxpl_id, addr, stdout, 0, VCOL, extra); } else if(!HDmemcmp(sig, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -348,7 +348,7 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5G_node_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra); + status = H5G_node_debug(f, H5AC_dxpl_id, addr, stdout, 0, VCOL, extra); break; case H5B_CHUNK_ID: @@ -386,7 +386,7 @@ main(int argc, char *argv[]) /* Set the last dimension (the element size) to zero */ dim[ndims] = 0; - status = H5D_btree_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, ndims, dim); + status = H5D_btree_debug(f, H5AC_dxpl_id, addr, stdout, 0, VCOL, ndims, dim); break; case H5B_NUM_BTREE_ID: @@ -402,7 +402,7 @@ main(int argc, char *argv[]) const H5B2_class_t *cls = get_H5B2_class(sig); HDassert(cls); - status = H5B2__hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, (haddr_t)extra); + status = H5B2__hdr_debug(f, H5AC_dxpl_id, addr, stdout, 0, VCOL, cls, (haddr_t)extra); } else if(!HDmemcmp(sig, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -420,7 +420,7 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5B2__int_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, (unsigned)extra3, (haddr_t)extra4); + status = H5B2__int_debug(f, H5AC_dxpl_id, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, (unsigned)extra3, (haddr_t)extra4); } else if(!HDmemcmp(sig, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -437,13 +437,13 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5B2__leaf_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, (haddr_t)extra3); + status = H5B2__leaf_debug(f, H5AC_dxpl_id, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, (haddr_t)extra3); } else if(!HDmemcmp(sig, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* * Debug a fractal heap header. */ - status = H5HF_hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL); + status = H5HF_hdr_debug(f, H5AC_dxpl_id, addr, stdout, 0, VCOL); } else if(!HDmemcmp(sig, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -458,7 +458,7 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5HF_dblock_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra, (size_t)extra2); + status = H5HF_dblock_debug(f, H5AC_dxpl_id, addr, stdout, 0, VCOL, extra, (size_t)extra2); } else if(!HDmemcmp(sig, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -473,14 +473,14 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5HF_iblock_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra, (unsigned)extra2); + status = H5HF_iblock_debug(f, H5AC_dxpl_id, addr, stdout, 0, VCOL, extra, (unsigned)extra2); } else if(!HDmemcmp(sig, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* * Debug a free space header. */ - status = H5FS_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL); + status = H5FS_debug(f, H5AC_dxpl_id, addr, stdout, 0, VCOL); } else if(!HDmemcmp(sig, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -495,14 +495,14 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5FS_sects_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra, extra2); + status = H5FS_sects_debug(f, H5AC_dxpl_id, addr, stdout, 0, VCOL, extra, extra2); } else if(!HDmemcmp(sig, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* * Debug shared message master table. */ - status = H5SM_table_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, (unsigned) UFAIL, (unsigned) UFAIL); + status = H5SM_table_debug(f, H5AC_dxpl_id, addr, stdout, 0, VCOL, (unsigned) UFAIL, (unsigned) UFAIL); } else if(!HDmemcmp(sig, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -517,7 +517,7 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5SM_list_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, (haddr_t)extra); + status = H5SM_list_debug(f, H5AC_dxpl_id, addr, stdout, 0, VCOL, (haddr_t)extra); } else if(!HDmemcmp(sig, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -534,7 +534,7 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5EA__hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra); + status = H5EA__hdr_debug(f, H5AC_dxpl_id, addr, stdout, 0, VCOL, cls, extra); } else if(!HDmemcmp(sig, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -551,7 +551,7 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5EA__iblock_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra, extra2); + status = H5EA__iblock_debug(f, H5AC_dxpl_id, addr, stdout, 0, VCOL, cls, extra, extra2); } else if(!HDmemcmp(sig, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -568,7 +568,7 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5EA__sblock_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, extra3); + status = H5EA__sblock_debug(f, H5AC_dxpl_id, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, extra3); } else if(!HDmemcmp(sig, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -585,7 +585,7 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5EA__dblock_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra, (size_t)extra2, extra3); + status = H5EA__dblock_debug(f, H5AC_dxpl_id, addr, stdout, 0, VCOL, cls, extra, (size_t)extra2, extra3); } else if(!HDmemcmp(sig, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -602,7 +602,7 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5FA__hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra); + status = H5FA__hdr_debug(f, H5AC_dxpl_id, addr, stdout, 0, VCOL, cls, extra); } else if(!HDmemcmp(sig, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -619,21 +619,21 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5FA__dblock_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra, extra2); + status = H5FA__dblock_debug(f, H5AC_dxpl_id, addr, stdout, 0, VCOL, cls, extra, extra2); } else if(!HDmemcmp(sig, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* * Debug v2 object header (which have signatures). */ - status = H5O_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL); + status = H5O_debug(f, H5AC_dxpl_id, addr, stdout, 0, VCOL); } else if(sig[0] == H5O_VERSION_1) { /* * This could be a v1 object header. Since they don't have a signature * it's a somewhat "ify" detection. */ - status = H5O_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL); + status = H5O_debug(f, H5AC_dxpl_id, addr, stdout, 0, VCOL); } else { /* -- cgit v0.12 From c418bc964d20d4603eaa830051bfab8ebed0f55c Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Mon, 8 Feb 2016 09:01:29 -0500 Subject: [svn-r29062] HDFFV-9564: Implement VDS Fortran wrappers. Tested: h5committest.new --- MANIFEST | 1 + fortran/src/CMakeLists.txt | 1 + fortran/src/H5Dff.F90 | 2 +- fortran/src/H5Eff.F90 | 2 +- fortran/src/H5Fff.F90 | 2 +- fortran/src/H5Gff.F90 | 2 +- fortran/src/H5Off.F90 | 2 +- fortran/src/H5Pff.F90 | 517 ++++++++++++++++++++++++++++++++++- fortran/src/H5Rff.F90 | 2 +- fortran/src/H5Sff.F90 | 118 +++++++- fortran/src/H5_buildiface.F90 | 2 +- fortran/src/H5_f.c | 4 + fortran/src/H5f90.h | 2 +- fortran/src/H5f90global.F90 | 23 +- fortran/src/H5fortkit.F90 | 58 ++++ fortran/src/HDF5.F90 | 2 +- fortran/src/Makefile.am | 6 +- fortran/src/hdf5_fortrandll.def.in | 12 + fortran/test/fortranlib_test_F03.F90 | 8 + fortran/test/tH5P_F03.F90 | 472 ++++++++++++++++++++++++++++++++ 20 files changed, 1219 insertions(+), 19 deletions(-) create mode 100644 fortran/src/H5fortkit.F90 diff --git a/MANIFEST b/MANIFEST index 7b0501d..8fffaad 100644 --- a/MANIFEST +++ b/MANIFEST @@ -216,6 +216,7 @@ ./fortran/src/H5f90global.F90 ./fortran/src/H5f90i.h ./fortran/src/H5f90kit.c +./fortran/src/H5fortkit.F90 ./fortran/src/H5f90proto.h ./fortran/src/H5match_types.c ./fortran/src/HDF5.F90 diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index dc884d5..5854f75 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -161,6 +161,7 @@ set (f90_F_BASE_SRCS # normal distribution ${HDF5_F90_SRC_SOURCE_DIR}/H5f90global.F90 + ${HDF5_F90_SRC_SOURCE_DIR}/H5fortkit.F90 ${HDF5_F90_SRC_SOURCE_DIR}/H5_ff.F90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Aff.F90 ${HDF5_F90_SRC_SOURCE_DIR}/H5Dff.F90 diff --git a/fortran/src/H5Dff.F90 b/fortran/src/H5Dff.F90 index e44d90e..b372dc1 100644 --- a/fortran/src/H5Dff.F90 +++ b/fortran/src/H5Dff.F90 @@ -4,7 +4,7 @@ ! MODULE H5D ! ! FILE -! fortran/src/H5Dff.f90 +! fortran/src/H5Dff.F90 ! ! PURPOSE ! This file contains Fortran interfaces for H5D functions. diff --git a/fortran/src/H5Eff.F90 b/fortran/src/H5Eff.F90 index a2efe61..7a0b15b 100644 --- a/fortran/src/H5Eff.F90 +++ b/fortran/src/H5Eff.F90 @@ -4,7 +4,7 @@ ! MODULE H5E ! ! FILE -! fortran/src/H5Eff.f90 +! fortran/src/H5Eff.F90 ! ! PURPOSE ! This Module contains Fortran interfaces for H5E functions. diff --git a/fortran/src/H5Fff.F90 b/fortran/src/H5Fff.F90 index c69ad82..165fba0 100644 --- a/fortran/src/H5Fff.F90 +++ b/fortran/src/H5Fff.F90 @@ -4,7 +4,7 @@ ! MODULE H5F ! ! FILE -! H5Fff.f90 +! H5Fff.F90 ! ! PURPOSE ! This file contains Fortran interfaces for H5F functions. diff --git a/fortran/src/H5Gff.F90 b/fortran/src/H5Gff.F90 index 2e002b5..30076a4 100644 --- a/fortran/src/H5Gff.F90 +++ b/fortran/src/H5Gff.F90 @@ -4,7 +4,7 @@ ! MODULE H5G ! ! FILE -! fortran/src/H5Gff.f90 +! fortran/src/H5Gff.F90 ! ! PURPOSE ! This file contains Fortran interfaces for H5G functions. diff --git a/fortran/src/H5Off.F90 b/fortran/src/H5Off.F90 index da940df..8d4fb16 100644 --- a/fortran/src/H5Off.F90 +++ b/fortran/src/H5Off.F90 @@ -4,7 +4,7 @@ ! MODULE H5O ! ! FILE -! fortran/src/H5Off.f90 +! fortran/src/H5Off.F90 ! ! PURPOSE ! This file contains Fortran interfaces for H5O functions. diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index 97f907b..6c6abe4 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -42,7 +42,8 @@ MODULE H5P USE, INTRINSIC :: ISO_C_BINDING USE H5GLOBAL - + USE H5fortkit + INTERFACE h5pset_fapl_multi_f MODULE PROCEDURE h5pset_fapl_multi_l MODULE PROCEDURE h5pset_fapl_multi_s @@ -7321,6 +7322,520 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) END SUBROUTINE h5pget_mpio_actual_io_mode_f #endif +! +! V I R T U A L D A T S E T S +! + +!****s* +! NAME +! h5pset_virtual_view_f +! +! PURPOSE +! Sets the view of the virtual dataset (VDS) to include or exclude missing mapped elements. +! +! INPUTS +! dapl_id - Identifier of the virtual dataset access property list. +! view - Flag specifying the extent of the data to be included in the view. +! Valid values are: +! H5D_VDS_FIRST_MISSING_F +! H5D_VDS_LAST_AVAILABLE_F +! +! OUTPUTS +! +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! Nov 2, 2015 +! +! +! SOURCE + SUBROUTINE h5pset_virtual_view_f(dapl_id, view, hdferr) + IMPLICIT NONE + + INTEGER(HID_T), INTENT(IN) :: dapl_id + INTEGER , INTENT(IN) :: view + INTEGER , INTENT(OUT) :: hdferr + +!***** + INTERFACE + INTEGER FUNCTION h5pset_virtual_view(dapl_id, view) BIND(C,NAME='H5Pset_virtual_view') + IMPORT :: HID_T, ENUM_T + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: dapl_id + INTEGER(ENUM_T), INTENT(IN), VALUE :: view + END FUNCTION h5pset_virtual_view + END INTERFACE + + hdferr = INT( h5pset_virtual_view(dapl_id, INT(view,ENUM_T)) ) + + END SUBROUTINE h5pset_virtual_view_f + +!****s* +! NAME +! h5pget_virtual_view_f +! +! PURPOSE +! Retrieves the view of a virtual dataset accessed with dapl_id. +! +! INPUTS +! dapl_id - Dataset access property list identifier for the virtual dataset +! +! OUTPUTS +! view - The flag specifying the view of the virtual dataset. +! Valid values are: +! H5D_VDS_FIRST_MISSING_F +! H5D_VDS_LAST_AVAILABLE_F +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! Nov 2, 2015 +! +! SOURCE + SUBROUTINE h5pget_virtual_view_f(dapl_id, view, hdferr) + IMPLICIT NONE + + INTEGER(HID_T), INTENT(IN) :: dapl_id + INTEGER , INTENT(INOUT) :: view + INTEGER , INTENT(OUT) :: hdferr +!***** + INTEGER(ENUM_T) :: view_enum + INTERFACE + INTEGER FUNCTION h5pget_virtual_view(dapl_id, view) BIND(C,NAME='H5Pget_virtual_view') + IMPORT :: HID_T, ENUM_T + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: dapl_id + INTEGER(ENUM_T), INTENT(OUT) :: view + END FUNCTION h5pget_virtual_view + END INTERFACE + + hdferr = INT( h5pget_virtual_view(dapl_id, view_enum) ) + view = INT(view_enum) + + END SUBROUTINE h5pget_virtual_view_f + +!****s* +! NAME +! h5pset_virtual_printf_gap_f +! +! PURPOSE +! Sets the maximum number of missing source files and/or datasets with the printf-style names +! when getting the extent of an unlimited virtual dataset. +! +! INPUTS +! dapl_id - Dataset access property list identifier for the virtual dataset. +! gap_size - Maximum number of files and/or datasets allowed to be missing for determining +! the extent of an unlimited virtual dataset with printf-style mappings. +! +! OUTPUTS +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! Nov 2, 2015 +! +! HISTORY +! +! SOURCE + SUBROUTINE h5pset_virtual_printf_gap_f(dapl_id, gap_size, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: dapl_id + INTEGER(HSIZE_T), INTENT(IN) :: gap_size + INTEGER , INTENT(OUT) :: hdferr +!***** + INTERFACE + INTEGER FUNCTION h5pset_virtual_printf_gap(dapl_id, gap_size) BIND(C,NAME='H5Pset_virtual_printf_gap') + IMPORT :: HID_T, HSIZE_T + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: dapl_id + INTEGER(HSIZE_T), INTENT(IN), VALUE :: gap_size + END FUNCTION h5pset_virtual_printf_gap + END INTERFACE + + hdferr = INT( h5pset_virtual_printf_gap(dapl_id, gap_size) ) + + END SUBROUTINE h5pset_virtual_printf_gap_f + +!****s* +! NAME +! h5pget_virtual_printf_gap_f +! +! PURPOSE +! Returns the maximum number of missing source files and/or datasets with the +! printf-style names when getting the extent for an unlimited virtual dataset. +! +! INPUTS +! dapl_id - Dataset access property list identifier for the virtual dataset +! +! OUTPUTS +! gap_size - Maximum number of the files and/or datasets allowed to be missing for +! determining the extent of an unlimited virtual dataset with printf-style mappings. +! hdferr - Returns 0 if successful and -1 if fails +! +! AUTHOR +! M. Scot Breitenfeld +! Nov 2, 2015 +! +! HISTORY +! +! SOURCE + SUBROUTINE h5pget_virtual_printf_gap_f(dapl_id, gap_size, hdferr) + IMPLICIT NONE + + INTEGER(HID_T) , INTENT(IN) :: dapl_id + INTEGER(HSIZE_T), INTENT(OUT) :: gap_size + INTEGER , INTENT(OUT) :: hdferr +!***** + INTERFACE + INTEGER FUNCTION h5pget_virtual_printf_gap(dapl_id, gap_size) BIND(C,NAME='H5Pget_virtual_printf_gap') + IMPORT :: HID_T, HSIZE_T + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: dapl_id + INTEGER(HSIZE_T), INTENT(OUT) :: gap_size + END FUNCTION h5pget_virtual_printf_gap + END INTERFACE + + hdferr = INT( h5pget_virtual_printf_gap(dapl_id, gap_size) ) + + END SUBROUTINE h5pget_virtual_printf_gap_f + +!****s* +! NAME +! h5pset_virtual_f +! +! PURPOSE +! Sets the mapping between virtual and source datasets. +! +! INPUTS +! dcpl_id - The identifier of the dataset creation property list that will be +! used when creating the virtual dataset. +! vspace_id - The dataspace identifier with the selection within the virtual +! dataset applied, possibly an unlimited selection. +! src_file_name - The name of the HDF5 file where the source dataset is located. +! src_dset_name - The path to the HDF5 dataset in the file specified by src_file_name. +! src_space_id - The source dataset’s dataspace identifier with a selection applied, possibly an unlimited selection +! +! OUTPUTS +! hdferr - Returns 0 if successful and -1 if fails + +! AUTHOR +! M. Scot Breitenfeld +! Nov 2, 2015 +! +! HISTORY +! +! SOURCE + SUBROUTINE h5pset_virtual_f(dcpl_id, vspace_id, src_file_name, src_dset_name, src_space_id, hdferr) + IMPLICIT NONE + + INTEGER(HID_T), INTENT(IN) :: dcpl_id + INTEGER(HID_T), INTENT(IN) :: vspace_id + CHARACTER(LEN=*), INTENT(IN) :: src_file_name + CHARACTER(LEN=*), INTENT(IN) :: src_dset_name + INTEGER(HID_T), INTENT(IN) :: src_space_id + INTEGER, INTENT(OUT) :: hdferr +!***** + CHARACTER(LEN=LEN_TRIM(src_file_name)+1,KIND=C_CHAR) :: c_src_file_name + CHARACTER(LEN=LEN_TRIM(src_dset_name)+1,KIND=C_CHAR) :: c_src_dset_name + + INTERFACE + INTEGER FUNCTION h5pset_virtual(dcpl_id, vspace_id, c_src_file_name, c_src_dset_name, src_space_id) & + BIND(C,NAME='H5Pset_virtual') + IMPORT :: C_CHAR + IMPORT :: HID_T + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: dcpl_id + INTEGER(HID_T), INTENT(IN), VALUE :: vspace_id + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: c_src_file_name + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(IN) :: c_src_dset_name + INTEGER(HID_T), INTENT(IN), VALUE :: src_space_id + END FUNCTION h5pset_virtual + END INTERFACE + + c_src_file_name = TRIM(src_file_name)//C_NULL_CHAR + c_src_dset_name = TRIM(src_dset_name)//C_NULL_CHAR + + hdferr = h5pset_virtual(dcpl_id, vspace_id, c_src_file_name, c_src_dset_name, src_space_id) + + END SUBROUTINE h5pset_virtual_f + +!****s* +! NAME +! h5pget_virtual_count_f +! +! PURPOSE +! Gets the number of mappings for the virtual dataset. +! +! INPUTS +! dcpl_id - The identifier of the virtual dataset creation property list. +! +! OUTPUTS +! count - The number of mappings. +! hdferr - Returns 0 if successful and -1 if fails +! AUTHOR +! M. Scot Breitenfeld +! Nov 2, 2015 +! +! HISTORY +! +! SOURCE + SUBROUTINE h5pget_virtual_count_f(dcpl_id, count, hdferr) + + IMPLICIT NONE + + INTEGER(HID_T), INTENT(IN) :: dcpl_id + INTEGER(SIZE_T), INTENT(OUT) :: count + INTEGER, INTENT(OUT) :: hdferr +!***** + INTERFACE + INTEGER(HID_T) FUNCTION h5pget_virtual_count(dcpl_id, count) BIND(C,NAME='H5Pget_virtual_count') + IMPORT :: HID_T, SIZE_T + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN), VALUE :: dcpl_id + INTEGER(SIZE_T), INTENT(OUT) :: count + END FUNCTION h5pget_virtual_count + END INTERFACE + + hdferr = INT( h5pget_virtual_count(dcpl_id, count)) + + END SUBROUTINE h5pget_virtual_count_f + +!****s* +! NAME +! h5pget_virtual_vspace_f +! +! PURPOSE +! Gets a dataspace identifier for the selection within the virtual dataset used in the mapping. +! +! INPUTS +! dcpl_id - The identifier of the virtual dataset creation property list. +! index - Mapping index. +! The value of index is 0 (zero) or greater and less than count (0 ≤ index < count), +! where count is the number of mappings returned by h5pget_virtual_count. +! +! OUTPUTS +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! Nov 2, 2015 +! +! HISTORY +! +! SOURCE + SUBROUTINE h5pget_virtual_vspace_f(dcpl_id, index, ds_id, hdferr) + IMPLICIT NONE + + INTEGER(HID_T) , INTENT(IN) :: dcpl_id + INTEGER(SIZE_T), INTENT(IN) :: index + INTEGER(HID_T) , INTENT(OUT) :: ds_id + INTEGER, INTENT(OUT) :: hdferr + +!***** + INTERFACE + INTEGER(HID_T) FUNCTION h5pget_virtual_vspace(dcpl_id, index) BIND(C,NAME='H5Pget_virtual_vspace') + IMPORT :: HID_T, SIZE_T + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN), VALUE :: dcpl_id + INTEGER(SIZE_T), INTENT(IN), VALUE :: index + END FUNCTION h5pget_virtual_vspace + END INTERFACE + + ds_id = h5pget_virtual_vspace(dcpl_id, index) + + hdferr = 0 + IF(ds_id.LT.0) hdferr = -1 + +END SUBROUTINE h5pget_virtual_vspace_f + +!****s* +! NAME +! h5pget_virtual_srcspace_f +! +! PURPOSE +! Gets a dataspace identifier for the selection within the source dataset used in the mapping. +! +! INPUTS +! dcpl_id - The identifier of the virtual dataset creation property list. +! index - Mapping index. +! The value of index is 0 (zero) or greater and less than count (0 ≤ index < count), +! where count is the number of mappings returned by h5pget_virtual_count. +! +! +! OUTPUTS +! ds_id - dataspace identifier +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! Nov 2, 2015 +! +! HISTORY +! +! SOURCE +SUBROUTINE h5pget_virtual_srcspace_f(dcpl_id, index, ds_id, hdferr) + IMPLICIT NONE + + INTEGER(HID_T) , INTENT(IN) :: dcpl_id + INTEGER(SIZE_T), INTENT(IN) :: index + INTEGER(HID_T) , INTENT(OUT) :: ds_id + INTEGER, INTENT(OUT) :: hdferr + +!***** + INTERFACE + INTEGER(HID_T) FUNCTION h5pget_virtual_srcspace(dcpl_id, index) BIND(C,NAME='H5Pget_virtual_srcspace') + IMPORT :: HID_T, SIZE_T + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN), VALUE :: dcpl_id + INTEGER(SIZE_T), INTENT(IN), VALUE :: index + END FUNCTION h5pget_virtual_srcspace + END INTERFACE + + ds_id = h5pget_virtual_srcspace(dcpl_id, index) + + hdferr = 0 + IF(ds_id.LT.0) hdferr = -1 + +END SUBROUTINE h5pget_virtual_srcspace_f + +!****s* +! NAME +! h5pget_virtual_filename_f +! +! PURPOSE +! Gets the filename of a source dataset used in the mapping. +! +! INPUTS +! dcpl_id - The identifier of the virtual dataset creation property list. +! index - Mapping index. +! The value of index is 0 (zero) or greater and less than count (0 ≤ index < count), +! where count is the number of mappings returned by h5pget_virtual_count. +! +! OUTPUTS +! name - A buffer containing the name of the file containing the source dataset. +! hdferr - Returns 0 if successful and -1 if fails. +! +! Optional parameters: +! name_len - The size of name needed to hold the filename. (OUT) +! +! AUTHOR +! M. Scot Breitenfeld +! Nov 2, 2015 +! +! HISTORY +! +! SOURCE +SUBROUTINE h5pget_virtual_filename_f(dcpl_id, index, name, hdferr, name_len) + + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: dcpl_id + INTEGER(SIZE_T) , INTENT(IN) :: index + CHARACTER(LEN=*), INTENT(OUT) :: name + INTEGER, INTENT(OUT) :: hdferr + INTEGER(SIZE_T), OPTIONAL :: name_len +!***** + + CHARACTER(LEN=1,KIND=C_CHAR), DIMENSION(1:LEN(name)+1), TARGET :: c_name + TYPE(C_PTR) :: f_ptr + + INTERFACE + INTEGER(SIZE_T) FUNCTION h5pget_virtual_filename(dcpl_id, index, name, size) BIND(C, NAME='H5Pget_virtual_filename') + IMPORT :: HID_T, SIZE_T, C_PTR, C_CHAR + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN), VALUE :: dcpl_id + INTEGER(SIZE_T), INTENT(IN), VALUE :: index + TYPE(C_PTR), VALUE :: name + INTEGER(SIZE_T), INTENT(IN), VALUE :: size + END FUNCTION h5pget_virtual_filename + END INTERFACE + + hdferr = 0 + IF(PRESENT(name_len))THEN + name_len = INT(h5pget_virtual_filename(dcpl_id, index, C_NULL_PTR, 0_SIZE_T), SIZE_T) + IF(name_len.LT.0) hdferr = -1 + ELSE + f_ptr = C_LOC(c_name(1)(1:1)) + + IF(INT(h5pget_virtual_filename(dcpl_id, index, f_ptr, INT(LEN(name)+1,SIZE_T)), SIZE_T).LT.0)THEN + hdferr = -1 + ELSE + CALL HD5c2fstring(name,c_name,LEN(name)) + ENDIF + + ENDIF + + +END SUBROUTINE h5pget_virtual_filename_f + +!****s* +! NAME +! h5pget_virtual_dsetname_f +! +! PURPOSE +! Gets the name of a source dataset used in the mapping. +! +! INPUTS +! dcpl_id - The identifier of the virtual dataset creation property list. +! index - Mapping index. +! The value of index is 0 (zero) or greater and less than count (0 ≤ index < count), +! where count is the number of mappings returned by h5pget_virtual_count. +! +! OUTPUTS +! name - A buffer containing the name of the source dataset. +! hdferr - Returns 0 if successful and -1 if fails. +! +! Optional parameters: +! name_len - The size of name needed to hold the source dataset name. (OUT) +! +! AUTHOR +! M. Scot Breitenfeld +! January 28, 2016 +! +! HISTORY +! +! SOURCE +SUBROUTINE h5pget_virtual_dsetname_f(dcpl_id, index, name, hdferr, name_len) + + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: dcpl_id + INTEGER(SIZE_T) , INTENT(IN) :: index + CHARACTER(LEN=*), INTENT(OUT) :: name + INTEGER, INTENT(OUT) :: hdferr + INTEGER(SIZE_T), OPTIONAL :: name_len +!***** + + CHARACTER(LEN=1,KIND=C_CHAR), DIMENSION(1:LEN(name)+1), TARGET :: c_name + TYPE(C_PTR) :: f_ptr + + INTERFACE + INTEGER(SIZE_T) FUNCTION h5pget_virtual_dsetname(dcpl_id, index, name, size) BIND(C, NAME='H5Pget_virtual_dsetname') + IMPORT :: HID_T, SIZE_T, C_PTR, C_CHAR + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN), VALUE :: dcpl_id + INTEGER(SIZE_T), INTENT(IN), VALUE :: index + TYPE(C_PTR), VALUE :: name + INTEGER(SIZE_T), INTENT(IN), VALUE :: size + END FUNCTION h5pget_virtual_dsetname + END INTERFACE + + hdferr = 0 + IF(PRESENT(name_len))THEN + name_len = INT(h5pget_virtual_dsetname(dcpl_id, index, C_NULL_PTR, 0_SIZE_T), SIZE_T) + IF(name_len.LT.0) hdferr = -1 + ELSE + f_ptr = C_LOC(c_name(1)(1:1)) + + IF(INT(h5pget_virtual_dsetname(dcpl_id, index, f_ptr, INT(LEN(name)+1,SIZE_T)), SIZE_T).LT.0)THEN + hdferr = -1 + ELSE + CALL HD5c2fstring(name,c_name,LEN(name)) + ENDIF + + ENDIF + +END SUBROUTINE h5pget_virtual_dsetname_f + END MODULE H5P diff --git a/fortran/src/H5Rff.F90 b/fortran/src/H5Rff.F90 index a90bd9a..7ba91c4 100644 --- a/fortran/src/H5Rff.F90 +++ b/fortran/src/H5Rff.F90 @@ -4,7 +4,7 @@ ! MODULE H5R ! ! FILE -! fortran/src/H5Rff.f90 +! fortran/src/H5Rff.F90 ! ! PURPOSE ! This file contains Fortran interfaces for H5R functions. diff --git a/fortran/src/H5Sff.F90 b/fortran/src/H5Sff.F90 index fd4226c..e9b9b73 100644 --- a/fortran/src/H5Sff.F90 +++ b/fortran/src/H5Sff.F90 @@ -4,7 +4,7 @@ ! MODULE H5S ! ! FILE -! fortran/src/H5Sff.f90 +! fortran/src/H5Sff.F90 ! ! PURPOSE ! This file contains Fortran interfaces for H5S functions. @@ -41,7 +41,7 @@ !***** MODULE H5S - USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR, C_CHAR + USE, INTRINSIC :: ISO_C_BINDING, ONLY : C_PTR, C_CHAR, C_INT USE H5GLOBAL CONTAINS @@ -1751,4 +1751,118 @@ CONTAINS END SUBROUTINE h5sextent_equal_f +! +!****s* H5S/h5sget_regular_hyperslab_f +! +! NAME +! h5sget_regular_hyperslab_f +! +! PURPOSE +! Retrieves a regular hyperslab selection. +! +! INPUTS +! space_id - The identifier of the dataspace. +! OUTPUTS +! start - Offset of the start of the regular hyperslab. +! stride - Stride of the regular hyperslab. +! count - Number of blocks in the regular hyperslab. +! block - Size of a block in the regular hyperslab. +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! January, 28 2016 +! SOURCE + SUBROUTINE h5sget_regular_hyperslab_f(space_id, start, stride, count, block, hdferr) + + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id + INTEGER(HSIZE_T), INTENT(OUT), DIMENSION(*), TARGET :: start + INTEGER(HSIZE_T), INTENT(OUT), DIMENSION(*), TARGET :: stride + INTEGER(HSIZE_T), INTENT(OUT), DIMENSION(*), TARGET :: count + INTEGER(HSIZE_T), INTENT(OUT), DIMENSION(*), TARGET :: block + INTEGER, INTENT(OUT) :: hdferr +!***** + TYPE(C_PTR) :: start_c, stride_c, count_c, block_c + INTEGER(C_INT) :: n + + INTERFACE + INTEGER FUNCTION h5sget_regular_hyperslab(space_id, start, stride, count, block) BIND(C,NAME='H5Sget_regular_hyperslab') + IMPORT :: HID_T, C_PTR + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: space_id + TYPE(C_PTR), VALUE :: start, stride, count, block + END FUNCTION h5sget_regular_hyperslab + END INTERFACE + + hdferr = 0 + + start_c = C_LOC(start(1)) + stride_c = C_LOC(stride(1)) + count_c = C_LOC(count(1)) + block_c = C_LOC(block(1)) + + IF(INT(h5sget_regular_hyperslab(space_id, start_c, stride_c, count_c, block_c)).LT.0) hdferr = -1 + + ! Reverse the C arrays description values of the hyperslab because + ! the hyperslab was for a C stored hyperslab + + CALL H5Sget_simple_extent_ndims_f(space_id,n,hdferr) + IF(hdferr.LT.0.OR.n.EQ.0)THEN + hdferr=-1 + ELSE + start(1:n) = start(n:1:-1) + stride(1:n) = stride(n:1:-1) + count(1:n) = count(n:1:-1) + block(1:n) = block(n:1:-1) + ENDIF + + END SUBROUTINE h5sget_regular_hyperslab_f + +!****s* H5S/h5sis_regular_hyperslab_f +! +! NAME +! h5sis_regular_hyperslab_f +! +! PURPOSE +! Retrieves a regular hyperslab selection. +! +! INPUTS +! space_id - The identifier of the dataspace. +! OUTPUTS +! IsRegular - TRUE or FALSE for hyperslab selection if successful. +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! January, 28 2016 +! SOURCE + SUBROUTINE h5sis_regular_hyperslab_f(space_id, IsRegular, hdferr) + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN) :: space_id + LOGICAL :: IsRegular + INTEGER, INTENT(OUT) :: hdferr +!***** + INTEGER(C_INT) :: status + + INTERFACE + INTEGER(C_INT) FUNCTION H5Sis_regular_hyperslab(space_id) BIND(C,NAME='H5Sis_regular_hyperslab') + IMPORT :: HID_T, C_INT + IMPLICIT NONE + INTEGER(HID_T), INTENT(IN), VALUE :: space_id + END FUNCTION H5Sis_regular_hyperslab + END INTERFACE + + status = H5Sis_regular_hyperslab(space_id) + + hdferr = 0 + IsRegular = .FALSE. + IF(status.GT.0)THEN + IsRegular = .TRUE. + ELSE IF(status.LT.0)THEN + hdferr = -1 + ENDIF + + END SUBROUTINE H5Sis_regular_hyperslab_f + END MODULE H5S diff --git a/fortran/src/H5_buildiface.F90 b/fortran/src/H5_buildiface.F90 index 9a42cbf..471052f 100644 --- a/fortran/src/H5_buildiface.F90 +++ b/fortran/src/H5_buildiface.F90 @@ -4,7 +4,7 @@ ! Executable: H5_buildiface ! ! FILE -! fortran/src/H5_buildiface.f90 +! fortran/src/H5_buildiface.F90 ! ! PURPOSE ! This stand alone program is used at build time to generate the module diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index f3bc42f..d7b952d 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -476,6 +476,10 @@ h5init_flags_c( int_f *h5d_flags, size_t_f *h5d_size_flags, h5d_flags[22] = (int_f)H5D_MPIO_CHUNK_COLLECTIVE; h5d_flags[23] = (int_f)H5D_MPIO_CHUNK_MIXED; h5d_flags[24] = (int_f)H5D_MPIO_CONTIGUOUS_COLLECTIVE; + h5d_flags[25] = (int_f)H5D_VDS_ERROR; + h5d_flags[26] = (int_f)H5D_VDS_FIRST_MISSING; + h5d_flags[27] = (int_f)H5D_VDS_LAST_AVAILABLE; + h5d_flags[28] = (int_f)H5D_VIRTUAL; /* * H5E flags diff --git a/fortran/src/H5f90.h b/fortran/src/H5f90.h index c45cfcb..7082d1d 100644 --- a/fortran/src/H5f90.h +++ b/fortran/src/H5f90.h @@ -22,7 +22,7 @@ #include "H5f90i.h" #include "H5f90proto.h" -/* Constants used in H5Rff.f90 and H5Rf.c files */ +/* Constants used in H5Rff.F90 and H5Rf.c files */ #define REF_REG_BUF_LEN_F 3 /* Constants used in H5Gf.c files */ diff --git a/fortran/src/H5f90global.F90 b/fortran/src/H5f90global.F90 index 947eff4..ac59251 100644 --- a/fortran/src/H5f90global.F90 +++ b/fortran/src/H5f90global.F90 @@ -4,7 +4,7 @@ ! MODULE H5GLOBAL ! ! FILE -! src/fortran/H5f90global.f90 +! src/fortran/H5f90global.F90 ! ! PURPOSE ! This module is used to pass C stubs for H5 Fortran APIs. The C stubs are @@ -46,12 +46,19 @@ MODULE H5GLOBAL IMPLICIT NONE + ! Enumerate data type that is interoperable with C. + ENUM, BIND(C) + ENUMERATOR :: enum_dtype + END ENUM + INTEGER, PARAMETER :: ENUM_T = KIND(enum_dtype) + + ! Definitions for reference datatypes. ! If you change the value of these parameters, do not forget to change corresponding ! values in the H5f90.h file. INTEGER, PARAMETER :: REF_REG_BUF_LEN = 3 - ! Parameters used in the function 'h5kind_to_type' located in H5_ff.f90. + ! Parameters used in the function 'h5kind_to_type' located in H5_ff.F90. ! The flag is used to tell the function whether the kind input variable ! is for a REAL or INTEGER data type. @@ -366,11 +373,11 @@ MODULE H5GLOBAL EQUIVALENCE(H5G_flags(10), H5G_STORAGE_TYPE_SYMBOL_TABLE_F) EQUIVALENCE(H5G_flags(11), H5G_STORAGE_TYPE_COMPACT_F) EQUIVALENCE(H5G_flags(12), H5G_STORAGE_TYPE_DENSE_F) + ! ! H5D flags declaration ! - - INTEGER, PARAMETER :: H5D_FLAGS_LEN = 25 + INTEGER, PARAMETER :: H5D_FLAGS_LEN = 29 INTEGER :: H5D_flags(H5D_FLAGS_LEN) INTEGER, PARAMETER :: H5D_SIZE_FLAGS_LEN = 2 INTEGER(SIZE_T) :: H5D_size_flags(H5D_SIZE_FLAGS_LEN) @@ -418,6 +425,10 @@ MODULE H5GLOBAL INTEGER :: H5D_MPIO_CHUNK_COLLECTIVE_F INTEGER :: H5D_MPIO_CHUNK_MIXED_F INTEGER :: H5D_MPIO_CONTIG_COLLECTIVE_F + INTEGER :: H5D_VDS_ERROR_F + INTEGER :: H5D_VDS_FIRST_MISSING_F + INTEGER :: H5D_VDS_LAST_AVAILABLE_F + INTEGER :: H5D_VIRTUAL_F EQUIVALENCE(H5D_flags(1), H5D_COMPACT_F) EQUIVALENCE(H5D_flags(2), H5D_CONTIGUOUS_F) @@ -449,6 +460,10 @@ MODULE H5GLOBAL EQUIVALENCE(H5D_flags(23), H5D_MPIO_CHUNK_COLLECTIVE_F) EQUIVALENCE(H5D_flags(24), H5D_MPIO_CHUNK_MIXED_F) EQUIVALENCE(H5D_flags(25), H5D_MPIO_CONTIG_COLLECTIVE_F) + EQUIVALENCE(H5D_flags(26), H5D_VDS_ERROR_F) + EQUIVALENCE(H5D_flags(27), H5D_VDS_FIRST_MISSING_F) + EQUIVALENCE(H5D_flags(28), H5D_VDS_LAST_AVAILABLE_F) + EQUIVALENCE(H5D_flags(29), H5D_VIRTUAL_F) EQUIVALENCE(H5D_size_flags(1), H5D_CHUNK_CACHE_NSLOTS_DFLT_F) EQUIVALENCE(H5D_size_flags(2), H5D_CHUNK_CACHE_NBYTES_DFLT_F) diff --git a/fortran/src/H5fortkit.F90 b/fortran/src/H5fortkit.F90 new file mode 100644 index 0000000..9afd890 --- /dev/null +++ b/fortran/src/H5fortkit.F90 @@ -0,0 +1,58 @@ +!****h* H5fortkit/H5fortkit +! PURPOSE +! Routines to deal with C-FORTRAN issues. +! +! COPYRIGHT +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! Copyright by The HDF Group. * +! Copyright by the Board of Trustees of the University of Illinois. * +! All rights reserved. * +! * +! This file is part of HDF5. The full HDF5 copyright notice, including * +! terms governing use, modification, and redistribution, is contained in * +! the files COPYING and Copyright.html. COPYING can be found at the root * +! of the source code distribution tree; Copyright.html can be found at the * +! root level of an installed copy of the electronic HDF5 document set and * +! is linked from the top-level documents page. It can also be found at * +! http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * +! access to either file, you may request a copy from help@hdfgroup.org. * +! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +! +MODULE H5fortkit + +CONTAINS + +!****if* H5fortkit/HD5c2fstring +! NAME +! HD5c2fstring +! INPUTS +! cstring - C string stored as a string array of size 'len' of string size LEN=1 +! len - length of Fortran string +! OUTPUT +! fstring - Fortran string array of LEN=1 +! PURPOSE +! Copies a Fortran array of strings having a length of one to a fortran string and removes the C Null +! terminator. The Null terminator is returned from C when calling the C APIs directly. +! +! The fortran standard does not allow C_LOC to be used on a character string of +! length greater than one, which is why we use the array of characters instead. +! +! SOURCE + SUBROUTINE HD5c2fstring(fstring,cstring,len) +!***** + IMPLICIT NONE + + INTEGER :: i + INTEGER :: len + CHARACTER(LEN=len) :: fstring + CHARACTER(LEN=1), DIMENSION(1:len) :: cstring + + fstring = '' + DO i = 1, len + IF (cstring(i)(1:1)==CHAR(0)) EXIT + fstring(i:i) = cstring(i)(1:1) + END DO + + END SUBROUTINE HD5c2fstring + +END MODULE H5fortkit diff --git a/fortran/src/HDF5.F90 b/fortran/src/HDF5.F90 index 64f5be6..cbe4c83 100644 --- a/fortran/src/HDF5.F90 +++ b/fortran/src/HDF5.F90 @@ -4,7 +4,7 @@ ! MODULE HDF5 ! ! FILE -! src/fortran/src/HDF5.f90 +! src/fortran/src/HDF5.F90 ! ! PURPOSE ! This is the main module used for linking to the Fortran HDF library. diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am index eb45f60..f4d192b 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -46,9 +46,9 @@ endif libhdf5_fortran_la_SOURCES=H5f90global.F90 \ H5fortran_types.F90 H5_ff.F90 H5Aff.F90 H5Dff.F90 H5Eff.F90 \ H5Fff.F90 H5Gff.F90 H5Iff.F90 H5Lff.F90 H5Off.F90 H5Pff.F90 H5Rff.F90 H5Sff.F90 \ - H5Tff.F90 H5Zff.F90 H5_gen.f90 \ + H5Tff.F90 H5Zff.F90 H5_gen.F90 H5fortkit.F90 \ H5f90kit.c H5_f.c H5Af.c H5Df.c H5Ef.c H5Ff.c H5Gf.c \ - H5If.c H5Lf.c H5Of.c H5Pf.c H5Rf.c H5Sf.c H5Tf.c H5Zf.c HDF5.f90 + H5If.c H5Lf.c H5Of.c H5Pf.c H5Rf.c H5Sf.c H5Tf.c H5Zf.c HDF5.F90 # HDF5 Fortran library depends on HDF5 Library. libhdf5_fortran_la_LIBADD=$(LIBHDF5) @@ -153,7 +153,7 @@ H5Gff.lo: $(srcdir)/H5Gff.F90 H5f90global.lo H5Iff.lo: $(srcdir)/H5Iff.F90 H5f90global.lo H5Lff.lo: $(srcdir)/H5Lff.F90 H5f90global.lo H5Off.lo: $(srcdir)/H5Off.F90 H5f90global.lo -H5Pff.lo: $(srcdir)/H5Pff.F90 H5f90global.lo +H5Pff.lo: $(srcdir)/H5Pff.F90 H5f90global.lo H5fortkit.lo H5Rff.lo: $(srcdir)/H5Rff.F90 H5f90global.lo H5Sff.lo: $(srcdir)/H5Sff.F90 H5f90global.lo H5Tff.lo: $(srcdir)/H5Tff.F90 H5f90global.lo diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index 1333262..42b5642 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -318,6 +318,16 @@ H5P_mp_H5PREGISTER_PTR H5P_mp_H5PINSERT_PTR H5P_mp_H5PGET_FILE_IMAGE_F H5P_mp_H5PSET_FILE_IMAGE_F +H5P_mp_H5PSET_VIRTUAL_VIEW_F +H5P_mp_H5PGET_VIRTUAL_VIEW_F +H5P_mp_H5PSET_VIRTUAL_PRINTF_GAP_F +H5P_mp_H5PGET_VIRTUAL_PRINTF_GAP_F +H5P_mp_H5PSET_VIRTUAL_F +H5P_mp_H5PGET_VIRTUAL_COUNT_F +H5P_mp_H5PGET_VIRTUAL_VSPACE_F +H5P_mp_H5PGET_VIRTUAL_SRCSPACE_F +H5P_mp_H5PGET_VIRTUAL_FILENAME_F +H5P_mp_H5PGET_VIRTUAL_DSETNAME_F ; Parallel @H5_NOPAREXP@H5P_mp_H5PSET_FAPL_MPIO_F @H5_NOPAREXP@H5P_mp_H5PGET_FAPL_MPIO_F @@ -367,6 +377,8 @@ H5S_mp_H5SGET_SELECT_TYPE_F H5S_mp_H5SDECODE_F H5S_mp_H5SENCODE_F H5S_mp_H5SEXTENT_EQUAL_F +H5S_mp_H5SGET_REGULAR_HYPERSLAB_F +H5S_mp_H5SIS_REGULAR_HYPERSLAB_F ; H5T H5T_mp_H5TOPEN_F H5T_mp_H5TCOMMIT_F diff --git a/fortran/test/fortranlib_test_F03.F90 b/fortran/test/fortranlib_test_F03.F90 index 5b386b9..070cd73 100644 --- a/fortran/test/fortranlib_test_F03.F90 +++ b/fortran/test/fortranlib_test_F03.F90 @@ -174,6 +174,14 @@ PROGRAM fortranlibtest_F03 CALL test_get_file_image(ret_total_error) CALL write_test_status(ret_total_error, ' Testing get file image ', total_error) +! write(*,*) +! write(*,*) '=========================================' +! write(*,*) 'Testing VDS ' +! write(*,*) '=========================================' + + ret_total_error = 0 + CALL test_vds(ret_total_error) + CALL write_test_status(ret_total_error, ' Testing vds ', total_error) WRITE(*,*) diff --git a/fortran/test/tH5P_F03.F90 b/fortran/test/tH5P_F03.F90 index 8982fc2..3cafdcb 100644 --- a/fortran/test/tH5P_F03.F90 +++ b/fortran/test/tH5P_F03.F90 @@ -617,4 +617,476 @@ SUBROUTINE external_test_offset(cleanup,total_error) CALL check("h5_cleanup_f", error, total_error) END SUBROUTINE external_test_offset + +!****h* root/fortran/test/tH5P_F03.f90 +! +! NAME +! test_vds +! +! FUNCTION +! Tests VDS API wrappers +! +! RETURNS: +! Success: 0 +! Failure: number of errors +! +! FORTRAN Programmer: M. Scot Breitenfeld +! February 1, 2016 +! +!------------------------------------------------------------------------- +! +SUBROUTINE test_vds(total_error) + + USE ISO_C_BINDING + IMPLICIT NONE + + INTEGER, INTENT(INOUT) :: total_error + + INTEGER, PARAMETER :: int_kind_8 = SELECTED_INT_KIND(9) !should map to INTEGER*4 on most modern processors + INTEGER, PARAMETER :: int_kind_16 = SELECTED_INT_KIND(18) !should map to INTEGER*8 on most modern processors + + CHARACTER(LEN=6), PARAMETER :: VFILENAME="vds.h5" + CHARACTER(LEN=3), PARAMETER :: DATASET="VDS" + INTEGER :: VDSDIM0 + INTEGER, PARAMETER :: VDSDIM1 = 10 + INTEGER, PARAMETER :: VDSDIM2 = 15 + + INTEGER :: DIM0 + INTEGER, PARAMETER :: DIM0_1= 4 ! Initial size of the source datasets + INTEGER, PARAMETER :: DIM1 = 10 + INTEGER, PARAMETER :: DIM2 = 15 + INTEGER, PARAMETER :: RANK = 3 + INTEGER(hsize_t), PARAMETER :: PLANE_STRIDE = 4 + + CHARACTER(LEN=4), DIMENSION(1:PLANE_STRIDE) :: SRC_FILE = (/"a.h5","b.h5","c.h5","d.h5"/) + CHARACTER(LEN=3), DIMENSION(1:PLANE_STRIDE) :: SRC_DATASET = (/"AAA","BBB","CCC","DDD"/) + + + INTEGER(hid_t) :: vfile, file, src_space, mem_space, vspace, vdset, dset !Handles + INTEGER(hid_t) :: dcpl, dapl + INTEGER :: status, error + INTEGER(hsize_t), DIMENSION(1:3) :: vdsdims = (/4*DIM0_1, VDSDIM1, VDSDIM2/), & + vdsdims_max, & + dims = (/DIM0_1, DIM1, DIM2/), & + memdims = (/DIM0_1, DIM1, DIM2/), & + extdims = (/0, DIM1, DIM2/), & ! Dimensions of the extended source datasets + chunk_dims = (/DIM0_1, DIM1, DIM2/), & + dims_max, & + vdsdims_out, vdsdims_max_out, & + start, & ! Hyperslab parameters + stride, & + count, & + src_count, block + INTEGER(hsize_t), DIMENSION(1:2,1:3) :: vdsdims_out_correct + + INTEGER(hsize_t), DIMENSION(1:3) :: start_out, & !Hyperslab PARAMETER out + stride_out, count_out, count_correct, block_out + INTEGER(hsize_t), DIMENSION(1:3,1:PLANE_STRIDE) :: start_correct + + INTEGER :: i, j + INTEGER :: layout ! Storage layout + INTEGER(size_t) :: num_map ! Number of mappings + INTEGER(size_t) :: len ! Length of the string also a RETURN value + CHARACTER(LEN=180) :: filename + ! Different sized character buffers + CHARACTER(len=LEN(SRC_FILE(1))-3) :: SRC_FILE_LEN_TINY + CHARACTER(len=LEN(SRC_FILE(1))-1) :: SRC_FILE_LEN_SMALL + CHARACTER(len=LEN(SRC_FILE(1))) :: SRC_FILE_LEN_EXACT + CHARACTER(len=LEN(SRC_FILE(1))+1) :: SRC_FILE_LEN_LARGE + CHARACTER(len=LEN(SRC_FILE(1))+10) :: SRC_FILE_LEN_HUGE + CHARACTER(len=LEN(SRC_DATASET(1))) :: SRC_DATASET_LEN_EXACT + + INTEGER(HID_T) :: space_out + + INTEGER :: s_type, virtual_view + INTEGER :: type1, type2 + + CHARACTER(LEN=180) :: dsetname + INTEGER, DIMENSION(DIM0_1*DIM1*DIM2), TARGET :: wdata + TYPE(C_PTR) :: f_ptr + INTEGER(SIZE_T) :: nsize + LOGICAL :: IsRegular + INTEGER(HSIZE_T) :: gap_size + + ! For testing against + vdsdims_out_correct(1,1) = DIM0_1*5 + vdsdims_out_correct(2,1) = DIM0_1*8 + vdsdims_out_correct(1:2,2) = VDSDIM1 + vdsdims_out_correct(1:2,3) = VDSDIM2 + + VDSDIM0 = H5S_UNLIMITED_F + DIM0 = H5S_UNLIMITED_F + vdsdims_max = (/VDSDIM0, VDSDIM1, VDSDIM2/) + dims_max = (/DIM0, DIM1, DIM2/) + + ! + ! Create source files and datasets. + ! + DO i = 1, PLANE_STRIDE + ! + ! Initialize data for i-th source dataset. + DO j = 1, DIM0_1*DIM1*DIM2 + wdata(j) = i + ENDDO + ! + ! Create the source files and datasets. Write data to each dataset and + ! close all resources. + CALL h5fcreate_f(SRC_FILE(i), H5F_ACC_TRUNC_F, file, status) + CALL check("h5fcreate_f", error, total_error) + + CALL h5screate_simple_f(RANK, dims, src_space, error, dims_max) + CALL check("h5screate_simple_f", error, total_error) + CALL h5pcreate_f(H5P_DATASET_CREATE_F, dcpl, error) + CALL check("h5pcreate_f", error, total_error) + CALL h5pset_chunk_f(dcpl, RANK, chunk_dims, error) + CALL check("h5pset_chunk_f",error, total_error) + + CALL h5dcreate_f(file, SRC_DATASET(i), H5T_NATIVE_INTEGER, src_space, dset, error, dcpl, H5P_DEFAULT_F, H5P_DEFAULT_F) + CALL check("h5dcreate_f",error, total_error) + f_ptr = C_LOC(wdata(1)) + CALL H5Dwrite_f(dset, H5T_NATIVE_INTEGER, f_ptr, error) + CALL check("H5Dwrite_f",error, total_error) + CALL H5Sclose_f(src_space, error) + CALL check("H5Sclose_f",error, total_error) + CALL H5Pclose_f(dcpl, error) + CALL check("H5Pclose_f",error, total_error) + CALL H5Dclose_f(dset, error) + CALL check("H5Dclose_f",error, total_error) + CALL H5Fclose_f(file, error) + CALL check("H5Fclose_f",error, total_error) + ENDDO + + CALL h5fcreate_f(VFILENAME, H5F_ACC_TRUNC_F, vfile, error) + CALL check("h5fcreate_f", error, total_error) + + ! Create VDS dataspace. + CALL H5Screate_simple_f(RANK, vdsdims, vspace, error, vdsdims_max) + CALL check("H5Screate_simple_f", error, total_error) + + ! Create dataspaces for the source dataset. + CALL H5Screate_simple_f(RANK, dims, src_space, error, dims_max) + CALL check("H5Screate_simple_f", error, total_error) + + ! Create VDS creation property + CALL H5Pcreate_f (H5P_DATASET_CREATE_F, dcpl, error) + CALL check("H5Pcreate_f", error, total_error) + + ! Initialize hyperslab values + start(1:3) = 0 + stride(1:3) = (/PLANE_STRIDE,1_hsize_t,1_hsize_t/) ! we will select every fifth plane in VDS + count(1:3) = (/H5S_UNLIMITED_F,1_hsize_t,1_hsize_t/) + src_count(1:3) = (/H5S_UNLIMITED_F,1_hsize_t,1_hsize_t/) + block(1:3) = (/1, DIM1, DIM2/) + + ! + ! Build the mappings + ! + start_correct = 0 + CALL H5Sselect_hyperslab_f(src_space, H5S_SELECT_SET_F, start, src_count, error, block=block) + CALL check("H5Sselect_hyperslab_f", error, total_error) + DO i = 1, PLANE_STRIDE + start_correct(1,i) = start(1) + CALL H5Sselect_hyperslab_f(vspace, H5S_SELECT_SET_F, start, count, error, stride=stride, block=block) + CALL check("H5Sselect_hyperslab_f", error, total_error) + + IF(i.eq.1)THEN ! check src_file and src_dataset with trailing blanks + CALL H5Pset_virtual_f (dcpl, vspace, SRC_FILE(i)//" ", SRC_DATASET(i)//" ", src_space, error) + ELSE + CALL H5Pset_virtual_f (dcpl, vspace, SRC_FILE(i), SRC_DATASET(i), src_space, error) + ENDIF + CALL check("H5Pset_virtual_f", error, total_error) + start(1) = start(1) + 1 + ENDDO + + CALL H5Sselect_none_f(vspace, error) + CALL check("H5Sselect_none_f", error, total_error) + + ! Create a virtual dataset + CALL H5Dcreate_f(vfile, DATASET, H5T_NATIVE_INTEGER, vspace, vdset, error, dcpl, H5P_DEFAULT_F, H5P_DEFAULT_F) + CALL check("H5Dcreate_f", error, total_error) + CALL H5Sclose_f(vspace, error) + CALL check("H5Sclose_f", error, total_error) + CALL H5Sclose_f(src_space, error) + CALL check("H5Sclose_f", error, total_error) + CALL H5Pclose_f(dcpl, error) + CALL check("H5Pclose_f", error, total_error) + + ! Let's add data to the source datasets and check new dimensions for VDS + ! We will add only one plane to the first source dataset, two planes to the + ! second one, three to the third, and four to the forth. + + DO i = 1, PLANE_STRIDE + ! + ! Initialize data for i-th source dataset. + DO j = 1, i*DIM1*DIM2 + wdata(j) = 10*i + ENDDO + + ! + ! Open the source files and datasets. Append data to each dataset and + ! close all resources. + CALL H5Fopen_f (SRC_FILE(i), H5F_ACC_RDWR_F, file, error) + CALL check("H5Fopen_f", error, total_error) + CALL H5Dopen_f (file, SRC_DATASET(i), dset, error) + CALL check("H5Dopen_f", error, total_error) + extdims(1) = DIM0_1+i + CALL H5Dset_extent_f(dset, extdims, error) + CALL check("H5Dset_extent_f", error, total_error) + CALL H5Dget_space_f(dset, src_space, error) + CALL check("H5Dget_space_f", error, total_error) + + start(1:3) = (/DIM0_1,0,0/) + count(1:3) = 1 + block(1:3) = (/i, DIM1, DIM2/) + + memdims(1) = i + + CALL H5Screate_simple_f(RANK, memdims, mem_space, error) + CALL check("H5Screate_simple_f", error, total_error) + + CALL H5Sselect_hyperslab_f(src_space, H5S_SELECT_SET_F, start,count, error,block=block) + CALL check("H5Sselect_hyperslab_f", error, total_error) + f_ptr = C_LOC(wdata(1)) + CALL H5Dwrite_f(dset, H5T_NATIVE_INTEGER, f_ptr, error, mem_space, src_space, H5P_DEFAULT_F) + CALL check("H5Dwrite_f", error, total_error) + CALL H5Sclose_f(src_space, error) + CALL check("H5Sclose_f", error, total_error) + call H5Dclose_f(dset, error) + CALL check("H5Dclose_f", error, total_error) + call H5Fclose_f(file, error) + CALL check("H5Fclose_f", error, total_error) + ENDDO + + call H5Dclose_f(vdset, error) + CALL check("H5Dclose_f", error, total_error) + call H5Fclose_f(vfile, error) + CALL check("H5Fclose_f", error, total_error) + + ! + ! begin the read section + ! + ! Open file and dataset using the default properties. + CALL H5Fopen_f(VFILENAME, H5F_ACC_RDONLY_F, vfile, error) + CALL check("H5Fopen_f", error, total_error) + + ! + ! Open VDS using different access properties to use max or + ! min extents depending on the sizes of the underlying datasets + CALL H5Pcreate_f(H5P_DATASET_ACCESS_F, dapl, error) + CALL check("H5Pcreate_f", error, total_error) + + DO i = 1, 2 + + IF(i.NE.1)THEN + CALL H5Pset_virtual_view_f(dapl, H5D_VDS_LAST_AVAILABLE_F, error) + CALL check("H5Pset_virtual_view_f", error, total_error) + ELSE + CALL H5Pset_virtual_view_f(dapl, H5D_VDS_FIRST_MISSING_F, error) + CALL check("H5Pset_virtual_view_f", error, total_error) + ENDIF + + CALL H5Dopen_f(vfile, DATASET, vdset, error, dapl) + CALL check("H5Dopen_f", error, total_error) + + ! Let's get space of the VDS and its dimension we should get 32(or 20)x10x10 + CALL H5Dget_space_f(vdset, vspace, error) + CALL check("H5Dget_space_f", error, total_error) + CALL H5Sget_simple_extent_dims_f(vspace, vdsdims_out, vdsdims_max_out, error) + CALL check("H5Sget_simple_extent_dims_f", error, total_error) + + ! check VDS dimensions + DO j = 1, RANK + IF(vdsdims_out(j).NE.vdsdims_out_correct(i,j))THEN + total_error = total_error + 1 + EXIT + ENDIF + ENDDO + + CALL H5Pget_virtual_view_f(dapl, virtual_view, error) + CALL check("h5pget_virtual_view_f", error, total_error) + + IF(i.EQ.1)THEN + IF(virtual_view .NE. H5D_VDS_FIRST_MISSING_F)THEN + total_error = total_error + 1 + ENDIF + ELSE + IF(virtual_view .NE. H5D_VDS_LAST_AVAILABLE_F)THEN + total_error = total_error + 1 + ENDIF + + ENDIF + + ! Close + CALL H5Dclose_f(vdset, error) + CALL check("H5Dclose_f", error, total_error) + CALL H5Sclose_f(vspace, error) + CALL check("H5Sclose_f", error, total_error) + ENDDO + + CALL H5Dopen_f(vfile, DATASET, vdset, error) + CALL check("H5Dopen_f", error, total_error) + + ! + ! Get creation property list and mapping properties. + ! + CALL H5Dget_create_plist_f (vdset, dcpl, error) + CALL check("H5Dget_create_plist_f", error, total_error) + + ! + ! Get storage layout. + CALL H5Pget_layout_f(dcpl, layout, error) + CALL check("H5Pget_layout_f", error, total_error) + + IF (H5D_VIRTUAL_F .NE. layout) THEN + PRINT*,"Wrong layout found" + total_error = total_error + 1 + ENDIF + + ! + ! Find number of mappings. + + CALL H5Pget_virtual_count_f(dcpl, num_map, error) + CALL check("H5Pget_virtual_count_f", error, total_error) + + IF(num_map.NE.4_size_t)THEN + PRINT*,"Number of mappings is incorrect" + total_error = total_error + 1 + ENDIF + ! + ! Get mapping parameters for each mapping. + ! + DO i = 1, num_map + CALL H5Pget_virtual_vspace_f(dcpl, INT(i-1,size_t), vspace, error) + CALL check("H5Pget_virtual_vspace_f", error, total_error) + + CALL h5sget_select_type_f(vspace, s_type, error) + CALL check("h5sget_select_type_f", error, total_error) + IF(s_type.EQ.H5S_SEL_HYPERSLABS_F)THEN + CALL H5Sis_regular_hyperslab_f(vspace, IsRegular, error) + CALL check("H5Sis_regular_hyperslab_f", error, total_error) + + IF(IsRegular)THEN + CALL H5Sget_regular_hyperslab_f(vspace, start_out, stride_out, count_out, block_out, error) + CALL check("H5Sget_regular_hyperslab_f", error, total_error) + DO j = 1, 3 + IF(start_out(j).NE.start_correct(j,i) .OR. & + stride_out(j).NE.stride(j).OR. & + count_out(j).NE.src_count(j))THEN + total_error = total_error + 1 + EXIT + ENDIF + ENDDO + ENDIF + END IF + + ! Get source file name + CALL H5Pget_virtual_filename_f(dcpl, INT(i-1, size_t), SRC_FILE_LEN_EXACT, error, nsize) + CALL check("H5Pget_virtual_count_f", error, total_error) + + IF(nsize.NE.LEN(SRC_FILE_LEN_EXACT))THEN + PRINT*,"virtual filenname size is incorrect" + total_error = total_error + 1 + ENDIF + ! check passing a buffer that is very small + CALL H5Pget_virtual_filename_f(dcpl, INT(i-1, size_t), SRC_FILE_LEN_TINY, error) + CALL check("H5Pget_virtual_filename_f", error, total_error) + IF(SRC_FILE_LEN_TINY.NE.SRC_FILE(i)(1:LEN(SRC_FILE_LEN_TINY)))THEN + PRINT*,"virtual filenname returned is incorrect" + total_error = total_error + 1 + ENDIF + ! check passing a buffer that small by one + CALL H5Pget_virtual_filename_f(dcpl, INT(i-1, size_t), SRC_FILE_LEN_SMALL, error) + CALL check("H5Pget_virtual_filename_f", error, total_error) + IF(SRC_FILE_LEN_SMALL.NE.SRC_FILE(i)(1:LEN(SRC_FILE_LEN_SMALL)))THEN + PRINT*,"virtual filenname returned is incorrect" + total_error = total_error + 1 + ENDIF + ! check passing a buffer that is exact + CALL H5Pget_virtual_filename_f(dcpl, INT(i-1, size_t), SRC_FILE_LEN_EXACT, error) + CALL check("H5Pget_virtual_filename_f", error, total_error) + IF(SRC_FILE_LEN_EXACT.NE.SRC_FILE(i)(1:LEN(SRC_FILE_LEN_EXACT)))THEN + PRINT*,"virtual filenname returned is incorrect" + total_error = total_error + 1 + ENDIF + ! check passing a buffer that bigger by one + CALL H5Pget_virtual_filename_f(dcpl, INT(i-1, size_t), SRC_FILE_LEN_LARGE, error) + CALL check("H5Pget_virtual_filename_f", error, total_error) + IF(SRC_FILE_LEN_LARGE(1:LEN(SRC_FILE_LEN_EXACT)).NE.SRC_FILE(i)(1:LEN(SRC_FILE_LEN_EXACT)).AND. & + SRC_FILE_LEN_LARGE(LEN(SRC_FILE_LEN_EXACT):).NE.'')THEN + PRINT*,"virtual filenname returned is incorrect" + total_error = total_error + 1 + ENDIF + ! check passing a buffer that is very big + CALL H5Pget_virtual_filename_f(dcpl, INT(i-1, size_t), SRC_FILE_LEN_HUGE, error) + CALL check("H5Pget_virtual_filename_f", error, total_error) + IF(SRC_FILE_LEN_HUGE(1:LEN(SRC_FILE_LEN_EXACT)).NE.SRC_FILE(i)(1:LEN(SRC_FILE_LEN_EXACT)).AND. & + SRC_FILE_LEN_HUGE(LEN(SRC_FILE_LEN_EXACT):).NE.'')THEN + PRINT*,"virtual filenname returned is incorrect" + total_error = total_error + 1 + ENDIF + ! Get source dataset name + CALL H5Pget_virtual_dsetname_f(dcpl, INT(i-1, size_t), SRC_DATASET_LEN_EXACT, error, nsize) + CALL check("H5Pget_virtual_dsetname_f", error, total_error) + + CALL H5Pget_virtual_dsetname_f(dcpl, INT(i-1, size_t), SRC_DATASET_LEN_EXACT, error) + CALL check("H5Pget_virtual_dsetname_f", error, total_error) + IF(SRC_DATASET_LEN_EXACT(1:LEN(SRC_DATASET_LEN_EXACT)).NE.SRC_DATASET(i)(1:LEN(SRC_DATASET_LEN_EXACT)).AND. & + SRC_DATASET_LEN_EXACT(LEN(SRC_DATASET_LEN_EXACT):).NE.'')THEN + PRINT*,"virtual dataset returned is incorrect" + total_error = total_error + 1 + ENDIF + + CALL h5pget_virtual_srcspace_f(dcpl, INT(i-1,size_t), space_out, error) + CALL check("H5Pget_virtual_srcspace_f", error, total_error) + + CALL h5sget_select_type_f(space_out, type1, error) + CALL check("H5Sget_select_type_f", error, total_error) + CALL h5sget_select_type_f(vspace, type2, error) + CALL check("H5Sget_select_type_f", error, total_error) + + IF(type1.NE.type2)THEN + total_error = total_error + 1 + ENDIF + + ENDDO + ! + ! Close and release resources. + + ! Clear virtual layout in DCPL + CALL h5pset_layout_f(dcpl, H5D_VIRTUAL_F,error) + CALL check("H5Pset_layout_f", error, total_error) + + CALL H5Pclose_f(dcpl, error) + CALL check("H5Pclose_f", error, total_error) + CALL H5Dclose_f(vdset, error) + CALL check("H5Dclose_f", error, total_error) + + ! Reopen VDS with printf gap set to 1 + + CALL H5Pset_virtual_printf_gap_f(dapl, 1_hsize_t, error) + CALL check("H5Pset_virtual_printf_gap_f", error, total_error) + + CALL H5Dopen_f(vfile, DATASET, vdset, error, dapl) + CALL check("H5Dopen_f", error, total_error) + + CALL H5Pget_virtual_printf_gap_f(dapl, gap_size, error) + CALL check("H5Pget_virtual_printf_gap_f", error, total_error) + + IF(gap_size.NE.1_hsize_t)THEN + PRINT*,"gapsize is incorrect" + total_error = total_error + 1 + ENDIF + + CALL H5Dclose_f(vdset, error) + CALL check("H5Dclose_f", error, total_error) + CALL H5Sclose_f(vspace, error) + CALL check("H5Sclose_f", error, total_error) + CALL H5Pclose_f(dapl, error) + CALL check("H5Pclose_f", error, total_error) + CALL H5Fclose_f(vfile, error) + CALL check("H5Fclose_f", error, total_error) + +END SUBROUTINE test_vds + + END MODULE TH5P_F03 -- cgit v0.12 From 1a4e315a5dac7b85f4862118fa770f80fe369739 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 8 Feb 2016 20:38:44 -0500 Subject: [svn-r29069] test/gheap cleanup prior to stack size fixes. Tested on: Linux VM (minor changes) --- test/gheap.c | 591 ++++++++++++++++++++++++++++------------------------------- 1 file changed, 285 insertions(+), 306 deletions(-) diff --git a/test/gheap.c b/test/gheap.c index fa73dcb..c8b27fb 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -55,90 +55,91 @@ const char *FILENAME[] = { NULL }; +/* Number of heap objects in tests */ +#define N_GHEAP_OBJS 1024 + +/* Size of heap object buffers */ +#define OBJ_BUF_SIZE N_GHEAP_OBJS + +/* Size of filename */ +#define FILENAME_SIZE 1024 + /*------------------------------------------------------------------------- - * Function: test_1 + * Function: test_monotonic_increasing * - * Purpose: Writes a sequence of objects to the global heap where each - * object is larger than the one before. + * Purpose: Writes a sequence of objects to the global heap where each + * object is larger than the one before. * - * Return: Success: 0 + * Return: Success: 0 + * Failure: number of errors * - * Failure: number of errors - * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -test_1 (hid_t fapl) +test_monotonic_increasing(hid_t fapl) { - hid_t file = -1; - H5F_t *f = NULL; - H5HG_t obj[1024]; - uint8_t out[1024]; - uint8_t in[1024]; - int i; - size_t size; - herr_t status; - int nerrors = 0; - char filename[1024]; + hid_t fid = -1; /* HDF5 file ID */ + H5F_t *f = NULL; /* file object pointer */ + H5HG_t obj[N_GHEAP_OBJS]; /* global heap objects */ + uint8_t in[OBJ_BUF_SIZE]; /* global heap data sent */ + uint8_t out[OBJ_BUF_SIZE]; /* global heap data received */ + unsigned i; /* iterator */ + size_t size; /* heap object size */ + int nerrors = 0; /* # of errors encountered */ + char filename[FILENAME_SIZE]; /* VFD-dependent filename */ TESTING("monotonically increasing lengths"); /* Open a clean file */ - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; - if(NULL == (f = (H5F_t *)H5I_object(file))) { - H5_FAILED(); - puts(" Unable to create file"); - goto error; - } - - /* - * Write the objects, monotonically increasing in length. Since this is + h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + goto error; + if(NULL == (f = (H5F_t *)H5I_object(fid))) { + H5_FAILED(); + HDputs(" Unable to create file"); + goto error; + } /* end if */ + + /* Write the objects, monotonically increasing in length. Since this is * a clean file, the addresses allocated for the collections should also * be monotonically increasing. */ - for(i = 0; i < 1024; i++) { - size = i + 1; - HDmemset(out, 'A' + i % 26, size); - H5Eclear2(H5E_DEFAULT); - status = H5HG_insert(f, H5AC_dxpl_id, size, out, obj + i); - if(status < 0) { - H5_FAILED(); - puts(" Unable to insert object into global heap"); - nerrors++; - } else if(i && H5F_addr_gt(obj[i - 1].addr, obj[i].addr)) { - H5_FAILED(); - puts(" Collection addresses are not monotonically increasing"); - nerrors++; - } - } - - /* - * Now try to read each object back. - */ - for(i = 0; i < 1024; i++) { - size = i + 1; - HDmemset(out, 'A' + i % 26, size); - H5Eclear2(H5E_DEFAULT); - if(NULL == H5HG_read(f, H5AC_dxpl_id, obj + i, in, NULL)) { - H5_FAILED(); - puts(" Unable to read object"); - nerrors++; - } else if(HDmemcmp(in, out, size)) { - H5_FAILED(); - puts(" Value read doesn't match value written"); - nerrors++; - } - } - - if(H5Fclose(file) < 0) goto error; + for(i = 0; i < N_GHEAP_OBJS; i++) { + size = i + 1; + HDmemset(out, 'A' + (int)i % 26, size); + H5Eclear2(H5E_DEFAULT); + if(H5HG_insert(f, H5AC_dxpl_id, size, out, obj + i) < 0) { + H5_FAILED(); + HDputs(" Unable to insert object into global heap"); + nerrors++; + } else if(i && H5F_addr_gt(obj[i - 1].addr, obj[i].addr)) { + H5_FAILED(); + HDputs(" Collection addresses are not monotonically increasing"); + nerrors++; + } /* end if */ + } /* end for */ + + /* Now try to read each object back. */ + for(i = 0; i < N_GHEAP_OBJS; i++) { + size = i + 1; + HDmemset(out, 'A' + (int)i % 26, size); + H5Eclear2(H5E_DEFAULT); + if(NULL == H5HG_read(f, H5AC_dxpl_id, obj + i, in, NULL)) { + H5_FAILED(); + HDputs(" Unable to read object"); + nerrors++; + } else if(HDmemcmp(in, out, size)) { + H5_FAILED(); + HDputs(" Value read doesn't match value written"); + nerrors++; + } /* end if */ + } /* end for */ + + if(H5Fclose(fid) < 0) goto error; if(nerrors) goto error; PASSED(); @@ -146,291 +147,270 @@ test_1 (hid_t fapl) error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(fid); } H5E_END_TRY; return MAX(1, nerrors); -} +} /* end test_monotonic_increasing() */ /*------------------------------------------------------------------------- - * Function: test_2 - * - * Purpose: Writes a sequence of objects to the global heap where each - * object is smaller than the one before. + * Function: test_monotonic_decreasing * - * Return: Success: 0 + * Purpose: Writes a sequence of objects to the global heap where each + * object is smaller than the one before. * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -test_2 (hid_t fapl) +test_monotonic_decreasing(hid_t fapl) { - hid_t file = -1; - H5F_t *f = NULL; - H5HG_t obj[1024]; - uint8_t out[1024]; - uint8_t in[1024]; - int i; - size_t size; - int nerrors = 0; - char filename[1024]; + hid_t fid = -1; /* HDF5 file ID */ + H5F_t *f = NULL; /* file object pointer */ + H5HG_t obj[N_GHEAP_OBJS]; /* global heap objects */ + uint8_t in[OBJ_BUF_SIZE]; /* global heap data sent */ + uint8_t out[OBJ_BUF_SIZE]; /* global heap data received */ + unsigned i; /* iterator */ + size_t size; /* heap object size */ + int nerrors = 0; /* # of errors encountered */ + char filename[FILENAME_SIZE]; /* VFD-dependent filename */ TESTING("monotonically decreasing lengths"); /* Open a clean file */ - h5_fixname(FILENAME[1], fapl, filename, sizeof filename); - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; - if(NULL == (f = (H5F_t *)H5I_object(file))) { - H5_FAILED(); - puts(" Unable to create file"); - goto error; - } - - /* - * Write the objects, monotonically decreasing in length. - */ - for (i=0; i<1024; i++) { - size = 1024-i; - memset (out, 'A'+i%26, size); - H5Eclear2(H5E_DEFAULT); - if (H5HG_insert (f, H5AC_dxpl_id, size, out, obj+i)<0) { - H5_FAILED(); - puts(" Unable to insert object into global heap"); - nerrors++; - } - } - - /* - * Now try to read each object back. - */ - for (i=0; i<1024; i++) { - size = 1024-i; - memset (out, 'A'+i%26, size); - H5Eclear2(H5E_DEFAULT); - if (NULL==H5HG_read (f, H5AC_dxpl_id, obj+i, in, NULL)) { - H5_FAILED(); - puts(" Unable to read object"); - nerrors++; - } else if (memcmp (in, out, size)) { - H5_FAILED(); - puts(" Value read doesn't match value written"); - nerrors++; - } - } - - if (H5Fclose(file)<0) goto error; - if (nerrors) goto error; + h5_fixname(FILENAME[1], fapl, filename, sizeof(filename)); + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + goto error; + if(NULL == (f = (H5F_t *)H5I_object(fid))) { + H5_FAILED(); + HDputs(" Unable to create file"); + goto error; + } /* end if */ + + /* Write the objects, monotonically decreasing in length. */ + for(i = 0; i < N_GHEAP_OBJS; i++) { + size = 1024 - i; + HDmemset(out, 'A' + (int)i % 26, size); + H5Eclear2(H5E_DEFAULT); + if(H5HG_insert(f, H5AC_dxpl_id, size, out, obj+i) < 0) { + H5_FAILED(); + HDputs(" Unable to insert object into global heap"); + nerrors++; + } /* end if */ + } /* end for */ + + /* Now try to read each object back. */ + for(i = 0; i < N_GHEAP_OBJS; i++) { + size = OBJ_BUF_SIZE - i; + HDmemset(out, 'A' + (int)i % 26, size); + H5Eclear2(H5E_DEFAULT); + if(NULL == H5HG_read(f, H5AC_dxpl_id, obj+i, in, NULL)) { + H5_FAILED(); + HDputs(" Unable to read object"); + nerrors++; + } else if (HDmemcmp(in, out, size)) { + H5_FAILED(); + HDputs(" Value read doesn't match value written"); + nerrors++; + } /* end if */ + } /* end for */ + + if(H5Fclose(fid) < 0) goto error; + if(nerrors) goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(fid); } H5E_END_TRY; return MAX(1, nerrors); -} +} /* end test_monotonic_decreasing() */ /*------------------------------------------------------------------------- - * Function: test_3 - * - * Purpose: Creates a few global heap objects and then removes them all. - * The collection should also be removed. + * Function: test_complete_removal * - * Return: Success: 0 + * Purpose: Creates a few global heap objects and then removes them all. + * The collection should also be removed. * - * Failure: number of errors + * Return: Success: 0 + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -test_3 (hid_t fapl) +test_complete_removal(hid_t fapl) { - hid_t file = -1; - H5F_t *f = NULL; - H5HG_t obj[1024]; - uint8_t out[1024]; - int i; - size_t size; - herr_t status; - int nerrors = 0; - char filename[1024]; + hid_t fid = -1; /* HDF5 file ID */ + H5F_t *f = NULL; /* file object pointer */ + H5HG_t obj[N_GHEAP_OBJS]; /* global heap objects */ + uint8_t out[OBJ_BUF_SIZE]; /* global heap data received */ + unsigned i; /* iterator */ + size_t size; /* heap object size */ + int nerrors = 0; /* # of errors encountered */ + char filename[FILENAME_SIZE]; /* VFD-dependent filename */ TESTING("complete object removal"); /* Open a clean file */ - h5_fixname(FILENAME[2], fapl, filename, sizeof filename); - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; - if(NULL == (f = (H5F_t *)H5I_object(file))) { - H5_FAILED(); - puts(" Unable to create file"); - goto error; - } + h5_fixname(FILENAME[2], fapl, filename, sizeof(filename)); + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + goto error; + if(NULL == (f = (H5F_t *)H5I_object(fid))) { + H5_FAILED(); + HDputs(" Unable to create file"); + goto error; + } /* end if */ /* Create some stuff */ - for (i=0; i<1024; i++) { - size = i%30+100; - memset (out, 'A'+i%26, size); - H5Eclear2(H5E_DEFAULT); - status = H5HG_insert (f, H5AC_dxpl_id, size, out, obj+i); - if (status<0) { - H5_FAILED(); - puts(" Unable to insert object into global heap"); - nerrors++; - } - } + for(i=0; i < N_GHEAP_OBJS; i++) { + size = i % 30 + 100; + HDmemset(out, 'A' + (int)i % 26, size); + H5Eclear2(H5E_DEFAULT); + if(H5HG_insert(f, H5AC_dxpl_id, size, out, obj+i) < 0) { + H5_FAILED(); + HDputs(" Unable to insert object into global heap"); + nerrors++; + } /* end if */ + } /* end for */ /* Remove everything */ - for (i=0; i<1024; i++) { - status = H5HG_remove (f, H5AC_dxpl_id, obj+i); - if (status<0) { - H5_FAILED(); - puts(" Unable to remove object"); - nerrors++; - } - } - - if (H5Fclose(file)<0) goto error; - if (nerrors) goto error; + for(i = 0; i < N_GHEAP_OBJS; i++) { + if(H5HG_remove(f, H5AC_dxpl_id, obj+i) < 0) { + H5_FAILED(); + HDputs(" Unable to remove object"); + nerrors++; + } /* end if */ + } /* end for */ + + if(H5Fclose(fid) < 0) goto error; + if(nerrors) goto error; + PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(fid); } H5E_END_TRY; return MAX(1, nerrors); -} +} /* end test_complete_removal() */ /*------------------------------------------------------------------------- - * Function: test_4 + * Function: test_partial_removal * - * Purpose: Tests the H5HG_remove() feature by writing lots of objects - * and occassionally removing some. When we're done they're all - * removed. + * Purpose: Tests the H5HG_remove() feature by writing lots of objects + * and occassionally removing some. When we're done they're all + * removed. * - * Return: Success: 0 + * Return: Success: 0 + * Failure: number of errors * - * Failure: number of errors - * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ static int -test_4 (hid_t fapl) +test_partial_removal(hid_t fapl) { - hid_t file = -1; - H5F_t *f = NULL; - H5HG_t obj[1024]; - uint8_t out[1024]; - int i; - size_t size; - herr_t status; - int nerrors = 0; - char filename[1024]; + hid_t fid = -1; /* HDF5 file ID */ + H5F_t *f = NULL; /* file object pointer */ + H5HG_t obj[N_GHEAP_OBJS]; /* global heap objects */ + uint8_t out[OBJ_BUF_SIZE]; /* global heap data received */ + unsigned i; /* iterator */ + size_t size; /* heap object size */ + int nerrors = 0; /* # of errors encountered */ + char filename[FILENAME_SIZE]; /* VFD-dependent filename */ TESTING("partial object removal"); /* Open a clean file */ - h5_fixname(FILENAME[3], fapl, filename, sizeof filename); - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; - if(NULL == (f = (H5F_t *)H5I_object(file))) { - H5_FAILED(); - puts(" Unable to create file"); - goto error; - } - - for (i=0; i<1024; i++) { - /* Insert */ - size = i%30+100; - memset (out, 'A'+i%26, size); - H5Eclear2(H5E_DEFAULT); - status = H5HG_insert (f, H5AC_dxpl_id, size, out, obj+i); - if (status<0) { - H5_FAILED(); - puts(" Unable to insert object into global heap"); - nerrors++; - } - - /* - * Remove every third one beginning with the second, but after the - * next one has already been inserted. That is, insert A, B, C; - * remove B, insert D, E, F; remove E; etc. - */ - if (1==i%3) { - H5Eclear2(H5E_DEFAULT); - status = H5HG_remove (f, H5AC_dxpl_id, obj+i-1); - if (status<0) { - H5_FAILED(); - puts(" Unable to remove object"); - nerrors++; - } - memset (obj+i-1, 0, sizeof *obj); - } - } - - if (H5Fclose(file)<0) goto error; - if (nerrors) goto error; + h5_fixname(FILENAME[3], fapl, filename, sizeof(filename)); + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + goto error; + if(NULL == (f = (H5F_t *)H5I_object(fid))) { + H5_FAILED(); + HDputs(" Unable to create file"); + goto error; + } /* end if */ + + for(i = 0; i < N_GHEAP_OBJS; i++) { + + /* Insert */ + size = i % 30 + 100; + HDmemset(out, 'A' + (int)i % 26, size); + H5Eclear2(H5E_DEFAULT); + if(H5HG_insert(f, H5AC_dxpl_id, size, out, obj+i) < 0) { + H5_FAILED(); + HDputs(" Unable to insert object into global heap"); + nerrors++; + } /* end if */ + + /* Remove every third one beginning with the second, but after the + * next one has already been inserted. That is, insert A, B, C; + * remove B, insert D, E, F; remove E; etc. + */ + if(1 == i % 3) { + H5Eclear2(H5E_DEFAULT); + if(H5HG_remove(f, H5AC_dxpl_id, obj+i-1) < 0) { + H5_FAILED(); + HDputs(" Unable to remove object"); + nerrors++; + } /* end if */ + HDmemset(obj+i-1, 0, sizeof(*obj)); + } /* end if */ + } /* end for */ + + if(H5Fclose(fid) < 0) goto error; + if(nerrors) goto error; + PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(fid); } H5E_END_TRY; return MAX(1, nerrors); -} +} /* end test_partial_removal() */ /*------------------------------------------------------------------------- - * Function: test_ooo_indices + * Function: test_ooo_indices * - * Purpose: Tests that indices can be stored out of order. This can + * Purpose: Tests that indices can be stored out of order. This can * happen when the indices "wrap around" due to many * insertions and deletions (for example, from rewriting a * VL dataset). * - * Return: Success: 0 + * Return: Success: 0 + * Failure: number of errors * - * Failure: number of errors - * - * Programmer: Neil Fortner + * Programmer: Neil Fortner * Monday, October 26, 2009 * - * Modifications: - * *------------------------------------------------------------------------- */ static int test_ooo_indices(hid_t fapl) { - hid_t file = -1; - H5F_t *f = NULL; - unsigned i, j; - H5HG_t *obj = NULL; - herr_t status; - int nerrors=0; - char filename[1024]; + hid_t fid = -1; /* HDF5 file ID */ + H5F_t *f = NULL; /* file object pointer */ + H5HG_t *obj = NULL; /* global heap objects */ + unsigned i, j; /* iterators */ + int nerrors = 0; /* # of errors encountered */ + char filename[FILENAME_SIZE]; /* VFD-dependent filename */ TESTING("out of order indices"); @@ -438,25 +418,27 @@ test_ooo_indices(hid_t fapl) goto error; /* Open a clean file */ - h5_fixname(FILENAME[4], fapl, filename, sizeof filename); - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + h5_fixname(FILENAME[4], fapl, filename, sizeof(filename)); + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; - if(NULL == (f = (H5F_t *)H5I_object(file))) { + if(NULL == (f = (H5F_t *)H5I_object(fid))) { H5_FAILED(); - puts(" Unable to create file"); + HDputs(" Unable to create file"); goto error; } /* end if */ /* Alternately insert 1000 entries and remove the previous group of 1000 - * entries, until the indices wrap around */ - for(i=0; i<66; i++) { + * entries, until the indices wrap around. + */ + for(i = 0; i < 66; i++) { + /* Insert 1000 entries. The index into the obj array will alternate up * and down by 1000 so the previous set of insertions is preserved and - * can be deleted. */ - for(j=1000*((~i&1)); j<1000*((~i&1)+1); j++) { + * can be deleted. + */ + for(j = 1000 * ((~i & 1)); j < 1000 * ((~i & 1) + 1); j++) { H5Eclear2(H5E_DEFAULT); - status = H5HG_insert(f, H5AC_dxpl_id, sizeof(j), &j, &obj[j]); - if (status<0) + if(H5HG_insert(f, H5AC_dxpl_id, sizeof(j), &j, &obj[j]) < 0) GHEAP_REPEATED_ERR(" Unable to insert object into global heap") /* Check that the index is as expected */ @@ -465,11 +447,10 @@ test_ooo_indices(hid_t fapl) } /* end for */ /* Remove the previous 1000 entries */ - if(i>0) - for(j=1000*(i&1); j<1000*((i&1)+1); j++) { + if(i > 0) + for(j = 1000 * (i & 1); j < 1000 * ((i & 1) + 1); j++) { H5Eclear2(H5E_DEFAULT); - status = H5HG_remove(f, H5AC_dxpl_id, &obj[j]); - if (status<0) + if(H5HG_remove(f, H5AC_dxpl_id, &obj[j]) < 0) GHEAP_REPEATED_ERR(" Unable to remove object from global heap"); } /* end for */ } /* end for */ @@ -479,36 +460,37 @@ test_ooo_indices(hid_t fapl) HDassert(obj[535].idx == 1); /* Reopen the file */ - if (H5Fclose(file)<0) goto error; - if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + if(H5Fclose(fid) < 0) goto error; + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) goto error; - if(NULL == (f = (H5F_t *)H5I_object(file))) { + if(NULL == (f = (H5F_t *)H5I_object(fid))) { H5_FAILED(); - puts(" Unable to open file"); + HDputs(" Unable to open file"); goto error; } /* end if */ /* Read the objects to make sure the heap is still readable */ - for(i=0; i<1000; i++) { + for(i = 0; i < 1000; i++) { if(NULL == H5HG_read(f, H5AC_dxpl_id, &obj[i], &j, NULL)) goto error; if(i != j) { H5_FAILED(); - puts(" Incorrect read value"); + HDputs(" Incorrect read value"); goto error; } /* end if */ } /* end for */ - if (H5Fclose(file)<0) goto error; - if (nerrors) goto error; + if(H5Fclose(fid) < 0) goto error; + if(nerrors) goto error; + HDfree(obj); obj = NULL; PASSED(); return 0; - error: +error: H5E_BEGIN_TRY { - H5Fclose(file); + H5Fclose(fid); } H5E_END_TRY; if(obj) HDfree(obj); @@ -517,46 +499,43 @@ test_ooo_indices(hid_t fapl) /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Tests global heap. + * Purpose: Tests global heap * - * Return: Success: zero + * Return: EXIT_SUCCESS/EXIT_FAILURE * - * Failure: non-zero - * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * - * Modifications: - * *------------------------------------------------------------------------- */ int -main (void) +main(void) { - int nerrors=0; - hid_t fapl; + int nerrors = 0; /* # of errors */ + hid_t fapl = -1; /* VFD-dependent fapl ID */ h5_reset(); fapl = h5_fileaccess(); - nerrors += test_1(fapl); - nerrors += test_2(fapl); - nerrors += test_3(fapl); - nerrors += test_4(fapl); + nerrors += test_monotonic_increasing(fapl); + nerrors += test_monotonic_decreasing(fapl); + nerrors += test_complete_removal(fapl); + nerrors += test_partial_removal(fapl); nerrors += test_ooo_indices(fapl); /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); - if (nerrors) goto error; + if(nerrors) goto error; - puts("All global heap tests passed."); + HDputs("All global heap tests passed."); h5_cleanup(FILENAME, fapl); - return 0; + return EXIT_SUCCESS; + +error: + HDputs("*** TESTS FAILED ***"); + return EXIT_FAILURE; +} /* end main() */ - error: - puts("*** TESTS FAILED ***"); - return 1; -} -- cgit v0.12 From be36958b77eedde1b016bd7e98eafe589541e7fc Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 8 Feb 2016 23:18:53 -0500 Subject: [svn-r29072] test/gheap stack size cleanup. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 serial autotools (also w/ Valgrind) --- test/Makefile.am | 2 +- test/gheap.c | 171 ++++++++++++++++++++++++++++++++++++++++++------------- 2 files changed, 131 insertions(+), 42 deletions(-) diff --git a/test/Makefile.am b/test/Makefile.am index c3761b7..667c0e7 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -129,7 +129,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse huge_chunks.h5 chunk_cache.h5 big_chunk.h5 chunk_expand.h5 \ copy_dcpl_newfile.h5 extend.h5 istore.h5 extlinks*.h5 frspace.h5 links*.h5 \ sys_file1 tfile[1-7].h5 th5s[1-4].h5 lheap.h5 fheap.h5 ohdr.h5 \ - stab.h5 extern_[1-4].h5 extern_[1-4][rw].raw gheap[0-4].h5 \ + stab.h5 extern_[1-4].h5 extern_[1-4][rw].raw gheap[0-5].h5 \ dt_arith[1-2] links.h5 links[0-6]*.h5 extlinks[0-15].h5 tmp \ big.data big[0-9][0-9][0-9][0-9][0-9].h5 \ stdio.h5 sec2.h5 dtypes[0-9].h5 dtypes1[0].h5 dt_arith[1-2].h5 tattr.h5 \ diff --git a/test/gheap.c b/test/gheap.c index c8b27fb..a296feb 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -51,7 +51,7 @@ const char *FILENAME[] = { "gheap2", "gheap3", "gheap4", - "gheapooo", + "gheap5", NULL }; @@ -82,18 +82,28 @@ const char *FILENAME[] = { static int test_monotonic_increasing(hid_t fapl) { - hid_t fid = -1; /* HDF5 file ID */ - H5F_t *f = NULL; /* file object pointer */ - H5HG_t obj[N_GHEAP_OBJS]; /* global heap objects */ - uint8_t in[OBJ_BUF_SIZE]; /* global heap data sent */ - uint8_t out[OBJ_BUF_SIZE]; /* global heap data received */ + char *filename = NULL; /* VFD-dependent filename */ + hid_t fid = -1; /* HDF5 file ID */ + H5F_t *f = NULL; /* file object pointer */ + H5HG_t *obj = NULL; /* global heap objects */ + uint8_t *in = NULL; /* global heap data sent */ + uint8_t *out = NULL; /* global heap data received */ unsigned i; /* iterator */ - size_t size; /* heap object size */ - int nerrors = 0; /* # of errors encountered */ - char filename[FILENAME_SIZE]; /* VFD-dependent filename */ + size_t size; /* heap object size */ + int nerrors = 0; /* # of errors encountered */ TESTING("monotonically increasing lengths"); + /* allocate memory */ + if(NULL == (filename = (char *)HDcalloc(FILENAME_SIZE, sizeof(char)))) + goto error; + if(NULL == (obj = (H5HG_t *)HDcalloc(N_GHEAP_OBJS, sizeof(H5HG_t)))) + goto error; + if(NULL == (in = (uint8_t *)HDcalloc(OBJ_BUF_SIZE, sizeof(uint8_t)))) + goto error; + if(NULL == (out = (uint8_t *)HDcalloc(OBJ_BUF_SIZE, sizeof(uint8_t)))) + goto error; + /* Open a clean file */ h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) @@ -142,6 +152,11 @@ test_monotonic_increasing(hid_t fapl) if(H5Fclose(fid) < 0) goto error; if(nerrors) goto error; + HDfree(filename); + HDfree(obj); + HDfree(in); + HDfree(out); + PASSED(); return 0; @@ -149,6 +164,14 @@ error: H5E_BEGIN_TRY { H5Fclose(fid); } H5E_END_TRY; + if(filename) + HDfree(filename); + if(obj) + HDfree(obj); + if(in) + HDfree(in); + if(out) + HDfree(out); return MAX(1, nerrors); } /* end test_monotonic_increasing() */ @@ -170,18 +193,28 @@ error: static int test_monotonic_decreasing(hid_t fapl) { - hid_t fid = -1; /* HDF5 file ID */ - H5F_t *f = NULL; /* file object pointer */ - H5HG_t obj[N_GHEAP_OBJS]; /* global heap objects */ - uint8_t in[OBJ_BUF_SIZE]; /* global heap data sent */ - uint8_t out[OBJ_BUF_SIZE]; /* global heap data received */ + char *filename = NULL; /* VFD-dependent filename */ + hid_t fid = -1; /* HDF5 file ID */ + H5F_t *f = NULL; /* file object pointer */ + H5HG_t *obj = NULL; /* global heap objects */ + uint8_t *in = NULL; /* global heap data sent */ + uint8_t *out = NULL; /* global heap data received */ unsigned i; /* iterator */ - size_t size; /* heap object size */ - int nerrors = 0; /* # of errors encountered */ - char filename[FILENAME_SIZE]; /* VFD-dependent filename */ + size_t size; /* heap object size */ + int nerrors = 0; /* # of errors encountered */ TESTING("monotonically decreasing lengths"); + /* allocate memory */ + if(NULL == (filename = (char *)HDcalloc(FILENAME_SIZE, sizeof(char)))) + goto error; + if(NULL == (obj = (H5HG_t *)HDcalloc(N_GHEAP_OBJS, sizeof(H5HG_t)))) + goto error; + if(NULL == (in = (uint8_t *)HDcalloc(OBJ_BUF_SIZE, sizeof(uint8_t)))) + goto error; + if(NULL == (out = (uint8_t *)HDcalloc(OBJ_BUF_SIZE, sizeof(uint8_t)))) + goto error; + /* Open a clean file */ h5_fixname(FILENAME[1], fapl, filename, sizeof(filename)); if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) @@ -194,7 +227,7 @@ test_monotonic_decreasing(hid_t fapl) /* Write the objects, monotonically decreasing in length. */ for(i = 0; i < N_GHEAP_OBJS; i++) { - size = 1024 - i; + size = N_GHEAP_OBJS - i; HDmemset(out, 'A' + (int)i % 26, size); H5Eclear2(H5E_DEFAULT); if(H5HG_insert(f, H5AC_dxpl_id, size, out, obj+i) < 0) { @@ -206,7 +239,7 @@ test_monotonic_decreasing(hid_t fapl) /* Now try to read each object back. */ for(i = 0; i < N_GHEAP_OBJS; i++) { - size = OBJ_BUF_SIZE - i; + size = N_GHEAP_OBJS - i; HDmemset(out, 'A' + (int)i % 26, size); H5Eclear2(H5E_DEFAULT); if(NULL == H5HG_read(f, H5AC_dxpl_id, obj+i, in, NULL)) { @@ -222,6 +255,12 @@ test_monotonic_decreasing(hid_t fapl) if(H5Fclose(fid) < 0) goto error; if(nerrors) goto error; + + HDfree(filename); + HDfree(obj); + HDfree(in); + HDfree(out); + PASSED(); return 0; @@ -229,6 +268,14 @@ test_monotonic_decreasing(hid_t fapl) H5E_BEGIN_TRY { H5Fclose(fid); } H5E_END_TRY; + if(filename) + HDfree(filename); + if(obj) + HDfree(obj); + if(in) + HDfree(in); + if(out) + HDfree(out); return MAX(1, nerrors); } /* end test_monotonic_decreasing() */ @@ -250,17 +297,25 @@ test_monotonic_decreasing(hid_t fapl) static int test_complete_removal(hid_t fapl) { - hid_t fid = -1; /* HDF5 file ID */ - H5F_t *f = NULL; /* file object pointer */ - H5HG_t obj[N_GHEAP_OBJS]; /* global heap objects */ - uint8_t out[OBJ_BUF_SIZE]; /* global heap data received */ + char *filename = NULL; /* VFD-dependent filename */ + hid_t fid = -1; /* HDF5 file ID */ + H5F_t *f = NULL; /* file object pointer */ + H5HG_t *obj = NULL; /* global heap objects */ + uint8_t *out = NULL; /* global heap data received */ unsigned i; /* iterator */ - size_t size; /* heap object size */ - int nerrors = 0; /* # of errors encountered */ - char filename[FILENAME_SIZE]; /* VFD-dependent filename */ + size_t size; /* heap object size */ + int nerrors = 0; /* # of errors encountered */ TESTING("complete object removal"); + /* allocate memory */ + if(NULL == (filename = (char *)HDcalloc(FILENAME_SIZE, sizeof(char)))) + goto error; + if(NULL == (obj = (H5HG_t *)HDcalloc(N_GHEAP_OBJS, sizeof(H5HG_t)))) + goto error; + if(NULL == (out = (uint8_t *)HDcalloc(OBJ_BUF_SIZE, sizeof(uint8_t)))) + goto error; + /* Open a clean file */ h5_fixname(FILENAME[2], fapl, filename, sizeof(filename)); if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) @@ -272,7 +327,7 @@ test_complete_removal(hid_t fapl) } /* end if */ /* Create some stuff */ - for(i=0; i < N_GHEAP_OBJS; i++) { + for(i = 0; i < N_GHEAP_OBJS; i++) { size = i % 30 + 100; HDmemset(out, 'A' + (int)i % 26, size); H5Eclear2(H5E_DEFAULT); @@ -295,6 +350,10 @@ test_complete_removal(hid_t fapl) if(H5Fclose(fid) < 0) goto error; if(nerrors) goto error; + HDfree(filename); + HDfree(obj); + HDfree(out); + PASSED(); return 0; @@ -302,6 +361,12 @@ test_complete_removal(hid_t fapl) H5E_BEGIN_TRY { H5Fclose(fid); } H5E_END_TRY; + if(filename) + HDfree(filename); + if(obj) + HDfree(obj); + if(out) + HDfree(out); return MAX(1, nerrors); } /* end test_complete_removal() */ @@ -324,17 +389,25 @@ test_complete_removal(hid_t fapl) static int test_partial_removal(hid_t fapl) { - hid_t fid = -1; /* HDF5 file ID */ - H5F_t *f = NULL; /* file object pointer */ - H5HG_t obj[N_GHEAP_OBJS]; /* global heap objects */ - uint8_t out[OBJ_BUF_SIZE]; /* global heap data received */ + char *filename = NULL; /* VFD-dependent filename */ + hid_t fid = -1; /* HDF5 file ID */ + H5F_t *f = NULL; /* file object pointer */ + H5HG_t *obj = NULL; /* global heap objects */ + uint8_t *out = NULL; /* global heap data received */ unsigned i; /* iterator */ - size_t size; /* heap object size */ - int nerrors = 0; /* # of errors encountered */ - char filename[FILENAME_SIZE]; /* VFD-dependent filename */ + size_t size; /* heap object size */ + int nerrors = 0; /* # of errors encountered */ TESTING("partial object removal"); + /* allocate memory */ + if(NULL == (filename = (char *)HDcalloc(FILENAME_SIZE, sizeof(char)))) + goto error; + if(NULL == (obj = (H5HG_t *)HDcalloc(N_GHEAP_OBJS, sizeof(H5HG_t)))) + goto error; + if(NULL == (out = (uint8_t *)HDcalloc(OBJ_BUF_SIZE, sizeof(uint8_t)))) + goto error; + /* Open a clean file */ h5_fixname(FILENAME[3], fapl, filename, sizeof(filename)); if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) @@ -375,6 +448,10 @@ test_partial_removal(hid_t fapl) if(H5Fclose(fid) < 0) goto error; if(nerrors) goto error; + HDfree(filename); + HDfree(obj); + HDfree(out); + PASSED(); return 0; @@ -382,6 +459,12 @@ test_partial_removal(hid_t fapl) H5E_BEGIN_TRY { H5Fclose(fid); } H5E_END_TRY; + if(filename) + HDfree(filename); + if(obj) + HDfree(obj); + if(out) + HDfree(out); return MAX(1, nerrors); } /* end test_partial_removal() */ @@ -405,15 +488,18 @@ test_partial_removal(hid_t fapl) static int test_ooo_indices(hid_t fapl) { - hid_t fid = -1; /* HDF5 file ID */ - H5F_t *f = NULL; /* file object pointer */ - H5HG_t *obj = NULL; /* global heap objects */ - unsigned i, j; /* iterators */ - int nerrors = 0; /* # of errors encountered */ - char filename[FILENAME_SIZE]; /* VFD-dependent filename */ + char *filename = NULL; /* VFD-dependent filename */ + hid_t fid = -1; /* HDF5 file ID */ + H5F_t *f = NULL; /* file object pointer */ + H5HG_t *obj = NULL; /* global heap objects */ + unsigned i, j; /* iterators */ + int nerrors = 0; /* # of errors encountered */ TESTING("out of order indices"); + /* allocate memory */ + if(NULL == (filename = (char *)HDcalloc(FILENAME_SIZE, sizeof(char)))) + goto error; if(NULL == (obj = (H5HG_t *)HDmalloc(2000 * sizeof(*obj)))) goto error; @@ -483,8 +569,9 @@ test_ooo_indices(hid_t fapl) if(H5Fclose(fid) < 0) goto error; if(nerrors) goto error; + HDfree(filename); HDfree(obj); - obj = NULL; + PASSED(); return 0; @@ -492,6 +579,8 @@ error: H5E_BEGIN_TRY { H5Fclose(fid); } H5E_END_TRY; + if(filename) + HDfree(filename); if(obj) HDfree(obj); return MAX(1, nerrors); -- cgit v0.12 From 745513e2b039515ccec52397cf7d1d807890bc9e Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Tue, 9 Feb 2016 11:51:28 -0500 Subject: [svn-r29074] fixed integer type for H5Sget_simple_extent_ndims_f argument --- fortran/src/H5Sff.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fortran/src/H5Sff.F90 b/fortran/src/H5Sff.F90 index e9b9b73..cb1388e 100644 --- a/fortran/src/H5Sff.F90 +++ b/fortran/src/H5Sff.F90 @@ -1784,7 +1784,7 @@ CONTAINS INTEGER, INTENT(OUT) :: hdferr !***** TYPE(C_PTR) :: start_c, stride_c, count_c, block_c - INTEGER(C_INT) :: n + INTEGER :: n INTERFACE INTEGER FUNCTION h5sget_regular_hyperslab(space_id, start, stride, count, block) BIND(C,NAME='H5Sget_regular_hyperslab') -- cgit v0.12 From 4da0790886dd7f52d9bd01ef5d9191f7ff729b3e Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 10 Feb 2016 12:54:15 -0500 Subject: [svn-r29076] Description: Normalize against the phdf5_metadata_opt branch, in preparation for merging it to trunk. Tested on: MacOSX/64 10.11.3 (amazon) w/serial, parallel, and production builds h5committest forthcoming --- src/H5ACprivate.h | 4 ++-- src/H5Cmpio.c | 24 ++++++++++++------------ src/H5Ddeprec.c | 4 +--- src/H5L.c | 2 +- src/H5Lexternal.c | 25 +++++++++++++++---------- src/H5O.c | 12 ++++++++---- src/H5Ocopy.c | 7 ++++--- src/H5Oprivate.h | 2 +- src/H5Pdxpl.c | 3 ++- src/H5Pint.c | 30 +++++++++++++++++++----------- src/H5R.c | 13 ++++++------- 11 files changed, 71 insertions(+), 55 deletions(-) diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index f441854..0231aa0 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -198,11 +198,11 @@ typedef H5C_t H5AC_t; H5_DLLVAR hid_t H5AC_dxpl_id; /* DXPL to be used in operations that will not result in I/O calls */ -extern hid_t H5AC_noio_dxpl_id; +H5_DLLVAR hid_t H5AC_noio_dxpl_id; /* DXPL to be used for raw data I/O operations when one is not provided by the user (fill values in H5Dcreate) */ -extern hid_t H5AC_rawdata_dxpl_id; +H5_DLLVAR hid_t H5AC_rawdata_dxpl_id; /* Default cache configuration. */ diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index 6e8d94c..44733c0 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -434,7 +434,7 @@ H5C_apply_candidate_list(H5F_t * f, */ if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't clear entry.") } /* end if */ /* Else, if this process needs to flush this entry. */ @@ -479,7 +479,7 @@ H5C_apply_candidate_list(H5F_t * f, cache_ptr->last_entry_removed_ptr = NULL; if(H5C__flush_single_entry(f, dxpl_id, flush_ptr, H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't flush entry.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry.") if ( ( cache_ptr->entries_removed_counter > 1 ) || ( cache_ptr->last_entry_removed_ptr == entry_ptr ) ) @@ -632,12 +632,12 @@ H5C_apply_candidate_list(H5F_t * f, entries_cleared++; #if ( H5C_APPLY_CANDIDATE_LIST__DEBUG > 1 ) - HDfprintf(stdout, "%s:%d: clearing 0x%llx.\n", FUNC, mpi_rank, - (long long)clear_ptr->addr); + HDfprintf(stdout, "%s:%d: clearing 0x%llx.\n", FUNC, mpi_rank, + (long long)clear_ptr->addr); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't clear entry.") } /* end else-if */ /* Else, if this process needs to independently flush this entry. */ @@ -653,7 +653,7 @@ H5C_apply_candidate_list(H5F_t * f, #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ if(H5C__flush_single_entry(f, dxpl_id, flush_ptr, H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't clear entry.") } /* end else-if */ } /* end if */ @@ -694,7 +694,7 @@ H5C_apply_candidate_list(H5F_t * f, } /* end if */ if(H5C__flush_single_entry(f, dxpl_id, delayed_ptr, H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't flush entry collectively.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry collectively.") entries_flushed_collectively++; entries_flushed_or_cleared_last++; @@ -710,9 +710,9 @@ H5C_apply_candidate_list(H5F_t * f, HDassert((entries_flushed_collectively == entries_to_flush_collectively)); if((entries_flushed != entries_to_flush) || - (entries_cleared != entries_to_clear) || - (entries_flushed_or_cleared_last != entries_to_flush_or_clear_last) || - (entries_flushed_collectively != entries_to_flush_collectively)) + (entries_cleared != entries_to_clear) || + (entries_flushed_or_cleared_last != entries_to_flush_or_clear_last) || + (entries_flushed_collectively != entries_to_flush_collectively)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry count mismatch.") done: @@ -1143,7 +1143,7 @@ H5C_mark_entries_as_clean(H5F_t * f, entries_cleared++; if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't clear entry.") } else { entry_ptr = entry_ptr->prev; @@ -1171,7 +1171,7 @@ H5C_mark_entries_as_clean(H5F_t * f, entries_cleared++; if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL) < 0 ) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't clear entry.") } else { entry_ptr = entry_ptr->next; diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index c5d6929..82545c1 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -179,8 +179,6 @@ H5Dopen1(hid_t loc_id, const char *name) { H5D_t *dset = NULL; H5G_loc_t loc; /* Object location of group */ - hid_t dapl_id = H5P_DATASET_ACCESS_DEFAULT; /* dapl to use to open dataset */ - hid_t dxpl_id = H5AC_dxpl_id; /* dxpl to use to open datset */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -193,7 +191,7 @@ H5Dopen1(hid_t loc_id, const char *name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") /* Open the dataset */ - if(NULL == (dset = H5D__open_name(&loc, name, dapl_id, dxpl_id))) + if(NULL == (dset = H5D__open_name(&loc, name, H5P_DATASET_ACCESS_DEFAULT, H5AC_dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset") /* Register an atom for the dataset */ diff --git a/src/H5L.c b/src/H5L.c index efe16aa..dd04990 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -717,7 +717,7 @@ H5Ldelete_by_idx(hid_t loc_id, const char *group_name, udata.idx_type = idx_type; udata.order = order; udata.n = n; - udata.dxpl_id = H5AC_dxpl_id; + udata.dxpl_id = dxpl_id; /* Traverse the group hierarchy to remove the link */ if(H5G_traverse(&loc, group_name, H5G_TARGET_SLINK|H5G_TARGET_UDLINK|H5G_TARGET_MOUNT, diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 732eb7b..5d4cb21 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -222,6 +222,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, char *actual_file_name = NULL; /* Parent file's actual name */ H5P_genplist_t *fa_plist; /* File access property list pointer */ H5F_close_degree_t fc_degree = H5F_CLOSE_WEAK; /* File close degree for target file */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -245,6 +246,10 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, if(NULL == (plist = H5P_object_verify(lapl_id, H5P_LINK_ACCESS))) HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, cur_group, FALSE) < 0) + HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Get the fapl_id set for lapl_id if any */ if(H5P_get(plist, H5L_ACS_ELINK_FAPL_NAME, &fapl_id) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get fapl for links") @@ -282,7 +287,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, parent_file_name = H5F_OPEN_NAME(loc.oloc->file); /* Query length of parent group name */ - if((group_name_len = H5G_get_name(&loc, NULL, (size_t) 0, NULL, lapl_id, H5AC_dxpl_id)) < 0) + if((group_name_len = H5G_get_name(&loc, NULL, (size_t) 0, NULL, lapl_id, dxpl_id)) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve length of group name") /* Account for null terminator */ @@ -297,7 +302,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, parent_group_name = local_group_name; /* Get parent group name */ - if(H5G_get_name(&loc, parent_group_name, (size_t) group_name_len, NULL, lapl_id, H5AC_dxpl_id) < 0) + if(H5G_get_name(&loc, parent_group_name, (size_t) group_name_len, NULL, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to retrieve group name") /* Make callback */ @@ -328,7 +333,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, /* target file_name is an absolute pathname: see RM for detailed description */ if(H5_CHECK_ABSOLUTE(file_name) || H5_CHECK_ABS_PATH(file_name)) { /* Try opening file */ - if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id))) { + if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) { char *ptr; H5E_clear_stack(NULL); @@ -347,7 +352,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, } /* end if */ else if(H5_CHECK_ABS_DRIVE(file_name)) { /* Try opening file */ - if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id))) { + if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) { H5E_clear_stack(NULL); @@ -377,7 +382,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't prepend prefix to filename") } /* end if */ - ext_file = H5F_efc_open(loc.oloc->file, full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id); + ext_file = H5F_efc_open(loc.oloc->file, full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id); full_name = (char *)H5MM_xfree(full_name); if(ext_file != NULL) break; @@ -395,7 +400,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, if(my_prefix) { if(H5L_build_name(my_prefix, temp_file_name, &full_name/*out*/) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't prepend prefix to filename") - if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id))) + if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) H5E_clear_stack(NULL); full_name = (char *)H5MM_xfree(full_name); } /* end if */ @@ -408,7 +413,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, if(NULL != (extpath = H5F_EXTPATH(loc.oloc->file))) { if(H5L_build_name(extpath, temp_file_name, &full_name/*out*/) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't prepend prefix to filename") - if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id))) + if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) H5E_clear_stack(NULL); full_name = (char *)H5MM_xfree(full_name); } /* end if */ @@ -416,7 +421,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, /* try the relative file_name stored in temp_file_name */ if(ext_file == NULL) { - if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, temp_file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id))) + if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, temp_file_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) H5E_clear_stack(NULL); } /* end if */ @@ -443,7 +448,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't prepend prefix to filename") /* Try opening with the resolved name */ - if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, H5AC_dxpl_id))) + if(NULL == (ext_file = H5F_efc_open(loc.oloc->file, full_name, intent, H5P_FILE_CREATE_DEFAULT, fapl_id, dxpl_id))) HGOTO_ERROR(H5E_LINK, H5E_CANTOPENFILE, FAIL, "unable to open external file, external link file name = '%s', temp_file_name = '%s'", file_name, temp_file_name) full_name = (char *)H5MM_xfree(full_name); } /* end if */ @@ -454,7 +459,7 @@ H5L_extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unable to create location for file") /* Open the object referenced in the external file */ - if((ext_obj = H5O_open_name(&root_loc, obj_name, lapl_id, FALSE)) < 0) + if((ext_obj = H5O_open_name(&root_loc, obj_name, lapl_id, dxpl_id, FALSE)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open object") /* Set return value */ diff --git a/src/H5O.c b/src/H5O.c index b22528a..dfcfee9 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -231,6 +231,7 @@ hid_t H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) { H5G_loc_t loc; + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value = FAIL; FUNC_ENTER_API(FAIL) @@ -242,8 +243,12 @@ H5Oopen(hid_t loc_id, const char *name, hid_t lapl_id) if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&lapl_id, H5P_CLS_LACC, &dxpl_id, loc_id, FALSE) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Open the object */ - if((ret_value = H5O_open_name(&loc, name, lapl_id, TRUE)) < 0) + if((ret_value = H5O_open_name(&loc, name, lapl_id, dxpl_id, TRUE)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open object") done: @@ -724,7 +729,7 @@ H5Oget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, loc_found = TRUE; /* Retrieve the object's information */ - if(H5O_get_info(obj_loc.oloc, H5AC_dxpl_id, TRUE, oinfo) < 0) + if(H5O_get_info(obj_loc.oloc, dxpl_id, TRUE, oinfo) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info") done: @@ -1345,13 +1350,12 @@ done: *------------------------------------------------------------------------- */ hid_t -H5O_open_name(H5G_loc_t *loc, const char *name, hid_t lapl_id, hbool_t app_ref) +H5O_open_name(H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id, hbool_t app_ref) { H5G_loc_t obj_loc; /* Location used to open group */ H5G_name_t obj_path; /* Opened object group hier. path */ H5O_loc_t obj_oloc; /* Opened object object location */ hbool_t loc_found = FALSE; /* Entry at 'name' found */ - hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value = FAIL; FUNC_ENTER_NOAPI(FAIL) diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 2bb7a36..0abe69d 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -216,6 +216,7 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, htri_t dst_exists; /* Does destination name exist already? */ hbool_t loc_found = FALSE; /* Location at 'name' found */ hbool_t obj_open = FALSE; /* Entry at 'name' found */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) @@ -233,7 +234,7 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no destination name specified") /* check if destination name already exists */ - if((dst_exists = H5L_exists_tolerant(&dst_loc, dst_name, H5P_DEFAULT, H5AC_dxpl_id)) < 0) + if((dst_exists = H5L_exists_tolerant(&dst_loc, dst_name, H5P_DEFAULT, dxpl_id)) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to check if destination name exists") if(TRUE == dst_exists) HGOTO_ERROR(H5E_OHDR, H5E_EXISTS, FAIL, "destination object already exists") @@ -244,7 +245,7 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, H5G_loc_reset(&src_loc); /* Find the source object to copy */ - if(H5G_loc_find(&loc, src_name, &src_loc/*out*/, H5P_DEFAULT, H5AC_dxpl_id) < 0) + if(H5G_loc_find(&loc, src_name, &src_loc/*out*/, H5P_DEFAULT, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "source object not found") loc_found = TRUE; @@ -270,7 +271,7 @@ H5Ocopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not object copy property list") /* Do the actual copying of the object */ - if(H5O_copy_obj(&src_loc, &dst_loc, dst_name, ocpypl_id, lcpl_id, H5AC_dxpl_id) < 0) + if(H5O_copy_obj(&src_loc, &dst_loc, dst_name, ocpypl_id, lcpl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "unable to copy object") done: diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 9235d6c..4ce8e59 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -763,7 +763,7 @@ H5_DLL herr_t H5O_get_info(const H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih H5O_info_t *oinfo); H5_DLL herr_t H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type, hid_t dxpl_id); H5_DLL herr_t H5O_get_create_plist(const H5O_loc_t *loc, hid_t dxpl_id, struct H5P_genplist_t *oc_plist); -H5_DLL hid_t H5O_open_name(H5G_loc_t *loc, const char *name, hid_t lapl_id, hbool_t app_ref); +H5_DLL hid_t H5O_open_name(H5G_loc_t *loc, const char *name, hid_t lapl_id, hid_t dxpl_id, hbool_t app_ref); H5_DLL herr_t H5O_get_nlinks(const H5O_loc_t *loc, hid_t dxpl_id, hsize_t *nlinks); H5_DLL void *H5O_obj_create(H5F_t *f, H5O_type_t obj_type, void *crt_info, H5G_loc_t *obj_loc, hid_t dxpl_id); H5_DLL haddr_t H5O_get_oh_addr(const H5O_t *oh); diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 89dcd16..3ff71dc 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -485,11 +485,12 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - /* Register the ring property */ + /* Register the ring property (private) */ if(H5P_register_real(pclass, H5AC_RING_NAME, H5AC_XFER_RING_SIZE, &H5D_ring_g, NULL, NULL, NULL, H5AC_XFER_RING_ENC, H5AC_XFER_RING_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + #ifdef H5_DEBUG_BUILD /* Register the dxpl IO type property */ if(H5P_register_real(pclass, H5FD_DXPL_TYPE_NAME, H5FD_DXPL_TYPE_SIZE, &H5D_dxpl_type_g, diff --git a/src/H5Pint.c b/src/H5Pint.c index b3d1976..4818021 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -5450,8 +5450,16 @@ H5P_get_class(const H5P_genplist_t *plist) *------------------------------------------------------------------------- */ herr_t -H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, - hid_t *dxpl_id, hid_t loc_id, hbool_t is_collective) +H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t *dxpl_id, + hid_t +#ifndef H5_HAVE_PARALLEL + H5_ATTR_UNUSED +#endif /* H5_HAVE_PARALLEL */ + loc_id, hbool_t +#ifndef H5_HAVE_PARALLEL + H5_ATTR_UNUSED +#endif /* H5_HAVE_PARALLEL */ + is_collective) { herr_t ret_value = SUCCEED; /* Return value */ @@ -5462,15 +5470,6 @@ H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, HDassert(libclass); HDassert(dxpl_id); - /* Set access plist to the default property list of the appropriate class if it's the generic default */ - if(H5P_DEFAULT == *acspl_id) - *acspl_id = *libclass->def_plist_id; - else { - /* Sanity check the access property list class */ - if(TRUE != H5P_isa_class(*acspl_id, *libclass->class_id)) - HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not the required access property list") - } /* end else */ - #ifdef H5_HAVE_PARALLEL /* If parallel is enabled and the file driver used in the MPI-IO VFD, issue an MPI barrier for easier debugging if the API function @@ -5490,6 +5489,15 @@ H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, } #endif /* H5_HAVE_PARALLEL */ + /* Set access plist to the default property list of the appropriate class if it's the generic default */ + if(H5P_DEFAULT == *acspl_id) + *acspl_id = *libclass->def_plist_id; + else { + /* Sanity check the access property list class */ + if(TRUE != H5P_isa_class(*acspl_id, *libclass->class_id)) + HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not the required access property list") + } /* end else */ + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P_verify_apl_and_dxpl() */ diff --git a/src/H5R.c b/src/H5R.c index 04d61cd..bc49364 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -541,12 +541,6 @@ H5R_dereference(H5F_t *file, hid_t oapl_id, hid_t dxpl_id, H5R_type_t ref_type, { H5D_t *dset; /* Pointer to dataset to open */ - /* Get correct property list */ - if(H5P_DEFAULT == oapl_id) - oapl_id = H5P_DATASET_ACCESS_DEFAULT; - else if(TRUE != H5P_isa_class(oapl_id, H5P_DATASET_ACCESS)) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset access property list") - /* Open the dataset */ if(NULL == (dset = H5D_open(&loc, oapl_id, dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_NOTFOUND, FAIL, "not found") @@ -602,6 +596,7 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r { H5G_loc_t loc; /* Group location */ H5F_t *file = NULL; /* File object */ + hid_t dxpl_id = H5AC_dxpl_id; /* dxpl used by library */ hid_t ret_value; FUNC_ENTER_API(FAIL) @@ -617,11 +612,15 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r if(_ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") + /* Verify access property list and get correct dxpl */ + if(H5P_verify_apl_and_dxpl(&oapl_id, H5P_CLS_DACC, &dxpl_id, obj_id, FALSE) < 0) + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + /* Get the file pointer from the entry */ file = loc.oloc->file; /* Create reference */ - if((ret_value = H5R_dereference(file, oapl_id, H5AC_dxpl_id, ref_type, _ref, TRUE)) < 0) + if((ret_value = H5R_dereference(file, oapl_id, dxpl_id, ref_type, _ref, TRUE)) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "unable to dereference object") done: -- cgit v0.12 From c8a6c6030a768952bc4161b2bf30c948b8b58723 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 10 Feb 2016 12:55:55 -0500 Subject: [svn-r29077] Description: Normalize against the trunk, in preparation for final merge. Tested on: MacOSX/64 10.11.3 (amazon) w/serial & parallel (h5committest not required on this branch) --- src/H5AC.c | 5 +- src/H5ACmpio.c | 2 +- src/H5ACprivate.h | 15 +- src/H5C.c | 527 +++++++++++++++----------------------------------- src/H5Cmpio.c | 205 +++++++++++--------- src/H5Cpkg.h | 15 +- src/H5Cprivate.h | 3 +- src/H5Dchunk.c | 17 +- src/H5Ddeprec.c | 3 +- src/H5Fint.c | 30 +++ src/H5Fprivate.h | 13 ++ src/H5Fquery.c | 28 +++ src/H5Pdxpl.c | 5 +- src/H5Pint.c | 16 +- src/H5Plapl.c | 4 +- src/H5Pprivate.h | 4 +- src/H5R.c | 4 +- testpar/t_cache.c | 2 +- testpar/t_mdset.c | 2 +- testpar/t_shapesame.c | 4 +- testpar/testphdf5.c | 5 +- 21 files changed, 392 insertions(+), 517 deletions(-) diff --git a/src/H5AC.c b/src/H5AC.c index 12417f2..01fdb72 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -88,8 +88,6 @@ hid_t H5AC_dxpl_id; hid_t H5AC_coll_read_dxpl_id = (-1); #endif /* H5_HAVE_PARALLEL */ -/* global flag for collective API sanity checks */ - /* DXPL to be used in operations that will not result in I/O calls */ hid_t H5AC_noio_dxpl_id = (-1); @@ -216,7 +214,7 @@ H5AC__init_package(void) /* Get the property list object */ if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_ind_read_dxpl_id))) HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") - /* set metadata dxpl type */ + /* Insert the dxpl type property */ dxpl_type = H5FD_METADATA_DXPL; if(H5P_set(xfer_plist, H5FD_DXPL_TYPE_NAME, &dxpl_type) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set dxpl type property") @@ -551,7 +549,6 @@ H5AC_dest(H5F_t *f, hid_t dxpl_id) HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") aux_ptr = (H5AC_aux_t *)H5C_get_aux_ptr(f->shared->cache); - if(aux_ptr) /* Sanity check */ HDassert(aux_ptr->magic == H5AC__H5AC_AUX_T_MAGIC); diff --git a/src/H5ACmpio.c b/src/H5ACmpio.c index 353805d..db291cf 100644 --- a/src/H5ACmpio.c +++ b/src/H5ACmpio.c @@ -2067,7 +2067,7 @@ HDfprintf(stdout, "%d:H5AC_propagate...:%u: (u/uu/i/iu/r/ru) = %zu/%u/%zu/%u/%zu /* clear collective access flag on half of the entries in the cache and mark them as independent in case they need to be - evicted later. All ranks are guranteed to mark the same entires + evicted later. All ranks are guranteed to mark the same entries since we don't modify the order of the collectively accessed entries except through collective access. */ if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0) diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h index 7481f0a..71ddcf3 100644 --- a/src/H5ACprivate.h +++ b/src/H5ACprivate.h @@ -181,13 +181,6 @@ typedef H5C_cache_entry_t H5AC_info_t; /* Typedef for metadata cache (defined in H5Cpkg.h) */ typedef H5C_t H5AC_t; -#ifdef H5_HAVE_PARALLEL -/* Definitions for "collective metadata write" property */ -#define H5AC_COLLECTIVE_META_WRITE_NAME "H5AC_collective_metadata_write" -#define H5AC_COLLECTIVE_META_WRITE_SIZE sizeof(hbool_t) -#define H5AC_COLLECTIVE_META_WRITE_DEF 0 -#endif /* H5_HAVE_PARALLEL */ - #define H5AC_METADATA_TAG_NAME "H5AC_metadata_tag" #define H5AC_METADATA_TAG_SIZE sizeof(haddr_t) #define H5AC_METADATA_TAG_DEF H5AC__INVALID_TAG @@ -196,17 +189,17 @@ typedef H5C_t H5AC_t; /* Dataset transfer property list for metadata calls */ H5_DLLVAR hid_t H5AC_dxpl_id; -extern hid_t H5AC_ind_read_dxpl_id; +H5_DLLVAR hid_t H5AC_ind_read_dxpl_id; #ifdef H5_HAVE_PARALLEL -extern hid_t H5AC_coll_read_dxpl_id; +H5_DLLVAR hid_t H5AC_coll_read_dxpl_id; #endif /* H5_HAVE_PARALLEL */ /* DXPL to be used in operations that will not result in I/O calls */ -extern hid_t H5AC_noio_dxpl_id; +H5_DLLVAR hid_t H5AC_noio_dxpl_id; /* DXPL to be used for raw data I/O operations when one is not provided by the user (fill values in H5Dcreate) */ -extern hid_t H5AC_rawdata_dxpl_id; +H5_DLLVAR hid_t H5AC_rawdata_dxpl_id; /* Default cache configuration. */ diff --git a/src/H5C.c b/src/H5C.c index 100fbe0..37b0df2 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -93,7 +93,6 @@ #include "H5MFprivate.h" /* File memory management */ #include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ -#include "H5SLprivate.h" /* Skip lists */ /****************/ @@ -182,7 +181,7 @@ static herr_t H5C_mark_tagged_entries(H5C_t * cache_ptr, static herr_t H5C_flush_marked_entries(H5F_t * f, hid_t dxpl_id); -static herr_t H5C__generate_image(H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr, +static herr_t H5C__generate_image(const H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr, hid_t dxpl_id, int64_t *entry_size_change_ptr); #if H5C_DO_TAGGING_SANITY_CHECKS @@ -225,6 +224,9 @@ hbool_t H5_PKG_INIT_VAR = FALSE; /* Declare a free list to manage the H5C_t struct */ H5FL_DEFINE_STATIC(H5C_t); +/* Declare extern free list to manage the H5C_collective_write_t struct */ +H5FL_EXTERN(H5C_collective_write_t); + /**************************************************************************** @@ -1006,7 +1008,7 @@ H5C_expunge_entry(H5F_t *f, hid_t dxpl_id, const H5C_class_t *type, flush_flags |= H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG; if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, flush_flags, NULL, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "H5C_flush_single_entry() failed.") + HGOTO_ERROR(H5E_CACHE, H5E_CANTEXPUNGE, FAIL, "can't flush entry") #if H5C_DO_SANITY_CHECKS if ( entry_was_dirty ) @@ -1913,8 +1915,10 @@ H5C_insert_entry(H5F_t * f, entry_ptr->aux_next = NULL; entry_ptr->aux_prev = NULL; +#ifdef H5_HAVE_PARALLEL entry_ptr->coll_next = NULL; entry_ptr->coll_prev = NULL; +#endif /* H5_HAVE_PARALLEL */ H5C__RESET_CACHE_ENTRY_STATS(entry_ptr) @@ -2041,19 +2045,18 @@ H5C_insert_entry(H5F_t * f, /* Make sure the size of the collective entries in the cache remain in check */ if(H5P_USER_TRUE == f->coll_md_read) { - if(cache_ptr->max_cache_size*80 < cache_ptr->coll_list_size*100) { - if(H5C_clear_coll_entries(cache_ptr, 1) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") + if(cache_ptr->max_cache_size * 80 < cache_ptr->coll_list_size * 100) { + if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear collective metadata entries") } /* end if */ } /* end if */ else { - if(cache_ptr->max_cache_size*40 < cache_ptr->coll_list_size*100) { - if(H5C_clear_coll_entries(cache_ptr, 1) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "H5C_clear_coll_entries() failed.") + if(cache_ptr->max_cache_size * 40 < cache_ptr->coll_list_size * 100) { + if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't clear collective metadata entries") } /* end if */ } /* end else */ } /* end if */ - entry_ptr->ind_access_while_coll = FALSE; #endif done: @@ -2724,52 +2727,52 @@ H5C_protect(H5F_t * f, the entry in their cache still have to participate in the bcast. */ #ifdef H5_HAVE_PARALLEL - if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && coll_access && - !(entry_ptr->is_dirty) && !(entry_ptr->coll_access)) { - MPI_Comm comm; /* File MPI Communicator */ - int mpi_code; /* MPI error code */ - int buf_size; + if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && coll_access) { + if(!(entry_ptr->is_dirty) && !(entry_ptr->coll_access)) { + MPI_Comm comm; /* File MPI Communicator */ + int mpi_code; /* MPI error code */ + int buf_size; - if(MPI_COMM_NULL == (comm = H5F_mpi_get_comm(f))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "get_comm request failed") + if(MPI_COMM_NULL == (comm = H5F_mpi_get_comm(f))) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "get_comm request failed") - if(entry_ptr->image_ptr == NULL) { - int mpi_rank; - size_t image_size; + if(entry_ptr->image_ptr == NULL) { + int mpi_rank; + size_t image_size; - if((mpi_rank = H5F_mpi_get_rank(f)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank") + if((mpi_rank = H5F_mpi_get_rank(f)) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "Can't get MPI rank") - if(entry_ptr->compressed) - image_size = entry_ptr->compressed_size; - else - image_size = entry_ptr->size; - HDassert(image_size > 0); + if(entry_ptr->compressed) + image_size = entry_ptr->compressed_size; + else + image_size = entry_ptr->size; + HDassert(image_size > 0); - if(NULL == (entry_ptr->image_ptr = H5MM_malloc(image_size + H5C_IMAGE_EXTRA_SPACE))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer") + if(NULL == (entry_ptr->image_ptr = H5MM_malloc(image_size + H5C_IMAGE_EXTRA_SPACE))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer") #if H5C_DO_MEMORY_SANITY_CHECKS - HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + image_size, - H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); + HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + image_size, + H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ - if(0 == mpi_rank) - if(H5C__generate_image(f, cache_ptr, entry_ptr, dxpl_id, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "Can't get Image") - } /* end if */ - - HDassert(entry_ptr->image_ptr); - - H5_CHECKED_ASSIGN(buf_size, int, entry_ptr->size, size_t); - if(MPI_SUCCESS != (mpi_code = MPI_Bcast(entry_ptr->image_ptr, buf_size, MPI_BYTE, 0, comm))) - HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) + if(0 == mpi_rank) + if(H5C__generate_image(f, cache_ptr, entry_ptr, dxpl_id, NULL) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "can't generate entry's image") + } /* end if */ + HDassert(entry_ptr->image_ptr); - entry_ptr->coll_access = TRUE; + H5_CHECKED_ASSIGN(buf_size, int, entry_ptr->size, size_t); + if(MPI_SUCCESS != (mpi_code = MPI_Bcast(entry_ptr->image_ptr, buf_size, MPI_BYTE, 0, comm))) + HMPI_GOTO_ERROR(NULL, "MPI_Bcast failed", mpi_code) - H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) + /* Mark the entry as collective and insert into the collective list */ + entry_ptr->coll_access = TRUE; + H5C__INSERT_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) + } /* end if */ + else if(entry_ptr->coll_access) { + H5C__MOVE_TO_TOP_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) + } /* end else-if */ } /* end if */ - else if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI) && coll_access && entry_ptr->coll_access) { - H5C__MOVE_TO_TOP_IN_COLL_LIST(cache_ptr, entry_ptr, NULL) - } /* end else-if */ #endif /* H5_HAVE_PARALLEL */ #if H5C_DO_TAGGING_SANITY_CHECKS @@ -3057,16 +3060,16 @@ H5C_protect(H5F_t * f, #ifdef H5_HAVE_PARALLEL if(H5F_HAS_FEATURE(f, H5FD_FEAT_HAS_MPI)) { /* Make sure the size of the collective entries in the cache remain in check */ - if(TRUE == coll_access) { + if(coll_access) { if(H5P_USER_TRUE == f->coll_md_read) { if(cache_ptr->max_cache_size * 80 < cache_ptr->coll_list_size * 100) - if(H5C_clear_coll_entries(cache_ptr, 1) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "H5C_clear_coll_entries() failed.") + if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "can't clear collective metadata entries") } /* end if */ else { if(cache_ptr->max_cache_size * 40 < cache_ptr->coll_list_size * 100) - if(H5C_clear_coll_entries(cache_ptr, 1) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "H5C_clear_coll_entries() failed.") + if(H5C_clear_coll_entries(cache_ptr, TRUE) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "can't clear collective metadata entries") } /* end else */ } /* end if */ } /* end if */ @@ -7707,7 +7710,11 @@ done: */ herr_t H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ptr, - unsigned flags, int64_t *entry_size_change_ptr, H5SL_t *collective_write_list) + unsigned flags, int64_t *entry_size_change_ptr, H5SL_t +#ifndef H5_HAVE_PARALLEL + H5_ATTR_UNUSED +#endif /* NDEBUG */ + *collective_write_list) { H5C_t * cache_ptr; /* Cache for file */ hbool_t destroy; /* external flag */ @@ -7718,11 +7725,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ hbool_t write_entry; /* internal flag */ hbool_t destroy_entry; /* internal flag */ hbool_t was_dirty; - haddr_t new_addr = HADDR_UNDEF; - haddr_t old_addr = HADDR_UNDEF; haddr_t entry_addr = HADDR_UNDEF; - size_t new_len = 0; - size_t new_compressed_len = 0; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -7807,7 +7810,6 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ /* serialize the entry if necessary, and then write it to disk. */ if(write_entry) { - unsigned serialize_flags = H5C__SERIALIZE_NO_FLAGS_SET; /* The entry is dirty, and we are doing either a flush, * or a flush destroy. In either case, serialize the @@ -7847,225 +7849,9 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ } /* end if */ if(!(entry_ptr->image_up_to_date)) { - /* reset cache_ptr->slist_changed so we can detect slist - * modifications in the pre_serialize call. - */ - cache_ptr->slist_changed = FALSE; - - /* make note of the entry's current address */ - old_addr = entry_ptr->addr; - - /* Call client's pre-serialize callback, if there's one */ - if ( ( entry_ptr->type->pre_serialize != NULL ) && - ( (entry_ptr->type->pre_serialize)(f, dxpl_id, - (void *)entry_ptr, - entry_ptr->addr, - entry_ptr->size, - entry_ptr->compressed_size, - &new_addr, &new_len, - &new_compressed_len, - &serialize_flags) < 0 ) ) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to pre-serialize entry") - - /* set cache_ptr->slist_change_in_pre_serialize if the - * slist was modified. - */ - if(cache_ptr->slist_changed) - cache_ptr->slist_change_in_pre_serialize = TRUE; - - /* Check for any flags set in the pre-serialize callback */ - if(serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) { - /* Check for unexpected flags from serialize callback */ - if(serialize_flags & ~(H5C__SERIALIZE_RESIZED_FLAG | - H5C__SERIALIZE_MOVED_FLAG | - H5C__SERIALIZE_COMPRESSED_FLAG)) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unknown serialize flag(s)") -#ifdef H5_HAVE_PARALLEL - /* In the parallel case, resizes and moves in - * the serialize operation can cause problems. - * If they occur, scream and die. - * - * At present, in the parallel case, the aux_ptr - * will only be set if there is more than one - * process. Thus we can use this to detect - * the parallel case. - * - * This works for now, but if we start using the - * aux_ptr for other purposes, we will have to - * change this test accordingly. - * - * NB: While this test detects entryies that attempt - * to resize or move themselves during a flush - * in the parallel case, it will not detect an - * entry that dirties, resizes, and/or moves - * other entries during its flush. - * - * From what Quincey tells me, this test is - * sufficient for now, as any flush routine that - * does the latter will also do the former. - * - * If that ceases to be the case, further - * tests will be necessary. - */ - if(cache_ptr->aux_ptr != NULL) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "resize/move in serialize occured in parallel case.") -#endif /* H5_HAVE_PARALLEL */ - - /* Resize the buffer if required */ - if ( ( ( ! entry_ptr->compressed ) && - ( serialize_flags & H5C__SERIALIZE_RESIZED_FLAG ) ) || - ( ( entry_ptr->compressed ) && - ( serialize_flags & H5C__SERIALIZE_COMPRESSED_FLAG ) ) ) - { - size_t new_image_size; - - if(entry_ptr->compressed) - new_image_size = new_compressed_len; - else - new_image_size = new_len; - HDassert(new_image_size > 0); - - /* Release the current image */ - if(entry_ptr->image_ptr) - entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr); - - /* Allocate a new image buffer */ - if(NULL == (entry_ptr->image_ptr = H5MM_malloc(new_image_size + H5C_IMAGE_EXTRA_SPACE))) - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer") -#if H5C_DO_MEMORY_SANITY_CHECKS - HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + new_image_size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); -#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ - } /* end if */ - - /* If required, update the entry and the cache data structures - * for a resize. - */ - if(serialize_flags & H5C__SERIALIZE_RESIZED_FLAG) { - H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, \ - entry_ptr, new_len) - - /* update the hash table for the size change*/ - H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, \ - entry_ptr->size, \ - new_len, entry_ptr, \ - !(entry_ptr->is_dirty)); - - /* The entry can't be protected since we are - * in the process of flushing it. Thus we must - * update the replacement policy data - * structures for the size change. The macro - * deals with the pinned case. - */ - H5C__UPDATE_RP_FOR_SIZE_CHANGE(cache_ptr, entry_ptr, new_len); - - /* as we haven't updated the cache data structures for - * for the flush or flush destroy yet, the entry should - * be in the slist. Thus update it for the size change. - */ - HDassert(entry_ptr->in_slist); - H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, \ - new_len) - - /* if defined, update *entry_size_change_ptr for the - * change in entry size. - */ - if(entry_size_change_ptr != NULL) - *entry_size_change_ptr = (int64_t)new_len - (int64_t)(entry_ptr->size); - - /* finally, update the entry for its new size */ - entry_ptr->size = new_len; - } /* end if */ - - /* If required, udate the entry and the cache data structures - * for a move - */ - if(serialize_flags & H5C__SERIALIZE_MOVED_FLAG) { -#if H5C_DO_SANITY_CHECKS - int64_t saved_slist_len_increase; - int64_t saved_slist_size_increase; -#endif /* H5C_DO_SANITY_CHECKS */ - - H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr) - - if(entry_ptr->addr == old_addr) { - /* we must update cache data structures for the - * change in address. - */ - - /* delete the entry from the hash table and the slist */ - H5C__DELETE_FROM_INDEX(cache_ptr, entry_ptr) - H5C__REMOVE_ENTRY_FROM_SLIST(cache_ptr, entry_ptr) - - /* update the entry for its new address */ - entry_ptr->addr = new_addr; - - /* and then reinsert in the index and slist */ - H5C__INSERT_IN_INDEX(cache_ptr, entry_ptr, FAIL) - -#if H5C_DO_SANITY_CHECKS - /* save cache_ptr->slist_len_increase and - * cache_ptr->slist_size_increase before the - * reinsertion into the slist, and restore - * them afterwards to avoid skewing our sanity - * checking. - */ - saved_slist_len_increase = cache_ptr->slist_len_increase; - saved_slist_size_increase = cache_ptr->slist_size_increase; -#endif /* H5C_DO_SANITY_CHECKS */ - - H5C__INSERT_ENTRY_IN_SLIST(cache_ptr, entry_ptr, FAIL) - -#if H5C_DO_SANITY_CHECKS - cache_ptr->slist_len_increase = saved_slist_len_increase; - cache_ptr->slist_size_increase = saved_slist_size_increase; -#endif /* H5C_DO_SANITY_CHECKS */ - } - else /* move is alread done for us -- just do sanity checks */ - HDassert(entry_ptr->addr == new_addr); - } /* end if */ - - if(serialize_flags & H5C__SERIALIZE_COMPRESSED_FLAG) { - /* just save the new compressed entry size in - * entry_ptr->compressed_size. We don't need to - * do more, as compressed size is only used for I/O. - */ - HDassert(entry_ptr->compressed); - entry_ptr->compressed_size = new_compressed_len; - } - } /* end if ( serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET ) */ - - /* Serialize object into buffer */ - { - size_t image_len; - - if(entry_ptr->compressed) - image_len = entry_ptr->compressed_size; - else - image_len = entry_ptr->size; - - /* reset cache_ptr->slist_changed so we can detect slist - * modifications in the serialize call. - */ - cache_ptr->slist_changed = FALSE; - - - if(entry_ptr->type->serialize(f, entry_ptr->image_ptr, - image_len, (void *)entry_ptr) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to serialize entry") - - /* set cache_ptr->slist_change_in_serialize if the - * slist was modified. - */ - if(cache_ptr->slist_changed) - cache_ptr->slist_change_in_pre_serialize = TRUE; - -#if H5C_DO_MEMORY_SANITY_CHECKS - HDassert(0 == HDmemcmp(((uint8_t *)entry_ptr->image_ptr) + image_len, - H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE)); -#endif /* H5C_DO_MEMORY_SANITY_CHECKS */ - - entry_ptr->image_up_to_date = TRUE; - } + /* Generate the entry's image */ + if(H5C__generate_image(f, cache_ptr, entry_ptr, dxpl_id, entry_size_change_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, FAIL, "can't generate entry's image") } /* end if ( ! (entry_ptr->image_up_to_date) ) */ /* Finally, write the image to disk. @@ -8091,10 +7877,10 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ #ifdef H5_HAVE_PARALLEL if(collective_write_list) { - H5C_collective_write_t *item = NULL; + H5C_collective_write_t *item; - if(NULL == (item = (H5C_collective_write_t *)H5MM_malloc(sizeof(H5C_collective_write_t)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate skip list item") + if(NULL == (item = (H5C_collective_write_t *)H5FL_MALLOC(H5C_collective_write_t))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "unable to allocate skip list item") item->length = image_size; item->free_buf = FALSE; @@ -8103,7 +7889,7 @@ H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ if(H5SL_insert(collective_write_list, item, &item->offset) < 0) { H5MM_free(item); - HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "unable to insert skip list item") + HGOTO_ERROR(H5E_CACHE, H5E_CANTINSERT, FAIL, "unable to insert skip list item") } /* end if */ } /* end if */ else @@ -8778,7 +8564,6 @@ H5C_load_entry(H5F_t * f, entry->clear_on_unprotect = FALSE; entry->flush_immediately = FALSE; entry->coll_access = coll_access; - entry->ind_access_while_coll = FALSE; #endif /* H5_HAVE_PARALLEL */ entry->flush_in_progress = FALSE; entry->destroy_in_progress = FALSE; @@ -8799,8 +8584,10 @@ H5C_load_entry(H5F_t * f, entry->aux_next = NULL; entry->aux_prev = NULL; +#ifdef H5_HAVE_PARALLEL entry->coll_next = NULL; entry->coll_prev = NULL; +#endif /* H5_HAVE_PARALLEL */ H5C__RESET_CACHE_ENTRY_STATS(entry); @@ -9018,13 +8805,6 @@ H5C_make_space_in_cache(H5F_t * f, cache_ptr->entries_scanned_to_make_space++; #endif /* H5C_COLLECT_CACHE_STATS */ -#ifdef H5_HAVE_PARALLEL - if(TRUE == entry_ptr->coll_access) { - entry_ptr->coll_access = FALSE; - H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) - } /* end if */ -#endif - if(H5C__flush_single_entry(f, dxpl_id, entry_ptr, H5C__FLUSH_INVALIDATE_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush entry") } else { @@ -10207,9 +9987,22 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C_get_entry_ring() */ + +/*------------------------------------------------------------------------- + * Function: H5C__generate_image + * + * Purpose: Serialize an entry and generate its image. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Mohamad Chaarawi + * 2/10/16 + * + *------------------------------------------------------------------------- + */ static herr_t -H5C__generate_image(H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr, - hid_t dxpl_id, int64_t *entry_size_change_ptr) +H5C__generate_image(const H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr, + hid_t dxpl_id, int64_t *entry_size_change_ptr) { haddr_t new_addr = HADDR_UNDEF; haddr_t old_addr = HADDR_UNDEF; @@ -10218,8 +10011,9 @@ H5C__generate_image(H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr, unsigned serialize_flags = H5C__SERIALIZE_NO_FLAGS_SET; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC + /* Sanity check */ HDassert(!entry_ptr->image_up_to_date); /* reset cache_ptr->slist_changed so we can detect slist @@ -10231,93 +10025,91 @@ H5C__generate_image(H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr, old_addr = entry_ptr->addr; /* Call client's pre-serialize callback, if there's one */ - if ( ( entry_ptr->type->pre_serialize != NULL ) && - ( (entry_ptr->type->pre_serialize)(f, dxpl_id, - (void *)entry_ptr, - entry_ptr->addr, - entry_ptr->size, - entry_ptr->compressed_size, - &new_addr, &new_len, - &new_compressed_len, - &serialize_flags) < 0 ) ) { - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "unable to pre-serialize entry"); - } + if(entry_ptr->type->pre_serialize && + (entry_ptr->type->pre_serialize)(f, dxpl_id, + (void *)entry_ptr, entry_ptr->addr, entry_ptr->size, + entry_ptr->compressed_size, &new_addr, &new_len, + &new_compressed_len, &serialize_flags) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to pre-serialize entry") /* set cache_ptr->slist_change_in_pre_serialize if the * slist was modified. */ - if ( cache_ptr->slist_changed ) + if(cache_ptr->slist_changed) cache_ptr->slist_change_in_pre_serialize = TRUE; /* Check for any flags set in the pre-serialize callback */ - if ( serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET ) { + if(serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) { /* Check for unexpected flags from serialize callback */ - if ( serialize_flags & ~(H5C__SERIALIZE_RESIZED_FLAG | - H5C__SERIALIZE_MOVED_FLAG | - H5C__SERIALIZE_COMPRESSED_FLAG)) { - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "unknown serialize flag(s)"); - } + if(serialize_flags & ~(H5C__SERIALIZE_RESIZED_FLAG | + H5C__SERIALIZE_MOVED_FLAG | + H5C__SERIALIZE_COMPRESSED_FLAG)) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unknown serialize flag(s)") #ifdef H5_HAVE_PARALLEL - if ( cache_ptr->aux_ptr != NULL ) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "resize/move in serialize occured in parallel case."); + /* In the parallel case, resizes and moves in + * the serialize operation can cause problems. + * If they occur, scream and die. + * + * At present, in the parallel case, the aux_ptr + * will only be set if there is more than one + * process. Thus we can use this to detect + * the parallel case. + * + * This works for now, but if we start using the + * aux_ptr for other purposes, we will have to + * change this test accordingly. + * + * NB: While this test detects entryies that attempt + * to resize or move themselves during a flush + * in the parallel case, it will not detect an + * entry that dirties, resizes, and/or moves + * other entries during its flush. + * + * From what Quincey tells me, this test is + * sufficient for now, as any flush routine that + * does the latter will also do the former. + * + * If that ceases to be the case, further + * tests will be necessary. + */ + if(cache_ptr->aux_ptr != NULL) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "resize/move in serialize occured in parallel case.") #endif /* Resize the buffer if required */ - if ( ( ( ! entry_ptr->compressed ) && - ( serialize_flags & H5C__SERIALIZE_RESIZED_FLAG ) ) || - ( ( entry_ptr->compressed ) && - ( serialize_flags & H5C__SERIALIZE_COMPRESSED_FLAG ) ) ) { + if(((!entry_ptr->compressed) && (serialize_flags & H5C__SERIALIZE_RESIZED_FLAG)) || + ((entry_ptr->compressed) && (serialize_flags & H5C__SERIALIZE_COMPRESSED_FLAG))) { size_t new_image_size; - if ( entry_ptr->compressed ) + if(entry_ptr->compressed) new_image_size = new_compressed_len; else new_image_size = new_len; - HDassert(new_image_size > 0); /* Release the current image */ - if ( entry_ptr->image_ptr ) { + if(entry_ptr->image_ptr) entry_ptr->image_ptr = H5MM_xfree(entry_ptr->image_ptr); - } /* Allocate a new image buffer */ - entry_ptr->image_ptr = - H5MM_malloc(new_image_size + H5C_IMAGE_EXTRA_SPACE); - - if ( NULL == entry_ptr->image_ptr ) - { - HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, \ - "memory allocation failed for on disk image buffer"); - } + if(NULL == (entry_ptr->image_ptr = H5MM_malloc(new_image_size + H5C_IMAGE_EXTRA_SPACE))) + HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer") #if H5C_DO_MEMORY_SANITY_CHECKS - - HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + new_image_size, - H5C_IMAGE_SANITY_VALUE, - H5C_IMAGE_EXTRA_SPACE); - + HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + new_image_size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ - } /* end if */ /* If required, update the entry and the cache data structures * for a resize. */ - if ( serialize_flags & H5C__SERIALIZE_RESIZED_FLAG ) { - - H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, \ - entry_ptr, new_len); + if(serialize_flags & H5C__SERIALIZE_RESIZED_FLAG) { + H5C__UPDATE_STATS_FOR_ENTRY_SIZE_CHANGE(cache_ptr, entry_ptr, new_len); /* update the hash table for the size change*/ - H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, \ - entry_ptr->size, \ - new_len, entry_ptr, \ - !(entry_ptr->is_dirty)); + H5C__UPDATE_INDEX_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, \ + new_len, entry_ptr, !(entry_ptr->is_dirty)); /* The entry can't be protected since we are * in the process of flushing it. Thus we must @@ -10332,17 +10124,13 @@ H5C__generate_image(H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr, * be in the slist. Thus update it for the size change. */ HDassert(entry_ptr->in_slist); - H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, \ - new_len); + H5C__UPDATE_SLIST_FOR_SIZE_CHANGE(cache_ptr, entry_ptr->size, new_len); /* if defined, update *entry_size_change_ptr for the * change in entry size. */ - if ( entry_size_change_ptr != NULL ) - { - *entry_size_change_ptr = (int64_t)new_len; - *entry_size_change_ptr -= (int64_t)(entry_ptr->size); - } + if(entry_size_change_ptr != NULL) + *entry_size_change_ptr = (int64_t)new_len - (int64_t)(entry_ptr->size); /* finally, update the entry for its new size */ entry_ptr->size = new_len; @@ -10359,7 +10147,7 @@ H5C__generate_image(H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr, H5C__UPDATE_STATS_FOR_MOVE(cache_ptr, entry_ptr); - if ( entry_ptr->addr == old_addr ) { + if(entry_ptr->addr == old_addr) { /* we must update cache data structures for the * change in address. */ @@ -10391,27 +10179,26 @@ H5C__generate_image(H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr, cache_ptr->slist_len_increase = saved_slist_len_increase; cache_ptr->slist_size_increase = saved_slist_size_increase; #endif /* H5C_DO_SANITY_CHECKS */ - } - else { + } /* end if */ + else /* move is already done for us -- just do sanity checks */ HDassert(entry_ptr->addr == new_addr); - } } /* end if */ - if ( serialize_flags & H5C__SERIALIZE_COMPRESSED_FLAG ) { + if(serialize_flags & H5C__SERIALIZE_COMPRESSED_FLAG) { /* just save the new compressed entry size in * entry_ptr->compressed_size. We don't need to * do more, as compressed size is only used for I/O. */ HDassert(entry_ptr->compressed); entry_ptr->compressed_size = new_compressed_len; - } - } /* end if ( serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET ) */ + } /* end if */ + } /* end if(serialize_flags != H5C__SERIALIZE_NO_FLAGS_SET) */ /* Serialize object into buffer */ { size_t image_len; - if ( entry_ptr->compressed ) + if(entry_ptr->compressed) image_len = entry_ptr->compressed_size; else image_len = entry_ptr->size; @@ -10420,33 +10207,25 @@ H5C__generate_image(H5F_t *f, H5C_t * cache_ptr, H5C_cache_entry_t *entry_ptr, * modifications in the serialize call. */ cache_ptr->slist_changed = FALSE; - - if ( entry_ptr->type->serialize(f, entry_ptr->image_ptr, - image_len, - (void *)entry_ptr) < 0) { - HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, \ - "unable to serialize entry"); - } + if(entry_ptr->type->serialize(f, entry_ptr->image_ptr, image_len, (void *)entry_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to serialize entry") /* set cache_ptr->slist_change_in_serialize if the * slist was modified. */ - if ( cache_ptr->slist_changed ) + if(cache_ptr->slist_changed) cache_ptr->slist_change_in_pre_serialize = TRUE; #if H5C_DO_MEMORY_SANITY_CHECKS - - HDassert(0 == HDmemcmp(((uint8_t *)entry_ptr->image_ptr) + - image_len, - H5C_IMAGE_SANITY_VALUE, - H5C_IMAGE_EXTRA_SPACE)); - + HDassert(0 == HDmemcmp(((uint8_t *)entry_ptr->image_ptr) + image_len, + H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE)); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ entry_ptr->image_up_to_date = TRUE; - } + } /* end block */ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C__generate_image */ + diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index e17aacd..4e88e44 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -43,13 +43,13 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* Files */ #include "H5FDprivate.h" /* File drivers */ +#include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ -#include "H5SLprivate.h" /* Skip lists */ -#ifdef H5_HAVE_PARALLEL +#ifdef H5_HAVE_PARALLEL /****************/ /* Local Macros */ /****************/ @@ -64,6 +64,9 @@ /********************/ /* Local Prototypes */ /********************/ +static herr_t H5C__collective_write(H5F_t *f, hid_t dxpl_id, + H5SL_t *collective_write_list); +static herr_t H5C__collective_write_free(void *_item, void *key, void *op_data); /*********************/ @@ -80,6 +83,9 @@ /* Local Variables */ /*******************/ +/* Declare a free list to manage the H5C_collective_write_t struct */ +H5FL_DEFINE(H5C_collective_write_t); + /*------------------------------------------------------------------------- @@ -261,7 +267,7 @@ H5C_apply_candidate_list(H5F_t * f, /* Create skip list of entries for collective write */ if(NULL == (collective_write_list = H5SL_create(H5SL_TYPE_HADDR, NULL))) HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create skip list for entries") - } + } /* end if */ n = num_candidates / mpi_size; m = num_candidates % mpi_size; @@ -376,7 +382,7 @@ H5C_apply_candidate_list(H5F_t * f, if(TRUE == entry_ptr->coll_access) { entry_ptr->coll_access = FALSE; H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) - } + } /* end if */ } /* end else */ } /* end for */ @@ -453,10 +459,8 @@ H5C_apply_candidate_list(H5F_t * f, * will not call either the pre_serialize or serialize callbacks. */ - if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, - H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, - NULL, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") + if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't clear entry.") } /* end if */ /* Else, if this process needs to flush this entry. */ @@ -500,9 +504,9 @@ H5C_apply_candidate_list(H5F_t * f, cache_ptr->entries_removed_counter = 0; cache_ptr->last_entry_removed_ptr = NULL; - if(H5C__flush_single_entry(f, dxpl_id, flush_ptr, H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, - NULL, collective_write_list) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't flush entry.") + /* Add this entry to the list of entries to collectively write */ + if(H5C__flush_single_entry(f, dxpl_id, flush_ptr, H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, collective_write_list) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry.") if ( ( cache_ptr->entries_removed_counter > 1 ) || ( cache_ptr->last_entry_removed_ptr == entry_ptr ) ) @@ -655,14 +659,12 @@ H5C_apply_candidate_list(H5F_t * f, entries_cleared++; #if ( H5C_APPLY_CANDIDATE_LIST__DEBUG > 1 ) - HDfprintf(stdout, "%s:%d: clearing 0x%llx.\n", FUNC, mpi_rank, - (long long)clear_ptr->addr); + HDfprintf(stdout, "%s:%d: clearing 0x%llx.\n", FUNC, mpi_rank, + (long long)clear_ptr->addr); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ - if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, - H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, - NULL, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") + if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't clear entry.") } /* end else-if */ /* Else, if this process needs to independently flush this entry. */ @@ -677,9 +679,9 @@ H5C_apply_candidate_list(H5F_t * f, (long long)flush_ptr->addr); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ - if(H5C__flush_single_entry(f, dxpl_id, flush_ptr, H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, - NULL, collective_write_list) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") + /* Add this entry to the list of entries to collectively write */ + if(H5C__flush_single_entry(f, dxpl_id, flush_ptr, H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, collective_write_list) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't clear entry.") } /* end else-if */ } /* end if */ @@ -712,16 +714,15 @@ H5C_apply_candidate_list(H5F_t * f, if (delayed_ptr) { if (delayed_ptr->clear_on_unprotect) { - if(H5C__flush_single_entry(f, dxpl_id, delayed_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG, - NULL, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't flush entry collectively.") + if(H5C__flush_single_entry(f, dxpl_id, delayed_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG, NULL, NULL) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry.") entry_ptr->clear_on_unprotect = FALSE; entries_cleared++; } else if (delayed_ptr->flush_immediately) { - if(H5C__flush_single_entry(f, dxpl_id, delayed_ptr, H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, - NULL, collective_write_list) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't flush entry collectively.") + /* Add this entry to the list of entries to collectively write */ + if(H5C__flush_single_entry(f, dxpl_id, delayed_ptr, H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, collective_write_list) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't flush entry collectively.") entry_ptr->flush_immediately = FALSE; entries_flushed++; @@ -731,15 +732,15 @@ H5C_apply_candidate_list(H5F_t * f, entries_flushed_or_cleared_last++; } /* end if */ + /* If we've deferred writing to do it collectively, take care of that now */ if(f->coll_md_write) { HDassert(collective_write_list); /* Write collective list */ - if(H5C_collective_write(f, - dxpl_id, - collective_write_list) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't write metadata collectively") - } + if(H5C__collective_write(f, dxpl_id, collective_write_list) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_WRITEERROR, FAIL, "Can't write metadata collectively") + } /* end if */ + /* ====================================================================== * * Finished flushing everything. * * ====================================================================== */ @@ -750,9 +751,9 @@ H5C_apply_candidate_list(H5F_t * f, HDassert((entries_flushed_collectively == entries_to_flush_collectively)); if((entries_flushed != entries_to_flush) || - (entries_cleared != entries_to_clear) || - (entries_flushed_or_cleared_last != entries_to_flush_or_clear_last) || - (entries_flushed_collectively != entries_to_flush_collectively)) + (entries_cleared != entries_to_clear) || + (entries_flushed_or_cleared_last != entries_to_flush_or_clear_last) || + (entries_flushed_collectively != entries_to_flush_collectively)) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "entry count mismatch.") done: @@ -760,7 +761,7 @@ done: candidate_assignment_table = (int *)H5MM_xfree((void *)candidate_assignment_table); if(collective_write_list) - if(H5SL_destroy(collective_write_list, H5C_collective_write_free, NULL) < 0) + if(H5SL_destroy(collective_write_list, H5C__collective_write_free, NULL) < 0) HDONE_ERROR(H5E_CACHE, H5E_CANTFREE, FAIL, "failed to destroy skip list") FUNC_LEAVE_NOAPI(ret_value) @@ -1132,7 +1133,7 @@ H5C_mark_entries_as_clean(H5F_t * f, if(TRUE == entry_ptr->coll_access) { entry_ptr->coll_access = FALSE; H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) - } + } /* end if */ entry_ptr->clear_on_unprotect = TRUE; #if H5C_DO_SANITY_CHECKS @@ -1194,10 +1195,8 @@ H5C_mark_entries_as_clean(H5F_t * f, entry_ptr = entry_ptr->prev; entries_cleared++; - if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, - H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, - NULL, NULL) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") + if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't clear entry.") } else { entry_ptr = entry_ptr->prev; @@ -1224,10 +1223,8 @@ H5C_mark_entries_as_clean(H5F_t * f, entry_ptr = entry_ptr->next; entries_cleared++; - if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, - H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, - NULL, NULL) < 0 ) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't clear entry.") + if(H5C__flush_single_entry(f, dxpl_id, clear_ptr, H5C__FLUSH_CLEAR_ONLY_FLAG | H5C__DEL_FROM_SLIST_ON_DESTROY_FLAG, NULL, NULL) < 0 ) + HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "Can't clear entry.") } else { entry_ptr = entry_ptr->next; @@ -1288,78 +1285,95 @@ done: *------------------------------------------------------------------------- */ herr_t -H5C_clear_coll_entries(H5C_t * cache_ptr, hbool_t partial) +H5C_clear_coll_entries(H5C_t *cache_ptr, hbool_t partial) { - int32_t list_len, coll_entries_cleared = 0; + int32_t clear_cnt; H5C_cache_entry_t * entry_ptr = NULL; - H5C_cache_entry_t * prev_ptr; herr_t ret_value = SUCCEED; FUNC_ENTER_NOAPI_NOINIT entry_ptr = cache_ptr->coll_tail_ptr; - list_len = cache_ptr->coll_list_len; - - while(entry_ptr && (coll_entries_cleared < (partial ? list_len/2 : list_len))) { - prev_ptr = entry_ptr->coll_prev; + clear_cnt = (partial ? cache_ptr->coll_list_len / 2 : cache_ptr->coll_list_len); + while(entry_ptr && clear_cnt > 0) { + H5C_cache_entry_t *prev_ptr = entry_ptr->coll_prev; + /* Sanity check */ HDassert(entry_ptr->coll_access); + /* Mark entry as independent */ entry_ptr->coll_access = FALSE; H5C__REMOVE_FROM_COLL_LIST(cache_ptr, entry_ptr, FAIL) - coll_entries_cleared ++; + /* Decrement entry count */ + clear_cnt--; + + /* Advance to next entry */ entry_ptr = prev_ptr; - } + } /* end while */ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5C_clear_coll_entries */ -herr_t -H5C_collective_write(H5F_t *f, - hid_t dxpl_id, - H5SL_t *collective_write_list) + +/*------------------------------------------------------------------------- + * + * Function: H5C__collective_write + * + * Purpose: Perform a collective write of a list of metadata entries. + * + * Return: FAIL if error is detected, SUCCEED otherwise. + * + * Programmer: Mohamad Chaarawi + * February, 2016 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__collective_write(H5F_t *f, hid_t dxpl_id, H5SL_t *collective_write_list) { H5P_genplist_t *plist = NULL; - H5FD_mpio_xfer_t xfer_mode = H5FD_MPIO_COLLECTIVE; - H5FD_mpio_xfer_t orig_xfer_mode; - H5SL_node_t *node; - H5C_collective_write_t *item; + H5FD_mpio_xfer_t orig_xfer_mode = H5FD_MPIO_COLLECTIVE; int count; - void *base_buf; int *length_array = NULL; MPI_Aint *buf_array = NULL; MPI_Aint *offset_array = NULL; MPI_Datatype btype; - MPI_Datatype ftype; hbool_t btype_created = FALSE; + MPI_Datatype ftype; hbool_t ftype_created = FALSE; int mpi_code; - int i; herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT - - count = (int)H5SL_count(collective_write_list); + FUNC_ENTER_STATIC + /* Get original transfer mode */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data transfer property list") - if(H5P_get(plist, H5D_XFER_IO_XFER_MODE_NAME, &orig_xfer_mode) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O property") + /* Get number of entries in collective write list */ + count = (int)H5SL_count(collective_write_list); + if(count > 0) { + H5FD_mpio_xfer_t xfer_mode = H5FD_MPIO_COLLECTIVE; + H5SL_node_t *node; + H5C_collective_write_t *item; + void *base_buf; + int i; + if(H5P_set(plist, H5D_XFER_IO_XFER_MODE_NAME, &xfer_mode) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O property") /* Allocate arrays */ if(NULL == (length_array = (int *)H5MM_malloc((size_t)count * sizeof(int)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for collective write table length array") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for collective write table length array") if(NULL == (buf_array = (MPI_Aint *)H5MM_malloc((size_t)count * sizeof(MPI_Aint)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for collective buf table length array") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for collective buf table length array") if(NULL == (offset_array = (MPI_Aint *)H5MM_malloc((size_t)count * sizeof(MPI_Aint)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for collective offset table length array") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "memory allocation failed for collective offset table length array") /* Fill arrays */ node = H5SL_first(collective_write_list); @@ -1367,6 +1381,7 @@ H5C_collective_write(H5F_t *f, if(NULL == (item = (H5C_collective_write_t *)H5SL_item(node))) HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "can't retrieve skip list item") + /* Set up initial array position & buffer base address */ length_array[0] = (int)item->length; base_buf = item->buf; buf_array[0] = (MPI_Aint)0; @@ -1378,28 +1393,31 @@ H5C_collective_write(H5F_t *f, if(NULL == (item = (H5C_collective_write_t *)H5SL_item(node))) HGOTO_ERROR(H5E_CACHE, H5E_NOTFOUND, FAIL, "can't retrieve skip list item") + /* Set up array position */ length_array[i] = (int)item->length; buf_array[i] = (MPI_Aint)item->buf - (MPI_Aint)base_buf; offset_array[i] = (MPI_Aint)item->offset; + + /* Advance to next node & array location */ node = H5SL_next(node); i++; } /* end while */ - /* Create memory mpi type */ + /* Create memory MPI type */ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed(count, length_array, buf_array, MPI_BYTE, &btype))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) btype_created = TRUE; if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&btype))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) - /* Create file mpi type */ + /* Create file MPI type */ if(MPI_SUCCESS != (mpi_code = MPI_Type_create_hindexed(count, length_array, offset_array, MPI_BYTE, &ftype))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_create_hindexed failed", mpi_code) ftype_created = TRUE; if(MPI_SUCCESS != (mpi_code = MPI_Type_commit(&ftype))) HMPI_GOTO_ERROR(FAIL, "MPI_Type_commit failed", mpi_code) - /* Pass buf type, file type to the file driver. */ + /* Pass buf type, file type to the file driver */ if(H5FD_mpi_setup_collective(dxpl_id, &btype, &ftype) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set MPI-I/O properties") @@ -1417,19 +1435,16 @@ H5C_collective_write(H5F_t *f, mpi_fh = *(MPI_File*)mpi_fh_p; /* just to match up with the 1st MPI_File_set_view from H5FD_mpio_write() */ - if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(mpi_fh, (MPI_Offset)0, MPI_BYTE, - MPI_BYTE, "native", MPI_INFO_NULL))) + if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(mpi_fh, (MPI_Offset)0, MPI_BYTE, MPI_BYTE, "native", MPI_INFO_NULL))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) /* just to match up with MPI_File_write_at_all from H5FD_mpio_write() */ HDmemset(&mpi_stat, 0, sizeof(MPI_Status)); - if(MPI_SUCCESS != (mpi_code = MPI_File_write_at_all(mpi_fh, (MPI_Offset)0, NULL, 0, - MPI_BYTE, &mpi_stat))) + if(MPI_SUCCESS != (mpi_code = MPI_File_write_at_all(mpi_fh, (MPI_Offset)0, NULL, 0, MPI_BYTE, &mpi_stat))) HMPI_GOTO_ERROR(FAIL, "MPI_File_write_at_all failed", mpi_code) /* just to match up with the 2nd MPI_File_set_view (reset) in H5FD_mpio_write() */ - if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(mpi_fh, (MPI_Offset)0, MPI_BYTE, - MPI_BYTE, "native", MPI_INFO_NULL))) + if(MPI_SUCCESS != (mpi_code = MPI_File_set_view(mpi_fh, (MPI_Offset)0, MPI_BYTE, MPI_BYTE, "native", MPI_INFO_NULL))) HMPI_GOTO_ERROR(FAIL, "MPI_File_set_view failed", mpi_code) } /* end else */ @@ -1453,23 +1468,37 @@ done: } /* end if */ FUNC_LEAVE_NOAPI(ret_value); -} /* end H5C_collective_write() */ +} /* end H5C__collective_write() */ -herr_t -H5C_collective_write_free(void *_item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op_data) + +/*------------------------------------------------------------------------- + * + * Function: H5C__collective_write_free + * + * Purpose: Release node on collective write skiplist + * + * Return: FAIL if error is detected, SUCCEED otherwise. + * + * Programmer: Mohamad Chaarawi + * February, 2016 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5C__collective_write_free(void *_item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op_data) { H5C_collective_write_t *item = (H5C_collective_write_t *)_item; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR - HDassert(item); + /* Sanity check */ + HDassert(item); if(item->free_buf) item->buf = H5MM_xfree(item->buf); - /*!FIXME change to use free list for items */ - H5MM_free(item); + H5FL_FREE(H5C_collective_write_t, item); FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5C_collective_write_free() */ +} /* end H5C__collective_write_free() */ #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 2f4d137..08be52b 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -3133,11 +3133,11 @@ if ( ( (entry_ptr) == NULL ) || \ (cache_ptr)->coll_list_size, \ (fail_val)) \ \ - H5C__COLL_DLL_PREPEND((entry_ptr), (cache_ptr)->coll_head_ptr, \ - (cache_ptr)->coll_tail_ptr, \ - (cache_ptr)->coll_list_len, \ - (cache_ptr)->coll_list_size, \ - (fail_val)) \ + H5C__COLL_DLL_PREPEND((entry_ptr), (cache_ptr)->coll_head_ptr, \ + (cache_ptr)->coll_tail_ptr, \ + (cache_ptr)->coll_list_len, \ + (cache_ptr)->coll_list_size, \ + (fail_val)) \ \ } /* H5C__MOVE_TO_TOP_IN_COLL_LIST */ #endif /* H5_HAVE_PARALLEL */ @@ -4254,6 +4254,7 @@ typedef struct H5C_collective_write_t { } H5C_collective_write_t; #endif /* H5_HAVE_PARALLEL */ + /*****************************/ /* Package Private Variables */ /*****************************/ @@ -4264,10 +4265,6 @@ typedef struct H5C_collective_write_t { /******************************/ H5_DLL herr_t H5C__flush_single_entry(const H5F_t *f, hid_t dxpl_id, H5C_cache_entry_t *entry_ptr, unsigned flags, int64_t *entry_size_change_ptr, H5SL_t *collective_write_list); -#ifdef H5_HAVE_PARALLEL -H5_DLL herr_t H5C_collective_write(H5F_t *f, hid_t dxpl_id, H5SL_t *collective_write_list); -H5_DLL herr_t H5C_collective_write_free(void *_item, void *key, void *op_data); -#endif /* H5_HAVE_PARALLEL */ #endif /* _H5Cpkg_H */ diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 5ad026b..5502e9f 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -1609,7 +1609,6 @@ typedef struct H5C_cache_entry_t { hbool_t clear_on_unprotect; hbool_t flush_immediately; hbool_t coll_access; - hbool_t ind_access_while_coll; #endif /* H5_HAVE_PARALLEL */ hbool_t flush_in_progress; hbool_t destroy_in_progress; @@ -1633,8 +1632,10 @@ typedef struct H5C_cache_entry_t { struct H5C_cache_entry_t * prev; struct H5C_cache_entry_t * aux_next; struct H5C_cache_entry_t * aux_prev; +#ifdef H5_HAVE_PARALLEL struct H5C_cache_entry_t * coll_next; struct H5C_cache_entry_t * coll_prev; +#endif /* H5_HAVE_PARALLEL */ #if H5C_COLLECT_CACHE_ENTRY_STATS /* cache entry stats fields */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 37e48ba..a17e035 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -45,7 +45,7 @@ /****************/ #include "H5Dmodule.h" /* This source code file is part of the H5D module */ -#define H5F_FRIEND /*suppress error about including H5Fpkg */ + /***********/ /* Headers */ @@ -56,7 +56,7 @@ #endif /* H5_HAVE_PARALLEL */ #include "H5Dpkg.h" /* Dataset functions */ #include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File functions */ +#include "H5Fprivate.h" /* File functions */ #include "H5FLprivate.h" /* Free Lists */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ @@ -2652,7 +2652,7 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, if(!H5D__chunk_cinfo_cache_found(&dset->shared->cache.chunk.last, udata)) { H5D_chk_idx_info_t idx_info; /* Chunked index info */ #ifdef H5_HAVE_PARALLEL - H5P_coll_md_read_flag_t temp_flag; /* temp flag to hold the coll metadata read setting */ + H5P_coll_md_read_flag_t temp_cmr; /* Temp value to hold the coll metadata read setting */ #endif /* H5_HAVE_PARALLEL */ /* Compose chunked index info struct */ @@ -2668,9 +2668,9 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, as it is highly unlikely that users would read the same chunks from all processes. MSC - might turn on for root node? */ - temp_flag = idx_info.f->coll_md_read; - idx_info.f->coll_md_read = H5P_FORCE_FALSE; - } + temp_cmr = H5F_COLL_MD_READ(idx_info.f); + H5F_set_coll_md_read(idx_info.f, H5P_FORCE_FALSE); + } /* end if */ #endif /* H5_HAVE_PARALLEL */ /* Go get the chunk information */ @@ -2678,9 +2678,8 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query chunk address") #ifdef H5_HAVE_PARALLEL - if(H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI)) { - idx_info.f->coll_md_read = temp_flag; - } + if(H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI)) + H5F_set_coll_md_read(idx_info.f, temp_cmr); #endif /* H5_HAVE_PARALLEL */ /* Cache the information retrieved */ diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c index 1753917..82545c1 100644 --- a/src/H5Ddeprec.c +++ b/src/H5Ddeprec.c @@ -141,8 +141,7 @@ H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t space_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not dataset create property list ID") /* Build and open the new dataset */ - if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, H5P_LINK_CREATE_DEFAULT, - dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5AC_dxpl_id))) + if(NULL == (dset = H5D__create_named(&loc, name, type_id, space, H5P_LINK_CREATE_DEFAULT, dcpl_id, H5P_DATASET_ACCESS_DEFAULT, H5AC_dxpl_id))) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create dataset") /* Register the new dataset to get an ID for it */ diff --git a/src/H5Fint.c b/src/H5Fint.c index ea6c9c1..063b65f 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -2110,3 +2110,33 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__set_eoa() */ +#ifdef H5_HAVE_PARALLEL + +/*------------------------------------------------------------------------- + * Function: H5F_set_coll_md_read + * + * Purpose: Set the coll_md_read field with a new value. + * + * Return: Success: SUCCEED + * Failure: FAIL + * + * Programmer: Quincey Koziol + * 2/10/16 + * + *------------------------------------------------------------------------- + */ +void +H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t cmr) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Sanity check */ + HDassert(f); + + f->coll_md_read = cmr; + + FUNC_LEAVE_NOAPI_VOID +} /* H5F_set_coll_md_read() */ +#endif /* H5_HAVE_PARALLEL */ + diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 7decaed..52649e5 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -27,6 +27,9 @@ #include "H5FDpublic.h" /* File drivers */ /* Private headers needed by this file */ +#ifdef H5_HAVE_PARALLEL +#include "H5Pprivate.h" /* Property lists */ +#endif /* H5_HAVE_PARALLEL */ #include "H5VMprivate.h" /* Vectors and arrays */ @@ -312,6 +315,9 @@ #define H5F_SET_GRP_BTREE_SHARED(F, RC) (((F)->shared->grp_btree_shared = (RC)) ? SUCCEED : FAIL) #define H5F_USE_TMP_SPACE(F) ((F)->shared->use_tmp_space) #define H5F_IS_TMP_ADDR(F, ADDR) (H5F_addr_le((F)->shared->tmp_addr, (ADDR))) +#ifdef H5_HAVE_PARALLEL +#define H5F_COLL_MD_READ(F) ((F)->coll_md_read) +#endif /* H5_HAVE_PARALLEL */ #else /* H5F_MODULE */ #define H5F_INTENT(F) (H5F_get_intent(F)) #define H5F_OPEN_NAME(F) (H5F_get_open_name(F)) @@ -354,6 +360,9 @@ #define H5F_SET_GRP_BTREE_SHARED(F, RC) (H5F_set_grp_btree_shared((F), (RC))) #define H5F_USE_TMP_SPACE(F) (H5F_use_tmp_space(F)) #define H5F_IS_TMP_ADDR(F, ADDR) (H5F_is_tmp_addr((F), (ADDR))) +#ifdef H5_HAVE_PARALLEL +#define H5F_COLL_MD_READ(F) (H5F_coll_md_read(F)) +#endif /* H5_HAVE_PARALLEL */ #endif /* H5F_MODULE */ @@ -639,6 +648,10 @@ H5_DLL struct H5UC_t *H5F_grp_btree_shared(const H5F_t *f); H5_DLL herr_t H5F_set_grp_btree_shared(H5F_t *f, struct H5UC_t *rc); H5_DLL hbool_t H5F_use_tmp_space(const H5F_t *f); H5_DLL hbool_t H5F_is_tmp_addr(const H5F_t *f, haddr_t addr); +#ifdef H5_HAVE_PARALLEL +H5_DLL H5P_coll_md_read_flag_t H5F_coll_md_read(const H5F_t *f); +H5_DLL void H5F_set_coll_md_read(H5F_t *f, H5P_coll_md_read_flag_t flag); +#endif /* H5_HAVE_PARALLEL */ /* Functions that retrieve values from VFD layer */ H5_DLL hid_t H5F_get_driver_id(const H5F_t *f); diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 75fc216..e9af300 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -1073,3 +1073,31 @@ H5F_use_tmp_space(const H5F_t *f) FUNC_LEAVE_NOAPI(f->shared->use_tmp_space) } /* end H5F_use_tmp_space() */ +#ifdef H5_HAVE_PARALLEL + +/*------------------------------------------------------------------------- + * Function: H5F_coll_md_read + * + * Purpose: Retrieve the 'collective metadata reads' flag for the file. + * + * Return: Success: Non-negative, the 'collective metadata reads' flag + * Failure: (can't happen) + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Feb 10 2016 + * + *------------------------------------------------------------------------- + */ +H5P_coll_md_read_flag_t +H5F_coll_md_read(const H5F_t *f) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(f); + + FUNC_LEAVE_NOAPI(f->coll_md_read) +} /* end H5F_coll_md_read() */ +#endif /* H5_HAVE_PARALLEL */ + diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 535e34b..9353094 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -179,7 +179,6 @@ #ifdef H5_DEBUG_BUILD /* dxpl I/O type - private property */ #define H5FD_DXPL_TYPE_SIZE sizeof(H5FD_dxpl_type_t) -#define H5FD_DXPL_TYPE_DEF H5FD_NOIO_DXPL #endif /* H5_DEBUG_BUILD */ #ifdef H5_HAVE_PARALLEL /* Definition for reading metadata collectively */ @@ -187,7 +186,9 @@ #define H5D_XFER_COLL_MD_READ_DEF H5P_USER_FALSE #define H5D_XFER_COLL_MD_READ_ENC H5P__encode_coll_md_read_flag_t #define H5D_XFER_COLL_MD_READ_DEC H5P__decode_coll_md_read_flag_t -#endif H5_HAVE_PARALLEL +#endif /* H5_HAVE_PARALLEL */ + + /******************/ /* Local Typedefs */ /******************/ diff --git a/src/H5Pint.c b/src/H5Pint.c index 3c145c5..a222082 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -29,7 +29,9 @@ /* Headers */ /***********/ #include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ +#ifdef H5_HAVE_PARALLEL +#include "H5ACprivate.h" /* Metadata cache */ +#endif /* H5_HAVE_PARALLEL */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* File access */ #include "H5FLprivate.h" /* Free lists */ @@ -5452,7 +5454,15 @@ H5P_get_class(const H5P_genplist_t *plist) */ herr_t H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t *dxpl_id, - hid_t loc_id, hbool_t is_collective) + hid_t +#ifndef H5_HAVE_PARALLEL + H5_ATTR_UNUSED +#endif /* H5_HAVE_PARALLEL */ + loc_id, hbool_t +#ifndef H5_HAVE_PARALLEL + H5_ATTR_UNUSED +#endif /* H5_HAVE_PARALLEL */ + is_collective) { herr_t ret_value = SUCCEED; /* Return value */ @@ -5495,8 +5505,6 @@ H5P_verify_apl_and_dxpl(hid_t *acspl_id, const H5P_libclass_t *libclass, hid_t * if(TRUE != H5P_isa_class(*acspl_id, *libclass->class_id)) HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not the required access property list") - *dxpl_id = H5AC_ind_read_dxpl_id; - #ifdef H5_HAVE_PARALLEL /* Get the plist structure for the access property list */ if(NULL == (plist = (H5P_genplist_t *)H5I_object(*acspl_id))) diff --git a/src/H5Plapl.c b/src/H5Plapl.c index cba2f88..f2711e8 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -94,6 +94,7 @@ #define H5L_ACS_COLL_MD_READ_ENC H5P__encode_coll_md_read_flag_t #define H5L_ACS_COLL_MD_READ_DEC H5P__decode_coll_md_read_flag_t + /******************/ /* Local Typedefs */ /******************/ @@ -222,8 +223,7 @@ H5P__lacc_reg_prop(H5P_genclass_t *pclass) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") /* Register the metadata collective read flag */ - if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5L_ACS_COLL_MD_READ_SIZE, - &H5L_def_coll_md_read_g, + if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5L_ACS_COLL_MD_READ_SIZE, &H5L_def_coll_md_read_g, NULL, NULL, NULL, H5L_ACS_COLL_MD_READ_ENC, H5L_ACS_COLL_MD_READ_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index be2bceb..29fb919 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -41,13 +41,13 @@ #define H5P_CLASS(P) (H5P_get_class(P)) #endif /* H5P_MODULE */ +#define H5_COLL_MD_READ_FLAG_NAME "collective_metadata_read" + /****************************/ /* Library Private Typedefs */ /****************************/ -#define H5_COLL_MD_READ_FLAG_NAME "collective_metadata_read" - typedef enum H5P_coll_md_read_flag_t { H5P_FORCE_FALSE = -1, H5P_USER_FALSE = 0, diff --git a/src/H5R.c b/src/H5R.c index f0aafc3..bc49364 100644 --- a/src/H5R.c +++ b/src/H5R.c @@ -611,10 +611,10 @@ H5Rdereference2(hid_t obj_id, hid_t oapl_id, H5R_type_t ref_type, const void *_r HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") if(_ref == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") - + /* Verify access property list and get correct dxpl */ if(H5P_verify_apl_and_dxpl(&oapl_id, H5P_CLS_DACC, &dxpl_id, obj_id, FALSE) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access and transfer property lists") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, FAIL, "can't set access and transfer property lists") /* Get the file pointer from the entry */ file = loc.oloc->file; diff --git a/testpar/t_cache.c b/testpar/t_cache.c index d7a12fe..48beb80 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -7595,7 +7595,7 @@ main(int argc, char **argv) #endif /* enable the collective metadata read property */ if ( world_mpi_rank != world_server_mpi_rank ) { - if ( H5Pset_coll_metadata_read(fapl, 1) < 0 ) { + if ( H5Pset_coll_metadata_read(fapl, TRUE) < 0 ) { nerrors++; if ( verbose ) { diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index f718f5b..66d6f49 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -888,7 +888,7 @@ void independent_group_read(void) MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); - H5Pset_coll_metadata_read(plist, 0); + H5Pset_coll_metadata_read(plist, FALSE); fid = H5Fopen(filename, H5F_ACC_RDONLY, plist); H5Pclose(plist); diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c index 1b856d0..106dd7b 100644 --- a/testpar/t_shapesame.c +++ b/testpar/t_shapesame.c @@ -4948,9 +4948,9 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) /* set Parallel access with communicator */ ret = H5Pset_fapl_mpio(ret_pl, comm, info); VRFY((ret >= 0), ""); - ret = H5Pset_coll_metadata_read(ret_pl, true); + ret = H5Pset_coll_metadata_read(ret_pl, TRUE); VRFY((ret >= 0), ""); - ret = H5Pset_coll_metadata_write(ret_pl, true); + ret = H5Pset_coll_metadata_write(ret_pl, TRUE); VRFY((ret >= 0), ""); return(ret_pl); } diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index b5ebb98..8ff0dc6 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -272,9 +272,9 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) /* set Parallel access with communicator */ ret = H5Pset_fapl_mpio(ret_pl, comm, info); VRFY((ret >= 0), ""); - ret = H5Pset_coll_metadata_read(ret_pl, true); + ret = H5Pset_coll_metadata_read(ret_pl, TRUE); VRFY((ret >= 0), ""); - ret = H5Pset_coll_metadata_write(ret_pl, true); + ret = H5Pset_coll_metadata_write(ret_pl, TRUE); VRFY((ret >= 0), ""); return(ret_pl); } @@ -536,6 +536,7 @@ int main(int argc, char **argv) AddTest("denseattr", test_dense_attr, NULL, "Store Dense Attributes", PARATESTFILE); + /* Display testing information */ TestInfo(argv[0]); -- cgit v0.12 From 25f271d84bb56b1f318545fb04dc5f7564417f13 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Wed, 10 Feb 2016 13:19:12 -0500 Subject: [svn-r29079] rename the coll read requirement function. --- UserMacros.cmake | 2 +- src/H5Pfapl.c | 6 +++--- src/H5Ppublic.h | 2 +- testpar/t_cache.c | 4 ++-- testpar/t_mdset.c | 3 ++- testpar/t_shapesame.c | 2 +- testpar/testphdf5.c | 2 +- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/UserMacros.cmake b/UserMacros.cmake index 65ea5d4..cb8739f 100644 --- a/UserMacros.cmake +++ b/UserMacros.cmake @@ -19,4 +19,4 @@ endif (BUILD_USER_DEFINED_LIBS) #----------------------------------------------------------------------------- #------------------- E X A M P L E E N D ----------------------------------- #----------------------------------------------------------------------------- - \ No newline at end of file + diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 75f9e7c..d90dcd5 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -3581,7 +3581,7 @@ H5P__decode_coll_md_read_flag_t(const void **_pp, void *_value) #ifdef H5_HAVE_PARALLEL /*------------------------------------------------------------------------- - * Function: H5Pset_coll_metadata_read + * Function: H5Pset_all_coll_metadata_ops * * Purpose: Tell the library whether the metadata read operations will * be done collectively (1) or not (0). Default is independent. @@ -3602,7 +3602,7 @@ H5P__decode_coll_md_read_flag_t(const void **_pp, void *_value) *------------------------------------------------------------------------- */ herr_t -H5Pset_coll_metadata_read(hid_t plist_id, hbool_t is_collective) +H5Pset_all_coll_metadata_ops(hid_t plist_id, hbool_t is_collective) { H5P_genplist_t *plist; /* Property list pointer */ H5P_coll_md_read_flag_t coll_meta_read; /* Property value */ @@ -3636,7 +3636,7 @@ H5Pset_coll_metadata_read(hid_t plist_id, hbool_t is_collective) done: FUNC_LEAVE_API(ret_value) -} /* end H5Pset_coll_metadata_read() */ +} /* end H5Pset_all_coll_metadata_ops() */ /*------------------------------------------------------------------------- diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 1820625..9308339 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -352,7 +352,7 @@ H5_DLL herr_t H5Pget_file_image_callbacks(hid_t fapl_id, H5_DLL herr_t H5Pset_core_write_tracking(hid_t fapl_id, hbool_t is_enabled, size_t page_size); H5_DLL herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, size_t *page_size); #ifdef H5_HAVE_PARALLEL -H5_DLL herr_t H5Pset_coll_metadata_read(hid_t plist_id, hbool_t is_collective); +H5_DLL herr_t H5Pset_all_coll_metadata_ops(hid_t plist_id, hbool_t is_collective); H5_DLL herr_t H5Pget_coll_metadata_read(hid_t plist_id, hbool_t *is_collective); H5_DLL herr_t H5Pset_coll_metadata_write(hid_t plist_id, hbool_t is_collective); H5_DLL herr_t H5Pget_coll_metadata_write(hid_t plist_id, hbool_t *is_collective); diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 48beb80..a5db9d7 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -7595,11 +7595,11 @@ main(int argc, char **argv) #endif /* enable the collective metadata read property */ if ( world_mpi_rank != world_server_mpi_rank ) { - if ( H5Pset_coll_metadata_read(fapl, TRUE) < 0 ) { + if ( H5Pset_all_coll_metadata_ops(fapl, TRUE) < 0 ) { nerrors++; if ( verbose ) { - HDfprintf(stdout, "%d:%s: H5Pset_coll_metadata_read() failed 1.\n", + HDfprintf(stdout, "%d:%s: H5Pset_all_coll_metadata_ops() failed 1.\n", world_mpi_rank, FUNC); } } diff --git a/testpar/t_mdset.c b/testpar/t_mdset.c index 66d6f49..c88cb86 100644 --- a/testpar/t_mdset.c +++ b/testpar/t_mdset.c @@ -888,7 +888,8 @@ void independent_group_read(void) MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); plist = create_faccess_plist(MPI_COMM_WORLD, MPI_INFO_NULL, facc_type); - H5Pset_coll_metadata_read(plist, FALSE); + H5Pset_all_coll_metadata_ops(plist, FALSE); + fid = H5Fopen(filename, H5F_ACC_RDONLY, plist); H5Pclose(plist); diff --git a/testpar/t_shapesame.c b/testpar/t_shapesame.c index 106dd7b..8be1610 100644 --- a/testpar/t_shapesame.c +++ b/testpar/t_shapesame.c @@ -4948,7 +4948,7 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) /* set Parallel access with communicator */ ret = H5Pset_fapl_mpio(ret_pl, comm, info); VRFY((ret >= 0), ""); - ret = H5Pset_coll_metadata_read(ret_pl, TRUE); + ret = H5Pset_all_coll_metadata_ops(ret_pl, TRUE); VRFY((ret >= 0), ""); ret = H5Pset_coll_metadata_write(ret_pl, TRUE); VRFY((ret >= 0), ""); diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index 8ff0dc6..abe074a 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -272,7 +272,7 @@ create_faccess_plist(MPI_Comm comm, MPI_Info info, int l_facc_type) /* set Parallel access with communicator */ ret = H5Pset_fapl_mpio(ret_pl, comm, info); VRFY((ret >= 0), ""); - ret = H5Pset_coll_metadata_read(ret_pl, TRUE); + ret = H5Pset_all_coll_metadata_ops(ret_pl, TRUE); VRFY((ret >= 0), ""); ret = H5Pset_coll_metadata_write(ret_pl, TRUE); VRFY((ret >= 0), ""); -- cgit v0.12 From 5655e5a91a538bd2cc885e5927f8ed61ab8e166b Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 10 Feb 2016 23:40:10 -0500 Subject: [svn-r29084] Revert of: r29069 and 72 (gheap cleanup) r29041 and 43 (HDFFV-8740 external storage) These cause problems in the daily tests. They will be re-introduced when their respective problems have been addressed. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial (check-vfd) w/ Fortran and C++ autotools parallel w/ Fortran CMake serial --- src/H5.c | 3 +- src/H5Defl.c | 172 ++++++------- src/H5Dint.c | 113 +-------- src/H5Dpkg.h | 2 - src/H5Dprivate.h | 1 - src/H5Fquery.c | 2 +- src/H5MM.c | 44 ++-- src/H5Pdapl.c | 384 +--------------------------- src/H5Plapl.c | 3 +- src/H5Ppublic.h | 2 - src/H5private.h | 6 +- src/H5system.c | 129 +--------- src/H5win32defs.h | 23 +- test/Makefile.am | 2 +- test/external.c | 739 +++++++----------------------------------------------- test/gheap.c | 684 +++++++++++++++++++++++--------------------------- 16 files changed, 526 insertions(+), 1783 deletions(-) diff --git a/src/H5.c b/src/H5.c index 41fb3ba..4de5731 100644 --- a/src/H5.c +++ b/src/H5.c @@ -193,8 +193,7 @@ H5_init_library(void) /* Normal library termination code */ (void)HDatexit(H5_term_library); - - H5_dont_atexit_g = TRUE; + H5_dont_atexit_g = TRUE; } /* end if */ /* diff --git a/src/H5Defl.c b/src/H5Defl.c index cf1b36c..ec96ae7 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -28,13 +28,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* Files */ -#include "H5HLprivate.h" /* Local Heaps */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5VMprivate.h" /* Vector and array functions */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5HLprivate.h" /* Local Heaps */ +#include "H5VMprivate.h" /* Vector and array functions */ /****************/ @@ -49,14 +48,12 @@ /* Callback info for readvv operation */ typedef struct H5D_efl_readvv_ud_t { const H5O_efl_t *efl; /* Pointer to efl info */ - const H5D_t *dset; /* The dataset */ unsigned char *rbuf; /* Read buffer */ } H5D_efl_readvv_ud_t; /* Callback info for writevv operation */ typedef struct H5D_efl_writevv_ud_t { const H5O_efl_t *efl; /* Pointer to efl info */ - const H5D_t *dset; /* The dataset */ const unsigned char *wbuf; /* Write buffer */ } H5D_efl_writevv_ud_t; @@ -78,9 +75,9 @@ static ssize_t H5D__efl_writevv(const H5D_io_info_t *io_info, size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]); /* Helper routines */ -static herr_t H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size, +static herr_t H5D__efl_read(const H5O_efl_t *efl, haddr_t addr, size_t size, uint8_t *buf); -static herr_t H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size, +static herr_t H5D__efl_write(const H5O_efl_t *efl, haddr_t addr, size_t size, const uint8_t *buf); @@ -235,22 +232,25 @@ H5D__efl_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNU /*------------------------------------------------------------------------- - * Function: H5D__efl_read + * Function: H5D__efl_read * - * Purpose: Reads data from an external file list. It is an error to - * read past the logical end of file, but reading past the end - * of any particular member of the external file list results in - * zeros. + * Purpose: Reads data from an external file list. It is an error to + * read past the logical end of file, but reading past the end + * of any particular member of the external file list results in + * zeros. * - * Return: SUCCEED/FAIL + * Return: Non-negative on success/Negative on failure * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, March 4, 1998 * + * Modifications: + * Robb Matzke, 1999-07-28 + * The ADDR argument is passed by value. *------------------------------------------------------------------------- */ static herr_t -H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size, uint8_t *buf) +H5D__efl_read(const H5O_efl_t *efl, haddr_t addr, size_t size, uint8_t *buf) { int fd = -1; size_t to_read; @@ -261,7 +261,6 @@ H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size haddr_t cur; ssize_t n; size_t u; /* Local index variable */ - char *full_name = NULL; /* File name with prefix */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -274,49 +273,44 @@ H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size /* Find the first efl member from which to read */ for (u=0, cur=0; unused; u++) { - if(H5O_EFL_UNLIMITED == efl->slot[u].size || addr < cur + efl->slot[u].size) { - skip = addr - cur; - break; - } /* end if */ - cur += efl->slot[u].size; + if(H5O_EFL_UNLIMITED == efl->slot[u].size || addr < cur + efl->slot[u].size) { + skip = addr - cur; + break; + } /* end if */ + cur += efl->slot[u].size; } /* end for */ /* Read the data */ while(size) { HDassert(buf); - if(u >= efl->nused) - HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "read past logical end of file") - if(H5F_OVERFLOW_HSIZET2OFFT(efl->slot[u].offset + skip)) - HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed") - if(H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0) - HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name") - if((fd = HDopen(full_name, O_RDONLY, 0)) < 0) - HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file") - if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0) - HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file") + if(u >= efl->nused) + HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "read past logical end of file") + if(H5F_OVERFLOW_HSIZET2OFFT(efl->slot[u].offset + skip)) + HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed") + if((fd = HDopen(efl->slot[u].name, O_RDONLY, 0)) < 0) + HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file") + if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0) + HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file") #ifndef NDEBUG - tempto_read = MIN((size_t)(efl->slot[u].size-skip), (hsize_t)size); + tempto_read = MIN(efl->slot[u].size-skip, (hsize_t)size); H5_CHECK_OVERFLOW(tempto_read, hsize_t, size_t); - to_read = (size_t)tempto_read; + to_read = (size_t)tempto_read; #else /* NDEBUG */ - to_read = MIN((size_t)(efl->slot[u].size - skip), (hsize_t)size); + to_read = MIN((size_t)(efl->slot[u].size - skip), size); #endif /* NDEBUG */ - if((n = HDread(fd, buf, to_read)) < 0) - HGOTO_ERROR(H5E_EFL, H5E_READERROR, FAIL, "read error in external raw data file") - else if((size_t)n < to_read) - HDmemset(buf + n, 0, to_read - (size_t)n); - full_name = (char *)H5MM_xfree(full_name); - HDclose(fd); - fd = -1; - size -= to_read; - buf += to_read; - skip = 0; - u++; + if((n = HDread(fd, buf, to_read)) < 0) + HGOTO_ERROR(H5E_EFL, H5E_READERROR, FAIL, "read error in external raw data file") + else if((size_t)n < to_read) + HDmemset(buf + n, 0, to_read - (size_t)n); + HDclose(fd); + fd = -1; + size -= to_read; + buf += to_read; + skip = 0; + u++; } /* end while */ done: - if(full_name) - full_name = (char *)H5MM_xfree(full_name); if(fd >= 0) HDclose(fd); @@ -343,7 +337,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size, const uint8_t *buf) +H5D__efl_write(const H5O_efl_t *efl, haddr_t addr, size_t size, const uint8_t *buf) { int fd = -1; size_t to_write; @@ -352,8 +346,7 @@ H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t siz #endif /* NDEBUG */ haddr_t cur; hsize_t skip = 0; - size_t u; /* Local index variable */ - char *full_name = NULL; /* File name with prefix */ + size_t u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -366,51 +359,46 @@ H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t siz /* Find the first efl member in which to write */ for(u = 0, cur = 0; u < efl->nused; u++) { - if(H5O_EFL_UNLIMITED == efl->slot[u].size || addr < cur + efl->slot[u].size) { - skip = addr - cur; - break; - } /* end if */ - cur += efl->slot[u].size; + if(H5O_EFL_UNLIMITED == efl->slot[u].size || addr < cur + efl->slot[u].size) { + skip = addr - cur; + break; + } /* end if */ + cur += efl->slot[u].size; } /* end for */ /* Write the data */ while(size) { HDassert(buf); - if(u >= efl->nused) - HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "write past logical end of file") - if(H5F_OVERFLOW_HSIZET2OFFT(efl->slot[u].offset + skip)) - HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed") - if(H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0) - HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name") - if((fd = HDopen(full_name, O_CREAT | O_RDWR, 0666)) < 0) { - if(HDaccess(full_name, F_OK) < 0) - HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "external raw data file does not exist") - else - HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file") - } /* end if */ - if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0) - HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file") + if(u >= efl->nused) + HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "write past logical end of file") + if(H5F_OVERFLOW_HSIZET2OFFT(efl->slot[u].offset + skip)) + HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed") + if((fd = HDopen(efl->slot[u].name, O_CREAT | O_RDWR, 0666)) < 0) { + if(HDaccess(efl->slot[u].name, F_OK) < 0) + HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "external raw data file does not exist") + else + HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file") + } /* end if */ + if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0) + HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file") #ifndef NDEBUG - tempto_write = MIN(efl->slot[u].size - skip, (hsize_t)size); + tempto_write = MIN(efl->slot[u].size - skip, (hsize_t)size); H5_CHECK_OVERFLOW(tempto_write, hsize_t, size_t); to_write = (size_t)tempto_write; #else /* NDEBUG */ - to_write = MIN((size_t)(efl->slot[u].size - skip), size); + to_write = MIN((size_t)(efl->slot[u].size - skip), size); #endif /* NDEBUG */ - if((size_t)HDwrite(fd, buf, to_write) != to_write) - HGOTO_ERROR(H5E_EFL, H5E_READERROR, FAIL, "write error in external raw data file") - full_name = (char *)H5MM_xfree(full_name); - HDclose (fd); - fd = -1; - size -= to_write; - buf += to_write; - skip = 0; - u++; + if((size_t)HDwrite(fd, buf, to_write) != to_write) + HGOTO_ERROR(H5E_EFL, H5E_READERROR, FAIL, "write error in external raw data file") + HDclose (fd); + fd = -1; + size -= to_write; + buf += to_write; + skip = 0; + u++; } /* end while */ done: - if(full_name) - full_name = (char *)H5MM_xfree(full_name); if(fd >= 0) HDclose(fd); @@ -439,7 +427,7 @@ H5D__efl_readvv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata) FUNC_ENTER_STATIC /* Read data */ - if(H5D__efl_read(udata->efl, udata->dset, dst_off, len, (udata->rbuf + src_off)) < 0) + if(H5D__efl_read(udata->efl, dst_off, len, (udata->rbuf + src_off)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "EFL read failed") done: @@ -476,9 +464,6 @@ H5D__efl_readvv(const H5D_io_info_t *io_info, HDassert(io_info); HDassert(io_info->store->efl.nused > 0); HDassert(io_info->u.rbuf); - HDassert(io_info->dset); - HDassert(io_info->dset->shared); - HDassert(io_info->dset->shared->extfile_prefix); HDassert(dset_curr_seq); HDassert(dset_len_arr); HDassert(dset_off_arr); @@ -488,7 +473,6 @@ H5D__efl_readvv(const H5D_io_info_t *io_info, /* Set up user data for H5VM_opvv() */ udata.efl = &(io_info->store->efl); - udata.dset = io_info->dset; udata.rbuf = (unsigned char *)io_info->u.rbuf; /* Call generic sequence operation routine */ @@ -523,7 +507,7 @@ H5D__efl_writevv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata) FUNC_ENTER_STATIC /* Write data */ - if(H5D__efl_write(udata->efl, udata->dset, dst_off, len, (udata->wbuf + src_off)) < 0) + if(H5D__efl_write(udata->efl, dst_off, len, (udata->wbuf + src_off)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "EFL write failed") done: @@ -560,9 +544,6 @@ H5D__efl_writevv(const H5D_io_info_t *io_info, HDassert(io_info); HDassert(io_info->store->efl.nused > 0); HDassert(io_info->u.wbuf); - HDassert(io_info->dset); - HDassert(io_info->dset->shared); - HDassert(io_info->dset->shared->extfile_prefix); HDassert(dset_curr_seq); HDassert(dset_len_arr); HDassert(dset_off_arr); @@ -572,7 +553,6 @@ H5D__efl_writevv(const H5D_io_info_t *io_info, /* Set up user data for H5VM_opvv() */ udata.efl = &(io_info->store->efl); - udata.dset = io_info->dset; udata.wbuf = (const unsigned char *)io_info->u.wbuf; /* Call generic sequence operation routine */ diff --git a/src/H5Dint.c b/src/H5Dint.c index fe34718..3e2d212 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -63,8 +63,6 @@ static herr_t H5D__cache_dataspace_info(const H5D_t *dset); static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space); static herr_t H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id); -static herr_t H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, - char **extfile_prefix); static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id); static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]); @@ -984,84 +982,6 @@ done: } /* end H5D__update_oh_info() */ -/*-------------------------------------------------------------------------- - * Function: H5D_build_extfile_prefix - * - * Purpose: Determine the external file prefix to be used and store - * it in extfile_prefix. Stores an empty string if no prefix - * should be used. - * - * Return: SUCCEED/FAIL - * - * Programmer: Steffen Kiess - * October 16, 2015 - *-------------------------------------------------------------------------- - */ -static herr_t -H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, char **extfile_prefix /*out*/) -{ - char *prefix = NULL; /* prefix used to look for the file */ - char *extpath = NULL; /* absolute path of directory the HDF5 file is in */ - size_t extpath_len; /* length of extpath */ - size_t prefix_len; /* length of prefix */ - size_t extfile_prefix_len; /* length of expanded prefix */ - H5P_genplist_t *plist = NULL; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ - - - FUNC_ENTER_NOAPI_NOINIT - - HDassert(dset); - HDassert(dset->oloc.file); - - extpath = H5F_EXTPATH(dset->oloc.file); - HDassert(extpath); - - /* XXX: Future thread-safety note - getenv is not required - * to be reentrant. - */ - prefix = HDgetenv("HDF5_EXTFILE_PREFIX"); - - if(prefix == NULL || *prefix == '\0') { - /* Set prefix to value of H5D_ACS_EFILE_PREFIX_NAME property */ - if(NULL == (plist = H5P_object_verify(dapl_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - if(H5P_peek(plist, H5D_ACS_EFILE_PREFIX_NAME, &prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file prefix") - } /* end if */ - - /* Prefix has to be checked for NULL / empty string again because the - * code above might have updated it. - */ - if(prefix == NULL || *prefix == '\0' || HDstrcmp(prefix, ".") == 0) { - /* filename is interpreted as relative to the current directory, - * does not need to be expanded - */ - if(NULL == (*extfile_prefix = (char *)H5MM_strdup(""))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - } /* end if */ - else { - if (HDstrncmp(prefix, "${ORIGIN}", HDstrlen("${ORIGIN}")) == 0) { - /* Replace ${ORIGIN} at beginning of prefix by directory of HDF5 file */ - extpath_len = HDstrlen(extpath); - prefix_len = HDstrlen(prefix); - extfile_prefix_len = extpath_len + prefix_len - HDstrlen("${ORIGIN}") + 1; - - if(NULL == (*extfile_prefix = (char *)H5MM_malloc(extfile_prefix_len))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate buffer") - HDsnprintf(*extfile_prefix, extfile_prefix_len, "%s%s", extpath, prefix + HDstrlen("${ORIGIN}")); - } /* end if */ - else { - if(NULL == (*extfile_prefix = (char *)H5MM_strdup(prefix))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - } /* end else */ - } /* end else */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5D_build_extfile_prefix() */ - - /*------------------------------------------------------------------------- * Function: H5D__create * @@ -1231,10 +1151,6 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, /* Indicate that the layout information was initialized */ layout_init = TRUE; - /* Set the external file prefix */ - if(H5D_build_extfile_prefix(new_dset, dapl_id, &new_dset->shared->extfile_prefix) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix") - /* Add the dataset to the list of opened objects in the file */ if(H5FO_top_incr(new_dset->oloc.file, new_dset->oloc.addr) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't incr object ref. count") @@ -1279,7 +1195,6 @@ done: } /* end if */ if(new_dset->shared->dcpl_id != 0 && H5I_dec_ref(new_dset->shared->dcpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list") - new_dset->shared->extfile_prefix = (char *)H5MM_xfree(new_dset->shared->extfile_prefix); new_dset->shared = H5FL_FREE(H5D_shared_t, new_dset->shared); } /* end if */ new_dset->oloc.file = NULL; @@ -1373,8 +1288,7 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) { H5D_shared_t *shared_fo = NULL; H5D_t *dataset = NULL; - char *extfile_prefix = NULL; /* Expanded external file prefix */ - H5D_t *ret_value = NULL; /* Return value */ + H5D_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1393,10 +1307,6 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) if(H5G_name_copy(&(dataset->path), loc->path, H5_COPY_SHALLOW) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, NULL, "can't copy path") - /* Get the external file prefix */ - if(H5D_build_extfile_prefix(dataset, dapl_id, &extfile_prefix) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix") - /* Check if dataset was already open */ if(NULL == (shared_fo = (H5D_shared_t *)H5FO_opened(dataset->oloc.file, dataset->oloc.addr))) { /* Clear any errors from H5FO_opened() */ @@ -1416,12 +1326,6 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) /* We're the first dataset to use the the shared info */ dataset->shared->fo_count = 1; - - /* Set the external file prefix */ - dataset->shared->extfile_prefix = extfile_prefix; - /* Prevent string from being freed during done: */ - extfile_prefix = NULL; - } /* end if */ else { /* Point to shared info */ @@ -1430,12 +1334,6 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) /* Increment # of datasets using shared information */ shared_fo->fo_count++; - /* Check whether the external file prefix of the already open dataset - * matches the new external file prefix - */ - if(HDstrcmp(extfile_prefix, dataset->shared->extfile_prefix) != 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "new external file prefix does not match external file prefix of already open dataset") - /* Check if the object has been opened through the top file yet */ if(H5FO_top_count(dataset->oloc.file, dataset->oloc.addr) == 0) { /* Open the object through this top file */ @@ -1452,15 +1350,11 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) ret_value = dataset; done: - extfile_prefix = (char *)H5MM_xfree(extfile_prefix); - if(ret_value == NULL) { /* Free the location--casting away const*/ if(dataset) { - if(shared_fo == NULL && dataset->shared) { /* Need to free shared fo */ - dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix); + if(shared_fo == NULL) /* Need to free shared fo */ dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared); - } H5O_loc_free(&(dataset->oloc)); H5G_name_free(&(dataset->path)); @@ -1764,9 +1658,6 @@ H5D_close(H5D_t *dataset) if(dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset, H5AC_ind_read_dxpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info") - /* Free the external file prefix */ - dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix); - /* Release layout, fill-value, efl & pipeline messages */ if(dataset->shared->dcpl_id != H5P_DATASET_CREATE_DEFAULT) free_failed |= (H5O_msg_reset(H5O_PLINE_ID, &dataset->shared->dcpl_cache.pline) < 0) || diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index bc04300..5972d9e 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -441,8 +441,6 @@ typedef struct H5D_shared_t { */ H5D_rdcc_t chunk; /* Information about chunked data */ } cache; - - char *extfile_prefix; /* expanded external file prefix */ } H5D_shared_t; struct H5D_t { diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index ab60a50..3b43aaf 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -54,7 +54,6 @@ #define H5D_ACS_PREEMPT_READ_CHUNKS_NAME "rdcc_w0" /* Preemption read chunks first */ #define H5D_ACS_VDS_VIEW_NAME "vds_view" /* VDS view option */ #define H5D_ACS_VDS_PRINTF_GAP_NAME "vds_printf_gap" /* VDS printf gap size */ -#define H5D_ACS_EFILE_PREFIX_NAME "external file prefix" /* External file prefix */ /* ======== Data transfer properties ======== */ #define H5D_XFER_MAX_TEMP_BUF_NAME "max_temp_buf" /* Maximum temp buffer size */ diff --git a/src/H5Fquery.c b/src/H5Fquery.c index e9af300..66f002c 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -158,7 +158,7 @@ H5F_get_actual_name(const H5F_t *f) * Function: H5F_get_extpath * * Purpose: Retrieve the file's 'extpath' flags - * This is used by H5L_extern_traverse() and H5D_build_extfile_prefix() to retrieve the main file's location + * This is used by H5L_extern_traverse() to retrieve the main file's location * when searching the target file. * * Return: 'extpath' on success/abort on failure (shouldn't fail) diff --git a/src/H5MM.c b/src/H5MM.c index 5c2a731..09e6461 100644 --- a/src/H5MM.c +++ b/src/H5MM.c @@ -125,10 +125,10 @@ static size_t H5MM_peak_alloc_blocks_count_s = 0; * Function: H5MM__is_our_block * * Purpose: Try to determine if a memory buffer has been allocated through - * the H5MM* interface, instead of the system's malloc() routines. + * the H5MM* interface, instead of the system's malloc() routines. * - * Return: Success: TRUE/FALSE - * Failure: (Can't fail) + * Return: Success: TRUE/FALSE + * Failure: (Can't fail) * * Programmer: Quincey Koziol * Dec 30 2015 @@ -149,7 +149,7 @@ H5MM__is_our_block(void *mem) * * Purpose: Check a block wrapper around a buffer to validate it. * - * Return: N/A (void) + * Return: N/A (void) * * Programmer: Quincey Koziol * Dec 30 2015 @@ -173,9 +173,9 @@ H5MM__sanity_check_block(const H5MM_block_t *block) * Function: H5MM__sanity_check * * Purpose: Check a buffer to validate it (just calls - * H5MM__sanity_check_block after finding block for buffer) + * H5MM__sanity_check_block after finding block for buffer) * - * Return: N/A (void) + * Return: N/A (void) * * Programmer: Quincey Koziol * Dec 30 2015 @@ -196,7 +196,7 @@ H5MM__sanity_check(void *mem) * * Purpose: Sanity check all current memory allocations. * - * Return: N/A (void) + * Return: N/A (void) * * Programmer: Quincey Koziol * Jan 5 2016 @@ -206,7 +206,7 @@ H5MM__sanity_check(void *mem) void H5MM_sanity_check_all(void) { - H5MM_block_t *curr = NULL; + H5MM_block_t *curr; curr = H5MM_block_head_s.next; while(curr != &H5MM_block_head_s) { @@ -221,7 +221,7 @@ H5MM_sanity_check_all(void) * * Purpose: Final sanity checks on memory allocation. * - * Return: N/A (void) + * Return: N/A (void) * * Programmer: Quincey Koziol * Jan 1 2016 @@ -257,8 +257,8 @@ H5MM_final_sanity_check(void) * considered an error condition since allocations of zero * bytes usually indicate problems. * - * Return: Success: Pointer to new memory - * Failure: NULL + * Return: Success: Pointer new memory + * Failure: NULL * * Programmer: Quincey Koziol * Nov 8 2003 @@ -268,7 +268,7 @@ H5MM_final_sanity_check(void) void * H5MM_malloc(size_t size) { - void *ret_value = NULL; + void *ret_value; HDassert(size); @@ -346,8 +346,8 @@ H5MM_malloc(size_t size) * bytes usually indicate problems. * * - * Return: Success: Pointer to new memory - * Failure: NULL + * Return: Success: Pointer new memory + * Failure: NULL * * Programmer: Quincey Koziol * Nov 8 2003 @@ -357,7 +357,7 @@ H5MM_malloc(size_t size) void * H5MM_calloc(size_t size) { - void *ret_value = NULL; + void *ret_value; HDassert(size); @@ -392,9 +392,8 @@ H5MM_calloc(size_t size) * Note that the (NULL, 0) combination is undefined behavior * in the C standard. * - * Return: Success: Ptr to new memory if size > 0 - * NULL if size is zero - * Failure: NULL (input buffer is unchanged on failure) + * Return: Success: Ptr to new memory if size > 0, NULL if size is zero + * Failure: NULL (input buffer is unchanged on failure) * * Programmer: Robb Matzke * Jul 10 1997 @@ -404,7 +403,7 @@ H5MM_calloc(size_t size) void * H5MM_realloc(void *mem, size_t size) { - void *ret_value = NULL; + void *ret_value; /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -459,6 +458,7 @@ H5MM_realloc(void *mem, size_t size) * Failure: abort() * * Programmer: Robb Matzke + * matzke@llnl.gov * Jul 10 1997 *------------------------------------------------------------------------- */ @@ -490,16 +490,17 @@ done: * an error will be raised. * * Return: Success: Pointer to a new string - * Failure: NULL + * Failure: abort() * * Programmer: Robb Matzke + * matzke@llnl.gov * Jul 10 1997 *------------------------------------------------------------------------- */ char * H5MM_strdup(const char *s) { - char *ret_value = NULL; + char *ret_value; FUNC_ENTER_NOAPI(NULL) @@ -527,6 +528,7 @@ done: * Failure: never fails * * Programmer: Robb Matzke + * matzke@llnl.gov * Jul 10 1997 * *------------------------------------------------------------------------- diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index 6407d4c..eab9337 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -16,8 +16,8 @@ /*------------------------------------------------------------------------- * * Created: H5Pdapl.c - * October 27, 2008 - * Neil Fortner + * October 27, 2008 + * Neil Fortner * * Purpose: Dataset access property list class routines * @@ -39,8 +39,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* Files */ #include "H5Iprivate.h" /* IDs */ -#include "H5Ppkg.h" /* Property lists */ -#include "H5MMprivate.h" /* Memory management */ +#include "H5Ppkg.h" /* Property lists */ /****************/ @@ -73,17 +72,6 @@ #define H5D_ACS_VDS_PRINTF_GAP_DEF (hsize_t)0 #define H5D_ACS_VDS_PRINTF_GAP_ENC H5P__encode_hsize_t #define H5D_ACS_VDS_PRINTF_GAP_DEC H5P__decode_hsize_t -/* Definitions for external file prefix */ -#define H5D_ACS_EFILE_PREFIX_SIZE sizeof(char *) -#define H5D_ACS_EFILE_PREFIX_DEF NULL /*default is no prefix */ -#define H5D_ACS_EFILE_PREFIX_SET H5P__dapl_efile_pref_set -#define H5D_ACS_EFILE_PREFIX_GET H5P__dapl_efile_pref_get -#define H5D_ACS_EFILE_PREFIX_ENC H5P__dapl_efile_pref_enc -#define H5D_ACS_EFILE_PREFIX_DEC H5P__dapl_efile_pref_dec -#define H5D_ACS_EFILE_PREFIX_DEL H5P__dapl_efile_pref_del -#define H5D_ACS_EFILE_PREFIX_COPY H5P__dapl_efile_pref_copy -#define H5D_ACS_EFILE_PREFIX_CMP H5P__dapl_efile_pref_cmp -#define H5D_ACS_EFILE_PREFIX_CLOSE H5P__dapl_efile_pref_close /******************/ /* Local Typedefs */ @@ -112,16 +100,6 @@ static herr_t H5P__decode_chunk_cache_nbytes(const void **_pp, void *_value); static herr_t H5P__dacc_vds_view_enc(const void *value, void **pp, size_t *size); static herr_t H5P__dacc_vds_view_dec(const void **pp, void *value); -/* Property list callbacks */ -static herr_t H5P__dapl_efile_pref_set(hid_t prop_id, const char* name, size_t size, void* value); -static herr_t H5P__dapl_efile_pref_get(hid_t prop_id, const char* name, size_t size, void* value); -static herr_t H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size); -static herr_t H5P__dapl_efile_pref_dec(const void **_pp, void *value); -static herr_t H5P__dapl_efile_pref_del(hid_t prop_id, const char* name, size_t size, void* value); -static herr_t H5P__dapl_efile_pref_copy(const char* name, size_t size, void* value); -static int H5P__dapl_efile_pref_cmp(const void *value1, const void *value2, size_t size); -static herr_t H5P__dapl_efile_pref_close(const char* name, size_t size, void* value); - /*********************/ /* Package Variables */ @@ -156,9 +134,6 @@ const H5P_libclass_t H5P_CLS_DACC[1] = {{ /* Local Variables */ /*******************/ -/* Property value defaults */ -static const char *H5D_def_efile_prefix_g = H5D_ACS_EFILE_PREFIX_DEF; /* Default external file prefix string */ - /*------------------------------------------------------------------------- @@ -212,274 +187,12 @@ H5P__dacc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - /* Register property for external file prefix */ - if(H5P_register_real(pclass, H5D_ACS_EFILE_PREFIX_NAME, H5D_ACS_EFILE_PREFIX_SIZE, &H5D_def_efile_prefix_g, - NULL, H5D_ACS_EFILE_PREFIX_SET, H5D_ACS_EFILE_PREFIX_GET, H5D_ACS_EFILE_PREFIX_ENC, H5D_ACS_EFILE_PREFIX_DEC, - H5D_ACS_EFILE_PREFIX_DEL, H5D_ACS_EFILE_PREFIX_COPY, H5D_ACS_EFILE_PREFIX_CMP, H5D_ACS_EFILE_PREFIX_CLOSE) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__dacc_reg_prop() */ /*------------------------------------------------------------------------- - * Function: H5P__dapl_efile_pref_set - * - * Purpose: Copies an external file prefix property when it's set - * for a property list - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -static herr_t -H5P__dapl_efile_pref_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, - size_t H5_ATTR_UNUSED size, void *value) -{ - FUNC_ENTER_STATIC_NOERR - - /* Sanity check */ - HDassert(value); - - /* Copy the prefix */ - *(char **)value = H5MM_xstrdup(*(const char **)value); - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P__dapl_efile_pref_set() */ - - -/*------------------------------------------------------------------------- - * Function: H5P__dapl_efile_pref_get - * - * Purpose: Copies an external file prefix property when it's retrieved - * from a property list - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -static herr_t -H5P__dapl_efile_pref_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, - size_t H5_ATTR_UNUSED size, void *value) -{ - FUNC_ENTER_STATIC_NOERR - - /* Sanity check */ - HDassert(value); - - /* Copy the prefix */ - *(char **)value = H5MM_xstrdup(*(const char **)value); - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P__dapl_efile_pref_get() */ - - -/*------------------------------------------------------------------------- - * Function: H5P__dapl_efile_pref_enc - * - * Purpose: Callback routine which is called whenever the efile flags - * property in the dataset access property list is - * encoded. - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -static herr_t -H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size) -{ - const char *efile_pref = *(const char * const *)value; - uint8_t **pp = (uint8_t **)_pp; - size_t len = 0; - uint64_t enc_value; - unsigned enc_size; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); - - /* calculate prefix length */ - if(NULL != efile_pref) - len = HDstrlen(efile_pref); - - enc_value = (uint64_t)len; - enc_size = H5VM_limit_enc_size(enc_value); - HDassert(enc_size < 256); - - if(NULL != *pp) { - /* encode the length of the prefix */ - *(*pp)++ = (uint8_t)enc_size; - UINT64ENCODE_VAR(*pp, enc_value, enc_size); - - /* encode the prefix */ - if(NULL != efile_pref) { - HDmemcpy(*(char **)pp, efile_pref, len); - *pp += len; - } /* end if */ - } /* end if */ - - *size += (1 + enc_size); - if(NULL != efile_pref) - *size += len; - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P__dapl_efile_pref_enc() */ - - -/*------------------------------------------------------------------------- - * Function: H5P__dapl_efile_pref_dec - * - * Purpose: Callback routine which is called whenever the efile prefix - * property in the dataset access property list is - * decoded. - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -static herr_t -H5P__dapl_efile_pref_dec(const void **_pp, void *_value) -{ - char **efile_pref = (char **)_value; - const uint8_t **pp = (const uint8_t **)_pp; - size_t len; - uint64_t enc_value; /* Decoded property value */ - unsigned enc_size; /* Size of encoded property */ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_NOAPI_NOINIT - - HDassert(pp); - HDassert(*pp); - HDassert(efile_pref); - HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); - - /* Decode the size */ - enc_size = *(*pp)++; - HDassert(enc_size < 256); - - /* Decode the value */ - UINT64DECODE_VAR(*pp, enc_value, enc_size); - len = (size_t)enc_value; - - if(0 != len) { - /* Make a copy of the user's prefix string */ - if(NULL == (*efile_pref = (char *)H5MM_malloc(len + 1))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for prefix") - HDstrncpy(*efile_pref, *(const char **)pp, len); - (*efile_pref)[len] = '\0'; - - *pp += len; - } /* end if */ - else - *efile_pref = NULL; - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P__dapl_efile_pref_dec() */ - - -/*------------------------------------------------------------------------- - * Function: H5P__dapl_efile_pref_del - * - * Purpose: Frees memory used to store the external file prefix string - * - * Return: SUCCEED (Can't fail) - * - *------------------------------------------------------------------------- - */ -static herr_t -H5P__dapl_efile_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, - size_t H5_ATTR_UNUSED size, void *value) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(value); - - H5MM_xfree(*(void **)value); - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P__dapl_efile_pref_del() */ - - -/*------------------------------------------------------------------------- - * Function: H5P__dapl_efile_pref_copy - * - * Purpose: Creates a copy of the external file prefix string - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -static herr_t -H5P__dapl_efile_pref_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(value); - - *(char **)value = H5MM_xstrdup(*(const char **)value); - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P__dapl_efile_pref_copy() */ - - -/*------------------------------------------------------------------------- - * Function: H5P__dapl_efile_pref_cmp - * - * Purpose: Callback routine which is called whenever the efile prefix - * property in the dataset creation property list is - * compared. - * - * Return: zero if VALUE1 and VALUE2 are equal, non zero otherwise. - * - *------------------------------------------------------------------------- - */ -static int -H5P__dapl_efile_pref_cmp(const void *value1, const void *value2, size_t H5_ATTR_UNUSED size) -{ - const char *pref1 = *(const char * const *)value1; - const char *pref2 = *(const char * const *)value2; - int ret_value = 0; - - FUNC_ENTER_NOAPI_NOINIT_NOERR - - if(NULL == pref1 && NULL != pref2) - HGOTO_DONE(1); - if(NULL != pref1 && NULL == pref2) - HGOTO_DONE(-1); - if(NULL != pref1 && NULL != pref2) - ret_value = HDstrcmp(pref1, pref2); - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5P__dapl_efile_pref_cmp() */ - - -/*------------------------------------------------------------------------- - * Function: H5P__dapl_efile_pref_close - * - * Purpose: Frees memory used to store the external file prefix string - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -static herr_t -H5P__dapl_efile_pref_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(value); - - H5MM_xfree(*(void **)value); - - FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5P__dapl_efile_pref_close() */ - - -/*------------------------------------------------------------------------- * Function: H5Pset_chunk_cache * * Purpose: Set the number of objects in the meta data cache and the @@ -1074,94 +787,3 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_virtual_printf_gap() */ - -/*------------------------------------------------------------------------- - * Function: H5Pset_efile_prefix - * - * Purpose: Set a prefix to be used for any external files. - * - * If the prefix starts with ${ORIGIN}, this will be replaced by - * the absolute path of the directory of the HDF5 file containing - * the dataset. - * - * If the prefix is ".", no prefix will be applied. - * - * This property can be overwritten by the environment variable - * HDF5_EXTFILE_PREFIX. - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -herr_t -H5Pset_efile_prefix(hid_t plist_id, const char *prefix) -{ - H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*s", plist_id, prefix); - - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - - /* Set prefix */ - if(H5P_set(plist, H5D_ACS_EFILE_PREFIX_NAME, &prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set prefix info") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pset_efile_prefix() */ - - -/*------------------------------------------------------------------------- - * Function: H5Pget_efile_prefix - * - * Purpose: Gets the prefix to be used for any external files. - * - * If the pointer is not NULL, it points to a user-allocated - * buffer. - * - * Return: Non-negative on success/Negative on failure - * - *------------------------------------------------------------------------- - */ -ssize_t -H5Pget_efile_prefix(hid_t plist_id, char *prefix, size_t size) -{ - H5P_genplist_t *plist; /* Property list pointer */ - char *my_prefix; /* Library's copy of the prefix */ - size_t len; /* Length of prefix string */ - ssize_t ret_value; /* Return value */ - - FUNC_ENTER_API(FAIL) - H5TRACE3("Zs", "i*sz", plist_id, prefix, size); - - /* Get the plist structure */ - if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") - - /* Get the current prefix */ - if(H5P_peek(plist, H5D_ACS_EFILE_PREFIX_NAME, &my_prefix) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file prefix") - - /* Check for prefix being set */ - if(my_prefix) { - /* Copy to user's buffer, if given */ - len = HDstrlen(my_prefix); - if(prefix) { - HDstrncpy(prefix, my_prefix, MIN(len + 1, size)); - if(len >= size) - prefix[size - 1] = '\0'; - } /* end if */ - } /* end if */ - else - len = 0; - - /* Set return value */ - ret_value = (ssize_t)len; - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5Pget_efile_prefix() */ diff --git a/src/H5Plapl.c b/src/H5Plapl.c index f2711e8..6cb2149 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -795,8 +795,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__lacc_elink_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, - size_t H5_ATTR_UNUSED size, void *value) +H5P__lacc_elink_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) { FUNC_ENTER_STATIC_NOERR diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 9308339..9ab1944 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -406,8 +406,6 @@ H5_DLL herr_t H5Pset_virtual_view(hid_t plist_id, H5D_vds_view_t view); H5_DLL herr_t H5Pget_virtual_view(hid_t plist_id, H5D_vds_view_t *view); H5_DLL herr_t H5Pset_virtual_printf_gap(hid_t plist_id, hsize_t gap_size); H5_DLL herr_t H5Pget_virtual_printf_gap(hid_t plist_id, hsize_t *gap_size); -H5_DLL herr_t H5Pset_efile_prefix(hid_t dapl_id, const char* prefix); -H5_DLL ssize_t H5Pget_efile_prefix(hid_t dapl_id, char* prefix /*out*/, size_t size); /* Dataset xfer property list (DXPL) routines */ H5_DLL herr_t H5Pset_data_transform(hid_t plist_id, const char* expression); diff --git a/src/H5private.h b/src/H5private.h index fa5a114..8d5f4c9 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1189,9 +1189,6 @@ typedef off_t h5_stat_size_t; #ifndef HDsetbuf #define HDsetbuf(F,S) setbuf(F,S) #endif /* HDsetbuf */ -#ifndef HDsetenv - #define HDsetenv(N,V,O) setenv(N,V,O) -#endif /* HDsetenv */ #ifndef HDsetgid #define HDsetgid(G) setgid(G) #endif /* HDsetgid */ @@ -2563,8 +2560,7 @@ H5_DLL uint32_t H5_hash_string(const char *str); H5_DLL time_t H5_make_time(struct tm *tm); /* Functions for building paths, etc. */ -H5_DLL herr_t H5_build_extpath(const char *name, char **extpath /*out*/); -H5_DLL herr_t H5_combine_path(const char *path1, const char *path2, char **full_name /*out*/); +H5_DLL herr_t H5_build_extpath(const char *, char ** /*out*/ ); /* Functions for debugging */ H5_DLL herr_t H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf, diff --git a/src/H5system.c b/src/H5system.c index eb09b15..4baebc5 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -757,7 +757,7 @@ done: */ int Wgettimeofday(struct timeval *tv, struct timezone *tz) -{ + { union { unsigned long long ns100; /*time since 1 Jan 1601 in 100ns units */ FILETIME ft; @@ -783,42 +783,7 @@ Wgettimeofday(struct timeval *tv, struct timezone *tz) /* Always return 0 as per Open Group Base Specifications Issue 6. Do not set errno on error. */ return 0; -} /* end Wgettimeofday() */ - - -/*------------------------------------------------------------------------- - * Function: Wsetenv - * - * Purpose: Wrapper function for setenv on Windows systems. - * Interestingly, getenv *is* available in the Windows - * POSIX layer, just not setenv. - * - * Return: Success: 0 - * Failure: non-zero error code - * - * Programmer: Dana Robinson - * February 2016 - * - *------------------------------------------------------------------------- - */ -int -Wsetenv(const char *name, const char *value, int overwrite) -{ - size_t bufsize; - errno_t err; - - /* If we're not overwriting, check if the environment variable exists. - * If it does (i.e.: the required buffer size to store the variable's - * value is non-zero), then return an error code. - */ - if(!overwrite) { - err = getenv_s(&bufsize, NULL, 0, name); - if (err || bufsize) - return (int)err; - } /* end if */ - - return (int)_putenv_s(name, value); -} /* end Wsetenv() */ +} #ifdef H5_HAVE_WINSOCK2_H #pragma comment(lib, "advapi32.lib") @@ -916,25 +881,26 @@ Wflock(int fd, int operation) { /*------------------------------------------------------------------------- - * Function: H5_build_extpath + * Function: H5_build_extpath * - * Purpose: To build the path for later searching of target file for external - * links and external files. This path can be either: + * Purpose: To build the path for later searching of target file for external + * link. This path can be either: * 1. The absolute path of NAME * or * 2. The current working directory + relative path of NAME * - * Return: SUCCEED/FAIL + * Return: Success: 0 + * Failure: -1 * * Programmer: Vailin Choi - * April 2, 2008 + * April 2, 2008 * *------------------------------------------------------------------------- */ #define MAX_PATH_LEN 1024 herr_t -H5_build_extpath(const char *name, char **extpath /*out*/) +H5_build_extpath(const char *name, char **extpath/*out*/) { char *full_path = NULL; /* Pointer to the full path, as built or passed in */ char *cwdpath = NULL; /* Pointer to the current working directory path */ @@ -1032,80 +998,5 @@ done: H5MM_xfree(new_name); FUNC_LEAVE_NOAPI(ret_value) -} /* end H5_build_extpath() */ - - -/*-------------------------------------------------------------------------- - * Function: H5_combine_path - * - * Purpose: If path2 is relative, interpret path2 as relative to path1 - * and store the result in full_name. Otherwise store path2 - * in full_name. - * - * Return: SUCCEED/FAIL - * - * Programmer: Steffen Kiess - * June 22, 2015 - *-------------------------------------------------------------------------- - */ -herr_t -H5_combine_path(const char* path1, const char* path2, char **full_name /*out*/) -{ - size_t path1_len; /* length of path1 */ - size_t path2_len; /* length of path2 */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI_NOINIT - - HDassert(path1); - HDassert(path2); - - path1_len = HDstrlen(path1); - path2_len = HDstrlen(path2); - - if(*path1 == '\0' || H5_CHECK_ABSOLUTE(path2)) { - - /* If path1 is empty or path2 is absolute, simply use path2 */ - if(NULL == (*full_name = (char *)H5MM_strdup(path2))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - - } /* end if */ - else if(H5_CHECK_ABS_PATH(path2)) { - - /* On windows path2 is a path absolute name */ - if (H5_CHECK_ABSOLUTE(path1) || H5_CHECK_ABS_DRIVE(path1)) { - /* path1 is absolute or drive absolute and path2 is path absolute. - * Use the drive letter of path1 + path2 - */ - if(NULL == (*full_name = (char *)H5MM_malloc(path2_len + 3))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate path2 buffer") - HDsnprintf(*full_name, (path2_len + 3), "%c:%s", path1[0], path2); - } /* end if */ - else { - /* On windows path2 is path absolute name ("\foo\bar"), - * path1 does not have a drive letter (i.e. is "a\b" or "\a\b"). - * Use path2. - */ - if(NULL == (*full_name = (char *)H5MM_strdup(path2))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - } /* end else */ - - } /* end else if */ - else { - - /* Relative path2: - * Allocate a buffer to hold path1 + path2 + possibly the delimiter - * + terminating null byte - */ - if(NULL == (*full_name = (char *)H5MM_malloc(path1_len + path2_len + 2))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate filename buffer") - - /* Compose the full file name */ - HDsnprintf(*full_name, (path1_len + path2_len + 2), "%s%s%s", path1, - (H5_CHECK_DELIMITER(path1[path1_len - 1]) ? "" : H5_DIR_SEPS), path2); - } /* end else */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5_combine_name() */ +} /* H5_build_extpath() */ diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 2a0f22d..e84def9 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -71,24 +71,21 @@ struct timezone { }; #ifdef __cplusplus -extern "C" { + extern "C" { #endif /* __cplusplus */ - H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz); - H5_DLL int Wsetenv(const char *name, const char *value, int overwrite); - H5_DLL int Wflock(int fd, int operation); - H5_DLL char* Wgetlogin(void); - H5_DLL int c99_snprintf(char* str, size_t size, const char* format, ...); - H5_DLL int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap); + H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz); + H5_DLL int Wflock(int fd, int operation); + H5_DLL char* Wgetlogin(void); + H5_DLL int c99_snprintf(char* str, size_t size, const char* format, ...); + H5_DLL int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap); #ifdef __cplusplus -} + } #endif /* __cplusplus */ - #define HDgettimeofday(V,Z) Wgettimeofday(V,Z) -#define HDsetenv(N,V,O) Wsetenv(N,V,O) #define HDflock(F,L) Wflock(F,L) #define HDgetlogin() Wgetlogin() #define HDsnprintf c99_snprintf /*varargs*/ -#define HDvsnprintf c99_vsnprintf /*varargs*/ +#define HDvsnprintf c99_vsnprintf #endif /* H5_HAVE_VISUAL_STUDIO */ @@ -101,7 +98,5 @@ extern "C" { #ifndef H5_HAVE_MINGW #define HDftruncate(F,L) _chsize_s(F,L) #define HDfseek(F,O,W) _fseeki64(F,O,W) -#endif /* H5_HAVE_MINGW */ - +#endif #endif /* H5_HAVE_WIN32_API */ - diff --git a/test/Makefile.am b/test/Makefile.am index 667c0e7..8389cc4 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -129,7 +129,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse huge_chunks.h5 chunk_cache.h5 big_chunk.h5 chunk_expand.h5 \ copy_dcpl_newfile.h5 extend.h5 istore.h5 extlinks*.h5 frspace.h5 links*.h5 \ sys_file1 tfile[1-7].h5 th5s[1-4].h5 lheap.h5 fheap.h5 ohdr.h5 \ - stab.h5 extern_[1-4].h5 extern_[1-4][rw].raw gheap[0-5].h5 \ + stab.h5 extern_[1-3].h5 extern_[1-4][ab].raw gheap[0-4].h5 \ dt_arith[1-2] links.h5 links[0-6]*.h5 extlinks[0-15].h5 tmp \ big.data big[0-9][0-9][0-9][0-9][0-9].h5 \ stdio.h5 sec2.h5 dtypes[0-9].h5 dtypes1[0].h5 dt_arith[1-2].h5 tattr.h5 \ diff --git a/test/external.c b/test/external.c index 67fa2ec..a37dc94 100644 --- a/test/external.c +++ b/test/external.c @@ -25,19 +25,9 @@ const char *FILENAME[] = { "extern_1", "extern_2", "extern_3", - "extern_4", - "extern_dir/file_1", NULL }; -/* A similar collection of files is used for the tests that - * perform file I/O. - */ -#define N_EXT_FILES 4 -#define PART_SIZE 25 -#define TOTAL_SIZE 100 -#define GARBAGE_PER_FILE 10 - /*------------------------------------------------------------------------- * Function: files_have_same_contents @@ -100,106 +90,6 @@ out: /*------------------------------------------------------------------------- - * Function: reset_raw_data_files - * - * Purpose: Resets the data in the raw data files for tests that - * perform dataset I/O on a set of files. - * - * Return: SUCCEED/FAIL - * - * Programmer: Dana Robinson - * February 2016 - * - *------------------------------------------------------------------------- - */ -static herr_t -reset_raw_data_files(void) -{ - int fd = 0; /* external file descriptor */ - size_t i, j; /* iterators */ - hssize_t n; /* bytes of I/O */ - char filename[1024]; /* file name */ - int data[PART_SIZE]; /* raw data buffer */ - uint8_t *garbage = NULL; /* buffer of garbage data */ - size_t garbage_count; /* size of garbage buffer */ - size_t garbage_bytes; /* # of garbage bytes written to file */ - - /* Set up garbage buffer */ - garbage_count = N_EXT_FILES * GARBAGE_PER_FILE; - if(NULL == (garbage = (uint8_t *)HDcalloc(garbage_count, sizeof(uint8_t)))) - goto error; - for(i = 0; i < garbage_count; i++) - garbage[i] = 0xFF; - - /* The *r files are pre-filled with data and are used to - * verify that read operations work correctly. - */ - for(i = 0; i < N_EXT_FILES; i++) { - - /* Open file */ - HDsprintf(filename, "extern_%lur.raw", (unsigned long)i + 1); - if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) - goto error; - - /* Write garbage data to the file. This allows us to test the - * the ability to set an offset in the raw data file. - */ - garbage_bytes = i * 10; - n = HDwrite(fd, garbage, garbage_bytes); - if(n < 0 || (size_t)n != garbage_bytes) - goto error; - - /* Fill array with data */ - for(j = 0; j < PART_SIZE; j++) { - data[j] = (int)(i * 25 + j); - } /* end for */ - - /* Write raw data to the file. */ - n = HDwrite(fd, data, sizeof(data)); - if(n != sizeof(data)) - goto error; - - /* Close this file */ - HDclose(fd); - - } /* end for */ - - /* The *w files are only pre-filled with the garbage data and are - * used to verify that write operations work correctly. The individual - * tests fill in the actual data. - */ - for(i = 0; i < N_EXT_FILES; i++) { - - /* Open file */ - HDsprintf(filename, "extern_%luw.raw", (unsigned long)i + 1); - if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) - goto error; - - /* Write garbage data to the file. This allows us to test the - * the ability to set an offset in the raw data file. - */ - garbage_bytes = i * 10; - n = HDwrite(fd, garbage, garbage_bytes); - if(n < 0 || (size_t)n != garbage_bytes) - goto error; - - /* Close this file */ - HDclose(fd); - - } /* end for */ - HDfree(garbage); - return SUCCEED; - -error: - if(fd) - HDclose(fd); - if(garbage) - HDfree(garbage); - return FAIL; -} /* end reset_raw_data_files() */ - - -/*------------------------------------------------------------------------- * Function: test_non_extendible * * Purpose: Tests a non-extendible dataset with a single external file. @@ -222,7 +112,7 @@ test_non_extendible(hid_t file) hsize_t max_size[1]; /* data space maximum size */ int n; /* number of external files */ char name[256]; /* external file name */ - off_t file_offset; /* external file offset */ + HDoff_t file_offset; /* external file offset */ hsize_t file_size; /* sizeof external file segment */ haddr_t dset_addr; /* address of dataset */ @@ -471,7 +361,7 @@ test_large_enough_current_not_eventual(hid_t file) /*------------------------------------------------------------------------- - * Function: test_unlimited + * Function: test_1e * * Purpose: Test a single external file of unlimited size and an * unlimited data space. @@ -494,7 +384,7 @@ test_unlimited(hid_t file) hsize_t max_size[1]; /* data space maximum size */ int n; /* number of external files */ char name[256]; /* external file name */ - off_t file_offset; /* external file offset */ + HDoff_t file_offset; /* external file offset */ hsize_t file_size; /* sizeof external file segment */ TESTING("unlimited dataspace, unlimited external storage"); @@ -739,25 +629,38 @@ test_read_file_set(hid_t fapl) hid_t space = -1; /* data space */ hid_t dset = -1; /* dataset */ hid_t grp = -1; /* group to emit diagnostics */ - size_t i; /* miscellaneous counter */ + int fd = -1; /* external file descriptors */ + size_t i, j; /* miscellaneous counters */ + hssize_t n; /* bytes of I/O */ char filename[1024]; /* file names */ - int part[PART_SIZE]; /* raw data buffer (partial) */ - int whole[TOTAL_SIZE]; /* raw data buffer (total) */ + int part[25], whole[100]; /* raw data buffers */ hsize_t cur_size; /* current data space size */ - hid_t hs_space = -1; /* hyperslab data space */ + hid_t hs_space; /* hyperslab data space */ hsize_t hs_start = 30; /* hyperslab starting offset */ hsize_t hs_count = 25; /* hyperslab size */ + int temparray[10] = {0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f}; TESTING("read external dataset"); - if(HDsetenv("HDF5_EXTFILE_PREFIX", "", 1) < 0) - TEST_ERROR - - /* Reset the raw data files */ - if(reset_raw_data_files() < 0) + /* Write the data to external files directly */ + for(i=0; i<4; i++) { + for(j=0; j<25; j++) { + part[j] = (int)(i*25+j); + } /* end for */ + HDsprintf(filename, "extern_%lua.raw", (unsigned long)i+1); + if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) + TEST_ERROR + n = HDwrite(fd, temparray, (size_t)i*10); + if(n < 0 || (size_t)n != i*10) + TEST_ERROR + n = HDwrite(fd, part, sizeof(part)); + if(n != sizeof(part)) TEST_ERROR + HDclose(fd); + } /* end for */ - /* Create the file and an initial group. This causes messages about + /* + * Create the file and an initial group. This causes messages about * debugging to be emitted before we start playing games with what the * output looks like. */ @@ -768,57 +671,50 @@ test_read_file_set(hid_t fapl) FAIL_STACK_ERROR if(H5Gclose(grp) < 0) FAIL_STACK_ERROR - /* Create the dcpl */ + /* Create the dataset */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - for(i = 0; i < N_EXT_FILES; i++) { - HDsnprintf(filename, sizeof(filename), "extern_%dr.raw", (int) i + 1); - if(H5Pset_external(dcpl, filename, (HDoff_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0) - FAIL_STACK_ERROR - } /* end for */ - - /* Create the dataspace */ - cur_size = TOTAL_SIZE; + if(H5Pset_external(dcpl, "extern_1a.raw", (HDoff_t)0, (hsize_t)sizeof part) < 0 || + H5Pset_external(dcpl, "extern_2a.raw", (HDoff_t)10, (hsize_t)sizeof part) < 0 || + H5Pset_external(dcpl, "extern_3a.raw", (HDoff_t)20, (hsize_t)sizeof part) < 0 || + H5Pset_external(dcpl, "extern_4a.raw", (HDoff_t)30, (hsize_t)sizeof part) < 0) + FAIL_STACK_ERROR + cur_size = 100; if((space = H5Screate_simple(1, &cur_size, NULL)) < 0) FAIL_STACK_ERROR - - /* Create the dataset */ if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* Read the entire dataset */ + /* + * Read the entire dataset and compare with the original + */ HDmemset(whole, 0, sizeof(whole)); if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0) FAIL_STACK_ERROR - - /* Compare data */ - for(i = 0; i < TOTAL_SIZE; i++) + for(i = 0; i < 100; i++) if(whole[i] != (signed)i) - FAIL_PUTS_ERROR("Incorrect value(s) read."); + FAIL_PUTS_ERROR(" Incorrect value(s) read."); - /* Read via a hypserslab in the middle of the dataset */ + /* Read the middle of the dataset */ + if((hs_space = H5Scopy(space)) < 0) + FAIL_STACK_ERROR + if(H5Sselect_hyperslab(hs_space, H5S_SELECT_SET, &hs_start, NULL, &hs_count, NULL) < 0) + FAIL_STACK_ERROR - /* Set up dataspace */ - if((hs_space = H5Scopy(space)) < 0) - FAIL_STACK_ERROR - if(H5Sselect_hyperslab(hs_space, H5S_SELECT_SET, &hs_start, NULL, &hs_count, NULL) < 0) - FAIL_STACK_ERROR + HDmemset(whole, 0, sizeof(whole)); + if(H5Dread(dset, H5T_NATIVE_INT, hs_space, hs_space, H5P_DEFAULT, whole) < 0) + FAIL_STACK_ERROR - /* Read */ - HDmemset(whole, 0, sizeof(whole)); - if(H5Dread(dset, H5T_NATIVE_INT, hs_space, hs_space, H5P_DEFAULT, whole) < 0) - FAIL_STACK_ERROR + if(H5Sclose(hs_space) < 0) FAIL_STACK_ERROR - /* Verify data */ - for(i = (size_t)hs_start; i < (size_t)(hs_start + hs_count); i++) { - if(whole[i] != (signed)i) - FAIL_PUTS_ERROR("Incorrect value(s) read (hyperslab)."); - } /* end for */ + for(i = hs_start; i= 0) - FAIL_PUTS_ERROR("reopening the dataset with a different efile_prefix succeded"); - - /* Read the entire dataset and compare with the original */ - HDmemset(whole, 0, sizeof(whole)); - if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0) - FAIL_STACK_ERROR - for(i = 0; i < TOTAL_SIZE; i++) - if(whole[i] != (signed)i) - FAIL_PUTS_ERROR("Incorrect value(s) read."); - - /* Close dataset */ - if(H5Dclose(dset2) < 0) FAIL_STACK_ERROR - if(H5Dclose(dset) < 0) FAIL_STACK_ERROR - - /* Open dataset (use a differend prefix than for create. - * This works because the dataset was closed. - */ - if(H5Pset_efile_prefix(dapl2, "${ORIGIN}/.") < 0) - FAIL_STACK_ERROR - if((dset = H5Dopen2(file, "dset1", dapl2)) < 0) - FAIL_STACK_ERROR - - /* Reopen dataset with same efile_prefix property */ - if((dset2 = H5Dopen2(file, "dset1", dapl2)) < 0) - FAIL_STACK_ERROR - - /* Reopen dataset with different efile_prefix property */ - if(H5Pset_efile_prefix(dapl, NULL) < 0) - FAIL_STACK_ERROR - H5E_BEGIN_TRY { - dset3 = H5Dopen2(file, "dset1", dapl); - } H5E_END_TRY; - if(dset3 >= 0) - FAIL_PUTS_ERROR("reopening the dataset with a different efile_prefix succeded"); - - /* Read the entire dataset and compare with the original */ - HDmemset(whole, 0, sizeof(whole)); - if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0) - FAIL_STACK_ERROR - for(i = 0; i < TOTAL_SIZE; i++) - if(whole[i] != (signed)i) - FAIL_PUTS_ERROR("Incorrect value(s) read."); - - if(H5Dclose(dset2) < 0) FAIL_STACK_ERROR - if(H5Dclose(dset) < 0) FAIL_STACK_ERROR - if(H5Pclose(dapl2) < 0) FAIL_STACK_ERROR - if(H5Pclose(dapl) < 0) FAIL_STACK_ERROR - if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR - if(H5Sclose(space) < 0) FAIL_STACK_ERROR - if(H5Fclose(file) < 0) FAIL_STACK_ERROR - PASSED(); - return 0; - -error: - H5E_BEGIN_TRY { - H5Pclose(dapl2); - H5Pclose(dapl); - H5Dclose(dset3); - H5Dclose(dset2); - H5Dclose(dset); - H5Pclose(dcpl); - H5Sclose(space); - H5Fclose(file); - } H5E_END_TRY; - return 1; -} /* end test_path_relative_cwd() */ - - -/*------------------------------------------------------------------------- - * Function: test_path_env - * - * Purpose: Test whether the value of HDF5_EXTFILE_PREFIX will overwrite - * the efile_prefix dataset access property. - * This will create an HDF5 file in a subdirectory which will - * refer to ../extern_*a.raw - * The files are then accessed by setting the HDF5_EXTFILE_PREFIX - * environment variable to "${ORIGIN}". - * The efile_prefix dataset access property is set to "someprefix", - * which will cause an error if the value is not overwritten by - * the environment variable. - * - * Return: Success: 0 - * Failure: 1 - * - * Programmer: Steffen Kiess - * March 10, 2015 - * - *------------------------------------------------------------------------- - */ -static int -test_path_env(hid_t fapl) -{ - hid_t file = -1; /* file to write to */ - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dapl = -1; /* dataset access property list */ - hid_t dset = -1; /* dataset */ - size_t i; /* miscellaneous counters */ - char cwdpath[1024]; /* working directory */ - char filename[1024]; /* file name */ - int part[PART_SIZE]; /* raw data buffer (partial) */ - int whole[TOTAL_SIZE]; /* raw data buffer (total) */ - hsize_t cur_size; /* current data space size */ - char buffer[1024]; /* buffer to read efile_prefix */ - - TESTING("prefix in HDF5_EXTFILE_PREFIX"); - - if(HDsetenv("HDF5_EXTFILE_PREFIX", "${ORIGIN}", 1)) - TEST_ERROR - - if(HDmkdir("extern_dir", (mode_t)0755) < 0 && errno != EEXIST) - TEST_ERROR; - - h5_fixname(FILENAME[4], fapl, filename, sizeof(filename)); - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - FAIL_STACK_ERROR - - /* Reset the raw data files */ - if(reset_raw_data_files() < 0) - TEST_ERROR - - /* Create the dataset */ - if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) - FAIL_STACK_ERROR - if(NULL == HDgetcwd(cwdpath, sizeof(cwdpath))) - TEST_ERROR - for(i = 0; i < N_EXT_FILES; i++) { - HDsnprintf(filename, sizeof(filename), "..%sextern_%dr.raw", H5_DIR_SEPS, (int) i + 1); - if(H5Pset_external(dcpl, filename, (HDoff_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0) - FAIL_STACK_ERROR - } /* end for */ - - cur_size = TOTAL_SIZE; - if((space = H5Screate_simple(1, &cur_size, NULL)) < 0) - FAIL_STACK_ERROR - if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) - FAIL_STACK_ERROR - - /* Set prefix to a nonexistent directory, will be overwritten by environment variable */ - if(H5Pset_efile_prefix(dapl, "someprefix") < 0) - FAIL_STACK_ERROR - if(H5Pget_efile_prefix(dapl, buffer, sizeof(buffer)) < 0) - FAIL_STACK_ERROR - if(HDstrcmp(buffer, "someprefix") != 0) - FAIL_PUTS_ERROR("efile prefix not set correctly"); - - /* Create dataset */ - if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, dapl)) < 0) - FAIL_STACK_ERROR - - /* Read the entire dataset and compare with the original */ - HDmemset(whole, 0, sizeof(whole)); - if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0) - FAIL_STACK_ERROR - for(i = 0; i < TOTAL_SIZE; i++) - if(whole[i] != (signed)i) - FAIL_PUTS_ERROR("Incorrect value(s) read."); - - if(H5Dclose(dset) < 0) FAIL_STACK_ERROR - if(H5Pclose(dapl) < 0) FAIL_STACK_ERROR - if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR - if(H5Sclose(space) < 0) FAIL_STACK_ERROR - if(H5Fclose(file) < 0) FAIL_STACK_ERROR - PASSED(); - return 0; - -error: - H5E_BEGIN_TRY { - H5Pclose(dapl); - H5Dclose(dset); - H5Pclose(dcpl); - H5Sclose(space); - H5Fclose(file); - } H5E_END_TRY; - return 1; -} /* end test_path_env() */ - /*------------------------------------------------------------------------- * Function: main @@ -1478,14 +926,10 @@ main(void) nerrors += test_add_to_unlimited(); nerrors += test_overflow(); - /* These file set tests use the VFD-aware fapl */ + /* These tests use the VFD-aware fapl */ nerrors += test_read_file_set(current_fapl_id); nerrors += test_write_file_set(current_fapl_id); - nerrors += test_path_absolute(current_fapl_id); - nerrors += test_path_relative(current_fapl_id); - nerrors += test_path_relative_cwd(current_fapl_id); - nerrors += test_path_env(current_fapl_id); - + /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, current_fapl_id) < 0 ? 1 : 0); @@ -1503,17 +947,14 @@ main(void) /* Clean up files used by file set tests */ if(h5_cleanup(FILENAME, fapl_id_old)) { - HDremove("extern_1r.raw"); - HDremove("extern_2r.raw"); - HDremove("extern_3r.raw"); - HDremove("extern_4r.raw"); - - HDremove("extern_1w.raw"); - HDremove("extern_2w.raw"); - HDremove("extern_3w.raw"); - HDremove("extern_4w.raw"); - - HDrmdir("extern_dir"); + HDremove("extern_1a.raw"); + HDremove("extern_1b.raw"); + HDremove("extern_2a.raw"); + HDremove("extern_2b.raw"); + HDremove("extern_3a.raw"); + HDremove("extern_3b.raw"); + HDremove("extern_4a.raw"); + HDremove("extern_4b.raw"); } /* end if */ return EXIT_SUCCESS; diff --git a/test/gheap.c b/test/gheap.c index c03d099..3f66d35 100644 --- a/test/gheap.c +++ b/test/gheap.c @@ -51,480 +51,412 @@ const char *FILENAME[] = { "gheap2", "gheap3", "gheap4", - "gheap5", + "gheapooo", NULL }; -/* Number of heap objects in tests */ -#define N_GHEAP_OBJS 1024 - -/* Size of heap object buffers */ -#define OBJ_BUF_SIZE N_GHEAP_OBJS - -/* Size of filename */ -#define FILENAME_SIZE 1024 - /*------------------------------------------------------------------------- - * Function: test_monotonic_increasing + * Function: test_1 + * + * Purpose: Writes a sequence of objects to the global heap where each + * object is larger than the one before. * - * Purpose: Writes a sequence of objects to the global heap where each - * object is larger than the one before. + * Return: Success: 0 * - * Return: Success: 0 - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * + * Modifications: + * *------------------------------------------------------------------------- */ static int -test_monotonic_increasing(hid_t fapl) +test_1 (hid_t fapl) { - char *filename = NULL; /* VFD-dependent filename */ - hid_t fid = -1; /* HDF5 file ID */ - H5F_t *f = NULL; /* file object pointer */ - H5HG_t *obj = NULL; /* global heap objects */ - uint8_t *in = NULL; /* global heap data sent */ - uint8_t *out = NULL; /* global heap data received */ - unsigned i; /* iterator */ - size_t size; /* heap object size */ - int nerrors = 0; /* # of errors encountered */ + hid_t file = -1; + H5F_t *f = NULL; + H5HG_t obj[1024]; + uint8_t out[1024]; + uint8_t in[1024]; + int i; + size_t size; + herr_t status; + int nerrors = 0; + char filename[1024]; TESTING("monotonically increasing lengths"); - /* allocate memory */ - if(NULL == (filename = (char *)HDcalloc(FILENAME_SIZE, sizeof(char)))) - goto error; - if(NULL == (obj = (H5HG_t *)HDcalloc(N_GHEAP_OBJS, sizeof(H5HG_t)))) - goto error; - if(NULL == (in = (uint8_t *)HDcalloc(OBJ_BUF_SIZE, sizeof(uint8_t)))) - goto error; - if(NULL == (out = (uint8_t *)HDcalloc(OBJ_BUF_SIZE, sizeof(uint8_t)))) - goto error; - /* Open a clean file */ - h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; - if(NULL == (f = (H5F_t *)H5I_object(fid))) { - H5_FAILED(); - HDputs(" Unable to create file"); - goto error; - } /* end if */ - - /* Write the objects, monotonically increasing in length. Since this is + h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + goto error; + if(NULL == (f = (H5F_t *)H5I_object(file))) { + H5_FAILED(); + puts(" Unable to create file"); + goto error; + } + + /* + * Write the objects, monotonically increasing in length. Since this is * a clean file, the addresses allocated for the collections should also * be monotonically increasing. */ - for(i = 0; i < N_GHEAP_OBJS; i++) { - size = i + 1; - HDmemset(out, 'A' + (int)i % 26, size); - H5Eclear2(H5E_DEFAULT); - if(H5HG_insert(f, H5AC_ind_read_dxpl_id, size, out, obj + i) < 0) { - H5_FAILED(); - HDputs(" Unable to insert object into global heap"); - nerrors++; - } else if(i && H5F_addr_gt(obj[i - 1].addr, obj[i].addr)) { - H5_FAILED(); - HDputs(" Collection addresses are not monotonically increasing"); - nerrors++; - } /* end if */ - } /* end for */ - - /* Now try to read each object back. */ - for(i = 0; i < N_GHEAP_OBJS; i++) { - size = i + 1; - HDmemset(out, 'A' + (int)i % 26, size); - H5Eclear2(H5E_DEFAULT); - if(NULL == H5HG_read(f, H5AC_ind_read_dxpl_id, obj + i, in, NULL)) { - H5_FAILED(); - HDputs(" Unable to read object"); - nerrors++; - } else if(HDmemcmp(in, out, size)) { - H5_FAILED(); - HDputs(" Value read doesn't match value written"); - nerrors++; - } /* end if */ - } /* end for */ - - if(H5Fclose(fid) < 0) goto error; + for(i = 0; i < 1024; i++) { + size = i + 1; + HDmemset(out, 'A' + i % 26, size); + H5Eclear2(H5E_DEFAULT); + status = H5HG_insert(f, H5AC_ind_read_dxpl_id, size, out, obj + i); + if(status < 0) { + H5_FAILED(); + puts(" Unable to insert object into global heap"); + nerrors++; + } else if(i && H5F_addr_gt(obj[i - 1].addr, obj[i].addr)) { + H5_FAILED(); + puts(" Collection addresses are not monotonically increasing"); + nerrors++; + } + } + + /* + * Now try to read each object back. + */ + for(i = 0; i < 1024; i++) { + size = i + 1; + HDmemset(out, 'A' + i % 26, size); + H5Eclear2(H5E_DEFAULT); + if(NULL == H5HG_read(f, H5AC_ind_read_dxpl_id, obj + i, in, NULL)) { + H5_FAILED(); + puts(" Unable to read object"); + nerrors++; + } else if(HDmemcmp(in, out, size)) { + H5_FAILED(); + puts(" Value read doesn't match value written"); + nerrors++; + } + } + + if(H5Fclose(file) < 0) goto error; if(nerrors) goto error; - HDfree(filename); - HDfree(obj); - HDfree(in); - HDfree(out); - PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Fclose(fid); + H5Fclose(file); } H5E_END_TRY; - if(filename) - HDfree(filename); - if(obj) - HDfree(obj); - if(in) - HDfree(in); - if(out) - HDfree(out); return MAX(1, nerrors); -} /* end test_monotonic_increasing() */ +} /*------------------------------------------------------------------------- - * Function: test_monotonic_decreasing + * Function: test_2 + * + * Purpose: Writes a sequence of objects to the global heap where each + * object is smaller than the one before. * - * Purpose: Writes a sequence of objects to the global heap where each - * object is smaller than the one before. + * Return: Success: 0 * - * Return: Success: 0 - * Failure: number of errors + * Failure: number of errors * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * + * Modifications: + * *------------------------------------------------------------------------- */ static int -test_monotonic_decreasing(hid_t fapl) +test_2 (hid_t fapl) { - char *filename = NULL; /* VFD-dependent filename */ - hid_t fid = -1; /* HDF5 file ID */ - H5F_t *f = NULL; /* file object pointer */ - H5HG_t *obj = NULL; /* global heap objects */ - uint8_t *in = NULL; /* global heap data sent */ - uint8_t *out = NULL; /* global heap data received */ - unsigned i; /* iterator */ - size_t size; /* heap object size */ - int nerrors = 0; /* # of errors encountered */ + hid_t file = -1; + H5F_t *f = NULL; + H5HG_t obj[1024]; + uint8_t out[1024]; + uint8_t in[1024]; + int i; + size_t size; + int nerrors = 0; + char filename[1024]; TESTING("monotonically decreasing lengths"); - /* allocate memory */ - if(NULL == (filename = (char *)HDcalloc(FILENAME_SIZE, sizeof(char)))) - goto error; - if(NULL == (obj = (H5HG_t *)HDcalloc(N_GHEAP_OBJS, sizeof(H5HG_t)))) - goto error; - if(NULL == (in = (uint8_t *)HDcalloc(OBJ_BUF_SIZE, sizeof(uint8_t)))) - goto error; - if(NULL == (out = (uint8_t *)HDcalloc(OBJ_BUF_SIZE, sizeof(uint8_t)))) - goto error; - /* Open a clean file */ - h5_fixname(FILENAME[1], fapl, filename, sizeof(filename)); - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; - if(NULL == (f = (H5F_t *)H5I_object(fid))) { - H5_FAILED(); - HDputs(" Unable to create file"); - goto error; - } /* end if */ - - /* Write the objects, monotonically decreasing in length. */ - for(i = 0; i < N_GHEAP_OBJS; i++) { - size = N_GHEAP_OBJS - i; - HDmemset(out, 'A' + (int)i % 26, size); - H5Eclear2(H5E_DEFAULT); - if(H5HG_insert(f, H5AC_ind_read_dxpl_id, size, out, obj+i) < 0) { - H5_FAILED(); - HDputs(" Unable to insert object into global heap"); - nerrors++; - } /* end if */ - } /* end for */ - - /* Now try to read each object back. */ - for(i = 0; i < N_GHEAP_OBJS; i++) { - size = N_GHEAP_OBJS - i; - HDmemset(out, 'A' + (int)i % 26, size); - H5Eclear2(H5E_DEFAULT); - if(NULL == H5HG_read(f, H5AC_ind_read_dxpl_id, obj+i, in, NULL)) { - H5_FAILED(); - HDputs(" Unable to read object"); - nerrors++; - } else if (HDmemcmp(in, out, size)) { - H5_FAILED(); - HDputs(" Value read doesn't match value written"); - nerrors++; - } /* end if */ - } /* end for */ - - if(H5Fclose(fid) < 0) goto error; - if(nerrors) goto error; - - HDfree(filename); - HDfree(obj); - HDfree(in); - HDfree(out); - + h5_fixname(FILENAME[1], fapl, filename, sizeof filename); + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + goto error; + if(NULL == (f = (H5F_t *)H5I_object(file))) { + H5_FAILED(); + puts(" Unable to create file"); + goto error; + } + + /* + * Write the objects, monotonically decreasing in length. + */ + for (i=0; i<1024; i++) { + size = 1024-i; + memset (out, 'A'+i%26, size); + H5Eclear2(H5E_DEFAULT); + if (H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj+i)<0) { + H5_FAILED(); + puts(" Unable to insert object into global heap"); + nerrors++; + } + } + + /* + * Now try to read each object back. + */ + for (i=0; i<1024; i++) { + size = 1024-i; + memset (out, 'A'+i%26, size); + H5Eclear2(H5E_DEFAULT); + if (NULL==H5HG_read (f, H5AC_ind_read_dxpl_id, obj+i, in, NULL)) { + H5_FAILED(); + puts(" Unable to read object"); + nerrors++; + } else if (memcmp (in, out, size)) { + H5_FAILED(); + puts(" Value read doesn't match value written"); + nerrors++; + } + } + + if (H5Fclose(file)<0) goto error; + if (nerrors) goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Fclose(fid); + H5Fclose(file); } H5E_END_TRY; - if(filename) - HDfree(filename); - if(obj) - HDfree(obj); - if(in) - HDfree(in); - if(out) - HDfree(out); return MAX(1, nerrors); -} /* end test_monotonic_decreasing() */ +} /*------------------------------------------------------------------------- - * Function: test_complete_removal + * Function: test_3 * - * Purpose: Creates a few global heap objects and then removes them all. - * The collection should also be removed. + * Purpose: Creates a few global heap objects and then removes them all. + * The collection should also be removed. * - * Return: Success: 0 - * Failure: number of errors + * Return: Success: 0 * - * Programmer: Robb Matzke + * Failure: number of errors + * + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * + * Modifications: + * *------------------------------------------------------------------------- */ static int -test_complete_removal(hid_t fapl) +test_3 (hid_t fapl) { - char *filename = NULL; /* VFD-dependent filename */ - hid_t fid = -1; /* HDF5 file ID */ - H5F_t *f = NULL; /* file object pointer */ - H5HG_t *obj = NULL; /* global heap objects */ - uint8_t *out = NULL; /* global heap data received */ - unsigned i; /* iterator */ - size_t size; /* heap object size */ - int nerrors = 0; /* # of errors encountered */ + hid_t file = -1; + H5F_t *f = NULL; + H5HG_t obj[1024]; + uint8_t out[1024]; + int i; + size_t size; + herr_t status; + int nerrors = 0; + char filename[1024]; TESTING("complete object removal"); - /* allocate memory */ - if(NULL == (filename = (char *)HDcalloc(FILENAME_SIZE, sizeof(char)))) - goto error; - if(NULL == (obj = (H5HG_t *)HDcalloc(N_GHEAP_OBJS, sizeof(H5HG_t)))) - goto error; - if(NULL == (out = (uint8_t *)HDcalloc(OBJ_BUF_SIZE, sizeof(uint8_t)))) - goto error; - /* Open a clean file */ - h5_fixname(FILENAME[2], fapl, filename, sizeof(filename)); - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; - if(NULL == (f = (H5F_t *)H5I_object(fid))) { - H5_FAILED(); - HDputs(" Unable to create file"); - goto error; - } /* end if */ + h5_fixname(FILENAME[2], fapl, filename, sizeof filename); + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + goto error; + if(NULL == (f = (H5F_t *)H5I_object(file))) { + H5_FAILED(); + puts(" Unable to create file"); + goto error; + } /* Create some stuff */ - for(i = 0; i < N_GHEAP_OBJS; i++) { - size = i % 30 + 100; - HDmemset(out, 'A' + (int)i % 26, size); - H5Eclear2(H5E_DEFAULT); - if(H5HG_insert(f, H5AC_ind_read_dxpl_id, size, out, obj+i) < 0) { - H5_FAILED(); - HDputs(" Unable to insert object into global heap"); - nerrors++; - } /* end if */ - } /* end for */ + for (i=0; i<1024; i++) { + size = i%30+100; + memset (out, 'A'+i%26, size); + H5Eclear2(H5E_DEFAULT); + status = H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj+i); + if (status<0) { + H5_FAILED(); + puts(" Unable to insert object into global heap"); + nerrors++; + } + } /* Remove everything */ - for(i = 0; i < N_GHEAP_OBJS; i++) { - if(H5HG_remove(f, H5AC_ind_read_dxpl_id, obj+i) < 0) { - H5_FAILED(); - HDputs(" Unable to remove object"); - nerrors++; - } /* end if */ - } /* end for */ - - if(H5Fclose(fid) < 0) goto error; - if(nerrors) goto error; - - HDfree(filename); - HDfree(obj); - HDfree(out); - + for (i=0; i<1024; i++) { + status = H5HG_remove (f, H5AC_ind_read_dxpl_id, obj+i); + if (status<0) { + H5_FAILED(); + puts(" Unable to remove object"); + nerrors++; + } + } + + if (H5Fclose(file)<0) goto error; + if (nerrors) goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Fclose(fid); + H5Fclose(file); } H5E_END_TRY; - if(filename) - HDfree(filename); - if(obj) - HDfree(obj); - if(out) - HDfree(out); return MAX(1, nerrors); -} /* end test_complete_removal() */ +} /*------------------------------------------------------------------------- - * Function: test_partial_removal + * Function: test_4 * - * Purpose: Tests the H5HG_remove() feature by writing lots of objects - * and occassionally removing some. When we're done they're all - * removed. + * Purpose: Tests the H5HG_remove() feature by writing lots of objects + * and occassionally removing some. When we're done they're all + * removed. * - * Return: Success: 0 - * Failure: number of errors + * Return: Success: 0 * - * Programmer: Robb Matzke + * Failure: number of errors + * + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * + * Modifications: + * *------------------------------------------------------------------------- */ static int -test_partial_removal(hid_t fapl) +test_4 (hid_t fapl) { - char *filename = NULL; /* VFD-dependent filename */ - hid_t fid = -1; /* HDF5 file ID */ - H5F_t *f = NULL; /* file object pointer */ - H5HG_t *obj = NULL; /* global heap objects */ - uint8_t *out = NULL; /* global heap data received */ - unsigned i; /* iterator */ - size_t size; /* heap object size */ - int nerrors = 0; /* # of errors encountered */ + hid_t file = -1; + H5F_t *f = NULL; + H5HG_t obj[1024]; + uint8_t out[1024]; + int i; + size_t size; + herr_t status; + int nerrors = 0; + char filename[1024]; TESTING("partial object removal"); - /* allocate memory */ - if(NULL == (filename = (char *)HDcalloc(FILENAME_SIZE, sizeof(char)))) - goto error; - if(NULL == (obj = (H5HG_t *)HDcalloc(N_GHEAP_OBJS, sizeof(H5HG_t)))) - goto error; - if(NULL == (out = (uint8_t *)HDcalloc(OBJ_BUF_SIZE, sizeof(uint8_t)))) - goto error; - /* Open a clean file */ - h5_fixname(FILENAME[3], fapl, filename, sizeof(filename)); - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - goto error; - if(NULL == (f = (H5F_t *)H5I_object(fid))) { - H5_FAILED(); - HDputs(" Unable to create file"); - goto error; - } /* end if */ - - for(i = 0; i < N_GHEAP_OBJS; i++) { - - /* Insert */ - size = i % 30 + 100; - HDmemset(out, 'A' + (int)i % 26, size); - H5Eclear2(H5E_DEFAULT); - if(H5HG_insert(f, H5AC_ind_read_dxpl_id, size, out, obj+i) < 0) { - H5_FAILED(); - HDputs(" Unable to insert object into global heap"); - nerrors++; - } /* end if */ - - /* Remove every third one beginning with the second, but after the - * next one has already been inserted. That is, insert A, B, C; - * remove B, insert D, E, F; remove E; etc. - */ - if(1 == i % 3) { - H5Eclear2(H5E_DEFAULT); - if(H5HG_remove(f, H5AC_ind_read_dxpl_id, obj+i-1) < 0) { - H5_FAILED(); - HDputs(" Unable to remove object"); - nerrors++; - } /* end if */ - HDmemset(obj+i-1, 0, sizeof(*obj)); - } /* end if */ - } /* end for */ - - if(H5Fclose(fid) < 0) goto error; - if(nerrors) goto error; - - HDfree(filename); - HDfree(obj); - HDfree(out); - + h5_fixname(FILENAME[3], fapl, filename, sizeof filename); + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + goto error; + if(NULL == (f = (H5F_t *)H5I_object(file))) { + H5_FAILED(); + puts(" Unable to create file"); + goto error; + } + + for (i=0; i<1024; i++) { + /* Insert */ + size = i%30+100; + memset (out, 'A'+i%26, size); + H5Eclear2(H5E_DEFAULT); + status = H5HG_insert (f, H5AC_ind_read_dxpl_id, size, out, obj+i); + if (status<0) { + H5_FAILED(); + puts(" Unable to insert object into global heap"); + nerrors++; + } + + /* + * Remove every third one beginning with the second, but after the + * next one has already been inserted. That is, insert A, B, C; + * remove B, insert D, E, F; remove E; etc. + */ + if (1==i%3) { + H5Eclear2(H5E_DEFAULT); + status = H5HG_remove (f, H5AC_ind_read_dxpl_id, obj+i-1); + if (status<0) { + H5_FAILED(); + puts(" Unable to remove object"); + nerrors++; + } + memset (obj+i-1, 0, sizeof *obj); + } + } + + if (H5Fclose(file)<0) goto error; + if (nerrors) goto error; PASSED(); return 0; error: H5E_BEGIN_TRY { - H5Fclose(fid); + H5Fclose(file); } H5E_END_TRY; - if(filename) - HDfree(filename); - if(obj) - HDfree(obj); - if(out) - HDfree(out); return MAX(1, nerrors); -} /* end test_partial_removal() */ +} /*------------------------------------------------------------------------- - * Function: test_ooo_indices + * Function: test_ooo_indices * - * Purpose: Tests that indices can be stored out of order. This can + * Purpose: Tests that indices can be stored out of order. This can * happen when the indices "wrap around" due to many * insertions and deletions (for example, from rewriting a * VL dataset). * - * Return: Success: 0 - * Failure: number of errors + * Return: Success: 0 * - * Programmer: Neil Fortner + * Failure: number of errors + * + * Programmer: Neil Fortner * Monday, October 26, 2009 * + * Modifications: + * *------------------------------------------------------------------------- */ static int test_ooo_indices(hid_t fapl) { - char *filename = NULL; /* VFD-dependent filename */ - hid_t fid = -1; /* HDF5 file ID */ - H5F_t *f = NULL; /* file object pointer */ - H5HG_t *obj = NULL; /* global heap objects */ - unsigned i, j; /* iterators */ - int nerrors = 0; /* # of errors encountered */ + hid_t file = -1; + H5F_t *f = NULL; + unsigned i, j; + H5HG_t *obj = NULL; + herr_t status; + int nerrors=0; + char filename[1024]; TESTING("out of order indices"); - /* allocate memory */ - if(NULL == (filename = (char *)HDcalloc(FILENAME_SIZE, sizeof(char)))) - goto error; if(NULL == (obj = (H5HG_t *)HDmalloc(2000 * sizeof(*obj)))) goto error; /* Open a clean file */ - h5_fixname(FILENAME[4], fapl, filename, sizeof(filename)); - if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + h5_fixname(FILENAME[4], fapl, filename, sizeof filename); + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; - if(NULL == (f = (H5F_t *)H5I_object(fid))) { + if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); - HDputs(" Unable to create file"); + puts(" Unable to create file"); goto error; } /* end if */ /* Alternately insert 1000 entries and remove the previous group of 1000 - * entries, until the indices wrap around. - */ - for(i = 0; i < 66; i++) { - + * entries, until the indices wrap around */ + for(i=0; i<66; i++) { /* Insert 1000 entries. The index into the obj array will alternate up * and down by 1000 so the previous set of insertions is preserved and - * can be deleted. - */ - for(j = 1000 * ((~i & 1)); j < 1000 * ((~i & 1) + 1); j++) { + * can be deleted. */ + for(j=1000*((~i&1)); j<1000*((~i&1)+1); j++) { H5Eclear2(H5E_DEFAULT); - if(H5HG_insert(f, H5AC_ind_read_dxpl_id, sizeof(j), &j, &obj[j]) < 0) + status = H5HG_insert(f, H5AC_ind_read_dxpl_id, sizeof(j), &j, &obj[j]); + if (status<0) GHEAP_REPEATED_ERR(" Unable to insert object into global heap") /* Check that the index is as expected */ @@ -533,10 +465,11 @@ test_ooo_indices(hid_t fapl) } /* end for */ /* Remove the previous 1000 entries */ - if(i > 0) - for(j = 1000 * (i & 1); j < 1000 * ((i & 1) + 1); j++) { + if(i>0) + for(j=1000*(i&1); j<1000*((i&1)+1); j++) { H5Eclear2(H5E_DEFAULT); - if(H5HG_remove(f, H5AC_ind_read_dxpl_id, &obj[j]) < 0) + status = H5HG_remove(f, H5AC_ind_read_dxpl_id, &obj[j]); + if (status<0) GHEAP_REPEATED_ERR(" Unable to remove object from global heap"); } /* end for */ } /* end for */ @@ -546,41 +479,37 @@ test_ooo_indices(hid_t fapl) HDassert(obj[535].idx == 1); /* Reopen the file */ - if(H5Fclose(fid) < 0) goto error; - if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + if (H5Fclose(file)<0) goto error; + if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) goto error; - if(NULL == (f = (H5F_t *)H5I_object(fid))) { + if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); - HDputs(" Unable to open file"); + puts(" Unable to open file"); goto error; } /* end if */ /* Read the objects to make sure the heap is still readable */ - for(i = 0; i < 1000; i++) { + for(i=0; i<1000; i++) { if(NULL == H5HG_read(f, H5AC_ind_read_dxpl_id, &obj[i], &j, NULL)) goto error; if(i != j) { H5_FAILED(); - HDputs(" Incorrect read value"); + puts(" Incorrect read value"); goto error; } /* end if */ } /* end for */ - if(H5Fclose(fid) < 0) goto error; - if(nerrors) goto error; - - HDfree(filename); + if (H5Fclose(file)<0) goto error; + if (nerrors) goto error; HDfree(obj); - + obj = NULL; PASSED(); return 0; -error: + error: H5E_BEGIN_TRY { - H5Fclose(fid); + H5Fclose(file); } H5E_END_TRY; - if(filename) - HDfree(filename); if(obj) HDfree(obj); return MAX(1, nerrors); @@ -588,43 +517,46 @@ error: /*------------------------------------------------------------------------- - * Function: main + * Function: main * - * Purpose: Tests global heap + * Purpose: Tests global heap. * - * Return: EXIT_SUCCESS/EXIT_FAILURE + * Return: Success: zero * - * Programmer: Robb Matzke + * Failure: non-zero + * + * Programmer: Robb Matzke * Tuesday, March 31, 1998 * + * Modifications: + * *------------------------------------------------------------------------- */ int -main(void) +main (void) { - int nerrors = 0; /* # of errors */ - hid_t fapl = -1; /* VFD-dependent fapl ID */ + int nerrors=0; + hid_t fapl; h5_reset(); fapl = h5_fileaccess(); - nerrors += test_monotonic_increasing(fapl); - nerrors += test_monotonic_decreasing(fapl); - nerrors += test_complete_removal(fapl); - nerrors += test_partial_removal(fapl); + nerrors += test_1(fapl); + nerrors += test_2(fapl); + nerrors += test_3(fapl); + nerrors += test_4(fapl); nerrors += test_ooo_indices(fapl); /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); - if(nerrors) goto error; + if (nerrors) goto error; - HDputs("All global heap tests passed."); + puts("All global heap tests passed."); h5_cleanup(FILENAME, fapl); - return EXIT_SUCCESS; - -error: - HDputs("*** TESTS FAILED ***"); - return EXIT_FAILURE; -} /* end main() */ + return 0; + error: + puts("*** TESTS FAILED ***"); + return 1; +} -- cgit v0.12 From fba3bbc7bf8e444155a7029f5ac82e1e513eadcc Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Thu, 11 Feb 2016 08:12:17 -0500 Subject: [svn-r29086] missed renaming the GET collective metadata read requirement. --- src/H5Pfapl.c | 6 +++--- src/H5Ppublic.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index d90dcd5..43f0574 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -3640,7 +3640,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5Pget_coll_metadata_read + * Function: H5Pget_all_coll_metadata_ops * * Purpose: Gets information about collective metadata read mode. * @@ -3658,7 +3658,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pget_coll_metadata_read(hid_t plist_id, hbool_t *is_collective) +H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective) { herr_t ret_value = SUCCEED; /* return value */ @@ -3694,7 +3694,7 @@ H5Pget_coll_metadata_read(hid_t plist_id, hbool_t *is_collective) done: FUNC_LEAVE_API(ret_value) -} /* H5Pget_coll_metadata_read */ +} /* H5Pget_all_coll_metadata_ops */ /*------------------------------------------------------------------------- diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 9ab1944..589bcdc 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -353,7 +353,7 @@ H5_DLL herr_t H5Pset_core_write_tracking(hid_t fapl_id, hbool_t is_enabled, size H5_DLL herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, size_t *page_size); #ifdef H5_HAVE_PARALLEL H5_DLL herr_t H5Pset_all_coll_metadata_ops(hid_t plist_id, hbool_t is_collective); -H5_DLL herr_t H5Pget_coll_metadata_read(hid_t plist_id, hbool_t *is_collective); +H5_DLL herr_t H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective); H5_DLL herr_t H5Pset_coll_metadata_write(hid_t plist_id, hbool_t is_collective); H5_DLL herr_t H5Pget_coll_metadata_write(hid_t plist_id, hbool_t *is_collective); #endif /* H5_HAVE_PARALLEL */ -- cgit v0.12 From d12a99498608fc23f61ec89ad56e61256428c3e6 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Thu, 11 Feb 2016 11:03:44 -0500 Subject: [svn-r29088] - Add a test for retrieving the property values for the new coll md functions. - ifdef some code that don't need to be built in parallel - more minor enhancements tested on bb-8 with parallel and serial --- src/H5Fint.c | 2 + src/H5Pfapl.c | 10 +++-- src/H5Plapl.c | 7 +++- testpar/t_file.c | 113 ++++++++++++++++++++++++++++++++++++++++++++++++++++ testpar/testphdf5.c | 3 ++ testpar/testphdf5.h | 1 + 6 files changed, 132 insertions(+), 4 deletions(-) diff --git a/src/H5Fint.c b/src/H5Fint.c index 2eb8ab0..1c29fee 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -175,6 +175,8 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) #ifdef H5_HAVE_PARALLEL if(H5P_set(new_plist, H5_COLL_MD_READ_FLAG_NAME, &(f->coll_md_read)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set collective metadata read flag") + if(H5P_set(new_plist, H5F_ACS_COLL_MD_WRITE_FLAG_NAME, &(f->coll_md_write)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't set collective metadata read flag") #endif /* H5_HAVE_PARALLEL */ /* Prepare the driver property */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 43f0574..0010c15 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -178,6 +178,7 @@ #define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEF 524288 #define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_ENC H5P__encode_size_t #define H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEC H5P__decode_size_t +#ifdef H5_HAVE_PARALLEL /* Definition of collective metadata read mode flag */ #define H5F_ACS_COLL_MD_READ_FLAG_SIZE sizeof(H5P_coll_md_read_flag_t) #define H5F_ACS_COLL_MD_READ_FLAG_DEF H5P_USER_FALSE @@ -188,7 +189,7 @@ #define H5F_ACS_COLL_MD_WRITE_FLAG_DEF FALSE #define H5F_ACS_COLL_MD_WRITE_FLAG_ENC H5P__encode_hbool_t #define H5F_ACS_COLL_MD_WRITE_FLAG_DEC H5P__decode_hbool_t - +#endif /* H5_HAVE_PARALLEL */ /******************/ /* Local Typedefs */ @@ -291,9 +292,10 @@ static const unsigned H5F_def_efc_size_g = H5F_ACS_EFC_SIZE_DEF; static const H5FD_file_image_info_t H5F_def_file_image_info_g = H5F_ACS_FILE_IMAGE_INFO_DEF; /* Default file image info and callbacks */ static const hbool_t H5F_def_core_write_tracking_flag_g = H5F_ACS_CORE_WRITE_TRACKING_FLAG_DEF; /* Default setting for core VFD write tracking */ static const size_t H5F_def_core_write_tracking_page_size_g = H5F_ACS_CORE_WRITE_TRACKING_PAGE_SIZE_DEF; /* Default core VFD write tracking page size */ +#ifdef H5_HAVE_PARALLEL static const H5P_coll_md_read_flag_t H5F_def_coll_md_read_flag_g = H5F_ACS_COLL_MD_READ_FLAG_DEF; /* Default setting for the collective metedata read flag */ static const hbool_t H5F_def_coll_md_write_flag_g = H5F_ACS_COLL_MD_WRITE_FLAG_DEF; /* Default setting for the collective metedata write flag */ - +#endif /* H5_HAVE_PARALLEL */ /*------------------------------------------------------------------------- @@ -450,6 +452,7 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") +#ifdef H5_HAVE_PARALLEL /* Register the metadata collective read flag */ if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5F_ACS_COLL_MD_READ_FLAG_SIZE, &H5F_def_coll_md_read_flag_g, NULL, NULL, NULL, H5F_ACS_COLL_MD_READ_FLAG_ENC, H5F_ACS_COLL_MD_READ_FLAG_DEC, @@ -461,6 +464,7 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, H5F_ACS_COLL_MD_WRITE_FLAG_ENC, H5F_ACS_COLL_MD_WRITE_FLAG_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") +#endif /* H5_HAVE_PARALLEL */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -3506,6 +3510,7 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_core_write_tracking() */ +#ifdef H5_HAVE_PARALLEL /*------------------------------------------------------------------------- * Function: H5P__encode_coll_md_read_flag_t @@ -3578,7 +3583,6 @@ H5P__decode_coll_md_read_flag_t(const void **_pp, void *_value) FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5P__decode_coll_md_read_flag_t() */ -#ifdef H5_HAVE_PARALLEL /*------------------------------------------------------------------------- * Function: H5Pset_all_coll_metadata_ops diff --git a/src/H5Plapl.c b/src/H5Plapl.c index 6cb2149..f725435 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -88,12 +88,13 @@ #define H5L_ACS_ELINK_CB_SIZE sizeof(H5L_elink_cb_t) #define H5L_ACS_ELINK_CB_DEF {NULL,NULL} +#ifdef H5_HAVE_PARALLEL /* Definition for reading metadata collectively */ #define H5L_ACS_COLL_MD_READ_SIZE sizeof(H5P_coll_md_read_flag_t) #define H5L_ACS_COLL_MD_READ_DEF H5P_USER_FALSE #define H5L_ACS_COLL_MD_READ_ENC H5P__encode_coll_md_read_flag_t #define H5L_ACS_COLL_MD_READ_DEC H5P__decode_coll_md_read_flag_t - +#endif /* H5_HAVE_PARALLEL */ /******************/ /* Local Typedefs */ @@ -170,7 +171,9 @@ static const char *H5L_def_elink_prefix_g = H5L_ACS_ELINK_PREFIX_DEF; /* Default static const hid_t H5L_def_fapl_id_g = H5L_ACS_ELINK_FAPL_DEF; /* Default fapl for external link access */ static const unsigned H5L_def_elink_flags_g = H5L_ACS_ELINK_FLAGS_DEF; /* Default file access flags for external link traversal */ static const H5L_elink_cb_t H5L_def_elink_cb_g = H5L_ACS_ELINK_CB_DEF; /* Default external link traversal callback */ +#ifdef H5_HAVE_PARALLEL static const H5P_coll_md_read_flag_t H5L_def_coll_md_read_g = H5L_ACS_COLL_MD_READ_DEF; /* Default setting for the collective metedata read flag */ +#endif /* H5_HAVE_PARALLEL */ /*------------------------------------------------------------------------- @@ -222,11 +225,13 @@ H5P__lacc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") +#ifdef H5_HAVE_PARALLEL /* Register the metadata collective read flag */ if(H5P_register_real(pclass, H5_COLL_MD_READ_FLAG_NAME, H5L_ACS_COLL_MD_READ_SIZE, &H5L_def_coll_md_read_g, NULL, NULL, NULL, H5L_ACS_COLL_MD_READ_ENC, H5L_ACS_COLL_MD_READ_DEC, NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") +#endif /* H5_HAVE_PARALLEL */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/testpar/t_file.c b/testpar/t_file.c index 70ca60e..45d1305 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -94,4 +94,117 @@ test_split_comm_access(void) VRFY((mrc==MPI_SUCCESS), "final MPI_Barrier succeeded"); } +void +test_file_properties(void) +{ + hid_t fid; /* HDF5 file ID */ + hid_t fapl_id; /* File access plist */ + hbool_t is_coll; + const char *filename; + MPI_Comm comm = MPI_COMM_WORLD; + MPI_Info info = MPI_INFO_NULL; + int mpi_size, mpi_rank; + herr_t ret; /* Generic return value */ + + filename = GetTestParameters(); + + /* set up MPI parameters */ + MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); + MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); + + /* setup file access plist */ + fapl_id = H5Pcreate (H5P_FILE_ACCESS); + VRFY((fapl_id >= 0), "H5P_FILE_ACCESS"); + + /* create the file with the SEC2 driver */ + fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); + VRFY((fid >= 0), "H5Fcreate succeeded"); + + /* verify settings for file access properties */ + + /* Collective metadata writes */ + ret = H5Pget_coll_metadata_write(fapl_id, &is_coll); + VRFY((ret >= 0), "H5Pget_coll_metadata_write succeeded"); + VRFY((is_coll == FALSE), "Incorrect property setting for coll metadata writes"); + + /* Collective metadata read API calling requirement */ + ret = H5Pget_all_coll_metadata_ops(fapl_id, &is_coll); + VRFY((ret >= 0), "H5Pget_all_coll_metadata_ops succeeded"); + VRFY((is_coll == FALSE), "Incorrect property setting for coll metadata API calls requirement"); + + ret = H5Fclose(fid); + VRFY((ret >= 0), "H5Fclose succeeded"); + + /* Open the file with the MPI-IO driver */ + ret = H5Pset_fapl_mpio(fapl_id, comm, info); + VRFY((ret >= 0), "H5Pset_fapl_mpio failed"); + fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); + VRFY((fid >= 0), "H5Fcreate succeeded"); + /* verify settings for file access properties */ + + /* Collective metadata writes */ + ret = H5Pget_coll_metadata_write(fapl_id, &is_coll); + VRFY((ret >= 0), "H5Pget_coll_metadata_write succeeded"); + VRFY((is_coll == FALSE), "Incorrect property setting for coll metadata writes"); + + /* Collective metadata read API calling requirement */ + ret = H5Pget_all_coll_metadata_ops(fapl_id, &is_coll); + VRFY((ret >= 0), "H5Pget_all_coll_metadata_ops succeeded"); + VRFY((is_coll == FALSE), "Incorrect property setting for coll metadata API calls requirement"); + + ret = H5Fclose(fid); + VRFY((ret >= 0), "H5Fclose succeeded"); + + /* Open the file with the MPI-IO driver w collective settings */ + ret = H5Pset_fapl_mpio(fapl_id, comm, info); + VRFY((ret >= 0), "H5Pset_fapl_mpio failed"); + /* Collective metadata writes */ + ret = H5Pset_coll_metadata_write(fapl_id, TRUE); + VRFY((ret >= 0), "H5Pget_coll_metadata_write succeeded"); + /* Collective metadata read API calling requirement */ + ret = H5Pset_all_coll_metadata_ops(fapl_id, TRUE); + VRFY((ret >= 0), "H5Pget_all_coll_metadata_ops succeeded"); + fid = H5Fopen(filename, H5F_ACC_RDWR, fapl_id); + VRFY((fid >= 0), "H5Fcreate succeeded"); + + /* verify settings for file access properties */ + + /* Collective metadata writes */ + ret = H5Pget_coll_metadata_write(fapl_id, &is_coll); + VRFY((ret >= 0), "H5Pget_coll_metadata_write succeeded"); + VRFY((is_coll == TRUE), "Incorrect property setting for coll metadata writes"); + + /* Collective metadata read API calling requirement */ + ret = H5Pget_all_coll_metadata_ops(fapl_id, &is_coll); + VRFY((ret >= 0), "H5Pget_all_coll_metadata_ops succeeded"); + VRFY((is_coll == TRUE), "Incorrect property setting for coll metadata API calls requirement"); + + /* close fapl and retrieve it from file */ + ret = H5Pclose(fapl_id); + VRFY((ret >= 0), "H5Pclose succeeded"); + fapl_id = -1; + + fapl_id = H5Fget_access_plist(fid); + VRFY((fapl_id >= 0), "H5P_FILE_ACCESS"); + + /* verify settings for file access properties */ + + /* Collective metadata writes */ + ret = H5Pget_coll_metadata_write(fapl_id, &is_coll); + VRFY((ret >= 0), "H5Pget_coll_metadata_write succeeded"); + VRFY((is_coll == TRUE), "Incorrect property setting for coll metadata writes"); + + /* Collective metadata read API calling requirement */ + ret = H5Pget_all_coll_metadata_ops(fapl_id, &is_coll); + VRFY((ret >= 0), "H5Pget_all_coll_metadata_ops succeeded"); + VRFY((is_coll == TRUE), "Incorrect property setting for coll metadata API calls requirement"); + + /* close file */ + ret = H5Fclose(fid); + VRFY((ret >= 0), "H5Fclose succeeded"); + + /* Release file-access plist */ + ret = H5Pclose(fapl_id); + VRFY((ret >= 0), "H5Pclose succeeded"); +} diff --git a/testpar/testphdf5.c b/testpar/testphdf5.c index abe074a..b7a68d9 100644 --- a/testpar/testphdf5.c +++ b/testpar/testphdf5.c @@ -351,6 +351,9 @@ int main(int argc, char **argv) AddTest("split", test_split_comm_access, NULL, "dataset using split communicators", PARATESTFILE); + AddTest("props", test_file_properties, NULL, + "Coll Metadata file property settings", PARATESTFILE); + AddTest("idsetw", dataset_writeInd, NULL, "dataset independent write", PARATESTFILE); AddTest("idsetr", dataset_readInd, NULL, diff --git a/testpar/testphdf5.h b/testpar/testphdf5.h index 3597b17..7d6ff22 100644 --- a/testpar/testphdf5.h +++ b/testpar/testphdf5.h @@ -238,6 +238,7 @@ extern int dxfer_coll_type; /* Test program prototypes */ void test_plist_ed(void); void zero_dim_dset(void); +void test_file_properties(void); void multiple_dset_write(void); void multiple_group_write(void); void multiple_group_read(void); -- cgit v0.12 From e7c12365431a3e5997835b401befd0dd6f589054 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 11 Feb 2016 14:37:14 -0500 Subject: [svn-r29090] Changed "smart quotes" to ASCII ' and " in r28960 code. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools parallel (MPICH 3.1.4) CMake serial (CMake 3.3.2) --- config/linux-gnulibc1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/linux-gnulibc1 b/config/linux-gnulibc1 index 46771dc..9128d78 100644 --- a/config/linux-gnulibc1 +++ b/config/linux-gnulibc1 @@ -183,7 +183,7 @@ case $FC in *mpif90*) fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS -v 2>&1 | grep 'version' |\ sed 's/^[a-z0-9]* for //' |\ - sed ’s/\”/\\\”/g’ |\ + sed 's/\"/\\\"/g' |\ sed 's/^\([a-z]* \)/ built with \1/1'` fc_version_info=`echo $fc_version_info` ;; -- cgit v0.12 From 39fa38559437cd30c69068ccab53fe67343a1b19 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Thu, 11 Feb 2016 16:50:22 -0500 Subject: [svn-r29092] Fixed uninitialized return value from fortran API. --- fortran/test/tH5P_F03.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fortran/test/tH5P_F03.F90 b/fortran/test/tH5P_F03.F90 index 3cafdcb..15bd86f 100644 --- a/fortran/test/tH5P_F03.F90 +++ b/fortran/test/tH5P_F03.F90 @@ -664,7 +664,7 @@ SUBROUTINE test_vds(total_error) INTEGER(hid_t) :: vfile, file, src_space, mem_space, vspace, vdset, dset !Handles INTEGER(hid_t) :: dcpl, dapl - INTEGER :: status, error + INTEGER :: error INTEGER(hsize_t), DIMENSION(1:3) :: vdsdims = (/4*DIM0_1, VDSDIM1, VDSDIM2/), & vdsdims_max, & dims = (/DIM0_1, DIM1, DIM2/), & @@ -731,7 +731,7 @@ SUBROUTINE test_vds(total_error) ! ! Create the source files and datasets. Write data to each dataset and ! close all resources. - CALL h5fcreate_f(SRC_FILE(i), H5F_ACC_TRUNC_F, file, status) + CALL h5fcreate_f(SRC_FILE(i), H5F_ACC_TRUNC_F, file, error) CALL check("h5fcreate_f", error, total_error) CALL h5screate_simple_f(RANK, dims, src_space, error, dims_max) -- cgit v0.12 From 20187288971b09cf754c75c4553b0ec5a0538118 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 12 Feb 2016 09:42:15 -0500 Subject: [svn-r29094] Removed the v-1 B-tree package from the list of packages that can be configured to generate extra debugging output in both the autotools and CMake. This can still be set by defining H5B_DEBUG manually or by using a custom string in configure. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial CMake serial --- configure.ac | 7 ++++++- src/CMakeLists.txt | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 2fc71c8..08efbc9 100644 --- a/configure.ac +++ b/configure.ac @@ -2104,8 +2104,13 @@ AC_SUBST([INTERNAL_DEBUG_OUTPUT]) ## These are all the packages that use H5*_DEBUG. ## There is no harm in specifying a package not in this list; ## you'll just get an unused H5_DEBUG symbol. +## +## Some packages that define debug checks or output are +## too specialized or have huge performance hits. These +## are not listed in the "all" packages list. +## ## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z" -all_packages="AC,B,B2,D,F,HL,I,O,S,ST,T,Z" +all_packages="AC,B2,D,F,HL,I,O,S,ST,T,Z" case "X-$INTERNAL_DEBUG_OUTPUT" in X-yes|X-all) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 60f043f..3647eb9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -860,7 +860,7 @@ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) if (HDF5_ENABLE_DEBUG_APIS) set_target_properties (${HDF5_LIB_TARGET} PROPERTIES COMPILE_DEFINITIONS - "H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5B_DEBUG;H5AC_DEBUG" + "H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG" ) endif (HDF5_ENABLE_DEBUG_APIS) set (install_targets ${HDF5_LIB_TARGET}) @@ -912,7 +912,7 @@ if (BUILD_SHARED_LIBS) if (HDF5_ENABLE_DEBUG_APIS) set_property (TARGET ${HDF5_LIBSH_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS - "H5Z_DEBUG;H5VM_DEBUG;H5T_DEBUG;H5S_DEBUG;H5P_DEBUG;H5O_DEBUG;H5MM_DEBUG;H5MF_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5HG_DEBUG;H5G_DEBUG;H5F_DEBUG;H5E_DEBUG;H5D_DEBUG;H5B_DEBUG;H5AC_DEBUG" + "H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5AC_DEBUG" ) endif (HDF5_ENABLE_DEBUG_APIS) set (install_targets ${install_targets} ${HDF5_LIBSH_TARGET}) -- cgit v0.12 From 8025f6b7123979d05688ccf22502b30b4008488b Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Fri, 12 Feb 2016 11:54:39 -0500 Subject: [svn-r29096] fix bug in internal dxpls generated exposed by production and parallel. --- src/H5AC.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/H5AC.c b/src/H5AC.c index 958cc61..6cd3b0e 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -207,6 +207,14 @@ H5AC__init_package(void) if((H5AC_ind_read_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") + /* Get an ID for the no I/O internal dxpl */ + if((H5AC_noio_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") + + /* Get an ID for the raw data (H5AC) dxpl */ + if((H5AC_rawdata_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") + /* if this is a debug build, set the dxpl type flag on the independent metadata dxpl and create the noio and raw data internal dxpls */ #ifdef H5_DEBUG_BUILD @@ -218,9 +226,6 @@ H5AC__init_package(void) if(H5P_set(xfer_plist, H5FD_DXPL_TYPE_NAME, &dxpl_type) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set dxpl type property") - /* Get an ID for the no I/O internal dxpl */ - if((H5AC_noio_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") /* Get the property list object */ if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_noio_dxpl_id))) HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") @@ -229,9 +234,6 @@ H5AC__init_package(void) if(H5P_set(xfer_plist, H5FD_DXPL_TYPE_NAME, &dxpl_type) < 0) HGOTO_ERROR(H5E_CACHE, H5E_CANTSET, FAIL, "can't set dxpl type property") - /* Get an ID for the metadata (H5AC) dxpl */ - if((H5AC_rawdata_dxpl_id = H5P_create_id(H5P_CLS_DATASET_XFER_g, FALSE)) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTCREATE, FAIL, "unable to register property list") /* Get the property list object */ if (NULL == (xfer_plist = (H5P_genplist_t *)H5I_object(H5AC_rawdata_dxpl_id))) HGOTO_ERROR(H5E_CACHE, H5E_BADATOM, FAIL, "can't get new property list object") -- cgit v0.12 From 944e932662366e98b4b313ffaba0b1d00984a24b Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 15 Feb 2016 14:22:03 -0500 Subject: [svn-r29119] Converted HDoff_t to off_t in test/external.c. Fixes Windows errors. Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 64-bit Windows 10 w/ VS2015 --- test/external.c | 230 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 114 insertions(+), 116 deletions(-) diff --git a/test/external.c b/test/external.c index a37dc94..181f43b 100644 --- a/test/external.c +++ b/test/external.c @@ -17,7 +17,7 @@ * Programmer: Robb Matzke * Tuesday, March 3, 1998 * - * Purpose: Tests datasets stored in external raw files. + * Purpose: Tests datasets stored in external raw files. */ #include "h5test.h" @@ -35,7 +35,7 @@ const char *FILENAME[] = { * Purpose: Determines whether two files contain the same data. * * Return: Success: nonzero if same, zero if different. - * Failure: zero + * Failure: zero * * Programmer: Robb Matzke * Wednesday, March 4, 1998 @@ -45,9 +45,9 @@ const char *FILENAME[] = { static hbool_t files_have_same_contents(const char *name1, const char *name2) { - int fd1 = 0, fd2 = 0; - ssize_t n1, n2; - char buf1[1024], buf2[1024]; + int fd1 = 0, fd2 = 0; + ssize_t n1, n2; + char buf1[1024], buf2[1024]; hbool_t ret = false; /* not equal until proven otherwise */ if((fd1 = HDopen(name1, O_RDONLY, 0666)) < 0) @@ -105,15 +105,15 @@ out: static int test_non_extendible(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* data space current size */ - hsize_t max_size[1]; /* data space maximum size */ - int n; /* number of external files */ - char name[256]; /* external file name */ - HDoff_t file_offset; /* external file offset */ - hsize_t file_size; /* sizeof external file segment */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* data space current size */ + hsize_t max_size[1]; /* data space maximum size */ + int n; /* number of external files */ + char name[256]; /* external file name */ + off_t file_offset; /* external file offset */ + hsize_t file_size; /* sizeof external file segment */ haddr_t dset_addr; /* address of dataset */ TESTING("fixed-size data space, exact storage"); @@ -122,7 +122,7 @@ test_non_extendible(hid_t file) if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR cur_size[0] = max_size[0] = 100; - if(H5Pset_external(dcpl, "ext1.data", (HDoff_t)0, (hsize_t)(max_size[0] * sizeof(int))) < 0) + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int))) < 0) FAIL_STACK_ERROR if((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR @@ -203,7 +203,7 @@ test_non_extendible(hid_t file) * Return: Success: 0 * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 23, 1998 * *------------------------------------------------------------------------- @@ -211,18 +211,18 @@ test_non_extendible(hid_t file) static int test_too_small(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* current data space size */ - hsize_t max_size[1]; /* maximum data space size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* current data space size */ + hsize_t max_size[1]; /* maximum data space size */ TESTING("external storage is too small"); if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR cur_size[0] = max_size[0] = 100; - if(H5Pset_external(dcpl, "ext1.data", (HDoff_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) FAIL_STACK_ERROR if((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR @@ -257,10 +257,10 @@ test_too_small(hid_t file) * represent the current data and large enough to represent the * eventual size of the data. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 23, 1998 * *------------------------------------------------------------------------- @@ -268,11 +268,11 @@ test_too_small(hid_t file) static int test_large_enough_current_eventual(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* current data space size */ - hsize_t max_size[1]; /* maximum data space size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* current data space size */ + hsize_t max_size[1]; /* maximum data space size */ TESTING("extendible dataspace, exact external size"); @@ -280,7 +280,7 @@ test_large_enough_current_eventual(hid_t file) FAIL_STACK_ERROR cur_size[0] = 100; max_size[0] = 200; - if(H5Pset_external(dcpl, "ext1.data", (HDoff_t)0, (hsize_t)(max_size[0] * sizeof(int))) < 0) + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int))) < 0) FAIL_STACK_ERROR if((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR @@ -321,11 +321,11 @@ error: static int test_large_enough_current_not_eventual(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* current data space size */ - hsize_t max_size[1]; /* maximum data space size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* current data space size */ + hsize_t max_size[1]; /* maximum data space size */ TESTING("extendible dataspace, external storage is too small"); @@ -333,7 +333,7 @@ test_large_enough_current_not_eventual(hid_t file) FAIL_STACK_ERROR cur_size[0] = 100; max_size[0] = 200; - if(H5Pset_external(dcpl, "ext1.data", (HDoff_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int) - 1)) < 0) FAIL_STACK_ERROR if((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR @@ -377,22 +377,22 @@ test_large_enough_current_not_eventual(hid_t file) static int test_unlimited(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* data space current size */ - hsize_t max_size[1]; /* data space maximum size */ - int n; /* number of external files */ - char name[256]; /* external file name */ - HDoff_t file_offset; /* external file offset */ - hsize_t file_size; /* sizeof external file segment */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* data space current size */ + hsize_t max_size[1]; /* data space maximum size */ + int n; /* number of external files */ + char name[256]; /* external file name */ + off_t file_offset; /* external file offset */ + hsize_t file_size; /* sizeof external file segment */ TESTING("unlimited dataspace, unlimited external storage"); /* Create dataset */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - if(H5Pset_external(dcpl, "ext1.data", (HDoff_t)0, H5F_UNLIMITED) < 0) + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0) FAIL_STACK_ERROR cur_size[0] = 100; max_size[0] = H5S_UNLIMITED; @@ -468,11 +468,11 @@ test_unlimited(hid_t file) static int test_multiple_files(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* dataspace */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* data space current size */ - hsize_t max_size[1]; /* data space maximum size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* dataspace */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* data space current size */ + hsize_t max_size[1]; /* data space maximum size */ TESTING("multiple external files"); @@ -481,13 +481,13 @@ test_multiple_files(hid_t file) cur_size[0] = max_size[0] = 100; - if(H5Pset_external(dcpl, "ext1.data", (HDoff_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) FAIL_STACK_ERROR - if(H5Pset_external(dcpl, "ext2.data", (HDoff_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) + if(H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) FAIL_STACK_ERROR - if(H5Pset_external(dcpl, "ext3.data", (HDoff_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) + if(H5Pset_external(dcpl, "ext3.data", (off_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) FAIL_STACK_ERROR - if(H5Pset_external(dcpl, "ext4.data", (HDoff_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) + if(H5Pset_external(dcpl, "ext4.data", (off_t)0, (hsize_t)(max_size[0]*sizeof(int)/4)) < 0) FAIL_STACK_ERROR if((space = H5Screate_simple(1, cur_size, max_size)) < 0) FAIL_STACK_ERROR @@ -528,19 +528,19 @@ error: static int test_add_to_unlimited(void) { - hid_t dcpl = -1; /* dataset creation properties */ - herr_t status; /* function return status */ - int n; /* number of external files */ + hid_t dcpl = -1; /* dataset creation properties */ + herr_t status; /* function return status */ + int n; /* number of external files */ TESTING("external file following unlimited file"); if((dcpl = H5Pcreate (H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - if(H5Pset_external(dcpl, "ext1.data", (HDoff_t)0, H5F_UNLIMITED) < 0) + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { - status = H5Pset_external(dcpl, "ext2.data", (HDoff_t)0, (hsize_t)100); + status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100); } H5E_END_TRY; if(status >= 0) FAIL_PUTS_ERROR(" H5Pset_external() succeeded when it should have failed."); @@ -579,18 +579,18 @@ test_add_to_unlimited(void) static int test_overflow(void) { - hid_t dcpl = -1; /* dataset creation properties */ - herr_t status; /* return status */ + hid_t dcpl = -1; /* dataset creation properties */ + herr_t status; /* return status */ TESTING("address overflow in external files"); if((dcpl=H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - if(H5Pset_external(dcpl, "ext1.data", (HDoff_t)0, H5F_UNLIMITED-1) < 0) + if(H5Pset_external(dcpl, "ext1.data", (off_t)0, H5F_UNLIMITED-1) < 0) FAIL_STACK_ERROR H5E_BEGIN_TRY { - status = H5Pset_external(dcpl, "ext2.data", (HDoff_t)0, (hsize_t)100); + status = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)100); } H5E_END_TRY; if(status >= 0) FAIL_PUTS_ERROR(" H5Pset_external() succeeded when it should have failed."); @@ -624,21 +624,21 @@ test_overflow(void) static int test_read_file_set(hid_t fapl) { - hid_t file = -1; /* file to write to */ - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hid_t grp = -1; /* group to emit diagnostics */ - int fd = -1; /* external file descriptors */ - size_t i, j; /* miscellaneous counters */ - hssize_t n; /* bytes of I/O */ - char filename[1024]; /* file names */ - int part[25], whole[100]; /* raw data buffers */ - hsize_t cur_size; /* current data space size */ - hid_t hs_space; /* hyperslab data space */ - hsize_t hs_start = 30; /* hyperslab starting offset */ - hsize_t hs_count = 25; /* hyperslab size */ - int temparray[10] = {0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f}; + hid_t file = -1; /* file to write to */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hid_t grp = -1; /* group to emit diagnostics */ + int fd = -1; /* external file descriptors */ + size_t i, j; /* miscellaneous counters */ + hssize_t n; /* bytes of I/O */ + char filename[1024]; /* file names */ + int part[25], whole[100]; /* raw data buffers */ + hsize_t cur_size; /* current data space size */ + hid_t hs_space; /* hyperslab data space */ + hsize_t hs_start = 30; /* hyperslab starting offset */ + hsize_t hs_count = 25; /* hyperslab size */ + int temparray[10] = {0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f}; TESTING("read external dataset"); @@ -674,10 +674,10 @@ test_read_file_set(hid_t fapl) /* Create the dataset */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - if(H5Pset_external(dcpl, "extern_1a.raw", (HDoff_t)0, (hsize_t)sizeof part) < 0 || - H5Pset_external(dcpl, "extern_2a.raw", (HDoff_t)10, (hsize_t)sizeof part) < 0 || - H5Pset_external(dcpl, "extern_3a.raw", (HDoff_t)20, (hsize_t)sizeof part) < 0 || - H5Pset_external(dcpl, "extern_4a.raw", (HDoff_t)30, (hsize_t)sizeof part) < 0) + if(H5Pset_external(dcpl, "extern_1a.raw", (off_t)0, (hsize_t)sizeof part) < 0 || + H5Pset_external(dcpl, "extern_2a.raw", (off_t)10, (hsize_t)sizeof part) < 0 || + H5Pset_external(dcpl, "extern_3a.raw", (off_t)20, (hsize_t)sizeof part) < 0 || + H5Pset_external(dcpl, "extern_4a.raw", (off_t)30, (hsize_t)sizeof part) < 0) FAIL_STACK_ERROR cur_size = 100; if((space = H5Screate_simple(1, &cur_size, NULL)) < 0) @@ -709,7 +709,7 @@ test_read_file_set(hid_t fapl) for(i = hs_start; i Date: Tue, 16 Feb 2016 17:42:40 -0500 Subject: [svn-r29127] Moved the --enable-build-mode check in configure.ac to after the platform-specific build information so the debug and production flags are not clobbered. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial (production & debug) --- configure.ac | 108 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/configure.ac b/configure.ac index 08efbc9..17e9ff9 100644 --- a/configure.ac +++ b/configure.ac @@ -158,60 +158,6 @@ AC_SUBST([UNAME_INFO]) UNAME_INFO=`uname -a` ## ---------------------------------------------------------------------- -## Determine build mode (debug, production, clean). -## This has to be done early since the build mode is referred to -## frequently. -## -AC_MSG_CHECKING([build mode]) -AC_ARG_ENABLE([build-mode], - [AS_HELP_STRING([--enable-build-mode=(debug|production|clean)], - [Sets the build mode. Debug turns on symbols, API - tracing, asserts, and debug optimization, - as well as several other minor configure options - that aid in debugging. - Production turns high optimizations on. - Clean turns nothing on and disables optimization - (i.e.: a 'clean slate' configuration). - All these settings can be overridden by using - specific configure flags. - [default=debug] - ])], - [BUILD_MODE=$enableval]) - -## Set the default -## Depends on branch, set via script at branch creation time -if test "X-$BUILD_MODE" = X- ; then - BUILD_MODE=debug -fi - -## Allow this variable to be substituted in -## other files (src/libhdf5.settings.in, etc.) -AC_SUBST([BUILD_MODE]) - -case "X-$BUILD_MODE" in - X-clean) - AC_MSG_RESULT([clean]) - ;; - X-debug) - AC_DEFINE([DEBUG_BUILD], [1], [Define if this is a debug build.]) - H5_CFLAGS="$H5_CFLAGS $DEBUG_CFLAGS" - H5_CPPFLAGS="$H5_CPPFLAGS $DEBUG_CPPFLAGS" - H5_CXXFLAGS="$H5_CXXFLAGS $DEBUG_CXXFLAGS" - H5_FCFLAGS="$H5_FCFLAGS $DEBUG_FCFLAGS" - AC_MSG_RESULT([debug]) - ;; - X-production) - H5_CFLAGS="$H5_CFLAGS $PROD_CFLAGS" - H5_CPPFLAGS="$H5_CPPFLAGS $PROD_CPPFLAGS" - H5_CXXFLAGS="$H5_CXXFLAGS $PROD_CXXFLAGS" - H5_FCFLAGS="$H5_FCFLAGS $PROD_FCFLAGS" - AC_MSG_RESULT([production]) - ;; - *) - AC_MSG_ERROR([Unrecognized build mode: $BUILD_MODE. Use debug, production, or clean.]) -esac - -## ---------------------------------------------------------------------- ## Some platforms have broken basename, and/or xargs programs. Check ## that it actually does what it's supposed to do. Catch this early ## since configure and scripts relies upon them heavily and there's @@ -321,6 +267,60 @@ while test -n "$hname"; do done ## ---------------------------------------------------------------------- +## Determine build mode (debug, production, clean). +## This has to be done early since the build mode is referred to +## frequently. +## +AC_MSG_CHECKING([build mode]) +AC_ARG_ENABLE([build-mode], + [AS_HELP_STRING([--enable-build-mode=(debug|production|clean)], + [Sets the build mode. Debug turns on symbols, API + tracing, asserts, and debug optimization, + as well as several other minor configure options + that aid in debugging. + Production turns high optimizations on. + Clean turns nothing on and disables optimization + (i.e.: a 'clean slate' configuration). + All these settings can be overridden by using + specific configure flags. + [default=debug] + ])], + [BUILD_MODE=$enableval]) + +## Set the default +## Depends on branch, set via script at branch creation time +if test "X-$BUILD_MODE" = X- ; then + BUILD_MODE=debug +fi + +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([BUILD_MODE]) + +case "X-$BUILD_MODE" in + X-clean) + AC_MSG_RESULT([clean]) + ;; + X-debug) + AC_DEFINE([DEBUG_BUILD], [1], [Define if this is a debug build.]) + H5_CFLAGS="$H5_CFLAGS $DEBUG_CFLAGS" + H5_CPPFLAGS="$H5_CPPFLAGS $DEBUG_CPPFLAGS" + H5_CXXFLAGS="$H5_CXXFLAGS $DEBUG_CXXFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $DEBUG_FCFLAGS" + AC_MSG_RESULT([debug]) + ;; + X-production) + H5_CFLAGS="$H5_CFLAGS $PROD_CFLAGS" + H5_CPPFLAGS="$H5_CPPFLAGS $PROD_CPPFLAGS" + H5_CXXFLAGS="$H5_CXXFLAGS $PROD_CXXFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $PROD_FCFLAGS" + AC_MSG_RESULT([production]) + ;; + *) + AC_MSG_ERROR([Unrecognized build mode: $BUILD_MODE. Use debug, production, or clean.]) +esac + +## ---------------------------------------------------------------------- ## Some built-in configure checks can only see CFLAGS (not AM_CFLAGS), so ## we need to add this in so configure works as intended. We will need to ## reset this value at the end of configure, to preserve the user's settings. -- cgit v0.12 From ad0925c214c9d3afe9a013aa1e3adfb2bc3ba4dc Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 16 Feb 2016 20:09:04 -0500 Subject: [svn-r29129] Added NO_SYMBOLS_CFLAGS, etc. to allow stripping symbols when --disable-symbols is specified and to ensure that production mode (where symbol stripping is usually a part of the FLAGS) doesn't conflict with --enable-symbols. This will allow better (though still limited) debugging of production/optimized code. The PGI, XLC, Intel, and Solaris files were not modified and do not generate the symbol removal flag at this time. They'll be updated in future check-ins. In the meantime, production mode on those platforms still usually strips symbols. This check-in also updates the Cygwin-specific files to use the new autotools FLAGS and option scheme when uncommon (non-gnu, etc.) Fortran compilers are used. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial (prod/debug w/ and w/o symbols) symbol presence/absence checked with objdump --- config/cce-fflags | 6 +++--- config/cce-flags | 10 ++++------ config/gnu-fflags | 3 ++- config/gnu-flags | 4 +--- config/i686-pc-cygwin | 22 +++++++++++++++++++--- config/ibm-flags | 6 ++---- config/linux-gnulibc1 | 22 +++++++++++++++++++--- config/x86_64-pc-cygwin | 23 ++++++++++++++++++++--- configure.ac | 3 +++ 9 files changed, 73 insertions(+), 26 deletions(-) diff --git a/config/cce-fflags b/config/cce-fflags index b96551d..233f9ff 100644 --- a/config/cce-fflags +++ b/config/cce-fflags @@ -52,15 +52,15 @@ if test "X-cce" = "X-$f9x_vendor"; then H5_FCFLAGS="${H5_FCFLAGS} -hnocaf" # Production - # -Wl,-s to remove all symbols for smaller file - # Note that this will likely override the symbols flag - PROD_FCFLAGS="-Wl,-s" + PROD_FCFLAGS= # Debug DEBUG_FCFLAGS= # Symbols + # -Wl,-s to remove all symbols for smaller file SYMBOLS_FCFLAGS="-g" + NO_SYMBOLS_FCFLAGS="-Wl,-s" # Profiling # Use this for profiling with gprof diff --git a/config/cce-flags b/config/cce-flags index e479363..8f3b2dc 100644 --- a/config/cce-flags +++ b/config/cce-flags @@ -54,23 +54,20 @@ if test "X-cce" = "X-$cc_vendor"; then H5_CFLAGS="${H5_CFLAGS:--hc99 $arch}" # Production - # -Wl,-s to remove all symbols for smaller file - PROD_CFLAGS="-Wl,-s" - PROD_CPPFLAGS= + PROD_CFLAGS= # Debug # NDEBUG is handled explicitly in configure DEBUG_CFLAGS= - DEBUG_CPPFLAGS= # Symbols + # -Wl,-s to remove all symbols for smaller file SYMBOLS_CFLAGS="-g" - SYMBOLS_CPPFLAGS= + NO_SYMBOLS_CFLAGS="-Wl,-s" # Profiling # Use this for profiling with gprof PROFILE_CFLAGS="-p" - PROFILE_CPPFLAGS= # Optimization HIGH_OPT_CFLAGS="-O3" @@ -87,3 +84,4 @@ if test "X-$cc_flags_set" = "X-"; then cc_vendor= cc_version= fi + diff --git a/config/gnu-fflags b/config/gnu-fflags index 3a90c10..62498a9 100644 --- a/config/gnu-fflags +++ b/config/gnu-fflags @@ -83,13 +83,14 @@ if test "X-gfortran" = "X-$f9x_vendor"; then H5_FCFLAGS="$H5_FCFLAGS -Wno-c-binding-type" # Production - PROD_FCFLAGS="-s" + PROD_FCFLAGS= # Debug DEBUG_FCFLAGS="-fbounds-check" # Symbols SYMBOLS_FCFLAGS="-g" + NO_SYMBOLS_FCFLAGS="-s" # Profiling PROFILE_FCFLAGS="-pg" diff --git a/config/gnu-flags b/config/gnu-flags index ecb5859..9cd0fd0 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -124,15 +124,13 @@ case "$cc_vendor-$cc_version" in ;; esac #DEBUG_CFLAGS="-fsanitize=undefined" - DEBUG_CPPFLAGS= # Symbols + NO_SYMBOLS_CFLAGS="-s" SYMBOLS_CFLAGS="-g" - SYMBOLS_CPPFLAGS= # Profile PROFILE_CFLAGS="-pg" - PROFILE_CPPFLAGS= # Optimization (only CFLAGS at this time) case "$cc_vendor-$cc_version" in diff --git a/config/i686-pc-cygwin b/config/i686-pc-cygwin index 9b1ab74..7355e4a 100644 --- a/config/i686-pc-cygwin +++ b/config/i686-pc-cygwin @@ -104,9 +104,25 @@ case $FC_BASENAME in # (just in case since this should be a default EIP) H5_FCFLAGS="$H5_FCFLAGS -YEXT_NAMES=UCS" FSEARCH_DIRS="" - DEBUG_FCFLAGS="-g" - PROD_FCFLAGS="-O" - PROFILE_FCFLAGS="-g -pg" + + # Production + PROD_FCFLAGS= + + # Debug + DEBUG_FCFLAGS= + + # Symbols + SYMBOLS_FCFLAGS="-g" + NO_SYMBOLS_FCFLAGS="-s" + + # Profiling + PROFILE_FCFLAGS="-pg" + + # Optimization + HIGH_OPT_FCFLAGS="-O" + DEBUG_OPT_FCFLAGS= + NO_OPT_FCFLAGS= + f9x_flags_set=yes ;; diff --git a/config/ibm-flags b/config/ibm-flags index 60a7af9..412817c 100644 --- a/config/ibm-flags +++ b/config/ibm-flags @@ -66,20 +66,17 @@ if test "XL" = "$cc_vendor"; then # Produciton PROD_CFLAGS= - PROD_CPPFLAGS= # Debug # NDEBUG is handled explicitly in configure DEBUG_CFLAGS="-qfullpath" - DEBUG_CPPFLAGS= # Symbols SYMBOLS_CFLAGS="-g" - SYMBOLS_CPPFLAGS= + NO_SYMBOLS_CFLAGS= # Profiling PROFILE_CFLAGS="-pg" - PROFILE_CPPFLAGS= # Optimization # -O causes test/dtypes to fail badly. Turn it off for now. @@ -125,3 +122,4 @@ if test X != X$CXX; then fi fi + diff --git a/config/linux-gnulibc1 b/config/linux-gnulibc1 index 9128d78..5bea816 100644 --- a/config/linux-gnulibc1 +++ b/config/linux-gnulibc1 @@ -117,9 +117,25 @@ case $FC_BASENAME in # (just in case since this should be a default EIP) H5_FCFLAGS="$H5_FCFLAGS" FSEARCH_DIRS="" - DEBUG_FCFLAGS="-g" - PROD_FCFLAGS="-O" - PROFILE_FCFLAGS="-g -pg" + + # Production + PROD_FCFLAGS= + + # Debug + DEBUG_FCFLAGS= + + # Symbols + SYMBOLS_FCFLAGS="-g" + NO_SYMBOLS_FCFLAGS="-s" + + # Profiling + PROFILE_FCFLAGS="-pg" + + # Optimization + HIGH_OPT_FCFLAGS="-O" + DEBUG_OPT_FCFLAGS= + NO_OPT_FCFLAGS= + f9x_flags_set=yes ;; diff --git a/config/x86_64-pc-cygwin b/config/x86_64-pc-cygwin index 9b1ab74..210aa2b 100644 --- a/config/x86_64-pc-cygwin +++ b/config/x86_64-pc-cygwin @@ -104,9 +104,25 @@ case $FC_BASENAME in # (just in case since this should be a default EIP) H5_FCFLAGS="$H5_FCFLAGS -YEXT_NAMES=UCS" FSEARCH_DIRS="" - DEBUG_FCFLAGS="-g" - PROD_FCFLAGS="-O" - PROFILE_FCFLAGS="-g -pg" + + # Production + PROD_FCFLAGS= + + # Debug + DEBUG_FCFLAGS= + + # Symbols + SYMBOLS_FCFLAGS="-g" + NO_SYMBOLS_FCFLAGS="-s" + + # Profiling + PROFILE_FCFLAGS="-pg" + + # Optimization + HIGH_OPT_FCFLAGS="-O" + DEBUG_OPT_FCFLAGS= + NO_OPT_FCFLAGS= + f9x_flags_set=yes ;; @@ -119,3 +135,4 @@ if test -z "$CXX"; then CXX=g++ CXX_BASENAME=g++ fi + diff --git a/configure.ac b/configure.ac index 17e9ff9..ed6c3b5 100644 --- a/configure.ac +++ b/configure.ac @@ -1913,6 +1913,9 @@ case "X-$SYMBOLS" in AC_MSG_RESULT([yes]) ;; X-no) + H5_CFLAGS="$H5_CFLAGS $NO_SYMBOLS_CFLAGS" + H5_CXXFLAGS="$H5_CXXFLAGS $NO_SYMBOLS_CXXFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $NO_SYMBOLS_FCFLAGS" AC_MSG_RESULT([no]) ;; *) -- cgit v0.12 From 77f2f1c132a852eb8e0893f051b128cf8f42a9ef Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 16 Feb 2016 21:16:27 -0500 Subject: [svn-r29131] Updated the GNU g++ compiler config file to use the new debug/ production, etc. system. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial - prod/debug w/ C++ --- config/gnu-cxxflags | 36 ++++++++++++++++++++++++++++++------ config/gnu-flags | 2 +- configure.ac | 4 ++++ 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/config/gnu-cxxflags b/config/gnu-cxxflags index ee690db..8d1ca67 100644 --- a/config/gnu-cxxflags +++ b/config/gnu-cxxflags @@ -100,30 +100,54 @@ case "$cxx_vendor-$cxx_version" in H5_CXXFLAGS="$H5_CXXFLAGS -Wsign-promo -Woverloaded-virtual -Wold-style-cast -Weffc++ -Wreorder -Wnon-virtual-dtor -Wctor-dtor-privacy -Wabi" # Production + # NDEBUG is handled explicitly by the configure script case "$cxx_vendor-$cxx_version" in g++-[34].*) - PROD_CXXFLAGS="-O3" + PROD_CXXFLAGS= ;; g++-5.*) - PROD_CXXFLAGS="-O3 -fstdarg-opt" + PROD_CXXFLAGS="-fstdarg-opt" ;; *) - PROD_CXXFLAGS="-O -finline-functions" + PROD_CXXFLAGS="-finline-functions" ;; esac # Debug + # NDEBUG is handled explicitly by the configure script + # -g is hanled by the symbols flags case "$cxx_vendor-$cxx_version" in g++-5.*) - DEBUG_CXXFLAGS="-Og -g -ftrapv -fno-common" + DEBUG_CXXFLAGS="-ftrapv -fno-common" ;; *) - DEBUG_CXXFLAGS="-g" + DEBUG_CXXFLAGS= ;; esac + # Symbols + NO_SYMBOLS_CXXFLAGS="-s" + SYMBOLS_CXXFLAGS="-g" + # Profile - PROFILE_CXXFLAGS="-Og -g -pg" + PROFILE_CXXFLAGS="-pg" + + # Optimization + case "$cxx_vendor-$cxx_version" in + g++-[34].*) + HIGH_OPT_CXXFLAGS="-O3" + DEBUG_OPT_CXXFLAGS= + ;; + g++-5.*) + HIGH_OPT_CXXFLAGS="-O3" + DEBUG_OPT_CXXFLAGS="-Og" + ;; + *) + HIGH_OPT_CXXFLAGS="-O" + DEBUG_OPT_CXXFLAGS= + ;; + esac + NO_OPT_CXXFLAGS="-O0" # Flags are set cxx_flags_set=yes diff --git a/config/gnu-flags b/config/gnu-flags index 9cd0fd0..87aef3a 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -132,7 +132,7 @@ case "$cc_vendor-$cc_version" in # Profile PROFILE_CFLAGS="-pg" - # Optimization (only CFLAGS at this time) + # Optimization case "$cc_vendor-$cc_version" in gcc-[34].*) HIGH_OPT_CFLAGS="-O3" diff --git a/configure.ac b/configure.ac index ed6c3b5..8f84a72 100644 --- a/configure.ac +++ b/configure.ac @@ -2056,21 +2056,25 @@ AC_SUBST([OPTIMIZATION]) case "X-$OPTIMIZATION" in X-high) H5_CFLAGS="$H5_CFLAGS $HIGH_OPT_CFLAGS" + H5_CXXFLAGS="$H5_CXXFLAGS $HIGH_OPT_CXXFLAGS" H5_FCFLAGS="$H5_FCFLAGS $HIGH_OPT_FCFLAGS" AC_MSG_RESULT([high]) ;; X-debug) H5_CFLAGS="$H5_CFLAGS $DEBUG_OPT_CFLAGS" + H5_CXXFLAGS="$H5_CXXFLAGS $DEBUG_OPT_CXXFLAGS" H5_FCFLAGS="$H5_FCFLAGS $DEBUG_OPT_FCFLAGS" AC_MSG_RESULT([debug]) ;; X-none) H5_CFLAGS="$H5_CFLAGS $NO_OPT_CFLAGS" + H5_CXXFLAGS="$H5_CXXFLAGS $NO_OPT_CXXFLAGS" H5_FCFLAGS="$H5_FCFLAGS $NO_OPT_FCFLAGS" AC_MSG_RESULT([none]) ;; *) H5_CFLAGS="$H5_CFLAGS $OPTIMIZATION" + H5_CXXFLAGS="$H5_CXXFLAGS $OPTIMIZATION" H5_FCFLAGS="$H5_FCFLAGS $OPTIMIZATION" OPTIMIZATION="custom ($OPTIMIZATION)" AC_MSG_RESULT([$OPTIMIZATION]) -- cgit v0.12 From e43c97fdb2459bfe605b7cb1a88624804b100232 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 16 Feb 2016 23:30:49 -0500 Subject: [svn-r29132] Added new single-responsibility functions to h5test.c/h that can replace functions like h5_clean_files() that also do things like reset the error handler and close fapls. Existing tests have not yet been updated to use these new functions. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial --- test/h5test.c | 294 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ test/h5test.h | 17 ++++ 2 files changed, 311 insertions(+) diff --git a/test/h5test.c b/test/h5test.c index 843ec35..c010adc 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -193,6 +193,107 @@ h5_clean_files(const char *base_name[], hid_t fapl) /*------------------------------------------------------------------------- + * Function: h5_delete_test_file + * + * Purpose Clean up temporary test files. + * + * When a test calls h5_fixname() get a VFD-dependent + * test file name, this function can be used to clean it up. + * + * Return: void + * + * Since this is a cleanup file, we don't care if it fails. + * + * Programmer: Dana Robinson + * February 2016 + * + *------------------------------------------------------------------------- + */ +void +h5_delete_test_file(const char *base_name, hid_t fapl) +{ + char filename[1024]; /* VFD-dependent filename to delete */ + char sub_filename[2048]; /* sub-files in multi & family VFDs */ + hid_t driver = -1; /* VFD ID */ + + /* Get the VFD-dependent filename */ + if(NULL == h5_fixname(base_name, fapl, filename, sizeof(filename))) + return; + + driver = H5Pget_driver(fapl); + + if(driver == H5FD_FAMILY) { + int j; + for(j = 0; /*void*/; j++) { + HDsnprintf(sub_filename, sizeof(sub_filename), filename, j); + + /* If we can't access the file, it probably doesn't exist + * and we are done deleting the sub-files. + */ + if(HDaccess(sub_filename, F_OK) < 0) + break; + + HDremove(sub_filename); + } /* end for */ + } else if(driver == H5FD_CORE) { + hbool_t backing; /* Whether the core file has backing store */ + + H5Pget_fapl_core(fapl, NULL, &backing); + + /* If the file was stored to disk with bacing store, remove it */ + if(backing) + HDremove(filename); + } else if (driver == H5FD_MULTI) { + H5FD_mem_t mt; + + HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); + + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) { + HDsnprintf(sub_filename, sizeof(sub_filename), "%s-%c.h5", filename, multi_letters[mt]); + HDremove(sub_filename); + } /* end for */ + } else { + HDremove(filename); + } /* end if */ + + return; +} /* end h5_delete_test_file() */ + + +/*------------------------------------------------------------------------- + * Function: h5_delete_all_test_files + * + * Purpose Clean up temporary test files. + * + * When a test calls h5_fixname() get a VFD-dependent + * test file name, this function can be used to clean it up. + * + * This function takes an array of filenames that ends with + * a NULL string and cleans them all. + * + * Return: void + * + * Since this is a cleanup file, we don't care if it fails. + * + * Programmer: Dana Robinson + * February 2016 + * + *------------------------------------------------------------------------- + */ +void +h5_delete_all_test_files(const char *base_name[], hid_t fapl) +{ + int i; /* iterator */ + + for(i = 0; base_name[i]; i++) { + h5_delete_test_file(base_name[i], fapl); + } /* end for */ + + return; +} /* end h5_delete_all_test_files() */ + + +/*------------------------------------------------------------------------- * Function: h5_cleanup * * Purpose: Cleanup temporary test files. @@ -226,6 +327,35 @@ h5_cleanup(const char *base_name[], hid_t fapl) /*------------------------------------------------------------------------- + * Function: h5_test_shutdown + * + * Purpose: Performs any special test cleanup required before the test + * ends. + * + * NOTE: This function should normally only be called once + * in a given test, usually just before leaving main(). It + * is intended for use in the single-file unit tests, not + * testhdf5. + * + * Return: void + * + * Programmer: Dana Robinson + * February 2016 + * + *------------------------------------------------------------------------- + */ +void +h5_test_shutdown(void) +{ + + /* Restore the original error reporting routine */ + h5_restore_err(); + + return; +} /* end h5_test_shutdown() */ + + +/*------------------------------------------------------------------------- * Function: h5_restore_err * * Purpose: Restore the default error handler. @@ -303,6 +433,39 @@ h5_reset(void) /*------------------------------------------------------------------------- + * Function: h5_test_init + * + * Purpose: Performs any special actions before the test begins. + * + * NOTE: This function should normally only be called once + * in a given test, usually at the beginning of main(). It + * is intended for use in the single-file unit tests, not + * testhdf5. + * + * Return: void + * + * Programmer: Dana Robinson + * February 2016 + * + *------------------------------------------------------------------------- + */ +void +h5_test_init(void) +{ + HDfflush(stdout); + HDfflush(stderr); + H5close(); + + /* Save current error stack reporting routine and redirect to our local one */ + HDassert(err_func == NULL); + H5Eget_auto2(H5E_DEFAULT, &err_func, NULL); + H5Eset_auto2(H5E_DEFAULT, h5_errors, NULL); + + return; +} /* end h5_test_init() */ + + +/*------------------------------------------------------------------------- * Function: h5_fixname * * Purpose: Create a file name from a file base name like `test' and @@ -744,6 +907,137 @@ h5_fileaccess(void) /*------------------------------------------------------------------------- + * Function: h5_get_vfd_fapl + * + * Purpose: Returns a file access property list which is the default + * fapl but with a file driver set according to the constant or + * environment variable HDF5_DRIVER. + * + * Return: Success: A file access property list ID + * Failure: -1 + * + * Programmer: Dana Robinson + * February 2016 + * + *------------------------------------------------------------------------- + */ +hid_t +h5_get_vfd_fapl(void) +{ + const char *env = NULL; /* HDF5_DRIVER environment variable */ + const char *tok = NULL; /* strtok pointer */ + char buf[1024]; /* buffer for tokenizing HDF5_DRIVER */ + hid_t fapl = -1; /* fapl to be returned */ + + /* Get the environment variable, if it exists */ + env = HDgetenv("HDF5_DRIVER"); + + /* Create a default fapl */ + if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) + return -1; + + /* If the environment variable was not set, just return + * the default fapl. + */ + if(!env || !*env) + return fapl; + + /* Get the first 'word' of the environment variable. + * If it's nothing (environment variable was whitespace) + * just return the default fapl. + */ + HDstrncpy(buf, env, sizeof(buf)); + HDmemset(buf, 0, sizeof(buf)); + if(NULL == (tok = HDstrtok(buf, " \t\n\r"))) + return fapl; + + if(!HDstrcmp(tok, "sec2")) { + /* POSIX (section 2) read() and write() system calls */ + if(H5Pset_fapl_sec2(fapl) < 0) + return -1; + } else if(!HDstrcmp(tok, "stdio")) { + /* Standard C fread() and fwrite() system calls */ + if(H5Pset_fapl_stdio(fapl) < 0) + return -1; + } else if(!HDstrcmp(tok, "core")) { + /* In-memory driver settings (backing store on, 1 MB increment) */ + if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0) + return -1; + } else if(!HDstrcmp(tok, "core_paged")) { + /* In-memory driver with write tracking and paging on */ + if(H5Pset_fapl_core(fapl, (size_t)1, TRUE) < 0) + return -1; + if(H5Pset_core_write_tracking(fapl, TRUE, (size_t)4096) < 0) + return -1; + } else if(!HDstrcmp(tok, "split")) { + /* Split meta data and raw data each using default driver */ + if(H5Pset_fapl_split(fapl, + "-m.h5", H5P_DEFAULT, + "-r.h5", H5P_DEFAULT) < 0) + return -1; + } else if(!HDstrcmp(tok, "multi")) { + /* Multi-file driver, general case of the split driver */ + H5FD_mem_t memb_map[H5FD_MEM_NTYPES]; + hid_t memb_fapl[H5FD_MEM_NTYPES]; + const char *memb_name[H5FD_MEM_NTYPES]; + char sv[H5FD_MEM_NTYPES][1024]; + haddr_t memb_addr[H5FD_MEM_NTYPES]; + H5FD_mem_t mt; + + HDmemset(memb_map, 0, sizeof(memb_map)); + HDmemset(memb_fapl, 0, sizeof(memb_fapl)); + HDmemset(memb_name, 0, sizeof(memb_name)); + HDmemset(memb_addr, 0, sizeof(memb_addr)); + + HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { + memb_fapl[mt] = H5P_DEFAULT; + HDsprintf(sv[mt], "%%s-%c.h5", multi_letters[mt]); + memb_name[mt] = sv[mt]; + memb_addr[mt] = (haddr_t)MAX(mt - 1, 0) * (HADDR_MAX / 10); + } /* end for */ + + if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, + memb_addr, FALSE) < 0) { + return -1; + } /* end if */ + } else if(!HDstrcmp(tok, "family")) { + /* Family of files, each 1MB and using the default driver */ + hsize_t fam_size = 100*1024*1024; /*100 MB*/ + + /* Was a family size specified in the environment variable? */ + if((tok = HDstrtok(NULL, " \t\n\r"))) + fam_size = (hsize_t)(HDstrtod(tok, NULL) * 1024*1024); + if(H5Pset_fapl_family(fapl, fam_size, H5P_DEFAULT) < 0) + return -1; + } else if(!HDstrcmp(tok, "log")) { + /* Log file access */ + unsigned log_flags = H5FD_LOG_LOC_IO | H5FD_LOG_ALLOC; + + /* Were special log file flags specified in the environment variable? */ + if((tok = HDstrtok(NULL, " \t\n\r"))) + log_flags = (unsigned)HDstrtol(tok, NULL, 0); + + if(H5Pset_fapl_log(fapl, NULL, log_flags, (size_t)0) < 0) + return -1; +#ifdef H5_HAVE_DIRECT + } else if(!HDstrcmp(tok, "direct")) { + /* Linux direct read() and write() system calls. Set memory boundary, + * file block size, and copy buffer size to the default values. + */ + if(H5Pset_fapl_direct(fapl, 1024, 4096, 8*4096)<0) + return -1; +#endif + } else { + /* Unknown driver */ + return -1; + } /* end if */ + + return fapl; +} /* end h5_get_vfd_fapl() */ + + +/*------------------------------------------------------------------------- * Function: h5_no_hwconv * * Purpose: Turn off hardware data type conversions. diff --git a/test/h5test.h b/test/h5test.h index ca0eead..575497b 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -139,6 +139,23 @@ H5TEST_DLL int print_func(const char *format, ...); H5TEST_DLL int h5_make_local_copy(const char *origfilename, const char *local_copy_name); H5TEST_DLL herr_t h5_verify_cached_stabs(const char *base_name[], hid_t fapl); +/* Functions that will replace VFD-dependent functions that violate + * the single responsibility principle. Unlike their predecessors, + * these new functions do not have hidden side effects. + */ +/* h5_fileaccess() replacement */ +H5TEST_DLL hid_t h5_get_vfd_fapl(void); + +/* h5_clean_files() replacements */ +H5TEST_DLL void h5_delete_test_file(const char *base_name, hid_t fapl); +H5TEST_DLL void h5_delete_all_test_files(const char *base_name[], hid_t fapl); + +/* h5_reset() replacement */ +H5TEST_DLL void h5_test_init(void); + +/* h5_cleanup() replacement */ +H5TEST_DLL void h5_test_shutdown(void); + /* Routines for operating on the list of tests (for the "all in one" tests) */ H5TEST_DLL void TestUsage(void); H5TEST_DLL void AddTest(const char *TheName, void (*TheCall) (void), -- cgit v0.12 From d334af98c15c03f5c7e574023e4d193f3e8b5aab Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 17 Feb 2016 04:54:07 -0500 Subject: [svn-r29134] Updated config/solaris to use the latest configure option and compiler flag scheme. Tested on: Solaris 11.1 (emu) w/ SunPro 5.12 CC/FC/CXX autotools serial --- config/solaris | 91 ++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 70 insertions(+), 21 deletions(-) diff --git a/config/solaris b/config/solaris index 310c373..72d7423 100644 --- a/config/solaris +++ b/config/solaris @@ -32,16 +32,32 @@ fi # Try solaris native compiler flags if test "X-" = "X-$cc_flags_set"; then H5_CFLAGS="$H5_CFLAGS -erroff=%none -DBSD_COMP" + + # Production + # NDEBUG is handled explicitly by the configure script + PROD_CFLAGS= + + # Debug + # NDEBUG is handled explicitly by the configure script + # -g is hanled by the symbols flags + DEBUG_CFLAGS= + + # Symbols + NO_SYMBOLS_CFLAGS="-s" + SYMBOLS_CFLAGS="-g" + + # Profile + PROFILE_CFLAGS="-xpg" + + # Optimization # -g produces rather slow code. "-g -O" produces much faster code with some # loss of debugger functions such as not able to print local variables. - DEBUG_CFLAGS="-g -O" - DEBUG_CPPFLAGS= - PROD_CFLAGS="-O -s" - PROD_CPPFLAGS= - PROFILE_CFLAGS=-xpg - PROFILE_CPPFLAGS= + HIGH_OPT_CFLAGS="-O" + DEBUG_OPT_CFLAGS="-O" + NO_OPT_CFLAGS= + cc_flags_set=yes -# Special linking flag is needed to build with Fortran on Solaris 5.9 + # Special linking flag is needed to build with Fortran on Solaris 5.9 system_version="`uname -r`" case "$system_version" in 5.9*) @@ -52,10 +68,6 @@ if test "X-" = "X-$cc_flags_set"; then ;; esac - # Turn off optimization flag for SUNpro compiler versions 4.x which - # have an optimization bug. Version 5.0 works. - ($CC -V 2>&1) | grep -s 'cc: .* C 4\.' >/dev/null 2>&1 \ - && PROD_CFLAGS="`echo $PROD_CFLAGS | sed -e 's/-O//'`" fi LIBS="$LIBS" @@ -69,12 +81,34 @@ fi if test "X-" = "X-$f9x_flags_set"; then F9XSUFFIXFLAG="" FSEARCH_DIRS="" + H5_FCFLAGS="$H5_FCFLAGS" + + # TODO: Revisit these flags. + + # Production + # NDEBUG is handled explicitly by the configure script + PROD_FCFLAGS= + + # Debug + # NDEBUG is handled explicitly by the configure script + # -g is hanled by the symbols flags + DEBUG_FCFLAGS= + + # Symbols + NO_SYMBOLS_FCFLAGS= + SYMBOLS_FCFLAGS="-g" + + # Profile + PROFILE_FCFLAGS= + + # Optimization # -g produces rather slow code. "-g -O" produces much faster code with some # loss of debugger functions such as not able to print local variables. - DEBUG_FCFLAGS="-g -O" - PROD_FCFLAGS="-O2" - PROFILE_FCFLAGS="" + HIGH_OPT_FCFLAGS="-O2" + DEBUG_OPT_FCFLAGS="-O" + NO_OPT_FCFLAGS= + f9x_flags_set=yes fi @@ -107,14 +141,30 @@ fi if test -z "$cxx_flags_set"; then H5_CXXFLAGS="$H5_CXXFLAGS -instances=static" H5_CPPFLAGS="$H5_CPPFLAGS -LANG:std" + + # Production + # NDEBUG is handled explicitly by the configure script + PROD_CXXFLAGS= + + # Debug + # NDEBUG is handled explicitly by the configure script + # -g is hanled by the symbols flags + DEBUG_CXXFLAGS= + + # Symbols + NO_SYMBOLS_CXXFLAGS="-s" + SYMBOLS_CXXFLAGS="-g" + + # Profile + PROFILE_CXXFLAGS="-xpg" + + # Optimization # -g produces rather slow code. "-g -O" produces much faster code with some # loss of debugger functions such as not able to print local variables. - DEBUG_CXXFLAGS="-g -O" - DEBUG_CPPFLAGS= - PROD_CXXFLAGS="-O -s" - PROD_CPPFLAGS= - PROFILE_CXXFLAGS=-xpg - PROFILE_CPPFLAGS= + HIGH_OPT_CXXFLAGS="-O" + DEBUG_OPT_CXXFLAGS="-O" + NO_OPT_CXXFLAGS= + cxx_flags_set=yes fi @@ -156,4 +206,3 @@ case $CXX in ;; esac - -- cgit v0.12 From 52705fa6f0e093bcde34f79ebc690b87504bf712 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 17 Feb 2016 10:08:33 -0500 Subject: [svn-r29139] Updated PGI compiler files to set NO_SYMBOLS_CFLAGS/FCFLAGS and moved the -s (strip symbols) option from the production flags to the no symbols flags. Tested on: platypus w/ PGI 15.7 (C, C++, Fortran) --- config/pgi-fflags | 3 ++- config/pgi-flags | 12 ++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/config/pgi-fflags b/config/pgi-fflags index fbcba52..08dfe6e 100644 --- a/config/pgi-fflags +++ b/config/pgi-fflags @@ -84,13 +84,14 @@ if test "X-pgf90" = "X-$f9x_vendor"; then #else # PROD_FCFLAGS="-O2 -s" #fi - PROD_FCFLAGS="-fast -s -Mnoframe" + PROD_FCFLAGS="-fast -Mnoframe" # Debug DEBUG_FCFLAGS="-Mbounds -Mchkptr -Mdclchk" # Symbols SYMBOLS_FCFLAGS="-g" + NO_SYMBOLS_FCFLAGS="-s" # Profiling PROFILE_FCFLAGS="-Mprof=func,line" diff --git a/config/pgi-flags b/config/pgi-flags index a6dcba3..f6878e6 100644 --- a/config/pgi-flags +++ b/config/pgi-flags @@ -73,31 +73,28 @@ if test "X-pgcc" = "X-$cc_vendor"; then # Production case "$cc_vendor-$cc_version" in pgcc-10.6*) - PROD_CFLAGS="-s" + PROD_CFLAGS= ;; pgcc-9.*) - PROD_CFLAGS="-s" + PROD_CFLAGS= ;; *) - PROD_CFLAGS="-fast -s" + PROD_CFLAGS="-fast" ;; esac - PROD_CPPFLAGS= # Debug # NDEBUG is handled explicitly by the configure script DEBUG_CFLAGS="-Mbounds" - DEBUG_CPPFLAGS= # Symbols SYMBOLS_CFLAGS="-g" - SYMBOLS_CPPFLAGS= + NO_SYMBOLS_CFLAGS="-s" # Profiling PROFILE_CFLAGS="-Mprof=func,line" # Use this for profiling with gprof #PROFILE_CFLAGS="-pg" - PROFILE_CPPFLAGS= # Optimization case "$cc_vendor-$cc_version" in @@ -118,7 +115,6 @@ if test "X-pgcc" = "X-$cc_vendor"; then # Flags are set cc_flags_set=yes - fi # Clear cc info if no flags set -- cgit v0.12 From b3df4e9c8d716db4ea2680f6bb4ac16d1084dea5 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 17 Feb 2016 13:15:58 -0500 Subject: [svn-r29142] Updated the Intel files in config to use the new NO_SYMBOLS flags and modified the failsafe configure flags in ibm-aix to use the new scheme. --- config/ibm-aix | 49 +++++++++++++++++++++++++++++++++++++++++-------- config/intel-fflags | 1 + config/intel-flags | 7 ++----- 3 files changed, 44 insertions(+), 13 deletions(-) diff --git a/config/ibm-aix b/config/ibm-aix index 28498e2..ef052fb 100644 --- a/config/ibm-aix +++ b/config/ibm-aix @@ -59,9 +59,25 @@ if test "X-" = "X-$f9x_flags_set"; then FCFLAGS="$FCFLAGS ${F9XSUFFIXFLAG}" H5_FCFLAGS="$H5_FCFLAGS ${F9XSUFFIXFLAG}" FSEARCH_DIRS="-I./ -I../src" - DEBUG_FCFLAGS="-g" - PROD_FCFLAGS="-O" - PROFILE_FCFLAGS="-g -pg" + + # Produciton + PROD_FCFLAGS= + + # Debug + DEBUG_FCFLAGS= + + # Symbols + SYMBOLS_FCFLAGS="-g" + NO_SYMBOLS_FCFLAGS= + + # Profiling + PROFILE_FCFLAGS="-pg" + + # Optimization + HIGH_OPT_FCFLAGS="-O" + DEBUG_OPT_FCFLAGS= + NO_OPT_FCFLAGS= + f9x_flags_set=yes fi @@ -91,13 +107,30 @@ case $CC_BASENAME in ;; *) + # Undetermined compiler + # Use very generic flags H5_CFLAGS="$H5_CFLAGS -ansi" - DEBUG_CFLAGS="-g" - DEBUG_CPPFLAGS= - PROD_CFLAGS="-O" - PROD_CPPFLAGS= + + # Produciton + PROD_CFLAGS= + + # Debug + DEBUG_CFLAGS= + + # Symbols + SYMBOLS_CFLAGS="-g" + NO_SYMBOLS_CFLAGS= + + # Profiling PROFILE_CFLAGS="-pg" - PROFILE_CPPFLAGS= + + # Optimization + HIGH_OPT_CFLAGS="-O" + DEBUG_OPT_CFLAGS= + NO_OPT_CFLAGS= + + # Flags are set + cc_flags_set=yes ;; esac diff --git a/config/intel-fflags b/config/intel-fflags index 1f7cf78..db9543e 100644 --- a/config/intel-fflags +++ b/config/intel-fflags @@ -80,6 +80,7 @@ if test "X-ifort" = "X-$f9x_vendor"; then # Symbols SYMBOLS_FCFLAGS="-g" + NO_SYMBOLS_FCFLAGS= # Profiling # Use this for profiling with gprof diff --git a/config/intel-flags b/config/intel-flags index 060e78a..fe7b06d 100644 --- a/config/intel-flags +++ b/config/intel-flags @@ -70,23 +70,20 @@ if test "X-icc" = "X-$cc_vendor"; then # Default to C99 standard. H5_CFLAGS="${H5_CFLAGS:--std=c99 $arch} -Wcheck -Wall" - # Production is set to default; see settings for specific version further down + # Production PROD_CFLAGS= - PROD_CPPFLAGS= # Debug # NDEBUG is handled explicitly in configure DEBUG_CFLAGS= - DEBUG_CPPFLAGS= # Symbols SYMBOLS_CFLAGS="-g" - SYMBOLS_CPPFLAGS= + NO_SYMBOLS_CFLAGS= # Profiling # Use this for profiling with gprof PROFILE_CFLAGS="-p" - PROFILE_CPPFLAGS= # Optimization HIGH_OPT_CFLAGS="-O" -- cgit v0.12 From 70ad55b1052e018acd90b22ab44260a8a1721e0b Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Thu, 18 Feb 2016 15:50:37 -0500 Subject: [svn-r29150] fix for Jira issue 9670 - HDF5 segfaults on corrupted file. Change compare callback in Btree2 class to correctly account for errors. tested on bb-8. --- src/H5Abtree2.c | 33 +++++++++++++++--------------- src/H5B2.c | 41 +++++++++++++++++++++++++++++-------- src/H5B2int.c | 60 ++++++++++++++++++++++++++++++++++++++----------------- src/H5B2pkg.h | 4 ++-- src/H5B2private.h | 2 +- src/H5B2test.c | 25 +++++++++++++++-------- src/H5C.c | 10 +++------- src/H5Gbtree2.c | 45 ++++++++++++++++++++--------------------- src/H5HFbtree2.c | 52 +++++++++++++++++++++++++---------------------- src/H5SM.c | 54 +++++++++++++++++++++++++++++++++---------------- src/H5SMmessage.c | 39 +++++++++++++++++++----------------- src/H5SMpkg.h | 2 +- 12 files changed, 223 insertions(+), 144 deletions(-) diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c index 716ad4a..a9c77d2 100644 --- a/src/H5Abtree2.c +++ b/src/H5Abtree2.c @@ -80,7 +80,7 @@ typedef struct H5A_fh_ud_cmp_t { /* v2 B-tree driver callbacks for 'creation order' index */ static herr_t H5A__dense_btree2_corder_store(void *native, const void *udata); -static herr_t H5A__dense_btree2_corder_compare(const void *rec1, const void *rec2); +static herr_t H5A__dense_btree2_corder_compare(const void *rec1, const void *rec2, int *result); static herr_t H5A__dense_btree2_corder_encode(uint8_t *raw, const void *native, void *ctx); static herr_t H5A__dense_btree2_corder_decode(const uint8_t *raw, void *native, @@ -90,7 +90,7 @@ static herr_t H5A__dense_btree2_corder_debug(FILE *stream, int indent, int fwidt /* v2 B-tree driver callbacks for 'name' index */ static herr_t H5A__dense_btree2_name_store(void *native, const void *udata); -static herr_t H5A__dense_btree2_name_compare(const void *rec1, const void *rec2); +static herr_t H5A__dense_btree2_name_compare(const void *rec1, const void *rec2, int *result); static herr_t H5A__dense_btree2_name_encode(uint8_t *raw, const void *native, void *ctx); static herr_t H5A__dense_btree2_name_decode(const uint8_t *raw, void *native, @@ -245,13 +245,13 @@ H5A__dense_btree2_name_store(void *_nrecord, const void *_udata) *------------------------------------------------------------------------- */ static herr_t -H5A__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec) +H5A__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec, int *result) { const H5A_bt2_ud_common_t *bt2_udata = (const H5A_bt2_ud_common_t *)_bt2_udata; const H5A_dense_bt2_name_rec_t *bt2_rec = (const H5A_dense_bt2_name_rec_t *)_bt2_rec; - herr_t ret_value = FAIL; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_STATIC_NOERR + FUNC_ENTER_STATIC /* Sanity check */ HDassert(bt2_udata); @@ -259,13 +259,12 @@ H5A__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec) /* Check hash value */ if(bt2_udata->name_hash < bt2_rec->hash) - ret_value = (-1); + *result = (-1); else if(bt2_udata->name_hash > bt2_rec->hash) - ret_value = 1; + *result = 1; else { H5A_fh_ud_cmp_t fh_udata; /* User data for fractal heap 'op' callback */ H5HF_t *fheap; /* Fractal heap handle to use for finding object */ - herr_t status; /* Status from fractal heap 'op' routine */ /* Sanity check */ HDassert(bt2_udata->name_hash == bt2_rec->hash); @@ -290,13 +289,14 @@ H5A__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec) HDassert(fheap); /* Check if the user's attribute and the B-tree's attribute have the same name */ - status = H5HF_op(fheap, bt2_udata->dxpl_id, &bt2_rec->id, H5A__dense_fh_name_cmp, &fh_udata); - HDassert(status >= 0); + if(H5HF_op(fheap, bt2_udata->dxpl_id, &bt2_rec->id, H5A__dense_fh_name_cmp, &fh_udata) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") /* Callback will set comparison value */ - ret_value = fh_udata.cmp; + *result = fh_udata.cmp; } /* end else */ +done: FUNC_LEAVE_NOAPI(ret_value) } /* H5A__dense_btree2_name_compare() */ @@ -437,11 +437,10 @@ H5A__dense_btree2_corder_store(void *_nrecord, const void *_udata) *------------------------------------------------------------------------- */ static herr_t -H5A__dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec) +H5A__dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec, int *result) { const H5A_bt2_ud_common_t *bt2_udata = (const H5A_bt2_ud_common_t *)_bt2_udata; const H5A_dense_bt2_corder_rec_t *bt2_rec = (const H5A_dense_bt2_corder_rec_t *)_bt2_rec; - herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_STATIC_NOERR @@ -451,13 +450,13 @@ H5A__dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec) /* Check creation order value */ if(bt2_udata->corder < bt2_rec->corder) - ret_value = -1; + *result = -1; else if(bt2_udata->corder > bt2_rec->corder) - ret_value = 1; + *result = 1; else - ret_value = 0; + *result = 0; - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5A__dense_btree2_corder_compare() */ diff --git a/src/H5B2.c b/src/H5B2.c index a1e9d37..caf2395 100644 --- a/src/H5B2.c +++ b/src/H5B2.c @@ -493,8 +493,10 @@ H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op, * find candidates or avoid further searching. */ if(hdr->min_native_rec != NULL) { - if((cmp = (hdr->cls->compare)(udata, hdr->min_native_rec)) < 0) - HGOTO_DONE(FALSE) /* Less than the least record--not found */ + if((hdr->cls->compare)(udata, hdr->min_native_rec, &cmp) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + if(cmp < 0) + HGOTO_DONE(FALSE) /* Less than the least record--not found */ else if(cmp == 0) { /* Record is found */ if(op && (op)(hdr->min_native_rec, op_data) < 0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation") @@ -502,8 +504,10 @@ H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op, } /* end if */ } /* end if */ if(hdr->max_native_rec != NULL) { - if((cmp = (hdr->cls->compare)(udata, hdr->max_native_rec)) > 0) - HGOTO_DONE(FALSE) /* Greater than the greatest record--not found */ + if((hdr->cls->compare)(udata, hdr->max_native_rec, &cmp) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + if(cmp > 0) + HGOTO_DONE(FALSE) /* Less than the least record--not found */ else if(cmp == 0) { /* Record is found */ if(op && (op)(hdr->max_native_rec, op_data) < 0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "'found' callback failed for B-tree find operation") @@ -526,7 +530,13 @@ H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op, HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node") /* Locate node pointer for child */ - cmp = H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx); + if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, + udata, &idx, &cmp) < 0) { + /* Unlock current node before failing */ + H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET); + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + } + if(cmp > 0) idx++; @@ -589,7 +599,12 @@ H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op, HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* Locate record */ - cmp = H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx); + if(H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, + udata, &idx, &cmp) < 0) { + /* unlock current node before failing */ + H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET); + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + } if(cmp != 0) { /* Unlock leaf node */ @@ -1117,7 +1132,13 @@ H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op, HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node") /* Locate node pointer for child */ - cmp = H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx); + if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, + udata, &idx, &cmp) < 0) { + /* Unlock current node */ + H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET); + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + } + if(cmp > 0) idx++; @@ -1189,7 +1210,11 @@ H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op, HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* Locate record */ - cmp = H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx); + if(H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, + udata, &idx, &cmp) < 0) { + H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET); + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + } if(cmp != 0) { /* Unlock leaf node */ diff --git a/src/H5B2int.c b/src/H5B2int.c index 09addce..a184b4b 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -134,20 +134,24 @@ H5FL_SEQ_EXTERN(H5B2_node_info_t); * *------------------------------------------------------------------------- */ -int +herr_t H5B2__locate_record(const H5B2_class_t *type, unsigned nrec, size_t *rec_off, - const uint8_t *native, const void *udata, unsigned *idx) + const uint8_t *native, const void *udata, unsigned *idx, int *cmp) { unsigned lo = 0, hi; /* Low & high index values */ unsigned my_idx = 0; /* Final index value */ - int cmp = -1; /* Key comparison value */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_PACKAGE - FUNC_ENTER_PACKAGE_NOERR + *cmp = -1; hi = nrec; - while(lo < hi && cmp) { + while(lo < hi && *cmp) { my_idx = (lo + hi) / 2; - if((cmp = (type->compare)(udata, native + rec_off[my_idx])) < 0) + if((type->compare)(udata, native + rec_off[my_idx], cmp) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + if(*cmp < 0) hi = my_idx; else lo = my_idx + 1; @@ -155,7 +159,8 @@ H5B2__locate_record(const H5B2_class_t *type, unsigned nrec, size_t *rec_off, *idx = my_idx; - FUNC_LEAVE_NOAPI(cmp) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5B2__locate_record */ @@ -1614,7 +1619,9 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr idx = 0; else { /* Find correct location to insert this record */ - if((cmp = H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx)) == 0) + if(H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + if(cmp == 0) HGOTO_ERROR(H5E_BTREE, H5E_EXISTS, FAIL, "record is already in B-tree") if(cmp > 0) idx++; @@ -1711,7 +1718,10 @@ H5B2__insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, size_t split_nrec; /* Number of records to split node at */ /* Locate node pointer for child */ - if((cmp = H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx)) == 0) + if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, + udata, &idx, &cmp) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + if(cmp == 0) HGOTO_ERROR(H5E_BTREE, H5E_EXISTS, FAIL, "record is already in B-tree") if(cmp > 0) idx++; @@ -1766,8 +1776,11 @@ H5B2__insert_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, } /* end else */ /* Locate node pointer for child (after split/redistribute) */ -/* Actually, this can be easily updated (for 2-node redistrib.) and shouldn't require re-searching */ - if((cmp = H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx)) == 0) + /* Actually, this can be easily updated (for 2-node redistrib.) and shouldn't require re-searching */ + if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, + udata, &idx, &cmp) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + if(cmp == 0) HGOTO_ERROR(H5E_BTREE, H5E_EXISTS, FAIL, "record is already in B-tree") if(cmp > 0) idx++; @@ -1861,7 +1874,8 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr idx = 0; else { /* Find correct location to insert this record */ - cmp = H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx); + if(H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") /* Check for inserting a record */ if(0 != cmp) { @@ -1999,7 +2013,8 @@ H5B2__update_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, HDassert(internal->nrec == curr_node_ptr->node_nrec); /* Locate node pointer for child */ - cmp = H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx); + if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx, &cmp) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") /* Check for modifying existing record */ if(0 == cmp) { @@ -2520,6 +2535,7 @@ H5B2__remove_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr haddr_t leaf_addr = HADDR_UNDEF; /* Leaf address on disk */ unsigned leaf_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting leaf node */ unsigned idx; /* Location of record which matches key */ + int cmp; /* Comparison value of records */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE @@ -2539,7 +2555,9 @@ H5B2__remove_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_ptr HDassert(leaf->nrec == curr_node_ptr->node_nrec); /* Find correct location to remove this record */ - if(H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx) != 0) + if(H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + if(cmp != 0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "record is not in B-tree") /* Check for invalidating the min/max record for the tree */ @@ -2683,7 +2701,9 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased, if(swap_loc) idx = 0; else { - cmp = H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx); + if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, + udata, &idx, &cmp) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") if(cmp >= 0) idx++; } /* end else */ @@ -2745,7 +2765,8 @@ H5B2__remove_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, hbool_t *depth_decreased, idx = 0; else { /* Actually, this can be easily updated (for 2-node redistrib.) and shouldn't require re-searching */ - cmp = H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx); + if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx, &cmp) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") if(cmp >= 0) idx++; } /* end else */ @@ -3229,7 +3250,8 @@ H5B2__neighbor_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, H5B2_node_ptr_t *curr_node_p HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* Locate node pointer for child */ - cmp = H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx); + if(H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx, &cmp) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") if(cmp > 0) idx++; else @@ -3316,7 +3338,9 @@ H5B2__neighbor_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node") /* Locate node pointer for child */ - cmp = H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx); + if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, + udata, &idx, &cmp) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") if(cmp > 0) idx++; diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h index 2b2c145..edac296 100644 --- a/src/H5B2pkg.h +++ b/src/H5B2pkg.h @@ -365,8 +365,8 @@ H5_DLL herr_t H5B2__node_size(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, const H5B2_node_ptr_t *curr_node, hsize_t *op_data); /* Routines for locating records */ -H5_DLL int H5B2__locate_record(const H5B2_class_t *type, unsigned nrec, - size_t *rec_off, const uint8_t *native, const void *udata, unsigned *idx); +H5_DLL herr_t H5B2__locate_record(const H5B2_class_t *type, unsigned nrec, + size_t *rec_off, const uint8_t *native, const void *udata, unsigned *idx, int *result); H5_DLL herr_t H5B2__neighbor_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, void *neighbor_loc, H5B2_compare_t comp, void *udata, H5B2_found_t op, void *op_data); diff --git a/src/H5B2private.h b/src/H5B2private.h index ff94680..b509869 100644 --- a/src/H5B2private.h +++ b/src/H5B2private.h @@ -90,7 +90,7 @@ struct H5B2_class_t { void *(*crt_context)(void *udata); /* Create context for other client callbacks */ herr_t (*dst_context)(void *ctx); /* Destroy client callback context */ herr_t (*store)(void *nrecord, const void *udata); /* Store application record in native record table */ - herr_t (*compare)(const void *rec1, const void *rec2); /* Compare two native records */ + herr_t (*compare)(const void *rec1, const void *rec2, int *result); /* Compare two native records */ herr_t (*encode)(uint8_t *raw, const void *record, void *ctx); /* Encode record from native form to disk storage form */ herr_t (*decode)(const uint8_t *raw, void *record, void *ctx); /* Decode record from disk storage form to native form */ herr_t (*debug)(FILE *stream, int indent, int fwidth, /* Print a record for debugging */ diff --git a/src/H5B2test.c b/src/H5B2test.c index e0c96fb..24163e0 100644 --- a/src/H5B2test.c +++ b/src/H5B2test.c @@ -65,7 +65,7 @@ typedef struct H5B2_test_ctx_t { static void *H5B2__test_crt_context(void *udata); static herr_t H5B2__test_dst_context(void *ctx); static herr_t H5B2__test_store(void *nrecord, const void *udata); -static herr_t H5B2__test_compare(const void *rec1, const void *rec2); +static herr_t H5B2__test_compare(const void *rec1, const void *rec2, int *result); static herr_t H5B2__test_encode(uint8_t *raw, const void *nrecord, void *ctx); static herr_t H5B2__test_decode(const uint8_t *raw, void *nrecord, void *ctx); static herr_t H5B2__test_debug(FILE *stream, int indent, int fwidth, @@ -73,7 +73,7 @@ static herr_t H5B2__test_debug(FILE *stream, int indent, int fwidth, /* v2 B-tree driver callbacks for 'test2' B-trees */ static herr_t H5B2__test2_store(void *nrecord, const void *udata); -static herr_t H5B2__test2_compare(const void *rec1, const void *rec2); +static herr_t H5B2__test2_compare(const void *rec1, const void *rec2, int *result); static herr_t H5B2__test2_encode(uint8_t *raw, const void *nrecord, void *ctx); static herr_t H5B2__test2_decode(const uint8_t *raw, void *nrecord, void *ctx); static herr_t H5B2__test2_debug(FILE *stream, int indent, int fwidth, @@ -236,11 +236,13 @@ H5B2__test_store(void *nrecord, const void *udata) *------------------------------------------------------------------------- */ static herr_t -H5B2__test_compare(const void *rec1, const void *rec2) +H5B2__test_compare(const void *rec1, const void *rec2, int *result) { FUNC_ENTER_STATIC_NOERR - FUNC_LEAVE_NOAPI((herr_t)(*(const hssize_t *)rec1 - *(const hssize_t *)rec2)) + *result = (int)(*(const hssize_t *)rec1 - *(const hssize_t *)rec2); + + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5B2__test_compare() */ @@ -369,11 +371,13 @@ H5B2__test2_store(void *nrecord, const void *udata) *------------------------------------------------------------------------- */ static herr_t -H5B2__test2_compare(const void *rec1, const void *rec2) +H5B2__test2_compare(const void *rec1, const void *rec2, int *result) { FUNC_ENTER_STATIC_NOERR - FUNC_LEAVE_NOAPI((herr_t)(((const H5B2_test_rec_t *)rec1)->key - ((const H5B2_test_rec_t *)rec2)->key)) + *result = (int)(((const H5B2_test_rec_t *)rec1)->key - ((const H5B2_test_rec_t *)rec2)->key); + + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5B2__test2_compare() */ @@ -551,7 +555,10 @@ H5B2_get_node_info_test(H5B2_t *bt2, hid_t dxpl_id, void *udata, HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node") /* Locate node pointer for child */ - cmp = H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx); + if(H5B2__locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, + udata, &idx, &cmp) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") + if(cmp > 0) idx++; @@ -591,7 +598,9 @@ H5B2_get_node_info_test(H5B2_t *bt2, hid_t dxpl_id, void *udata, HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* Locate record */ - cmp = H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx); + if(H5B2__locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, + udata, &idx, &cmp) < 0) + HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") /* Unlock current node */ if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0) diff --git a/src/H5C.c b/src/H5C.c index 37b0df2..97ce4c6 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -2807,16 +2807,12 @@ H5C_protect(H5F_t * f, hit = FALSE; - thing = H5C_load_entry(f, dxpl_id, + if(NULL == (thing = H5C_load_entry(f, dxpl_id, #ifdef H5_HAVE_PARALLEL - coll_access, + coll_access, #endif /* H5_HAVE_PARALLEL */ - type, addr, udata); - - if ( thing == NULL ) { - + type, addr, udata))) HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "can't load entry") - } entry_ptr = (H5C_cache_entry_t *)thing; entry_ptr->ring = ring; diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c index 1a99b12..ff7e200 100644 --- a/src/H5Gbtree2.c +++ b/src/H5Gbtree2.c @@ -78,7 +78,7 @@ typedef struct H5G_fh_ud_cmp_t { /* v2 B-tree driver callbacks for 'creation order' index */ static herr_t H5G_dense_btree2_corder_store(void *native, const void *udata); -static herr_t H5G_dense_btree2_corder_compare(const void *rec1, const void *rec2); +static herr_t H5G_dense_btree2_corder_compare(const void *rec1, const void *rec2, int *result); static herr_t H5G_dense_btree2_corder_encode(uint8_t *raw, const void *native, void *ctx); static herr_t H5G_dense_btree2_corder_decode(const uint8_t *raw, void *native, @@ -88,7 +88,7 @@ static herr_t H5G_dense_btree2_corder_debug(FILE *stream, int indent, int fwidth /* v2 B-tree driver callbacks for 'name' index */ static herr_t H5G_dense_btree2_name_store(void *native, const void *udata); -static herr_t H5G_dense_btree2_name_compare(const void *rec1, const void *rec2); +static herr_t H5G__dense_btree2_name_compare(const void *rec1, const void *rec2, int *result); static herr_t H5G_dense_btree2_name_encode(uint8_t *raw, const void *native, void *ctx); static herr_t H5G_dense_btree2_name_decode(const uint8_t *raw, void *native, @@ -111,7 +111,7 @@ const H5B2_class_t H5G_BT2_NAME[1]={{ /* B-tree class information */ NULL, /* Create client callback context */ NULL, /* Destroy client callback context */ H5G_dense_btree2_name_store, /* Record storage callback */ - H5G_dense_btree2_name_compare, /* Record comparison callback */ + H5G__dense_btree2_name_compare, /* Record comparison callback */ H5G_dense_btree2_name_encode, /* Record encoding callback */ H5G_dense_btree2_name_decode, /* Record decoding callback */ H5G_dense_btree2_name_debug /* Record debugging callback */ @@ -216,7 +216,7 @@ H5G_dense_btree2_name_store(void *_nrecord, const void *_udata) /*------------------------------------------------------------------------- - * Function: H5G_dense_btree2_name_compare + * Function: H5G__dense_btree2_name_compare * * Purpose: Compare two native information records, according to some key * @@ -230,13 +230,13 @@ H5G_dense_btree2_name_store(void *_nrecord, const void *_udata) *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec) +H5G__dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec, int *result) { const H5G_bt2_ud_common_t *bt2_udata = (const H5G_bt2_ud_common_t *)_bt2_udata; const H5G_dense_bt2_name_rec_t *bt2_rec = (const H5G_dense_bt2_name_rec_t *)_bt2_rec; - herr_t ret_value = FAIL; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC /* Sanity check */ HDassert(bt2_udata); @@ -246,20 +246,19 @@ H5G_dense_btree2_name_compare(const void *_bt2_udata, const void *_bt2_rec) { unsigned u; -HDfprintf(stderr, "%s: bt2_udata = {'%s', %x}\n", "H5G_dense_btree2_name_compare", bt2_udata->name, (unsigned)bt2_udata->name_hash); -HDfprintf(stderr, "%s: bt2_rec = {%x, ", "H5G_dense_btree2_name_compare", (unsigned)bt2_rec->hash); +HDfprintf(stderr, "%s: bt2_udata = {'%s', %x}\n", "H5G__dense_btree2_name_compare", bt2_udata->name, (unsigned)bt2_udata->name_hash); +HDfprintf(stderr, "%s: bt2_rec = {%x, ", "H5G__dense_btree2_name_compare", (unsigned)bt2_rec->hash); for(u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++) HDfprintf(stderr, "%02x%s", bt2_rec->id[u], (u < (H5G_DENSE_FHEAP_ID_LEN - 1) ? " " : "}\n")); } #endif /* QAK */ /* Check hash value */ if(bt2_udata->name_hash < bt2_rec->hash) - ret_value = (-1); + *result = (-1); else if(bt2_udata->name_hash > bt2_rec->hash) - ret_value = 1; + *result = 1; else { H5G_fh_ud_cmp_t fh_udata; /* User data for fractal heap 'op' callback */ - herr_t status; /* Status from fractal heap 'op' routine */ /* Sanity check */ HDassert(bt2_udata->name_hash == bt2_rec->hash); @@ -276,16 +275,17 @@ for(u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++) fh_udata.cmp = 0; /* Check if the user's link and the B-tree's link have the same name */ - status = H5HF_op(bt2_udata->fheap, bt2_udata->dxpl_id, bt2_rec->id, - H5G_dense_fh_name_cmp, &fh_udata); - HDassert(status >= 0); + if(H5HF_op(bt2_udata->fheap, bt2_udata->dxpl_id, bt2_rec->id, + H5G_dense_fh_name_cmp, &fh_udata) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") /* Callback will set comparison value */ - ret_value = fh_udata.cmp; + *result = fh_udata.cmp; } /* end else */ +done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5G_dense_btree2_name_compare() */ +} /* H5G__dense_btree2_name_compare() */ /*------------------------------------------------------------------------- @@ -419,11 +419,10 @@ H5G_dense_btree2_corder_store(void *_nrecord, const void *_udata) *------------------------------------------------------------------------- */ static herr_t -H5G_dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec) +H5G_dense_btree2_corder_compare(const void *_bt2_udata, const void *_bt2_rec, int *result) { const H5G_bt2_ud_common_t *bt2_udata = (const H5G_bt2_ud_common_t *)_bt2_udata; const H5G_dense_bt2_corder_rec_t *bt2_rec = (const H5G_dense_bt2_corder_rec_t *)_bt2_rec; - herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -443,13 +442,13 @@ for(u = 0; u < H5G_DENSE_FHEAP_ID_LEN; u++) #endif /* QAK */ /* Check creation order value */ if(bt2_udata->corder < bt2_rec->corder) - ret_value = -1; + *result = -1; else if(bt2_udata->corder > bt2_rec->corder) - ret_value = 1; + *result = 1; else - ret_value = 0; + *result = 0; - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5G_dense_btree2_corder_compare() */ diff --git a/src/H5HFbtree2.c b/src/H5HFbtree2.c index a79bf58..d4a30b8 100644 --- a/src/H5HFbtree2.c +++ b/src/H5HFbtree2.c @@ -74,7 +74,7 @@ static herr_t H5HF__huge_bt2_dst_context(void *ctx); /* Callbacks for indirect objects */ static herr_t H5HF__huge_bt2_indir_store(void *native, const void *udata); -static herr_t H5HF__huge_bt2_indir_compare(const void *rec1, const void *rec2); +static herr_t H5HF__huge_bt2_indir_compare(const void *rec1, const void *rec2, int *result); static herr_t H5HF__huge_bt2_indir_encode(uint8_t *raw, const void *native, void *ctx); static herr_t H5HF__huge_bt2_indir_decode(const uint8_t *raw, void *native, @@ -84,7 +84,7 @@ static herr_t H5HF__huge_bt2_indir_debug(FILE *stream, int indent, int fwidth, /* Callbacks for filtered indirect objects */ static herr_t H5HF__huge_bt2_filt_indir_store(void *native, const void *udata); -static herr_t H5HF__huge_bt2_filt_indir_compare(const void *rec1, const void *rec2); +static herr_t H5HF__huge_bt2_filt_indir_compare(const void *rec1, const void *rec2, int *result); static herr_t H5HF__huge_bt2_filt_indir_encode(uint8_t *raw, const void *native, void *ctx); static herr_t H5HF__huge_bt2_filt_indir_decode(const uint8_t *raw, void *native, @@ -94,7 +94,7 @@ static herr_t H5HF__huge_bt2_filt_indir_debug(FILE *stream, int indent, int fwid /* Callbacks for direct objects */ static herr_t H5HF__huge_bt2_dir_store(void *native, const void *udata); -static herr_t H5HF__huge_bt2_dir_compare(const void *rec1, const void *rec2); +static herr_t H5HF__huge_bt2_dir_compare(const void *rec1, const void *rec2, int *result); static herr_t H5HF__huge_bt2_dir_encode(uint8_t *raw, const void *native, void *ctx); static herr_t H5HF__huge_bt2_dir_decode(const uint8_t *raw, void *native, @@ -104,7 +104,7 @@ static herr_t H5HF__huge_bt2_dir_debug(FILE *stream, int indent, int fwidth, /* Callbacks for filtered direct objects */ static herr_t H5HF__huge_bt2_filt_dir_store(void *native, const void *udata); -static herr_t H5HF__huge_bt2_filt_dir_compare(const void *rec1, const void *rec2); +static herr_t H5HF__huge_bt2_filt_dir_compare(const void *rec1, const void *rec2, int *result); static herr_t H5HF__huge_bt2_filt_dir_encode(uint8_t *raw, const void *native, void *ctx); static herr_t H5HF__huge_bt2_filt_dir_decode(const uint8_t *raw, void *native, @@ -358,11 +358,14 @@ H5HF__huge_bt2_indir_store(void *nrecord, const void *udata) *------------------------------------------------------------------------- */ static herr_t -H5HF__huge_bt2_indir_compare(const void *_rec1, const void *_rec2) +H5HF__huge_bt2_indir_compare(const void *_rec1, const void *_rec2, int *result) { FUNC_ENTER_STATIC_NOERR - FUNC_LEAVE_NOAPI((herr_t)(((const H5HF_huge_bt2_indir_rec_t *)_rec1)->id - ((const H5HF_huge_bt2_indir_rec_t *)_rec2)->id)) + *result = (int)(((const H5HF_huge_bt2_indir_rec_t *)_rec1)->id - + ((const H5HF_huge_bt2_indir_rec_t *)_rec2)->id); + + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF__huge_bt2_indir_compare() */ @@ -558,11 +561,14 @@ H5HF__huge_bt2_filt_indir_store(void *nrecord, const void *udata) *------------------------------------------------------------------------- */ static herr_t -H5HF__huge_bt2_filt_indir_compare(const void *_rec1, const void *_rec2) +H5HF__huge_bt2_filt_indir_compare(const void *_rec1, const void *_rec2, int *result) { FUNC_ENTER_STATIC_NOERR - FUNC_LEAVE_NOAPI((herr_t)(((const H5HF_huge_bt2_filt_indir_rec_t *)_rec1)->id - ((const H5HF_huge_bt2_filt_indir_rec_t *)_rec2)->id)) + *result = (int)(((const H5HF_huge_bt2_filt_indir_rec_t *)_rec1)->id - + ((const H5HF_huge_bt2_filt_indir_rec_t *)_rec2)->id); + + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF__huge_bt2_filt_indir_compare() */ @@ -737,26 +743,25 @@ H5HF__huge_bt2_dir_store(void *nrecord, const void *udata) *------------------------------------------------------------------------- */ static herr_t -H5HF__huge_bt2_dir_compare(const void *_rec1, const void *_rec2) +H5HF__huge_bt2_dir_compare(const void *_rec1, const void *_rec2, int *result) { const H5HF_huge_bt2_dir_rec_t *rec1 = (const H5HF_huge_bt2_dir_rec_t *)_rec1; const H5HF_huge_bt2_dir_rec_t *rec2 = (const H5HF_huge_bt2_dir_rec_t *)_rec2; - herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_STATIC_NOERR if(rec1->addr < rec2->addr) - ret_value = -1; + *result = -1; else if(rec1->addr > rec2->addr) - ret_value = 1; + *result = 1; else if(rec1->len < rec2->len) - ret_value = -1; + *result = -1; else if(rec1->len > rec2->len) - ret_value = 1; + *result = 1; else - ret_value = 0; + *result = 0; - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF__huge_bt2_dir_compare() */ @@ -950,26 +955,25 @@ H5HF__huge_bt2_filt_dir_store(void *nrecord, const void *udata) *------------------------------------------------------------------------- */ static herr_t -H5HF__huge_bt2_filt_dir_compare(const void *_rec1, const void *_rec2) +H5HF__huge_bt2_filt_dir_compare(const void *_rec1, const void *_rec2, int *result) { const H5HF_huge_bt2_filt_dir_rec_t *rec1 = (const H5HF_huge_bt2_filt_dir_rec_t *)_rec1; const H5HF_huge_bt2_filt_dir_rec_t *rec2 = (const H5HF_huge_bt2_filt_dir_rec_t *)_rec2; - herr_t ret_value = FAIL; /* Return value */ FUNC_ENTER_STATIC_NOERR if(rec1->addr < rec2->addr) - ret_value = -1; + *result = -1; else if(rec1->addr > rec2->addr) - ret_value = 1; + *result = 1; else if(rec1->len < rec2->len) - ret_value = -1; + *result = -1; else if(rec1->len > rec2->len) - ret_value = 1; + *result = 1; else - ret_value = 0; + *result = 0; - FUNC_LEAVE_NOAPI(ret_value) + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5HF__huge_bt2_filt_dir_compare() */ diff --git a/src/H5SM.c b/src/H5SM.c index 413ad1f..0b72e40 100644 --- a/src/H5SM.c +++ b/src/H5SM.c @@ -60,7 +60,8 @@ static herr_t H5SM_create_index(H5F_t *f, H5SM_index_header_t *header, static herr_t H5SM_delete_index(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id, hbool_t delete_heap); static haddr_t H5SM_create_list(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id); -static size_t H5SM_find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t *empty_pos); +static herr_t H5SM__find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, + size_t *empty_pos, size_t *list_pos); static herr_t H5SM_convert_list_to_btree(H5F_t * f, H5SM_index_header_t * header, H5SM_list_t **_list, H5HF_t *fheap, H5O_t *open_oh, hid_t dxpl_id); static herr_t H5SM_convert_btree_to_list(H5F_t * f, H5SM_index_header_t * header, hid_t dxpl_id); @@ -1303,7 +1304,9 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, * Also record the first empty list position we find in case we need it * later. */ - list_pos = H5SM_find_in_list(list, &key, &empty_pos); + if(H5SM__find_in_list(list, &key, &empty_pos, &list_pos) < 0) + HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list") + if(defer) { if(list_pos != UFAIL) found = TRUE; @@ -1464,10 +1467,15 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, /* Insert the new message into the SOHM index */ if(header->index_type == H5SM_LIST) { /* Index is a list. Find an empty spot if we haven't already */ - if(empty_pos == UFAIL) - if((H5SM_find_in_list(list, NULL, &empty_pos) == UFAIL) || empty_pos == UFAIL) - HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to find empty entry in list") + if(empty_pos == UFAIL) { + size_t pos; + + if(H5SM__find_in_list(list, NULL, &empty_pos, &pos) < 0) + HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to search for message in list") + if(pos == UFAIL || empty_pos == UFAIL) + HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "unable to find empty entry in list") + } /* Insert message into list */ HDassert(list->messages[empty_pos].location == H5SM_NO_LOC); HDassert(key.message.location != H5SM_NO_LOC); @@ -1610,7 +1618,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5SM_find_in_list + * Function: H5SM__find_in_list * * Purpose: Find a message's location in a list. Also find the first * empty location in the list (since if we don't find the @@ -1630,13 +1638,13 @@ done: * *------------------------------------------------------------------------- */ -static size_t -H5SM_find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t *empty_pos) +static herr_t +H5SM__find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t *empty_pos, size_t *pos) { size_t x; - size_t ret_value = 0; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC HDassert(list); /* Both key and empty_pos can be NULL, but not both! */ @@ -1650,9 +1658,17 @@ H5SM_find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t *e * Also record the first empty position we find. */ for(x = 0; x < list->header->list_max; x++) { - if((list->messages[x].location != H5SM_NO_LOC) && - (0 == H5SM__message_compare(key, &(list->messages[x])))) - HGOTO_DONE(x) + if(list->messages[x].location != H5SM_NO_LOC) { + int cmp; + + if(H5SM__message_compare(key, &(list->messages[x]), &cmp) < 0) + HGOTO_ERROR(H5E_SOHM, H5E_CANTCOMPARE, FAIL, "can't compare message records") + + if(0 == cmp) { + *pos = x; + HGOTO_DONE(SUCCEED) + } + } else if(empty_pos && list->messages[x].location == H5SM_NO_LOC) { /* Note position */ *empty_pos = x; @@ -1663,11 +1679,11 @@ H5SM_find_in_list(const H5SM_list_t *list, const H5SM_mesg_key_t *key, size_t *e } /* end for */ /* If we reached this point, we didn't find the message */ - ret_value = UFAIL; + *pos = UFAIL; done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5SM_find_in_list */ +} /* end H5SM__find_in_list */ /*------------------------------------------------------------------------- @@ -1834,7 +1850,9 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index") /* Find the message in the list */ - if((list_pos = H5SM_find_in_list(list, &key, NULL)) == UFAIL) + if(H5SM__find_in_list(list, &key, NULL, &list_pos) < 0) + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to search for message in list") + if(list_pos == UFAIL) HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") if(list->messages[list_pos].location == H5SM_IN_HEAP) @@ -2217,7 +2235,9 @@ H5SM_get_refcount(H5F_t *f, hid_t dxpl_id, unsigned type_id, HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index") /* Find the message in the list */ - if((list_pos = H5SM_find_in_list(list, &key, NULL)) == UFAIL) + if(H5SM__find_in_list(list, &key, NULL, &list_pos) < 0) + HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "unable to search for message in list") + if(list_pos == UFAIL) HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index") /* Copy the message */ diff --git a/src/H5SMmessage.c b/src/H5SMmessage.c index 426ea20..92b6a75 100644 --- a/src/H5SMmessage.c +++ b/src/H5SMmessage.c @@ -186,13 +186,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5SM__message_compare(const void *rec1, const void *rec2) +H5SM__message_compare(const void *rec1, const void *rec2, int *result) { const H5SM_mesg_key_t *key = (const H5SM_mesg_key_t *) rec1; const H5SM_sohm_t *mesg = (const H5SM_sohm_t *) rec2; - herr_t ret_value = 0; + herr_t ret_value = SUCCEED; - FUNC_ENTER_PACKAGE_NOERR + FUNC_ENTER_PACKAGE /* If the key has an fheap ID, we're looking for a message that's * already in the index; if the fheap ID matches, we've found the message @@ -201,28 +201,31 @@ H5SM__message_compare(const void *rec1, const void *rec2) * message in the index, we've found the message. */ if(mesg->location == H5SM_IN_HEAP && key->message.location == H5SM_IN_HEAP) { - if(key->message.u.heap_loc.fheap_id.val == mesg->u.heap_loc.fheap_id.val) - HGOTO_DONE(0); + if(key->message.u.heap_loc.fheap_id.val == mesg->u.heap_loc.fheap_id.val) { + *result = 0; + HGOTO_DONE(SUCCEED); + } } /* end if */ else if(mesg->location == H5SM_IN_OH && key->message.location == H5SM_IN_OH) { if(key->message.u.mesg_loc.oh_addr == mesg->u.mesg_loc.oh_addr && - key->message.u.mesg_loc.index == mesg->u.mesg_loc.index && - key->message.msg_type_id == mesg->msg_type_id) - HGOTO_DONE(0); + key->message.u.mesg_loc.index == mesg->u.mesg_loc.index && + key->message.msg_type_id == mesg->msg_type_id) { + *result = 0; + HGOTO_DONE(SUCCEED); + } } /* end if */ /* Compare hash values */ if(key->message.hash > mesg->hash) - ret_value = 1; + *result = 1; else if(key->message.hash < mesg->hash) - ret_value = -1; + *result = -1; /* If the hash values match, make sure the messages are really the same */ else { /* Hash values match; compare the encoded message with the one in * the index. */ H5SM_compare_udata_t udata; - herr_t status; HDassert(key->message.hash == mesg->hash); HDassert(key->encoding_size > 0 && key->encoding); @@ -235,8 +238,8 @@ H5SM__message_compare(const void *rec1, const void *rec2) */ if(mesg->location == H5SM_IN_HEAP) { /* Call heap op routine with comparison callback */ - status = H5HF_op(key->fheap, key->dxpl_id, &(mesg->u.heap_loc.fheap_id), H5SM_compare_cb, &udata); - HDassert(status >= 0); + if(H5HF_op(key->fheap, key->dxpl_id, &(mesg->u.heap_loc.fheap_id), H5SM_compare_cb, &udata) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") } /* end if */ else { H5O_loc_t oloc; /* Object owning the message */ @@ -247,8 +250,8 @@ H5SM__message_compare(const void *rec1, const void *rec2) HDassert(mesg->location == H5SM_IN_OH); /* Reset the object location */ - status = H5O_loc_reset(&oloc); - HDassert(status >= 0); + if(H5O_loc_reset(&oloc) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "unable to initialize target location") /* Set up object location */ oloc.file = key->file; @@ -260,11 +263,11 @@ H5SM__message_compare(const void *rec1, const void *rec2) /* Locate the right message and compare with it */ op.op_type = H5O_MESG_OP_LIB; op.u.lib_op = H5SM_compare_iter_op; - status = H5O_msg_iterate(&oloc, mesg->msg_type_id, &op, &udata, key->dxpl_id); - HDassert(status >= 0); + if(H5O_msg_iterate(&oloc, mesg->msg_type_id, &op, &udata, key->dxpl_id) < 0) + HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "error iterating over links") } /* end else */ - ret_value = udata.ret; + *result = udata.ret; } /* end if */ done: diff --git a/src/H5SMpkg.h b/src/H5SMpkg.h index f072741..3b13e23 100644 --- a/src/H5SMpkg.h +++ b/src/H5SMpkg.h @@ -268,7 +268,7 @@ H5_DLLVAR const H5B2_class_t H5SM_INDEX[1]; H5_DLL ssize_t H5SM_get_index(const H5SM_master_table_t *table, unsigned type_id); /* Encode and decode routines, used for B-tree and cache encoding/decoding */ -H5_DLL herr_t H5SM__message_compare(const void *rec1, const void *rec2); +H5_DLL herr_t H5SM__message_compare(const void *rec1, const void *rec2, int *result); H5_DLL herr_t H5SM__message_encode(uint8_t *raw, const void *native, void *ctx); H5_DLL herr_t H5SM__message_decode(const uint8_t *raw, void *native, void *ctx); -- cgit v0.12 From 1b2c30753d214214e67f131322757fe7c6520d1f Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Fri, 19 Feb 2016 09:24:11 -0500 Subject: [svn-r29155] HDFFV-9652: Add fortran wrappers/test for collective metadata functions Tested: h5committest.new --- fortran/src/H5Pff.F90 | 183 +++++++++++++++++++++++++++++++++++++ fortran/src/hdf5_fortrandll.def.in | 4 + fortran/test/tf.F90 | 2 +- fortran/testpar/hyper.f90 | 143 ++++++++++++++++++++--------- fortran/testpar/ptest.f90 | 119 +++++++++--------------- 5 files changed, 330 insertions(+), 121 deletions(-) diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index 6c6abe4..e66a7f2 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -7320,6 +7320,188 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) hdferr = h5pget_mpio_actual_io_mode_c(dxpl_id, actual_io_mode) END SUBROUTINE h5pget_mpio_actual_io_mode_f + +!****s* H5P/h5pset_all_coll_metadata_ops_f +! NAME +! h5pset_all_coll_metadata_ops_f +! +! PURPOSE +! Sets requirement whether HDF5 metadata read operations using the access property +! list are required to be collective or independent. If collective requirement is +! selected, the HDF5 library will optimize the metadata reads improving performance. +! The default setting is independent (false). +! +! INPUTS +! plist_id - File access property list identifier. +! is_collective - Indicates if metadata writes are collective or not. +! OUTPUTS +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! Feb, 10 2016 +! +! HISTORY +! +! SOURCE + SUBROUTINE h5pset_all_coll_metadata_ops_f(plist_id, is_collective, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: plist_id + LOGICAL, INTENT(IN) :: is_collective + INTEGER, INTENT(OUT) :: hdferr +!***** + LOGICAL(C_BOOL) :: c_is_collective + + INTERFACE + INTEGER FUNCTION h5pset_all_coll_metadata_ops(plist_id, is_collective) BIND(C, NAME='H5Pset_all_coll_metadata_ops') + IMPORT :: HID_T, C_BOOL + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN), VALUE :: plist_id + LOGICAL(C_BOOL), INTENT(IN), VALUE :: is_collective + END FUNCTION h5pset_all_coll_metadata_ops + END INTERFACE + + ! Transfer value of Fortran LOGICAL to C c_bool type + c_is_collective = is_collective + + hdferr = INT(H5Pset_all_coll_metadata_ops(plist_id, c_is_collective)) + + END SUBROUTINE h5pset_all_coll_metadata_ops_f + +!****s* H5P/h5pget_all_coll_metadata_ops_f +! NAME +! h5pget_all_coll_metadata_ops_f +! +! PURPOSE +! Retrieves metadata read mode from the access property list. +! +! INPUTS +! plist_id - File access property list identifier. +! OUTPUTS +! is_collective - Collective access setting. +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! Feb, 10 2016 +! +! HISTORY +! +! SOURCE + SUBROUTINE h5pget_all_coll_metadata_ops_f(plist_id, is_collective, hdferr) + + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: plist_id + LOGICAL, INTENT(OUT) :: is_collective + INTEGER, INTENT(OUT) :: hdferr +!***** + LOGICAL(C_BOOL) :: c_is_collective + + INTERFACE + INTEGER FUNCTION h5pget_all_coll_metadata_ops(plist_id, is_collective) BIND(C, NAME='H5Pget_all_coll_metadata_ops') + IMPORT :: HID_T, C_BOOL + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN), VALUE :: plist_id + LOGICAL(C_BOOL), INTENT(OUT) :: is_collective + END FUNCTION h5pget_all_coll_metadata_ops + END INTERFACE + + hdferr = INT(H5Pget_all_coll_metadata_ops(plist_id, c_is_collective)) + + ! Transfer value of C c_bool type to Fortran LOGICAL + is_collective = c_is_collective + + END SUBROUTINE h5pget_all_coll_metadata_ops_f + +!****s* H5P/h5pset_coll_metadata_write_f +! NAME +! h5pset_coll_metadata_write_f +! +! PURPOSE +! Sets metadata writes to collective or independent. Default setting is independent (false). +! +! INPUTS +! fapl_id - File access property list identifier. +! is_collective - Indicates if metadata writes are collective or not. +! OUTPUTS +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! Feb, 10 2016 +! +! HISTORY +! +! SOURCE + SUBROUTINE h5pset_coll_metadata_write_f(plist_id, is_collective, hdferr) + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: plist_id + LOGICAL, INTENT(IN) :: is_collective + INTEGER, INTENT(OUT) :: hdferr +!***** + LOGICAL(C_BOOL) :: c_is_collective + + INTERFACE + INTEGER FUNCTION h5pset_coll_metadata_write(plist_id, is_collective) BIND(C, NAME='H5Pset_coll_metadata_write') + IMPORT :: HID_T, C_BOOL + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN), VALUE :: plist_id + LOGICAL(C_BOOL), INTENT(IN), VALUE :: is_collective + END FUNCTION h5pset_coll_metadata_write + END INTERFACE + + ! Transfer value of Fortran LOGICAL to C c_bool type + c_is_collective = is_collective + + hdferr = INT(H5Pset_coll_metadata_write(plist_id, c_is_collective)) + + END SUBROUTINE h5pset_coll_metadata_write_f + +!****s* H5P/h5pget_coll_metadata_write_f +! NAME +! h5pget_coll_metadata_write_f +! +! PURPOSE +! Retrieves metadata write mode from the file access property list. +! +! INPUTS +! plist_id - File access property list identifier. +! OUTPUTS +! is_collective - Collective access setting. +! hdferr - Returns 0 if successful and -1 if fails. +! +! AUTHOR +! M. Scot Breitenfeld +! Feb, 10 2016 +! +! HISTORY +! +! SOURCE + SUBROUTINE h5pget_coll_metadata_write_f(plist_id, is_collective, hdferr) + + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN) :: plist_id + LOGICAL, INTENT(OUT) :: is_collective + INTEGER, INTENT(OUT) :: hdferr +!***** + LOGICAL(C_BOOL) :: c_is_collective + + INTERFACE + INTEGER FUNCTION h5pget_coll_metadata_write(plist_id, is_collective) BIND(C, NAME='H5Pget_coll_metadata_write') + IMPORT :: HID_T, C_BOOL + IMPLICIT NONE + INTEGER(HID_T) , INTENT(IN), VALUE :: plist_id + LOGICAL(C_BOOL), INTENT(OUT) :: is_collective + END FUNCTION h5pget_coll_metadata_write + END INTERFACE + + hdferr = INT(H5Pget_coll_metadata_write(plist_id, c_is_collective)) + + ! Transfer value of C c_bool type to Fortran LOGICAL + is_collective = c_is_collective + + END SUBROUTINE h5pget_coll_metadata_write_f + #endif ! @@ -7836,6 +8018,7 @@ SUBROUTINE h5pget_virtual_dsetname_f(dcpl_id, index, name, hdferr, name_len) END SUBROUTINE h5pget_virtual_dsetname_f + END MODULE H5P diff --git a/fortran/src/hdf5_fortrandll.def.in b/fortran/src/hdf5_fortrandll.def.in index 42b5642..3a5a91f 100644 --- a/fortran/src/hdf5_fortrandll.def.in +++ b/fortran/src/hdf5_fortrandll.def.in @@ -334,6 +334,10 @@ H5P_mp_H5PGET_VIRTUAL_DSETNAME_F @H5_NOPAREXP@H5P_mp_H5PSET_DXPL_MPIO_F @H5_NOPAREXP@H5P_mp_H5PGET_DXPL_MPIO_F @H5_NOPAREXP@H5P_mp_H5PGET_MPIO_ACTUAL_IO_MODE_F +@H5_NOPAREXP@H5P_mp_H5PSET_ALL_COLL_METADATA_OPS_F +@H5_NOPAREXP@H5P_mp_H5PGET_ALL_COLL_METADATA_OPS_F +@H5_NOPAREXP@H5P_mp_H5PSET_COLL_METADATA_WRITE_F +@H5_NOPAREXP@H5P_mp_H5PGET_COLL_METADATA_WRITE_F ; H5R H5R_mp_H5RCREATE_OBJECT_F H5R_mp_H5RCREATE_REGION_F diff --git a/fortran/test/tf.F90 b/fortran/test/tf.F90 index 7d67f30..f8629ba 100644 --- a/fortran/test/tf.F90 +++ b/fortran/test/tf.F90 @@ -89,7 +89,7 @@ CONTAINS error_string = skip ENDIF - WRITE(*, fmt = '(A, T72, A)') test_title, error_string + WRITE(*, fmt = '(A, T80, A)') test_title, error_string IF(test_result.GT.0) total_error = total_error + test_result diff --git a/fortran/testpar/hyper.f90 b/fortran/testpar/hyper.f90 index a2e2e07..28c0b53 100644 --- a/fortran/testpar/hyper.f90 +++ b/fortran/testpar/hyper.f90 @@ -14,9 +14,9 @@ ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -!////////////////////////////////////////////////////////// +! ! writes/reads dataset by hyperslabs -!////////////////////////////////////////////////////////// +! SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) USE HDF5 @@ -52,14 +52,15 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) CHARACTER(len=80) :: filename ! filename INTEGER :: i INTEGER :: actual_io_mode ! The type of I/O performed by this process - - !////////////////////////////////////////////////////////// + LOGICAL :: is_coll + LOGICAL :: is_coll_true = .TRUE. + ! ! initialize the array data between the processes (3) ! for the 12 size array we get ! p0 = 1,2,3,4 ! p1 = 5,6,7,8 ! p2 = 9,10,11,12 - !////////////////////////////////////////////////////////// + ! ALLOCATE(wbuf(0:length-1),stat=hdferror) IF (hdferror /= 0) THEN @@ -81,17 +82,16 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) wbuf(i) = i ENDDO - !////////////////////////////////////////////////////////// + ! ! HDF5 I/O - !////////////////////////////////////////////////////////// + ! dims(1) = length cdims(1) = length/mpi_size ! define chunks as the number of processes - !////////////////////////////////////////////////////////// + ! ! setup file access property list with parallel I/O access - !////////////////////////////////////////////////////////// - + ! CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl_id, hdferror) CALL check("h5pcreate_f", hdferror, nerrors) @@ -106,14 +106,67 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) nerrors = nerrors + 1 ENDIF - !////////////////////////////////////////////////////////// + ! ! create the file collectively - !////////////////////////////////////////////////////////// - + ! CALL h5_fixname_f("parf1", filename, fapl_id, hdferror) - CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, hdferror, access_prp = fapl_id) - CALL check("h5fcreate_f", hdferror, nerrors) + IF(do_collective)THEN + ! verify settings for file access properties + + ! Collective metadata writes + CALL h5pget_coll_metadata_write_f(fapl_id, is_coll, hdferror) + CALL check("h5pget_coll_metadata_write_f", hdferror, nerrors) + IF(is_coll .NEQV. .FALSE.)THEN + PRINT*, "Incorrect property setting for coll metadata writes" + nerrors = nerrors + 1 + ENDIF + + ! Collective metadata read API calling requirement + CALL h5pget_all_coll_metadata_ops_f(fapl_id, is_coll, hdferror) + CALL check("h5pget_all_coll_metadata_ops_f", hdferror, nerrors) + IF(is_coll .NEQV. .FALSE.)THEN + PRINT*, "Incorrect property setting for coll metadata API calls requirement" + nerrors = nerrors + 1 + ENDIF + + ! Collective metadata writes + CALL h5pset_coll_metadata_write_f(fapl_id, .TRUE., hdferror) + CALL check("h5pset_coll_metadata_write_f", hdferror, nerrors) + ! Collective metadata READ API calling requirement + CALL h5pset_all_coll_metadata_ops_f(fapl_id, is_coll_true, hdferror) + CALL check("h5pset_all_coll_metadata_ops_f", hdferror, nerrors) + + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, hdferror, access_prp = fapl_id) + CALL check("h5fcreate_f", hdferror, nerrors) + + ! close fapl and retrieve it from file + CALL h5pclose_f(fapl_id, hdferror) + CALL check("h5pclose_f", hdferror, nerrors) + CALL h5fget_access_plist_f(file_id, fapl_id, hdferror) + CALL check("h5fget_access_plist_f", hdferror, nerrors) + + ! verify settings for file access properties + + ! Collective metadata writes + CALL h5pget_coll_metadata_write_f(fapl_id, is_coll, hdferror) + CALL check("h5pget_coll_metadata_write_f", hdferror, nerrors) + IF(is_coll .NEQV. .TRUE.)THEN + PRINT*, "Incorrect property setting for coll metadata writes" + nerrors = nerrors + 1 + ENDIF + + ! Collective metadata read API calling requirement + CALL h5pget_all_coll_metadata_ops_f(fapl_id, is_coll, hdferror) + CALL check("h5pget_all_coll_metadata_ops_f", hdferror, nerrors) + IF(is_coll .NEQV. .TRUE.)THEN + PRINT*, "Incorrect property setting for coll metadata API calls requirement" + nerrors = nerrors + 1 + ENDIF + ELSE + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, hdferror, access_prp = fapl_id) + CALL check("h5fcreate_f", hdferror, nerrors) + ENDIF CALL h5screate_simple_f(1, dims, fspace_id, hdferror) CALL check("h5screate_simple_f", hdferror, nerrors) @@ -121,9 +174,9 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) CALL h5screate_simple_f(1, dims, mspace_id, hdferror) CALL check("h5screate_simple_f", hdferror, nerrors) - !////////////////////////////////////////////////////////// + ! ! modify dataset creation properties to enable chunking - !////////////////////////////////////////////////////////// + ! CALL h5pcreate_f(H5P_DATASET_CREATE_F, dcpl_id, hdferror) CALL check("h5pcreate_f", hdferror, nerrors) @@ -133,38 +186,38 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) CALL check("h5pset_chunk_f", hdferror, nerrors) ENDIF - !////////////////////////////////////////////////////////// + ! ! create the dataset - !////////////////////////////////////////////////////////// + ! CALL h5dcreate_f(file_id, "dset", H5T_NATIVE_INTEGER, fspace_id, dset_id, hdferror, dcpl_id) CALL check("h5dcreate_f", hdferror, nerrors) - !////////////////////////////////////////////////////////// + ! ! define hyperslab - !////////////////////////////////////////////////////////// + ! counti(1) = icount start(1) = istart - !////////////////////////////////////////////////////////// + ! ! select hyperslab in memory - !////////////////////////////////////////////////////////// + ! CALL h5sselect_hyperslab_f(mspace_id, H5S_SELECT_SET_F, start, counti, hdferror) CALL check("h5sselect_hyperslab_f", hdferror, nerrors) - !////////////////////////////////////////////////////////// + ! ! select hyperslab in the file - !////////////////////////////////////////////////////////// + ! CALL h5sselect_hyperslab_f(fspace_id, H5S_SELECT_SET_F, start, counti, hdferror) CALL check("h5sselect_hyperslab_f", hdferror, nerrors) - !////////////////////////////////////////////////////////// + ! ! create a property list for collective dataset write - !////////////////////////////////////////////////////////// + ! CALL h5pcreate_f(H5P_DATASET_XFER_F, dxpl_id, hdferror) CALL check("h5pcreate_f", hdferror, nerrors) @@ -174,9 +227,9 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) CALL check("h5pset_dxpl_mpio_f", hdferror, nerrors) ENDIF - !////////////////////////////////////////////////////////// + ! ! write dataset - !////////////////////////////////////////////////////////// + ! CALL h5dwrite_f(dset_id,H5T_NATIVE_INTEGER,wbuf,dims,hdferror,file_space_id=fspace_id,mem_space_id=mspace_id,xfer_prp=dxpl_id) CALL check("h5dwrite_f", hdferror, nerrors) @@ -200,9 +253,9 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) ENDIF ENDIF - !////////////////////////////////////////////////////////// + ! ! close HDF5 I/O - !////////////////////////////////////////////////////////// + ! CALL h5pclose_f(fapl_id, hdferror) CALL check("h5pclose_f", hdferror, nerrors) @@ -225,9 +278,9 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) CALL h5fclose_f(file_id, hdferror) CALL check("h5fclose_f", hdferror, nerrors) - !////////////////////////////////////////////////////////// + ! ! reopen file with read access - !////////////////////////////////////////////////////////// + ! CALL h5pcreate_f(H5P_FILE_ACCESS_F, fapl_id, hdferror) CALL check("h5pcreate_f", hdferror, nerrors) @@ -247,23 +300,23 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) CALL h5dopen_f(file_id, "dset", dset_id, hdferror) CALL check("h5pcreate_f", hdferror, nerrors) - !////////////////////////////////////////////////////////// + ! ! select hyperslab in memory - !////////////////////////////////////////////////////////// + ! CALL h5sselect_hyperslab_f(mspace_id, H5S_SELECT_SET_F, start, counti, hdferror) CALL check("h5pcreate_f", hdferror, nerrors) - !////////////////////////////////////////////////////////// + ! ! select hyperslab in the file - !////////////////////////////////////////////////////////// + ! CALL h5sselect_hyperslab_f(fspace_id, H5S_SELECT_SET_F, start, counti, hdferror) CALL check("h5pcreate_f", hdferror, nerrors) - !////////////////////////////////////////////////////////// + ! ! create a property list for collective dataset read - !////////////////////////////////////////////////////////// + ! CALL h5pcreate_f(H5P_DATASET_XFER_F, dxpl_id, hdferror) CALL check("h5pcreate_f", hdferror, nerrors) @@ -273,16 +326,16 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) CALL check("h5pcreate_f", hdferror, nerrors) ENDIF - !////////////////////////////////////////////////////////// + ! ! read dataset - !////////////////////////////////////////////////////////// + ! CALL h5dread_f(dset_id,H5T_NATIVE_INTEGER,rbuf,dims,hdferror,file_space_id=fspace_id,mem_space_id=mspace_id,xfer_prp=dxpl_id) CALL check("h5pcreate_f", hdferror, nerrors) - !////////////////////////////////////////////////////////// + ! ! close HDF5 I/O - !////////////////////////////////////////////////////////// + ! CALL h5pclose_f(fapl_id, hdferror) CALL check("h5pcreate_f", hdferror, nerrors) @@ -302,9 +355,9 @@ SUBROUTINE hyper(length,do_collective,do_chunk, mpi_size, mpi_rank, nerrors) CALL h5fclose_f(file_id, hdferror) CALL check("h5pcreate_f", hdferror, nerrors) - !////////////////////////////////////////////////////////// + ! ! compare read and write data. each process compares a subset of the array - !////////////////////////////////////////////////////////// + ! DO i = istart, iend-1 IF( wbuf(i) /= rbuf(i)) THEN diff --git a/fortran/testpar/ptest.f90 b/fortran/testpar/ptest.f90 index 69594b0..82dcc09 100644 --- a/fortran/testpar/ptest.f90 +++ b/fortran/testpar/ptest.f90 @@ -13,29 +13,35 @@ ! access to either file, you may request a copy from help@hdfgroup.org. * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -!////////////////////////////////////////////////////////// +! ! main program for parallel HDF5 Fortran tests -!////////////////////////////////////////////////////////// +! PROGRAM parallel_test USE hdf5 + USE MPI + USE TH5_MISC IMPLICIT NONE - INCLUDE 'mpif.h' INTEGER :: mpierror ! MPI hdferror flag INTEGER :: hdferror ! HDF hdferror flag - LOGICAL :: do_collective ! use collective MPI I/O - LOGICAL :: do_chunk ! use chunking - INTEGER :: nerrors = 0 ! number of errors + INTEGER :: ret_total_error = 0 ! number of errors in subroutine + INTEGER :: total_error = 0 ! sum of the number of errors INTEGER :: mpi_size ! number of processes in the group of communicator INTEGER :: mpi_rank ! rank of the calling process in the communicator INTEGER :: length = 12000 ! length of array - - !////////////////////////////////////////////////////////// + INTEGER :: i,j + ! use collective MPI I/O + LOGICAL, DIMENSION(1:2) :: do_collective = (/.FALSE.,.TRUE./) + CHARACTER(LEN=11), DIMENSION(1:2) :: chr_collective =(/"independent", "collective "/) + ! use chunking + LOGICAL, DIMENSION(1:2) :: do_chunk = (/.FALSE.,.TRUE./) + CHARACTER(LEN=10), DIMENSION(1:2) :: chr_chunk =(/"contiguous", "chunk "/) + + ! ! initialize MPI - !////////////////////////////////////////////////////////// - + ! CALL mpi_init(mpierror) IF (mpierror .NE. MPI_SUCCESS) THEN WRITE(*,*) "MPI_INIT *FAILED*" @@ -48,74 +54,40 @@ PROGRAM parallel_test IF (mpierror .NE. MPI_SUCCESS) THEN WRITE(*,*) "MPI_COMM_SIZE *FAILED* Process = ", mpi_rank ENDIF - !////////////////////////////////////////////////////////// + ! ! initialize the HDF5 fortran interface - !////////////////////////////////////////////////////////// - + ! CALL h5open_f(hdferror) - - !////////////////////////////////////////////////////////// - ! test write/read dataset by hyperslabs with independent MPI I/O - !////////////////////////////////////////////////////////// - - IF (mpi_rank == 0) WRITE(*,*) 'Writing/reading dataset by hyperslabs (contiguous layout, independent MPI I/O)' - - do_collective = .FALSE. - do_chunk = .FALSE. - CALL hyper(length, do_collective, do_chunk, mpi_size, mpi_rank, nerrors) - - !////////////////////////////////////////////////////////// - ! test write/read dataset by hyperslabs with collective MPI I/O - !////////////////////////////////////////////////////////// - - IF (mpi_rank == 0) WRITE(*,*) 'Writing/reading dataset by hyperslabs (contiguous layout, collective MPI I/O)' - - do_collective = .TRUE. - do_chunk = .FALSE. - CALL hyper(length, do_collective, do_chunk, mpi_size, mpi_rank, nerrors) - - !////////////////////////////////////////////////////////// - ! test write/read dataset by hyperslabs with independent MPI I/O - !////////////////////////////////////////////////////////// - - IF (mpi_rank == 0) WRITE(*,*) 'Writing/reading dataset by hyperslabs (chunk layout, independent MPI I/O)' - - do_collective = .FALSE. - do_chunk = .TRUE. - CALL hyper(length, do_collective, do_chunk, mpi_size, mpi_rank, nerrors) - - !////////////////////////////////////////////////////////// - ! test write/read dataset by hyperslabs with collective MPI I/O - !////////////////////////////////////////////////////////// - - IF (mpi_rank == 0) WRITE(*,*) 'Writing/reading dataset by hyperslabs (chunk layout, collective MPI I/O)' - - do_collective = .TRUE. - do_chunk = .TRUE. - CALL hyper(length, do_collective, do_chunk, mpi_size, mpi_rank, nerrors) - - !////////////////////////////////////////////////////////// + ! + ! test write/read dataset by hyperslabs (contiguous/chunk) with independent/collective MPI I/O + ! + DO i = 1, 2 + DO j = 1, 2 + ret_total_error = 0 + CALL hyper(length, do_collective(j), do_chunk(i), mpi_size, mpi_rank, ret_total_error) + IF(mpi_rank==0) CALL write_test_status(ret_total_error, & + "Writing/reading dataset by hyperslabs ("//TRIM(chr_chunk(i))//" layout, "//TRIM(chr_collective(j))//" MPI I/O)", & + total_error) + ENDDO + ENDDO + + ! ! test write/read several datasets (independent MPI I/O) - !////////////////////////////////////////////////////////// - - IF (mpi_rank == 0) WRITE(*,*) 'Writing/reading several datasets (contiguous layout, independent MPI I/O)' - - do_collective = .FALSE. - do_chunk = .FALSE. - CALL multiple_dset_write(length, do_collective, do_chunk, mpi_size, mpi_rank, nerrors) + ! + ret_total_error = 0 + CALL multiple_dset_write(length, do_collective(1), do_chunk(1), mpi_size, mpi_rank, ret_total_error) + IF(mpi_rank==0) CALL write_test_status(ret_total_error, & + 'Writing/reading several datasets (contiguous layout, independent MPI I/O)', total_error) - - !////////////////////////////////////////////////////////// + ! ! close HDF5 interface - !////////////////////////////////////////////////////////// - + ! CALL h5close_f(hdferror) - !////////////////////////////////////////////////////////// + ! ! close MPI - !////////////////////////////////////////////////////////// - - IF (nerrors == 0) THEN + ! + IF (total_error == 0) THEN CALL mpi_finalize(mpierror) IF (mpierror .NE. MPI_SUCCESS) THEN WRITE(*,*) "MPI_FINALIZE *FAILED* Process = ", mpi_rank @@ -127,10 +99,7 @@ PROGRAM parallel_test WRITE(*,*) "MPI_ABORT *FAILED* Process = ", mpi_rank ENDIF ENDIF - - !////////////////////////////////////////////////////////// + ! ! end main program - !////////////////////////////////////////////////////////// - + ! END PROGRAM parallel_test - -- cgit v0.12 From 70c24f201ca18a99cbe0817abab54ae83d93722d Mon Sep 17 00:00:00 2001 From: Mike McGreevy Date: Fri, 19 Feb 2016 11:21:00 -0500 Subject: [svn-r29158] HDFFV-9190: Changed configure.ac to define H5_USE_18_API_DEFAULT when 'v18' is provided to --with-default-api-version. Tested: h5committest.new and kituo with --with-default-api-version=v18 --- configure.ac | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure.ac b/configure.ac index 8f84a72..54ad5a2 100644 --- a/configure.ac +++ b/configure.ac @@ -3168,6 +3168,8 @@ if test "X$withval" = "Xv16"; then elif test "X$withval" = "Xv18"; then AC_MSG_RESULT([v18]) DEFAULT_API_VERSION=v18 + AC_DEFINE([USE_18_API_DEFAULT], [1], + [Define using v1.8 public API symbols by default]) elif test "X$withval" = "Xv110"; then AC_MSG_RESULT([v110]) DEFAULT_API_VERSION=v110 -- cgit v0.12 From f4430184abd72e829e6f09dfa5dd2e8ffbaa95f1 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Fri, 19 Feb 2016 13:10:27 -0500 Subject: [svn-r29162] added robodoc header information --- fortran/src/H5Pff.F90 | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/fortran/src/H5Pff.F90 b/fortran/src/H5Pff.F90 index e66a7f2..e052ea0 100644 --- a/fortran/src/H5Pff.F90 +++ b/fortran/src/H5Pff.F90 @@ -7508,7 +7508,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) ! V I R T U A L D A T S E T S ! -!****s* +!****s* H5P/h5pset_virtual_view_f ! NAME ! h5pset_virtual_view_f ! @@ -7553,7 +7553,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) END SUBROUTINE h5pset_virtual_view_f -!****s* +!****s* H5P/h5pget_virtual_view_f ! NAME ! h5pget_virtual_view_f ! @@ -7597,7 +7597,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) END SUBROUTINE h5pget_virtual_view_f -!****s* +!****s* H5P/h5pset_virtual_printf_gap_f ! NAME ! h5pset_virtual_printf_gap_f ! @@ -7639,7 +7639,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) END SUBROUTINE h5pset_virtual_printf_gap_f -!****s* +!****s* H5P/h5pget_virtual_printf_gap_f ! NAME ! h5pget_virtual_printf_gap_f ! @@ -7682,7 +7682,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) END SUBROUTINE h5pget_virtual_printf_gap_f -!****s* +!****s* H5P/h5pset_virtual_f ! NAME ! h5pset_virtual_f ! @@ -7742,7 +7742,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) END SUBROUTINE h5pset_virtual_f -!****s* +!****s* H5P/h5pget_virtual_count_f ! NAME ! h5pget_virtual_count_f ! @@ -7783,7 +7783,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) END SUBROUTINE h5pget_virtual_count_f -!****s* +!****s* H5P/h5pget_virtual_vspace_f ! NAME ! h5pget_virtual_vspace_f ! @@ -7831,7 +7831,7 @@ SUBROUTINE h5pset_attr_phase_change_f(ocpl_id, max_compact, min_dense, hdferr) END SUBROUTINE h5pget_virtual_vspace_f -!****s* +!****s* H5P/h5pget_virtual_srcspace_f ! NAME ! h5pget_virtual_srcspace_f ! @@ -7881,7 +7881,7 @@ SUBROUTINE h5pget_virtual_srcspace_f(dcpl_id, index, ds_id, hdferr) END SUBROUTINE h5pget_virtual_srcspace_f -!****s* +!****s* H5P/h5pget_virtual_filename_f ! NAME ! h5pget_virtual_filename_f ! @@ -7947,10 +7947,9 @@ SUBROUTINE h5pget_virtual_filename_f(dcpl_id, index, name, hdferr, name_len) ENDIF - END SUBROUTINE h5pget_virtual_filename_f -!****s* +!****s* H5P/h5pget_virtual_dsetname_f ! NAME ! h5pget_virtual_dsetname_f ! -- cgit v0.12 From 0859dd40bb0cfb45933d5def97178e6e389bf160 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Fri, 19 Feb 2016 13:11:26 -0500 Subject: [svn-r29163] changed robodoc specs to look for .F90 files --- fortran/robodoc.rc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/fortran/robodoc.rc b/fortran/robodoc.rc index 07b8b35..b24e4f9 100644 --- a/fortran/robodoc.rc +++ b/fortran/robodoc.rc @@ -132,10 +132,7 @@ ignore files: *.o *e *.mod - *_F90.f90 *.c accept files: - *_F03.f90 - *_F90.f90 - *.f90 + *.F90 *.h -- cgit v0.12 From 5126111606cf941ead418a81be4a18eb78dd0236 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Fri, 19 Feb 2016 14:09:34 -0500 Subject: [svn-r29165] Various rododoc fixes. Effects comments only. --- fortran/src/H5_buildiface.F90 | 40 ++----------------------------------- fortran/src/H5fortkit.F90 | 10 +++++++++- fortran/test/H5_test_buildiface.F90 | 6 +++--- fortran/test/tH5F_F03.F90 | 4 ++-- fortran/test/tH5P_F03.F90 | 7 +++---- fortran/test/tHDF5.F90 | 2 +- fortran/test/tHDF5_1_8.F90 | 2 +- fortran/test/tHDF5_F03.F90 | 2 +- 8 files changed, 22 insertions(+), 51 deletions(-) diff --git a/fortran/src/H5_buildiface.F90 b/fortran/src/H5_buildiface.F90 index 471052f..d58b384 100644 --- a/fortran/src/H5_buildiface.F90 +++ b/fortran/src/H5_buildiface.F90 @@ -717,45 +717,9 @@ PROGRAM H5_buildiface WRITE(11,'(A)') ' file_space_id_default, xfer_prp_default, f_ptr)' WRITE(11,'(A)') ' END SUBROUTINE h5dread_ckind_rank'//chr_rank(j) ENDDO -! +!********************** ! h5dwrite_f - -!****s* H5D (F03)/h5dwrite_f_F03 -! -! NAME -! h5dwrite_f_F03 -! -! PURPOSE -! Writes raw data from a dataset into a buffer. -! -! Inputs: -! dset_id - Identifier of the dataset to write to. -! mem_type_id - Identifier of the memory datatype. -! buf - Buffer with data to be written to the file. -! -! Outputs: -! hdferr - Returns 0 if successful and -1 if fails -! -! Optional parameters: -! mem_space_id - Identifier of the memory dataspace. -! file_space_id - Identifier of the dataset's dataspace in the file. -! xfer_prp - Identifier of a transfer property list for this I/O operation. -! -! AUTHOR -! M. Scot Breitenfeld -! September 17, 2011 -! -! Fortran2003 Interface: -!! SUBROUTINE h5dwrite_f(dset_id, mem_type_id, buf, hdferr, & -!! mem_space_id, file_space_id, xfer_prp) -!! INTEGER(HID_T), INTENT(IN) :: dset_id -!! INTEGER(HID_T), INTENT(IN) :: mem_type_id -!! TYPE(C_PTR) , INTENT(IN) :: buf -!! INTEGER , INTENT(OUT) :: hdferr -!! INTEGER(HID_T), INTENT(IN) , OPTIONAL :: mem_space_id -!! INTEGER(HID_T), INTENT(IN) , OPTIONAL :: file_space_id -!! INTEGER(HID_T), INTENT(IN) , OPTIONAL :: xfer_prp -!***** +!********************** DO i = 1, num_rkinds k = rkind(i) WRITE(chr2,'(I2)') k diff --git a/fortran/src/H5fortkit.F90 b/fortran/src/H5fortkit.F90 index 9afd890..3062c28 100644 --- a/fortran/src/H5fortkit.F90 +++ b/fortran/src/H5fortkit.F90 @@ -1,4 +1,11 @@ -!****h* H5fortkit/H5fortkit +!****h* ROBODoc/H5fortkit +! +! NAME +! MODULE H5fortkit +! +! FILE +! fortran/src/H5fortkit.F90 +! ! PURPOSE ! Routines to deal with C-FORTRAN issues. ! @@ -18,6 +25,7 @@ ! access to either file, you may request a copy from help@hdfgroup.org. * ! * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ! +!***** MODULE H5fortkit CONTAINS diff --git a/fortran/test/H5_test_buildiface.F90 b/fortran/test/H5_test_buildiface.F90 index 30687df..e0323cc 100644 --- a/fortran/test/H5_test_buildiface.F90 +++ b/fortran/test/H5_test_buildiface.F90 @@ -1,10 +1,10 @@ -!****p* Program/H5_buildiface +!****p* Program/H5_test_buildiface ! ! NAME -! Executable: H5_buildiface +! Executable: H5_test_buildiface ! ! FILE -! fortran/src/H5_buildiface.f90 +! fortran/src/H5_test_buildiface.F90 ! ! PURPOSE ! This stand alone program is used at build time to generate the program diff --git a/fortran/test/tH5F_F03.F90 b/fortran/test/tH5F_F03.F90 index 9e23d19..2425bba 100644 --- a/fortran/test/tH5F_F03.F90 +++ b/fortran/test/tH5F_F03.F90 @@ -1,7 +1,7 @@ -!****h* root/fortran/test/tH5F_F03.f90 +!****h* root/fortran/test/tH5F_F03 ! ! NAME -! tH5F_F03.f90 +! tH5F_F03.F90 ! ! FUNCTION ! Test FORTRAN HDF5 H5F APIs which are dependent on FORTRAN 2003 diff --git a/fortran/test/tH5P_F03.F90 b/fortran/test/tH5P_F03.F90 index 15bd86f..f64c4e3 100644 --- a/fortran/test/tH5P_F03.F90 +++ b/fortran/test/tH5P_F03.F90 @@ -1,7 +1,7 @@ -!****h* root/fortran/test/tH5P_F03.f90 +!****h* root/fortran/test/TH5P_F03 ! ! NAME -! tH5P_F03.f90 +! tH5P_F03.F90 ! ! FUNCTION ! Test FORTRAN HDF5 H5P APIs which are dependent on FORTRAN 2003 @@ -618,8 +618,7 @@ SUBROUTINE external_test_offset(cleanup,total_error) END SUBROUTINE external_test_offset -!****h* root/fortran/test/tH5P_F03.f90 -! +!------------------------------------------------------------------------- ! NAME ! test_vds ! diff --git a/fortran/test/tHDF5.F90 b/fortran/test/tHDF5.F90 index d12bb25..e9e0892 100644 --- a/fortran/test/tHDF5.F90 +++ b/fortran/test/tHDF5.F90 @@ -1,4 +1,4 @@ -!****h* ROBODoc/HDF5 +!****h* ROBODoc/THDF5 ! ! NAME ! MODULE THDF5 diff --git a/fortran/test/tHDF5_1_8.F90 b/fortran/test/tHDF5_1_8.F90 index 9d1c3ec..6a3f74b 100644 --- a/fortran/test/tHDF5_1_8.F90 +++ b/fortran/test/tHDF5_1_8.F90 @@ -1,4 +1,4 @@ -!****h* ROBODoc/HDF5 +!****h* ROBODoc/THDF5_1_8 ! ! NAME ! MODULE THDF5_1_8 diff --git a/fortran/test/tHDF5_F03.F90 b/fortran/test/tHDF5_F03.F90 index 3dbec11..b3b1885 100644 --- a/fortran/test/tHDF5_F03.F90 +++ b/fortran/test/tHDF5_F03.F90 @@ -1,4 +1,4 @@ -!****h* ROBODoc/HDF5 +!****h* ROBODoc/THDF5_F03 ! ! NAME ! MODULE THDF5_F03 -- cgit v0.12 From 553374e665ac2a8ed1e9ebf412b234f50123f12d Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Fri, 19 Feb 2016 15:39:11 -0500 Subject: [svn-r29169] Changed #ifdef to use H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE instead of H5_FORTRAN_HAVE_C_LONG_DOUBLE Tested: jam (gnu) --- fortran/src/H5Dff.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fortran/src/H5Dff.F90 b/fortran/src/H5Dff.F90 index b372dc1..cb0b292 100644 --- a/fortran/src/H5Dff.F90 +++ b/fortran/src/H5Dff.F90 @@ -172,7 +172,7 @@ MODULE H5D MODULE PROCEDURE h5dfill_integer MODULE PROCEDURE h5dfill_c_float MODULE PROCEDURE h5dfill_c_double -#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE +#if H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE!=0 MODULE PROCEDURE h5dfill_c_long_double #endif MODULE PROCEDURE h5dfill_char @@ -1753,7 +1753,7 @@ CONTAINS END SUBROUTINE h5dfill_c_double -#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE +#if H5_FORTRAN_C_LONG_DOUBLE_IS_UNIQUE!=0 SUBROUTINE h5dfill_c_long_double(fill_value, space_id, buf, hdferr) IMPLICIT NONE REAL(KIND=C_LONG_DOUBLE), INTENT(IN), TARGET :: fill_value ! Fill value -- cgit v0.12 From fe2b65f3e44057bf1155cd82d1d87169c6e09a5c Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Fri, 19 Feb 2016 16:12:32 -0500 Subject: [svn-r29172] Fixed double word typo in #ifdef H5_FORTRAN_HAVE_C_SIZEOF --- fortran/test/tf.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fortran/test/tf.F90 b/fortran/test/tf.F90 index f8629ba..e9baf43 100644 --- a/fortran/test/tf.F90 +++ b/fortran/test/tf.F90 @@ -336,7 +336,7 @@ CONTAINS IMPLICIT NONE TYPE(comp_datatype), INTENT(in) :: a -#ifdef H5_FORTRAN_FORTRAN_HAVE_C_SIZEOF +#ifdef H5_FORTRAN_HAVE_C_SIZEOF H5_SIZEOF_CMPD = C_SIZEOF(a) #else H5_SIZEOF_CMPD = SIZEOF(a) -- cgit v0.12 From 910d4204098e4ad4b27dc037fa0bab977af2b59e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 22 Feb 2016 11:57:07 -0500 Subject: [svn-r29177] HDFFV-9654: add VDS options to h5dump --- tools/h5dump/CMakeTestsVDS.cmake | 28 ++ tools/h5dump/h5dump.c | 16 +- tools/h5dump/h5dump.h | 2 + tools/h5dump/h5dump_ddl.c | 306 ++++++++++++--------- tools/h5dump/h5dump_extern.h | 2 + tools/h5dump/testh5dumpvds.sh.in | 18 ++ tools/h5repack/CMakeLists.txt | 6 +- tools/lib/CMakeLists.txt | 2 +- tools/testfiles/h5dump-help.txt | 2 + .../pbits/tnofilename-with-packed-bits.ddl | 2 + tools/testfiles/pbits/tpbitsIncomplete.ddl | 2 + tools/testfiles/pbits/tpbitsLengthExceeded.ddl | 2 + tools/testfiles/pbits/tpbitsLengthPositive.ddl | 2 + tools/testfiles/pbits/tpbitsMaxExceeded.ddl | 2 + tools/testfiles/pbits/tpbitsOffsetExceeded.ddl | 2 + tools/testfiles/pbits/tpbitsOffsetNegative.ddl | 2 + 16 files changed, 257 insertions(+), 139 deletions(-) diff --git a/tools/h5dump/CMakeTestsVDS.cmake b/tools/h5dump/CMakeTestsVDS.cmake index 58287fa..cc68896 100644 --- a/tools/h5dump/CMakeTestsVDS.cmake +++ b/tools/h5dump/CMakeTestsVDS.cmake @@ -22,6 +22,11 @@ tvds_layout-3_2.ddl tvds_layout-4.ddl tvds_layout-5.ddl + vds-first.ddl + vds-gap1.ddl + vds-gap2.ddl + vds_layout-eiger.ddl + vds_layout-maxmin.ddl ) set (HDF5_REFERENCE_TEST_VDS 1_a.h5 @@ -47,6 +52,14 @@ 5_b.h5 5_c.h5 5_vds.h5 + a.h5 + b.h5 + c.h5 + d.h5 + vds-percival-unlim-maxmin.h5 + f-0.h5 + f-3.h5 + vds-eiger.h5 ) set (HDF5_ERROR_REFERENCE_VDS ) @@ -184,6 +197,12 @@ tvds-4.out.err tvds-5.out tvds-5.out.err + vds-first.out + vds-first.out.err + vds-gap1.out + vds-gap1.out.err + vds-gap2.out + vds-gap2.out.err tvds_layout-1.out tvds_layout-1.out.err tvds_layout-2.out @@ -196,6 +215,10 @@ tvds_layout-4.out.err tvds_layout-5.out tvds_layout-5.out.err + vds_layout-eiger.out + vds_layout-eiger.out.err + vds_layout-maxmin.out + vds_layout-maxmin.out.err ) set_tests_properties (H5DUMP_VDS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") if (NOT "${last_vds_test}" STREQUAL "") @@ -225,6 +248,9 @@ ADD_H5_VDS_TEST (tvds-3_2 0 --enable-error-stack 3_2_vds.h5) ADD_H5_VDS_TEST (tvds-4 0 --enable-error-stack 4_vds.h5) ADD_H5_VDS_TEST (tvds-5 0 --enable-error-stack 5_vds.h5) + ADD_H5_VDS_TEST (vds-first 0 --vds-view-first-missing --enable-error-stack vds-percival-unlim-maxmin.h5) + ADD_H5_VDS_TEST (vds-gap1 0 -d /VDS-Eiger --vds-gap-size=1 --enable-error-stack vds-eiger.h5) + ADD_H5_VDS_TEST (vds-gap2 0 --vds-gap-size=2 --enable-error-stack vds-eiger.h5) endif (USE_FILTER_DEFLATE) # Layout read @@ -235,4 +261,6 @@ ADD_H5_VDS_LAYOUT (tvds_layout-3_2 0 --enable-error-stack 3_2_vds.h5) ADD_H5_VDS_LAYOUT (tvds_layout-4 0 --enable-error-stack 4_vds.h5) ADD_H5_VDS_LAYOUT (tvds_layout-5 0 --enable-error-stack 5_vds.h5) + ADD_H5_VDS_LAYOUT (vds_layout-eiger 0 --enable-error-stack vds-eiger.h5) + ADD_H5_VDS_LAYOUT (vds_layout-maxmin 0 --enable-error-stack vds-percival-unlim-maxmin.h5) endif (USE_FILTER_DEFLATE) diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index ffba581..7c24fa4 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -71,7 +71,7 @@ struct handler_t { */ /* The following initialization makes use of C language cancatenating */ /* "xxx" "yyy" into "xxxyyy". */ -static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RECM:O*N:"; +static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RECM:O*N:vG:"; static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "hel", no_arg, 'h' }, @@ -190,6 +190,8 @@ static struct long_options l_opts[] = { { "no-compact-subset", no_arg, 'C' }, { "ddl", optional_arg, 'O' }, { "any_path", require_arg, 'N' }, + { "vds-view-first-missing", no_arg, 'v' }, + { "vds-gap-size", require_arg, 'G' }, { NULL, 0, '\0' } }; @@ -256,6 +258,8 @@ usage(const char *prog) PRINTVALSTREAM(rawoutstream, " P can be the absolute path or just a relative path.\n"); PRINTVALSTREAM(rawoutstream, " -A, --onlyattr Print the header and value of attributes\n"); PRINTVALSTREAM(rawoutstream, " Optional value 0 suppresses printing attributes.\n"); + PRINTVALSTREAM(rawoutstream, " --vds-view-first-missing Set the VDS bounds to first missing mapped elements.\n"); + PRINTVALSTREAM(rawoutstream, " --vds-gap-size=N Set the missing file gap size, N=non-negative integers\n"); PRINTVALSTREAM(rawoutstream, "--------------- Object Property Options ---------------\n"); PRINTVALSTREAM(rawoutstream, " -i, --object-ids Print the object ids\n"); PRINTVALSTREAM(rawoutstream, " -p, --properties Print dataset filters, storage layout and fill value\n"); @@ -1121,6 +1125,16 @@ parse_start: } display_packed_bits = TRUE; break; + case 'v': + display_vds_first = TRUE; + break; + case 'G': + vds_gap_size = HDatoi(opt_arg); + if (vds_gap_size < 0) { + usage(h5tools_getprogname()); + goto error; + } + break; /** begin XML parameters **/ case 'x': diff --git a/tools/h5dump/h5dump.h b/tools/h5dump/h5dump.h index 2b1fb04..7cf4efd 100644 --- a/tools/h5dump/h5dump.h +++ b/tools/h5dump/h5dump.h @@ -78,6 +78,8 @@ int enable_error_stack= FALSE; /* re-enable error stack */ int disable_compact_subset= FALSE; /* disable compact form of subset notation */ int display_packed_bits = FALSE; /*print 1-8 byte numbers as packed bits*/ int include_attrs = TRUE; /* Display attributes */ +int display_vds_first = FALSE; /* vds display to all by default*/ +int vds_gap_size = 0; /* vds skip missing files default is none */ /* sort parameters */ H5_index_t sort_by = H5_INDEX_NAME; /*sort_by [creation_order | name] */ diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c index fd50710..09751ab 100644 --- a/tools/h5dump/h5dump_ddl.c +++ b/tools/h5dump/h5dump_ddl.c @@ -26,12 +26,12 @@ typedef struct { hid_t fid; /* File ID being traversed */ - char *op_name; /* Object name wanted */ + char *op_name; /* Object name wanted */ } trav_handle_udata_t; typedef struct { - char *path; /* Path of object being searched */ - char *op_name; /* Object name wanted */ + char *path; /* Path of object being searched */ + char *op_name; /* Object name wanted */ } trav_attr_udata_t; /* callback function used by H5Literate() */ @@ -90,7 +90,7 @@ dump_dataspace(hid_t space) HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + h5tools_dump_dataspace(rawoutstream, outputformat, &ctx, space); } @@ -117,19 +117,19 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED * h5tools_context_t ctx; /* print context */ h5tool_format_t *outputformat = &h5tools_dataformat; h5tool_format_t string_dataformat; - + hid_t attr_id; herr_t ret = SUCCEED; HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT); oid_output = display_oid; data_output = display_data; attr_data_output = display_attr_data; - + string_dataformat = *outputformat; if (fp_format) { @@ -155,7 +155,7 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED * h5tools_setstatus(EXIT_FAILURE); ret = FAIL; } - + return ret; } @@ -185,6 +185,7 @@ static herr_t dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR_UNUSED *op_data) { hid_t obj; + hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */ herr_t ret = SUCCEED; char *obj_path = NULL; /* Full path of object */ h5tools_str_t buffer; /* string into which to render */ @@ -199,7 +200,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + string_dataformat = *outputformat; if (fp_format) { @@ -222,8 +223,8 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR if(!obj_path) { ret = FAIL; goto done; - } - + } + HDstrcpy(obj_path, prefix); HDstrcat(obj_path, "/"); HDstrcat(obj_path, name); @@ -269,7 +270,20 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR break; case H5O_TYPE_DATASET: - if((obj = H5Dopen2(group, name, H5P_DEFAULT)) >= 0) { + if(display_data) { + if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) { + error_msg("error in creating default access property list ID\n"); + } + if (display_vds_first) { + if(H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0) + error_msg("error in setting access property list ID, virtual_view\n"); + } + if (vds_gap_size > 0) { + if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)vds_gap_size) < 0) + error_msg("error in setting access property list ID, virtual_printf_gap\n"); + } + } + if((obj = H5Dopen2(group, name, dapl_id)) >= 0) { if(oinfo.rc > 1 || hit_elink) { obj_t *found_obj; /* Found object */ @@ -308,9 +322,11 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR h5tools_setstatus(EXIT_FAILURE); ret = FAIL; + if (dapl_id != H5P_DEFAULT) + H5Pclose(dapl_id); H5Dclose(obj); goto done; - } + } else if(found_obj->displayed) { ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); @@ -347,18 +363,24 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + if (dapl_id != H5P_DEFAULT) + H5Pclose(dapl_id); H5Dclose(obj); goto done; - } + } else { found_obj->displayed = TRUE; } } /* end if */ dump_function_table->dump_dataset_function(obj, name, NULL); + if (dapl_id != H5P_DEFAULT) + H5Pclose(dapl_id); H5Dclose(obj); - } + } else { + if (dapl_id) + H5Pclose(dapl_id && dapl_id != H5P_DEFAULT); error_msg("unable to dump dataset \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; @@ -370,7 +392,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR error_msg("unable to dump datatype \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; - } + } else { dump_function_table->dump_named_datatype_function(obj, name); H5Tclose(obj); @@ -408,7 +430,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR error_msg("unable to get link value\n"); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; - } + } else { /* print the value of a soft link */ /* Standard DDL: no modification */ @@ -558,7 +580,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR done: h5tools_str_close(&buffer); - + if(obj_path) HDfree(obj_path); return ret; @@ -650,7 +672,7 @@ dump_named_datatype(hid_t tid, const char *name) HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + string_dataformat = *outputformat; if (fp_format) { @@ -685,7 +707,7 @@ dump_named_datatype(hid_t tid, const char *name) } ctx.need_prefix = TRUE; - + /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\" %s", @@ -718,7 +740,7 @@ dump_named_datatype(hid_t tid, const char *name) else found_obj->displayed = TRUE; } /* end if */ - + /* Render the element */ h5tools_str_reset(&buffer); h5tools_print_datatype(rawoutstream, &buffer, outputformat, &ctx, tid, FALSE); @@ -726,7 +748,7 @@ dump_named_datatype(hid_t tid, const char *name) if(H5Tget_class(tid) != H5T_COMPOUND) { h5tools_str_append(&buffer, ";"); } - + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); /* print attributes */ @@ -813,7 +835,7 @@ dump_group(hid_t gid, const char *name) HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + string_dataformat = *outputformat; if (fp_format) { @@ -839,7 +861,7 @@ dump_group(hid_t gid, const char *name) h5tools_dump_header_format->groupbegin, name, h5tools_dump_header_format->groupblockbegin); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - + ctx.indent_level++; dump_indent += COL; @@ -948,7 +970,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + string_dataformat = *outputformat; if (fp_format) { @@ -982,7 +1004,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - + /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\" %s", @@ -994,7 +1016,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) dump_indent += COL; ctx.indent_level++; - + type = H5Dget_type(did); h5dump_type_table = type_table; h5tools_dump_datatype(rawoutstream, outputformat, &ctx, type); @@ -1018,6 +1040,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) if(display_data) { int data_loop = 1; int i; + if(display_packed_bits) data_loop = packed_bits_num; for(i=0; iline_ncols, (hsize_t)0, (hsize_t)0); - + ctx.indent_level--; break; @@ -1079,7 +1102,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - + /* Render the element */ h5tools_str_reset(&buffer); if(HDstrlen(h5tools_dump_header_format->datasetblockend)) { @@ -1189,7 +1212,7 @@ dump_fcpl(hid_t fid) fdriver=H5Pget_driver(fapl); H5Pclose(fapl); #endif - + /*------------------------------------------------------------------------- * SUPER_BLOCK *------------------------------------------------------------------------- @@ -1308,54 +1331,54 @@ static herr_t attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void *_op_data) { herr_t ret = SUCCEED; - int i; - int j; - int k; - char *obj_op_name; + int i; + int j; + int k; + char *obj_op_name; char *obj_name; - trav_attr_udata_t *attr_data = (trav_attr_udata_t*)_op_data; + trav_attr_udata_t *attr_data = (trav_attr_udata_t*)_op_data; char *buf = attr_data->path; - char *op_name = attr_data->op_name; + char *op_name = attr_data->op_name; j = (int)HDstrlen(op_name) - 1; /* find the last / */ while(j >= 0) { - if (op_name[j] == '/' && (j==0 || (j>0 && op_name[j-1]!='\\'))) - break; - j--; + if (op_name[j] == '/' && (j==0 || (j>0 && op_name[j-1]!='\\'))) + break; + j--; } obj_op_name = h5tools_str_replace(op_name + j + 1, "\\/", "/"); if(obj_op_name == NULL) { - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; } else { - if(HDstrcmp(attr_name, obj_op_name)==0) { - /* object name */ - i = (int)HDstrlen(buf); - j = (int)HDstrlen(op_name); - k = (size_t)i + 1 + (size_t)j + 1 + 2; - obj_name = (char *)HDmalloc((size_t)k); - if(obj_name == NULL) { - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - } - else { - HDmemset(obj_name, '\0', (size_t)k); - if(op_name[0] != '/') { - HDstrncat(obj_name, buf, (size_t)i + 1); - if(buf[i-1] != '/') - HDstrncat(obj_name, "/", (size_t)2); - } - HDstrncat(obj_name, op_name, (size_t)j + 1); - - handle_attributes(oid, obj_name, NULL, 0, NULL); - HDfree(obj_name); - } - } - HDfree(obj_op_name); + if(HDstrcmp(attr_name, obj_op_name)==0) { + /* object name */ + i = (int)HDstrlen(buf); + j = (int)HDstrlen(op_name); + k = (size_t)i + 1 + (size_t)j + 1 + 2; + obj_name = (char *)HDmalloc((size_t)k); + if(obj_name == NULL) { + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + else { + HDmemset(obj_name, '\0', (size_t)k); + if(op_name[0] != '/') { + HDstrncat(obj_name, buf, (size_t)i + 1); + if(buf[i-1] != '/') + HDstrncat(obj_name, "/", (size_t)2); + } + HDstrncat(obj_name, op_name, (size_t)j + 1); + + handle_attributes(oid, obj_name, NULL, 0, NULL); + HDfree(obj_name); + } + } + HDfree(obj_op_name); } return ret; } /* end attr_search() */ @@ -1363,7 +1386,7 @@ attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *a static herr_t obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *already_visited, void *_op_data) { - trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data; + trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data; char *op_name = (char*)handle_data->op_name; trav_attr_udata_t attr_data; @@ -1372,22 +1395,22 @@ obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *al H5Aiterate_by_name(handle_data->fid, path, H5_INDEX_NAME, H5_ITER_INC, NULL, attr_search, (void*)&attr_data, H5P_DEFAULT); if(HDstrcmp(path, op_name)==0) { - switch(oi->type) { - case H5O_TYPE_GROUP: - handle_groups(handle_data->fid, path, NULL, 0, NULL); - break; - case H5O_TYPE_DATASET: - handle_datasets(handle_data->fid, path, NULL, 0, NULL); - break; - case H5O_TYPE_NAMED_DATATYPE: - handle_datatypes(handle_data->fid, path, NULL, 0, NULL); - break; - case H5O_TYPE_UNKNOWN: - case H5O_TYPE_NTYPES: - default: - error_msg("unknown object type value\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end switch */ + switch(oi->type) { + case H5O_TYPE_GROUP: + handle_groups(handle_data->fid, path, NULL, 0, NULL); + break; + case H5O_TYPE_DATASET: + handle_datasets(handle_data->fid, path, NULL, 0, NULL); + break; + case H5O_TYPE_NAMED_DATATYPE: + handle_datatypes(handle_data->fid, path, NULL, 0, NULL); + break; + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: + default: + error_msg("unknown object type value\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end switch */ } return 0; @@ -1397,48 +1420,48 @@ static herr_t lnk_search(const char *path, const H5L_info_t *li, void *_op_data) { int search_len; - int k; + int k; char *search_name; - trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data; + trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data; char *op_name = (char*)handle_data->op_name; search_len = HDstrlen(op_name); if(search_len > 0 && op_name[0] != '/') { - k = 2; + k = 2; } else k = 1; - search_name = (char *)HDmalloc((size_t)(search_len + k)); + search_name = (char *)HDmalloc((size_t)(search_len + k)); if(search_name == NULL) { - error_msg("creating temporary link\n"); - h5tools_setstatus(EXIT_FAILURE); + error_msg("creating temporary link\n"); + h5tools_setstatus(EXIT_FAILURE); } else { - if (k == 2) { - HDstrcpy(search_name, "/"); - HDstrncat(search_name, op_name, (size_t)search_len + 1); - } - else - HDstrncpy(search_name, op_name, (size_t)search_len + 1); - search_name[search_len + k - 1] = '\0'; - - if(HDstrcmp(path, search_name) == 0) { - switch(li->type) { - case H5L_TYPE_SOFT: - case H5L_TYPE_EXTERNAL: - handle_links(handle_data->fid, op_name, NULL, 0, NULL); - break; - - case H5L_TYPE_HARD: - case H5L_TYPE_MAX: - case H5L_TYPE_ERROR: - default: - error_msg("unknown link type value\n"); - h5tools_setstatus(EXIT_FAILURE); - break; - } /* end switch() */ - } - HDfree(search_name); + if (k == 2) { + HDstrcpy(search_name, "/"); + HDstrncat(search_name, op_name, (size_t)search_len + 1); + } + else + HDstrncpy(search_name, op_name, (size_t)search_len + 1); + search_name[search_len + k - 1] = '\0'; + + if(HDstrcmp(path, search_name) == 0) { + switch(li->type) { + case H5L_TYPE_SOFT: + case H5L_TYPE_EXTERNAL: + handle_links(handle_data->fid, op_name, NULL, 0, NULL); + break; + + case H5L_TYPE_HARD: + case H5L_TYPE_MAX: + case H5L_TYPE_ERROR: + default: + error_msg("unknown link type value\n"); + h5tools_setstatus(EXIT_FAILURE); + break; + } /* end switch() */ + } + HDfree(search_name); } return 0; } /* end lnk_search() */ @@ -1465,7 +1488,7 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H hid_t gcpl_id; unsigned crt_order_flags; unsigned attr_crt_order_flags; - trav_handle_udata_t handle_udata; /* User data for traversal */ + trav_handle_udata_t handle_udata; /* User data for traversal */ if ((gcpl_id = H5Gget_create_plist(gid)) < 0) { error_msg("error in getting group creation property list ID\n"); @@ -1489,12 +1512,12 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H h5tools_setstatus(EXIT_FAILURE); } - handle_udata.fid = fid; - handle_udata.op_name = (char*)path_name; - if(h5trav_visit(fid, "/", TRUE, TRUE, obj_search, lnk_search, &handle_udata) < 0) { - error_msg("error traversing information\n"); - h5tools_setstatus(EXIT_FAILURE); - } + handle_udata.fid = fid; + handle_udata.op_name = (char*)path_name; + if(h5trav_visit(fid, "/", TRUE, TRUE, obj_search, lnk_search, &handle_udata) < 0) { + error_msg("error traversing information\n"); + h5tools_setstatus(EXIT_FAILURE); + } } } @@ -1536,7 +1559,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H /* find the last / */ while(j >= 0) { - if (attr[j] == '/' && (j==0 || (j>0 && attr[j-1]!='\\'))) + if (attr[j] == '/' && (j==0 || (j>0 && attr[j-1]!='\\'))) break; j--; } @@ -1571,7 +1594,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H string_dataformat.do_escape = display_escape; outputformat = &string_dataformat; - attr_name = h5tools_str_replace(attr + j + 1, "\\/", "/"); + attr_name = h5tools_str_replace(attr + j + 1, "\\/", "/"); /* handle error case: cannot open the object with the attribute */ if((oid = H5Oopen(fid, obj_name, H5P_DEFAULT)) < 0) { @@ -1627,7 +1650,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H } /* end if */ HDfree(obj_name); - HDfree(attr_name); + HDfree(attr_name); dump_indent -= COL; return; @@ -1635,9 +1658,9 @@ error: h5tools_setstatus(EXIT_FAILURE); if(obj_name) HDfree(obj_name); - - if (attr_name) - HDfree(attr_name); + + if (attr_name) + HDfree(attr_name); H5E_BEGIN_TRY { H5Oclose(oid); @@ -1672,10 +1695,24 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis { H5O_info_t oinfo; hid_t dsetid; + hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */ struct subset_t *sset = (struct subset_t *)data; const char *real_name = display_name ? display_name : dset; - if((dsetid = H5Dopen2(fid, dset, H5P_DEFAULT)) < 0) { + if(display_data) { + if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) { + error_msg("error in creating default access property list ID\n"); + } + if (display_vds_first) { + if(H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0) + error_msg("error in setting access property list ID, virtual_view\n"); + } + if (vds_gap_size > 0) { + if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)vds_gap_size) < 0) + error_msg("error in setting access property list ID, virtual_printf_gap\n"); + } + } + if((dsetid = H5Dopen2(fid, dset, dapl_id)) < 0) { if (pe) { handle_links(fid, dset, data, pe, display_name); } @@ -1752,7 +1789,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis h5tools_setstatus(EXIT_FAILURE); return; } - + /*------------------------------------------------------------------------- * check for block overlap *------------------------------------------------------------------------- @@ -1785,7 +1822,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis PRINTSTREAM(rawoutstream, "%s \"%s\"\n", HARDLINK, found_obj->objname); indentation(dump_indent); end_obj(h5tools_dump_header_format->datasetend, h5tools_dump_header_format->datasetblockend); - } + } else { found_obj->displayed = TRUE; dump_indent += COL; @@ -1801,7 +1838,8 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis dump_dataset(dsetid, real_name, sset); dump_indent -= COL; } - + if (dapl_id != H5P_DEFAULT) + H5Pclose(dapl_id); if(H5Dclose(dsetid) < 0) h5tools_setstatus(EXIT_FAILURE); } @@ -1884,11 +1922,11 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT if(H5Lget_info(fid, links, &linfo, H5P_DEFAULT) < 0) { error_msg("unable to get link info from \"%s\"\n", links); h5tools_setstatus(EXIT_FAILURE); - } + } else if(linfo.type == H5L_TYPE_HARD) { error_msg("\"%s\" is a hard link\n", links); h5tools_setstatus(EXIT_FAILURE); - } + } else { char *buf = (char *)HDmalloc(linfo.u.val_size); PRINTVALSTREAM(rawoutstream, "\n"); @@ -1925,12 +1963,12 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT PRINTSTREAM(rawoutstream, "TARGETFILE \"%s\"\n", elink_file); indentation(COL); PRINTSTREAM(rawoutstream, "TARGETPATH \"%s\"\n", elink_path); - } + } else { error_msg("h5dump error: unable to unpack external link value for \"%s\"\n", links); h5tools_setstatus(EXIT_FAILURE); } - } + } else { error_msg("h5dump error: unable to get external link value for \"%s\"\n", links); h5tools_setstatus(EXIT_FAILURE); diff --git a/tools/h5dump/h5dump_extern.h b/tools/h5dump/h5dump_extern.h index 08f9e36..62477d0 100644 --- a/tools/h5dump/h5dump_extern.h +++ b/tools/h5dump/h5dump_extern.h @@ -77,6 +77,8 @@ extern int enable_error_stack; /* re-enable error stack */ extern int disable_compact_subset; /* disable compact form of subset notation */ extern int display_packed_bits; /*print 1-8 byte numbers as packed bits*/ extern int include_attrs; /* Display attributes */ +extern int display_vds_first; /* vds display to first missing */ +extern int vds_gap_size; /* vds skip missing files */ /* sort parameters */ extern H5_index_t sort_by; /*sort_by [creation_order | name] */ diff --git a/tools/h5dump/testh5dumpvds.sh.in b/tools/h5dump/testh5dumpvds.sh.in index b15606f..850c03a 100644 --- a/tools/h5dump/testh5dumpvds.sh.in +++ b/tools/h5dump/testh5dumpvds.sh.in @@ -98,6 +98,14 @@ $SRC_H5DUMP_TESTFILES/vds/5_a.h5 $SRC_H5DUMP_TESTFILES/vds/5_b.h5 $SRC_H5DUMP_TESTFILES/vds/5_c.h5 $SRC_H5DUMP_TESTFILES/vds/5_vds.h5 +$SRC_H5DUMP_TESTFILES/vds/a.h5 +$SRC_H5DUMP_TESTFILES/vds/b.h5 +$SRC_H5DUMP_TESTFILES/vds/c.h5 +$SRC_H5DUMP_TESTFILES/vds/d.h5 +$SRC_H5DUMP_TESTFILES/vds/vds-percival-unlim-maxmin.h5 +$SRC_H5DUMP_TESTFILES/vds/f-0.h5 +$SRC_H5DUMP_TESTFILES/vds/f-3.h5 +$SRC_H5DUMP_TESTFILES/vds/vds-eiger.h5 " LIST_OTHER_TEST_FILES=" @@ -113,6 +121,11 @@ $SRC_H5DUMP_TESTFILES/vds/tvds_layout-3_1.ddl $SRC_H5DUMP_TESTFILES/vds/tvds_layout-3_2.ddl $SRC_H5DUMP_TESTFILES/vds/tvds_layout-4.ddl $SRC_H5DUMP_TESTFILES/vds/tvds_layout-5.ddl +$SRC_H5DUMP_TESTFILES/vds/vds-first.ddl +$SRC_H5DUMP_TESTFILES/vds/vds-gap1.ddl +$SRC_H5DUMP_TESTFILES/vds/vds-gap2.ddl +$SRC_H5DUMP_TESTFILES/vds/vds_layout-eiger.ddl +$SRC_H5DUMP_TESTFILES/vds/vds_layout-maxmin.ddl " LIST_ERROR_TEST_FILES=" @@ -480,6 +493,9 @@ if test $USE_FILTER_DEFLATE = "yes" ; then TOOLTEST tvds-3_2.ddl --enable-error-stack 3_2_vds.h5 TOOLTEST tvds-4.ddl --enable-error-stack 4_vds.h5 TOOLTEST tvds-5.ddl --enable-error-stack 5_vds.h5 + TOOLTEST vds-first.ddl --vds-view-first-missing --enable-error-stack vds-percival-unlim-maxmin.h5 + TOOLTEST vds-gap1.ddl -d /VDS-Eiger --vds-gap-size=1 --enable-error-stack vds-eiger.h5 + TOOLTEST vds-gap2.ddl --vds-gap-size=2 --enable-error-stack vds-eiger.h5 fi # Layout read @@ -490,6 +506,8 @@ if test $USE_FILTER_DEFLATE = "yes" ; then TOOLTEST tvds_layout-3_2.ddl -p --enable-error-stack 3_2_vds.h5 TOOLTEST tvds_layout-4.ddl -p --enable-error-stack 4_vds.h5 TOOLTEST tvds_layout-5.ddl -p --enable-error-stack 5_vds.h5 + TOOLTEST vds_layout-eiger.ddl -p --enable-error-stack vds-eiger.h5 + TOOLTEST vds_layout-maxmin.ddl -p --enable-error-stack vds-percival-unlim-maxmin.h5 fi # Clean up temporary files/directories diff --git a/tools/h5repack/CMakeLists.txt b/tools/h5repack/CMakeLists.txt index 7631ae8..9b1fbcf 100644 --- a/tools/h5repack/CMakeLists.txt +++ b/tools/h5repack/CMakeLists.txt @@ -58,7 +58,7 @@ if (BUILD_TESTING) target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) H5_SET_LIB_OPTIONS ( ${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} - SHARED + SHARED ${HDF5_PACKAGE_SOVERSION} HDF5_TOOL_PLUGIN_LIB_NAME_RELEASE HDF5_TOOL_PLUGIN_LIB_NAME_DEBUG ) @@ -72,13 +72,13 @@ if (BUILD_TESTING) TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different + ARGS -E copy_if_different "$" "${CMAKE_BINARY_DIR}/plugins/$" ) include (CMakeTests.cmake) - + endif (BUILD_TESTING) ############################################################################## diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index 38c84a2..0b39a2b 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -61,7 +61,7 @@ if (BUILD_SHARED_LIBS) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIBSH_TARGET}") H5_SET_LIB_OPTIONS ( ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TOOLS_LIB_NAME} - SHARED + SHARED ${HDF5_TOOLS_PACKAGE_SOVERSION} HDF5_TOOLS_LIB_NAME_RELEASE HDF5_TOOLS_LIB_NAME_DEBUG ) diff --git a/tools/testfiles/h5dump-help.txt b/tools/testfiles/h5dump-help.txt index 444dd97..7ebefc6 100644 --- a/tools/testfiles/h5dump-help.txt +++ b/tools/testfiles/h5dump-help.txt @@ -25,6 +25,8 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. + --vds-view-first-missing Set the VDS bounds to first missing mapped elements. + --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl index 64a2880..1a1b7e8 100644 --- a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl +++ b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl @@ -25,6 +25,8 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. + --vds-view-first-missing Set the VDS bounds to first missing mapped elements. + --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tpbitsIncomplete.ddl b/tools/testfiles/pbits/tpbitsIncomplete.ddl index cdb1f91..2a2778a 100644 --- a/tools/testfiles/pbits/tpbitsIncomplete.ddl +++ b/tools/testfiles/pbits/tpbitsIncomplete.ddl @@ -25,6 +25,8 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. + --vds-view-first-missing Set the VDS bounds to first missing mapped elements. + --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl index 6d2492a..5e00073 100644 --- a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl @@ -25,6 +25,8 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. + --vds-view-first-missing Set the VDS bounds to first missing mapped elements. + --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tpbitsLengthPositive.ddl b/tools/testfiles/pbits/tpbitsLengthPositive.ddl index 4f56619..f2574d4 100644 --- a/tools/testfiles/pbits/tpbitsLengthPositive.ddl +++ b/tools/testfiles/pbits/tpbitsLengthPositive.ddl @@ -25,6 +25,8 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. + --vds-view-first-missing Set the VDS bounds to first missing mapped elements. + --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl index 3432433..15c0abc 100644 --- a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl @@ -25,6 +25,8 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. + --vds-view-first-missing Set the VDS bounds to first missing mapped elements. + --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl index e51a09e..c62e290 100644 --- a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl @@ -25,6 +25,8 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. + --vds-view-first-missing Set the VDS bounds to first missing mapped elements. + --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl index ba6e46d..5621a60 100644 --- a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl +++ b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl @@ -25,6 +25,8 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. + --vds-view-first-missing Set the VDS bounds to first missing mapped elements. + --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value -- cgit v0.12 From 7511d8b4691770a15f1ba9f7fcc242f038c79669 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 22 Feb 2016 15:32:01 -0500 Subject: [svn-r29179] Revert of 29177 which breaks the autotools build. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial --- tools/h5dump/CMakeTestsVDS.cmake | 28 -- tools/h5dump/h5dump.c | 16 +- tools/h5dump/h5dump.h | 2 - tools/h5dump/h5dump_ddl.c | 306 +++++++++------------ tools/h5dump/h5dump_extern.h | 2 - tools/h5dump/testh5dumpvds.sh.in | 18 -- tools/h5repack/CMakeLists.txt | 6 +- tools/lib/CMakeLists.txt | 2 +- tools/testfiles/h5dump-help.txt | 2 - .../pbits/tnofilename-with-packed-bits.ddl | 2 - tools/testfiles/pbits/tpbitsIncomplete.ddl | 2 - tools/testfiles/pbits/tpbitsLengthExceeded.ddl | 2 - tools/testfiles/pbits/tpbitsLengthPositive.ddl | 2 - tools/testfiles/pbits/tpbitsMaxExceeded.ddl | 2 - tools/testfiles/pbits/tpbitsOffsetExceeded.ddl | 2 - tools/testfiles/pbits/tpbitsOffsetNegative.ddl | 2 - 16 files changed, 139 insertions(+), 257 deletions(-) diff --git a/tools/h5dump/CMakeTestsVDS.cmake b/tools/h5dump/CMakeTestsVDS.cmake index cc68896..58287fa 100644 --- a/tools/h5dump/CMakeTestsVDS.cmake +++ b/tools/h5dump/CMakeTestsVDS.cmake @@ -22,11 +22,6 @@ tvds_layout-3_2.ddl tvds_layout-4.ddl tvds_layout-5.ddl - vds-first.ddl - vds-gap1.ddl - vds-gap2.ddl - vds_layout-eiger.ddl - vds_layout-maxmin.ddl ) set (HDF5_REFERENCE_TEST_VDS 1_a.h5 @@ -52,14 +47,6 @@ 5_b.h5 5_c.h5 5_vds.h5 - a.h5 - b.h5 - c.h5 - d.h5 - vds-percival-unlim-maxmin.h5 - f-0.h5 - f-3.h5 - vds-eiger.h5 ) set (HDF5_ERROR_REFERENCE_VDS ) @@ -197,12 +184,6 @@ tvds-4.out.err tvds-5.out tvds-5.out.err - vds-first.out - vds-first.out.err - vds-gap1.out - vds-gap1.out.err - vds-gap2.out - vds-gap2.out.err tvds_layout-1.out tvds_layout-1.out.err tvds_layout-2.out @@ -215,10 +196,6 @@ tvds_layout-4.out.err tvds_layout-5.out tvds_layout-5.out.err - vds_layout-eiger.out - vds_layout-eiger.out.err - vds_layout-maxmin.out - vds_layout-maxmin.out.err ) set_tests_properties (H5DUMP_VDS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") if (NOT "${last_vds_test}" STREQUAL "") @@ -248,9 +225,6 @@ ADD_H5_VDS_TEST (tvds-3_2 0 --enable-error-stack 3_2_vds.h5) ADD_H5_VDS_TEST (tvds-4 0 --enable-error-stack 4_vds.h5) ADD_H5_VDS_TEST (tvds-5 0 --enable-error-stack 5_vds.h5) - ADD_H5_VDS_TEST (vds-first 0 --vds-view-first-missing --enable-error-stack vds-percival-unlim-maxmin.h5) - ADD_H5_VDS_TEST (vds-gap1 0 -d /VDS-Eiger --vds-gap-size=1 --enable-error-stack vds-eiger.h5) - ADD_H5_VDS_TEST (vds-gap2 0 --vds-gap-size=2 --enable-error-stack vds-eiger.h5) endif (USE_FILTER_DEFLATE) # Layout read @@ -261,6 +235,4 @@ ADD_H5_VDS_LAYOUT (tvds_layout-3_2 0 --enable-error-stack 3_2_vds.h5) ADD_H5_VDS_LAYOUT (tvds_layout-4 0 --enable-error-stack 4_vds.h5) ADD_H5_VDS_LAYOUT (tvds_layout-5 0 --enable-error-stack 5_vds.h5) - ADD_H5_VDS_LAYOUT (vds_layout-eiger 0 --enable-error-stack vds-eiger.h5) - ADD_H5_VDS_LAYOUT (vds_layout-maxmin 0 --enable-error-stack vds-percival-unlim-maxmin.h5) endif (USE_FILTER_DEFLATE) diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 7c24fa4..ffba581 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -71,7 +71,7 @@ struct handler_t { */ /* The following initialization makes use of C language cancatenating */ /* "xxx" "yyy" into "xxxyyy". */ -static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RECM:O*N:vG:"; +static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RECM:O*N:"; static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "hel", no_arg, 'h' }, @@ -190,8 +190,6 @@ static struct long_options l_opts[] = { { "no-compact-subset", no_arg, 'C' }, { "ddl", optional_arg, 'O' }, { "any_path", require_arg, 'N' }, - { "vds-view-first-missing", no_arg, 'v' }, - { "vds-gap-size", require_arg, 'G' }, { NULL, 0, '\0' } }; @@ -258,8 +256,6 @@ usage(const char *prog) PRINTVALSTREAM(rawoutstream, " P can be the absolute path or just a relative path.\n"); PRINTVALSTREAM(rawoutstream, " -A, --onlyattr Print the header and value of attributes\n"); PRINTVALSTREAM(rawoutstream, " Optional value 0 suppresses printing attributes.\n"); - PRINTVALSTREAM(rawoutstream, " --vds-view-first-missing Set the VDS bounds to first missing mapped elements.\n"); - PRINTVALSTREAM(rawoutstream, " --vds-gap-size=N Set the missing file gap size, N=non-negative integers\n"); PRINTVALSTREAM(rawoutstream, "--------------- Object Property Options ---------------\n"); PRINTVALSTREAM(rawoutstream, " -i, --object-ids Print the object ids\n"); PRINTVALSTREAM(rawoutstream, " -p, --properties Print dataset filters, storage layout and fill value\n"); @@ -1125,16 +1121,6 @@ parse_start: } display_packed_bits = TRUE; break; - case 'v': - display_vds_first = TRUE; - break; - case 'G': - vds_gap_size = HDatoi(opt_arg); - if (vds_gap_size < 0) { - usage(h5tools_getprogname()); - goto error; - } - break; /** begin XML parameters **/ case 'x': diff --git a/tools/h5dump/h5dump.h b/tools/h5dump/h5dump.h index 7cf4efd..2b1fb04 100644 --- a/tools/h5dump/h5dump.h +++ b/tools/h5dump/h5dump.h @@ -78,8 +78,6 @@ int enable_error_stack= FALSE; /* re-enable error stack */ int disable_compact_subset= FALSE; /* disable compact form of subset notation */ int display_packed_bits = FALSE; /*print 1-8 byte numbers as packed bits*/ int include_attrs = TRUE; /* Display attributes */ -int display_vds_first = FALSE; /* vds display to all by default*/ -int vds_gap_size = 0; /* vds skip missing files default is none */ /* sort parameters */ H5_index_t sort_by = H5_INDEX_NAME; /*sort_by [creation_order | name] */ diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c index 09751ab..fd50710 100644 --- a/tools/h5dump/h5dump_ddl.c +++ b/tools/h5dump/h5dump_ddl.c @@ -26,12 +26,12 @@ typedef struct { hid_t fid; /* File ID being traversed */ - char *op_name; /* Object name wanted */ + char *op_name; /* Object name wanted */ } trav_handle_udata_t; typedef struct { - char *path; /* Path of object being searched */ - char *op_name; /* Object name wanted */ + char *path; /* Path of object being searched */ + char *op_name; /* Object name wanted */ } trav_attr_udata_t; /* callback function used by H5Literate() */ @@ -90,7 +90,7 @@ dump_dataspace(hid_t space) HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + h5tools_dump_dataspace(rawoutstream, outputformat, &ctx, space); } @@ -117,19 +117,19 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED * h5tools_context_t ctx; /* print context */ h5tool_format_t *outputformat = &h5tools_dataformat; h5tool_format_t string_dataformat; - + hid_t attr_id; herr_t ret = SUCCEED; HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT); oid_output = display_oid; data_output = display_data; attr_data_output = display_attr_data; - + string_dataformat = *outputformat; if (fp_format) { @@ -155,7 +155,7 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED * h5tools_setstatus(EXIT_FAILURE); ret = FAIL; } - + return ret; } @@ -185,7 +185,6 @@ static herr_t dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR_UNUSED *op_data) { hid_t obj; - hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */ herr_t ret = SUCCEED; char *obj_path = NULL; /* Full path of object */ h5tools_str_t buffer; /* string into which to render */ @@ -200,7 +199,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + string_dataformat = *outputformat; if (fp_format) { @@ -223,8 +222,8 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR if(!obj_path) { ret = FAIL; goto done; - } - + } + HDstrcpy(obj_path, prefix); HDstrcat(obj_path, "/"); HDstrcat(obj_path, name); @@ -270,20 +269,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR break; case H5O_TYPE_DATASET: - if(display_data) { - if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) { - error_msg("error in creating default access property list ID\n"); - } - if (display_vds_first) { - if(H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0) - error_msg("error in setting access property list ID, virtual_view\n"); - } - if (vds_gap_size > 0) { - if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)vds_gap_size) < 0) - error_msg("error in setting access property list ID, virtual_printf_gap\n"); - } - } - if((obj = H5Dopen2(group, name, dapl_id)) >= 0) { + if((obj = H5Dopen2(group, name, H5P_DEFAULT)) >= 0) { if(oinfo.rc > 1 || hit_elink) { obj_t *found_obj; /* Found object */ @@ -322,11 +308,9 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR h5tools_setstatus(EXIT_FAILURE); ret = FAIL; - if (dapl_id != H5P_DEFAULT) - H5Pclose(dapl_id); H5Dclose(obj); goto done; - } + } else if(found_obj->displayed) { ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); @@ -363,24 +347,18 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - if (dapl_id != H5P_DEFAULT) - H5Pclose(dapl_id); H5Dclose(obj); goto done; - } + } else { found_obj->displayed = TRUE; } } /* end if */ dump_function_table->dump_dataset_function(obj, name, NULL); - if (dapl_id != H5P_DEFAULT) - H5Pclose(dapl_id); H5Dclose(obj); - } + } else { - if (dapl_id) - H5Pclose(dapl_id && dapl_id != H5P_DEFAULT); error_msg("unable to dump dataset \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; @@ -392,7 +370,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR error_msg("unable to dump datatype \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; - } + } else { dump_function_table->dump_named_datatype_function(obj, name); H5Tclose(obj); @@ -430,7 +408,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR error_msg("unable to get link value\n"); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; - } + } else { /* print the value of a soft link */ /* Standard DDL: no modification */ @@ -580,7 +558,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR done: h5tools_str_close(&buffer); - + if(obj_path) HDfree(obj_path); return ret; @@ -672,7 +650,7 @@ dump_named_datatype(hid_t tid, const char *name) HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + string_dataformat = *outputformat; if (fp_format) { @@ -707,7 +685,7 @@ dump_named_datatype(hid_t tid, const char *name) } ctx.need_prefix = TRUE; - + /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\" %s", @@ -740,7 +718,7 @@ dump_named_datatype(hid_t tid, const char *name) else found_obj->displayed = TRUE; } /* end if */ - + /* Render the element */ h5tools_str_reset(&buffer); h5tools_print_datatype(rawoutstream, &buffer, outputformat, &ctx, tid, FALSE); @@ -748,7 +726,7 @@ dump_named_datatype(hid_t tid, const char *name) if(H5Tget_class(tid) != H5T_COMPOUND) { h5tools_str_append(&buffer, ";"); } - + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); /* print attributes */ @@ -835,7 +813,7 @@ dump_group(hid_t gid, const char *name) HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + string_dataformat = *outputformat; if (fp_format) { @@ -861,7 +839,7 @@ dump_group(hid_t gid, const char *name) h5tools_dump_header_format->groupbegin, name, h5tools_dump_header_format->groupblockbegin); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - + ctx.indent_level++; dump_indent += COL; @@ -970,7 +948,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + string_dataformat = *outputformat; if (fp_format) { @@ -1004,7 +982,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - + /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\" %s", @@ -1016,7 +994,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) dump_indent += COL; ctx.indent_level++; - + type = H5Dget_type(did); h5dump_type_table = type_table; h5tools_dump_datatype(rawoutstream, outputformat, &ctx, type); @@ -1040,7 +1018,6 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) if(display_data) { int data_loop = 1; int i; - if(display_packed_bits) data_loop = packed_bits_num; for(i=0; iline_ncols, (hsize_t)0, (hsize_t)0); - + ctx.indent_level--; break; @@ -1102,7 +1079,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - + /* Render the element */ h5tools_str_reset(&buffer); if(HDstrlen(h5tools_dump_header_format->datasetblockend)) { @@ -1212,7 +1189,7 @@ dump_fcpl(hid_t fid) fdriver=H5Pget_driver(fapl); H5Pclose(fapl); #endif - + /*------------------------------------------------------------------------- * SUPER_BLOCK *------------------------------------------------------------------------- @@ -1331,54 +1308,54 @@ static herr_t attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void *_op_data) { herr_t ret = SUCCEED; - int i; - int j; - int k; - char *obj_op_name; + int i; + int j; + int k; + char *obj_op_name; char *obj_name; - trav_attr_udata_t *attr_data = (trav_attr_udata_t*)_op_data; + trav_attr_udata_t *attr_data = (trav_attr_udata_t*)_op_data; char *buf = attr_data->path; - char *op_name = attr_data->op_name; + char *op_name = attr_data->op_name; j = (int)HDstrlen(op_name) - 1; /* find the last / */ while(j >= 0) { - if (op_name[j] == '/' && (j==0 || (j>0 && op_name[j-1]!='\\'))) - break; - j--; + if (op_name[j] == '/' && (j==0 || (j>0 && op_name[j-1]!='\\'))) + break; + j--; } obj_op_name = h5tools_str_replace(op_name + j + 1, "\\/", "/"); if(obj_op_name == NULL) { - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; } else { - if(HDstrcmp(attr_name, obj_op_name)==0) { - /* object name */ - i = (int)HDstrlen(buf); - j = (int)HDstrlen(op_name); - k = (size_t)i + 1 + (size_t)j + 1 + 2; - obj_name = (char *)HDmalloc((size_t)k); - if(obj_name == NULL) { - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - } - else { - HDmemset(obj_name, '\0', (size_t)k); - if(op_name[0] != '/') { - HDstrncat(obj_name, buf, (size_t)i + 1); - if(buf[i-1] != '/') - HDstrncat(obj_name, "/", (size_t)2); - } - HDstrncat(obj_name, op_name, (size_t)j + 1); - - handle_attributes(oid, obj_name, NULL, 0, NULL); - HDfree(obj_name); - } - } - HDfree(obj_op_name); + if(HDstrcmp(attr_name, obj_op_name)==0) { + /* object name */ + i = (int)HDstrlen(buf); + j = (int)HDstrlen(op_name); + k = (size_t)i + 1 + (size_t)j + 1 + 2; + obj_name = (char *)HDmalloc((size_t)k); + if(obj_name == NULL) { + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + else { + HDmemset(obj_name, '\0', (size_t)k); + if(op_name[0] != '/') { + HDstrncat(obj_name, buf, (size_t)i + 1); + if(buf[i-1] != '/') + HDstrncat(obj_name, "/", (size_t)2); + } + HDstrncat(obj_name, op_name, (size_t)j + 1); + + handle_attributes(oid, obj_name, NULL, 0, NULL); + HDfree(obj_name); + } + } + HDfree(obj_op_name); } return ret; } /* end attr_search() */ @@ -1386,7 +1363,7 @@ attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *a static herr_t obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *already_visited, void *_op_data) { - trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data; + trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data; char *op_name = (char*)handle_data->op_name; trav_attr_udata_t attr_data; @@ -1395,22 +1372,22 @@ obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *al H5Aiterate_by_name(handle_data->fid, path, H5_INDEX_NAME, H5_ITER_INC, NULL, attr_search, (void*)&attr_data, H5P_DEFAULT); if(HDstrcmp(path, op_name)==0) { - switch(oi->type) { - case H5O_TYPE_GROUP: - handle_groups(handle_data->fid, path, NULL, 0, NULL); - break; - case H5O_TYPE_DATASET: - handle_datasets(handle_data->fid, path, NULL, 0, NULL); - break; - case H5O_TYPE_NAMED_DATATYPE: - handle_datatypes(handle_data->fid, path, NULL, 0, NULL); - break; - case H5O_TYPE_UNKNOWN: - case H5O_TYPE_NTYPES: - default: - error_msg("unknown object type value\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end switch */ + switch(oi->type) { + case H5O_TYPE_GROUP: + handle_groups(handle_data->fid, path, NULL, 0, NULL); + break; + case H5O_TYPE_DATASET: + handle_datasets(handle_data->fid, path, NULL, 0, NULL); + break; + case H5O_TYPE_NAMED_DATATYPE: + handle_datatypes(handle_data->fid, path, NULL, 0, NULL); + break; + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: + default: + error_msg("unknown object type value\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end switch */ } return 0; @@ -1420,48 +1397,48 @@ static herr_t lnk_search(const char *path, const H5L_info_t *li, void *_op_data) { int search_len; - int k; + int k; char *search_name; - trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data; + trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data; char *op_name = (char*)handle_data->op_name; search_len = HDstrlen(op_name); if(search_len > 0 && op_name[0] != '/') { - k = 2; + k = 2; } else k = 1; - search_name = (char *)HDmalloc((size_t)(search_len + k)); + search_name = (char *)HDmalloc((size_t)(search_len + k)); if(search_name == NULL) { - error_msg("creating temporary link\n"); - h5tools_setstatus(EXIT_FAILURE); + error_msg("creating temporary link\n"); + h5tools_setstatus(EXIT_FAILURE); } else { - if (k == 2) { - HDstrcpy(search_name, "/"); - HDstrncat(search_name, op_name, (size_t)search_len + 1); - } - else - HDstrncpy(search_name, op_name, (size_t)search_len + 1); - search_name[search_len + k - 1] = '\0'; - - if(HDstrcmp(path, search_name) == 0) { - switch(li->type) { - case H5L_TYPE_SOFT: - case H5L_TYPE_EXTERNAL: - handle_links(handle_data->fid, op_name, NULL, 0, NULL); - break; - - case H5L_TYPE_HARD: - case H5L_TYPE_MAX: - case H5L_TYPE_ERROR: - default: - error_msg("unknown link type value\n"); - h5tools_setstatus(EXIT_FAILURE); - break; - } /* end switch() */ - } - HDfree(search_name); + if (k == 2) { + HDstrcpy(search_name, "/"); + HDstrncat(search_name, op_name, (size_t)search_len + 1); + } + else + HDstrncpy(search_name, op_name, (size_t)search_len + 1); + search_name[search_len + k - 1] = '\0'; + + if(HDstrcmp(path, search_name) == 0) { + switch(li->type) { + case H5L_TYPE_SOFT: + case H5L_TYPE_EXTERNAL: + handle_links(handle_data->fid, op_name, NULL, 0, NULL); + break; + + case H5L_TYPE_HARD: + case H5L_TYPE_MAX: + case H5L_TYPE_ERROR: + default: + error_msg("unknown link type value\n"); + h5tools_setstatus(EXIT_FAILURE); + break; + } /* end switch() */ + } + HDfree(search_name); } return 0; } /* end lnk_search() */ @@ -1488,7 +1465,7 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H hid_t gcpl_id; unsigned crt_order_flags; unsigned attr_crt_order_flags; - trav_handle_udata_t handle_udata; /* User data for traversal */ + trav_handle_udata_t handle_udata; /* User data for traversal */ if ((gcpl_id = H5Gget_create_plist(gid)) < 0) { error_msg("error in getting group creation property list ID\n"); @@ -1512,12 +1489,12 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H h5tools_setstatus(EXIT_FAILURE); } - handle_udata.fid = fid; - handle_udata.op_name = (char*)path_name; - if(h5trav_visit(fid, "/", TRUE, TRUE, obj_search, lnk_search, &handle_udata) < 0) { - error_msg("error traversing information\n"); - h5tools_setstatus(EXIT_FAILURE); - } + handle_udata.fid = fid; + handle_udata.op_name = (char*)path_name; + if(h5trav_visit(fid, "/", TRUE, TRUE, obj_search, lnk_search, &handle_udata) < 0) { + error_msg("error traversing information\n"); + h5tools_setstatus(EXIT_FAILURE); + } } } @@ -1559,7 +1536,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H /* find the last / */ while(j >= 0) { - if (attr[j] == '/' && (j==0 || (j>0 && attr[j-1]!='\\'))) + if (attr[j] == '/' && (j==0 || (j>0 && attr[j-1]!='\\'))) break; j--; } @@ -1594,7 +1571,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H string_dataformat.do_escape = display_escape; outputformat = &string_dataformat; - attr_name = h5tools_str_replace(attr + j + 1, "\\/", "/"); + attr_name = h5tools_str_replace(attr + j + 1, "\\/", "/"); /* handle error case: cannot open the object with the attribute */ if((oid = H5Oopen(fid, obj_name, H5P_DEFAULT)) < 0) { @@ -1650,7 +1627,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H } /* end if */ HDfree(obj_name); - HDfree(attr_name); + HDfree(attr_name); dump_indent -= COL; return; @@ -1658,9 +1635,9 @@ error: h5tools_setstatus(EXIT_FAILURE); if(obj_name) HDfree(obj_name); - - if (attr_name) - HDfree(attr_name); + + if (attr_name) + HDfree(attr_name); H5E_BEGIN_TRY { H5Oclose(oid); @@ -1695,24 +1672,10 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis { H5O_info_t oinfo; hid_t dsetid; - hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */ struct subset_t *sset = (struct subset_t *)data; const char *real_name = display_name ? display_name : dset; - if(display_data) { - if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) { - error_msg("error in creating default access property list ID\n"); - } - if (display_vds_first) { - if(H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0) - error_msg("error in setting access property list ID, virtual_view\n"); - } - if (vds_gap_size > 0) { - if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)vds_gap_size) < 0) - error_msg("error in setting access property list ID, virtual_printf_gap\n"); - } - } - if((dsetid = H5Dopen2(fid, dset, dapl_id)) < 0) { + if((dsetid = H5Dopen2(fid, dset, H5P_DEFAULT)) < 0) { if (pe) { handle_links(fid, dset, data, pe, display_name); } @@ -1789,7 +1752,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis h5tools_setstatus(EXIT_FAILURE); return; } - + /*------------------------------------------------------------------------- * check for block overlap *------------------------------------------------------------------------- @@ -1822,7 +1785,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis PRINTSTREAM(rawoutstream, "%s \"%s\"\n", HARDLINK, found_obj->objname); indentation(dump_indent); end_obj(h5tools_dump_header_format->datasetend, h5tools_dump_header_format->datasetblockend); - } + } else { found_obj->displayed = TRUE; dump_indent += COL; @@ -1838,8 +1801,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis dump_dataset(dsetid, real_name, sset); dump_indent -= COL; } - if (dapl_id != H5P_DEFAULT) - H5Pclose(dapl_id); + if(H5Dclose(dsetid) < 0) h5tools_setstatus(EXIT_FAILURE); } @@ -1922,11 +1884,11 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT if(H5Lget_info(fid, links, &linfo, H5P_DEFAULT) < 0) { error_msg("unable to get link info from \"%s\"\n", links); h5tools_setstatus(EXIT_FAILURE); - } + } else if(linfo.type == H5L_TYPE_HARD) { error_msg("\"%s\" is a hard link\n", links); h5tools_setstatus(EXIT_FAILURE); - } + } else { char *buf = (char *)HDmalloc(linfo.u.val_size); PRINTVALSTREAM(rawoutstream, "\n"); @@ -1963,12 +1925,12 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT PRINTSTREAM(rawoutstream, "TARGETFILE \"%s\"\n", elink_file); indentation(COL); PRINTSTREAM(rawoutstream, "TARGETPATH \"%s\"\n", elink_path); - } + } else { error_msg("h5dump error: unable to unpack external link value for \"%s\"\n", links); h5tools_setstatus(EXIT_FAILURE); } - } + } else { error_msg("h5dump error: unable to get external link value for \"%s\"\n", links); h5tools_setstatus(EXIT_FAILURE); diff --git a/tools/h5dump/h5dump_extern.h b/tools/h5dump/h5dump_extern.h index 62477d0..08f9e36 100644 --- a/tools/h5dump/h5dump_extern.h +++ b/tools/h5dump/h5dump_extern.h @@ -77,8 +77,6 @@ extern int enable_error_stack; /* re-enable error stack */ extern int disable_compact_subset; /* disable compact form of subset notation */ extern int display_packed_bits; /*print 1-8 byte numbers as packed bits*/ extern int include_attrs; /* Display attributes */ -extern int display_vds_first; /* vds display to first missing */ -extern int vds_gap_size; /* vds skip missing files */ /* sort parameters */ extern H5_index_t sort_by; /*sort_by [creation_order | name] */ diff --git a/tools/h5dump/testh5dumpvds.sh.in b/tools/h5dump/testh5dumpvds.sh.in index 850c03a..b15606f 100644 --- a/tools/h5dump/testh5dumpvds.sh.in +++ b/tools/h5dump/testh5dumpvds.sh.in @@ -98,14 +98,6 @@ $SRC_H5DUMP_TESTFILES/vds/5_a.h5 $SRC_H5DUMP_TESTFILES/vds/5_b.h5 $SRC_H5DUMP_TESTFILES/vds/5_c.h5 $SRC_H5DUMP_TESTFILES/vds/5_vds.h5 -$SRC_H5DUMP_TESTFILES/vds/a.h5 -$SRC_H5DUMP_TESTFILES/vds/b.h5 -$SRC_H5DUMP_TESTFILES/vds/c.h5 -$SRC_H5DUMP_TESTFILES/vds/d.h5 -$SRC_H5DUMP_TESTFILES/vds/vds-percival-unlim-maxmin.h5 -$SRC_H5DUMP_TESTFILES/vds/f-0.h5 -$SRC_H5DUMP_TESTFILES/vds/f-3.h5 -$SRC_H5DUMP_TESTFILES/vds/vds-eiger.h5 " LIST_OTHER_TEST_FILES=" @@ -121,11 +113,6 @@ $SRC_H5DUMP_TESTFILES/vds/tvds_layout-3_1.ddl $SRC_H5DUMP_TESTFILES/vds/tvds_layout-3_2.ddl $SRC_H5DUMP_TESTFILES/vds/tvds_layout-4.ddl $SRC_H5DUMP_TESTFILES/vds/tvds_layout-5.ddl -$SRC_H5DUMP_TESTFILES/vds/vds-first.ddl -$SRC_H5DUMP_TESTFILES/vds/vds-gap1.ddl -$SRC_H5DUMP_TESTFILES/vds/vds-gap2.ddl -$SRC_H5DUMP_TESTFILES/vds/vds_layout-eiger.ddl -$SRC_H5DUMP_TESTFILES/vds/vds_layout-maxmin.ddl " LIST_ERROR_TEST_FILES=" @@ -493,9 +480,6 @@ if test $USE_FILTER_DEFLATE = "yes" ; then TOOLTEST tvds-3_2.ddl --enable-error-stack 3_2_vds.h5 TOOLTEST tvds-4.ddl --enable-error-stack 4_vds.h5 TOOLTEST tvds-5.ddl --enable-error-stack 5_vds.h5 - TOOLTEST vds-first.ddl --vds-view-first-missing --enable-error-stack vds-percival-unlim-maxmin.h5 - TOOLTEST vds-gap1.ddl -d /VDS-Eiger --vds-gap-size=1 --enable-error-stack vds-eiger.h5 - TOOLTEST vds-gap2.ddl --vds-gap-size=2 --enable-error-stack vds-eiger.h5 fi # Layout read @@ -506,8 +490,6 @@ if test $USE_FILTER_DEFLATE = "yes" ; then TOOLTEST tvds_layout-3_2.ddl -p --enable-error-stack 3_2_vds.h5 TOOLTEST tvds_layout-4.ddl -p --enable-error-stack 4_vds.h5 TOOLTEST tvds_layout-5.ddl -p --enable-error-stack 5_vds.h5 - TOOLTEST vds_layout-eiger.ddl -p --enable-error-stack vds-eiger.h5 - TOOLTEST vds_layout-maxmin.ddl -p --enable-error-stack vds-percival-unlim-maxmin.h5 fi # Clean up temporary files/directories diff --git a/tools/h5repack/CMakeLists.txt b/tools/h5repack/CMakeLists.txt index 9b1fbcf..7631ae8 100644 --- a/tools/h5repack/CMakeLists.txt +++ b/tools/h5repack/CMakeLists.txt @@ -58,7 +58,7 @@ if (BUILD_TESTING) target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) H5_SET_LIB_OPTIONS ( ${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} - SHARED ${HDF5_PACKAGE_SOVERSION} + SHARED HDF5_TOOL_PLUGIN_LIB_NAME_RELEASE HDF5_TOOL_PLUGIN_LIB_NAME_DEBUG ) @@ -72,13 +72,13 @@ if (BUILD_TESTING) TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different + ARGS -E copy_if_different "$" "${CMAKE_BINARY_DIR}/plugins/$" ) include (CMakeTests.cmake) - + endif (BUILD_TESTING) ############################################################################## diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index 0b39a2b..38c84a2 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -61,7 +61,7 @@ if (BUILD_SHARED_LIBS) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIBSH_TARGET}") H5_SET_LIB_OPTIONS ( ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TOOLS_LIB_NAME} - SHARED ${HDF5_TOOLS_PACKAGE_SOVERSION} + SHARED HDF5_TOOLS_LIB_NAME_RELEASE HDF5_TOOLS_LIB_NAME_DEBUG ) diff --git a/tools/testfiles/h5dump-help.txt b/tools/testfiles/h5dump-help.txt index 7ebefc6..444dd97 100644 --- a/tools/testfiles/h5dump-help.txt +++ b/tools/testfiles/h5dump-help.txt @@ -25,8 +25,6 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. - --vds-view-first-missing Set the VDS bounds to first missing mapped elements. - --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl index 1a1b7e8..64a2880 100644 --- a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl +++ b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl @@ -25,8 +25,6 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. - --vds-view-first-missing Set the VDS bounds to first missing mapped elements. - --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tpbitsIncomplete.ddl b/tools/testfiles/pbits/tpbitsIncomplete.ddl index 2a2778a..cdb1f91 100644 --- a/tools/testfiles/pbits/tpbitsIncomplete.ddl +++ b/tools/testfiles/pbits/tpbitsIncomplete.ddl @@ -25,8 +25,6 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. - --vds-view-first-missing Set the VDS bounds to first missing mapped elements. - --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl index 5e00073..6d2492a 100644 --- a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl @@ -25,8 +25,6 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. - --vds-view-first-missing Set the VDS bounds to first missing mapped elements. - --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tpbitsLengthPositive.ddl b/tools/testfiles/pbits/tpbitsLengthPositive.ddl index f2574d4..4f56619 100644 --- a/tools/testfiles/pbits/tpbitsLengthPositive.ddl +++ b/tools/testfiles/pbits/tpbitsLengthPositive.ddl @@ -25,8 +25,6 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. - --vds-view-first-missing Set the VDS bounds to first missing mapped elements. - --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl index 15c0abc..3432433 100644 --- a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl @@ -25,8 +25,6 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. - --vds-view-first-missing Set the VDS bounds to first missing mapped elements. - --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl index c62e290..e51a09e 100644 --- a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl @@ -25,8 +25,6 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. - --vds-view-first-missing Set the VDS bounds to first missing mapped elements. - --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl index 5621a60..ba6e46d 100644 --- a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl +++ b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl @@ -25,8 +25,6 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. - --vds-view-first-missing Set the VDS bounds to first missing mapped elements. - --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value -- cgit v0.12 From 19a8216bd52b6a495c4bc989b7d01e9a7ecd46bf Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 22 Feb 2016 16:40:03 -0500 Subject: [svn-r29182] Re-commit of HDFFV-8740 fix, which adds the ability to configure external dataset storage path behavior. This check-in fixes a bug in the original check-in where the external path stored in the file struct was not copied on reopen causing subsequent dataset operations to fail. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial w/ fortran and C++ autotools parallel (MPICH 3.1.4) w/ fortran --- fortran/test/tH5F.F90 | 7 - src/H5.c | 3 +- src/H5Defl.c | 172 +++++----- src/H5Dint.c | 113 ++++++- src/H5Dpkg.h | 2 + src/H5Dprivate.h | 1 + src/H5F.c | 15 +- src/H5Fquery.c | 2 +- src/H5MM.c | 44 ++- src/H5Pdapl.c | 384 ++++++++++++++++++++- src/H5Plapl.c | 3 +- src/H5Ppublic.h | 2 + src/H5private.h | 6 +- src/H5system.c | 129 +++++++- src/H5win32defs.h | 23 +- test/Makefile.am | 2 +- test/external.c | 903 ++++++++++++++++++++++++++++++++++++++++---------- test/tfile.c | 60 +++- 18 files changed, 1554 insertions(+), 317 deletions(-) diff --git a/fortran/test/tH5F.F90 b/fortran/test/tH5F.F90 index 0b3c275..020d2c8 100644 --- a/fortran/test/tH5F.F90 +++ b/fortran/test/tH5F.F90 @@ -357,13 +357,6 @@ CONTAINS end do ! - !Initialize FORTRAN predifined datatypes - ! -! CALL h5init_types_f(error) -! CALL check("h5init_types_f",error,total_error) - - - ! !Create file "reopen.h5" using default properties. ! CALL h5_fixname_f(filename, fix_filename, H5P_DEFAULT_F, error) diff --git a/src/H5.c b/src/H5.c index 4de5731..41fb3ba 100644 --- a/src/H5.c +++ b/src/H5.c @@ -193,7 +193,8 @@ H5_init_library(void) /* Normal library termination code */ (void)HDatexit(H5_term_library); - H5_dont_atexit_g = TRUE; + + H5_dont_atexit_g = TRUE; } /* end if */ /* diff --git a/src/H5Defl.c b/src/H5Defl.c index ec96ae7..cf1b36c 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -28,12 +28,13 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* Files */ -#include "H5HLprivate.h" /* Local Heaps */ -#include "H5VMprivate.h" /* Vector and array functions */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5HLprivate.h" /* Local Heaps */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5VMprivate.h" /* Vector and array functions */ /****************/ @@ -48,12 +49,14 @@ /* Callback info for readvv operation */ typedef struct H5D_efl_readvv_ud_t { const H5O_efl_t *efl; /* Pointer to efl info */ + const H5D_t *dset; /* The dataset */ unsigned char *rbuf; /* Read buffer */ } H5D_efl_readvv_ud_t; /* Callback info for writevv operation */ typedef struct H5D_efl_writevv_ud_t { const H5O_efl_t *efl; /* Pointer to efl info */ + const H5D_t *dset; /* The dataset */ const unsigned char *wbuf; /* Write buffer */ } H5D_efl_writevv_ud_t; @@ -75,9 +78,9 @@ static ssize_t H5D__efl_writevv(const H5D_io_info_t *io_info, size_t mem_max_nseq, size_t *mem_curr_seq, size_t mem_len_arr[], hsize_t mem_offset_arr[]); /* Helper routines */ -static herr_t H5D__efl_read(const H5O_efl_t *efl, haddr_t addr, size_t size, +static herr_t H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size, uint8_t *buf); -static herr_t H5D__efl_write(const H5O_efl_t *efl, haddr_t addr, size_t size, +static herr_t H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size, const uint8_t *buf); @@ -232,25 +235,22 @@ H5D__efl_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNU /*------------------------------------------------------------------------- - * Function: H5D__efl_read + * Function: H5D__efl_read * - * Purpose: Reads data from an external file list. It is an error to - * read past the logical end of file, but reading past the end - * of any particular member of the external file list results in - * zeros. + * Purpose: Reads data from an external file list. It is an error to + * read past the logical end of file, but reading past the end + * of any particular member of the external file list results in + * zeros. * - * Return: Non-negative on success/Negative on failure + * Return: SUCCEED/FAIL * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Wednesday, March 4, 1998 * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. *------------------------------------------------------------------------- */ static herr_t -H5D__efl_read(const H5O_efl_t *efl, haddr_t addr, size_t size, uint8_t *buf) +H5D__efl_read(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size, uint8_t *buf) { int fd = -1; size_t to_read; @@ -261,6 +261,7 @@ H5D__efl_read(const H5O_efl_t *efl, haddr_t addr, size_t size, uint8_t *buf) haddr_t cur; ssize_t n; size_t u; /* Local index variable */ + char *full_name = NULL; /* File name with prefix */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -273,44 +274,49 @@ H5D__efl_read(const H5O_efl_t *efl, haddr_t addr, size_t size, uint8_t *buf) /* Find the first efl member from which to read */ for (u=0, cur=0; unused; u++) { - if(H5O_EFL_UNLIMITED == efl->slot[u].size || addr < cur + efl->slot[u].size) { - skip = addr - cur; - break; - } /* end if */ - cur += efl->slot[u].size; + if(H5O_EFL_UNLIMITED == efl->slot[u].size || addr < cur + efl->slot[u].size) { + skip = addr - cur; + break; + } /* end if */ + cur += efl->slot[u].size; } /* end for */ /* Read the data */ while(size) { HDassert(buf); - if(u >= efl->nused) - HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "read past logical end of file") - if(H5F_OVERFLOW_HSIZET2OFFT(efl->slot[u].offset + skip)) - HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed") - if((fd = HDopen(efl->slot[u].name, O_RDONLY, 0)) < 0) - HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file") - if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0) - HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file") + if(u >= efl->nused) + HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "read past logical end of file") + if(H5F_OVERFLOW_HSIZET2OFFT(efl->slot[u].offset + skip)) + HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed") + if(H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0) + HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name") + if((fd = HDopen(full_name, O_RDONLY, 0)) < 0) + HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file") + if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0) + HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file") #ifndef NDEBUG - tempto_read = MIN(efl->slot[u].size-skip, (hsize_t)size); + tempto_read = MIN((size_t)(efl->slot[u].size-skip), (hsize_t)size); H5_CHECK_OVERFLOW(tempto_read, hsize_t, size_t); - to_read = (size_t)tempto_read; + to_read = (size_t)tempto_read; #else /* NDEBUG */ - to_read = MIN((size_t)(efl->slot[u].size - skip), size); + to_read = MIN((size_t)(efl->slot[u].size - skip), (hsize_t)size); #endif /* NDEBUG */ - if((n = HDread(fd, buf, to_read)) < 0) - HGOTO_ERROR(H5E_EFL, H5E_READERROR, FAIL, "read error in external raw data file") - else if((size_t)n < to_read) - HDmemset(buf + n, 0, to_read - (size_t)n); - HDclose(fd); - fd = -1; - size -= to_read; - buf += to_read; - skip = 0; - u++; + if((n = HDread(fd, buf, to_read)) < 0) + HGOTO_ERROR(H5E_EFL, H5E_READERROR, FAIL, "read error in external raw data file") + else if((size_t)n < to_read) + HDmemset(buf + n, 0, to_read - (size_t)n); + full_name = (char *)H5MM_xfree(full_name); + HDclose(fd); + fd = -1; + size -= to_read; + buf += to_read; + skip = 0; + u++; } /* end while */ done: + if(full_name) + full_name = (char *)H5MM_xfree(full_name); if(fd >= 0) HDclose(fd); @@ -337,7 +343,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D__efl_write(const H5O_efl_t *efl, haddr_t addr, size_t size, const uint8_t *buf) +H5D__efl_write(const H5O_efl_t *efl, const H5D_t *dset, haddr_t addr, size_t size, const uint8_t *buf) { int fd = -1; size_t to_write; @@ -346,7 +352,8 @@ H5D__efl_write(const H5O_efl_t *efl, haddr_t addr, size_t size, const uint8_t *b #endif /* NDEBUG */ haddr_t cur; hsize_t skip = 0; - size_t u; /* Local index variable */ + size_t u; /* Local index variable */ + char *full_name = NULL; /* File name with prefix */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -359,46 +366,51 @@ H5D__efl_write(const H5O_efl_t *efl, haddr_t addr, size_t size, const uint8_t *b /* Find the first efl member in which to write */ for(u = 0, cur = 0; u < efl->nused; u++) { - if(H5O_EFL_UNLIMITED == efl->slot[u].size || addr < cur + efl->slot[u].size) { - skip = addr - cur; - break; - } /* end if */ - cur += efl->slot[u].size; + if(H5O_EFL_UNLIMITED == efl->slot[u].size || addr < cur + efl->slot[u].size) { + skip = addr - cur; + break; + } /* end if */ + cur += efl->slot[u].size; } /* end for */ /* Write the data */ while(size) { HDassert(buf); - if(u >= efl->nused) - HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "write past logical end of file") - if(H5F_OVERFLOW_HSIZET2OFFT(efl->slot[u].offset + skip)) - HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed") - if((fd = HDopen(efl->slot[u].name, O_CREAT | O_RDWR, 0666)) < 0) { - if(HDaccess(efl->slot[u].name, F_OK) < 0) - HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "external raw data file does not exist") - else - HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file") - } /* end if */ - if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0) - HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file") + if(u >= efl->nused) + HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "write past logical end of file") + if(H5F_OVERFLOW_HSIZET2OFFT(efl->slot[u].offset + skip)) + HGOTO_ERROR(H5E_EFL, H5E_OVERFLOW, FAIL, "external file address overflowed") + if(H5_combine_path(dset->shared->extfile_prefix, efl->slot[u].name, &full_name) < 0) + HGOTO_ERROR(H5E_EFL, H5E_NOSPACE, FAIL, "can't build external file name") + if((fd = HDopen(full_name, O_CREAT | O_RDWR, 0666)) < 0) { + if(HDaccess(full_name, F_OK) < 0) + HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "external raw data file does not exist") + else + HGOTO_ERROR(H5E_EFL, H5E_CANTOPENFILE, FAIL, "unable to open external raw data file") + } /* end if */ + if(HDlseek(fd, (HDoff_t)(efl->slot[u].offset + skip), SEEK_SET) < 0) + HGOTO_ERROR(H5E_EFL, H5E_SEEKERROR, FAIL, "unable to seek in external raw data file") #ifndef NDEBUG - tempto_write = MIN(efl->slot[u].size - skip, (hsize_t)size); + tempto_write = MIN(efl->slot[u].size - skip, (hsize_t)size); H5_CHECK_OVERFLOW(tempto_write, hsize_t, size_t); to_write = (size_t)tempto_write; #else /* NDEBUG */ - to_write = MIN((size_t)(efl->slot[u].size - skip), size); + to_write = MIN((size_t)(efl->slot[u].size - skip), size); #endif /* NDEBUG */ - if((size_t)HDwrite(fd, buf, to_write) != to_write) - HGOTO_ERROR(H5E_EFL, H5E_READERROR, FAIL, "write error in external raw data file") - HDclose (fd); - fd = -1; - size -= to_write; - buf += to_write; - skip = 0; - u++; + if((size_t)HDwrite(fd, buf, to_write) != to_write) + HGOTO_ERROR(H5E_EFL, H5E_READERROR, FAIL, "write error in external raw data file") + full_name = (char *)H5MM_xfree(full_name); + HDclose (fd); + fd = -1; + size -= to_write; + buf += to_write; + skip = 0; + u++; } /* end while */ done: + if(full_name) + full_name = (char *)H5MM_xfree(full_name); if(fd >= 0) HDclose(fd); @@ -427,7 +439,7 @@ H5D__efl_readvv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata) FUNC_ENTER_STATIC /* Read data */ - if(H5D__efl_read(udata->efl, dst_off, len, (udata->rbuf + src_off)) < 0) + if(H5D__efl_read(udata->efl, udata->dset, dst_off, len, (udata->rbuf + src_off)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "EFL read failed") done: @@ -464,6 +476,9 @@ H5D__efl_readvv(const H5D_io_info_t *io_info, HDassert(io_info); HDassert(io_info->store->efl.nused > 0); HDassert(io_info->u.rbuf); + HDassert(io_info->dset); + HDassert(io_info->dset->shared); + HDassert(io_info->dset->shared->extfile_prefix); HDassert(dset_curr_seq); HDassert(dset_len_arr); HDassert(dset_off_arr); @@ -473,6 +488,7 @@ H5D__efl_readvv(const H5D_io_info_t *io_info, /* Set up user data for H5VM_opvv() */ udata.efl = &(io_info->store->efl); + udata.dset = io_info->dset; udata.rbuf = (unsigned char *)io_info->u.rbuf; /* Call generic sequence operation routine */ @@ -507,7 +523,7 @@ H5D__efl_writevv_cb(hsize_t dst_off, hsize_t src_off, size_t len, void *_udata) FUNC_ENTER_STATIC /* Write data */ - if(H5D__efl_write(udata->efl, dst_off, len, (udata->wbuf + src_off)) < 0) + if(H5D__efl_write(udata->efl, udata->dset, dst_off, len, (udata->wbuf + src_off)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "EFL write failed") done: @@ -544,6 +560,9 @@ H5D__efl_writevv(const H5D_io_info_t *io_info, HDassert(io_info); HDassert(io_info->store->efl.nused > 0); HDassert(io_info->u.wbuf); + HDassert(io_info->dset); + HDassert(io_info->dset->shared); + HDassert(io_info->dset->shared->extfile_prefix); HDassert(dset_curr_seq); HDassert(dset_len_arr); HDassert(dset_off_arr); @@ -553,6 +572,7 @@ H5D__efl_writevv(const H5D_io_info_t *io_info, /* Set up user data for H5VM_opvv() */ udata.efl = &(io_info->store->efl); + udata.dset = io_info->dset; udata.wbuf = (const unsigned char *)io_info->u.wbuf; /* Call generic sequence operation routine */ diff --git a/src/H5Dint.c b/src/H5Dint.c index 3e2d212..fe34718 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -63,6 +63,8 @@ static herr_t H5D__cache_dataspace_info(const H5D_t *dset); static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space); static herr_t H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id); +static herr_t H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, + char **extfile_prefix); static herr_t H5D__open_oid(H5D_t *dataset, hid_t dapl_id, hid_t dxpl_id); static herr_t H5D__init_storage(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]); @@ -982,6 +984,84 @@ done: } /* end H5D__update_oh_info() */ +/*-------------------------------------------------------------------------- + * Function: H5D_build_extfile_prefix + * + * Purpose: Determine the external file prefix to be used and store + * it in extfile_prefix. Stores an empty string if no prefix + * should be used. + * + * Return: SUCCEED/FAIL + * + * Programmer: Steffen Kiess + * October 16, 2015 + *-------------------------------------------------------------------------- + */ +static herr_t +H5D_build_extfile_prefix(const H5D_t *dset, hid_t dapl_id, char **extfile_prefix /*out*/) +{ + char *prefix = NULL; /* prefix used to look for the file */ + char *extpath = NULL; /* absolute path of directory the HDF5 file is in */ + size_t extpath_len; /* length of extpath */ + size_t prefix_len; /* length of prefix */ + size_t extfile_prefix_len; /* length of expanded prefix */ + H5P_genplist_t *plist = NULL; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(dset); + HDassert(dset->oloc.file); + + extpath = H5F_EXTPATH(dset->oloc.file); + HDassert(extpath); + + /* XXX: Future thread-safety note - getenv is not required + * to be reentrant. + */ + prefix = HDgetenv("HDF5_EXTFILE_PREFIX"); + + if(prefix == NULL || *prefix == '\0') { + /* Set prefix to value of H5D_ACS_EFILE_PREFIX_NAME property */ + if(NULL == (plist = H5P_object_verify(dapl_id, H5P_DATASET_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + if(H5P_peek(plist, H5D_ACS_EFILE_PREFIX_NAME, &prefix) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file prefix") + } /* end if */ + + /* Prefix has to be checked for NULL / empty string again because the + * code above might have updated it. + */ + if(prefix == NULL || *prefix == '\0' || HDstrcmp(prefix, ".") == 0) { + /* filename is interpreted as relative to the current directory, + * does not need to be expanded + */ + if(NULL == (*extfile_prefix = (char *)H5MM_strdup(""))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + } /* end if */ + else { + if (HDstrncmp(prefix, "${ORIGIN}", HDstrlen("${ORIGIN}")) == 0) { + /* Replace ${ORIGIN} at beginning of prefix by directory of HDF5 file */ + extpath_len = HDstrlen(extpath); + prefix_len = HDstrlen(prefix); + extfile_prefix_len = extpath_len + prefix_len - HDstrlen("${ORIGIN}") + 1; + + if(NULL == (*extfile_prefix = (char *)H5MM_malloc(extfile_prefix_len))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate buffer") + HDsnprintf(*extfile_prefix, extfile_prefix_len, "%s%s", extpath, prefix + HDstrlen("${ORIGIN}")); + } /* end if */ + else { + if(NULL == (*extfile_prefix = (char *)H5MM_strdup(prefix))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + } /* end else */ + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D_build_extfile_prefix() */ + + /*------------------------------------------------------------------------- * Function: H5D__create * @@ -1151,6 +1231,10 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, /* Indicate that the layout information was initialized */ layout_init = TRUE; + /* Set the external file prefix */ + if(H5D_build_extfile_prefix(new_dset, dapl_id, &new_dset->shared->extfile_prefix) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix") + /* Add the dataset to the list of opened objects in the file */ if(H5FO_top_incr(new_dset->oloc.file, new_dset->oloc.addr) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't incr object ref. count") @@ -1195,6 +1279,7 @@ done: } /* end if */ if(new_dset->shared->dcpl_id != 0 && H5I_dec_ref(new_dset->shared->dcpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, NULL, "unable to decrement ref count on property list") + new_dset->shared->extfile_prefix = (char *)H5MM_xfree(new_dset->shared->extfile_prefix); new_dset->shared = H5FL_FREE(H5D_shared_t, new_dset->shared); } /* end if */ new_dset->oloc.file = NULL; @@ -1288,7 +1373,8 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) { H5D_shared_t *shared_fo = NULL; H5D_t *dataset = NULL; - H5D_t *ret_value = NULL; /* Return value */ + char *extfile_prefix = NULL; /* Expanded external file prefix */ + H5D_t *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) @@ -1307,6 +1393,10 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) if(H5G_name_copy(&(dataset->path), loc->path, H5_COPY_SHALLOW) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, NULL, "can't copy path") + /* Get the external file prefix */ + if(H5D_build_extfile_prefix(dataset, dapl_id, &extfile_prefix) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, NULL, "unable to initialize external file prefix") + /* Check if dataset was already open */ if(NULL == (shared_fo = (H5D_shared_t *)H5FO_opened(dataset->oloc.file, dataset->oloc.addr))) { /* Clear any errors from H5FO_opened() */ @@ -1326,6 +1416,12 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) /* We're the first dataset to use the the shared info */ dataset->shared->fo_count = 1; + + /* Set the external file prefix */ + dataset->shared->extfile_prefix = extfile_prefix; + /* Prevent string from being freed during done: */ + extfile_prefix = NULL; + } /* end if */ else { /* Point to shared info */ @@ -1334,6 +1430,12 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) /* Increment # of datasets using shared information */ shared_fo->fo_count++; + /* Check whether the external file prefix of the already open dataset + * matches the new external file prefix + */ + if(HDstrcmp(extfile_prefix, dataset->shared->extfile_prefix) != 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "new external file prefix does not match external file prefix of already open dataset") + /* Check if the object has been opened through the top file yet */ if(H5FO_top_count(dataset->oloc.file, dataset->oloc.addr) == 0) { /* Open the object through this top file */ @@ -1350,11 +1452,15 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id, hid_t dxpl_id) ret_value = dataset; done: + extfile_prefix = (char *)H5MM_xfree(extfile_prefix); + if(ret_value == NULL) { /* Free the location--casting away const*/ if(dataset) { - if(shared_fo == NULL) /* Need to free shared fo */ + if(shared_fo == NULL && dataset->shared) { /* Need to free shared fo */ + dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix); dataset->shared = H5FL_FREE(H5D_shared_t, dataset->shared); + } H5O_loc_free(&(dataset->oloc)); H5G_name_free(&(dataset->path)); @@ -1658,6 +1764,9 @@ H5D_close(H5D_t *dataset) if(dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset, H5AC_ind_read_dxpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTRELEASE, FAIL, "unable to destroy layout info") + /* Free the external file prefix */ + dataset->shared->extfile_prefix = (char *)H5MM_xfree(dataset->shared->extfile_prefix); + /* Release layout, fill-value, efl & pipeline messages */ if(dataset->shared->dcpl_id != H5P_DATASET_CREATE_DEFAULT) free_failed |= (H5O_msg_reset(H5O_PLINE_ID, &dataset->shared->dcpl_cache.pline) < 0) || diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 5972d9e..bc04300 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -441,6 +441,8 @@ typedef struct H5D_shared_t { */ H5D_rdcc_t chunk; /* Information about chunked data */ } cache; + + char *extfile_prefix; /* expanded external file prefix */ } H5D_shared_t; struct H5D_t { diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index 3b43aaf..ab60a50 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -54,6 +54,7 @@ #define H5D_ACS_PREEMPT_READ_CHUNKS_NAME "rdcc_w0" /* Preemption read chunks first */ #define H5D_ACS_VDS_VIEW_NAME "vds_view" /* VDS view option */ #define H5D_ACS_VDS_PRINTF_GAP_NAME "vds_printf_gap" /* VDS printf gap size */ +#define H5D_ACS_EFILE_PREFIX_NAME "external file prefix" /* External file prefix */ /* ======== Data transfer properties ======== */ #define H5D_XFER_MAX_TEMP_BUF_NAME "max_temp_buf" /* Maximum temp buffer size */ diff --git a/src/H5F.c b/src/H5F.c index be98157..95d87fc 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -785,10 +785,6 @@ done: * Programmer: Robb Matzke * Friday, October 16, 1998 * - * Modifications: - * Quincey Koziol, May 14, 2002 - * Keep old file's read/write intent in reopened file. - * *------------------------------------------------------------------------- */ hid_t @@ -803,26 +799,27 @@ H5Freopen(hid_t file_id) /* Check arguments */ if(NULL == (old_file = (H5F_t *)H5I_object_verify(file_id, H5I_FILE))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file") /* Get a new "top level" file struct, sharing the same "low level" file struct */ if(NULL == (new_file = H5F_new(old_file->shared, 0, H5P_FILE_CREATE_DEFAULT, H5P_FILE_ACCESS_DEFAULT, NULL))) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") + HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file") /* Duplicate old file's names */ new_file->open_name = H5MM_xstrdup(old_file->open_name); new_file->actual_name = H5MM_xstrdup(old_file->actual_name); + new_file->extpath = H5MM_xstrdup(old_file->extpath); if((ret_value = H5I_register(H5I_FILE, new_file, TRUE)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle") + HGOTO_ERROR(H5E_ATOM, H5E_CANTREGISTER, FAIL, "unable to atomize file handle") /* Keep this ID in file object structure */ new_file->file_id = ret_value; done: if(ret_value < 0 && new_file) - if(H5F_dest(new_file, H5AC_ind_read_dxpl_id, FALSE) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file") + if(H5F_dest(new_file, H5AC_ind_read_dxpl_id, FALSE) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close file") FUNC_LEAVE_API(ret_value) } /* end H5Freopen() */ diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 66f002c..e9af300 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -158,7 +158,7 @@ H5F_get_actual_name(const H5F_t *f) * Function: H5F_get_extpath * * Purpose: Retrieve the file's 'extpath' flags - * This is used by H5L_extern_traverse() to retrieve the main file's location + * This is used by H5L_extern_traverse() and H5D_build_extfile_prefix() to retrieve the main file's location * when searching the target file. * * Return: 'extpath' on success/abort on failure (shouldn't fail) diff --git a/src/H5MM.c b/src/H5MM.c index 09e6461..5c2a731 100644 --- a/src/H5MM.c +++ b/src/H5MM.c @@ -125,10 +125,10 @@ static size_t H5MM_peak_alloc_blocks_count_s = 0; * Function: H5MM__is_our_block * * Purpose: Try to determine if a memory buffer has been allocated through - * the H5MM* interface, instead of the system's malloc() routines. + * the H5MM* interface, instead of the system's malloc() routines. * - * Return: Success: TRUE/FALSE - * Failure: (Can't fail) + * Return: Success: TRUE/FALSE + * Failure: (Can't fail) * * Programmer: Quincey Koziol * Dec 30 2015 @@ -149,7 +149,7 @@ H5MM__is_our_block(void *mem) * * Purpose: Check a block wrapper around a buffer to validate it. * - * Return: N/A (void) + * Return: N/A (void) * * Programmer: Quincey Koziol * Dec 30 2015 @@ -173,9 +173,9 @@ H5MM__sanity_check_block(const H5MM_block_t *block) * Function: H5MM__sanity_check * * Purpose: Check a buffer to validate it (just calls - * H5MM__sanity_check_block after finding block for buffer) + * H5MM__sanity_check_block after finding block for buffer) * - * Return: N/A (void) + * Return: N/A (void) * * Programmer: Quincey Koziol * Dec 30 2015 @@ -196,7 +196,7 @@ H5MM__sanity_check(void *mem) * * Purpose: Sanity check all current memory allocations. * - * Return: N/A (void) + * Return: N/A (void) * * Programmer: Quincey Koziol * Jan 5 2016 @@ -206,7 +206,7 @@ H5MM__sanity_check(void *mem) void H5MM_sanity_check_all(void) { - H5MM_block_t *curr; + H5MM_block_t *curr = NULL; curr = H5MM_block_head_s.next; while(curr != &H5MM_block_head_s) { @@ -221,7 +221,7 @@ H5MM_sanity_check_all(void) * * Purpose: Final sanity checks on memory allocation. * - * Return: N/A (void) + * Return: N/A (void) * * Programmer: Quincey Koziol * Jan 1 2016 @@ -257,8 +257,8 @@ H5MM_final_sanity_check(void) * considered an error condition since allocations of zero * bytes usually indicate problems. * - * Return: Success: Pointer new memory - * Failure: NULL + * Return: Success: Pointer to new memory + * Failure: NULL * * Programmer: Quincey Koziol * Nov 8 2003 @@ -268,7 +268,7 @@ H5MM_final_sanity_check(void) void * H5MM_malloc(size_t size) { - void *ret_value; + void *ret_value = NULL; HDassert(size); @@ -346,8 +346,8 @@ H5MM_malloc(size_t size) * bytes usually indicate problems. * * - * Return: Success: Pointer new memory - * Failure: NULL + * Return: Success: Pointer to new memory + * Failure: NULL * * Programmer: Quincey Koziol * Nov 8 2003 @@ -357,7 +357,7 @@ H5MM_malloc(size_t size) void * H5MM_calloc(size_t size) { - void *ret_value; + void *ret_value = NULL; HDassert(size); @@ -392,8 +392,9 @@ H5MM_calloc(size_t size) * Note that the (NULL, 0) combination is undefined behavior * in the C standard. * - * Return: Success: Ptr to new memory if size > 0, NULL if size is zero - * Failure: NULL (input buffer is unchanged on failure) + * Return: Success: Ptr to new memory if size > 0 + * NULL if size is zero + * Failure: NULL (input buffer is unchanged on failure) * * Programmer: Robb Matzke * Jul 10 1997 @@ -403,7 +404,7 @@ H5MM_calloc(size_t size) void * H5MM_realloc(void *mem, size_t size) { - void *ret_value; + void *ret_value = NULL; /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -458,7 +459,6 @@ H5MM_realloc(void *mem, size_t size) * Failure: abort() * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 10 1997 *------------------------------------------------------------------------- */ @@ -490,17 +490,16 @@ done: * an error will be raised. * * Return: Success: Pointer to a new string - * Failure: abort() + * Failure: NULL * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 10 1997 *------------------------------------------------------------------------- */ char * H5MM_strdup(const char *s) { - char *ret_value; + char *ret_value = NULL; FUNC_ENTER_NOAPI(NULL) @@ -528,7 +527,6 @@ done: * Failure: never fails * * Programmer: Robb Matzke - * matzke@llnl.gov * Jul 10 1997 * *------------------------------------------------------------------------- diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index eab9337..6407d4c 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -16,8 +16,8 @@ /*------------------------------------------------------------------------- * * Created: H5Pdapl.c - * October 27, 2008 - * Neil Fortner + * October 27, 2008 + * Neil Fortner * * Purpose: Dataset access property list class routines * @@ -39,7 +39,8 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* Files */ #include "H5Iprivate.h" /* IDs */ -#include "H5Ppkg.h" /* Property lists */ +#include "H5Ppkg.h" /* Property lists */ +#include "H5MMprivate.h" /* Memory management */ /****************/ @@ -72,6 +73,17 @@ #define H5D_ACS_VDS_PRINTF_GAP_DEF (hsize_t)0 #define H5D_ACS_VDS_PRINTF_GAP_ENC H5P__encode_hsize_t #define H5D_ACS_VDS_PRINTF_GAP_DEC H5P__decode_hsize_t +/* Definitions for external file prefix */ +#define H5D_ACS_EFILE_PREFIX_SIZE sizeof(char *) +#define H5D_ACS_EFILE_PREFIX_DEF NULL /*default is no prefix */ +#define H5D_ACS_EFILE_PREFIX_SET H5P__dapl_efile_pref_set +#define H5D_ACS_EFILE_PREFIX_GET H5P__dapl_efile_pref_get +#define H5D_ACS_EFILE_PREFIX_ENC H5P__dapl_efile_pref_enc +#define H5D_ACS_EFILE_PREFIX_DEC H5P__dapl_efile_pref_dec +#define H5D_ACS_EFILE_PREFIX_DEL H5P__dapl_efile_pref_del +#define H5D_ACS_EFILE_PREFIX_COPY H5P__dapl_efile_pref_copy +#define H5D_ACS_EFILE_PREFIX_CMP H5P__dapl_efile_pref_cmp +#define H5D_ACS_EFILE_PREFIX_CLOSE H5P__dapl_efile_pref_close /******************/ /* Local Typedefs */ @@ -100,6 +112,16 @@ static herr_t H5P__decode_chunk_cache_nbytes(const void **_pp, void *_value); static herr_t H5P__dacc_vds_view_enc(const void *value, void **pp, size_t *size); static herr_t H5P__dacc_vds_view_dec(const void **pp, void *value); +/* Property list callbacks */ +static herr_t H5P__dapl_efile_pref_set(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__dapl_efile_pref_get(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size); +static herr_t H5P__dapl_efile_pref_dec(const void **_pp, void *value); +static herr_t H5P__dapl_efile_pref_del(hid_t prop_id, const char* name, size_t size, void* value); +static herr_t H5P__dapl_efile_pref_copy(const char* name, size_t size, void* value); +static int H5P__dapl_efile_pref_cmp(const void *value1, const void *value2, size_t size); +static herr_t H5P__dapl_efile_pref_close(const char* name, size_t size, void* value); + /*********************/ /* Package Variables */ @@ -134,6 +156,9 @@ const H5P_libclass_t H5P_CLS_DACC[1] = {{ /* Local Variables */ /*******************/ +/* Property value defaults */ +static const char *H5D_def_efile_prefix_g = H5D_ACS_EFILE_PREFIX_DEF; /* Default external file prefix string */ + /*------------------------------------------------------------------------- @@ -187,12 +212,274 @@ H5P__dacc_reg_prop(H5P_genclass_t *pclass) NULL, NULL, NULL, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register property for external file prefix */ + if(H5P_register_real(pclass, H5D_ACS_EFILE_PREFIX_NAME, H5D_ACS_EFILE_PREFIX_SIZE, &H5D_def_efile_prefix_g, + NULL, H5D_ACS_EFILE_PREFIX_SET, H5D_ACS_EFILE_PREFIX_GET, H5D_ACS_EFILE_PREFIX_ENC, H5D_ACS_EFILE_PREFIX_DEC, + H5D_ACS_EFILE_PREFIX_DEL, H5D_ACS_EFILE_PREFIX_COPY, H5D_ACS_EFILE_PREFIX_CMP, H5D_ACS_EFILE_PREFIX_CLOSE) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__dacc_reg_prop() */ /*------------------------------------------------------------------------- + * Function: H5P__dapl_efile_pref_set + * + * Purpose: Copies an external file prefix property when it's set + * for a property list + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_efile_pref_set(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(value); + + /* Copy the prefix */ + *(char **)value = H5MM_xstrdup(*(const char **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dapl_efile_pref_set() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_efile_pref_get + * + * Purpose: Copies an external file prefix property when it's retrieved + * from a property list + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_efile_pref_get(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(value); + + /* Copy the prefix */ + *(char **)value = H5MM_xstrdup(*(const char **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dapl_efile_pref_get() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_efile_pref_enc + * + * Purpose: Callback routine which is called whenever the efile flags + * property in the dataset access property list is + * encoded. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size) +{ + const char *efile_pref = *(const char * const *)value; + uint8_t **pp = (uint8_t **)_pp; + size_t len = 0; + uint64_t enc_value; + unsigned enc_size; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + + /* calculate prefix length */ + if(NULL != efile_pref) + len = HDstrlen(efile_pref); + + enc_value = (uint64_t)len; + enc_size = H5VM_limit_enc_size(enc_value); + HDassert(enc_size < 256); + + if(NULL != *pp) { + /* encode the length of the prefix */ + *(*pp)++ = (uint8_t)enc_size; + UINT64ENCODE_VAR(*pp, enc_value, enc_size); + + /* encode the prefix */ + if(NULL != efile_pref) { + HDmemcpy(*(char **)pp, efile_pref, len); + *pp += len; + } /* end if */ + } /* end if */ + + *size += (1 + enc_size); + if(NULL != efile_pref) + *size += len; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dapl_efile_pref_enc() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_efile_pref_dec + * + * Purpose: Callback routine which is called whenever the efile prefix + * property in the dataset access property list is + * decoded. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_efile_pref_dec(const void **_pp, void *_value) +{ + char **efile_pref = (char **)_value; + const uint8_t **pp = (const uint8_t **)_pp; + size_t len; + uint64_t enc_value; /* Decoded property value */ + unsigned enc_size; /* Size of encoded property */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(pp); + HDassert(*pp); + HDassert(efile_pref); + HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); + + /* Decode the size */ + enc_size = *(*pp)++; + HDassert(enc_size < 256); + + /* Decode the value */ + UINT64DECODE_VAR(*pp, enc_value, enc_size); + len = (size_t)enc_value; + + if(0 != len) { + /* Make a copy of the user's prefix string */ + if(NULL == (*efile_pref = (char *)H5MM_malloc(len + 1))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for prefix") + HDstrncpy(*efile_pref, *(const char **)pp, len); + (*efile_pref)[len] = '\0'; + + *pp += len; + } /* end if */ + else + *efile_pref = NULL; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dapl_efile_pref_dec() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_efile_pref_del + * + * Purpose: Frees memory used to store the external file prefix string + * + * Return: SUCCEED (Can't fail) + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_efile_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(value); + + H5MM_xfree(*(void **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dapl_efile_pref_del() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_efile_pref_copy + * + * Purpose: Creates a copy of the external file prefix string + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_efile_pref_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(value); + + *(char **)value = H5MM_xstrdup(*(const char **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dapl_efile_pref_copy() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_efile_pref_cmp + * + * Purpose: Callback routine which is called whenever the efile prefix + * property in the dataset creation property list is + * compared. + * + * Return: zero if VALUE1 and VALUE2 are equal, non zero otherwise. + * + *------------------------------------------------------------------------- + */ +static int +H5P__dapl_efile_pref_cmp(const void *value1, const void *value2, size_t H5_ATTR_UNUSED size) +{ + const char *pref1 = *(const char * const *)value1; + const char *pref2 = *(const char * const *)value2; + int ret_value = 0; + + FUNC_ENTER_NOAPI_NOINIT_NOERR + + if(NULL == pref1 && NULL != pref2) + HGOTO_DONE(1); + if(NULL != pref1 && NULL == pref2) + HGOTO_DONE(-1); + if(NULL != pref1 && NULL != pref2) + ret_value = HDstrcmp(pref1, pref2); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5P__dapl_efile_pref_cmp() */ + + +/*------------------------------------------------------------------------- + * Function: H5P__dapl_efile_pref_close + * + * Purpose: Frees memory used to store the external file prefix string + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +static herr_t +H5P__dapl_efile_pref_close(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(value); + + H5MM_xfree(*(void **)value); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5P__dapl_efile_pref_close() */ + + +/*------------------------------------------------------------------------- * Function: H5Pset_chunk_cache * * Purpose: Set the number of objects in the meta data cache and the @@ -787,3 +1074,94 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_virtual_printf_gap() */ + +/*------------------------------------------------------------------------- + * Function: H5Pset_efile_prefix + * + * Purpose: Set a prefix to be used for any external files. + * + * If the prefix starts with ${ORIGIN}, this will be replaced by + * the absolute path of the directory of the HDF5 file containing + * the dataset. + * + * If the prefix is ".", no prefix will be applied. + * + * This property can be overwritten by the environment variable + * HDF5_EXTFILE_PREFIX. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_efile_prefix(hid_t plist_id, const char *prefix) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*s", plist_id, prefix); + + /* Get the plist structure */ + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Set prefix */ + if(H5P_set(plist, H5D_ACS_EFILE_PREFIX_NAME, &prefix) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set prefix info") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_efile_prefix() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_efile_prefix + * + * Purpose: Gets the prefix to be used for any external files. + * + * If the pointer is not NULL, it points to a user-allocated + * buffer. + * + * Return: Non-negative on success/Negative on failure + * + *------------------------------------------------------------------------- + */ +ssize_t +H5Pget_efile_prefix(hid_t plist_id, char *prefix, size_t size) +{ + H5P_genplist_t *plist; /* Property list pointer */ + char *my_prefix; /* Library's copy of the prefix */ + size_t len; /* Length of prefix string */ + ssize_t ret_value; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("Zs", "i*sz", plist_id, prefix, size); + + /* Get the plist structure */ + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Get the current prefix */ + if(H5P_peek(plist, H5D_ACS_EFILE_PREFIX_NAME, &my_prefix) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file prefix") + + /* Check for prefix being set */ + if(my_prefix) { + /* Copy to user's buffer, if given */ + len = HDstrlen(my_prefix); + if(prefix) { + HDstrncpy(prefix, my_prefix, MIN(len + 1, size)); + if(len >= size) + prefix[size - 1] = '\0'; + } /* end if */ + } /* end if */ + else + len = 0; + + /* Set return value */ + ret_value = (ssize_t)len; + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_efile_prefix() */ diff --git a/src/H5Plapl.c b/src/H5Plapl.c index f725435..266dc63 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -800,7 +800,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5P__lacc_elink_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED size, void *value) +H5P__lacc_elink_pref_del(hid_t H5_ATTR_UNUSED prop_id, const char H5_ATTR_UNUSED *name, + size_t H5_ATTR_UNUSED size, void *value) { FUNC_ENTER_STATIC_NOERR diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 589bcdc..894fc2c 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -406,6 +406,8 @@ H5_DLL herr_t H5Pset_virtual_view(hid_t plist_id, H5D_vds_view_t view); H5_DLL herr_t H5Pget_virtual_view(hid_t plist_id, H5D_vds_view_t *view); H5_DLL herr_t H5Pset_virtual_printf_gap(hid_t plist_id, hsize_t gap_size); H5_DLL herr_t H5Pget_virtual_printf_gap(hid_t plist_id, hsize_t *gap_size); +H5_DLL herr_t H5Pset_efile_prefix(hid_t dapl_id, const char* prefix); +H5_DLL ssize_t H5Pget_efile_prefix(hid_t dapl_id, char* prefix /*out*/, size_t size); /* Dataset xfer property list (DXPL) routines */ H5_DLL herr_t H5Pset_data_transform(hid_t plist_id, const char* expression); diff --git a/src/H5private.h b/src/H5private.h index 8d5f4c9..fa5a114 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1189,6 +1189,9 @@ typedef off_t h5_stat_size_t; #ifndef HDsetbuf #define HDsetbuf(F,S) setbuf(F,S) #endif /* HDsetbuf */ +#ifndef HDsetenv + #define HDsetenv(N,V,O) setenv(N,V,O) +#endif /* HDsetenv */ #ifndef HDsetgid #define HDsetgid(G) setgid(G) #endif /* HDsetgid */ @@ -2560,7 +2563,8 @@ H5_DLL uint32_t H5_hash_string(const char *str); H5_DLL time_t H5_make_time(struct tm *tm); /* Functions for building paths, etc. */ -H5_DLL herr_t H5_build_extpath(const char *, char ** /*out*/ ); +H5_DLL herr_t H5_build_extpath(const char *name, char **extpath /*out*/); +H5_DLL herr_t H5_combine_path(const char *path1, const char *path2, char **full_name /*out*/); /* Functions for debugging */ H5_DLL herr_t H5_buffer_dump(FILE *stream, int indent, const uint8_t *buf, diff --git a/src/H5system.c b/src/H5system.c index 4baebc5..eb09b15 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -757,7 +757,7 @@ done: */ int Wgettimeofday(struct timeval *tv, struct timezone *tz) - { +{ union { unsigned long long ns100; /*time since 1 Jan 1601 in 100ns units */ FILETIME ft; @@ -783,7 +783,42 @@ Wgettimeofday(struct timeval *tv, struct timezone *tz) /* Always return 0 as per Open Group Base Specifications Issue 6. Do not set errno on error. */ return 0; -} +} /* end Wgettimeofday() */ + + +/*------------------------------------------------------------------------- + * Function: Wsetenv + * + * Purpose: Wrapper function for setenv on Windows systems. + * Interestingly, getenv *is* available in the Windows + * POSIX layer, just not setenv. + * + * Return: Success: 0 + * Failure: non-zero error code + * + * Programmer: Dana Robinson + * February 2016 + * + *------------------------------------------------------------------------- + */ +int +Wsetenv(const char *name, const char *value, int overwrite) +{ + size_t bufsize; + errno_t err; + + /* If we're not overwriting, check if the environment variable exists. + * If it does (i.e.: the required buffer size to store the variable's + * value is non-zero), then return an error code. + */ + if(!overwrite) { + err = getenv_s(&bufsize, NULL, 0, name); + if (err || bufsize) + return (int)err; + } /* end if */ + + return (int)_putenv_s(name, value); +} /* end Wsetenv() */ #ifdef H5_HAVE_WINSOCK2_H #pragma comment(lib, "advapi32.lib") @@ -881,26 +916,25 @@ Wflock(int fd, int operation) { /*------------------------------------------------------------------------- - * Function: H5_build_extpath + * Function: H5_build_extpath * - * Purpose: To build the path for later searching of target file for external - * link. This path can be either: + * Purpose: To build the path for later searching of target file for external + * links and external files. This path can be either: * 1. The absolute path of NAME * or * 2. The current working directory + relative path of NAME * - * Return: Success: 0 - * Failure: -1 + * Return: SUCCEED/FAIL * * Programmer: Vailin Choi - * April 2, 2008 + * April 2, 2008 * *------------------------------------------------------------------------- */ #define MAX_PATH_LEN 1024 herr_t -H5_build_extpath(const char *name, char **extpath/*out*/) +H5_build_extpath(const char *name, char **extpath /*out*/) { char *full_path = NULL; /* Pointer to the full path, as built or passed in */ char *cwdpath = NULL; /* Pointer to the current working directory path */ @@ -998,5 +1032,80 @@ done: H5MM_xfree(new_name); FUNC_LEAVE_NOAPI(ret_value) -} /* H5_build_extpath() */ +} /* end H5_build_extpath() */ + + +/*-------------------------------------------------------------------------- + * Function: H5_combine_path + * + * Purpose: If path2 is relative, interpret path2 as relative to path1 + * and store the result in full_name. Otherwise store path2 + * in full_name. + * + * Return: SUCCEED/FAIL + * + * Programmer: Steffen Kiess + * June 22, 2015 + *-------------------------------------------------------------------------- + */ +herr_t +H5_combine_path(const char* path1, const char* path2, char **full_name /*out*/) +{ + size_t path1_len; /* length of path1 */ + size_t path2_len; /* length of path2 */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT + + HDassert(path1); + HDassert(path2); + + path1_len = HDstrlen(path1); + path2_len = HDstrlen(path2); + + if(*path1 == '\0' || H5_CHECK_ABSOLUTE(path2)) { + + /* If path1 is empty or path2 is absolute, simply use path2 */ + if(NULL == (*full_name = (char *)H5MM_strdup(path2))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + + } /* end if */ + else if(H5_CHECK_ABS_PATH(path2)) { + + /* On windows path2 is a path absolute name */ + if (H5_CHECK_ABSOLUTE(path1) || H5_CHECK_ABS_DRIVE(path1)) { + /* path1 is absolute or drive absolute and path2 is path absolute. + * Use the drive letter of path1 + path2 + */ + if(NULL == (*full_name = (char *)H5MM_malloc(path2_len + 3))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate path2 buffer") + HDsnprintf(*full_name, (path2_len + 3), "%c:%s", path1[0], path2); + } /* end if */ + else { + /* On windows path2 is path absolute name ("\foo\bar"), + * path1 does not have a drive letter (i.e. is "a\b" or "\a\b"). + * Use path2. + */ + if(NULL == (*full_name = (char *)H5MM_strdup(path2))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + } /* end else */ + + } /* end else if */ + else { + + /* Relative path2: + * Allocate a buffer to hold path1 + path2 + possibly the delimiter + * + terminating null byte + */ + if(NULL == (*full_name = (char *)H5MM_malloc(path1_len + path2_len + 2))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate filename buffer") + + /* Compose the full file name */ + HDsnprintf(*full_name, (path1_len + path2_len + 2), "%s%s%s", path1, + (H5_CHECK_DELIMITER(path1[path1_len - 1]) ? "" : H5_DIR_SEPS), path2); + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5_combine_name() */ diff --git a/src/H5win32defs.h b/src/H5win32defs.h index e84def9..2a0f22d 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -71,21 +71,24 @@ struct timezone { }; #ifdef __cplusplus - extern "C" { +extern "C" { #endif /* __cplusplus */ - H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz); - H5_DLL int Wflock(int fd, int operation); - H5_DLL char* Wgetlogin(void); - H5_DLL int c99_snprintf(char* str, size_t size, const char* format, ...); - H5_DLL int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap); + H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz); + H5_DLL int Wsetenv(const char *name, const char *value, int overwrite); + H5_DLL int Wflock(int fd, int operation); + H5_DLL char* Wgetlogin(void); + H5_DLL int c99_snprintf(char* str, size_t size, const char* format, ...); + H5_DLL int c99_vsnprintf(char* str, size_t size, const char* format, va_list ap); #ifdef __cplusplus - } +} #endif /* __cplusplus */ + #define HDgettimeofday(V,Z) Wgettimeofday(V,Z) +#define HDsetenv(N,V,O) Wsetenv(N,V,O) #define HDflock(F,L) Wflock(F,L) #define HDgetlogin() Wgetlogin() #define HDsnprintf c99_snprintf /*varargs*/ -#define HDvsnprintf c99_vsnprintf +#define HDvsnprintf c99_vsnprintf /*varargs*/ #endif /* H5_HAVE_VISUAL_STUDIO */ @@ -98,5 +101,7 @@ struct timezone { #ifndef H5_HAVE_MINGW #define HDftruncate(F,L) _chsize_s(F,L) #define HDfseek(F,O,W) _fseeki64(F,O,W) -#endif +#endif /* H5_HAVE_MINGW */ + #endif /* H5_HAVE_WIN32_API */ + diff --git a/test/Makefile.am b/test/Makefile.am index 8389cc4..c3761b7 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -129,7 +129,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse huge_chunks.h5 chunk_cache.h5 big_chunk.h5 chunk_expand.h5 \ copy_dcpl_newfile.h5 extend.h5 istore.h5 extlinks*.h5 frspace.h5 links*.h5 \ sys_file1 tfile[1-7].h5 th5s[1-4].h5 lheap.h5 fheap.h5 ohdr.h5 \ - stab.h5 extern_[1-3].h5 extern_[1-4][ab].raw gheap[0-4].h5 \ + stab.h5 extern_[1-4].h5 extern_[1-4][rw].raw gheap[0-4].h5 \ dt_arith[1-2] links.h5 links[0-6]*.h5 extlinks[0-15].h5 tmp \ big.data big[0-9][0-9][0-9][0-9][0-9].h5 \ stdio.h5 sec2.h5 dtypes[0-9].h5 dtypes1[0].h5 dt_arith[1-2].h5 tattr.h5 \ diff --git a/test/external.c b/test/external.c index 181f43b..af38428 100644 --- a/test/external.c +++ b/test/external.c @@ -17,7 +17,7 @@ * Programmer: Robb Matzke * Tuesday, March 3, 1998 * - * Purpose: Tests datasets stored in external raw files. + * Purpose: Tests datasets stored in external raw files. */ #include "h5test.h" @@ -25,9 +25,19 @@ const char *FILENAME[] = { "extern_1", "extern_2", "extern_3", + "extern_4", + "extern_dir/file_1", NULL }; +/* A similar collection of files is used for the tests that + * perform file I/O. + */ +#define N_EXT_FILES 4 +#define PART_SIZE 25 +#define TOTAL_SIZE 100 +#define GARBAGE_PER_FILE 10 + /*------------------------------------------------------------------------- * Function: files_have_same_contents @@ -35,7 +45,7 @@ const char *FILENAME[] = { * Purpose: Determines whether two files contain the same data. * * Return: Success: nonzero if same, zero if different. - * Failure: zero + * Failure: zero * * Programmer: Robb Matzke * Wednesday, March 4, 1998 @@ -45,9 +55,9 @@ const char *FILENAME[] = { static hbool_t files_have_same_contents(const char *name1, const char *name2) { - int fd1 = 0, fd2 = 0; - ssize_t n1, n2; - char buf1[1024], buf2[1024]; + int fd1 = 0, fd2 = 0; + ssize_t n1, n2; + char buf1[1024], buf2[1024]; hbool_t ret = false; /* not equal until proven otherwise */ if((fd1 = HDopen(name1, O_RDONLY, 0666)) < 0) @@ -90,6 +100,106 @@ out: /*------------------------------------------------------------------------- + * Function: reset_raw_data_files + * + * Purpose: Resets the data in the raw data files for tests that + * perform dataset I/O on a set of files. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * February 2016 + * + *------------------------------------------------------------------------- + */ +static herr_t +reset_raw_data_files(void) +{ + int fd = 0; /* external file descriptor */ + size_t i, j; /* iterators */ + hssize_t n; /* bytes of I/O */ + char filename[1024]; /* file name */ + int data[PART_SIZE]; /* raw data buffer */ + uint8_t *garbage = NULL; /* buffer of garbage data */ + size_t garbage_count; /* size of garbage buffer */ + size_t garbage_bytes; /* # of garbage bytes written to file */ + + /* Set up garbage buffer */ + garbage_count = N_EXT_FILES * GARBAGE_PER_FILE; + if(NULL == (garbage = (uint8_t *)HDcalloc(garbage_count, sizeof(uint8_t)))) + goto error; + for(i = 0; i < garbage_count; i++) + garbage[i] = 0xFF; + + /* The *r files are pre-filled with data and are used to + * verify that read operations work correctly. + */ + for(i = 0; i < N_EXT_FILES; i++) { + + /* Open file */ + HDsprintf(filename, "extern_%lur.raw", (unsigned long)i + 1); + if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) + goto error; + + /* Write garbage data to the file. This allows us to test the + * the ability to set an offset in the raw data file. + */ + garbage_bytes = i * 10; + n = HDwrite(fd, garbage, garbage_bytes); + if(n < 0 || (size_t)n != garbage_bytes) + goto error; + + /* Fill array with data */ + for(j = 0; j < PART_SIZE; j++) { + data[j] = (int)(i * 25 + j); + } /* end for */ + + /* Write raw data to the file. */ + n = HDwrite(fd, data, sizeof(data)); + if(n != sizeof(data)) + goto error; + + /* Close this file */ + HDclose(fd); + + } /* end for */ + + /* The *w files are only pre-filled with the garbage data and are + * used to verify that write operations work correctly. The individual + * tests fill in the actual data. + */ + for(i = 0; i < N_EXT_FILES; i++) { + + /* Open file */ + HDsprintf(filename, "extern_%luw.raw", (unsigned long)i + 1); + if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) + goto error; + + /* Write garbage data to the file. This allows us to test the + * the ability to set an offset in the raw data file. + */ + garbage_bytes = i * 10; + n = HDwrite(fd, garbage, garbage_bytes); + if(n < 0 || (size_t)n != garbage_bytes) + goto error; + + /* Close this file */ + HDclose(fd); + + } /* end for */ + HDfree(garbage); + return SUCCEED; + +error: + if(fd) + HDclose(fd); + if(garbage) + HDfree(garbage); + return FAIL; +} /* end reset_raw_data_files() */ + + +/*------------------------------------------------------------------------- * Function: test_non_extendible * * Purpose: Tests a non-extendible dataset with a single external file. @@ -105,15 +215,15 @@ out: static int test_non_extendible(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* data space current size */ - hsize_t max_size[1]; /* data space maximum size */ - int n; /* number of external files */ - char name[256]; /* external file name */ - off_t file_offset; /* external file offset */ - hsize_t file_size; /* sizeof external file segment */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* data space current size */ + hsize_t max_size[1]; /* data space maximum size */ + int n; /* number of external files */ + char name[256]; /* external file name */ + off_t file_offset; /* external file offset */ + hsize_t file_size; /* sizeof external file segment */ haddr_t dset_addr; /* address of dataset */ TESTING("fixed-size data space, exact storage"); @@ -203,7 +313,7 @@ test_non_extendible(hid_t file) * Return: Success: 0 * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 23, 1998 * *------------------------------------------------------------------------- @@ -211,11 +321,11 @@ test_non_extendible(hid_t file) static int test_too_small(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* current data space size */ - hsize_t max_size[1]; /* maximum data space size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* current data space size */ + hsize_t max_size[1]; /* maximum data space size */ TESTING("external storage is too small"); @@ -257,10 +367,10 @@ test_too_small(hid_t file) * represent the current data and large enough to represent the * eventual size of the data. * - * Return: Success: 0 - * Failure: 1 + * Return: Success: 0 + * Failure: 1 * - * Programmer: Robb Matzke + * Programmer: Robb Matzke * Monday, November 23, 1998 * *------------------------------------------------------------------------- @@ -268,11 +378,11 @@ test_too_small(hid_t file) static int test_large_enough_current_eventual(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* current data space size */ - hsize_t max_size[1]; /* maximum data space size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* current data space size */ + hsize_t max_size[1]; /* maximum data space size */ TESTING("extendible dataspace, exact external size"); @@ -321,11 +431,11 @@ error: static int test_large_enough_current_not_eventual(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* current data space size */ - hsize_t max_size[1]; /* maximum data space size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* current data space size */ + hsize_t max_size[1]; /* maximum data space size */ TESTING("extendible dataspace, external storage is too small"); @@ -361,7 +471,7 @@ test_large_enough_current_not_eventual(hid_t file) /*------------------------------------------------------------------------- - * Function: test_1e + * Function: test_unlimited * * Purpose: Test a single external file of unlimited size and an * unlimited data space. @@ -377,15 +487,15 @@ test_large_enough_current_not_eventual(hid_t file) static int test_unlimited(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* data space current size */ - hsize_t max_size[1]; /* data space maximum size */ - int n; /* number of external files */ - char name[256]; /* external file name */ - off_t file_offset; /* external file offset */ - hsize_t file_size; /* sizeof external file segment */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* data space current size */ + hsize_t max_size[1]; /* data space maximum size */ + int n; /* number of external files */ + char name[256]; /* external file name */ + off_t file_offset; /* external file offset */ + hsize_t file_size; /* sizeof external file segment */ TESTING("unlimited dataspace, unlimited external storage"); @@ -468,11 +578,11 @@ test_unlimited(hid_t file) static int test_multiple_files(hid_t file) { - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* dataspace */ - hid_t dset = -1; /* dataset */ - hsize_t cur_size[1]; /* data space current size */ - hsize_t max_size[1]; /* data space maximum size */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* dataspace */ + hid_t dset = -1; /* dataset */ + hsize_t cur_size[1]; /* data space current size */ + hsize_t max_size[1]; /* data space maximum size */ TESTING("multiple external files"); @@ -528,9 +638,9 @@ error: static int test_add_to_unlimited(void) { - hid_t dcpl = -1; /* dataset creation properties */ - herr_t status; /* function return status */ - int n; /* number of external files */ + hid_t dcpl = -1; /* dataset creation properties */ + herr_t status; /* function return status */ + int n; /* number of external files */ TESTING("external file following unlimited file"); @@ -579,8 +689,8 @@ test_add_to_unlimited(void) static int test_overflow(void) { - hid_t dcpl = -1; /* dataset creation properties */ - herr_t status; /* return status */ + hid_t dcpl = -1; /* dataset creation properties */ + herr_t status; /* return status */ TESTING("address overflow in external files"); @@ -624,43 +734,30 @@ test_overflow(void) static int test_read_file_set(hid_t fapl) { - hid_t file = -1; /* file to write to */ - hid_t dcpl = -1; /* dataset creation properties */ - hid_t space = -1; /* data space */ - hid_t dset = -1; /* dataset */ - hid_t grp = -1; /* group to emit diagnostics */ - int fd = -1; /* external file descriptors */ - size_t i, j; /* miscellaneous counters */ - hssize_t n; /* bytes of I/O */ - char filename[1024]; /* file names */ - int part[25], whole[100]; /* raw data buffers */ - hsize_t cur_size; /* current data space size */ - hid_t hs_space; /* hyperslab data space */ - hsize_t hs_start = 30; /* hyperslab starting offset */ - hsize_t hs_count = 25; /* hyperslab size */ - int temparray[10] = {0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f,0x0f0f0f0f}; + hid_t file = -1; /* file to write to */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dset = -1; /* dataset */ + hid_t grp = -1; /* group to emit diagnostics */ + size_t i; /* miscellaneous counter */ + char filename[1024]; /* file names */ + int part[PART_SIZE]; /* raw data buffer (partial) */ + int whole[TOTAL_SIZE]; /* raw data buffer (total) */ + hsize_t cur_size; /* current data space size */ + hid_t hs_space = -1; /* hyperslab data space */ + hsize_t hs_start = 30; /* hyperslab starting offset */ + hsize_t hs_count = 25; /* hyperslab size */ TESTING("read external dataset"); - /* Write the data to external files directly */ - for(i=0; i<4; i++) { - for(j=0; j<25; j++) { - part[j] = (int)(i*25+j); - } /* end for */ - HDsprintf(filename, "extern_%lua.raw", (unsigned long)i+1); - if((fd = HDopen(filename, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) - TEST_ERROR - n = HDwrite(fd, temparray, (size_t)i*10); - if(n < 0 || (size_t)n != i*10) - TEST_ERROR - n = HDwrite(fd, part, sizeof(part)); - if(n != sizeof(part)) + if(HDsetenv("HDF5_EXTFILE_PREFIX", "", 1) < 0) + TEST_ERROR + + /* Reset the raw data files */ + if(reset_raw_data_files() < 0) TEST_ERROR - HDclose(fd); - } /* end for */ - /* - * Create the file and an initial group. This causes messages about + /* Create the file and an initial group. This causes messages about * debugging to be emitted before we start playing games with what the * output looks like. */ @@ -671,50 +768,57 @@ test_read_file_set(hid_t fapl) FAIL_STACK_ERROR if(H5Gclose(grp) < 0) FAIL_STACK_ERROR - /* Create the dataset */ + /* Create the dcpl */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR - if(H5Pset_external(dcpl, "extern_1a.raw", (off_t)0, (hsize_t)sizeof part) < 0 || - H5Pset_external(dcpl, "extern_2a.raw", (off_t)10, (hsize_t)sizeof part) < 0 || - H5Pset_external(dcpl, "extern_3a.raw", (off_t)20, (hsize_t)sizeof part) < 0 || - H5Pset_external(dcpl, "extern_4a.raw", (off_t)30, (hsize_t)sizeof part) < 0) - FAIL_STACK_ERROR - cur_size = 100; + for(i = 0; i < N_EXT_FILES; i++) { + HDsnprintf(filename, sizeof(filename), "extern_%dr.raw", (int) i + 1); + if(H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0) + FAIL_STACK_ERROR + } /* end for */ + + /* Create the dataspace */ + cur_size = TOTAL_SIZE; if((space = H5Screate_simple(1, &cur_size, NULL)) < 0) FAIL_STACK_ERROR + + /* Create the dataset */ if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR - /* - * Read the entire dataset and compare with the original - */ + /* Read the entire dataset */ HDmemset(whole, 0, sizeof(whole)); if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0) FAIL_STACK_ERROR - for(i = 0; i < 100; i++) + + /* Compare data */ + for(i = 0; i < TOTAL_SIZE; i++) if(whole[i] != (signed)i) - FAIL_PUTS_ERROR(" Incorrect value(s) read."); + FAIL_PUTS_ERROR("Incorrect value(s) read."); - /* Read the middle of the dataset */ - if((hs_space = H5Scopy(space)) < 0) - FAIL_STACK_ERROR - if(H5Sselect_hyperslab(hs_space, H5S_SELECT_SET, &hs_start, NULL, &hs_count, NULL) < 0) - FAIL_STACK_ERROR + /* Read via a hypserslab in the middle of the dataset */ - HDmemset(whole, 0, sizeof(whole)); - if(H5Dread(dset, H5T_NATIVE_INT, hs_space, hs_space, H5P_DEFAULT, whole) < 0) - FAIL_STACK_ERROR + /* Set up dataspace */ + if((hs_space = H5Scopy(space)) < 0) + FAIL_STACK_ERROR + if(H5Sselect_hyperslab(hs_space, H5S_SELECT_SET, &hs_start, NULL, &hs_count, NULL) < 0) + FAIL_STACK_ERROR - if(H5Sclose(hs_space) < 0) FAIL_STACK_ERROR + /* Read */ + HDmemset(whole, 0, sizeof(whole)); + if(H5Dread(dset, H5T_NATIVE_INT, hs_space, hs_space, H5P_DEFAULT, whole) < 0) + FAIL_STACK_ERROR - for(i = hs_start; i= 0) + FAIL_PUTS_ERROR("reopening the dataset with a different efile_prefix succeded"); + + /* Read the entire dataset and compare with the original */ + HDmemset(whole, 0, sizeof(whole)); + if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0) + FAIL_STACK_ERROR + for(i = 0; i < TOTAL_SIZE; i++) + if(whole[i] != (signed)i) + FAIL_PUTS_ERROR("Incorrect value(s) read."); + + /* Close dataset */ + if(H5Dclose(dset2) < 0) FAIL_STACK_ERROR + if(H5Dclose(dset) < 0) FAIL_STACK_ERROR + + /* Open dataset (use a differend prefix than for create. + * This works because the dataset was closed. + */ + if(H5Pset_efile_prefix(dapl2, "${ORIGIN}/.") < 0) + FAIL_STACK_ERROR + if((dset = H5Dopen2(file, "dset1", dapl2)) < 0) + FAIL_STACK_ERROR + + /* Reopen dataset with same efile_prefix property */ + if((dset2 = H5Dopen2(file, "dset1", dapl2)) < 0) + FAIL_STACK_ERROR + + /* Reopen dataset with different efile_prefix property */ + if(H5Pset_efile_prefix(dapl, NULL) < 0) + FAIL_STACK_ERROR + H5E_BEGIN_TRY { + dset3 = H5Dopen2(file, "dset1", dapl); + } H5E_END_TRY; + if(dset3 >= 0) + FAIL_PUTS_ERROR("reopening the dataset with a different efile_prefix succeded"); + + /* Read the entire dataset and compare with the original */ + HDmemset(whole, 0, sizeof(whole)); + if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0) + FAIL_STACK_ERROR + for(i = 0; i < TOTAL_SIZE; i++) + if(whole[i] != (signed)i) + FAIL_PUTS_ERROR("Incorrect value(s) read."); + + if(H5Dclose(dset2) < 0) FAIL_STACK_ERROR + if(H5Dclose(dset) < 0) FAIL_STACK_ERROR + if(H5Pclose(dapl2) < 0) FAIL_STACK_ERROR + if(H5Pclose(dapl) < 0) FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR + if(H5Sclose(space) < 0) FAIL_STACK_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Pclose(dapl2); + H5Pclose(dapl); + H5Dclose(dset3); + H5Dclose(dset2); + H5Dclose(dset); + H5Pclose(dcpl); + H5Sclose(space); + H5Fclose(file); + } H5E_END_TRY; + return 1; +} /* end test_path_relative_cwd() */ + + +/*------------------------------------------------------------------------- + * Function: test_path_env + * + * Purpose: Test whether the value of HDF5_EXTFILE_PREFIX will overwrite + * the efile_prefix dataset access property. + * This will create an HDF5 file in a subdirectory which will + * refer to ../extern_*a.raw + * The files are then accessed by setting the HDF5_EXTFILE_PREFIX + * environment variable to "${ORIGIN}". + * The efile_prefix dataset access property is set to "someprefix", + * which will cause an error if the value is not overwritten by + * the environment variable. + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Steffen Kiess + * March 10, 2015 + * + *------------------------------------------------------------------------- + */ +static int +test_path_env(hid_t fapl) +{ + hid_t file = -1; /* file to write to */ + hid_t dcpl = -1; /* dataset creation properties */ + hid_t space = -1; /* data space */ + hid_t dapl = -1; /* dataset access property list */ + hid_t dset = -1; /* dataset */ + size_t i; /* miscellaneous counters */ + char cwdpath[1024]; /* working directory */ + char filename[1024]; /* file name */ + int part[PART_SIZE]; /* raw data buffer (partial) */ + int whole[TOTAL_SIZE]; /* raw data buffer (total) */ + hsize_t cur_size; /* current data space size */ + char buffer[1024]; /* buffer to read efile_prefix */ + + TESTING("prefix in HDF5_EXTFILE_PREFIX"); + + if(HDsetenv("HDF5_EXTFILE_PREFIX", "${ORIGIN}", 1)) + TEST_ERROR + + if(HDmkdir("extern_dir", (mode_t)0755) < 0 && errno != EEXIST) + TEST_ERROR; + + h5_fixname(FILENAME[4], fapl, filename, sizeof(filename)); + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + FAIL_STACK_ERROR + + /* Reset the raw data files */ + if(reset_raw_data_files() < 0) + TEST_ERROR + + /* Create the dataset */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR + if(NULL == HDgetcwd(cwdpath, sizeof(cwdpath))) + TEST_ERROR + for(i = 0; i < N_EXT_FILES; i++) { + HDsnprintf(filename, sizeof(filename), "..%sextern_%dr.raw", H5_DIR_SEPS, (int) i + 1); + if(H5Pset_external(dcpl, filename, (off_t)(i * GARBAGE_PER_FILE), (hsize_t)sizeof(part)) < 0) + FAIL_STACK_ERROR + } /* end for */ + + cur_size = TOTAL_SIZE; + if((space = H5Screate_simple(1, &cur_size, NULL)) < 0) + FAIL_STACK_ERROR + if((dapl = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + FAIL_STACK_ERROR + + /* Set prefix to a nonexistent directory, will be overwritten by environment variable */ + if(H5Pset_efile_prefix(dapl, "someprefix") < 0) + FAIL_STACK_ERROR + if(H5Pget_efile_prefix(dapl, buffer, sizeof(buffer)) < 0) + FAIL_STACK_ERROR + if(HDstrcmp(buffer, "someprefix") != 0) + FAIL_PUTS_ERROR("efile prefix not set correctly"); + + /* Create dataset */ + if((dset = H5Dcreate2(file, "dset1", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, dapl)) < 0) + FAIL_STACK_ERROR + + /* Read the entire dataset and compare with the original */ + HDmemset(whole, 0, sizeof(whole)); + if(H5Dread(dset, H5T_NATIVE_INT, space, space, H5P_DEFAULT, whole) < 0) + FAIL_STACK_ERROR + for(i = 0; i < TOTAL_SIZE; i++) + if(whole[i] != (signed)i) + FAIL_PUTS_ERROR("Incorrect value(s) read."); + + if(H5Dclose(dset) < 0) FAIL_STACK_ERROR + if(H5Pclose(dapl) < 0) FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR + if(H5Sclose(space) < 0) FAIL_STACK_ERROR + if(H5Fclose(file) < 0) FAIL_STACK_ERROR + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Pclose(dapl); + H5Dclose(dset); + H5Pclose(dcpl); + H5Sclose(space); + H5Fclose(file); + } H5E_END_TRY; + return 1; +} /* end test_path_env() */ + + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Runs external dataset tests. + * + * Return: Success: exit(0) + * + * Failure: exit(non-zero) + * + * Programmer: Robb Matzke * Tuesday, March 3, 1998 * *------------------------------------------------------------------------- @@ -870,13 +1423,13 @@ test_write_file_set(hid_t fapl) int main(void) { - hid_t fapl_id_old = -1; /* file access properties (old format) */ - hid_t fapl_id_new = -1; /* file access properties (new format) */ - hid_t fid = -1; /* file for test_1* functions */ - hid_t gid = -1; /* group to emit diagnostics */ - char filename[1024]; /* file name for test_1* funcs */ - unsigned latest_format; /* default or latest file format */ - int nerrors = 0; /* number of errors */ + hid_t fapl_id_old = -1; /* file access properties (old format) */ + hid_t fapl_id_new = -1; /* file access properties (new format) */ + hid_t fid = -1; /* file for test_1* functions */ + hid_t gid = -1; /* group to emit diagnostics */ + char filename[1024]; /* file name for test_1* funcs */ + unsigned latest_format; /* default or latest file format */ + int nerrors = 0; /* number of errors */ h5_reset(); @@ -925,10 +1478,14 @@ main(void) nerrors += test_add_to_unlimited(); nerrors += test_overflow(); - /* These tests use the VFD-aware fapl */ + /* These file set tests use the VFD-aware fapl */ nerrors += test_read_file_set(current_fapl_id); nerrors += test_write_file_set(current_fapl_id); - + nerrors += test_path_absolute(current_fapl_id); + nerrors += test_path_relative(current_fapl_id); + nerrors += test_path_relative_cwd(current_fapl_id); + nerrors += test_path_env(current_fapl_id); + /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, current_fapl_id) < 0 ? 1 : 0); @@ -946,14 +1503,17 @@ main(void) /* Clean up files used by file set tests */ if(h5_cleanup(FILENAME, fapl_id_old)) { - HDremove("extern_1a.raw"); - HDremove("extern_1b.raw"); - HDremove("extern_2a.raw"); - HDremove("extern_2b.raw"); - HDremove("extern_3a.raw"); - HDremove("extern_3b.raw"); - HDremove("extern_4a.raw"); - HDremove("extern_4b.raw"); + HDremove("extern_1r.raw"); + HDremove("extern_2r.raw"); + HDremove("extern_3r.raw"); + HDremove("extern_4r.raw"); + + HDremove("extern_1w.raw"); + HDremove("extern_2w.raw"); + HDremove("extern_3w.raw"); + HDremove("extern_4w.raw"); + + HDrmdir("extern_dir"); } /* end if */ return EXIT_SUCCESS; @@ -969,3 +1529,4 @@ error: printf ("%d TEST%s FAILED.\n", nerrors, 1==nerrors?"":"s"); return EXIT_FAILURE; } /* end main() */ + diff --git a/test/tfile.c b/test/tfile.c index 927ecab..db74720 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -52,6 +52,9 @@ #define FILE1 "tfile1.h5" #define SFILE1 "sys_file1" +#define REOPEN_FILE "tfile_reopen.h5" +#define REOPEN_DSET "dset" + #define F2_USERBLOCK_SIZE (hsize_t)512 #define F2_OFFSET_SIZE 8 #define F2_LENGTH_SIZE 8 @@ -532,6 +535,59 @@ test_file_open(void) /**************************************************************** ** +** test_file_reopen(): File reopen test routine. +** +****************************************************************/ +static void +test_file_reopen(void) +{ + hid_t fid = -1; /* file ID from initial open */ + hid_t rfid = -1; /* file ID from reopen */ + hid_t did = -1; /* dataset ID (both opens) */ + hid_t sid = -1; /* dataspace ID for dataset creation */ + hsize_t dims = 6; /* dataspace size */ + herr_t ret; /* Generic return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Testing File Re-opening\n")); + + /* Create file via first ID */ + fid = H5Fcreate(REOPEN_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK_I(fid, "H5Fcreate"); + + /* Create a dataset in the file */ + sid = H5Screate_simple(1, &dims, &dims); + CHECK_I(sid, "H5Screate_simple") + did = H5Dcreate2(fid, REOPEN_DSET, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + CHECK_I(did, "H5Dcreate2"); + + /* Close dataset and dataspace */ + ret = H5Sclose(sid); + CHECK(ret, FAIL, "H5Sclose"); + ret = H5Dclose(did); + CHECK(ret, FAIL, "H5Dclose"); + + /* Reopen the file with a different file ID */ + rfid = H5Freopen(fid); + CHECK_I(rfid, "H5Freopen"); + + /* Reopen the dataset through the reopen file ID */ + did = H5Dopen2(rfid, REOPEN_DSET, H5P_DEFAULT); + CHECK_I(did, "H5Dopen2"); + + /* Close and clean up */ + ret = H5Dclose(did); + CHECK(ret, FAIL, "H5Dclose"); + ret = H5Fclose(fid); + CHECK(ret, FAIL, "H5Fclose"); + ret = H5Fclose(rfid); + CHECK(ret, FAIL, "H5Fclose"); + HDremove(REOPEN_FILE); + +} /* test_file_reopen() */ + +/**************************************************************** +** ** test_file_close(): low-level file close test routine. ** It mainly tests behavior with close degree. ** @@ -3660,8 +3716,8 @@ test_file(void) /* Output message about test being performed */ MESSAGE(5, ("Testing Low-Level File I/O\n")); - test_file_create(); /* Test file creation(also creation templates)*/ - test_file_open(); /* Test file opening */ + test_file_create(); /* Test file creation(also creation templates)*/ + test_file_open(); /* Test file opening */ test_file_close(); /* Test file close behavior */ test_get_file_id(); /* Test H5Iget_file_id */ test_get_obj_ids(); /* Test H5Fget_obj_ids for Jira Issue 8528 */ -- cgit v0.12 From 807187e2f200e63adb4918dd475d47546c8588e9 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 22 Feb 2016 16:45:28 -0500 Subject: [svn-r29183] Fixed missing reopen test call in tfile from HDFFV-8740 fix. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial w/ fortran and C++ --- test/tfile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/test/tfile.c b/test/tfile.c index db74720..dff4128 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -3718,6 +3718,7 @@ test_file(void) test_file_create(); /* Test file creation(also creation templates)*/ test_file_open(); /* Test file opening */ + test_file_reopen(); /* Test file reopening */ test_file_close(); /* Test file close behavior */ test_get_file_id(); /* Test H5Iget_file_id */ test_get_obj_ids(); /* Test H5Fget_obj_ids for Jira Issue 8528 */ -- cgit v0.12 From f7689087de6c3d549cca79f30b0633ba8ff239c8 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 23 Feb 2016 15:23:46 -0500 Subject: [svn-r29186] HDFFV-9654: add VDS options to h5dump includes new data files --- MANIFEST | 13 + tools/h5dump/CMakeTestsVDS.cmake | 28 ++ tools/h5dump/h5dump.c | 16 +- tools/h5dump/h5dump.h | 2 + tools/h5dump/h5dump_ddl.c | 306 ++++++++------- tools/h5dump/h5dump_extern.h | 2 + tools/h5dump/testh5dumpvds.sh.in | 18 + tools/h5repack/CMakeLists.txt | 6 +- tools/lib/CMakeLists.txt | 2 +- tools/testfiles/h5dump-help.txt | 2 + .../pbits/tnofilename-with-packed-bits.ddl | 2 + tools/testfiles/pbits/tpbitsIncomplete.ddl | 2 + tools/testfiles/pbits/tpbitsLengthExceeded.ddl | 2 + tools/testfiles/pbits/tpbitsLengthPositive.ddl | 2 + tools/testfiles/pbits/tpbitsMaxExceeded.ddl | 2 + tools/testfiles/pbits/tpbitsOffsetExceeded.ddl | 2 + tools/testfiles/pbits/tpbitsOffsetNegative.ddl | 2 + tools/testfiles/vds/a.h5 | Bin 0 -> 7736 bytes tools/testfiles/vds/b.h5 | Bin 0 -> 7736 bytes tools/testfiles/vds/c.h5 | Bin 0 -> 7736 bytes tools/testfiles/vds/d.h5 | Bin 0 -> 7736 bytes tools/testfiles/vds/f-0.h5 | Bin 0 -> 4144 bytes tools/testfiles/vds/f-3.h5 | Bin 0 -> 4144 bytes tools/testfiles/vds/vds-eiger.h5 | Bin 0 -> 5496 bytes tools/testfiles/vds/vds-first.ddl | 210 ++++++++++ tools/testfiles/vds/vds-gap1.ddl | 58 +++ tools/testfiles/vds/vds-gap2.ddl | 210 ++++++++++ tools/testfiles/vds/vds-percival-unlim-maxmin.h5 | Bin 0 -> 5496 bytes tools/testfiles/vds/vds_layout-eiger.ddl | 87 +++++ tools/testfiles/vds/vds_layout-maxmin.ddl | 422 +++++++++++++++++++++ 30 files changed, 1257 insertions(+), 139 deletions(-) create mode 100644 tools/testfiles/vds/a.h5 create mode 100644 tools/testfiles/vds/b.h5 create mode 100644 tools/testfiles/vds/c.h5 create mode 100644 tools/testfiles/vds/d.h5 create mode 100644 tools/testfiles/vds/f-0.h5 create mode 100644 tools/testfiles/vds/f-3.h5 create mode 100644 tools/testfiles/vds/vds-eiger.h5 create mode 100644 tools/testfiles/vds/vds-first.ddl create mode 100644 tools/testfiles/vds/vds-gap1.ddl create mode 100644 tools/testfiles/vds/vds-gap2.ddl create mode 100644 tools/testfiles/vds/vds-percival-unlim-maxmin.h5 create mode 100644 tools/testfiles/vds/vds_layout-eiger.ddl create mode 100644 tools/testfiles/vds/vds_layout-maxmin.ddl diff --git a/MANIFEST b/MANIFEST index 8fffaad..004cfb5 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1731,6 +1731,11 @@ ./tools/testfiles/vds/tvds_layout-3_2.ddl ./tools/testfiles/vds/tvds_layout-4.ddl ./tools/testfiles/vds/tvds_layout-5.ddl +./tools/testfiles/vds/vds-first.ddl +./tools/testfiles/vds/vds-gap1.ddl +./tools/testfiles/vds/vds-gap2.ddl +./tools/testfiles/vds/vds_layout-eiger.ddl +./tools/testfiles/vds/vds_layout-maxmin.ddl ./tools/testfiles/vds/1_a.h5 ./tools/testfiles/vds/1_b.h5 ./tools/testfiles/vds/1_c.h5 @@ -1754,6 +1759,14 @@ ./tools/testfiles/vds/5_b.h5 ./tools/testfiles/vds/5_c.h5 ./tools/testfiles/vds/5_vds.h5 +./tools/testfiles/vds/a.h5 +./tools/testfiles/vds/b.h5 +./tools/testfiles/vds/c.h5 +./tools/testfiles/vds/d.h5 +./tools/testfiles/vds/vds-percival-unlim-maxmin.h5 +./tools/testfiles/vds/f-0.h5 +./tools/testfiles/vds/f-3.h5 +./tools/testfiles/vds/vds-eiger.h5 # h5dump h5import validation ./tools/testfiles/out3.h5import diff --git a/tools/h5dump/CMakeTestsVDS.cmake b/tools/h5dump/CMakeTestsVDS.cmake index 58287fa..cc68896 100644 --- a/tools/h5dump/CMakeTestsVDS.cmake +++ b/tools/h5dump/CMakeTestsVDS.cmake @@ -22,6 +22,11 @@ tvds_layout-3_2.ddl tvds_layout-4.ddl tvds_layout-5.ddl + vds-first.ddl + vds-gap1.ddl + vds-gap2.ddl + vds_layout-eiger.ddl + vds_layout-maxmin.ddl ) set (HDF5_REFERENCE_TEST_VDS 1_a.h5 @@ -47,6 +52,14 @@ 5_b.h5 5_c.h5 5_vds.h5 + a.h5 + b.h5 + c.h5 + d.h5 + vds-percival-unlim-maxmin.h5 + f-0.h5 + f-3.h5 + vds-eiger.h5 ) set (HDF5_ERROR_REFERENCE_VDS ) @@ -184,6 +197,12 @@ tvds-4.out.err tvds-5.out tvds-5.out.err + vds-first.out + vds-first.out.err + vds-gap1.out + vds-gap1.out.err + vds-gap2.out + vds-gap2.out.err tvds_layout-1.out tvds_layout-1.out.err tvds_layout-2.out @@ -196,6 +215,10 @@ tvds_layout-4.out.err tvds_layout-5.out tvds_layout-5.out.err + vds_layout-eiger.out + vds_layout-eiger.out.err + vds_layout-maxmin.out + vds_layout-maxmin.out.err ) set_tests_properties (H5DUMP_VDS-clearall-objects PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") if (NOT "${last_vds_test}" STREQUAL "") @@ -225,6 +248,9 @@ ADD_H5_VDS_TEST (tvds-3_2 0 --enable-error-stack 3_2_vds.h5) ADD_H5_VDS_TEST (tvds-4 0 --enable-error-stack 4_vds.h5) ADD_H5_VDS_TEST (tvds-5 0 --enable-error-stack 5_vds.h5) + ADD_H5_VDS_TEST (vds-first 0 --vds-view-first-missing --enable-error-stack vds-percival-unlim-maxmin.h5) + ADD_H5_VDS_TEST (vds-gap1 0 -d /VDS-Eiger --vds-gap-size=1 --enable-error-stack vds-eiger.h5) + ADD_H5_VDS_TEST (vds-gap2 0 --vds-gap-size=2 --enable-error-stack vds-eiger.h5) endif (USE_FILTER_DEFLATE) # Layout read @@ -235,4 +261,6 @@ ADD_H5_VDS_LAYOUT (tvds_layout-3_2 0 --enable-error-stack 3_2_vds.h5) ADD_H5_VDS_LAYOUT (tvds_layout-4 0 --enable-error-stack 4_vds.h5) ADD_H5_VDS_LAYOUT (tvds_layout-5 0 --enable-error-stack 5_vds.h5) + ADD_H5_VDS_LAYOUT (vds_layout-eiger 0 --enable-error-stack vds-eiger.h5) + ADD_H5_VDS_LAYOUT (vds_layout-maxmin 0 --enable-error-stack vds-percival-unlim-maxmin.h5) endif (USE_FILTER_DEFLATE) diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index ffba581..7c24fa4 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -71,7 +71,7 @@ struct handler_t { */ /* The following initialization makes use of C language cancatenating */ /* "xxx" "yyy" into "xxxyyy". */ -static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RECM:O*N:"; +static const char *s_opts = "hn*peyBHirVa:c:d:f:g:k:l:t:w:xD:uX:o*b*F:s:S:A*q:z:m:RECM:O*N:vG:"; static struct long_options l_opts[] = { { "help", no_arg, 'h' }, { "hel", no_arg, 'h' }, @@ -190,6 +190,8 @@ static struct long_options l_opts[] = { { "no-compact-subset", no_arg, 'C' }, { "ddl", optional_arg, 'O' }, { "any_path", require_arg, 'N' }, + { "vds-view-first-missing", no_arg, 'v' }, + { "vds-gap-size", require_arg, 'G' }, { NULL, 0, '\0' } }; @@ -256,6 +258,8 @@ usage(const char *prog) PRINTVALSTREAM(rawoutstream, " P can be the absolute path or just a relative path.\n"); PRINTVALSTREAM(rawoutstream, " -A, --onlyattr Print the header and value of attributes\n"); PRINTVALSTREAM(rawoutstream, " Optional value 0 suppresses printing attributes.\n"); + PRINTVALSTREAM(rawoutstream, " --vds-view-first-missing Set the VDS bounds to first missing mapped elements.\n"); + PRINTVALSTREAM(rawoutstream, " --vds-gap-size=N Set the missing file gap size, N=non-negative integers\n"); PRINTVALSTREAM(rawoutstream, "--------------- Object Property Options ---------------\n"); PRINTVALSTREAM(rawoutstream, " -i, --object-ids Print the object ids\n"); PRINTVALSTREAM(rawoutstream, " -p, --properties Print dataset filters, storage layout and fill value\n"); @@ -1121,6 +1125,16 @@ parse_start: } display_packed_bits = TRUE; break; + case 'v': + display_vds_first = TRUE; + break; + case 'G': + vds_gap_size = HDatoi(opt_arg); + if (vds_gap_size < 0) { + usage(h5tools_getprogname()); + goto error; + } + break; /** begin XML parameters **/ case 'x': diff --git a/tools/h5dump/h5dump.h b/tools/h5dump/h5dump.h index 2b1fb04..7cf4efd 100644 --- a/tools/h5dump/h5dump.h +++ b/tools/h5dump/h5dump.h @@ -78,6 +78,8 @@ int enable_error_stack= FALSE; /* re-enable error stack */ int disable_compact_subset= FALSE; /* disable compact form of subset notation */ int display_packed_bits = FALSE; /*print 1-8 byte numbers as packed bits*/ int include_attrs = TRUE; /* Display attributes */ +int display_vds_first = FALSE; /* vds display to all by default*/ +int vds_gap_size = 0; /* vds skip missing files default is none */ /* sort parameters */ H5_index_t sort_by = H5_INDEX_NAME; /*sort_by [creation_order | name] */ diff --git a/tools/h5dump/h5dump_ddl.c b/tools/h5dump/h5dump_ddl.c index fd50710..09751ab 100644 --- a/tools/h5dump/h5dump_ddl.c +++ b/tools/h5dump/h5dump_ddl.c @@ -26,12 +26,12 @@ typedef struct { hid_t fid; /* File ID being traversed */ - char *op_name; /* Object name wanted */ + char *op_name; /* Object name wanted */ } trav_handle_udata_t; typedef struct { - char *path; /* Path of object being searched */ - char *op_name; /* Object name wanted */ + char *path; /* Path of object being searched */ + char *op_name; /* Object name wanted */ } trav_attr_udata_t; /* callback function used by H5Literate() */ @@ -90,7 +90,7 @@ dump_dataspace(hid_t space) HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + h5tools_dump_dataspace(rawoutstream, outputformat, &ctx, space); } @@ -117,19 +117,19 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED * h5tools_context_t ctx; /* print context */ h5tool_format_t *outputformat = &h5tools_dataformat; h5tool_format_t string_dataformat; - + hid_t attr_id; herr_t ret = SUCCEED; HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + attr_id = H5Aopen(oid, attr_name, H5P_DEFAULT); oid_output = display_oid; data_output = display_data; attr_data_output = display_attr_data; - + string_dataformat = *outputformat; if (fp_format) { @@ -155,7 +155,7 @@ dump_attr_cb(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED * h5tools_setstatus(EXIT_FAILURE); ret = FAIL; } - + return ret; } @@ -185,6 +185,7 @@ static herr_t dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR_UNUSED *op_data) { hid_t obj; + hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */ herr_t ret = SUCCEED; char *obj_path = NULL; /* Full path of object */ h5tools_str_t buffer; /* string into which to render */ @@ -199,7 +200,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + string_dataformat = *outputformat; if (fp_format) { @@ -222,8 +223,8 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR if(!obj_path) { ret = FAIL; goto done; - } - + } + HDstrcpy(obj_path, prefix); HDstrcat(obj_path, "/"); HDstrcat(obj_path, name); @@ -269,7 +270,20 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR break; case H5O_TYPE_DATASET: - if((obj = H5Dopen2(group, name, H5P_DEFAULT)) >= 0) { + if(display_data) { + if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) { + error_msg("error in creating default access property list ID\n"); + } + if (display_vds_first) { + if(H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0) + error_msg("error in setting access property list ID, virtual_view\n"); + } + if (vds_gap_size > 0) { + if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)vds_gap_size) < 0) + error_msg("error in setting access property list ID, virtual_printf_gap\n"); + } + } + if((obj = H5Dopen2(group, name, dapl_id)) >= 0) { if(oinfo.rc > 1 || hit_elink) { obj_t *found_obj; /* Found object */ @@ -308,9 +322,11 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR h5tools_setstatus(EXIT_FAILURE); ret = FAIL; + if (dapl_id != H5P_DEFAULT) + H5Pclose(dapl_id); H5Dclose(obj); goto done; - } + } else if(found_obj->displayed) { ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); @@ -347,18 +363,24 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR h5tools_str_append(&buffer, "%s", h5tools_dump_header_format->datasetend); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); + if (dapl_id != H5P_DEFAULT) + H5Pclose(dapl_id); H5Dclose(obj); goto done; - } + } else { found_obj->displayed = TRUE; } } /* end if */ dump_function_table->dump_dataset_function(obj, name, NULL); + if (dapl_id != H5P_DEFAULT) + H5Pclose(dapl_id); H5Dclose(obj); - } + } else { + if (dapl_id) + H5Pclose(dapl_id && dapl_id != H5P_DEFAULT); error_msg("unable to dump dataset \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; @@ -370,7 +392,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR error_msg("unable to dump datatype \"%s\"\n", name); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; - } + } else { dump_function_table->dump_named_datatype_function(obj, name); H5Tclose(obj); @@ -408,7 +430,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR error_msg("unable to get link value\n"); h5tools_setstatus(EXIT_FAILURE); ret = FAIL; - } + } else { /* print the value of a soft link */ /* Standard DDL: no modification */ @@ -558,7 +580,7 @@ dump_all_cb(hid_t group, const char *name, const H5L_info_t *linfo, void H5_ATTR done: h5tools_str_close(&buffer); - + if(obj_path) HDfree(obj_path); return ret; @@ -650,7 +672,7 @@ dump_named_datatype(hid_t tid, const char *name) HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + string_dataformat = *outputformat; if (fp_format) { @@ -685,7 +707,7 @@ dump_named_datatype(hid_t tid, const char *name) } ctx.need_prefix = TRUE; - + /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\" %s", @@ -718,7 +740,7 @@ dump_named_datatype(hid_t tid, const char *name) else found_obj->displayed = TRUE; } /* end if */ - + /* Render the element */ h5tools_str_reset(&buffer); h5tools_print_datatype(rawoutstream, &buffer, outputformat, &ctx, tid, FALSE); @@ -726,7 +748,7 @@ dump_named_datatype(hid_t tid, const char *name) if(H5Tget_class(tid) != H5T_COMPOUND) { h5tools_str_append(&buffer, ";"); } - + h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); /* print attributes */ @@ -813,7 +835,7 @@ dump_group(hid_t gid, const char *name) HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + string_dataformat = *outputformat; if (fp_format) { @@ -839,7 +861,7 @@ dump_group(hid_t gid, const char *name) h5tools_dump_header_format->groupbegin, name, h5tools_dump_header_format->groupblockbegin); h5tools_render_element(rawoutstream, outputformat, &ctx, &buffer, &curr_pos, (size_t)outputformat->line_ncols, (hsize_t)0, (hsize_t)0); - + ctx.indent_level++; dump_indent += COL; @@ -948,7 +970,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) HDmemset(&ctx, 0, sizeof(ctx)); ctx.indent_level = dump_indent/COL; ctx.cur_column = dump_indent; - + string_dataformat = *outputformat; if (fp_format) { @@ -982,7 +1004,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - + /* Render the element */ h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s \"%s\" %s", @@ -994,7 +1016,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) dump_indent += COL; ctx.indent_level++; - + type = H5Dget_type(did); h5dump_type_table = type_table; h5tools_dump_datatype(rawoutstream, outputformat, &ctx, type); @@ -1018,6 +1040,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) if(display_data) { int data_loop = 1; int i; + if(display_packed_bits) data_loop = packed_bits_num; for(i=0; iline_ncols, (hsize_t)0, (hsize_t)0); - + ctx.indent_level--; break; @@ -1079,7 +1102,7 @@ dump_dataset(hid_t did, const char *name, struct subset_t *sset) ctx.need_prefix = TRUE; h5tools_simple_prefix(rawoutstream, outputformat, &ctx, (hsize_t)0, 0); - + /* Render the element */ h5tools_str_reset(&buffer); if(HDstrlen(h5tools_dump_header_format->datasetblockend)) { @@ -1189,7 +1212,7 @@ dump_fcpl(hid_t fid) fdriver=H5Pget_driver(fapl); H5Pclose(fapl); #endif - + /*------------------------------------------------------------------------- * SUPER_BLOCK *------------------------------------------------------------------------- @@ -1308,54 +1331,54 @@ static herr_t attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ainfo, void *_op_data) { herr_t ret = SUCCEED; - int i; - int j; - int k; - char *obj_op_name; + int i; + int j; + int k; + char *obj_op_name; char *obj_name; - trav_attr_udata_t *attr_data = (trav_attr_udata_t*)_op_data; + trav_attr_udata_t *attr_data = (trav_attr_udata_t*)_op_data; char *buf = attr_data->path; - char *op_name = attr_data->op_name; + char *op_name = attr_data->op_name; j = (int)HDstrlen(op_name) - 1; /* find the last / */ while(j >= 0) { - if (op_name[j] == '/' && (j==0 || (j>0 && op_name[j-1]!='\\'))) - break; - j--; + if (op_name[j] == '/' && (j==0 || (j>0 && op_name[j-1]!='\\'))) + break; + j--; } obj_op_name = h5tools_str_replace(op_name + j + 1, "\\/", "/"); if(obj_op_name == NULL) { - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; } else { - if(HDstrcmp(attr_name, obj_op_name)==0) { - /* object name */ - i = (int)HDstrlen(buf); - j = (int)HDstrlen(op_name); - k = (size_t)i + 1 + (size_t)j + 1 + 2; - obj_name = (char *)HDmalloc((size_t)k); - if(obj_name == NULL) { - h5tools_setstatus(EXIT_FAILURE); - ret = FAIL; - } - else { - HDmemset(obj_name, '\0', (size_t)k); - if(op_name[0] != '/') { - HDstrncat(obj_name, buf, (size_t)i + 1); - if(buf[i-1] != '/') - HDstrncat(obj_name, "/", (size_t)2); - } - HDstrncat(obj_name, op_name, (size_t)j + 1); - - handle_attributes(oid, obj_name, NULL, 0, NULL); - HDfree(obj_name); - } - } - HDfree(obj_op_name); + if(HDstrcmp(attr_name, obj_op_name)==0) { + /* object name */ + i = (int)HDstrlen(buf); + j = (int)HDstrlen(op_name); + k = (size_t)i + 1 + (size_t)j + 1 + 2; + obj_name = (char *)HDmalloc((size_t)k); + if(obj_name == NULL) { + h5tools_setstatus(EXIT_FAILURE); + ret = FAIL; + } + else { + HDmemset(obj_name, '\0', (size_t)k); + if(op_name[0] != '/') { + HDstrncat(obj_name, buf, (size_t)i + 1); + if(buf[i-1] != '/') + HDstrncat(obj_name, "/", (size_t)2); + } + HDstrncat(obj_name, op_name, (size_t)j + 1); + + handle_attributes(oid, obj_name, NULL, 0, NULL); + HDfree(obj_name); + } + } + HDfree(obj_op_name); } return ret; } /* end attr_search() */ @@ -1363,7 +1386,7 @@ attr_search(hid_t oid, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *a static herr_t obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *already_visited, void *_op_data) { - trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data; + trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data; char *op_name = (char*)handle_data->op_name; trav_attr_udata_t attr_data; @@ -1372,22 +1395,22 @@ obj_search(const char *path, const H5O_info_t *oi, const char H5_ATTR_UNUSED *al H5Aiterate_by_name(handle_data->fid, path, H5_INDEX_NAME, H5_ITER_INC, NULL, attr_search, (void*)&attr_data, H5P_DEFAULT); if(HDstrcmp(path, op_name)==0) { - switch(oi->type) { - case H5O_TYPE_GROUP: - handle_groups(handle_data->fid, path, NULL, 0, NULL); - break; - case H5O_TYPE_DATASET: - handle_datasets(handle_data->fid, path, NULL, 0, NULL); - break; - case H5O_TYPE_NAMED_DATATYPE: - handle_datatypes(handle_data->fid, path, NULL, 0, NULL); - break; - case H5O_TYPE_UNKNOWN: - case H5O_TYPE_NTYPES: - default: - error_msg("unknown object type value\n"); - h5tools_setstatus(EXIT_FAILURE); - } /* end switch */ + switch(oi->type) { + case H5O_TYPE_GROUP: + handle_groups(handle_data->fid, path, NULL, 0, NULL); + break; + case H5O_TYPE_DATASET: + handle_datasets(handle_data->fid, path, NULL, 0, NULL); + break; + case H5O_TYPE_NAMED_DATATYPE: + handle_datatypes(handle_data->fid, path, NULL, 0, NULL); + break; + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: + default: + error_msg("unknown object type value\n"); + h5tools_setstatus(EXIT_FAILURE); + } /* end switch */ } return 0; @@ -1397,48 +1420,48 @@ static herr_t lnk_search(const char *path, const H5L_info_t *li, void *_op_data) { int search_len; - int k; + int k; char *search_name; - trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data; + trav_handle_udata_t *handle_data = (trav_handle_udata_t*)_op_data; char *op_name = (char*)handle_data->op_name; search_len = HDstrlen(op_name); if(search_len > 0 && op_name[0] != '/') { - k = 2; + k = 2; } else k = 1; - search_name = (char *)HDmalloc((size_t)(search_len + k)); + search_name = (char *)HDmalloc((size_t)(search_len + k)); if(search_name == NULL) { - error_msg("creating temporary link\n"); - h5tools_setstatus(EXIT_FAILURE); + error_msg("creating temporary link\n"); + h5tools_setstatus(EXIT_FAILURE); } else { - if (k == 2) { - HDstrcpy(search_name, "/"); - HDstrncat(search_name, op_name, (size_t)search_len + 1); - } - else - HDstrncpy(search_name, op_name, (size_t)search_len + 1); - search_name[search_len + k - 1] = '\0'; - - if(HDstrcmp(path, search_name) == 0) { - switch(li->type) { - case H5L_TYPE_SOFT: - case H5L_TYPE_EXTERNAL: - handle_links(handle_data->fid, op_name, NULL, 0, NULL); - break; - - case H5L_TYPE_HARD: - case H5L_TYPE_MAX: - case H5L_TYPE_ERROR: - default: - error_msg("unknown link type value\n"); - h5tools_setstatus(EXIT_FAILURE); - break; - } /* end switch() */ - } - HDfree(search_name); + if (k == 2) { + HDstrcpy(search_name, "/"); + HDstrncat(search_name, op_name, (size_t)search_len + 1); + } + else + HDstrncpy(search_name, op_name, (size_t)search_len + 1); + search_name[search_len + k - 1] = '\0'; + + if(HDstrcmp(path, search_name) == 0) { + switch(li->type) { + case H5L_TYPE_SOFT: + case H5L_TYPE_EXTERNAL: + handle_links(handle_data->fid, op_name, NULL, 0, NULL); + break; + + case H5L_TYPE_HARD: + case H5L_TYPE_MAX: + case H5L_TYPE_ERROR: + default: + error_msg("unknown link type value\n"); + h5tools_setstatus(EXIT_FAILURE); + break; + } /* end switch() */ + } + HDfree(search_name); } return 0; } /* end lnk_search() */ @@ -1465,7 +1488,7 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H hid_t gcpl_id; unsigned crt_order_flags; unsigned attr_crt_order_flags; - trav_handle_udata_t handle_udata; /* User data for traversal */ + trav_handle_udata_t handle_udata; /* User data for traversal */ if ((gcpl_id = H5Gget_create_plist(gid)) < 0) { error_msg("error in getting group creation property list ID\n"); @@ -1489,12 +1512,12 @@ handle_paths(hid_t fid, const char *path_name, void H5_ATTR_UNUSED * data, int H h5tools_setstatus(EXIT_FAILURE); } - handle_udata.fid = fid; - handle_udata.op_name = (char*)path_name; - if(h5trav_visit(fid, "/", TRUE, TRUE, obj_search, lnk_search, &handle_udata) < 0) { - error_msg("error traversing information\n"); - h5tools_setstatus(EXIT_FAILURE); - } + handle_udata.fid = fid; + handle_udata.op_name = (char*)path_name; + if(h5trav_visit(fid, "/", TRUE, TRUE, obj_search, lnk_search, &handle_udata) < 0) { + error_msg("error traversing information\n"); + h5tools_setstatus(EXIT_FAILURE); + } } } @@ -1536,7 +1559,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H /* find the last / */ while(j >= 0) { - if (attr[j] == '/' && (j==0 || (j>0 && attr[j-1]!='\\'))) + if (attr[j] == '/' && (j==0 || (j>0 && attr[j-1]!='\\'))) break; j--; } @@ -1571,7 +1594,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H string_dataformat.do_escape = display_escape; outputformat = &string_dataformat; - attr_name = h5tools_str_replace(attr + j + 1, "\\/", "/"); + attr_name = h5tools_str_replace(attr + j + 1, "\\/", "/"); /* handle error case: cannot open the object with the attribute */ if((oid = H5Oopen(fid, obj_name, H5P_DEFAULT)) < 0) { @@ -1627,7 +1650,7 @@ handle_attributes(hid_t fid, const char *attr, void H5_ATTR_UNUSED * data, int H } /* end if */ HDfree(obj_name); - HDfree(attr_name); + HDfree(attr_name); dump_indent -= COL; return; @@ -1635,9 +1658,9 @@ error: h5tools_setstatus(EXIT_FAILURE); if(obj_name) HDfree(obj_name); - - if (attr_name) - HDfree(attr_name); + + if (attr_name) + HDfree(attr_name); H5E_BEGIN_TRY { H5Oclose(oid); @@ -1672,10 +1695,24 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis { H5O_info_t oinfo; hid_t dsetid; + hid_t dapl_id = H5P_DEFAULT; /* dataset access property list ID */ struct subset_t *sset = (struct subset_t *)data; const char *real_name = display_name ? display_name : dset; - if((dsetid = H5Dopen2(fid, dset, H5P_DEFAULT)) < 0) { + if(display_data) { + if ((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) { + error_msg("error in creating default access property list ID\n"); + } + if (display_vds_first) { + if(H5Pset_virtual_view(dapl_id, H5D_VDS_FIRST_MISSING) < 0) + error_msg("error in setting access property list ID, virtual_view\n"); + } + if (vds_gap_size > 0) { + if(H5Pset_virtual_printf_gap(dapl_id, (hsize_t)vds_gap_size) < 0) + error_msg("error in setting access property list ID, virtual_printf_gap\n"); + } + } + if((dsetid = H5Dopen2(fid, dset, dapl_id)) < 0) { if (pe) { handle_links(fid, dset, data, pe, display_name); } @@ -1752,7 +1789,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis h5tools_setstatus(EXIT_FAILURE); return; } - + /*------------------------------------------------------------------------- * check for block overlap *------------------------------------------------------------------------- @@ -1785,7 +1822,7 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis PRINTSTREAM(rawoutstream, "%s \"%s\"\n", HARDLINK, found_obj->objname); indentation(dump_indent); end_obj(h5tools_dump_header_format->datasetend, h5tools_dump_header_format->datasetblockend); - } + } else { found_obj->displayed = TRUE; dump_indent += COL; @@ -1801,7 +1838,8 @@ handle_datasets(hid_t fid, const char *dset, void *data, int pe, const char *dis dump_dataset(dsetid, real_name, sset); dump_indent -= COL; } - + if (dapl_id != H5P_DEFAULT) + H5Pclose(dapl_id); if(H5Dclose(dsetid) < 0) h5tools_setstatus(EXIT_FAILURE); } @@ -1884,11 +1922,11 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT if(H5Lget_info(fid, links, &linfo, H5P_DEFAULT) < 0) { error_msg("unable to get link info from \"%s\"\n", links); h5tools_setstatus(EXIT_FAILURE); - } + } else if(linfo.type == H5L_TYPE_HARD) { error_msg("\"%s\" is a hard link\n", links); h5tools_setstatus(EXIT_FAILURE); - } + } else { char *buf = (char *)HDmalloc(linfo.u.val_size); PRINTVALSTREAM(rawoutstream, "\n"); @@ -1925,12 +1963,12 @@ handle_links(hid_t fid, const char *links, void H5_ATTR_UNUSED * data, int H5_AT PRINTSTREAM(rawoutstream, "TARGETFILE \"%s\"\n", elink_file); indentation(COL); PRINTSTREAM(rawoutstream, "TARGETPATH \"%s\"\n", elink_path); - } + } else { error_msg("h5dump error: unable to unpack external link value for \"%s\"\n", links); h5tools_setstatus(EXIT_FAILURE); } - } + } else { error_msg("h5dump error: unable to get external link value for \"%s\"\n", links); h5tools_setstatus(EXIT_FAILURE); diff --git a/tools/h5dump/h5dump_extern.h b/tools/h5dump/h5dump_extern.h index 08f9e36..62477d0 100644 --- a/tools/h5dump/h5dump_extern.h +++ b/tools/h5dump/h5dump_extern.h @@ -77,6 +77,8 @@ extern int enable_error_stack; /* re-enable error stack */ extern int disable_compact_subset; /* disable compact form of subset notation */ extern int display_packed_bits; /*print 1-8 byte numbers as packed bits*/ extern int include_attrs; /* Display attributes */ +extern int display_vds_first; /* vds display to first missing */ +extern int vds_gap_size; /* vds skip missing files */ /* sort parameters */ extern H5_index_t sort_by; /*sort_by [creation_order | name] */ diff --git a/tools/h5dump/testh5dumpvds.sh.in b/tools/h5dump/testh5dumpvds.sh.in index b15606f..850c03a 100644 --- a/tools/h5dump/testh5dumpvds.sh.in +++ b/tools/h5dump/testh5dumpvds.sh.in @@ -98,6 +98,14 @@ $SRC_H5DUMP_TESTFILES/vds/5_a.h5 $SRC_H5DUMP_TESTFILES/vds/5_b.h5 $SRC_H5DUMP_TESTFILES/vds/5_c.h5 $SRC_H5DUMP_TESTFILES/vds/5_vds.h5 +$SRC_H5DUMP_TESTFILES/vds/a.h5 +$SRC_H5DUMP_TESTFILES/vds/b.h5 +$SRC_H5DUMP_TESTFILES/vds/c.h5 +$SRC_H5DUMP_TESTFILES/vds/d.h5 +$SRC_H5DUMP_TESTFILES/vds/vds-percival-unlim-maxmin.h5 +$SRC_H5DUMP_TESTFILES/vds/f-0.h5 +$SRC_H5DUMP_TESTFILES/vds/f-3.h5 +$SRC_H5DUMP_TESTFILES/vds/vds-eiger.h5 " LIST_OTHER_TEST_FILES=" @@ -113,6 +121,11 @@ $SRC_H5DUMP_TESTFILES/vds/tvds_layout-3_1.ddl $SRC_H5DUMP_TESTFILES/vds/tvds_layout-3_2.ddl $SRC_H5DUMP_TESTFILES/vds/tvds_layout-4.ddl $SRC_H5DUMP_TESTFILES/vds/tvds_layout-5.ddl +$SRC_H5DUMP_TESTFILES/vds/vds-first.ddl +$SRC_H5DUMP_TESTFILES/vds/vds-gap1.ddl +$SRC_H5DUMP_TESTFILES/vds/vds-gap2.ddl +$SRC_H5DUMP_TESTFILES/vds/vds_layout-eiger.ddl +$SRC_H5DUMP_TESTFILES/vds/vds_layout-maxmin.ddl " LIST_ERROR_TEST_FILES=" @@ -480,6 +493,9 @@ if test $USE_FILTER_DEFLATE = "yes" ; then TOOLTEST tvds-3_2.ddl --enable-error-stack 3_2_vds.h5 TOOLTEST tvds-4.ddl --enable-error-stack 4_vds.h5 TOOLTEST tvds-5.ddl --enable-error-stack 5_vds.h5 + TOOLTEST vds-first.ddl --vds-view-first-missing --enable-error-stack vds-percival-unlim-maxmin.h5 + TOOLTEST vds-gap1.ddl -d /VDS-Eiger --vds-gap-size=1 --enable-error-stack vds-eiger.h5 + TOOLTEST vds-gap2.ddl --vds-gap-size=2 --enable-error-stack vds-eiger.h5 fi # Layout read @@ -490,6 +506,8 @@ if test $USE_FILTER_DEFLATE = "yes" ; then TOOLTEST tvds_layout-3_2.ddl -p --enable-error-stack 3_2_vds.h5 TOOLTEST tvds_layout-4.ddl -p --enable-error-stack 4_vds.h5 TOOLTEST tvds_layout-5.ddl -p --enable-error-stack 5_vds.h5 + TOOLTEST vds_layout-eiger.ddl -p --enable-error-stack vds-eiger.h5 + TOOLTEST vds_layout-maxmin.ddl -p --enable-error-stack vds-percival-unlim-maxmin.h5 fi # Clean up temporary files/directories diff --git a/tools/h5repack/CMakeLists.txt b/tools/h5repack/CMakeLists.txt index 7631ae8..9b1fbcf 100644 --- a/tools/h5repack/CMakeLists.txt +++ b/tools/h5repack/CMakeLists.txt @@ -58,7 +58,7 @@ if (BUILD_TESTING) target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) H5_SET_LIB_OPTIONS ( ${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} - SHARED + SHARED ${HDF5_PACKAGE_SOVERSION} HDF5_TOOL_PLUGIN_LIB_NAME_RELEASE HDF5_TOOL_PLUGIN_LIB_NAME_DEBUG ) @@ -72,13 +72,13 @@ if (BUILD_TESTING) TARGET ${HDF5_TOOL_PLUGIN_LIB_TARGET} POST_BUILD COMMAND ${CMAKE_COMMAND} - ARGS -E copy_if_different + ARGS -E copy_if_different "$" "${CMAKE_BINARY_DIR}/plugins/$" ) include (CMakeTests.cmake) - + endif (BUILD_TESTING) ############################################################################## diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index 38c84a2..0b39a2b 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -61,7 +61,7 @@ if (BUILD_SHARED_LIBS) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIBSH_TARGET}") H5_SET_LIB_OPTIONS ( ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TOOLS_LIB_NAME} - SHARED + SHARED ${HDF5_TOOLS_PACKAGE_SOVERSION} HDF5_TOOLS_LIB_NAME_RELEASE HDF5_TOOLS_LIB_NAME_DEBUG ) diff --git a/tools/testfiles/h5dump-help.txt b/tools/testfiles/h5dump-help.txt index 444dd97..7ebefc6 100644 --- a/tools/testfiles/h5dump-help.txt +++ b/tools/testfiles/h5dump-help.txt @@ -25,6 +25,8 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. + --vds-view-first-missing Set the VDS bounds to first missing mapped elements. + --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl index 64a2880..1a1b7e8 100644 --- a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl +++ b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl @@ -25,6 +25,8 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. + --vds-view-first-missing Set the VDS bounds to first missing mapped elements. + --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tpbitsIncomplete.ddl b/tools/testfiles/pbits/tpbitsIncomplete.ddl index cdb1f91..2a2778a 100644 --- a/tools/testfiles/pbits/tpbitsIncomplete.ddl +++ b/tools/testfiles/pbits/tpbitsIncomplete.ddl @@ -25,6 +25,8 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. + --vds-view-first-missing Set the VDS bounds to first missing mapped elements. + --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl index 6d2492a..5e00073 100644 --- a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl @@ -25,6 +25,8 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. + --vds-view-first-missing Set the VDS bounds to first missing mapped elements. + --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tpbitsLengthPositive.ddl b/tools/testfiles/pbits/tpbitsLengthPositive.ddl index 4f56619..f2574d4 100644 --- a/tools/testfiles/pbits/tpbitsLengthPositive.ddl +++ b/tools/testfiles/pbits/tpbitsLengthPositive.ddl @@ -25,6 +25,8 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. + --vds-view-first-missing Set the VDS bounds to first missing mapped elements. + --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl index 3432433..15c0abc 100644 --- a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl @@ -25,6 +25,8 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. + --vds-view-first-missing Set the VDS bounds to first missing mapped elements. + --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl index e51a09e..c62e290 100644 --- a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl @@ -25,6 +25,8 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. + --vds-view-first-missing Set the VDS bounds to first missing mapped elements. + --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl index ba6e46d..5621a60 100644 --- a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl +++ b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl @@ -25,6 +25,8 @@ usage: h5dump [OPTIONS] files P can be the absolute path or just a relative path. -A, --onlyattr Print the header and value of attributes Optional value 0 suppresses printing attributes. + --vds-view-first-missing Set the VDS bounds to first missing mapped elements. + --vds-gap-size=N Set the missing file gap size, N=non-negative integers --------------- Object Property Options --------------- -i, --object-ids Print the object ids -p, --properties Print dataset filters, storage layout and fill value diff --git a/tools/testfiles/vds/a.h5 b/tools/testfiles/vds/a.h5 new file mode 100644 index 0000000..fa19535 Binary files /dev/null and b/tools/testfiles/vds/a.h5 differ diff --git a/tools/testfiles/vds/b.h5 b/tools/testfiles/vds/b.h5 new file mode 100644 index 0000000..08449ca Binary files /dev/null and b/tools/testfiles/vds/b.h5 differ diff --git a/tools/testfiles/vds/c.h5 b/tools/testfiles/vds/c.h5 new file mode 100644 index 0000000..ba9af30 Binary files /dev/null and b/tools/testfiles/vds/c.h5 differ diff --git a/tools/testfiles/vds/d.h5 b/tools/testfiles/vds/d.h5 new file mode 100644 index 0000000..8eceb4a Binary files /dev/null and b/tools/testfiles/vds/d.h5 differ diff --git a/tools/testfiles/vds/f-0.h5 b/tools/testfiles/vds/f-0.h5 new file mode 100644 index 0000000..242df07 Binary files /dev/null and b/tools/testfiles/vds/f-0.h5 differ diff --git a/tools/testfiles/vds/f-3.h5 b/tools/testfiles/vds/f-3.h5 new file mode 100644 index 0000000..539c1c9 Binary files /dev/null and b/tools/testfiles/vds/f-3.h5 differ diff --git a/tools/testfiles/vds/vds-eiger.h5 b/tools/testfiles/vds/vds-eiger.h5 new file mode 100644 index 0000000..23d1fd3 Binary files /dev/null and b/tools/testfiles/vds/vds-eiger.h5 differ diff --git a/tools/testfiles/vds/vds-first.ddl b/tools/testfiles/vds/vds-first.ddl new file mode 100644 index 0000000..97b1ecf --- /dev/null +++ b/tools/testfiles/vds/vds-first.ddl @@ -0,0 +1,210 @@ +HDF5 "vds-percival-unlim-maxmin.h5" { +GROUP "/" { + DATASET "VDS-Percival-unlim-maxmin" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 20, 10, 10 ) / ( H5S_UNLIMITED, 10, 10 ) } + DATA { + (0,0,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,1,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,2,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,3,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,4,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,5,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,6,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,7,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,8,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,9,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (1,0,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,1,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,2,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,3,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,4,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,5,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,6,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,7,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,8,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,9,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (2,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (3,0,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,1,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,2,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,3,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,4,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,5,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,6,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,7,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,8,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,9,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (4,0,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,1,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,2,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,3,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,4,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,5,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,6,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,7,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,8,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,9,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (5,0,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,1,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,2,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,3,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,4,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,5,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,6,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,7,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,8,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,9,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (6,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (7,0,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,1,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,2,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,3,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,4,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,5,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,6,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,7,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,8,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,9,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (8,0,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,1,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,2,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,3,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,4,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,5,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,6,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,7,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,8,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,9,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (9,0,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,1,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,2,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,3,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,4,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,5,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,6,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,7,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,8,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,9,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (10,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (11,0,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,1,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,2,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,3,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,4,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,5,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,6,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,7,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,8,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,9,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (12,0,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,1,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,2,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,3,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,4,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,5,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,6,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,7,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,8,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,9,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (13,0,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,1,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,2,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,3,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,4,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,5,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,6,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,7,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,8,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,9,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (14,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (15,0,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,1,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,2,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,3,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,4,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,5,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,6,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,7,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,8,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,9,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (16,0,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,1,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,2,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,3,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,4,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,5,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,6,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,7,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,8,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,9,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (17,0,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,1,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,2,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,3,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,4,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,5,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,6,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,7,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,8,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,9,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (18,0,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,1,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,2,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,3,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,4,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,5,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,6,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,7,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,8,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,9,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (19,0,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,1,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,2,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,3,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,4,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,5,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,6,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,7,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,8,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,9,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40 + } + } +} +} diff --git a/tools/testfiles/vds/vds-gap1.ddl b/tools/testfiles/vds/vds-gap1.ddl new file mode 100644 index 0000000..cace781 --- /dev/null +++ b/tools/testfiles/vds/vds-gap1.ddl @@ -0,0 +1,58 @@ +HDF5 "vds-eiger.h5" { +DATASET "/VDS-Eiger" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 5, 10, 10 ) / ( H5S_UNLIMITED, 10, 10 ) } + DATA { + (0,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + } +} +} diff --git a/tools/testfiles/vds/vds-gap2.ddl b/tools/testfiles/vds/vds-gap2.ddl new file mode 100644 index 0000000..24da48f --- /dev/null +++ b/tools/testfiles/vds/vds-gap2.ddl @@ -0,0 +1,210 @@ +HDF5 "vds-eiger.h5" { +GROUP "/" { + DATASET "VDS-Eiger" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 20, 10, 10 ) / ( H5S_UNLIMITED, 10, 10 ) } + DATA { + (0,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (5,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (5,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (5,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (5,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (5,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (5,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (5,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (5,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (5,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (5,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (6,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (6,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (6,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (6,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (6,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (6,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (6,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (6,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (6,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (6,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (7,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (7,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (7,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (7,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (7,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (7,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (7,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (7,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (7,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (7,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (8,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (8,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (8,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (8,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (8,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (8,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (8,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (8,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (8,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (8,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (9,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (9,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (9,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (9,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (9,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (9,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (9,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (9,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (9,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (9,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (10,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (10,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (10,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (10,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (10,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (10,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (10,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (10,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (10,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (10,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (11,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (11,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (11,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (11,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (11,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (11,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (11,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (11,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (11,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (11,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (12,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (12,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (12,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (12,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (12,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (12,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (12,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (12,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (12,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (12,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (13,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (13,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (13,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (13,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (13,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (13,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (13,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (13,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (13,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (13,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (14,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (14,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (14,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (14,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (14,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (14,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (14,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (14,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (14,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (14,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (15,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (15,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (15,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (15,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (15,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (15,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (15,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (15,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (15,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (15,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (16,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (16,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (16,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (16,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (16,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (16,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (16,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (16,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (16,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (16,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (17,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (17,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (17,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (17,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (17,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (17,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (17,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (17,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (17,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (17,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (18,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (18,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (18,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (18,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (18,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (18,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (18,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (18,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (18,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (18,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (19,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (19,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (19,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (19,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (19,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (19,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (19,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (19,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (19,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (19,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 + } + } +} +} diff --git a/tools/testfiles/vds/vds-percival-unlim-maxmin.h5 b/tools/testfiles/vds/vds-percival-unlim-maxmin.h5 new file mode 100644 index 0000000..b7f8827 Binary files /dev/null and b/tools/testfiles/vds/vds-percival-unlim-maxmin.h5 differ diff --git a/tools/testfiles/vds/vds_layout-eiger.ddl b/tools/testfiles/vds/vds_layout-eiger.ddl new file mode 100644 index 0000000..0ea4994 --- /dev/null +++ b/tools/testfiles/vds/vds_layout-eiger.ddl @@ -0,0 +1,87 @@ +HDF5 "vds-eiger.h5" { +GROUP "/" { + DATASET "VDS-Eiger" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 5, 10, 10 ) / ( H5S_UNLIMITED, 10, 10 ) } + STORAGE_LAYOUT { + MAPPING 0 { + VIRTUAL { + SELECTION REGULAR_HYPERSLAB { + START (0,0,0) + STRIDE (5,1,1) + COUNT (H5S_UNLIMITED,1,1) + BLOCK (5,10,10) + } + } + SOURCE { + FILE "f-%b.h5" + DATASET "A" + SELECTION ALL + } + } + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + DATA { + (0,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (0,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (1,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (2,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (3,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (4,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + } + } +} +} diff --git a/tools/testfiles/vds/vds_layout-maxmin.ddl b/tools/testfiles/vds/vds_layout-maxmin.ddl new file mode 100644 index 0000000..0b5b583 --- /dev/null +++ b/tools/testfiles/vds/vds_layout-maxmin.ddl @@ -0,0 +1,422 @@ +HDF5 "vds-percival-unlim-maxmin.h5" { +GROUP "/" { + DATASET "VDS-Percival-unlim-maxmin" { + DATATYPE H5T_STD_I32LE + DATASPACE SIMPLE { ( 32, 10, 10 ) / ( H5S_UNLIMITED, 10, 10 ) } + STORAGE_LAYOUT { + MAPPING 0 { + VIRTUAL { + SELECTION REGULAR_HYPERSLAB { + START (0,0,0) + STRIDE (4,1,1) + COUNT (H5S_UNLIMITED,1,1) + BLOCK (1,10,10) + } + } + SOURCE { + FILE "a.h5" + DATASET "A" + SELECTION REGULAR_HYPERSLAB { + START (0,0,0) + STRIDE (1,1,1) + COUNT (H5S_UNLIMITED,1,1) + BLOCK (1,10,10) + } + } + } + MAPPING 1 { + VIRTUAL { + SELECTION REGULAR_HYPERSLAB { + START (1,0,0) + STRIDE (4,1,1) + COUNT (H5S_UNLIMITED,1,1) + BLOCK (1,10,10) + } + } + SOURCE { + FILE "b.h5" + DATASET "B" + SELECTION REGULAR_HYPERSLAB { + START (0,0,0) + STRIDE (1,1,1) + COUNT (H5S_UNLIMITED,1,1) + BLOCK (1,10,10) + } + } + } + MAPPING 2 { + VIRTUAL { + SELECTION REGULAR_HYPERSLAB { + START (2,0,0) + STRIDE (4,1,1) + COUNT (H5S_UNLIMITED,1,1) + BLOCK (1,10,10) + } + } + SOURCE { + FILE "c.h5" + DATASET "C" + SELECTION REGULAR_HYPERSLAB { + START (0,0,0) + STRIDE (1,1,1) + COUNT (H5S_UNLIMITED,1,1) + BLOCK (1,10,10) + } + } + } + MAPPING 3 { + VIRTUAL { + SELECTION REGULAR_HYPERSLAB { + START (3,0,0) + STRIDE (4,1,1) + COUNT (H5S_UNLIMITED,1,1) + BLOCK (1,10,10) + } + } + SOURCE { + FILE "d.h5" + DATASET "D" + SELECTION REGULAR_HYPERSLAB { + START (0,0,0) + STRIDE (1,1,1) + COUNT (H5S_UNLIMITED,1,1) + BLOCK (1,10,10) + } + } + } + } + FILTERS { + NONE + } + FILLVALUE { + FILL_TIME H5D_FILL_TIME_IFSET + VALUE 0 + } + ALLOCATION_TIME { + H5D_ALLOC_TIME_LATE + } + DATA { + (0,0,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,1,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,2,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,3,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,4,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,5,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,6,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,7,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,8,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (0,9,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (1,0,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,1,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,2,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,3,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,4,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,5,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,6,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,7,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,8,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (1,9,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (2,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (2,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (3,0,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,1,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,2,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,3,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,4,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,5,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,6,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,7,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,8,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (3,9,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (4,0,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,1,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,2,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,3,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,4,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,5,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,6,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,7,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,8,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (4,9,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (5,0,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,1,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,2,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,3,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,4,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,5,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,6,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,7,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,8,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (5,9,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (6,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (6,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (7,0,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,1,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,2,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,3,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,4,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,5,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,6,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,7,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,8,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (7,9,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (8,0,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,1,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,2,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,3,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,4,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,5,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,6,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,7,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,8,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (8,9,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (9,0,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,1,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,2,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,3,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,4,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,5,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,6,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,7,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,8,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (9,9,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (10,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (10,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (11,0,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,1,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,2,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,3,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,4,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,5,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,6,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,7,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,8,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (11,9,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (12,0,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,1,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,2,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,3,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,4,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,5,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,6,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,7,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,8,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (12,9,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + (13,0,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,1,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,2,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,3,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,4,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,5,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,6,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,7,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,8,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (13,9,0): 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + (14,0,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,1,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,2,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,3,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,4,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,5,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,6,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,7,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,8,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (14,9,0): 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + (15,0,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,1,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,2,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,3,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,4,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,5,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,6,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,7,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,8,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (15,9,0): 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + (16,0,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,1,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,2,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,3,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,4,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,5,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,6,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,7,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,8,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (16,9,0): 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + (17,0,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,1,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,2,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,3,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,4,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,5,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,6,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,7,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,8,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (17,9,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (18,0,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,1,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,2,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,3,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,4,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,5,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,6,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,7,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,8,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (18,9,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (19,0,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,1,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,2,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,3,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,4,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,5,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,6,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,7,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,8,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (19,9,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (20,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (20,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (20,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (20,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (20,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (20,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (20,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (20,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (20,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (20,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (21,0,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (21,1,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (21,2,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (21,3,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (21,4,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (21,5,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (21,6,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (21,7,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (21,8,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (21,9,0): 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, + (22,0,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (22,1,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (22,2,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (22,3,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (22,4,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (22,5,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (22,6,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (22,7,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (22,8,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (22,9,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (23,0,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (23,1,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (23,2,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (23,3,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (23,4,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (23,5,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (23,6,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (23,7,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (23,8,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (23,9,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (24,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (24,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (24,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (24,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (24,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (24,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (24,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (24,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (24,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (24,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (25,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (25,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (25,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (25,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (25,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (25,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (25,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (25,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (25,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (25,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (26,0,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (26,1,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (26,2,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (26,3,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (26,4,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (26,5,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (26,6,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (26,7,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (26,8,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (26,9,0): 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, + (27,0,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (27,1,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (27,2,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (27,3,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (27,4,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (27,5,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (27,6,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (27,7,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (27,8,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (27,9,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (28,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (28,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (28,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (28,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (28,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (28,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (28,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (28,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (28,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (28,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (29,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (29,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (29,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (29,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (29,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (29,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (29,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (29,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (29,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (29,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (30,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (30,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (30,2,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (30,3,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (30,4,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (30,5,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (30,6,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (30,7,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (30,8,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (30,9,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + (31,0,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (31,1,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (31,2,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (31,3,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (31,4,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (31,5,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (31,6,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (31,7,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (31,8,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + (31,9,0): 40, 40, 40, 40, 40, 40, 40, 40, 40, 40 + } + } +} +} -- cgit v0.12 From f74042d4e8ac904e5ab847b36e0fbabf5835b12a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 23 Feb 2016 15:50:02 -0500 Subject: [svn-r29190] Add checking for *.err file before trying to read --- config/cmake/vfdTest.cmake | 4 ++-- config/cmake_ext_mod/prunTest.cmake | 4 ++-- config/cmake_ext_mod/runTest.cmake | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/config/cmake/vfdTest.cmake b/config/cmake/vfdTest.cmake index 4685d88..10f0a7b 100644 --- a/config/cmake/vfdTest.cmake +++ b/config/cmake/vfdTest.cmake @@ -35,10 +35,10 @@ EXECUTE_PROCESS ( message (STATUS "COMMAND Result: ${TEST_RESULT}") -if (ERROR_APPEND) +if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.err) file (READ ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.err TEST_STREAM) file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.out "${TEST_STREAM}") -endif (ERROR_APPEND) +endif (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}_${TEST_VFD}.err) # if the return value is !=${TEST_EXPECT} bail out if (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) diff --git a/config/cmake_ext_mod/prunTest.cmake b/config/cmake_ext_mod/prunTest.cmake index 089c203..38ecb7e 100644 --- a/config/cmake_ext_mod/prunTest.cmake +++ b/config/cmake_ext_mod/prunTest.cmake @@ -49,10 +49,10 @@ message (STATUS "COMMAND Result: ${TEST_RESULT}") file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) file (WRITE ${TEST_FOLDER}/P_${TEST_REFERENCE} "${TEST_STREAM}") -if (ERROR_APPEND) +if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif (ERROR_APPEND) +endif (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) if (TEST_APPEND) file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_APPEND} ${TEST_ERROR}\n") diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index c2b7527..2dc8ac4 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -62,10 +62,10 @@ endif (NOT TEST_INPUT) message (STATUS "COMMAND Result: ${TEST_RESULT}") -if (ERROR_APPEND) +if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") -endif (ERROR_APPEND) +endif (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) if (TEST_APPEND) file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_APPEND} ${TEST_RESULT}\n") @@ -91,11 +91,11 @@ if (TEST_MASK_MOD) endif (TEST_MASK_MOD) if (TEST_MASK_ERROR) - if (NOT TEST_ERRREF) + if (NOT TEST_ERRREF AND NOT EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - else (NOT TEST_ERRREF) + else () file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) - endif (NOT TEST_ERRREF) + endif () string (REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}") string (REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}") string (REGEX REPLACE " line [0-9]*" " line (number)" TEST_STREAM "${TEST_STREAM}") @@ -103,11 +103,11 @@ if (TEST_MASK_ERROR) string (REGEX REPLACE "[1-9]*[.][0-9]*[.][0-9]*[^)]*" "version (number)" TEST_STREAM "${TEST_STREAM}") string (REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") string (REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") - if (NOT TEST_ERRREF) + if (NOT TEST_ERRREF AND NOT EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") - else (NOT TEST_ERRREF) + else () file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") - endif (NOT TEST_ERRREF) + endif () endif (TEST_MASK_ERROR) if (TEST_FILTER) -- cgit v0.12 From 016ebfcdf247eb1b63b116babf054d2252245086 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 24 Feb 2016 09:55:14 -0500 Subject: [svn-r29198] Remove if condition for test mask situation --- config/cmake_ext_mod/runTest.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index 2dc8ac4..3b7d949 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -91,7 +91,7 @@ if (TEST_MASK_MOD) endif (TEST_MASK_MOD) if (TEST_MASK_ERROR) - if (NOT TEST_ERRREF AND NOT EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) + if (NOT TEST_ERRREF) file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) else () file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) @@ -103,7 +103,7 @@ if (TEST_MASK_ERROR) string (REGEX REPLACE "[1-9]*[.][0-9]*[.][0-9]*[^)]*" "version (number)" TEST_STREAM "${TEST_STREAM}") string (REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") string (REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") - if (NOT TEST_ERRREF AND NOT EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) + if (NOT TEST_ERRREF) file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") else () file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") -- cgit v0.12 From 337e62226ca69fea7a467ef1052a96a0015b1305 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Wed, 24 Feb 2016 16:30:35 -0500 Subject: [svn-r29202] Fix for unknown message HDFFV-9697. Tested on jam, ostrich, platypus, kite, quail, osx1010test, emu, mayll, moohan. --- src/H5Dint.c | 10 +- src/H5Fpkg.h | 2 +- src/H5Fsuper.c | 6 +- src/H5MF.c | 4 +- src/H5O.c | 24 ++- src/H5Obogus.c | 30 +++- src/H5Ocache.c | 13 +- src/H5Opkg.h | 8 +- src/H5Oprivate.h | 11 +- test/gen_bogus.c | 68 ++++++-- test/ohdr.c | 464 +++++++++++++++++++++++++++++++++++-------------------- test/tbogus.h5 | Bin 2216 -> 4512 bytes 12 files changed, 435 insertions(+), 205 deletions(-) diff --git a/src/H5Dint.c b/src/H5Dint.c index fe34718..733ffe7 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -945,15 +945,21 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't get dataset creation property list") /* Check whether to add a "bogus" message */ - if(H5P_exist_plist(dc_plist, H5O_BOGUS_MSG_FLAGS_NAME) > 0) { + if( (H5P_exist_plist(dc_plist, H5O_BOGUS_MSG_FLAGS_NAME) > 0) && + (H5P_exist_plist(dc_plist, H5O_BOGUS_MSG_ID_NAME) > 0) ) { + uint8_t bogus_flags = 0; /* Flags for creating "bogus" message */ + unsigned bogus_id; /* "bogus" ID */ + /* Retrieve "bogus" message ID */ + if(H5P_get(dc_plist, H5O_BOGUS_MSG_ID_NAME, &bogus_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus ID options") /* Retrieve "bogus" message flags */ if(H5P_get(dc_plist, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get bogus message options") /* Add a "bogus" message (for error testing). */ - if(H5O_bogus_oh(file, dxpl_id, oh, (unsigned)bogus_flags) < 0) + if(H5O_bogus_oh(file, dxpl_id, oh, bogus_id, (unsigned)bogus_flags) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to create 'bogus' message") } /* end if */ } diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index be324d0..ab2ef9e 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -359,7 +359,7 @@ H5_DLL herr_t H5F__super_free(H5F_super_t *sblock); /* Superblock extension related routines */ H5_DLL herr_t H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr); -H5_DLL herr_t H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, void *mesg, unsigned id, hbool_t may_create); +H5_DLL herr_t H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, unsigned id, void *mesg, hbool_t may_create); H5_DLL herr_t H5F_super_ext_remove_msg(H5F_t *f, hid_t dxpl_id, unsigned id); H5_DLL herr_t H5F_super_ext_close(H5F_t *f, H5O_loc_t *ext_ptr, hid_t dxpl_id, hbool_t was_created); diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 332dfa6..6b4613d 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -622,7 +622,7 @@ H5F__super_read(H5F_t *f, hid_t dxpl_id) f->shared->sblock = sblock; #endif /* JRM */ - if(H5F_super_ext_write_msg(f, dxpl_id, &drvinfo, H5O_DRVINFO_ID, FALSE) < 0) + if(H5F_super_ext_write_msg(f, dxpl_id, H5O_DRVINFO_ID, &drvinfo, FALSE) < 0) HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing message to superblock extension") #if 1 /* bug fix test code -- tidy this up if all goes well */ /* JRM */ @@ -959,7 +959,7 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id) for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) fsinfo.fs_addr[type-1] = HADDR_UNDEF; - if(H5O_msg_create(&ext_loc, H5O_FSINFO_ID, H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &fsinfo, dxpl_id) < 0) + if(H5O_msg_create(&ext_loc, H5O_FSINFO_ID, H5O_MSG_FLAG_DONTSHARE, H5O_UPDATE_TIME, &fsinfo, dxpl_id) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to update free-space info header message") } /* end if */ } /* end if */ @@ -1197,7 +1197,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, void *mesg, unsigned id, hbool_t may_create) +H5F_super_ext_write_msg(H5F_t *f, hid_t dxpl_id, unsigned id, void *mesg, hbool_t may_create) { H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ diff --git a/src/H5MF.c b/src/H5MF.c index 52ea82a..00a1ed8 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -1237,7 +1237,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); /* Write free-space manager info message to superblock extension object header */ /* Create the superblock extension object header in advance if needed */ - if(H5F_super_ext_write_msg(f, dxpl_id, &fsinfo, H5O_FSINFO_ID, TRUE) < 0) + if(H5F_super_ext_write_msg(f, dxpl_id, H5O_FSINFO_ID, &fsinfo, TRUE) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_WRITEERROR, FAIL, "error in writing message to superblock extension") /* Re-allocate free-space manager header and/or section info header */ @@ -1272,7 +1272,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); /* Update the free space manager info message in superblock extension object header */ if(update) - if(H5F_super_ext_write_msg(f, dxpl_id, &fsinfo, H5O_FSINFO_ID, FALSE) < 0) + if(H5F_super_ext_write_msg(f, dxpl_id, H5O_FSINFO_ID, &fsinfo, FALSE) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_WRITEERROR, FAIL, "error in writing message to superblock extension") /* Final close of free-space managers */ diff --git a/src/H5O.c b/src/H5O.c index 503c978..1937483 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -112,9 +112,9 @@ const H5O_msg_class_t *const H5O_msg_class_g[] = { H5O_MSG_EFL, /*0x0007 Data storage -- external data files */ H5O_MSG_LAYOUT, /*0x0008 Data Layout */ #ifdef H5O_ENABLE_BOGUS - H5O_MSG_BOGUS, /*0x0009 "Bogus" (for testing) */ + H5O_MSG_BOGUS_VALID, /*0x0009 "Bogus valid" (for testing) */ #else /* H5O_ENABLE_BOGUS */ - NULL, /*0x0009 "Bogus" (for testing) */ + NULL, /*0x0009 "Bogus valid" (for testing) */ #endif /* H5O_ENABLE_BOGUS */ H5O_MSG_GINFO, /*0x000A Group information */ H5O_MSG_PLINE, /*0x000B Data storage -- filter pipeline */ @@ -131,6 +131,11 @@ const H5O_msg_class_t *const H5O_msg_class_g[] = { H5O_MSG_REFCOUNT, /*0x0016 Object's ref. count */ H5O_MSG_FSINFO, /*0x0017 Free-space manager info message */ H5O_MSG_UNKNOWN, /*0x0018 Placeholder for unknown message */ +#ifdef H5O_ENABLE_BOGUS + H5O_MSG_BOGUS_INVALID, /*0x0019 "Bogus invalid" (for testing) */ +#else /* H5O_ENABLE_BOGUS */ + NULL, /*0x0019 "Bogus invalid" (for testing) */ +#endif /* H5O_ENABLE_BOGUS */ }; /* Declare a free list to manage the H5O_t struct */ @@ -2141,9 +2146,10 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_flags) +H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned bogus_id, unsigned mesg_flags) { size_t idx; /* Local index variable */ + H5O_msg_class_t *type; /* Message class type */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -2153,7 +2159,8 @@ H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_flags) /* Look for existing message */ for(idx = 0; idx < oh->nmesgs; idx++) - if(H5O_MSG_BOGUS == oh->mesg[idx].type) + if(H5O_MSG_BOGUS_VALID == oh->mesg[idx].type || + H5O_MSG_BOGUS_INVALID == oh->mesg[idx].type) break; /* Create a new message */ @@ -2167,8 +2174,15 @@ H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_flags) /* Update the native value */ bogus->u = H5O_BOGUS_VALUE; + if(bogus_id == H5O_BOGUS_VALID_ID) + type = H5O_MSG_BOGUS_VALID; + else if(bogus_id == H5O_BOGUS_INVALID_ID) + type = H5O_MSG_BOGUS_INVALID; + else + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "invalid ID for 'bogus' message") + /* Allocate space in the object header for bogus message */ - if(H5O_msg_alloc(f, dxpl_id, oh, H5O_MSG_BOGUS, &mesg_flags, bogus, &idx) < 0) + if(H5O_msg_alloc(f, dxpl_id, oh, type, &mesg_flags, bogus, &idx) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to allocate space for 'bogus' message") /* Point to "bogus" information (take it over) */ diff --git a/src/H5Obogus.c b/src/H5Obogus.c index de205f6..d1085c8 100644 --- a/src/H5Obogus.c +++ b/src/H5Obogus.c @@ -47,9 +47,9 @@ static herr_t H5O_bogus_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * int indent, int fwidth); /* This message derives from H5O message class */ -const H5O_msg_class_t H5O_MSG_BOGUS[1] = {{ - H5O_BOGUS_ID, /*message id number */ - "bogus", /*message name for debugging */ +const H5O_msg_class_t H5O_MSG_BOGUS_VALID[1] = {{ + H5O_BOGUS_VALID_ID, /*message id number */ + "bogus valid", /*message name for debugging */ 0, /*native message size */ 0, /* messages are sharable? */ H5O_bogus_decode, /*decode message */ @@ -70,6 +70,30 @@ const H5O_msg_class_t H5O_MSG_BOGUS[1] = {{ H5O_bogus_debug /*debug the message */ }}; +/* This message derives from H5O message class */ +const H5O_msg_class_t H5O_MSG_BOGUS_INVALID[1] = {{ + H5O_BOGUS_INVALID_ID, /*message id number */ + "bogus invalid", /*message name for debugging */ + 0, /*native message size */ + 0, /* messages are sharable? */ + H5O_bogus_decode, /*decode message */ + H5O_bogus_encode, /*encode message */ + NULL, /*copy the native value */ + H5O_bogus_size, /*raw message size */ + NULL, /*free internal memory */ + NULL, /*free method */ + NULL, /* file delete method */ + NULL, /* link method */ + NULL, /*set share method */ + NULL, /*can share method */ + NULL, /* pre copy native value to file */ + NULL, /* copy native value to file */ + NULL, /* post copy native value to file */ + NULL, /* get creation index */ + NULL, /* set creation index */ + H5O_bogus_debug /*debug the message */ +}}; + /*------------------------------------------------------------------------- * Function: H5O_bogus_decode diff --git a/src/H5Ocache.c b/src/H5Ocache.c index 945d12e..f74966e 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -1149,10 +1149,6 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image else id = *chunk_image++; - /* Check for unknown message ID getting encoded in file */ - if(id >= H5O_UNKNOWN_ID) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "'unknown' message ID encoded in file?!?") - /* Message size */ UINT16DECODE(chunk_image, mesg_size); HDassert(mesg_size == H5O_ALIGN_OH(oh, mesg_size)); @@ -1222,8 +1218,13 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image /* Point unknown messages at 'unknown' message class */ /* (Usually from future versions of the library) */ - if(id >= NELMTS(H5O_msg_class_g) || NULL == H5O_msg_class_g[id]) { - H5O_unknown_t *unknown; /* Pointer to "unknown" message info */ + if(id >= H5O_UNKNOWN_ID || +#ifdef H5O_ENABLE_BOGUS + id == H5O_BOGUS_VALID_ID || +#endif + NULL == H5O_msg_class_g[id]) { + + H5O_unknown_t *unknown; /* Pointer to "unknown" message info */ /* Allocate "unknown" message info */ if(NULL == (unknown = H5FL_MALLOC(H5O_unknown_t))) diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 642e938..cc1b289 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -31,7 +31,7 @@ #define H5O_NMESGS 8 /*initial number of messages */ #define H5O_NCHUNKS 2 /*initial number of chunks */ #define H5O_MIN_SIZE 22 /* Min. obj header data size (must be big enough for a message prefix and a continuation message) */ -#define H5O_MSG_TYPES 25 /* # of types of messages */ +#define H5O_MSG_TYPES 26 /* # of types of messages */ #define H5O_MAX_CRT_ORDER_IDX 65535 /* Max. creation order index value */ /* Versions of object header structure */ @@ -440,11 +440,13 @@ H5_DLLVAR const H5O_msg_class_t H5O_MSG_EFL[1]; H5_DLLVAR const H5O_msg_class_t H5O_MSG_LAYOUT[1]; #ifdef H5O_ENABLE_BOGUS -/* "Bogus" Message. (0x0009) */ +/* "Bogus valid" Message. (0x0009) */ +/* "Bogus invalid" Message. (0x0019) */ /* * Used for debugging - should never be found in valid HDF5 file. */ -H5_DLLVAR const H5O_msg_class_t H5O_MSG_BOGUS[1]; +H5_DLLVAR const H5O_msg_class_t H5O_MSG_BOGUS_VALID[1]; +H5_DLLVAR const H5O_msg_class_t H5O_MSG_BOGUS_INVALID[1]; #endif /* H5O_ENABLE_BOGUS */ /* Group Information Message. (0x000a) */ diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 4ce8e59..77b2b51 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -98,7 +98,13 @@ typedef struct H5O_t H5O_t; #ifdef H5O_ENABLE_BOGUS #define H5O_BOGUS_MSG_FLAGS_NAME "bogus msg flags" /* Flags for 'bogus' message */ #define H5O_BOGUS_MSG_FLAGS_SIZE sizeof(uint8_t) + +/* bogus ID can be either (a) H5O_BOGUS_VALID_ID 0x0009 or (b) H5O_BOGUS_INVALID_ID 0x0019 */ +#define H5O_BOGUS_MSG_ID_NAME "bogus msg id" /* ID for 'bogus' message */ +#define H5O_BOGUS_MSG_ID_SIZE sizeof(unsigned) + #endif /* H5O_ENABLE_BOGUS */ + #ifdef H5O_ENABLE_BAD_MESG_COUNT #define H5O_BAD_MESG_COUNT_NAME "bad message count" /* Flag setting bad message count */ #define H5O_BAD_MESG_COUNT_SIZE sizeof(hbool_t) @@ -183,7 +189,7 @@ typedef struct H5O_copy_t { #define H5O_LINK_ID 0x0006 /* Link Message. */ #define H5O_EFL_ID 0x0007 /* External File List Message */ #define H5O_LAYOUT_ID 0x0008 /* Data Layout Message. */ -#define H5O_BOGUS_ID 0x0009 /* "Bogus" Message. */ +#define H5O_BOGUS_VALID_ID 0x0009 /* "Bogus valid" Message. */ #define H5O_GINFO_ID 0x000a /* Group info Message. */ #define H5O_PLINE_ID 0x000b /* Filter pipeline message. */ #define H5O_ATTR_ID 0x000c /* Attribute Message. */ @@ -200,6 +206,7 @@ typedef struct H5O_copy_t { #define H5O_FSINFO_ID 0x0017 /* Free-space manager info message. */ #define H5O_UNKNOWN_ID 0x0018 /* Placeholder message ID for unknown message. */ /* (this should never exist in a file) */ +#define H5O_BOGUS_INVALID_ID 0x0019 /* "Bogus invalid" Message. */ /* Shared object message types. * Shared objects can be committed, in which case the shared message contains @@ -755,7 +762,7 @@ H5_DLL herr_t H5O_touch(const H5O_loc_t *loc, hbool_t force, hid_t dxpl_id); H5_DLL herr_t H5O_touch_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hbool_t force); #ifdef H5O_ENABLE_BOGUS -H5_DLL herr_t H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_flags); +H5_DLL herr_t H5O_bogus_oh(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned mesg_id, unsigned mesg_flags); #endif /* H5O_ENABLE_BOGUS */ H5_DLL herr_t H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr); H5_DLL herr_t H5O_get_hdr_info(const H5O_loc_t *oloc, hid_t dxpl_id, H5O_hdr_info_t *hdr); diff --git a/test/gen_bogus.c b/test/gen_bogus.c index e9ce686..fdd8744 100644 --- a/test/gen_bogus.c +++ b/test/gen_bogus.c @@ -21,8 +21,8 @@ * datasets that have "bogus" messages in their object header. */ -#include "H5private.h" #include "hdf5.h" +#include "H5private.h" #include "H5Oprivate.h" #ifdef H5O_ENABLE_BOGUS @@ -36,18 +36,21 @@ #define FALSE 0 #endif /* FALSE */ -int main(void) -{ #ifdef H5O_ENABLE_BOGUS - hid_t fid = -1; /* File ID */ + +/* + * Create datasets in the location (in "/" or "/group") with + * message id: (a) H5O_BOGUS_VALID_ID or (b)H5O_BOGUS_INVALID_ID + * and various unknown message flags + */ +static int +generate_datasets(hid_t loc_id, unsigned bogus_id) +{ hid_t sid = -1; /* Dataspace ID */ hid_t dcpl = -1; /* Dataset creation property list ID */ hid_t did = -1; /* Dataset ID */ uint8_t bogus_flags = 0; /* Flags for bogus message */ - /* Create file for test datasets */ - if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; - /* Create dataspace for datasets */ if((sid = H5Screate(H5S_SCALAR)) < 0) goto error; @@ -57,8 +60,11 @@ int main(void) /* Add property for bogus message flags */ if(H5Pinsert2(dcpl, H5O_BOGUS_MSG_FLAGS_NAME, H5O_BOGUS_MSG_FLAGS_SIZE, &bogus_flags, NULL, NULL, NULL, NULL, NULL, NULL) < 0) goto error; + /* Add property for bogus message ID */ + if(H5Pinsert2(dcpl, H5O_BOGUS_MSG_ID_NAME, H5O_BOGUS_MSG_ID_SIZE, &bogus_id, NULL, NULL, NULL, NULL, NULL, NULL) < 0) goto error; + /* Create dataset with "bogus" message, but no message flags */ - if((did = H5Dcreate2(fid, "/Dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; + if((did = H5Dcreate2(loc_id, "Dataset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; if(H5Dclose(did) < 0) goto error; /* Set "fail if unknown and open for write" message flag for bogus message */ @@ -66,7 +72,7 @@ int main(void) if(H5Pset(dcpl, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0) goto error; /* Create second dataset, with "fail if unknown" message flag */ - if((did = H5Dcreate2(fid, "/Dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; + if((did = H5Dcreate2(loc_id, "Dataset2", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; if(H5Dclose(did) < 0) goto error; /* Set "fail if unknown always" message flag for bogus message */ @@ -74,7 +80,7 @@ int main(void) if(H5Pset(dcpl, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0) goto error; /* Create third dataset, with "fail if unknown always" message flag */ - if((did = H5Dcreate2(fid, "/Dataset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; + if((did = H5Dcreate2(loc_id, "Dataset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; if(H5Dclose(did) < 0) goto error; /* Set "mark if unknown" message flag for bogus message */ @@ -82,7 +88,7 @@ int main(void) if(H5Pset(dcpl, H5O_BOGUS_MSG_FLAGS_NAME, &bogus_flags) < 0) goto error; /* Create fourth dataset, with "mark if unknown" message flag */ - if((did = H5Dcreate2(fid, "/Dataset4", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; + if((did = H5Dcreate2(loc_id, "Dataset4", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; if(H5Dclose(did) < 0) goto error; /* Close dataset creation property list */ @@ -91,9 +97,6 @@ int main(void) /* Close dataspace */ if(H5Sclose(sid) < 0) goto error; - /* Close file */ - if(H5Fclose(fid) < 0) goto error; - return 0; error: @@ -101,6 +104,43 @@ error: H5Dclose(did); H5Sclose(sid); H5Pclose(dcpl); + } H5E_END_TRY; + + return -1; +} /* generate_datasets() */ +#endif + +int main(void) +{ +#ifdef H5O_ENABLE_BOGUS + hid_t fid = -1; /* File ID */ + hid_t gid = -1; /* Group ID */ + + /* Create file for test datasets */ + if((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; + + /* Create datasets in "/" group with bogus message H5O_BOGUS_VALID_ID */ + if(generate_datasets(fid, H5O_BOGUS_VALID_ID) < 0) + goto error; + + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + goto error; + + /* Create datasets in "/group" with bogus message H5O_BOGUS_INVALID_ID */ + if(generate_datasets(gid, H5O_BOGUS_INVALID_ID) < 0) + goto error; + + /* Close the group */ + if(H5Gclose(gid) < 0) goto error; + + /* Close file */ + if(H5Fclose(fid) < 0) goto error; + + return 0; + +error: + H5E_BEGIN_TRY { + H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; #else /* H5O_ENABLE_BOGUS */ diff --git a/test/ohdr.c b/test/ohdr.c index c0ec3d0..3b11539 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -295,6 +295,294 @@ error: return -1; } /* test_ohdr_cache() */ +/* + * To test objects with unknown messages in a file with: + * a) H5O_BOGUS_VALID_ID: + * --the bogus_id is within the range of H5O_msg_class_g[] + * b) H5O_BOGUS_INVALID_ID: + * --the bogus_id is outside the range of H5O_msg_class_g[] + * + * The test file is FILE_BOGUS: "tbogus.h5" generated with gen_bogus.c + * --objects that have unknown header messages with H5O_BOGUS_VALID_ID in "/" + * --objects that have unknown header messages with H5O_BOGUS_INVALID_ID in "/group" + * + * The test also uses the test file FILENAME[0] (ohdr.h5): the parameter "filename" + */ +static herr_t +test_unknown(unsigned bogus_id, char *filename, hid_t fapl) +{ + hid_t fid = -1; /* file ID */ + hid_t gid = -1; /* group ID */ + hid_t did = -1; /* Dataset ID */ + hid_t sid = -1; /* Dataspace ID */ + hid_t aid = -1; /* Attribute ID */ + hid_t loc = -1; /* location: file or group ID */ + hid_t fid_bogus = -1; /* bogus file ID */ + hid_t gid_bogus = -1; /* bogus group ID */ + hid_t loc_bogus = -1; /* location: bogus file or group ID */ + const char *testfile = H5_get_srcdir_filename(FILE_BOGUS); + + TESTING("object with unknown header message and no flags set"); + + /* Open filename */ + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + + /* Open FILE_BOGUS */ + if((fid_bogus = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Set up location ID depending on bogus_id */ + if(bogus_id == H5O_BOGUS_INVALID_ID) { + /* Open "group" in FILE_BOGUS */ + if((gid_bogus = H5Gopen2(fid_bogus, "group", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + loc_bogus = gid_bogus; + + /* Create "group" in filename */ + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + loc = gid; + + } else { /* H5O_BOGUS_VALID_ID */ + loc_bogus = fid_bogus; + loc = fid; + } + + /* Open the dataset with the unknown header message, but no extra flags */ + if((did = H5Dopen2(loc_bogus, "Dataset1", H5P_DEFAULT)) < 0) + TEST_ERROR + if(H5Dclose(did) < 0) + TEST_ERROR + + PASSED(); + + TESTING("object in r/o file with unknown header message & 'fail if unknown and open for write' flag set"); + + /* Open the dataset with the unknown header message, and "fail if unknown and open for write" flag */ + if((did = H5Dopen2(loc_bogus, "Dataset2", H5P_DEFAULT)) < 0) + TEST_ERROR + if(H5Dclose(did) < 0) + TEST_ERROR + + PASSED(); + + TESTING("object in r/o file with unknown header message & 'fail if unknown always' flag set"); + + /* Attempt to open the dataset with the unknown header message, and "fail if unknown always" flag */ + H5E_BEGIN_TRY { + did = H5Dopen2(loc_bogus, "Dataset3", H5P_DEFAULT); + } H5E_END_TRY; + if(did >= 0) { + H5Dclose(did); + TEST_ERROR + } /* end if */ + + PASSED(); + + TESTING("object with unknown header message & 'mark if unknown' flag set"); + + /* Copy object with "mark if unknown" flag on message into file (FILENAME[0]) that can be modified */ + if(H5Ocopy(loc_bogus, "Dataset4", loc, "Dataset4", H5P_DEFAULT, H5P_DEFAULT) < 0) + TEST_ERROR + + /* Closing: filename */ + if(bogus_id == H5O_BOGUS_INVALID_ID) { + if(H5Gclose(gid) < 0) + FAIL_STACK_ERROR + } + if(H5Fclose(fid) < 0) + TEST_ERROR + + /* Re-open filename, with read-only permissions */ + if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) + TEST_ERROR + + /* Set up location ID depending on bogus_id */ + if(bogus_id == H5O_BOGUS_INVALID_ID) { + /* Open "group" in filename */ + if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + loc = gid; + } else + loc = fid; + + /* Open the dataset with the "mark if unknown" message */ + if((did = H5Dopen2(loc, "Dataset4", H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Check that the "unknown" message was _NOT_ marked */ + if(H5O_check_msg_marked_test(did, FALSE) < 0) + FAIL_STACK_ERROR + + /* Close the dataset */ + if(H5Dclose(did) < 0) + TEST_ERROR + + /* Close "group" in filename depending on bogus_id */ + if(bogus_id == H5O_BOGUS_INVALID_ID) { + if(H5Gclose(gid) < 0) + FAIL_STACK_ERROR + } + + /* Close filename (to flush change to object header) */ + if(H5Fclose(fid) < 0) + TEST_ERROR + + /* Re-open filename */ + if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) + TEST_ERROR + + /* Set up location ID depending on bogus_id */ + if(bogus_id == H5O_BOGUS_INVALID_ID) { + /* Open "group" in filename */ + if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + loc = gid; + } else + loc = fid; + + /* Open the dataset with the "mark if unknown" message */ + if((did = H5Dopen2(loc, "Dataset4", H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Create data space */ + if((sid = H5Screate(H5S_SCALAR)) < 0) + FAIL_STACK_ERROR + + /* Create an attribute, to get the object header into write access */ + if((aid = H5Acreate2(did, "Attr", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + + /* Close dataspace */ + if(H5Sclose(sid) < 0) + FAIL_STACK_ERROR + + /* Close attribute */ + if(H5Aclose(aid) < 0) + FAIL_STACK_ERROR + + /* Close the dataset */ + if(H5Dclose(did) < 0) + TEST_ERROR + + /* Close "group" in filename depending on bogus_id */ + if(bogus_id == H5O_BOGUS_INVALID_ID) { + if(H5Gclose(gid) < 0) + FAIL_STACK_ERROR + } + + /* Close filename (to flush change to object header) */ + if(H5Fclose(fid) < 0) + TEST_ERROR + + /* Re-open filename */ + if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) + TEST_ERROR + + /* Set up location ID depending on bogus_id */ + if(bogus_id == H5O_BOGUS_INVALID_ID) { + /* Open "group" in filename */ + if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + loc = gid; + } else + loc = fid; + + /* Re-open the dataset with the "mark if unknown" message */ + if((did = H5Dopen2(loc, "Dataset4", H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Check that the "unknown" message was marked */ + if(H5O_check_msg_marked_test(did, TRUE) < 0) + FAIL_STACK_ERROR + + /* Close the dataset */ + if(H5Dclose(did) < 0) + TEST_ERROR + + /* Closing: filename */ + if(bogus_id == H5O_BOGUS_INVALID_ID) { + if(H5Gclose(gid) < 0) + TEST_ERROR + } + if(H5Fclose(fid) < 0) + TEST_ERROR + + PASSED(); + + /* Closing: FILE_BOGUS */ + if(bogus_id == H5O_BOGUS_INVALID_ID) { + if(H5Gclose(gid_bogus) < 0) + TEST_ERROR + } + if(H5Fclose(fid_bogus) < 0) + TEST_ERROR + + TESTING("object in r/w file with unknown header message & 'fail if unknown and open for write' flag set"); + + /* Open FILE_BOGUS with RW intent this time */ + if((fid_bogus = H5Fopen(testfile, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) + TEST_ERROR + + /* Set up location ID */ + if(bogus_id == H5O_BOGUS_INVALID_ID) { + /* Open "group" in FILE_BOGUS */ + if((gid_bogus = H5Gopen2(fid_bogus, "group", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + loc_bogus = gid_bogus; + } else + loc_bogus = fid_bogus; + + /* Attempt to open the dataset with the unknown header message, and "fail if unknown and open for write" flag */ + H5E_BEGIN_TRY { + did = H5Dopen2(loc_bogus, "Dataset2", H5P_DEFAULT); + } H5E_END_TRY; + if(did >= 0) { + H5Dclose(did); + TEST_ERROR + } /* end if */ + + PASSED(); + + TESTING("object in r/w file with unknown header message & 'fail if unknown always' flag set"); + + /* Attempt to open the dataset with the unknown header message, and "fail if unknown always" flag */ + H5E_BEGIN_TRY { + did = H5Dopen2(loc_bogus, "Dataset3", H5P_DEFAULT); + } H5E_END_TRY; + if(did >= 0) { + H5Dclose(did); + TEST_ERROR + } /* end if */ + + /* Closing: FILE_BOGUS */ + if(bogus_id == H5O_BOGUS_INVALID_ID) { + if(H5Gclose(gid_bogus) < 0) + TEST_ERROR + } + if(H5Fclose(fid_bogus) < 0) + TEST_ERROR + + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY { + H5Fclose(fid); + H5Gclose(gid); + H5Fclose(fid_bogus); + H5Gclose(gid_bogus); + H5Dclose(did); + H5Sclose(sid); + H5Aclose(aid); + } H5E_END_TRY; + + return -1; +} /* test_unknown() */ + /*------------------------------------------------------------------------- * Function: main @@ -664,180 +952,28 @@ main(void) PASSED(); + /* Close the file we created */ + if(H5Fclose(file) < 0) + TEST_ERROR /* Test reading datasets with undefined object header messages * and the various "fail/mark if unknown" object header message flags */ - HDputs("Accessing objects with unknown header messages:"); + HDputs("Accessing objects with unknown header messages: H5O_BOGUS_VALID_ID"); { - hid_t file2; /* File ID for 'bogus' object file */ - hid_t sid; /* Dataspace ID */ - hid_t aid; /* Attribute ID */ - const char *testfile = H5_get_srcdir_filename(FILE_BOGUS); - - TESTING("object with unknown header message and no flags set"); - - /* Open the file with objects that have unknown header messages (generated with gen_bogus.c) */ - if((file2 = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) - TEST_ERROR - - /* Open the dataset with the unknown header message, but no extra flags */ - if((dset = H5Dopen2(file2, "/Dataset1", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Dclose(dset) < 0) - TEST_ERROR - - PASSED(); - - TESTING("object in r/o file with unknown header message & 'fail if unknown and open for write' flag set"); - - /* Open the dataset with the unknown header message, and "fail if unknown and open for write" flag */ - if((dset = H5Dopen2(file2, "/Dataset2", H5P_DEFAULT)) < 0) - TEST_ERROR - if(H5Dclose(dset) < 0) - TEST_ERROR - - PASSED(); - - TESTING("object in r/o file with unknown header message & 'fail if unknown always' flag set"); - - /* Attempt to open the dataset with the unknown header message, and "fail if unknown always" flag */ - H5E_BEGIN_TRY { - dset = H5Dopen2(file2, "/Dataset3", H5P_DEFAULT); - } H5E_END_TRY; - if(dset >= 0) { - H5Dclose(dset); - TEST_ERROR - } /* end if */ - - PASSED(); - - TESTING("object with unknown header message & 'mark if unknown' flag set"); - - /* Copy object with "mark if unknown" flag on message into file that can be modified */ - if(H5Ocopy(file2, "/Dataset4", file, "/Dataset4", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR - - /* Close the file we created (to flush changes to file) */ - if(H5Fclose(file) < 0) - TEST_ERROR - - /* Re-open the file created, with read-only permissions */ - if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) - TEST_ERROR - - /* Open the dataset with the "mark if unknown" message */ - if((dset = H5Dopen2(file, "/Dataset4", H5P_DEFAULT)) < 0) - TEST_ERROR - - /* Check that the "unknown" message was _NOT_ marked */ - if(H5O_check_msg_marked_test(dset, FALSE) < 0) - FAIL_STACK_ERROR - - /* Close the dataset */ - if(H5Dclose(dset) < 0) + if(test_unknown(H5O_BOGUS_VALID_ID, filename, fapl) < 0) TEST_ERROR + } - /* Close the file we created (to flush change to object header) */ - if(H5Fclose(file) < 0) - TEST_ERROR - - /* Re-open the file created */ - if((file = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) - TEST_ERROR - - /* Open the dataset with the "mark if unknown" message */ - if((dset = H5Dopen2(file, "/Dataset4", H5P_DEFAULT)) < 0) - TEST_ERROR - - /* Create data space */ - if((sid = H5Screate(H5S_SCALAR)) < 0) - FAIL_STACK_ERROR - - /* Create an attribute, to get the object header into write access */ - if((aid = H5Acreate2(dset, "Attr", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - - /* Close dataspace */ - if(H5Sclose(sid) < 0) - FAIL_STACK_ERROR - - /* Close attribute */ - if(H5Aclose(aid) < 0) - FAIL_STACK_ERROR - - /* Close the dataset */ - if(H5Dclose(dset) < 0) - TEST_ERROR - - /* Close the file we created (to flush change to object header) */ - if(H5Fclose(file) < 0) - TEST_ERROR - - /* Re-open the file created */ - if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) - TEST_ERROR - - /* Re-open the dataset with the "mark if unknown" message */ - if((dset = H5Dopen2(file, "/Dataset4", H5P_DEFAULT)) < 0) - TEST_ERROR - - /* Check that the "unknown" message was marked */ - if(H5O_check_msg_marked_test(dset, TRUE) < 0) - FAIL_STACK_ERROR - - /* Close the dataset */ - if(H5Dclose(dset) < 0) - TEST_ERROR - - /* Close the file with the bogus objects */ - if(H5Fclose(file2) < 0) - TEST_ERROR - - PASSED(); - - /* Open the file with objects that have unknown header messages (generated with gen_bogus.c) with RW intent this time */ - if((file2 = H5Fopen(testfile, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) - TEST_ERROR - - TESTING("object in r/w file with unknown header message & 'fail if unknown and open for write' flag set"); - - /* Attempt to open the dataset with the unknown header message, and "fail if unknown and open for write" flag */ - H5E_BEGIN_TRY { - dset = H5Dopen2(file2, "/Dataset2", H5P_DEFAULT); - } H5E_END_TRY; - if(dset >= 0) { - H5Dclose(dset); - TEST_ERROR - } /* end if */ - - PASSED(); - - TESTING("object in r/w file with unknown header message & 'fail if unknown always' flag set"); - - /* Attempt to open the dataset with the unknown header message, and "fail if unknown always" flag */ - H5E_BEGIN_TRY { - dset = H5Dopen2(file2, "/Dataset3", H5P_DEFAULT); - } H5E_END_TRY; - if(dset >= 0) { - H5Dclose(dset); - TEST_ERROR - } /* end if */ - - /* Close the file with the bogus objects */ - if(H5Fclose(file2) < 0) + HDputs("Accessing objects with unknown header messages: H5O_BOGUS_INVALID_ID"); + { + if(test_unknown(H5O_BOGUS_INVALID_ID, filename, fapl) < 0) TEST_ERROR - - PASSED(); } - /* Close the file we created */ - if(H5Fclose(file) < 0) - TEST_ERROR - - /* Test object header creation metadata cache issues */ - if(test_ohdr_cache(filename, fapl) < 0) - TEST_ERROR + /* Test object header creation metadata cache issues */ + if(test_ohdr_cache(filename, fapl) < 0) + TEST_ERROR } /* end for */ /* Verify symbol table messages are cached */ diff --git a/test/tbogus.h5 b/test/tbogus.h5 index 875fbd8..91ab76f 100644 Binary files a/test/tbogus.h5 and b/test/tbogus.h5 differ -- cgit v0.12 From a1617b7cdbe14173fcf690b4627059fa4528c19b Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Sun, 28 Feb 2016 12:58:37 -0500 Subject: [svn-r29222] HDFFV-9570: Fix segfault when optional args are last option on command line. Tested: java_merge DT --- tools/lib/h5tools_utils.c | 51 ++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/tools/lib/h5tools_utils.c b/tools/lib/h5tools_utils.c index a09a003..b87abf6 100644 --- a/tools/lib/h5tools_utils.c +++ b/tools/lib/h5tools_utils.c @@ -177,7 +177,7 @@ warn_msg(const char *fmt, ...) /*------------------------------------------------------------------------- * Function: help_ref_msg * - * Purpose: Print a message to refer help page + * Purpose: Print a message to refer help page * * Return: Nothing * @@ -224,7 +224,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti /* check for more flag-like tokens */ if (opt_ind >= argc || argv[opt_ind][0] != '-' || argv[opt_ind][1] == '\0') { return EOF; - } + } else if (HDstrcmp(argv[opt_ind], "--") == 0) { opt_ind++; return EOF; @@ -248,10 +248,10 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti opt_arg = &arg[len + 1]; } else if (l_opts[i].has_arg != optional_arg) { - if (opt_ind < (argc - 1)) + if (opt_ind < (argc - 1)) if (argv[opt_ind + 1][0] != '-') opt_arg = argv[++opt_ind]; - } + } else if (l_opts[i].has_arg == require_arg) { if (opt_err) HDfprintf(rawerrorstream, @@ -262,7 +262,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti } else opt_arg = NULL; - } + } else { if (arg[len] == '=') { if (opt_err) @@ -288,7 +288,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti opt_ind++; sp = 1; - } + } else { register char *cp; /* pointer into current token */ @@ -313,7 +313,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti if (argv[opt_ind][sp + 1] != '\0') { /* flag value is rest of current token */ opt_arg = &argv[opt_ind++][sp + 1]; - } + } else if (++opt_ind >= argc) { if (opt_err) HDfprintf(rawerrorstream, @@ -321,7 +321,7 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti argv[0], opt_opt); opt_opt = '?'; - } + } else { /* flag value is next token */ opt_arg = argv[opt_ind++]; @@ -334,8 +334,13 @@ get_option(int argc, const char **argv, const char *opts, const struct long_opti /* check the next argument */ opt_ind++; /* we do have an extra argument, check if not last */ - if ( argv[opt_ind][0] != '-' && (opt_ind+1) < argc ) { - opt_arg = argv[opt_ind++]; + if ( (opt_ind+1) < argc ) { + if ( argv[opt_ind][0] != '-' ) { + opt_arg = argv[opt_ind++]; + } + else { + opt_arg = NULL; + } } else { opt_arg = NULL; @@ -376,7 +381,7 @@ indentation(int x) if (x < h5tools_nCols) { while (x-- > 0) PRINTVALSTREAM(rawoutstream, " "); - } + } else { HDfprintf(rawerrorstream, "error: the indentation exceeds the number of cols.\n"); HDexit(1); @@ -721,7 +726,7 @@ tmpfile(void) /*------------------------------------------------------------------------- * Function: H5tools_get_symlink_info * - * Purpose: Get symbolic link (soft, external) info and its target object type + * Purpose: Get symbolic link (soft, external) info and its target object type (dataset, group, named datatype) and path, if exist * * Patameters: @@ -729,9 +734,9 @@ tmpfile(void) * - [IN] linkpath : link path * - [OUT] link_info: returning target object info (h5tool_link_info_t) * - * Return: - * 2 : given pathname is object - * 1 : Succed to get link info. + * Return: + * 2 : given pathname is object + * 1 : Succed to get link info. * 0 : Detected as a dangling link * -1 : H5 API failed. * @@ -795,7 +800,7 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_ } /* end if */ /*----------------------------------------------------- - * if link type is external link use different lapl to + * if link type is external link use different lapl to * follow object in other file */ if(link_info->linfo.type == H5L_TYPE_EXTERNAL) { @@ -816,7 +821,7 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_ */ /* check if target object exist */ l_ret = H5Oexists_by_name(file_id, linkpath, lapl); - + /* detect dangling link */ if(l_ret == FALSE) { ret = 0; @@ -824,7 +829,7 @@ H5tools_get_symlink_info(hid_t file_id, const char * linkpath, h5tool_link_info_ } /* end if */ /* function failed */ else if(l_ret < 0) - goto out; + goto out; /* get target object info */ if(H5Oget_info_by_name(file_id, linkpath, &trg_oinfo, lapl) < 0) { @@ -889,8 +894,8 @@ int h5tools_getstatus(void) } /*----------------------------------------------------------- - * PURPOSE : - * if environment variable H5TOOLS_BUFSIZE is set, + * PURPOSE : + * if environment variable H5TOOLS_BUFSIZE is set, * update H5TOOLS_BUFSIZE and H5TOOLS_MALLOCSIZE from the env * This can be called from each tools main() as part of initial act. * Note: this is more of debugging purpose for now. @@ -907,11 +912,11 @@ int h5tools_getenv_update_hyperslab_bufsize(void) hyperslab_bufsize_mb = HDstrtol(env_str, (char**)NULL, 10); if (errno != 0 || hyperslab_bufsize_mb <= 0) { - - /* TODO: later when pubilshed + + /* TODO: later when pubilshed HDfprintf(rawerrorstream,"Error: Invalid environment variable \"H5TOOLS_BUFSIZE\" : %s\n", env_str); */ - + goto error; } -- cgit v0.12 From 63249be0e10a8726acb5a7cf64491319eaa46227 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Sun, 28 Feb 2016 21:43:00 -0500 Subject: [svn-r29226] HDFFV-9552: merge in java code. --- CMakeLists.txt | 165 +- MANIFEST | 320 +- Makefile.am | 9 +- c++/src/CMakeLists.txt | 2 +- config/cmake/CMakeFindJavaCommon.cmake | 41 + config/cmake/FindHDFJAVA.cmake.in | 68 + config/cmake/FindJNI.cmake | 342 + config/cmake/README.txt.cmake.in | 1 + config/cmake/UseJava.cmake | 1290 +++ config/cmake/UseJavaClassFilelist.cmake | 58 + config/cmake/UseJavaSymlinks.cmake | 38 + config/cmake/hdf5-config.cmake.in | 14 + config/cmake/jrunTest.cmake | 212 + config/cmake/libhdf5.settings.cmake.in | 56 +- config/commence.am | 1 + configure.ac | 106 +- fortran/src/CMakeLists.txt | 4 +- fortran/test/CMakeLists.txt | 4 +- hl/c++/src/CMakeLists.txt | 2 +- hl/fortran/src/CMakeLists.txt | 4 +- hl/src/CMakeLists.txt | 2 +- java/CMakeLists.txt | 77 + java/COPYING | 16 + java/Makefile.am | 38 + java/examples/CMakeLists.txt | 7 + java/examples/Makefile.am | 31 + java/examples/datasets/CMakeLists.txt | 121 + java/examples/datasets/H5Ex_D_Alloc.java | 301 + java/examples/datasets/H5Ex_D_Checksum.java | 347 + java/examples/datasets/H5Ex_D_Chunk.java | 366 + java/examples/datasets/H5Ex_D_Compact.java | 289 + java/examples/datasets/H5Ex_D_External.java | 238 + java/examples/datasets/H5Ex_D_FillValue.java | 246 + java/examples/datasets/H5Ex_D_Gzip.java | 336 + java/examples/datasets/H5Ex_D_Hyperslab.java | 269 + java/examples/datasets/H5Ex_D_Nbit.java | 305 + java/examples/datasets/H5Ex_D_ReadWrite.java | 179 + java/examples/datasets/H5Ex_D_Shuffle.java | 373 + java/examples/datasets/H5Ex_D_Sofloat.java | 356 + java/examples/datasets/H5Ex_D_Soint.java | 335 + java/examples/datasets/H5Ex_D_Szip.java | 337 + java/examples/datasets/H5Ex_D_Transform.java | 250 + java/examples/datasets/H5Ex_D_UnlimitedAdd.java | 393 + java/examples/datasets/H5Ex_D_UnlimitedGzip.java | 504 ++ java/examples/datasets/H5Ex_D_UnlimitedMod.java | 379 + java/examples/datasets/Makefile.am | 78 + java/examples/datasets/runExample.sh.in | 413 + java/examples/datatypes/CMakeLists.txt | 109 + java/examples/datatypes/H5Ex_T_Array.java | 282 + java/examples/datatypes/H5Ex_T_ArrayAttribute.java | 322 + java/examples/datatypes/H5Ex_T_Bit.java | 227 + java/examples/datatypes/H5Ex_T_BitAttribute.java | 267 + java/examples/datatypes/H5Ex_T_Commit.java | 265 + java/examples/datatypes/H5Ex_T_Compound.java | 443 + .../datatypes/H5Ex_T_CompoundAttribute.java | 486 ++ java/examples/datatypes/H5Ex_T_Float.java | 227 + java/examples/datatypes/H5Ex_T_FloatAttribute.java | 263 + java/examples/datatypes/H5Ex_T_Integer.java | 226 + .../datatypes/H5Ex_T_IntegerAttribute.java | 263 + .../examples/datatypes/H5Ex_T_ObjectReference.java | 347 + .../datatypes/H5Ex_T_ObjectReferenceAttribute.java | 389 + java/examples/datatypes/H5Ex_T_Opaque.java | 270 + .../examples/datatypes/H5Ex_T_OpaqueAttribute.java | 307 + java/examples/datatypes/H5Ex_T_String.java | 311 + .../examples/datatypes/H5Ex_T_StringAttribute.java | 351 + java/examples/datatypes/H5Ex_T_VLString.java | 138 + java/examples/datatypes/Makefile.am | 78 + java/examples/datatypes/runExample.sh.in | 408 + java/examples/groups/CMakeLists.txt | 138 + java/examples/groups/H5Ex_G_Compact.java | 266 + java/examples/groups/H5Ex_G_Corder.java | 121 + java/examples/groups/H5Ex_G_Create.java | 94 + java/examples/groups/H5Ex_G_Intermediate.java | 125 + java/examples/groups/H5Ex_G_Iterate.java | 119 + java/examples/groups/H5Ex_G_Phase.java | 241 + java/examples/groups/H5Ex_G_Traverse.java | 167 + java/examples/groups/H5Ex_G_Visit.java | 152 + java/examples/groups/Makefile.am | 68 + java/examples/groups/h5ex_g_iterate.h5 | Bin 0 -> 2928 bytes java/examples/groups/h5ex_g_visit.h5 | Bin 0 -> 6312 bytes java/examples/groups/runExample.sh.in | 349 + java/examples/intro/CMakeLists.txt | 112 + java/examples/intro/H5_CreateAttribute.java | 145 + java/examples/intro/H5_CreateDataset.java | 97 + java/examples/intro/H5_CreateFile.java | 55 + java/examples/intro/H5_CreateGroup.java | 76 + .../intro/H5_CreateGroupAbsoluteRelative.java | 118 + java/examples/intro/H5_CreateGroupDataset.java | 207 + java/examples/intro/H5_ReadWrite.java | 112 + java/examples/intro/Makefile.am | 67 + java/examples/intro/runExample.sh.in | 298 + .../testfiles/examples.datasets.H5Ex_D_Alloc.txt | 16 + .../examples.datasets.H5Ex_D_Checksum.txt | 3 + .../testfiles/examples.datasets.H5Ex_D_Chunk.txt | 26 + .../testfiles/examples.datasets.H5Ex_D_Compact.txt | 8 + .../examples.datasets.H5Ex_D_External.txt | 7 + .../examples.datasets.H5Ex_D_FillValue.txt | 20 + .../testfiles/examples.datasets.H5Ex_D_Gzip.txt | 3 + .../examples.datasets.H5Ex_D_Hyperslab.txt | 24 + .../testfiles/examples.datasets.H5Ex_D_Nbit.txt | 3 + .../examples.datasets.H5Ex_D_ReadWrite.txt | 6 + .../testfiles/examples.datasets.H5Ex_D_Shuffle.txt | 5 + .../testfiles/examples.datasets.H5Ex_D_Sofloat.txt | 6 + .../testfiles/examples.datasets.H5Ex_D_Soint.txt | 3 + .../testfiles/examples.datasets.H5Ex_D_Szip.txt | 3 + .../examples.datasets.H5Ex_D_Transform.txt | 15 + .../examples.datasets.H5Ex_D_UnlimitedAdd.txt | 14 + .../examples.datasets.H5Ex_D_UnlimitedGzip.txt | 16 + .../examples.datasets.H5Ex_D_UnlimitedMod.txt | 14 + .../testfiles/examples.datatypes.H5Ex_T_Array.txt | 21 + .../examples.datatypes.H5Ex_T_ArrayAttribute.txt | 21 + .../testfiles/examples.datatypes.H5Ex_T_Bit.txt | 6 + .../examples.datatypes.H5Ex_T_BitAttribute.txt | 6 + .../testfiles/examples.datatypes.H5Ex_T_Commit.txt | 6 + .../examples.datatypes.H5Ex_T_Compound.txt | 25 + ...examples.datatypes.H5Ex_T_CompoundAttribute.txt | 25 + .../testfiles/examples.datatypes.H5Ex_T_Float.txt | 6 + .../examples.datatypes.H5Ex_T_FloatAttribute.txt | 6 + .../examples.datatypes.H5Ex_T_Integer.txt | 6 + .../examples.datatypes.H5Ex_T_IntegerAttribute.txt | 6 + .../examples.datatypes.H5Ex_T_ObjectReference.txt | 4 + ...s.datatypes.H5Ex_T_ObjectReferenceAttribute.txt | 4 + .../testfiles/examples.datatypes.H5Ex_T_Opaque.txt | 6 + .../examples.datatypes.H5Ex_T_OpaqueAttribute.txt | 6 + .../testfiles/examples.datatypes.H5Ex_T_String.txt | 5 + .../examples.datatypes.H5Ex_T_StringAttribute.txt | 5 + .../examples.datatypes.H5Ex_T_VLString.txt | 4 + .../testfiles/examples.groups.H5Ex_G_Compact.txt | 5 + .../testfiles/examples.groups.H5Ex_G_Corder.txt | 10 + .../testfiles/examples.groups.H5Ex_G_Create.txt | 0 .../examples.groups.H5Ex_G_Intermediate.txt | 5 + .../testfiles/examples.groups.H5Ex_G_Iterate.txt | 5 + .../testfiles/examples.groups.H5Ex_G_Phase.txt | 15 + .../testfiles/examples.groups.H5Ex_G_Visit.txt | 19 + .../examples.intro.H5_CreateAttribute.txt | 0 .../testfiles/examples.intro.H5_CreateDataset.txt | 0 .../testfiles/examples.intro.H5_CreateFile.txt | 0 .../testfiles/examples.intro.H5_CreateGroup.txt | 0 ...amples.intro.H5_CreateGroupAbsoluteRelative.txt | 0 .../examples.intro.H5_CreateGroupDataset.txt | 0 .../testfiles/examples.intro.H5_ReadWrite.txt | 0 java/lib/ext/slf4j-nop-1.7.5.jar | Bin 0 -> 4091 bytes java/lib/ext/slf4j-simple-1.7.5.jar | Bin 0 -> 10680 bytes java/lib/hamcrest-core.jar | Bin 0 -> 45024 bytes java/lib/junit.jar | Bin 0 -> 245039 bytes java/lib/simplelogger.properties | 36 + java/lib/slf4j-api-1.7.5.jar | Bin 0 -> 26084 bytes java/src/CMakeLists.txt | 8 + java/src/Makefile.am | 137 + java/src/hdf/CMakeLists.txt | 4 + java/src/hdf/hdf5lib/CMakeLists.txt | 124 + java/src/hdf/hdf5lib/H5.java | 9185 ++++++++++++++++++++ java/src/hdf/hdf5lib/HDF5Constants.java | 1877 ++++ java/src/hdf/hdf5lib/HDF5GroupInfo.java | 171 + java/src/hdf/hdf5lib/HDFArray.java | 1096 +++ java/src/hdf/hdf5lib/HDFNativeData.java | 481 + java/src/hdf/hdf5lib/callbacks/Callbacks.java | 33 + java/src/hdf/hdf5lib/callbacks/H5D_iterate_cb.java | 21 + java/src/hdf/hdf5lib/callbacks/H5D_iterate_t.java | 22 + java/src/hdf/hdf5lib/callbacks/H5L_iterate_cb.java | 23 + java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java | 22 + java/src/hdf/hdf5lib/callbacks/H5O_iterate_cb.java | 23 + java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java | 22 + .../hdf/hdf5lib/exceptions/HDF5AtomException.java | 44 + .../hdf5lib/exceptions/HDF5AttributeException.java | 42 + .../hdf/hdf5lib/exceptions/HDF5BtreeException.java | 42 + .../exceptions/HDF5DataFiltersException.java | 42 + .../exceptions/HDF5DataStorageException.java | 43 + .../exceptions/HDF5DatasetInterfaceException.java | 42 + .../HDF5DataspaceInterfaceException.java | 43 + .../exceptions/HDF5DatatypeInterfaceException.java | 43 + java/src/hdf/hdf5lib/exceptions/HDF5Exception.java | 68 + .../exceptions/HDF5ExternalFileListException.java | 43 + .../exceptions/HDF5FileInterfaceException.java | 43 + .../exceptions/HDF5FunctionArgumentException.java | 43 + .../exceptions/HDF5FunctionEntryExitException.java | 43 + .../hdf/hdf5lib/exceptions/HDF5HeapException.java | 43 + .../exceptions/HDF5InternalErrorException.java | 43 + .../hdf/hdf5lib/exceptions/HDF5JavaException.java | 45 + .../hdf5lib/exceptions/HDF5LibraryException.java | 383 + .../exceptions/HDF5LowLevelIOException.java | 43 + .../exceptions/HDF5MetaDataCacheException.java | 43 + .../exceptions/HDF5ObjectHeaderException.java | 43 + .../HDF5PropertyListInterfaceException.java | 43 + .../hdf5lib/exceptions/HDF5ReferenceException.java | 37 + .../HDF5ResourceUnavailableException.java | 43 + .../exceptions/HDF5SymbolTableException.java | 43 + .../hdf/hdf5lib/structs/H5AC_cache_config_t.java | 99 + java/src/hdf/hdf5lib/structs/H5A_info_t.java | 34 + java/src/hdf/hdf5lib/structs/H5G_info_t.java | 27 + java/src/hdf/hdf5lib/structs/H5L_info_t.java | 38 + java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java | 49 + java/src/hdf/hdf5lib/structs/H5O_info_t.java | 54 + java/src/hdf/hdf5lib/structs/H5_ih_info_t.java | 31 + java/src/jni/CMakeLists.txt | 84 + java/src/jni/Makefile.am | 44 + java/src/jni/exceptionImp.c | 414 + java/src/jni/exceptionImp.h | 67 + java/src/jni/h5Constants.c | 692 ++ java/src/jni/h5Imp.c | 181 + java/src/jni/h5Imp.h | 95 + java/src/jni/h5aImp.c | 879 ++ java/src/jni/h5aImp.h | 273 + java/src/jni/h5dImp.c | 1758 ++++ java/src/jni/h5dImp.h | 319 + java/src/jni/h5eImp.c | 524 ++ java/src/jni/h5eImp.h | 167 + java/src/jni/h5fImp.c | 516 ++ java/src/jni/h5fImp.h | 198 + java/src/jni/h5gImp.c | 257 + java/src/jni/h5gImp.h | 96 + java/src/jni/h5iImp.c | 289 + java/src/jni/h5iImp.h | 143 + java/src/jni/h5jni.h | 249 + java/src/jni/h5lImp.c | 736 ++ java/src/jni/h5lImp.h | 183 + java/src/jni/h5oImp.c | 766 ++ java/src/jni/h5oImp.h | 175 + java/src/jni/h5pImp.c | 5344 ++++++++++++ java/src/jni/h5pImp.h | 1313 +++ java/src/jni/h5rImp.c | 324 + java/src/jni/h5rImp.h | 78 + java/src/jni/h5sImp.c | 1408 +++ java/src/jni/h5sImp.h | 288 + java/src/jni/h5tImp.c | 1588 ++++ java/src/jni/h5tImp.h | 550 ++ java/src/jni/h5util.c | 2592 ++++++ java/src/jni/h5util.h | 108 + java/src/jni/h5zImp.c | 84 + java/src/jni/h5zImp.h | 55 + java/src/jni/nativeData.c | 1195 +++ java/src/jni/nativeData.h | 115 + java/test/CMakeLists.txt | 114 + java/test/JUnit-interface.txt | 652 ++ java/test/Makefile.am | 103 + java/test/TestAll.java | 40 + java/test/TestH5.java | 257 + java/test/TestH5A.java | 1119 +++ java/test/TestH5D.java | 892 ++ java/test/TestH5Dparams.java | 134 + java/test/TestH5Dplist.java | 216 + java/test/TestH5E.java | 553 ++ java/test/TestH5Edefault.java | 564 ++ java/test/TestH5Eregister.java | 78 + java/test/TestH5F.java | 332 + java/test/TestH5Fbasic.java | 320 + java/test/TestH5Fparams.java | 215 + java/test/TestH5G.java | 505 ++ java/test/TestH5Gbasic.java | 371 + java/test/TestH5Giterate.java | 136 + java/test/TestH5Lbasic.java | 371 + java/test/TestH5Lcreate.java | 819 ++ java/test/TestH5Lparams.java | 231 + java/test/TestH5Obasic.java | 488 ++ java/test/TestH5Ocopy.java | 365 + java/test/TestH5Ocreate.java | 562 ++ java/test/TestH5Oparams.java | 154 + java/test/TestH5P.java | 1221 +++ java/test/TestH5PData.java | 170 + java/test/TestH5Pfapl.java | 1325 +++ java/test/TestH5R.java | 335 + java/test/TestH5S.java | 590 ++ java/test/TestH5Sbasic.java | 247 + java/test/TestH5T.java | 459 + java/test/TestH5Tbasic.java | 161 + java/test/TestH5Tparams.java | 389 + java/test/TestH5Z.java | 100 + java/test/h5ex_g_iterate.hdf | Bin 0 -> 2928 bytes java/test/junit.sh.in | 234 + m4/ax_check_class.m4 | 144 + m4/ax_check_classpath.m4 | 60 + m4/ax_check_java_home.m4 | 80 + m4/ax_check_junit.m4 | 70 + m4/ax_check_rqrd_class.m4 | 62 + m4/ax_java_check_class.m4 | 85 + m4/ax_java_options.m4 | 48 + m4/ax_jni_include_dir.m4 | 132 + m4/ax_prog_jar.m4 | 49 + m4/ax_prog_java.m4 | 115 + m4/ax_prog_java_cc.m4 | 104 + m4/ax_prog_java_works.m4 | 134 + m4/ax_prog_javac.m4 | 79 + m4/ax_prog_javac_works.m4 | 72 + m4/ax_prog_javadoc.m4 | 50 + m4/ax_prog_javah.m4 | 64 + m4/ax_try_compile_java.m4 | 55 + m4/ax_try_run_java.m4 | 56 + src/CMakeLists.txt | 2 +- src/libhdf5.settings.in | 3 + test/CMakeLists.txt | 6 +- 290 files changed, 74248 insertions(+), 46 deletions(-) create mode 100644 config/cmake/CMakeFindJavaCommon.cmake create mode 100644 config/cmake/FindHDFJAVA.cmake.in create mode 100644 config/cmake/FindJNI.cmake create mode 100644 config/cmake/UseJava.cmake create mode 100644 config/cmake/UseJavaClassFilelist.cmake create mode 100644 config/cmake/UseJavaSymlinks.cmake create mode 100644 config/cmake/jrunTest.cmake create mode 100644 java/CMakeLists.txt create mode 100644 java/COPYING create mode 100644 java/Makefile.am create mode 100644 java/examples/CMakeLists.txt create mode 100644 java/examples/Makefile.am create mode 100644 java/examples/datasets/CMakeLists.txt create mode 100644 java/examples/datasets/H5Ex_D_Alloc.java create mode 100644 java/examples/datasets/H5Ex_D_Checksum.java create mode 100644 java/examples/datasets/H5Ex_D_Chunk.java create mode 100644 java/examples/datasets/H5Ex_D_Compact.java create mode 100644 java/examples/datasets/H5Ex_D_External.java create mode 100644 java/examples/datasets/H5Ex_D_FillValue.java create mode 100644 java/examples/datasets/H5Ex_D_Gzip.java create mode 100644 java/examples/datasets/H5Ex_D_Hyperslab.java create mode 100644 java/examples/datasets/H5Ex_D_Nbit.java create mode 100644 java/examples/datasets/H5Ex_D_ReadWrite.java create mode 100644 java/examples/datasets/H5Ex_D_Shuffle.java create mode 100644 java/examples/datasets/H5Ex_D_Sofloat.java create mode 100644 java/examples/datasets/H5Ex_D_Soint.java create mode 100644 java/examples/datasets/H5Ex_D_Szip.java create mode 100644 java/examples/datasets/H5Ex_D_Transform.java create mode 100644 java/examples/datasets/H5Ex_D_UnlimitedAdd.java create mode 100644 java/examples/datasets/H5Ex_D_UnlimitedGzip.java create mode 100644 java/examples/datasets/H5Ex_D_UnlimitedMod.java create mode 100644 java/examples/datasets/Makefile.am create mode 100644 java/examples/datasets/runExample.sh.in create mode 100644 java/examples/datatypes/CMakeLists.txt create mode 100644 java/examples/datatypes/H5Ex_T_Array.java create mode 100644 java/examples/datatypes/H5Ex_T_ArrayAttribute.java create mode 100644 java/examples/datatypes/H5Ex_T_Bit.java create mode 100644 java/examples/datatypes/H5Ex_T_BitAttribute.java create mode 100644 java/examples/datatypes/H5Ex_T_Commit.java create mode 100644 java/examples/datatypes/H5Ex_T_Compound.java create mode 100644 java/examples/datatypes/H5Ex_T_CompoundAttribute.java create mode 100644 java/examples/datatypes/H5Ex_T_Float.java create mode 100644 java/examples/datatypes/H5Ex_T_FloatAttribute.java create mode 100644 java/examples/datatypes/H5Ex_T_Integer.java create mode 100644 java/examples/datatypes/H5Ex_T_IntegerAttribute.java create mode 100644 java/examples/datatypes/H5Ex_T_ObjectReference.java create mode 100644 java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java create mode 100644 java/examples/datatypes/H5Ex_T_Opaque.java create mode 100644 java/examples/datatypes/H5Ex_T_OpaqueAttribute.java create mode 100644 java/examples/datatypes/H5Ex_T_String.java create mode 100644 java/examples/datatypes/H5Ex_T_StringAttribute.java create mode 100644 java/examples/datatypes/H5Ex_T_VLString.java create mode 100644 java/examples/datatypes/Makefile.am create mode 100644 java/examples/datatypes/runExample.sh.in create mode 100644 java/examples/groups/CMakeLists.txt create mode 100644 java/examples/groups/H5Ex_G_Compact.java create mode 100644 java/examples/groups/H5Ex_G_Corder.java create mode 100644 java/examples/groups/H5Ex_G_Create.java create mode 100644 java/examples/groups/H5Ex_G_Intermediate.java create mode 100644 java/examples/groups/H5Ex_G_Iterate.java create mode 100644 java/examples/groups/H5Ex_G_Phase.java create mode 100644 java/examples/groups/H5Ex_G_Traverse.java create mode 100644 java/examples/groups/H5Ex_G_Visit.java create mode 100644 java/examples/groups/Makefile.am create mode 100644 java/examples/groups/h5ex_g_iterate.h5 create mode 100644 java/examples/groups/h5ex_g_visit.h5 create mode 100644 java/examples/groups/runExample.sh.in create mode 100644 java/examples/intro/CMakeLists.txt create mode 100644 java/examples/intro/H5_CreateAttribute.java create mode 100644 java/examples/intro/H5_CreateDataset.java create mode 100644 java/examples/intro/H5_CreateFile.java create mode 100644 java/examples/intro/H5_CreateGroup.java create mode 100644 java/examples/intro/H5_CreateGroupAbsoluteRelative.java create mode 100644 java/examples/intro/H5_CreateGroupDataset.java create mode 100644 java/examples/intro/H5_ReadWrite.java create mode 100644 java/examples/intro/Makefile.am create mode 100644 java/examples/intro/runExample.sh.in create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_Alloc.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_Checksum.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_Chunk.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_Compact.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_External.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_FillValue.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_Gzip.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_Hyperslab.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_Nbit.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_ReadWrite.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_Shuffle.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_Sofloat.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_Soint.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_Szip.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_Transform.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedAdd.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedGzip.txt create mode 100644 java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedMod.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_Array.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_ArrayAttribute.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_Bit.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_BitAttribute.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_Commit.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_Compound.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_CompoundAttribute.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_Float.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_FloatAttribute.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_Integer.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_IntegerAttribute.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReference.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReferenceAttribute.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_Opaque.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_OpaqueAttribute.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_String.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_StringAttribute.txt create mode 100644 java/examples/testfiles/examples.datatypes.H5Ex_T_VLString.txt create mode 100644 java/examples/testfiles/examples.groups.H5Ex_G_Compact.txt create mode 100644 java/examples/testfiles/examples.groups.H5Ex_G_Corder.txt create mode 100644 java/examples/testfiles/examples.groups.H5Ex_G_Create.txt create mode 100644 java/examples/testfiles/examples.groups.H5Ex_G_Intermediate.txt create mode 100644 java/examples/testfiles/examples.groups.H5Ex_G_Iterate.txt create mode 100644 java/examples/testfiles/examples.groups.H5Ex_G_Phase.txt create mode 100644 java/examples/testfiles/examples.groups.H5Ex_G_Visit.txt create mode 100644 java/examples/testfiles/examples.intro.H5_CreateAttribute.txt create mode 100644 java/examples/testfiles/examples.intro.H5_CreateDataset.txt create mode 100644 java/examples/testfiles/examples.intro.H5_CreateFile.txt create mode 100644 java/examples/testfiles/examples.intro.H5_CreateGroup.txt create mode 100644 java/examples/testfiles/examples.intro.H5_CreateGroupAbsoluteRelative.txt create mode 100644 java/examples/testfiles/examples.intro.H5_CreateGroupDataset.txt create mode 100644 java/examples/testfiles/examples.intro.H5_ReadWrite.txt create mode 100644 java/lib/ext/slf4j-nop-1.7.5.jar create mode 100644 java/lib/ext/slf4j-simple-1.7.5.jar create mode 100644 java/lib/hamcrest-core.jar create mode 100644 java/lib/junit.jar create mode 100644 java/lib/simplelogger.properties create mode 100644 java/lib/slf4j-api-1.7.5.jar create mode 100644 java/src/CMakeLists.txt create mode 100644 java/src/Makefile.am create mode 100644 java/src/hdf/CMakeLists.txt create mode 100644 java/src/hdf/hdf5lib/CMakeLists.txt create mode 100644 java/src/hdf/hdf5lib/H5.java create mode 100644 java/src/hdf/hdf5lib/HDF5Constants.java create mode 100644 java/src/hdf/hdf5lib/HDF5GroupInfo.java create mode 100644 java/src/hdf/hdf5lib/HDFArray.java create mode 100644 java/src/hdf/hdf5lib/HDFNativeData.java create mode 100644 java/src/hdf/hdf5lib/callbacks/Callbacks.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5D_iterate_cb.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5D_iterate_t.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5L_iterate_cb.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5O_iterate_cb.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5AtomException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5AttributeException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5BtreeException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5DataFiltersException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5DataStorageException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5DatasetInterfaceException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5DataspaceInterfaceException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5DatatypeInterfaceException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5Exception.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5ExternalFileListException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5FileInterfaceException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5FunctionArgumentException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5FunctionEntryExitException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5HeapException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5InternalErrorException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5JavaException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5LowLevelIOException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5MetaDataCacheException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5ObjectHeaderException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5PropertyListInterfaceException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5ReferenceException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5ResourceUnavailableException.java create mode 100644 java/src/hdf/hdf5lib/exceptions/HDF5SymbolTableException.java create mode 100644 java/src/hdf/hdf5lib/structs/H5AC_cache_config_t.java create mode 100644 java/src/hdf/hdf5lib/structs/H5A_info_t.java create mode 100644 java/src/hdf/hdf5lib/structs/H5G_info_t.java create mode 100644 java/src/hdf/hdf5lib/structs/H5L_info_t.java create mode 100644 java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java create mode 100644 java/src/hdf/hdf5lib/structs/H5O_info_t.java create mode 100644 java/src/hdf/hdf5lib/structs/H5_ih_info_t.java create mode 100644 java/src/jni/CMakeLists.txt create mode 100644 java/src/jni/Makefile.am create mode 100644 java/src/jni/exceptionImp.c create mode 100644 java/src/jni/exceptionImp.h create mode 100644 java/src/jni/h5Constants.c create mode 100644 java/src/jni/h5Imp.c create mode 100644 java/src/jni/h5Imp.h create mode 100644 java/src/jni/h5aImp.c create mode 100644 java/src/jni/h5aImp.h create mode 100644 java/src/jni/h5dImp.c create mode 100644 java/src/jni/h5dImp.h create mode 100644 java/src/jni/h5eImp.c create mode 100644 java/src/jni/h5eImp.h create mode 100644 java/src/jni/h5fImp.c create mode 100644 java/src/jni/h5fImp.h create mode 100644 java/src/jni/h5gImp.c create mode 100644 java/src/jni/h5gImp.h create mode 100644 java/src/jni/h5iImp.c create mode 100644 java/src/jni/h5iImp.h create mode 100644 java/src/jni/h5jni.h create mode 100644 java/src/jni/h5lImp.c create mode 100644 java/src/jni/h5lImp.h create mode 100644 java/src/jni/h5oImp.c create mode 100644 java/src/jni/h5oImp.h create mode 100644 java/src/jni/h5pImp.c create mode 100644 java/src/jni/h5pImp.h create mode 100644 java/src/jni/h5rImp.c create mode 100644 java/src/jni/h5rImp.h create mode 100644 java/src/jni/h5sImp.c create mode 100644 java/src/jni/h5sImp.h create mode 100644 java/src/jni/h5tImp.c create mode 100644 java/src/jni/h5tImp.h create mode 100644 java/src/jni/h5util.c create mode 100644 java/src/jni/h5util.h create mode 100644 java/src/jni/h5zImp.c create mode 100644 java/src/jni/h5zImp.h create mode 100644 java/src/jni/nativeData.c create mode 100644 java/src/jni/nativeData.h create mode 100644 java/test/CMakeLists.txt create mode 100644 java/test/JUnit-interface.txt create mode 100644 java/test/Makefile.am create mode 100644 java/test/TestAll.java create mode 100644 java/test/TestH5.java create mode 100644 java/test/TestH5A.java create mode 100644 java/test/TestH5D.java create mode 100644 java/test/TestH5Dparams.java create mode 100644 java/test/TestH5Dplist.java create mode 100644 java/test/TestH5E.java create mode 100644 java/test/TestH5Edefault.java create mode 100644 java/test/TestH5Eregister.java create mode 100644 java/test/TestH5F.java create mode 100644 java/test/TestH5Fbasic.java create mode 100644 java/test/TestH5Fparams.java create mode 100644 java/test/TestH5G.java create mode 100644 java/test/TestH5Gbasic.java create mode 100644 java/test/TestH5Giterate.java create mode 100644 java/test/TestH5Lbasic.java create mode 100644 java/test/TestH5Lcreate.java create mode 100644 java/test/TestH5Lparams.java create mode 100644 java/test/TestH5Obasic.java create mode 100644 java/test/TestH5Ocopy.java create mode 100644 java/test/TestH5Ocreate.java create mode 100644 java/test/TestH5Oparams.java create mode 100644 java/test/TestH5P.java create mode 100644 java/test/TestH5PData.java create mode 100644 java/test/TestH5Pfapl.java create mode 100644 java/test/TestH5R.java create mode 100644 java/test/TestH5S.java create mode 100644 java/test/TestH5Sbasic.java create mode 100644 java/test/TestH5T.java create mode 100644 java/test/TestH5Tbasic.java create mode 100644 java/test/TestH5Tparams.java create mode 100644 java/test/TestH5Z.java create mode 100644 java/test/h5ex_g_iterate.hdf create mode 100644 java/test/junit.sh.in create mode 100644 m4/ax_check_class.m4 create mode 100644 m4/ax_check_classpath.m4 create mode 100644 m4/ax_check_java_home.m4 create mode 100644 m4/ax_check_junit.m4 create mode 100644 m4/ax_check_rqrd_class.m4 create mode 100644 m4/ax_java_check_class.m4 create mode 100644 m4/ax_java_options.m4 create mode 100644 m4/ax_jni_include_dir.m4 create mode 100644 m4/ax_prog_jar.m4 create mode 100644 m4/ax_prog_java.m4 create mode 100644 m4/ax_prog_java_cc.m4 create mode 100644 m4/ax_prog_java_works.m4 create mode 100644 m4/ax_prog_javac.m4 create mode 100644 m4/ax_prog_javac_works.m4 create mode 100644 m4/ax_prog_javadoc.m4 create mode 100644 m4/ax_prog_javah.m4 create mode 100644 m4/ax_try_compile_java.m4 create mode 100644 m4/ax_try_run_java.m4 diff --git a/CMakeLists.txt b/CMakeLists.txt index 23b55c6..4fb9262 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,6 +121,9 @@ set (HDF5_F90_TEST_LIB_CORENAME "hdf5_test_fortran") set (HDF5_F90_C_TEST_LIB_CORENAME "hdf5_test_f90cstub") set (HDF5_HL_F90_LIB_CORENAME "hdf5_hl_fortran") set (HDF5_HL_F90_C_LIB_CORENAME "hdf5_hl_f90cstub") +set (HDF5_JAVA_JNI_LIB_CORENAME "hdf5_java") +set (HDF5_JAVA_HDF5_LIB_CORENAME "jarhdf5") +set (HDF5_JAVA_TEST_LIB_CORENAME "jartest5") #----------------------------------------------------------------------------- # Set the true names of all the libraries if customized by external project @@ -137,6 +140,9 @@ set (HDF5_F90_TEST_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_F90_TEST_LIB_ set (HDF5_F90_C_TEST_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_F90_C_TEST_LIB_CORENAME}") set (HDF5_HL_F90_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_HL_F90_LIB_CORENAME}") set (HDF5_HL_F90_C_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_HL_F90_C_LIB_CORENAME}") +set (HDF5_JAVA_JNI_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_JAVA_JNI_LIB_CORENAME}") +set (HDF5_JAVA_HDF5_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_JAVA_HDF5_LIB_CORENAME}") +set (HDF5_JAVA_TEST_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_JAVA_TEST_LIB_CORENAME}") #----------------------------------------------------------------------------- # Set the target names of all the libraries @@ -153,6 +159,9 @@ set (HDF5_F90_TEST_LIB_TARGET "${HDF5_F90_TEST_LIB_CORENAME}-static") set (HDF5_F90_C_TEST_LIB_TARGET "${HDF5_F90_C_TEST_LIB_CORENAME}-static") set (HDF5_HL_F90_LIB_TARGET "${HDF5_HL_F90_LIB_CORENAME}-static") set (HDF5_HL_F90_C_LIB_TARGET "${HDF5_HL_F90_C_LIB_CORENAME}-static") +set (HDF5_JAVA_JNI_LIB_TARGET "${HDF5_JAVA_JNI_LIB_CORENAME}") +set (HDF5_JAVA_HDF5_LIB_TARGET "${HDF5_JAVA_HDF5_LIB_CORENAME}") +set (HDF5_JAVA_TEST_LIB_TARGET "${HDF5_JAVA_TEST_LIB_CORENAME}") set (HDF5_LIBSH_TARGET "${HDF5_LIB_CORENAME}-shared") set (HDF5_TEST_LIBSH_TARGET "${HDF5_TEST_LIB_CORENAME}-shared") set (HDF5_CPP_LIBSH_TARGET "${HDF5_CPP_LIB_CORENAME}-shared") @@ -180,20 +189,37 @@ set (HDF5_HL_CPP_SRC_DIR ${HDF5_SOURCE_DIR}/hl/c++) set (HDF5_TOOLS_SRC_DIR ${HDF5_SOURCE_DIR}/tools) set (HDF5_PERFORM_SRC_DIR ${HDF5_SOURCE_DIR}/tools/perform) set (HDF5_F90_SRC_DIR ${HDF5_SOURCE_DIR}/fortran) +set (HDF5_JAVA_JNI_SRC_DIR ${HDF5_SOURCE_DIR}/java/src/jni) +set (HDF5_JAVA_HDF5_SRC_DIR ${HDF5_SOURCE_DIR}/java/src/hdf) +set (HDF5_JAVA_TEST_SRC_DIR ${HDF5_SOURCE_DIR}/java/test) +set (HDF5_JAVA_LIB_DIR ${HDF5_SOURCE_DIR}/java/lib) +set (HDF5_JAVA_LOGGING_JAR ${HDF5_SOURCE_DIR}/java/lib/slf4j-api-1.7.5.jar) +set (HDF5_JAVA_LOGGING_NOP_JAR ${HDF5_SOURCE_DIR}/java/lib/ext/slf4j-nop-1.7.5.jar) +set (HDF5_JAVA_LOGGING_SIMPLE_JAR ${HDF5_SOURCE_DIR}/java/lib/ext/slf4j-simple-1.7.5.jar) + +if (APPLE) + option (HDF5_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries, FALSE to build according to BUILD_SHARED_LIBS" FALSE) +endif (APPLE) if (NOT HDF5_INSTALL_BIN_DIR) set (HDF5_INSTALL_BIN_DIR bin) endif (NOT HDF5_INSTALL_BIN_DIR) if (NOT HDF5_INSTALL_LIB_DIR) if (APPLE) + if (HDF5_BUILD_FRAMEWORKS) + set (HDF5_INSTALL_JAR_DIR ../Java) + else (HDF5_BUILD_FRAMEWORKS) + set (HDF5_INSTALL_JAR_DIR lib) + endif (HDF5_BUILD_FRAMEWORKS) set (HDF5_INSTALL_FMWK_DIR ${CMAKE_INSTALL_FRAMEWORK_PREFIX}) + else (APPLE) + set (HDF5_INSTALL_JAR_DIR lib) endif (APPLE) set (HDF5_INSTALL_LIB_DIR lib) endif (NOT HDF5_INSTALL_LIB_DIR) if (NOT HDF5_INSTALL_INCLUDE_DIR) set (HDF5_INSTALL_INCLUDE_DIR include) endif (NOT HDF5_INSTALL_INCLUDE_DIR) -option (HDF5_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries, FALSE to build according to BUILD_SHARED_LIBS" FALSE) if (NOT HDF5_INSTALL_DATA_DIR) if (NOT WIN32) if (APPLE) @@ -242,6 +268,83 @@ string (REGEX REPLACE ".*LT_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" "\\1" H5_SOVERS_RELEASE ${_lt_vers_am_contents}) MATH (EXPR H5_SOVERS_MAJOR ${H5_SOVERS_INTERFACE}-${H5_SOVERS_RELEASE}) message (STATUS "SOVERSION: ${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") +string (REGEX MATCH ".*LT_TOOLS_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_TOOLS_SOVERS_EXISTS ${_lt_vers_am_contents}) +if(H5_TOOLS_SOVERS_EXISTS) + string (REGEX REPLACE ".*LT_TOOLS_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_TOOLS_SOVERS_INTERFACE ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_TOOLS_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_TOOLS_SOVERS_MINOR ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_TOOLS_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_TOOLS_SOVERS_RELEASE ${_lt_vers_am_contents}) + MATH (EXPR H5_TOOLS_SOVERS_MAJOR ${H5_TOOLS_SOVERS_INTERFACE}-${H5_TOOLS_SOVERS_RELEASE}) + message (STATUS "SOVERSION_TOOLS: ${H5_TOOLS_SOVERS_MAJOR}.${H5_TOOLS_SOVERS_RELEASE}.${H5_TOOLS_SOVERS_MINOR}") +endif() +string (REGEX REPLACE ".*LT_CXX_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_CXX_SOVERS_EXISTS ${_lt_vers_am_contents}) +if(H5_CXX_SOVERS_EXISTS) + string (REGEX REPLACE ".*LT_CXX_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_CXX_SOVERS_INTERFACE ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_CXX_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_CXX_SOVERS_MINOR ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_CXX_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_CXX_SOVERS_RELEASE ${_lt_vers_am_contents}) + MATH (EXPR H5_CXX_SOVERS_MAJOR ${H5_CXX_SOVERS_INTERFACE}-${H5_CXX_SOVERS_RELEASE}) + message (STATUS "SOVERSION_CXX: ${H5_CXX_SOVERS_MAJOR}.${H5_CXX_SOVERS_RELEASE}.${H5_CXX_SOVERS_MINOR}") +endif() +string (REGEX REPLACE ".*LT_F_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_F_SOVERS_EXISTS ${_lt_vers_am_contents}) +if(H5_F_SOVERS_EXISTS) + string (REGEX REPLACE ".*LT_F_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_F_SOVERS_INTERFACE ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_F_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_F_SOVERS_MINOR ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_F_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_F_SOVERS_RELEASE ${_lt_vers_am_contents}) + MATH (EXPR H5_F_SOVERS_MAJOR ${H5_F_SOVERS_INTERFACE}-${H5_F_SOVERS_RELEASE}) + message (STATUS "SOVERSION_F: ${H5_F_SOVERS_MAJOR}.${H5_F_SOVERS_RELEASE}.${H5_F_SOVERS_MINOR}") +endif() +string (REGEX REPLACE ".*LT_HL_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_HL_SOVERS_EXISTS ${_lt_vers_am_contents}) +if(H5_HL_SOVERS_EXISTS) + string (REGEX REPLACE ".*LT_HL_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_HL_SOVERS_INTERFACE ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_HL_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_HL_SOVERS_MINOR ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_HL_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_HL_SOVERS_RELEASE ${_lt_vers_am_contents}) + MATH (EXPR H5_HL_SOVERS_MAJOR ${H5_HL_SOVERS_INTERFACE}-${H5_HL_SOVERS_RELEASE}) + message (STATUS "SOVERSION_HL: ${H5_HL_SOVERS_MAJOR}.${H5_HL_SOVERS_RELEASE}.${H5_HL_SOVERS_MINOR}") +endif() +string (REGEX REPLACE ".*LT_HL_CXX_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_HL_CXX_SOVERS_EXISTS ${_lt_vers_am_contents}) +if(H5_HL_CXX_SOVERS_EXISTS) + string (REGEX REPLACE ".*LT_HL_CXX_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_HL_CXX_SOVERS_INTERFACE ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_HL_CXX_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_HL_CXX_SOVERS_MINOR ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_HL_CXX_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_HL_CXX_SOVERS_RELEASE ${_lt_vers_am_contents}) + MATH (EXPR H5_HL_CXX_SOVERS_MAJOR ${H5_HL_CXX_SOVERS_INTERFACE}-${H5_HL_CXX_SOVERS_RELEASE}) + message (STATUS "SOVERSION_HL_CXX: ${H5_HL_CXX_SOVERS_MAJOR}.${H5_HL_CXX_SOVERS_RELEASE}.${H5_HL_CXX_SOVERS_MINOR}") +endif() +string (REGEX REPLACE ".*LT_HL_F_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_HL_F_SOVERS_EXISTS ${_lt_vers_am_contents}) +if(H5_HL_F_SOVERS_EXISTS) + string (REGEX REPLACE ".*LT_HL_F_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_HL_F_SOVERS_INTERFACE ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_HL_F_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_HL_F_SOVERS_MINOR ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_HL_F_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_HL_F_SOVERS_RELEASE ${_lt_vers_am_contents}) + MATH (EXPR H5_HL_F_SOVERS_MAJOR ${H5_HL_F_SOVERS_INTERFACE}-${H5_HL_F_SOVERS_RELEASE}) + message (STATUS "SOVERSION_HL_F: ${H5_HL_F_SOVERS_MAJOR}.${H5_HL_F_SOVERS_RELEASE}.${H5_HL_F_SOVERS_MINOR}") +endif() +string (REGEX REPLACE ".*LT_JAVA_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_JAVA_SOVERS_EXISTS ${_lt_vers_am_contents}) +if(H5_JAVA_SOVERS_EXISTS) + string (REGEX REPLACE ".*LT_JAVA_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_JAVA_SOVERS_INTERFACE ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_JAVA_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_JAVA_SOVERS_MINOR ${_lt_vers_am_contents}) + string (REGEX REPLACE ".*LT_JAVA_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$" + "\\1" H5_JAVA_SOVERS_RELEASE ${_lt_vers_am_contents}) + MATH (EXPR H5_JAVA_SOVERS_MAJOR ${H5_JAVA_SOVERS_INTERFACE}-${H5_JAVA_SOVERS_RELEASE}) + message (STATUS "SOVERSION_JAVA: ${H5_JAVA_SOVERS_MAJOR}.${H5_JAVA_SOVERS_RELEASE}.${H5_JAVA_SOVERS_MINOR}") +endif() #----------------------------------------------------------------------------- # Basic HDF5 stuff here @@ -257,6 +360,41 @@ else (NOT "${H5_VERS_SUBRELEASE}" STREQUAL "") set (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}") endif (NOT "${H5_VERS_SUBRELEASE}" STREQUAL "") set (HDF5_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") +if(H5_TOOLS_SOVERS_EXISTS) + set (HDF5_TOOLS_PACKAGE_SOVERSION "${H5_TOOLS_SOVERS_MAJOR}.${H5_TOOLS_SOVERS_RELEASE}.${H5_TOOLS_SOVERS_MINOR}") +else() + set (HDF5_TOOLS_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") +endif() +if(H5_CXX_SOVERS_EXISTS) + set (HDF5_CXX_PACKAGE_SOVERSION "${H5_CXX_SOVERS_MAJOR}.${H5_CXX_SOVERS_RELEASE}.${H5_CXX_SOVERS_MINOR}") +else() + set (HDF5_CXX_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") +endif() +if(H5_F_SOVERS_EXISTS) + set (HDF5_F_PACKAGE_SOVERSION "${H5_F_SOVERS_MAJOR}.${H5_F_SOVERS_RELEASE}.${H5_F_SOVERS_MINOR}") +else() + set (HDF5_F_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") +endif() +if(H5_HL_SOVERS_EXISTS) + set (HDF5_HL_PACKAGE_SOVERSION "${H5_HL_SOVERS_MAJOR}.${H5_HL_SOVERS_RELEASE}.${H5_HL_SOVERS_MINOR}") +else() + set (HDF5_HL_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") +endif() +if(H5_HL_F_SOVERS_EXISTS) + set (HDF5_HL_CXX_PACKAGE_SOVERSION "${H5_HL_CXX_SOVERS_MAJOR}.${H5_HL_CXX_SOVERS_RELEASE}.${H5_HL_CXX_SOVERS_MINOR}") +else() + set (HDF5_HL_CXX_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") +endif() +if(H5_HL_F_SOVERS_EXISTS) + set (HDF5_HL_F_PACKAGE_SOVERSION "${H5_HL_F_SOVERS_MAJOR}.${H5_HL_F_SOVERS_RELEASE}.${H5_HL_F_SOVERS_MINOR}") +else() + set (HDF5_HL_F_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") +endif() +if(H5_JAVA_SOVERS_EXISTS) + set (HDF5_PACKAGE_SOVERSION "${H5_JAVA_SOVERS_MAJOR}.${H5_JAVA_SOVERS_RELEASE}.${H5_JAVA_SOVERS_MINOR}") +else() + set (HDF5_JAVA_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}") +endif() set (HDF5_PACKAGE_STRING "${HDF5_PACKAGE_NAME} ${HDF5_PACKAGE_VERSION_STRING}") set (HDF5_PACKAGE_TARNAME "${HDF5_PACKAGE}${HDF_PACKAGE_EXT}") set (HDF5_PACKAGE_URL "http://www.hdfgroup.org") @@ -285,6 +423,11 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) set (CMAKE_Fortran_MODULE_DIRECTORY ${PROJECT_BINARY_DIR}/bin CACHE PATH "Single Directory for all fortran modules." ) + if (WIN32) + set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_BUILD_TYPE}) + else (WIN32) + set (CMAKE_TEST_OUTPUT_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + endif (WIN32) else (NOT HDF5_EXTERNALLY_CONFIGURED) # if we are externally configured, but the project uses old cmake scripts # this may not be set and utilities like H5detect will fail @@ -773,11 +916,21 @@ endif (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++" # Check if Fortran's default real is double precision. If it is and HL is # being built then configure should fail due to bug HDFFV-889. #----------------------------------------------------------------------------- - if (HDF5_BUILD_FORTRAN AND HDF5_BUILD_HL_LIB ) - if (NOT FORTRAN_DEFAULT_REAL_NOT_DOUBLE) - message (FATAL_ERROR " **** Fortran high-level routines are not supported when the default REAL is DOUBLE PRECISION, use HDF5_BUILD_HL_LIB:BOOL=OFF **** ") - endif (NOT FORTRAN_DEFAULT_REAL_NOT_DOUBLE) - endif (HDF5_BUILD_FORTRAN AND HDF5_BUILD_HL_LIB ) +if (HDF5_BUILD_FORTRAN AND HDF5_BUILD_HL_LIB) + if (NOT FORTRAN_DEFAULT_REAL_NOT_DOUBLE) + message (FATAL_ERROR " **** Fortran high-level routines are not supported when the default REAL is DOUBLE PRECISION, use HDF5_BUILD_HL_LIB:BOOL=OFF **** ") + endif (NOT FORTRAN_DEFAULT_REAL_NOT_DOUBLE) +endif (HDF5_BUILD_FORTRAN AND HDF5_BUILD_HL_LIB) + +#----------------------------------------------------------------------------- +# Option to build HDF5 Java Library +#----------------------------------------------------------------------------- +if (EXISTS "${HDF5_SOURCE_DIR}/java" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/java") + option (HDF5_BUILD_JAVA "Build Java HDF5 Library" ON) + if (HDF5_BUILD_JAVA) + add_subdirectory (${HDF5_SOURCE_DIR}/java ${PROJECT_BINARY_DIR}/java) + endif (HDF5_BUILD_JAVA) +endif (EXISTS "${HDF5_SOURCE_DIR}/java" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/java") #----------------------------------------------------------------------------- # Generate the H5pubconf.h file containing user settings needed by compilation diff --git a/MANIFEST b/MANIFEST index 004cfb5..27be844 100644 --- a/MANIFEST +++ b/MANIFEST @@ -27,14 +27,33 @@ ./MANIFEST ./Makefile.dist ./Makefile.am -./m4/aclocal_fc.m4 -./m4/aclocal_cxx.m4 ./README.txt ./BRANCH.txt ./acsite.m4 ./autogen.sh ./configure.ac +./m4/aclocal_cxx.m4 +./m4/aclocal_fc.m4 +./m4/ax_check_class.m4 +./m4/ax_check_classpath.m4 +./m4/ax_check_java_home.m4 +./m4/ax_check_junit.m4 +./m4/ax_check_rqrd_class.m4 +./m4/ax_java_check_class.m4 +./m4/ax_java_options.m4 +./m4/ax_jni_include_dir.m4 +./m4/ax_prog_jar.m4 +./m4/ax_prog_java_cc.m4 +./m4/ax_prog_java_works.m4 +./m4/ax_prog_java.m4 +./m4/ax_prog_javac_works.m4 +./m4/ax_prog_javac.m4 +./m4/ax_prog_javadoc.m4 +./m4/ax_prog_javah.m4 +./m4/ax_try_compile_java.m4 +./m4/ax_try_run_java.m4 + ./bin/COPYING ./bin/bbrelease _DO_NOT_DISTRIBUTE_ ./bin/buildhdf5 @@ -2416,13 +2435,306 @@ ./hl/c++/test/ptableTest.cpp ./hl/c++/test/Makefile.am +# java +./java/COPYING +./java/Makefile.am +./java/CMakeLists.txt + +./java/src/Makefile.am +./java/src/CMakeLists.txt +./java/src/jni/Makefile.am +./java/src/jni/CMakeLists.txt +./java/src/jni/exceptionImp.c +./java/src/jni/exceptionImp.h +./java/src/jni/h5Constants.c +./java/src/jni/nativeData.c +./java/src/jni/nativeData.h +./java/src/jni/h5jni.h +./java/src/jni/h5util.c +./java/src/jni/h5util.h +./java/src/jni/h5Imp.c +./java/src/jni/h5Imp.h +./java/src/jni/h5aImp.c +./java/src/jni/h5aImp.h +./java/src/jni/h5dImp.c +./java/src/jni/h5dImp.h +./java/src/jni/h5eImp.c +./java/src/jni/h5eImp.h +./java/src/jni/h5fImp.c +./java/src/jni/h5fImp.h +./java/src/jni/h5gImp.c +./java/src/jni/h5gImp.h +./java/src/jni/h5iImp.c +./java/src/jni/h5iImp.h +./java/src/jni/h5lImp.c +./java/src/jni/h5lImp.h +./java/src/jni/h5oImp.c +./java/src/jni/h5oImp.h +./java/src/jni/h5pImp.c +./java/src/jni/h5pImp.h +./java/src/jni/h5plImp.c +./java/src/jni/h5plImp.h +./java/src/jni/h5rImp.c +./java/src/jni/h5rImp.h +./java/src/jni/h5sImp.c +./java/src/jni/h5sImp.h +./java/src/jni/h5tImp.c +./java/src/jni/h5tImp.h +./java/src/jni/h5zImp.c +./java/src/jni/h5zImp.h + +./java/src/hdf/CMakeLists.txt +./java/src/hdf/hdf5lib/CMakeLists.txt + +./java/src/hdf/hdf5lib/callbacks/Callbacks.java +./java/src/hdf/hdf5lib/callbacks/H5A_iterate_cb.java +./java/src/hdf/hdf5lib/callbacks/H5A_iterate_t.java +./java/src/hdf/hdf5lib/callbacks/H5D_iterate_cb.java +./java/src/hdf/hdf5lib/callbacks/H5D_iterate_t.java +./java/src/hdf/hdf5lib/callbacks/H5E_walk_cb.java +./java/src/hdf/hdf5lib/callbacks/H5E_walk_t.java +./java/src/hdf/hdf5lib/callbacks/H5L_iterate_cb.java +./java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java +./java/src/hdf/hdf5lib/callbacks/H5O_iterate_cb.java +./java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java +./java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_cb.java +./java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_t.java +./java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_cb.java +./java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_t.java +./java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_cb.java +./java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_t.java +./java/src/hdf/hdf5lib/callbacks/H5P_prp_close_func_cb.java +./java/src/hdf/hdf5lib/callbacks/H5P_prp_compare_func_cb.java +./java/src/hdf/hdf5lib/callbacks/H5P_prp_copy_func_cb.java +./java/src/hdf/hdf5lib/callbacks/H5P_prp_create_func_cb.java +./java/src/hdf/hdf5lib/callbacks/H5P_prp_delete_func_cb.java +./java/src/hdf/hdf5lib/callbacks/H5P_prp_get_func_cb.java +./java/src/hdf/hdf5lib/callbacks/H5P_prp_set_func_cb.java +./java/src/hdf/hdf5lib/callbacks/H5P_iterate_cb.java +./java/src/hdf/hdf5lib/callbacks/H5P_iterate_t.java + +./java/src/hdf/hdf5lib/exceptions/HDF5AtomException.java +./java/src/hdf/hdf5lib/exceptions/HDF5AttributeException.java +./java/src/hdf/hdf5lib/exceptions/HDF5BtreeException.java +./java/src/hdf/hdf5lib/exceptions/HDF5DataFiltersException.java +./java/src/hdf/hdf5lib/exceptions/HDF5DataStorageException.java +./java/src/hdf/hdf5lib/exceptions/HDF5DatasetInterfaceException.java +./java/src/hdf/hdf5lib/exceptions/HDF5DataspaceInterfaceException.java +./java/src/hdf/hdf5lib/exceptions/HDF5DatatypeInterfaceException.java +./java/src/hdf/hdf5lib/exceptions/HDF5Exception.java +./java/src/hdf/hdf5lib/exceptions/HDF5ExternalFileListException.java +./java/src/hdf/hdf5lib/exceptions/HDF5FileInterfaceException.java +./java/src/hdf/hdf5lib/exceptions/HDF5FunctionArgumentException.java +./java/src/hdf/hdf5lib/exceptions/HDF5FunctionEntryExitException.java +./java/src/hdf/hdf5lib/exceptions/HDF5HeapException.java +./java/src/hdf/hdf5lib/exceptions/HDF5InternalErrorException.java +./java/src/hdf/hdf5lib/exceptions/HDF5JavaException.java +./java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java +./java/src/hdf/hdf5lib/exceptions/HDF5LowLevelIOException.java +./java/src/hdf/hdf5lib/exceptions/HDF5MetaDataCacheException.java +./java/src/hdf/hdf5lib/exceptions/HDF5ObjectHeaderException.java +./java/src/hdf/hdf5lib/exceptions/HDF5PropertyListInterfaceException.java +./java/src/hdf/hdf5lib/exceptions/HDF5ReferenceException.java +./java/src/hdf/hdf5lib/exceptions/HDF5ResourceUnavailableException.java +./java/src/hdf/hdf5lib/exceptions/HDF5SymbolTableException.java + +./java/src/hdf/hdf5lib/structs/H5_ih_info_t.java +./java/src/hdf/hdf5lib/structs/H5A_info_t.java +./java/src/hdf/hdf5lib/structs/H5AC_cache_config_t.java +./java/src/hdf/hdf5lib/structs/H5E_error2_t.java +./java/src/hdf/hdf5lib/structs/H5F_info2_t.java +./java/src/hdf/hdf5lib/structs/H5G_info_t.java +./java/src/hdf/hdf5lib/structs/H5L_info_t.java +./java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java +./java/src/hdf/hdf5lib/structs/H5O_info_t.java + +./java/src/hdf/hdf5lib/H5.java +./java/src/hdf/hdf5lib/HDF5Constants.java +./java/src/hdf/hdf5lib/HDF5GroupInfo.java +./java/src/hdf/hdf5lib/HDFArray.java +./java/src/hdf/hdf5lib/HDFNativeData.java + +./java/examples/Makefile.am +./java/examples/CMakeLists.txt + +./java/examples/intro/Makefile.am +./java/examples/intro/CMakeLists.txt +./java/examples/intro/runExample.sh.in +./java/examples/intro/H5_CreateAttribute.java +./java/examples/intro/H5_CreateDataset.java +./java/examples/intro/H5_CreateFile.java +./java/examples/intro/H5_CreateGroup.java +./java/examples/intro/H5_CreateGroupAbsoluteRelative.java +./java/examples/intro/H5_CreateGroupDataset.java +./java/examples/intro/H5_ReadWrite.java + +./java/examples/groups/Makefile.am +./java/examples/groups/CMakeLists.txt +./java/examples/groups/runExample.sh.in +./java/examples/groups/H5Ex_G_Create.java +./java/examples/groups/H5Ex_G_Iterate.java +./java/examples/groups/H5Ex_G_Compact.java +./java/examples/groups/H5Ex_G_Corder.java +./java/examples/groups/H5Ex_G_Intermediate.java +./java/examples/groups/H5Ex_G_Phase.java +./java/examples/groups/H5Ex_G_Traverse.java +./java/examples/groups/H5Ex_G_Visit.java +./java/examples/groups/h5ex_g_iterate.h5 +./java/examples/groups/h5ex_g_visit.h5 + +./java/examples/datasets/Makefile.am +./java/examples/datasets/CMakeLists.txt +./java/examples/datasets/runExample.sh.in +./java/examples/datasets/H5Ex_D_Alloc.java +./java/examples/datasets/H5Ex_D_Checksum.java +./java/examples/datasets/H5Ex_D_Chunk.java +./java/examples/datasets/H5Ex_D_Compact.java +./java/examples/datasets/H5Ex_D_External.java +./java/examples/datasets/H5Ex_D_FillValue.java +./java/examples/datasets/H5Ex_D_Gzip.java +./java/examples/datasets/H5Ex_D_Hyperslab.java +./java/examples/datasets/H5Ex_D_ReadWrite.java +./java/examples/datasets/H5Ex_D_Shuffle.java +./java/examples/datasets/H5Ex_D_Szip.java +./java/examples/datasets/H5Ex_D_UnlimitedAdd.java +./java/examples/datasets/H5Ex_D_UnlimitedGzip.java +./java/examples/datasets/H5Ex_D_UnlimitedMod.java +./java/examples/datasets/H5Ex_D_Nbit.java +./java/examples/datasets/H5Ex_D_Transform.java +./java/examples/datasets/H5Ex_D_Sofloat.java +./java/examples/datasets/H5Ex_D_Soint.java + +./java/examples/datatypes/Makefile.am +./java/examples/datatypes/CMakeLists.txt +./java/examples/datatypes/runExample.sh.in +./java/examples/datatypes/H5Ex_T_Array.java +./java/examples/datatypes/H5Ex_T_ArrayAttribute.java +./java/examples/datatypes/H5Ex_T_Bit.java +./java/examples/datatypes/H5Ex_T_BitAttribute.java +./java/examples/datatypes/H5Ex_T_Commit.java +./java/examples/datatypes/H5Ex_T_Compound.java +./java/examples/datatypes/H5Ex_T_CompoundAttribute.java +./java/examples/datatypes/H5Ex_T_Float.java +./java/examples/datatypes/H5Ex_T_FloatAttribute.java +./java/examples/datatypes/H5Ex_T_Integer.java +./java/examples/datatypes/H5Ex_T_IntegerAttribute.java +./java/examples/datatypes/H5Ex_T_ObjectReference.java +./java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java +./java/examples/datatypes/H5Ex_T_Opaque.java +./java/examples/datatypes/H5Ex_T_OpaqueAttribute.java +./java/examples/datatypes/H5Ex_T_String.java +./java/examples/datatypes/H5Ex_T_StringAttribute.java +./java/examples/datatypes/H5Ex_T_VLString.java + +./java/examples/testfiles/examples.intro.H5_CreateAttribute.txt +./java/examples/testfiles/examples.intro.H5_CreateDataset.txt +./java/examples/testfiles/examples.intro.H5_CreateFile.txt +./java/examples/testfiles/examples.intro.H5_CreateGroup.txt +./java/examples/testfiles/examples.intro.H5_CreateGroupAbsoluteRelative.txt +./java/examples/testfiles/examples.intro.H5_CreateGroupDataset.txt +./java/examples/testfiles/examples.intro.H5_ReadWrite.txt +./java/examples/testfiles/examples.groups.H5Ex_G_Create.txt +./java/examples/testfiles/examples.groups.H5Ex_G_Iterate.txt +./java/examples/testfiles/examples.groups.H5Ex_G_Compact.txt +./java/examples/testfiles/examples.groups.H5Ex_G_Corder.txt +./java/examples/testfiles/examples.groups.H5Ex_G_Intermediate.txt +./java/examples/testfiles/examples.groups.H5Ex_G_Phase.txt +./java/examples/testfiles/examples.groups.H5Ex_G_Visit.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_Alloc.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_Checksum.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_Chunk.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_Compact.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_External.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_FillValue.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_Gzip.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_Hyperslab.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_ReadWrite.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_Shuffle.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_Szip.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedAdd.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedGzip.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedMod.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_Nbit.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_Transform.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_Sofloat.txt +./java/examples/testfiles/examples.datasets.H5Ex_D_Soint.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_Array.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_ArrayAttribute.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_Bit.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_BitAttribute.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_Commit.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_Compound.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_CompoundAttribute.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_Float.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_FloatAttribute.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_Integer.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_IntegerAttribute.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReference.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReferenceAttribute.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_Opaque.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_OpaqueAttribute.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_String.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_StringAttribute.txt +./java/examples/testfiles/examples.datatypes.H5Ex_T_VLString.txt + +./java/test/Makefile.am +./java/test/CMakeLists.txt +./java/test/junit.sh.in +./java/test/JUnit-interface.txt +./java/test/h5ex_g_iterate.hdf +./java/test/TestH5.java +./java/test/TestH5A.java +./java/test/TestH5Dparams.java +./java/test/TestH5D.java +./java/test/TestH5Dplist.java +./java/test/TestH5E.java +./java/test/TestH5Edefault.java +./java/test/TestH5Eregister.java +./java/test/TestH5Fparams.java +./java/test/TestH5Fbasic.java +./java/test/TestH5F.java +./java/test/TestH5Gbasic.java +./java/test/TestH5G.java +./java/test/TestH5Giterate.java +./java/test/TestH5Lparams.java +./java/test/TestH5Lbasic.java +./java/test/TestH5Lcreate.java +./java/test/TestH5Oparams.java +./java/test/TestH5Obasic.java +./java/test/TestH5Ocreate.java +./java/test/TestH5Ocopy.java +./java/test/TestH5P.java +./java/test/TestH5PData.java +./java/test/TestH5Pfapl.java +./java/test/TestH5Plist.java +./java/test/TestH5Pvirtual.java +./java/test/TestH5PL.java +./java/test/TestH5R.java +./java/test/TestH5Sbasic.java +./java/test/TestH5S.java +./java/test/TestH5Tparams.java +./java/test/TestH5Tbasic.java +./java/test/TestH5T.java +./java/test/TestH5Z.java +./java/test/TestAll.java + +./java/lib/hamcrest-core.jar +./java/lib/junit.jar +./java/lib/simplelogger.properties +./java/lib/slf4j-api-1.7.5.jar +./java/lib/ext/slf4j-nop-1.7.5.jar +./java/lib/ext/slf4j-simple-1.7.5.jar + # CMake-specific Files ./config/cmake/cacheinit.cmake +./config/cmake/CMakeFindJavaCommon.cmake ./config/cmake/ConversionTests.c ./config/cmake/ConfigureChecks.cmake ./config/cmake/CPack.Info.plist.in ./config/cmake/CTestCustom.cmake ./config/cmake/FindHDF5.cmake.in +./config/cmake/FindHDFJAVA.cmake.in +./config/cmake/FindJNI.cmake ./config/cmake/H5cxx_config.h.in ./config/cmake/H5pubconf.h.in ./config/cmake/hdf5-config.cmake.in @@ -2431,11 +2743,15 @@ ./config/cmake/HDF5_Process_Flex_Files.cmake ./config/cmake/HDF5Macros.cmake ./config/cmake/HDF5UseFortran.cmake +./config/cmake/jrunTest.cmake ./config/cmake/libhdf5.settings.cmake.in ./config/cmake/mccacheinit.cmake ./config/cmake/patch.xml ./config/cmake/PkgInfo.in ./config/cmake/README.txt.cmake.in +./config/cmake/UseJava.cmake +./config/cmake/UseJavaClassFilelist.cmake +./config/cmake/UseJavaSymlinks.cmake ./config/cmake/userblockTest.cmake ./config/cmake/vfdTest.cmake diff --git a/Makefile.am b/Makefile.am index c34f2cd..bbab346 100644 --- a/Makefile.am +++ b/Makefile.am @@ -66,6 +66,11 @@ if BUILD_FORTRAN_CONDITIONAL else FORTRAN_DIR= endif +if BUILD_JAVA_CONDITIONAL + JAVA_DIR=java +else + JAVA_DIR= +endif if BUILD_HDF5_HL_CONDITIONAL HDF5_HL_DIR =hl else @@ -73,8 +78,8 @@ else endif SUBDIRS = src test $(TESTPARALLEL_DIR) tools . $(CXX_DIR) $(FORTRAN_DIR) \ - $(HDF5_HL_DIR) -DIST_SUBDIRS = src test testpar tools . c++ fortran hl examples + $(JAVA_DIR) $(HDF5_HL_DIR) +DIST_SUBDIRS = src test testpar tools . c++ fortran hl examples java # Some files generated during configure that should be cleaned DISTCLEANFILES=config/stamp1 config/stamp2 diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index 473605a..1a182e3 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -94,7 +94,7 @@ if (BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${HDF5_CPP_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_CPP_LIBSH_TARGET}") - H5_SET_LIB_OPTIONS (${HDF5_CPP_LIBSH_TARGET} ${HDF5_CPP_LIB_NAME} SHARED) + H5_SET_LIB_OPTIONS (${HDF5_CPP_LIBSH_TARGET} ${HDF5_CPP_LIB_NAME} SHARED ${HDF5_CXX_PACKAGE_SOVERSION}) set_target_properties (${HDF5_CPP_LIBSH_TARGET} PROPERTIES FOLDER libraries/cpp COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB" diff --git a/config/cmake/CMakeFindJavaCommon.cmake b/config/cmake/CMakeFindJavaCommon.cmake new file mode 100644 index 0000000..fcf0389 --- /dev/null +++ b/config/cmake/CMakeFindJavaCommon.cmake @@ -0,0 +1,41 @@ + +#============================================================================= +# Copyright 2013-2014 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# Do not include this module directly from code outside CMake! +set(_JAVA_HOME "") +if(JAVA_HOME AND IS_DIRECTORY "${JAVA_HOME}") + set(_JAVA_HOME "${JAVA_HOME}") + set(_JAVA_HOME_EXPLICIT 1) +else() + set(_ENV_JAVA_HOME "") + if(DEFINED ENV{JAVA_HOME}) + file(TO_CMAKE_PATH "$ENV{JAVA_HOME}" _ENV_JAVA_HOME) + endif() + if(_ENV_JAVA_HOME AND IS_DIRECTORY "${_ENV_JAVA_HOME}") + set(_JAVA_HOME "${_ENV_JAVA_HOME}") + set(_JAVA_HOME_EXPLICIT 1) + else() + set(_CMD_JAVA_HOME "") + if(APPLE AND EXISTS /usr/libexec/java_home) + execute_process(COMMAND /usr/libexec/java_home + OUTPUT_VARIABLE _CMD_JAVA_HOME OUTPUT_STRIP_TRAILING_WHITESPACE) + endif() + if(_CMD_JAVA_HOME AND IS_DIRECTORY "${_CMD_JAVA_HOME}") + set(_JAVA_HOME "${_CMD_JAVA_HOME}") + set(_JAVA_HOME_EXPLICIT 0) + endif() + unset(_CMD_JAVA_HOME) + endif() + unset(_ENV_JAVA_HOME) +endif() diff --git a/config/cmake/FindHDFJAVA.cmake.in b/config/cmake/FindHDFJAVA.cmake.in new file mode 100644 index 0000000..b822280 --- /dev/null +++ b/config/cmake/FindHDFJAVA.cmake.in @@ -0,0 +1,68 @@ +# +# To be used by projects that make use of CMakeified hdf-java +# + +# +# Find the HDFJAVA includes and get all installed hdf-java library settings from +# HDFJAVA-config.cmake file : Requires a CMake compatible hdf-java-@HDFJAVA_PACKAGE_VERSION@ or later +# for this feature to work. The following vars are set if hdf-java is found. +# +# HDFJAVA_FOUND - True if found, otherwise all other vars are undefined +# HDFJAVA_VERSION_STRING - full version (e.g. @HDFJAVA_PACKAGE_VERSION@) +# HDFJAVA_VERSION_MAJOR - major part of version (e.g. @HDFJAVA_PACKAGE_VERSION_MAJOR@) +# HDFJAVA_VERSION_MINOR - minor part (e.g. @HDFJAVA_PACKAGE_VERSION_MINOR@) +# +# Target names that are valid (depending on enabled options) +# will be the following +# +# +# To aid in finding HDFJAVA as part of a subproject set +# HDFJAVA_ROOT_DIR_HINT to the location where @HDFJAVA_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake lies + +INCLUDE (SelectLibraryConfigurations) +INCLUDE (FindPackageHandleStandardArgs) + +# The HINTS option should only be used for values computed from the system. +set (_HDFJAVA_HINTS + $ENV{HOME}/.local + $ENV{HDFJAVA_ROOT} + $ENV{HDFJAVA_ROOT_DIR_HINT} +) +# Hard-coded guesses should still go in PATHS. This ensures that the user +# environment can always override hard guesses. +set (_HDFJAVA_PATHS + $ENV{HOME}/.local + $ENV{HDFJAVA_ROOT} + $ENV{HDFJAVA_ROOT_DIR_HINT} + /usr/lib/@HDFJAVA_PACKAGE@ + /usr/share/@HDFJAVA_PACKAGE@ + /usr/local/@HDFJAVA_PACKAGE@ + /usr/local/@HDFJAVA_PACKAGE@/share +) + +FIND_PATH (HDFJAVA_ROOT_DIR "@HDFJAVA_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake" + HINTS ${_HDFJAVA_HINTS} + PATHS ${_HDFJAVA_PATHS} + PATH_SUFFIXES + cmake/@HDFJAVA_PACKAGE@ + lib/cmake/@HDFJAVA_PACKAGE@ + share/cmake/@HDFJAVA_PACKAGE@ +) + +FIND_PATH (HDFJAVA_LIBRARY "jarhdf5-@HDFJAVA_PACKAGE_VERSION@.jar" + HINTS ${_HDFJAVA_HINTS} + PATHS ${_HDFJAVA_PATHS} + PATH_SUFFIXES + lib +) + +if (HDFJAVA_ROOT_DIR) + set (HDFJAVA_FOUND "YES") + INCLUDE (${HDFJAVA_ROOT_DIR}/@HDFJAVA_PACKAGE@@HDF_PACKAGE_EXT@-config.cmake) + set (HDFJAVA_LIBRARIES "${HDFJAVA_LIBRARY}") + set (HDFJAVA_INCLUDE_DIRS + ${HDFJAVA_LIBRARY}/jarhdf-@HDFJAVA_PACKAGE_VERSION@.jar + ${HDFJAVA_LIBRARY}/jarhdf5-@HDFJAVA_PACKAGE_VERSION@.jar + ) + +endif (HDFJAVA_ROOT_DIR) diff --git a/config/cmake/FindJNI.cmake b/config/cmake/FindJNI.cmake new file mode 100644 index 0000000..440a9889 --- /dev/null +++ b/config/cmake/FindJNI.cmake @@ -0,0 +1,342 @@ +#.rst: +# FindJNI +# ------- +# +# Find JNI java libraries. +# +# This module finds if Java is installed and determines where the +# include files and libraries are. It also determines what the name of +# the library is. The caller may set variable JAVA_HOME to specify a +# Java installation prefix explicitly. +# +# This module sets the following result variables: +# +# :: +# +# JNI_INCLUDE_DIRS = the include dirs to use +# JNI_LIBRARIES = the libraries to use +# JNI_FOUND = TRUE if JNI headers and libraries were found. +# JAVA_AWT_LIBRARY = the path to the jawt library +# JAVA_JVM_LIBRARY = the path to the jvm library +# JAVA_INCLUDE_PATH = the include path to jni.h +# JAVA_INCLUDE_PATH2 = the include path to jni_md.h +# JAVA_AWT_INCLUDE_PATH = the include path to jawt.h + +#============================================================================= +# Copyright 2001-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# Expand {libarch} occurences to java_libarch subdirectory(-ies) and set ${_var} +macro(java_append_library_directories _var) + # Determine java arch-specific library subdir + # Mostly based on openjdk/jdk/make/common/shared/Platform.gmk as of openjdk + # 1.6.0_18 + icedtea patches. However, it would be much better to base the + # guess on the first part of the GNU config.guess platform triplet. + if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") + if(CMAKE_LIBRARY_ARCHITECTURE STREQUAL "x86_64-linux-gnux32") + set(_java_libarch "x32" "amd64" "i386") + else() + set(_java_libarch "amd64" "i386") + endif() + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$") + set(_java_libarch "i386") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^alpha") + set(_java_libarch "alpha") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm") + # Subdir is "arm" for both big-endian (arm) and little-endian (armel). + set(_java_libarch "arm") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips") + # mips* machines are bi-endian mostly so processor does not tell + # endianess of the underlying system. + set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb" "mips64" "mips64el" "mipsn32" "mipsn32el") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64le") + set(_java_libarch "ppc64" "ppc64le") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64") + set(_java_libarch "ppc64" "ppc") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)") + set(_java_libarch "ppc") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc") + # Both flavours can run on the same processor + set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "sparc" "sparcv9") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(parisc|hppa)") + set(_java_libarch "parisc" "parisc64") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^s390") + # s390 binaries can run on s390x machines + set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "s390" "s390x") + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sh") + set(_java_libarch "sh") + else() + set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}") + endif() + + # Append default list architectures if CMAKE_SYSTEM_PROCESSOR was empty or + # system is non-Linux (where the code above has not been well tested) + if(NOT _java_libarch OR NOT (CMAKE_SYSTEM_NAME MATCHES "Linux")) + list(APPEND _java_libarch "i386" "amd64" "ppc") + endif() + + # Sometimes ${CMAKE_SYSTEM_PROCESSOR} is added to the list to prefer + # current value to a hardcoded list. Remove possible duplicates. + list(REMOVE_DUPLICATES _java_libarch) + + foreach(_path ${ARGN}) + if(_path MATCHES "{libarch}") + foreach(_libarch ${_java_libarch}) + string(REPLACE "{libarch}" "${_libarch}" _newpath "${_path}") + list(APPEND ${_var} "${_newpath}") + endforeach() + else() + list(APPEND ${_var} "${_path}") + endif() + endforeach() +endmacro() + +#include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindJavaCommon.cmake) +INCLUDE (CMakeFindJavaCommon) + +# Save CMAKE_FIND_FRAMEWORK +if(DEFINED CMAKE_FIND_FRAMEWORK) + set(_JNI_CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK}) +else() + unset(_JNI_CMAKE_FIND_FRAMEWORK) +endif() + +if(_JAVA_HOME_EXPLICIT) + set(CMAKE_FIND_FRAMEWORK NEVER) +endif() + +set(JAVA_AWT_LIBRARY_DIRECTORIES) +if(_JAVA_HOME) + JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES + ${_JAVA_HOME}/jre/lib/{libarch} + ${_JAVA_HOME}/jre/lib + ${_JAVA_HOME}/lib/{libarch} + ${_JAVA_HOME}/lib + ${_JAVA_HOME} + ) +endif() +get_filename_component(java_install_version + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit;CurrentVersion]" NAME) + +list(APPEND JAVA_AWT_LIBRARY_DIRECTORIES + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/lib" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/lib" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/lib" + ) +JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES + /usr/java/lib + /usr/java/jre/lib + /usr/lib + /usr/lib64 + /usr/local/lib + /usr/local/lib64 + /usr/lib/jvm/java/lib + /usr/lib64/jvm/java/lib + /usr/lib/java/jre/lib/{libarch} + /usr/lib64/java/jre/lib/{libarch} + /usr/lib/jvm/jre/lib/{libarch} + /usr/lib64/jvm/jre/lib/{libarch} + /usr/local/lib/java/jre/lib/{libarch} + /usr/local/share/java/jre/lib/{libarch} + /usr/lib/j2sdk1.4-sun/jre/lib/{libarch} + /usr/lib/j2sdk1.5-sun/jre/lib/{libarch} + /opt/sun-jdk-1.5.0.04/jre/lib/{libarch} + /usr/lib/jvm/java-6-sun/jre/lib/{libarch} + /usr/lib/jvm/java-1.5.0-sun/jre/lib/{libarch} + /usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/{libarch} # can this one be removed according to #8821 ? Alex + /usr/lib/jvm/java-6-openjdk/jre/lib/{libarch} + /usr/lib/jvm/java-7-openjdk/jre/lib/{libarch} + /usr/lib/jvm/java-7-openjdk-{libarch}/jre/lib/{libarch} + /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/{libarch} # fedora + # Debian specific paths for default JVM + /usr/lib/jvm/default-java/jre/lib/{libarch} + /usr/lib/jvm/default-java/jre/lib + /usr/lib/jvm/default-java/lib + # OpenBSD specific paths for default JVM + /usr/local/jdk-1.7.0/jre/lib/{libarch} + /usr/local/jre-1.7.0/lib/{libarch} + /usr/local/jdk-1.6.0/jre/lib/{libarch} + /usr/local/jre-1.6.0/lib/{libarch} + # SuSE specific paths for default JVM + /usr/lib64/jvm/java/jre/lib/{libarch} + /usr/lib64/jvm/jre/lib/{libarch} + ) + +set(JAVA_JVM_LIBRARY_DIRECTORIES) +foreach(dir ${JAVA_AWT_LIBRARY_DIRECTORIES}) + list(APPEND JAVA_JVM_LIBRARY_DIRECTORIES + "${dir}" + "${dir}/client" + "${dir}/server" + # IBM SDK, Java Technology Edition, specific paths + "${dir}/j9vm" + "${dir}/default" + ) +endforeach() + +set(JAVA_AWT_INCLUDE_DIRECTORIES) +if(_JAVA_HOME) + list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES ${_JAVA_HOME}/include) +endif() +list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/include" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/include" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/include" + ${_JAVA_HOME}/include + /usr/include + /usr/java/include + /usr/local/include + /usr/lib/java/include + /usr/lib64/java/include + /usr/local/lib/java/include + /usr/lib/jvm/java/include + /usr/lib64/jvm/java/include + /usr/lib/jvm/java-6-sun/include + /usr/lib/jvm/java-1.5.0-sun/include + /usr/lib/jvm/java-6-sun-1.6.0.00/include # can this one be removed according to #8821 ? Alex + /usr/lib/jvm/java-6-openjdk/include + /usr/lib/jvm/java-7-openjdk/include + /usr/lib/jvm/java-7-openjdk-i386/include + /usr/lib/jvm/java-7-openjdk-amd64/include + /usr/lib64/jvm/java-7-openjdk/include + /usr/lib64/jvm/java-7-openjdk-amd64/include + /usr/local/share/java/include + /usr/lib/j2sdk1.4-sun/include + /usr/lib/j2sdk1.5-sun/include + /opt/sun-jdk-1.5.0.04/include + # Debian specific path for default JVM + /usr/lib/jvm/default-java/include + # OpenBSD specific path for default JVM + /usr/local/jdk-1.7.0/include + /usr/local/jdk-1.6.0/include + # SuSE specific paths for default JVM + /usr/lib64/jvm/java/include + ) + +foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}") + get_filename_component(jpath "${JAVA_PROG}" PATH) + foreach(JAVA_INC_PATH ../include ../java/include ../share/java/include) + if(EXISTS ${jpath}/${JAVA_INC_PATH}) + list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES "${jpath}/${JAVA_INC_PATH}") + endif() + endforeach() + foreach(JAVA_LIB_PATH + ../lib ../jre/lib ../jre/lib/i386 + ../java/lib ../java/jre/lib ../java/jre/lib/i386 + ../share/java/lib ../share/java/jre/lib ../share/java/jre/lib/i386) + if(EXISTS ${jpath}/${JAVA_LIB_PATH}) + list(APPEND JAVA_AWT_LIBRARY_DIRECTORIES "${jpath}/${JAVA_LIB_PATH}") + endif() + endforeach() +endforeach() + +if(APPLE) + if(CMAKE_FIND_FRAMEWORK STREQUAL "ONLY") + set(_JNI_SEARCHES FRAMEWORK) + elseif(CMAKE_FIND_FRAMEWORK STREQUAL "NEVER") + set(_JNI_SEARCHES NORMAL) + elseif(CMAKE_FIND_FRAMEWORK STREQUAL "LAST") + set(_JNI_SEARCHES NORMAL FRAMEWORK) + else() + set(_JNI_SEARCHES FRAMEWORK NORMAL) + endif() + set(_JNI_FRAMEWORK_JVM NAMES JavaVM) + set(_JNI_FRAMEWORK_JAWT "${_JNI_FRAMEWORK_JVM}") +else() + set(_JNI_SEARCHES NORMAL) +endif() + +set(_JNI_NORMAL_JVM + NAMES jvm + PATHS ${JAVA_JVM_LIBRARY_DIRECTORIES} + ) + +set(_JNI_NORMAL_JAWT + NAMES jawt + PATHS ${JAVA_AWT_LIBRARY_DIRECTORIES} + ) + +foreach(search ${_JNI_SEARCHES}) + find_library(JAVA_JVM_LIBRARY ${_JNI_${search}_JVM}) + find_library(JAVA_AWT_LIBRARY ${_JNI_${search}_JAWT}) + if(JAVA_JVM_LIBRARY) + break() + endif() +endforeach() +unset(_JNI_SEARCHES) +unset(_JNI_FRAMEWORK_JVM) +unset(_JNI_FRAMEWORK_JAWT) +unset(_JNI_NORMAL_JVM) +unset(_JNI_NORMAL_JAWT) + +# Find headers matching the library. +if("${JAVA_JVM_LIBRARY};${JAVA_AWT_LIBRARY};" MATCHES "(/JavaVM.framework|-framework JavaVM);") + set(CMAKE_FIND_FRAMEWORK ONLY) +else() + set(CMAKE_FIND_FRAMEWORK NEVER) +endif() + +# add in the include path +find_path(JAVA_INCLUDE_PATH jni.h + ${JAVA_AWT_INCLUDE_DIRECTORIES} +) + +find_path(JAVA_INCLUDE_PATH2 jni_md.h + ${JAVA_INCLUDE_PATH} + ${JAVA_INCLUDE_PATH}/darwin + ${JAVA_INCLUDE_PATH}/win32 + ${JAVA_INCLUDE_PATH}/linux + ${JAVA_INCLUDE_PATH}/freebsd + ${JAVA_INCLUDE_PATH}/openbsd + ${JAVA_INCLUDE_PATH}/solaris + ${JAVA_INCLUDE_PATH}/hp-ux + ${JAVA_INCLUDE_PATH}/alpha +) + +find_path(JAVA_AWT_INCLUDE_PATH jawt.h + ${JAVA_INCLUDE_PATH} +) + +# Restore CMAKE_FIND_FRAMEWORK +if(DEFINED _JNI_CMAKE_FIND_FRAMEWORK) + set(CMAKE_FIND_FRAMEWORK ${_JNI_CMAKE_FIND_FRAMEWORK}) + unset(_JNI_CMAKE_FIND_FRAMEWORK) +else() + unset(CMAKE_FIND_FRAMEWORK) +endif() + +#include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +INCLUDE (FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(JNI DEFAULT_MSG JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY + JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) + +mark_as_advanced( + JAVA_AWT_LIBRARY + JAVA_JVM_LIBRARY + JAVA_AWT_INCLUDE_PATH + JAVA_INCLUDE_PATH + JAVA_INCLUDE_PATH2 +) + +set(JNI_LIBRARIES + ${JAVA_AWT_LIBRARY} + ${JAVA_JVM_LIBRARY} +) + +set(JNI_INCLUDE_DIRS + ${JAVA_INCLUDE_PATH} + ${JAVA_INCLUDE_PATH2} + ${JAVA_AWT_INCLUDE_PATH} +) + +message ("JNI_LIBRARIES=${JNI_LIBRARIES}") +message ("JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}") diff --git a/config/cmake/README.txt.cmake.in b/config/cmake/README.txt.cmake.in index ec40abe..4c4ffd5 100644 --- a/config/cmake/README.txt.cmake.in +++ b/config/cmake/README.txt.cmake.in @@ -9,6 +9,7 @@ It was built with the following options: -- @LIB_TYPE@ C/C++/Fortran libraries -- SZIP (encoder enabled) and ZLIB -- @LIB_TYPE@ HDF5 tools + -- Java The contents of this directory are: diff --git a/config/cmake/UseJava.cmake b/config/cmake/UseJava.cmake new file mode 100644 index 0000000..d694517 --- /dev/null +++ b/config/cmake/UseJava.cmake @@ -0,0 +1,1290 @@ +#.rst: +# UseJava +# ------- +# +# Use Module for Java +# +# This file provides functions for Java. It is assumed that +# FindJava.cmake has already been loaded. See FindJava.cmake for +# information on how to load Java into your CMake project. +# +# :: +# +# add_jar(target_name +# [SOURCES] source1 [source2 ...] [resource1 ...] +# [INCLUDE_JARS jar1 [jar2 ...]] +# [ENTRY_POINT entry] +# [VERSION version] +# [OUTPUT_NAME name] +# [OUTPUT_DIR dir] +# ) +# +# This command creates a .jar. It compiles the given +# source files (source) and adds the given resource files (resource) to +# the jar file. Source files can be java files or listing files +# (prefixed by '@'). If only resource files are given then just a jar file +# is created. The list of include jars are added to the classpath when +# compiling the java sources and also to the dependencies of the target. +# INCLUDE_JARS also accepts other target names created by add_jar. For +# backwards compatibility, jar files listed as sources are ignored (as +# they have been since the first version of this module). +# +# The default OUTPUT_DIR can also be changed by setting the variable +# CMAKE_JAVA_TARGET_OUTPUT_DIR. +# +# Additional instructions: +# +# :: +# +# To add compile flags to the target you can set these flags with +# the following variable: +# +# +# +# :: +# +# set(CMAKE_JAVA_COMPILE_FLAGS -nowarn) +# +# +# +# :: +# +# To add a path or a jar file to the class path you can do this +# with the CMAKE_JAVA_INCLUDE_PATH variable. +# +# +# +# :: +# +# set(CMAKE_JAVA_INCLUDE_PATH /usr/share/java/shibboleet.jar) +# +# +# +# :: +# +# To use a different output name for the target you can set it with: +# +# +# +# :: +# +# add_jar(foobar foobar.java OUTPUT_NAME shibboleet.jar) +# +# +# +# :: +# +# To use a different output directory than CMAKE_CURRENT_BINARY_DIR +# you can set it with: +# +# +# +# :: +# +# add_jar(foobar foobar.java OUTPUT_DIR ${PROJECT_BINARY_DIR}/bin) +# +# +# +# :: +# +# To define an entry point in your jar you can set it with the ENTRY_POINT +# named argument: +# +# +# +# :: +# +# add_jar(example ENTRY_POINT com/examples/MyProject/Main) +# +# +# +# :: +# +# To define a custom manifest for the jar, you can set it with the manifest +# named argument: +# +# +# +# :: +# +# add_jar(example MANIFEST /path/to/manifest) +# +# +# +# :: +# +# To add a VERSION to the target output name you can set it using +# the VERSION named argument to add_jar. This will create a jar file with the +# name shibboleet-1.0.0.jar and will create a symlink shibboleet.jar +# pointing to the jar with the version information. +# +# +# +# :: +# +# add_jar(shibboleet shibbotleet.java VERSION 1.2.0) +# +# +# +# :: +# +# If the target is a JNI library, utilize the following commands to +# create a JNI symbolic link: +# +# +# +# :: +# +# set(CMAKE_JNI_TARGET TRUE) +# add_jar(shibboleet shibbotleet.java VERSION 1.2.0) +# install_jar(shibboleet ${LIB_INSTALL_DIR}/shibboleet) +# install_jni_symlink(shibboleet ${JAVA_LIB_INSTALL_DIR}) +# +# +# +# :: +# +# If a single target needs to produce more than one jar from its +# java source code, to prevent the accumulation of duplicate class +# files in subsequent jars, set/reset CMAKE_JAR_CLASSES_PREFIX prior +# to calling the add_jar() function: +# +# +# +# :: +# +# set(CMAKE_JAR_CLASSES_PREFIX com/redhat/foo) +# add_jar(foo foo.java) +# +# +# +# :: +# +# set(CMAKE_JAR_CLASSES_PREFIX com/redhat/bar) +# add_jar(bar bar.java) +# +# +# +# Target Properties: +# +# :: +# +# The add_jar() functions sets some target properties. You can get these +# properties with the +# get_property(TARGET PROPERTY ) +# command. +# +# +# +# :: +# +# INSTALL_FILES The files which should be installed. This is used by +# install_jar(). +# JNI_SYMLINK The JNI symlink which should be installed. +# This is used by install_jni_symlink(). +# JAR_FILE The location of the jar file so that you can include +# it. +# CLASS_DIR The directory where the class files can be found. For +# example to use them with javah. +# +# :: +# +# find_jar( +# name | NAMES name1 [name2 ...] +# [PATHS path1 [path2 ... ENV var]] +# [VERSIONS version1 [version2]] +# [DOC "cache documentation string"] +# ) +# +# This command is used to find a full path to the named jar. A cache +# entry named by is created to stor the result of this command. +# If the full path to a jar is found the result is stored in the +# variable and the search will not repeated unless the variable is +# cleared. If nothing is found, the result will be -NOTFOUND, and +# the search will be attempted again next time find_jar is invoked with +# the same variable. The name of the full path to a file that is +# searched for is specified by the names listed after NAMES argument. +# Additional search locations can be specified after the PATHS argument. +# If you require special a version of a jar file you can specify it with +# the VERSIONS argument. The argument after DOC will be used for the +# documentation string in the cache. +# +# :: +# +# install_jar(target_name destination) +# install_jar(target_name DESTINATION destination [COMPONENT component]) +# +# This command installs the TARGET_NAME files to the given DESTINATION. +# It should be called in the same scope as add_jar() or it will fail. +# +# :: +# +# install_jni_symlink(target_name destination) +# install_jni_symlink(target_name DESTINATION destination [COMPONENT component]) +# +# This command installs the TARGET_NAME JNI symlinks to the given +# DESTINATION. It should be called in the same scope as add_jar() or it +# will fail. +# +# :: +# +# create_javadoc( +# PACKAGES pkg1 [pkg2 ...] +# [SOURCEPATH ] +# [CLASSPATH ] +# [INSTALLPATH ] +# [DOCTITLE "the documentation title"] +# [WINDOWTITLE "the title of the document"] +# [AUTHOR TRUE|FALSE] +# [USE TRUE|FALSE] +# [VERSION TRUE|FALSE] +# ) +# +# Create java documentation based on files or packages. For more +# details please read the javadoc manpage. +# +# There are two main signatures for create_javadoc. The first signature +# works with package names on a path with source files: +# +# :: +# +# Example: +# create_javadoc(my_example_doc +# PACKAGES com.exmaple.foo com.example.bar +# SOURCEPATH "${CMAKE_CURRENT_SOURCE_DIR}" +# CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH} +# WINDOWTITLE "My example" +# DOCTITLE "

My example

" +# AUTHOR TRUE +# USE TRUE +# VERSION TRUE +# ) +# +# +# +# The second signature for create_javadoc works on a given list of +# files. +# +# :: +# +# create_javadoc( +# FILES file1 [file2 ...] +# [CLASSPATH ] +# [INSTALLPATH ] +# [DOCTITLE "the documentation title"] +# [WINDOWTITLE "the title of the document"] +# [AUTHOR TRUE|FALSE] +# [USE TRUE|FALSE] +# [VERSION TRUE|FALSE] +# ) +# +# +# +# Example: +# +# :: +# +# create_javadoc(my_example_doc +# FILES ${example_SRCS} +# CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH} +# WINDOWTITLE "My example" +# DOCTITLE "

My example

" +# AUTHOR TRUE +# USE TRUE +# VERSION TRUE +# ) +# +# +# +# Both signatures share most of the options. These options are the same +# as what you can find in the javadoc manpage. Please look at the +# manpage for CLASSPATH, DOCTITLE, WINDOWTITLE, AUTHOR, USE and VERSION. +# +# The documentation will be by default installed to +# +# :: +# +# ${CMAKE_INSTALL_PREFIX}/share/javadoc/ +# +# +# +# if you don't set the INSTALLPATH. +# +# :: +# +# create_javah(TARGET +# GENERATED_FILES +# CLASSES ... +# [CLASSPATH ...] +# [DEPENDS ...] +# [OUTPUT_NAME |OUTPUT_DIR ] +# ) +# +# Create C header files from java classes. These files provide the connective glue +# that allow your Java and C code to interact. +# +# There are two main signatures for create_javah. The first signature +# returns generated files throught variable specified by GENERATED_FILES option: +# +# :: +# +# Example: +# Create_javah(GENERATED_FILES files_headers +# CLASSES org.cmake.HelloWorld +# CLASSPATH hello.jar +# ) +# +# +# +# The second signature for create_javah creates a target which encapsulates +# header files generation. +# +# :: +# +# Example: +# Create_javah(TARGET target_headers +# CLASSES org.cmake.HelloWorld +# CLASSPATH hello.jar +# ) +# +# +# +# Both signatures share same options. +# +# ``CLASSES ...`` +# Specifies Java classes used to generate headers. +# +# ``CLASSPATH ...`` +# Specifies various paths to look up classes. Here .class files, jar files or targets +# created by command add_jar can be used. +# +# ``DEPENDS ...`` +# Targets on which the javah target depends +# +# ``OUTPUT_NAME `` +# Concatenates the resulting header files for all the classes listed by option CLASSES +# into . Same behavior as option '-o' of javah tool. +# +# ``OUTPUT_DIR `` +# Sets the directory where the header files will be generated. Same behavior as option +# '-d' of javah tool. If not specified, ${CMAKE_CURRENT_BINARY_DIR} is used as output directory. + +#============================================================================= +# Copyright 2013 OpenGamma Ltd. +# Copyright 2010-2011 Andreas schneider +# Copyright 2010-2013 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +include(CMakeParseArguments) + +function (__java_copy_file src dest comment) + add_custom_command( + OUTPUT ${dest} + COMMAND cmake -E copy_if_different + ARGS ${src} + ${dest} + DEPENDS ${src} + COMMENT ${comment}) +endfunction () + +# define helper scripts +set(_JAVA_CLASS_FILELIST_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaClassFilelist.cmake) +set(_JAVA_SYMLINK_SCRIPT ${CMAKE_CURRENT_LIST_DIR}/UseJavaSymlinks.cmake) + +function(add_jar _TARGET_NAME) + + cmake_parse_arguments(_add_jar + "" + "VERSION;OUTPUT_DIR;OUTPUT_NAME;ENTRY_POINT;MANIFEST" + "SOURCES;INCLUDE_JARS" + ${ARGN} + ) + + # In CMake < 2.8.12, add_jar used variables which were set prior to calling + # add_jar for customizing the behavior of add_jar. In order to be backwards + # compatible, check if any of those variables are set, and use them to + # initialize values of the named arguments. (Giving the corresponding named + # argument will override the value set here.) + # + # New features should use named arguments only. + if(NOT DEFINED _add_jar_VERSION AND DEFINED CMAKE_JAVA_TARGET_VERSION) + set(_add_jar_VERSION "${CMAKE_JAVA_TARGET_VERSION}") + endif() + if(NOT DEFINED _add_jar_OUTPUT_DIR AND DEFINED CMAKE_JAVA_TARGET_OUTPUT_DIR) + set(_add_jar_OUTPUT_DIR "${CMAKE_JAVA_TARGET_OUTPUT_DIR}") + endif() + if(NOT DEFINED _add_jar_OUTPUT_NAME AND DEFINED CMAKE_JAVA_TARGET_OUTPUT_NAME) + set(_add_jar_OUTPUT_NAME "${CMAKE_JAVA_TARGET_OUTPUT_NAME}") + # reset + set(CMAKE_JAVA_TARGET_OUTPUT_NAME) + endif() + if(NOT DEFINED _add_jar_ENTRY_POINT AND DEFINED CMAKE_JAVA_JAR_ENTRY_POINT) + set(_add_jar_ENTRY_POINT "${CMAKE_JAVA_JAR_ENTRY_POINT}") + endif() + + set(_JAVA_SOURCE_FILES ${_add_jar_SOURCES} ${_add_jar_UNPARSED_ARGUMENTS}) + + if (NOT DEFINED _add_jar_OUTPUT_DIR) + set(_add_jar_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}) + endif() + + if (_add_jar_ENTRY_POINT) + set(_ENTRY_POINT_OPTION e) + set(_ENTRY_POINT_VALUE ${_add_jar_ENTRY_POINT}) + endif () + + if (_add_jar_MANIFEST) + set(_MANIFEST_OPTION m) + set(_MANIFEST_VALUE ${_add_jar_MANIFEST}) + endif () + + if (LIBRARY_OUTPUT_PATH) + set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${LIBRARY_OUTPUT_PATH}) + else () + set(CMAKE_JAVA_LIBRARY_OUTPUT_PATH ${_add_jar_OUTPUT_DIR}) + endif () + + set(CMAKE_JAVA_INCLUDE_PATH + ${CMAKE_JAVA_INCLUDE_PATH} + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_JAVA_OBJECT_OUTPUT_PATH} + ${CMAKE_JAVA_LIBRARY_OUTPUT_PATH} + ) + + if (CMAKE_HOST_WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") + set(CMAKE_JAVA_INCLUDE_FLAG_SEP ";") + else () + set(CMAKE_JAVA_INCLUDE_FLAG_SEP ":") + endif() + + foreach (JAVA_INCLUDE_DIR ${CMAKE_JAVA_INCLUDE_PATH}) + set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}") + endforeach() + + set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${_add_jar_OUTPUT_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir") + + set(_JAVA_TARGET_OUTPUT_NAME "${_TARGET_NAME}.jar") + if (_add_jar_OUTPUT_NAME AND _add_jar_VERSION) + set(_JAVA_TARGET_OUTPUT_NAME "${_add_jar_OUTPUT_NAME}-${_add_jar_VERSION}.jar") + set(_JAVA_TARGET_OUTPUT_LINK "${_add_jar_OUTPUT_NAME}.jar") + elseif (_add_jar_VERSION) + set(_JAVA_TARGET_OUTPUT_NAME "${_TARGET_NAME}-${_add_jar_VERSION}.jar") + set(_JAVA_TARGET_OUTPUT_LINK "${_TARGET_NAME}.jar") + elseif (_add_jar_OUTPUT_NAME) + set(_JAVA_TARGET_OUTPUT_NAME "${_add_jar_OUTPUT_NAME}.jar") + endif () + + set(_JAVA_CLASS_FILES) + set(_JAVA_COMPILE_FILES) + set(_JAVA_COMPILE_FILELISTS) + set(_JAVA_DEPENDS) + set(_JAVA_COMPILE_DEPENDS) + set(_JAVA_RESOURCE_FILES) + set(_JAVA_RESOURCE_FILES_RELATIVE) + foreach(_JAVA_SOURCE_FILE ${_JAVA_SOURCE_FILES}) + get_filename_component(_JAVA_EXT ${_JAVA_SOURCE_FILE} EXT) + get_filename_component(_JAVA_FILE ${_JAVA_SOURCE_FILE} NAME_WE) + get_filename_component(_JAVA_PATH ${_JAVA_SOURCE_FILE} PATH) + get_filename_component(_JAVA_FULL ${_JAVA_SOURCE_FILE} ABSOLUTE) + + if (_JAVA_SOURCE_FILE MATCHES "^@(.+)$") + get_filename_component(_JAVA_FULL ${CMAKE_MATCH_1} ABSOLUTE) + list(APPEND _JAVA_COMPILE_FILELISTS ${_JAVA_FULL}) + + elseif (_JAVA_EXT MATCHES ".java") + file(RELATIVE_PATH _JAVA_REL_BINARY_PATH ${_add_jar_OUTPUT_DIR} ${_JAVA_FULL}) + file(RELATIVE_PATH _JAVA_REL_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${_JAVA_FULL}) + string(LENGTH ${_JAVA_REL_BINARY_PATH} _BIN_LEN) + string(LENGTH ${_JAVA_REL_SOURCE_PATH} _SRC_LEN) + if (${_BIN_LEN} LESS ${_SRC_LEN}) + set(_JAVA_REL_PATH ${_JAVA_REL_BINARY_PATH}) + else () + set(_JAVA_REL_PATH ${_JAVA_REL_SOURCE_PATH}) + endif () + get_filename_component(_JAVA_REL_PATH ${_JAVA_REL_PATH} PATH) + + list(APPEND _JAVA_COMPILE_FILES ${_JAVA_SOURCE_FILE}) + set(_JAVA_CLASS_FILE "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_REL_PATH}/${_JAVA_FILE}.class") + set(_JAVA_CLASS_FILES ${_JAVA_CLASS_FILES} ${_JAVA_CLASS_FILE}) + + elseif (_JAVA_EXT MATCHES ".jar" + OR _JAVA_EXT MATCHES ".war" + OR _JAVA_EXT MATCHES ".ear" + OR _JAVA_EXT MATCHES ".sar") + # Ignored for backward compatibility + + elseif (_JAVA_EXT STREQUAL "") + list(APPEND CMAKE_JAVA_INCLUDE_PATH ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}} ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}_CLASSPATH}) + list(APPEND _JAVA_DEPENDS ${JAVA_JAR_TARGET_${_JAVA_SOURCE_FILE}}) + + else () + __java_copy_file(${CMAKE_CURRENT_SOURCE_DIR}/${_JAVA_SOURCE_FILE} + ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_SOURCE_FILE} + "Copying ${_JAVA_SOURCE_FILE} to the build directory") + list(APPEND _JAVA_RESOURCE_FILES ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${_JAVA_SOURCE_FILE}) + list(APPEND _JAVA_RESOURCE_FILES_RELATIVE ${_JAVA_SOURCE_FILE}) + endif () + endforeach() + + foreach(_JAVA_INCLUDE_JAR ${_add_jar_INCLUDE_JARS}) + if (TARGET ${_JAVA_INCLUDE_JAR}) + get_target_property(_JAVA_JAR_PATH ${_JAVA_INCLUDE_JAR} JAR_FILE) + if (_JAVA_JAR_PATH) + set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_JAR_PATH}") + list(APPEND CMAKE_JAVA_INCLUDE_PATH ${_JAVA_JAR_PATH}) + list(APPEND _JAVA_DEPENDS ${_JAVA_INCLUDE_JAR}) + list(APPEND _JAVA_COMPILE_DEPENDS ${_JAVA_INCLUDE_JAR}) + else () + message(SEND_ERROR "add_jar: INCLUDE_JARS target ${_JAVA_INCLUDE_JAR} is not a jar") + endif () + else () + set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_INCLUDE_JAR}") + list(APPEND CMAKE_JAVA_INCLUDE_PATH "${_JAVA_INCLUDE_JAR}") + list(APPEND _JAVA_DEPENDS "${_JAVA_INCLUDE_JAR}") + list(APPEND _JAVA_COMPILE_DEPENDS "${_JAVA_INCLUDE_JAR}") + endif () + endforeach() + + # create an empty java_class_filelist + if (NOT EXISTS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist) + file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist "") + endif() + + if (_JAVA_COMPILE_FILES OR _JAVA_COMPILE_FILELISTS) + set (_JAVA_SOURCES_FILELISTS) + + if (_JAVA_COMPILE_FILES) + # Create the list of files to compile. + set(_JAVA_SOURCES_FILE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_sources) + string(REPLACE ";" "\"\n\"" _JAVA_COMPILE_STRING "\"${_JAVA_COMPILE_FILES}\"") + file(WRITE ${_JAVA_SOURCES_FILE} ${_JAVA_COMPILE_STRING}) + list (APPEND _JAVA_SOURCES_FILELISTS "@${_JAVA_SOURCES_FILE}") + endif() + if (_JAVA_COMPILE_FILELISTS) + foreach (_JAVA_FILELIST IN LISTS _JAVA_COMPILE_FILELISTS) + list (APPEND _JAVA_SOURCES_FILELISTS "@${_JAVA_FILELIST}") + endforeach() + endif() + + # Compile the java files and create a list of class files + add_custom_command( + # NOTE: this command generates an artificial dependency file + OUTPUT ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME} + COMMAND ${Java_JAVAC_EXECUTABLE} + ${CMAKE_JAVA_COMPILE_FLAGS} + -classpath "${CMAKE_JAVA_INCLUDE_PATH_FINAL}" + -d ${CMAKE_JAVA_CLASS_OUTPUT_PATH} + ${_JAVA_SOURCES_FILELISTS} + COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME} + DEPENDS ${_JAVA_COMPILE_FILES} ${_JAVA_COMPILE_FILELISTS} ${_JAVA_COMPILE_DEPENDS} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMENT "Building Java objects for ${_TARGET_NAME}.jar" + ) + add_custom_command( + OUTPUT ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist + COMMAND ${CMAKE_COMMAND} + -DCMAKE_JAVA_CLASS_OUTPUT_PATH=${CMAKE_JAVA_CLASS_OUTPUT_PATH} + -DCMAKE_JAR_CLASSES_PREFIX="${CMAKE_JAR_CLASSES_PREFIX}" + -P ${_JAVA_CLASS_FILELIST_SCRIPT} + DEPENDS ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_compiled_${_TARGET_NAME} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) + endif () + + # create the jar file + set(_JAVA_JAR_OUTPUT_PATH + ${_add_jar_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_NAME}) + if (CMAKE_JNI_TARGET) + add_custom_command( + OUTPUT ${_JAVA_JAR_OUTPUT_PATH} + COMMAND ${Java_JAR_EXECUTABLE} + -cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE} + ${_JAVA_RESOURCE_FILES_RELATIVE} @java_class_filelist + COMMAND ${CMAKE_COMMAND} + -D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR} + -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME} + -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK} + -P ${_JAVA_SYMLINK_SCRIPT} + COMMAND ${CMAKE_COMMAND} + -D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR} + -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_JAR_OUTPUT_PATH} + -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK} + -P ${_JAVA_SYMLINK_SCRIPT} + DEPENDS ${_JAVA_RESOURCE_FILES} ${_JAVA_DEPENDS} ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist + WORKING_DIRECTORY ${CMAKE_JAVA_CLASS_OUTPUT_PATH} + COMMENT "Creating Java archive ${_JAVA_TARGET_OUTPUT_NAME}" + ) + else () + add_custom_command( + OUTPUT ${_JAVA_JAR_OUTPUT_PATH} + COMMAND ${Java_JAR_EXECUTABLE} + -cf${_ENTRY_POINT_OPTION}${_MANIFEST_OPTION} ${_JAVA_JAR_OUTPUT_PATH} ${_ENTRY_POINT_VALUE} ${_MANIFEST_VALUE} + ${_JAVA_RESOURCE_FILES_RELATIVE} @java_class_filelist + COMMAND ${CMAKE_COMMAND} + -D_JAVA_TARGET_DIR=${_add_jar_OUTPUT_DIR} + -D_JAVA_TARGET_OUTPUT_NAME=${_JAVA_TARGET_OUTPUT_NAME} + -D_JAVA_TARGET_OUTPUT_LINK=${_JAVA_TARGET_OUTPUT_LINK} + -P ${_JAVA_SYMLINK_SCRIPT} + WORKING_DIRECTORY ${CMAKE_JAVA_CLASS_OUTPUT_PATH} + DEPENDS ${_JAVA_RESOURCE_FILES} ${_JAVA_DEPENDS} ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist + COMMENT "Creating Java archive ${_JAVA_TARGET_OUTPUT_NAME}" + ) + endif () + + # Add the target and make sure we have the latest resource files. + add_custom_target(${_TARGET_NAME} ALL DEPENDS ${_JAVA_JAR_OUTPUT_PATH}) + + set_property( + TARGET + ${_TARGET_NAME} + PROPERTY + INSTALL_FILES + ${_JAVA_JAR_OUTPUT_PATH} + ) + + if (_JAVA_TARGET_OUTPUT_LINK) + set_property( + TARGET + ${_TARGET_NAME} + PROPERTY + INSTALL_FILES + ${_JAVA_JAR_OUTPUT_PATH} + ${_add_jar_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_LINK} + ) + + if (CMAKE_JNI_TARGET) + set_property( + TARGET + ${_TARGET_NAME} + PROPERTY + JNI_SYMLINK + ${_add_jar_OUTPUT_DIR}/${_JAVA_TARGET_OUTPUT_LINK} + ) + endif () + endif () + + set_property( + TARGET + ${_TARGET_NAME} + PROPERTY + JAR_FILE + ${_JAVA_JAR_OUTPUT_PATH} + ) + + set_property( + TARGET + ${_TARGET_NAME} + PROPERTY + CLASSDIR + ${CMAKE_JAVA_CLASS_OUTPUT_PATH} + ) + +endfunction() + +function(INSTALL_JAR _TARGET_NAME) + if (ARGC EQUAL 2) + set (_DESTINATION ${ARGV1}) + else() + cmake_parse_arguments(_install_jar + "" + "DESTINATION;COMPONENT" + "" + ${ARGN}) + if (_install_jar_DESTINATION) + set (_DESTINATION ${_install_jar_DESTINATION}) + else() + message(SEND_ERROR "install_jar: ${_TARGET_NAME}: DESTINATION must be specified.") + endif() + + if (_install_jar_COMPONENT) + set (_COMPONENT COMPONENT ${_install_jar_COMPONENT}) + endif() + endif() + + get_property(__FILES + TARGET + ${_TARGET_NAME} + PROPERTY + INSTALL_FILES + ) + + if (__FILES) + install( + FILES + ${__FILES} + DESTINATION + ${_DESTINATION} + ${_COMPONENT} + ) + else () + message(SEND_ERROR "install_jar: The target ${_TARGET_NAME} is not known in this scope.") + endif () +endfunction() + +function(INSTALL_JNI_SYMLINK _TARGET_NAME) + if (ARGC EQUAL 2) + set (_DESTINATION ${ARGV1}) + else() + cmake_parse_arguments(_install_jni_symlink + "" + "DESTINATION;COMPONENT" + "" + ${ARGN}) + if (_install_jni_symlink_DESTINATION) + set (_DESTINATION ${_install_jni_symlink_DESTINATION}) + else() + message(SEND_ERROR "install_jni_symlink: ${_TARGET_NAME}: DESTINATION must be specified.") + endif() + + if (_install_jni_symlink_COMPONENT) + set (_COMPONENT COMPONENT ${_install_jni_symlink_COMPONENT}) + endif() + endif() + + get_property(__SYMLINK + TARGET + ${_TARGET_NAME} + PROPERTY + JNI_SYMLINK + ) + + if (__SYMLINK) + install( + FILES + ${__SYMLINK} + DESTINATION + ${_DESTINATION} + ${_COMPONENT} + ) + else () + message(SEND_ERROR "install_jni_symlink: The target ${_TARGET_NAME} is not known in this scope.") + endif () +endfunction() + +function (find_jar VARIABLE) + set(_jar_names) + set(_jar_files) + set(_jar_versions) + set(_jar_paths + /usr/share/java/ + /usr/local/share/java/ + ${Java_JAR_PATHS}) + set(_jar_doc "NOTSET") + + set(_state "name") + + foreach (arg ${ARGN}) + if (${_state} STREQUAL "name") + if (${arg} STREQUAL "VERSIONS") + set(_state "versions") + elseif (${arg} STREQUAL "NAMES") + set(_state "names") + elseif (${arg} STREQUAL "PATHS") + set(_state "paths") + elseif (${arg} STREQUAL "DOC") + set(_state "doc") + else () + set(_jar_names ${arg}) + if (_jar_doc STREQUAL "NOTSET") + set(_jar_doc "Finding ${arg} jar") + endif () + endif () + elseif (${_state} STREQUAL "versions") + if (${arg} STREQUAL "NAMES") + set(_state "names") + elseif (${arg} STREQUAL "PATHS") + set(_state "paths") + elseif (${arg} STREQUAL "DOC") + set(_state "doc") + else () + set(_jar_versions ${_jar_versions} ${arg}) + endif () + elseif (${_state} STREQUAL "names") + if (${arg} STREQUAL "VERSIONS") + set(_state "versions") + elseif (${arg} STREQUAL "PATHS") + set(_state "paths") + elseif (${arg} STREQUAL "DOC") + set(_state "doc") + else () + set(_jar_names ${_jar_names} ${arg}) + if (_jar_doc STREQUAL "NOTSET") + set(_jar_doc "Finding ${arg} jar") + endif () + endif () + elseif (${_state} STREQUAL "paths") + if (${arg} STREQUAL "VERSIONS") + set(_state "versions") + elseif (${arg} STREQUAL "NAMES") + set(_state "names") + elseif (${arg} STREQUAL "DOC") + set(_state "doc") + else () + set(_jar_paths ${_jar_paths} ${arg}) + endif () + elseif (${_state} STREQUAL "doc") + if (${arg} STREQUAL "VERSIONS") + set(_state "versions") + elseif (${arg} STREQUAL "NAMES") + set(_state "names") + elseif (${arg} STREQUAL "PATHS") + set(_state "paths") + else () + set(_jar_doc ${arg}) + endif () + endif () + endforeach () + + if (NOT _jar_names) + message(FATAL_ERROR "find_jar: No name to search for given") + endif () + + foreach (jar_name ${_jar_names}) + foreach (version ${_jar_versions}) + set(_jar_files ${_jar_files} ${jar_name}-${version}.jar) + endforeach () + set(_jar_files ${_jar_files} ${jar_name}.jar) + endforeach () + + find_file(${VARIABLE} + NAMES ${_jar_files} + PATHS ${_jar_paths} + DOC ${_jar_doc} + NO_DEFAULT_PATH) +endfunction () + +function(create_javadoc _target) + set(_javadoc_packages) + set(_javadoc_files) + set(_javadoc_sourcepath) + set(_javadoc_classpath) + set(_javadoc_installpath "${CMAKE_INSTALL_PREFIX}/share/javadoc") + set(_javadoc_doctitle) + set(_javadoc_windowtitle) + set(_javadoc_author FALSE) + set(_javadoc_version FALSE) + set(_javadoc_use FALSE) + + set(_state "package") + + foreach (arg ${ARGN}) + if (${_state} STREQUAL "package") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + set(_javadoc_packages ${arg}) + set(_state "packages") + endif () + elseif (${_state} STREQUAL "packages") + if (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + list(APPEND _javadoc_packages ${arg}) + endif () + elseif (${_state} STREQUAL "files") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + list(APPEND _javadoc_files ${arg}) + endif () + elseif (${_state} STREQUAL "sourcepath") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + list(APPEND _javadoc_sourcepath ${arg}) + endif () + elseif (${_state} STREQUAL "classpath") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + list(APPEND _javadoc_classpath ${arg}) + endif () + elseif (${_state} STREQUAL "installpath") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + set(_javadoc_installpath ${arg}) + endif () + elseif (${_state} STREQUAL "doctitle") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + set(_javadoc_doctitle ${arg}) + endif () + elseif (${_state} STREQUAL "windowtitle") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + set(_javadoc_windowtitle ${arg}) + endif () + elseif (${_state} STREQUAL "author") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + set(_javadoc_author ${arg}) + endif () + elseif (${_state} STREQUAL "use") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + set(_javadoc_use ${arg}) + endif () + elseif (${_state} STREQUAL "version") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + set(_javadoc_version ${arg}) + endif () + endif () + endforeach () + + set(_javadoc_builddir ${CMAKE_CURRENT_BINARY_DIR}/javadoc/${_target}) + set(_javadoc_options -d ${_javadoc_builddir}) + + if (_javadoc_sourcepath) + set(_start TRUE) + foreach(_path ${_javadoc_sourcepath}) + if (_start) + set(_sourcepath ${_path}) + set(_start FALSE) + else () + set(_sourcepath ${_sourcepath}:${_path}) + endif () + endforeach() + set(_javadoc_options ${_javadoc_options} -sourcepath ${_sourcepath}) + endif () + + if (_javadoc_classpath) + set(_start TRUE) + foreach(_path ${_javadoc_classpath}) + if (_start) + set(_classpath ${_path}) + set(_start FALSE) + else () + set(_classpath ${_classpath}:${_path}) + endif () + endforeach() + set(_javadoc_options ${_javadoc_options} -classpath "${_classpath}") + endif () + + if (_javadoc_doctitle) + set(_javadoc_options ${_javadoc_options} -doctitle '${_javadoc_doctitle}') + endif () + + if (_javadoc_windowtitle) + set(_javadoc_options ${_javadoc_options} -windowtitle '${_javadoc_windowtitle}') + endif () + + if (_javadoc_author) + set(_javadoc_options ${_javadoc_options} -author) + endif () + + if (_javadoc_use) + set(_javadoc_options ${_javadoc_options} -use) + endif () + + if (_javadoc_version) + set(_javadoc_options ${_javadoc_options} -version) + endif () + + add_custom_target(${_target}_javadoc ALL + COMMAND ${Java_JAVADOC_EXECUTABLE} ${_javadoc_options} + ${_javadoc_files} + ${_javadoc_packages} + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) + + install( + DIRECTORY ${_javadoc_builddir} + DESTINATION ${_javadoc_installpath} + ) +endfunction() + +function (create_javah) + cmake_parse_arguments(_create_javah + "" + "TARGET;GENERATED_FILES;OUTPUT_NAME;OUTPUT_DIR" + "CLASSES;CLASSPATH;DEPENDS" + ${ARGN}) + + # ckeck parameters + if (NOT _create_javah_TARGET AND NOT _create_javah_GENERATED_FILES) + message (FATAL_ERROR "create_javah: TARGET or GENERATED_FILES must be specified.") + endif() + if (_create_javah_OUTPUT_NAME AND _create_javah_OUTPUT_DIR) + message (FATAL_ERROR "create_javah: OUTPUT_NAME and OUTPUT_DIR are mutually exclusive.") + endif() + + if (NOT _create_javah_CLASSES) + message (FATAL_ERROR "create_javah: CLASSES is a required parameter.") + endif() + + set (_output_files) + if (WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") + set(_classpath_sep ";") + else () + set(_classpath_sep ":") + endif() + + # handle javah options + set (_javah_options) + + if (_create_javah_CLASSPATH) + # CLASSPATH can specify directories, jar files or targets created with add_jar command + set (_classpath) + foreach (_path IN LISTS _create_javah_CLASSPATH) + if (TARGET ${_path}) + get_target_property (_jar_path ${_path} JAR_FILE) + if (_jar_path) + list (APPEND _classpath "${_jar_path}") + list (APPEND _create_javah_DEPENDS "${_path}") + else() + message(SEND_ERROR "create_javah: CLASSPATH target ${_path} is not a jar.") + endif() + elseif (EXISTS "${_path}") + list (APPEND _classpath "${_path}") + if (NOT IS_DIRECTORY "${_path}") + list (APPEND _create_javah_DEPENDS "${_path}") + endif() + else() + message(SEND_ERROR "create_javah: CLASSPATH entry ${_path} does not exist.") + endif() + endforeach() + string (REPLACE ";" "${_classpath_sep}" _classpath "${_classpath}") + list (APPEND _javah_options -classpath ${_classpath}) + endif() + + if (_create_javah_OUTPUT_DIR) + list (APPEND _javah_options -d "${_create_javah_OUTPUT_DIR}") + endif() + + if (_create_javah_OUTPUT_NAME) + list (APPEND _javah_options -o "${_create_javah_OUTPUT_NAME}") + set (_output_files "${_create_javah_OUTPUT_NAME}") + + get_filename_component (_create_javah_OUTPUT_DIR "${_create_javah_OUTPUT_NAME}" DIRECTORY) + get_filename_component (_create_javah_OUTPUT_DIR "${_create_javah_OUTPUT_DIR}" ABSOLUTE) + endif() + + if (NOT _create_javah_OUTPUT_DIR) + set (_create_javah_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}") + endif() + + if (NOT _create_javah_OUTPUT_NAME) + # compute output names + foreach (_class IN LISTS _create_javah_CLASSES) + string (REPLACE "." "_" _c_header "${_class}") + set (_c_header "${_create_javah_OUTPUT_DIR}/${_c_header}.h") + list (APPEND _output_files "${_c_header}") + endforeach() + endif() + + # finalize custom command arguments + if (_create_javah_DEPENDS) + list (INSERT _create_javah_DEPENDS 0 DEPENDS) + endif() + + add_custom_command (OUTPUT ${_output_files} + COMMAND "${Java_JAVAH_EXECUTABLE}" ${_javah_options} -jni ${_create_javah_CLASSES} + ${_create_javah_DEPENDS} + WORKING_DIRECTORY ${_create_javah_OUTPUT_DIR} + COMMENT "Building C header files from classes...") + + if (_create_javah_TARGET) + add_custom_target (${_create_javah_TARGET} ALL DEPENDS ${_output_files}) + endif() + if (_create_javah_GENERATED_FILES) + set (${_create_javah_GENERATED_FILES} ${_output_files} PARENT_SCOPE) + endif() +endfunction() diff --git a/config/cmake/UseJavaClassFilelist.cmake b/config/cmake/UseJavaClassFilelist.cmake new file mode 100644 index 0000000..e8e6f01 --- /dev/null +++ b/config/cmake/UseJavaClassFilelist.cmake @@ -0,0 +1,58 @@ +#.rst: +# UseJavaClassFilelist +# -------------------- +# +# +# +# +# +# This script create a list of compiled Java class files to be added to +# a jar file. This avoids including cmake files which get created in +# the binary directory. + +#============================================================================= +# Copyright 2010-2011 Andreas schneider +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +if (CMAKE_JAVA_CLASS_OUTPUT_PATH) + if (EXISTS "${CMAKE_JAVA_CLASS_OUTPUT_PATH}") + + set(_JAVA_GLOBBED_FILES) + if (CMAKE_JAR_CLASSES_PREFIX) + foreach(JAR_CLASS_PREFIX ${CMAKE_JAR_CLASSES_PREFIX}) + message(STATUS "JAR_CLASS_PREFIX: ${JAR_CLASS_PREFIX}") + + file(GLOB_RECURSE _JAVA_GLOBBED_TMP_FILES "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/${JAR_CLASS_PREFIX}/*.class") + if (_JAVA_GLOBBED_TMP_FILES) + list(APPEND _JAVA_GLOBBED_FILES ${_JAVA_GLOBBED_TMP_FILES}) + endif () + endforeach() + else() + file(GLOB_RECURSE _JAVA_GLOBBED_FILES "${CMAKE_JAVA_CLASS_OUTPUT_PATH}/*.class") + endif () + + set(_JAVA_CLASS_FILES) + # file(GLOB_RECURSE foo RELATIVE) is broken so we need this. + foreach(_JAVA_GLOBBED_FILE ${_JAVA_GLOBBED_FILES}) + file(RELATIVE_PATH _JAVA_CLASS_FILE ${CMAKE_JAVA_CLASS_OUTPUT_PATH} ${_JAVA_GLOBBED_FILE}) + set(_JAVA_CLASS_FILES ${_JAVA_CLASS_FILES}${_JAVA_CLASS_FILE}\n) + endforeach() + + # write to file + file(WRITE ${CMAKE_JAVA_CLASS_OUTPUT_PATH}/java_class_filelist ${_JAVA_CLASS_FILES}) + + else () + message(SEND_ERROR "FATAL: Java class output path doesn't exist") + endif () +else () + message(SEND_ERROR "FATAL: Can't find CMAKE_JAVA_CLASS_OUTPUT_PATH") +endif () diff --git a/config/cmake/UseJavaSymlinks.cmake b/config/cmake/UseJavaSymlinks.cmake new file mode 100644 index 0000000..90ffdd5 --- /dev/null +++ b/config/cmake/UseJavaSymlinks.cmake @@ -0,0 +1,38 @@ +#.rst: +# UseJavaSymlinks +# --------------- +# +# +# +# +# +# Helper script for UseJava.cmake + +#============================================================================= +# Copyright 2010-2011 Andreas schneider +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +if (UNIX AND _JAVA_TARGET_OUTPUT_LINK) + if (_JAVA_TARGET_OUTPUT_NAME) + find_program(LN_EXECUTABLE + NAMES + ln + ) + + execute_process( + COMMAND ${LN_EXECUTABLE} -sf "${_JAVA_TARGET_OUTPUT_NAME}" "${_JAVA_TARGET_OUTPUT_LINK}" + WORKING_DIRECTORY ${_JAVA_TARGET_DIR} + ) + else () + message(SEND_ERROR "FATAL: Can't find _JAVA_TARGET_OUTPUT_NAME") + endif () +endif () diff --git a/config/cmake/hdf5-config.cmake.in b/config/cmake/hdf5-config.cmake.in index 3577e40..3f95d76 100644 --- a/config/cmake/hdf5-config.cmake.in +++ b/config/cmake/hdf5-config.cmake.in @@ -14,6 +14,7 @@ set (${HDF5_PACKAGE_NAME}_VALID_COMPONENTS HL CXX_HL Fortran_HL + Java Tools ) @@ -23,6 +24,7 @@ set (${HDF5_PACKAGE_NAME}_VALID_COMPONENTS set (${HDF5_PACKAGE_NAME}_ENABLE_PARALLEL @HDF5_ENABLE_PARALLEL@) set (${HDF5_PACKAGE_NAME}_BUILD_FORTRAN @HDF5_BUILD_FORTRAN@) set (${HDF5_PACKAGE_NAME}_BUILD_CPP_LIB @HDF5_BUILD_CPP_LIB@) +set (${HDF5_PACKAGE_NAME}_BUILD_JAVA @HDF5_BUILD_JAVA@) set (${HDF5_PACKAGE_NAME}_BUILD_TOOLS @HDF5_BUILD_TOOLS@) set (${HDF5_PACKAGE_NAME}_BUILD_HL_LIB @HDF5_BUILD_HL_LIB@) set (${HDF5_PACKAGE_NAME}_ENABLE_Z_LIB_SUPPORT @HDF5_ENABLE_Z_LIB_SUPPORT@) @@ -40,6 +42,16 @@ if (${HDF5_PACKAGE_NAME}_ENABLE_PARALLEL) set (${HDF5_PACKAGE_NAME}_MPI_C_LIBRARIES "@MPI_C_LIBRARIES@") endif () +if (${HDF5_PACKAGE_NAME}_BUILD_JAVA) + set (${HDF5_PACKAGE_NAME}_JAVA_INCLUDE_DIRS + @PACKAGE_CURRENT_BUILD_DIR@/lib/jarhdf5-@HDF5_VERSION_STRING@.jar + @PACKAGE_CURRENT_BUILD_DIR@/lib/slf4j-api-1.7.5.jar + @PACKAGE_CURRENT_BUILD_DIR@/lib/slf4j-nop-1.7.5.jar + ) + set (${HDF5_PACKAGE_NAME}_JAVA_LIBRARY "@PACKAGE_CURRENT_BUILD_DIR@/lib") + set (${HDF5_PACKAGE_NAME}_JAVA_LIBRARIES "${${HDF5_PACKAGE_NAME}_JAVA_LIBRARY}") +endif() + #----------------------------------------------------------------------------- # Directories #----------------------------------------------------------------------------- @@ -123,6 +135,8 @@ foreach (libtype IN LISTS ${HDF5_PACKAGE_NAME}_LIB_TYPE) set (hdf5_comp "hdf5_hl") elseif (${comp} STREQUAL "CXX_HL") set (hdf5_comp "hdf5_hl_cpp") + elseif (${comp} STREQUAL "Java") + set (hdf5_comp "hdf5_java") elseif (${comp} STREQUAL "Tools") set (hdf5_comp "hdf5_tools") elseif (${comp} STREQUAL "Fortran") diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake new file mode 100644 index 0000000..7a92867 --- /dev/null +++ b/config/cmake/jrunTest.cmake @@ -0,0 +1,212 @@ +# runTest.cmake executes a command and captures the output in a file. File is then compared +# against a reference file. Exit status of command can also be compared. +cmake_policy(SET CMP0007 NEW) + +# arguments checking +if (NOT TEST_TESTER) + message (FATAL_ERROR "Require TEST_TESTER to be defined") +endif (NOT TEST_TESTER) +if (NOT TEST_PROGRAM) + message (FATAL_ERROR "Require TEST_PROGRAM to be defined") +endif (NOT TEST_PROGRAM) +if (NOT TEST_LIBRARY_DIRECTORY) + message (STATUS "Require TEST_LIBRARY_DIRECTORY to be defined") +endif (NOT TEST_LIBRARY_DIRECTORY) +if (NOT TEST_FOLDER) + message ( FATAL_ERROR "Require TEST_FOLDER to be defined") +endif (NOT TEST_FOLDER) +if (NOT TEST_OUTPUT) + message (FATAL_ERROR "Require TEST_OUTPUT to be defined") +endif (NOT TEST_OUTPUT) +if (NOT TEST_CLASSPATH) + message (STATUS "Require TEST_CLASSPATH to be defined") +endif (NOT TEST_CLASSPATH) +if (NOT TEST_REFERENCE) + message (FATAL_ERROR "Require TEST_REFERENCE to be defined") +endif (NOT TEST_REFERENCE) + +if (NOT TEST_ERRREF) + set (ERROR_APPEND 1) +endif (NOT TEST_ERRREF) + +if (NOT TEST_LOG_LEVEL) + set (LOG_LEVEL "info") +else (NOT TEST_LOG_LEVEL) + set (LOG_LEVEL "${TEST_LOG_LEVEL}") +endif (NOT TEST_LOG_LEVEL) + +message (STATUS "COMMAND: ${TEST_TESTER} -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=${LOG_LEVEL} -Djava.library.path=\"${TEST_LIBRARY_DIRECTORY}\" -cp \"${TEST_CLASSPATH}\" ${TEST_ARGS} ${TEST_PROGRAM} ${ARGN}") + +if (WIN32 AND NOT MINGW) + set (ENV{PATH} "$ENV{PATH}\\;${TEST_LIBRARY_DIRECTORY}") +endif (WIN32 AND NOT MINGW) + +# run the test program, capture the stdout/stderr and the result var +execute_process ( + COMMAND ${TEST_TESTER} -Xmx1024M + -Dorg.slf4j.simpleLogger.defaultLogLevel=${LOG_LEVEL} + -Djava.library.path=${TEST_LIBRARY_DIRECTORY} + -cp "${TEST_CLASSPATH}" ${TEST_ARGS} ${TEST_PROGRAM} + ${ARGN} + WORKING_DIRECTORY ${TEST_FOLDER} + RESULT_VARIABLE TEST_RESULT + OUTPUT_FILE ${TEST_OUTPUT} + ERROR_FILE ${TEST_OUTPUT}.err + ERROR_VARIABLE TEST_ERROR +) + +message (STATUS "COMMAND Result: ${TEST_RESULT}") + +if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) + file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) + if (TEST_MASK_FILE) + STRING(REGEX REPLACE "CurrentDir is [^\n]+\n" "CurrentDir is (dir name)\n" TEST_STREAM "${TEST_STREAM}") + endif (TEST_MASK_FILE) + + if (ERROR_APPEND) + file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + else (ERROR_APPEND) + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") + endif (ERROR_APPEND) +endif (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) + +if (TEST_MASK_ERROR) + if (NOT TEST_ERRREF) + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + else (NOT TEST_ERRREF) + file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) + endif (NOT TEST_ERRREF) + string (REGEX REPLACE "Time:[^\n]+\n" "Time: XXXX\n" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE " line [0-9]*" " line (number)" TEST_STREAM "${TEST_STREAM}") + #string (REGEX REPLACE "v[1-9]*[.][0-9]*[.]" "version (number)." TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "HDF5 .[1-9]*[.][0-9]*[.][0-9]*[^)]*" "HDF5 (version (number)" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") + if (NOT TEST_ERRREF) + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + else (NOT TEST_ERRREF) + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") + endif (NOT TEST_ERRREF) +endif (TEST_MASK_ERROR) + +# if the return value is !=0 bail out +if (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) + message (STATUS "ERROR OUTPUT: ${TEST_STREAM}") + message (FATAL_ERROR "Failed: Test program ${TEST_PROGRAM} exited != 0.\n${TEST_ERROR}") +endif (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) + +message (STATUS "COMMAND Error: ${TEST_ERROR}") + +if (NOT TEST_SKIP_COMPARE) + if (WIN32 AND NOT MINGW) + file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) + file (WRITE ${TEST_FOLDER}/${TEST_REFERENCE} "${TEST_STREAM}") + endif (WIN32 AND NOT MINGW) + + # now compare the output with the reference + execute_process ( + COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT} ${TEST_FOLDER}/${TEST_REFERENCE} + RESULT_VARIABLE TEST_RESULT + ) + if (NOT ${TEST_RESULT} STREQUAL 0) + set (TEST_RESULT 0) + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT} test_act) + list (LENGTH test_act len_act) + file (STRINGS ${TEST_FOLDER}/${TEST_REFERENCE} test_ref) + list (LENGTH test_ref len_ref) + if (NOT ${len_act} STREQUAL "0") + MATH (EXPR _FP_LEN "${len_ref} - 1") + foreach (line RANGE 0 ${_FP_LEN}) + list (GET test_act ${line} str_act) + list (GET test_ref ${line} str_ref) + if (NOT "${str_act}" STREQUAL "${str_ref}") + if (NOT "${str_act}" STREQUAL "") + set (TEST_RESULT 1) + message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + endif (NOT "${str_act}" STREQUAL "") + endif (NOT "${str_act}" STREQUAL "${str_ref}") + endforeach (line RANGE 0 ${_FP_LEN}) + endif (NOT ${len_act} STREQUAL "0") + if (NOT ${len_act} STREQUAL ${len_ref}) + set (TEST_RESULT 1) + endif (NOT ${len_act} STREQUAL ${len_ref}) + endif (NOT ${TEST_RESULT} STREQUAL 0) + + message (STATUS "COMPARE Result: ${TEST_RESULT}") + + # again, if return value is !=0 scream and shout + if (NOT ${TEST_RESULT} STREQUAL 0) + message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") + endif (NOT ${TEST_RESULT} STREQUAL 0) + + if (TEST_ERRREF) + if (WIN32 AND NOT MINGW) + file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) + file (WRITE ${TEST_FOLDER}/${TEST_ERRREF} "${TEST_STREAM}") + endif (WIN32 AND NOT MINGW) + + # now compare the error output with the error reference + execute_process ( + COMMAND ${CMAKE_COMMAND} -E compare_files ${TEST_FOLDER}/${TEST_OUTPUT}.err ${TEST_FOLDER}/${TEST_ERRREF} + RESULT_VARIABLE TEST_RESULT + ) + if (NOT ${TEST_RESULT} STREQUAL 0) + set (TEST_RESULT 0) + file (STRINGS ${TEST_FOLDER}/${TEST_OUTPUT}.err test_act) + list (LENGTH test_act len_act) + file (STRINGS ${TEST_FOLDER}/${TEST_ERRREF} test_ref) + list (LENGTH test_ref len_ref) + MATH (EXPR _FP_LEN "${len_ref} - 1") + if (NOT ${len_act} STREQUAL "0") + MATH (EXPR _FP_LEN "${len_ref} - 1") + foreach (line RANGE 0 ${_FP_LEN}) + list (GET test_act ${line} str_act) + list (GET test_ref ${line} str_ref) + if (NOT "${str_act}" STREQUAL "${str_ref}") + if (NOT "${str_act}" STREQUAL "") + set (TEST_RESULT 1) + message ("line = ${line}\n***ACTUAL: ${str_act}\n****REFER: ${str_ref}\n") + endif (NOT "${str_act}" STREQUAL "") + endif (NOT "${str_act}" STREQUAL "${str_ref}") + endforeach (line RANGE 0 ${_FP_LEN}) + endif (NOT ${len_act} STREQUAL "0") + if (NOT ${len_act} STREQUAL ${len_ref}) + set (TEST_RESULT 1) + endif (NOT ${len_act} STREQUAL ${len_ref}) + endif (NOT ${TEST_RESULT} STREQUAL 0) + + message (STATUS "COMPARE Result: ${TEST_RESULT}") + + # again, if return value is !=0 scream and shout + if (NOT ${TEST_RESULT} STREQUAL 0) + message (FATAL_ERROR "Failed: The error output of ${TEST_OUTPUT}.err did not match ${TEST_ERRREF}") + endif (NOT ${TEST_RESULT} STREQUAL 0) + endif (TEST_ERRREF) +endif (NOT TEST_SKIP_COMPARE) + +if (TEST_GREP_COMPARE) + # now grep the output with the reference + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + + # TEST_REFERENCE should always be matched + string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM}) + string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT) + if (${TEST_RESULT} STREQUAL "0") + message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}") + endif (${TEST_RESULT} STREQUAL "0") + + string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) + if (${TEST_EXPECT} STREQUAL "1") + # TEST_EXPECT (1) interperts TEST_FILTER as NOT to match + string (LENGTH "${TEST_MATCH}" TEST_RESULT) + if (NOT ${TEST_RESULT} STREQUAL "0") + message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") + endif (NOT ${TEST_RESULT} STREQUAL "0") + endif (${TEST_EXPECT} STREQUAL "0") +endif (TEST_GREP_COMPARE) + +# everything went fine... +message ("${TEST_PROGRAM} Passed") + diff --git a/config/cmake/libhdf5.settings.cmake.in b/config/cmake/libhdf5.settings.cmake.in index cc6ae3e..8348af0 100644 --- a/config/cmake/libhdf5.settings.cmake.in +++ b/config/cmake/libhdf5.settings.cmake.in @@ -1,43 +1,50 @@ - SUMMARY OF THE HDF5 CONFIGURATION - ================================= + SUMMARY OF THE HDF5 CONFIGURATION + ================================= General Information: ------------------- HDF5 Version: @HDF5_PACKAGE_VERSION_STRING@ Configured on: @CONFIG_DATE@ Configured by: @CMAKE_GENERATOR@ - Configure mode: CMAKE @CMAKE_VERSION@ Host system: @CMAKE_HOST_SYSTEM@ Uname information: @CMAKE_SYSTEM_NAME@ Byte sex: @BYTESEX@ - Libraries: @BUILD_NAME_EXT@ Installation point: @CMAKE_INSTALL_PREFIX@ Compiling Options: ------------------ - Compilation Mode: @CMAKE_BUILD_TYPE@ - C Compiler: @CMAKE_C_COMPILER@ - CFLAGS: @CMAKE_C_FLAGS@ - H5_CFLAGS: @H5_CFLAGS@ - AM_CFLAGS: @AM_CFLAGS@ - CPPFLAGS: @CPPFLAGS@ - H5_CPPFLAGS: @H5_CPPFLAGS@ - AM_CPPFLAGS: @AM_CPPFLAGS@ - Shared C Library: @H5_ENABLE_SHARED_LIB@ - Static C Library: @H5_ENABLE_STATIC_LIB@ + Build Mode: @CMAKE_BUILD_TYPE@ + Debugging Symbols: @SYMBOLS@ + Asserts: @ASSERTS@ + Profiling: @PROFILING@ + Optimization Level: @OPTIMIZATION@ + +Linking Options: +---------------- + Libraries: @BUILD_NAME_EXT@ Statically Linked Executables: @BUILD_STATIC_EXECS@ LDFLAGS: @CMAKE_SHARED_LINKER_FLAGS@ + H5_LDFLAGS: @H5_LDFLAGS@ AM_LDFLAGS: @AM_LDFLAGS@ Extra libraries: @LINK_LIBS@ Archiver: @CMAKE_AR@ Ranlib: @CMAKE_RANLIB@ - Debugged Packages: @DEBUG_PKG@ - API Tracing: @HDF5_ENABLE_TRACE@ Languages: ---------- + C: yes + C Compiler: @CMAKE_C_COMPILER@ @CMAKE_C_COMPILER_VERSION@ + CPPFLAGS: @CPPFLAGS@ + H5_CPPFLAGS: @H5_CPPFLAGS@ + AM_CPPFLAGS: @AM_CPPFLAGS@ + CFLAGS: @CMAKE_C_FLAGS@ + H5_CFLAGS: @H5_CFLAGS@ + AM_CFLAGS: @AM_CFLAGS@ + Shared C Library: @H5_ENABLE_SHARED_LIB@ + Static C Library: YES + Fortran: @HDF5_BUILD_FORTRAN@ -@BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Compiler: @CMAKE_Fortran_COMPILER@ +@BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Compiler: @CMAKE_Fortran_COMPILER@ @CMAKE_Fortran_COMPILER_VERSION@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Flags: @CMAKE_Fortran_FLAGS@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ H5 Fortran Flags: @H5_FCFLAGS@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ AM Fortran Flags: @AM_FCFLAGS@ @@ -45,27 +52,32 @@ Languages: @BUILD_FORTRAN_CONDITIONAL_TRUE@ Static Fortran Library: YES C++: @HDF5_BUILD_CPP_LIB@ -@BUILD_CXX_CONDITIONAL_TRUE@ C++ Compiler: @CMAKE_CXX_COMPILER@ +@BUILD_CXX_CONDITIONAL_TRUE@ C++ Compiler: @CMAKE_CXX_COMPILER@ @CMAKE_CXX_COMPILER_VERSION@ @BUILD_CXX_CONDITIONAL_TRUE@ C++ Flags: @CMAKE_CXX_FLAGS@ @BUILD_CXX_CONDITIONAL_TRUE@ H5 C++ Flags: @H5_CXXFLAGS@ @BUILD_CXX_CONDITIONAL_TRUE@ AM C++ Flags: @AM_CXXFLAGS@ @BUILD_CXX_CONDITIONAL_TRUE@ Shared C++ Library: @H5_ENABLE_SHARED_LIB@ @BUILD_CXX_CONDITIONAL_TRUE@ Static C++ Library: YES + JAVA: @HDF5_BUILD_JAVA@ +@BUILD_JAVA_CONDITIONAL_TRUE@ JAVA Compiler: @CMAKE_Java_COMPILER@ @Java_VERSION@ + Features: --------- Parallel HDF5: @HDF5_ENABLE_PARALLEL@ - High Level library: @HDF5_BUILD_HL_LIB@ + High-level library: @HDF5_BUILD_HL_LIB@ Threadsafety: @HDF5_ENABLE_THREADSAFE@ - Default API Mapping: @DEFAULT_API_VERSION@ - With Deprecated Public Symbols: @HDF5_ENABLE_DEPRECATED_SYMBOLS@ + Default API mapping: @DEFAULT_API_VERSION@ + With deprecated public symbols: @HDF5_ENABLE_DEPRECATED_SYMBOLS@ I/O filters (external): @EXTERNAL_FILTERS@ MPE: @H5_HAVE_LIBLMPE@ Direct VFD: @H5_HAVE_DIRECT@ dmalloc: @H5_HAVE_LIBDMALLOC@ -Clear file buffers before write: @HDF5_Enable_Clear_File_Buffers@ + Packages w/ extra debug output: @INTERNAL_DEBUG_OUTPUT@ + API Tracing: @HDF5_ENABLE_TRACE@ Using memory checker: @HDF5_ENABLE_USING_MEMCHECKER@ Memory allocation sanity checks: @HDF5_MEMORY_ALLOC_SANITY_CHECK@ + Metadata trace file: @METADATATRACEFILE@ Function Stack Tracing: @HDF5_ENABLE_CODESTACK@ Strict File Format Checks: @HDF5_STRICT_FORMAT_CHECKS@ Optimization Instrumentation: @HDF5_Enable_Instrument@ diff --git a/config/commence.am b/config/commence.am index 554c9fb..1a26a85 100644 --- a/config/commence.am +++ b/config/commence.am @@ -37,6 +37,7 @@ LIBH5TEST=$(top_builddir)/test/libh5test.la LIBH5F=$(top_builddir)/fortran/src/libhdf5_fortran.la LIBH5FTEST=$(top_builddir)/fortran/test/libh5test_fortran.la LIBH5CPP=$(top_builddir)/c++/src/libhdf5_cpp.la +LIBH5JNI=$(top_builddir)/java/src/jni/libhdf5_java.la LIBH5TOOLS=$(top_builddir)/tools/lib/libh5tools.la LIBH5_HL=$(top_builddir)/hl/src/libhdf5_hl.la LIBH5F_HL=$(top_builddir)/hl/fortran/src/libhdf5hl_fortran.la diff --git a/configure.ac b/configure.ac index 54ad5a2..d547ac5 100644 --- a/configure.ac +++ b/configure.ac @@ -100,6 +100,7 @@ AC_CONFIG_COMMANDS([pubconf], [ AC_CANONICAL_HOST AC_SUBST([CPPFLAGS]) +AC_SUBST([JNIFLAGS]) ## H5_CFLAGS (and company) are for CFLAGS that should be used on HDF5, but ## not exported to h5cc (or h5fc, etc.) @@ -107,6 +108,9 @@ AC_SUBST([H5_CFLAGS]) AC_SUBST([H5_CPPFLAGS]) AC_SUBST([H5_FCFLAGS]) AC_SUBST([H5_CXXFLAGS]) +AC_SUBST([H5_JNIFLAGS]) +AC_SUBST([H5_JAVACFLAGS]) +AC_SUBST([H5_JAVAFLAGS]) AC_SUBST([H5_LDFLAGS]) ## AM_CFLAGS (and company) are for CFLAGS that should be used on HDF5, @@ -115,6 +119,9 @@ AC_SUBST([AM_CFLAGS]) AC_SUBST([AM_FCFLAGS]) AC_SUBST([AM_CXXFLAGS]) AC_SUBST([AM_CPPFLAGS]) +AC_SUBST([AM_JNIFLAGS]) +AC_SUBST([AM_JAVACFLAGS]) +AC_SUBST([AM_JAVAFLAGS]) AC_SUBST([AM_LDFLAGS]) ## Make sure flags are initialized. @@ -122,11 +129,17 @@ AM_CFLAGS="${AM_CFLAGS}" AM_CXXFLAGS="${AM_CXXFLAGS}" AM_FCFLAGS="${AM_FCFLAGS}" AM_CPPFLAGS="${AM_CPPFLAGS}" +AM_JNIFLAGS="${AM_JNIFLAGS}" +AM_JAVACFLAGS="${AM_JAVACFLAGS}" +AM_JAVAFLAGS="${AM_JAVAFLAGS}" AM_LDFLAGS="${AM_LDFLAGS}" CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" FCFLAGS="${FCFLAGS}" CPPFLAGS="${CPPFLAGS}" +JNIFLAGS="${JNIFLAGS}" +JAVACFLAGS="${JAVACFLAGS}" +JAVAFLAGS="${JAVAFLAGS}" LDFLAGS="${LDFLAGS}" ## Configure may need to alter any of the *FLAGS variables in order for @@ -135,6 +148,8 @@ LDFLAGS="${LDFLAGS}" saved_user_CFLAGS="$CFLAGS" saved_user_CXXFLAGS="$CXXFLAGS" saved_user_FCFLAGS="$FCFLAGS" +saved_user_JAVACFLAGS="$JAVACFLAGS" +saved_user_JAVAFLAGS="$JAVAFLAGS" saved_user_LDFLAGS="$LDFLAGS" saved_user_CPPFLAGS="$CPPFLAGS" @@ -326,6 +341,8 @@ esac ## reset this value at the end of configure, to preserve the user's settings. CFLAGS="${AM_CFLAGS} ${CFLAGS}" FCFLAGS="${AM_FCFLAGS} ${FCFLAGS}" +JAVACFLAGS="${AM_JAVACFLAGS} ${JAVACFLAGS}" +JAVAFLAGS="${AM_JAVAFLAGS} ${JAVAFLAGS}" CXXFLAGS="${AM_CXXFLAGS} ${CXXFLAGS}" CPPFLAGS="${AM_CPPFLAGS} ${CPPFLAGS}" LDFLAGS="${AM_LDFLAGS} ${LDFLAGS}" @@ -835,6 +852,55 @@ case "`uname`" in esac ## ---------------------------------------------------------------------- +## Check if they would like the Java native interface (JNI) compiled +## + +AC_SUBST([H5_CLASSPATH]) H5_CLASSPATH="" +AC_MSG_CHECKING([if Java JNI interface enabled]) + +AC_ARG_ENABLE([java], + [AS_HELP_STRING([--enable-java], + [Compile the Java JNI interface [default=no]])], + [HDF_JAVA=$enableval], + [HDF_JAVA=no]) + +if test "X$HDF_JAVA" = "Xyes" && test "X${enable_shared}" != "Xno"; then + echo "yes" + if test "X$CLASSPATH" = "X"; then + H5_CLASSPATH=".:$srcdir/java/lib" + else + H5_CLASSPATH=".:$CLASSPATH:$srcdir/java/lib" + fi +## Checks for programs. + AX_JAVA_OPTIONS + H5_JAVACFLAGS=$JAVACFLAGS + H5_JAVAFLAGS=$JAVAFLAGS + AX_PROG_JAVAC + AX_PROG_JAVA + AX_PROG_JAR + AX_PROG_JAVADOC + ## Find the include directories needed for building JNI code + AX_JNI_INCLUDE_DIR() + for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS + do + JNIFLAGS="$JNIFLAGS -I$JNI_INCLUDE_DIR" + done + ## Find junit for testing the JNI code + AX_CHECK_CLASSPATH() + CLASSPATH_ENV=$H5_CLASSPATH + AX_CHECK_JUNIT() + AX_CHECK_JAVA_HOME + + AC_MSG_RESULT([yes]) +else + if test "X${enable_shared}" = "Xno"; then + AC_MSG_ERROR([Java requires shared libraries to be built]) + fi + HDF_JAVA="no" + AC_MSG_RESULT([no]) +fi + +## ---------------------------------------------------------------------- ## Fortran libraries are not currently supported on Mac. Disable them. ## (this is overridable with --enable-unsupported). ## @@ -3071,7 +3137,7 @@ CXX_NOFLAGS=`echo $CXX | sed 's/ -.*//'` if `echo $CXX_NOFLAGS | grep ^/ >/dev/null 2>&1`; then CXX_VERSION="$CXX" else - CXX_VERSION="$FC"; + CXX_VERSION="$CXX"; for x in `echo $PATH | sed -e 's/:/ /g'`; do if test -x $x/$CXX_NOFLAGS; then CXX_VERSION="$x/$CXX" @@ -3083,6 +3149,27 @@ if test -n "$cxx_version_info"; then CXX_VERSION="$CXX_VERSION ( $cxx_version_info)" fi +AC_SUBST([JAVA_VERSION]) +## Strip anything that looks like a flag off of $JAVA +JAVA_NOFLAGS=`echo $JAVA | sed 's/ -.*//'` + +if `echo $JAVA_NOFLAGS | grep ^/ >/dev/null 2>&1`; then + JAVA_VERSION="$JAVA" +else + JAVA_VERSION="$JAVA"; + for x in `echo $PATH | sed -e 's/:/ /g'`; do + if test -x $x/$JAVA_NOFLAGS; then + JAVA_VERSION="$x/$JAVA" + break + fi + done +fi +java_version_info=`$JAVA -version 2>&1 |\ + grep 'version' | sed -e 's/version "//' | sed -e 's/"//'` +if test -n "$java_version_info"; then + JAVA_VERSION="$JAVA_VERSION ( $java_version_info)" +fi + ## ---------------------------------------------------------------------- ## Where is the root of the source tree. Give an absolute address so ## we can find it no matter which directory of the distribution is our @@ -3296,6 +3383,8 @@ CFLAGS="$saved_user_CFLAGS" FCFLAGS="$saved_user_FCFLAGS" CXXFLAGS="$saved_user_CXXFLAGS" CPPFLAGS="$saved_user_CPPFLAGS" +JAVACFLAGS="$saved_user_JAVACFLAGS" +JAVAFLAGS="$saved_user_JAVAFLAGS" LDFLAGS="$saved_user_LDFLAGS" @@ -3306,6 +3395,7 @@ LDFLAGS="$saved_user_LDFLAGS" AM_CONDITIONAL([BUILD_CXX_CONDITIONAL], [test "X$HDF_CXX" = "Xyes"]) AM_CONDITIONAL([BUILD_PARALLEL_CONDITIONAL], [test -n "$TESTPARALLEL"]) AM_CONDITIONAL([BUILD_FORTRAN_CONDITIONAL], [test "X$HDF_FORTRAN" = "Xyes"]) +AM_CONDITIONAL([BUILD_JAVA_CONDITIONAL], [test "X$HDF_JAVA" = "Xyes"]) AM_CONDITIONAL([BUILD_HDF5_HL_CONDITIONAL], [test "X$HDF5_HL" = "Xyes"]) @@ -3451,6 +3541,20 @@ AC_CONFIG_FILES([src/libhdf5.settings fortran/examples/Makefile fortran/examples/run-fortran-ex.sh fortran/examples/testh5fc.sh + java/Makefile + java/src/Makefile + java/src/jni/Makefile + java/test/Makefile + java/test/junit.sh + java/examples/Makefile + java/examples/intro/Makefile + java/examples/intro/runExample.sh + java/examples/datasets/Makefile + java/examples/datasets/runExample.sh + java/examples/datatypes/Makefile + java/examples/datatypes/runExample.sh + java/examples/groups/Makefile + java/examples/groups/runExample.sh hl/Makefile hl/src/Makefile hl/test/Makefile diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index 5854f75..8ebbbd0 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -139,7 +139,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) TARGET_C_PROPERTIES (${HDF5_F90_C_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_F90_C_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${LINK_SHARED_LIBS}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_C_LIBSH_TARGET}") - H5_SET_LIB_OPTIONS (${HDF5_F90_C_LIBSH_TARGET} ${HDF5_F90_C_LIB_NAME} SHARED) + H5_SET_LIB_OPTIONS (${HDF5_F90_C_LIBSH_TARGET} ${HDF5_F90_C_LIB_NAME} SHARED ${HDF5_F_PACKAGE_SOVERSION}) set_target_properties (${HDF5_F90_C_LIBSH_TARGET} PROPERTIES FOLDER libraries/fortran LINKER_LANGUAGE C @@ -235,7 +235,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) target_link_libraries (${HDF5_F90_LIBSH_TARGET} ${MPI_Fortran_LIBRARIES}) endif (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIBSH_TARGET}") - H5_SET_LIB_OPTIONS (${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_LIB_NAME} SHARED) + H5_SET_LIB_OPTIONS (${HDF5_F90_LIBSH_TARGET} ${HDF5_F90_LIB_NAME} SHARED ${HDF5_F_PACKAGE_SOVERSION}) set_target_properties (${HDF5_F90_LIBSH_TARGET} PROPERTIES FOLDER libraries/fortran LINKER_LANGUAGE Fortran diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt index 0cbd17f..005a5c8 100644 --- a/fortran/test/CMakeLists.txt +++ b/fortran/test/CMakeLists.txt @@ -65,7 +65,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) ${HDF5_F90_C_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET} ) - H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIBSH_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} SHARED) + H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIBSH_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) set_target_properties (${HDF5_F90_C_TEST_LIBSH_TARGET} PROPERTIES FOLDER libraries/test/fortran LINKER_LANGUAGE C @@ -128,7 +128,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) ${HDF5_F90_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ) - H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_TEST_LIB_NAME} SHARED) + H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIBSH_TARGET} ${HDF5_F90_TEST_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) target_include_directories (${HDF5_F90_TEST_LIBSH_TARGET} PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/shared) set_target_properties (${HDF5_F90_TEST_LIBSH_TARGET} PROPERTIES FOLDER libraries/test/fortran diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index e37c5ba..425a2fe 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -34,7 +34,7 @@ if (BUILD_SHARED_LIBS) ${HDF5_LIBSH_TARGET} ) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_CPP_LIBSH_TARGET}") - H5_SET_LIB_OPTIONS (${HDF5_HL_CPP_LIBSH_TARGET} ${HDF5_HL_CPP_LIB_NAME} SHARED) + H5_SET_LIB_OPTIONS (${HDF5_HL_CPP_LIBSH_TARGET} ${HDF5_HL_CPP_LIB_NAME} SHARED ${HDF5_HL_CXX_PACKAGE_SOVERSION}) set_target_properties (${HDF5_HL_CPP_LIBSH_TARGET} PROPERTIES FOLDER libraries/hl COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB" diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index ead21be..a566314 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -91,7 +91,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) TARGET_C_PROPERTIES (${HDF5_HL_F90_C_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_F90_C_LIBSH_TARGET} ${HDF5_HL_LIBSH_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_C_LIBSH_TARGET}") - H5_SET_LIB_OPTIONS (${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_HL_F90_C_LIB_NAME} SHARED) + H5_SET_LIB_OPTIONS (${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_HL_F90_C_LIB_NAME} SHARED ${HDF5_HL_F_PACKAGE_SOVERSION}) set_target_properties (${HDF5_HL_F90_C_LIBSH_TARGET} PROPERTIES FOLDER libraries/hl/fortran LINKER_LANGUAGE C @@ -163,7 +163,7 @@ if (BUILD_SHARED_LIBS AND NOT SKIP_HDF5_FORTRAN_SHARED) TARGET_FORTRAN_PROPERTIES (${HDF5_HL_F90_LIBSH_TARGET} SHARED " " ${SHARED_LINK_FLAGS}) target_link_libraries (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_HL_F90_C_LIBSH_TARGET} ${HDF5_F90_LIBSH_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_F90_LIBSH_TARGET}") - H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_HL_F90_LIB_NAME} SHARED) + H5_SET_LIB_OPTIONS (${HDF5_HL_F90_LIBSH_TARGET} ${HDF5_HL_F90_LIB_NAME} SHARED ${HDF5_HL_F_PACKAGE_SOVERSION}) set_target_properties (${HDF5_HL_F90_LIBSH_TARGET} PROPERTIES FOLDER libraries/hl/fortran LINKER_LANGUAGE Fortran diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index 472f1ee..a86bf4f 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -42,7 +42,7 @@ if (BUILD_SHARED_LIBS) add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SRCS} ${HL_HEADERS}) TARGET_C_PROPERTIES (${HDF5_HL_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_HL_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_HL_LIBSH_TARGET} ${HDF5_HL_LIB_NAME} SHARED) + H5_SET_LIB_OPTIONS (${HDF5_HL_LIBSH_TARGET} ${HDF5_HL_LIB_NAME} SHARED ${HDF5_HL_PACKAGE_SOVERSION}) set_target_properties (${HDF5_HL_LIBSH_TARGET} PROPERTIES FOLDER libraries/hl COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB" diff --git a/java/CMakeLists.txt b/java/CMakeLists.txt new file mode 100644 index 0000000..0440d41 --- /dev/null +++ b/java/CMakeLists.txt @@ -0,0 +1,77 @@ +cmake_minimum_required(VERSION 3.1.0) +PROJECT ( HDF5_JAVA C Java ) + +set (CMAKE_MODULE_PATH "${HDF_RESOURCES_DIR};${HDF_RESOURCES_EXT_DIR}") +find_package (Java) +#----------------------------------------------------------------------------- +# Include some macros for reusable code +#----------------------------------------------------------------------------- +include (${HDF_RESOURCES_DIR}/UseJava.cmake) + +message (STATUS "JAVA: JAVA_HOME=$ENV{JAVA_HOME} JAVA_ROOT=$ENV{JAVA_ROOT}") +find_package (JNI) + +INCLUDE_DIRECTORIES ( ${JNI_INCLUDE_DIRS} ) + +#----------------------------------------------------------------------------- +# Include the main src and config directories +#----------------------------------------------------------------------------- +set (HDF5_JAVA_INCLUDE_DIRECTORIES + ${HDF5_JAVA_JNI_SRC_DIR} + ${JAVA_INCLUDE_PATH} + ${JAVA_INCLUDE_PATH2} +) +INCLUDE_DIRECTORIES (${HDF5_JAVA_INCLUDE_DIRECTORIES}) +set (CMAKE_JAVA_INCLUDE_PATH "") + + +#----------------------------------------------------------------------------- +# Traverse source subdirectory +#----------------------------------------------------------------------------- +add_subdirectory (${HDF5_JAVA_SOURCE_DIR}/src ${HDF5_JAVA_BINARY_DIR}/src) + +#----------------------------------------------------------------------------- +# Build the Java Examples +#----------------------------------------------------------------------------- +if (HDF5_BUILD_EXAMPLES) + add_subdirectory (${HDF5_JAVA_SOURCE_DIR}/examples ${HDF5_JAVA_BINARY_DIR}/examples) +endif (HDF5_BUILD_EXAMPLES) + +#----------------------------------------------------------------------------- +# Testing +#----------------------------------------------------------------------------- +if (BUILD_TESTING) + add_subdirectory (${HDF5_JAVA_SOURCE_DIR}/test ${HDF5_JAVA_BINARY_DIR}/test) +endif (BUILD_TESTING) + +#----------------------------------------------------------------------------- +# Add Required Jar(s) +#----------------------------------------------------------------------------- +install ( + FILES + ${HDF5_JAVA_LOGGING_JAR} + ${HDF5_JAVA_LOGGING_NOP_JAR} + ${HDF5_JAVA_LOGGING_SIMPLE_JAR} + DESTINATION ${HDF5_INSTALL_JAR_DIR} + COMPONENT libraries +) + +#----------------------------------------------------------------------------- +# Option to include jre +#----------------------------------------------------------------------------- +option (HDF5_JAVA_PACK_JRE "Package a JRE installer directory" OFF) +if (HDF5_JAVA_PACK_JRE) + if (WIN32) + install ( + DIRECTORY "C:/Program Files/Java/jre8" + DESTINATION ${HDF5_INSTALL_BIN_DIR} + USE_SOURCE_PERMISSIONS + ) + else (WIN32) + install ( + DIRECTORY "/usr/lib/jvm/jre" + DESTINATION ${HDF5_INSTALL_BIN_DIR} + USE_SOURCE_PERMISSIONS + ) + endif (WIN32) +endif (HDF5_JAVA_PACK_JRE) diff --git a/java/COPYING b/java/COPYING new file mode 100644 index 0000000..6903daf --- /dev/null +++ b/java/COPYING @@ -0,0 +1,16 @@ + + Copyright by The HDF Group and + The Board of Trustees of the University of Illinois. + All rights reserved. + + The files and subdirectories in this directory are part of HDF5. + The full HDF5 copyright notice, including terms governing use, + modification, and redistribution, is contained in the files COPYING + and Copyright.html. COPYING can be found at the root of the source + code distribution tree; Copyright.html can be found at the root + level of an installed copy of the electronic HDF5 document set and + is linked from the top-level documents page. It can also be found + at http://www.hdfgroup.org/HDF5/doc/Copyright.html. If you do not + have access to either file, you may request a copy from + help@hdfgroup.org. + diff --git a/java/Makefile.am b/java/Makefile.am new file mode 100644 index 0000000..10b1e91 --- /dev/null +++ b/java/Makefile.am @@ -0,0 +1,38 @@ +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# +# +# This makefile mostly just reinvokes make in the various subdirectories +# but does so in the correct order. You can alternatively invoke make from +# each subdirectory manually. +## +## Makefile.am +## Run automake to generate a Makefile.in from this file. +## +# +# HDF5 Java native interface (JNI) Library Makefile(.in) + +include $(top_srcdir)/config/commence.am + +## Only recurse into subdirectories if the Java (JNI) interface is enabled. +if BUILD_JAVA_CONDITIONAL + +# Mark this directory as part of the JNI API +JAVA_API=yes + +SUBDIRS=src test examples + +endif + +include $(top_srcdir)/config/conclude.am diff --git a/java/examples/CMakeLists.txt b/java/examples/CMakeLists.txt new file mode 100644 index 0000000..0430bdb --- /dev/null +++ b/java/examples/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required (VERSION 3.1.0) +PROJECT (HDFJAVA_EXAMPLES) + +add_subdirectory (${HDFJAVA_EXAMPLES_SOURCE_DIR}/datasets datasets) +add_subdirectory (${HDFJAVA_EXAMPLES_SOURCE_DIR}/datatypes datatypes) +add_subdirectory (${HDFJAVA_EXAMPLES_SOURCE_DIR}/groups groups) +add_subdirectory (${HDFJAVA_EXAMPLES_SOURCE_DIR}/intro intro) diff --git a/java/examples/Makefile.am b/java/examples/Makefile.am new file mode 100644 index 0000000..e685e01 --- /dev/null +++ b/java/examples/Makefile.am @@ -0,0 +1,31 @@ +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# +# +# This makefile mostly just reinvokes make in the various subdirectories +# but does so in the correct order. You can alternatively invoke make from +# each subdirectory manually. +## +## Makefile.am +## Run automake to generate a Makefile.in from this file. +## +# +# HDF5 Java Library Examples Makefile(.in) + +include $(top_srcdir)/config/commence.am + +## Only recurse into subdirectories if the Java (JNI) interface is enabled. + SUBDIRS=intro groups datasets datatypes + +include $(top_srcdir)/config/conclude.am diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt new file mode 100644 index 0000000..2338325 --- /dev/null +++ b/java/examples/datasets/CMakeLists.txt @@ -0,0 +1,121 @@ +cmake_minimum_required (VERSION 3.1.0) +PROJECT (HDFJAVA_EXAMPLES_DATASETS Java) + +set (CMAKE_VERBOSE_MAKEFILE 1) + +INCLUDE_DIRECTORIES ( + ${HDF5_JAVA_JNI_BINARY_DIR} + ${HDF5_JAVA_HDF5_LIB_DIR} +) + +set (HDF_JAVA_EXAMPLES + H5Ex_D_Alloc + H5Ex_D_Checksum + H5Ex_D_Chunk + H5Ex_D_Compact + H5Ex_D_External + H5Ex_D_FillValue + H5Ex_D_Gzip + H5Ex_D_Hyperslab + H5Ex_D_ReadWrite + H5Ex_D_Shuffle + H5Ex_D_Szip + H5Ex_D_UnlimitedAdd + H5Ex_D_UnlimitedGzip + H5Ex_D_UnlimitedMod + H5Ex_D_Nbit + H5Ex_D_Transform + H5Ex_D_Sofloat + H5Ex_D_Soint +) + +if (WIN32) + set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") +else (WIN32) + set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") +endif (WIN32) + +set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS}") + +set (CMAKE_JAVA_CLASSPATH ".") +foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH}) + set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}") +endforeach (CMAKE_INCLUDE_PATH) + +foreach (example ${HDF_JAVA_EXAMPLES}) + file (WRITE ${PROJECT_BINARY_DIR}/${example}_Manifest.txt + "Main-Class: examples.datasets.${example} +" + ) + add_jar (${example} MANIFEST ${PROJECT_BINARY_DIR}/${example}_Manifest.txt ${example}.java) + get_target_property (${example}_JAR_FILE ${example} JAR_FILE) +# install_jar (${example} ${HJAVA_INSTALL_DATA_DIR}/examples examples) + get_target_property (${example}_CLASSPATH ${example} CLASSDIR) + add_dependencies (${example} ${HDF5_JAVA_HDF5_LIB_TARGET}) +endforeach (example ${HDF_JAVA_EXAMPLES}) + +set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS};${HDF5_JAVA_LOGGING_JAR};${HDF5_JAVA_LOGGING_NOP_JAR}") + +set (CMAKE_JAVA_CLASSPATH ".") +foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) + set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}") +endforeach (HDFJAVA_JAR) + +MACRO (ADD_H5_TEST resultfile resultcode) + add_test ( + NAME JAVA_datasets-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" + -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_PROGRAM=examples.datasets.${resultfile}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" + -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" + -D "TEST_OUTPUT=datasets/${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=datasets/${resultfile}.txt" + -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (JAVA_datasets-${resultfile} PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + set (last_test "JAVA_datasets-${resultfile}") +ENDMACRO (ADD_H5_TEST file) + +if (BUILD_TESTING) + foreach (example ${HDF_JAVA_EXAMPLES}) + if (${example} STREQUAL "H5Ex_D_External") + add_test ( + NAME JAVA_datasets-${example}-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 + ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.data + ${example}.out + ${example}.out.err + ) + else (${example} STREQUAL "H5Ex_D_External") + add_test ( + NAME JAVA_datasets-${example}-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 + ${example}.out + ${example}.out.err + ) + endif (${example} STREQUAL "H5Ex_D_External") + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (JAVA_datasets-${example}-clearall-objects PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + add_test ( + NAME JAVA_datasets-${example}-copy-objects + COMMAND ${CMAKE_COMMAND} + -E copy_if_different + ${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.datasets.${example}.txt + ${HDFJAVA_EXAMPLES_DATASETS_BINARY_DIR}/${example}.txt + ) + set_tests_properties (JAVA_datasets-${example}-copy-objects PROPERTIES DEPENDS JAVA_datasets-${example}-clearall-objects) + set (last_test "JAVA_datasets-${example}-copy-objects") + ADD_H5_TEST (${example} 0) + endforeach (example ${HDF_JAVA_EXAMPLES}) +endif (BUILD_TESTING) diff --git a/java/examples/datasets/H5Ex_D_Alloc.java b/java/examples/datasets/H5Ex_D_Alloc.java new file mode 100644 index 0000000..69fee38 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_Alloc.java @@ -0,0 +1,301 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to set the space allocation time + for a dataset. The program first creates two datasets, + one with the default allocation time (late) and one with + early allocation time, and displays whether each has been + allocated and their allocation size. Next, it writes data + to the datasets, and again displays whether each has been + allocated and their allocation size. + ************************************************************/ +package examples.datasets; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_Alloc { + private static String FILENAME = "H5Ex_D_Alloc.h5"; + private static String DATASETNAME1 = "DS1"; + private static String DATASETNAME2 = "DS2"; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int FILLVAL = 99; + private static final int RANK = 2; + + // Values for the status of space allocation + enum H5D_space_status { + H5D_SPACE_STATUS_ERROR(-1), H5D_SPACE_STATUS_NOT_ALLOCATED(0), H5D_SPACE_STATUS_PART_ALLOCATED(1), H5D_SPACE_STATUS_ALLOCATED( + 2); + private static final Map lookup = new HashMap(); + + static { + for (H5D_space_status s : EnumSet.allOf(H5D_space_status.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5D_space_status(int space_status) { + this.code = space_status; + } + + public int getCode() { + return this.code; + } + + public static H5D_space_status get(int code) { + return lookup.get(code); + } + } + + private static void allocation() { + long file_id = -1; + long filespace_id = -1; + long dataset_id1 = -1; + long dataset_id2 = -1; + long dcpl_id = -1; + long[] dims = { DIM_X, DIM_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + int space_status = 0; + long storage_size = 0; + + // Initialize the dataset. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = FILLVAL; + + // Create a file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list, and set the chunk size. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Set the allocation time to "early". This way we can be sure + // that reading from the dataset immediately after creation will + // return the fill value. + try { + if (dcpl_id >= 0) + H5.H5Pset_alloc_time(dcpl_id, HDF5Constants.H5D_ALLOC_TIME_EARLY); + } + catch (Exception e) { + e.printStackTrace(); + } + + System.out.println("Creating datasets..."); + System.out.println(DATASETNAME1 + " has allocation time H5D_ALLOC_TIME_LATE"); + System.out.println(DATASETNAME2 + " has allocation time H5D_ALLOC_TIME_EARLY"); + System.out.println(); + + // Create the dataset using the dataset default creation property list. + try { + if ((file_id >= 0) && (filespace_id >= 0)) + dataset_id1 = H5.H5Dcreate(file_id, DATASETNAME1, HDF5Constants.H5T_NATIVE_INT, filespace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset using the dataset creation property list. + try { + if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) + dataset_id2 = H5.H5Dcreate(file_id, DATASETNAME2, HDF5Constants.H5T_NATIVE_INT, filespace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve and print space status and storage size for dset1. + try { + if (dataset_id1 >= 0) + space_status = H5.H5Dget_space_status(dataset_id1); + } + catch (Exception e) { + e.printStackTrace(); + } + try { + if (dataset_id1 >= 0) + storage_size = H5.H5Dget_storage_size(dataset_id1); + } + catch (Exception e) { + e.printStackTrace(); + } + String the_space = " "; + if (H5D_space_status.get(space_status) != H5D_space_status.H5D_SPACE_STATUS_ALLOCATED) + the_space += "not "; + System.out.println("Space for " + DATASETNAME1 + " has" + the_space + "been allocated."); + System.out.println("Storage size for " + DATASETNAME1 + " is: " + storage_size + " bytes."); + + // Retrieve and print space status and storage size for dset2. + try { + if (dataset_id2 >= 0) + space_status = H5.H5Dget_space_status(dataset_id2); + } + catch (Exception e) { + e.printStackTrace(); + } + try { + if (dataset_id2 >= 0) + storage_size = H5.H5Dget_storage_size(dataset_id2); + } + catch (Exception e) { + e.printStackTrace(); + } + the_space = " "; + if (H5D_space_status.get(space_status) != H5D_space_status.H5D_SPACE_STATUS_ALLOCATED) + the_space += "not "; + System.out.println("Space for " + DATASETNAME2 + " has" + the_space + "been allocated."); + System.out.println("Storage size for " + DATASETNAME2 + " is: " + storage_size + " bytes."); + System.out.println(); + + System.out.println("Writing data..."); + System.out.println(); + + // Write the data to the datasets. + try { + if (dataset_id1 >= 0) + H5.H5Dwrite(dataset_id1, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data[0]); + } + catch (Exception e) { + e.printStackTrace(); + } + try { + if (dataset_id2 >= 0) + H5.H5Dwrite(dataset_id2, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data[0]); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve and print space status and storage size for dset1. + try { + if (dataset_id1 >= 0) + space_status = H5.H5Dget_space_status(dataset_id1); + } + catch (Exception e) { + e.printStackTrace(); + } + try { + if (dataset_id1 >= 0) + storage_size = H5.H5Dget_storage_size(dataset_id1); + } + catch (Exception e) { + e.printStackTrace(); + } + the_space = " "; + if (H5D_space_status.get(space_status) != H5D_space_status.H5D_SPACE_STATUS_ALLOCATED) + the_space += "not "; + System.out.println("Space for " + DATASETNAME1 + " has" + the_space + "been allocated."); + System.out.println("Storage size for " + DATASETNAME1 + " is: " + storage_size + " bytes."); + + // Retrieve and print space status and storage size for dset2. + try { + if (dataset_id2 >= 0) + space_status = H5.H5Dget_space_status(dataset_id2); + } + catch (Exception e) { + e.printStackTrace(); + } + try { + if (dataset_id2 >= 0) + storage_size = H5.H5Dget_storage_size(dataset_id2); + } + catch (Exception e) { + e.printStackTrace(); + } + the_space = " "; + if (H5D_space_status.get(space_status) != H5D_space_status.H5D_SPACE_STATUS_ALLOCATED) + the_space += "not "; + System.out.println("Space for " + DATASETNAME2 + " has" + the_space + "been allocated."); + System.out.println("Storage size for " + DATASETNAME2 + " is: " + storage_size + " bytes."); + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id1 >= 0) + H5.H5Dclose(dataset_id1); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id2 >= 0) + H5.H5Dclose(dataset_id2); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_D_Alloc.allocation(); + } + +} diff --git a/java/examples/datasets/H5Ex_D_Checksum.java b/java/examples/datasets/H5Ex_D_Checksum.java new file mode 100644 index 0000000..3a2f98f --- /dev/null +++ b/java/examples/datasets/H5Ex_D_Checksum.java @@ -0,0 +1,347 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write data to a dataset + using the Fletcher32 checksum filter. The program first + checks if the Fletcher32 filter is available, then if it + is it writes integers to a dataset using Fletcher32, then + closes the file. Next, it reopens the file, reads back + the data, checks if the filter detected an error and + outputs the type of filter and the maximum value in the + dataset to the screen. + ************************************************************/ +package examples.datasets; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_Checksum { + private static String FILENAME = "H5Ex_D_Checksum.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 32; + private static final int DIM_Y = 64; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 8; + private static final int RANK = 2; + private static final int NDIMS = 2; + + // Values for the status of space allocation + enum H5Z_filter { + H5Z_FILTER_ERROR(-1), H5Z_FILTER_NONE(0), H5Z_FILTER_DEFLATE(1), H5Z_FILTER_SHUFFLE(2), H5Z_FILTER_FLETCHER32(3), H5Z_FILTER_SZIP( + 4), H5Z_FILTER_NBIT(5), H5Z_FILTER_SCALEOFFSET(6), H5Z_FILTER_RESERVED(256), H5Z_FILTER_MAX(65535); + private static final Map lookup = new HashMap(); + + static { + for (H5Z_filter s : EnumSet.allOf(H5Z_filter.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5Z_filter(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5Z_filter get(int code) { + return lookup.get(code); + } + } + + private static boolean checkFletcher32Filter() { + try { + int available = H5.H5Zfilter_avail(H5Z_filter.H5Z_FILTER_FLETCHER32.getCode()); + if (available == 0) { + System.out.println("N-Bit filter not available."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_FLETCHER32); + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) + || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + System.out.println("N-Bit filter not available for encoding and decoding."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + return true; + } + + private static void writeChecksum() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] chunk_dims = { CHUNK_X, CHUNK_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize data. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * jndx - jndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list, add the N-Bit filter. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + if (dcpl_id >= 0) { + H5.H5Pset_fletcher32(dcpl_id); + // Set the chunk size. + H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readChecksum() { + long file_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the dataset creation property list. + try { + if (dataset_id >= 0) + dcpl_id = H5.H5Dget_create_plist(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve and print the filter type. Here we only retrieve the + // first filter because we know that we only added one filter. + try { + if (dcpl_id >= 0) { + // Java lib requires a valid filter_name object and cd_values + int[] flags = { 0 }; + long[] cd_nelmts = { 1 }; + int[] cd_values = { 0 }; + String[] filter_name = { "" }; + int[] filter_config = { 0 }; + int filter_type = -1; + filter_type = H5 + .H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, filter_config); + System.out.print("Filter type is: "); + switch (H5Z_filter.get(filter_type)) { + case H5Z_FILTER_DEFLATE: + System.out.println("H5Z_FILTER_DEFLATE"); + break; + case H5Z_FILTER_SHUFFLE: + System.out.println("H5Z_FILTER_SHUFFLE"); + break; + case H5Z_FILTER_FLETCHER32: + System.out.println("H5Z_FILTER_FLETCHER32"); + break; + case H5Z_FILTER_SZIP: + System.out.println("H5Z_FILTER_SZIP"); + break; + default: + System.out.println("H5Z_FILTER_ERROR"); + } + System.out.println(); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the default properties. + try { + if (dataset_id >= 0) { + int status = H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); + // Check if the read was successful. Normally we do not perform + // error checking in these examples for the sake of clarity, but in + // this case we will make an exception because this is how the + // fletcher32 checksum filter reports data errors. + if (status < 0) { + System.out.print("Dataset read failed!"); + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + return; + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Find the maximum value in the dataset, to verify that it was read + // correctly. + int max = dset_data[0][0]; + for (int indx = 0; indx < DIM_X; indx++) { + for (int jndx = 0; jndx < DIM_Y; jndx++) + if (max < dset_data[indx][jndx]) + max = dset_data[indx][jndx]; + } + // Print the maximum value. + System.out.println("Maximum value in " + DATASETNAME + " is: " + max); + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + // Check if the Fletcher32 filter is available and can be used for + // both encoding and decoding. Normally we do not perform error + // checking in these examples for the sake of clarity, but in this + // case we will make an exception because this filter is an + // optional part of the hdf5 library. + // size to be the current size. + if (H5Ex_D_Checksum.checkFletcher32Filter()) { + H5Ex_D_Checksum.writeChecksum(); + H5Ex_D_Checksum.readChecksum(); + } + } + +} diff --git a/java/examples/datasets/H5Ex_D_Chunk.java b/java/examples/datasets/H5Ex_D_Chunk.java new file mode 100644 index 0000000..7f02e5a --- /dev/null +++ b/java/examples/datasets/H5Ex_D_Chunk.java @@ -0,0 +1,366 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to create a chunked dataset. The + program first writes integers in a hyperslab selection to + a chunked dataset with dataspace dimensions of DIM_XxDIM_Y + and chunk size of CHUNK_XxCHUNK_Y, then closes the file. + Next, it reopens the file, reads back the data, and + outputs it to the screen. Finally it reads the data again + using a different hyperslab selection, and outputs + the result to the screen. + ************************************************************/ +package examples.datasets; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_Chunk { + private static String FILENAME = "H5Ex_D_Chunk.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 6; + private static final int DIM_Y = 8; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 4; + private static final int RANK = 2; + private static final int NDIMS = 2; + + // Values for the status of space allocation + enum H5D_layout { + H5D_LAYOUT_ERROR(-1), H5D_COMPACT(0), H5D_CONTIGUOUS(1), H5D_CHUNKED(2), H5D_NLAYOUTS(3); + private static final Map lookup = new HashMap(); + + static { + for (H5D_layout s : EnumSet.allOf(H5D_layout.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5D_layout(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5D_layout get(int code) { + return lookup.get(code); + } + } + + private static void writeChunk() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] chunk_dims = { CHUNK_X, CHUNK_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize data to "1", to make it easier to see the selections. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = 1; + + // Print the data to the screen. + System.out.println("Original Data:"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Set the chunk size. + try { + if (dcpl_id >= 0) + H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the chunked dataset. + try { + if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Define and select the first part of the hyperslab selection. + long[] start = { 0, 0 }; + long[] stride = { 3, 3 }; + long[] count = { 2, 3 }; + long[] block = { 2, 2 }; + try { + if ((filespace_id >= 0)) + H5.H5Sselect_hyperslab(filespace_id, HDF5Constants.H5S_SELECT_SET, start, stride, count, block); + } + catch (Exception e) { + e.printStackTrace(); + } + // Define and select the second part of the hyperslab selection, + // which is subtracted from the first selection by the use of + // H5S_SELECT_NOTB + block[0] = 1; + block[1] = 1; + try { + if ((filespace_id >= 0)) { + H5.H5Sselect_hyperslab(filespace_id, HDF5Constants.H5S_SELECT_NOTB, start, stride, count, block); + + // Write the data to the dataset. + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, filespace_id, + HDF5Constants.H5P_DEFAULT, dset_data); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readChunk() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the dataset creation property list. + try { + if (dataset_id >= 0) + dcpl_id = H5.H5Dget_create_plist(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Print the storage layout. + try { + if (dcpl_id >= 0) { + int layout_type = H5.H5Pget_layout(dcpl_id); + System.out.print("Storage layout for " + DATASETNAME + " is: "); + switch (H5D_layout.get(layout_type)) { + case H5D_COMPACT: + System.out.println("H5D_COMPACT"); + break; + case H5D_CONTIGUOUS: + System.out.println("H5D_CONTIGUOUS"); + break; + case H5D_CHUNKED: + System.out.println("H5D_CHUNKED"); + break; + case H5D_LAYOUT_ERROR: + break; + case H5D_NLAYOUTS: + break; + default: + break; + } + System.out.println(); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Data as written to disk by hyberslabs:"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // Initialize the read array. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = 0; + + // Define and select the hyperslab to use for reading. + try { + if (dataset_id >= 0) { + filespace_id = H5.H5Dget_space(dataset_id); + + long[] start = { 0, 1 }; + long[] stride = { 4, 4 }; + long[] count = { 2, 2 }; + long[] block = { 2, 3 }; + + if (filespace_id >= 0) { + H5.H5Sselect_hyperslab(filespace_id, HDF5Constants.H5S_SELECT_SET, start, stride, count, block); + + // Read the data using the previously defined hyperslab. + if ((dataset_id >= 0) && (filespace_id >= 0)) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, filespace_id, + HDF5Constants.H5P_DEFAULT, dset_data); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Data as read from disk by hyberslab:"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_D_Chunk.writeChunk(); + H5Ex_D_Chunk.readChunk(); + } + +} diff --git a/java/examples/datasets/H5Ex_D_Compact.java b/java/examples/datasets/H5Ex_D_Compact.java new file mode 100644 index 0000000..4f1e2f0 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_Compact.java @@ -0,0 +1,289 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write data to a compact + dataset. The program first writes integers to a compact + dataset with dataspace dimensions of DIM_XxDIM_Y, then + closes the file. Next, it reopens the file, reads back + the data, and outputs it to the screen. + ************************************************************/ +package examples.datasets; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_Compact { + private static String FILENAME = "H5Ex_D_Compact.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int RANK = 2; + + // Values for the status of space allocation + enum H5D_layout { + H5D_LAYOUT_ERROR(-1), H5D_COMPACT(0), H5D_CONTIGUOUS(1), H5D_CHUNKED(2), H5D_NLAYOUTS(3); + private static final Map lookup = new HashMap(); + + static { + for (H5D_layout s : EnumSet.allOf(H5D_layout.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5D_layout(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5D_layout get(int code) { + return lookup.get(code); + } + } + + private static void writeCompact() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + long[] dims = { DIM_X, DIM_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize data. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * jndx - jndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Set the layout to compact. + try { + if (dcpl_id >= 0) + H5.H5Pset_layout(dcpl_id, H5D_layout.H5D_COMPACT.getCode()); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. We will use all default properties for this example. + try { + if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readCompact() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Open file and dataset using the default properties. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the dataset creation property list. + try { + if (dataset_id >= 0) + dcpl_id = H5.H5Dget_create_plist(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Print the storage layout. + try { + if (dcpl_id >= 0) { + int layout_type = H5.H5Pget_layout(dcpl_id); + System.out.print("Storage layout for " + DATASETNAME + " is: "); + switch (H5D_layout.get(layout_type)) { + case H5D_COMPACT: + System.out.println("H5D_COMPACT"); + break; + case H5D_CONTIGUOUS: + System.out.println("H5D_CONTIGUOUS"); + break; + case H5D_CHUNKED: + System.out.println("H5D_CHUNKED"); + break; + case H5D_LAYOUT_ERROR: + break; + case H5D_NLAYOUTS: + break; + default: + break; + } + System.out.println(); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Data for " + DATASETNAME + " is: "); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_D_Compact.writeCompact(); + H5Ex_D_Compact.readCompact(); + } + +} diff --git a/java/examples/datasets/H5Ex_D_External.java b/java/examples/datasets/H5Ex_D_External.java new file mode 100644 index 0000000..5fdc696 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_External.java @@ -0,0 +1,238 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write data to an + external dataset. The program first writes integers to an + external dataset with dataspace dimensions of DIM_XxDIM_Y, + then closes the file. Next, it reopens the file, reads + back the data, and outputs the name of the external data + file and the data to the screen. + ************************************************************/ +package examples.datasets; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_External { + private static String FILENAME = "H5Ex_D_External.h5"; + private static String EXTERNALNAME = "H5Ex_D_External.data"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int RANK = 2; + private static final int NAME_BUF_SIZE = 32; + + private static void writeExternal() { + long file_id = -1; + long dcpl_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize the dataset. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * jndx - jndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // set the external file. + try { + if (dcpl_id >= 0) + H5.H5Pset_external(dcpl_id, EXTERNALNAME, 0, HDF5Constants.H5F_UNLIMITED); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the HDF5Constants.dataset. + try { + if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the dataset. + try { + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void readExternal() { + long file_id = -1; + long dcpl_id = -1; + long dataset_id = -1; + int[][] dset_data = new int[DIM_X][DIM_Y]; + String[] Xname = new String[1]; + + // Open file using the default properties. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open dataset using the default properties. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the dataset creation property list. + try { + if (dataset_id >= 0) + dcpl_id = H5.H5Dget_create_plist(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve and print the name of the external file. + long[] Xsize = new long[NAME_BUF_SIZE]; + try { + if (dcpl_id >= 0) + H5.H5Pget_external(dcpl_id, 0, Xsize.length, Xname, Xsize); + } + catch (Exception e) { + e.printStackTrace(); + } + System.out.println(DATASETNAME + " is stored in file: " + Xname[0]); + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println(DATASETNAME + ":"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // Close the dataset. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_D_External.writeExternal(); + H5Ex_D_External.readExternal(); + } + +} diff --git a/java/examples/datasets/H5Ex_D_FillValue.java b/java/examples/datasets/H5Ex_D_FillValue.java new file mode 100644 index 0000000..982d2cb --- /dev/null +++ b/java/examples/datasets/H5Ex_D_FillValue.java @@ -0,0 +1,246 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to set the fill value for a + dataset. The program first sets the fill value to + FILLVAL, creates a dataset with dimensions of DIM_XxDIM_Y, + reads from the uninitialized dataset, and outputs the + contents to the screen. Next, it writes integers to the + dataset, reads the data back, and outputs it to the + screen. Finally it extends the dataset, reads from it, + and outputs the result to the screen. + ************************************************************/ +package examples.datasets; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_FillValue { + private static String FILENAME = "H5Ex_D_FillValue.h5"; + private static String DATASETNAME = "ExtendibleArray"; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int EDIM_X = 6; + private static final int EDIM_Y = 10; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 4; + private static final int RANK = 2; + private static final int NDIMS = 2; + private static final int FILLVAL = 99; + + private static void fillValue() { + long file_id = -1; + long dcpl_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] extdims = { EDIM_X, EDIM_Y }; + long[] chunk_dims = { CHUNK_X, CHUNK_Y }; + long[] maxdims = { HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED }; + int[][] write_dset_data = new int[DIM_X][DIM_Y]; + int[][] read_dset_data = new int[DIM_X][DIM_Y]; + int[][] extend_dset_data = new int[EDIM_X][EDIM_Y]; + + // Initialize the dataset. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + write_dset_data[indx][jndx] = indx * jndx - jndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace with unlimited dimensions. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, maxdims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Set the chunk size. + try { + if (dcpl_id >= 0) + H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Set the fill value for the dataset + try { + int[] fill_value = { FILLVAL }; + if (dcpl_id >= 0) + H5.H5Pset_fill_value(dcpl_id, HDF5Constants.H5T_NATIVE_INT, fill_value); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Set the allocation time to "early". This way we can be sure + // that reading from the dataset immediately after creation will + // return the fill value. + try { + if (dcpl_id >= 0) + H5.H5Pset_alloc_time(dcpl_id, HDF5Constants.H5D_ALLOC_TIME_EARLY); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset using the dataset creation property list. + try { + if ((file_id >= 0) && (dataspace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read values from the dataset, which has not been written to yet. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, read_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Dataset before being written to:"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(read_dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, write_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data back. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, read_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Dataset after being written to:"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(read_dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // Extend the dataset. + try { + if (dataset_id >= 0) + H5.H5Dset_extent(dataset_id, extdims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read from the extended dataset. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, extend_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Dataset after extension:"); + for (int indx = 0; indx < EDIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < EDIM_Y; jndx++) + System.out.print(extend_dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_D_FillValue.fillValue(); + } + +} diff --git a/java/examples/datasets/H5Ex_D_Gzip.java b/java/examples/datasets/H5Ex_D_Gzip.java new file mode 100644 index 0000000..b813367 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_Gzip.java @@ -0,0 +1,336 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write data to a dataset + using gzip compression (also called zlib or deflate). The + program first checks if gzip compression is available, + then if it is it writes integers to a dataset using gzip, + then closes the file. Next, it reopens the file, reads + back the data, and outputs the type of compression and the + maximum value in the dataset to the screen. + ************************************************************/ +package examples.datasets; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_Gzip { + private static String FILENAME = "H5Ex_D_Gzip.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 32; + private static final int DIM_Y = 64; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 8; + private static final int RANK = 2; + private static final int NDIMS = 2; + + // Values for the status of space allocation + enum H5Z_filter { + H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), H5Z_FILTER_DEFLATE( + HDF5Constants.H5Z_FILTER_DEFLATE), H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), H5Z_FILTER_FLETCHER32( + HDF5Constants.H5Z_FILTER_FLETCHER32), H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), H5Z_FILTER_NBIT( + HDF5Constants.H5Z_FILTER_NBIT), H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), H5Z_FILTER_RESERVED( + HDF5Constants.H5Z_FILTER_RESERVED), H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); + private static final Map lookup = new HashMap(); + + static { + for (H5Z_filter s : EnumSet.allOf(H5Z_filter.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5Z_filter(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5Z_filter get(int code) { + return lookup.get(code); + } + } + + private static boolean checkGzipFilter() { + try { + int available = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE); + if (available == 0) { + System.out.println("gzip filter not available."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_DEFLATE); + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) + || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + System.out.println("gzip filter not available for encoding and decoding."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + return true; + } + + private static void writeGzip() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] chunk_dims = { CHUNK_X, CHUNK_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize data. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * jndx - jndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list, add the gzip compression + // filter. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + if (dcpl_id >= 0) { + H5.H5Pset_deflate(dcpl_id, 9); + // Set the chunk size. + H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readGzip() { + long file_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the dataset creation property list. + try { + if (dataset_id >= 0) + dcpl_id = H5.H5Dget_create_plist(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve and print the filter type. Here we only retrieve the + // first filter because we know that we only added one filter. + try { + if (dcpl_id >= 0) { + // Java lib requires a valid filter_name object and cd_values + int[] flags = { 0 }; + long[] cd_nelmts = { 1 }; + int[] cd_values = { 0 }; + String[] filter_name = { "" }; + int[] filter_config = { 0 }; + int filter_type = -1; + filter_type = H5 + .H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, filter_config); + System.out.print("Filter type is: "); + switch (H5Z_filter.get(filter_type)) { + case H5Z_FILTER_DEFLATE: + System.out.println("H5Z_FILTER_DEFLATE"); + break; + case H5Z_FILTER_SHUFFLE: + System.out.println("H5Z_FILTER_SHUFFLE"); + break; + case H5Z_FILTER_FLETCHER32: + System.out.println("H5Z_FILTER_FLETCHER32"); + break; + case H5Z_FILTER_SZIP: + System.out.println("H5Z_FILTER_SZIP"); + break; + case H5Z_FILTER_NBIT: + System.out.println("H5Z_FILTER_NBIT"); + break; + case H5Z_FILTER_SCALEOFFSET: + System.out.println("H5Z_FILTER_SCALEOFFSET"); + break; + default: + System.out.println("H5Z_FILTER_ERROR"); + } + System.out.println(); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the default properties. + try { + if (dataset_id >= 0) { + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Find the maximum value in the dataset, to verify that it was read + // correctly. + int max = dset_data[0][0]; + for (int indx = 0; indx < DIM_X; indx++) { + for (int jndx = 0; jndx < DIM_Y; jndx++) + if (max < dset_data[indx][jndx]) + max = dset_data[indx][jndx]; + } + // Print the maximum value. + System.out.println("Maximum value in " + DATASETNAME + " is: " + max); + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + // Check if gzip compression is available and can be used for both + // compression and decompression. Normally we do not perform error + // checking in these examples for the sake of clarity, but in this + // case we will make an exception because this filter is an + // optional part of the hdf5 library. + if (H5Ex_D_Gzip.checkGzipFilter()) { + H5Ex_D_Gzip.writeGzip(); + H5Ex_D_Gzip.readGzip(); + } + } + +} diff --git a/java/examples/datasets/H5Ex_D_Hyperslab.java b/java/examples/datasets/H5Ex_D_Hyperslab.java new file mode 100644 index 0000000..482e2c0 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_Hyperslab.java @@ -0,0 +1,269 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write data to a + dataset by hyberslabs. The program first writes integers + in a hyperslab selection to a dataset with dataspace + dimensions of DIM_XxDIM_Y, then closes the file. Next, it + reopens the file, reads back the data, and outputs it to + the screen. Finally it reads the data again using a + different hyperslab selection, and outputs the result to + the screen. + ************************************************************/ +package examples.datasets; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_Hyperslab { + private static String FILENAME = "H5Ex_D_Hyperslab.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 6; + private static final int DIM_Y = 8; + private static final int RANK = 2; + + private static void writeHyperslab() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize data to "1", to make it easier to see the selections. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = 1; + + // Print the data to the screen. + System.out.println("Original Data:"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. We will use all default properties for this example. + try { + if ((file_id >= 0) && (filespace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Define and select the first part of the hyperslab selection. + long[] start = { 0, 0 }; + long[] stride = { 3, 3 }; + long[] count = { 2, 3 }; + long[] block = { 2, 2 }; + try { + if ((filespace_id >= 0)) + H5.H5Sselect_hyperslab(filespace_id, HDF5Constants.H5S_SELECT_SET, start, stride, count, block); + } + catch (Exception e) { + e.printStackTrace(); + } + // Define and select the second part of the hyperslab selection, + // which is subtracted from the first selection by the use of + // H5S_SELECT_NOTB + block[0] = 1; + block[1] = 1; + try { + if ((filespace_id >= 0)) { + H5.H5Sselect_hyperslab(filespace_id, HDF5Constants.H5S_SELECT_NOTB, start, stride, count, block); + + // Write the data to the dataset. + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, filespace_id, + HDF5Constants.H5P_DEFAULT, dset_data); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readHyperslab() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Data as written to disk by hyberslabs:"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // Initialize the read array. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = 0; + + // Define and select the hyperslab to use for reading. + try { + if (dataset_id >= 0) { + filespace_id = H5.H5Dget_space(dataset_id); + + long[] start = { 0, 1 }; + long[] stride = { 4, 4 }; + long[] count = { 2, 2 }; + long[] block = { 2, 3 }; + + if (filespace_id >= 0) { + H5.H5Sselect_hyperslab(filespace_id, HDF5Constants.H5S_SELECT_SET, start, stride, count, block); + + // Read the data using the previously defined hyperslab. + if ((dataset_id >= 0) && (filespace_id >= 0)) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, filespace_id, + HDF5Constants.H5P_DEFAULT, dset_data); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Data as read from disk by hyberslab:"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_D_Hyperslab.writeHyperslab(); + H5Ex_D_Hyperslab.readHyperslab(); + } + +} diff --git a/java/examples/datasets/H5Ex_D_Nbit.java b/java/examples/datasets/H5Ex_D_Nbit.java new file mode 100644 index 0000000..f74b675 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_Nbit.java @@ -0,0 +1,305 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write data to a dataset + using the N-Bit filter. The program first checks if the + N-Bit filter is available, then if it is it writes integers + to a dataset using N-Bit, then closes the file. Next, it + reopens the file, reads back the data, and outputs the type + of filter and the maximum value in the dataset to the screen. + ************************************************************/ + +package examples.datasets; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_Nbit { + private static String FILENAME = "H5Ex_D_Nbit.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 32; + private static final int DIM_Y = 64; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 8; + private static final int RANK = 2; + private static final int NDIMS = 2; + + // Values for the status of space allocation + enum H5Z_filter { + H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), H5Z_FILTER_DEFLATE( + HDF5Constants.H5Z_FILTER_DEFLATE), H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), H5Z_FILTER_FLETCHER32( + HDF5Constants.H5Z_FILTER_FLETCHER32), H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), H5Z_FILTER_NBIT( + HDF5Constants.H5Z_FILTER_NBIT), H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), H5Z_FILTER_RESERVED( + HDF5Constants.H5Z_FILTER_RESERVED), H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); + private static final Map lookup = new HashMap(); + + static { + for (H5Z_filter s : EnumSet.allOf(H5Z_filter.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5Z_filter(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5Z_filter get(int code) { + return lookup.get(code); + } + } + + private static boolean checkNbitFilter() { + try { + // Check if N-Bit compression is available and can be used for both compression and decompression. + int available = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_NBIT); + if (available == 0) { + System.out.println("N-Bit filter not available."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_NBIT); + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) + || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + System.out.println("N-Bit filter not available for encoding and decoding."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + return true; + } + + private static void writeData() throws Exception { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dtype_id = -1; + long dcpl_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] chunk_dims = { CHUNK_X, CHUNK_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize data. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * jndx - jndx; + + try { + // Create a new file using the default properties. + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + filespace_id = H5.H5Screate_simple(RANK, dims, null); + + // Create the datatype to use with the N-Bit filter. It has an uncompressed size of 32 bits, + // but will have a size of 16 bits after being packed by the N-Bit filter. + dtype_id = H5.H5Tcopy(HDF5Constants.H5T_STD_I32LE); + H5.H5Tset_precision(dtype_id, 16); + H5.H5Tset_offset(dtype_id, 5); + + // Create the dataset creation property list, add the N-Bit filter and set the chunk size. + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + H5.H5Pset_nbit(dcpl_id); + H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); + + // Create the dataset. + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, dtype_id, filespace_id, HDF5Constants.H5P_DEFAULT, dcpl_id, + HDF5Constants.H5P_DEFAULT); + + // Write the data to the dataset. + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + finally { + // Close and release resources. + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + if (dtype_id >= 0) + H5.H5Tclose(dtype_id); + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + if (file_id >= 0) + H5.H5Fclose(file_id); + } + } + + private static void readData() throws Exception { + long file_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the dataset creation property list. + try { + if (dataset_id >= 0) + dcpl_id = H5.H5Dget_create_plist(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve and print the filter type. Here we only retrieve the + // first filter because we know that we only added one filter. + try { + if (dcpl_id >= 0) { + // Java lib requires a valid filter_name object and cd_values + int[] flags = { 0 }; + long[] cd_nelmts = { 1 }; + int[] cd_values = { 0 }; + String[] filter_name = { "" }; + int[] filter_config = { 0 }; + int filter_type = -1; + filter_type = H5 + .H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, filter_config); + System.out.print("Filter type is: "); + switch (H5Z_filter.get(filter_type)) { + case H5Z_FILTER_DEFLATE: + System.out.println("H5Z_FILTER_DEFLATE"); + break; + case H5Z_FILTER_SHUFFLE: + System.out.println("H5Z_FILTER_SHUFFLE"); + break; + case H5Z_FILTER_FLETCHER32: + System.out.println("H5Z_FILTER_FLETCHER32"); + break; + case H5Z_FILTER_SZIP: + System.out.println("H5Z_FILTER_SZIP"); + break; + case H5Z_FILTER_NBIT: + System.out.println("H5Z_FILTER_NBIT"); + break; + case H5Z_FILTER_SCALEOFFSET: + System.out.println("H5Z_FILTER_SCALEOFFSET"); + break; + default: + System.out.println("H5Z_FILTER_ERROR"); + } + System.out.println(); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the default properties. + try { + if (dataset_id >= 0) { + int status = H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, + HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, dset_data); + // Check if the read was successful. + if (status < 0) + System.out.print("Dataset read failed!"); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Find the maximum value in the dataset, to verify that it was read + // correctly. + int max = dset_data[0][0]; + for (int indx = 0; indx < DIM_X; indx++) { + for (int jndx = 0; jndx < DIM_Y; jndx++) + if (max < dset_data[indx][jndx]) + max = dset_data[indx][jndx]; + } + // Print the maximum value. + System.out.println("Maximum value in " + DATASETNAME + " is: " + max); + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + /* + * Check if N-Bit compression is available and can be used for both compression and decompression. Normally we + * do not perform error checking in these examples for the sake of clarity, but in this case we will make an + * exception because this filter is an optional part of the hdf5 library. + */ + try { + if (H5Ex_D_Nbit.checkNbitFilter()) { + H5Ex_D_Nbit.writeData(); + H5Ex_D_Nbit.readData(); + } + } + catch (Exception ex) { + ex.printStackTrace(); + } + } +} diff --git a/java/examples/datasets/H5Ex_D_ReadWrite.java b/java/examples/datasets/H5Ex_D_ReadWrite.java new file mode 100644 index 0000000..de94ccb --- /dev/null +++ b/java/examples/datasets/H5Ex_D_ReadWrite.java @@ -0,0 +1,179 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + + This example shows how to read and write data to a + dataset. The program first writes integers to a dataset + with dataspace dimensions of DIM_XxDIM_Y, then closes the + file. Next, it reopens the file, reads back the data, and + outputs it to the screen. + ************************************************************/ +package examples.datasets; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_ReadWrite { + private static String FILENAME = "H5Ex_D_ReadWrite.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int RANK = 2; + + private static void WriteDataset() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize data. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * jndx - jndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. We will use all default properties for this example. + try { + if ((file_id >= 0) && (filespace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void ReadDataset() { + long file_id = -1; + long dataset_id = -1; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Open file using the default properties. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open dataset using the default properties. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println(DATASETNAME + ":"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // Close the dataset. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_D_ReadWrite.WriteDataset(); + H5Ex_D_ReadWrite.ReadDataset(); + } + +} diff --git a/java/examples/datasets/H5Ex_D_Shuffle.java b/java/examples/datasets/H5Ex_D_Shuffle.java new file mode 100644 index 0000000..ac3c1b4 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_Shuffle.java @@ -0,0 +1,373 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write data to a dataset + using the shuffle filter with gzip compression. The + program first checks if the shuffle and gzip filters are + available, then if they are it writes integers to a + dataset using shuffle+gzip, then closes the file. Next, + it reopens the file, reads back the data, and outputs the + types of filters and the maximum value in the dataset to + the screen. + ************************************************************/ +package examples.datasets; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_Shuffle { + private static String FILENAME = "H5Ex_D_Shuffle.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 32; + private static final int DIM_Y = 64; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 8; + private static final int RANK = 2; + private static final int NDIMS = 2; + + // Values for the status of space allocation + enum H5Z_filter { + H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), H5Z_FILTER_DEFLATE( + HDF5Constants.H5Z_FILTER_DEFLATE), H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), H5Z_FILTER_FLETCHER32( + HDF5Constants.H5Z_FILTER_FLETCHER32), H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), H5Z_FILTER_NBIT( + HDF5Constants.H5Z_FILTER_NBIT), H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), H5Z_FILTER_RESERVED( + HDF5Constants.H5Z_FILTER_RESERVED), H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); + private static final Map lookup = new HashMap(); + + static { + for (H5Z_filter s : EnumSet.allOf(H5Z_filter.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5Z_filter(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5Z_filter get(int code) { + return lookup.get(code); + } + } + + private static boolean checkGzipFilter() { + try { + int available = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE); + if (available == 0) { + System.out.println("gzip filter not available."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_DEFLATE); + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) + || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + System.out.println("gzip filter not available for encoding and decoding."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + return true; + } + + private static boolean checkShuffleFilter() { + try { + int available = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SHUFFLE); + if (available == 0) { + System.out.println("Shuffle filter not available."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SHUFFLE); + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) + || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + System.out.println("Shuffle filter not available for encoding and decoding."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + return true; + } + + private static void writeShuffle() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] chunk_dims = { CHUNK_X, CHUNK_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize data. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * jndx - jndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list, add the shuffle + // filter and the gzip compression filter. + // The order in which the filters are added here is significant - + // we will see much greater results when the shuffle is applied + // first. The order in which the filters are added to the property + // list is the order in which they will be invoked when writing + // data. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + if (dcpl_id >= 0) { + H5.H5Pset_shuffle(dcpl_id); + H5.H5Pset_deflate(dcpl_id, 9); + // Set the chunk size. + H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readShuffle() { + long file_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the dataset creation property list. + try { + if (dataset_id >= 0) + dcpl_id = H5.H5Dget_create_plist(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the number of filters, and retrieve and print the + // type of each. + try { + if (dcpl_id >= 0) { + int nfilters = H5.H5Pget_nfilters(dcpl_id); + for (int indx = 0; indx < nfilters; indx++) { + // Java lib requires a valid filter_name object and cd_values + int[] flags = { 0 }; + long[] cd_nelmts = { 1 }; + int[] cd_values = { 0 }; + String[] filter_name = { "" }; + int[] filter_config = { 0 }; + int filter_type = -1; + filter_type = H5.H5Pget_filter(dcpl_id, indx, flags, cd_nelmts, cd_values, 120, filter_name, + filter_config); + System.out.print("Filter " + indx + ": Type is: "); + switch (H5Z_filter.get(filter_type)) { + case H5Z_FILTER_DEFLATE: + System.out.println("H5Z_FILTER_DEFLATE"); + break; + case H5Z_FILTER_SHUFFLE: + System.out.println("H5Z_FILTER_SHUFFLE"); + break; + case H5Z_FILTER_FLETCHER32: + System.out.println("H5Z_FILTER_FLETCHER32"); + break; + case H5Z_FILTER_SZIP: + System.out.println("H5Z_FILTER_SZIP"); + break; + case H5Z_FILTER_NBIT: + System.out.println("H5Z_FILTER_NBIT"); + break; + case H5Z_FILTER_SCALEOFFSET: + System.out.println("H5Z_FILTER_SCALEOFFSET"); + break; + default: + System.out.println("H5Z_FILTER_ERROR"); + } + System.out.println(); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the default properties. + try { + if (dataset_id >= 0) { + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Find the maximum value in the dataset, to verify that it was read + // correctly. + int max = dset_data[0][0]; + for (int indx = 0; indx < DIM_X; indx++) { + for (int jndx = 0; jndx < DIM_Y; jndx++) + if (max < dset_data[indx][jndx]) + max = dset_data[indx][jndx]; + } + // Print the maximum value. + System.out.println("Maximum value in " + DATASETNAME + " is: " + max); + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + // Check if gzip compression is available and can be used for both + // compression and decompression. Normally we do not perform error + // checking in these examples for the sake of clarity, but in this + // case we will make an exception because this filter is an + // optional part of the hdf5 library. + // Similarly, check for availability of the shuffle filter. + if (H5Ex_D_Shuffle.checkGzipFilter() && H5Ex_D_Shuffle.checkShuffleFilter()) { + H5Ex_D_Shuffle.writeShuffle(); + H5Ex_D_Shuffle.readShuffle(); + } + } + +} diff --git a/java/examples/datasets/H5Ex_D_Sofloat.java b/java/examples/datasets/H5Ex_D_Sofloat.java new file mode 100644 index 0000000..26c8d49 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_Sofloat.java @@ -0,0 +1,356 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write data to a dataset + using the Scale-Offset filter. The program first checks + if the Scale-Offset filter is available, then if it is it + writes floating point numbers to a dataset using + Scale-Offset, then closes the file Next, it reopens the + file, reads back the data, and outputs the type of filter + and the maximum value in the dataset to the screen. + ************************************************************/ +package examples.datasets; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_Sofloat { + + private static String FILENAME = "H5Ex_D_Sofloat.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 32; + private static final int DIM_Y = 64; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 8; + private static final int RANK = 2; + private static final int NDIMS = 2; + + // Values for the status of space allocation + enum H5Z_filter { + H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), H5Z_FILTER_DEFLATE( + HDF5Constants.H5Z_FILTER_DEFLATE), H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), H5Z_FILTER_FLETCHER32( + HDF5Constants.H5Z_FILTER_FLETCHER32), H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), H5Z_FILTER_NBIT( + HDF5Constants.H5Z_FILTER_NBIT), H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), H5Z_FILTER_RESERVED( + HDF5Constants.H5Z_FILTER_RESERVED), H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); + private static final Map lookup = new HashMap(); + + static { + for (H5Z_filter s : EnumSet.allOf(H5Z_filter.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5Z_filter(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5Z_filter get(int code) { + return lookup.get(code); + } + } + + private static boolean checkScaleoffsetFilter() { + try { + int available = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SCALEOFFSET); + if (available == 0) { + System.out.println("Scale-Offset filter not available."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SCALEOFFSET); + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) + || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + System.out.println("Scale-Offset filter not available for encoding and decoding."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + return true; + } + + private static void writeData() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] chunk_dims = { CHUNK_X, CHUNK_Y }; + double[][] dset_data = new double[DIM_X][DIM_Y]; + + // Initialize data. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) { + double x = indx; + double y = jndx; + dset_data[indx][jndx] = (x + 1) / (y + 0.3) + y; + } + + // Find the maximum value in the dataset, to verify that it was read correctly. + double max = dset_data[0][0]; + double min = dset_data[0][0]; + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) { + if (max < dset_data[indx][jndx]) + max = dset_data[indx][jndx]; + if (min > dset_data[indx][jndx]) + min = dset_data[indx][jndx]; + } + + // Print the maximum value. + System.out.println("Maximum value in write buffer is: " + max); + System.out.println("Minimum value in write buffer is: " + min); + + // Create a new file using the default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list, add the Scale-Offset + // filter and set the chunk size. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + if (dcpl_id >= 0) { + H5.H5Pset_scaleoffset(dcpl_id, HDF5Constants.H5Z_SO_FLOAT_DSCALE, 2); + H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_IEEE_F64LE, filespace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close and release resources. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close file + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readData() { + long file_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + double[][] dset_data = new double[DIM_X][DIM_Y]; + + // Open file using the default properties. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + // Open dataset using the default properties. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve dataset creation property list. + try { + if (dataset_id >= 0) + dcpl_id = H5.H5Dget_create_plist(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve and print the filter type. Here we only retrieve the + // first filter because we know that we only added one filter. + try { + if (dcpl_id >= 0) { + // Java lib requires a valid filter_name object and cd_values + int[] flags = { 0 }; + long[] cd_nelmts = { 1 }; + int[] cd_values = { 0 }; + String[] filter_name = { "" }; + int[] filter_config = { 0 }; + int filter_type = -1; + + filter_type = H5 + .H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, filter_config); + System.out.print("Filter type is: "); + switch (H5Z_filter.get(filter_type)) { + case H5Z_FILTER_DEFLATE: + System.out.println("H5Z_FILTER_DEFLATE"); + break; + case H5Z_FILTER_SHUFFLE: + System.out.println("H5Z_FILTER_SHUFFLE"); + break; + case H5Z_FILTER_FLETCHER32: + System.out.println("H5Z_FILTER_FLETCHER32"); + break; + case H5Z_FILTER_SZIP: + System.out.println("H5Z_FILTER_SZIP"); + break; + case H5Z_FILTER_NBIT: + System.out.println("H5Z_FILTER_NBIT"); + break; + case H5Z_FILTER_SCALEOFFSET: + System.out.println("H5Z_FILTER_SCALEOFFSET"); + break; + default: + System.out.println("H5Z_FILTER_ERROR"); + } + System.out.println(); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Find the maximum value in the dataset, to verify that it was read correctly. + double max = dset_data[0][0]; + double min = dset_data[0][0]; + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) { + if (max < dset_data[indx][jndx]) + max = dset_data[indx][jndx]; + if (min > dset_data[indx][jndx]) + min = dset_data[indx][jndx]; + } + + // Print the maximum value. + System.out.println("Maximum value in " + DATASETNAME + " is: " + max); + System.out.println("Minimum value in " + DATASETNAME + " is: " + min); + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + + // Check if Scale-Offset compression is available and can be used + // for both compression and decompression. Normally we do not + // perform error checking in these examples for the sake of + // clarity, but in this case we will make an exception because this + // filter is an optional part of the hdf5 library. + if (H5Ex_D_Sofloat.checkScaleoffsetFilter()) { + H5Ex_D_Sofloat.writeData(); + H5Ex_D_Sofloat.readData(); + } + } +} diff --git a/java/examples/datasets/H5Ex_D_Soint.java b/java/examples/datasets/H5Ex_D_Soint.java new file mode 100644 index 0000000..7939883 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_Soint.java @@ -0,0 +1,335 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write data to a dataset + using the Scale-Offset filter. The program first checks + if the Scale-Offset filter is available, then if it is it + writes integers to a dataset using Scale-Offset, then + closes the file Next, it reopens the file, reads back the + data, and outputs the type of filter and the maximum value + in the dataset to the screen. + ************************************************************/ +package examples.datasets; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_Soint { + + private static String FILENAME = "H5Ex_D_Soint.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 32; + private static final int DIM_Y = 64; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 8; + private static final int RANK = 2; + private static final int NDIMS = 2; + + // Values for the status of space allocation + enum H5Z_filter { + H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), H5Z_FILTER_DEFLATE( + HDF5Constants.H5Z_FILTER_DEFLATE), H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), H5Z_FILTER_FLETCHER32( + HDF5Constants.H5Z_FILTER_FLETCHER32), H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), H5Z_FILTER_NBIT( + HDF5Constants.H5Z_FILTER_NBIT), H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), H5Z_FILTER_RESERVED( + HDF5Constants.H5Z_FILTER_RESERVED), H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); + private static final Map lookup = new HashMap(); + + static { + for (H5Z_filter s : EnumSet.allOf(H5Z_filter.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5Z_filter(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5Z_filter get(int code) { + return lookup.get(code); + } + } + + private static boolean checkScaleoffsetFilter() { + try { + int available = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SCALEOFFSET); + if (available == 0) { + System.out.println("Scale-Offset filter not available."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SCALEOFFSET); + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) + || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + System.out.println("Scale-Offset filter not available for encoding and decoding."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + return true; + } + + private static void writeData() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] chunk_dims = { CHUNK_X, CHUNK_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize data. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * jndx - jndx; + + // Create a new file using the default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list, add the Scale-Offset + // filter and set the chunk size. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + if (dcpl_id >= 0) { + H5.H5Pset_scaleoffset(dcpl_id, HDF5Constants.H5Z_SO_INT, HDF5Constants.H5Z_SO_INT_MINBITS_DEFAULT); + H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close and release resources. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close file + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readData() { + long file_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Open file using the default properties. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + // Open dataset using the default properties. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve dataset creation property list. + try { + if (dataset_id >= 0) + dcpl_id = H5.H5Dget_create_plist(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve and print the filter type. Here we only retrieve the + // first filter because we know that we only added one filter. + try { + if (dcpl_id >= 0) { + // Java lib requires a valid filter_name object and cd_values + int[] flags = { 0 }; + long[] cd_nelmts = { 1 }; + int[] cd_values = { 0 }; + String[] filter_name = { "" }; + int[] filter_config = { 0 }; + int filter_type = -1; + + filter_type = H5 + .H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, filter_config); + System.out.print("Filter type is: "); + switch (H5Z_filter.get(filter_type)) { + case H5Z_FILTER_DEFLATE: + System.out.println("H5Z_FILTER_DEFLATE"); + break; + case H5Z_FILTER_SHUFFLE: + System.out.println("H5Z_FILTER_SHUFFLE"); + break; + case H5Z_FILTER_FLETCHER32: + System.out.println("H5Z_FILTER_FLETCHER32"); + break; + case H5Z_FILTER_SZIP: + System.out.println("H5Z_FILTER_SZIP"); + break; + case H5Z_FILTER_NBIT: + System.out.println("H5Z_FILTER_NBIT"); + break; + case H5Z_FILTER_SCALEOFFSET: + System.out.println("H5Z_FILTER_SCALEOFFSET"); + break; + default: + System.out.println("H5Z_FILTER_ERROR"); + } + System.out.println(); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Find the maximum value in the dataset, to verify that it was read correctly. + int max = dset_data[0][0]; + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) { + if (max < dset_data[indx][jndx]) + max = dset_data[indx][jndx]; + } + + // Print the maximum value. + System.out.println("Maximum value in " + DATASETNAME + " is: " + max); + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + + // Check if Scale-Offset compression is available and can be used + // for both compression and decompression. Normally we do not + // perform error checking in these examples for the sake of + // clarity, but in this case we will make an exception because this + // filter is an optional part of the hdf5 library. + if (H5Ex_D_Soint.checkScaleoffsetFilter()) { + H5Ex_D_Soint.writeData(); + H5Ex_D_Soint.readData(); + } + } + +} diff --git a/java/examples/datasets/H5Ex_D_Szip.java b/java/examples/datasets/H5Ex_D_Szip.java new file mode 100644 index 0000000..5258234 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_Szip.java @@ -0,0 +1,337 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write data to a dataset + using szip compression. The program first checks if + szip compression is available, then if it is it writes + integers to a dataset using szip, then closes the file. + Next, it reopens the file, reads back the data, and + outputs the type of compression and the maximum value in + the dataset to the screen. + ************************************************************/ +package examples.datasets; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_Szip { + private static String FILENAME = "H5Ex_D_Szip.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 32; + private static final int DIM_Y = 64; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 8; + private static final int RANK = 2; + private static final int NDIMS = 2; + + // Values for the status of space allocation + enum H5Z_filter { + H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), H5Z_FILTER_DEFLATE( + HDF5Constants.H5Z_FILTER_DEFLATE), H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), H5Z_FILTER_FLETCHER32( + HDF5Constants.H5Z_FILTER_FLETCHER32), H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), H5Z_FILTER_NBIT( + HDF5Constants.H5Z_FILTER_NBIT), H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), H5Z_FILTER_RESERVED( + HDF5Constants.H5Z_FILTER_RESERVED), H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); + private static final Map lookup = new HashMap(); + + static { + for (H5Z_filter s : EnumSet.allOf(H5Z_filter.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5Z_filter(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5Z_filter get(int code) { + return lookup.get(code); + } + } + + private static boolean checkSzipFilter() { + try { + int available = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SZIP); + if (available == 0) { + System.out.println("szip filter not available."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SZIP); + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) + || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + System.out.println("szip filter not available for encoding and decoding."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + return true; + } + + private static void writeSzip() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] chunk_dims = { CHUNK_X, CHUNK_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize data. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * jndx - jndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list, add the szip compression + // filter. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + if (dcpl_id >= 0) { + H5.H5Pset_szip(dcpl_id, HDF5Constants.H5_SZIP_NN_OPTION_MASK, 8); + // Set the chunk size. + H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (filespace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, filespace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readSzip() { + long file_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the dataset creation property list. + try { + if (dataset_id >= 0) + dcpl_id = H5.H5Dget_create_plist(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve and print the filter type. Here we only retrieve the + // first filter because we know that we only added one filter. + try { + if (dcpl_id >= 0) { + // Java lib requires a valid filter_name object and cd_values + int[] flags = { 0 }; + long[] cd_nelmts = { 1 }; + int[] cd_values = { 0 }; + String[] filter_name = { "" }; + int[] filter_config = { 0 }; + int filter_type = -1; + + filter_type = H5 + .H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, filter_config); + System.out.print("Filter type is: "); + switch (H5Z_filter.get(filter_type)) { + case H5Z_FILTER_DEFLATE: + System.out.println("H5Z_FILTER_DEFLATE"); + break; + case H5Z_FILTER_SHUFFLE: + System.out.println("H5Z_FILTER_SHUFFLE"); + break; + case H5Z_FILTER_FLETCHER32: + System.out.println("H5Z_FILTER_FLETCHER32"); + break; + case H5Z_FILTER_SZIP: + System.out.println("H5Z_FILTER_SZIP"); + break; + case H5Z_FILTER_NBIT: + System.out.println("H5Z_FILTER_NBIT"); + break; + case H5Z_FILTER_SCALEOFFSET: + System.out.println("H5Z_FILTER_SCALEOFFSET"); + break; + default: + System.out.println("H5Z_FILTER_ERROR"); + } + System.out.println(); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the default properties. + try { + if (dataset_id >= 0) { + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Find the maximum value in the dataset, to verify that it was read + // correctly. + int max = dset_data[0][0]; + for (int indx = 0; indx < DIM_X; indx++) { + for (int jndx = 0; jndx < DIM_Y; jndx++) + if (max < dset_data[indx][jndx]) + max = dset_data[indx][jndx]; + } + // Print the maximum value. + System.out.println("Maximum value in " + DATASETNAME + " is: " + max); + + // End access to the dataset and release resources used by it. + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + // Check if gzip compression is available and can be used for both + // compression and decompression. Normally we do not perform error + // checking in these examples for the sake of clarity, but in this + // case we will make an exception because this filter is an + // optional part of the hdf5 library. + if (H5Ex_D_Szip.checkSzipFilter()) { + H5Ex_D_Szip.writeSzip(); + H5Ex_D_Szip.readSzip(); + } + } + +} diff --git a/java/examples/datasets/H5Ex_D_Transform.java b/java/examples/datasets/H5Ex_D_Transform.java new file mode 100644 index 0000000..1f289f3 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_Transform.java @@ -0,0 +1,250 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write data to a dataset + using a data transform expression. The program first + writes integers to a dataset using the transform + expression TRANSFORM, then closes the file. Next, it + reopens the file, reads back the data without a transform, + and outputs the data to the screen. Finally it reads the + data using the transform expression RTRANSFORM and outputs + the results to the screen. + ************************************************************/ +package examples.datasets; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_Transform { + + private static String FILE = "H5Ex_D_Transform.h5"; + private static String DATASET = "DS1"; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static String TRANSFORM = "x+1"; + private static String RTRANSFORM = "x-1"; + + private static void writeData() { + long file_id = -1; + long filespace_id = -1; + long dataset_id = -1; + long dxpl_id = -1; + + long[] dims = { DIM_X, DIM_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize data. + for (int i = 0; i < DIM_X; i++) + for (int j = 0; j < DIM_Y; j++) + dset_data[i][j] = i * j - j; + + // Output the data to the screen. + System.out.println("Original Data:"); + for (int i = 0; i < DIM_X; i++) { + System.out.print(" ["); + for (int j = 0; j < DIM_Y; j++) + System.out.print(" " + dset_data[i][j] + " "); + System.out.println("]"); + } + + // Create a new file using the default properties. + try { + file_id = H5.H5Fcreate(FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + filespace_id = H5.H5Screate_simple(2, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset transfer property list and define the transform expression. + try { + dxpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); + if (dxpl_id >= 0) + H5.H5Pset_data_transform(dxpl_id, TRANSFORM); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset using the default properties. Unfortunately we must save as + // a native type or the transform operation will fail. + try { + if ((file_id >= 0) && (filespace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASET, HDF5Constants.H5T_NATIVE_INT, filespace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset using the dataset transfer property list. + try { + if ((dataset_id >= 0) && (dxpl_id >= 0)) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + dxpl_id, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dxpl_id >= 0) + H5.H5Pclose(dxpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readData() { + + long file_id = -1; + long dataset_id = -1; + long dxpl_id = -1; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Open an existing file using the default properties. + try { + file_id = H5.H5Fopen(FILE, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset using the default properties. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASET, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Data as written with transform '" + TRANSFORM + "'"); + for (int i = 0; i < DIM_X; i++) { + System.out.print(" ["); + for (int j = 0; j < DIM_Y; j++) + System.out.print(" " + dset_data[i][j] + " "); + System.out.println("]"); + } + + // Create the dataset transfer property list and define the transform expression. + try { + dxpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); + if (dxpl_id >= 0) + H5.H5Pset_data_transform(dxpl_id, RTRANSFORM); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data using the dataset transfer property list. + try { + if ((dataset_id >= 0) && (dxpl_id >= 0)) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + dxpl_id, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + + System.out.println("Data as written with transform '" + TRANSFORM + "' and read with transform '" + + RTRANSFORM + "'"); + for (int i = 0; i < DIM_X; i++) { + System.out.print(" ["); + for (int j = 0; j < DIM_Y; j++) + System.out.print(" " + dset_data[i][j] + " "); + System.out.println("]"); + } + + // Close and release resources. + try { + if (dxpl_id >= 0) + H5.H5Pclose(dxpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_D_Transform.writeData(); + H5Ex_D_Transform.readData(); + } + +} diff --git a/java/examples/datasets/H5Ex_D_UnlimitedAdd.java b/java/examples/datasets/H5Ex_D_UnlimitedAdd.java new file mode 100644 index 0000000..ada8df0 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_UnlimitedAdd.java @@ -0,0 +1,393 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to create and extend an unlimited + dataset. The program first writes integers to a dataset + with dataspace dimensions of DIM_XxDIM_Y, then closes the + file. Next, it reopens the file, reads back the data, + outputs it to the screen, extends the dataset, and writes + new data to the extended portions of the dataset. Finally + it reopens the file again, reads back the data, and + outputs it to the screen. + ************************************************************/ +package examples.datasets; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_UnlimitedAdd { + private static String FILENAME = "H5Ex_D_UnlimitedAdd.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int EDIM_X = 6; + private static final int EDIM_Y = 10; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 4; + private static final int RANK = 2; + private static final int NDIMS = 2; + + private static void writeUnlimited() { + long file_id = -1; + long dcpl_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] chunk_dims = { CHUNK_X, CHUNK_Y }; + long[] maxdims = { HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize the dataset. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * jndx - jndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace with unlimited dimensions. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, maxdims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Set the chunk size. + try { + if (dcpl_id >= 0) + H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the unlimited dataset. + try { + if ((file_id >= 0) && (dataspace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void extendUnlimited() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] extdims = { EDIM_X, EDIM_Y }; + long[] start = { 0, 0 }; + long[] count = new long[2]; + int[][] dset_data; + int[][] extend_dset_data = new int[EDIM_X][EDIM_Y]; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. This is a + // two dimensional dataset so the dynamic allocation must be done + // in steps. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to rows. + dset_data = new int[(int) dims[0]][(int) dims[1]]; + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Dataset before extension:"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Extend the dataset. + try { + if (dataset_id >= 0) + H5.H5Dset_extent(dataset_id, extdims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the dataspace for the newly extended dataset. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Initialize data for writing to the extended dataset. + for (int indx = 0; indx < EDIM_X; indx++) + for (int jndx = 0; jndx < EDIM_Y; jndx++) + extend_dset_data[indx][jndx] = jndx; + + // Select the entire dataspace. + try { + if (dataspace_id >= 0) { + H5.H5Sselect_all(dataspace_id); + + // Subtract a hyperslab reflecting the original dimensions from the + // selection. The selection now contains only the newly extended + // portions of the dataset. + count[0] = dims[0]; + count[1] = dims[1]; + H5.H5Sselect_hyperslab(dataspace_id, HDF5Constants.H5S_SELECT_NOTB, start, null, count, null); + + // Write the data to the selected portion of the dataset. + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, dataspace_id, + HDF5Constants.H5P_DEFAULT, extend_dset_data); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readUnlimited() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + int[][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for the read buffer as before. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + // Allocate array of pointers to rows. + dset_data = new int[(int) dims[0]][(int) dims[1]]; + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Dataset after extension:"); + for (int indx = 0; indx < dims[0]; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < dims[1]; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_D_UnlimitedAdd.writeUnlimited(); + H5Ex_D_UnlimitedAdd.extendUnlimited(); + H5Ex_D_UnlimitedAdd.readUnlimited(); + } + +} diff --git a/java/examples/datasets/H5Ex_D_UnlimitedGzip.java b/java/examples/datasets/H5Ex_D_UnlimitedGzip.java new file mode 100644 index 0000000..c08ceef --- /dev/null +++ b/java/examples/datasets/H5Ex_D_UnlimitedGzip.java @@ -0,0 +1,504 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to create and extend an unlimited + dataset with gzip compression. The program first writes + integers to a gzip compressed dataset with dataspace + dimensions of DIM_XxDIM_Y, then closes the file. Next, it + reopens the file, reads back the data, outputs it to the + screen, extends the dataset, and writes new data to the + extended portions of the dataset. Finally it reopens the + file again, reads back the data, and outputs it to the + screen. + ************************************************************/ +package examples.datasets; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_UnlimitedGzip { + private static String FILENAME = "H5Ex_D_UnlimitedGzip.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int EDIM_X = 6; + private static final int EDIM_Y = 10; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 4; + private static final int RANK = 2; + private static final int NDIMS = 2; + + // Values for the status of space allocation + enum H5Z_filter { + H5Z_FILTER_ERROR(HDF5Constants.H5Z_FILTER_ERROR), H5Z_FILTER_NONE(HDF5Constants.H5Z_FILTER_NONE), H5Z_FILTER_DEFLATE( + HDF5Constants.H5Z_FILTER_DEFLATE), H5Z_FILTER_SHUFFLE(HDF5Constants.H5Z_FILTER_SHUFFLE), H5Z_FILTER_FLETCHER32( + HDF5Constants.H5Z_FILTER_FLETCHER32), H5Z_FILTER_SZIP(HDF5Constants.H5Z_FILTER_SZIP), H5Z_FILTER_NBIT( + HDF5Constants.H5Z_FILTER_NBIT), H5Z_FILTER_SCALEOFFSET(HDF5Constants.H5Z_FILTER_SCALEOFFSET), H5Z_FILTER_RESERVED( + HDF5Constants.H5Z_FILTER_RESERVED), H5Z_FILTER_MAX(HDF5Constants.H5Z_FILTER_MAX); + private static final Map lookup = new HashMap(); + + static { + for (H5Z_filter s : EnumSet.allOf(H5Z_filter.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5Z_filter(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5Z_filter get(int code) { + return lookup.get(code); + } + } + + private static boolean checkGzipFilter() { + try { + int available = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE); + if (available == 0) { + System.out.println("gzip filter not available."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + int filter_info = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_DEFLATE); + if (((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) == 0) + || ((filter_info & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) == 0)) { + System.out.println("gzip filter not available for encoding and decoding."); + return false; + } + } + catch (Exception e) { + e.printStackTrace(); + } + return true; + } + + private static void writeUnlimited() { + long file_id = -1; + long dcpl_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] chunk_dims = { CHUNK_X, CHUNK_Y }; + long[] maxdims = { HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize the dataset. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * jndx - jndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace with unlimited dimensions. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, maxdims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list, add the gzip compression + // filter. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + if (dcpl_id >= 0) { + H5.H5Pset_deflate(dcpl_id, 9); + // Set the chunk size. + H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the unlimited dataset. + try { + if ((file_id >= 0) && (dataspace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void extendUnlimited() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] extdims = { EDIM_X, EDIM_Y }; + long[] start = { 0, 0 }; + long[] count = new long[2]; + int[][] dset_data; + int[][] extend_dset_data = new int[EDIM_X][EDIM_Y]; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. This is a + // two dimensional dataset so the dynamic allocation must be done + // in steps. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to rows. + dset_data = new int[(int) dims[0]][(int) dims[1]]; + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Dataset before extension:"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Extend the dataset. + try { + if (dataset_id >= 0) + H5.H5Dset_extent(dataset_id, extdims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the dataspace for the newly extended dataset. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Initialize data for writing to the extended dataset. + for (int indx = 0; indx < EDIM_X; indx++) + for (int jndx = 0; jndx < EDIM_Y; jndx++) + extend_dset_data[indx][jndx] = jndx; + + // Select the entire dataspace. + try { + if (dataspace_id >= 0) { + H5.H5Sselect_all(dataspace_id); + + // Subtract a hyperslab reflecting the original dimensions from the + // selection. The selection now contains only the newly extended + // portions of the dataset. + count[0] = dims[0]; + count[1] = dims[1]; + H5.H5Sselect_hyperslab(dataspace_id, HDF5Constants.H5S_SELECT_NOTB, start, null, count, null); + + // Write the data to the selected portion of the dataset. + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, dataspace_id, + HDF5Constants.H5P_DEFAULT, extend_dset_data); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readUnlimited() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long dcpl_id = -1; + long[] dims = { DIM_X, DIM_Y }; + int[][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the dataset creation property list. + try { + if (dataset_id >= 0) + dcpl_id = H5.H5Dget_create_plist(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve and print the filter type. Here we only retrieve the + // first filter because we know that we only added one filter. + try { + if (dcpl_id >= 0) { + // Java lib requires a valid filter_name object and cd_values + int[] flags = { 0 }; + long[] cd_nelmts = { 1 }; + int[] cd_values = { 0 }; + String[] filter_name = { "" }; + int[] filter_config = { 0 }; + int filter_type = -1; + filter_type = H5 + .H5Pget_filter(dcpl_id, 0, flags, cd_nelmts, cd_values, 120, filter_name, filter_config); + System.out.print("Filter type is: "); + switch (H5Z_filter.get(filter_type)) { + case H5Z_FILTER_DEFLATE: + System.out.println("H5Z_FILTER_DEFLATE"); + break; + case H5Z_FILTER_SHUFFLE: + System.out.println("H5Z_FILTER_SHUFFLE"); + break; + case H5Z_FILTER_FLETCHER32: + System.out.println("H5Z_FILTER_FLETCHER32"); + break; + case H5Z_FILTER_SZIP: + System.out.println("H5Z_FILTER_SZIP"); + break; + default: + System.out.println("H5Z_FILTER_ERROR"); + } + System.out.println(); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for the read buffer as before. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + // Allocate array of pointers to rows. + dset_data = new int[(int) dims[0]][(int) dims[1]]; + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Dataset after extension:"); + for (int indx = 0; indx < dims[0]; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < dims[1]; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + // Check if gzip compression is available and can be used for both + // compression and decompression. Normally we do not perform error + // checking in these examples for the sake of clarity, but in this + // case we will make an exception because this filter is an + // optional part of the hdf5 library. + if (H5Ex_D_UnlimitedGzip.checkGzipFilter()) { + H5Ex_D_UnlimitedGzip.writeUnlimited(); + H5Ex_D_UnlimitedGzip.extendUnlimited(); + H5Ex_D_UnlimitedGzip.readUnlimited(); + } + } + +} diff --git a/java/examples/datasets/H5Ex_D_UnlimitedMod.java b/java/examples/datasets/H5Ex_D_UnlimitedMod.java new file mode 100644 index 0000000..884cad3 --- /dev/null +++ b/java/examples/datasets/H5Ex_D_UnlimitedMod.java @@ -0,0 +1,379 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to create and extend an unlimited + dataset. The program first writes integers to a dataset + with dataspace dimensions of DIM_XxDIM_Y, then closes the + file. Next, it reopens the file, reads back the data, + outputs it to the screen, extends the dataset, and writes + new data to the entire extended dataset. Finally it + reopens the file again, reads back the data, and utputs it + to the screen. + ************************************************************/ +package examples.datasets; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_D_UnlimitedMod { + private static String FILENAME = "H5Ex_D_UnlimitedMod.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int EDIM_X = 6; + private static final int EDIM_Y = 10; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 4; + private static final int RANK = 2; + private static final int NDIMS = 2; + + private static void writeUnlimited() { + long file_id = -1; + long dcpl_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] chunk_dims = { CHUNK_X, CHUNK_Y }; + long[] maxdims = { HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize the dataset. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * jndx - jndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace with unlimited dimensions. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, maxdims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset creation property list. + try { + dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Set the chunk size. + try { + if (dcpl_id >= 0) + H5.H5Pset_chunk(dcpl_id, NDIMS, chunk_dims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the unlimited dataset. + try { + if ((file_id >= 0) && (dataspace_id >= 0) && (dcpl_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dcpl_id >= 0) + H5.H5Pclose(dcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void extendUnlimited() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + long[] extdims = { EDIM_X, EDIM_Y }; + int[][] dset_data; + int[][] extend_dset_data = new int[EDIM_X][EDIM_Y]; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. This is a + // two dimensional dataset so the dynamic allocation must be done + // in steps. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to rows. + dset_data = new int[(int) dims[0]][(int) dims[1]]; + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Dataset before extension:"); + for (int indx = 0; indx < DIM_X; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < DIM_Y; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Extend the dataset. + try { + if (dataset_id >= 0) + H5.H5Dset_extent(dataset_id, extdims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve the dataspace for the newly extended dataset. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Initialize data for writing to the extended dataset. + for (int indx = 0; indx < EDIM_X; indx++) + for (int jndx = 0; jndx < EDIM_Y; jndx++) + extend_dset_data[indx][jndx] = jndx; + + // Write the data tto the extended dataset. + try { + if ((dataspace_id >= 0) && (dataset_id >= 0)) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, dataspace_id, + HDF5Constants.H5P_DEFAULT, extend_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readUnlimited() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + int[][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for the read buffer as before. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + // Allocate array of pointers to rows. + dset_data = new int[(int) dims[0]][(int) dims[1]]; + + // Read the data using the default properties. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Dataset after extension:"); + for (int indx = 0; indx < dims[0]; indx++) { + System.out.print(" [ "); + for (int jndx = 0; jndx < dims[1]; jndx++) + System.out.print(dset_data[indx][jndx] + " "); + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_D_UnlimitedMod.writeUnlimited(); + H5Ex_D_UnlimitedMod.extendUnlimited(); + H5Ex_D_UnlimitedMod.readUnlimited(); + } + +} diff --git a/java/examples/datasets/Makefile.am b/java/examples/datasets/Makefile.am new file mode 100644 index 0000000..49888a0 --- /dev/null +++ b/java/examples/datasets/Makefile.am @@ -0,0 +1,78 @@ +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +## +## Makefile.am +## Run automake to generate a Makefile.in from this file. +## +# +# HDF5 Java Library Examples Makefile(.in) + +include $(top_srcdir)/config/commence.am + +# Mark this directory as part of the JNI API +JAVA_API=yes + +JAVAROOT = .classes + +classes: + $(MKDIR_P) $(@D)/$(JAVAROOT) + +pkgpath = examples/datasets +hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar +CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.5.jar:$$CLASSPATH + +jarfile = jar$(PACKAGE_TARNAME)datasets.jar + +AM_JAVACFLAGS = $(H5_JAVACFLAGS) -deprecation + +TESTPACKAGE = + +noinst_JAVA = \ + H5Ex_D_Alloc.java \ + H5Ex_D_Checksum.java \ + H5Ex_D_Chunk.java \ + H5Ex_D_Compact.java \ + H5Ex_D_External.java \ + H5Ex_D_FillValue.java \ + H5Ex_D_Gzip.java \ + H5Ex_D_Hyperslab.java \ + H5Ex_D_ReadWrite.java \ + H5Ex_D_Shuffle.java \ + H5Ex_D_Szip.java \ + H5Ex_D_UnlimitedAdd.java \ + H5Ex_D_UnlimitedGzip.java \ + H5Ex_D_UnlimitedMod.java \ + H5Ex_D_Nbit.java \ + H5Ex_D_Transform.java \ + H5Ex_D_Sofloat.java \ + H5Ex_D_Soint.java + +$(jarfile): classnoinst.stamp classes + $(JAR) cvf $@ -C $(JAVAROOT)/ $(pkgpath) + +noinst_DATA = $(jarfile) + +.PHONY: classes + +check_SCRIPTS = runExample.sh +TEST_SCRIPT = $(check_SCRIPTS) + +CLEANFILES = classnoinst.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class runExample.sh + +clean: + rm -rf $(JAVAROOT) + rm -f $(jarfile) + rm -f classnoinst.stamp + +include $(top_srcdir)/config/conclude.am diff --git a/java/examples/datasets/runExample.sh.in b/java/examples/datasets/runExample.sh.in new file mode 100644 index 0000000..8ac28a7 --- /dev/null +++ b/java/examples/datasets/runExample.sh.in @@ -0,0 +1,413 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# + +top_builddir=@top_builddir@ +top_srcdir=@top_srcdir@ +srcdir=@srcdir@ + +USE_FILTER_SZIP="@USE_FILTER_SZIP@" +USE_FILTER_DEFLATE="@USE_FILTER_DEFLATE@" + +TESTNAME=EX_Datasets +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +# Set up default variable values if not supplied by the user. +RM='rm -rf' +CMP='cmp' +DIFF='diff -c' +CP='cp' +DIRNAME='dirname' +LS='ls' +AWK='awk' + +nerrors=0 + +# where the libs exist +HDFLIB_HOME="$top_srcdir/java/lib" +BLDLIBDIR="./lib" +BLDDIR="." +HDFTEST_HOME="$top_srcdir/java/examples/datasets" +JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar +TESTJARFILE=jar@PACKAGE_TARNAME@datasets.jar +test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR + +###################################################################### +# library files +# -------------------------------------------------------------------- +# All the library files copy from source directory to test directory +# NOTE: Keep this framework to add/remove test files. +# This list are also used for checking exist. +# Comment '#' without space can be used. +# -------------------------------------------------------------------- +LIST_LIBRARY_FILES=" +$HDFLIB_HOME/slf4j-api-1.7.5.jar +$HDFLIB_HOME/ext/slf4j-simple-1.7.5.jar +$top_builddir/src/.libs/libhdf5.* +$top_builddir/java/src/jni/.libs/libhdf5_java.* +$top_builddir/java/src/$JARFILE +" +LIST_DATA_FILES=" +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Alloc.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Checksum.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Chunk.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Compact.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_External.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_FillValue.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Gzip.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Hyperslab.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_ReadWrite.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Shuffle.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Szip.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_UnlimitedAdd.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_UnlimitedGzip.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_UnlimitedMod.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Nbit.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Transform.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Sofloat.txt +$HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Soint.txt +" + +# +# copy files from source dirs to test dir +# +COPY_LIBFILES="$LIST_LIBRARY_FILES" + +COPY_LIBFILES_TO_BLDLIBDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_LIBFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDLIBDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done +} + +CLEAN_LIBFILES_AND_BLDLIBDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $BLDLIBDIR + fi +} + +COPY_DATAFILES="$LIST_DATA_FILES" + +COPY_DATAFILES_TO_BLDDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_DATAFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done +} + +CLEAN_DATAFILES_AND_BLDDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $BLDDIR/*.txt + $RM $BLDDIR/*.out + fi +} + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Testing". +# +TESTING() { + SPACES=" " + echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# where Java is installed (requires jdk1.7.x) +JAVAEXE=@JAVA@ +JAVAEXEFLAGS=@H5_JAVAFLAGS@ + +############################################################################### +# DO NOT MODIFY BELOW THIS LINE +############################################################################### + +# prepare for test +COPY_LIBFILES_TO_BLDLIBDIR +COPY_DATAFILES_TO_BLDDIR + +CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.5.jar:"$BLDLIBDIR"/slf4j-simple-1.7.5.jar:"$TESTJARFILE"" + +TEST=/usr/bin/test +if [ ! -x /usr/bin/test ] +then +TEST=`which test` +fi + +if $TEST -z "$CLASSPATH"; then + CLASSPATH="" +fi +CLASSPATH=$CPATH":"$CLASSPATH +export CLASSPATH + +if $TEST -n "$JAVAPATH" ; then + PATH=$JAVAPATH":"$PATH + export PATH +fi + +if $TEST -e /bin/uname; then + os_name=`/bin/uname -s` +elif $TEST -e /usr/bin/uname; then + os_name=`/usr/bin/uname -s` +else + os_name=unknown +fi + +if $TEST -z "$LD_LIBRARY_PATH" ; then + LD_LIBRARY_PATH="" +fi + +case $os_name in + Darwin) + DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH + export DYLD_LIBRARY_PATH + LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH + ;; + *) + LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH + ;; +esac + +export LD_LIBRARY_PATH + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Alloc" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Alloc > H5Ex_D_Alloc.out) +if diff H5Ex_D_Alloc.out examples.datasets.H5Ex_D_Alloc.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_Alloc" +else + echo "**FAILED** datasets.H5Ex_D_Alloc" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Checksum" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Checksum > H5Ex_D_Checksum.out) +if diff H5Ex_D_Checksum.out examples.datasets.H5Ex_D_Checksum.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_Checksum" +else + echo "**FAILED** datasets.H5Ex_D_Checksum" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Chunk" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Chunk > H5Ex_D_Chunk.out) +if diff H5Ex_D_Chunk.out examples.datasets.H5Ex_D_Chunk.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_Chunk" +else + echo "**FAILED** datasets.H5Ex_D_Chunk" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Compact" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Compact > H5Ex_D_Compact.out) +if diff H5Ex_D_Compact.out examples.datasets.H5Ex_D_Compact.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_Compact" +else + echo "**FAILED** datasets.H5Ex_D_Compact" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_External" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_External > H5Ex_D_External.out) +if diff H5Ex_D_External.out examples.datasets.H5Ex_D_External.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_External" +else + echo "**FAILED** datasets.H5Ex_D_External" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_FillValue" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_FillValue > H5Ex_D_FillValue.out) +if diff H5Ex_D_FillValue.out examples.datasets.H5Ex_D_FillValue.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_FillValue" +else + echo "**FAILED** datasets.H5Ex_D_FillValue" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Gzip" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Gzip > H5Ex_D_Gzip.out) +if diff H5Ex_D_Gzip.out examples.datasets.H5Ex_D_Gzip.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_Gzip" +else + echo "**FAILED** datasets.H5Ex_D_Gzip" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Hyperslab" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Hyperslab > H5Ex_D_Hyperslab.out) +if diff H5Ex_D_Hyperslab.out examples.datasets.H5Ex_D_Hyperslab.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_Hyperslab" +else + echo "**FAILED** datasets.H5Ex_D_Hyperslab" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_ReadWrite" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_ReadWrite > H5Ex_D_ReadWrite.out) +if diff H5Ex_D_ReadWrite.out examples.datasets.H5Ex_D_ReadWrite.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_ReadWrite" +else + echo "**FAILED** datasets.H5Ex_D_ReadWrite" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Shuffle" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Shuffle > H5Ex_D_Shuffle.out) +if diff H5Ex_D_Shuffle.out examples.datasets.H5Ex_D_Shuffle.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_Shuffle" +else + echo "**FAILED** datasets.H5Ex_D_Shuffle" + nerrors="`expr $nerrors + 1`" +fi + +if test $USE_FILTER_SZIP = "yes"; then + echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Szip" + ($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Szip > H5Ex_D_Szip.out) + if diff H5Ex_D_Szip.out examples.datasets.H5Ex_D_Szip.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_Szip" + else + echo "**FAILED** datasets.H5Ex_D_Szip" + nerrors="`expr $nerrors + 1`" + fi +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_UnlimitedAdd" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_UnlimitedAdd > H5Ex_D_UnlimitedAdd.out) +if diff H5Ex_D_UnlimitedAdd.out examples.datasets.H5Ex_D_UnlimitedAdd.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_UnlimitedAdd" +else + echo "**FAILED** datasets.H5Ex_D_UnlimitedAdd" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_UnlimitedGzip" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_UnlimitedGzip > H5Ex_D_UnlimitedGzip.out) +if diff H5Ex_D_External.out examples.datasets.H5Ex_D_External.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_UnlimitedGzip" +else + echo "**FAILED** datasets.H5Ex_D_UnlimitedGzip" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_UnlimitedMod" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_UnlimitedMod > H5Ex_D_UnlimitedMod.out) +if diff H5Ex_D_UnlimitedMod.out examples.datasets.H5Ex_D_UnlimitedMod.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_UnlimitedMod" +else + echo "**FAILED** datasets.H5Ex_D_UnlimitedMod" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Nbit" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Nbit > H5Ex_D_Nbit.out) +if diff H5Ex_D_Nbit.out examples.datasets.H5Ex_D_Nbit.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_Nbit" +else + echo "**FAILED** datasets.H5Ex_D_Nbit" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Transform" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Transform > H5Ex_D_Transform.out) +if diff H5Ex_D_Transform.out examples.datasets.H5Ex_D_Transform.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_Transform" +else + echo "**FAILED** datasets.H5Ex_D_Transform" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Sofloat" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Sofloat > H5Ex_D_Sofloat.out) +if diff H5Ex_D_Sofloat.out examples.datasets.H5Ex_D_Sofloat.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_Sofloat" +else + echo "**FAILED** datasets.H5Ex_D_Sofloat" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Soint" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datasets.H5Ex_D_Soint > H5Ex_D_Soint.out) +if diff H5Ex_D_Soint.out examples.datasets.H5Ex_D_Soint.txt > /dev/null; then + echo " PASSED datasets.H5Ex_D_Soint" +else + echo "**FAILED** datasets.H5Ex_D_Soint" + nerrors="`expr $nerrors + 1`" +fi + +# Clean up temporary files/directories +CLEAN_LIBFILES_AND_BLDLIBDIR +CLEAN_DATAFILES_AND_BLDDIR + +# Report test results and exit +if test $nerrors -eq 0 ; then + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE +fi diff --git a/java/examples/datatypes/CMakeLists.txt b/java/examples/datatypes/CMakeLists.txt new file mode 100644 index 0000000..6525506 --- /dev/null +++ b/java/examples/datatypes/CMakeLists.txt @@ -0,0 +1,109 @@ +cmake_minimum_required (VERSION 3.1.0) +PROJECT (HDFJAVA_EXAMPLES_DATATYPES Java) + +set (CMAKE_VERBOSE_MAKEFILE 1) + +INCLUDE_DIRECTORIES ( + ${HDF5_JAVA_JNI_BINARY_DIR} + ${HDF5_JAVA_HDF5_LIB_DIR} +) + +set (HDF_JAVA_EXAMPLES + H5Ex_T_Array + H5Ex_T_ArrayAttribute + H5Ex_T_Bit + H5Ex_T_BitAttribute + H5Ex_T_Commit + H5Ex_T_Compound + H5Ex_T_CompoundAttribute + H5Ex_T_Float + H5Ex_T_FloatAttribute + H5Ex_T_Integer + H5Ex_T_IntegerAttribute + H5Ex_T_ObjectReference + H5Ex_T_ObjectReferenceAttribute + H5Ex_T_Opaque + H5Ex_T_OpaqueAttribute + H5Ex_T_String + H5Ex_T_StringAttribute + H5Ex_T_VLString +) + +if (WIN32) + set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") +else (WIN32) + set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") +endif (WIN32) + +set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS}") + +set (CMAKE_JAVA_CLASSPATH ".") +foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH}) + set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}") +endforeach (CMAKE_INCLUDE_PATH) + +foreach (example ${HDF_JAVA_EXAMPLES}) + file (WRITE ${PROJECT_BINARY_DIR}/${example}_Manifest.txt + "Main-Class: examples.datatypes.${example} +" + ) + add_jar (${example} MANIFEST ${PROJECT_BINARY_DIR}/${example}_Manifest.txt ${example}.java) + get_target_property (${example}_JAR_FILE ${example} JAR_FILE) +# install_jar (${example} ${HJAVA_INSTALL_DATA_DIR}/examples examples) + get_target_property (${example}_CLASSPATH ${example} CLASSDIR) + add_dependencies (${example} ${HDF5_JAVA_HDF5_LIB_TARGET}) +endforeach (example ${HDF_JAVA_EXAMPLES}) + +set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS};${HDF5_JAVA_LOGGING_JAR};${HDF5_JAVA_LOGGING_NOP_JAR}") + +set (CMAKE_JAVA_CLASSPATH ".") +foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) + set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}") +endforeach (HDFJAVA_JAR) + +MACRO (ADD_H5_TEST resultfile resultcode) + add_test ( + NAME JAVA_datatypes-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" + -D "TEST_PROGRAM=examples.datatypes.${resultfile}" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" + -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" + -D "TEST_OUTPUT=datatypes/${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=datatypes/${resultfile}.txt" + -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (JAVA_datatypes-${resultfile} PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + set (last_test "JAVA_datatypes-${resultfile}") +ENDMACRO (ADD_H5_TEST file) + +if (BUILD_TESTING) + foreach (example ${HDF_JAVA_EXAMPLES}) + add_test ( + NAME JAVA_datatypes-${example}-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 + ${example}.out + ${example}.out.err + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (JAVA_datatypes-${example}-clearall-objects PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + add_test ( + NAME JAVA_datatypes-${example}-copy-objects + COMMAND ${CMAKE_COMMAND} + -E copy_if_different + ${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.datatypes.${example}.txt + ${HDFJAVA_EXAMPLES_DATATYPES_BINARY_DIR}/${example}.txt + ) + set_tests_properties (JAVA_datatypes-${example}-copy-objects PROPERTIES DEPENDS JAVA_datatypes-${example}-clearall-objects) + set (last_test "JAVA_datatypes-${example}-copy-objects") + ADD_H5_TEST (${example} 0) + endforeach (example ${HDF_JAVA_EXAMPLES}) +endif (BUILD_TESTING) diff --git a/java/examples/datatypes/H5Ex_T_Array.java b/java/examples/datatypes/H5Ex_T_Array.java new file mode 100644 index 0000000..7b7009a --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_Array.java @@ -0,0 +1,282 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write array datatypes + to a dataset. The program first writes integers arrays of + dimension ADIM0xADIM1 to a dataset with a dataspace of + DIM0, then closes the file. Next, it reopens the file, + reads back the data, and outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_Array { + private static String FILENAME = "H5Ex_T_Array.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM0 = 4; + private static final int ADIM0 = 3; + private static final int ADIM1 = 5; + private static final int RANK = 1; + private static final int NDIMS = 2; + + private static void CreateDataset() { + long file_id = -1; + long filetype_id = -1; + long memtype_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM0 }; + long[] adims = { ADIM0, ADIM1 }; + int[][][] dset_data = new int[DIM0][ADIM0][ADIM1]; + + // Initialize data. indx is the element in the dataspace, jndx and kndx the + // elements within the array datatype. + for (int indx = 0; indx < DIM0; indx++) + for (int jndx = 0; jndx < ADIM0; jndx++) + for (int kndx = 0; kndx < ADIM1; kndx++) + dset_data[indx][jndx][kndx] = indx * jndx - jndx * kndx + indx * kndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create array datatypes for file. + try { + filetype_id = H5.H5Tarray_create(HDF5Constants.H5T_STD_I64LE, NDIMS, adims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create array datatypes for memory. + try { + memtype_id = H5.H5Tarray_create(HDF5Constants.H5T_NATIVE_INT, NDIMS, adims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (dataspace_id >= 0) && (filetype_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, filetype_id, dataspace_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the dataset. + try { + if ((dataset_id >= 0) && (memtype_id >= 0)) + H5.H5Dwrite(dataset_id, memtype_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the file type. + try { + if (filetype_id >= 0) + H5.H5Tclose(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (memtype_id >= 0) + H5.H5Tclose(memtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long filetype_id = -1; + long memtype_id = -1; + long dataset_id = -1; + long[] dims = { DIM0 }; + long[] adims = { ADIM0, ADIM1 }; + int[][][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get the datatype. + try { + if (dataset_id >= 0) + filetype_id = H5.H5Dget_type(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get the datatype's dimensions. + try { + if (filetype_id >= 0) + H5.H5Tget_array_dims(filetype_id, adims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to two-dimensional arrays (the + // elements of the dataset. + dset_data = new int[(int) dims[0]][(int) (adims[0])][(int) (adims[1])]; + + // Create array datatypes for memory. + try { + memtype_id = H5.H5Tarray_create(HDF5Constants.H5T_NATIVE_INT, 2, adims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read data. + try { + if ((dataset_id >= 0) && (memtype_id >= 0)) + H5.H5Dread(dataset_id, memtype_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + for (int indx = 0; indx < dims[0]; indx++) { + System.out.println(DATASETNAME + " [" + indx + "]:"); + for (int jndx = 0; jndx < adims[0]; jndx++) { + System.out.print(" ["); + for (int kndx = 0; kndx < adims[1]; kndx++) + System.out.print(dset_data[indx][jndx][kndx] + " "); + System.out.println("]"); + } + System.out.println(); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the file type. + try { + if (filetype_id >= 0) + H5.H5Tclose(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (memtype_id >= 0) + H5.H5Tclose(memtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_Array.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_Array.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_ArrayAttribute.java b/java/examples/datatypes/H5Ex_T_ArrayAttribute.java new file mode 100644 index 0000000..ce97457 --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_ArrayAttribute.java @@ -0,0 +1,322 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write array datatypes + to an attribute. The program first writes integers arrays + of dimension ADIM0xADIM1 to an attribute with a dataspace + of DIM0, then closes the file. Next, it reopens the + file, reads back the data, and outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_ArrayAttribute { + private static String FILENAME = "H5Ex_T_ArrayAttribute.h5"; + private static String DATASETNAME = "DS1"; + private static String ATTRIBUTENAME = "A1"; + private static final int DIM0 = 4; + private static final int ADIM0 = 3; + private static final int ADIM1 = 5; + private static final int RANK = 1; + private static final int NDIMS = 2; + + private static void CreateDataset() { + long file_id = -1; + long filetype_id = -1; + long memtype_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0 }; + long[] adims = { ADIM0, ADIM1 }; + int[][][] dset_data = new int[DIM0][ADIM0][ADIM1]; + + // Initialize data. indx is the element in the dataspace, jndx and kndx the + // elements within the array datatype. + for (int indx = 0; indx < DIM0; indx++) + for (int jndx = 0; jndx < ADIM0; jndx++) + for (int kndx = 0; kndx < ADIM1; kndx++) + dset_data[indx][jndx][kndx] = indx * jndx - jndx * kndx + indx * kndx; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create array datatypes for file. + try { + filetype_id = H5.H5Tarray_create(HDF5Constants.H5T_STD_I64LE, NDIMS, adims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create array datatypes for memory. + try { + memtype_id = H5.H5Tarray_create(HDF5Constants.H5T_NATIVE_INT, NDIMS, adims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataset with a scalar dataspace. + try { + dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); + if (dataspace_id >= 0) { + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Sclose(dataspace_id); + dataspace_id = -1; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the attribute and write the array data to it. + try { + if ((dataset_id >= 0) && (dataspace_id >= 0) && (filetype_id >= 0)) + attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, filetype_id, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the dataset. + try { + if ((attribute_id >= 0) && (memtype_id >= 0)) + H5.H5Awrite(attribute_id, memtype_id, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the file type. + try { + if (filetype_id >= 0) + H5.H5Tclose(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (memtype_id >= 0) + H5.H5Tclose(memtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long filetype_id = -1; + long memtype_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0 }; + long[] adims = { ADIM0, ADIM1 }; + int[][][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get the datatype. + try { + if (attribute_id >= 0) + filetype_id = H5.H5Aget_type(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get the datatype's dimensions. + try { + if (filetype_id >= 0) + H5.H5Tget_array_dims(filetype_id, adims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to two-dimensional arrays (the + // elements of the dataset. + dset_data = new int[(int) dims[0]][(int) (adims[0])][(int) (adims[1])]; + + // Create array datatypes for memory. + try { + memtype_id = H5.H5Tarray_create(HDF5Constants.H5T_NATIVE_INT, 2, adims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read data. + try { + if ((attribute_id >= 0) && (memtype_id >= 0)) + H5.H5Aread(attribute_id, memtype_id, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + for (int indx = 0; indx < dims[0]; indx++) { + System.out.println(ATTRIBUTENAME + " [" + indx + "]:"); + for (int jndx = 0; jndx < adims[0]; jndx++) { + System.out.print(" ["); + for (int kndx = 0; kndx < adims[1]; kndx++) + System.out.print(dset_data[indx][jndx][kndx] + " "); + System.out.println("]"); + } + System.out.println(); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the file type. + try { + if (filetype_id >= 0) + H5.H5Tclose(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (memtype_id >= 0) + H5.H5Tclose(memtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_ArrayAttribute.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_ArrayAttribute.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_Bit.java b/java/examples/datatypes/H5Ex_T_Bit.java new file mode 100644 index 0000000..f76c7d5 --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_Bit.java @@ -0,0 +1,227 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write bitfield + datatypes to a dataset. The program first writes bit + fields to a dataset with a dataspace of DIM0xDIM1, then + closes the file. Next, it reopens the file, reads back + the data, and outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_Bit { + private static String FILENAME = "H5Ex_T_Bit.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM0 = 4; + private static final int DIM1 = 7; + private static final int RANK = 2; + + private static void CreateDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM0, DIM1 }; + int[][] dset_data = new int[DIM0][DIM1]; + + // Initialize data. + for (int indx = 0; indx < DIM0; indx++) + for (int jndx = 0; jndx < DIM1; jndx++) { + dset_data[indx][jndx] = 0; + dset_data[indx][jndx] |= (indx * jndx - jndx) & 0x03; /* Field "A" */ + dset_data[indx][jndx] |= (indx & 0x03) << 2; /* Field "B" */ + dset_data[indx][jndx] |= (jndx & 0x03) << 4; /* Field "C" */ + dset_data[indx][jndx] |= ((indx + jndx) & 0x03) << 6; /* Field "D" */ + } + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (dataspace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_B8BE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the bitfield data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_B8, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM0, DIM1 }; + int[][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to two-dimensional arrays (the + // elements of the dataset. + dset_data = new int[(int) dims[0]][(int) (dims[1])]; + + // Read data. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_B8, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println(DATASETNAME + ":"); + for (int indx = 0; indx < dims[0]; indx++) { + System.out.print(" ["); + for (int jndx = 0; jndx < dims[1]; jndx++) { + System.out.print("{" + (dset_data[indx][jndx] & 0x03) + ", "); + System.out.print(((dset_data[indx][jndx] >> 2) & 0x03) + ", "); + System.out.print(((dset_data[indx][jndx] >> 4) & 0x03) + ", "); + System.out.print(((dset_data[indx][jndx] >> 6) & 0x03) + "}"); + } + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_Bit.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_Bit.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_BitAttribute.java b/java/examples/datatypes/H5Ex_T_BitAttribute.java new file mode 100644 index 0000000..a5ab81b --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_BitAttribute.java @@ -0,0 +1,267 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write bitfield + datatypes to an attribute. The program first writes bit + fields to an attribute with a dataspace of DIM0xDIM1, then + closes the file. Next, it reopens the file, reads back + the data, and outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_BitAttribute { + private static String FILENAME = "H5Ex_T_BitAttribute.h5"; + private static String DATASETNAME = "DS1"; + private static String ATTRIBUTENAME = "A1"; + private static final int DIM0 = 4; + private static final int DIM1 = 7; + private static final int RANK = 2; + + private static void CreateDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0, DIM1 }; + int[][] dset_data = new int[DIM0][DIM1]; + + // Initialize data. + for (int indx = 0; indx < DIM0; indx++) + for (int jndx = 0; jndx < DIM1; jndx++) { + dset_data[indx][jndx] = 0; + dset_data[indx][jndx] |= (indx * jndx - jndx) & 0x03; /* Field "A" */ + dset_data[indx][jndx] |= (indx & 0x03) << 2; /* Field "B" */ + dset_data[indx][jndx] |= (jndx & 0x03) << 4; /* Field "C" */ + dset_data[indx][jndx] |= ((indx + jndx) & 0x03) << 6; /* Field "D" */ + } + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataset with a scalar dataspace. + try { + dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); + if (dataspace_id >= 0) { + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Sclose(dataspace_id); + dataspace_id = -1; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the attribute and write the array data to it. + try { + if ((dataset_id >= 0) && (dataspace_id >= 0)) + attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, HDF5Constants.H5T_STD_B8BE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the dataset. + try { + if (attribute_id >= 0) + H5.H5Awrite(attribute_id, HDF5Constants.H5T_NATIVE_B8, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0, DIM1 }; + int[][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (attribute_id >= 0) + dataspace_id = H5.H5Aget_space(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to two-dimensional arrays (the + // elements of the dataset. + dset_data = new int[(int) dims[0]][(int) (dims[1])]; + + // Read data. + try { + if (attribute_id >= 0) + H5.H5Aread(attribute_id, HDF5Constants.H5T_NATIVE_B8, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println(ATTRIBUTENAME + ":"); + for (int indx = 0; indx < dims[0]; indx++) { + System.out.print(" ["); + for (int jndx = 0; jndx < dims[1]; jndx++) { + System.out.print("{" + (dset_data[indx][jndx] & 0x03) + ", "); + System.out.print(((dset_data[indx][jndx] >> 2) & 0x03) + ", "); + System.out.print(((dset_data[indx][jndx] >> 4) & 0x03) + ", "); + System.out.print(((dset_data[indx][jndx] >> 6) & 0x03) + "}"); + } + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_BitAttribute.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_BitAttribute.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_Commit.java b/java/examples/datatypes/H5Ex_T_Commit.java new file mode 100644 index 0000000..d4e43f9 --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_Commit.java @@ -0,0 +1,265 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to commit a named datatype to a + file, and read back that datatype. The program first + defines a compound datatype, commits it to a file, then + closes the file. Next, it reopens the file, opens the + datatype, and outputs the names of its fields to the + screen. + ************************************************************/ + +package examples.datatypes; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +public class H5Ex_T_Commit { + private static String FILENAME = "H5Ex_T_Commit.h5"; + private static String DATATYPENAME = "Sensor_Type"; + protected static final int INTEGERSIZE = 4; + protected static final int DOUBLESIZE = 8; + protected final static int MAXSTRINGSIZE = 80; + + // Values for the various classes of datatypes + enum H5T_class { + H5T_NO_CLASS(HDF5Constants.H5T_NO_CLASS), // error + H5T_INTEGER(HDF5Constants.H5T_INTEGER), // integer types + H5T_FLOAT(HDF5Constants.H5T_FLOAT), // floating-point types + H5T_TIME(HDF5Constants.H5T_TIME), // date and time types + H5T_STRING(HDF5Constants.H5T_STRING), // character string types + H5T_BITFIELD(HDF5Constants.H5T_BITFIELD), // bit field types + H5T_OPAQUE(HDF5Constants.H5T_OPAQUE), // opaque types + H5T_COMPOUND(HDF5Constants.H5T_COMPOUND), // compound types + H5T_REFERENCE(HDF5Constants.H5T_REFERENCE), // reference types + H5T_ENUM(HDF5Constants.H5T_ENUM), // enumeration types + H5T_VLEN(HDF5Constants.H5T_VLEN), // Variable-Length types + H5T_ARRAY(HDF5Constants.H5T_ARRAY), // Array types + H5T_NCLASSES(11); // this must be last + + private static final Map lookup = new HashMap(); + + static { + for (H5T_class s : EnumSet.allOf(H5T_class.class)) + lookup.put(s.getCode(), s); + } + + private long code; + + H5T_class(long layout_type) { + this.code = layout_type; + } + + public long getCode() { + return this.code; + } + + public static H5T_class get(long typeclass_id) { + return lookup.get(typeclass_id); + } + } + + // The supporting Sensor_Datatype class. + private static class Sensor_Datatype { + static int numberMembers = 4; + static int[] memberDims = { 1, 1, 1, 1 }; + + String[] memberNames = { "Serial number", "Location", "Temperature (F)", "Pressure (inHg)" }; + long[] memberFileTypes = { HDF5Constants.H5T_STD_I32BE, HDF5Constants.H5T_C_S1, HDF5Constants.H5T_IEEE_F64BE, + HDF5Constants.H5T_IEEE_F64BE }; + static int[] memberStorage = { INTEGERSIZE, MAXSTRINGSIZE, DOUBLESIZE, DOUBLESIZE }; + + // Data size is the storage size for the members not the object. + static long getDataSize() { + long data_size = 0; + for (int indx = 0; indx < numberMembers; indx++) + data_size += memberStorage[indx] * memberDims[indx]; + return data_size; + } + + static int getOffset(int memberItem) { + int data_offset = 0; + for (int indx = 0; indx < memberItem; indx++) + data_offset += memberStorage[indx]; + return data_offset; + } + } + + private static void CreateDataType() { + long file_id = -1; + long strtype_id = -1; + long filetype_id = -1; + Sensor_Datatype datatypes = new Sensor_Datatype(); + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create string datatype. + try { + strtype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + if (strtype_id >= 0) + H5.H5Tset_size(strtype_id, MAXSTRINGSIZE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the compound datatype for the file. Because the standard + // types we are using for the file may have different sizes than + // the corresponding native types, we must manually calculate the + // offset of each member. + try { + filetype_id = H5.H5Tcreate(HDF5Constants.H5T_COMPOUND, Sensor_Datatype.getDataSize()); + if (filetype_id >= 0) { + for (int indx = 0; indx < Sensor_Datatype.numberMembers; indx++) { + long type_id = datatypes.memberFileTypes[indx]; + if (type_id == HDF5Constants.H5T_C_S1) + type_id = strtype_id; + H5.H5Tinsert(filetype_id, datatypes.memberNames[indx], Sensor_Datatype.getOffset(indx), type_id); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Commit the compound datatype to the file, creating a named datatype. + try { + if ((file_id >= 0) && (filetype_id >= 0)) + H5.H5Tcommit(file_id, DATATYPENAME, filetype_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the file type. + try { + if (filetype_id >= 0) + H5.H5Tclose(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the str type. + try { + if (strtype_id >= 0) + H5.H5Tclose(strtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataType() { + long file_id = -1; + long typeclass_id = -1; + long filetype_id = -1; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open named datatype. + try { + if (file_id >= 0) + filetype_id = H5.H5Topen(file_id, DATATYPENAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Named datatype: " + DATATYPENAME + ":"); + + // Get datatype class. If it isn't compound, we won't print anything. + try { + if (filetype_id >= 0) + typeclass_id = H5.H5Tget_class(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + // Read data. + try { + if (H5T_class.get(typeclass_id) == H5T_class.H5T_COMPOUND) { + System.out.println(" Class: H5T_COMPOUND"); + int nmembs = H5.H5Tget_nmembers(filetype_id); + // Iterate over compound datatype members. + for (int indx = 0; indx < nmembs; indx++) { + String member_name = H5.H5Tget_member_name(filetype_id, indx); + System.out.println(" " + member_name); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (filetype_id >= 0) + H5.H5Tclose(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_Commit.CreateDataType(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_Commit.ReadDataType(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_Compound.java b/java/examples/datatypes/H5Ex_T_Compound.java new file mode 100644 index 0000000..f270cb9 --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_Compound.java @@ -0,0 +1,443 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write compound + datatypes to a dataset. The program first writes + compound structures to a dataset with a dataspace of DIM0, + then closes the file. Next, it reopens the file, reads + back the data, and outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.charset.Charset; + +public class H5Ex_T_Compound { + private static String FILENAME = "H5Ex_T_Compound.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM0 = 4; + private static final int RANK = 1; + protected static final int INTEGERSIZE = 4; + protected static final int DOUBLESIZE = 8; + protected final static int MAXSTRINGSIZE = 80; + + static class Sensor_Datatype { + static int numberMembers = 4; + static int[] memberDims = { 1, 1, 1, 1 }; + + static String[] memberNames = { "Serial number", "Location", "Temperature (F)", "Pressure (inHg)" }; + static long[] memberMemTypes = { HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5T_C_S1, + HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5T_NATIVE_DOUBLE }; + static long[] memberFileTypes = { HDF5Constants.H5T_STD_I32BE, HDF5Constants.H5T_C_S1, + HDF5Constants.H5T_IEEE_F64BE, HDF5Constants.H5T_IEEE_F64BE }; + static int[] memberStorage = { INTEGERSIZE, MAXSTRINGSIZE, DOUBLESIZE, DOUBLESIZE }; + + // Data size is the storage size for the members. + static long getTotalDataSize() { + long data_size = 0; + for (int indx = 0; indx < numberMembers; indx++) + data_size += memberStorage[indx] * memberDims[indx]; + return DIM0 * data_size; + } + + static long getDataSize() { + long data_size = 0; + for (int indx = 0; indx < numberMembers; indx++) + data_size += memberStorage[indx] * memberDims[indx]; + return data_size; + } + + static int getOffset(int memberItem) { + int data_offset = 0; + for (int indx = 0; indx < memberItem; indx++) + data_offset += memberStorage[indx]; + return data_offset; + } + } + + static class Sensor { + public int serial_no; + public String location; + public double temperature; + public double pressure; + + Sensor(int serial_no, String location, double temperature, double pressure) { + this.serial_no = serial_no; + this.location = location; + this.temperature = temperature; + this.pressure = pressure; + } + + Sensor(ByteBuffer databuf, int dbposition) { + readBuffer(databuf, dbposition); + } + + void writeBuffer(ByteBuffer databuf, int dbposition) { + databuf.putInt(dbposition + Sensor_Datatype.getOffset(0), serial_no); + byte[] temp_str = location.getBytes(Charset.forName("UTF-8")); + int arraylen = (temp_str.length > MAXSTRINGSIZE) ? MAXSTRINGSIZE : temp_str.length; + for (int ndx = 0; ndx < arraylen; ndx++) + databuf.put(dbposition + Sensor_Datatype.getOffset(1) + ndx, temp_str[ndx]); + for (int ndx = arraylen; ndx < MAXSTRINGSIZE; ndx++) + databuf.put(dbposition + Sensor_Datatype.getOffset(1) + arraylen, (byte) 0); + databuf.putDouble(dbposition + Sensor_Datatype.getOffset(2), temperature); + databuf.putDouble(dbposition + Sensor_Datatype.getOffset(3), pressure); + } + + void readBuffer(ByteBuffer databuf, int dbposition) { + this.serial_no = databuf.getInt(dbposition + Sensor_Datatype.getOffset(0)); + ByteBuffer stringbuf = databuf.duplicate(); + stringbuf.position(dbposition + Sensor_Datatype.getOffset(1)); + stringbuf.limit(dbposition + Sensor_Datatype.getOffset(1) + MAXSTRINGSIZE); + byte[] bytearr = new byte[stringbuf.remaining()]; + stringbuf.get(bytearr); + this.location = new String(bytearr, Charset.forName("UTF-8")).trim(); + this.temperature = databuf.getDouble(dbposition + Sensor_Datatype.getOffset(2)); + this.pressure = databuf.getDouble(dbposition + Sensor_Datatype.getOffset(3)); + } + + @Override + public String toString() { + return String.format("Serial number : " + serial_no + "%n" + + "Location : " + location + "%n" + + "Temperature (F) : " + temperature + "%n" + + "Pressure (inHg) : " + pressure + "%n"); + } + } + + private static void CreateDataset() { + long file_id = -1; + long strtype_id = -1; + long memtype_id = -1; + long filetype_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM0 }; + Sensor[] object_data = new Sensor[DIM0]; + byte[] dset_data = null; + + // Initialize data. + object_data[0] = new Sensor(1153, new String("Exterior (static)"), 53.23, 24.57); + object_data[1] = new Sensor(1184, new String("Intake"), 55.12, 22.95); + object_data[2] = new Sensor(1027, new String("Intake manifold"), 103.55, 31.23); + object_data[3] = new Sensor(1313, new String("Exhaust manifold"), 1252.89, 84.11); + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create string datatype. + try { + strtype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + if (strtype_id >= 0) + H5.H5Tset_size(strtype_id, MAXSTRINGSIZE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the compound datatype for memory. + try { + memtype_id = H5.H5Tcreate(HDF5Constants.H5T_COMPOUND, Sensor_Datatype.getDataSize()); + if (memtype_id >= 0) { + for (int indx = 0; indx < Sensor_Datatype.numberMembers; indx++) { + long type_id = Sensor_Datatype.memberMemTypes[indx]; + if (type_id == HDF5Constants.H5T_C_S1) + type_id = strtype_id; + H5.H5Tinsert(memtype_id, Sensor_Datatype.memberNames[indx], Sensor_Datatype.getOffset(indx), + type_id); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the compound datatype for the file. Because the standard + // types we are using for the file may have different sizes than + // the corresponding native types, we must manually calculate the + // offset of each member. + try { + filetype_id = H5.H5Tcreate(HDF5Constants.H5T_COMPOUND, Sensor_Datatype.getDataSize()); + if (filetype_id >= 0) { + for (int indx = 0; indx < Sensor_Datatype.numberMembers; indx++) { + long type_id = Sensor_Datatype.memberFileTypes[indx]; + if (type_id == HDF5Constants.H5T_C_S1) + type_id = strtype_id; + H5.H5Tinsert(filetype_id, Sensor_Datatype.memberNames[indx], Sensor_Datatype.getOffset(indx), + type_id); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (dataspace_id >= 0) && (filetype_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, filetype_id, dataspace_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the compound data to the dataset. + // allocate memory for read buffer. + dset_data = new byte[(int)dims[0] * (int)Sensor_Datatype.getDataSize()]; + ByteBuffer outBuf = ByteBuffer.wrap(dset_data); + outBuf.order(ByteOrder.nativeOrder()); + for (int indx = 0; indx < (int) dims[0]; indx++) { + object_data[indx].writeBuffer(outBuf, indx * (int)Sensor_Datatype.getDataSize()); + } + try { + if ((dataset_id >= 0) && (memtype_id >= 0)) + H5.H5Dwrite(dataset_id, memtype_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the file type. + try { + if (filetype_id >= 0) + H5.H5Tclose(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (memtype_id >= 0) + H5.H5Tclose(memtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (strtype_id >= 0) + H5.H5Tclose(strtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long strtype_id = -1; + long memtype_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM0 }; + Sensor[] object_data2; + byte[] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create string datatype. + try { + strtype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + if (strtype_id >= 0) + H5.H5Tset_size(strtype_id, MAXSTRINGSIZE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the compound datatype for memory. + try { + memtype_id = H5.H5Tcreate(HDF5Constants.H5T_COMPOUND, Sensor_Datatype.getDataSize()); + if (memtype_id >= 0) { + for (int indx = 0; indx < Sensor_Datatype.numberMembers; indx++) { + long type_id = Sensor_Datatype.memberMemTypes[indx]; + if (type_id == HDF5Constants.H5T_C_S1) + type_id = strtype_id; + H5.H5Tinsert(memtype_id, Sensor_Datatype.memberNames[indx], Sensor_Datatype.getOffset(indx), + type_id); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // allocate memory for read buffer. + dset_data = new byte[(int) dims[0] * (int)Sensor_Datatype.getDataSize()]; + + object_data2 = new Sensor[(int) dims[0]]; + + // Read data. + try { + if ((dataset_id >= 0) && (memtype_id >= 0)) + H5.H5Dread(dataset_id, memtype_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + + ByteBuffer inBuf = ByteBuffer.wrap(dset_data); + inBuf.order(ByteOrder.nativeOrder()); + for (int indx = 0; indx < (int) dims[0]; indx++) { + object_data2[indx] = new Sensor(inBuf, indx * (int)Sensor_Datatype.getDataSize()); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + for (int indx = 0; indx < dims[0]; indx++) { + System.out.println(DATASETNAME + " [" + indx + "]:"); + System.out.println(object_data2[indx].toString()); + } + System.out.println(); + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (memtype_id >= 0) + H5.H5Tclose(memtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (strtype_id >= 0) + H5.H5Tclose(strtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_Compound.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_Compound.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_CompoundAttribute.java b/java/examples/datatypes/H5Ex_T_CompoundAttribute.java new file mode 100644 index 0000000..25581d4 --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_CompoundAttribute.java @@ -0,0 +1,486 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write compound + datatypes to an attribute. The program first writes + compound structures to an attribute with a dataspace of + DIM0, then closes the file. Next, it reopens the file, + reads back the data, and outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; +import java.nio.charset.Charset; + +public class H5Ex_T_CompoundAttribute { + private static String FILENAME = "H5Ex_T_CompoundAttribute.h5"; + private static String DATASETNAME = "DS1"; + private static String ATTRIBUTENAME = "A1"; + private static final int DIM0 = 4; + private static final int RANK = 1; + protected static final int INTEGERSIZE = 4; + protected static final int DOUBLESIZE = 8; + protected final static int MAXSTRINGSIZE = 80; + + // Using Java Externalization will add a two-byte object header in + // the stream, which needs to be called out in the datatypes. + static class Sensor_Datatype { + static int numberMembers = 4; + static int[] memberDims = { 1, 1, 1, 1 }; + + static String[] memberNames = { "Serial number", "Location", "Temperature (F)", "Pressure (inHg)" }; + static long[] memberMemTypes = { HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5T_C_S1, + HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5T_NATIVE_DOUBLE }; + static long[] memberFileTypes = { HDF5Constants.H5T_STD_I32BE, HDF5Constants.H5T_C_S1, + HDF5Constants.H5T_IEEE_F64BE, HDF5Constants.H5T_IEEE_F64BE }; + static int[] memberStorage = { INTEGERSIZE, MAXSTRINGSIZE, DOUBLESIZE, DOUBLESIZE }; + + // Data size is the storage size for the members not the object. + static long getTotalDataSize() { + long data_size = 0; + for (int indx = 0; indx < numberMembers; indx++) + data_size += memberStorage[indx] * memberDims[indx]; + return DIM0 * data_size; + } + + static long getDataSize() { + long data_size = 0; + for (int indx = 0; indx < numberMembers; indx++) + data_size += memberStorage[indx] * memberDims[indx]; + return data_size; + } + + static int getOffset(int memberItem) { + int data_offset = 0; + for (int indx = 0; indx < memberItem; indx++) + data_offset += memberStorage[indx]; + return data_offset; + } + } + + static class Sensor { + public int serial_no; + public String location; + public double temperature; + public double pressure; + + Sensor(int serial_no, String location, double temperature, double pressure) { + this.serial_no = serial_no; + this.location = location; + this.temperature = temperature; + this.pressure = pressure; + } + + Sensor(ByteBuffer databuf, int dbposition) { + readBuffer(databuf, dbposition); + } + + void writeBuffer(ByteBuffer databuf, int dbposition) { + databuf.putInt(dbposition + Sensor_Datatype.getOffset(0), serial_no); + byte[] temp_str = location.getBytes(Charset.forName("UTF-8")); + int arraylen = (temp_str.length > MAXSTRINGSIZE) ? MAXSTRINGSIZE : temp_str.length; + for (int ndx = 0; ndx < arraylen; ndx++) + databuf.put(dbposition + Sensor_Datatype.getOffset(1) + ndx, temp_str[ndx]); + for (int ndx = arraylen; ndx < MAXSTRINGSIZE; ndx++) + databuf.put(dbposition + Sensor_Datatype.getOffset(1) + arraylen, (byte) 0); + databuf.putDouble(dbposition + Sensor_Datatype.getOffset(2), temperature); + databuf.putDouble(dbposition + Sensor_Datatype.getOffset(3), pressure); + } + + void readBuffer(ByteBuffer databuf, int dbposition) { + this.serial_no = databuf.getInt(dbposition + Sensor_Datatype.getOffset(0)); + ByteBuffer stringbuf = databuf.duplicate(); + stringbuf.position(dbposition + Sensor_Datatype.getOffset(1)); + stringbuf.limit(dbposition + Sensor_Datatype.getOffset(1) + MAXSTRINGSIZE); + byte[] bytearr = new byte[stringbuf.remaining()]; + stringbuf.get(bytearr); + this.location = new String(bytearr, Charset.forName("UTF-8")).trim(); + this.temperature = databuf.getDouble(dbposition + Sensor_Datatype.getOffset(2)); + this.pressure = databuf.getDouble(dbposition + Sensor_Datatype.getOffset(3)); + } + + @Override + public String toString() { + return String.format("Serial number : " + serial_no + "%n" + + "Location : " + location + "%n" + + "Temperature (F) : " + temperature + "%n" + + "Pressure (inHg) : " + pressure + "%n"); + } + } + + private static void CreateDataset() { + long file_id = -1; + long strtype_id = -1; + long memtype_id = -1; + long filetype_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0 }; + Sensor[] object_data = new Sensor[DIM0]; + byte[] dset_data = null; + + // Initialize data. + object_data[0] = new Sensor(1153, new String("Exterior (static)"), 53.23, 24.57); + object_data[1] = new Sensor(1184, new String("Intake"), 55.12, 22.95); + object_data[2] = new Sensor(1027, new String("Intake manifold"), 103.55, 31.23); + object_data[3] = new Sensor(1313, new String("Exhaust manifold"), 1252.89, 84.11); + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create string datatype. + try { + strtype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + if (strtype_id >= 0) + H5.H5Tset_size(strtype_id, MAXSTRINGSIZE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the compound datatype for memory. + try { + memtype_id = H5.H5Tcreate(HDF5Constants.H5T_COMPOUND, Sensor_Datatype.getDataSize()); + if (memtype_id >= 0) { + for (int indx = 0; indx < Sensor_Datatype.numberMembers; indx++) { + long type_id = Sensor_Datatype.memberMemTypes[indx]; + if (type_id == HDF5Constants.H5T_C_S1) + type_id = strtype_id; + H5.H5Tinsert(memtype_id, Sensor_Datatype.memberNames[indx], Sensor_Datatype.getOffset(indx), + type_id); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the compound datatype for the file. Because the standard + // types we are using for the file may have different sizes than + // the corresponding native types, we must manually calculate the + // offset of each member. + try { + filetype_id = H5.H5Tcreate(HDF5Constants.H5T_COMPOUND, Sensor_Datatype.getDataSize()); + if (filetype_id >= 0) { + for (int indx = 0; indx < Sensor_Datatype.numberMembers; indx++) { + long type_id = Sensor_Datatype.memberFileTypes[indx]; + if (type_id == HDF5Constants.H5T_C_S1) + type_id = strtype_id; + H5.H5Tinsert(filetype_id, Sensor_Datatype.memberNames[indx], Sensor_Datatype.getOffset(indx), + type_id); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataset with a scalar dataspace. + try { + dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); + if (dataspace_id >= 0) { + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Sclose(dataspace_id); + dataspace_id = -1; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the attribute. + try { + if ((dataset_id >= 0) && (dataspace_id >= 0) && (filetype_id >= 0)) + attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, filetype_id, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the compound data. + dset_data = new byte[(int) dims[0] * (int)Sensor_Datatype.getDataSize()]; + ByteBuffer outBuf = ByteBuffer.wrap(dset_data); + outBuf.order(ByteOrder.nativeOrder()); + for (int indx = 0; indx < (int) dims[0]; indx++) { + object_data[indx].writeBuffer(outBuf, indx * (int)Sensor_Datatype.getDataSize()); + } + try { + if ((attribute_id >= 0) && (memtype_id >= 0)) + H5.H5Awrite(attribute_id, memtype_id, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the file type. + try { + if (filetype_id >= 0) + H5.H5Tclose(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (memtype_id >= 0) + H5.H5Tclose(memtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (strtype_id >= 0) + H5.H5Tclose(strtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long strtype_id = -1; + long memtype_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0 }; + Sensor[] object_data2; + byte[] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. This is a + // three dimensional dataset when the array datatype is included so + // the dynamic allocation must be done in steps. + try { + if (attribute_id >= 0) + dataspace_id = H5.H5Aget_space(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create string datatype. + try { + strtype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + if (strtype_id >= 0) + H5.H5Tset_size(strtype_id, MAXSTRINGSIZE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the compound datatype for memory. + try { + memtype_id = H5.H5Tcreate(HDF5Constants.H5T_COMPOUND, Sensor_Datatype.getDataSize()); + if (memtype_id >= 0) { + for (int indx = 0; indx < Sensor_Datatype.numberMembers; indx++) { + long type_id = Sensor_Datatype.memberMemTypes[indx]; + if (type_id == HDF5Constants.H5T_C_S1) + type_id = strtype_id; + H5.H5Tinsert(memtype_id, Sensor_Datatype.memberNames[indx], Sensor_Datatype.getOffset(indx), + type_id); + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // allocate memory for read buffer. + dset_data = new byte[(int) dims[0] * (int)Sensor_Datatype.getDataSize()]; + + object_data2 = new Sensor[(int) dims[0]]; + + // Read data. + try { + if ((attribute_id >= 0) && (memtype_id >= 0)) + H5.H5Aread(attribute_id, memtype_id, dset_data); + + ByteBuffer inBuf = ByteBuffer.wrap(dset_data); + inBuf.order(ByteOrder.nativeOrder()); + for (int indx = 0; indx < (int) dims[0]; indx++) { + object_data2[indx] = new Sensor(inBuf, indx * (int)Sensor_Datatype.getDataSize()); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + for (int indx = 0; indx < dims[0]; indx++) { + System.out.println(ATTRIBUTENAME + " [" + indx + "]:"); + System.out.println(object_data2[indx].toString()); + } + System.out.println(); + + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (memtype_id >= 0) + H5.H5Tclose(memtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (strtype_id >= 0) + H5.H5Tclose(strtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_CompoundAttribute.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_CompoundAttribute.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_Float.java b/java/examples/datatypes/H5Ex_T_Float.java new file mode 100644 index 0000000..1b5fd9b --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_Float.java @@ -0,0 +1,227 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write integer datatypes + to a dataset. The program first writes integers to a + dataset with a dataspace of DIM0xDIM1, then closes the + file. Next, it reopens the file, reads back the data, and + outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import java.text.DecimalFormat; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_Float { + private static String FILENAME = "H5Ex_T_Float.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM0 = 4; + private static final int DIM1 = 7; + private static final int RANK = 2; + + private static void CreateDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM0, DIM1 }; + double[][] dset_data = new double[DIM0][DIM1]; + + // Initialize data. + for (int indx = 0; indx < DIM0; indx++) + for (int jndx = 0; jndx < DIM1; jndx++) { + dset_data[indx][jndx] = indx / (jndx + 0.5) + jndx; + } + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset and write the floating point data to it. In + // this example we will save the data as 64 bit little endian IEEE + // floating point numbers, regardless of the native type. The HDF5 + // library automatically converts between different floating point + // types. + try { + if ((file_id >= 0) && (dataspace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_IEEE_F64LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM0, DIM1 }; + double[][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to two-dimensional arrays (the + // elements of the dataset. + dset_data = new double[(int) dims[0]][(int) (dims[1])]; + + // Read data. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + DecimalFormat df = new DecimalFormat("#,##0.0000"); + System.out.println(DATASETNAME + ":"); + for (int indx = 0; indx < dims[0]; indx++) { + System.out.print(" ["); + for (int jndx = 0; jndx < dims[1]; jndx++) { + System.out.print(" " + df.format(dset_data[indx][jndx])); + } + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_Float.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_Float.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_FloatAttribute.java b/java/examples/datatypes/H5Ex_T_FloatAttribute.java new file mode 100644 index 0000000..de1dac7 --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_FloatAttribute.java @@ -0,0 +1,263 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write floating point + datatypes to an attribute. The program first writes + floating point numbers to an attribute with a dataspace of + DIM0xDIM1, then closes the file. Next, it reopens the + file, reads back the data, and outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import java.text.DecimalFormat; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_FloatAttribute { + private static String FILENAME = "H5Ex_T_FloatAttribute.h5"; + private static String DATASETNAME = "DS1"; + private static String ATTRIBUTENAME = "A1"; + private static final int DIM0 = 4; + private static final int DIM1 = 7; + private static final int RANK = 2; + + private static void CreateDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0, DIM1 }; + double[][] dset_data = new double[DIM0][DIM1]; + + // Initialize data. + for (int indx = 0; indx < DIM0; indx++) + for (int jndx = 0; jndx < DIM1; jndx++) { + dset_data[indx][jndx] = indx / (jndx + 0.5) + jndx; + } + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataset with a scalar dataspace. + try { + dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); + if (dataspace_id >= 0) { + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Sclose(dataspace_id); + dataspace_id = -1; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the attribute and write the array data to it. + try { + if ((dataset_id >= 0) && (dataspace_id >= 0)) + attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, HDF5Constants.H5T_IEEE_F64LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the dataset. + try { + if (attribute_id >= 0) + H5.H5Awrite(attribute_id, HDF5Constants.H5T_NATIVE_DOUBLE, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0, DIM1 }; + double[][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (attribute_id >= 0) + dataspace_id = H5.H5Aget_space(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to two-dimensional arrays (the + // elements of the dataset. + dset_data = new double[(int) dims[0]][(int) (dims[1])]; + + // Read data. + try { + if (attribute_id >= 0) + H5.H5Aread(attribute_id, HDF5Constants.H5T_NATIVE_DOUBLE, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + DecimalFormat df = new DecimalFormat("#,##0.0000"); + System.out.println(ATTRIBUTENAME + ":"); + for (int indx = 0; indx < dims[0]; indx++) { + System.out.print(" ["); + for (int jndx = 0; jndx < dims[1]; jndx++) { + System.out.print(" " + df.format(dset_data[indx][jndx])); + } + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_FloatAttribute.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_FloatAttribute.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_Integer.java b/java/examples/datatypes/H5Ex_T_Integer.java new file mode 100644 index 0000000..2f365cd --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_Integer.java @@ -0,0 +1,226 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write integer datatypes + to a dataset. The program first writes integers to a + dataset with a dataspace of DIM0xDIM1, then closes the + file. Next, it reopens the file, reads back the data, and + outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import java.text.DecimalFormat; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_Integer { + private static String FILENAME = "H5Ex_T_Integer.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM0 = 4; + private static final int DIM1 = 7; + private static final int RANK = 2; + + private static void CreateDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM0, DIM1 }; + int[][] dset_data = new int[DIM0][DIM1]; + + // Initialize data. + for (int indx = 0; indx < DIM0; indx++) + for (int jndx = 0; jndx < DIM1; jndx++) { + dset_data[indx][jndx] = indx * jndx - jndx; + } + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset and write the integer data to it. In this + // example we will save the data as 64 bit big endian integers, + // regardless of the native integer type. The HDF5 library + // automatically converts between different integer types. + try { + if ((file_id >= 0) && (dataspace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I64BE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM0, DIM1 }; + int[][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to two-dimensional arrays (the + // elements of the dataset. + dset_data = new int[(int) dims[0]][(int) (dims[1])]; + + // Read data. + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + DecimalFormat df = new DecimalFormat("#,##0"); + System.out.println(DATASETNAME + ":"); + for (int indx = 0; indx < dims[0]; indx++) { + System.out.print(" ["); + for (int jndx = 0; jndx < dims[1]; jndx++) { + System.out.print(" " + df.format(dset_data[indx][jndx])); + } + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_Integer.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_Integer.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_IntegerAttribute.java b/java/examples/datatypes/H5Ex_T_IntegerAttribute.java new file mode 100644 index 0000000..c153d99 --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_IntegerAttribute.java @@ -0,0 +1,263 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write integer datatypes + to an attribute. The program first writes integers to an + attribute with a dataspace of DIM0xDIM1, then closes the + file. Next, it reopens the file, reads back the data, and + outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import java.text.DecimalFormat; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_IntegerAttribute { + private static String FILENAME = "H5Ex_T_IntegerAttribute.h5"; + private static String DATASETNAME = "DS1"; + private static String ATTRIBUTENAME = "A1"; + private static final int DIM0 = 4; + private static final int DIM1 = 7; + private static final int RANK = 2; + + private static void CreateDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0, DIM1 }; + int[][] dset_data = new int[DIM0][DIM1]; + + // Initialize data. + for (int indx = 0; indx < DIM0; indx++) + for (int jndx = 0; jndx < DIM1; jndx++) { + dset_data[indx][jndx] = indx * jndx - jndx; + } + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataset with a scalar dataspace. + try { + dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); + if (dataspace_id >= 0) { + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Sclose(dataspace_id); + dataspace_id = -1; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the attribute and write the array data to it. + try { + if ((dataset_id >= 0) && (dataspace_id >= 0)) + attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, HDF5Constants.H5T_STD_I64BE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the dataset. + try { + if (attribute_id >= 0) + H5.H5Awrite(attribute_id, HDF5Constants.H5T_NATIVE_INT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0, DIM1 }; + int[][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (attribute_id >= 0) + dataspace_id = H5.H5Aget_space(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to two-dimensional arrays (the + // elements of the dataset. + dset_data = new int[(int) dims[0]][(int) (dims[1])]; + + // Read data. + try { + if (attribute_id >= 0) + H5.H5Aread(attribute_id, HDF5Constants.H5T_NATIVE_INT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + DecimalFormat df = new DecimalFormat("#,##0"); + System.out.println(ATTRIBUTENAME + ":"); + for (int indx = 0; indx < dims[0]; indx++) { + System.out.print(" ["); + for (int jndx = 0; jndx < dims[1]; jndx++) { + System.out.print(" " + df.format(dset_data[indx][jndx])); + } + System.out.println("]"); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_IntegerAttribute.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_IntegerAttribute.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_ObjectReference.java b/java/examples/datatypes/H5Ex_T_ObjectReference.java new file mode 100644 index 0000000..3cad6c9 --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_ObjectReference.java @@ -0,0 +1,347 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write object references + to a dataset. The program first creates objects in the + file and writes references to those objects to a dataset + with a dataspace of DIM0, then closes the file. Next, it + reopens the file, dereferences the references, and outputs + the names of their targets to the screen. + ************************************************************/ +package examples.datatypes; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_ObjectReference { + private static String FILENAME = "H5Ex_T_ObjectReference.h5"; + private static String DATASETNAME = "DS1"; + private static String DATASETNAME2 = "DS2"; + private static String GROUPNAME = "G1"; + private static final int DIM0 = 2; + private static final int RANK = 1; + + // Values for the status of space allocation + enum H5G_obj { + H5G_UNKNOWN(HDF5Constants.H5O_TYPE_UNKNOWN), /* Unknown object type */ + H5G_GROUP(HDF5Constants.H5O_TYPE_GROUP), /* Object is a group */ + H5G_DATASET(HDF5Constants.H5O_TYPE_DATASET), /* Object is a dataset */ + H5G_TYPE(HDF5Constants.H5O_TYPE_NAMED_DATATYPE); /* Object is a named data type */ + private static final Map lookup = new HashMap(); + + static { + for (H5G_obj s : EnumSet.allOf(H5G_obj.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5G_obj(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5G_obj get(int code) { + return lookup.get(code); + } + } + + private static void writeObjRef() { + long file_id = -1; + long dataspace_id = -1; + long filespace_id = -1; + long group_id = -1; + long dataset_id = -1; + long[] dims = { DIM0 }; + byte[][] dset_data = new byte[DIM0][8]; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataset with a scalar dataspace. + try { + dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); + if ((file_id >= 0) && (dataspace_id >= 0)) { + dataset_id = H5.H5Dcreate(file_id, DATASETNAME2, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + dataset_id = -1; + H5.H5Sclose(dataspace_id); + dataspace_id = -1; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create a group in the file. + try { + if (file_id >= 0) + group_id = H5.H5Gcreate(file_id, GROUPNAME, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + if (group_id >= 0) + H5.H5Gclose(group_id); + group_id = -1; + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create references to the previously created objects. Passing -1 + // as space_id causes this parameter to be ignored. Other values + // besides valid dataspaces result in an error. + try { + if (file_id >= 0) { + byte rbuf0[] = H5.H5Rcreate(file_id, GROUPNAME, HDF5Constants.H5R_OBJECT, -1); + byte rbuf1[] = H5.H5Rcreate(file_id, DATASETNAME2, HDF5Constants.H5R_OBJECT, -1); + for (int indx = 0; indx < 8; indx++) { + dset_data[0][indx] = rbuf0[indx]; + dset_data[1][indx] = rbuf1[indx]; + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + filespace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (filespace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_REF_OBJ, filespace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the object references to it. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF_OBJ, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (filespace_id >= 0) + H5.H5Sclose(filespace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readObjRef() { + long file_id = -1; + long dataset_id = -1; + long dataspace_id = -1; + int object_type = -1; + long object_id = -1; + long[] dims = { DIM0 }; + byte[][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to two-dimensional arrays (the + // elements of the dataset. + dset_data = new byte[(int)dims[0]][8]; + + // Read the data using the default properties. + try { + if (dataset_id >= 0) { + H5.H5Dread(dataset_id, HDF5Constants.H5T_STD_REF_OBJ, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + for (int indx = 0; indx < dims[0]; indx++) { + System.out.println(DATASETNAME + "[" + indx + "]:"); + System.out.print(" ->"); + // Open the referenced object, get its name and type. + try { + if (dataset_id >= 0) { + object_id = H5.H5Rdereference(dataset_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, dset_data[indx]); + object_type = H5.H5Rget_obj_type(dataset_id, HDF5Constants.H5R_OBJECT, dset_data[indx]); + } + String[] obj_name = new String[1]; + long name_size = 1; + if (object_type >= 0) { + // Get the length of the name and retrieve the name. + name_size = 1 + H5.H5Iget_name(object_id, obj_name, name_size); + } + if ((object_id >= 0) && (object_type >= -1)) { + switch (H5G_obj.get(object_type)) { + case H5G_GROUP: + System.out.print("H5G_GROUP"); + try { + if (object_id >= 0) + H5.H5Gclose(object_id); + } + catch (Exception e) { + e.printStackTrace(); + } + break; + case H5G_DATASET: + System.out.print("H5G_DATASET"); + try { + if (object_id >= 0) + H5.H5Dclose(object_id); + } + catch (Exception e) { + e.printStackTrace(); + } + break; + case H5G_TYPE: + System.out.print("H5G_TYPE"); + try { + if (object_id >= 0) + H5.H5Tclose(object_id); + } + catch (Exception e) { + e.printStackTrace(); + } + break; + default: + System.out.print("UNHANDLED"); + } + } + // Print the name. + if (name_size > 1) + System.out.println(": " + obj_name[0]); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + // End access to the dataset and release resources used by it. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + // Check if gzip compression is available and can be used for both + // compression and decompression. Normally we do not perform error + // checking in these examples for the sake of clarity, but in this + // case we will make an exception because this filter is an + // optional part of the hdf5 library. + H5Ex_T_ObjectReference.writeObjRef(); + H5Ex_T_ObjectReference.readObjRef(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java b/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java new file mode 100644 index 0000000..e354029 --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_ObjectReferenceAttribute.java @@ -0,0 +1,389 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write object references + to an attribute. The program first creates objects in the + file and writes references to those objects to an + attribute with a dataspace of DIM0, then closes the file. + Next, it reopens the file, dereferences the references, + and outputs the names of their targets to the screen. + ************************************************************/ + +package examples.datatypes; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_ObjectReferenceAttribute { + private static String FILENAME = "H5Ex_T_ObjectReferenceAttribute.h5"; + private static String DATASETNAME = "DS1"; + private static String ATTRIBUTENAME = "A1"; + private static String DATASETNAME2 = "DS2"; + private static String GROUPNAME = "G1"; + private static final int DIM0 = 2; + private static final int RANK = 1; + + // Values for the status of space allocation + enum H5G_obj { + H5G_UNKNOWN(HDF5Constants.H5O_TYPE_UNKNOWN), /* Unknown object type */ + H5G_GROUP(HDF5Constants.H5O_TYPE_GROUP), /* Object is a group */ + H5G_DATASET(HDF5Constants.H5O_TYPE_DATASET), /* Object is a dataset */ + H5G_TYPE(HDF5Constants.H5O_TYPE_NAMED_DATATYPE); /* Object is a named data type */ + private static final Map lookup = new HashMap(); + + static { + for (H5G_obj s : EnumSet.allOf(H5G_obj.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5G_obj(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5G_obj get(int code) { + return lookup.get(code); + } + } + + private static void CreateDataset() { + long file_id = -1; + long dataspace_id = -1; + long group_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0 }; + byte[][] dset_data = new byte[DIM0][8]; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataset with a scalar dataspace. + try { + dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); + if (dataspace_id >= 0) { + dataset_id = H5.H5Dcreate(file_id, DATASETNAME2, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + dataset_id = -1; + H5.H5Sclose(dataspace_id); + dataspace_id = -1; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create a group in the file. + try { + if (file_id >= 0) + group_id = H5.H5Gcreate(file_id, GROUPNAME, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + if (group_id >= 0) + H5.H5Gclose(group_id); + group_id = -1; + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create references to the previously created objects. Passing -1 + // as space_id causes this parameter to be ignored. Other values + // besides valid dataspaces result in an error. + try { + if (file_id >= 0) { + byte rbuf0[] = H5.H5Rcreate(file_id, GROUPNAME, HDF5Constants.H5R_OBJECT, -1); + byte rbuf1[] = H5.H5Rcreate(file_id, DATASETNAME2, HDF5Constants.H5R_OBJECT, -1); + for (int indx = 0; indx < 8; indx++) { + dset_data[0][indx] = rbuf0[indx]; + dset_data[1][indx] = rbuf1[indx]; + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataset with a scalar dataspace to serve as the parent + // for the attribute. + try { + dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); + if (dataspace_id >= 0) { + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Sclose(dataspace_id); + dataspace_id = -1; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the attribute and write the array data to it. + try { + if ((dataset_id >= 0) && (dataspace_id >= 0)) + attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, HDF5Constants.H5T_STD_REF_OBJ, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the dataset. + try { + if (attribute_id >= 0) + H5.H5Awrite(attribute_id, HDF5Constants.H5T_STD_REF_OBJ, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + int object_type = -1; + long object_id = -1; + long[] dims = { DIM0 }; + byte[][] dset_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (attribute_id >= 0) + dataspace_id = H5.H5Aget_space(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate array of pointers to two-dimensional arrays (the + // elements of the dataset. + dset_data = new byte[(int) dims[0]][8]; + + // Read data. + try { + if (attribute_id >= 0) + H5.H5Aread(attribute_id, HDF5Constants.H5T_STD_REF_OBJ, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + for (int indx = 0; indx < dims[0]; indx++) { + System.out.println(ATTRIBUTENAME + "[" + indx + "]:"); + System.out.print(" ->"); + // Open the referenced object, get its name and type. + try { + if (dataset_id >= 0) { + object_id = H5.H5Rdereference(dataset_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, dset_data[indx]); + object_type = H5.H5Rget_obj_type(dataset_id, HDF5Constants.H5R_OBJECT, dset_data[indx]); + } + String[] obj_name = new String[1]; + long name_size = 1; + if (object_type >= 0) { + // Get the length of the name and retrieve the name. + name_size = 1 + H5.H5Iget_name(object_id, obj_name, name_size); + } + if ((object_id >= 0) && (object_type >= -1)) { + switch (H5G_obj.get(object_type)) { + case H5G_GROUP: + System.out.print("H5G_GROUP"); + try { + if (object_id >= 0) + H5.H5Gclose(object_id); + } + catch (Exception e) { + e.printStackTrace(); + } + break; + case H5G_DATASET: + System.out.print("H5G_DATASET"); + try { + if (object_id >= 0) + H5.H5Dclose(object_id); + } + catch (Exception e) { + e.printStackTrace(); + } + break; + case H5G_TYPE: + System.out.print("H5G_TYPE"); + try { + if (object_id >= 0) + H5.H5Tclose(object_id); + } + catch (Exception e) { + e.printStackTrace(); + } + break; + default: + System.out.print("UNHANDLED"); + } + } + // Print the name. + if (name_size > 1) + System.out.println(": " + obj_name[0]); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_ObjectReferenceAttribute.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_ObjectReferenceAttribute.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_Opaque.java b/java/examples/datatypes/H5Ex_T_Opaque.java new file mode 100644 index 0000000..eb45686 --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_Opaque.java @@ -0,0 +1,270 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write opaque datatypes + to a dataset. The program first writes opaque data to a + dataset with a dataspace of DIM0, then closes the file. + Next, it reopens the file, reads back the data, and + outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_Opaque { + private static String FILENAME = "H5Ex_T_Opaque.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM0 = 4; + private static final int LEN = 7; + private static final int RANK = 1; + + private static void CreateDataset() { + long file_id = -1; + long dataspace_id = -1; + long datatype_id = -1; + long dataset_id = -1; + long[] dims = { DIM0 }; + byte[] dset_data = new byte[DIM0 * LEN]; + byte[] str_data = { 'O', 'P', 'A', 'Q', 'U', 'E' }; + + // Initialize data. + for (int indx = 0; indx < DIM0; indx++) { + for (int jndx = 0; jndx < LEN - 1; jndx++) + dset_data[jndx + indx * LEN] = str_data[jndx]; + dset_data[LEN - 1 + indx * LEN] = (byte) (indx + '0'); + } + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create opaque datatype and set the tag to something appropriate. + // For this example we will write and view the data as a character + // array. + try { + datatype_id = H5.H5Tcreate(HDF5Constants.H5T_OPAQUE, (long)LEN); + if (datatype_id >= 0) + H5.H5Tset_tag(datatype_id, "Character array"); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset and write the integer data to it. In this + // example we will save the data as 64 bit big endian integers, + // regardless of the native integer type. The HDF5 library + // automatically converts between different integer types. + try { + if ((file_id >= 0) && (datatype_id >= 0) && (dataspace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, datatype_id, dataspace_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the opaque data to the dataset. + try { + if ((dataset_id >= 0) && (datatype_id >= 0)) + H5.H5Dwrite(dataset_id, datatype_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (datatype_id >= 0) + H5.H5Tclose(datatype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long datatype_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long type_len = -1; + long[] dims = { DIM0 }; + byte[] dset_data; + String tag_name = null; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get datatype and properties for the datatype. + try { + if (dataset_id >= 0) + datatype_id = H5.H5Dget_type(dataset_id); + if (datatype_id >= 0) { + type_len = H5.H5Tget_size(datatype_id); + tag_name = H5.H5Tget_tag(datatype_id); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate buffer. + dset_data = new byte[(int) (dims[0] * type_len)]; + + // Read data. + try { + if ((dataset_id >= 0) && (datatype_id >= 0)) + H5.H5Dread(dataset_id, datatype_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Datatype tag for " + DATASETNAME + " is: \"" + tag_name + "\""); + for (int indx = 0; indx < dims[0]; indx++) { + System.out.print(DATASETNAME + "[" + indx + "]: "); + for (int jndx = 0; jndx < type_len; jndx++) { + char temp = (char) dset_data[jndx + indx * (int)type_len]; + System.out.print(temp); + } + System.out.println(""); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (datatype_id >= 0) + H5.H5Tclose(datatype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_Opaque.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_Opaque.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_OpaqueAttribute.java b/java/examples/datatypes/H5Ex_T_OpaqueAttribute.java new file mode 100644 index 0000000..e42bfe8 --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_OpaqueAttribute.java @@ -0,0 +1,307 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write opaque datatypes + to an attribute. The program first writes opaque data to + an attribute with a dataspace of DIM0, then closes the + file. Next, it reopens the file, reads back the data, and + outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_OpaqueAttribute { + private static String FILENAME = "H5Ex_T_OpaqueAttribute.h5"; + private static String DATASETNAME = "DS1"; + private static String ATTRIBUTENAME = "A1"; + private static final int DIM0 = 4; + private static final int LEN = 7; + private static final int RANK = 1; + + private static void CreateDataset() { + long file_id = -1; + long dataspace_id = -1; + long datatype_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0 }; + byte[] dset_data = new byte[DIM0 * LEN]; + byte[] str_data = { 'O', 'P', 'A', 'Q', 'U', 'E' }; + + // Initialize data. + for (int indx = 0; indx < DIM0; indx++) { + for (int jndx = 0; jndx < LEN - 1; jndx++) + dset_data[jndx + indx * LEN] = str_data[jndx]; + dset_data[LEN - 1 + indx * LEN] = (byte) (indx + '0'); + } + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataset with a scalar dataspace. + try { + dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); + if (dataspace_id >= 0) { + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Sclose(dataspace_id); + dataspace_id = -1; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create opaque datatype and set the tag to something appropriate. + // For this example we will write and view the data as a character + // array. + try { + datatype_id = H5.H5Tcreate(HDF5Constants.H5T_OPAQUE, (long)LEN); + if (datatype_id >= 0) + H5.H5Tset_tag(datatype_id, "Character array"); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the attribute and write the array data to it. + try { + if ((dataset_id >= 0) && (datatype_id >= 0) && (dataspace_id >= 0)) + attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, datatype_id, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the dataset. + try { + if ((attribute_id >= 0) && (datatype_id >= 0)) + H5.H5Awrite(attribute_id, datatype_id, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (datatype_id >= 0) + H5.H5Tclose(datatype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long datatype_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long type_len = -1; + long[] dims = { DIM0 }; + byte[] dset_data; + String tag_name = null; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get datatype and properties for the datatype. + try { + if (attribute_id >= 0) + datatype_id = H5.H5Aget_type(attribute_id); + if (datatype_id >= 0) { + type_len = H5.H5Tget_size(datatype_id); + tag_name = H5.H5Tget_tag(datatype_id); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (attribute_id >= 0) + dataspace_id = H5.H5Aget_space(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate buffer. + dset_data = new byte[(int) (dims[0] * type_len)]; + + // Read data. + try { + if ((attribute_id >= 0) && (datatype_id >= 0)) + H5.H5Aread(attribute_id, datatype_id, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + System.out.println("Datatype tag for " + ATTRIBUTENAME + " is: \"" + tag_name + "\""); + for (int indx = 0; indx < dims[0]; indx++) { + System.out.print(ATTRIBUTENAME + "[" + indx + "]: "); + for (int jndx = 0; jndx < type_len; jndx++) { + char temp = (char) dset_data[jndx + indx * (int)type_len]; + System.out.print(temp); + } + System.out.println(""); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (datatype_id >= 0) + H5.H5Tclose(datatype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_OpaqueAttribute.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_OpaqueAttribute.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_String.java b/java/examples/datatypes/H5Ex_T_String.java new file mode 100644 index 0000000..469172d --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_String.java @@ -0,0 +1,311 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write string datatypes + to a dataset. The program first writes strings to a + dataset with a dataspace of DIM0, then closes the file. + Next, it reopens the file, reads back the data, and + outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_String { + private static String FILENAME = "H5Ex_T_String.h5"; + private static String DATASETNAME = "DS1"; + private static final int DIM0 = 4; + private static final int SDIM = 8; + private static final int RANK = 1; + + private static void CreateDataset() { + long file_id = -1; + long memtype_id = -1; + long filetype_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM0 }; + byte[][] dset_data = new byte[DIM0][SDIM]; + StringBuffer[] str_data = { new StringBuffer("Parting"), new StringBuffer("is such"), + new StringBuffer("sweet"), new StringBuffer("sorrow.") }; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create file and memory datatypes. For this example we will save + // the strings as FORTRAN strings, therefore they do not need space + // for the null terminator in the file. + try { + filetype_id = H5.H5Tcopy(HDF5Constants.H5T_FORTRAN_S1); + if (filetype_id >= 0) + H5.H5Tset_size(filetype_id, SDIM - 1); + } + catch (Exception e) { + e.printStackTrace(); + } + try { + memtype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + if (memtype_id >= 0) + H5.H5Tset_size(memtype_id, SDIM); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset and write the string data to it. + try { + if ((file_id >= 0) && (filetype_id >= 0) && (dataspace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, filetype_id, dataspace_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + for (int indx = 0; indx < DIM0; indx++) { + for (int jndx = 0; jndx < SDIM; jndx++) { + if (jndx < str_data[indx].length()) + dset_data[indx][jndx] = (byte) str_data[indx].charAt(jndx); + else + dset_data[indx][jndx] = 0; + } + } + if ((dataset_id >= 0) && (memtype_id >= 0)) + H5.H5Dwrite(dataset_id, memtype_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the file type. + try { + if (filetype_id >= 0) + H5.H5Tclose(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (memtype_id >= 0) + H5.H5Tclose(memtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long filetype_id = -1; + long memtype_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long sdim = 0; + long[] dims = { DIM0 }; + byte[][] dset_data; + StringBuffer[] str_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get the datatype and its size. + try { + if (dataset_id >= 0) + filetype_id = H5.H5Dget_type(dataset_id); + if (filetype_id >= 0) { + sdim = H5.H5Tget_size(filetype_id); + sdim++; // Make room for null terminator + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (dataset_id >= 0) + dataspace_id = H5.H5Dget_space(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate space for data. + dset_data = new byte[(int) dims[0]][(int)sdim]; + str_data = new StringBuffer[(int) dims[0]]; + + // Create the memory datatype. + try { + memtype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + if (memtype_id >= 0) + H5.H5Tset_size(memtype_id, sdim); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read data. + try { + if ((dataset_id >= 0) && (memtype_id >= 0)) + H5.H5Dread(dataset_id, memtype_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + byte[] tempbuf = new byte[(int)sdim]; + for (int indx = 0; indx < (int) dims[0]; indx++) { + for (int jndx = 0; jndx < sdim; jndx++) { + tempbuf[jndx] = dset_data[indx][jndx]; + } + str_data[indx] = new StringBuffer(new String(tempbuf).trim()); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + for (int indx = 0; indx < dims[0]; indx++) { + System.out.println(DATASETNAME + " [" + indx + "]: " + str_data[indx]); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the file type. + try { + if (filetype_id >= 0) + H5.H5Tclose(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (memtype_id >= 0) + H5.H5Tclose(memtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_String.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_String.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_StringAttribute.java b/java/examples/datatypes/H5Ex_T_StringAttribute.java new file mode 100644 index 0000000..49361bc --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_StringAttribute.java @@ -0,0 +1,351 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to read and write string datatypes + to an attribute. The program first writes strings to an + attribute with a dataspace of DIM0, then closes the file. + Next, it reopens the file, reads back the data, and + outputs it to the screen. + ************************************************************/ + +package examples.datatypes; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_StringAttribute { + private static String FILENAME = "H5Ex_T_StringAttribute.h5"; + private static String DATASETNAME = "DS1"; + private static String ATTRIBUTENAME = "A1"; + private static final int DIM0 = 4; + private static final int SDIM = 8; + private static final int RANK = 1; + + private static void CreateDataset() { + long file_id = -1; + long memtype_id = -1; + long filetype_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims = { DIM0 }; + byte[][] dset_data = new byte[DIM0][SDIM]; + StringBuffer[] str_data = { new StringBuffer("Parting"), new StringBuffer("is such"), + new StringBuffer("sweet"), new StringBuffer("sorrow.") }; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create file and memory datatypes. For this example we will save + // the strings as FORTRAN strings, therefore they do not need space + // for the null terminator in the file. + try { + filetype_id = H5.H5Tcopy(HDF5Constants.H5T_FORTRAN_S1); + if (filetype_id >= 0) + H5.H5Tset_size(filetype_id, SDIM - 1); + } + catch (Exception e) { + e.printStackTrace(); + } + try { + memtype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + if (memtype_id >= 0) + H5.H5Tset_size(memtype_id, SDIM); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataset with a scalar dataspace. + try { + dataspace_id = H5.H5Screate(HDF5Constants.H5S_SCALAR); + if (dataspace_id >= 0) { + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, HDF5Constants.H5T_STD_I32LE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Sclose(dataspace_id); + dataspace_id = -1; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(RANK, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the attribute. + try { + if ((dataset_id >= 0) && (dataspace_id >= 0) && (filetype_id >= 0)) + attribute_id = H5.H5Acreate(dataset_id, ATTRIBUTENAME, filetype_id, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + for (int indx = 0; indx < DIM0; indx++) { + for (int jndx = 0; jndx < SDIM; jndx++) { + if (jndx < str_data[indx].length()) + dset_data[indx][jndx] = (byte) str_data[indx].charAt(jndx); + else + dset_data[indx][jndx] = 0; + } + } + if ((attribute_id >= 0) && (memtype_id >= 0)) + H5.H5Awrite(attribute_id, memtype_id, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the file type. + try { + if (filetype_id >= 0) + H5.H5Tclose(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (memtype_id >= 0) + H5.H5Tclose(memtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + private static void ReadDataset() { + long file_id = -1; + long filetype_id = -1; + long memtype_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long sdim = 0; + long[] dims = { DIM0 }; + byte[][] dset_data; + StringBuffer[] str_data; + + // Open an existing file. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing dataset. + try { + if (file_id >= 0) + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + attribute_id = H5.H5Aopen_by_name(dataset_id, ".", ATTRIBUTENAME, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get the datatype and its size. + try { + if (attribute_id >= 0) + filetype_id = H5.H5Aget_type(attribute_id); + if (filetype_id >= 0) { + sdim = H5.H5Tget_size(filetype_id); + sdim++; // Make room for null terminator + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Get dataspace and allocate memory for read buffer. + try { + if (attribute_id >= 0) + dataspace_id = H5.H5Aget_space(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataspace_id >= 0) + H5.H5Sget_simple_extent_dims(dataspace_id, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Allocate space for data. + dset_data = new byte[(int) dims[0]][(int)sdim]; + str_data = new StringBuffer[(int) dims[0]]; + + // Create the memory datatype. + try { + memtype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + if (memtype_id >= 0) + H5.H5Tset_size(memtype_id, sdim); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read data. + try { + if ((attribute_id >= 0) && (memtype_id >= 0)) + H5.H5Aread(attribute_id, memtype_id, dset_data); + byte[] tempbuf = new byte[(int)sdim]; + for (int indx = 0; indx < (int) dims[0]; indx++) { + for (int jndx = 0; jndx < sdim; jndx++) { + tempbuf[jndx] = dset_data[indx][jndx]; + } + str_data[indx] = new StringBuffer(new String(tempbuf).trim()); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Output the data to the screen. + for (int indx = 0; indx < dims[0]; indx++) { + System.out.println(DATASETNAME + " [" + indx + "]: " + str_data[indx]); + } + System.out.println(); + + // End access to the dataset and release resources used by it. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the file type. + try { + if (filetype_id >= 0) + H5.H5Tclose(filetype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the mem type. + try { + if (memtype_id >= 0) + H5.H5Tclose(memtype_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_T_StringAttribute.CreateDataset(); + // Now we begin the read section of this example. Here we assume + // the dataset and array have the same name and rank, but can have + // any size. Therefore we must allocate a new array to read in + // data using malloc(). + H5Ex_T_StringAttribute.ReadDataset(); + } + +} diff --git a/java/examples/datatypes/H5Ex_T_VLString.java b/java/examples/datatypes/H5Ex_T_VLString.java new file mode 100644 index 0000000..c8892ba --- /dev/null +++ b/java/examples/datatypes/H5Ex_T_VLString.java @@ -0,0 +1,138 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + Creating and writing a VL string to a file. + ************************************************************/ + +package examples.datatypes; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_T_VLString +{ + private static String FILENAME = "H5Ex_T_VLString.h5"; + private static String DATASETNAME = "DS1"; + + private static void createDataset() { + long file_id = -1; + long type_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + int rank = 1; + String[] str_data = { "Parting", "is such", "sweet", "sorrow." }; + long[] dims = { str_data.length }; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + type_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + H5.H5Tset_size(type_id, HDF5Constants.H5T_VARIABLE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create dataspace. Setting maximum size to NULL sets the maximum + // size to be the current size. + try { + dataspace_id = H5.H5Screate_simple(rank, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset and write the string data to it. + try { + if ((file_id >= 0) && (type_id >= 0) && (dataspace_id >= 0)) { + dataset_id = H5.H5Dcreate(file_id, DATASETNAME, type_id, dataspace_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the data to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite_VLStrings(dataset_id, type_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, str_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + H5.H5Sclose(dataspace_id); + H5.H5Tclose(type_id); + H5.H5Dclose(dataset_id); + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + private static void readDataset() { + long file_id = -1; + long type_id = -1; + long dataset_id = -1; + String[] str_data = { "", "", "", "" }; + + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + dataset_id = H5.H5Dopen(file_id, DATASETNAME, HDF5Constants.H5P_DEFAULT); + type_id = H5.H5Dget_type(dataset_id); + H5.H5Dread_VLStrings(dataset_id, type_id, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, + str_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + for (int indx = 0; indx < str_data.length; indx++) + System.out.println(DATASETNAME + " [" + indx + "]: " + str_data[indx]); + + try { + H5.H5Tclose(type_id); + H5.H5Dclose(dataset_id); + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_T_VLString.createDataset(); + H5Ex_T_VLString.readDataset(); + } + +} diff --git a/java/examples/datatypes/Makefile.am b/java/examples/datatypes/Makefile.am new file mode 100644 index 0000000..de2ea9d --- /dev/null +++ b/java/examples/datatypes/Makefile.am @@ -0,0 +1,78 @@ +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +## +## Makefile.am +## Run automake to generate a Makefile.in from this file. +## +# +# HDF5 Java Library Examples Makefile(.in) + +include $(top_srcdir)/config/commence.am + +# Mark this directory as part of the JNI API +JAVA_API=yes + +JAVAROOT = .classes + +classes: + $(MKDIR_P) $(@D)/$(JAVAROOT) + +pkgpath = examples/datatypes +hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar +CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.5.jar:$$CLASSPATH + +jarfile = jar$(PACKAGE_TARNAME)datatypes.jar + +AM_JAVACFLAGS = $(H5_JAVACFLAGS) -deprecation + +TESTPACKAGE = + +noinst_JAVA = \ + H5Ex_T_Array.java \ + H5Ex_T_ArrayAttribute.java \ + H5Ex_T_Bit.java \ + H5Ex_T_BitAttribute.java \ + H5Ex_T_Commit.java \ + H5Ex_T_Compound.java \ + H5Ex_T_CompoundAttribute.java \ + H5Ex_T_Float.java \ + H5Ex_T_FloatAttribute.java \ + H5Ex_T_Integer.java \ + H5Ex_T_IntegerAttribute.java \ + H5Ex_T_ObjectReference.java \ + H5Ex_T_ObjectReferenceAttribute.java \ + H5Ex_T_Opaque.java \ + H5Ex_T_OpaqueAttribute.java \ + H5Ex_T_String.java \ + H5Ex_T_StringAttribute.java \ + H5Ex_T_VLString.java + +$(jarfile): classnoinst.stamp classes + $(JAR) cvf $@ -C $(JAVAROOT)/ $(pkgpath) + +noinst_DATA = $(jarfile) + +.PHONY: classes + +check_SCRIPTS = runExample.sh +TEST_SCRIPT = $(check_SCRIPTS) + +CLEANFILES = classnoinst.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class runExample.sh + +clean: + rm -rf $(JAVAROOT) + rm -f $(jarfile) + rm -f classnoinst.stamp + +include $(top_srcdir)/config/conclude.am diff --git a/java/examples/datatypes/runExample.sh.in b/java/examples/datatypes/runExample.sh.in new file mode 100644 index 0000000..9ed3954 --- /dev/null +++ b/java/examples/datatypes/runExample.sh.in @@ -0,0 +1,408 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# + +top_builddir=@top_builddir@ +top_srcdir=@top_srcdir@ +srcdir=@srcdir@ + +TESTNAME=EX_Datatypes +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +# Set up default variable values if not supplied by the user. +RM='rm -rf' +CMP='cmp' +DIFF='diff -c' +CP='cp' +DIRNAME='dirname' +LS='ls' +AWK='awk' + +nerrors=0 + +# where the libs exist +HDFLIB_HOME="$top_srcdir/java/lib" +BLDLIBDIR="./lib" +BLDDIR="." +HDFTEST_HOME="$top_srcdir/java/examples/datatypes" +JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar +TESTJARFILE=jar@PACKAGE_TARNAME@datatypes.jar +test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR + +###################################################################### +# library files +# -------------------------------------------------------------------- +# All the library files copy from source directory to test directory +# NOTE: Keep this framework to add/remove test files. +# This list are also used for checking exist. +# Comment '#' without space can be used. +# -------------------------------------------------------------------- +LIST_LIBRARY_FILES=" +$HDFLIB_HOME/slf4j-api-1.7.5.jar +$HDFLIB_HOME/ext/slf4j-simple-1.7.5.jar +$top_builddir/src/.libs/libhdf5.* +$top_builddir/java/src/jni/.libs/libhdf5_java.* +$top_builddir/java/src/$JARFILE +" +LIST_DATA_FILES=" +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_Array.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_ArrayAttribute.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_Bit.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_BitAttribute.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_Commit.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_Compound.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_CompoundAttribute.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_Float.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_FloatAttribute.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_Integer.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_IntegerAttribute.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_ObjectReference.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_ObjectReferenceAttribute.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_Opaque.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_OpaqueAttribute.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_String.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_StringAttribute.txt +$HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_VLString.txt +" + +# +# copy files from source dirs to test dir +# +COPY_LIBFILES="$LIST_LIBRARY_FILES" + +COPY_LIBFILES_TO_BLDLIBDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_LIBFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDLIBDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done +} + +CLEAN_LIBFILES_AND_BLDLIBDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $BLDLIBDIR + fi +} + +COPY_DATAFILES="$LIST_DATA_FILES" + +COPY_DATAFILES_TO_BLDDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_DATAFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done +} + +CLEAN_DATAFILES_AND_BLDDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $BLDDIR/*.txt + $RM $BLDDIR/*.out + fi +} + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Testing". +# +TESTING() { + SPACES=" " + echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# where Java is installed (requires jdk1.7.x) +JAVAEXE=@JAVA@ +JAVAEXEFLAGS=@H5_JAVAFLAGS@ + +############################################################################### +# DO NOT MODIFY BELOW THIS LINE +############################################################################### + +# prepare for test +COPY_LIBFILES_TO_BLDLIBDIR +COPY_DATAFILES_TO_BLDDIR + +CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.5.jar:"$BLDLIBDIR"/slf4j-simple-1.7.5.jar:"$TESTJARFILE"" + +TEST=/usr/bin/test +if [ ! -x /usr/bin/test ] +then +TEST=`which test` +fi + +if $TEST -z "$CLASSPATH"; then + CLASSPATH="" +fi +CLASSPATH=$CPATH":"$CLASSPATH +export CLASSPATH + +if $TEST -n "$JAVAPATH" ; then + PATH=$JAVAPATH":"$PATH + export PATH +fi + +if $TEST -e /bin/uname; then + os_name=`/bin/uname -s` +elif $TEST -e /usr/bin/uname; then + os_name=`/usr/bin/uname -s` +else + os_name=unknown +fi + +if $TEST -z "$LD_LIBRARY_PATH" ; then + LD_LIBRARY_PATH="" +fi + +case $os_name in + Darwin) + DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH + export DYLD_LIBRARY_PATH + LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH + ;; + *) + LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH + ;; +esac + +export LD_LIBRARY_PATH + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Array" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Array > H5Ex_T_Array.out) +if diff H5Ex_T_Array.out examples.datatypes.H5Ex_T_Array.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_Array" +else + echo "**FAILED** datatypes.H5Ex_T_Array" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_ArrayAttribute" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_ArrayAttribute > H5Ex_T_ArrayAttribute.out) +if diff H5Ex_T_ArrayAttribute.out examples.datatypes.H5Ex_T_ArrayAttribute.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_ArrayAttribute" +else + echo "**FAILED** datatypes.H5Ex_T_ArrayAttribute" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Bit" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Bit > H5Ex_T_Bit.out) +if diff H5Ex_T_Bit.out examples.datatypes.H5Ex_T_Bit.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_Bit" +else + echo "**FAILED** datatypes.H5Ex_T_Bit" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_BitAttribute" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_BitAttribute > H5Ex_T_BitAttribute.out) +if diff H5Ex_T_BitAttribute.out examples.datatypes.H5Ex_T_BitAttribute.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_BitAttribute" +else + echo "**FAILED** datatypes.H5Ex_T_BitAttribute" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Commit" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Commit > H5Ex_T_Commit.out) +if diff H5Ex_T_Commit.out examples.datatypes.H5Ex_T_Commit.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_Commit" +else + echo "**FAILED** datatypes.H5Ex_T_Commit" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Compound" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Compound > H5Ex_T_Compound.out) +if diff H5Ex_T_Compound.out examples.datatypes.H5Ex_T_Compound.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_Compound" +else + echo "**FAILED** datatypes.H5Ex_T_Compound" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_CompoundAttribute" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_CompoundAttribute > H5Ex_T_CompoundAttribute.out) +if diff H5Ex_T_CompoundAttribute.out examples.datatypes.H5Ex_T_CompoundAttribute.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_CompoundAttribute" +else + echo "**FAILED** datatypes.H5Ex_T_CompoundAttribute" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Float" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Float > H5Ex_T_Float.out) +if diff H5Ex_T_Float.out examples.datatypes.H5Ex_T_Float.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_Float" +else + echo "**FAILED** datatypes.H5Ex_T_Float" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_FloatAttribute" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_FloatAttribute > H5Ex_T_FloatAttribute.out) +if diff H5Ex_T_FloatAttribute.out examples.datatypes.H5Ex_T_FloatAttribute.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_FloatAttribute" +else + echo "**FAILED** datatypes.H5Ex_T_FloatAttribute" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Integer" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Integer > H5Ex_T_Integer.out) +if diff H5Ex_T_Integer.out examples.datatypes.H5Ex_T_Integer.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_Integer" +else + echo "**FAILED** datatypes.H5Ex_T_Integer" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_IntegerAttribute" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_IntegerAttribute > H5Ex_T_IntegerAttribute.out) +if diff H5Ex_T_IntegerAttribute.out examples.datatypes.H5Ex_T_IntegerAttribute.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_IntegerAttribute" +else + echo "**FAILED** datatypes.H5Ex_T_IntegerAttribute" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_ObjectReference" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_ObjectReference > H5Ex_T_ObjectReference.out) +if diff H5Ex_T_ObjectReference.out examples.datatypes.H5Ex_T_ObjectReference.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_ObjectReference" +else + echo "**FAILED** datatypes.H5Ex_T_ObjectReference" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_ObjectReferenceAttribute" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_ObjectReferenceAttribute > H5Ex_T_ObjectReferenceAttribute.out) +if diff H5Ex_T_ObjectReferenceAttribute.out examples.datatypes.H5Ex_T_ObjectReferenceAttribute.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_ObjectReferenceAttribute" +else + echo "**FAILED** datatypes.H5Ex_T_ObjectReferenceAttribute" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Opaque" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_Opaque > H5Ex_T_Opaque.out) +if diff H5Ex_T_Opaque.out examples.datatypes.H5Ex_T_Opaque.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_Opaque" +else + echo "**FAILED** datatypes.H5Ex_T_Opaque" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_OpaqueAttribute" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_OpaqueAttribute > H5Ex_T_OpaqueAttribute.out) +if diff H5Ex_T_OpaqueAttribute.out examples.datatypes.H5Ex_T_OpaqueAttribute.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_OpaqueAttribute" +else + echo "**FAILED** datatypes.H5Ex_T_OpaqueAttribute" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_String" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_String > H5Ex_T_String.out) +if diff H5Ex_T_String.out examples.datatypes.H5Ex_T_String.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_String" +else + echo "**FAILED** datatypes.H5Ex_T_String" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_StringAttribute" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_StringAttribute > H5Ex_T_StringAttribute.out) +if diff H5Ex_T_StringAttribute.out examples.datatypes.H5Ex_T_StringAttribute.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_StringAttribute" +else + echo "**FAILED** datatypes.H5Ex_T_StringAttribute" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_VLString" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.datatypes.H5Ex_T_VLString > H5Ex_T_VLString.out) +if diff H5Ex_T_VLString.out examples.datatypes.H5Ex_T_VLString.txt > /dev/null; then + echo " PASSED datatypes.H5Ex_T_VLString" +else + echo "**FAILED** datatypes.H5Ex_T_VLString" + nerrors="`expr $nerrors + 1`" +fi + +# Clean up temporary files/directories +CLEAN_LIBFILES_AND_BLDLIBDIR +CLEAN_DATAFILES_AND_BLDDIR + +# Report test results and exit +if test $nerrors -eq 0 ; then + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE +fi diff --git a/java/examples/groups/CMakeLists.txt b/java/examples/groups/CMakeLists.txt new file mode 100644 index 0000000..0849f0c --- /dev/null +++ b/java/examples/groups/CMakeLists.txt @@ -0,0 +1,138 @@ +cmake_minimum_required (VERSION 3.1.0) +PROJECT (HDFJAVA_EXAMPLES_GROUPS Java) + +set (CMAKE_VERBOSE_MAKEFILE 1) + +INCLUDE_DIRECTORIES ( + ${HDF5_JAVA_JNI_BINARY_DIR} + ${HDF5_JAVA_HDF5_LIB_DIR} +) + +set (HDF_JAVA_EXAMPLES + H5Ex_G_Create + H5Ex_G_Iterate + H5Ex_G_Compact + H5Ex_G_Corder + H5Ex_G_Intermediate + H5Ex_G_Phase + H5Ex_G_Visit +) + +if (WIN32) + set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") +else (WIN32) + set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") +endif (WIN32) + +set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS}") + +set (CMAKE_JAVA_CLASSPATH ".") +foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH}) + set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}") +endforeach (CMAKE_INCLUDE_PATH) + +foreach (example ${HDF_JAVA_EXAMPLES}) + file (WRITE ${PROJECT_BINARY_DIR}/${example}_Manifest.txt + "Main-Class: examples.groups.${example} +" + ) + add_jar (${example} MANIFEST ${PROJECT_BINARY_DIR}/${example}_Manifest.txt ${example}.java) + get_target_property (${example}_JAR_FILE ${example} JAR_FILE) +# install_jar (${example} ${HJAVA_INSTALL_DATA_DIR}/examples examples) + get_target_property (${example}_CLASSPATH ${example} CLASSDIR) + add_dependencies (${example} ${HDF5_JAVA_HDF5_LIB_TARGET}) +endforeach (example ${HDF_JAVA_EXAMPLES}) + +set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS};${HDF5_JAVA_LOGGING_JAR};${HDF5_JAVA_LOGGING_NOP_JAR}") + +set (CMAKE_JAVA_CLASSPATH ".") +foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) + set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}") +endforeach (HDFJAVA_JAR) + +set (HDF_JAVA_TEST_FILES + h5ex_g_iterate.h5 + h5ex_g_visit.h5 +) + +foreach (h5_file ${HDF_JAVA_TEST_FILES}) + set (dest "${PROJECT_BINARY_DIR}/${h5_file}") + #message (STATUS " Copying ${h5_file}") + add_custom_command ( + TARGET H5Ex_G_Visit + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/${h5_file} ${dest} + ) +endforeach (h5_file ${HDF_JAVA_TEST_FILES}) + +MACRO (ADD_H5_TEST resultfile resultcode) + add_test ( + NAME JAVA_groups-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" + -D "TEST_PROGRAM=examples.groups.${resultfile}" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" + -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" + -D "TEST_OUTPUT=groups/${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=groups/${resultfile}.txt" + -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (JAVA_groups-${resultfile} PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + set (last_test "JAVA_groups-${resultfile}") +ENDMACRO (ADD_H5_TEST file) + +if (BUILD_TESTING) + foreach (example ${HDF_JAVA_EXAMPLES}) + add_test ( + NAME JAVA_groups-${example}-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${example}.out + ${example}.out.err + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (JAVA_groups-${example}-clearall-objects PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + set (last_test "JAVA_groups-${example}-clearall-objects") + if (NOT ${example} STREQUAL "H5Ex_G_Iterate" AND NOT ${example} STREQUAL "H5Ex_G_Visit") + if (${example} STREQUAL "H5Ex_G_Compact") + add_test ( + NAME JAVA_groups-${example}-clearall-h5s + COMMAND ${CMAKE_COMMAND} + -E remove + ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}1.h5 + ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}2.h5 + ) + else (${example} STREQUAL "H5Ex_G_Compact") + add_test ( + NAME JAVA_groups-${example}-clearall-h5s + COMMAND ${CMAKE_COMMAND} + -E remove + ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 + ) + endif (${example} STREQUAL "H5Ex_G_Compact") + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (JAVA_groups-${example}-clearall-h5s PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + set (last_test "JAVA_groups-${example}-clearall-h5s") + endif (NOT ${example} STREQUAL "H5Ex_G_Iterate" AND NOT ${example} STREQUAL "H5Ex_G_Visit") + add_test ( + NAME JAVA_groups-${example}-copy-objects + COMMAND ${CMAKE_COMMAND} + -E copy_if_different + ${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.groups.${example}.txt + ${HDFJAVA_EXAMPLES_GROUPS_BINARY_DIR}/${example}.txt + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (JAVA_groups-${example}-copy-objects PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + set (last_test "JAVA_groups-${example}-copy-objects") + ADD_H5_TEST (${example} 0) + endforeach (example ${HDF_JAVA_EXAMPLES}) +endif (BUILD_TESTING) diff --git a/java/examples/groups/H5Ex_G_Compact.java b/java/examples/groups/H5Ex_G_Compact.java new file mode 100644 index 0000000..ca9b6c8 --- /dev/null +++ b/java/examples/groups/H5Ex_G_Compact.java @@ -0,0 +1,266 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + Creating a file and print the storage layout. + ************************************************************/ + +package examples.groups; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.structs.H5G_info_t; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +public class H5Ex_G_Compact { + + private static final String FILE1 = "H5Ex_G_Compact1.h5"; + private static final String FILE2 = "H5Ex_G_Compact2.h5"; + private static final String GROUP = "G1"; + + enum H5G_storage { + H5G_STORAGE_TYPE_UNKNOWN(-1), + H5G_STORAGE_TYPE_SYMBOL_TABLE(0), + H5G_STORAGE_TYPE_COMPACT(1), + H5G_STORAGE_TYPE_DENSE(2); + + private static final Map lookup = new HashMap(); + + static { + for (H5G_storage s : EnumSet.allOf(H5G_storage.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5G_storage(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5G_storage get(int code) { + return lookup.get(code); + } + } + + public static void CreateGroup() { + long file_id = -1; + long group_id = -1; + long fapl_id = -1; + H5G_info_t ginfo; + long size; + + // Create file 1. This file will use original format groups. + try { + file_id = H5.H5Fcreate (FILE1, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + // Create a group in the file1. + try { + if(file_id >= 0) + group_id = H5.H5Gcreate(file_id, GROUP, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Obtain the group info and print the group storage type. + try { + if(group_id >= 0) { + ginfo = H5.H5Gget_info(group_id); + System.out.print("Group storage type for " + FILE1 + " is: "); + switch (H5G_storage.get(ginfo.storage_type)) { + case H5G_STORAGE_TYPE_COMPACT: + System.out.println("H5G_STORAGE_TYPE_COMPACT"); // New compact format + break; + case H5G_STORAGE_TYPE_DENSE: + System.out.println("H5G_STORAGE_TYPE_DENSE"); // New dense (indexed) format + break; + case H5G_STORAGE_TYPE_SYMBOL_TABLE: + System.out.println("H5G_STORAGE_TYPE_SYMBOL_TABLE"); // Original format + break; + case H5G_STORAGE_TYPE_UNKNOWN: + System.out.println("H5G_STORAGE_TYPE_UNKNOWN"); + break; + default: + System.out.println("Storage Type Invalid"); + break; + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the group. + try { + if (group_id >= 0) + H5.H5Gclose(group_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // close the file 1. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Re-open file 1. Need to get the correct file size. + try { + file_id = H5.H5Fopen(FILE1, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Obtain and print the file size. + try { + if (file_id >= 0) { + size = H5.H5Fget_filesize(file_id); + System.out.println("File size for " + FILE1 + " is: " + size + " bytes"); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close FILE1. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Set file access property list to allow the latest file format. + // This will allow the library to create new compact format groups. + try { + fapl_id = H5.H5Pcreate(HDF5Constants.H5P_FILE_ACCESS); + if (fapl_id >= 0) + H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST, HDF5Constants.H5F_LIBVER_LATEST); + } + catch (Exception e) { + e.printStackTrace(); + } + System.out.println(); + // Create file 2 using the new file access property list. + try { + file_id = H5.H5Fcreate(FILE2, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, fapl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + // Create group in file2. + try { + if(file_id >= 0) + group_id = H5.H5Gcreate(file_id, GROUP, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Obtain the group info and print the group storage type. + try { + if (group_id >= 0) { + ginfo = H5.H5Gget_info(group_id); + System.out.print("Group storage type for " + FILE2 + " is: "); + switch (H5G_storage.get(ginfo.storage_type)) { + case H5G_STORAGE_TYPE_COMPACT: + System.out.println("H5G_STORAGE_TYPE_COMPACT"); // New compact format + break; + case H5G_STORAGE_TYPE_DENSE: + System.out.println("H5G_STORAGE_TYPE_DENSE"); // New dense (indexed) format + break; + case H5G_STORAGE_TYPE_SYMBOL_TABLE: + System.out.println("H5G_STORAGE_TYPE_SYMBOL_TABLE"); // Original format + break; + case H5G_STORAGE_TYPE_UNKNOWN: + System.out.println("H5G_STORAGE_TYPE_UNKNOWN"); + break; + default: + System.out.println("Storage Type Invalid"); + break; + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the group. + try { + if (group_id >= 0) + H5.H5Gclose(group_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // close the file 2. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Re-open file 2. Needed to get the correct file size. + try { + file_id = H5.H5Fopen(FILE2, HDF5Constants.H5F_ACC_RDONLY, fapl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Obtain and print the file size. + try { + if (file_id >= 0) { + size = H5.H5Fget_filesize(file_id); + System.out.println("File size for " + FILE2 + " is: " + size + " bytes"); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close FILE2. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_G_Compact.CreateGroup(); + } +} diff --git a/java/examples/groups/H5Ex_G_Corder.java b/java/examples/groups/H5Ex_G_Corder.java new file mode 100644 index 0000000..95790bf --- /dev/null +++ b/java/examples/groups/H5Ex_G_Corder.java @@ -0,0 +1,121 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/************************************************************ + Creating a file with creation properties and traverse the + groups in alpabetical and creation order. + ************************************************************/ + +package examples.groups; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.structs.H5G_info_t; + +public class H5Ex_G_Corder { + private static String FILE = "H5Ex_G_Corder.h5"; + + private static void CreateGroup() throws Exception { + long file_id = -1; + long group_id = -1; + long subgroup_id = -1; + long gcpl_id = -1; + int status; + H5G_info_t ginfo; + int i; + String name; + + try { + // Create a new file using default properties. + file_id = H5.H5Fcreate(FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + + // Create group creation property list and enable link creation order tracking. + gcpl_id = H5.H5Pcreate(HDF5Constants.H5P_GROUP_CREATE); + status = H5.H5Pset_link_creation_order(gcpl_id, HDF5Constants.H5P_CRT_ORDER_TRACKED + + HDF5Constants.H5P_CRT_ORDER_INDEXED); + + // Create primary group using the property list. + if (status >= 0) + group_id = H5.H5Gcreate(file_id, "index_group", HDF5Constants.H5P_DEFAULT, gcpl_id, + HDF5Constants.H5P_DEFAULT); + + try { + /* + * Create subgroups in the primary group. These will be tracked by creation order. Note that these + * groups do not have to have the creation order tracking property set. + */ + subgroup_id = H5.H5Gcreate(group_id, "H", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + status = H5.H5Gclose(subgroup_id); + subgroup_id = H5.H5Gcreate(group_id, "D", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + status = H5.H5Gclose(subgroup_id); + subgroup_id = H5.H5Gcreate(group_id, "F", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + status = H5.H5Gclose(subgroup_id); + subgroup_id = H5.H5Gcreate(group_id, "5", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + status = H5.H5Gclose(subgroup_id); + + // Get group info. + ginfo = H5.H5Gget_info(group_id); + + // Traverse links in the primary group using alphabetical indices (H5_INDEX_NAME). + System.out.println("Traversing group using alphabetical indices:"); + for (i = 0; i < ginfo.nlinks; i++) { + // Retrieve the name of the ith link in a group + name = H5.H5Lget_name_by_idx(group_id, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, + i, HDF5Constants.H5P_DEFAULT); + System.out.println("Index " + i + ": " + name); + } + + // Traverse links in the primary group by creation order (H5_INDEX_CRT_ORDER). + System.out.println("Traversing group using creation order indices:"); + for (i = 0; i < ginfo.nlinks; i++) { + // Retrieve the name of the ith link in a group + name = H5.H5Lget_name_by_idx(group_id, ".", HDF5Constants.H5_INDEX_CRT_ORDER, + HDF5Constants.H5_ITER_INC, i, HDF5Constants.H5P_DEFAULT); + System.out.println("Index " + i + ": " + name); + } + + } + catch (Exception e) { + e.printStackTrace(); + } + } + catch (Exception e) { + e.printStackTrace(); + } + finally { + // Close and release resources. + if (gcpl_id >= 0) + H5.H5Pclose(gcpl_id); + if (group_id >= 0) + H5.H5Gclose(group_id); + if (file_id >= 0) + H5.H5Fclose(file_id); + } + } + + public static void main(String[] args) { + try { + H5Ex_G_Corder.CreateGroup(); + } + catch (Exception ex) { + ex.printStackTrace(); + } + } + +} diff --git a/java/examples/groups/H5Ex_G_Create.java b/java/examples/groups/H5Ex_G_Create.java new file mode 100644 index 0000000..1902d86 --- /dev/null +++ b/java/examples/groups/H5Ex_G_Create.java @@ -0,0 +1,94 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to create, open, and close a group. + ************************************************************/ + +package examples.groups; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5Ex_G_Create { + private static String FILENAME = "H5Ex_G_Create.h5"; + private static String GROUPNAME = "G1"; + + private static void CreateGroup() { + long file_id = -1; + long group_id = -1; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create a group in the file. + try { + if (file_id >= 0) + group_id = H5.H5Gcreate(file_id, "/" + GROUPNAME, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the group. The handle "group" can no longer be used. + try { + if (group_id >= 0) + H5.H5Gclose(group_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Re-open the group, obtaining a new handle. + try { + if (file_id >= 0) + group_id = H5.H5Gopen(file_id, "/" + GROUPNAME, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the group. + try { + if (group_id >= 0) + H5.H5Gclose(group_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_G_Create.CreateGroup(); + } + +} diff --git a/java/examples/groups/H5Ex_G_Intermediate.java b/java/examples/groups/H5Ex_G_Intermediate.java new file mode 100644 index 0000000..a3d620b --- /dev/null +++ b/java/examples/groups/H5Ex_G_Intermediate.java @@ -0,0 +1,125 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to create intermediate groups with + a single call to H5Gcreate. + ************************************************************/ +package examples.groups; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.callbacks.H5O_iterate_cb; +import hdf.hdf5lib.callbacks.H5O_iterate_t; +import hdf.hdf5lib.structs.H5O_info_t; + +import java.util.ArrayList; + +public class H5Ex_G_Intermediate { + + private static String FILE = "H5Ex_G_Intermediate.h5"; + + private void CreateGroup() throws Exception { + + long file_id = -1; + long group_id = -1; + long gcpl_id = -1; + + try { + // Create a new file_id using the default properties. + file_id = H5.H5Fcreate(FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + + // Create group_id creation property list and set it to allow creation of intermediate group_ids. + gcpl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_CREATE); + H5.H5Pset_create_intermediate_group(gcpl_id, true); + + /* + * Create the group_id /G1/G2/G3. Note that /G1 and /G1/G2 do not exist yet. This call would cause an error + * if we did not use the previously created property list. + */ + group_id = H5 + .H5Gcreate(file_id, "/G1/G2/G3", gcpl_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + // Print all the objects in the file_ids to show that intermediate group_ids have been created. + System.out.println("Objects in the file_id:"); + + // H5O_iterate_t iter_data = null; + H5O_iterate_t iter_data = new H5O_iter_data(); + H5O_iterate_cb iter_cb = new H5O_iter_callback(); + + H5.H5Ovisit(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, iter_cb, iter_data); + } + catch (Exception e) { + e.printStackTrace(); + } + finally { + // Close and release resources. + if (gcpl_id >= 0) + H5.H5Pclose(gcpl_id); + if (group_id >= 0) + H5.H5Gclose(group_id); + if (file_id >= 0) + H5.H5Fclose(file_id); + } + } + + public static void main(String[] args) { + try { + (new H5Ex_G_Intermediate()).CreateGroup(); + } + catch (Exception ex) { + ex.printStackTrace(); + } + } + + private class idata { + public String link_name = null; + public int link_type = -1; + + idata(String name, int type) { + this.link_name = name; + this.link_type = type; + } + } + + private class H5O_iter_data implements H5O_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + + private class H5O_iter_callback implements H5O_iterate_cb { + public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) { + idata id = new idata(name, info.type); + ((H5O_iter_data) op_data).iterdata.add(id); + + System.out.print("/"); /* Print root group in object path */ + + // Check if the current object is the root group, and if not print the full path name and type. + + if (name.charAt(0) == '.') /* Root group, do not print '.' */ + System.out.println(" (Group)"); + else if (info.type == HDF5Constants.H5O_TYPE_GROUP) + System.out.println(name + " (Group)"); + else if (info.type == HDF5Constants.H5O_TYPE_DATASET) + System.out.println(name + " (Dataset)"); + else if (info.type == HDF5Constants.H5O_TYPE_NAMED_DATATYPE) + System.out.println(name + " (Datatype)"); + else + System.out.println(name + " (Unknown)"); + + return 0; + } + } + +} diff --git a/java/examples/groups/H5Ex_G_Iterate.java b/java/examples/groups/H5Ex_G_Iterate.java new file mode 100644 index 0000000..d0b4ea4 --- /dev/null +++ b/java/examples/groups/H5Ex_G_Iterate.java @@ -0,0 +1,119 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to iterate over group members using + H5Gget_obj_info_all. + ************************************************************/ +package examples.groups; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +public class H5Ex_G_Iterate { + private static String FILENAME = "groups/h5ex_g_iterate.h5"; + private static String DATASETNAME = "/"; + + enum H5O_type { + H5O_TYPE_UNKNOWN(-1), // Unknown object type + H5O_TYPE_GROUP(0), // Object is a group + H5O_TYPE_DATASET(1), // Object is a dataset + H5O_TYPE_NAMED_DATATYPE(2), // Object is a named data type + H5O_TYPE_NTYPES(3); // Number of different object types + private static final Map lookup = new HashMap(); + + static { + for (H5O_type s : EnumSet.allOf(H5O_type.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5O_type(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5O_type get(int code) { + return lookup.get(code); + } + } + + private static void do_iterate() { + long file_id = -1; + + // Open a file using default properties. + try { + file_id = H5.H5Fopen(FILENAME, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Begin iteration. + System.out.println("Objects in root group:"); + try { + if (file_id >= 0) { + int count = (int) H5.H5Gn_members(file_id, DATASETNAME); + String[] oname = new String[count]; + int[] otype = new int[count]; + int[] ltype = new int[count]; + long[] orefs = new long[count]; + H5.H5Gget_obj_info_all(file_id, DATASETNAME, oname, otype, ltype, orefs, HDF5Constants.H5_INDEX_NAME); + + // Get type of the object and display its name and type. + for (int indx = 0; indx < otype.length; indx++) { + switch (H5O_type.get(otype[indx])) { + case H5O_TYPE_GROUP: + System.out.println(" Group: " + oname[indx]); + break; + case H5O_TYPE_DATASET: + System.out.println(" Dataset: " + oname[indx]); + break; + case H5O_TYPE_NAMED_DATATYPE: + System.out.println(" Datatype: " + oname[indx]); + break; + default: + System.out.println(" Unknown: " + oname[indx]); + } + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_G_Iterate.do_iterate(); + } + +} diff --git a/java/examples/groups/H5Ex_G_Phase.java b/java/examples/groups/H5Ex_G_Phase.java new file mode 100644 index 0000000..f23d6f2 --- /dev/null +++ b/java/examples/groups/H5Ex_G_Phase.java @@ -0,0 +1,241 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to set the conditions for + conversion between compact and dense (indexed) groups. + ************************************************************/ +package examples.groups; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.structs.H5G_info_t; + +import java.util.EnumSet; +import java.util.HashMap; +import java.util.Map; + +public class H5Ex_G_Phase { + private static String FILE = "H5Ex_G_Phase.h5"; + private static int MAX_GROUPS = 7; + private static int MAX_COMPACT = 5; + private static int MIN_DENSE = 3; + + enum H5G_storage { + H5G_STORAGE_TYPE_UNKNOWN(-1), + H5G_STORAGE_TYPE_SYMBOL_TABLE(0), + H5G_STORAGE_TYPE_COMPACT(1), + H5G_STORAGE_TYPE_DENSE(2); + + private static final Map lookup = new HashMap(); + + static { + for (H5G_storage s : EnumSet.allOf(H5G_storage.class)) + lookup.put(s.getCode(), s); + } + + private int code; + + H5G_storage(int layout_type) { + this.code = layout_type; + } + + public int getCode() { + return this.code; + } + + public static H5G_storage get(int code) { + return lookup.get(code); + } + } + + private static void CreateGroup() { + long file_id = -1; + long group_id = -1; + long subgroup_id = -1; + long fapl_id = -1; + long gcpl_id = -1; + H5G_info_t ginfo; + String name = "G0"; // Name of subgroup_id + int i; + + // Set file access property list to allow the latest file format.This will allow the library to create new + // format groups. + try { + fapl_id = H5.H5Pcreate(HDF5Constants.H5P_FILE_ACCESS); + if (fapl_id >= 0) + H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST, HDF5Constants.H5F_LIBVER_LATEST); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create group access property list and set the phase change conditions. + try { + gcpl_id = H5.H5Pcreate(HDF5Constants.H5P_GROUP_CREATE); + if (gcpl_id >= 0) + H5.H5Pset_link_phase_change(gcpl_id, MAX_COMPACT, MIN_DENSE); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create a new file using the default properties. + try { + if (fapl_id >= 0) + file_id = H5.H5Fcreate(FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, fapl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create primary group. + try { + if ((file_id >= 0) && (gcpl_id >= 0)) + group_id = H5.H5Gcreate(file_id, name, HDF5Constants.H5P_DEFAULT, gcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Add subgroups to "group" one at a time, print the storage type for "group" after each subgroup is created. + for (i = 1; i <= MAX_GROUPS; i++) { + // Define the subgroup name and create the subgroup. + char append = (char) (((char) i) + '0'); + name = name + append; /* G1, G2, G3 etc. */ + try { + if (group_id >= 0) { + subgroup_id = H5.H5Gcreate(group_id, name, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + H5.H5Gclose(subgroup_id); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Obtain the group info and print the group storage type + try { + if (group_id >= 0) { + ginfo = H5.H5Gget_info(group_id); + System.out.print(ginfo.nlinks + " Group" + (ginfo.nlinks == 1 ? " " : "s") + ": Storage type is "); + switch (H5G_storage.get(ginfo.storage_type)) { + case H5G_STORAGE_TYPE_COMPACT: + System.out.println("H5G_STORAGE_TYPE_COMPACT"); // New compact format + break; + case H5G_STORAGE_TYPE_DENSE: + System.out.println("H5G_STORAGE_TYPE_DENSE"); // New dense (indexed) format + break; + case H5G_STORAGE_TYPE_SYMBOL_TABLE: + System.out.println("H5G_STORAGE_TYPE_SYMBOL_TABLE"); // Original format + break; + case H5G_STORAGE_TYPE_UNKNOWN: + System.out.println("H5G_STORAGE_TYPE_UNKNOWN"); + break; + default: + System.out.println("Storage Type Invalid"); + break; + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + } + + System.out.println(); + + // Delete subgroups one at a time, print the storage type for "group" after each subgroup is deleted. + for (i = MAX_GROUPS; i >= 1; i--) { + // Define the subgroup name and delete the subgroup. + try { + H5.H5Ldelete(group_id, name, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + name = name.substring(0, i + 1); + + // Obtain the group info and print the group storage type + try { + if (group_id >= 0) { + ginfo = H5.H5Gget_info(group_id); + System.out.print(ginfo.nlinks + " Group" + (ginfo.nlinks == 1 ? " " : "s") + ": Storage type is "); + switch (H5G_storage.get(ginfo.storage_type)) { + case H5G_STORAGE_TYPE_COMPACT: + System.out.println("H5G_STORAGE_TYPE_COMPACT"); // New compact format + break; + case H5G_STORAGE_TYPE_DENSE: + System.out.println("H5G_STORAGE_TYPE_DENSE"); // New dense (indexed) format + break; + case H5G_STORAGE_TYPE_SYMBOL_TABLE: + System.out.println("H5G_STORAGE_TYPE_SYMBOL_TABLE"); // Original format + break; + case H5G_STORAGE_TYPE_UNKNOWN: + System.out.println("H5G_STORAGE_TYPE_UNKNOWN"); + break; + default: + System.out.println("Storage Type Invalid"); + break; + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + } + + // Close and release resources + try { + if (fapl_id >= 0) + H5.H5Pclose(fapl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (gcpl_id >= 0) + H5.H5Pclose(gcpl_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the group + try { + if (group_id >= 0) + H5.H5Gclose(group_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5Ex_G_Phase.CreateGroup(); + } + +} diff --git a/java/examples/groups/H5Ex_G_Traverse.java b/java/examples/groups/H5Ex_G_Traverse.java new file mode 100644 index 0000000..b00fe97 --- /dev/null +++ b/java/examples/groups/H5Ex_G_Traverse.java @@ -0,0 +1,167 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ +This example shows a way to recursively traverse the file +using H5Literate. The method shown here guarantees that +the recursion will not enter an infinite loop, but does +not prevent objects from being visited more than once. +The program prints the directory structure of the file +specified in FILE. The default file used by this example +implements the structure described in the User's Guide, +chapter 4, figure 26. + ************************************************************/ +package examples.groups; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.callbacks.H5L_iterate_cb; +import hdf.hdf5lib.callbacks.H5L_iterate_t; +import hdf.hdf5lib.structs.H5L_info_t; +import hdf.hdf5lib.structs.H5O_info_t; +import examples.groups.H5Ex_G_Iterate.H5O_type; + +class opdata implements H5L_iterate_t { + int recurs; + opdata prev; + long addr; +} + +public class H5Ex_G_Traverse { + + private static String FILE = "h5ex_g_traverse.h5"; + public static H5L_iterate_cb iter_cb = new H5L_iter_callbackT(); + + private static void OpenGroup() { + long file_id = -1; + H5O_info_t infobuf; + opdata od = new opdata(); + + // Open file and initialize the operator data structure. + try { + file_id = H5.H5Fopen(FILE, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + if (file_id >= 0) { + infobuf = H5.H5Oget_info(file_id); + od.recurs = 0; + od.prev = null; + od.addr = infobuf.addr; + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Print the root group and formatting, begin iteration. + try { + System.out.println("/ {"); + // H5L_iterate_cb iter_cb = new H5L_iter_callbackT(); + H5.H5Literate(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, 0L, iter_cb, od); + System.out.println("}"); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close and release resources. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5Ex_G_Traverse.OpenGroup(); + } +} + +class H5L_iter_callbackT implements H5L_iterate_cb { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + + H5O_info_t infobuf; + int return_val = 0; + opdata od = (opdata) op_data; // Type conversion + int spaces = 2 * (od.recurs + 1); // Number of white spaces to prepend to output. + + // Get type of the object and display its name and type. + // The name of the object is passed to this function by the Library. + try { + infobuf = H5.H5Oget_info_by_name(group, name, HDF5Constants.H5P_DEFAULT); + + for (int i = 0; i < spaces; i++) + System.out.print(" "); // Format output. + switch (H5O_type.get(infobuf.type)) { + case H5O_TYPE_GROUP: + System.out.println("Group: " + name + " { "); + // Check group address against linked list of operator + // data structures. We will always run the check, as the + // reference count cannot be relied upon if there are + // symbolic links, and H5Oget_info_by_name always follows + // symbolic links. Alternatively we could use H5Lget_info + // and never recurse on groups discovered by symbolic + // links, however it could still fail if an object's + // reference count was manually manipulated with + // H5Odecr_refcount. + if (group_check(od, infobuf.addr)) { + for (int i = 0; i < spaces; i++) + System.out.print(" "); + System.out.println(" Warning: Loop detected!"); + } + else { + // Initialize new object of type opdata and begin + // recursive iteration on the discovered + // group. The new opdata is given a pointer to the + // current one. + opdata nextod = new opdata(); + nextod.recurs = od.recurs + 1; + nextod.prev = od; + nextod.addr = infobuf.addr; + H5L_iterate_cb iter_cb2 = new H5L_iter_callbackT(); + return_val = H5.H5Literate_by_name(group, name, HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_NATIVE, 0L, iter_cb2, nextod, HDF5Constants.H5P_DEFAULT); + } + for (int i = 0; i < spaces; i++) + System.out.print(" "); + System.out.println("}"); + break; + case H5O_TYPE_DATASET: + System.out.println("Dataset: " + name); + break; + case H5O_TYPE_NAMED_DATATYPE: + System.out.println("Datatype: " + name); + break; + default: + System.out.println("Unknown: " + name); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + return return_val; + } + + public boolean group_check(opdata od, long target_addr) { + if (od.addr == target_addr) + return true; // Addresses match + else if (od.recurs == 0) + return false; // Root group reached with no matches + else + return group_check(od.prev, target_addr); // Recursively examine the next node + } + +} diff --git a/java/examples/groups/H5Ex_G_Visit.java b/java/examples/groups/H5Ex_G_Visit.java new file mode 100644 index 0000000..c2367a6 --- /dev/null +++ b/java/examples/groups/H5Ex_G_Visit.java @@ -0,0 +1,152 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + This example shows how to recursively traverse a file + using H5Ovisit and H5Lvisit. The program prints all of + the objects in the file specified in FILE, then prints all + of the links in that file. The default file used by this + example implements the structure described in the User's + Guide, chapter 4, figure 26. + ************************************************************/ +package examples.groups; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.callbacks.H5L_iterate_cb; +import hdf.hdf5lib.callbacks.H5L_iterate_t; +import hdf.hdf5lib.callbacks.H5O_iterate_cb; +import hdf.hdf5lib.callbacks.H5O_iterate_t; +import hdf.hdf5lib.structs.H5L_info_t; +import hdf.hdf5lib.structs.H5O_info_t; + +import java.util.ArrayList; + +public class H5Ex_G_Visit { + + private static String FILE = "groups/h5ex_g_visit.h5"; + + public static void main(String[] args) { + try { + (new H5Ex_G_Visit()).VisitGroup(); + } + catch (Exception ex) { + ex.printStackTrace(); + } + } + + private void VisitGroup() throws Exception { + + long file_id = -1; + + try { + // Open file + file_id = H5.H5Fopen(FILE, HDF5Constants.H5F_ACC_RDONLY, HDF5Constants.H5P_DEFAULT); + + // Begin iteration using H5Ovisit + System.out.println("Objects in the file:"); + H5O_iterate_t iter_data = new H5O_iter_data(); + H5O_iterate_cb iter_cb = new H5O_iter_callback(); + H5.H5Ovisit(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, iter_cb, iter_data); + System.out.println(); + // Repeat the same process using H5Lvisit + H5L_iterate_t iter_data2 = new H5L_iter_data(); + H5L_iterate_cb iter_cb2 = new H5L_iter_callback(); + System.out.println("Links in the file:"); + H5.H5Lvisit(file_id, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_NATIVE, iter_cb2, iter_data2); + + } + catch (Exception e) { + e.printStackTrace(); + } + finally { + // Close and release resources. + if (file_id >= 0) + H5.H5Fclose(file_id); + } + } + + /************************************************************ + * Operator function for H5Lvisit. This function simply retrieves the info for the object the current link points + * to, and calls the operator function for H5Ovisit. + ************************************************************/ + + private class idata { + public String link_name = null; + public int link_type = -1; + + idata(String name, int type) { + this.link_name = name; + this.link_type = type; + } + } + + private class H5L_iter_data implements H5L_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + + private class H5L_iter_callback implements H5L_iterate_cb { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + + idata id = new idata(name, info.type); + ((H5L_iter_data) op_data).iterdata.add(id); + + H5O_info_t infobuf; + int ret = 0; + try { + // Get type of the object and display its name and type. The name of the object is passed to this + // function by the Library. + infobuf = H5.H5Oget_info_by_name(group, name, HDF5Constants.H5P_DEFAULT); + H5O_iterate_cb iter_cbO = new H5O_iter_callback(); + H5O_iterate_t iter_dataO = new H5O_iter_data(); + ret = iter_cbO.callback(group, name, infobuf, iter_dataO); + } + catch (Exception e) { + e.printStackTrace(); + } + + return ret; + } + } + + private class H5O_iter_data implements H5O_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + + private class H5O_iter_callback implements H5O_iterate_cb { + public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) { + idata id = new idata(name, info.type); + ((H5O_iter_data) op_data).iterdata.add(id); + + System.out.print("/"); /* Print root group in object path */ + + // Check if the current object is the root group, and if not print the full path name and type. + + if (name.charAt(0) == '.') /* Root group, do not print '.' */ + System.out.println(" (Group)"); + else if (info.type == HDF5Constants.H5O_TYPE_GROUP) + System.out.println(name + " (Group)"); + else if (info.type == HDF5Constants.H5O_TYPE_DATASET) + System.out.println(name + " (Dataset)"); + else if (info.type == HDF5Constants.H5O_TYPE_NAMED_DATATYPE) + System.out.println(name + " (Datatype)"); + else + System.out.println(name + " (Unknown)"); + + return 0; + } + } + +} diff --git a/java/examples/groups/Makefile.am b/java/examples/groups/Makefile.am new file mode 100644 index 0000000..802e2b0 --- /dev/null +++ b/java/examples/groups/Makefile.am @@ -0,0 +1,68 @@ +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +## +## Makefile.am +## Run automake to generate a Makefile.in from this file. +## +# +# HDF5 Java Library Examples Makefile(.in) + +include $(top_srcdir)/config/commence.am + +# Mark this directory as part of the JNI API +JAVA_API=yes + +JAVAROOT = .classes + +classes: + $(MKDIR_P) $(@D)/$(JAVAROOT) + +pkgpath = examples/groups +hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar +CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.5.jar:$$CLASSPATH + +jarfile = jar$(PACKAGE_TARNAME)groups.jar + +AM_JAVACFLAGS = $(H5_JAVACFLAGS) -deprecation + +TESTPACKAGE = + +noinst_JAVA = \ + H5Ex_G_Create.java \ + H5Ex_G_Iterate.java \ + H5Ex_G_Compact.java \ + H5Ex_G_Corder.java \ + H5Ex_G_Intermediate.java \ + H5Ex_G_Phase.java \ + H5Ex_G_Visit.java + + +$(jarfile): classnoinst.stamp classes + $(JAR) cvf $@ -C $(JAVAROOT)/ $(pkgpath) + +noinst_DATA = $(jarfile) + +.PHONY: classes + +check_SCRIPTS = runExample.sh +TEST_SCRIPT = $(check_SCRIPTS) + +CLEANFILES = classnoinst.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class runExample.sh + +clean: + rm -rf $(JAVAROOT) + rm -f $(jarfile) + rm -f classnoinst.stamp + +include $(top_srcdir)/config/conclude.am diff --git a/java/examples/groups/h5ex_g_iterate.h5 b/java/examples/groups/h5ex_g_iterate.h5 new file mode 100644 index 0000000..e462703 Binary files /dev/null and b/java/examples/groups/h5ex_g_iterate.h5 differ diff --git a/java/examples/groups/h5ex_g_visit.h5 b/java/examples/groups/h5ex_g_visit.h5 new file mode 100644 index 0000000..d8267b1 Binary files /dev/null and b/java/examples/groups/h5ex_g_visit.h5 differ diff --git a/java/examples/groups/runExample.sh.in b/java/examples/groups/runExample.sh.in new file mode 100644 index 0000000..a59a894 --- /dev/null +++ b/java/examples/groups/runExample.sh.in @@ -0,0 +1,349 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# + +top_builddir=@top_builddir@ +top_srcdir=@top_srcdir@ +srcdir=@srcdir@ + +TESTNAME=EX_Groups +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +# Set up default variable values if not supplied by the user. +RM='rm -rf' +CMP='cmp' +DIFF='diff -c' +CP='cp' +DIRNAME='dirname' +LS='ls' +AWK='awk' + +nerrors=0 + +# where the libs exist +HDFLIB_HOME="$top_srcdir/java/lib" +BLDLIBDIR="./lib" +BLDREFDIR="./groups" +BLDDIR="." +HDFTEST_HOME="$top_srcdir/java/examples/groups" +JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar +TESTJARFILE=jar@PACKAGE_TARNAME@groups.jar +test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR +test -d $BLDREFDIR || mkdir -p $BLDREFDIR + +###################################################################### +# library files +# -------------------------------------------------------------------- +# All the library files copy from source directory to test directory +# NOTE: Keep this framework to add/remove test files. +# This list are also used for checking exist. +# Comment '#' without space can be used. +# -------------------------------------------------------------------- +LIST_LIBRARY_FILES=" +$HDFLIB_HOME/slf4j-api-1.7.5.jar +$HDFLIB_HOME/ext/slf4j-simple-1.7.5.jar +$top_builddir/src/.libs/libhdf5.* +$top_builddir/java/src/jni/.libs/libhdf5_java.* +$top_builddir/java/src/$JARFILE +" +LIST_REF_FILES=" +$HDFTEST_HOME/h5ex_g_iterate.h5 +$HDFTEST_HOME/h5ex_g_visit.h5 +" +LIST_DATA_FILES=" +$HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Create.txt +$HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Iterate.txt +$HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Compact.txt +$HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Corder.txt +$HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Intermediate.txt +$HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Phase.txt +$HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Visit.txt +" + +# +# copy files from source dirs to test dir +# +COPY_LIBFILES="$LIST_LIBRARY_FILES" + +COPY_LIBFILES_TO_BLDLIBDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_LIBFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDLIBDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done +} + +CLEAN_LIBFILES_AND_BLDLIBDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $BLDLIBDIR + fi +} + +COPY_DATAFILES="$LIST_DATA_FILES" + +COPY_DATAFILES_TO_BLDDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_DATAFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done +} + +CLEAN_DATAFILES_AND_BLDDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $BLDDIR/*.txt + $RM $BLDDIR/*.out + fi +} + +COPY_REFFILES="$LIST_REF_FILES" + +COPY_REFFILES_TO_BLDREFDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_REFFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDREFDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done +} + +CLEAN_REFFILES_AND_BLDREFDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $BLDREFDIR + fi +} + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Testing". +# +TESTING() { + SPACES=" " + echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# where Java is installed (requires jdk1.7.x) +JAVAEXE=@JAVA@ +JAVAEXEFLAGS=@H5_JAVAFLAGS@ + +############################################################################### +# DO NOT MODIFY BELOW THIS LINE +############################################################################### + +# prepare for test +COPY_LIBFILES_TO_BLDLIBDIR +COPY_DATAFILES_TO_BLDDIR +COPY_REFFILES_TO_BLDREFDIR + +CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.5.jar:"$BLDLIBDIR"/slf4j-simple-1.7.5.jar:"$TESTJARFILE"" + +TEST=/usr/bin/test +if [ ! -x /usr/bin/test ] +then +TEST=`which test` +fi + +if $TEST -z "$CLASSPATH"; then + CLASSPATH="" +fi +CLASSPATH=$CPATH":"$CLASSPATH +export CLASSPATH + +if $TEST -n "$JAVAPATH" ; then + PATH=$JAVAPATH":"$PATH + export PATH +fi + +if $TEST -e /bin/uname; then + os_name=`/bin/uname -s` +elif $TEST -e /usr/bin/uname; then + os_name=`/usr/bin/uname -s` +else + os_name=unknown +fi + +if $TEST -z "$LD_LIBRARY_PATH" ; then + LD_LIBRARY_PATH="" +fi + +case $os_name in + Darwin) + DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH + export DYLD_LIBRARY_PATH + LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH + ;; + *) + LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH + ;; +esac + +export LD_LIBRARY_PATH + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Create" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Create > H5Ex_G_Create.out) +if diff H5Ex_G_Create.out examples.groups.H5Ex_G_Create.txt > /dev/null; then + echo " PASSED groups.H5Ex_G_Create" +else + echo "**FAILED** groups.H5Ex_G_Create" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Iterate" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Iterate > H5Ex_G_Iterate.out) +if diff H5Ex_G_Iterate.out examples.groups.H5Ex_G_Iterate.txt > /dev/null; then + echo " PASSED groups.H5Ex_G_Iterate" +else + echo "**FAILED** groups.H5Ex_G_Iterate" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Compact" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Compact > H5Ex_G_Compact.out) +if diff H5Ex_G_Compact.out examples.groups.H5Ex_G_Compact.txt > /dev/null; then + echo " PASSED groups.H5Ex_G_Compact" +else + echo "**FAILED** groups.H5Ex_G_Compact" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Corder" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Corder > H5Ex_G_Corder.out) +if diff H5Ex_G_Corder.out examples.groups.H5Ex_G_Corder.txt > /dev/null; then + echo " PASSED groups.H5Ex_G_Corder" +else + echo "**FAILED** groups.H5Ex_G_Corder" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Intermediate" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Intermediate > H5Ex_G_Intermediate.out) +if diff H5Ex_G_Intermediate.out examples.groups.H5Ex_G_Intermediate.txt > /dev/null; then + echo " PASSED groups.H5Ex_G_Intermediate" +else + echo "**FAILED** groups.H5Ex_G_Intermediate" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Phase" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Phase > H5Ex_G_Phase.out) +if diff H5Ex_G_Phase.out examples.groups.H5Ex_G_Phase.txt > /dev/null; then + echo " PASSED groups.H5Ex_G_Phase" +else + echo "**FAILED** groups.H5Ex_G_Phase" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Visit" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.groups.H5Ex_G_Visit > H5Ex_G_Visit.out) +if diff H5Ex_G_Visit.out examples.groups.H5Ex_G_Visit.txt > /dev/null; then + echo " PASSED groups.H5Ex_G_Visit" +else + echo "**FAILED** groups.H5Ex_G_Visit" + nerrors="`expr $nerrors + 1`" +fi + +# Clean up temporary files/directories +CLEAN_LIBFILES_AND_BLDLIBDIR +CLEAN_DATAFILES_AND_BLDDIR +CLEAN_REFFILES_AND_BLDREFDIR + +# Report test results and exit +if test $nerrors -eq 0 ; then + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE +fi diff --git a/java/examples/intro/CMakeLists.txt b/java/examples/intro/CMakeLists.txt new file mode 100644 index 0000000..ae3f585 --- /dev/null +++ b/java/examples/intro/CMakeLists.txt @@ -0,0 +1,112 @@ +cmake_minimum_required (VERSION 3.1.0) +PROJECT (HDFJAVA_EXAMPLES_INTRO Java) + +set (CMAKE_VERBOSE_MAKEFILE 1) + +INCLUDE_DIRECTORIES ( + ${HDF5_JAVA_JNI_BINARY_DIR} + ${HDF5_JAVA_HDF5_LIB_DIR} +) + +set (HDF_JAVA_EXAMPLES + H5_CreateAttribute + H5_CreateDataset + H5_CreateFile + H5_CreateGroup + H5_CreateGroupAbsoluteRelative + H5_CreateGroupDataset + H5_ReadWrite +) + +if (WIN32) + set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") +else (WIN32) + set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") +endif (WIN32) + +set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS}") + +set (CMAKE_JAVA_CLASSPATH ".") +foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH}) + set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}") +endforeach (CMAKE_INCLUDE_PATH) + +foreach (example ${HDF_JAVA_EXAMPLES}) + file (WRITE ${PROJECT_BINARY_DIR}/${example}_Manifest.txt + "Main-Class: examples.intro.${example} +" + ) + add_jar (${example} MANIFEST ${PROJECT_BINARY_DIR}/${example}_Manifest.txt ${example}.java) + get_target_property (${example}_JAR_FILE ${example} JAR_FILE) +# install_jar (${example} ${HJAVA_INSTALL_DATA_DIR}/examples examples) + get_target_property (${example}_CLASSPATH ${example} CLASSDIR) + add_dependencies (${example} ${HDF5_JAVA_HDF5_LIB_TARGET}) +endforeach (example ${HDF_JAVA_EXAMPLES}) + +set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_JARS};${HDF5_JAVA_LOGGING_JAR};${HDF5_JAVA_LOGGING_NOP_JAR}") + +set (CMAKE_JAVA_CLASSPATH ".") +foreach (HDFJAVA_JAR ${CMAKE_JAVA_INCLUDE_PATH}) + set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${HDFJAVA_JAR}") +endforeach (HDFJAVA_JAR) + +foreach (example ${HDF_JAVA_OBJECT_EXAMPLES}) + file (WRITE ${PROJECT_BINARY_DIR}/${example}_Manifest.txt + "Main-Class: examples.intro.${example} +" + ) + add_jar (${example} MANIFEST ${PROJECT_BINARY_DIR}/${example}_Manifest.txt ${example}.java) + get_target_property (${example}_JAR_FILE ${example} JAR_FILE) +# install_jar (${example} ${HJAVA_INSTALL_DATA_DIR}/examples examples) + get_target_property (${example}_CLASSPATH ${example} CLASSDIR) + add_dependencies (${example} ${HDFJAVA_H5_LIB_TARGET}) +endforeach (example ${HDF_JAVA_OBJECT_EXAMPLES}) + +MACRO (ADD_H5_TEST resultfile resultcode) + add_test ( + NAME JAVA_intro-${resultfile} + COMMAND "${CMAKE_COMMAND}" + -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" + -D "TEST_PROGRAM=examples.intro.${resultfile}" + -D "TEST_ARGS:STRING=${ARGN}" + -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${resultfile}_JAR_FILE}" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" + -D "TEST_FOLDER=${HDFJAVA_EXAMPLES_BINARY_DIR}" + -D "TEST_OUTPUT=intro/${resultfile}.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=intro/${resultfile}.txt" + -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (JAVA_intro-${resultfile} PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + set (last_test "JAVA_intro-${resultfile}") +ENDMACRO (ADD_H5_TEST file) + +if (BUILD_TESTING) + + foreach (example ${HDF_JAVA_EXAMPLES}) + add_test ( + NAME JAVA_intro-${example}-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + ${HDFJAVA_EXAMPLES_BINARY_DIR}/${example}.h5 + ${example}.out + ${example}.out.err + ) + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (JAVA_intro-${example}-clearall-objects PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + add_test ( + NAME JAVA_intro-${example}-copy-objects + COMMAND ${CMAKE_COMMAND} + -E copy_if_different + ${HDFJAVA_EXAMPLES_SOURCE_DIR}/testfiles/examples.intro.${example}.txt + ${HDFJAVA_EXAMPLES_INTRO_BINARY_DIR}/${example}.txt + ) + set_tests_properties (JAVA_intro-${example}-copy-objects PROPERTIES DEPENDS JAVA_intro-${example}-clearall-objects) + set (last_test "JAVA_intro-${example}-copy-objects") + ADD_H5_TEST (${example} 0) + endforeach (example ${HDF_JAVA_EXAMPLES}) + +endif (BUILD_TESTING) diff --git a/java/examples/intro/H5_CreateAttribute.java b/java/examples/intro/H5_CreateAttribute.java new file mode 100644 index 0000000..16c53d6 --- /dev/null +++ b/java/examples/intro/H5_CreateAttribute.java @@ -0,0 +1,145 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + Creating a dataset attribute. + ************************************************************/ + +package examples.intro; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5_CreateAttribute { + private static String FILENAME = "H5_CreateAttribute.h5"; + private static String DATASETNAME = "dset"; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + private static String DATASETATTRIBUTE = "Units"; + + private static void CreateDatasetAttribute() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long attribute_id = -1; + long[] dims1 = { DIM_X, DIM_Y }; + long[] dims = { 2 }; + int[] attr_data = { 100, 200 }; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the data space for the dataset. + try { + dataspace_id = H5.H5Screate_simple(2, dims1, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (dataspace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, "/" + DATASETNAME, HDF5Constants.H5T_STD_I32BE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the data space for the attribute. + try { + dataspace_id = H5.H5Screate_simple(1, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create a dataset attribute. + try { + if ((dataset_id >= 0) && (dataspace_id >= 0)) + attribute_id = H5.H5Acreate(dataset_id, DATASETATTRIBUTE, HDF5Constants.H5T_STD_I32BE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the attribute data. + try { + if (attribute_id >= 0) + H5.H5Awrite(attribute_id, HDF5Constants.H5T_NATIVE_INT, attr_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the attribute. + try { + if (attribute_id >= 0) + H5.H5Aclose(attribute_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the dataspace. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close to the dataset. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5_CreateAttribute.CreateDatasetAttribute(); + } + +} diff --git a/java/examples/intro/H5_CreateDataset.java b/java/examples/intro/H5_CreateDataset.java new file mode 100644 index 0000000..a16cfe6 --- /dev/null +++ b/java/examples/intro/H5_CreateDataset.java @@ -0,0 +1,97 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + Creating and closing a dataset. + ************************************************************/ + +package examples.intro; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5_CreateDataset { + private static String FILENAME = "H5_CreateDataset.h5"; + private static String DATASETNAME = "dset"; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + + private static void CreateDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the data space for the dataset. + try { + dataspace_id = H5.H5Screate_simple(2, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (dataspace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, "/" + DATASETNAME, HDF5Constants.H5T_STD_I32BE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Terminate access to the data space. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5_CreateDataset.CreateDataset(); + } + +} diff --git a/java/examples/intro/H5_CreateFile.java b/java/examples/intro/H5_CreateFile.java new file mode 100644 index 0000000..eb9f277 --- /dev/null +++ b/java/examples/intro/H5_CreateFile.java @@ -0,0 +1,55 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + Creating and closing a file. + ************************************************************/ + +package examples.intro; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5_CreateFile { + static final String FILENAME = "H5_CreateFile.h5"; + + private static void CreateFile() { + long file_id = -1; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5_CreateFile.CreateFile(); + } + +} diff --git a/java/examples/intro/H5_CreateGroup.java b/java/examples/intro/H5_CreateGroup.java new file mode 100644 index 0000000..36bd49a --- /dev/null +++ b/java/examples/intro/H5_CreateGroup.java @@ -0,0 +1,76 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + Creating and closing a group. + ************************************************************/ + +package examples.intro; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5_CreateGroup { + private static String FILENAME = "H5_CreateGroup.h5"; + private static String GROUPNAME = "MyGroup"; + + private static void CreateGroup() { + long file_id = -1; + long group_id = -1; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create a group in the file. + try { + if (file_id >= 0) + group_id = H5.H5Gcreate(file_id, "/" + GROUPNAME, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the group. + try { + if (group_id >= 0) + H5.H5Gclose(group_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5_CreateGroup.CreateGroup(); + } + +} diff --git a/java/examples/intro/H5_CreateGroupAbsoluteRelative.java b/java/examples/intro/H5_CreateGroupAbsoluteRelative.java new file mode 100644 index 0000000..e0127cc --- /dev/null +++ b/java/examples/intro/H5_CreateGroupAbsoluteRelative.java @@ -0,0 +1,118 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + Creating groups using absolute and relative names. + ************************************************************/ + +package examples.intro; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5_CreateGroupAbsoluteRelative { + private static String FILENAME = "H5_CreateGroupAbsoluteRelative.h5"; + private static String GROUPNAME = "MyGroup"; + private static String GROUPNAME_A = "GroupA"; + private static String GROUPNAME_B = "GroupB"; + + private static void CreateGroupAbsoluteAndRelative() { + long file_id = -1; + long group1_id = -1; + long group2_id = -1; + long group3_id = -1; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create a group named "/MyGroup" in the file. + try { + if (file_id >= 0) + group1_id = H5.H5Gcreate(file_id, "/" + GROUPNAME, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create group "Group_A" in group "MyGroup" using absolute name. + try { + if (file_id >= 0) + group2_id = H5.H5Gcreate(file_id, "/" + GROUPNAME + "/" + GROUPNAME_A, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create group "Group_B" in group "MyGroup" using relative name. + try { + if (group1_id >= 0) + group3_id = H5.H5Gcreate(group1_id, GROUPNAME_B, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the group3. + try { + if (group3_id >= 0) + H5.H5Gclose(group3_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the group2. + try { + if (group2_id >= 0) + H5.H5Gclose(group2_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the group1. + try { + if (group1_id >= 0) + H5.H5Gclose(group1_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + H5_CreateGroupAbsoluteRelative.CreateGroupAbsoluteAndRelative(); + } + +} diff --git a/java/examples/intro/H5_CreateGroupDataset.java b/java/examples/intro/H5_CreateGroupDataset.java new file mode 100644 index 0000000..0607bbd --- /dev/null +++ b/java/examples/intro/H5_CreateGroupDataset.java @@ -0,0 +1,207 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + Create two datasets within groups. + ************************************************************/ + +package examples.intro; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5_CreateGroupDataset { + private static String FILENAME = "H5_CreateGroupDataset.h5"; + private static String GROUPNAME = "MyGroup"; + private static String GROUPNAME_A = "GroupA"; + private static String DATASETNAME1 = "dset1"; + private static String DATASETNAME2 = "dset2"; + private static final int DIM1_X = 3; + private static final int DIM1_Y = 3; + private static final int DIM2_X = 2; + private static final int DIM2_Y = 10; + + private static void h5_crtgrpd() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long group_id = -1; + long group1_id = -1; + long group2_id = -1; + int[][] dset1_data = new int[DIM1_X][DIM1_Y]; + int[][] dset2_data = new int[DIM2_X][DIM2_Y]; + long[] dims1 = { DIM1_X, DIM1_Y }; + long[] dims2 = { DIM2_X, DIM2_Y }; + + // Initialize the first dataset. + for (int indx = 0; indx < DIM1_X; indx++) + for (int jndx = 0; jndx < DIM1_Y; jndx++) + dset1_data[indx][jndx] = jndx + 1; + + // Initialize the second dataset. + for (int indx = 0; indx < DIM2_X; indx++) + for (int jndx = 0; jndx < DIM2_Y; jndx++) + dset2_data[indx][jndx] = jndx + 1; + + // Create a file. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + // Create a group named "/MyGroup" in the file. + if (file_id >= 0) { + group1_id = H5.H5Gcreate(file_id, "/" + GROUPNAME, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + // Create group "Group_A" in group "MyGroup" using absolute name. + if (group1_id >= 0) { + group2_id = H5.H5Gcreate(file_id, "/" + GROUPNAME + "/" + GROUPNAME_A, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + if (group2_id >= 0) + H5.H5Gclose(group2_id); + } + if (group1_id >= 0) + H5.H5Gclose(group1_id); + } + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the data space for the first dataset. + try { + dataspace_id = H5.H5Screate_simple(2, dims1, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset in group "MyGroup". + try { + if ((file_id >= 0) && (dataspace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, "/" + GROUPNAME + "/" + DATASETNAME1, HDF5Constants.H5T_STD_I32BE, + dataspace_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the first dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset1_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the data space for the first dataset. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + dataspace_id = -1; + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the first dataset. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + dataset_id = -1; + } + catch (Exception e) { + e.printStackTrace(); + } + + // Open an existing group of the specified file. + try { + if (file_id >= 0) + group_id = H5.H5Gopen(file_id, "/" + GROUPNAME + "/" + GROUPNAME_A, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the data space for the second dataset. + try { + dataspace_id = H5.H5Screate_simple(2, dims2, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the second dataset in group "Group_A". + try { + if ((group_id >= 0) && (dataspace_id >= 0)) + dataset_id = H5.H5Dcreate(group_id, DATASETNAME2, HDF5Constants.H5T_STD_I32BE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the second dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset2_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the data space for the second dataset. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the second dataset. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the group. + try { + if (group_id >= 0) + H5.H5Gclose(group_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5_CreateGroupDataset.h5_crtgrpd(); + } + +} diff --git a/java/examples/intro/H5_ReadWrite.java b/java/examples/intro/H5_ReadWrite.java new file mode 100644 index 0000000..0d73884 --- /dev/null +++ b/java/examples/intro/H5_ReadWrite.java @@ -0,0 +1,112 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/************************************************************ + Writing and reading an existing dataset. + ************************************************************/ + +package examples.intro; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +public class H5_ReadWrite { + private static String FILENAME = "H5_ReadWrite.h5"; + private static String DATASETNAME = "dset"; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + + private static void ReadWriteDataset() { + long file_id = -1; + long dataspace_id = -1; + long dataset_id = -1; + long[] dims = { DIM_X, DIM_Y }; + int[][] dset_data = new int[DIM_X][DIM_Y]; + + // Initialize the dataset. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = indx * 6 + jndx + 1; + + // Create a new file using default properties. + try { + file_id = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the data space for the dataset. + try { + dataspace_id = H5.H5Screate_simple(2, dims, null); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Create the dataset. + try { + if ((file_id >= 0) && (dataspace_id >= 0)) + dataset_id = H5.H5Dcreate(file_id, "/" + DATASETNAME, HDF5Constants.H5T_STD_I32BE, dataspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Write the dataset. + try { + if (dataset_id >= 0) + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + if (dataset_id >= 0) + H5.H5Dread(dataset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the dataset. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Close the file. + try { + if (file_id >= 0) + H5.H5Fclose(file_id); + } + catch (Exception e) { + e.printStackTrace(); + } + } + + public static void main(String[] args) { + H5_ReadWrite.ReadWriteDataset(); + } + +} diff --git a/java/examples/intro/Makefile.am b/java/examples/intro/Makefile.am new file mode 100644 index 0000000..fef33d2 --- /dev/null +++ b/java/examples/intro/Makefile.am @@ -0,0 +1,67 @@ +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +## +## Makefile.am +## Run automake to generate a Makefile.in from this file. +## +# +# HDF5 Java Library Examples Makefile(.in) + +include $(top_srcdir)/config/commence.am + +# Mark this directory as part of the JNI API +JAVA_API=yes + +JAVAROOT = .classes + +classes: + $(MKDIR_P) $(@D)/$(JAVAROOT) + +pkgpath = examples/intro +hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar +CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.5.jar:$$CLASSPATH + +jarfile = jar$(PACKAGE_TARNAME)intro.jar + +AM_JAVACFLAGS = $(H5_JAVACFLAGS) -deprecation + +TESTPACKAGE = + +noinst_JAVA = \ + H5_CreateAttribute.java \ + H5_CreateDataset.java \ + H5_CreateFile.java \ + H5_CreateGroup.java \ + H5_CreateGroupAbsoluteRelative.java \ + H5_CreateGroupDataset.java \ + H5_ReadWrite.java + +$(jarfile): classnoinst.stamp classes + $(JAR) cvf $@ -C $(JAVAROOT)/ $(pkgpath) + +noinst_DATA = $(jarfile) + +.PHONY: classes + +check_SCRIPTS = runExample.sh +TEST_SCRIPT = $(check_SCRIPTS) + +CLEANFILES = classnoinst.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class runExample.sh + +clean: + rm -rf $(JAVAROOT) + rm -f $(jarfile) + rm -f classnoinst.stamp + +include $(top_srcdir)/config/conclude.am diff --git a/java/examples/intro/runExample.sh.in b/java/examples/intro/runExample.sh.in new file mode 100644 index 0000000..ecc51ca --- /dev/null +++ b/java/examples/intro/runExample.sh.in @@ -0,0 +1,298 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# + +top_builddir=@top_builddir@ +top_srcdir=@top_srcdir@ +srcdir=@srcdir@ + +TESTNAME=EX_Intro +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +# Set up default variable values if not supplied by the user. +RM='rm -rf' +CMP='cmp' +DIFF='diff -c' +CP='cp' +DIRNAME='dirname' +LS='ls' +AWK='awk' + +nerrors=0 + +# where the libs exist +HDFLIB_HOME="$top_srcdir/java/lib" +BLDLIBDIR="./lib" +BLDDIR="." +HDFTEST_HOME="$top_srcdir/java/examples/intro" +JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar +TESTJARFILE=jar@PACKAGE_TARNAME@intro.jar +test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR + +###################################################################### +# library files +# -------------------------------------------------------------------- +# All the library files copy from source directory to test directory +# NOTE: Keep this framework to add/remove test files. +# This list are also used for checking exist. +# Comment '#' without space can be used. +# -------------------------------------------------------------------- +LIST_LIBRARY_FILES=" +$HDFLIB_HOME/slf4j-api-1.7.5.jar +$HDFLIB_HOME/ext/slf4j-simple-1.7.5.jar +$top_builddir/src/.libs/libhdf5.* +$top_builddir/java/src/jni/.libs/libhdf5_java.* +$top_builddir/java/src/$JARFILE +" +LIST_DATA_FILES=" +$HDFTEST_HOME/../testfiles/examples.intro.H5_CreateDataset.txt +$HDFTEST_HOME/../testfiles/examples.intro.H5_CreateAttribute.txt +$HDFTEST_HOME/../testfiles/examples.intro.H5_CreateFile.txt +$HDFTEST_HOME/../testfiles/examples.intro.H5_CreateGroup.txt +$HDFTEST_HOME/../testfiles/examples.intro.H5_CreateGroupAbsoluteRelative.txt +$HDFTEST_HOME/../testfiles/examples.intro.H5_CreateGroupDataset.txt +$HDFTEST_HOME/../testfiles/examples.intro.H5_ReadWrite.txt +" + +# +# copy files from source dirs to test dir +# +COPY_LIBFILES="$LIST_LIBRARY_FILES" + +COPY_LIBFILES_TO_BLDLIBDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_LIBFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDLIBDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done +} + +CLEAN_LIBFILES_AND_BLDLIBDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $BLDLIBDIR + fi +} + +COPY_DATAFILES="$LIST_DATA_FILES" + +COPY_DATAFILES_TO_BLDDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_DATAFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done +} + +CLEAN_DATAFILES_AND_BLDDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $BLDDIR/*.txt + $RM $BLDDIR/*.out + fi +} + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Testing". +# +TESTING() { + SPACES=" " + echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# where Java is installed (requires jdk1.7.x) +JAVAEXE=@JAVA@ +JAVAEXEFLAGS=@H5_JAVAFLAGS@ + +############################################################################### +# DO NOT MODIFY BELOW THIS LINE +############################################################################### + +# prepare for test +COPY_LIBFILES_TO_BLDLIBDIR +COPY_DATAFILES_TO_BLDDIR + +CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.5.jar:"$BLDLIBDIR"/slf4j-simple-1.7.5.jar:"$TESTJARFILE"" + +TEST=/usr/bin/test +if [ ! -x /usr/bin/test ] +then +TEST=`which test` +fi + +if $TEST -z "$CLASSPATH"; then + CLASSPATH="" +fi +CLASSPATH=$CPATH":"$CLASSPATH +export CLASSPATH + +if $TEST -n "$JAVAPATH" ; then + PATH=$JAVAPATH":"$PATH + export PATH +fi + +if $TEST -e /bin/uname; then + os_name=`/bin/uname -s` +elif $TEST -e /usr/bin/uname; then + os_name=`/usr/bin/uname -s` +else + os_name=unknown +fi + +if $TEST -z "$LD_LIBRARY_PATH" ; then + LD_LIBRARY_PATH="" +fi + +case $os_name in + Darwin) + DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH + export DYLD_LIBRARY_PATH + LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH + ;; + *) + LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH + ;; +esac + +export LD_LIBRARY_PATH + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateDataset" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateDataset > H5_CreateDataset.out) +if diff H5_CreateDataset.out examples.intro.H5_CreateDataset.txt > /dev/null; then + echo " PASSED intro.H5_CreateDataset" +else + echo "**FAILED** intro.H5_CreateDataset" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateAttribute" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateAttribute > H5_CreateAttribute.out) +if diff H5_CreateAttribute.out examples.intro.H5_CreateAttribute.txt > /dev/null; then + echo " PASSED intro.H5_CreateAttribute" +else + echo "**FAILED** intro.H5_CreateAttribute" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateFile" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateFile > H5_CreateFile.out) +if diff H5_CreateFile.out examples.intro.H5_CreateFile.txt > /dev/null; then + echo " PASSED intro.H5_CreateFile" +else + echo "**FAILED** intro.H5_CreateFile" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateGroup" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateGroup > H5_CreateGroup.out) +if diff H5_CreateGroup.out examples.intro.H5_CreateGroup.txt > /dev/null; then + echo " PASSED intro.H5_CreateGroup" +else + echo "**FAILED** intro.H5_CreateGroup" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateGroupAbsoluteRelative" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateGroupAbsoluteRelative > H5_CreateGroupAbsoluteRelative.out) +if diff H5_CreateGroupAbsoluteRelative.out examples.intro.H5_CreateGroupAbsoluteRelative.txt > /dev/null; then + echo " PASSED intro.H5_CreateGroupAbsoluteRelative" +else + echo "**FAILED** intro.H5_CreateGroupAbsoluteRelative" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateGroupDataset" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_CreateGroupDataset > H5_CreateGroupDataset.out) +if diff H5_CreateGroupDataset.out examples.intro.H5_CreateGroupDataset.txt > /dev/null; then + echo " PASSED intro.H5_CreateGroupDataset" +else + echo "**FAILED** intro.H5_CreateGroupDataset" + nerrors="`expr $nerrors + 1`" +fi + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_ReadWrite" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH examples.intro.H5_ReadWrite > H5_ReadWrite.out) +if diff H5_ReadWrite.out examples.intro.H5_ReadWrite.txt > /dev/null; then + echo " PASSED intro.H5_ReadWrite" +else + echo "**FAILED** intro.H5_ReadWrite" + nerrors="`expr $nerrors + 1`" +fi + +# Clean up temporary files/directories +CLEAN_LIBFILES_AND_BLDLIBDIR +CLEAN_DATAFILES_AND_BLDDIR + +# Report test results and exit +if test $nerrors -eq 0 ; then + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE +fi diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_Alloc.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_Alloc.txt new file mode 100644 index 0000000..6fd810b --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_Alloc.txt @@ -0,0 +1,16 @@ +Creating datasets... +DS1 has allocation time H5D_ALLOC_TIME_LATE +DS2 has allocation time H5D_ALLOC_TIME_EARLY + +Space for DS1 has not been allocated. +Storage size for DS1 is: 0 bytes. +Space for DS2 has been allocated. +Storage size for DS2 is: 112 bytes. + +Writing data... + +Space for DS1 has been allocated. +Storage size for DS1 is: 112 bytes. +Space for DS2 has been allocated. +Storage size for DS2 is: 112 bytes. + diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_Checksum.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_Checksum.txt new file mode 100644 index 0000000..676aebb --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_Checksum.txt @@ -0,0 +1,3 @@ +Filter type is: H5Z_FILTER_FLETCHER32 + +Maximum value in DS1 is: 1890 diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_Chunk.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_Chunk.txt new file mode 100644 index 0000000..5f4c2de --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_Chunk.txt @@ -0,0 +1,26 @@ +Original Data: + [ 1 1 1 1 1 1 1 1 ] + [ 1 1 1 1 1 1 1 1 ] + [ 1 1 1 1 1 1 1 1 ] + [ 1 1 1 1 1 1 1 1 ] + [ 1 1 1 1 1 1 1 1 ] + [ 1 1 1 1 1 1 1 1 ] + +Storage layout for DS1 is: H5D_CHUNKED + +Data as written to disk by hyberslabs: + [ 0 1 0 0 1 0 0 1 ] + [ 1 1 0 1 1 0 1 1 ] + [ 0 0 0 0 0 0 0 0 ] + [ 0 1 0 0 1 0 0 1 ] + [ 1 1 0 1 1 0 1 1 ] + [ 0 0 0 0 0 0 0 0 ] + +Data as read from disk by hyberslab: + [ 0 1 0 0 0 0 0 1 ] + [ 0 1 0 1 0 0 1 1 ] + [ 0 0 0 0 0 0 0 0 ] + [ 0 0 0 0 0 0 0 0 ] + [ 0 1 0 1 0 0 1 1 ] + [ 0 0 0 0 0 0 0 0 ] + diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_Compact.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_Compact.txt new file mode 100644 index 0000000..e34f3c1 --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_Compact.txt @@ -0,0 +1,8 @@ +Storage layout for DS1 is: H5D_COMPACT + +Data for DS1 is: + [ 0 -1 -2 -3 -4 -5 -6 ] + [ 0 0 0 0 0 0 0 ] + [ 0 1 2 3 4 5 6 ] + [ 0 2 4 6 8 10 12 ] + diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_External.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_External.txt new file mode 100644 index 0000000..5878149 --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_External.txt @@ -0,0 +1,7 @@ +DS1 is stored in file: H5Ex_D_External.data +DS1: + [ 0 -1 -2 -3 -4 -5 -6 ] + [ 0 0 0 0 0 0 0 ] + [ 0 1 2 3 4 5 6 ] + [ 0 2 4 6 8 10 12 ] + diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_FillValue.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_FillValue.txt new file mode 100644 index 0000000..68d826b --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_FillValue.txt @@ -0,0 +1,20 @@ +Dataset before being written to: + [ 99 99 99 99 99 99 99 ] + [ 99 99 99 99 99 99 99 ] + [ 99 99 99 99 99 99 99 ] + [ 99 99 99 99 99 99 99 ] + +Dataset after being written to: + [ 0 -1 -2 -3 -4 -5 -6 ] + [ 0 0 0 0 0 0 0 ] + [ 0 1 2 3 4 5 6 ] + [ 0 2 4 6 8 10 12 ] + +Dataset after extension: + [ 0 -1 -2 -3 -4 -5 -6 99 99 99 ] + [ 0 0 0 0 0 0 0 99 99 99 ] + [ 0 1 2 3 4 5 6 99 99 99 ] + [ 0 2 4 6 8 10 12 99 99 99 ] + [ 99 99 99 99 99 99 99 99 99 99 ] + [ 99 99 99 99 99 99 99 99 99 99 ] + diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_Gzip.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_Gzip.txt new file mode 100644 index 0000000..255a561 --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_Gzip.txt @@ -0,0 +1,3 @@ +Filter type is: H5Z_FILTER_DEFLATE + +Maximum value in DS1 is: 1890 diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_Hyperslab.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_Hyperslab.txt new file mode 100644 index 0000000..823dfcc --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_Hyperslab.txt @@ -0,0 +1,24 @@ +Original Data: + [ 1 1 1 1 1 1 1 1 ] + [ 1 1 1 1 1 1 1 1 ] + [ 1 1 1 1 1 1 1 1 ] + [ 1 1 1 1 1 1 1 1 ] + [ 1 1 1 1 1 1 1 1 ] + [ 1 1 1 1 1 1 1 1 ] + +Data as written to disk by hyberslabs: + [ 0 1 0 0 1 0 0 1 ] + [ 1 1 0 1 1 0 1 1 ] + [ 0 0 0 0 0 0 0 0 ] + [ 0 1 0 0 1 0 0 1 ] + [ 1 1 0 1 1 0 1 1 ] + [ 0 0 0 0 0 0 0 0 ] + +Data as read from disk by hyberslab: + [ 0 1 0 0 0 0 0 1 ] + [ 0 1 0 1 0 0 1 1 ] + [ 0 0 0 0 0 0 0 0 ] + [ 0 0 0 0 0 0 0 0 ] + [ 0 1 0 1 0 0 1 1 ] + [ 0 0 0 0 0 0 0 0 ] + diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_Nbit.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_Nbit.txt new file mode 100644 index 0000000..a768ba0 --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_Nbit.txt @@ -0,0 +1,3 @@ +Filter type is: H5Z_FILTER_NBIT + +Maximum value in DS1 is: 1890 diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_ReadWrite.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_ReadWrite.txt new file mode 100644 index 0000000..e021029 --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_ReadWrite.txt @@ -0,0 +1,6 @@ +DS1: + [ 0 -1 -2 -3 -4 -5 -6 ] + [ 0 0 0 0 0 0 0 ] + [ 0 1 2 3 4 5 6 ] + [ 0 2 4 6 8 10 12 ] + diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_Shuffle.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_Shuffle.txt new file mode 100644 index 0000000..ea95f11 --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_Shuffle.txt @@ -0,0 +1,5 @@ +Filter 0: Type is: H5Z_FILTER_SHUFFLE + +Filter 1: Type is: H5Z_FILTER_DEFLATE + +Maximum value in DS1 is: 1890 diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_Sofloat.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_Sofloat.txt new file mode 100644 index 0000000..4d4b5d6 --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_Sofloat.txt @@ -0,0 +1,6 @@ +Maximum value in write buffer is: 106.66666666666667 +Minimum value in write buffer is: 1.7692307692307692 +Filter type is: H5Z_FILTER_SCALEOFFSET + +Maximum value in DS1 is: 106.66169811320755 +Minimum value in DS1 is: 1.7692307692307692 diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_Soint.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_Soint.txt new file mode 100644 index 0000000..48d0d8c --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_Soint.txt @@ -0,0 +1,3 @@ +Filter type is: H5Z_FILTER_SCALEOFFSET + +Maximum value in DS1 is: 1890 diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_Szip.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_Szip.txt new file mode 100644 index 0000000..a1c0d19 --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_Szip.txt @@ -0,0 +1,3 @@ +Filter type is: H5Z_FILTER_SZIP + +Maximum value in DS1 is: 1890 diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_Transform.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_Transform.txt new file mode 100644 index 0000000..05257bc --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_Transform.txt @@ -0,0 +1,15 @@ +Original Data: + [ 0 -1 -2 -3 -4 -5 -6 ] + [ 0 0 0 0 0 0 0 ] + [ 0 1 2 3 4 5 6 ] + [ 0 2 4 6 8 10 12 ] +Data as written with transform 'x+1' + [ 1 0 -1 -2 -3 -4 -5 ] + [ 1 1 1 1 1 1 1 ] + [ 1 2 3 4 5 6 7 ] + [ 1 3 5 7 9 11 13 ] +Data as written with transform 'x+1' and read with transform 'x-1' + [ 0 -1 -2 -3 -4 -5 -6 ] + [ 0 0 0 0 0 0 0 ] + [ 0 1 2 3 4 5 6 ] + [ 0 2 4 6 8 10 12 ] diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedAdd.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedAdd.txt new file mode 100644 index 0000000..d3a7281 --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedAdd.txt @@ -0,0 +1,14 @@ +Dataset before extension: + [ 0 -1 -2 -3 -4 -5 -6 ] + [ 0 0 0 0 0 0 0 ] + [ 0 1 2 3 4 5 6 ] + [ 0 2 4 6 8 10 12 ] + +Dataset after extension: + [ 0 -1 -2 -3 -4 -5 -6 7 8 9 ] + [ 0 0 0 0 0 0 0 7 8 9 ] + [ 0 1 2 3 4 5 6 7 8 9 ] + [ 0 2 4 6 8 10 12 7 8 9 ] + [ 0 1 2 3 4 5 6 7 8 9 ] + [ 0 1 2 3 4 5 6 7 8 9 ] + diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedGzip.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedGzip.txt new file mode 100644 index 0000000..9e36281 --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedGzip.txt @@ -0,0 +1,16 @@ +Dataset before extension: + [ 0 -1 -2 -3 -4 -5 -6 ] + [ 0 0 0 0 0 0 0 ] + [ 0 1 2 3 4 5 6 ] + [ 0 2 4 6 8 10 12 ] + +Filter type is: H5Z_FILTER_DEFLATE + +Dataset after extension: + [ 0 -1 -2 -3 -4 -5 -6 7 8 9 ] + [ 0 0 0 0 0 0 0 7 8 9 ] + [ 0 1 2 3 4 5 6 7 8 9 ] + [ 0 2 4 6 8 10 12 7 8 9 ] + [ 0 1 2 3 4 5 6 7 8 9 ] + [ 0 1 2 3 4 5 6 7 8 9 ] + diff --git a/java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedMod.txt b/java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedMod.txt new file mode 100644 index 0000000..15eee16 --- /dev/null +++ b/java/examples/testfiles/examples.datasets.H5Ex_D_UnlimitedMod.txt @@ -0,0 +1,14 @@ +Dataset before extension: + [ 0 -1 -2 -3 -4 -5 -6 ] + [ 0 0 0 0 0 0 0 ] + [ 0 1 2 3 4 5 6 ] + [ 0 2 4 6 8 10 12 ] + +Dataset after extension: + [ 0 1 2 3 4 5 6 7 8 9 ] + [ 0 1 2 3 4 5 6 7 8 9 ] + [ 0 1 2 3 4 5 6 7 8 9 ] + [ 0 1 2 3 4 5 6 7 8 9 ] + [ 0 1 2 3 4 5 6 7 8 9 ] + [ 0 1 2 3 4 5 6 7 8 9 ] + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_Array.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_Array.txt new file mode 100644 index 0000000..7bcd8fa --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_Array.txt @@ -0,0 +1,21 @@ +DS1 [0]: + [0 0 0 0 0 ] + [0 -1 -2 -3 -4 ] + [0 -2 -4 -6 -8 ] + +DS1 [1]: + [0 1 2 3 4 ] + [1 1 1 1 1 ] + [2 1 0 -1 -2 ] + +DS1 [2]: + [0 2 4 6 8 ] + [2 3 4 5 6 ] + [4 4 4 4 4 ] + +DS1 [3]: + [0 3 6 9 12 ] + [3 5 7 9 11 ] + [6 7 8 9 10 ] + + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_ArrayAttribute.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_ArrayAttribute.txt new file mode 100644 index 0000000..7d27c0b --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_ArrayAttribute.txt @@ -0,0 +1,21 @@ +A1 [0]: + [0 0 0 0 0 ] + [0 -1 -2 -3 -4 ] + [0 -2 -4 -6 -8 ] + +A1 [1]: + [0 1 2 3 4 ] + [1 1 1 1 1 ] + [2 1 0 -1 -2 ] + +A1 [2]: + [0 2 4 6 8 ] + [2 3 4 5 6 ] + [4 4 4 4 4 ] + +A1 [3]: + [0 3 6 9 12 ] + [3 5 7 9 11 ] + [6 7 8 9 10 ] + + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_Bit.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_Bit.txt new file mode 100644 index 0000000..57769b2 --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_Bit.txt @@ -0,0 +1,6 @@ +DS1: + [{0, 0, 0, 0}{3, 0, 1, 1}{2, 0, 2, 2}{1, 0, 3, 3}{0, 0, 0, 0}{3, 0, 1, 1}{2, 0, 2, 2}] + [{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}] + [{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}] + [{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}] + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_BitAttribute.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_BitAttribute.txt new file mode 100644 index 0000000..683bc7f --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_BitAttribute.txt @@ -0,0 +1,6 @@ +A1: + [{0, 0, 0, 0}{3, 0, 1, 1}{2, 0, 2, 2}{1, 0, 3, 3}{0, 0, 0, 0}{3, 0, 1, 1}{2, 0, 2, 2}] + [{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}] + [{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}] + [{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}{0, 0, 0, 0}] + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_Commit.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_Commit.txt new file mode 100644 index 0000000..e6d0bef --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_Commit.txt @@ -0,0 +1,6 @@ +Named datatype: Sensor_Type: + Class: H5T_COMPOUND + Serial number + Location + Temperature (F) + Pressure (inHg) diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_Compound.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_Compound.txt new file mode 100644 index 0000000..0505c78 --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_Compound.txt @@ -0,0 +1,25 @@ +DS1 [0]: +Serial number : 1153 +Location : Exterior (static) +Temperature (F) : 53.23 +Pressure (inHg) : 24.57 + +DS1 [1]: +Serial number : 1184 +Location : Intake +Temperature (F) : 55.12 +Pressure (inHg) : 22.95 + +DS1 [2]: +Serial number : 1027 +Location : Intake manifold +Temperature (F) : 103.55 +Pressure (inHg) : 31.23 + +DS1 [3]: +Serial number : 1313 +Location : Exhaust manifold +Temperature (F) : 1252.89 +Pressure (inHg) : 84.11 + + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_CompoundAttribute.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_CompoundAttribute.txt new file mode 100644 index 0000000..dd77f8d --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_CompoundAttribute.txt @@ -0,0 +1,25 @@ +A1 [0]: +Serial number : 1153 +Location : Exterior (static) +Temperature (F) : 53.23 +Pressure (inHg) : 24.57 + +A1 [1]: +Serial number : 1184 +Location : Intake +Temperature (F) : 55.12 +Pressure (inHg) : 22.95 + +A1 [2]: +Serial number : 1027 +Location : Intake manifold +Temperature (F) : 103.55 +Pressure (inHg) : 31.23 + +A1 [3]: +Serial number : 1313 +Location : Exhaust manifold +Temperature (F) : 1252.89 +Pressure (inHg) : 84.11 + + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_Float.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_Float.txt new file mode 100644 index 0000000..85d8ced --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_Float.txt @@ -0,0 +1,6 @@ +DS1: + [ 0.0000 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000] + [ 2.0000 1.6667 2.4000 3.2857 4.2222 5.1818 6.1538] + [ 4.0000 2.3333 2.8000 3.5714 4.4444 5.3636 6.3077] + [ 6.0000 3.0000 3.2000 3.8571 4.6667 5.5455 6.4615] + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_FloatAttribute.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_FloatAttribute.txt new file mode 100644 index 0000000..cfa1f92 --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_FloatAttribute.txt @@ -0,0 +1,6 @@ +A1: + [ 0.0000 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000] + [ 2.0000 1.6667 2.4000 3.2857 4.2222 5.1818 6.1538] + [ 4.0000 2.3333 2.8000 3.5714 4.4444 5.3636 6.3077] + [ 6.0000 3.0000 3.2000 3.8571 4.6667 5.5455 6.4615] + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_Integer.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_Integer.txt new file mode 100644 index 0000000..f686bd1 --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_Integer.txt @@ -0,0 +1,6 @@ +DS1: + [ 0 -1 -2 -3 -4 -5 -6] + [ 0 0 0 0 0 0 0] + [ 0 1 2 3 4 5 6] + [ 0 2 4 6 8 10 12] + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_IntegerAttribute.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_IntegerAttribute.txt new file mode 100644 index 0000000..dccd4a6 --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_IntegerAttribute.txt @@ -0,0 +1,6 @@ +A1: + [ 0 -1 -2 -3 -4 -5 -6] + [ 0 0 0 0 0 0 0] + [ 0 1 2 3 4 5 6] + [ 0 2 4 6 8 10 12] + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReference.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReference.txt new file mode 100644 index 0000000..827c042 --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReference.txt @@ -0,0 +1,4 @@ +DS1[0]: + ->H5G_GROUP: +DS1[1]: + ->H5G_DATASET: diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReferenceAttribute.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReferenceAttribute.txt new file mode 100644 index 0000000..fe3cdc0 --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_ObjectReferenceAttribute.txt @@ -0,0 +1,4 @@ +A1[0]: + ->H5G_GROUP: +A1[1]: + ->H5G_DATASET: diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_Opaque.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_Opaque.txt new file mode 100644 index 0000000..fb74236 --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_Opaque.txt @@ -0,0 +1,6 @@ +Datatype tag for DS1 is: "Character array" +DS1[0]: OPAQUE0 +DS1[1]: OPAQUE1 +DS1[2]: OPAQUE2 +DS1[3]: OPAQUE3 + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_OpaqueAttribute.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_OpaqueAttribute.txt new file mode 100644 index 0000000..bc9a730 --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_OpaqueAttribute.txt @@ -0,0 +1,6 @@ +Datatype tag for A1 is: "Character array" +A1[0]: OPAQUE0 +A1[1]: OPAQUE1 +A1[2]: OPAQUE2 +A1[3]: OPAQUE3 + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_String.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_String.txt new file mode 100644 index 0000000..4df6a41 --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_String.txt @@ -0,0 +1,5 @@ +DS1 [0]: Parting +DS1 [1]: is such +DS1 [2]: sweet +DS1 [3]: sorrow. + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_StringAttribute.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_StringAttribute.txt new file mode 100644 index 0000000..4df6a41 --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_StringAttribute.txt @@ -0,0 +1,5 @@ +DS1 [0]: Parting +DS1 [1]: is such +DS1 [2]: sweet +DS1 [3]: sorrow. + diff --git a/java/examples/testfiles/examples.datatypes.H5Ex_T_VLString.txt b/java/examples/testfiles/examples.datatypes.H5Ex_T_VLString.txt new file mode 100644 index 0000000..0322953 --- /dev/null +++ b/java/examples/testfiles/examples.datatypes.H5Ex_T_VLString.txt @@ -0,0 +1,4 @@ +DS1 [0]: Parting +DS1 [1]: is such +DS1 [2]: sweet +DS1 [3]: sorrow. diff --git a/java/examples/testfiles/examples.groups.H5Ex_G_Compact.txt b/java/examples/testfiles/examples.groups.H5Ex_G_Compact.txt new file mode 100644 index 0000000..0a88d3f --- /dev/null +++ b/java/examples/testfiles/examples.groups.H5Ex_G_Compact.txt @@ -0,0 +1,5 @@ +Group storage type for H5Ex_G_Compact1.h5 is: H5G_STORAGE_TYPE_SYMBOL_TABLE +File size for H5Ex_G_Compact1.h5 is: 1832 bytes + +Group storage type for H5Ex_G_Compact2.h5 is: H5G_STORAGE_TYPE_COMPACT +File size for H5Ex_G_Compact2.h5 is: 342 bytes diff --git a/java/examples/testfiles/examples.groups.H5Ex_G_Corder.txt b/java/examples/testfiles/examples.groups.H5Ex_G_Corder.txt new file mode 100644 index 0000000..2d959fc --- /dev/null +++ b/java/examples/testfiles/examples.groups.H5Ex_G_Corder.txt @@ -0,0 +1,10 @@ +Traversing group using alphabetical indices: +Index 0: 5 +Index 1: D +Index 2: F +Index 3: H +Traversing group using creation order indices: +Index 0: H +Index 1: D +Index 2: F +Index 3: 5 diff --git a/java/examples/testfiles/examples.groups.H5Ex_G_Create.txt b/java/examples/testfiles/examples.groups.H5Ex_G_Create.txt new file mode 100644 index 0000000..e69de29 diff --git a/java/examples/testfiles/examples.groups.H5Ex_G_Intermediate.txt b/java/examples/testfiles/examples.groups.H5Ex_G_Intermediate.txt new file mode 100644 index 0000000..65a0fc2 --- /dev/null +++ b/java/examples/testfiles/examples.groups.H5Ex_G_Intermediate.txt @@ -0,0 +1,5 @@ +Objects in the file_id: +/ (Group) +/G1 (Group) +/G1/G2 (Group) +/G1/G2/G3 (Group) diff --git a/java/examples/testfiles/examples.groups.H5Ex_G_Iterate.txt b/java/examples/testfiles/examples.groups.H5Ex_G_Iterate.txt new file mode 100644 index 0000000..66a4ae9 --- /dev/null +++ b/java/examples/testfiles/examples.groups.H5Ex_G_Iterate.txt @@ -0,0 +1,5 @@ +Objects in root group: + Dataset: DS1 + Datatype: DT1 + Group: G1 + Dataset: L1 diff --git a/java/examples/testfiles/examples.groups.H5Ex_G_Phase.txt b/java/examples/testfiles/examples.groups.H5Ex_G_Phase.txt new file mode 100644 index 0000000..9e666d4 --- /dev/null +++ b/java/examples/testfiles/examples.groups.H5Ex_G_Phase.txt @@ -0,0 +1,15 @@ +1 Group : Storage type is H5G_STORAGE_TYPE_COMPACT +2 Groups: Storage type is H5G_STORAGE_TYPE_COMPACT +3 Groups: Storage type is H5G_STORAGE_TYPE_COMPACT +4 Groups: Storage type is H5G_STORAGE_TYPE_COMPACT +5 Groups: Storage type is H5G_STORAGE_TYPE_COMPACT +6 Groups: Storage type is H5G_STORAGE_TYPE_DENSE +7 Groups: Storage type is H5G_STORAGE_TYPE_DENSE + +6 Groups: Storage type is H5G_STORAGE_TYPE_DENSE +5 Groups: Storage type is H5G_STORAGE_TYPE_DENSE +4 Groups: Storage type is H5G_STORAGE_TYPE_DENSE +3 Groups: Storage type is H5G_STORAGE_TYPE_DENSE +2 Groups: Storage type is H5G_STORAGE_TYPE_COMPACT +1 Group : Storage type is H5G_STORAGE_TYPE_COMPACT +0 Groups: Storage type is H5G_STORAGE_TYPE_COMPACT diff --git a/java/examples/testfiles/examples.groups.H5Ex_G_Visit.txt b/java/examples/testfiles/examples.groups.H5Ex_G_Visit.txt new file mode 100644 index 0000000..126a588 --- /dev/null +++ b/java/examples/testfiles/examples.groups.H5Ex_G_Visit.txt @@ -0,0 +1,19 @@ +Objects in the file: +/ (Group) +/group1 (Group) +/group1/dset1 (Dataset) +/group1/group3 (Group) +/group1/group3/group4 (Group) +/group1/group3/group4/group1 (Group) +/group1/group3/group4/group2 (Group) + +Links in the file: +/group1 (Group) +/group1/dset1 (Dataset) +/group1/group3 (Group) +/group1/group3/dset2 (Dataset) +/group1/group3/group4 (Group) +/group1/group3/group4/group1 (Group) +/group1/group3/group4/group1/group5 (Group) +/group1/group3/group4/group2 (Group) +/group2 (Group) diff --git a/java/examples/testfiles/examples.intro.H5_CreateAttribute.txt b/java/examples/testfiles/examples.intro.H5_CreateAttribute.txt new file mode 100644 index 0000000..e69de29 diff --git a/java/examples/testfiles/examples.intro.H5_CreateDataset.txt b/java/examples/testfiles/examples.intro.H5_CreateDataset.txt new file mode 100644 index 0000000..e69de29 diff --git a/java/examples/testfiles/examples.intro.H5_CreateFile.txt b/java/examples/testfiles/examples.intro.H5_CreateFile.txt new file mode 100644 index 0000000..e69de29 diff --git a/java/examples/testfiles/examples.intro.H5_CreateGroup.txt b/java/examples/testfiles/examples.intro.H5_CreateGroup.txt new file mode 100644 index 0000000..e69de29 diff --git a/java/examples/testfiles/examples.intro.H5_CreateGroupAbsoluteRelative.txt b/java/examples/testfiles/examples.intro.H5_CreateGroupAbsoluteRelative.txt new file mode 100644 index 0000000..e69de29 diff --git a/java/examples/testfiles/examples.intro.H5_CreateGroupDataset.txt b/java/examples/testfiles/examples.intro.H5_CreateGroupDataset.txt new file mode 100644 index 0000000..e69de29 diff --git a/java/examples/testfiles/examples.intro.H5_ReadWrite.txt b/java/examples/testfiles/examples.intro.H5_ReadWrite.txt new file mode 100644 index 0000000..e69de29 diff --git a/java/lib/ext/slf4j-nop-1.7.5.jar b/java/lib/ext/slf4j-nop-1.7.5.jar new file mode 100644 index 0000000..e55bdd8 Binary files /dev/null and b/java/lib/ext/slf4j-nop-1.7.5.jar differ diff --git a/java/lib/ext/slf4j-simple-1.7.5.jar b/java/lib/ext/slf4j-simple-1.7.5.jar new file mode 100644 index 0000000..9dece31 Binary files /dev/null and b/java/lib/ext/slf4j-simple-1.7.5.jar differ diff --git a/java/lib/hamcrest-core.jar b/java/lib/hamcrest-core.jar new file mode 100644 index 0000000..9d5fe16 Binary files /dev/null and b/java/lib/hamcrest-core.jar differ diff --git a/java/lib/junit.jar b/java/lib/junit.jar new file mode 100644 index 0000000..aaf7444 Binary files /dev/null and b/java/lib/junit.jar differ diff --git a/java/lib/simplelogger.properties b/java/lib/simplelogger.properties new file mode 100644 index 0000000..119ee92 --- /dev/null +++ b/java/lib/simplelogger.properties @@ -0,0 +1,36 @@ +# SLF4J's SimpleLogger configuration file +# Simple implementation of Logger that sends all enabled log messages, for all defined loggers, to System.err. + +org.slf4j.simpleLogger.logFile=slf4j.simpleLogger.log + +# Default logging detail level for all instances of SimpleLogger. +# Must be one of ("trace", "debug", "info", "warn", or "error"). +# If not specified, defaults to "info". +org.slf4j.simpleLogger.defaultLog=trace + +# Logging detail level for a SimpleLogger instance named "xxxxx". +# Must be one of ("trace", "debug", "info", "warn", or "error"). +# If not specified, the default logging detail level is used. +#org.slf4j.simpleLogger.log.xxxxx= + +# Set to true if you want the current date and time to be included in output messages. +# Default is false, and will output the number of milliseconds elapsed since startup. +#org.slf4j.simpleLogger.showDateTime=false + +# The date and time format to be used in the output messages. +# The pattern describing the date and time format is the same that is used in java.text.SimpleDateFormat. +# If the format is not specified or is invalid, the default format is used. +# The default format is yyyy-MM-dd HH:mm:ss:SSS Z. +org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd HH:mm:ss:SSS Z + +# Set to true if you want to output the current thread name. +# Defaults to true. +org.slf4j.simpleLogger.showThreadName=true + +# Set to true if you want the Logger instance name to be included in output messages. +# Defaults to true. +org.slf4j.simpleLogger.showLogName=true + +# Set to true if you want the last component of the name to be included in output messages. +# Defaults to false. +org.slf4j.simpleLogger.showShortLogName=false diff --git a/java/lib/slf4j-api-1.7.5.jar b/java/lib/slf4j-api-1.7.5.jar new file mode 100644 index 0000000..8766455 Binary files /dev/null and b/java/lib/slf4j-api-1.7.5.jar differ diff --git a/java/src/CMakeLists.txt b/java/src/CMakeLists.txt new file mode 100644 index 0000000..ae78201 --- /dev/null +++ b/java/src/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1.0) +PROJECT ( HDF5_JAVA_SRC C Java ) + +#----------------------------------------------------------------------------- +# Traverse source subdirectory +#----------------------------------------------------------------------------- +add_subdirectory (${HDF5_JAVA_SRC_SOURCE_DIR}/jni ${HDF5_JAVA_SRC_BINARY_DIR}/jni) +add_subdirectory (${HDF5_JAVA_SRC_SOURCE_DIR}/hdf ${HDF5_JAVA_SRC_BINARY_DIR}/hdf) diff --git a/java/src/Makefile.am b/java/src/Makefile.am new file mode 100644 index 0000000..7615973 --- /dev/null +++ b/java/src/Makefile.am @@ -0,0 +1,137 @@ +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# +# +# This makefile mostly just reinvokes make in the various subdirectories +# but does so in the correct order. You can alternatively invoke make from +# each subdirectory manually. +## +## Makefile.am +## Run automake to generate a Makefile.in from this file. +## +# +# HDF5 Java native interface (JNI) Library Makefile(.in) + +include $(top_srcdir)/config/commence.am + +# Mark this directory as part of the JNI API +JAVA_API=yes + +SUBDIRS=jni + +JAVAROOT = .classes + +classes: + $(MKDIR_P) $(@D)/$(JAVAROOT) + +jarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar +hdf5_javadir = $(libdir) + +pkgpath = hdf/hdf5lib +CLASSPATH_ENV=CLASSPATH=.:$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$$CLASSPATH + +AM_JAVACFLAGS = $(H5_JAVACFLAGS) -deprecation + +hdf5_java_JAVA = \ + ${pkgpath}/callbacks/Callbacks.java \ + ${pkgpath}/callbacks/H5A_iterate_cb.java \ + ${pkgpath}/callbacks/H5A_iterate_t.java \ + ${pkgpath}/callbacks/H5D_iterate_cb.java \ + ${pkgpath}/callbacks/H5D_iterate_t.java \ + ${pkgpath}/callbacks/H5E_walk_cb.java \ + ${pkgpath}/callbacks/H5E_walk_t.java \ + ${pkgpath}/callbacks/H5L_iterate_cb.java \ + ${pkgpath}/callbacks/H5L_iterate_t.java \ + ${pkgpath}/callbacks/H5O_iterate_cb.java \ + ${pkgpath}/callbacks/H5O_iterate_t.java \ + ${pkgpath}/callbacks/H5P_cls_close_func_cb.java \ + ${pkgpath}/callbacks/H5P_cls_close_func_t.java \ + ${pkgpath}/callbacks/H5P_cls_copy_func_cb.java \ + ${pkgpath}/callbacks/H5P_cls_copy_func_t.java \ + ${pkgpath}/callbacks/H5P_cls_create_func_cb.java \ + ${pkgpath}/callbacks/H5P_cls_create_func_t.java \ + ${pkgpath}/callbacks/H5P_prp_close_func_cb.java \ + ${pkgpath}/callbacks/H5P_prp_compare_func_cb.java \ + ${pkgpath}/callbacks/H5P_prp_copy_func_cb.java \ + ${pkgpath}/callbacks/H5P_prp_create_func_cb.java \ + ${pkgpath}/callbacks/H5P_prp_delete_func_cb.java \ + ${pkgpath}/callbacks/H5P_prp_get_func_cb.java \ + ${pkgpath}/callbacks/H5P_prp_set_func_cb.java \ + ${pkgpath}/callbacks/H5P_iterate_cb.java \ + ${pkgpath}/callbacks/H5P_iterate_t.java \ + ${pkgpath}/exceptions/HDF5AtomException.java \ + ${pkgpath}/exceptions/HDF5AttributeException.java \ + ${pkgpath}/exceptions/HDF5BtreeException.java \ + ${pkgpath}/exceptions/HDF5DataFiltersException.java \ + ${pkgpath}/exceptions/HDF5DataStorageException.java \ + ${pkgpath}/exceptions/HDF5DatasetInterfaceException.java \ + ${pkgpath}/exceptions/HDF5DataspaceInterfaceException.java \ + ${pkgpath}/exceptions/HDF5DatatypeInterfaceException.java \ + ${pkgpath}/exceptions/HDF5Exception.java \ + ${pkgpath}/exceptions/HDF5ExternalFileListException.java \ + ${pkgpath}/exceptions/HDF5FileInterfaceException.java \ + ${pkgpath}/exceptions/HDF5FunctionArgumentException.java \ + ${pkgpath}/exceptions/HDF5FunctionEntryExitException.java \ + ${pkgpath}/exceptions/HDF5HeapException.java \ + ${pkgpath}/exceptions/HDF5InternalErrorException.java \ + ${pkgpath}/exceptions/HDF5JavaException.java \ + ${pkgpath}/exceptions/HDF5LibraryException.java \ + ${pkgpath}/exceptions/HDF5LowLevelIOException.java \ + ${pkgpath}/exceptions/HDF5MetaDataCacheException.java \ + ${pkgpath}/exceptions/HDF5ObjectHeaderException.java \ + ${pkgpath}/exceptions/HDF5PropertyListInterfaceException.java \ + ${pkgpath}/exceptions/HDF5ReferenceException.java \ + ${pkgpath}/exceptions/HDF5ResourceUnavailableException.java \ + ${pkgpath}/exceptions/HDF5SymbolTableException.java \ + ${pkgpath}/structs/H5_ih_info_t.java \ + ${pkgpath}/structs/H5A_info_t.java \ + ${pkgpath}/structs/H5E_error2_t.java \ + ${pkgpath}/structs/H5F_info2_t.java \ + ${pkgpath}/structs/H5G_info_t.java \ + ${pkgpath}/structs/H5L_info_t.java \ + ${pkgpath}/structs/H5O_info_t.java \ + ${pkgpath}/structs/H5O_hdr_info_t.java \ + ${pkgpath}/structs/H5AC_cache_config_t.java \ + ${pkgpath}/H5.java \ + ${pkgpath}/HDF5Constants.java \ + ${pkgpath}/HDF5GroupInfo.java \ + ${pkgpath}/HDFArray.java \ + ${pkgpath}/HDFNativeData.java + +$(jarfile): classhdf5_java.stamp classes docs + $(JAR) cvf $@ -C $(JAVAROOT)/ $(pkgpath) + +hdf5_java_DATA = $(jarfile) + +.PHONY: docs classes + +WINDOWTITLE = 'HDF5 Java' +DOCTITLE = '

HDF5 Java Wrapper

' +SRCDIR = '$(pkgpath)' + +docs: + $(JAVADOC) -sourcepath $(srcdir) -d javadoc -use -splitIndex -windowtitle $(WINDOWTITLE) -doctitle $(DOCTITLE) -J-Xmx180m -verbose -classpath $(CLASSPATH_ENV) hdf.hdf5lib + +CLEANFILES = classhdf5_java.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/callbacks/*.class $(JAVAROOT)/$(pkgpath)/exceptions/*.class $(JAVAROOT)/$(pkgpath)/structs/*.class $(JAVAROOT)/$(pkgpath)/*.class + +clean: + rm -rf $(JAVAROOT) + rm -f $(jarfile) + rm -f classhdf5_java.stamp + + +# Clean examples when check-clean is invoked +check-clean :: ; + +#include $(top_srcdir)/config/conclude.am diff --git a/java/src/hdf/CMakeLists.txt b/java/src/hdf/CMakeLists.txt new file mode 100644 index 0000000..f465da9 --- /dev/null +++ b/java/src/hdf/CMakeLists.txt @@ -0,0 +1,4 @@ +cmake_minimum_required (VERSION 3.1.0) +PROJECT (HDF5_JAVA_HDF) + +add_subdirectory (${HDF5_JAVA_HDF_SOURCE_DIR}/hdf5lib hdf5lib) diff --git a/java/src/hdf/hdf5lib/CMakeLists.txt b/java/src/hdf/hdf5lib/CMakeLists.txt new file mode 100644 index 0000000..56c1e59 --- /dev/null +++ b/java/src/hdf/hdf5lib/CMakeLists.txt @@ -0,0 +1,124 @@ +cmake_minimum_required (VERSION 3.1.0) +PROJECT (HDF5_JAVA_HDF_HDF5 Java) + +set (CMAKE_VERBOSE_MAKEFILE 1) + +INCLUDE_DIRECTORIES ( + ${HDF5_JAVA_HDF_HDF5_SOURCE_DIR} + ${HDF5_JAVA_HDF_HDF5_BINARY_DIR} + ${HDF5_JAVA_LIB_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${HDF5_JAVA_HDF5_LIB_CORENAME}.dir/hdf/hdf5lib +) + +SET_GLOBAL_VARIABLE (HDF5_JAVA_SOURCE_PACKAGES + "${HDFJAVA_SOURCE_PACKAGES};hdf.hdf5lib.callbacks;hdf.hdf5lib.exceptions;hdf.hdf5lib.structs;hdf.hdf5lib" +) + +set (HDF5_JAVA_HDF_HDF5_CALLBACKS_SRCS + callbacks/H5A_iterate_cb.java + callbacks/H5A_iterate_t.java + callbacks/H5D_iterate_cb.java + callbacks/H5D_iterate_t.java + callbacks/H5E_walk_cb.java + callbacks/H5E_walk_t.java + callbacks/H5L_iterate_cb.java + callbacks/H5L_iterate_t.java + callbacks/H5O_iterate_cb.java + callbacks/H5O_iterate_t.java + callbacks/H5P_cls_close_func_cb.java + callbacks/H5P_cls_close_func_t.java + callbacks/H5P_cls_copy_func_cb.java + callbacks/H5P_cls_copy_func_t.java + callbacks/H5P_cls_create_func_cb.java + callbacks/H5P_cls_create_func_t.java + callbacks/H5P_prp_close_func_cb.java + callbacks/H5P_prp_compare_func_cb.java + callbacks/H5P_prp_copy_func_cb.java + callbacks/H5P_prp_create_func_cb.java + callbacks/H5P_prp_delete_func_cb.java + callbacks/H5P_prp_get_func_cb.java + callbacks/H5P_prp_set_func_cb.java + callbacks/H5P_iterate_cb.java + callbacks/H5P_iterate_t.java + callbacks/Callbacks.java +) + +set (HDF5_JAVA_HDF_HDF5_EXCEPTIONS_SRCS + exceptions/HDF5Exception.java + exceptions/HDF5AtomException.java + exceptions/HDF5AttributeException.java + exceptions/HDF5BtreeException.java + exceptions/HDF5DataFiltersException.java + exceptions/HDF5DatasetInterfaceException.java + exceptions/HDF5DataspaceInterfaceException.java + exceptions/HDF5DataStorageException.java + exceptions/HDF5DatatypeInterfaceException.java + exceptions/HDF5ExternalFileListException.java + exceptions/HDF5FileInterfaceException.java + exceptions/HDF5FunctionArgumentException.java + exceptions/HDF5FunctionEntryExitException.java + exceptions/HDF5HeapException.java + exceptions/HDF5InternalErrorException.java + exceptions/HDF5JavaException.java + exceptions/HDF5LibraryException.java + exceptions/HDF5LowLevelIOException.java + exceptions/HDF5MetaDataCacheException.java + exceptions/HDF5ObjectHeaderException.java + exceptions/HDF5PropertyListInterfaceException.java + exceptions/HDF5ReferenceException.java + exceptions/HDF5ResourceUnavailableException.java + exceptions/HDF5SymbolTableException.java +) + +set (HDF5_JAVA_HDF_HDF5_STRUCTS_SRCS + structs/H5_ih_info_t.java + structs/H5A_info_t.java + structs/H5AC_cache_config_t.java + structs/H5E_error2_t.java + structs/H5F_info2_t.java + structs/H5G_info_t.java + structs/H5L_info_t.java + structs/H5O_hdr_info_t.java + structs/H5O_info_t.java +) + +set (HDF5_JAVA_HDF_HDF5_SRCS + HDFArray.java + HDF5Constants.java + HDF5GroupInfo.java + HDFNativeData.java + H5.java +) + +set (CMAKE_JNI_TARGET TRUE) + +file (WRITE ${PROJECT_BINARY_DIR}/Manifest.txt +" +" +) + +set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_LOGGING_JAR}") + +add_jar (${HDF5_JAVA_HDF5_LIB_TARGET} OUTPUT_NAME "${HDF5_JAVA_HDF5_LIB_TARGET}-${HDF5_PACKAGE_VERSION}" OUTPUT_DIR ${CMAKE_JAVA_TARGET_OUTPUT_DIR} MANIFEST ${PROJECT_BINARY_DIR}/Manifest.txt ${HDF5_JAVA_HDF_HDF5_CALLBACKS_SRCS} ${HDF5_JAVA_HDF_HDF5_EXCEPTIONS_SRCS} ${HDF5_JAVA_HDF_HDF5_STRUCTS_SRCS} ${HDF5_JAVA_HDF_HDF5_SRCS}) +install_jar (${HDF5_JAVA_HDF5_LIB_TARGET} LIBRARY DESTINATION ${HDF5_INSTALL_JAR_DIR} COMPONENT libraries) +#if (NOT WIN32) +# install_jni_symlink (${HDF5_JAVA_HDF5_LIB_TARGET} ${HDF5_INSTALL_JAR_DIR} libraries) +#endif (NOT WIN32) + +get_target_property (${HDF5_JAVA_HDF5_LIB_TARGET}_JAR_FILE ${HDF5_JAVA_HDF5_LIB_TARGET} JAR_FILE) +SET_GLOBAL_VARIABLE (HDF5_JAVA_JARS_TO_EXPORT "${HDF5_JAVA_JARS_TO_EXPORT};${${HDF5_JAVA_HDF5_LIB_TARGET}_JAR_FILE}") +SET_GLOBAL_VARIABLE (HDF5_JAVA_JARS ${${HDF5_JAVA_HDF5_LIB_TARGET}_JAR_FILE}) + +add_dependencies (${HDF5_JAVA_HDF5_LIB_TARGET} ${HDF5_JAVA_JNI_LIB_TARGET}) +set_target_properties (${HDF5_JAVA_HDF5_LIB_TARGET} PROPERTIES FOLDER libraries/java) + +create_javadoc(hdf5_java_doc + FILES ${HDF5_JAVA_HDF_HDF5_CALLBACKS_SRCS} ${HDF5_JAVA_HDF_HDF5_EXCEPTIONS_SRCS} ${HDF5_JAVA_HDF_HDF5_STRUCTS_SRCS} ${HDF5_JAVA_HDF_HDF5_SRCS} + CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH} + WINDOWTITLE "HDF5 Java" + DOCTITLE "

HDF5 Java Wrapper

" + INSTALLPATH ${HDF5_INSTALL_DATA_DIR} + AUTHOR TRUE + USE TRUE + VERSION TRUE +) diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java new file mode 100644 index 0000000..fbfc40a --- /dev/null +++ b/java/src/hdf/hdf5lib/H5.java @@ -0,0 +1,9185 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +package hdf.hdf5lib; + +import java.io.File; +import java.nio.ByteBuffer; +import java.util.Collection; +import java.util.LinkedHashSet; +import hdf.hdf5lib.callbacks.H5A_iterate_cb; +import hdf.hdf5lib.callbacks.H5A_iterate_t; +import hdf.hdf5lib.callbacks.H5D_iterate_cb; +import hdf.hdf5lib.callbacks.H5D_iterate_t; +import hdf.hdf5lib.callbacks.H5E_walk_cb; +import hdf.hdf5lib.callbacks.H5E_walk_t; +import hdf.hdf5lib.callbacks.H5L_iterate_cb; +import hdf.hdf5lib.callbacks.H5L_iterate_t; +import hdf.hdf5lib.callbacks.H5O_iterate_cb; +import hdf.hdf5lib.callbacks.H5O_iterate_t; +import hdf.hdf5lib.callbacks.H5P_cls_close_func_cb; +import hdf.hdf5lib.callbacks.H5P_cls_close_func_t; +import hdf.hdf5lib.callbacks.H5P_cls_copy_func_cb; +import hdf.hdf5lib.callbacks.H5P_cls_copy_func_t; +import hdf.hdf5lib.callbacks.H5P_cls_create_func_cb; +import hdf.hdf5lib.callbacks.H5P_cls_create_func_t; +import hdf.hdf5lib.callbacks.H5P_prp_set_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_get_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_delete_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_copy_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_compare_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_close_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_create_func_cb; +import hdf.hdf5lib.callbacks.H5P_iterate_cb; +import hdf.hdf5lib.callbacks.H5P_iterate_t; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5JavaException; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.structs.H5AC_cache_config_t; +import hdf.hdf5lib.structs.H5A_info_t; +import hdf.hdf5lib.structs.H5E_error2_t; +import hdf.hdf5lib.structs.H5F_info2_t; +import hdf.hdf5lib.structs.H5G_info_t; +import hdf.hdf5lib.structs.H5L_info_t; +import hdf.hdf5lib.structs.H5O_info_t; + +/** + * This class is the Java interface for the HDF5 library. + *

+ * This code is the called by Java programs to access the entry points of the HDF5 library. Each routine wraps a single + * HDF5 entry point, generally with the arguments and return codes analogous to the C interface. + *

+ * For details of the HDF5 library, see the HDF5 Documentation at: http://hdfgroup.org/HDF5/ + *


+ *

+ * Mapping of arguments for Java + * + *

+ * In general, arguments to the HDF Java API are straightforward translations from the 'C' API described in the HDF + * Reference Manual. + * + *

+ * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
HDF-5 C types to Java types
HDF-5Java
H5T_NATIVE_INTint, Integer
H5T_NATIVE_SHORTshort, Short
H5T_NATIVE_FLOATfloat, Float
H5T_NATIVE_DOUBLEdouble, Double
H5T_NATIVE_CHARbyte, Byte
H5T_C_S1java.lang.String
void *
+ * (i.e., pointer to `Any')
Special -- see HDFArray
+ *
+ *
General Rules for Passing Arguments and Results
+ *

+ * In general, arguments passed IN to Java are the analogous basic types, as above. The exception is for arrays, + * which are discussed below. + *

+ * The return value of Java methods is also the analogous type, as above. A major exception to that rule is that + * all HDF functions that return SUCCEED/FAIL are declared boolean in the Java version, rather than int as + * in the C. Functions that return a value or else FAIL are declared the equivalent to the C function. However, in most + * cases the Java method will raise an exception instead of returning an error code. See Errors and + * Exceptions below. + *

+ * Java does not support pass by reference of arguments, so arguments that are returned through OUT parameters + * must be wrapped in an object or array. The Java API for HDF consistently wraps arguments in arrays. + *

+ * For instance, a function that returns two integers is declared: + * + *

+ *       h_err_t HDF5dummy( int *a1, int *a2)
+ * 
+ * + * For the Java interface, this would be declared: + * + *
+ * public synchronized static native int HDF5dummy(int args[]);
+ * 
+ * + * where a1 is args[0] and a2 is args[1], and would be invoked: + * + *
+ * H5.HDF5dummy(a);
+ * 
+ * + *

+ * All the routines where this convention is used will have specific documentation of the details, given below. + *

+ * Arrays + *

+ * HDF5 needs to read and write multi-dimensional arrays of any number type (and records). The HDF5 API describes the + * layout of the source and destination, and the data for the array passed as a block of bytes, for instance, + * + *

+ *      herr_t H5Dread(int fid, int filetype, int memtype, int memspace,
+ *      void * data);
+ * 
+ * + *

+ * where ``void *'' means that the data may be any valid numeric type, and is a contiguous block of bytes that is the + * data for a multi-dimensional array. The other parameters describe the dimensions, rank, and datatype of the array on + * disk (source) and in memory (destination). + *

+ * For Java, this ``ANY'' is a problem, as the type of data must always be declared. Furthermore, multidimensional + * arrays are definitely not layed out contiguously in memory. It would be infeasible to declare a separate + * routine for every combination of number type and dimensionality. For that reason, the HDFArray class is used to discover the type, shape, and size of the + * data array at run time, and to convert to and from a contiguous array of bytes in synchronized static native C order. + *

+ * The upshot is that any Java array of numbers (either primitive or sub-classes of type Number) can be passed as + * an ``Object'', and the Java API will translate to and from the appropriate packed array of bytes needed by the C + * library. So the function above would be declared: + * + *

+ * public synchronized static native int H5Dread(int fid, int filetype, int memtype, int memspace, Object data);
+ * 
+ * OPEN_IDS.addElement(id); + + * and the parameter data can be any multi-dimensional array of numbers, such as float[][], or int[][][], or + * Double[][]. + *

+ * HDF-5 Constants + *

+ * The HDF-5 API defines a set of constants and enumerated values. Most of these values are available to Java programs + * via the class HDF5Constants. For example, the parameters for + * the h5open() call include two numeric values, HDFConstants.H5F_ACC_RDWR and + * HDF5Constants.H5P_DEFAULT. As would be expected, these numbers correspond to the C constants + * H5F_ACC_RDWR and H5P_DEFAULT. + *

+ * The HDF-5 API defines a set of values that describe number types and sizes, such as "H5T_NATIVE_INT" and "hsize_t". + * These values are determined at run time by the HDF-5 C library. To support these parameters, the Java class HDF5CDataTypes looks up the values when initiated. The values + * can be accessed as public variables of the Java class, such as: + * + *

+ * int data_type = HDF5CDataTypes.JH5T_NATIVE_INT;
+ * 
+ * + * The Java application uses both types of constants the same way, the only difference is that the + * HDF5CDataTypes may have different values on different platforms. + *

+ * Error handling and Exceptions + *

+ * The HDF5 error API (H5E) manages the behavior of the error stack in the HDF-5 library. This API is omitted from the + * JHI5. Errors are converted into Java exceptions. This is totally different from the C interface, but is very natural + * for Java programming. + *

+ * The exceptions of the JHI5 are organized as sub-classes of the class HDF5Exception. There are two subclasses of + * HDF5Exception, HDF5LibraryException + * and HDF5JavaException. The sub-classes of the + * former represent errors from the HDF-5 C library, while sub-classes of the latter represent errors in the JHI5 + * wrapper and support code. + *

+ * The super-class HDF5LibraryException implements the method 'printStackTrace()', which + * prints out the HDF-5 error stack, as described in the HDF-5 C API H5Eprint(). This may be used by Java + * exception handlers to print out the HDF-5 error stack. + *


+ * + * @version HDF5 1.9
+ * See also: hdf.hdf5lib.HDFArray
+ * hdf.hdf5lib.HDF5Constants
+ * hdf.hdf5lib.HDF5CDataTypes
+ * hdf.hdf5lib.HDF5Exception
+ * http://hdfgroup.org/HDF5" + **/ +public class H5 implements java.io.Serializable { + /** + * + */ + private static final long serialVersionUID = 6129888282117053288L; + + private final static org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(H5.class); + + /** + * The version number of the HDF5 library: + * LIB_VERSION[0]: The major version of the library. + * LIB_VERSION[1]: The minor version of the library. + * LIB_VERSION[2]: The release number of the library. + * + * Make sure to update the versions number when a different library is used. + */ + public final static int LIB_VERSION[] = { 1, 9, 9999 }; + + public final static String H5PATH_PROPERTY_KEY = "hdf.hdf5lib.H5.hdf5lib"; + + // add system property to load library by name from library path, via + // System.loadLibrary() + public final static String H5_LIBRARY_NAME_PROPERTY_KEY = "hdf.hdf5lib.H5.loadLibraryName"; + private static String s_libraryName; + private static boolean isLibraryLoaded = false; + + private final static boolean IS_CRITICAL_PINNING = true; + // change from Vector to LinkedHashSet - jp 6-Oct-2014 + private final static LinkedHashSet OPEN_IDS = new LinkedHashSet(); + + static { + loadH5Lib(); + } + + public static void loadH5Lib() { + // Make sure that the library is loaded only once + if (isLibraryLoaded) + return; + + // first try loading library by name from user supplied library path + s_libraryName = System.getProperty(H5_LIBRARY_NAME_PROPERTY_KEY, null); + String mappedName = null; + if ((s_libraryName != null) && (s_libraryName.length() > 0)) { + try { + mappedName = System.mapLibraryName(s_libraryName); + System.loadLibrary(s_libraryName); + isLibraryLoaded = true; + } + catch (Throwable err) { + err.printStackTrace(); + isLibraryLoaded = false; + } + finally { + log.info("HDF5 library: " + s_libraryName); + log.debug(" resolved to: " + mappedName + "; "); + log.info((isLibraryLoaded ? "" : " NOT") + " successfully loaded from system property"); + } + } + + if (!isLibraryLoaded) { + // else try loading library via full path + String filename = System.getProperty(H5PATH_PROPERTY_KEY, null); + if ((filename != null) && (filename.length() > 0)) { + File h5dll = new File(filename); + if (h5dll.exists() && h5dll.canRead() && h5dll.isFile()) { + try { + System.load(filename); + isLibraryLoaded = true; + } + catch (Throwable err) { + err.printStackTrace(); + isLibraryLoaded = false; + } + finally { + log.info("HDF5 library: "); + log.debug(filename); + log.info((isLibraryLoaded ? "" : " NOT") + " successfully loaded."); + } + } + else { + isLibraryLoaded = false; + throw (new UnsatisfiedLinkError("Invalid HDF5 library, " + filename)); + } + } + } + + // else load standard library + if (!isLibraryLoaded) { + try { + s_libraryName = "hdf5_java"; + mappedName = System.mapLibraryName(s_libraryName); + System.loadLibrary("hdf5_java"); + isLibraryLoaded = true; + } + catch (Throwable err) { + err.printStackTrace(); + isLibraryLoaded = false; + } + finally { + log.info("HDF5 library: " + s_libraryName); + log.debug(" resolved to: " + mappedName + "; "); + log.info((isLibraryLoaded ? "" : " NOT") + " successfully loaded from java.library.path"); + } + } + + /* Important! Exit quietly */ + try { + H5.H5dont_atexit(); + } + catch (HDF5LibraryException e) { + System.exit(1); + } + + /* Important! Disable error output to C stdout */ + if (!log.isDebugEnabled()) + H5.H5error_off(); + + /* + * Optional: confirm the version This will crash immediately if not the specified version. + */ + Integer majnum = Integer.getInteger("hdf.hdf5lib.H5.hdf5maj", null); + Integer minnum = Integer.getInteger("hdf.hdf5lib.H5.hdf5min", null); + Integer relnum = Integer.getInteger("hdf.hdf5lib.H5.hdf5rel", null); + if ((majnum != null) && (minnum != null) && (relnum != null)) { + H5.H5check_version(majnum.intValue(), minnum.intValue(), relnum.intValue()); + } + } + + // //////////////////////////////////////////////////////////// + // // + // H5: General Library Functions // + // // + // //////////////////////////////////////////////////////////// + + /** + * Get number of open IDs. + * + * @return Returns a count of open IDs + */ + public final static int getOpenIDCount() { + return OPEN_IDS.size(); + } + + /** + * Get the open IDs + * + * @return Returns a collection of open IDs + */ + public final static Collection getOpenIDs() { + return OPEN_IDS; + } + + /** + * H5check_version verifies that the arguments match the version numbers compiled into the library. + * + * @param majnum + * The major version of the library. + * @param minnum + * The minor version of the library. + * @param relnum + * The release number of the library. + * @return a non-negative value if successful. Upon failure (when the versions do not match), this function causes + * the application to abort (i.e., crash) + * + * See C API function: herr_t H5check_version() + **/ + public synchronized static native int H5check_version(int majnum, int minnum, int relnum); + + /** + * H5close flushes all data to disk, closes all file identifiers, and cleans up all memory used by the library. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5close() throws HDF5LibraryException; + + /** + * H5open initialize the library. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5open() throws HDF5LibraryException; + + /** + * H5dont_atexit indicates to the library that an atexit() cleanup routine should not be installed. In order to be + * effective, this routine must be called before any other HDF function calls, and must be called each time the + * library is loaded/linked into the application (the first time and after it's been unloaded). + *

+ * This is called by the static initializer, so this should never need to be explicitly called by a Java program. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + private synchronized static native int H5dont_atexit() throws HDF5LibraryException; + + /** + * Turn off error handling By default, the C library prints the error stack of the HDF-5 C library on stdout. This + * behavior may be disabled by calling H5error_off(). + * + * @return a non-negative value if successful + */ + public synchronized static native int H5error_off(); + + /** + * H5garbage_collect collects on all free-lists of all types. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5garbage_collect() throws HDF5LibraryException; + + /** + * H5get_libversion retrieves the major, minor, and release numbers of the version of the HDF library which is + * linked to the application. + * + * @param libversion + * The version information of the HDF library. + * + *

+     *      libversion[0] = The major version of the library.
+     *      libversion[1] = The minor version of the library.
+     *      libversion[2] = The release number of the library.
+     * 
+ * @return a non-negative value if successful, along with the version information. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5get_libversion(int[] libversion) throws HDF5LibraryException; + + public synchronized static native int H5set_free_list_limits(int reg_global_lim, int reg_list_lim, + int arr_global_lim, int arr_list_lim, int blk_global_lim, int blk_list_lim) throws HDF5LibraryException; + + /** + * H5export_dataset is a utility function to save data in a file. + * + * @param file_export_name + * The file name to export data into. + * @param file_name + * The name of the HDF5 file containing the dataset. + * @param object_path + * The full path of the dataset to be exported. + * @param binary_order + * 99 - export data as text. + * 1 - export data as binary Native Order. + * 2 - export data as binary Little Endian. + * 3 - export data as binary Big Endian. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5export_dataset(String file_export_name, String file_name, + String object_path, int binary_order) throws HDF5LibraryException; + + /** + * H5is_library_threadsafe Checks to see if the library was built with thread-safety enabled. + * + * @return true if hdf5 library implements threadsafe + * + **/ + private synchronized static native boolean H5is_library_threadsafe(); + + // /////// unimplemented //////// + // H5_DLL herr_t H5free_memory(void *mem); + // H5_DLL void *H5allocate_memory(size_t size, hbool_t clear); + // H5_DLL void *H5resize_memory(void *mem, size_t size); + + // //////////////////////////////////////////////////////////// + // // + // H5A: HDF5 1.8 Attribute Interface API Functions // + // // + // //////////////////////////////////////////////////////////// + + /** + * H5Aclose terminates access to the attribute specified by its identifier, attr_id. + * + * @param attr_id + * IN: Attribute to release access to. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Aclose(long attr_id) throws HDF5LibraryException { + if (attr_id < 0) + return 0; // throw new HDF5LibraryException("Negative ID");; + + log.trace("OPEN_IDS: H5Aclose remove {}", attr_id); + OPEN_IDS.remove(attr_id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + return _H5Aclose(attr_id); + } + + private synchronized static native int _H5Aclose(long attr_id) throws HDF5LibraryException; + + /** + * H5Acopy copies the content of one attribute to another. + * + * @param src_aid + * the identifier of the source attribute + * @param dst_aid + * the identifier of the destination attribute + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native int H5Acopy(long src_aid, long dst_aid) throws HDF5LibraryException; + + /** + * H5Acreate creates an attribute, attr_name, which is attached to the object specified by the identifier loc_id. + * + * @param loc_id + * IN: Location or object identifier; may be dataset or group + * @param attr_name + * IN: Attribute name + * @param type_id + * IN: Attribute datatype identifier + * @param space_id + * IN: Attribute dataspace identifier + * @param acpl_id + * IN: Attribute creation property list identifier + * @param aapl_id + * IN: Attribute access property list identifier + * + * @return An attribute identifier if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - Name is null. + **/ + public static long H5Acreate(long loc_id, String attr_name, long type_id, long space_id, long acpl_id, long aapl_id) + throws HDF5LibraryException, NullPointerException { + long id = _H5Acreate2(loc_id, attr_name, type_id, space_id, acpl_id, aapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5A create add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + /** + * H5Acreate2 an attribute, attr_name, which is attached to the object specified by the identifier loc_id. + * + * @see public static long H5Acreate( long loc_id, String attr_name, long type_id, long space_id, long acpl_id, long + * aapl_id ) + **/ + private synchronized static native long _H5Acreate2(long loc_id, String attr_name, long type_id, long space_id, + long acpl_id, long aapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Acreate_by_name creates an attribute, attr_name, which is attached to the object specified by loc_id and + * obj_name. + * + * @param loc_id + * IN: Location or object identifier; may be dataset or group + * @param obj_name + * IN: Name, relative to loc_id, of object that attribute is to be attached to + * @param attr_name + * IN: Attribute name + * @param type_id + * IN: Attribute datatype identifier + * @param space_id + * IN: Attribute dataspace identifier + * @param acpl_id + * IN: Attribute creation property list identifier (currently not used). + * @param aapl_id + * IN: Attribute access property list identifier (currently not used). + * @param lapl_id + * IN: Link access property list + * + * @return An attribute identifier if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static long H5Acreate_by_name(long loc_id, String obj_name, String attr_name, long type_id, long space_id, + long acpl_id, long aapl_id, long lapl_id) throws HDF5LibraryException, NullPointerException { + long id = _H5Acreate_by_name(loc_id, obj_name, attr_name, type_id, space_id, acpl_id, aapl_id, lapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Acreate_by_name add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Acreate_by_name(long loc_id, String obj_name, String attr_name, + long type_id, long space_id, long acpl_id, long aapl_id, long lapl_id) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Adelete removes the attribute specified by its name, name, from a dataset, group, or named datatype. + * + * @param loc_id + * IN: Identifier of the dataset, group, or named datatype. + * @param name + * IN: Name of the attribute to delete. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native int H5Adelete(long loc_id, String name) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Adelete_by_idx removes an attribute, specified by its location in an index, from an object. + * + * @param loc_id + * IN: Location or object identifier; may be dataset or group + * @param obj_name + * IN: Name of object, relative to location, from which attribute is to be removed + * @param idx_type + * IN: Type of index + * @param order + * IN: Order in which to iterate over index + * @param n + * IN: Offset within index + * @param lapl_id + * IN: Link access property list identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - obj_name is null. + **/ + public synchronized static native void H5Adelete_by_idx(long loc_id, String obj_name, int idx_type, int order, + long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Adelete_by_name removes the attribute attr_name from an object specified by location and name, loc_id and + * obj_name, respectively. + * + * @param loc_id + * IN: Location or object identifier; may be dataset or group + * @param obj_name + * IN: Name of object, relative to location, from which attribute is to be removed + * @param attr_name + * IN: Name of attribute to delete + * @param lapl_id + * IN: Link access property list identifier. + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native int H5Adelete_by_name(long loc_id, String obj_name, String attr_name, long lapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Aexists determines whether the attribute attr_name exists on the object specified by obj_id. + * + * @param obj_id + * IN: Object identifier. + * @param attr_name + * IN: Name of the attribute. + * + * @return boolean true if an attribute with a given name exists. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - attr_name is null. + **/ + public synchronized static native boolean H5Aexists(long obj_id, String attr_name) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Aexists_by_name determines whether the attribute attr_name exists on an object. That object is specified by its + * location and name, loc_id and obj_name, respectively. + * + * @param loc_id + * IN: Location of object to which attribute is attached . + * @param obj_name + * IN: Name, relative to loc_id, of object that attribute is attached to. + * @param attr_name + * IN: Name of attribute. + * @param lapl_id + * IN: Link access property list identifier. + * + * @return boolean true if an attribute with a given name exists, otherwise returns false. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native boolean H5Aexists_by_name(long loc_id, String obj_name, String attr_name, + long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Aget_info retrieves attribute information, by attribute identifier. + * + * @param attr_id + * IN: Attribute identifier + * + * @return A buffer(H5A_info_t) for Attribute information + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native H5A_info_t H5Aget_info(long attr_id) throws HDF5LibraryException; + + /** + * H5Aget_info_by_idx Retrieves attribute information, by attribute index position. + * + * @param loc_id + * IN: Location of object to which attribute is attached + * @param obj_name + * IN: Name of object to which attribute is attached, relative to location + * @param idx_type + * IN: Type of index + * @param order + * IN: Index traversal order + * @param n + * IN: Attribute's position in index + * @param lapl_id + * IN: Link access property list + * + * @return A buffer(H5A_info_t) for Attribute information + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - obj_name is null. + **/ + public synchronized static native H5A_info_t H5Aget_info_by_idx(long loc_id, String obj_name, int idx_type, + int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Aget_info_by_name Retrieves attribute information, by attribute name. + * + * @param loc_id + * IN: Location of object to which attribute is attached + * @param obj_name + * IN: Name of object to which attribute is attached, relative to location + * @param attr_name + * IN: Attribute name + * @param lapl_id + * IN: Link access property list + * + * @return A buffer(H5A_info_t) for Attribute information + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - obj_name is null. + **/ + public synchronized static native H5A_info_t H5Aget_info_by_name(long loc_id, String obj_name, String attr_name, + long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Aget_name retrieves the name of an attribute specified by the identifier, attr_id. + * + * @param attr_id + * IN: Identifier of the attribute. + * + * @return String for Attribute name. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native String H5Aget_name(long attr_id) + throws HDF5LibraryException; + + /** + * H5Aget_name_by_idx retrieves the name of an attribute that is attached to an object, which is specified by its + * location and name, loc_id and obj_name, respectively. + * + * @param attr_id + * IN: Attribute identifier + * @param obj_name + * IN: Name of object to which attribute is attached, relative to location + * @param idx_type + * IN: Type of index + * @param order + * IN: Index traversal order + * @param n + * IN: Attribute's position in index + * @param lapl_id + * IN: Link access property list + * + * @return String for Attribute name. + * + * @exception HDF5LibraryException + * - Error from the HDF5 Library. + * @exception NullPointerException + * - obj_name is null. + **/ + public synchronized static native String H5Aget_name_by_idx(long attr_id, String obj_name, int idx_type, int order, + long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Aget_space retrieves a copy of the dataspace for an attribute. + * + * @param attr_id + * IN: Identifier of an attribute. + * + * @return attribute dataspace identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Aget_space(long attr_id) throws HDF5LibraryException { + long id = _H5Aget_space(attr_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Aget_space add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Aget_space(long attr_id) throws HDF5LibraryException; + + /** + * H5Aget_storage_size returns the amount of storage that is required for the specified attribute, attr_id. + * + * @param attr_id + * IN: Identifier of the attribute to query. + * + * @return the amount of storage size allocated for the attribute; otherwise returns 0 (zero) + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Aget_storage_size(long attr_id) throws HDF5LibraryException; + + /** + * H5Aget_type retrieves a copy of the datatype for an attribute. + * + * @param attr_id + * IN: Identifier of an attribute. + * + * @return a datatype identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Aget_type(long attr_id) throws HDF5LibraryException { + long id = _H5Aget_type(attr_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Aget_type add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Aget_type(long attr_id) throws HDF5LibraryException; + + /** + * H5Aopen opens an existing attribute, attr_name, that is attached to an object specified an object identifier, + * object_id. + * + * @param obj_id + * IN: Identifier for object to which attribute is attached + * @param attr_name + * IN: Name of attribute to open + * @param aapl_id + * IN: Attribute access property list identifier + * + * @return An attribute identifier if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - Name is null. + **/ + public static long H5Aopen(long obj_id, String attr_name, long aapl_id) throws HDF5LibraryException, + NullPointerException { + long id = _H5Aopen(obj_id, attr_name, aapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Aopen add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Aopen(long obj_id, String attr_name, long aapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Aopen_by_idx opens an existing attribute that is attached to an object specified by location and name, loc_id + * and obj_name, respectively + * + * @param loc_id + * IN: Location of object to which attribute is attached + * @param obj_name + * IN: Name of object to which attribute is attached, relative to location + * @param idx_type + * IN: Type of index + * @param order + * IN: Index traversal order + * @param n + * IN: Attribute's position in index + * @param aapl_id + * IN: Attribute access property list + * @param lapl_id + * IN: Link access property list + * + * @return An attribute identifier if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - Name is null. + **/ + public static long H5Aopen_by_idx(long loc_id, String obj_name, int idx_type, int order, long n, long aapl_id, + long lapl_id) throws HDF5LibraryException, NullPointerException { + long id = _H5Aopen_by_idx(loc_id, obj_name, idx_type, order, n, aapl_id, lapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Aopen_by_idx add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Aopen_by_idx(long loc_id, String obj_name, int idx_type, int order, + long n, long aapl_id, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Aopen_by_name Opens an attribute for an object by object name and attribute name + * + * @param loc_id + * IN: Location from which to find object to which attribute is attached + * @param obj_name + * IN: Name of object to which attribute is attached, relative to loc_id + * @param attr_name + * IN: Name of attribute to open + * @param aapl_id + * IN: Attribute access property list + * @param lapl_id + * IN: Link access property list identifier + * + * @return Returns an attribute identifier if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - obj_name is null. + **/ + public static long H5Aopen_by_name(long loc_id, String obj_name, String attr_name, long aapl_id, long lapl_id) + throws HDF5LibraryException, NullPointerException { + long id = _H5Aopen_by_name(loc_id, obj_name, attr_name, aapl_id, lapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Aopen_by_name add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Aopen_by_name(long loc_id, String obj_name, String attr_name, + long aapl_id, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Aread reads an attribute, specified with attr_id. The attribute's memory datatype is specified with + * mem_type_id. The entire attribute is read into buf from the file. + * + * @param attr_id + * IN: Identifier of an attribute to read. + * @param mem_type_id + * IN: Identifier of the attribute datatype (in memory). + * @param buf + * IN: Buffer for data to be read. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - data buffer is null. + **/ + public synchronized static native int H5Aread(long attr_id, long mem_type_id, byte[] buf) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Aread reads an attribute, specified with attr_id. The attribute's memory datatype is specified with + * mem_type_id. The entire attribute is read into data object from the file. + * + * @param attr_id + * IN: Identifier of an attribute to read. + * @param mem_type_id + * IN: Identifier of the attribute datatype (in memory). + * @param obj + * IN: Object for data to be read. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - data buffer is null. See public synchronized static native int H5Aread( ) + **/ + public synchronized static int H5Aread(long attr_id, long mem_type_id, Object obj) throws HDF5Exception, + NullPointerException { + HDFArray theArray = new HDFArray(obj); + byte[] buf = theArray.emptyBytes(); + + // This will raise an exception if there is an error + int status = H5Aread(attr_id, mem_type_id, buf); + + // No exception: status really ought to be OK + if (status >= 0) { + obj = theArray.arrayify(buf); + } + + return status; + } + + public synchronized static native int H5AreadVL(long attr_id, long mem_type_id, String[] buf) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Arename changes the name of attribute that is attached to the object specified by loc_id. The attribute named + * old_attr_name is renamed new_attr_name. + * + * @param loc_id + * IN: Location or object identifier; may be dataset or group + * @param old_attr_name + * IN: Prior attribute name + * @param new_attr_name + * IN: New attribute name + * + * @return A non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - Name is null. + **/ + public synchronized static native int H5Arename(long loc_id, String old_attr_name, String new_attr_name) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Arename_by_name changes the name of attribute that is attached to the object specified by loc_id and obj_name. + * The attribute named old_attr_name is renamed new_attr_name. + * + * @param loc_id + * IN: Location or object identifier; may be dataset or group + * @param obj_name + * IN: Name of object, relative to location, whose attribute is to be renamed + * @param old_attr_name + * IN: Prior attribute name + * @param new_attr_name + * IN: New attribute name + * @param lapl_id + * IN: Link access property list + * + * @return A non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - Name is null. + **/ + public synchronized static native int H5Arename_by_name(long loc_id, String obj_name, String old_attr_name, + String new_attr_name, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Awrite writes an attribute, specified with attr_id. The attribute's memory datatype is specified with + * mem_type_id. The entire attribute is written from buf to the file. + * + * @param attr_id + * IN: Identifier of an attribute to write. + * @param mem_type_id + * IN: Identifier of the attribute datatype (in memory). + * @param buf + * IN: Data to be written. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - data is null. + **/ + public synchronized static native int H5Awrite(long attr_id, long mem_type_id, byte[] buf) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Awrite writes an attribute, specified with attr_id. The attribute's memory datatype is specified with + * mem_type_id. The entire attribute is written from data object to the file. + * + * @param attr_id + * IN: Identifier of an attribute to write. + * @param mem_type_id + * IN: Identifier of the attribute datatype (in memory). + * @param obj + * IN: Data object to be written. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - data object is null. See public synchronized static native int H5Awrite(int attr_id, int + * mem_type_id, byte[] buf); + **/ + public synchronized static int H5Awrite(long attr_id, long mem_type_id, Object obj) + throws HDF5Exception, NullPointerException + { + HDFArray theArray = new HDFArray(obj); + byte[] buf = theArray.byteify(); + + int retVal = H5Awrite(attr_id, mem_type_id, buf); + buf = null; + theArray = null; + return retVal; + } + + public synchronized static native int H5AwriteVL(long attr_id, long mem_type_id, String[] buf) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Aget_create_plist retrieves a copy of the attribute creation property list identifier. + * + * @param attr_id + * IN: Identifier of an attribute. + * + * @return identifier for the attribute's creation property list if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Aget_create_plist(long attr_id) + throws HDF5LibraryException + { + long id = _H5Aget_create_plist(attr_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Aget_create_plist add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Aget_create_plist(long attr_id) throws HDF5LibraryException; + + /** + * H5Aiterate2 iterates over the attributes attached to a dataset, named datatype, or group, as + * specified by obj_id. For each attribute, user-provided data, op_data, with additional information + * as defined below, is passed to a user-defined function, op, which operates on that attribute. + * + * @param loc_id + * IN: Identifier for object to which attributes are attached; may be group, dataset, or named datatype. + * @param idx_type + * IN: The type of index specified by idx_type can be one of the following: + * H5_INDEX_NAME An alpha-numeric index by attribute name. + * H5_INDEX_CRT_ORDER An index by creation order. + * @param order + * IN: The order in which the index is to be traversed, as specified by order, can be one of the following: + * H5_ITER_INC Iteration is from beginning to end, i.e., a top-down iteration + * incrementing the index position at each step. + * H5_ITER_DEC Iteration starts at the end of the index, i.e., a bottom-up iteration + * decrementing the index position at each step. + * H5_ITER_NATIVE HDF5 iterates in the fastest-available order. No information is provided + * as to the order, but HDF5 ensures that each element in the index will be + * visited if the iteration completes successfully. + * @param idx + * IN/OUT: Initial and returned offset within index. + * @param op + * IN: Callback function to operate on each value. + * @param op_data + * IN/OUT: Pointer to any user-efined data for use by operator function. + * + * @return returns the return value of the first operator that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - buf is null. + **/ + public synchronized static native int H5Aiterate(long loc_id, int idx_type, int order, long idx, + H5A_iterate_cb op, H5A_iterate_t op_data) throws HDF5LibraryException, NullPointerException; + + /** + * H5Aiterate_by_name iterates over the attributes attached to the dataset or group specified with loc_id + * and obj_name. For each attribute, user-provided data, op_data, with additional information as defined + * below, is passed to a user-defined function, op, which operates on that attribute. + * + * @param loc_id + * IN: Identifier for object to which attributes are attached; may be group, dataset, or named datatype. + * @param obj_name + * IN: Name of object, relative to location. + * @param idx_type + * IN: The type of index specified by idx_type can be one of the following: + * H5_INDEX_NAME An alpha-numeric index by attribute name. + * H5_INDEX_CRT_ORDER An index by creation order. + * @param order + * IN: The order in which the index is to be traversed, as specified by order, can be one of the following: + * H5_ITER_INC Iteration is from beginning to end, i.e., a top-down iteration + * incrementing the index position at each step. + * H5_ITER_DEC Iteration starts at the end of the index, i.e., a bottom-up iteration + * decrementing the index position at each step. + * H5_ITER_NATIVE HDF5 iterates in the fastest-available order. No information is provided + * as to the order, but HDF5 ensures that each element in the index will be + * visited if the iteration completes successfully. + * @param idx + * IN/OUT: Initial and returned offset within index. + * @param op + * IN: Callback function to operate on each value. + * @param op_data + * IN/OUT: Pointer to any user-efined data for use by operator function. + * @param lapl_id + * IN: Link access property list + * + * @return returns the return value of the first operator that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - buf is null. + **/ + public synchronized static native int H5Aiterate_by_name(long loc_id, String obj_name, int idx_type, + int order, long idx, H5A_iterate_cb op, H5A_iterate_t op_data, long lapl_id) throws HDF5LibraryException, NullPointerException; + + // //////////////////////////////////////////////////////////// + // // + // H5D: Datasets Interface Functions // + // // + // //////////////////////////////////////////////////////////// + + /** + * H5Dcopy copies the content of one dataset to another dataset. + * + * @param src_did + * the identifier of the source dataset + * @param dst_did + * the identifier of the destinaiton dataset + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native int H5Dcopy(long src_did, long dst_did) throws HDF5LibraryException; + + /** + * H5Dclose ends access to a dataset specified by dataset_id and releases resources used by it. + * + * @param dataset_id + * Identifier of the dataset to finish access to. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Dclose(long dataset_id) throws HDF5LibraryException { + if (dataset_id < 0) + return 0; // throw new HDF5LibraryException("Negative ID"); + + log.trace("OPEN_IDS: H5Dclose remove {}", dataset_id); + OPEN_IDS.remove(dataset_id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + return _H5Dclose(dataset_id); + } + + private synchronized static native int _H5Dclose(long dataset_id) throws HDF5LibraryException; + + /** + * H5Dcreate creates a new dataset named name at the location specified by loc_id. + * + * @param loc_id + * IN: Location identifier + * @param name + * IN: Dataset name + * @param type_id + * IN: Datatype identifier + * @param space_id + * IN: Dataspace identifier + * @param lcpl_id + * IN: Identifier of link creation property list. + * @param dcpl_id + * IN: Identifier of dataset creation property list. + * @param dapl_id + * IN: Identifier of dataset access property list. + * + * @return a dataset identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static long H5Dcreate(long loc_id, String name, long type_id, long space_id, long lcpl_id, long dcpl_id, + long dapl_id) throws HDF5LibraryException, NullPointerException { + long id = _H5Dcreate2(loc_id, name, type_id, space_id, lcpl_id, dcpl_id, dapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Dcreate add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + /** + * H5Dcreate2 creates a new dataset named name at the location specified by loc_id. + * + * @see public static int H5Dcreate(int loc_id, String name, int type_id, int space_id, int lcpl_id, int dcpl_id, + * int dapl_id) + **/ + private synchronized static native long _H5Dcreate2(long loc_id, String name, long type_id, long space_id, + long lcpl_id, long dcpl_id, long dapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Dcreate_anon creates a dataset in the file specified by loc_id. + * + * @param loc_id + * IN: Location identifier + * @param type_id + * IN: Datatype identifier + * @param space_id + * IN: Dataspace identifier + * @param dcpl_id + * IN: Identifier of dataset creation property list. + * @param dapl_id + * IN: Identifier of dataset access property list. + * + * @return a dataset identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Dcreate_anon(long loc_id, long type_id, long space_id, long dcpl_id, long dapl_id) + throws HDF5LibraryException { + long id = _H5Dcreate_anon(loc_id, type_id, space_id, dcpl_id, dapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Dcreate_anon add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Dcreate_anon(long loc_id, long type_id, long space_id, long dcpl_id, + long dapl_id) throws HDF5LibraryException; + + /** + * H5Dfill explicitly fills the dataspace selection in memory, space_id, with the fill value specified in fill. + * + * @param fill + * IN: Pointer to the fill value to be used. + * @param fill_type + * IN: Fill value datatype identifier. + * @param buf + * IN/OUT: Pointer to the memory buffer containing the selection to be filled. + * @param buf_type + * IN: Datatype of dataspace elements to be filled. + * @param space_id + * IN: Dataspace describing memory buffer and containing the selection to be filled. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - buf is null. + **/ + public synchronized static native void H5Dfill(byte[] fill, long fill_type, byte[] buf, long buf_type, long space_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Dget_access_plist returns an identifier for a copy of the dataset access property list for a dataset. + * + * @param dset_id + * IN: Identifier of the dataset to query. + * + * @return a dataset access property list identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Dget_access_plist(long dset_id) throws HDF5LibraryException; + + /** + * H5Dget_create_plist returns an identifier for a copy of the dataset creation property list for a dataset. + * + * @param dataset_id + * Identifier of the dataset to query. + * @return a dataset creation property list identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Dget_create_plist(long dataset_id) throws HDF5LibraryException { + long id = _H5Dget_create_plist(dataset_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Dget_create_plist add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Dget_create_plist(long dataset_id) throws HDF5LibraryException; + + /** + * H5Dget_offset returns the address in the file of the dataset dset_id. + * + * @param dset_id + * IN: Identifier of the dataset in question + * + * @return the offset in bytes. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Dget_offset(long dset_id) throws HDF5LibraryException; + + /** + * H5Dget_space returns an identifier for a copy of the dataspace for a dataset. + * + * @param dataset_id + * Identifier of the dataset to query. + * + * @return a dataspace identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Dget_space(long dataset_id) throws HDF5LibraryException { + long id = _H5Dget_space(dataset_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Dget_space add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Dget_space(long dataset_id) throws HDF5LibraryException; + + /** + * H5Dget_space_status determines whether space has been allocated for the dataset dset_id. + * + * @param dset_id + * IN: Identifier of the dataset to query. + * + * @return the space allocation status + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Dget_space_status(long dset_id) throws HDF5LibraryException; + + /** + * H5Dget_storage_size returns the amount of storage that is required for the dataset. + * + * @param dataset_id + * Identifier of the dataset in question + * + * @return he amount of storage space allocated for the dataset. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Dget_storage_size(long dataset_id) throws HDF5LibraryException, + IllegalArgumentException; + + /** + * H5Dget_type returns an identifier for a copy of the datatype for a dataset. + * + * @param dataset_id + * Identifier of the dataset to query. + * + * @return a datatype identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Dget_type(long dataset_id) throws HDF5LibraryException { + long id = _H5Dget_type(dataset_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Dget_type add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Dget_type(long dataset_id) throws HDF5LibraryException; + + /** + * H5Diterate iterates over all the data elements in the memory buffer buf, executing the callback function operator + * once for each such data element. + * + * @param buf + * IN/OUT: Pointer to the memory containing the elements to iterate over. + * @param buf_type + * IN: Buffer datatype identifier. + * @param space_id + * IN: Dataspace describing memory buffer. + * @param op + * IN: Callback function to operate on each value. + * @param op_data + * IN/OUT: Pointer to any user-efined data for use by operator function. + * + * @return returns the return value of the first operator that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - buf is null. + **/ + public synchronized static native int H5Diterate(byte[] buf, long buf_type, long space_id, H5D_iterate_cb op, + H5D_iterate_t op_data) throws HDF5LibraryException, NullPointerException; + + /** + * H5Dopen opens the existing dataset specified by a location identifier and name, loc_id and name, respectively. + * + * @param loc_id + * IN: Location identifier + * @param name + * IN: Dataset name + * @param dapl_id + * IN: Identifier of dataset access property list. + * + * @return a dataset identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static long H5Dopen(long loc_id, String name, long dapl_id) throws HDF5LibraryException, + NullPointerException { + long id = _H5Dopen2(loc_id, name, dapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Dopen add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + /** + * H5Dopen2 opens the existing dataset specified by a location identifier and name, loc_id and name, respectively. + * + * @see public static int H5Dopen(int loc_id, String name, int dapl_id) + **/ + private synchronized static native long _H5Dopen2(long loc_id, String name, long dapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the application + * memory buffer buf. + * + * @param dataset_id + * Identifier of the dataset read from. + * @param mem_type_id + * Identifier of the memory datatype. + * @param mem_space_id + * Identifier of the memory dataspace. + * @param file_space_id + * Identifier of the dataset's dataspace in the file. + * @param xfer_plist_id + * Identifier of a transfer property list for this I/O operation. + * @param obj + * Buffer to store data read from the file. + * @param isCriticalPinning + * request lock on data reference. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - data buffer is null. + **/ + public synchronized static native int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, byte[] obj, boolean isCriticalPinning) throws HDF5LibraryException, + NullPointerException; + + public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, + long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException { + return H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); + } + + public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, + long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException { + return H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, obj, true); + } + + /** + * H5Dread reads a (partial) dataset, specified by its identifier dataset_id, from the file into the application + * data object. + * + * @param dataset_id + * Identifier of the dataset read from. + * @param mem_type_id + * Identifier of the memory datatype. + * @param mem_space_id + * Identifier of the memory dataspace. + * @param file_space_id + * Identifier of the dataset's dataspace in the file. + * @param xfer_plist_id + * Identifier of a transfer property list for this I/O operation. + * @param obj + * Object to store data read from the file. + * @param isCriticalPinning + * request lock on data reference. + * + * @return a non-negative value if successful + * + * @exception HDF5Exception + * - Failure in the data conversion. + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - data object is null. + **/ + public synchronized static int H5Dread(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, + long xfer_plist_id, Object obj, boolean isCriticalPinning) throws HDF5Exception, HDF5LibraryException, + NullPointerException { + int status = -1; + boolean is1D = false; + + Class dataClass = obj.getClass(); + if (!dataClass.isArray()) { + throw (new HDF5JavaException("H5Dread: data is not an array")); + } + + String cname = dataClass.getName(); + is1D = (cname.lastIndexOf('[') == cname.indexOf('[')); + char dname = cname.charAt(cname.lastIndexOf("[") + 1); + log.trace("H5Dread: cname={} is1D={} dname={}", cname, is1D, dname); + + if (is1D && (dname == 'B')) { + log.trace("H5Dread_dname_B"); + status = H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (byte[]) obj, + isCriticalPinning); + } + else if (is1D && (dname == 'S')) { + log.trace("H5Dread_dname_S"); + status = H5Dread_short(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (short[]) obj, + isCriticalPinning); + } + else if (is1D && (dname == 'I')) { + log.trace("H5Dread_dname_I"); + status = H5Dread_int(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (int[]) obj, + isCriticalPinning); + } + else if (is1D && (dname == 'J')) { + log.trace("H5Dread_dname_J"); + status = H5Dread_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (long[]) obj); + } + else if (is1D && (dname == 'F')) { + log.trace("H5Dread_dname_F"); + status = H5Dread_float(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (float[]) obj, + isCriticalPinning); + } + else if (is1D && (dname == 'D')) { + log.trace("H5Dread_dname_D"); + status = H5Dread_double(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, + (double[]) obj, isCriticalPinning); + } + else if (H5.H5Tequal(mem_type_id, HDF5Constants.H5T_STD_REF_DSETREG)) { + log.trace("H5Dread_reg_ref"); + status = H5Dread_reg_ref(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, + (String[]) obj); + } + else if (is1D && (dataClass.getComponentType() == String.class)) { + log.trace("H5Dread_string type"); + if (H5.H5Tis_variable_str(mem_type_id)) { + status = H5Dread_VLStrings(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (Object[]) obj); + } + else { + status = H5Dread_string(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, + (String[]) obj); + } + } + else { + // Create a data buffer to hold the data into a Java Array + HDFArray theArray = new HDFArray(obj); + byte[] buf = theArray.emptyBytes(); + log.trace("H5Dread_else"); + + // will raise exception if read fails + status = H5Dread(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, + isCriticalPinning); + if (status >= 0) { + // convert the data into a Java Array */ + obj = theArray.arrayify(buf); + } + + // clean up these: assign 'null' as hint to gc() + buf = null; + theArray = null; + } + + return status; + } + + public synchronized static native int H5Dread_double(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, double[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Dread_double(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException { + return H5Dread_double(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); + } + + public synchronized static native int H5Dread_float(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, float[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Dread_float(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException { + return H5Dread_float(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); + } + + public synchronized static native int H5Dread_int(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, int[] buf, boolean isCriticalPinning) throws HDF5LibraryException, + NullPointerException; + + public synchronized static int H5Dread_int(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException { + return H5Dread_int(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); + } + + public synchronized static native int H5Dread_long(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, long[] buf, boolean isCriticalPinning) throws HDF5LibraryException, + NullPointerException; + + public synchronized static int H5Dread_long(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException { + return H5Dread_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); + } + + public synchronized static native int H5Dread_reg_ref(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, String[] buf) throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Dread_reg_ref_data(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, String[] buf) throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Dread_short(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, short[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Dread_short(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException { + return H5Dread_short(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); + } + + public synchronized static native int H5Dread_string(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, String[] buf) throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Dread_VLStrings(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, Object[] buf) throws HDF5LibraryException, NullPointerException; + + /** + * H5Dset_extent sets the current dimensions of the chunked dataset dset_id to the sizes specified in size. + * + * @param dset_id + * IN: Chunked dataset identifier. + * @param size + * IN: Array containing the new magnitude of each dimension of the dataset. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - size is null. + **/ + public synchronized static native void H5Dset_extent(long dset_id, long size[]) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Dvlen_get_buf_size determines the number of bytes required to store the VL data from the dataset, using the + * space_id for the selection in the dataset on disk and the type_id for the memory representation of the VL data in + * memory. + * + * @param dset_id + * IN: Identifier of the dataset read from. + * @param type_id + * IN: Identifier of the datatype. + * @param space_id + * IN: Identifier of the dataspace. + * + * @return the size in bytes of the memory buffer required to store the VL data. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - buf is null. + **/ + public synchronized static native long H5Dvlen_get_buf_size(long dset_id, long type_id, long space_id) + throws HDF5LibraryException; + + /** + * H5Dvlen_reclaim reclaims buffer used for VL data. + * + * @param type_id + * Identifier of the datatype. + * @param space_id + * Identifier of the dataspace. + * @param xfer_plist_id + * Identifier of a transfer property list for this I/O operation. + * @param buf + * Buffer with data to be reclaimed. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - buf is null. + **/ + public synchronized static native int H5Dvlen_reclaim(long type_id, long space_id, long xfer_plist_id, byte[] buf) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application memory buffer + * buf into the file. + * + * @param dataset_id + * Identifier of the dataset read from. + * @param mem_type_id + * Identifier of the memory datatype. + * @param mem_space_id + * Identifier of the memory dataspace. + * @param file_space_id + * Identifier of the dataset's dataspace in the file. + * @param xfer_plist_id + * Identifier of a transfer property list for this I/O operation. + * @param buf + * Buffer with data to be written to the file. + * @param isCriticalPinning + * request lock on data reference. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, byte[] buf, boolean isCriticalPinning) throws HDF5LibraryException, + NullPointerException; + + public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, + long xfer_plist_id, byte[] buf) throws HDF5LibraryException, NullPointerException { + return H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); + } + + public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, + long xfer_plist_id, Object obj) throws HDF5Exception, HDF5LibraryException, NullPointerException { + return H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, obj, true); + } + + /** + * H5Dwrite writes a (partial) dataset, specified by its identifier dataset_id, from the application memory data + * object into the file. + * + * @param dataset_id + * Identifier of the dataset read from. + * @param mem_type_id + * Identifier of the memory datatype. + * @param mem_space_id + * Identifier of the memory dataspace. + * @param file_space_id + * Identifier of the dataset's dataspace in the file. + * @param xfer_plist_id + * Identifier of a transfer property list for this I/O operation. + * @param obj + * Object with data to be written to the file. + * @param isCriticalPinning + * request lock on data reference. + * + * @return a non-negative value if successful + * + * @exception HDF5Exception + * - Failure in the data conversion. + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - data object is null. + **/ + public synchronized static int H5Dwrite(long dataset_id, long mem_type_id, long mem_space_id, long file_space_id, + long xfer_plist_id, Object obj, boolean isCriticalPinning) throws HDF5Exception, HDF5LibraryException, + NullPointerException { + int status = -1; + boolean is1D = false; + + Class dataClass = obj.getClass(); + if (!dataClass.isArray()) { + throw (new HDF5JavaException("H5Dread: data is not an array")); + } + + String cname = dataClass.getName(); + is1D = (cname.lastIndexOf('[') == cname.indexOf('[')); + char dname = cname.charAt(cname.lastIndexOf("[") + 1); + + if (is1D && (dname == 'B')) { + status = H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (byte[]) obj, + isCriticalPinning); + } + else if (is1D && (dname == 'S')) { + status = H5Dwrite_short(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (short[]) obj, + isCriticalPinning); + } + else if (is1D && (dname == 'I')) { + status = H5Dwrite_int(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (int[]) obj, + isCriticalPinning); + } + else if (is1D && (dname == 'J')) { + status = H5Dwrite_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (long[]) obj, + isCriticalPinning); + } + else if (is1D && (dname == 'F')) { + status = H5Dwrite_float(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (float[]) obj, + isCriticalPinning); + } + else if (is1D && (dname == 'D')) { + status = H5Dwrite_double(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, + (double[]) obj, isCriticalPinning); + } + else if (is1D && (dataClass.getComponentType() == String.class)) { + log.trace("H5Dwrite_string type"); + if (H5.H5Tis_variable_str(mem_type_id)) { + status = H5Dwrite_VLStrings(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, (Object[]) obj); + } + else { + status = H5Dwrite_string(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, + (String[]) obj); + } + } + else { + HDFArray theArray = new HDFArray(obj); + byte[] buf = theArray.byteify(); + + // will raise exception on error + status = H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, + isCriticalPinning); + + // clean up these: assign 'null' as hint to gc() + buf = null; + theArray = null; + } + + return status; + } + + public synchronized static native int H5Dwrite_double(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, double[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Dwrite_double(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, double[] buf) throws HDF5LibraryException, NullPointerException { + return H5Dwrite_double(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); + } + + public synchronized static native int H5Dwrite_float(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, float[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Dwrite_float(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, float[] buf) throws HDF5LibraryException, NullPointerException { + return H5Dwrite_float(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); + } + + public synchronized static native int H5Dwrite_int(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, int[] buf, boolean isCriticalPinning) throws HDF5LibraryException, + NullPointerException; + + public synchronized static int H5Dwrite_int(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, int[] buf) throws HDF5LibraryException, NullPointerException { + return H5Dwrite_int(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); + } + + public synchronized static native int H5Dwrite_long(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, long[] buf, boolean isCriticalPinning) throws HDF5LibraryException, + NullPointerException; + + public synchronized static int H5Dwrite_long(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, long[] buf) throws HDF5LibraryException, NullPointerException { + return H5Dwrite_long(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); + } + + public synchronized static native int H5Dwrite_short(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, short[] buf, boolean isCriticalPinning) + throws HDF5LibraryException, NullPointerException; + + public synchronized static int H5Dwrite_short(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, short[] buf) throws HDF5LibraryException, NullPointerException { + return H5Dwrite_short(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, buf, true); + } + + public synchronized static native int H5Dwrite_string(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, String[] buf) throws HDF5LibraryException, NullPointerException; + + /** + * H5Dwrite_VLStrings writes a (partial) variable length String dataset, specified by its identifier dataset_id, from + * the application memory buffer buf into the file. + * + * ---- contributed by Rosetta Biosoftware + * + * @param dataset_id + * Identifier of the dataset read from. + * @param mem_type_id + * Identifier of the memory datatype. + * @param mem_space_id + * Identifier of the memory dataspace. + * @param file_space_id + * Identifier of the dataset's dataspace in the file. + * @param xfer_plist_id + * Identifier of a transfer property list for this I/O operation. + * @param buf + * Buffer with data to be written to the file. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + + public synchronized static native int H5Dwrite_VLStrings(long dataset_id, long mem_type_id, long mem_space_id, + long file_space_id, long xfer_plist_id, Object[] buf) throws HDF5LibraryException, NullPointerException; + + // /////// unimplemented //////// + // H5_DLL herr_t H5Ddebug(hid_t dset_id); + // herr_t H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id, + // size_t dst_buf_size, void *dst_buf, H5D_gather_func_t op, void *op_data); + // herr_t H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, hid_t dst_space_id, void *dst_buf); + + // //////////////////////////////////////////////////////////// + // // + // H5E: Error Stack // + // // + // //////////////////////////////////////////////////////////// + + /** + * H5Eauto_is_v2 determines whether the error auto reporting function for an error stack conforms to the H5E_auto2_t + * typedef or the H5E_auto1_t typedef. + * + * @param stack_id + * IN: Error stack identifier. + * + * @return boolean true if the error stack conforms to H5E_auto2_t and false if it conforms to H5E_auto1_t. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Eauto_is_v2(long stack_id) throws HDF5LibraryException; + + /** + * H5Eclear clears the error stack for the current thread. H5Eclear can fail if there are problems initializing the + * library. + *

+ * This may be used by exception handlers to assure that the error condition in the HDF-5 library has been reset. + * + * @return Returns a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Eclear() throws HDF5LibraryException { + H5Eclear2(HDF5Constants.H5E_DEFAULT); + return 0; + } + + /** + * H5Eclear clears the error stack specified by estack_id, or, if estack_id is set to H5E_DEFAULT, the error stack + * for the current thread. + * + * @param stack_id + * IN: Error stack identifier. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static void H5Eclear(long stack_id) throws HDF5LibraryException { + H5Eclear2(stack_id); + } + + /** + * H5Eclear2 clears the error stack specified by estack_id, or, if estack_id is set to H5E_DEFAULT, the error stack + * for the current thread. + * + * @param stack_id + * IN: Error stack identifier. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Eclear2(long stack_id) throws HDF5LibraryException; + + /** + * H5Eclose_msg closes an error message identifier, which can be either a major or minor message. + * + * @param err_id + * IN: Error message identifier. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Eclose_msg(long err_id) throws HDF5LibraryException; + + /** + * H5Eclose_stack closes the object handle for an error stack and releases its resources. + * + * @param stack_id + * IN: Error stack identifier. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Eclose_stack(long stack_id) throws HDF5LibraryException; + + /** + * H5Ecreate_msg adds an error message to an error class defined by client library or application program. + * + * @param cls_id + * IN: Error class identifier. + * @param msg_type + * IN: The type of the error message. + * @param msg + * IN: The error message. + * + * @return a message identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - msg is null. + **/ + public synchronized static native long H5Ecreate_msg(long cls_id, int msg_type, String msg) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Ecreate_stack creates a new empty error stack and returns the new stack's identifier. + * + * @return an error stack identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Ecreate_stack() throws HDF5LibraryException; + + /** + * H5Eget_class_name retrieves the name of the error class specified by the class identifier. + * + * @param class_id + * IN: Error class identifier. + * + * @return the name of the error class + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native String H5Eget_class_name(long class_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Eget_current_stack copies the current error stack and returns an error stack identifier for the new copy. + * + * @return an error stack identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Eget_current_stack() throws HDF5LibraryException; + + /** + * H5Eset_current_stack replaces the content of the current error stack with a copy of the content of the error + * stack specified by estack_id. + * + * @param stack_id + * IN: Error stack identifier. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Eset_current_stack(long stack_id) throws HDF5LibraryException; + + /** + * H5Eget_msg retrieves the error message including its length and type. + * + * @param msg_id + * IN: Name of the error class. + * @param type_list + * OUT: The type of the error message. Valid values are H5E_MAJOR and H5E_MINOR. + * + * @return the error message + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native String H5Eget_msg(long msg_id, int[] type_list) throws HDF5LibraryException; + + /** + * H5Eget_num retrieves the number of error records in the error stack specified by estack_id (including major, + * minor messages and description). + * + * @param stack_id + * IN: Error stack identifier. + * + * @return the number of error messages + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Eget_num(long stack_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Eprint2 prints the error stack specified by estack_id on the specified stream, stream. + * + * @param stack_id + * IN: Error stack identifier.If the identifier is H5E_DEFAULT, the current error stack will be printed. + * @param stream + * IN: File pointer, or stderr if null. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Eprint2(long stack_id, Object stream) throws HDF5LibraryException; + + /** + * H5Epop deletes the number of error records specified in count from the top of the error stack specified by + * estack_id (including major, minor messages and description). + * + * @param stack_id + * IN: Error stack identifier. + * @param count + * IN: Version of the client library or application to which the error class belongs. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Epop(long stack_id, long count) throws HDF5LibraryException; + + + /** + * H5Epush2 pushes a new error record onto the error stack specified by estack_id. + * + * @param stack_id + * IN: Error stack identifier. + * @param file + * IN: Name of the file in which the error was detected. + * @param func + * IN: Name of the function in which the error was detected. + * @param line + * IN: Line number within the file at which the error was detected. + * @param cls_id + * IN: Error class identifier. + * @param maj_id + * IN: Major error identifier. + * @param min_id + * IN: Minor error identifier. + * @param msg + * IN: Error description string. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - file, func, or msg is null. + **/ + public static void H5Epush(long stack_id, String file, String func, int line, + long cls_id, long maj_id, long min_id, String msg) throws HDF5LibraryException, NullPointerException + { + H5Epush2(stack_id, file, func, line, cls_id, maj_id, min_id, msg); + } + public synchronized static native void H5Epush2(long stack_id, String file, String func, int line, + long cls_id, long maj_id, long min_id, String msg) throws HDF5LibraryException, NullPointerException; + + /** + * H5Eregister_class registers a client library or application program to the HDF5 error API so that the client + * library or application program can report errors together with HDF5 library. + * + * @param cls_name + * IN: Name of the error class. + * @param lib_name + * IN: Name of the client library or application to which the error class belongs. + * @param version + * IN: Version of the client library or application to which the error class belongs. + * + * @return a class identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native long H5Eregister_class(String cls_name, String lib_name, String version) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Eunregister_class removes the error class specified by class_id. + * + * @param class_id + * IN: Error class identifier. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Eunregister_class(long class_id) throws HDF5LibraryException; + + /** + * H5Ewalk walks the error stack specified by estack_id for the current thread and calls the + * function specified in func for each error along the way. + * + * @param stack_id + * IN: Error stack identifier. + * @param direction + * IN: Direction in which the error stack is to be walked. + * @param func + * IN: Function to be called for each error encountered. + * @param client_data + * IN: Data to be passed with func. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - func is null. + **/ + public static void H5Ewalk(long stack_id, long direction, H5E_walk_cb func, H5E_walk_t client_data) throws HDF5LibraryException, NullPointerException + { + H5Ewalk2(stack_id, direction, func, client_data); + } + public synchronized static native void H5Ewalk2(long stack_id, long direction, H5E_walk_cb func, H5E_walk_t client_data) + throws HDF5LibraryException, NullPointerException; + + // /////// unimplemented //////// + // public interface H5E_auto2_t extends Callback + // { + // int callback(int estack, Pointer client_data); + // } + + // int H5Eget_auto(long estack_id, H5E_auto2_t func, PointerByReference client_data); + // { + // return H5Eget_auto2(estack_id, func, client_data); + // } + // int H5Eget_auto2(long estack_id, H5E_auto2_t func, PointerByReference client_data); + + // int H5Eset_auto(long estack_id, H5E_auto2_t func, Pointer client_data); + // { + // return H5Eset_auto2(estack_id, func, client_data); + // } + // int H5Eset_auto2(long estack_id, H5E_auto2_t func, Pointer client_data); + + // public static void H5Epush(long err_stack, String file, String func, int line, + // long cls_id, long maj_id, long min_id, String msg, ...) + // { + // H5Epush2(err_stack, file, func, line, cls_id, maj_id, min_id, msg, ...); + // } + // public synchronized static native void H5Epush2(long err_stack, String file, String func, int line, + // long cls_id, long maj_id, long min_id, String msg, ...); + + // //////////////////////////////////////////////////////////// + // // + // H5F: File Interface Functions // + // // + // //////////////////////////////////////////////////////////// + + /** + * H5Fclose terminates access to an HDF5 file. + * + * @param file_id + * Identifier of a file to terminate access to. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Fclose(long file_id) throws HDF5LibraryException { + if (file_id < 0) + return 0; // throw new HDF5LibraryException("Negative ID");; + + log.trace("OPEN_IDS: H5Fclose remove {}", file_id); + OPEN_IDS.remove(file_id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + return _H5Fclose(file_id); + } + + private synchronized static native int _H5Fclose(long file_id) throws HDF5LibraryException; + + /** + * H5Fopen opens an existing file and is the primary function for accessing existing HDF5 files. + * + * @param name + * Name of the file to access. + * @param flags + * File access flags. + * @param access_id + * Identifier for the file access properties list. + * + * @return a file identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static long H5Fopen(String name, int flags, long access_id) throws HDF5LibraryException, + NullPointerException { + long id = _H5Fopen(name, flags, access_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Fopen add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Fopen(String name, int flags, long access_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Freopen reopens an HDF5 file. + * + * @param file_id + * Identifier of a file to terminate and reopen access to. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @return a new file identifier if successful + **/ + public static long H5Freopen(long file_id) throws HDF5LibraryException { + long id = _H5Freopen(file_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Freopen add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Freopen(long file_id) throws HDF5LibraryException; + + /** + * H5Fcreate is the primary function for creating HDF5 files. + * + * @param name + * Name of the file to access. + * @param flags + * File access flags. Possible values include: + *

    + *
  • + * H5F_ACC_RDWR Allow read and write access to file.
  • + *
  • + * H5F_ACC_RDONLY Allow read-only access to file.
  • + *
  • + * H5F_ACC_TRUNC Truncate file, if it already exists, erasing all data previously stored in the file.
  • + *
  • + * H5F_ACC_EXCL Fail if file already exists.
  • + *
  • + * H5P_DEFAULT Apply default file access and creation properties.
  • + *
+ * + * @param create_id + * File creation property list identifier, used when modifying default file meta-data. Use H5P_DEFAULT + * for default access properties. + * @param access_id + * File access property list identifier. If parallel file access is desired, this is a collective call + * according to the communicator stored in the access_id (not supported in Java). Use H5P_DEFAULT for + * default access properties. + * + * @return a file identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static long H5Fcreate(String name, int flags, long create_id, long access_id) throws HDF5LibraryException, + NullPointerException { + long id = _H5Fcreate(name, flags, create_id, access_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Fcreate add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Fcreate(String name, int flags, long create_id, long access_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Fflush causes all buffers associated with a file or object to be immediately flushed (written) to disk without + * removing the data from the (memory) cache. + *

+ * After this call completes, the file (or object) is in a consistent state and all data written to date is assured + * to be permanent. + * + * @param object_id + * Identifier of object used to identify the file. object_id can be any object associated with the + * file, including the file itself, a dataset, a group, an attribute, or a named data type. + * @param scope + * specifies the scope of the flushing action, in the case that the HDF-5 file is not a single physical + * file. + *

+ * Valid values are: + *

    + *
  • + * H5F_SCOPE_GLOBAL Flushes the entire virtual file.
  • + *
  • + * H5F_SCOPE_LOCAL Flushes only the specified file.
  • + *
+ * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Fflush(long object_id, int scope) throws HDF5LibraryException; + + /** + * H5Fget_access_plist returns the file access property list identifier of the specified file. + * + * @param file_id + * Identifier of file to get access property list of + * + * @return a file access property list identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Fget_access_plist(long file_id) throws HDF5LibraryException { + long id = _H5Fget_access_plist(file_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Fget_access_plist add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Fget_access_plist(long file_id) throws HDF5LibraryException; + + /** + * H5Fget_create_plist returns a file creation property list identifier identifying the creation properties used to + * create this file. + * + * @param file_id + * Identifier of the file to get creation property list + * + * @return a file creation property list identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Fget_create_plist(long file_id) throws HDF5LibraryException { + long id = _H5Fget_create_plist(file_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Fget_create_plist add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Fget_create_plist(long file_id) throws HDF5LibraryException; + + public synchronized static native long H5Fget_filesize(long file_id) throws HDF5LibraryException; + + /** + * H5Fget_freespace returns the amount of space that is unused by any objects in the file. + * + * @param file_id + * IN: File identifier for a currently-open HDF5 file + * + * @return the amount of free space in the file + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Fget_freespace(long file_id) throws HDF5LibraryException; + + /** + * H5Fget_intent retrieves the intended access mode flag passed with H5Fopen when the file was opened. + * + * @param file_id + * IN: File identifier for a currently-open HDF5 file + * + * @return the intended access mode flag, as originally passed with H5Fopen. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Fget_intent(long file_id) throws HDF5LibraryException; + + /** + * H5Fget_mdc_hit_rate queries the metadata cache of the target file to obtain its hit rate (cache hits / (cache + * hits + cache misses)) since the last time hit rate statistics were reset. + * + * @param file_id + * IN: Identifier of the target file. + * + * @return the double in which the hit rate is returned. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native double H5Fget_mdc_hit_rate(long file_id) throws HDF5LibraryException; + + /** + * H5Fget_mdc_size queries the metadata cache of the target file for the desired size information. + * + * @param file_id + * IN: Identifier of the target file. + * @param metadata_cache + * OUT: Current metadata cache information + *
    + *
  • metadata_cache[0] = max_size_ptr // current cache maximum size
  • + *
  • metadata_cache[1] = min_clean_size_ptr // current cache minimum clean size
  • + *
  • metadata_cache[2] = cur_size_ptr // current cache size
  • + *
+ * + * @return current number of entries in the cache + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - metadata_cache is null. + **/ + public synchronized static native int H5Fget_mdc_size(long file_id, long[] metadata_cache) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + + /** + * H5Fget_name retrieves the name of the file to which the object obj_id belongs. + * + * @param obj_id + * IN: Identifier of the object for which the associated filename is sought. + * + * @return the filename. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native String H5Fget_name(long obj_id) throws HDF5LibraryException; + + /** + * H5Fget_obj_count returns the number of open object identifiers for the file. + * + * @param file_id + * IN: File identifier for a currently-open HDF5 file + * @param types + * IN: Type of object for which identifiers are to be returned. + *
    + *
  • H5F_OBJ_FILE Files only
  • + *
  • H5F_OBJ_DATASET Datasets only
  • + *
  • H5F_OBJ_GROUP Groups only
  • + *
  • H5F_OBJ_DATATYPE Named datatypes only
  • + *
  • H5F_OBJ_ATTR Attributes only
  • + *
  • H5F_OBJ_ALL All of the above
  • + *
  • H5F_OBJ_LOCAL Restrict search to objects opened through current file identifier.
  • + *
+ * + * @return the number of open objects. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Fget_obj_count(long file_id, int types) throws HDF5LibraryException; + + /** + * H5Fget_obj_ids returns the list of identifiers for all open HDF5 objects fitting the specified criteria. + * + * @param file_id + * IN: File identifier for a currently-open HDF5 file + * @param types + * IN: Type of object for which identifiers are to be returned. + * @param max_objs + * IN: Maximum number of object identifiers to place into obj_id_list. + * @param obj_id_list + * OUT: Pointer to the returned list of open object identifiers. + * + * @return the number of objects placed into obj_id_list. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - obj_id_list is null. + **/ + public synchronized static native long H5Fget_obj_ids(long file_id, int types, long max_objs, long[] obj_id_list) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Fis_hdf5 determines whether a file is in the HDF5 format. + * + * @param name + * File name to check format. + * + * @return true if is HDF-5, false if not. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native boolean H5Fis_hdf5(String name) throws HDF5LibraryException, NullPointerException; + + /** + * H5Fmount mounts the file specified by child_id onto the group specified by loc_id and name using the mount + * properties plist_id. + * + * @param loc_id + * The identifier for the group onto which the file specified by child_id is to be mounted. + * @param name + * The name of the group onto which the file specified by child_id is to be mounted. + * @param child_id + * The identifier of the file to be mounted. + * @param plist_id + * The identifier of the property list to be used. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native int H5Fmount(long loc_id, String name, long child_id, long plist_id) + throws HDF5LibraryException, NullPointerException; + + /** + * Given a mount point, H5Funmount dissassociates the mount point's file from the file mounted there. + * + * @param loc_id + * The identifier for the location at which the specified file is to be unmounted. + * @param name + * The name of the file to be unmounted. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native int H5Funmount(long loc_id, String name) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Freset_mdc_hit_rate_stats resets the hit rate statistics counters in the metadata cache associated with the + * specified file. + * + * @param file_id + * IN: Identifier of the target file. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Freset_mdc_hit_rate_stats(long file_id) throws HDF5LibraryException; + + /** + * H5Fget_info returns global information for the file associated with the + * object identifier obj_id. + * + * @param obj_id IN: Object identifier for any object in the file. + * + * @return A buffer(H5F_info2_t) for current "global" information about file + * + * @exception HDF5LibraryException - Error from the HDF-5 Library. + **/ + public synchronized static native H5F_info2_t H5Fget_info(long obj_id) throws HDF5LibraryException; + + /** + * H5Fclear_elink_file_cache evicts all the cached child files in the specified file's external file + * cache, causing them to be closed if there is nothing else holding them open. + * + * @param file_id + * IN: Identifier of the target file. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Fclear_elink_file_cache(long file_id) throws HDF5LibraryException; + + // /////// unimplemented //////// + // ssize_t H5Fget_file_image(hid_t file_id, void * buf_ptr, size_t buf_len); + // ssize_t H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info_t *sect_info/*out*/); + + // /** + // * H5Fget_vfd_handle returns a pointer to the file handle from the + // low-level file driver + // * currently being used by the HDF5 library for file I/O. + // * + // * @param file_id IN: Identifier of the file to be queried. + // * @param fapl IN: File access property list identifier. + // * + // * @return a pointer to the file handle being used by the low-level + // virtual file driver. + // * + // * @exception HDF5LibraryException - Error from the HDF-5 Library. + // **/ + // public synchronized static native Pointer file_handle + // H5Fget_vfd_handle(int file_id, int fapl) + // throws HDF5LibraryException; + + // /** + // * H5Fget_mdc_config loads the current metadata cache configuration into + // * the instance of H5AC_cache_config_t pointed to by the config_ptr + // parameter. + // * + // * @param file_id IN: Identifier of the target file + // * @param config_ptr IN/OUT: Pointer to the instance of + // H5AC_cache_config_t in which the current metadata cache configuration is to be reported. + // * + // * @return none + // * + // * @exception HDF5LibraryException - Error from the HDF-5 Library. + // * @exception NullPointerException - config_ptr is null. + // **/ + // public synchronized static native void H5Fget_mdc_config(int file_id, H5AC_cache_config_t config_ptr) + // throws HDF5LibraryException, NullPointerException; + + // /** + // * H5Fset_mdc_config attempts to configure the file's metadata cache + // according to the configuration supplied. + // * + // * @param file_id IN: Identifier of the target file + // * @param config_ptr IN: Pointer to the instance of H5AC_cache_config_t + // containing the desired configuration. + // * + // * @return none + // * + // * @exception HDF5LibraryException - Error from the HDF-5 Library. + // * @exception NullPointerException - config_ptr is null. + // **/ + // public synchronized static native int H5Fset_mdc_config(int file_id, H5AC_cache_config_t config_ptr) + // throws HDF5LibraryException, NullPointerException; + + // //////////////////////////////////////////////////////////// + // // + // H5G: Group Interface Functions // + // // + // //////////////////////////////////////////////////////////// + + /** + * H5Gclose releases resources used by a group which was opened by a call to H5Gcreate() or H5Gopen(). + * + * @param group_id + * Group identifier to release. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Gclose(long group_id) throws HDF5LibraryException { + if (group_id < 0) + return 0; // throw new HDF5LibraryException("Negative ID");; + + log.trace("OPEN_IDS: H5Gclose remove {}", group_id); + OPEN_IDS.remove(group_id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + return _H5Gclose(group_id); + } + + private synchronized static native int _H5Gclose(long group_id) throws HDF5LibraryException; + + /** + * H5Gcreate creates a new group with the specified name at the specified location, loc_id. + * + * @param loc_id + * IN: The file or group identifier. + * @param name + * IN: The absolute or relative name of the new group. + * @param lcpl_id + * IN: Identifier of link creation property list. + * @param gcpl_id + * IN: Identifier of group creation property list. + * @param gapl_id + * IN: Identifier of group access property list. (No group access properties have been implemented at + * this time; use H5P_DEFAULT.) + * + * @return a valid group identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static long H5Gcreate(long loc_id, String name, long lcpl_id, long gcpl_id, long gapl_id) + throws HDF5LibraryException, NullPointerException { + long id = _H5Gcreate2(loc_id, name, lcpl_id, gcpl_id, gapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Gcreate add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Gcreate2(long loc_id, String name, long lcpl_id, long gcpl_id, + long gapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Gcreate_anon creates a new empty group in the file specified by loc_id. + * + * @param loc_id + * IN: File or group identifier specifying the file in which the new group is to be created. + * @param gcpl_id + * IN: Identifier of group creation property list. + * @param gapl_id + * IN: Identifier of group access property list. (No group access properties have been implemented at + * this time; use H5P_DEFAULT.) + * + * @return a valid group identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Gcreate_anon(long loc_id, long gcpl_id, long gapl_id) throws HDF5LibraryException { + long id = _H5Gcreate_anon(loc_id, gcpl_id, gapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Gcreate_anon add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Gcreate_anon(long loc_id, long gcpl_id, long gapl_id) + throws HDF5LibraryException; + + /** + * H5Gget_create_plist returns an identifier for the group creation property list associated with the group + * specified by group_id. + * + * @param group_id + * IN: Identifier of the group. + * + * @return an identifier for the group's creation property list + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Gget_create_plist(long group_id) throws HDF5LibraryException; + + /** + * H5Gget_info retrieves information about the group specified by group_id. The information is returned in the + * group_info struct. + * + * @param group_id + * IN: Identifier of the group. + * + * @return a structure in which group information is returned + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native H5G_info_t H5Gget_info(long group_id) throws HDF5LibraryException; + + /** + * H5Gget_info_by_idx retrieves information about a group, according to the group's position within an index. + * + * @param group_id + * IN: File or group identifier. + * @param group_name + * IN: Name of group for which information is to be retrieved. + * @param idx_type + * IN: Type of index by which objects are ordered + * @param order + * IN: Order of iteration within index + * @param n + * IN: Attribute's position in index + * @param lapl_id + * IN: Link access property list. + * + * @return a structure in which group information is returned + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native H5G_info_t H5Gget_info_by_idx(long group_id, String group_name, int idx_type, + int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Gget_info_by_name retrieves information about the group group_name located in the file or group specified by + * loc_id. + * + * @param group_id + * IN: File or group identifier. + * @param name + * IN: Name of group for which information is to be retrieved. + * @param lapl_id + * IN: Link access property list. + * + * @return a structure in which group information is returned + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native H5G_info_t H5Gget_info_by_name(long group_id, String name, long lapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * retrieves information of all objects under the group (name) located in the file or group specified by loc_id. + * + * @param loc_id + * IN: File or group identifier + * @param name + * IN: Name of group for which information is to be retrieved + * @param objNames + * OUT: Names of all objects under the group, name. + * @param objTypes + * OUT: Types of all objects under the group, name. + * @param objRef + * OUT: Reference number of all objects under the group, name. + * + * @return the number of items found + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + */ + public synchronized static int H5Gget_obj_info_all(long loc_id, String name, String[] objNames, int[] objTypes, + long[] objRef) throws HDF5LibraryException, NullPointerException { + if (objNames == null) { + throw new NullPointerException("H5Gget_obj_info_all(): name array is null"); + } + + return H5Gget_obj_info_all(loc_id, name, objNames, objTypes, null, null, objRef, HDF5Constants.H5_INDEX_NAME); + } + + public synchronized static int H5Gget_obj_info_all(long loc_id, String name, String[] oname, int[] otype, + int[] ltype, long[] ref, int indx_type) throws HDF5LibraryException, NullPointerException { + return H5Gget_obj_info_full(loc_id, name, oname, otype, ltype, null, ref, indx_type, -1); + } + + public synchronized static int H5Gget_obj_info_all(long loc_id, String name, String[] oname, int[] otype, + int[] ltype, long[] fno, long[] ref, int indx_type) throws HDF5LibraryException, NullPointerException { + return H5Gget_obj_info_full(loc_id, name, oname, otype, ltype, fno, ref, oname.length, indx_type, -1); + } + + public synchronized static int H5Gget_obj_info_full(long loc_id, String name, String[] oname, int[] otype, + int[] ltype, long[] fno, long[] ref, int indx_type, int indx_order) throws HDF5LibraryException, + NullPointerException { + if (oname == null) { + throw new NullPointerException("H5Gget_obj_info_full(): name array is null"); + } + + if (otype == null) { + throw new NullPointerException("H5Gget_obj_info_full(): object type array is null"); + } + + if (oname.length == 0) { + throw new HDF5LibraryException("H5Gget_obj_info_full(): array size is zero"); + } + + if (oname.length != otype.length) { + throw new HDF5LibraryException("H5Gget_obj_info_full(): name and type array sizes are different"); + } + + if (ltype == null) + ltype = new int[otype.length]; + + if (fno == null) + fno = new long[ref.length]; + + if (indx_type < 0) + indx_type = HDF5Constants.H5_INDEX_NAME; + + if (indx_order < 0) + indx_order = HDF5Constants.H5_ITER_INC; + + log.trace("H5Gget_obj_info_full: oname_len={}", oname.length); + int status = H5Gget_obj_info_full(loc_id, name, oname, otype, ltype, fno, ref, oname.length, indx_type, + indx_order); + for (int indx = 0; indx < oname.length; indx++) + log.trace("H5Gget_obj_info_full: oname={}", oname[indx]); + return status; + } + + private synchronized static native int H5Gget_obj_info_full(long loc_id, String name, String[] oname, int[] otype, + int[] ltype, long[] fno, long[] ref, int n, int indx_type, int indx_order) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Gget_obj_info_idx report the name and type of object with index 'idx' in a Group. The 'idx' corresponds to the + * index maintained by H5Giterate. Each link is returned, so objects with multiple links will be counted once for + * each link. + * + * @param loc_id + * IN: file or group ID. + * @param name + * IN: name of the group to iterate, relative to the loc_id + * @param idx + * IN: the index of the object to iterate. + * @param oname + * the name of the object [OUT] + * @param type + * the type of the object [OUT] + * + * @return non-negative if successful, -1 if not. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + */ + public synchronized static int H5Gget_obj_info_idx(long loc_id, String name, int idx, String[] oname, int[] type) + throws HDF5LibraryException, NullPointerException { + String n[] = new String[1]; + n[0] = new String(""); + oname[0] = H5Lget_name_by_idx(loc_id, name, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, idx, + HDF5Constants.H5P_DEFAULT); + H5L_info_t info = H5Lget_info_by_idx(loc_id, name, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, idx, + HDF5Constants.H5P_DEFAULT); + type[0] = info.type; + return 0; + } + + /* + * Add these methods so that we don't need to call + * in a loop to get information for all the object in a group, which takes + * a lot of time to finish if the number of objects is more than 10,000 + */ + /** + * retrieves information of all objects (recurvisely) under the group (name) located in the file or group specified + * by loc_id upto maximum specified by objMax. + * + * @param loc_id + * IN: File or group identifier + * @param objNames + * OUT: Names of all objects under the group, name. + * @param objTypes + * OUT: Types of all objects under the group, name. + * @param lnkTypes + * OUT: Types of all links under the group, name. + * @param objRef + * OUT: Reference number of all objects under the group, name. + * @param objMax + * IN: Maximum number of all objects under the group, name. + * + * @return the number of items found + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + */ + public synchronized static int H5Gget_obj_info_max(long loc_id, String[] objNames, int[] objTypes, int[] lnkTypes, + long[] objRef, long objMax) throws HDF5LibraryException, NullPointerException { + if (objNames == null) { + throw new NullPointerException("H5Gget_obj_info_max(): name array is null"); + } + + if (objTypes == null) { + throw new NullPointerException("H5Gget_obj_info_max(): object type array is null"); + } + + if (lnkTypes == null) { + throw new NullPointerException("H5Gget_obj_info_max(): link type array is null"); + } + + if (objNames.length <= 0) { + throw new HDF5LibraryException("H5Gget_obj_info_max(): array size is zero"); + } + + if (objMax <= 0) { + throw new HDF5LibraryException("H5Gget_obj_info_max(): maximum array size is zero"); + } + + if (objNames.length != objTypes.length) { + throw new HDF5LibraryException("H5Gget_obj_info_max(): name and type array sizes are different"); + } + + return H5Gget_obj_info_max(loc_id, objNames, objTypes, lnkTypes, objRef, objMax, objNames.length); + } + + private synchronized static native int H5Gget_obj_info_max(long loc_id, String[] oname, int[] otype, int[] ltype, + long[] ref, long amax, int n) throws HDF5LibraryException, NullPointerException; + + /** + * H5Gn_members report the number of objects in a Group. The 'objects' include everything that will be visited by + * H5Giterate. Each link is returned, so objects with multiple links will be counted once for each link. + * + * @param loc_id + * file or group ID. + * @param name + * name of the group to iterate, relative to the loc_id + * + * @return the number of members in the group or -1 if error. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + */ + public synchronized static long H5Gn_members(long loc_id, String name) throws HDF5LibraryException, + NullPointerException { + long grp_id = H5Gopen(loc_id, name, HDF5Constants.H5P_DEFAULT); + long n = -1; + + try { + H5G_info_t info = H5.H5Gget_info(grp_id); + n = info.nlinks; + } + finally { + H5Gclose(grp_id); + } + + return n; + } + + /** + * H5Gopen opens an existing group, name, at the location specified by loc_id. + * + * @param loc_id + * IN: File or group identifier specifying the location of the group to be opened. + * @param name + * IN: Name of group to open. + * @param gapl_id + * IN: Identifier of group access property list. + * + * @return a valid group identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static long H5Gopen(long loc_id, String name, long gapl_id) throws HDF5LibraryException, + NullPointerException { + long id = _H5Gopen2(loc_id, name, gapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Gopen add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Gopen2(long loc_id, String name, long gapl_id) + throws HDF5LibraryException, NullPointerException; + + // //////////////////////////////////////////////////////////// + // // + // H5I: HDF5 1.8 Identifier Interface API Functions // + // // + // //////////////////////////////////////////////////////////// + + public synchronized static native long H5Iget_file_id(long obj_id) throws HDF5LibraryException; + + public synchronized static native long H5Iget_name(long obj_id, String[] name, long size) + throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Iget_ref(long obj_id) throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Idec_ref(long obj_id) throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Iinc_ref(long obj_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Iget_type retrieves the type of the object identified by obj_id. + * + * @param obj_id + * IN: Object identifier whose type is to be determined. + * + * @return the object type if successful; otherwise H5I_BADID. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Iget_type(long obj_id) throws HDF5LibraryException; + + /** + * H5Iget_type_ref retrieves the reference count on an ID type. The reference count is used by the library to + * indicate when an ID type can be destroyed. + * + * @param type_id + * IN: The identifier of the type whose reference count is to be retrieved + * + * @return The current reference count on success, negative on failure. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Iget_type_ref(long type_id) throws HDF5LibraryException; + + /** + * H5Idec_type_ref decrements the reference count on an identifier type. The reference count is used by the + * library to indicate when an identifier type can be destroyed. If the reference count reaches zero, + * this function will destroy it. + * + * @param type_id + * IN: The identifier of the type whose reference count is to be decremented + * + * @return The current reference count on success, negative on failure. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Idec_type_ref(long type_id) throws HDF5LibraryException; + + /** + * H5Iinc_type_ref increments the reference count on an ID type. The reference count is used by the library + * to indicate when an ID type can be destroyed. + * + * @param type_id + * IN: The identifier of the type whose reference count is to be incremented + * + * @return The current reference count on success, negative on failure. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Iinc_type_ref(long type_id) throws HDF5LibraryException; + + /** + * H5Inmembers returns the number of identifiers of the identifier type specified in type. + * + * @param type_id + * IN: Identifier for the identifier type whose member count will be retrieved + * + * @return Number of identifiers of the specified identifier type + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Inmembers(long type_id) throws HDF5LibraryException; + + /** + * H5Iis_valid indicates if the identifier type specified in obj_id is valid. + * + * @param obj_id + * IN: Identifier to be checked + * + * @return a boolean, true if the specified identifier id is valid + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Iis_valid(long obj_id) throws HDF5LibraryException; + + /** + * H5Itype_exists indicates if the identifier type specified in type exists. + * + * @param type_id + * IN: the identifier type to be checked + * + * @return a boolean, true if the specified identifier type exists + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Itype_exists(int type_id) throws HDF5LibraryException; + + + /** + * H5Iclear_type deletes all identifiers of the type identified by the argument type. + * + * @param type_id + * IN: Identifier of identifier type which is to be cleared of identifiers + * @param force + * IN: Whether or not to force deletion of all identifiers + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Iclear_type(int type_id, boolean force) throws HDF5LibraryException; + + /** + * H5Idestroy_type deletes an entire identifier type. All identifiers of this type are destroyed + * and no new identifiers of this type can be registered. + * + * @param type_id + * IN: Identifier of identifier type which is to be destroyed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Idestroy_type(int type_id) throws HDF5LibraryException; + + // /////// unimplemented //////// + + // void *H5Iobject_verify(hid_t id, H5I_type_t id_type); + + // hid_t H5Iregister(H5I_type_t type, const void *object); + + // H5I_type_t H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func); + + // void *H5Iremove_verify(hid_t id, H5I_type_t id_type); + + // void *H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key); + + // ////////////////////////////////////////////////////////////////// + // H5L: Link Interface Functions // + // ////////////////////////////////////////////////////////////////// + + /** + * H5Lcopy copies a link from one location to another. + * + * @param src_loc + * IN: Location identifier of the source link + * @param src_name + * IN: Name of the link to be copied + * @param dst_loc + * IN: Location identifier specifying the destination of the copy + * @param dst_name + * IN: Name to be assigned to the new copy + * @param lcpl_id + * IN: Link creation property list identifier + * @param lapl_id + * IN: Link access property list identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native void H5Lcopy(long src_loc, String src_name, long dst_loc, String dst_name, + long lcpl_id, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Lcreate_external creates a new soft link to an external object, which is an object in a different HDF5 file + * from the location of the link. + * + * @param file_name + * IN: Name of the target file containing the target object. + * @param obj_name + * IN: Path within the target file to the target object. + * @param link_loc_id + * IN: The file or group identifier for the new link. + * @param link_name + * IN: The name of the new link. + * @param lcpl_id + * IN: Link creation property list identifier + * @param lapl_id + * IN: Link access property list identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native void H5Lcreate_external(String file_name, String obj_name, long link_loc_id, + String link_name, long lcpl_id, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Lcreate_hard creates a new hard link to a pre-existing object in an HDF5 file. + * + * @param cur_loc + * IN: The file or group identifier for the target object. + * @param cur_name + * IN: Name of the target object, which must already exist. + * @param dst_loc + * IN: The file or group identifier for the new link. + * @param dst_name + * IN: The name of the new link. + * @param lcpl_id + * IN: Link creation property list identifier + * @param lapl_id + * IN: Link access property list identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - cur_name or dst_name is null. + **/ + public synchronized static native void H5Lcreate_hard(long cur_loc, String cur_name, long dst_loc, String dst_name, + long lcpl_id, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Lcreate_soft creates a new soft link to an object in an HDF5 file. + * + * @param link_target + * IN: Path to the target object, which is not required to exist. + * @param link_loc_id + * IN: The file or group identifier for the new link. + * @param link_name + * IN: The name of the new link. + * @param lcpl_id + * IN: Link creation property list identifier + * @param lapl_id + * IN: Link access property list identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - link_name is null. + **/ + public synchronized static native void H5Lcreate_soft(String link_target, long link_loc_id, String link_name, + long lcpl_id, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Ldelete removes the link specified from a group. + * + * @param loc_id + * IN: Identifier of the file or group containing the object. + * @param name + * IN: Name of the link to delete. + * @param lapl_id + * IN: Link access property list identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native void H5Ldelete(long loc_id, String name, long lapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Ldelete_by_idx removes the nth link in a group according to the specified order and in the specified index. + * + * @param loc_id + * IN: File or group identifier specifying location of subject group + * @param group_name + * IN: Name of subject group + * @param idx_type + * IN: Index or field which determines the order + * @param order + * IN: Order within field or index + * @param n + * IN: Link for which to retrieve information + * @param lapl_id + * IN: Link access property list identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - group_name is null. + **/ + public synchronized static native void H5Ldelete_by_idx(long loc_id, String group_name, int idx_type, int order, + long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Lexists checks if a link with a particular name exists in a group. + * + * @param loc_id + * IN: Identifier of the file or group to query. + * @param name + * IN: The name of the link to check. + * @param lapl_id + * IN: Link access property list identifier + * + * @return a boolean, true if the name exists, otherwise false. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native boolean H5Lexists(long loc_id, String name, long lapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Lget_info returns information about the specified link. + * + * @param loc_id + * IN: Identifier of the file or group. + * @param name + * IN: Name of the link for which information is being sought. + * @param lapl_id + * IN: Link access property list identifier + * + * @return a buffer(H5L_info_t) for the link information. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native H5L_info_t H5Lget_info(long loc_id, String name, long lapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Lget_info_by_idx opens a named datatype at the location specified by loc_id and return an identifier for the + * datatype. + * + * @param loc_id + * IN: File or group identifier specifying location of subject group + * @param group_name + * IN: Name of subject group + * @param idx_type + * IN: Type of index + * @param order + * IN: Order within field or index + * @param n + * IN: Link for which to retrieve information + * @param lapl_id + * IN: Link access property list identifier + * + * @return a buffer(H5L_info_t) for the link information. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - group_name is null. + **/ + public synchronized static native H5L_info_t H5Lget_info_by_idx(long loc_id, String group_name, int idx_type, + int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Lget_name_by_idx retrieves name of the nth link in a group, according to the order within a specified field or + * index. + * + * @param loc_id + * IN: File or group identifier specifying location of subject group + * @param group_name + * IN: Name of subject group + * @param idx_type + * IN: Type of index + * @param order + * IN: Order within field or index + * @param n + * IN: Link for which to retrieve information + * @param lapl_id + * IN: Link access property list identifier + * + * @return a String for the link name. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - group_name is null. + **/ + public synchronized static native String H5Lget_name_by_idx(long loc_id, String group_name, int idx_type, + int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Lget_value returns the link value of a symbolic link. Note that this function is a combination + * of H5Lget_info(), H5Lget_val() and for external links, H5Lunpack_elink_val. + * + * @param loc_id + * IN: Identifier of the file or group containing the object. + * @param name + * IN: Name of the symbolic link. + * @param link_value + * OUT: Path of the symbolic link, or the file_name and path of an external file. + * @param lapl_id + * IN: Link access property list identifier + * + * @return the link type + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native int H5Lget_value(long loc_id, String name, String[] link_value, long lapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Lget_value_by_idx retrieves value of the nth link in a group, according to the order within an index. + * Note that this function is a combination of H5Lget_info(), H5Lget_val() and for external links, + * H5Lunpack_elink_val. + * + * @param loc_id + * IN: File or group identifier specifying location of subject group + * @param group_name + * IN: Name of subject group + * @param idx_type + * IN: Type of index + * @param order + * IN: Order within field or index + * @param n + * IN: Link for which to retrieve information + * @param link_value + * OUT: Path of the symbolic link, or the file_name and path of an external file. + * @param lapl_id + * IN: Link access property list identifier + * + * @return the link type + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - group_name is null. + **/ + public synchronized static native int H5Lget_value_by_idx(long loc_id, String group_name, int idx_type, int order, + long n, String[] link_value, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Literate iterates through links in a group. + * + * @param grp_id + * IN: Identifier specifying subject group + * @param idx_type + * IN: Type of index + * @param order + * IN: Order of iteration within index + * @param idx + * IN: Iteration position at which to start + * @param op + * IN: Callback function passing data regarding the link to the calling application + * @param op_data + * IN: User-defined pointer to data required by the application for its processing of the link + * + * @return returns the return value of the first operator that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Literate(long grp_id, int idx_type, int order, long idx, H5L_iterate_cb op, + H5L_iterate_t op_data) throws HDF5LibraryException; + + /** + * H5Literate_by_name iterates through links in a group. + * + * @param grp_id + * IN: Identifier specifying subject group + * @param group_name + * IN: Name of subject group + * @param idx_type + * IN: Type of index + * @param order + * IN: Order of iteration within index + * @param idx + * IN: Iteration position at which to start + * @param op + * IN: Callback function passing data regarding the link to the calling application + * @param op_data + * IN: User-defined pointer to data required by the application for its processing of the link + * @param lapl_id + * IN: Link access property list identifier + * + * @return returns the return value of the first operator that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - group_name is null. + **/ + public synchronized static native int H5Literate_by_name(long grp_id, String group_name, int idx_type, int order, + long idx, H5L_iterate_cb op, H5L_iterate_t op_data, long lapl_id) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Lmove renames a link within an HDF5 file. + * + * @param src_loc + * IN: Original file or group identifier. + * @param src_name + * IN: Original link name. + * @param dst_loc + * IN: Destination file or group identifier. + * @param dst_name + * IN: New link name. + * @param lcpl_id + * IN: Link creation property list identifier to be associated with the new link. + * @param lapl_id + * IN: Link access property list identifier to be associated with the new link. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native void H5Lmove(long src_loc, String src_name, long dst_loc, String dst_name, + long lcpl_id, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Lvisit recursively visits all links starting from a specified group. + * + * @param grp_id + * IN: Identifier specifying subject group + * @param idx_type + * IN: Type of index + * @param order + * IN: Order of iteration within index + * @param op + * IN: Callback function passing data regarding the link to the calling application + * @param op_data + * IN: User-defined pointer to data required by the application for its processing of the link + * + * @return returns the return value of the first operator that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Lvisit(long grp_id, int idx_type, int order, H5L_iterate_cb op, + H5L_iterate_t op_data) throws HDF5LibraryException; + + /** + * H5Lvisit_by_name recursively visits all links starting from a specified group. + * + * @param loc_id + * IN: Identifier specifying subject group + * @param group_name + * IN: Name of subject group + * @param idx_type + * IN: Type of index + * @param order + * IN: Order of iteration within index + * @param op + * IN: Callback function passing data regarding the link to the calling application + * @param op_data + * IN: User-defined pointer to data required by the application for its processing of the link + * @param lapl_id + * IN: link access property + * + * @return returns the return value of the first operator that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - group_name is null. + **/ + public synchronized static native int H5Lvisit_by_name(long loc_id, String group_name, int idx_type, int order, + H5L_iterate_cb op, H5L_iterate_t op_data, long lapl_id) throws HDF5LibraryException, NullPointerException; + + + /** + * H5Lis_registered tests whether a user-defined link class is currently registered, + * either by the HDF5 Library or by the user through the use of H5Lregister. + * + * @param link_cls_id + * IN: User-defined link class identifier + * + * @return Returns a positive value if the link class has been registered and zero if it is unregistered. + * Otherwise returns a negative value; this may mean that the identifier is not a valid user-defined class identifier. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Lis_registered(int link_cls_id) throws HDF5LibraryException; + + /** + * H5Lunregister unregisters a class of user-defined links, preventing them from being traversed, queried, moved, etc. + * + * @param link_cls_id + * IN: User-defined link class identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Lunregister(int link_cls_id) throws HDF5LibraryException; + + // /////// unimplemented //////// + // herr_t H5Lcreate_ud(hid_t link_loc_id, const char *link_name, + // H5L_type_t link_type, const void *udata, size_t udata_size, hid_t lcpl_id, + // hid_t lapl_id); + + // herr_t H5Lregister(const H5L_class_t *cls); + + // herr_t H5Lunpack_elink_val(const void *ext_linkval/*in*/, size_t link_size, + // unsigned *flags, const char **filename/*out*/, const char **obj_path /*out*/); + // herr_t H5Lget_val(hid_t loc_id, const char *name, void *buf/*out*/, + // size_t size, hid_t lapl_id); + // herr_t H5Lget_val_by_idx(hid_t loc_id, const char *group_name, + // H5_index_t idx_type, H5_iter_order_t order, hsize_t n, + // void *buf/*out*/, size_t size, hid_t lapl_id); + + + // //////////////////////////////////////////////////////////// + // // + // H5O: HDF5 1.8 Object Interface API Functions // + // // + // //////////////////////////////////////////////////////////// + + /** + * H5Oclose closes the group, dataset, or named datatype specified. + * + * @param object_id + * IN: Object identifier + * + * @return non-negative on success + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Oclose(long object_id) throws HDF5LibraryException { + if (object_id < 0) + return 0; // throw new HDF5LibraryException("Negative ID");; + + log.trace("OPEN_IDS: H5Oclose remove {}", object_id); + OPEN_IDS.remove(object_id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + return _H5Oclose(object_id); + } + + private synchronized static native int _H5Oclose(long object_id) throws HDF5LibraryException; + + /** + * H5Ocopy copies the group, dataset or named datatype specified from the file or group specified by source location + * to the destination location. + * + * @param src_loc_id + * IN: Object identifier indicating the location of the source object to be copied + * @param src_name + * IN: Name of the source object to be copied + * @param dst_loc_id + * IN: Location identifier specifying the destination + * @param dst_name + * IN: Name to be assigned to the new copy + * @param ocpypl_id + * IN: Object copy property list + * @param lcpl_id + * IN: Link creation property list for the new hard link + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native void H5Ocopy(long src_loc_id, String src_name, long dst_loc_id, String dst_name, + long ocpypl_id, long lcpl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Oget_comment retrieves the comment for the specified object. + * + * @param obj_id + * IN: File or group identifier + * + * @return the comment + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native String H5Oget_comment(long obj_id) throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Oset_comment sets the comment for the specified object. + * + * @param obj_id + * IN: Identifier of the target object + * @param comment + * IN: The new comment. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + * @deprecated As of HDF5 1.8 in favor of object attributes. + **/ + @Deprecated + public synchronized static native void H5Oset_comment(long obj_id, String comment) throws HDF5LibraryException; + + /** + * H5Oget_comment_by_name retrieves the comment for an object. + * + * @param loc_id + * IN: Identifier of a file, group, dataset, or named datatype. + * @param name + * IN: Relative name of the object whose comment is to be set or reset. + * @param lapl_id + * IN: Link access property list identifier. + * + * @return the comment + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native String H5Oget_comment_by_name(long loc_id, String name, long lapl_id) + throws HDF5LibraryException, IllegalArgumentException, NullPointerException; + + // long H5Oget_comment_by_name(int loc_id, String name, String comment, long bufsize, int lapl_id); + + /** + * H5Oset_comment_by_name sets the comment for the specified object. + * + * @param loc_id + * IN: Identifier of a file, group, dataset, or named datatype. + * @param name + * IN: Relative name of the object whose comment is to be set or reset. + * @param comment + * IN: The new comment. + * @param lapl_id + * IN: Link access property list identifier. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + * + * @deprecated As of HDF5 1.8 in favor of object attributes. + **/ + @Deprecated + public synchronized static native void H5Oset_comment_by_name(long loc_id, String name, String comment, long lapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Oget_info retrieves the metadata for an object specified by an identifier. + * + * @param loc_id + * IN: Identifier for target object + * + * @return object information + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native H5O_info_t H5Oget_info(long loc_id) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Oget_info_by_idx retrieves the metadata for an object, identifying the object by an index position. + * + * @param loc_id + * IN: File or group identifier + * @param group_name + * IN: Name of group, relative to loc_id, in which object is located + * @param idx_type + * IN: Type of index by which objects are ordered + * @param order + * IN: Order of iteration within index + * @param n + * IN: Object to open + * @param lapl_id + * IN: Access property list identifier for the link pointing to the object (Not currently used; pass as + * H5P_DEFAULT.) + * + * @return object information + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native H5O_info_t H5Oget_info_by_idx(long loc_id, String group_name, int idx_type, + int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Oget_info_by_name retrieves the metadata for an object, identifying the object by location and relative name. + * + * @param loc_id + * IN: File or group identifier specifying location of group in which object is located + * @param name + * IN: Relative name of group + * @param lapl_id + * IN: Access property list identifier for the link pointing to the object (Not currently used; pass as + * H5P_DEFAULT.) + * + * @return object information + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native H5O_info_t H5Oget_info_by_name(long loc_id, String name, long lapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Olink creates a new hard link to an object in an HDF5 file. + * + * @param obj_id + * IN: Object to be linked. + * @param new_loc_id + * IN: File or group identifier specifying location at which object is to be linked. + * @param new_name + * IN: Relative name of link to be created. + * @param lcpl_id + * IN: Link creation property list identifier. + * @param lapl_id + * IN: Access property list identifier. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native void H5Olink(long obj_id, long new_loc_id, String new_name, long lcpl_id, + long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Oopen opens a group, dataset, or named datatype specified by a location and a path name. + * + * @param loc_id + * IN: File or group identifier + * @param name + * IN: Relative path to the object + * @param lapl_id + * IN: Access property list identifier for the link pointing to the object + * + * @return an object identifier for the opened object + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static long H5Oopen(long loc_id, String name, long lapl_id) throws HDF5LibraryException, NullPointerException { + long id = _H5Oopen(loc_id, name, lapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Oopen add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Oopen(long loc_id, String name, long lapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Ovisit recursively visits all objects accessible from a specified object. + * + * @param obj_id + * IN: Identifier of the object at which the recursive iteration begins. + * @param idx_type + * IN: Type of index + * @param order + * IN: Order of iteration within index + * @param op + * IN: Callback function passing data regarding the object to the calling application + * @param op_data + * IN: User-defined pointer to data required by the application for its processing of the object + * + * @return returns the return value of the first operator that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native int H5Ovisit(long obj_id, int idx_type, int order, H5O_iterate_cb op, + H5O_iterate_t op_data) throws HDF5LibraryException, NullPointerException; + + /** + * H5Ovisit_by_name recursively visits all objects starting from a specified object. + * + * @param loc_id + * IN: File or group identifier + * @param obj_name + * IN: Relative path to the object + * @param idx_type + * IN: Type of index + * @param order + * IN: Order of iteration within index + * @param op + * IN: Callback function passing data regarding the object to the calling application + * @param op_data + * IN: User-defined pointer to data required by the application for its processing of the object + * @param lapl_id + * IN: Link access property list identifier + * + * @return returns the return value of the first operator that returns a positive value, or zero if all members were + * processed with no operator returning non-zero. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native int H5Ovisit_by_name(long loc_id, String obj_name, int idx_type, int order, + H5O_iterate_cb op, H5O_iterate_t op_data, long lapl_id) throws HDF5LibraryException, NullPointerException; + + + /** + * H5Oexists_by_name is used by an application to check that an existing link resolves to an object. + * Primarily, it is designed to check for dangling soft, external, or user-defined links. + * + * @param loc_id + * IN: File or group identifier + * @param obj_name + * IN: Relative path to the object + * @param lapl_id + * IN: Link access property list identifier + * + * @return Returns TRUE or FALSE if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native boolean H5Oexists_by_name(long loc_id, String obj_name, long lapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Odecr_refcount decrements the hard link reference count for an object. + * + * @param object_id IN: Object identifier + * + * @exception HDF5LibraryException - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Odecr_refcount(long object_id) throws HDF5LibraryException; + + /** + * H5Oincr_refcount increments the hard link reference count for an object. + * + * @param object_id IN: Object identifier + * + * @exception HDF5LibraryException - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Oincr_refcount(long object_id) throws HDF5LibraryException; + + /** + * H5Oopen_by_addr opens a group, dataset, or named datatype using its address within an HDF5 file. + * + * @param loc_id IN: File or group identifier + * @param addr IN: Object's address in the file + * + * @return an object identifier for the opened object + * + * @exception HDF5LibraryException - Error from the HDF-5 Library. + **/ + public static long H5Oopen_by_addr(long loc_id, long addr) throws HDF5LibraryException { + long id = _H5Oopen_by_addr(loc_id, addr); + if (id > 0) { + log.trace("OPEN_IDS: H5Oopen_by_addr add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Oopen_by_addr(long loc_id, long addr) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Oopen_by_idx opens the nth object in the group specified. + * + * @param loc_id IN: File or group identifier + * @param group_name IN: Name of group, relative to loc_id, in which object is located + * @param idx_type IN: Type of index by which objects are ordered + * @param order IN: Order of iteration within index + * @param n IN: Object to open + * @param lapl_id IN: Access property list identifier for the link pointing to the object + * + * @return an object identifier for the opened object + * + * @exception HDF5LibraryException - Error from the HDF-5 Library. + * @exception NullPointerException - group_name is null. + **/ + public static long H5Oopen_by_idx(long loc_id, String group_name, + int idx_type, int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException { + long id = _H5Oopen_by_idx(loc_id, group_name, idx_type, order, n, lapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Oopen_by_idx add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + public synchronized static native long _H5Oopen_by_idx(long loc_id, String group_name, + int idx_type, int order, long n, long lapl_id) throws HDF5LibraryException, NullPointerException; + + // /////// unimplemented //////// + + // //////////////////////////////////////////////////////////// + // // + // H5P: Property List Interface Functions // + // // + // //////////////////////////////////////////////////////////// + + // Generic property list routines + + /** + * H5Pget_class_name retrieves the name of a generic property list class + * + * @param plid + * IN: Identifier of property object to query + * @return name of a property list if successful; null if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native String H5Pget_class_name(long plid) throws HDF5LibraryException; + + /** + * H5Pcreate creates a new property as an instance of some property list class. + * + * @param type + * IN: The type of property list to create. + * + * @return a property list identifier (plist) if successful; otherwise Fail (-1). + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Pcreate(long type) throws HDF5LibraryException { + long id = _H5Pcreate(type); + if (id > 0) { + log.trace("OPEN_IDS: H5Pcreate add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Pcreate(long type) throws HDF5LibraryException; + + /** + * Sets a property list value (support integer only) + * + * @param plid + * IN: Property list identifier to modify + * @param name + * IN: Name of property to modify + * @param value + * IN: value to set the property to + * @return a non-negative value if successful; a negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native int H5Pset(long plid, String name, int value) throws HDF5LibraryException; + + /** + * H5Pexist determines whether a property exists within a property list or class + * + * @param plid + * IN: Identifier for the property to query + * @param name + * IN: Name of property to check for + * @return a positive value if the property exists in the property object; zero if the property does not exist; a + * negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native int H5Pexist(long plid, String name) throws HDF5LibraryException; + + /** + * H5Pget_size retrieves the size of a property's value in bytes + * + * @param plid + * IN: Identifier of property object to query + * @param name + * IN: Name of property to query + * @return size of a property's value if successful; a negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native long H5Pget_size(long plid, String name) throws HDF5LibraryException; + + /** + * H5Pget_nprops retrieves the number of properties in a property list or class + * + * @param plid + * IN: Identifier of property object to query + * @return number of properties if successful; a negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native long H5Pget_nprops(long plid) throws HDF5LibraryException; + + /** + * H5Pget_class returns the property list class for the property list identified by the plist parameter. + * + * @param plist + * IN: Identifier of property list to query. + * @return a property list class if successful. Otherwise returns H5P_ROOT (-1). + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Pget_class(long plist) throws HDF5LibraryException; + + /** + * H5Pget_class_parent retrieves an identifier for the parent class of a property class + * + * @param plid + * IN: Identifier of the property class to query + * @return a valid parent class object identifier if successful; a negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native long H5Pget_class_parent(long plid) throws HDF5LibraryException; + + /** + * H5Pget retrieves a copy of the value for a property in a property list (support integer only) + * + * @param plid + * IN: Identifier of property object to query + * @param name + * IN: Name of property to query + * @return value for a property if successful; a negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native int H5Pget(long plid, String name) throws HDF5LibraryException; + + /** + * H5Pequal determines if two property lists or classes are equal + * + * @param plid1 + * IN: First property object to be compared + * @param plid2 + * IN: Second property object to be compared + * @return positive value if equal; zero if unequal, a negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native int H5Pequal(long plid1, long plid2) throws HDF5LibraryException; + + public static boolean H5P_equal(long plid1, long plid2) throws HDF5LibraryException { + if (H5Pequal(plid1, plid2) == 1) + return true; + return false; + } + + /** + * H5Pisa_class checks to determine whether a property list is a member of the specified class + * + * @param plist + * IN: Identifier of the property list + * @param pclass + * IN: Identifier of the property class + * @return a positive value if equal; zero if unequal; a negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native int H5Pisa_class(long plist, long pclass) throws HDF5LibraryException; + + /** + * H5Pcopy_prop copies a property from one property list or class to another + * + * @param dst_id + * IN: Identifier of the destination property list or class + * @param src_id + * IN: Identifier of the source property list or class + * @param name + * IN: Name of the property to copy + * @return a non-negative value if successful; a negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native int H5Pcopy_prop(long dst_id, long src_id, String name) + throws HDF5LibraryException; + + /** + * H5Premove removes a property from a property list + * + * @param plid + * IN: Identifier of the property list to modify + * @param name + * IN: Name of property to remove + * @return a non-negative value if successful; a negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native int H5Premove(long plid, String name) throws HDF5LibraryException; + + /** + * H5Punregister removes a property from a property list class + * + * @param plid + * IN: Property list class from which to remove permanent property + * @param name + * IN: Name of property to remove + * @return a non-negative value if successful; a negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native int H5Punregister(long plid, String name) throws HDF5LibraryException; + + /** + * Closes an existing property list class + * + * @param plid + * IN: Property list class to close + * @return a non-negative value if successful; a negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public static int H5Pclose_class(long plid) throws HDF5LibraryException { + if (plid < 0) + return 0; // throw new HDF5LibraryException("Negative ID");; + + log.trace("OPEN_IDS: H5Pclose_class remove {}", plid); + OPEN_IDS.remove(plid); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + return _H5Pclose_class(plid); + } + + public synchronized static native int _H5Pclose_class(long plid) throws HDF5LibraryException; + + /** + * H5Pclose terminates access to a property list. + * + * @param plist + * IN: Identifier of the property list to terminate access to. + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Pclose(long plist) throws HDF5LibraryException { + if (plist < 0) + return 0; // throw new HDF5LibraryException("Negative ID");; + + log.trace("OPEN_IDS: H5Pclose remove {}", plist); + OPEN_IDS.remove(plist); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + return _H5Pclose(plist); + } + + private synchronized static native int _H5Pclose(long plist) throws HDF5LibraryException; + + /** + * H5Pcopy copies an existing property list to create a new property list. + * + * @param plist + * IN: Identifier of property list to duplicate. + * + * @return a property list identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Pcopy(long plist) throws HDF5LibraryException { + long id = _H5Pcopy(plist); + if (id > 0) { + log.trace("OPEN_IDS: H5Pcopy add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Pcopy(long plist) throws HDF5LibraryException; + + public static long H5Pcreate_class_nocb(long parent_class, String name) throws HDF5LibraryException { + long id = _H5Pcreate_class_nocb(parent_class, name); + if (id > 0) { + log.trace("OPEN_IDS: H5Pcreate_class_nocb add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Pcreate_class_nocb(long parent_class, String name) throws HDF5LibraryException; + +// public static long H5Pcreate_class(long parent_class, String name, H5P_cls_create_func_cb create_op, H5P_cls_create_func_t create_data, +// H5P_cls_copy_func_cb copy_op, H5P_cls_copy_func_t copy_data, H5P_cls_close_func_cb close_op, H5P_cls_close_func_t close_data) throws HDF5LibraryException { +// long id = _H5Pcreate_class(parent_class, name, create_op, create_data, copy_op, copy_data, close_op, close_data); +// if (id > 0) { +// log.trace("OPEN_IDS: H5Pcreate_class add {}", id); +// OPEN_IDS.add(id); +// log.trace("OPEN_IDS: {}", OPEN_IDS.size()); +// } +// return id; +// } +// +// private synchronized static native long _H5Pcreate_class(long parent_class, String name, H5P_cls_create_func_cb create_op, H5P_cls_create_func_t create_data, +// H5P_cls_copy_func_cb copy_op, H5P_cls_copy_func_t copy_data, H5P_cls_close_func_cb close_op, H5P_cls_close_func_t close_data) throws HDF5LibraryException; + + public synchronized static native void H5Pregister2_nocb(long plist_class, String name, long size, byte[] def_value) throws HDF5LibraryException; + +// public synchronized static native void H5Pregister2(long plist_class, String name, long size, byte[] def_value, H5P_prp_create_func_cb prp_create, H5P_prp_set_func_cb prp_set, +// H5P_prp_get_func_cb prp_get, H5P_prp_delete_func_cb prp_delete, H5P_prp_copy_func_cb prp_copy, H5P_prp_compare_func_cb prp_cmp, H5P_prp_close_func_cb prp_close) throws HDF5LibraryException; + + public synchronized static native void H5Pinsert2_nocb(long plist, String name, long size, byte[] value) throws HDF5LibraryException; + + + // public synchronized static native void H5Pinsert2(long plist, String name, long size, byte[] value, H5P_prp_set_func_cb prp_set, H5P_prp_get_func_cb prp_get, + // H5P_prp_delete_func_cb prp_delete, H5P_prp_copy_func_cb prp_copy, H5P_prp_compare_func_cb prp_cmp, H5P_prp_close_func_cb prp_close) throws HDF5LibraryException; + + public synchronized static native int H5Piterate(long plist, int[] idx, H5P_iterate_cb op, H5P_iterate_t op_data) throws HDF5LibraryException; + + // Object creation property list (OCPL) routines + + /** + * H5Pget_attr_phase_change retrieves attribute storage phase change thresholds. + * + * @param ocpl_id + * IN: : Object (dataset or group) creation property list identifier + * @param attributes + * The maximun and minimum no. of attributes to be stored. + * + *
+     *      attributes[0] =  The maximum number of attributes to be stored in compact storage
+     *      attributes[1] =  The minimum number of attributes to be stored in dense storage
+     * 
+ * + * @return Returns a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - size is null. + * + **/ + public synchronized static native int H5Pget_attr_phase_change(long ocpl_id, int[] attributes) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Pset_attr_phase_change sets threshold values for attribute storage on an object. These + * thresholds determine the point at which attribute storage changes + * from compact storage (i.e., storage in the object header) + * to dense storage (i.e., storage in a heap and indexed with a B-tree). + * + * @param ocpl_id + * IN: : Object (dataset or group) creation property list identifier + * @param max_compact + * IN: Maximum number of attributes to be stored in compact storage (Default: 8) + * @param min_dense + * IN: Minimum number of attributes to be stored in dense storage (Default: 6) + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native void H5Pset_attr_phase_change(long ocpl_id, int max_compact, int min_dense) + throws HDF5LibraryException; + + /** + * H5Pget_attr_creation_order retrieves the settings for tracking and indexing attribute creation order on an object + * + * @param ocpl_id + * IN: Object (group or dataset) creation property list identifier + * + * @return Flags specifying whether to track and index attribute creation order + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pget_attr_creation_order(long ocpl_id) throws HDF5LibraryException; + + /** + * H5Pset_attr_creation_order sets flags specifying whether to track and index attribute creation order on an + * object. + * + * @param ocpl_id + * IN: Object creation property list identifier + * @param crt_order_flags + * IN: Flags specifying whether to track and index attribute creation order + * + * @return Returns a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pset_attr_creation_order(long ocpl_id, int crt_order_flags) + throws HDF5LibraryException; + + /** + * H5Pget_obj_track_times queries the object creation property list, ocpl_id, to determine whether object times are + * being recorded. + * + * @param ocpl_id + * IN: Object creation property list identifier + * + * @return TRUE or FALSE, specifying whether object times are being recorded + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native boolean H5Pget_obj_track_times(long ocpl_id) throws HDF5LibraryException; + + /** + * H5Pset_obj_track_times sets a property in the object creation property list, ocpl_id, that governs the recording + * of times associated with an object. + * + * @param ocpl_id + * IN: Object creation property list identifier + * + * @param track_times + * IN: TRUE or FALSE, specifying whether object times are to be tracked + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native void H5Pset_obj_track_times(long ocpl_id, boolean track_times) + throws HDF5LibraryException; + + public synchronized static native int H5Pmodify_filter(long plist, long filter, int flags, long cd_nelmts, + int[] cd_values) throws HDF5LibraryException, NullPointerException; + + /** + * H5Pset_filter adds the specified filter and corresponding properties to the end of an output filter pipeline. + * + * @param plist + * IN: Property list identifier. + * @param filter + * IN: Filter to be added to the pipeline. + * @param flags + * IN: Bit vector specifying certain general properties of the filter. + * @param cd_nelmts + * IN: Number of elements in cd_values + * @param cd_values + * IN: Auxiliary data for the filter. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pset_filter(long plist, int filter, int flags, long cd_nelmts, + int[] cd_values) throws HDF5LibraryException; + + /** + * H5Pget_nfilters returns the number of filters defined in the filter pipeline associated with the property list + * plist. + * + * @param plist + * IN: Property list identifier. + * + * @return the number of filters in the pipeline if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pget_nfilters(long plist) throws HDF5LibraryException; + + /** + * H5Pget_filter returns information about a filter, specified by its filter number, in a filter pipeline, specified + * by the property list with which it is associated. + * + * @param plist + * IN: Property list identifier. + * @param filter_number + * IN: Sequence number within the filter pipeline of the filter for which information is sought. + * @param flags + * OUT: Bit vector specifying certain general properties of the filter. + * @param cd_nelmts + * IN/OUT: Number of elements in cd_values + * @param cd_values + * OUT: Auxiliary data for the filter. + * @param namelen + * IN: Anticipated number of characters in name. + * @param name + * OUT: Name of the filter. + * @param filter_config + * OUT:A bit field encoding the returned filter information + * + * @return the filter identification number if successful. Otherwise returns H5Z_FILTER_ERROR (-1). + * + * @exception ArrayIndexOutOfBoundsException + * Fatal error on Copyback + * @exception ArrayStoreException + * Fatal error on Copyback + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name or an array is null. + * + **/ + public static int H5Pget_filter(long plist, int filter_number, int[] flags, long[] cd_nelmts, int[] cd_values, + long namelen, String[] name, int[] filter_config) throws ArrayIndexOutOfBoundsException, + ArrayStoreException, HDF5LibraryException, NullPointerException { + return H5Pget_filter2(plist, filter_number, flags, cd_nelmts, cd_values, namelen, name, filter_config); + } + + /** + * H5Pget_filter2 returns information about a filter, specified by its filter number, in a filter pipeline, + * specified by the property list with which it is associated. + * + * @see public static int H5Pget_filter(int plist, int filter_number, int[] flags, int[] cd_nelmts, int[] cd_values, + * int namelen, String[] name, int[] filter_config) + * + **/ + private synchronized static native int H5Pget_filter2(long plist, int filter_number, int[] flags, long[] cd_nelmts, + int[] cd_values, long namelen, String[] name, int[] filter_config) throws ArrayIndexOutOfBoundsException, + ArrayStoreException, HDF5LibraryException, NullPointerException; + + /** + * H5Pget_filter_by_id returns information about the filter specified in filter_id, a filter identifier. plist_id + * must be a dataset or group creation property list and filter_id must be in the associated filter pipeline. The + * filter_id and flags parameters are used in the same manner as described in the discussion of H5Pset_filter. Aside + * from the fact that they are used for output, the parameters cd_nelmts and cd_values[] are used in the same manner + * as described in the discussion of H5Pset_filter. On input, the cd_nelmts parameter indicates the number of + * entries in the cd_values[] array allocated by the calling program; on exit it contains the number of values + * defined by the filter. On input, the namelen parameter indicates the number of characters allocated for the + * filter name by the calling program in the array name[]. On exit name[] contains the name of the filter with one + * character of the name in each element of the array. If the filter specified in filter_id is not set for the + * property list, an error will be returned and H5Pget_filter_by_id1 will fail. + * + * @param plist_id + * IN: Property list identifier. + * @param filter_id + * IN: Filter identifier. + * @param flags + * OUT: Bit vector specifying certain general properties of the filter. + * @param cd_nelmts + * N/OUT: Number of elements in cd_values + * @param cd_values + * OUT: Auxiliary data for the filter. + * @param namelen + * IN: Anticipated number of characters in name. + * @param name + * OUT: Name of the filter. + * @param filter_config + * OUT: A bit field encoding the returned filter information + * + * @return the filter identification number if successful. Otherwise returns H5Z_FILTER_ERROR (-1). + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception ArrayIndexOutOfBoundsException + * Fatal error on Copyback + * @exception ArrayStoreException + * Fatal error on Copyback + * @exception NullPointerException + * - name or an array is null. + * + **/ + public static int H5Pget_filter_by_id(long plist_id, long filter_id, int[] flags, long[] cd_nelmts, + int[] cd_values, long namelen, String[] name, int[] filter_config) throws ArrayIndexOutOfBoundsException, + ArrayStoreException, HDF5LibraryException, NullPointerException { + return H5Pget_filter_by_id2(plist_id, filter_id, flags, cd_nelmts, cd_values, namelen, name, filter_config); + } + + /** + * H5Pget_filter_by_id2 returns information about a filter, specified by its filter id, in a filter pipeline, + * specified by the property list with which it is associated. + * + * @param plist_id + * IN: Property list identifier. + * @param filter_id + * IN: Filter identifier. + * @param flags + * OUT: Bit vector specifying certain general properties of the filter. + * @param cd_nelmts + * N/OUT: Number of elements in cd_values + * @param cd_values + * OUT: Auxiliary data for the filter. + * @param namelen + * IN: Anticipated number of characters in name. + * @param name + * OUT: Name of the filter. + * @param filter_config + * OUT: A bit field encoding the returned filter information + * + * @return the filter identification number if successful. Otherwise returns H5Z_FILTER_ERROR (-1). + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name or an array is null. + * + **/ + public synchronized static native int H5Pget_filter_by_id2(long plist_id, long filter_id, int[] flags, + long[] cd_nelmts, int[] cd_values, long namelen, String[] name, int[] filter_config) + throws HDF5LibraryException, NullPointerException; + + + public synchronized static native boolean H5Pall_filters_avail(long dcpl_id) throws HDF5LibraryException, + NullPointerException; + + public synchronized static native int H5Premove_filter(long obj_id, long filter) throws HDF5LibraryException; + + /** + * H5Pset_deflate sets the compression method for a dataset. + * + * @param plist + * IN: Identifier for the dataset creation property list. + * @param level + * IN: Compression level. + * + * @return non-negative if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pset_deflate(long plist, int level) throws HDF5LibraryException; + + public synchronized static native int H5Pset_fletcher32(long plist) throws HDF5LibraryException, + NullPointerException; + + // File creation property list (FCPL) routines + + /** + * H5Pget_userblock retrieves the size of a user block in a file creation property list. + * + * @param plist + * IN: Identifier for property list to query. + * @param size + * OUT: Pointer to location to return user-block size. + * + * @return a non-negative value and the size of the user block; if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - size is null. + **/ + public synchronized static native int H5Pget_userblock(long plist, long[] size) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Pset_userblock sets the user block size of a file creation property list. + * + * @param plist + * IN: Identifier of property list to modify. + * @param size + * IN: Size of the user-block in bytes. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pset_userblock(long plist, long size) throws HDF5LibraryException; + + /** + * H5Pget_sizes retrieves the size of the offsets and lengths used in an HDF5 file. This function is only valid for + * file creation property lists. + * + * @param plist + * IN: Identifier of property list to query. + * @param size + * OUT: the size of the offsets and length. + * + *
+     *      size[0] = sizeof_addr // offset size in bytes
+     *      size[1] = sizeof_size // length size in bytes
+     * 
+ * @return a non-negative value with the sizes initialized; if successful; + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - size is null. + * @exception IllegalArgumentException + * - size is invalid. + **/ + public synchronized static native int H5Pget_sizes(long plist, long[] size) throws HDF5LibraryException, + NullPointerException, IllegalArgumentException; + + /** + * H5Pset_sizes sets the byte size of the offsets and lengths used to address objects in an HDF5 file. + * + * @param plist + * IN: Identifier of property list to modify. + * @param sizeof_addr + * IN: Size of an object offset in bytes. + * @param sizeof_size + * IN: Size of an object length in bytes. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pset_sizes(long plist, int sizeof_addr, int sizeof_size) + throws HDF5LibraryException; + + /** + * H5Pget_sym_k retrieves the size of the symbol table B-tree 1/2 rank and the symbol table leaf node 1/2 size. + * + * @param plist + * IN: Property list to query. + * @param size + * OUT: the symbol table's B-tree 1/2 rank and leaf node 1/2size. + * + *
+     *      size[0] = ik // the symbol table's B-tree 1/2 rank
+     *      size[1] = lk // leaf node 1/2 size
+     * 
+ * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - size is null. + * @exception IllegalArgumentException + * - size is invalid. + **/ + public synchronized static native int H5Pget_sym_k(long plist, int[] size) throws HDF5LibraryException, + NullPointerException, IllegalArgumentException; + + /** + * H5Pset_sym_k sets the size of parameters used to control the symbol table nodes. + * + * @param plist + * IN: Identifier for property list to query. + * @param ik + * IN: Symbol table tree rank. + * @param lk + * IN: Symbol table node size. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pset_sym_k(long plist, int ik, int lk) throws HDF5LibraryException; + + /** + * H5Pget_istore_k queries the 1/2 rank of an indexed storage B-tree. + * + * @param plist + * IN: Identifier of property list to query. + * @param ik + * OUT: Pointer to location to return the chunked storage B-tree 1/2 rank. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - ik array is null. + **/ + public synchronized static native int H5Pget_istore_k(long plist, int[] ik) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Pset_istore_k sets the size of the parameter used to control the B-trees for indexing chunked datasets. + * + * @param plist + * IN: Identifier of property list to query. + * @param ik + * IN: 1/2 rank of chunked storage B-tree. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pset_istore_k(long plist, int ik) throws HDF5LibraryException; + + /** + * H5Pget_shared_mesg_nindexes retrieves number of shared object header message indexes in file creation property + * list. + * + * @param fcpl_id + * IN: : File creation property list identifier + * + * @return nindexes, the number of shared object header message indexes available in files created with this + * property list + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pget_shared_mesg_nindexes(long fcpl_id) throws HDF5LibraryException; + + /** + * H5Pset_shared_mesg_nindexes sets the number of shared object header message indexes in the specified file + * creation property list. + * + * @param plist_id + * IN: File creation property list + * @param nindexes + * IN: Number of shared object header message indexes to be available in files created with this property + * list + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - Invalid value of nindexes + * + **/ + public synchronized static native int H5Pset_shared_mesg_nindexes(long plist_id, int nindexes) + throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pget_shared_mesg_index Retrieves the configuration settings for a shared message index. + * + * @param fcpl_id + * IN: File creation property list identifier + * @param index_num + * IN: Index being configured. + * @param mesg_info + * The message type and minimum message size + * + *
+     *      mesg_info[0] =  Types of messages that may be stored in this index.
+     *      mesg_info[1] =  Minimum message size.
+     * 
+ * + * @return Returns a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - mesg_info is null. + * @exception IllegalArgumentException + * - Invalid value of nindexes + * + **/ + public synchronized static native int H5Pget_shared_mesg_index(long fcpl_id, int index_num, int[] mesg_info) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + + /** + * H5Pset_shared_mesg_index Configures the specified shared object header message index + * + * @param fcpl_id + * IN: File creation property list identifier. + * @param index_num + * IN: Index being configured. + * @param mesg_type_flags + * IN: Types of messages that should be stored in this index. + * @param min_mesg_size + * IN: Minimum message size. + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - Invalid value of nindexes + * + **/ + public synchronized static native int H5Pset_shared_mesg_index(long fcpl_id, int index_num, int mesg_type_flags, + int min_mesg_size) throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pget_shared_mesg_phase_change retrieves shared object header message phase change information. + * + * @param fcpl_id + * IN: : File creation property list identifier + * @param size + * The threshold values for storage of shared object header message indexes in a file. + * + *
+     *      size[0] =  Threshold above which storage of a shared object header message index shifts from list to B-tree
+     *      size[1] =  Threshold below which storage of a shared object header message index reverts to list format
+     * 
+ * + * @return Returns a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - size is null. + * + **/ + public synchronized static native int H5Pget_shared_mesg_phase_change(long fcpl_id, int[] size) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Pset_shared_mesg_phase_change sets shared object header message storage phase change thresholds. + * + * @param fcpl_id + * IN: File creation property list identifier + * @param max_list + * IN: Threshold above which storage of a shared object header message index shifts from list to B-tree + * @param min_btree + * IN: Threshold below which storage of a shared object header message index reverts to list format + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - Invalid values of max_list and min_btree. + * + **/ + public synchronized static native int H5Pset_shared_mesg_phase_change(long fcpl_id, int max_list, int min_btree) + throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pset_file_space sets the file space management strategy for the file associated with fcpl_id to strategy. + * There are four strategies that applications can select and they are described in the Parameters section. + * + * @param fcpl_id + * IN: File creation property list identifier + * @param strategy + * IN: The strategy for file space management. + * Passing a value of zero (0) indicates that the value of strategy is not to be modified. + * H5F_FILE_SPACE_ALL_PERSIST + * With this strategy, the free-space managers track the free space that results from the + * manipulation of HDF5 objects in the HDF5 file. The free space information is saved when the + * file is closed, and reloaded when the file is reopened. When space is needed for file metadata + * or raw data, the HDF5 library first requests space from the library's free-space managers. + * If the request is not satisfied, the library requests space from the aggregators. If the request + * is still not satisfied, the library requests space from the virtual file driver. That is, the + * library will use all of the mechanisms for allocating space. + * H5F_FILE_SPACE_ALL (Default file space management strategy) + * With this strategy, the free-space managers track the free space that results from the manipulation + * of HDF5 objects in the HDF5 file. The free space information is NOT saved when the file is closed + * and the free space that exists upon file closing becomes unaccounted space in the file. + * Like the previous strategy, the library will try all of the mechanisms for allocating space. When + * space is needed for file metadata or raw data, the library first requests space from the free-space + * managers. If the request is not satisfied, the library requests space from the aggregators. If the + * request is still not satisfied, the library requests space from the virtual file driver. + * H5F_FILE_SPACE_AGGR_VFD + * With this strategy, the library does not track free space that results from the manipulation of HDF5 + * obejcts in the HDF5 file and the free space becomes unaccounted space in the file. + * When space is needed for file metadata or raw data, the library first requests space from the + * aggregators. If the request is not satisfied, the library requests space from the virtual file driver. + * H5F_FILE_SPACE_VFD + * With this strategy, the library does not track free space that results from the manipulation of HDF5 + * obejcts in the HDF5 file and the free space becomes unaccounted space in the file. + * When space is needed for file metadata or raw data, the library requests space from the virtual file driver. + * @param threshold + * IN: The free-space section threshold. The library default is 1, which is to track all free-space sections. + * Passing a value of zero (0) indicates that the value of threshold is not to be modified. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - Invalid values of max_list and min_btree. + * + **/ + public synchronized static native void H5Pset_file_space(long fcpl_id, int strategy, long threshold) + throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pget_file_space provides the means for applications to manage the HDF5 file's file space for their specific needs. + * + * @param fcpl_id + * IN: File creation property list identifier + * @param strategy + * IN/OUT: The current file space management strategy in use for the file. NULL, strategy not queried. + * @param threshold + * IN/OUT: The current free-space section threshold. NULL, threshold not queried. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - Invalid values of max_list and min_btree. + * + **/ + public synchronized static native void H5Pget_file_space(long fcpl_id, int[] strategy, long[] threshold) + throws HDF5LibraryException, IllegalArgumentException; + + // File access property list (FAPL) routines + + /** + * H5Pget_alignment retrieves the current settings for alignment properties from a file access property list. + * + * @param plist + * IN: Identifier of a file access property list. + * @param alignment + * OUT: threshold value and alignment value. + * + *
+     *      alignment[0] = threshold // threshold value
+     *      alignment[1] = alignment // alignment value
+     * 
+ * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - aligment array is null. + * @exception IllegalArgumentException + * - aligment array is invalid. + **/ + public synchronized static native int H5Pget_alignment(long plist, long[] alignment) throws HDF5LibraryException, + NullPointerException, IllegalArgumentException; + + /** + * H5Pset_alignment sets the alignment properties of a file access property list so that any file object >= + * THRESHOLD bytes will be aligned on an address which is a multiple of ALIGNMENT. + * + * @param plist + * IN: Identifier for a file access property list. + * @param threshold + * IN: Threshold value. + * @param alignment + * IN: Alignment value. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pset_alignment(long plist, long threshold, long alignment) + throws HDF5LibraryException; + + /** + * H5Pget_driver returns the identifier of the low-level file driver associated with the file access property list + * or data transfer property list plid. + * + * @param plid + * IN: File access or data transfer property list identifier. + * @return a valid low-level driver identifier if successful; a negative value if failed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + */ + public synchronized static native long H5Pget_driver(long plid) throws HDF5LibraryException; + + public synchronized static native long H5Pget_family_offset(long fapl_id) throws HDF5LibraryException, + NullPointerException; + + public synchronized static native int H5Pset_family_offset(long fapl_id, long offset) throws HDF5LibraryException, + NullPointerException; + + /** + * Retrieves the maximum possible number of elements in the meta data cache and the maximum possible number of bytes + * and the RDCC_W0 value in the raw data chunk cache. + * + * @param plist + * IN: Identifier of the file access property list. + * @param mdc_nelmts + * IN/OUT: No longer used, will be ignored. + * @param rdcc_nelmts + * IN/OUT: Number of elements (objects) in the raw data chunk cache. + * @param rdcc_nbytes + * IN/OUT: Total size of the raw data chunk cache, in bytes. + * @param rdcc_w0 + * IN/OUT: Preemption policy. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - an array is null. + **/ + public synchronized static native int H5Pget_cache(long plist, int[] mdc_nelmts, long[] rdcc_nelmts, + long[] rdcc_nbytes, double[] rdcc_w0) throws HDF5LibraryException, NullPointerException; + + /** + * H5Pset_cache sets the number of elements (objects) in the meta data cache and the total number of bytes in the + * raw data chunk cache. + * + * @param plist + * IN: Identifier of the file access property list. + * @param mdc_nelmts + * IN: No longer used, will be ignored. + * @param rdcc_nelmts + * IN: Number of elements (objects) in the raw data chunk cache. + * @param rdcc_nbytes + * IN: Total size of the raw data chunk cache, in bytes. + * @param rdcc_w0 + * IN: Preemption policy. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pset_cache(long plist, int mdc_nelmts, long rdcc_nelmts, long rdcc_nbytes, + double rdcc_w0) throws HDF5LibraryException; + + /** + * H5Pget_mdc_config gets the initial metadata cache configuration contained in a file access property list and + * loads it into the instance of H5AC_cache_config_t pointed to by the config_ptr parameter. This configuration is + * used when the file is opened. + * + * @param plist_id + * IN: Identifier of the file access property list. + * + * @return A buffer(H5AC_cache_config_t) for the current metadata cache configuration information + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native H5AC_cache_config_t H5Pget_mdc_config(long plist_id) throws HDF5LibraryException; + + public synchronized static native void H5Pset_mdc_config(long plist_id, H5AC_cache_config_t config_ptr) + throws HDF5LibraryException; + + /** + * H5Pget_gc_references Returns the current setting for the garbage collection refernces property from a file access + * property list. + * + * @param fapl_id + * IN File access property list + * + * @return GC is on (true) or off (false) + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Pget_gc_references(long fapl_id) throws HDF5LibraryException; + + /** + * H5Pset_gc_references Sets the flag for garbage collecting references for the file. Default value for garbage + * collecting references is off. + * + * @param fapl_id + * IN File access property list + * @param gc_ref + * IN set GC on (true) or off (false) + * + * @return non-negative if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pset_gc_references(long fapl_id, boolean gc_ref) + throws HDF5LibraryException; + + public synchronized static native int H5Pget_fclose_degree(long plist_id) throws HDF5LibraryException, + NullPointerException; + + public synchronized static native int H5Pset_fclose_degree(long plist, int degree) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Pget_meta_block_size the current metadata block size setting. + * + * @param fapl_id + * IN: File access property list identifier + * + * @return the minimum size, in bytes, of metadata block allocations. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native long H5Pget_meta_block_size(long fapl_id) throws HDF5LibraryException; + + /** + * H5Pset_meta_block_size sets the minimum metadata block size. + * + * @param fapl_id + * IN: File access property list identifier + * @param size + * IN: Minimum size, in bytes, of metadata block allocations. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native void H5Pset_meta_block_size(long fapl_id, long size) throws HDF5LibraryException; + + public synchronized static native long H5Pget_sieve_buf_size(long fapl_id) throws HDF5LibraryException; + + public synchronized static native void H5Pset_sieve_buf_size(long fapl_id, long size) throws HDF5LibraryException; + + /** + * H5Pget_small_data_block_size retrieves the size of a block of small data in a file creation property list. + * + * @param plist + * IN: Identifier for property list to query. + * + * @return a non-negative value and the size of the user block; if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Pget_small_data_block_size(long plist) throws HDF5LibraryException; + + /** + * H5Pset_small_data_block_size reserves blocks of size bytes for the contiguous storage of the raw data portion of + * small datasets. + * + * @param plist + * IN: Identifier of property list to modify. + * @param size + * IN: Size of the blocks in bytes. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pset_small_data_block_size(long plist, long size) + throws HDF5LibraryException; + + /** + * H5Pget_libver_bounds retrieves the lower and upper bounds on the HDF5 Library versions that indirectly determine + * the object formats versions used when creating objects in the file. + * + * @param fapl_id + * IN: File access property list identifier + * @param libver + * The earliest/latest version of the library that will be used for writing objects. + * + *
+     *      libver[0] =  The earliest version of the library that will be used for writing objects
+     *      libver[1] =  The latest version of the library that will be used for writing objects.
+     * 
+ * + * @return Returns a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - size is null. + * + **/ + public synchronized static native int H5Pget_libver_bounds(long fapl_id, int[] libver) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Pset_libver_bounds Sets bounds on library versions, and indirectly format versions, to be used when creating + * objects + * + * @param fapl_id + * IN: File access property list identifier + * @param low + * IN: The earliest version of the library that will be used for writing objects + * @param high + * IN: The latest version of the library that will be used for writing objects. + * + * + * @return Returns a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - Argument is Illegal + * + **/ + public synchronized static native int H5Pset_libver_bounds(long fapl_id, int low, int high) + throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pget_elink_file_cache_size retrieves the size of the external link open file cache. + * + * @param fapl_id + * IN: File access property list identifier + * + * @return External link open file cache size in number of files. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pget_elink_file_cache_size(long fapl_id) throws HDF5LibraryException; + + /** + * H5Pset_elink_file_cache_size sets the number of files that can be held open in an external link open file cache. + * + * @param fapl_id + * IN: File access property list identifier + * @param efc_size + * IN: External link open file cache size in number of files. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native void H5Pset_elink_file_cache_size(long fapl_id, int efc_size) + throws HDF5LibraryException; + + // Dataset creation property list (DCPL) routines // + + /** + * H5Pget_layout returns the layout of the raw data for a dataset. + * + * @param plist + * IN: Identifier for property list to query. + * + * @return the layout type of a dataset creation property list if successful. Otherwise returns H5D_LAYOUT_ERROR + * (-1). + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pget_layout(long plist) throws HDF5LibraryException; + + /** + * H5Pset_layout sets the type of storage used store the raw data for a dataset. + * + * @param plist + * IN: Identifier of property list to query. + * @param layout + * IN: Type of storage layout for raw data. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pset_layout(long plist, int layout) throws HDF5LibraryException; + + /** + * H5Pget_chunk retrieves the size of chunks for the raw data of a chunked layout dataset. + * + * @param plist + * IN: Identifier of property list to query. + * @param max_ndims + * IN: Size of the dims array. + * @param dims + * OUT: Array to store the chunk dimensions. + * + * @return chunk dimensionality successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - dims array is null. + * @exception IllegalArgumentException + * - max_ndims <=0 + **/ + public synchronized static native int H5Pget_chunk(long plist, int max_ndims, long[] dims) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + + /** + * H5Pset_chunk sets the size of the chunks used to store a chunked layout dataset. + * + * @param plist + * IN: Identifier for property list to query. + * @param ndims + * IN: The number of dimensions of each chunk. + * @param dim + * IN: An array containing the size of each chunk. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - dims array is null. + * @exception IllegalArgumentException + * - dims <=0 + **/ + public synchronized static native int H5Pset_chunk(long plist, int ndims, byte[] dim) throws HDF5LibraryException, + NullPointerException, IllegalArgumentException; + + public synchronized static int H5Pset_chunk(long plist, int ndims, long[] dim) throws HDF5Exception, + NullPointerException, IllegalArgumentException { + if (dim == null) { + return -1; + } + + HDFArray theArray = new HDFArray(dim); + byte[] thedims = theArray.byteify(); + + int retVal = H5Pset_chunk(plist, ndims, thedims); + + thedims = null; + theArray = null; + return retVal; + } + + /** + * H5Pset_virtual maps elements of the virtual dataset (VDS) described by the + * virtual dataspace identifier vspace_id to the elements of the source dataset + * described by the source dataset dataspace identifier src_space_id. The source + * dataset is identified by the name of the file where it is located, src_file_name, + * and the name of the dataset, src_dset_name. + * + * @param dcpl_id + * IN: The identifier of the dataset creation property list that will be used when creating the virtual dataset. + * @param vspace_id + * IN: The dataspace identifier with the selection within the virtual dataset applied, possibly an unlimited selection. + * @param src_file_name + * IN: The name of the HDF5 file where the source dataset is located. The file might not exist yet. The name can be specified using a C-style printf statement. + * @param src_dset_name + * IN: The path to the HDF5 dataset in the file specified by src_file_name. The dataset might not exist yet. The dataset name can be specified using a C-style printf statement. + * @param src_space_id + * IN: The source dataset dataspace identifier with a selection applied, possibly an unlimited selection. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - an name string is null. + * @exception IllegalArgumentException + * - An id is <=0 + **/ + public synchronized static native void H5Pset_virtual(long dcpl_id, long vspace_id, String src_file_name, String src_dset_name, long src_space_id) throws HDF5LibraryException, + NullPointerException, IllegalArgumentException; + + /** + * H5Pget_virtual_count gets the number of mappings for a virtual dataset that has the creation property list specified by dcpl_id. + * + * @param dcpl_id + * IN: The identifier of the virtual dataset creation property list. + * + * @return a non-negative number of mappings if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - An id is <=0 + **/ + public synchronized static native long H5Pget_virtual_count(long dcpl_id) throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pget_virtual_vspace takes the dataset creation property list for the virtual dataset, dcpl_id, and the mapping index, index, + * and returns a dataspace identifier for the selection within the virtual dataset used in the mapping. + * + * @param dcpl_id + * IN: The identifier of the virtual dataset creation property list. + * @param index + * IN: Mapping index. + * + * @return a valid dataspace identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - An id is <=0 + **/ + public synchronized static native long H5Pget_virtual_vspace(long dcpl_id, long index) throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pget_virtual_srcspace takes the dataset creation property list for the virtual dataset, dcpl_id, and the mapping index, index, + * and returns a dataspace identifier for the selection within the source dataset used in the mapping. + * + * @param dcpl_id + * IN: The identifier of the virtual dataset creation property list. + * @param index + * IN: Mapping index. + * + * @return a valid dataspace identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - An id is <=0 + **/ + public synchronized static native long H5Pget_virtual_srcspace(long dcpl_id, long index) throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pget_virtual_filename takes the dataset creation property list for the virtual dataset, dcpl_id, the mapping index, index, + * the size of the filename for a source dataset, size, and retrieves the name of the file for a source dataset used in the mapping. + * + * @param dcpl_id + * IN: The identifier of the virtual dataset creation property list. + * @param index + * IN: Mapping index. + * + * @return the name of the file containing the source dataset if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - An id is <=0 + **/ + public synchronized static native String H5Pget_virtual_filename(long dcpl_id, long index) throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pget_virtual_dsetname takes the dataset creation property list for the virtual dataset, dcpl_id, the mapping index, index, the + * size of the dataset name for a source dataset, size, and retrieves the name of the source dataset used in the mapping. + * + * @param dcpl_id + * IN: The identifier of the virtual dataset creation property list. + * @param index + * IN: Mapping index. + * + * @return the name of the source dataset if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - An id is <=0 + **/ + public synchronized static native String H5Pget_virtual_dsetname(long dcpl_id, long index) throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pget_external returns information about an external file. + * + * @param plist + * IN: Identifier of a dataset creation property list. + * @param idx + * IN: External file index. + * @param name_size + * IN: Maximum length of name array. + * @param name + * OUT: Name of the external file. + * @param size + * OUT: the offset value and the size of the external file data. + * + *
+     *      size[0] = offset // a location to return an offset value
+     *      size[1] = size // a location to return the size of
+     *                // the external file data.
+     * 
+ * + * @return a non-negative value if successful + * + * @exception ArrayIndexOutOfBoundsException + * Fatal error on Copyback + * @exception ArrayStoreException + * Fatal error on Copyback + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name or size is null. + * @exception IllegalArgumentException + * - name_size <= 0 . + * + **/ + public synchronized static native int H5Pget_external(long plist, int idx, long name_size, String[] name, + long[] size) throws ArrayIndexOutOfBoundsException, ArrayStoreException, HDF5LibraryException, + NullPointerException, IllegalArgumentException; + + /** + * H5Pset_external adds an external file to the list of external files. + * + * @param plist + * IN: Identifier of a dataset creation property list. + * @param name + * IN: Name of an external file. + * @param offset + * IN: Offset, in bytes, from the beginning of the file to the location in the file where the data + * starts. + * @param size + * IN: Number of bytes reserved in the file for the data. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native int H5Pset_external(long plist, String name, long offset, long size) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Pget_external_count returns the number of external files for the specified dataset. + * + * @param plist + * IN: Identifier of a dataset creation property list. + * + * @return the number of external files if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pget_external_count(long plist) throws HDF5LibraryException; + + public synchronized static native int H5Pset_szip(long plist, int options_mask, int pixels_per_block) + throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Pset_shuffle(long plist_id) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Pset_nbit Sets up the use of the N-Bit filter. + * + * @param plist_id + * IN: Dataset creation property list identifier. + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pset_nbit(long plist_id) throws HDF5LibraryException; + + /** + * H5Pset_scaleoffset sets the Scale-Offset filter for a dataset. + * + * @param plist_id + * IN: Dataset creation property list identifier. + * @param scale_type + * IN: Flag indicating compression method. + * @param scale_factor + * IN: Parameter related to scale. + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - Invalid arguments + * + **/ + public synchronized static native int H5Pset_scaleoffset(long plist_id, int scale_type, int scale_factor) + throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pget_fill_value queries the fill value property of a dataset creation property list. + * + * @param plist_id + * IN: Property list identifier. + * @param type_id + * IN: The datatype identifier of value. + * @param value + * IN: The fill value. + * + * @return a non-negative value if successful + * + * @exception HDF5Exception + * - Error converting data array. + **/ + public synchronized static native int H5Pget_fill_value(long plist_id, long type_id, byte[] value) + throws HDF5Exception; + + /** + * H5Pget_fill_value queries the fill value property of a dataset creation property list. + * + * @param plist_id + * IN: Property list identifier. + * @param type_id + * IN: The datatype identifier of value. + * @param obj + * IN: The fill value. + * + * @return a non-negative value if successful + * + * @exception HDF5Exception + * - Error converting data array. + **/ + public synchronized static int H5Pget_fill_value(long plist_id, long type_id, Object obj) throws HDF5Exception { + HDFArray theArray = new HDFArray(obj); + byte[] buf = theArray.emptyBytes(); + + int status = H5Pget_fill_value(plist_id, type_id, buf); + if (status >= 0) { + obj = theArray.arrayify(buf); + } + + return status; + } + + /** + * H5Pset_fill_value sets the fill value for a dataset creation property list. + * + * @param plist_id + * IN: Property list identifier. + * @param type_id + * IN: The datatype identifier of value. + * @param value + * IN: The fill value. + * + * @return a non-negative value if successful + * + * @exception HDF5Exception + * - Error converting data array + **/ + public synchronized static native int H5Pset_fill_value(long plist_id, long type_id, byte[] value) + throws HDF5Exception; + + /** + * H5Pset_fill_value sets the fill value for a dataset creation property list. + * + * @param plist_id + * IN: Property list identifier. + * @param type_id + * IN: The datatype identifier of value. + * @param obj + * IN: The fill value. + * + * @return a non-negative value if successful + * + * @exception HDF5Exception + * - Error converting data array + **/ + public synchronized static int H5Pset_fill_value(long plist_id, long type_id, Object obj) throws HDF5Exception { + HDFArray theArray = new HDFArray(obj); + byte[] buf = theArray.byteify(); + + int retVal = H5Pset_fill_value(plist_id, type_id, buf); + + buf = null; + theArray = null; + return retVal; + } + + public synchronized static native int H5Pfill_value_defined(long plist_id, int[] status) + throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Pget_alloc_time(long plist_id, int[] alloc_time) + throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Pset_alloc_time(long plist_id, int alloc_time) throws HDF5LibraryException, + NullPointerException; + + public synchronized static native int H5Pget_fill_time(long plist_id, int[] fill_time) throws HDF5LibraryException, + NullPointerException; + + public synchronized static native int H5Pset_fill_time(long plist_id, int fill_time) throws HDF5LibraryException, + NullPointerException; + + // Dataset access property list (DAPL) routines // + + /** + * Retrieves the maximum possible number of elements in the meta data cache and the maximum possible number of bytes + * and the RDCC_W0 value in the raw data chunk cache on a per-datset basis. + * + * @param dapl_id + * IN: Identifier of the dataset access property list. + * @param rdcc_nslots + * IN/OUT: Number of elements (objects) in the raw data chunk cache. + * @param rdcc_nbytes + * IN/OUT: Total size of the raw data chunk cache, in bytes. + * @param rdcc_w0 + * IN/OUT: Preemption policy. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - an array is null. + **/ + public synchronized static native void H5Pget_chunk_cache(long dapl_id, long[] rdcc_nslots, long[] rdcc_nbytes, + double[] rdcc_w0) throws HDF5LibraryException, NullPointerException; + + /** + * H5Pset_chunk_cache sets the number of elements (objects) in the meta data cache and the total number of bytes in + * the raw data chunk cache on a per-datset basis. + * + * @param dapl_id + * IN: Identifier of the datset access property list. + * @param rdcc_nslots + * IN: Number of elements (objects) in the raw data chunk cache. + * @param rdcc_nbytes + * IN: Total size of the raw data chunk cache, in bytes. + * @param rdcc_w0 + * IN: Preemption policy. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Pset_chunk_cache(long dapl_id, long rdcc_nslots, long rdcc_nbytes, + double rdcc_w0) throws HDF5LibraryException; + + /** + * H5Pset_virtual_view takes the access property list for the virtual dataset, dapl_id, and the flag, + * view, and sets the VDS view according to the flag value. + * + * @param dapl_id + * IN: Dataset access property list identifier for the virtual dataset + * @param view + * IN: Flag specifying the extent of the data to be included in the view. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library + **/ + public synchronized static native void H5Pset_virtual_view(long dapl_id, int view) throws HDF5LibraryException; + + /** + * H5Pget_virtual_view takes the virtual dataset access property list, dapl_id, and retrieves the flag, + * view, set by the H5Pset_virtual_view call. + * + * @param dapl_id + * IN: Dataset access property list identifier for the virtual dataset + + * @return The flag specifying the view of the virtual dataset. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library + **/ + public synchronized static native int H5Pget_virtual_view(long dapl_id) throws HDF5LibraryException; + + /** + * H5Pset_virtual_printf_gap sets the access property list for the virtual dataset, dapl_id, to instruct the + * library to stop looking for the mapped data stored in the files and/or datasets with the printf-style names + * after not finding gap_size files and/or datasets. The found source files and datasets will determine the + * extent of the unlimited virtual dataset with the printf-style mappings. + * + * @param dapl_id + * IN: Dataset access property list identifier for the virtual dataset + * @param gap_size + * IN: Maximum number of files and/or datasets allowed to be missing for determining + * the extent of an unlimited virtual dataset with printf-style mappings. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library + **/ + public synchronized static native void H5Pset_virtual_printf_gap(long dapl_id, long gap_size) throws HDF5LibraryException; + + /** + * H5Pget_virtual_printf_gap returns the maximum number of missing printf-style files and/or datasets for + * determining the extent of an unlimited virtual dataaset, gap_size, using the access property list for + * the virtual dataset, dapl_id. + * + * @param dapl_id + * IN: Dataset access property list identifier for the virtual dataset + + * @return Maximum number of files and/or datasets allowed to be missing for determining + * the extent of an unlimited virtual dataset with printf-style mappings. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library + **/ + public synchronized static native long H5Pget_virtual_printf_gap(long dapl_id) throws HDF5LibraryException; + + // Dataset xfer property list (DXPL) routines // + + /** + * H5Pget_data_transform retrieves the data transform expression previously set in the dataset transfer property + * list plist_id by H5Pset_data_transform. + * + * @param plist_id + * IN: Identifier of the property list or class + * @param size + * IN: Number of bytes of the transform expression to copy to + * @param expression + * OUT: A data transform expression + * + * @return The size of the transform expression if successful; 0(zero) if no transform expression exists. Otherwise + * returns a negative value. + * + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - Size is <= 0. + * + **/ + public synchronized static native long H5Pget_data_transform(long plist_id, String[] expression, long size) + throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pset_data_transform sets a data transform expression + * + * @param plist_id + * IN: Identifier of the property list or class + * @param expression + * IN: Pointer to the null-terminated data transform expression + * + * @return a non-negative valule if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - expression is null. + * + **/ + public synchronized static native int H5Pset_data_transform(long plist_id, String expression) + throws HDF5LibraryException, NullPointerException; + + /** + * HH5Pget_buffer gets type conversion and background buffers. Returns buffer size, in bytes, if successful; + * otherwise 0 on failure. + * + * @param plist + * Identifier for the dataset transfer property list. + * @param tconv + * byte array of application-allocated type conversion buffer. + * @param bkg + * byte array of application-allocated background buffer. + * + * @return buffer size, in bytes, if successful; otherwise 0 on failure + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - plist is invalid. + **/ + public synchronized static native int H5Pget_buffer(long plist, byte[] tconv, byte[] bkg) + throws HDF5LibraryException, IllegalArgumentException; + + public synchronized static native long H5Pget_buffer_size(long plist) + throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pset_buffer sets type conversion and background buffers. status to TRUE or FALSE. + * + * Given a dataset transfer property list, H5Pset_buffer sets the maximum size for the type conversion buffer and + * background buffer and optionally supplies pointers to application-allocated buffers. If the buffer size is + * smaller than the entire amount of data being transferred between the application and the file, and a type + * conversion buffer or background buffer is required, then strip mining will be used. + * + * Note that there are minimum size requirements for the buffer. Strip mining can only break the data up along the + * first dimension, so the buffer must be large enough to accommodate a complete slice that encompasses all of the + * remaining dimensions. For example, when strip mining a 100x200x300 hyperslab of a simple data space, the buffer + * must be large enough to hold 1x200x300 data elements. When strip mining a 100x200x300x150 hyperslab of a simple + * data space, the buffer must be large enough to hold 1x200x300x150 data elements. + * + * @param plist + * Identifier for the dataset transfer property list. + * @param size + * Size, in bytes, of the type conversion and background buffers. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - plist is invalid. + **/ + public synchronized static native void H5Pset_buffer_size(long plist, long size) throws HDF5LibraryException, + IllegalArgumentException; + + public synchronized static native int H5Pget_edc_check(long plist) throws HDF5LibraryException, + NullPointerException; + + public synchronized static native int H5Pset_edc_check(long plist, int check) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Pget_btree_ratio Get the B-tree split ratios for a dataset transfer property list. + * + * @param plist_id + * IN Dataset transfer property list + * @param left + * OUT split ratio for leftmost nodes + * @param right + * OUT split ratio for righttmost nodes + * @param middle + * OUT split ratio for all other nodes + * + * @return non-negative if succeed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - an input array is null. + **/ + public synchronized static native int H5Pget_btree_ratios(long plist_id, double[] left, double[] middle, + double[] right) throws HDF5LibraryException, NullPointerException; + + /** + * H5Pset_btree_ratio Sets B-tree split ratios for a dataset transfer property list. The split ratios determine what + * percent of children go in the first node when a node splits. + * + * @param plist_id + * IN Dataset transfer property list + * @param left + * IN split ratio for leftmost nodes + * @param right + * IN split ratio for righttmost nodes + * @param middle + * IN split ratio for all other nodes + * + * @return non-negative if succeed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Pset_btree_ratios(long plist_id, double left, double middle, double right) + throws HDF5LibraryException; + + public synchronized static native int H5Pget_hyper_vector_size(long dxpl_id, long[] vector_size) + throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Pset_hyper_vector_size(long dxpl_id, long vector_size) + throws HDF5LibraryException, NullPointerException; + + // Link creation property list (LCPL) routines // + + /** + * H5Pget_create_intermediate_group determines whether property is set to enable creating missing intermediate + * groups. + * + * @param lcpl_id + * IN: Link creation property list identifier + * + * @return Boolean true or false + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native boolean H5Pget_create_intermediate_group(long lcpl_id) + throws HDF5LibraryException; + + /** + * H5Pset_create_intermediate_group specifies in property list whether to create missing intermediate groups + * + * @param lcpl_id + * IN: Link creation property list identifier + * @param crt_intermed_group + * IN: Flag specifying whether to create intermediate groups upon the creation of an object + * + * @return a non-negative valule if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pset_create_intermediate_group(long lcpl_id, boolean crt_intermed_group) + throws HDF5LibraryException; + + // Group creation property list (GCPL) routines // + + /** + * H5Pget_local_heap_size_hint Retrieves the anticipated size of the local heap for original-style groups. + * + * @param gcpl_id + * IN: Group creation property list identifier + * + * @return size_hint, the anticipated size of local heap + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native long H5Pget_local_heap_size_hint(long gcpl_id) throws HDF5LibraryException; + + /** + * H5Pset_local_heap_size_hint Specifies the anticipated maximum size of a local heap. + * + * @param gcpl_id + * IN: Group creation property list identifier + * @param size_hint + * IN: Anticipated maximum size in bytes of local heap + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pset_local_heap_size_hint(long gcpl_id, long size_hint) + throws HDF5LibraryException; + + /** + * H5Pget_link_phase_change Queries the settings for conversion between compact and dense groups. + * + * @param gcpl_id + * IN: Group creation property list identifier + * @param links + * The max. no. of compact links & the min. no. of dense links, which are used for storing groups + * + *
+     *      links[0] =  The maximum number of links for compact storage
+     *      links[1] =  The minimum number of links for dense storage
+     * 
+ * + * @return Returns a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - size is null. + * + **/ + public synchronized static native int H5Pget_link_phase_change(long gcpl_id, int[] links) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Pset_link_phase_change Sets the parameters for conversion between compact and dense groups. + * + * @param gcpl_id + * IN: Group creation property list identifier + * @param max_compact + * IN: Maximum number of links for compact storage(Default: 8) + * @param min_dense + * IN: Minimum number of links for dense storage(Default: 6) + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - Invalid values of max_compact and min_dense. + * + **/ + public synchronized static native int H5Pset_link_phase_change(long gcpl_id, int max_compact, int min_dense) + throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pget_est_link_info Queries data required to estimate required local heap or object header size. + * + * @param gcpl_id + * IN: Group creation property list identifier + * @param link_info + * Estimated number of links to be inserted into group And the estimated average length of link names + * + *
+     *      link_info[0] =  Estimated number of links to be inserted into group
+     *      link_info[1] =  Estimated average length of link names
+     * 
+ * + * @return Returns a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - link_info is null. + * + **/ + public synchronized static native int H5Pget_est_link_info(long gcpl_id, int[] link_info) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Pset_est_link_info Sets estimated number of links and length of link names in a group. + * + * @param gcpl_id + * IN: Group creation property list identifier + * @param est_num_entries + * IN: Estimated number of links to be inserted into group + * @param est_name_len + * IN: Estimated average length of link names + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - Invalid values to est_num_entries and est_name_len. + * + **/ + public synchronized static native int H5Pset_est_link_info(long gcpl_id, int est_num_entries, int est_name_len) + throws HDF5LibraryException, IllegalArgumentException; + + /** + * H5Pget_link_creation_order queries the group creation property list, gcpl_id, and returns a flag indicating + * whether link creation order is tracked and/or indexed in a group. + * + * @param gcpl_id + * IN: Group creation property list identifier + * + * @return crt_order_flags -Creation order flag(s) + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pget_link_creation_order(long gcpl_id) throws HDF5LibraryException; + + /** + * H5Pset_link_creation_order Sets flags in a group creation property list, gcpl_id, for tracking and/or indexing + * links on creation order. + * + * @param gcpl_id + * IN: Group creation property list identifier + * @param crt_order_flags + * IN: Creation order flag(s) + * + * + * @return Returns a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pset_link_creation_order(long gcpl_id, int crt_order_flags) + throws HDF5LibraryException; + + // String creation property list (STRCPL) routines // + + public synchronized static native int H5Pget_char_encoding(long plist_id) throws HDF5LibraryException; + + public synchronized static native void H5Pset_char_encoding(long plist_id, int encoding) + throws HDF5LibraryException; + + // Link access property list (LAPL) routines // + + /** + * H5Pget_nlinks retrieves the maximum number of soft or user-defined link traversals allowed, nlinks, before the + * library assumes it has found a cycle and aborts the traversal. This value is retrieved from the link access + * property list lapl_id. + * + * @param lapl_id + * IN: File access property list identifier + * + * @return Returns a Maximum number of links to traverse. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native long H5Pget_nlinks(long lapl_id) throws HDF5LibraryException; + + /** + * H5Pset_nlinks sets the maximum number of soft or user-defined link traversals allowed, nlinks, before the library + * assumes it has found a cycle and aborts the traversal. This value is set in the link access property list + * lapl_id. + * + * @param lapl_id + * IN: File access property list identifier + * @param nlinks + * IN: Maximum number of links to traverse + * + * @return Returns a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - Argument is Illegal + * + **/ + public synchronized static native int H5Pset_nlinks(long lapl_id, long nlinks) throws HDF5LibraryException, + IllegalArgumentException; + + /** + * H5Pget_elink_prefix Retrieves prefix applied to external link paths. + * + * @param lapl_id + * IN: Link access property list identifier + * @param prefix + * OUT: Prefix applied to external link paths + * + * @return If successful, returns a non-negative value specifying the size in bytes of the prefix without the NULL + * terminator; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - prefix is null. + * + **/ + public synchronized static native long H5Pget_elink_prefix(long lapl_id, String[] prefix) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Pset_elink_prefix Sets prefix to be applied to external link paths. + * + * @param lapl_id + * IN: Link access property list identifier + * @param prefix + * IN: Prefix to be applied to external link paths + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - prefix is null. + * + **/ + public synchronized static native int H5Pset_elink_prefix(long lapl_id, String prefix) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Pget_elink_fapl Retrieves the file access property list identifier associated with the link access property + * list. + * + * @param lapl_id + * IN: Link access property list identifier + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public static long H5Pget_elink_fapl(long lapl_id) throws HDF5LibraryException { + long id = _H5Pget_elink_fapl(lapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Pget_elink_fapl add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Pget_elink_fapl(long lapl_id) throws HDF5LibraryException; + + /** + * H5Pset_elink_fapl sets a file access property list for use in accessing a file pointed to by an external link. + * + * @param lapl_id + * IN: Link access property list identifier + * @param fapl_id + * IN: File access property list identifier + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pset_elink_fapl(long lapl_id, long fapl_id) throws HDF5LibraryException; + + /** + * H5Pget_elink_acc_flags retrieves the external link traversal file access flag from the specified link access + * property list. + * + * @param lapl_id + * IN: Link access property list identifier + * + * @return File access flag for link traversal. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pget_elink_acc_flags(long lapl_id) throws HDF5LibraryException; + + /** + * H5Pset_elink_acc_flags Sets the external link traversal file access flag in a link access property list. + * + * @param lapl_id + * IN: Link access property list identifier + * @param flags + * IN: The access flag for external link traversal. + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception IllegalArgumentException + * - Invalid Flag values. + * + **/ + public synchronized static native int H5Pset_elink_acc_flags(long lapl_id, int flags) throws HDF5LibraryException, + IllegalArgumentException; + + // Object copy property list (OCPYPL) routines // + + /** + * H5Pget_copy_object retrieves the properties to be used when an object is copied. + * + * @param ocp_plist_id + * IN: Object copy property list identifier + * + * @return Copy option(s) set in the object copy property list + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pget_copy_object(long ocp_plist_id) throws HDF5LibraryException; + + /** + * H5Pset_copy_object Sets properties to be used when an object is copied. + * + * @param ocp_plist_id + * IN: Object copy property list identifier + * @param copy_options + * IN: Copy option(s) to be set + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native void H5Pset_copy_object(long ocp_plist_id, int copy_options) + throws HDF5LibraryException; + + // Other/Older property list routines // + + /** + * H5Pget_version retrieves the version information of various objects for a file creation property list. + * + * @param plist + * IN: Identifier of the file creation property list. + * @param version_info + * OUT: version information. + * + *
+     *      version_info[0] = boot  // boot block version number
+     *      version_info[1] = freelist  // global freelist version
+     *      version_info[2] = stab  // symbol tabl version number
+     *      version_info[3] = shhdr  // shared object header version
+     * 
+ * @return a non-negative value, with the values of version_info initialized, if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - version_info is null. + * @exception IllegalArgumentException + * - version_info is illegal. + **/ + public synchronized static native int H5Pget_version(long plist, int[] version_info) throws HDF5LibraryException, + NullPointerException, IllegalArgumentException; + + // file drivers property list routines // + + public synchronized static native void H5Pget_fapl_core(long fapl_id, long[] increment, boolean[] backing_store) + throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Pset_fapl_core(long fapl_id, long increment, boolean backing_store) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Pget_fapl_direct Retrieve direct I/O settings. + * + * @param fapl_id + * IN: File access property list identifier + * @param info + * OUT: Returned property list information info[0] = alignment Required memory alignment boundary info[1] + * = block_size File system block size info[2] = cbuf_size Copy buffer size + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pget_fapl_direct(long fapl_id, long[] info) throws HDF5LibraryException; + + /** + * H5Pset_fapl_direct Sets up use of the direct I/O driver. + * + * @param fapl_id + * IN: File access property list identifier + * @param alignment + * IN: Required memory alignment boundary + * @param block_size + * IN: File system block size + * @param cbuf_size + * IN: Copy buffer size + * + * @return a non-negative value if successful; otherwise returns a negative value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * + **/ + public synchronized static native int H5Pset_fapl_direct(long fapl_id, long alignment, long block_size, + long cbuf_size) throws HDF5LibraryException; + + public synchronized static native int H5Pget_fapl_family(long fapl_id, long[] memb_size, long[] memb_fapl_id) + throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Pset_fapl_family(long fapl_id, long memb_size, long memb_fapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Pget_fapl_multi Sets up use of the multi I/O driver. + * + * @param fapl_id + * IN: File access property list identifier + * @param memb_map + * IN: Maps memory usage types to other memory usage types. + * @param memb_fapl + * IN: Property list for each memory usage type. + * @param memb_name + * IN: Name generator for names of member files. + * @param memb_addr + * IN: The offsets within the virtual address space, from 0 (zero) to HADDR_MAX, at which each type of + * data storage begins. + * + * @return a boolean value; Allows read-only access to incomplete file sets when TRUE. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - an array is null. + * + **/ + public synchronized static native boolean H5Pget_fapl_multi(long fapl_id, int[] memb_map, long[] memb_fapl, + String[] memb_name, long[] memb_addr) throws HDF5LibraryException, NullPointerException; + + /** + * H5Pset_fapl_multi Sets up use of the multi I/O driver. + * + * @param fapl_id + * IN: File access property list identifier + * @param memb_map + * IN: Maps memory usage types to other memory usage types. + * @param memb_fapl + * IN: Property list for each memory usage type. + * @param memb_name + * IN: Name generator for names of member files. + * @param memb_addr + * IN: The offsets within the virtual address space, from 0 (zero) to HADDR_MAX, at which each type of + * data storage begins. + * @param relax + * IN: Allows read-only access to incomplete file sets when TRUE. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - an array is null. + * + **/ + public synchronized static native void H5Pset_fapl_multi(long fapl_id, int[] memb_map, long[] memb_fapl, + String[] memb_name, long[] memb_addr, boolean relax) throws HDF5LibraryException, NullPointerException; + + + /** + * H5Pset_fapl_log Sets up the logging virtual file driver (H5FD_LOG) for use. H5Pset_fapl_log modifies the file + * access property list to use the logging driver, H5FD_LOG. The logging virtual file driver (VFD) is a clone of the + * standard SEC2 (H5FD_SEC2) driver with additional facilities for logging VFD metrics and activity to a file. + * + * @param fapl_id + * IN: File access property list identifier. + * @param logfile + * IN: logfile is the name of the file in which the logging entries are to be recorded. + * @param flags + * IN: Flags specifying the types of logging activity. + * @param buf_size + * IN: The size of the logging buffers, in bytes. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - logfile is null. + **/ + public synchronized static native void H5Pset_fapl_log(long fapl_id, String logfile, long flags, long buf_size) + throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Pset_fapl_sec2(long fapl_id) throws HDF5LibraryException, NullPointerException; + + public synchronized static native void H5Pset_fapl_split(long fapl_id, String meta_ext, long meta_plist_id, + String raw_ext, long raw_plist_id) throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Pset_fapl_stdio(long fapl_id) throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Pset_fapl_windows(long fapl_id) throws HDF5LibraryException, NullPointerException; + + // /////// unimplemented //////// + + // Generic property list routines // + // herr_t H5Pencode(hid_t plist_id, void *buf, size_t *nalloc); + // hid_t H5Pdecode(const void *buf); + + // Object creation property list (OCPL) routines // + + // File creation property list (FCPL) routines // + + // File access property list (FAPL) routines // + // herr_t H5Pset_driver( hid_t plist_id, hid_t new_driver_id, const void *new_driver_info ) + // void *H5Pget_driver_info( hid_t plist_id ) + // herr_t H5Pget_multi_type ( hid_t fapl_id, H5FD_mem_t *type ) + // herr_t H5Pset_multi_type ( hid_t fapl_id, H5FD_mem_t type ) + // herr_t H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr); + // herr_t H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len); + // herr_t H5Pget_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr); + // herr_t H5Pset_file_image_callbacks(hid_t fapl_id, H5FD_file_image_callbacks_t *callbacks_ptr); + // herr_t H5Pset_core_write_tracking(hid_t fapl_id, hbool_t is_enabled, size_t page_size); + // herr_t H5Pget_core_write_tracking(hid_t fapl_id, hbool_t *is_enabled, size_t *page_size); + + // Dataset creation property list (DCPL) routines // + + // Dataset access property list (DAPL) routines // + + // Dataset xfer property list (DXPL) routines // + // herr_t H5Pset_buffer(hid_t plist_id, size_t size, void *tconv, void *bkg); + // herr_t H5Pset_preserve(hid_t plist_id, hbool_t status); + // int H5Pget_preserve(hid_t plist_id); + // herr_t H5Pset_filter_callback(hid_t plist, H5Z_filter_func_t func, void *op_data) + // herr_t H5Pget_vlen_mem_manager(hid_t plist, H5MM_allocate_t *alloc, void **alloc_info, H5MM_free_t *free, void + // **free_info ) + // herr_t H5Pset_vlen_mem_manager(hid_t plist, H5MM_allocate_t alloc, void *alloc_info, H5MM_free_t free, void + // *free_info ) + // herr_t H5Pget_type_conv_cb(hid_t plist, H5T_conv_except_func_t *func, void **op_data) + // herr_t H5Pset_type_conv_cb( hid_t plist, H5T_conv_except_func_t func, void *op_data) + + // Link creation property list (LCPL) routines // + + // Group creation property list (GCPL) routines // + + // String creation property list (STRCPL) routines // + + // Link access property list (LAPL) routines // + // herr_t H5Pget_elink_cb( hid_t lapl_id, H5L_elink_traverse_t *func, void **op_data ) + // herr_t H5Pset_elink_cb( hid_t lapl_id, H5L_elink_traverse_t func, void *op_data ) + + // Object copy property list (OCPYPL) routines // + // herr_t H5Padd_merge_committed_dtype_path(hid_t plist_id, const char *path); + // herr_t H5Pfree_merge_committed_dtype_paths(hid_t plist_id); + // herr_t H5Pget_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t *func, void **op_data); + // herr_t H5Pset_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t func, void *op_data); + + + // Other/Older property list routines // + // herr_t H5Pget_fapl_mpio( int fapl_id, MPI_Comm *comm, MPI_Info *info ) + // herr_t H5Pset_fapl_mpio( int fapl_id, MPI_Comm comm, MPI_Info info ) + + // herr_t H5Pget_fapl_mpiposix( int fapl_id, MPI_Comm *comm, hbool_t *use_gpfs_hints ) + // herr_t H5Pset_fapl_mpiposix( int fapl_id, MPI_Comm comm, hbool_t use_gpfs_hints ) + + // herr_t H5Pget_dxpl_mpio( hid_t dxpl_id, H5FD_mpio_xfer_t *xfer_mode ) + // herr_t H5Pset_dxpl_mpio( hid_t dxpl_id, H5FD_mpio_xfer_t xfer_mode ) + // herr_t H5Pset_dxpl_mpio_chunk_opt (hid_t dxpl_id, H5FD_mpio_chunk_opt_t opt_mode) + // herr_t H5Pset_dxpl_mpio_chunk_opt_num (hid_t dxpl_id, unsigned num_chunk_per_proc) + // herr_t H5Pset_dxpl_mpio_chunk_opt_ratio (hid_t dxpl_id, unsigned percent_proc_per_chunk) + // herr_t H5Pset_dxpl_mpio_collective_opt (hid_t dxpl_id, H5FD_mpio_collective_opt_t opt_mode) + + // //////////////////////////////////////////////////////////// + // // + // H5PL: HDF5 1.8 Plugin API Functions // + // // + // //////////////////////////////////////////////////////////// + /** + * H5PLset_loading_state uses one argument to enable or disable individual plugins. + * The plugin_flags parameter is an encoded integer in which each bit controls a specific + * plugin or class of plugins. + * A plugin bit set to 0 (zero) prevents the use of the dynamic plugin corresponding + * to that bit position. A plugin bit set to 1 (one) allows the use of that dynamic plugin. + * All dynamic plugins can be enabled by setting plugin_flags to a negative value. + * A value of 0 (zero) will disable all dynamic plugins. + * + * H5PLset_loading_state inspects the HDF5_PLUGIN_PRELOAD environment variable every + * time it is called. If the environment variable is set to the special :: string, + * all dynamic plugins will be disabled. + * + * @param plugin_flags + * IN: The list of dynamic plugin types to enable or disable. + * A plugin bit set to 0 (zero) prevents use of that dynamic plugin. + * A plugin bit set to 1 (one) enables use of that dynamic plugin. + * Setting plugin_flags to a negative value enables all dynamic plugins. + * Setting plugin_flags to 0 (zero) disables all dynamic plugins. + * + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5PLset_loading_state(int plugin_flags) throws HDF5LibraryException; + + /** + * H5PLget_loading_state retrieves the state of the dynamic plugins flag, plugin_flags.. + * + * @return the list of dynamic plugin types that are enabled or disabled. + * A plugin bit set to 0 (zero) indicates that that dynamic plugin is disabled. + * A plugin bit set to 1 (one) indicates that that dynamic plugin is enabled. + * If the value of plugin_flags is negative, all dynamic plugins are enabled. + * If the value of plugin_flags is 0 (zero), all dynamic plugins are disabled. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5PLget_loading_state() throws HDF5LibraryException; + + // //////////////////////////////////////////////////////////// + // // + // H5R: HDF5 1.8 Reference API Functions // + // // + // //////////////////////////////////////////////////////////// + + private synchronized static native int H5Rcreate(byte[] ref, long loc_id, String name, int ref_type, long space_id) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + + /** + * H5Rcreate creates the reference, ref, of the type specified in ref_type, pointing to the object name located at + * loc_id. + * + * @param loc_id + * IN: Location identifier used to locate the object being pointed to. + * @param name + * IN: Name of object at location loc_id. + * @param ref_type + * IN: Type of reference. + * @param space_id + * IN: Dataspace identifier with selection. + * + * @return the reference (byte[]) if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - an input array is null. + * @exception IllegalArgumentException + * - an input array is invalid. + **/ + public synchronized static byte[] H5Rcreate(long loc_id, String name, int ref_type, long space_id) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException { + /* These sizes are correct for HDF5.1.2 */ + int ref_size = 8; + if (ref_type == HDF5Constants.H5R_DATASET_REGION) { + ref_size = 12; + } + byte rbuf[] = new byte[ref_size]; + + /* will raise an exception if fails */ + H5Rcreate(rbuf, loc_id, name, ref_type, space_id); + + return rbuf; + } + + /** + * Given a reference to some object, H5Rdereference opens that object and return an identifier. + * + * @param dataset + * IN: Dataset containing reference object. + * @param access_list + * IN: Property list of the object being referenced. + * @param ref_type + * IN: The reference type of ref. + * @param ref + * IN: reference to an object + * + * @return valid identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - output array is null. + * @exception IllegalArgumentException + * - output array is invalid. + **/ + public static long H5Rdereference(long dataset, long access_list, int ref_type, byte[] ref) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException { + long id = _H5Rdereference(dataset, access_list, ref_type, ref); + if (id > 0) { + log.trace("OPEN_IDS: H5Rdereference add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Rdereference(long dataset, long access_list, int ref_type, byte[] ref) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + + /** + * H5Rget_name retrieves a name for the object identified by ref. + * + * @param loc_id + * IN: Identifier for the dataset containing the reference or for the group that dataset is in. + * @param ref_type + * IN: Type of reference. + * @param ref + * IN: An object or dataset region reference. + * @param name + * OUT: A name associated with the referenced object or dataset region. + * @param size + * IN: The size of the name buffer. + * + * @return Returns the length of the name if successful, returning 0 (zero) if no name is associated with the + * identifier. Otherwise returns a negative value. + * + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - size is null. + * @exception IllegalArgumentException + * - Argument is illegal. + * + **/ + public synchronized static native long H5Rget_name(long loc_id, int ref_type, byte[] ref, String[] name, long size) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + + /** + * H5Rget_obj_type Given a reference to an object ref, H5Rget_obj_type returns the type of the object pointed to. + * + * @param loc_id + * IN: loc_id of the reference object. + * @param ref_type + * IN: Type of reference to query. + * @param ref + * IN: the reference + * + * @return Returns the object type + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - array is null. + * @exception IllegalArgumentException + * - array is invalid. + **/ + public synchronized static native int H5Rget_obj_type(long loc_id, int ref_type, byte ref[]) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + + /** + * H5Rget_obj_type2 Retrieves the type of object that an object reference points to. + * + * @see public static int H5Rget_obj_type(int loc_id, int ref_type, byte ref[]) + **/ + private synchronized static native int H5Rget_obj_type2(long loc_id, int ref_type, byte ref[], int[] obj_type) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + + /** + * Given a reference to an object ref, H5Rget_region creates a copy of the dataspace of the dataset pointed to and + * defines a selection in the copy which is the region pointed to. + * + * @param loc_id + * IN: loc_id of the reference object. + * @param ref_type + * IN: The reference type of ref. + * @param ref + * OUT: the reference to the object and region + * + * @return a valid identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - output array is null. + * @exception IllegalArgumentException + * - output array is invalid. + **/ + public static long H5Rget_region(long loc_id, int ref_type, byte[] ref) throws HDF5LibraryException, + NullPointerException, IllegalArgumentException { + long id = _H5Rget_region(loc_id, ref_type, ref); + if (id > 0) { + log.trace("OPEN_IDS: H5Rget_region add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Rget_region(long loc_id, int ref_type, byte[] ref) + throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + + // //////////////////////////////////////////////////////////// + // // + // H5S: Dataspace Interface Functions // + // // + // //////////////////////////////////////////////////////////// + + /** + * H5Sclose releases a dataspace. + * + * @param space_id + * Identifier of dataspace to release. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Sclose(long space_id) throws HDF5LibraryException { + if (space_id < 0) + return 0; // throw new HDF5LibraryException("Negative ID");; + + log.trace("OPEN_IDS: H5Sclose remove {}", space_id); + OPEN_IDS.remove(space_id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + return _H5Sclose(space_id); + } + + private synchronized static native int _H5Sclose(long space_id) throws HDF5LibraryException; + + /** + * H5Scopy creates a new dataspace which is an exact copy of the dataspace identified by space_id. + * + * @param space_id + * Identifier of dataspace to copy. + * @return a dataspace identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Scopy(long space_id) throws HDF5LibraryException { + long id = _H5Scopy(space_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Scopy add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Scopy(long space_id) throws HDF5LibraryException; + + /** + * H5Screate creates a new dataspace of a particular type. + * + * @param type + * IN: The type of dataspace to be created. + * + * @return a dataspace identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Screate(int type) throws HDF5LibraryException { + long id = _H5Screate(type); + if (id > 0) { + log.trace("OPEN_IDS: H5Screate add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Screate(int type) throws HDF5LibraryException; + + /** + * H5Screate_simple creates a new simple data space and opens it for access. + * + * @param rank + * IN: Number of dimensions of dataspace. + * @param dims + * IN: An array of the size of each dimension. + * @param maxdims + * IN: An array of the maximum size of each dimension. + * + * @return a dataspace identifier + * + * @exception HDF5Exception + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - dims or maxdims is null. + **/ + public static long H5Screate_simple(int rank, long[] dims, long[] maxdims) throws HDF5Exception, + NullPointerException { + long id = _H5Screate_simple(rank, dims, maxdims); + if (id > 0) { + log.trace("OPEN_IDS: H5Screate_simple add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Screate_simple(int rank, long[] dims, long[] maxdims) + throws HDF5Exception, NullPointerException; + + /** + * H5Sdecode reconstructs the HDF5 data space object and returns a new object handle for it. + * + * @param buf + * IN: Buffer for the data space object to be decoded. + * + * @return a new object handle + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - buf is null. + **/ + public synchronized static native long H5Sdecode(byte[] buf) throws HDF5LibraryException, NullPointerException; + + /** + * H5Sencode converts a data space description into binary form in a buffer. + * + * @param obj_id + * IN: Identifier of the object to be encoded. + * + * @return the buffer for the object to be encoded into. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native byte[] H5Sencode(long obj_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Sextent_copy copies the extent from source_space_id to dest_space_id. This action may change the type of the + * dataspace. + * + * @param dest_space_id + * IN: The identifier for the dataspace from which the extent is copied. + * @param source_space_id + * IN: The identifier for the dataspace to which the extent is copied. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Sextent_copy(long dest_space_id, long source_space_id) + throws HDF5LibraryException; + + /** + * H5Sextent_equal determines whether the dataspace extents of two dataspaces, space1_id and space2_id, are equal. + * + * @param first_space_id + * IN: The identifier for the first dataspace. + * @param second_space_id + * IN: The identifier for the seconddataspace. + * + * @return true if successful, else false + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Sextent_equal(long first_space_id, long second_space_id) + throws HDF5LibraryException; + + /** + * H5Sget_select_bounds retrieves the coordinates of the bounding box containing the current selection and places + * them into user-supplied buffers. + *

+ * The start and end buffers must be large enough to hold the dataspace rank number of coordinates. + * + * @param spaceid + * Identifier of dataspace to release. + * @param start + * coordinates of lowest corner of bounding box. + * @param end + * coordinates of highest corner of bounding box. + * + * @return a non-negative value if successful,with start and end initialized. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - start or end is null. + **/ + public synchronized static native int H5Sget_select_bounds(long spaceid, long[] start, long[] end) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Sget_select_elem_npoints returns the number of element points in the current dataspace selection. + * + * @param spaceid + * Identifier of dataspace to release. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Sget_select_elem_npoints(long spaceid) throws HDF5LibraryException; + + /** + * H5Sget_select_elem_pointlist returns an array of of element points in the current dataspace selection. The point + * coordinates have the same dimensionality (rank) as the dataspace they are located within, one coordinate per + * point. + * + * @param spaceid + * Identifier of dataspace to release. + * @param startpoint + * first point to retrieve + * @param numpoints + * number of points to retrieve + * @param buf + * returns points startblock to startblock+num-1, each points is rank longs. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - buf is null. + **/ + public synchronized static native int H5Sget_select_elem_pointlist(long spaceid, long startpoint, long numpoints, + long[] buf) throws HDF5LibraryException, NullPointerException; + + /** + * H5Sget_select_hyper_blocklist returns an array of hyperslab blocks. The block coordinates have the same + * dimensionality (rank) as the dataspace they are located within. The list of blocks is formatted as follows: + * + *

+     *    <"start" coordinate>, immediately followed by
+     *    <"opposite" corner coordinate>, followed by
+     *   the next "start" and "opposite" coordinates,
+     *   etc.
+     *   until all of the selected blocks have been listed.
+     * 
+ * + * @param spaceid + * Identifier of dataspace to release. + * @param startblock + * first block to retrieve + * @param numblocks + * number of blocks to retrieve + * @param buf + * returns blocks startblock to startblock+num-1, each block is rank * 2 (corners) longs. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - buf is null. + **/ + public synchronized static native int H5Sget_select_hyper_blocklist(long spaceid, long startblock, long numblocks, + long[] buf) throws HDF5LibraryException, NullPointerException; + + /** + * H5Sget_select_hyper_nblocks returns the number of hyperslab blocks in the current dataspace selection. + * + * @param spaceid + * Identifier of dataspace to release. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Sget_select_hyper_nblocks(long spaceid) throws HDF5LibraryException; + + /** + * H5Sget_select_npoints determines the number of elements in the current selection of a dataspace. + * + * @param space_id + * IN: Identifier of the dataspace object to query + * + * @return the number of elements in the selection if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Sget_select_npoints(long space_id) throws HDF5LibraryException; + + /** + * H5Sget_select_type retrieves the type of selection currently defined for the dataspace space_id. + * + * @param space_id + * IN: Identifier of the dataspace object to query + * + * @return the dataspace selection type if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Sget_select_type(long space_id) throws HDF5LibraryException; + + /** + * H5Sget_simple_extent_dims returns the size and maximum sizes of each dimension of a dataspace through the dims + * and maxdims parameters. + * + * @param space_id + * IN: Identifier of the dataspace object to query + * @param dims + * OUT: Pointer to array to store the size of each dimension. + * @param maxdims + * OUT: Pointer to array to store the maximum size of each dimension. + * + * @return the number of dimensions in the dataspace if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - dims or maxdims is null. + **/ + public synchronized static native int H5Sget_simple_extent_dims(long space_id, long[] dims, long[] maxdims) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Sget_simple_extent_ndims determines the dimensionality (or rank) of a dataspace. + * + * @param space_id + * IN: Identifier of the dataspace + * + * @return the number of dimensions in the dataspace if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Sget_simple_extent_ndims(long space_id) throws HDF5LibraryException; + + /** + * H5Sget_simple_extent_npoints determines the number of elements in a dataspace. + * + * @param space_id + * ID of the dataspace object to query + * @return the number of elements in the dataspace if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Sget_simple_extent_npoints(long space_id) throws HDF5LibraryException; + + /** + * H5Sget_simple_extent_type queries a dataspace to determine the current class of a dataspace. + * + * @param space_id + * Dataspace identifier. + * + * @return a dataspace class name if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Sget_simple_extent_type(long space_id) throws HDF5LibraryException; + + /** + * H5Sis_simple determines whether a dataspace is a simple dataspace. + * + * @param space_id + * Identifier of the dataspace to query + * + * @return true if is a simple dataspace + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Sis_simple(long space_id) throws HDF5LibraryException; + + /** + * H5Soffset_simple sets the offset of a simple dataspace space_id. + * + * @param space_id + * IN: The identifier for the dataspace object to reset. + * @param offset + * IN: The offset at which to position the selection. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - offset array is null. + **/ + public synchronized static native int H5Soffset_simple(long space_id, byte[] offset) throws HDF5LibraryException, + NullPointerException; + + public synchronized static int H5Soffset_simple(long space_id, long[] offset) throws HDF5Exception, + NullPointerException { + if (offset == null) { + return -1; + } + + HDFArray theArray = new HDFArray(offset); + byte[] theArr = theArray.byteify(); + + int retVal = H5Soffset_simple(space_id, theArr); + + theArr = null; + theArray = null; + return retVal; + } + + /** + * H5Sselect_all selects the entire extent of the dataspace space_id. + * + * @param space_id + * IN: The identifier of the dataspace to be selected. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Sselect_all(long space_id) throws HDF5LibraryException; + + /** + * H5Sselect_elements selects array elements to be included in the selection for the space_id dataspace. + * + * @param space_id + * Identifier of the dataspace. + * @param op + * operator specifying how the new selection is combined. + * @param num_elements + * Number of elements to be selected. + * @param coord + * A 2-dimensional array specifying the coordinates of the elements. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + private synchronized static native int H5Sselect_elements(long space_id, int op, int num_elements, byte[] coord) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Sselect_elements selects array elements to be included in the selection for the space_id dataspace. + * + * @param space_id + * Identifier of the dataspace. + * @param op + * operator specifying how the new selection is combined. + * @param num_elements + * Number of elements to be selected. + * @param coord2D + * A 2-dimensional array specifying the coordinates of the elements. + * + * @return a non-negative value if successful + * + * @exception HDF5Exception + * - Error in the data conversion + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - cord array is + **/ + public synchronized static int H5Sselect_elements(long space_id, int op, int num_elements, long[][] coord2D) + throws HDF5Exception, HDF5LibraryException, NullPointerException { + if (coord2D == null) { + return -1; + } + + HDFArray theArray = new HDFArray(coord2D); + byte[] coord = theArray.byteify(); + + int retVal = H5Sselect_elements(space_id, op, num_elements, coord); + + coord = null; + theArray = null; + return retVal; + } + + /** + * H5Sselect_hyperslab selects a hyperslab region to add to the current selected region for the dataspace specified + * by space_id. The start, stride, count, and block arrays must be the same size as the rank of the dataspace. + * + * @param space_id + * IN: Identifier of dataspace selection to modify + * @param op + * IN: Operation to perform on current selection. + * @param start + * IN: Offset of start of hyperslab + * @param stride + * IN: Hyperslab stride. + * @param count + * IN: Number of blocks included in hyperslab. + * @param block + * IN: Size of block in hyperslab. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - an input array is null. + * @exception IllegalArgumentException + * - an input array is invalid. + **/ + public synchronized static int H5Sselect_hyperslab(long space_id, int op, byte[] start, byte[] stride, + byte[] count, byte[] block) throws HDF5LibraryException, NullPointerException, IllegalArgumentException { + ByteBuffer startbb = ByteBuffer.wrap(start); + long[] lastart = (startbb.asLongBuffer()).array(); + ByteBuffer stridebb = ByteBuffer.wrap(stride); + long[] lastride = (stridebb.asLongBuffer()).array(); + ByteBuffer countbb = ByteBuffer.wrap(count); + long[] lacount = (countbb.asLongBuffer()).array(); + ByteBuffer blockbb = ByteBuffer.wrap(block); + long[] lablock = (blockbb.asLongBuffer()).array(); + + return H5Sselect_hyperslab(space_id, op, lastart, lastride, lacount, lablock); + } + + public synchronized static native int H5Sselect_hyperslab(long space_id, int op, long[] start, long[] stride, + long[] count, long[] block) throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + + /** + * H5Sselect_none resets the selection region for the dataspace space_id to include no elements. + * + * @param space_id + * IN: The identifier of the dataspace to be reset. + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Sselect_none(long space_id) throws HDF5LibraryException; + + /** + * H5Sselect_valid verifies that the selection for the dataspace. + * + * @param space_id + * The identifier for the dataspace in which the selection is being reset. + * + * @return true if the selection is contained within the extent and FALSE if it is not or is an error. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Sselect_valid(long space_id) throws HDF5LibraryException; + + /** + * H5Sset_extent_none removes the extent from a dataspace and sets the type to H5S_NONE. + * + * @param space_id + * The identifier for the dataspace from which the extent is to be removed. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Sset_extent_none(long space_id) throws HDF5LibraryException; + + /** + * H5Sset_extent_simple sets or resets the size of an existing dataspace. + * + * @param space_id + * Dataspace identifier. + * @param rank + * Rank, or dimensionality, of the dataspace. + * @param current_size + * Array containing current size of dataspace. + * @param maximum_size + * Array containing maximum size of dataspace. + * + * @return a dataspace identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Sset_extent_simple(long space_id, int rank, long[] current_size, + long[] maximum_size) throws HDF5LibraryException, NullPointerException; + + public synchronized static long H5Sset_extent_simple(long space_id, int rank, byte[] current_size, + byte[] maximum_size) throws HDF5LibraryException, NullPointerException { + ByteBuffer csbb = ByteBuffer.wrap(current_size); + long[] lacs = (csbb.asLongBuffer()).array(); + ByteBuffer maxsbb = ByteBuffer.wrap(maximum_size); + long[] lamaxs = (maxsbb.asLongBuffer()).array(); + + return H5Sset_extent_simple(space_id, rank, lacs, lamaxs); + } + + /** + * H5Sget_regular_hyperslab determines if a hyperslab selection is regular for the dataspace specified + * by space_id. The start, stride, count, and block arrays must be the same size as the rank of the dataspace. + * + * @param space_id + * IN: Identifier of dataspace selection to modify + * @param start + * OUT: Offset of start of hyperslab + * @param stride + * OUT: Hyperslab stride. + * @param count + * OUT: Number of blocks included in hyperslab. + * @param block + * OUT: Size of block in hyperslab. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - an output array is null. + * @exception IllegalArgumentException + * - an output array is invalid. + **/ + public synchronized static native void H5Sget_regular_hyperslab(long space_id, long[] start, long[] stride, long[] count, long[] block) throws HDF5LibraryException, NullPointerException, IllegalArgumentException; + + /** + * H5Sis_regular_hyperslab retrieves a regular hyperslab selection for the dataspace specified + * by space_id. + * + * @param space_id + * IN: Identifier of dataspace selection to query + * + * @return a TRUE/FALSE for hyperslab selection if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Sis_regular_hyperslab(long space_id) throws HDF5LibraryException; + + // /////// unimplemented //////// + + + + // //////////////////////////////////////////////////////////// + // // + // H5T: Datatype Interface Functions // + // // + // //////////////////////////////////////////////////////////// + + /** + * H5Tarray_create creates a new array datatype object. + * + * @param base_id + * IN: Datatype identifier for the array base datatype. + * @param ndims + * IN: Rank of the array. + * @param dim + * IN: Size of each array dimension. + * + * @return a valid datatype identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - dim is null. + **/ + public static long H5Tarray_create(long base_id, int ndims, long[] dim) throws HDF5LibraryException, + NullPointerException { + long id = _H5Tarray_create2(base_id, ndims, dim); + if (id > 0) { + log.trace("OPEN_IDS: H5Tarray_create add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Tarray_create2(long base_id, int ndims, long[] dim) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Tclose releases a datatype. + * + * @param type_id + * IN: Identifier of datatype to release. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Tclose(long type_id) throws HDF5LibraryException { + if (type_id < 0) + return 0; // throw new HDF5LibraryException("Negative ID");; + + log.trace("OPEN_IDS: H5Tclose remove {}", type_id); + OPEN_IDS.remove(type_id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + return _H5Tclose(type_id); + } + + private synchronized static native int _H5Tclose(long type_id) throws HDF5LibraryException; + + /** + * H5Tcommit saves a transient datatype as an immutable named datatype in a file. + * + * @param loc_id + * IN: Location identifier. + * @param name + * IN: Name given to committed datatype. + * @param type_id + * IN: Identifier of datatype to be committed. + * @param lcpl_id + * IN: Link creation property list. + * @param tcpl_id + * IN: Datatype creation property list. + * @param tapl_id + * IN: Datatype access property list. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native void H5Tcommit(long loc_id, String name, long type_id, long lcpl_id, + long tcpl_id, long tapl_id) throws HDF5LibraryException, NullPointerException; + + /** + * H5Tcommit_anon commits a transient datatype (not immutable) to a file, turning it into a named datatype with the + * specified creation and property lists. + * + * @param loc_id + * IN: Location identifier. + * @param type_id + * IN: Identifier of datatype to be committed. + * @param tcpl_id + * IN: Datatype creation property list. + * @param tapl_id + * IN: Datatype access property list. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Tcommit_anon(long loc_id, long type_id, long tcpl_id, long tapl_id) + throws HDF5LibraryException; + + /** + * H5Tcommitted queries a type to determine whether the type specified by the type identifier is a named type or a + * transient type. + * + * @param type_id + * IN: Identifier of datatype. + * + * @return true the datatype has been committed + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Tcommitted(long type_id) throws HDF5LibraryException; + + /** + * H5Tcompiler_conv finds out whether the library's conversion function from type src_id to type dst_id is a + * compiler (hard) conversion. + * + * @param src_id + * IN: Identifier of source datatype. + * @param dst_id + * IN: Identifier of destination datatype. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Tcompiler_conv(long src_id, long dst_id) throws HDF5LibraryException; + + /** + ** H5Tconvert converts nelmts elements from the type specified by the src_id identifier to type dst_id. + * + * @param src_id + * IN: Identifier of source datatype. + * @param dst_id + * IN: Identifier of destination datatype. + * @param nelmts + * IN: Size of array buf. + * @param buf + * IN: Array containing pre- and post-conversion values. + * @param background + * IN: Optional background buffer. + * @param plist_id + * IN: Dataset transfer property list identifier. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - buf is null. + **/ + public synchronized static native void H5Tconvert(long src_id, long dst_id, long nelmts, byte[] buf, + byte[] background, long plist_id) throws HDF5LibraryException, NullPointerException; + + // int H5Tconvert(int src_id, int dst_id, long nelmts, Pointer buf, Pointer background, int plist_id); + + /** + * H5Tcopy copies an existing datatype. The returned type is always transient and unlocked. + * + * @param type_id + * IN: Identifier of datatype to copy. Can be a datatype identifier, a predefined datatype (defined in + * H5Tpublic.h), or a dataset Identifier. + * + * @return a datatype identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Tcopy(long type_id) throws HDF5LibraryException { + long id = _H5Tcopy(type_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Tcopy add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Tcopy(long type_id) throws HDF5LibraryException; + + /** + * H5Tcreate creates a new dataype of the specified class with the specified number of bytes. + * + * @param tclass + * IN: Class of datatype to create. + * @param size + * IN: The number of bytes in the datatype to create. + * + * @return datatype identifier + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Tcreate(int tclass, long size) throws HDF5LibraryException { + long id = _H5Tcreate(tclass, size); + if (id > 0) { + log.trace("OPEN_IDS: H5Tcreate add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Tcreate(int type, long size) throws HDF5LibraryException; + + /** + * H5Tdecode reconstructs the HDF5 data type object and returns a new object handle for it. + * + * @param buf + * IN: Buffer for the data type object to be decoded. + * + * @return a new object handle + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - buf is null. + **/ + public static long H5Tdecode(byte[] buf) throws HDF5LibraryException, NullPointerException { + long id = _H5Tdecode(buf); + if (id > 0) { + log.trace("OPEN_IDS: H5Tdecode add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Tdecode(byte[] buf) throws HDF5LibraryException, NullPointerException; + + /** + * H5Tdetect_class determines whether the datatype specified in dtype_id contains any datatypes of the datatype + * class specified in dtype_class. + * + * @param type_id + * IN: Identifier of datatype to query. + * @param cls + * IN: Identifier of datatype cls. + * + * @return true if the datatype specified in dtype_id contains any datatypes of the datatype class + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Tdetect_class(long type_id, int cls) throws HDF5LibraryException; + + /** + * H5Tencode converts a data type description into binary form in a buffer. + * + * @param obj_id + * IN: Identifier of the object to be encoded. + * @param buf + * OUT: Buffer for the object to be encoded into. If the provided buffer is NULL, only the size of buffer + * needed is returned. + * @param nalloc + * IN: The size of the allocated buffer. + * + * @return the size needed for the allocated buffer. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - buf is null. + **/ + public synchronized static native int H5Tencode(long obj_id, byte[] buf, long nalloc) throws HDF5LibraryException, + NullPointerException; + + // /** + // * H5Tencode converts a data type description into binary form in a buffer. + // * + // * @param obj_id IN: Identifier of the object to be encoded. + // * + // * @return the buffer for the object to be encoded into. + // * + // * @exception HDF5LibraryException - Error from the HDF-5 Library. + // **/ + // public synchronized static native byte[] H5Tencode(int obj_id) + // throws HDF5LibraryException; + + /** + * H5Tenum_create creates a new enumeration datatype based on the specified base datatype, parent_id, which must be + * an integer type. + * + * @param base_id + * IN: Identifier of the parent datatype to release. + * + * @return the datatype identifier for the new enumeration datatype + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Tenum_create(long base_id) throws HDF5LibraryException { + long id = _H5Tenum_create(base_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Tenum_create add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Tenum_create(long base_id) throws HDF5LibraryException; + + /** + * H5Tenum_insert inserts a new enumeration datatype member into an enumeration datatype. + * + * @param type + * IN: Identifier of datatype. + * @param name + * IN: The name of the member + * @param value + * IN: The value of the member, data of the correct type + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native void H5Tenum_insert(long type, String name, byte[] value) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Tenum_insert inserts a new enumeration datatype member into an enumeration datatype. + * + * @param type + * IN: Identifier of datatype. + * @param name + * IN: The name of the member + * @param value + * IN: The value of the member, data of the correct type + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static int H5Tenum_insert(long type, String name, int[] value) throws HDF5LibraryException, + NullPointerException { + return H5Tenum_insert_int(type, name, value); + } + + public static int H5Tenum_insert(long type, String name, int value) throws HDF5LibraryException, + NullPointerException { + int[] val = { value }; + return H5Tenum_insert_int(type, name, val); + } + + private synchronized static native int H5Tenum_insert_int(long type, String name, int[] value) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Tenum_nameof finds the symbol name that corresponds to the specified value of the enumeration datatype type. + * + * @param type + * IN: Identifier of datatype. + * @param value + * IN: The value of the member, data of the correct + * @param size + * IN: The probable length of the name + * + * @return the symbol name. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - value is null. + **/ + public synchronized static native String H5Tenum_nameof(long type, byte[] value, long size) + throws HDF5LibraryException, NullPointerException; + + // int H5Tenum_nameof(int type, Pointer value, Buffer name/* out */, long size); + + /** + * H5Tenum_nameof finds the symbol name that corresponds to the specified value of the enumeration datatype type. + * + * @param type + * IN: Identifier of datatype. + * @param value + * IN: The value of the member, data of the correct + * @param name + * OUT: The name of the member + * @param size + * IN: The max length of the name + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static int H5Tenum_nameof(long type, int[] value, String[] name, int size) throws HDF5LibraryException, + NullPointerException { + return H5Tenum_nameof_int(type, value, name, size); + } + + private synchronized static native int H5Tenum_nameof_int(long type, int[] value, String[] name, int size) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Tenum_valueof finds the value that corresponds to the specified name of the enumeration datatype type. + * + * @param type + * IN: Identifier of datatype. + * @param name + * IN: The name of the member + * @param value + * OUT: The value of the member + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Tenum_valueof(long type, String name, byte[] value) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Tenum_valueof finds the value that corresponds to the specified name of the enumeration datatype type. + * + * @param type + * IN: Identifier of datatype. + * @param name + * IN: The name of the member + * @param value + * OUT: The value of the member + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static int H5Tenum_valueof(long type, String name, int[] value) throws HDF5LibraryException, + NullPointerException { + return H5Tenum_valueof_int(type, name, value); + } + + private synchronized static native int H5Tenum_valueof_int(long type, String name, int[] value) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Tequal determines whether two datatype identifiers refer to the same datatype. + * + * @param type_id1 + * IN: Identifier of datatype to compare. + * @param type_id2 + * IN: Identifier of datatype to compare. + * + * @return true if the datatype identifiers refer to the same datatype, else false. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Tequal(long type_id1, long type_id2) throws HDF5LibraryException; + + /** + * H5Tget_array_dims returns the sizes of the dimensions of the specified array datatype object. + * + * @param type_id + * IN: Datatype identifier of array object. + * @param dims + * OUT: Sizes of array dimensions. + * + * @return the non-negative number of dimensions of the array type + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - dims is null. + **/ + public static int H5Tget_array_dims(long type_id, long[] dims) throws HDF5LibraryException, NullPointerException { + return H5Tget_array_dims2(type_id, dims); + } + + /** + * H5Tget_array_dims2 returns the sizes of the dimensions of the specified array datatype object. + * + * @param type_id + * IN: Datatype identifier of array object. + * @param dims + * OUT: Sizes of array dimensions. + * + * @return the non-negative number of dimensions of the array type + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - dims is null. + **/ + public synchronized static native int H5Tget_array_dims2(long type_id, long[] dims) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Tget_array_ndims returns the rank, the number of dimensions, of an array datatype object. + * + * @param type_id + * IN: Datatype identifier of array object. + * + * @return the rank of the array + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_array_ndims(long type_id) throws HDF5LibraryException; + + /** + * H5Tget_class returns the datatype class identifier. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return datatype class identifier if successful; otherwise H5T_NO_CLASS(-1). + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_class(long type_id) throws HDF5LibraryException; + + /** + * H5Tget_class_name returns the datatype class identifier. + * + * @param class_id + * IN: Identifier of class from H5Tget_class. + * + * @return class name if successful; otherwise H5T_NO_CLASS. + * + **/ + public static String H5Tget_class_name(long class_id) { + String retValue = null; + if (HDF5Constants.H5T_INTEGER == class_id) /* integer types */ + retValue = "H5T_INTEGER"; + else if (HDF5Constants.H5T_FLOAT == class_id) /* floating-point types */ + retValue = "H5T_FLOAT"; + else if (HDF5Constants.H5T_TIME == class_id) /* date and time types */ + retValue = "H5T_TIME"; + else if (HDF5Constants.H5T_STRING == class_id) /* character string types */ + retValue = "H5T_STRING"; + else if (HDF5Constants.H5T_BITFIELD == class_id) /* bit field types */ + retValue = "H5T_BITFIELD"; + else if (HDF5Constants.H5T_OPAQUE == class_id) /* opaque types */ + retValue = "H5T_OPAQUE"; + else if (HDF5Constants.H5T_COMPOUND == class_id) /* compound types */ + retValue = "H5T_COMPOUND"; + else if (HDF5Constants.H5T_REFERENCE == class_id)/* reference types */ + retValue = "H5T_REFERENCE"; + else if (HDF5Constants.H5T_ENUM == class_id) /* enumeration types */ + retValue = "H5T_ENUM"; + else if (HDF5Constants.H5T_VLEN == class_id) /* Variable-Length types */ + retValue = "H5T_VLEN"; + else if (HDF5Constants.H5T_ARRAY == class_id) /* Array types */ + retValue = "H5T_ARRAY"; + else + retValue = "H5T_NO_CLASS"; + + return retValue; + } + + /** + * H5Tget_create_plist returns a property list identifier for the datatype creation property list associated with + * the datatype specified by type_id. + * + * @param type_id + * IN: Identifier of datatype. + * + * @return a datatype property list identifier. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Tget_create_plist(long type_id) throws HDF5LibraryException { + long id = _H5Tget_create_plist(type_id); + if (id > 0) { + log.trace("OPEN_IDS: _H5Tget_create_plist add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Tget_create_plist(long type_id) throws HDF5LibraryException; + + /** + * H5Tget_cset retrieves the character set type of a string datatype. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return a valid character set type if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_cset(long type_id) throws HDF5LibraryException; + + /** + * H5Tset_cset the character set to be used. + * + * @param type_id + * IN: Identifier of datatype to modify. + * @param cset + * IN: Character set type. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tset_cset(long type_id, int cset) throws HDF5LibraryException; + + /** + * H5Tget_ebias retrieves the exponent bias of a floating-point type. + * + * @param type_id + * Identifier of datatype to query. + * + * @return the bias if successful; otherwise 0. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_ebias(long type_id) throws HDF5LibraryException; + + /** + * H5Tset_ebias sets the exponent bias of a floating-point type. + * + * @param type_id + * Identifier of datatype to set. + * @param ebias + * Exponent bias value. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Tset_ebias(long type_id, int ebias) throws HDF5LibraryException { + H5Tset_ebias(type_id, (long) ebias); + return 0; + } + + /** + * H5Tget_ebias retrieves the exponent bias of a floating-point type. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return the bias + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Tget_ebias_long(long type_id) throws HDF5LibraryException; + + /** + * H5Tset_ebias sets the exponent bias of a floating-point type. + * + * @param type_id + * IN: Identifier of datatype to set. + * @param ebias + * IN: Exponent bias value. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Tset_ebias(long type_id, long ebias) throws HDF5LibraryException; + + /** + * H5Tget_fields retrieves information about the locations of the various bit fields of a floating point datatype. + * + * @param type_id + * IN: Identifier of datatype to query. + * @param fields + * OUT: location of size and bit-position. + *
    + *
  • fields[0] = spos OUT: location to return size of in bits.
  • + *
  • fields[1] = epos OUT: location to return exponent bit-position.
  • + *
  • fields[2] = esize OUT: location to return size of exponent in bits.
  • + *
  • fields[3] = mpos OUT: location to return mantissa bit-position.
  • + *
  • fields[4] = msize OUT: location to return size of mantissa in bits.
  • + *
+ * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - fields is null. + * @exception IllegalArgumentException + * - fields array is invalid. + **/ + public synchronized static native void H5Tget_fields(long type_id, long[] fields) throws HDF5LibraryException, + NullPointerException, IllegalArgumentException; + + /** + * H5Tget_fields retrieves information about the locations of the various bit fields of a floating point datatype. + * + * @param type_id + * IN: Identifier of datatype to query. + * @param fields + * OUT: location of size and bit-position. + * + *
+     *      fields[0] = spos  OUT: location to return size of in bits.
+     *      fields[1] = epos  OUT: location to return exponent bit-position.
+     *      fields[2] = esize OUT: location to return size of exponent in bits.
+     *      fields[3] = mpos  OUT: location to return mantissa bit-position.
+     *      fields[4] = msize OUT: location to return size of mantissa in bits.
+     * 
+ * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - fields is null. + * @exception IllegalArgumentException + * - fields array is invalid. + **/ + public static int H5Tget_fields(long type_id, int[] fields) throws HDF5LibraryException, NullPointerException, + IllegalArgumentException { + return H5Tget_fields_int(type_id, fields); + } + + private synchronized static native int H5Tget_fields_int(long type_id, int[] fields) throws HDF5LibraryException, + NullPointerException, IllegalArgumentException; + + /** + * H5Tset_fields sets the locations and sizes of the various floating point bit fields. + * + * @param type_id + * IN: Identifier of datatype to set. + * @param spos + * IN: Size position. + * @param epos + * IN: Exponent bit position. + * @param esize + * IN: Size of exponent in bits. + * @param mpos + * IN: Mantissa bit position. + * @param msize + * IN: Size of mantissa in bits. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Tset_fields(long type_id, long spos, long epos, long esize, long mpos, + long msize) throws HDF5LibraryException; + + /** + * H5Tset_fields sets the locations and sizes of the various floating point bit fields. + * + * @param type_id + * Identifier of datatype to set. + * @param spos + * Size position. + * @param epos + * Exponent bit position. + * @param esize + * Size of exponent in bits. + * @param mpos + * Mantissa bit position. + * @param msize + * Size of mantissa in bits. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Tset_fields(long type_id, int spos, int epos, int esize, int mpos, int msize) + throws HDF5LibraryException { + H5Tset_fields(type_id, (long) spos, (long) epos, (long) esize, (long) mpos, (long) msize); + return 0; + } + + /** + * H5Tget_inpad retrieves the internal padding type for unused bits in floating-point datatypes. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return a valid padding type if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_inpad(long type_id) throws HDF5LibraryException; + + /** + * If any internal bits of a floating point type are unused (that is, those significant bits which are not part of + * the sign, exponent, or mantissa), then H5Tset_inpad will be filled according to the value of the padding value + * property inpad. + * + * @param type_id + * IN: Identifier of datatype to modify. + * @param inpad + * IN: Padding type. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tset_inpad(long type_id, int inpad) throws HDF5LibraryException; + + /** + * H5Tget_member_class returns the class of datatype of the specified member. + * + * @param type_id + * IN: Datatype identifier of compound object. + * @param membno + * IN: Compound object member number. + * + * @return the class of the datatype of the field if successful; + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_member_class(long type_id, int membno) throws HDF5LibraryException; + + /** + * H5Tget_member_index retrieves the index of a field of a compound datatype. + * + * @param type_id + * IN: Identifier of datatype to query. + * @param field_name + * IN: Field name of the field index to retrieve. + * + * @return if field is defined, the index; else negative. + **/ + public synchronized static native int H5Tget_member_index(long type_id, String field_name); + + /** + * H5Tget_member_name retrieves the name of a field of a compound datatype or an element of an enumeration datatype. + * + * @param type_id + * IN: Identifier of datatype to query. + * @param field_idx + * IN: Field index (0-based) of the field name to retrieve. + * + * @return a valid pointer to the name if successful; otherwise null. + **/ + public synchronized static native String H5Tget_member_name(long type_id, int field_idx); + + /** + * H5Tget_member_offset returns the byte offset of the specified member of the compound datatype. This is the byte + * offset in the HDF-5 file/library, NOT the offset of any Java object which might be mapped to this data item. + * + * @param type_id + * IN: Identifier of datatype to query. + * @param membno + * IN: Field index (0-based) of the field type to retrieve. + * + * @return the offset of the member. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Tget_member_offset(long type_id, int membno) throws HDF5LibraryException; + + /** + * H5Tget_member_type returns the datatype of the specified member. + * + * @param type_id + * IN: Identifier of datatype to query. + * @param field_idx + * IN: Field index (0-based) of the field type to retrieve. + * + * @return the identifier of a copy of the datatype of the field if successful; + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Tget_member_type(long type_id, int field_idx) throws HDF5LibraryException { + long id = _H5Tget_member_type(type_id, field_idx); + if (id > 0) { + log.trace("OPEN_IDS: H5Tget_member_type add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Tget_member_type(long type_id, int field_idx) + throws HDF5LibraryException; + + /** + * H5Tget_member_value returns the value of the enumeration datatype member memb_no. + * + * @param type_id + * IN: Datatype identifier for the enumeration datatype. + * @param membno + * IN: Number of the enumeration datatype member. + * @param value + * OUT: The value of the member + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - value is null. + **/ + public synchronized static native void H5Tget_member_value(long type_id, int membno, byte[] value) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Tget_member_value returns the value of the enumeration datatype member memb_no. + * + * @param type_id + * IN: Identifier of datatype. + * @param membno + * IN: The name of the member + * @param value + * OUT: The value of the member + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - value is null. + **/ + public static int H5Tget_member_value(long type_id, int membno, int[] value) throws HDF5LibraryException, + NullPointerException { + return H5Tget_member_value_int(type_id, membno, value); + } + + private synchronized static native int H5Tget_member_value_int(long type_id, int membno, int[] value) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Tget_native_type returns the equivalent native datatype for the datatype specified in type_id. + * + * @param type_id + * IN: Identifier of datatype to query. Direction of search is assumed to be in ascending order. + * + * @return the native datatype identifier for the specified dataset datatype. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static long H5Tget_native_type(long type_id) throws HDF5LibraryException { + return H5Tget_native_type(type_id, HDF5Constants.H5T_DIR_ASCEND); + } + + /** + * H5Tget_native_type returns the equivalent native datatype for the datatype specified in type_id. + * + * @param type_id + * IN: Identifier of datatype to query. + * @param direction + * IN: Direction of search. + * + * @return the native datatype identifier for the specified dataset datatype. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Tget_native_type(long type_id, int direction) throws HDF5LibraryException { + long id = _H5Tget_native_type(type_id, direction); + if (id > 0) { + log.trace("OPEN_IDS: H5Tget_native_type add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Tget_native_type(long tid, int direction) throws HDF5LibraryException; + + /** + * H5Tget_nmembers retrieves the number of fields a compound datatype has. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return number of members datatype has if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_nmembers(long type_id) throws HDF5LibraryException; + + /** + * H5Tget_norm retrieves the mantissa normalization of a floating-point datatype. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return a valid normalization type if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_norm(long type_id) throws HDF5LibraryException; + + /** + * H5Tset_norm sets the mantissa normalization of a floating-point datatype. + * + * @param type_id + * IN: Identifier of datatype to set. + * @param norm + * IN: Mantissa normalization type. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tset_norm(long type_id, int norm) throws HDF5LibraryException; + + /** + * H5Tget_offset retrieves the bit offset of the first significant bit. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return a positive offset value if successful; otherwise 0. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_offset(long type_id) throws HDF5LibraryException; + + /** + * H5Tset_offset sets the bit offset of the first significant bit. + * + * @param type_id + * Identifier of datatype to set. + * @param offset + * Offset of first significant bit. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Tset_offset(long type_id, int offset) throws HDF5LibraryException { + H5Tset_offset(type_id, (long) offset); + return 0; + } + + /** + * H5Tset_offset sets the bit offset of the first significant bit. + * + * @param type_id + * IN: Identifier of datatype to set. + * @param offset + * IN: Offset of first significant bit. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Tset_offset(long type_id, long offset) throws HDF5LibraryException; + + /** + * H5Tget_order returns the byte order of an atomic datatype. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return a byte order constant if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_order(long type_id) throws HDF5LibraryException; + + /** + * H5Tset_order sets the byte ordering of an atomic datatype. + * + * @param type_id + * IN: Identifier of datatype to set. + * @param order + * IN: Byte ordering constant. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tset_order(long type_id, int order) throws HDF5LibraryException; + + /** + * H5Tget_pad retrieves the padding type of the least and most-significant bit padding. + * + * @param type_id + * IN: Identifier of datatype to query. + * @param pad + * OUT: locations to return least-significant and most-significant bit padding type. + * + *
+     *      pad[0] = lsb // least-significant bit padding type
+     *      pad[1] = msb // most-significant bit padding type
+     * 
+ * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - pad is null. + **/ + public synchronized static native int H5Tget_pad(long type_id, int[] pad) throws HDF5LibraryException, + NullPointerException; + + /** + * H5Tset_pad sets the least and most-significant bits padding types. + * + * @param type_id + * IN: Identifier of datatype to set. + * @param lsb + * IN: Padding type for least-significant bits. + * @param msb + * IN: Padding type for most-significant bits. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tset_pad(long type_id, int lsb, int msb) throws HDF5LibraryException; + + /** + * H5Tget_precision returns the precision of an atomic datatype. + * + * @param type_id + * Identifier of datatype to query. + * + * @return the number of significant bits if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_precision(long type_id) throws HDF5LibraryException; + + /** + * H5Tset_precision sets the precision of an atomic datatype. + * + * @param type_id + * Identifier of datatype to set. + * @param precision + * Number of bits of precision for datatype. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static int H5Tset_precision(long type_id, int precision) throws HDF5LibraryException { + H5Tset_precision(type_id, (long) precision); + return 0; + } + + /** + * H5Tget_precision returns the precision of an atomic datatype. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return the number of significant bits if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Tget_precision_long(long type_id) throws HDF5LibraryException; + + /** + * H5Tset_precision sets the precision of an atomic datatype. + * + * @param type_id + * IN: Identifier of datatype to set. + * @param precision + * IN: Number of bits of precision for datatype. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native void H5Tset_precision(long type_id, long precision) throws HDF5LibraryException; + + /** + * H5Tget_sign retrieves the sign type for an integer type. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return a valid sign type if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_sign(long type_id) throws HDF5LibraryException; + + /** + * H5Tset_sign sets the sign proprety for an integer type. + * + * @param type_id + * IN: Identifier of datatype to set. + * @param sign + * IN: Sign type. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tset_sign(long type_id, int sign) throws HDF5LibraryException; + + /** + * H5Tget_size returns the size of a datatype in bytes. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return the size of the datatype in bytes + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native long H5Tget_size(long type_id) throws HDF5LibraryException; + + /** + * H5Tset_size sets the total size in bytes, size, for an atomic datatype (this operation is not permitted on + * compound datatypes). + * + * @param type_id + * IN: Identifier of datatype to change size. + * @param size + * IN: Size in bytes to modify datatype. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tset_size(long type_id, long size) throws HDF5LibraryException; + + /** + * H5Tget_strpad retrieves the string padding method for a string datatype. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return a valid string padding type if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tget_strpad(long type_id) throws HDF5LibraryException; + + /** + * H5Tset_strpad defines the storage mechanism for the string. + * + * @param type_id + * IN: Identifier of datatype to modify. + * @param strpad + * IN: String padding type. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tset_strpad(long type_id, int strpad) throws HDF5LibraryException; + + /** + * H5Tget_super returns the type from which TYPE is derived. + * + * @param type + * IN: Identifier of datatype. + * + * @return the parent type + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Tget_super(long type) throws HDF5LibraryException { + long id = _H5Tget_super(type); + if (id > 0) { + log.trace("OPEN_IDS: H5Tget_super add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Tget_super(long type) throws HDF5LibraryException; + + /** + * H5Tget_tag returns the tag associated with datatype type_id. + * + * @param type + * IN: Identifier of datatype. + * + * @return the tag + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native String H5Tget_tag(long type) throws HDF5LibraryException; + + /** + * H5Tset_tag tags an opaque datatype type_id with a unique ASCII identifier tag. + * + * @param type + * IN: Datatype identifier for the opaque datatype to be tagged. + * @param tag + * IN: Descriptive ASCII string with which the opaque datatype is to be tagged. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tset_tag(long type, String tag) throws HDF5LibraryException; + + /** + * H5Tinsert adds another member to the compound datatype type_id. + * + * @param type_id + * IN: Identifier of compound datatype to modify. + * @param name + * IN: Name of the field to insert. + * @param offset + * IN: Offset in memory structure of the field to insert. + * @param field_id + * IN: Datatype identifier of the field to insert. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public synchronized static native int H5Tinsert(long type_id, String name, long offset, long field_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Tis_variable_str determines whether the datatype identified in type_id is a variable-length string. + * + * @param type_id + * IN: Identifier of datatype to query. + * + * @return true if type_id is a variable-length string. + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native boolean H5Tis_variable_str(long type_id) throws HDF5LibraryException; + + /** + * H5Tlock locks the datatype specified by the type_id identifier, making it read-only and non-destrucible. + * + * @param type_id + * IN: Identifier of datatype to lock. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tlock(long type_id) throws HDF5LibraryException; + + /** + * H5Topen opens a named datatype at the location specified by loc_id and return an identifier for the datatype. + * + * @param loc_id + * IN: A file, group, or datatype identifier. + * @param name + * IN: A datatype name, defined within the file or group identified by loc_id. + * @param tapl_id + * IN: Datatype access property list. + * + * @return a named datatype identifier if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + * @exception NullPointerException + * - name is null. + **/ + public static long H5Topen(long loc_id, String name, long tapl_id) throws HDF5LibraryException, + NullPointerException { + long id = _H5Topen2(loc_id, name, tapl_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Topen add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Topen2(long loc_id, String name, long tapl_id) + throws HDF5LibraryException, NullPointerException; + + /** + * H5Tpack recursively removes padding from within a compound datatype to make it more efficient (space-wise) to + * store that data. + *

+ * WARNING: This call only affects the C-data, even if it succeeds, there may be no visible effect on Java + * objects. + * + * @param type_id + * IN: Identifier of datatype to modify. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public synchronized static native int H5Tpack(long type_id) throws HDF5LibraryException; + + /** + * H5Tvlen_create creates a new variable-length (VL) dataype. + * + * @param base_id + * IN: Identifier of parent datatype. + * + * @return a non-negative value if successful + * + * @exception HDF5LibraryException + * - Error from the HDF-5 Library. + **/ + public static long H5Tvlen_create(long base_id) throws HDF5LibraryException { + long id = _H5Tvlen_create(base_id); + if (id > 0) { + log.trace("OPEN_IDS: H5Tvlen_create add {}", id); + OPEN_IDS.add(id); + log.trace("OPEN_IDS: {}", OPEN_IDS.size()); + } + return id; + } + + private synchronized static native long _H5Tvlen_create(long base_id) throws HDF5LibraryException; + + // /////// unimplemented //////// + + // H5T_conv_t H5Tfind(int src_id, int dst_id, H5T_cdata_t *pcdata); + + // public synchronized static native int H5Tregister(H5T_pers_t pers, String name, int src_id, int dst_id, + // H5T_conv_t func) + // throws HDF5LibraryException, NullPointerException; + + // public synchronized static native int H5Tunregister(H5T_pers_t pers, String name, int src_id, int dst_id, + // H5T_conv_t func) + // throws HDF5LibraryException, NullPointerException; + + // //////////////////////////////////////////////////////////// + // // + // H5Z: Filter Interface Functions // + // // + // //////////////////////////////////////////////////////////// + + public synchronized static native int H5Zfilter_avail(int filter) throws HDF5LibraryException, NullPointerException; + + public synchronized static native int H5Zget_filter_info(int filter) throws HDF5LibraryException; + + public synchronized static native int H5Zunregister(int filter) throws HDF5LibraryException, NullPointerException; + +} + +// /////// unimplemented //////// + +// herr_t H5Zregister(const void *cls); + diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java new file mode 100644 index 0000000..8089544 --- /dev/null +++ b/java/src/hdf/hdf5lib/HDF5Constants.java @@ -0,0 +1,1877 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +package hdf.hdf5lib; + +/** + * /** This class contains C constants and enumerated types of HDF5 library. The + * values of these constants are obtained from the library by calling J2C(int + * jconstant), where jconstant is any of the private constants which start their + * name with "JH5" need to be converted. + *

+ * Do not edit this file! + * + * See also: hdf.hdf5lib.HDF5Library + */ +public class HDF5Constants { + static { + H5.loadH5Lib(); + } + + // ///////////////////////////////////////////////////////////////////////// + // Get the HDF5 constants from the library // + // ///////////////////////////////////////////////////////////////////////// + + public static final long H5_QUARTER_HADDR_MAX = H5_QUARTER_HADDR_MAX(); + + public static final int H5_SZIP_MAX_PIXELS_PER_BLOCK = H5_SZIP_MAX_PIXELS_PER_BLOCK(); + public static final int H5_SZIP_NN_OPTION_MASK = H5_SZIP_NN_OPTION_MASK(); + public static final int H5_SZIP_EC_OPTION_MASK = H5_SZIP_EC_OPTION_MASK(); + public static final int H5_SZIP_ALLOW_K13_OPTION_MASK = H5_SZIP_ALLOW_K13_OPTION_MASK(); + public static final int H5_SZIP_CHIP_OPTION_MASK = H5_SZIP_CHIP_OPTION_MASK(); + public static final int H5_INDEX_UNKNOWN = H5_INDEX_UNKNOWN(); + public static final int H5_INDEX_NAME = H5_INDEX_NAME(); + public static final int H5_INDEX_CRT_ORDER = H5_INDEX_CRT_ORDER(); + public static final int H5_INDEX_N = H5_INDEX_N(); + public static final int H5_ITER_UNKNOWN = H5_ITER_UNKNOWN(); + public static final int H5_ITER_INC = H5_ITER_INC(); + public static final int H5_ITER_DEC = H5_ITER_DEC(); + public static final int H5_ITER_NATIVE = H5_ITER_NATIVE(); + public static final int H5_ITER_N = H5_ITER_N(); + public static final int H5AC_CURR_CACHE_CONFIG_VERSION = H5AC_CURR_CACHE_CONFIG_VERSION(); + public static final int H5AC_MAX_TRACE_FILE_NAME_LEN = H5AC_MAX_TRACE_FILE_NAME_LEN(); + public static final int H5AC_METADATA_WRITE_STRATEGY_PROCESS_ZERO_ONLY = H5AC_METADATA_WRITE_STRATEGY_PROCESS_ZERO_ONLY(); + public static final int H5AC_METADATA_WRITE_STRATEGY_DISTRIBUTED = H5AC_METADATA_WRITE_STRATEGY_DISTRIBUTED(); + public static final int H5C_incr_off = H5C_incr_off(); + public static final int H5C_incr_threshold = H5C_incr_threshold(); + public static final int H5C_flash_incr_off = H5C_flash_incr_off(); + public static final int H5C_flash_incr_add_space = H5C_flash_incr_add_space(); + public static final int H5C_decr_off = H5C_decr_off(); + public static final int H5C_decr_threshold = H5C_decr_threshold(); + public static final int H5C_decr_age_out = H5C_decr_age_out(); + public static final int H5C_decr_age_out_with_threshold = H5C_decr_age_out_with_threshold(); + public static final int H5D_CHUNK_IDX_BTREE = H5D_CHUNK_IDX_BTREE(); + public static final int H5D_ALLOC_TIME_DEFAULT = H5D_ALLOC_TIME_DEFAULT(); + public static final int H5D_ALLOC_TIME_EARLY = H5D_ALLOC_TIME_EARLY(); + public static final int H5D_ALLOC_TIME_ERROR = H5D_ALLOC_TIME_ERROR(); + public static final int H5D_ALLOC_TIME_INCR = H5D_ALLOC_TIME_INCR(); + public static final int H5D_ALLOC_TIME_LATE = H5D_ALLOC_TIME_LATE(); + public static final int H5D_FILL_TIME_ERROR = H5D_FILL_TIME_ERROR(); + public static final int H5D_FILL_TIME_ALLOC = H5D_FILL_TIME_ALLOC(); + public static final int H5D_FILL_TIME_NEVER = H5D_FILL_TIME_NEVER(); + public static final int H5D_FILL_TIME_IFSET = H5D_FILL_TIME_IFSET(); + public static final int H5D_FILL_VALUE_DEFAULT = H5D_FILL_VALUE_DEFAULT(); + public static final int H5D_FILL_VALUE_ERROR = H5D_FILL_VALUE_ERROR(); + public static final int H5D_FILL_VALUE_UNDEFINED = H5D_FILL_VALUE_UNDEFINED(); + public static final int H5D_FILL_VALUE_USER_DEFINED = H5D_FILL_VALUE_USER_DEFINED(); + public static final int H5D_LAYOUT_ERROR = H5D_LAYOUT_ERROR(); + public static final int H5D_CHUNKED = H5D_CHUNKED(); + public static final int H5D_COMPACT = H5D_COMPACT(); + public static final int H5D_CONTIGUOUS = H5D_CONTIGUOUS(); + public static final int H5D_VIRTUAL = H5D_VIRTUAL(); + public static final int H5D_NLAYOUTS = H5D_NLAYOUTS(); + public static final int H5D_SPACE_STATUS_ALLOCATED = H5D_SPACE_STATUS_ALLOCATED(); + public static final int H5D_SPACE_STATUS_ERROR = H5D_SPACE_STATUS_ERROR(); + public static final int H5D_SPACE_STATUS_NOT_ALLOCATED = H5D_SPACE_STATUS_NOT_ALLOCATED(); + public static final int H5D_SPACE_STATUS_PART_ALLOCATED = H5D_SPACE_STATUS_PART_ALLOCATED(); + public static final int H5D_VDS_ERROR = H5D_VDS_ERROR(); + public static final int H5D_VDS_FIRST_MISSING = H5D_VDS_FIRST_MISSING(); + public static final int H5D_VDS_LAST_AVAILABLE = H5D_VDS_LAST_AVAILABLE(); + + public static final int H5E_MAJOR = H5E_MAJOR(); + public static final int H5E_MINOR = H5E_MINOR(); + public static final long H5E_ALIGNMENT = H5E_ALIGNMENT(); + public static final long H5E_ALREADYEXISTS = H5E_ALREADYEXISTS(); + public static final long H5E_ALREADYINIT = H5E_ALREADYINIT(); + public static final long H5E_ARGS = H5E_ARGS(); + public static final long H5E_ATOM = H5E_ATOM(); + public static final long H5E_ATTR = H5E_ATTR(); + public static final long H5E_BADATOM = H5E_BADATOM(); + public static final long H5E_BADFILE = H5E_BADFILE(); + public static final long H5E_BADGROUP = H5E_BADGROUP(); + public static final long H5E_BADMESG = H5E_BADMESG(); + public static final long H5E_BADRANGE = H5E_BADRANGE(); + public static final long H5E_BADSELECT = H5E_BADSELECT(); + public static final long H5E_BADSIZE = H5E_BADSIZE(); + public static final long H5E_BADTYPE = H5E_BADTYPE(); + public static final long H5E_BADVALUE = H5E_BADVALUE(); + public static final long H5E_BTREE = H5E_BTREE(); + public static final long H5E_CACHE = H5E_CACHE(); + public static final long H5E_CALLBACK = H5E_CALLBACK(); + public static final long H5E_CANAPPLY = H5E_CANAPPLY(); + // public static final long H5E_CANTALLOC = H5E_CANTALLOC(); + public static final long H5E_CANTCLIP = H5E_CANTCLIP(); + public static final long H5E_CANTCLOSEFILE = H5E_CANTCLOSEFILE(); + public static final long H5E_CANTCONVERT = H5E_CANTCONVERT(); + public static final long H5E_CANTCOPY = H5E_CANTCOPY(); + public static final long H5E_CANTCOUNT = H5E_CANTCOUNT(); + public static final long H5E_CANTCREATE = H5E_CANTCREATE(); + public static final long H5E_CANTDEC = H5E_CANTDEC(); + public static final long H5E_CANTDECODE = H5E_CANTDECODE(); + public static final long H5E_CANTDELETE = H5E_CANTDELETE(); + public static final long H5E_CANTENCODE = H5E_CANTENCODE(); + public static final long H5E_CANTFLUSH = H5E_CANTFLUSH(); + public static final long H5E_CANTFREE = H5E_CANTFREE(); + public static final long H5E_CANTGET = H5E_CANTGET(); + public static final long H5E_CANTINC = H5E_CANTINC(); + public static final long H5E_CANTINIT = H5E_CANTINIT(); + public static final long H5E_CANTINSERT = H5E_CANTINSERT(); + public static final long H5E_CANTLIST = H5E_CANTLIST(); + public static final long H5E_CANTLOAD = H5E_CANTLOAD(); + public static final long H5E_CANTLOCK = H5E_CANTLOCK(); + public static final long H5E_CANTNEXT = H5E_CANTNEXT(); + public static final long H5E_CANTOPENFILE = H5E_CANTOPENFILE(); + public static final long H5E_CANTOPENOBJ = H5E_CANTOPENOBJ(); + // public static final long H5E_CANTRECV = H5E_CANTRECV(); + public static final long H5E_CANTREGISTER = H5E_CANTREGISTER(); + public static final long H5E_CANTRELEASE = H5E_CANTRELEASE(); + public static final long H5E_CANTSELECT = H5E_CANTSELECT(); + public static final long H5E_CANTSET = H5E_CANTSET(); + public static final long H5E_CANTSPLIT = H5E_CANTSPLIT(); + public static final long H5E_CANTUNLOCK = H5E_CANTUNLOCK(); + public static final long H5E_CLOSEERROR = H5E_CLOSEERROR(); + public static final long H5E_COMPLEN = H5E_COMPLEN(); + public static final long H5E_DATASET = H5E_DATASET(); + public static final long H5E_DATASPACE = H5E_DATASPACE(); + public static final long H5E_DATATYPE = H5E_DATATYPE(); + public static final long H5E_DEFAULT = H5E_DEFAULT(); + public static final long H5E_DUPCLASS = H5E_DUPCLASS(); + public static final long H5E_EFL = H5E_EFL(); + public static final long H5E_EXISTS = H5E_EXISTS(); + public static final long H5E_FCNTL = H5E_FCNTL(); + public static final long H5E_FILE = H5E_FILE(); + public static final long H5E_FILEEXISTS = H5E_FILEEXISTS(); + public static final long H5E_FILEOPEN = H5E_FILEOPEN(); + public static final long H5E_FUNC = H5E_FUNC(); + public static final long H5E_HEAP = H5E_HEAP(); + public static final long H5E_INTERNAL = H5E_INTERNAL(); + public static final long H5E_IO = H5E_IO(); + public static final long H5E_LINK = H5E_LINK(); + public static final long H5E_LINKCOUNT = H5E_LINKCOUNT(); + public static final long H5E_MOUNT = H5E_MOUNT(); + public static final long H5E_MPI = H5E_MPI(); + public static final long H5E_MPIERRSTR = H5E_MPIERRSTR(); + public static final long H5E_NOFILTER = H5E_NOFILTER(); + public static final long H5E_NOIDS = H5E_NOIDS(); + public static final long H5E_NONE_MAJOR = H5E_NONE_MAJOR(); + public static final long H5E_NONE_MINOR = H5E_NONE_MINOR(); + public static final long H5E_NOSPACE = H5E_NOSPACE(); + public static final long H5E_NOTCACHED = H5E_NOTCACHED(); + public static final long H5E_NOTFOUND = H5E_NOTFOUND(); + public static final long H5E_NOTHDF5 = H5E_NOTHDF5(); + public static final long H5E_OHDR = H5E_OHDR(); + public static final long H5E_OVERFLOW = H5E_OVERFLOW(); + public static final long H5E_PLINE = H5E_PLINE(); + public static final long H5E_PLIST = H5E_PLIST(); + public static final long H5E_PROTECT = H5E_PROTECT(); + public static final long H5E_READERROR = H5E_READERROR(); + public static final long H5E_REFERENCE = H5E_REFERENCE(); + public static final long H5E_RESOURCE = H5E_RESOURCE(); + public static final long H5E_RS = H5E_RS(); + public static final long H5E_SEEKERROR = H5E_SEEKERROR(); + public static final long H5E_SETLOCAL = H5E_SETLOCAL(); + public static final long H5E_STORAGE = H5E_STORAGE(); + public static final long H5E_SYM = H5E_SYM(); + public static final long H5E_TRUNCATED = H5E_TRUNCATED(); + public static final long H5E_TST = H5E_TST(); + public static final long H5E_UNINITIALIZED = H5E_UNINITIALIZED(); + public static final long H5E_UNSUPPORTED = H5E_UNSUPPORTED(); + public static final long H5E_VERSION = H5E_VERSION(); + public static final long H5E_VFL = H5E_VFL(); + public static final long H5E_WALK_DOWNWARD = H5E_WALK_DOWNWARD(); + public static final long H5E_WALK_UPWARD = H5E_WALK_UPWARD(); + public static final long H5E_WRITEERROR = H5E_WRITEERROR(); + + public static final int H5F_ACC_CREAT = H5F_ACC_CREAT(); + public static final int H5F_ACC_EXCL = H5F_ACC_EXCL(); + public static final int H5F_ACC_RDONLY = H5F_ACC_RDONLY(); + public static final int H5F_ACC_RDWR = H5F_ACC_RDWR(); + public static final int H5F_ACC_TRUNC = H5F_ACC_TRUNC(); + public static final int H5F_ACC_DEFAULT = H5F_ACC_DEFAULT(); + public static final int H5F_CLOSE_DEFAULT = H5F_CLOSE_DEFAULT(); + public static final int H5F_CLOSE_SEMI = H5F_CLOSE_SEMI(); + public static final int H5F_CLOSE_STRONG = H5F_CLOSE_STRONG(); + public static final int H5F_CLOSE_WEAK = H5F_CLOSE_WEAK(); + public static final int H5F_LIBVER_EARLIEST = H5F_LIBVER_EARLIEST(); + public static final int H5F_LIBVER_LATEST = H5F_LIBVER_LATEST(); + public static final int H5F_OBJ_ALL = H5F_OBJ_ALL(); + public static final int H5F_OBJ_ATTR = H5F_OBJ_ATTR(); + public static final int H5F_OBJ_DATASET = H5F_OBJ_DATASET(); + public static final int H5F_OBJ_DATATYPE = H5F_OBJ_DATATYPE(); + public static final int H5F_OBJ_FILE = H5F_OBJ_FILE(); + public static final int H5F_OBJ_GROUP = H5F_OBJ_GROUP(); + public static final int H5F_OBJ_LOCAL = H5F_OBJ_LOCAL(); + public static final int H5F_SCOPE_GLOBAL = H5F_SCOPE_GLOBAL(); + public static final int H5F_SCOPE_LOCAL = H5F_SCOPE_LOCAL(); + public static final int H5F_UNLIMITED = H5F_UNLIMITED(); + public static final int H5F_FILE_SPACE_DEFAULT = H5F_FILE_SPACE_DEFAULT(); + public static final int H5F_FILE_SPACE_ALL_PERSIST = H5F_FILE_SPACE_ALL_PERSIST(); + public static final int H5F_FILE_SPACE_ALL = H5F_FILE_SPACE_ALL(); + public static final int H5F_FILE_SPACE_AGGR_VFD = H5F_FILE_SPACE_AGGR_VFD(); + public static final int H5F_FILE_SPACE_VFD = H5F_FILE_SPACE_VFD(); + public static final int H5F_FILE_SPACE_NTYPES = H5F_FILE_SPACE_NTYPES(); + + public static final long H5FD_CORE = H5FD_CORE(); + public static final long H5FD_DIRECT = H5FD_DIRECT(); + public static final long H5FD_FAMILY = H5FD_FAMILY(); + public static final long H5FD_LOG = H5FD_LOG(); + public static final long H5FD_MPIO = H5FD_MPIO(); + public static final long H5FD_MULTI = H5FD_MULTI(); + public static final long H5FD_SEC2 = H5FD_SEC2(); + public static final long H5FD_STDIO = H5FD_STDIO(); + public static final long H5FD_WINDOWS = H5FD_WINDOWS(); + public static final int H5FD_LOG_LOC_READ = H5FD_LOG_LOC_READ(); + public static final int H5FD_LOG_LOC_WRITE = H5FD_LOG_LOC_WRITE(); + public static final int H5FD_LOG_LOC_SEEK = H5FD_LOG_LOC_SEEK(); + public static final int H5FD_LOG_LOC_IO = H5FD_LOG_LOC_IO(); + public static final int H5FD_LOG_FILE_READ = H5FD_LOG_FILE_READ(); + public static final int H5FD_LOG_FILE_WRITE = H5FD_LOG_FILE_WRITE(); + public static final int H5FD_LOG_FILE_IO = H5FD_LOG_FILE_IO(); + public static final int H5FD_LOG_FLAVOR = H5FD_LOG_FLAVOR(); + public static final int H5FD_LOG_NUM_READ = H5FD_LOG_NUM_READ(); + public static final int H5FD_LOG_NUM_WRITE = H5FD_LOG_NUM_WRITE(); + public static final int H5FD_LOG_NUM_SEEK = H5FD_LOG_NUM_SEEK(); + public static final int H5FD_LOG_NUM_TRUNCATE = H5FD_LOG_NUM_TRUNCATE(); + public static final int H5FD_LOG_NUM_IO = H5FD_LOG_NUM_IO(); + public static final int H5FD_LOG_TIME_OPEN = H5FD_LOG_TIME_OPEN(); + public static final int H5FD_LOG_TIME_STAT = H5FD_LOG_TIME_STAT(); + public static final int H5FD_LOG_TIME_READ = H5FD_LOG_TIME_READ(); + public static final int H5FD_LOG_TIME_WRITE = H5FD_LOG_TIME_WRITE(); + public static final int H5FD_LOG_TIME_SEEK = H5FD_LOG_TIME_SEEK(); + public static final int H5FD_LOG_TIME_CLOSE = H5FD_LOG_TIME_CLOSE(); + public static final int H5FD_LOG_TIME_IO = H5FD_LOG_TIME_IO(); + public static final int H5FD_LOG_ALLOC = H5FD_LOG_ALLOC(); + public static final int H5FD_LOG_ALL = H5FD_LOG_ALL(); + public static final int H5FD_MEM_NOLIST = H5FD_MEM_NOLIST(); + public static final int H5FD_MEM_DEFAULT = H5FD_MEM_DEFAULT(); + public static final int H5FD_MEM_SUPER = H5FD_MEM_SUPER(); + public static final int H5FD_MEM_BTREE = H5FD_MEM_BTREE(); + public static final int H5FD_MEM_DRAW = H5FD_MEM_DRAW(); + public static final int H5FD_MEM_GHEAP = H5FD_MEM_GHEAP(); + public static final int H5FD_MEM_LHEAP = H5FD_MEM_LHEAP(); + public static final int H5FD_MEM_OHDR = H5FD_MEM_OHDR(); + public static final int H5FD_MEM_NTYPES = H5FD_MEM_NTYPES(); + public static final long H5FD_DEFAULT_HADDR_SIZE = H5FD_DEFAULT_HADDR_SIZE(); + public static final long H5FD_MEM_DEFAULT_SIZE = H5FD_MEM_DEFAULT_SIZE(); + public static final long H5FD_MEM_DEFAULT_SUPER_SIZE = H5FD_MEM_DEFAULT_SUPER_SIZE(); + public static final long H5FD_MEM_DEFAULT_BTREE_SIZE = H5FD_MEM_DEFAULT_BTREE_SIZE(); + public static final long H5FD_MEM_DEFAULT_DRAW_SIZE = H5FD_MEM_DEFAULT_DRAW_SIZE(); + public static final long H5FD_MEM_DEFAULT_GHEAP_SIZE = H5FD_MEM_DEFAULT_GHEAP_SIZE(); + public static final long H5FD_MEM_DEFAULT_LHEAP_SIZE = H5FD_MEM_DEFAULT_LHEAP_SIZE(); + public static final long H5FD_MEM_DEFAULT_OHDR_SIZE = H5FD_MEM_DEFAULT_OHDR_SIZE(); + +// public static final int H5G_DATASET = H5G_DATASET(); +// public static final int H5G_GROUP = H5G_GROUP(); +// public static final int H5G_LINK = H5G_LINK(); +// public static final int H5G_UDLINK = H5G_UDLINK(); +// public static final int H5G_LINK_ERROR = H5G_LINK_ERROR(); +// public static final int H5G_LINK_HARD = H5G_LINK_HARD(); +// public static final int H5G_LINK_SOFT = H5G_LINK_SOFT(); +// public static final int H5G_NLIBTYPES = H5G_NLIBTYPES(); +// public static final int H5G_NTYPES = H5G_NTYPES(); +// public static final int H5G_NUSERTYPES = H5G_NUSERTYPES(); +// public static final int H5G_RESERVED_5 = H5G_RESERVED_5(); +// public static final int H5G_RESERVED_6 = H5G_RESERVED_6(); +// public static final int H5G_RESERVED_7 = H5G_RESERVED_7(); +// public static final int H5G_SAME_LOC = H5G_SAME_LOC(); +// public static final int H5G_TYPE = H5G_TYPE(); +// public static final int H5G_UNKNOWN = H5G_UNKNOWN(); + + public static final int H5G_STORAGE_TYPE_UNKNOWN = H5G_STORAGE_TYPE_UNKNOWN(); + public static final int H5G_STORAGE_TYPE_SYMBOL_TABLE = H5G_STORAGE_TYPE_SYMBOL_TABLE(); + public static final int H5G_STORAGE_TYPE_COMPACT = H5G_STORAGE_TYPE_COMPACT(); + public static final int H5G_STORAGE_TYPE_DENSE = H5G_STORAGE_TYPE_DENSE(); + + public static final int H5I_ATTR = H5I_ATTR(); + public static final int H5I_BADID = H5I_BADID(); + public static final int H5I_DATASET = H5I_DATASET(); + public static final int H5I_DATASPACE = H5I_DATASPACE(); + public static final int H5I_DATATYPE = H5I_DATATYPE(); + public static final int H5I_ERROR_CLASS = H5I_ERROR_CLASS(); + public static final int H5I_ERROR_MSG = H5I_ERROR_MSG(); + public static final int H5I_ERROR_STACK = H5I_ERROR_STACK(); + public static final int H5I_FILE = H5I_FILE(); + public static final int H5I_GENPROP_CLS = H5I_GENPROP_CLS(); + public static final int H5I_GENPROP_LST = H5I_GENPROP_LST(); + public static final int H5I_GROUP = H5I_GROUP(); + public static final int H5I_INVALID_HID = H5I_INVALID_HID(); + public static final int H5I_NTYPES = H5I_NTYPES(); + public static final int H5I_REFERENCE = H5I_REFERENCE(); + public static final int H5I_UNINIT = H5I_UNINIT(); + public static final int H5I_VFL = H5I_VFL(); + + public static final int H5L_TYPE_ERROR = H5L_TYPE_ERROR(); + public static final int H5L_TYPE_HARD = H5L_TYPE_HARD(); + public static final int H5L_TYPE_SOFT = H5L_TYPE_SOFT(); + public static final int H5L_TYPE_EXTERNAL = H5L_TYPE_EXTERNAL(); + public static final int H5L_TYPE_MAX = H5L_TYPE_MAX(); + + public static final int H5O_COPY_SHALLOW_HIERARCHY_FLAG = H5O_COPY_SHALLOW_HIERARCHY_FLAG(); + public static final int H5O_COPY_EXPAND_SOFT_LINK_FLAG = H5O_COPY_EXPAND_SOFT_LINK_FLAG(); + public static final int H5O_COPY_EXPAND_EXT_LINK_FLAG = H5O_COPY_EXPAND_EXT_LINK_FLAG(); + public static final int H5O_COPY_EXPAND_REFERENCE_FLAG = H5O_COPY_EXPAND_REFERENCE_FLAG(); + public static final int H5O_COPY_WITHOUT_ATTR_FLAG = H5O_COPY_WITHOUT_ATTR_FLAG(); + public static final int H5O_COPY_PRESERVE_NULL_FLAG = H5O_COPY_PRESERVE_NULL_FLAG(); + public static final int H5O_SHMESG_NONE_FLAG = H5O_SHMESG_NONE_FLAG(); + public static final int H5O_SHMESG_SDSPACE_FLAG = H5O_SHMESG_SDSPACE_FLAG(); + public static final int H5O_SHMESG_DTYPE_FLAG = H5O_SHMESG_DTYPE_FLAG(); + public static final int H5O_SHMESG_FILL_FLAG = H5O_SHMESG_FILL_FLAG(); + public static final int H5O_SHMESG_PLINE_FLAG = H5O_SHMESG_PLINE_FLAG(); + public static final int H5O_SHMESG_ATTR_FLAG = H5O_SHMESG_ATTR_FLAG(); + public static final int H5O_SHMESG_ALL_FLAG = H5O_SHMESG_ALL_FLAG(); + public static final int H5O_TYPE_UNKNOWN = H5O_TYPE_UNKNOWN(); + public static final int H5O_TYPE_GROUP = H5O_TYPE_GROUP(); + public static final int H5O_TYPE_DATASET = H5O_TYPE_DATASET(); + public static final int H5O_TYPE_NAMED_DATATYPE = H5O_TYPE_NAMED_DATATYPE(); + public static final int H5O_TYPE_NTYPES = H5O_TYPE_NTYPES(); + + public static final long H5P_ROOT = H5P_ROOT(); + public static final long H5P_OBJECT_CREATE = H5P_OBJECT_CREATE(); + public static final long H5P_FILE_CREATE = H5P_FILE_CREATE(); + public static final long H5P_FILE_ACCESS = H5P_FILE_ACCESS(); + public static final long H5P_DATASET_CREATE = H5P_DATASET_CREATE(); + public static final long H5P_DATASET_ACCESS = H5P_DATASET_ACCESS(); + public static final long H5P_DATASET_XFER = H5P_DATASET_XFER(); + public static final long H5P_FILE_MOUNT = H5P_FILE_MOUNT(); + public static final long H5P_GROUP_CREATE = H5P_GROUP_CREATE(); + public static final long H5P_GROUP_ACCESS = H5P_GROUP_ACCESS(); + public static final long H5P_DATATYPE_CREATE = H5P_DATATYPE_CREATE(); + public static final long H5P_DATATYPE_ACCESS = H5P_DATATYPE_ACCESS(); + public static final long H5P_STRING_CREATE = H5P_STRING_CREATE(); + public static final long H5P_ATTRIBUTE_CREATE = H5P_ATTRIBUTE_CREATE(); + public static final long H5P_ATTRIBUTE_ACCESS = H5P_ATTRIBUTE_ACCESS(); + public static final long H5P_OBJECT_COPY = H5P_OBJECT_COPY(); + public static final long H5P_LINK_CREATE = H5P_LINK_CREATE(); + public static final long H5P_LINK_ACCESS = H5P_LINK_ACCESS(); + public static final long H5P_FILE_CREATE_DEFAULT = H5P_FILE_CREATE_DEFAULT(); + public static final long H5P_FILE_ACCESS_DEFAULT = H5P_FILE_ACCESS_DEFAULT(); + public static final long H5P_DATASET_CREATE_DEFAULT = H5P_DATASET_CREATE_DEFAULT(); + public static final long H5P_DATASET_ACCESS_DEFAULT = H5P_DATASET_ACCESS_DEFAULT(); + public static final long H5P_DATASET_XFER_DEFAULT = H5P_DATASET_XFER_DEFAULT(); + public static final long H5P_FILE_MOUNT_DEFAULT = H5P_FILE_MOUNT_DEFAULT(); + public static final long H5P_GROUP_CREATE_DEFAULT = H5P_GROUP_CREATE_DEFAULT(); + public static final long H5P_GROUP_ACCESS_DEFAULT = H5P_GROUP_ACCESS_DEFAULT(); + public static final long H5P_DATATYPE_CREATE_DEFAULT = H5P_DATATYPE_CREATE_DEFAULT(); + public static final long H5P_DATATYPE_ACCESS_DEFAULT = H5P_DATATYPE_ACCESS_DEFAULT(); + public static final long H5P_ATTRIBUTE_CREATE_DEFAULT = H5P_ATTRIBUTE_CREATE_DEFAULT(); + public static final long H5P_ATTRIBUTE_ACCESS_DEFAULT = H5P_ATTRIBUTE_ACCESS_DEFAULT(); + public static final long H5P_OBJECT_COPY_DEFAULT = H5P_OBJECT_COPY_DEFAULT(); + public static final long H5P_LINK_CREATE_DEFAULT = H5P_LINK_CREATE_DEFAULT(); + public static final long H5P_LINK_ACCESS_DEFAULT = H5P_LINK_ACCESS_DEFAULT(); + public static final int H5P_CRT_ORDER_TRACKED = H5P_CRT_ORDER_TRACKED(); + public static final int H5P_CRT_ORDER_INDEXED = H5P_CRT_ORDER_INDEXED(); + public static final long H5P_DEFAULT = H5P_DEFAULT(); + + public static final int H5PL_TYPE_ERROR = H5PL_TYPE_ERROR(); + public static final int H5PL_TYPE_FILTER = H5PL_TYPE_FILTER(); + public static final int H5PL_FILTER_PLUGIN = H5PL_FILTER_PLUGIN(); + public static final int H5PL_ALL_PLUGIN = H5PL_ALL_PLUGIN(); + + public static final int H5R_BADTYPE = H5R_BADTYPE(); + public static final int H5R_DATASET_REGION = H5R_DATASET_REGION(); + public static final int H5R_MAXTYPE = H5R_MAXTYPE(); + public static final int H5R_OBJ_REF_BUF_SIZE = H5R_OBJ_REF_BUF_SIZE(); + public static final int H5R_OBJECT = H5R_OBJECT(); + public static final int H5S_ALL = H5S_ALL(); + public static final int H5S_MAX_RANK = H5S_MAX_RANK(); + public static final int H5S_NO_CLASS = H5S_NO_CLASS(); + public static final int H5S_NULL = H5S_NULL(); + public static final int H5S_SCALAR = H5S_SCALAR(); + public static final int H5S_SEL_ALL = H5S_SEL_ALL(); + public static final int H5S_SEL_ERROR = H5S_SEL_ERROR(); + public static final int H5S_SEL_HYPERSLABS = H5S_SEL_HYPERSLABS(); + public static final int H5S_SEL_N = H5S_SEL_N(); + public static final int H5S_SEL_NONE = H5S_SEL_NONE(); + public static final int H5S_SEL_POINTS = H5S_SEL_POINTS(); + public static final int H5S_SELECT_AND = H5S_SELECT_AND(); + public static final int H5S_SELECT_APPEND = H5S_SELECT_APPEND(); + public static final int H5S_SELECT_INVALID = H5S_SELECT_INVALID(); + public static final int H5S_SELECT_NOOP = H5S_SELECT_NOOP(); + public static final int H5S_SELECT_NOTA = H5S_SELECT_NOTA(); + public static final int H5S_SELECT_NOTB = H5S_SELECT_NOTB(); + public static final int H5S_SELECT_OR = H5S_SELECT_OR(); + public static final int H5S_SELECT_PREPEND = H5S_SELECT_PREPEND(); + public static final int H5S_SELECT_SET = H5S_SELECT_SET(); + public static final int H5S_SELECT_XOR = H5S_SELECT_XOR(); + public static final int H5S_SIMPLE = H5S_SIMPLE(); + public static final int H5S_UNLIMITED = H5S_UNLIMITED(); + public static final long H5T_ALPHA_B16 = H5T_ALPHA_B16(); + public static final long H5T_ALPHA_B32 = H5T_ALPHA_B32(); + public static final long H5T_ALPHA_B64 = H5T_ALPHA_B64(); + public static final long H5T_ALPHA_B8 = H5T_ALPHA_B8(); + public static final long H5T_ALPHA_F32 = H5T_ALPHA_F32(); + public static final long H5T_ALPHA_F64 = H5T_ALPHA_F64(); + public static final long H5T_ALPHA_I16 = H5T_ALPHA_I16(); + public static final long H5T_ALPHA_I32 = H5T_ALPHA_I32(); + public static final long H5T_ALPHA_I64 = H5T_ALPHA_I64(); + public static final long H5T_ALPHA_I8 = H5T_ALPHA_I8(); + public static final long H5T_ALPHA_U16 = H5T_ALPHA_U16(); + public static final long H5T_ALPHA_U32 = H5T_ALPHA_U32(); + public static final long H5T_ALPHA_U64 = H5T_ALPHA_U64(); + public static final long H5T_ALPHA_U8 = H5T_ALPHA_U8(); + public static final int H5T_ARRAY = H5T_ARRAY(); + public static final int H5T_BITFIELD = H5T_BITFIELD(); + public static final int H5T_BKG_NO = H5T_BKG_NO(); + public static final int H5T_BKG_YES = H5T_BKG_YES(); + public static final long H5T_C_S1 = H5T_C_S1(); + public static final int H5T_COMPOUND = H5T_COMPOUND(); + public static final int H5T_CONV_CONV = H5T_CONV_CONV(); + public static final int H5T_CONV_FREE = H5T_CONV_FREE(); + public static final int H5T_CONV_INIT = H5T_CONV_INIT(); + public static final int H5T_CSET_ERROR = H5T_CSET_ERROR(); + public static final int H5T_CSET_ASCII = H5T_CSET_ASCII(); + public static final int H5T_CSET_UTF8 = H5T_CSET_UTF8(); + public static final int H5T_CSET_RESERVED_10 = H5T_CSET_RESERVED_10(); + public static final int H5T_CSET_RESERVED_11 = H5T_CSET_RESERVED_11(); + public static final int H5T_CSET_RESERVED_12 = H5T_CSET_RESERVED_12(); + public static final int H5T_CSET_RESERVED_13 = H5T_CSET_RESERVED_13(); + public static final int H5T_CSET_RESERVED_14 = H5T_CSET_RESERVED_14(); + public static final int H5T_CSET_RESERVED_15 = H5T_CSET_RESERVED_15(); + public static final int H5T_CSET_RESERVED_2 = H5T_CSET_RESERVED_2(); + public static final int H5T_CSET_RESERVED_3 = H5T_CSET_RESERVED_3(); + public static final int H5T_CSET_RESERVED_4 = H5T_CSET_RESERVED_4(); + public static final int H5T_CSET_RESERVED_5 = H5T_CSET_RESERVED_5(); + public static final int H5T_CSET_RESERVED_6 = H5T_CSET_RESERVED_6(); + public static final int H5T_CSET_RESERVED_7 = H5T_CSET_RESERVED_7(); + public static final int H5T_CSET_RESERVED_8 = H5T_CSET_RESERVED_8(); + public static final int H5T_CSET_RESERVED_9 = H5T_CSET_RESERVED_9(); + public static final int H5T_DIR_ASCEND = H5T_DIR_ASCEND(); + public static final int H5T_DIR_DEFAULT = H5T_DIR_DEFAULT(); + public static final int H5T_DIR_DESCEND = H5T_DIR_DESCEND(); + public static final int H5T_ENUM = H5T_ENUM(); + public static final int H5T_FLOAT = H5T_FLOAT(); + public static final long H5T_FORTRAN_S1 = H5T_FORTRAN_S1(); + public static final long H5T_IEEE_F32BE = H5T_IEEE_F32BE(); + public static final long H5T_IEEE_F32LE = H5T_IEEE_F32LE(); + public static final long H5T_IEEE_F64BE = H5T_IEEE_F64BE(); + public static final long H5T_IEEE_F64LE = H5T_IEEE_F64LE(); + public static final int H5T_INTEGER = H5T_INTEGER(); + public static final long H5T_INTEL_B16 = H5T_INTEL_B16(); + public static final long H5T_INTEL_B32 = H5T_INTEL_B32(); + public static final long H5T_INTEL_B64 = H5T_INTEL_B64(); + public static final long H5T_INTEL_B8 = H5T_INTEL_B8(); + public static final long H5T_INTEL_F32 = H5T_INTEL_F32(); + public static final long H5T_INTEL_F64 = H5T_INTEL_F64(); + public static final long H5T_INTEL_I16 = H5T_INTEL_I16(); + public static final long H5T_INTEL_I32 = H5T_INTEL_I32(); + public static final long H5T_INTEL_I64 = H5T_INTEL_I64(); + public static final long H5T_INTEL_I8 = H5T_INTEL_I8(); + public static final long H5T_INTEL_U16 = H5T_INTEL_U16(); + public static final long H5T_INTEL_U32 = H5T_INTEL_U32(); + public static final long H5T_INTEL_U64 = H5T_INTEL_U64(); + public static final long H5T_INTEL_U8 = H5T_INTEL_U8(); + public static final long H5T_MIPS_B16 = H5T_MIPS_B16(); + public static final long H5T_MIPS_B32 = H5T_MIPS_B32(); + public static final long H5T_MIPS_B64 = H5T_MIPS_B64(); + public static final long H5T_MIPS_B8 = H5T_MIPS_B8(); + public static final long H5T_MIPS_F32 = H5T_MIPS_F32(); + public static final long H5T_MIPS_F64 = H5T_MIPS_F64(); + public static final long H5T_MIPS_I16 = H5T_MIPS_I16(); + public static final long H5T_MIPS_I32 = H5T_MIPS_I32(); + public static final long H5T_MIPS_I64 = H5T_MIPS_I64(); + public static final long H5T_MIPS_I8 = H5T_MIPS_I8(); + public static final long H5T_MIPS_U16 = H5T_MIPS_U16(); + public static final long H5T_MIPS_U32 = H5T_MIPS_U32(); + public static final long H5T_MIPS_U64 = H5T_MIPS_U64(); + public static final long H5T_MIPS_U8 = H5T_MIPS_U8(); + public static final long H5T_NATIVE_B16 = H5T_NATIVE_B16(); + public static final long H5T_NATIVE_B32 = H5T_NATIVE_B32(); + public static final long H5T_NATIVE_B64 = H5T_NATIVE_B64(); + public static final long H5T_NATIVE_B8 = H5T_NATIVE_B8(); + public static final long H5T_NATIVE_CHAR = H5T_NATIVE_CHAR(); + public static final long H5T_NATIVE_DOUBLE = H5T_NATIVE_DOUBLE(); + public static final long H5T_NATIVE_FLOAT = H5T_NATIVE_FLOAT(); + public static final long H5T_NATIVE_HADDR = H5T_NATIVE_HADDR(); + public static final long H5T_NATIVE_HBOOL = H5T_NATIVE_HBOOL(); + public static final long H5T_NATIVE_HERR = H5T_NATIVE_HERR(); + public static final long H5T_NATIVE_HSIZE = H5T_NATIVE_HSIZE(); + public static final long H5T_NATIVE_HSSIZE = H5T_NATIVE_HSSIZE(); + public static final long H5T_NATIVE_INT = H5T_NATIVE_INT(); + public static final long H5T_NATIVE_INT_FAST16 = H5T_NATIVE_INT_FAST16(); + public static final long H5T_NATIVE_INT_FAST32 = H5T_NATIVE_INT_FAST32(); + public static final long H5T_NATIVE_INT_FAST64 = H5T_NATIVE_INT_FAST64(); + public static final long H5T_NATIVE_INT_FAST8 = H5T_NATIVE_INT_FAST8(); + public static final long H5T_NATIVE_INT_LEAST16 = H5T_NATIVE_INT_LEAST16(); + public static final long H5T_NATIVE_INT_LEAST32 = H5T_NATIVE_INT_LEAST32(); + public static final long H5T_NATIVE_INT_LEAST64 = H5T_NATIVE_INT_LEAST64(); + public static final long H5T_NATIVE_INT_LEAST8 = H5T_NATIVE_INT_LEAST8(); + public static final long H5T_NATIVE_INT16 = H5T_NATIVE_INT16(); + public static final long H5T_NATIVE_INT32 = H5T_NATIVE_INT32(); + public static final long H5T_NATIVE_INT64 = H5T_NATIVE_INT64(); + public static final long H5T_NATIVE_INT8 = H5T_NATIVE_INT8(); + public static final long H5T_NATIVE_LDOUBLE = H5T_NATIVE_LDOUBLE(); + public static final long H5T_NATIVE_LLONG = H5T_NATIVE_LLONG(); + public static final long H5T_NATIVE_LONG = H5T_NATIVE_LONG(); + public static final long H5T_NATIVE_OPAQUE = H5T_NATIVE_OPAQUE(); + public static final long H5T_NATIVE_SCHAR = H5T_NATIVE_SCHAR(); + public static final long H5T_NATIVE_SHORT = H5T_NATIVE_SHORT(); + public static final long H5T_NATIVE_UCHAR = H5T_NATIVE_UCHAR(); + public static final long H5T_NATIVE_UINT = H5T_NATIVE_UINT(); + public static final long H5T_NATIVE_UINT_FAST16 = H5T_NATIVE_UINT_FAST16(); + public static final long H5T_NATIVE_UINT_FAST32 = H5T_NATIVE_UINT_FAST32(); + public static final long H5T_NATIVE_UINT_FAST64 = H5T_NATIVE_UINT_FAST64(); + public static final long H5T_NATIVE_UINT_FAST8 = H5T_NATIVE_UINT_FAST8(); + public static final long H5T_NATIVE_UINT_LEAST16 = H5T_NATIVE_UINT_LEAST16(); + public static final long H5T_NATIVE_UINT_LEAST32 = H5T_NATIVE_UINT_LEAST32(); + public static final long H5T_NATIVE_UINT_LEAST64 = H5T_NATIVE_UINT_LEAST64(); + public static final long H5T_NATIVE_UINT_LEAST8 = H5T_NATIVE_UINT_LEAST8(); + public static final long H5T_NATIVE_UINT16 = H5T_NATIVE_UINT16(); + public static final long H5T_NATIVE_UINT32 = H5T_NATIVE_UINT32(); + public static final long H5T_NATIVE_UINT64 = H5T_NATIVE_UINT64(); + public static final long H5T_NATIVE_UINT8 = H5T_NATIVE_UINT8(); + public static final long H5T_NATIVE_ULLONG = H5T_NATIVE_ULLONG(); + public static final long H5T_NATIVE_ULONG = H5T_NATIVE_ULONG(); + public static final long H5T_NATIVE_USHORT = H5T_NATIVE_USHORT(); + public static final int H5T_NCLASSES = H5T_NCLASSES(); + public static final int H5T_NO_CLASS = H5T_NO_CLASS(); + public static final int H5T_NORM_ERROR = H5T_NORM_ERROR(); + public static final int H5T_NORM_IMPLIED = H5T_NORM_IMPLIED(); + public static final int H5T_NORM_MSBSET = H5T_NORM_MSBSET(); + public static final int H5T_NORM_NONE = H5T_NORM_NONE(); + public static final int H5T_NPAD = H5T_NPAD(); + public static final int H5T_NSGN = H5T_NSGN(); + public static final int H5T_OPAQUE = H5T_OPAQUE(); + public static final int H5T_OPAQUE_TAG_MAX = H5T_OPAQUE_TAG_MAX(); /* 1.6.5 */ + public static final int H5T_ORDER_BE = H5T_ORDER_BE(); + public static final int H5T_ORDER_ERROR = H5T_ORDER_ERROR(); + public static final int H5T_ORDER_LE = H5T_ORDER_LE(); + public static final int H5T_ORDER_NONE = H5T_ORDER_NONE(); + public static final int H5T_ORDER_VAX = H5T_ORDER_VAX(); + public static final int H5T_PAD_BACKGROUND = H5T_PAD_BACKGROUND(); + public static final int H5T_PAD_ERROR = H5T_PAD_ERROR(); + public static final int H5T_PAD_ONE = H5T_PAD_ONE(); + public static final int H5T_PAD_ZERO = H5T_PAD_ZERO(); + public static final int H5T_PERS_DONTCARE = H5T_PERS_DONTCARE(); + public static final int H5T_PERS_HARD = H5T_PERS_HARD(); + public static final int H5T_PERS_SOFT = H5T_PERS_SOFT(); + public static final int H5T_REFERENCE = H5T_REFERENCE(); + public static final int H5T_SGN_2 = H5T_SGN_2(); + public static final int H5T_SGN_ERROR = H5T_SGN_ERROR(); + public static final int H5T_SGN_NONE = H5T_SGN_NONE(); + public static final long H5T_STD_B16BE = H5T_STD_B16BE(); + public static final long H5T_STD_B16LE = H5T_STD_B16LE(); + public static final long H5T_STD_B32BE = H5T_STD_B32BE(); + public static final long H5T_STD_B32LE = H5T_STD_B32LE(); + public static final long H5T_STD_B64BE = H5T_STD_B64BE(); + public static final long H5T_STD_B64LE = H5T_STD_B64LE(); + public static final long H5T_STD_B8BE = H5T_STD_B8BE(); + public static final long H5T_STD_B8LE = H5T_STD_B8LE(); + public static final long H5T_STD_I16BE = H5T_STD_I16BE(); + public static final long H5T_STD_I16LE = H5T_STD_I16LE(); + public static final long H5T_STD_I32BE = H5T_STD_I32BE(); + public static final long H5T_STD_I32LE = H5T_STD_I32LE(); + public static final long H5T_STD_I64BE = H5T_STD_I64BE(); + public static final long H5T_STD_I64LE = H5T_STD_I64LE(); + public static final long H5T_STD_I8BE = H5T_STD_I8BE(); + public static final long H5T_STD_I8LE = H5T_STD_I8LE(); + public static final long H5T_STD_REF_DSETREG = H5T_STD_REF_DSETREG(); + public static final long H5T_STD_REF_OBJ = H5T_STD_REF_OBJ(); + public static final long H5T_STD_U16BE = H5T_STD_U16BE(); + public static final long H5T_STD_U16LE = H5T_STD_U16LE(); + public static final long H5T_STD_U32BE = H5T_STD_U32BE(); + public static final long H5T_STD_U32LE = H5T_STD_U32LE(); + public static final long H5T_STD_U64BE = H5T_STD_U64BE(); + public static final long H5T_STD_U64LE = H5T_STD_U64LE(); + public static final long H5T_STD_U8BE = H5T_STD_U8BE(); + public static final long H5T_STD_U8LE = H5T_STD_U8LE(); + public static final int H5T_STR_ERROR = H5T_STR_ERROR(); + public static final int H5T_STR_NULLPAD = H5T_STR_NULLPAD(); + public static final int H5T_STR_NULLTERM = H5T_STR_NULLTERM(); + public static final int H5T_STR_RESERVED_10 = H5T_STR_RESERVED_10(); + public static final int H5T_STR_RESERVED_11 = H5T_STR_RESERVED_11(); + public static final int H5T_STR_RESERVED_12 = H5T_STR_RESERVED_12(); + public static final int H5T_STR_RESERVED_13 = H5T_STR_RESERVED_13(); + public static final int H5T_STR_RESERVED_14 = H5T_STR_RESERVED_14(); + public static final int H5T_STR_RESERVED_15 = H5T_STR_RESERVED_15(); + public static final int H5T_STR_RESERVED_3 = H5T_STR_RESERVED_3(); + public static final int H5T_STR_RESERVED_4 = H5T_STR_RESERVED_4(); + public static final int H5T_STR_RESERVED_5 = H5T_STR_RESERVED_5(); + public static final int H5T_STR_RESERVED_6 = H5T_STR_RESERVED_6(); + public static final int H5T_STR_RESERVED_7 = H5T_STR_RESERVED_7(); + public static final int H5T_STR_RESERVED_8 = H5T_STR_RESERVED_8(); + public static final int H5T_STR_RESERVED_9 = H5T_STR_RESERVED_9(); + public static final int H5T_STR_SPACEPAD = H5T_STR_SPACEPAD(); + public static final int H5T_STRING = H5T_STRING(); + public static final int H5T_TIME = H5T_TIME(); + public static final long H5T_UNIX_D32BE = H5T_UNIX_D32BE(); + public static final long H5T_UNIX_D32LE = H5T_UNIX_D32LE(); + public static final long H5T_UNIX_D64BE = H5T_UNIX_D64BE(); + public static final long H5T_UNIX_D64LE = H5T_UNIX_D64LE(); + public static final long H5T_VARIABLE = H5T_VARIABLE(); + public static final int H5T_VLEN = H5T_VLEN(); + public static final int H5Z_CB_CONT = H5Z_CB_CONT(); + public static final int H5Z_CB_ERROR = H5Z_CB_ERROR(); + public static final int H5Z_CB_FAIL = H5Z_CB_FAIL(); + public static final int H5Z_CB_NO = H5Z_CB_NO(); + public static final int H5Z_DISABLE_EDC = H5Z_DISABLE_EDC(); + public static final int H5Z_ENABLE_EDC = H5Z_ENABLE_EDC(); + public static final int H5Z_ERROR_EDC = H5Z_ERROR_EDC(); + public static final int H5Z_FILTER_DEFLATE = H5Z_FILTER_DEFLATE(); + public static final int H5Z_FILTER_ERROR = H5Z_FILTER_ERROR(); + public static final int H5Z_FILTER_FLETCHER32 = H5Z_FILTER_FLETCHER32(); + public static final int H5Z_FILTER_MAX = H5Z_FILTER_MAX(); + public static final int H5Z_FILTER_NBIT = H5Z_FILTER_NBIT(); + public static final int H5Z_FILTER_NONE = H5Z_FILTER_NONE(); + public static final int H5Z_FILTER_RESERVED = H5Z_FILTER_RESERVED(); + public static final int H5Z_FILTER_SCALEOFFSET = H5Z_FILTER_SCALEOFFSET(); + public static final int H5Z_FILTER_SHUFFLE = H5Z_FILTER_SHUFFLE(); + public static final int H5Z_FILTER_SZIP = H5Z_FILTER_SZIP(); + public static final int H5Z_FLAG_DEFMASK = H5Z_FLAG_DEFMASK(); + public static final int H5Z_FLAG_INVMASK = H5Z_FLAG_INVMASK(); + public static final int H5Z_FLAG_MANDATORY = H5Z_FLAG_MANDATORY(); + public static final int H5Z_FLAG_OPTIONAL = H5Z_FLAG_OPTIONAL(); + public static final int H5Z_FLAG_REVERSE = H5Z_FLAG_REVERSE(); + public static final int H5Z_FLAG_SKIP_EDC = H5Z_FLAG_SKIP_EDC(); + public static final int H5Z_MAX_NFILTERS = H5Z_MAX_NFILTERS(); + public static final int H5Z_NO_EDC = H5Z_NO_EDC(); + public static final int H5Z_FILTER_CONFIG_ENCODE_ENABLED = H5Z_FILTER_CONFIG_ENCODE_ENABLED(); + public static final int H5Z_FILTER_CONFIG_DECODE_ENABLED = H5Z_FILTER_CONFIG_DECODE_ENABLED(); + public static final int H5Z_SO_INT_MINBITS_DEFAULT = H5Z_SO_INT_MINBITS_DEFAULT(); + public static final int H5Z_SO_FLOAT_DSCALE = H5Z_SO_FLOAT_DSCALE(); + public static final int H5Z_SO_FLOAT_ESCALE = H5Z_SO_FLOAT_ESCALE(); + public static final int H5Z_SO_INT = H5Z_SO_INT(); + public static final int H5Z_SHUFFLE_USER_NPARMS = H5Z_SHUFFLE_USER_NPARMS(); + public static final int H5Z_SHUFFLE_TOTAL_NPARMS = H5Z_SHUFFLE_TOTAL_NPARMS(); + public static final int H5Z_SZIP_USER_NPARMS = H5Z_SZIP_USER_NPARMS(); + public static final int H5Z_SZIP_TOTAL_NPARMS = H5Z_SZIP_TOTAL_NPARMS(); + public static final int H5Z_SZIP_PARM_MASK = H5Z_SZIP_PARM_MASK(); + public static final int H5Z_SZIP_PARM_PPB = H5Z_SZIP_PARM_PPB(); + public static final int H5Z_SZIP_PARM_BPP = H5Z_SZIP_PARM_BPP(); + public static final int H5Z_SZIP_PARM_PPS = H5Z_SZIP_PARM_PPS(); + public static final int H5Z_NBIT_USER_NPARMS = H5Z_NBIT_USER_NPARMS(); + public static final int H5Z_SCALEOFFSET_USER_NPARMS = H5Z_SCALEOFFSET_USER_NPARMS(); + public static final int H5Z_FILTER_ALL = H5Z_FILTER_ALL(); + + // ///////////////////////////////////////////////////////////////////////// + // List of private native variables to get constant values from C // + // DO NOT EDIT THE LIST UNLESS YOU KNOW WHAT YOU DO!!! // + // ///////////////////////////////////////////////////////////////////////// + + private static native final long H5_QUARTER_HADDR_MAX(); + + private static native final int H5_SZIP_MAX_PIXELS_PER_BLOCK(); + + private static native final int H5_SZIP_NN_OPTION_MASK(); + + private static native final int H5_SZIP_EC_OPTION_MASK(); + + private static native final int H5_SZIP_ALLOW_K13_OPTION_MASK(); + + private static native final int H5_SZIP_CHIP_OPTION_MASK(); + + private static native final int H5_INDEX_UNKNOWN(); + + private static native final int H5_INDEX_NAME(); + + private static native final int H5_INDEX_CRT_ORDER(); + + private static native final int H5_INDEX_N(); + + private static native final int H5_ITER_UNKNOWN(); + + private static native final int H5_ITER_INC(); + + private static native final int H5_ITER_DEC(); + + private static native final int H5_ITER_NATIVE(); + + private static native final int H5_ITER_N(); + + private static native final int H5AC_CURR_CACHE_CONFIG_VERSION(); + + private static native final int H5AC_MAX_TRACE_FILE_NAME_LEN(); + + private static native final int H5AC_METADATA_WRITE_STRATEGY_PROCESS_ZERO_ONLY(); + + private static native final int H5AC_METADATA_WRITE_STRATEGY_DISTRIBUTED(); + + private static native final int H5C_incr_off(); + + private static native final int H5C_incr_threshold(); + + private static native final int H5C_flash_incr_off(); + + private static native final int H5C_flash_incr_add_space(); + + private static native final int H5C_decr_off(); + + private static native final int H5C_decr_threshold(); + + private static native final int H5C_decr_age_out(); + + private static native final int H5C_decr_age_out_with_threshold(); + + private static native final int H5D_CHUNK_IDX_BTREE(); + + private static native final int H5D_ALLOC_TIME_DEFAULT(); + + private static native final int H5D_ALLOC_TIME_EARLY(); + + private static native final int H5D_ALLOC_TIME_ERROR(); + + private static native final int H5D_ALLOC_TIME_INCR(); + + private static native final int H5D_ALLOC_TIME_LATE(); + + private static native final int H5D_FILL_TIME_ERROR(); + + private static native final int H5D_FILL_TIME_ALLOC(); + + private static native final int H5D_FILL_TIME_NEVER(); + + private static native final int H5D_FILL_TIME_IFSET(); + + private static native final int H5D_FILL_VALUE_DEFAULT(); + + private static native final int H5D_FILL_VALUE_ERROR(); + + private static native final int H5D_FILL_VALUE_UNDEFINED(); + + private static native final int H5D_FILL_VALUE_USER_DEFINED(); + + private static native final int H5D_LAYOUT_ERROR(); + + private static native final int H5D_CHUNKED(); + + private static native final int H5D_COMPACT(); + + private static native final int H5D_CONTIGUOUS(); + + private static native final int H5D_VIRTUAL(); + + private static native final int H5D_NLAYOUTS(); + + private static native final int H5D_SPACE_STATUS_ALLOCATED(); + + private static native final int H5D_SPACE_STATUS_ERROR(); + + private static native final int H5D_SPACE_STATUS_NOT_ALLOCATED(); + + private static native final int H5D_SPACE_STATUS_PART_ALLOCATED(); + + private static native final int H5D_VDS_ERROR(); + + private static native final int H5D_VDS_FIRST_MISSING(); + + private static native final int H5D_VDS_LAST_AVAILABLE(); + + private static native final long H5E_ALIGNMENT(); + + private static native final long H5E_ALREADYEXISTS(); + + private static native final long H5E_ALREADYINIT(); + + private static native final long H5E_ARGS(); + + private static native final long H5E_ATOM(); + + private static native final long H5E_ATTR(); + + private static native final long H5E_BADATOM(); + + private static native final long H5E_BADFILE(); + + private static native final long H5E_BADGROUP(); + + private static native final long H5E_BADMESG(); + + private static native final long H5E_BADRANGE(); + + private static native final long H5E_BADSELECT(); + + private static native final long H5E_BADSIZE(); + + private static native final long H5E_BADTYPE(); + + private static native final long H5E_BADVALUE(); + + private static native final long H5E_BTREE(); + + private static native final long H5E_CACHE(); + + private static native final long H5E_CALLBACK(); + + private static native final long H5E_CANAPPLY(); + + // private static native final long H5E_CANTALLOC(); + private static native final long H5E_CANTCLIP(); + + private static native final long H5E_CANTCLOSEFILE(); + + private static native final long H5E_CANTCONVERT(); + + private static native final long H5E_CANTCOPY(); + + private static native final long H5E_CANTCOUNT(); + + private static native final long H5E_CANTCREATE(); + + private static native final long H5E_CANTDEC(); + + private static native final long H5E_CANTDECODE(); + + private static native final long H5E_CANTDELETE(); + + private static native final long H5E_CANTENCODE(); + + private static native final long H5E_CANTFLUSH(); + + private static native final long H5E_CANTFREE(); + + private static native final long H5E_CANTGET(); + + private static native final long H5E_CANTINC(); + + private static native final long H5E_CANTINIT(); + + private static native final long H5E_CANTINSERT(); + + private static native final long H5E_CANTLIST(); + + private static native final long H5E_CANTLOAD(); + + private static native final long H5E_CANTLOCK(); + + private static native final long H5E_CANTNEXT(); + + private static native final long H5E_CANTOPENFILE(); + + private static native final long H5E_CANTOPENOBJ(); + + // private static native final long H5E_CANTRECV(); + private static native final long H5E_CANTREGISTER(); + + private static native final long H5E_CANTRELEASE(); + + private static native final long H5E_CANTSELECT(); + + private static native final long H5E_CANTSET(); + + private static native final long H5E_CANTSPLIT(); + + private static native final long H5E_CANTUNLOCK(); + + private static native final long H5E_CLOSEERROR(); + + private static native final long H5E_COMPLEN(); + + private static native final long H5E_DATASET(); + + private static native final long H5E_DATASPACE(); + + private static native final long H5E_DATATYPE(); + + private static native final long H5E_DEFAULT(); + + private static native final long H5E_DUPCLASS(); + + private static native final long H5E_EFL(); + + private static native final long H5E_EXISTS(); + + private static native final long H5E_FCNTL(); + + private static native final long H5E_FILE(); + + private static native final long H5E_FILEEXISTS(); + + private static native final long H5E_FILEOPEN(); + + private static native final long H5E_FUNC(); + + private static native final long H5E_HEAP(); + + private static native final long H5E_INTERNAL(); + + private static native final long H5E_IO(); + + private static native final long H5E_LINK(); + + private static native final long H5E_LINKCOUNT(); + + private static native final int H5E_MAJOR(); + + private static native final int H5E_MINOR(); + + private static native final long H5E_MOUNT(); + + private static native final long H5E_MPI(); + + private static native final long H5E_MPIERRSTR(); + + private static native final long H5E_NOFILTER(); + + private static native final long H5E_NOIDS(); + + private static native final long H5E_NONE_MAJOR(); + + private static native final long H5E_NONE_MINOR(); + + private static native final long H5E_NOSPACE(); + + private static native final long H5E_NOTCACHED(); + + private static native final long H5E_NOTFOUND(); + + private static native final long H5E_NOTHDF5(); + + private static native final long H5E_OHDR(); + + private static native final long H5E_OVERFLOW(); + + private static native final long H5E_PLINE(); + + private static native final long H5E_PLIST(); + + private static native final long H5E_PROTECT(); + + private static native final long H5E_READERROR(); + + private static native final long H5E_REFERENCE(); + + private static native final long H5E_RESOURCE(); + + private static native final long H5E_RS(); + + private static native final long H5E_SEEKERROR(); + + private static native final long H5E_SETLOCAL(); + + private static native final long H5E_STORAGE(); + + private static native final long H5E_SYM(); + + private static native final long H5E_TRUNCATED(); + + private static native final long H5E_TST(); + + private static native final long H5E_UNINITIALIZED(); + + private static native final long H5E_UNSUPPORTED(); + + private static native final long H5E_VERSION(); + + private static native final long H5E_VFL(); + + private static native final long H5E_WALK_DOWNWARD(); + + private static native final long H5E_WALK_UPWARD(); + + private static native final long H5E_WRITEERROR(); + + private static native final int H5F_ACC_CREAT(); + + private static native final int H5F_ACC_EXCL(); + + private static native final int H5F_ACC_RDONLY(); + + private static native final int H5F_ACC_RDWR(); + + private static native final int H5F_ACC_TRUNC(); + + private static native final int H5F_ACC_DEFAULT(); + + private static native final int H5F_CLOSE_DEFAULT(); + + private static native final int H5F_CLOSE_SEMI(); + + private static native final int H5F_CLOSE_STRONG(); + + private static native final int H5F_CLOSE_WEAK(); + + private static native final int H5F_LIBVER_EARLIEST(); + + private static native final int H5F_LIBVER_LATEST(); + + private static native final int H5F_OBJ_ALL(); + + private static native final int H5F_OBJ_ATTR(); + + private static native final int H5F_OBJ_DATASET(); + + private static native final int H5F_OBJ_DATATYPE(); + + private static native final int H5F_OBJ_FILE(); + + private static native final int H5F_OBJ_GROUP(); + + private static native final int H5F_OBJ_LOCAL(); /* 1.6.5 */ + + private static native final int H5F_SCOPE_DOWN(); + + private static native final int H5F_SCOPE_GLOBAL(); + + private static native final int H5F_SCOPE_LOCAL(); + + private static native final int H5F_UNLIMITED(); + + private static native final int H5F_FILE_SPACE_DEFAULT(); + + private static native final int H5F_FILE_SPACE_ALL_PERSIST(); + + private static native final int H5F_FILE_SPACE_ALL(); + + private static native final int H5F_FILE_SPACE_AGGR_VFD(); + + private static native final int H5F_FILE_SPACE_VFD(); + + private static native final int H5F_FILE_SPACE_NTYPES(); + + private static native final long H5FD_CORE(); + + private static native final long H5FD_DIRECT(); + + private static native final long H5FD_FAMILY(); + + private static native final long H5FD_LOG(); + + private static native final long H5FD_MPIO(); + + private static native final long H5FD_MULTI(); + + private static native final long H5FD_SEC2(); + + private static native final long H5FD_STDIO(); + + private static native final long H5FD_WINDOWS(); + + private static native final int H5FD_LOG_LOC_READ(); + + private static native final int H5FD_LOG_LOC_WRITE(); + + private static native final int H5FD_LOG_LOC_SEEK(); + + private static native final int H5FD_LOG_LOC_IO(); + + private static native final int H5FD_LOG_FILE_READ(); + + private static native final int H5FD_LOG_FILE_WRITE(); + + private static native final int H5FD_LOG_FILE_IO(); + + private static native final int H5FD_LOG_FLAVOR(); + + private static native final int H5FD_LOG_NUM_READ(); + + private static native final int H5FD_LOG_NUM_WRITE(); + + private static native final int H5FD_LOG_NUM_SEEK(); + + private static native final int H5FD_LOG_NUM_TRUNCATE(); + + private static native final int H5FD_LOG_NUM_IO(); + + private static native final int H5FD_LOG_TIME_OPEN(); + + private static native final int H5FD_LOG_TIME_STAT(); + + private static native final int H5FD_LOG_TIME_READ(); + + private static native final int H5FD_LOG_TIME_WRITE(); + + private static native final int H5FD_LOG_TIME_SEEK(); + + private static native final int H5FD_LOG_TIME_CLOSE(); + + private static native final int H5FD_LOG_TIME_IO(); + + private static native final int H5FD_LOG_ALLOC(); + + private static native final int H5FD_LOG_ALL(); + + private static native final int H5FD_MEM_NOLIST(); + + private static native final int H5FD_MEM_DEFAULT(); + + private static native final int H5FD_MEM_SUPER(); + + private static native final int H5FD_MEM_BTREE(); + + private static native final int H5FD_MEM_DRAW(); + + private static native final int H5FD_MEM_GHEAP(); + + private static native final int H5FD_MEM_LHEAP(); + + private static native final int H5FD_MEM_OHDR(); + + private static native final int H5FD_MEM_NTYPES(); + + private static native final long H5FD_DEFAULT_HADDR_SIZE(); + + private static native final long H5FD_MEM_DEFAULT_SIZE(); + + private static native final long H5FD_MEM_DEFAULT_SUPER_SIZE(); + + private static native final long H5FD_MEM_DEFAULT_BTREE_SIZE(); + + private static native final long H5FD_MEM_DEFAULT_DRAW_SIZE(); + + private static native final long H5FD_MEM_DEFAULT_GHEAP_SIZE(); + + private static native final long H5FD_MEM_DEFAULT_LHEAP_SIZE(); + + private static native final long H5FD_MEM_DEFAULT_OHDR_SIZE(); + + private static native final int H5G_DATASET(); + + private static native final int H5G_GROUP(); + + private static native final int H5G_LINK(); + + private static native final int H5G_UDLINK(); + + private static native final int H5G_LINK_ERROR(); + + private static native final int H5G_LINK_HARD(); + + private static native final int H5G_LINK_SOFT(); + + private static native final int H5G_NLIBTYPES(); + + private static native final int H5G_NTYPES(); + + private static native final int H5G_NUSERTYPES(); + + private static native final int H5G_RESERVED_5(); + + private static native final int H5G_RESERVED_6(); + + private static native final int H5G_RESERVED_7(); + + private static native final int H5G_SAME_LOC(); + + private static native final int H5G_STORAGE_TYPE_UNKNOWN(); + + private static native final int H5G_STORAGE_TYPE_SYMBOL_TABLE(); + + private static native final int H5G_STORAGE_TYPE_COMPACT(); + + private static native final int H5G_STORAGE_TYPE_DENSE(); + + private static native final int H5G_TYPE(); + + private static native final int H5G_UNKNOWN(); + + private static native final int H5I_ATTR(); + + private static native final int H5I_BADID(); + + private static native final int H5I_DATASET(); + + private static native final int H5I_DATASPACE(); + + private static native final int H5I_DATATYPE(); + + private static native final int H5I_ERROR_CLASS(); + + private static native final int H5I_ERROR_MSG(); + + private static native final int H5I_ERROR_STACK(); + + private static native final int H5I_FILE(); + + private static native final int H5I_GENPROP_CLS(); + + private static native final int H5I_GENPROP_LST(); + + private static native final int H5I_GROUP(); + + private static native final int H5I_INVALID_HID(); + + private static native final int H5I_NTYPES(); + + private static native final int H5I_REFERENCE(); + + private static native final int H5I_UNINIT(); + + private static native final int H5I_VFL(); + + private static native final int H5L_TYPE_ERROR(); + + private static native final int H5L_TYPE_HARD(); + + private static native final int H5L_TYPE_SOFT(); + + private static native final int H5L_TYPE_EXTERNAL(); + + private static native final int H5L_TYPE_MAX(); + + private static native final int H5O_COPY_SHALLOW_HIERARCHY_FLAG(); + + private static native final int H5O_COPY_EXPAND_SOFT_LINK_FLAG(); + + private static native final int H5O_COPY_EXPAND_EXT_LINK_FLAG(); + + private static native final int H5O_COPY_EXPAND_REFERENCE_FLAG(); + + private static native final int H5O_COPY_WITHOUT_ATTR_FLAG(); + + private static native final int H5O_COPY_PRESERVE_NULL_FLAG(); + + private static native final int H5O_SHMESG_NONE_FLAG(); + + private static native final int H5O_SHMESG_SDSPACE_FLAG(); + + private static native final int H5O_SHMESG_DTYPE_FLAG(); + + private static native final int H5O_SHMESG_FILL_FLAG(); + + private static native final int H5O_SHMESG_PLINE_FLAG(); + + private static native final int H5O_SHMESG_ATTR_FLAG(); + + private static native final int H5O_SHMESG_ALL_FLAG(); + + private static native final int H5O_TYPE_UNKNOWN(); + + private static native final int H5O_TYPE_GROUP(); + + private static native final int H5O_TYPE_DATASET(); + + private static native final int H5O_TYPE_NAMED_DATATYPE(); + + private static native final int H5O_TYPE_NTYPES(); + + private static native final long H5P_ROOT(); + + private static native final long H5P_OBJECT_CREATE(); + + private static native final long H5P_FILE_CREATE(); + + private static native final long H5P_FILE_ACCESS(); + + private static native final long H5P_DATASET_CREATE(); + + private static native final long H5P_DATASET_ACCESS(); + + private static native final long H5P_DATASET_XFER(); + + private static native final long H5P_FILE_MOUNT(); + + private static native final long H5P_GROUP_CREATE(); + + private static native final long H5P_GROUP_ACCESS(); + + private static native final long H5P_DATATYPE_CREATE(); + + private static native final long H5P_DATATYPE_ACCESS(); + + private static native final long H5P_STRING_CREATE(); + + private static native final long H5P_ATTRIBUTE_CREATE(); + + private static native final long H5P_ATTRIBUTE_ACCESS(); + + private static native final long H5P_OBJECT_COPY(); + + private static native final long H5P_LINK_CREATE(); + + private static native final long H5P_LINK_ACCESS(); + + private static native final long H5P_FILE_CREATE_DEFAULT(); + + private static native final long H5P_FILE_ACCESS_DEFAULT(); + + private static native final long H5P_DATASET_CREATE_DEFAULT(); + + private static native final long H5P_DATASET_ACCESS_DEFAULT(); + + private static native final long H5P_DATASET_XFER_DEFAULT(); + + private static native final long H5P_FILE_MOUNT_DEFAULT(); + + private static native final long H5P_GROUP_CREATE_DEFAULT(); + + private static native final long H5P_GROUP_ACCESS_DEFAULT(); + + private static native final long H5P_DATATYPE_CREATE_DEFAULT(); + + private static native final long H5P_DATATYPE_ACCESS_DEFAULT(); + + private static native final long H5P_ATTRIBUTE_CREATE_DEFAULT(); + + private static native final long H5P_ATTRIBUTE_ACCESS_DEFAULT(); + + private static native final long H5P_OBJECT_COPY_DEFAULT(); + + private static native final long H5P_LINK_CREATE_DEFAULT(); + + private static native final long H5P_LINK_ACCESS_DEFAULT(); + + private static native final int H5P_CRT_ORDER_TRACKED(); + + private static native final int H5P_CRT_ORDER_INDEXED(); + + private static native final long H5P_DEFAULT(); + + private static native final int H5PL_TYPE_ERROR(); + + private static native final int H5PL_TYPE_FILTER(); + + private static native final int H5PL_FILTER_PLUGIN(); + + private static native final int H5PL_ALL_PLUGIN(); + + private static native final int H5R_BADTYPE(); + + private static native final int H5R_DATASET_REGION(); + + private static native final int H5R_MAXTYPE(); + + private static native final int H5R_OBJ_REF_BUF_SIZE(); + + private static native final int H5R_OBJECT(); + + private static native final int H5S_ALL(); + + private static native final int H5S_MAX_RANK(); + + private static native final int H5S_NO_CLASS(); + + private static native final int H5S_NULL(); + + private static native final int H5S_SCALAR(); + + private static native final int H5S_SEL_ALL(); + + private static native final int H5S_SEL_ERROR(); + + private static native final int H5S_SEL_HYPERSLABS(); + + private static native final int H5S_SEL_N(); + + private static native final int H5S_SEL_NONE(); + + private static native final int H5S_SEL_POINTS(); + + private static native final int H5S_SELECT_AND(); + + private static native final int H5S_SELECT_APPEND(); + + private static native final int H5S_SELECT_INVALID(); + + private static native final int H5S_SELECT_NOOP(); + + private static native final int H5S_SELECT_NOTA(); + + private static native final int H5S_SELECT_NOTB(); + + private static native final int H5S_SELECT_OR(); + + private static native final int H5S_SELECT_PREPEND(); + + private static native final int H5S_SELECT_SET(); + + private static native final int H5S_SELECT_XOR(); + + private static native final int H5S_SIMPLE(); + + private static native final int H5S_UNLIMITED(); + + private static native final long H5T_ALPHA_B16(); + + private static native final long H5T_ALPHA_B32(); + + private static native final long H5T_ALPHA_B64(); + + private static native final long H5T_ALPHA_B8(); + + private static native final long H5T_ALPHA_F32(); + + private static native final long H5T_ALPHA_F64(); + + private static native final long H5T_ALPHA_I16(); + + private static native final long H5T_ALPHA_I32(); + + private static native final long H5T_ALPHA_I64(); + + private static native final long H5T_ALPHA_I8(); + + private static native final long H5T_ALPHA_U16(); + + private static native final long H5T_ALPHA_U32(); + + private static native final long H5T_ALPHA_U64(); + + private static native final long H5T_ALPHA_U8(); + + private static native final int H5T_ARRAY(); + + private static native final int H5T_BITFIELD(); + + private static native final int H5T_BKG_NO(); + + private static native final int H5T_BKG_YES(); + + private static native final long H5T_C_S1(); + + private static native final int H5T_COMPOUND(); + + private static native final int H5T_CONV_CONV(); + + private static native final int H5T_CONV_FREE(); + + private static native final int H5T_CONV_INIT(); + + private static native final int H5T_CSET_ERROR(); + + private static native final int H5T_CSET_ASCII(); + + private static native final int H5T_CSET_UTF8(); + + private static native final int H5T_CSET_RESERVED_10(); + + private static native final int H5T_CSET_RESERVED_11(); + + private static native final int H5T_CSET_RESERVED_12(); + + private static native final int H5T_CSET_RESERVED_13(); + + private static native final int H5T_CSET_RESERVED_14(); + + private static native final int H5T_CSET_RESERVED_15(); + + private static native final int H5T_CSET_RESERVED_2(); + + private static native final int H5T_CSET_RESERVED_3(); + + private static native final int H5T_CSET_RESERVED_4(); + + private static native final int H5T_CSET_RESERVED_5(); + + private static native final int H5T_CSET_RESERVED_6(); + + private static native final int H5T_CSET_RESERVED_7(); + + private static native final int H5T_CSET_RESERVED_8(); + + private static native final int H5T_CSET_RESERVED_9(); + + private static native final int H5T_DIR_ASCEND(); + + private static native final int H5T_DIR_DEFAULT(); + + private static native final int H5T_DIR_DESCEND(); + + private static native final int H5T_ENUM(); + + private static native final int H5T_FLOAT(); + + private static native final long H5T_FORTRAN_S1(); + + private static native final long H5T_IEEE_F32BE(); + + private static native final long H5T_IEEE_F32LE(); + + private static native final long H5T_IEEE_F64BE(); + + private static native final long H5T_IEEE_F64LE(); + + private static native final int H5T_INTEGER(); + + private static native final long H5T_INTEL_B16(); + + private static native final long H5T_INTEL_B32(); + + private static native final long H5T_INTEL_B64(); + + private static native final long H5T_INTEL_B8(); + + private static native final long H5T_INTEL_F32(); + + private static native final long H5T_INTEL_F64(); + + private static native final long H5T_INTEL_I16(); + + private static native final long H5T_INTEL_I32(); + + private static native final long H5T_INTEL_I64(); + + private static native final long H5T_INTEL_I8(); + + private static native final long H5T_INTEL_U16(); + + private static native final long H5T_INTEL_U32(); + + private static native final long H5T_INTEL_U64(); + + private static native final long H5T_INTEL_U8(); + + private static native final long H5T_MIPS_B16(); + + private static native final long H5T_MIPS_B32(); + + private static native final long H5T_MIPS_B64(); + + private static native final long H5T_MIPS_B8(); + + private static native final long H5T_MIPS_F32(); + + private static native final long H5T_MIPS_F64(); + + private static native final long H5T_MIPS_I16(); + + private static native final long H5T_MIPS_I32(); + + private static native final long H5T_MIPS_I64(); + + private static native final long H5T_MIPS_I8(); + + private static native final long H5T_MIPS_U16(); + + private static native final long H5T_MIPS_U32(); + + private static native final long H5T_MIPS_U64(); + + private static native final long H5T_MIPS_U8(); + + private static native final long H5T_NATIVE_B16(); + + private static native final long H5T_NATIVE_B32(); + + private static native final long H5T_NATIVE_B64(); + + private static native final long H5T_NATIVE_B8(); + + private static native final long H5T_NATIVE_CHAR(); + + private static native final long H5T_NATIVE_DOUBLE(); + + private static native final long H5T_NATIVE_FLOAT(); + + private static native final long H5T_NATIVE_HADDR(); + + private static native final long H5T_NATIVE_HBOOL(); + + private static native final long H5T_NATIVE_HERR(); + + private static native final long H5T_NATIVE_HSIZE(); + + private static native final long H5T_NATIVE_HSSIZE(); + + private static native final long H5T_NATIVE_INT(); + + private static native final long H5T_NATIVE_INT_FAST16(); + + private static native final long H5T_NATIVE_INT_FAST32(); + + private static native final long H5T_NATIVE_INT_FAST64(); + + private static native final long H5T_NATIVE_INT_FAST8(); + + private static native final long H5T_NATIVE_INT_LEAST16(); + + private static native final long H5T_NATIVE_INT_LEAST32(); + + private static native final long H5T_NATIVE_INT_LEAST64(); + + private static native final long H5T_NATIVE_INT_LEAST8(); + + private static native final long H5T_NATIVE_INT16(); + + private static native final long H5T_NATIVE_INT32(); + + private static native final long H5T_NATIVE_INT64(); + + private static native final long H5T_NATIVE_INT8(); + + private static native final long H5T_NATIVE_LDOUBLE(); + + private static native final long H5T_NATIVE_LLONG(); + + private static native final long H5T_NATIVE_LONG(); + + private static native final long H5T_NATIVE_OPAQUE(); + + private static native final long H5T_NATIVE_SCHAR(); + + private static native final long H5T_NATIVE_SHORT(); + + private static native final long H5T_NATIVE_UCHAR(); + + private static native final long H5T_NATIVE_UINT(); + + private static native final long H5T_NATIVE_UINT_FAST16(); + + private static native final long H5T_NATIVE_UINT_FAST32(); + + private static native final long H5T_NATIVE_UINT_FAST64(); + + private static native final long H5T_NATIVE_UINT_FAST8(); + + private static native final long H5T_NATIVE_UINT_LEAST16(); + + private static native final long H5T_NATIVE_UINT_LEAST32(); + + private static native final long H5T_NATIVE_UINT_LEAST64(); + + private static native final long H5T_NATIVE_UINT_LEAST8(); + + private static native final long H5T_NATIVE_UINT16(); + + private static native final long H5T_NATIVE_UINT32(); + + private static native final long H5T_NATIVE_UINT64(); + + private static native final long H5T_NATIVE_UINT8(); + + private static native final long H5T_NATIVE_ULLONG(); + + private static native final long H5T_NATIVE_ULONG(); + + private static native final long H5T_NATIVE_USHORT(); + + private static native final int H5T_NCLASSES(); + + private static native final int H5T_NO_CLASS(); + + private static native final int H5T_NORM_ERROR(); + + private static native final int H5T_NORM_IMPLIED(); + + private static native final int H5T_NORM_MSBSET(); + + private static native final int H5T_NORM_NONE(); + + private static native final int H5T_NPAD(); + + private static native final int H5T_NSGN(); + + private static native final int H5T_OPAQUE(); + + private static native final int H5T_OPAQUE_TAG_MAX(); + + private static native final int H5T_ORDER_BE(); + + private static native final int H5T_ORDER_ERROR(); + + private static native final int H5T_ORDER_LE(); + + private static native final int H5T_ORDER_NONE(); + + private static native final int H5T_ORDER_VAX(); + + private static native final int H5T_PAD_BACKGROUND(); + + private static native final int H5T_PAD_ERROR(); + + private static native final int H5T_PAD_ONE(); + + private static native final int H5T_PAD_ZERO(); + + private static native final int H5T_PERS_DONTCARE(); + + private static native final int H5T_PERS_HARD(); + + private static native final int H5T_PERS_SOFT(); + + private static native final int H5T_REFERENCE(); + + private static native final int H5T_SGN_2(); + + private static native final int H5T_SGN_ERROR(); + + private static native final int H5T_SGN_NONE(); + + private static native final long H5T_STD_B16BE(); + + private static native final long H5T_STD_B16LE(); + + private static native final long H5T_STD_B32BE(); + + private static native final long H5T_STD_B32LE(); + + private static native final long H5T_STD_B64BE(); + + private static native final long H5T_STD_B64LE(); + + private static native final long H5T_STD_B8BE(); + + private static native final long H5T_STD_B8LE(); + + private static native final long H5T_STD_I16BE(); + + private static native final long H5T_STD_I16LE(); + + private static native final long H5T_STD_I32BE(); + + private static native final long H5T_STD_I32LE(); + + private static native final long H5T_STD_I64BE(); + + private static native final long H5T_STD_I64LE(); + + private static native final long H5T_STD_I8BE(); + + private static native final long H5T_STD_I8LE(); + + private static native final long H5T_STD_REF_DSETREG(); + + private static native final long H5T_STD_REF_OBJ(); + + private static native final long H5T_STD_U16BE(); + + private static native final long H5T_STD_U16LE(); + + private static native final long H5T_STD_U32BE(); + + private static native final long H5T_STD_U32LE(); + + private static native final long H5T_STD_U64BE(); + + private static native final long H5T_STD_U64LE(); + + private static native final long H5T_STD_U8BE(); + + private static native final long H5T_STD_U8LE(); + + private static native final int H5T_STR_ERROR(); + + private static native final int H5T_STR_NULLPAD(); + + private static native final int H5T_STR_NULLTERM(); + + private static native final int H5T_STR_RESERVED_10(); + + private static native final int H5T_STR_RESERVED_11(); + + private static native final int H5T_STR_RESERVED_12(); + + private static native final int H5T_STR_RESERVED_13(); + + private static native final int H5T_STR_RESERVED_14(); + + private static native final int H5T_STR_RESERVED_15(); + + private static native final int H5T_STR_RESERVED_3(); + + private static native final int H5T_STR_RESERVED_4(); + + private static native final int H5T_STR_RESERVED_5(); + + private static native final int H5T_STR_RESERVED_6(); + + private static native final int H5T_STR_RESERVED_7(); + + private static native final int H5T_STR_RESERVED_8(); + + private static native final int H5T_STR_RESERVED_9(); + + private static native final int H5T_STR_SPACEPAD(); + + private static native final int H5T_STRING(); + + private static native final int H5T_TIME(); + + private static native final long H5T_UNIX_D32BE(); + + private static native final long H5T_UNIX_D32LE(); + + private static native final long H5T_UNIX_D64BE(); + + private static native final long H5T_UNIX_D64LE(); + + private static native final long H5T_VARIABLE(); + + private static native final int H5T_VLEN(); + + private static native final int H5Z_CB_CONT(); + + private static native final int H5Z_CB_ERROR(); + + private static native final int H5Z_CB_FAIL(); + + private static native final int H5Z_CB_NO(); + + private static native final int H5Z_DISABLE_EDC(); + + private static native final int H5Z_ENABLE_EDC(); + + private static native final int H5Z_ERROR_EDC(); + + private static native final int H5Z_FILTER_DEFLATE(); + + private static native final int H5Z_FILTER_ERROR(); + + private static native final int H5Z_FILTER_FLETCHER32(); + + private static native final int H5Z_FILTER_MAX(); + + private static native final int H5Z_FILTER_NBIT(); + + private static native final int H5Z_FILTER_NONE(); + + private static native final int H5Z_FILTER_RESERVED(); + + private static native final int H5Z_FILTER_SCALEOFFSET(); + + private static native final int H5Z_FILTER_SHUFFLE(); + + private static native final int H5Z_FILTER_SZIP(); + + private static native final int H5Z_FLAG_DEFMASK(); + + private static native final int H5Z_FLAG_INVMASK(); + + private static native final int H5Z_FLAG_MANDATORY(); + + private static native final int H5Z_FLAG_OPTIONAL(); + + private static native final int H5Z_FLAG_REVERSE(); + + private static native final int H5Z_FLAG_SKIP_EDC(); + + private static native final int H5Z_MAX_NFILTERS(); + + private static native final int H5Z_NO_EDC(); + + private static native final int H5Z_FILTER_CONFIG_ENCODE_ENABLED(); + + private static native final int H5Z_FILTER_CONFIG_DECODE_ENABLED(); + + private static native final int H5Z_SO_INT_MINBITS_DEFAULT(); + + private static native final int H5Z_SO_FLOAT_DSCALE(); + + private static native final int H5Z_SO_FLOAT_ESCALE(); + + private static native final int H5Z_SO_INT(); + + private static native final int H5Z_SHUFFLE_USER_NPARMS(); + + private static native final int H5Z_SHUFFLE_TOTAL_NPARMS(); + + private static native final int H5Z_SZIP_USER_NPARMS(); + + private static native final int H5Z_SZIP_TOTAL_NPARMS(); + + private static native final int H5Z_SZIP_PARM_MASK(); + + private static native final int H5Z_SZIP_PARM_PPB(); + + private static native final int H5Z_SZIP_PARM_BPP(); + + private static native final int H5Z_SZIP_PARM_PPS(); + + private static native final int H5Z_NBIT_USER_NPARMS(); + + private static native final int H5Z_SCALEOFFSET_USER_NPARMS(); + + private static native final int H5Z_FILTER_ALL(); + +} diff --git a/java/src/hdf/hdf5lib/HDF5GroupInfo.java b/java/src/hdf/hdf5lib/HDF5GroupInfo.java new file mode 100644 index 0000000..fa33fec --- /dev/null +++ b/java/src/hdf/hdf5lib/HDF5GroupInfo.java @@ -0,0 +1,171 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +package hdf.hdf5lib; + +/** + *

+ * This class is a container for the information reported about an HDF5 Object + * from the H5Gget_obj_info() method. + *

+ * The fileno and objno fields contain four values which uniquely identify an + * object among those HDF5 files which are open: if all four values are the same + * between two objects, then the two objects are the same (provided both files + * are still open). The nlink field is the number of hard links to the object or + * zero when information is being returned about a symbolic link (symbolic links + * do not have hard links but all other objects always have at least one). The + * type field contains the type of the object, one of H5G_GROUP, H5G_DATASET, or + * H5G_LINK. The mtime field contains the modification time. If information is + * being returned about a symbolic link then linklen will be the length of the + * link value (the name of the pointed-to object with the null terminator); + * otherwise linklen will be zero. Other fields may be added to this structure + * in the future. + */ + +public class HDF5GroupInfo { + long[] fileno; + long[] objno; + int nlink; + int type; + long mtime; + int linklen; + + public HDF5GroupInfo() { + fileno = new long[2]; + objno = new long[2]; + nlink = -1; + type = -1; + mtime = 0; + linklen = 0; + } + + /** + * Sets the HDF5 group information. Used by the JHI5. + * + * @param fn + * File id number + * @param on + * Object id number + * @param nl + * Number of links + * @param t + * Type of the object + * @param mt + * Modification time + * @param len + * Length of link + **/ + public void setGroupInfo(long[] fn, long[] on, int nl, int t, long mt, + int len) { + fileno = fn; + objno = on; + nlink = nl; + type = t; + mtime = mt; + linklen = len; + } + + /** Resets all the group information to defaults. */ + public void reset() { + fileno[0] = 0; + fileno[1] = 0; + objno[0] = 0; + objno[1] = 0; + nlink = -1; + type = -1; + mtime = 0; + linklen = 0; + } + + /* accessors */ + public long[] getFileno() { + return fileno; + } + + public long[] getObjno() { + return objno; + } + + public int getType() { + return type; + } + + public int getNlink() { + return nlink; + } + + public long getMtime() { + return mtime; + } + + public int getLinklen() { + return linklen; + } + + /** + * The fileno and objno fields contain four values which uniquely identify + * an object among those HDF5 files. + */ + @Override + public boolean equals(Object obj) { + if (!(obj instanceof HDF5GroupInfo)) { + return false; + } + + HDF5GroupInfo target = (HDF5GroupInfo) obj; + if ((fileno[0] == target.fileno[0]) && (fileno[1] == target.fileno[1]) + && (objno[0] == target.objno[0]) + && (objno[1] == target.objno[1])) { + return true; + } + else { + return false; + } + } + + /** + * Returns the object id. + * + * @return the object id + */ + public long getOID() { + return objno[0]; + } + + /** + * /** Converts this object to a String representation. + * + * @return a string representation of this object + */ + @Override + public String toString() { + String fileStr = "fileno=null"; + String objStr = "objno=null"; + + if (fileno != null) { + fileStr = "fileno[0]=" + fileno[0] + ",fileno[1]=" + fileno[1]; + } + + if (objno != null) { + objStr = "objno[0]=" + objno[0] + ",objno[1]=" + objno[1]; + } + + return getClass().getName() + "[" + fileStr + "," + objStr + ",type=" + + type + ",nlink=" + nlink + ",mtime=" + mtime + ",linklen=" + + linklen + "]"; + } + +} diff --git a/java/src/hdf/hdf5lib/HDFArray.java b/java/src/hdf/hdf5lib/HDFArray.java new file mode 100644 index 0000000..55c19e4 --- /dev/null +++ b/java/src/hdf/hdf5lib/HDFArray.java @@ -0,0 +1,1096 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +package hdf.hdf5lib; + +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5JavaException; + +/** + * This is a class for handling multidimensional arrays for HDF. + *

+ * The purpose is to allow the storage and retrieval of arbitrary array types + * containing scientific data. + *

+ * The methods support the conversion of an array to and from Java to a + * one-dimensional array of bytes suitable for I/O by the C library. + *

+ * This class heavily uses the HDFNativeData class to + * convert between Java and C representations. + */ + +public class HDFArray { + + private Object _theArray = null; + private ArrayDescriptor _desc = null; + private byte[] _barray = null; + + // public HDFArray() {} + + /** + * The input must be a Java Array (possibly multidimensional) of primitive + * numbers or sub-classes of Number. + *

+ * The input is analysed to determine the number of dimensions and size of + * each dimension, as well as the type of the elements. + *

+ * The description is saved in private variables, and used to convert data. + * + * @param anArray + * The array object. + * + * @exception hdf.hdf5lib.exceptions.HDF5Exception + * object is not an array. + */ + public HDFArray(Object anArray) throws HDF5Exception { + + if (anArray == null) { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: array is null?: "); + } + Class tc = anArray.getClass(); + if (tc.isArray() == false) { + /* exception: not an array */ + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: not an array?: "); + throw (ex); + } + _theArray = anArray; + _desc = new ArrayDescriptor(_theArray); + + /* extra error checking -- probably not needed */ + if (_desc == null) { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: internal error: array description failed?: "); + throw (ex); + } + } + + /** + * Allocate a one-dimensional array of bytes sufficient to store the array. + * + * @return A one-D array of bytes, filled with zeroes. The bytes are + * sufficient to hold the data of the Array passed to the + * constructor. + * @exception hdf.hdf5lib.exceptions.HDF5JavaException + * Allocation failed. + */ + + public byte[] emptyBytes() throws HDF5JavaException { + byte[] b = null; + + if ((ArrayDescriptor.dims == 1) && (ArrayDescriptor.NT == 'B')) { + b = (byte[]) _theArray; + } + else { + b = new byte[ArrayDescriptor.totalSize]; + } + if (b == null) { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: emptyBytes: allocation failed"); + throw (ex); + } + return (b); + } + + /** + * Given a Java array of numbers, convert it to a one-dimensional array of + * bytes in correct native order. + * + * @return A one-D array of bytes, constructed from the Array passed to the + * constructor. + * @exception hdf.hdf5lib.exceptions.HDF5JavaException + * the object not an array or other internal error. + */ + public byte[] byteify() throws HDF5JavaException { + + if (_barray != null) { + return _barray; + } + + if (_theArray == null) { + /* exception: not an array */ + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: byteify not an array?: "); + throw (ex); + } + + if (ArrayDescriptor.dims == 1) { + /* special case */ + if (ArrayDescriptor.NT == 'B') { + /* really special case! */ + _barray = (byte[]) _theArray; + return _barray; + } + else { + try { + _barray = new byte[ArrayDescriptor.totalSize]; + + byte[] therow; + if (ArrayDescriptor.NT == 'I') { + therow = HDFNativeData.intToByte(0, + ArrayDescriptor.dimlen[1], (int[]) _theArray); + } + else if (ArrayDescriptor.NT == 'S') { + therow = HDFNativeData.shortToByte(0, + ArrayDescriptor.dimlen[1], (short[]) _theArray); + } + else if (ArrayDescriptor.NT == 'F') { + therow = HDFNativeData.floatToByte(0, + ArrayDescriptor.dimlen[1], (float[]) _theArray); + } + else if (ArrayDescriptor.NT == 'J') { + therow = HDFNativeData.longToByte(0, + ArrayDescriptor.dimlen[1], (long[]) _theArray); + } + else if (ArrayDescriptor.NT == 'D') { + therow = HDFNativeData + .doubleToByte(0, ArrayDescriptor.dimlen[1], + (double[]) _theArray); + } + else if (ArrayDescriptor.NT == 'L') { + if (ArrayDescriptor.className.equals("java.lang.Byte")) { + therow = ByteObjToByte((Byte[]) _theArray); + } + else if (ArrayDescriptor.className + .equals("java.lang.Integer")) { + therow = IntegerToByte((Integer[]) _theArray); + } + else if (ArrayDescriptor.className + .equals("java.lang.Short")) { + therow = ShortToByte((Short[]) _theArray); + } + else if (ArrayDescriptor.className + .equals("java.lang.Float")) { + therow = FloatObjToByte((Float[]) _theArray); + } + else if (ArrayDescriptor.className + .equals("java.lang.Double")) { + therow = DoubleObjToByte((Double[]) _theArray); + } + else if (ArrayDescriptor.className + .equals("java.lang.Long")) { + therow = LongObjToByte((Long[]) _theArray); + } + else { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: unknown type of Object?"); + throw (ex); + } + } + else { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: unknown type of data?"); + throw (ex); + } + System + .arraycopy( + therow, + 0, + _barray, + 0, + (ArrayDescriptor.dimlen[1] * ArrayDescriptor.NTsize)); + return _barray; + } + catch (OutOfMemoryError err) { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: byteify array too big?"); + throw (ex); + } + } + } + + try { + _barray = new byte[ArrayDescriptor.totalSize]; + } + catch (OutOfMemoryError err) { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: byteify array too big?"); + throw (ex); + } + + Object oo = _theArray; + int n = 0; /* the current byte */ + int index = 0; + int i; + while (n < ArrayDescriptor.totalSize) { + oo = ArrayDescriptor.objs[0]; + index = n / ArrayDescriptor.bytetoindex[0]; + index %= ArrayDescriptor.dimlen[0]; + for (i = 0; i < (ArrayDescriptor.dims); i++) { + index = n / ArrayDescriptor.bytetoindex[i]; + index %= ArrayDescriptor.dimlen[i]; + + if (index == ArrayDescriptor.currentindex[i]) { + /* then use cached copy */ + oo = ArrayDescriptor.objs[i]; + } + else { + /* check range of index */ + if (index > (ArrayDescriptor.dimlen[i] - 1)) { + throw new java.lang.IndexOutOfBoundsException( + "HDFArray: byteify index OOB?"); + } + oo = java.lang.reflect.Array.get(oo, index); + ArrayDescriptor.currentindex[i] = index; + ArrayDescriptor.objs[i] = oo; + } + } + + /* byte-ify */ + byte arow[]; + try { + if (ArrayDescriptor.NT == 'J') { + arow = HDFNativeData + .longToByte( + 0, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + (long[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + arow = HDFNativeData + .longToByte( + 0, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + (long[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + } + else if (ArrayDescriptor.NT == 'I') { + arow = HDFNativeData + .intToByte( + 0, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + (int[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + } + else if (ArrayDescriptor.NT == 'S') { + arow = HDFNativeData + .shortToByte( + 0, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + (short[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + } + else if (ArrayDescriptor.NT == 'B') { + arow = (byte[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]; + } + else if (ArrayDescriptor.NT == 'F') { + /* 32 bit float */ + arow = HDFNativeData + .floatToByte( + 0, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + (float[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + } + else if (ArrayDescriptor.NT == 'D') { + /* 64 bit float */ + arow = HDFNativeData + .doubleToByte( + 0, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + (double[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + } + else if (ArrayDescriptor.NT == 'L') { + if (ArrayDescriptor.className.equals("java.lang.Byte")) { + arow = ByteObjToByte((Byte[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + } + else if (ArrayDescriptor.className + .equals("java.lang.Integer")) { + arow = IntegerToByte((Integer[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + } + else if (ArrayDescriptor.className + .equals("java.lang.Short")) { + arow = ShortToByte((Short[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + } + else if (ArrayDescriptor.className + .equals("java.lang.Float")) { + arow = FloatObjToByte((Float[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + } + else if (ArrayDescriptor.className + .equals("java.lang.Double")) { + arow = DoubleObjToByte((Double[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + } + else if (ArrayDescriptor.className.equals("java.lang.Long")) { + arow = LongObjToByte((Long[]) ArrayDescriptor.objs[ArrayDescriptor.dims - 1]); + } + else { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: byteify Object type not implemented?"); + throw (ex); + } + } + else { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: byteify unknown type not implemented?"); + throw (ex); + } + System + .arraycopy( + arow, + 0, + _barray, + n, + (ArrayDescriptor.dimlen[ArrayDescriptor.dims] * ArrayDescriptor.NTsize)); + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + } + catch (OutOfMemoryError err) { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: byteify array too big?"); + throw (ex); + } + } + /* assert: the whole array is completed--currentindex should == len - 1 */ + + /* error checks */ + + if (n < ArrayDescriptor.totalSize) { + throw new java.lang.InternalError(new String( + "HDFArray::byteify: Panic didn't complete all input data: n= " + + n + " size = " + ArrayDescriptor.totalSize)); + } + for (i = 0; i < ArrayDescriptor.dims; i++) { + if (ArrayDescriptor.currentindex[i] != ArrayDescriptor.dimlen[i] - 1) { + throw new java.lang.InternalError(new String( + "Panic didn't complete all data: currentindex[" + i + + "] = " + ArrayDescriptor.currentindex[i] + + " (should be " + + (ArrayDescriptor.dimlen[i] - 1) + " ?)")); + } + } + return _barray; + } + + /** + * Given a one-dimensional array of bytes representing numbers, convert it + * to a java array of the shape and size passed to the constructor. + * + * @param bytes + * The bytes to construct the Array. + * @return An Array (possibly multidimensional) of primitive or number + * objects. + * @exception hdf.hdf5lib.exceptions.HDF5JavaException + * the object not an array or other internal error. + */ + public Object arrayify(byte[] bytes) throws HDF5JavaException { + + if (_theArray == null) { + /* exception: not an array */ + HDF5JavaException ex = new HDF5JavaException( + "arrayify: not an array?: "); + throw (ex); + } + + if (java.lang.reflect.Array.getLength(bytes) != ArrayDescriptor.totalSize) { + /* exception: array not right size */ + HDF5JavaException ex = new HDF5JavaException( + "arrayify: array is wrong size?: "); + throw (ex); + } + _barray = bytes; /* hope that the bytes are correct.... */ + if (ArrayDescriptor.dims == 1) { + /* special case */ + /* 2 data copies here! */ + try { + if (ArrayDescriptor.NT == 'I') { + int[] x = HDFNativeData.byteToInt(_barray); + System.arraycopy(x, 0, _theArray, 0, + ArrayDescriptor.dimlen[1]); + return _theArray; + } + else if (ArrayDescriptor.NT == 'S') { + short[] x = HDFNativeData.byteToShort(_barray); + System.arraycopy(x, 0, _theArray, 0, + ArrayDescriptor.dimlen[1]); + return _theArray; + } + else if (ArrayDescriptor.NT == 'F') { + float x[] = HDFNativeData.byteToFloat(_barray); + System.arraycopy(x, 0, _theArray, 0, + ArrayDescriptor.dimlen[1]); + return _theArray; + } + else if (ArrayDescriptor.NT == 'J') { + long x[] = HDFNativeData.byteToLong(_barray); + System.arraycopy(x, 0, _theArray, 0, + ArrayDescriptor.dimlen[1]); + return _theArray; + } + else if (ArrayDescriptor.NT == 'D') { + double x[] = HDFNativeData.byteToDouble(_barray); + System.arraycopy(x, 0, _theArray, 0, + ArrayDescriptor.dimlen[1]); + return _theArray; + } + else if (ArrayDescriptor.NT == 'B') { + System.arraycopy(_barray, 0, _theArray, 0, + ArrayDescriptor.dimlen[1]); + return _theArray; + } + else if (ArrayDescriptor.NT == 'L') { + if (ArrayDescriptor.className.equals("java.lang.Byte")) { + Byte I[] = ByteToByteObj(_barray); + System.arraycopy(I, 0, _theArray, 0, + ArrayDescriptor.dimlen[1]); + return _theArray; + } + else if (ArrayDescriptor.className + .equals("java.lang.Integer")) { + Integer I[] = ByteToInteger(_barray); + System.arraycopy(I, 0, _theArray, 0, + ArrayDescriptor.dimlen[1]); + return _theArray; + } + else if (ArrayDescriptor.className + .equals("java.lang.Short")) { + Short I[] = ByteToShort(_barray); + System.arraycopy(I, 0, _theArray, 0, + ArrayDescriptor.dimlen[1]); + return _theArray; + } + else if (ArrayDescriptor.className + .equals("java.lang.Float")) { + Float I[] = ByteToFloatObj(_barray); + System.arraycopy(I, 0, _theArray, 0, + ArrayDescriptor.dimlen[1]); + return _theArray; + } + else if (ArrayDescriptor.className + .equals("java.lang.Double")) { + Double I[] = ByteToDoubleObj(_barray); + System.arraycopy(I, 0, _theArray, 0, + ArrayDescriptor.dimlen[1]); + return _theArray; + } + else if (ArrayDescriptor.className.equals("java.lang.Long")) { + Long I[] = ByteToLongObj(_barray); + System.arraycopy(I, 0, _theArray, 0, + ArrayDescriptor.dimlen[1]); + return _theArray; + } + else { + HDF5JavaException ex = new HDF5JavaException( + "arrayify: Object type not implemented yet..."); + throw (ex); + } + } + else { + HDF5JavaException ex = new HDF5JavaException( + "arrayify: unknown type not implemented yet..."); + throw (ex); + } + } + catch (OutOfMemoryError err) { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: arrayify array too big?"); + throw (ex); + } + } + /* Assert dims >= 2 */ + + Object oo = _theArray; + int n = 0; /* the current byte */ + int index = 0; + int i; + while (n < ArrayDescriptor.totalSize) { + oo = ArrayDescriptor.objs[0]; + index = n / ArrayDescriptor.bytetoindex[0]; + index %= ArrayDescriptor.dimlen[0]; + for (i = 0; i < (ArrayDescriptor.dims); i++) { + index = n / ArrayDescriptor.bytetoindex[i]; + index %= ArrayDescriptor.dimlen[i]; + + if (index == ArrayDescriptor.currentindex[i]) { + /* then use cached copy */ + oo = ArrayDescriptor.objs[i]; + } + else { + /* check range of index */ + if (index > (ArrayDescriptor.dimlen[i] - 1)) { + System.out.println("out of bounds?"); + return null; + } + oo = java.lang.reflect.Array.get(oo, index); + ArrayDescriptor.currentindex[i] = index; + ArrayDescriptor.objs[i] = oo; + } + } + + /* array-ify */ + try { + if (ArrayDescriptor.NT == 'J') { + long[] arow = HDFNativeData.byteToLong(n, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + _barray); + java.lang.reflect.Array + .set( + ArrayDescriptor.objs[ArrayDescriptor.dims - 2], + (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), + arow); + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; + } + else if (ArrayDescriptor.NT == 'I') { + int[] arow = HDFNativeData.byteToInt(n, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + _barray); + java.lang.reflect.Array + .set( + ArrayDescriptor.objs[ArrayDescriptor.dims - 2], + (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), + arow); + + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; + } + else if (ArrayDescriptor.NT == 'S') { + short[] arow = HDFNativeData.byteToShort(n, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + _barray); + java.lang.reflect.Array + .set( + ArrayDescriptor.objs[ArrayDescriptor.dims - 2], + (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), + arow); + + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; + } + else if (ArrayDescriptor.NT == 'B') { + System.arraycopy(_barray, n, + ArrayDescriptor.objs[ArrayDescriptor.dims - 1], 0, + ArrayDescriptor.dimlen[ArrayDescriptor.dims]); + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + } + else if (ArrayDescriptor.NT == 'F') { + float arow[] = HDFNativeData.byteToFloat(n, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + _barray); + java.lang.reflect.Array + .set( + ArrayDescriptor.objs[ArrayDescriptor.dims - 2], + (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), + arow); + + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; + } + else if (ArrayDescriptor.NT == 'D') { + double[] arow = HDFNativeData.byteToDouble(n, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + _barray); + java.lang.reflect.Array + .set( + ArrayDescriptor.objs[ArrayDescriptor.dims - 2], + (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), + arow); + + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; + } + else if (ArrayDescriptor.NT == 'L') { + if (ArrayDescriptor.className.equals("java.lang.Byte")) { + Byte I[] = ByteToByteObj(n, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + _barray); + java.lang.reflect.Array + .set( + ArrayDescriptor.objs[ArrayDescriptor.dims - 2], + (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), + I); + + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; + } + else if (ArrayDescriptor.className + .equals("java.lang.Integer")) { + Integer I[] = ByteToInteger(n, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + _barray); + java.lang.reflect.Array + .set( + ArrayDescriptor.objs[ArrayDescriptor.dims - 2], + (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), + I); + + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; + } + else if (ArrayDescriptor.className + .equals("java.lang.Short")) { + Short I[] = ByteToShort(n, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + _barray); + java.lang.reflect.Array + .set( + ArrayDescriptor.objs[ArrayDescriptor.dims - 2], + (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), + I); + + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; + } + else if (ArrayDescriptor.className + .equals("java.lang.Float")) { + Float I[] = ByteToFloatObj(n, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + _barray); + java.lang.reflect.Array + .set( + ArrayDescriptor.objs[ArrayDescriptor.dims - 2], + (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), + I); + + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; + } + else if (ArrayDescriptor.className + .equals("java.lang.Double")) { + Double I[] = ByteToDoubleObj(n, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + _barray); + java.lang.reflect.Array + .set( + ArrayDescriptor.objs[ArrayDescriptor.dims - 2], + (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), + I); + + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; + } + else if (ArrayDescriptor.className.equals("java.lang.Long")) { + Long I[] = ByteToLongObj(n, + ArrayDescriptor.dimlen[ArrayDescriptor.dims], + _barray); + java.lang.reflect.Array + .set( + ArrayDescriptor.objs[ArrayDescriptor.dims - 2], + (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]), + I); + + n += ArrayDescriptor.bytetoindex[ArrayDescriptor.dims - 1]; + ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1]++; + } + else { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: unsupported Object type: " + + ArrayDescriptor.NT); + throw (ex); + } + } + else { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: unknown or unsupported type: " + + ArrayDescriptor.NT); + throw (ex); + } + } + catch (OutOfMemoryError err) { + HDF5JavaException ex = new HDF5JavaException( + "HDFArray: arrayify array too big?"); + throw (ex); + } + + } + + /* assert: the whole array is completed--currentindex should == len - 1 */ + + /* error checks */ + + if (n < ArrayDescriptor.totalSize) { + throw new java.lang.InternalError(new String( + "HDFArray::arrayify Panic didn't complete all input data: n= " + + n + " size = " + ArrayDescriptor.totalSize)); + } + for (i = 0; i <= ArrayDescriptor.dims - 2; i++) { + if (ArrayDescriptor.currentindex[i] != ArrayDescriptor.dimlen[i] - 1) { + throw new java.lang.InternalError(new String( + "HDFArray::arrayify Panic didn't complete all data: currentindex[" + + i + "] = " + ArrayDescriptor.currentindex[i] + + " (should be " + + (ArrayDescriptor.dimlen[i] - 1) + "?")); + } + } + if (ArrayDescriptor.NT != 'B') { + if (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1] != ArrayDescriptor.dimlen[ArrayDescriptor.dims - 1]) { + throw new java.lang.InternalError(new String( + "HDFArray::arrayify Panic didn't complete all data: currentindex[" + + i + "] = " + ArrayDescriptor.currentindex[i] + + " (should be " + (ArrayDescriptor.dimlen[i]) + + "?")); + } + } + else { + if (ArrayDescriptor.currentindex[ArrayDescriptor.dims - 1] != (ArrayDescriptor.dimlen[ArrayDescriptor.dims - 1] - 1)) { + throw new java.lang.InternalError(new String( + "HDFArray::arrayify Panic didn't complete all data: currentindex[" + + i + "] = " + ArrayDescriptor.currentindex[i] + + " (should be " + + (ArrayDescriptor.dimlen[i] - 1) + "?")); + } + } + + return _theArray; + } + + private byte[] IntegerToByte(Integer in[]) { + int nelems = java.lang.reflect.Array.getLength(in); + int[] out = new int[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = in[i].intValue(); + } + return HDFNativeData.intToByte(0, nelems, out); + } + + private Integer[] ByteToInteger(byte[] bin) { + int in[] = HDFNativeData.byteToInt(bin); + int nelems = java.lang.reflect.Array.getLength(in); + Integer[] out = new Integer[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = new Integer(in[i]); + } + return out; + } + + private Integer[] ByteToInteger(int start, int len, byte[] bin) { + int in[] = HDFNativeData.byteToInt(start, len, bin); + int nelems = java.lang.reflect.Array.getLength(in); + Integer[] out = new Integer[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = new Integer(in[i]); + } + return out; + } + + private byte[] ShortToByte(Short in[]) { + int nelems = java.lang.reflect.Array.getLength(in); + short[] out = new short[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = in[i].shortValue(); + } + return HDFNativeData.shortToByte(0, nelems, out); + } + + private Short[] ByteToShort(byte[] bin) { + short in[] = HDFNativeData.byteToShort(bin); + int nelems = java.lang.reflect.Array.getLength((Object) in); + Short[] out = new Short[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = new Short(in[i]); + } + return out; + } + + private Short[] ByteToShort(int start, int len, byte[] bin) { + short in[] = (short[]) HDFNativeData.byteToShort(start, len, bin); + int nelems = java.lang.reflect.Array.getLength((Object) in); + Short[] out = new Short[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = new Short(in[i]); + } + return out; + } + + private byte[] ByteObjToByte(Byte in[]) { + int nelems = java.lang.reflect.Array.getLength((Object) in); + byte[] out = new byte[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = in[i].byteValue(); + } + return out; + } + + private Byte[] ByteToByteObj(byte[] bin) { + int nelems = java.lang.reflect.Array.getLength((Object) bin); + Byte[] out = new Byte[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = new Byte(bin[i]); + } + return out; + } + + private Byte[] ByteToByteObj(int start, int len, byte[] bin) { + Byte[] out = new Byte[len]; + + for (int i = 0; i < len; i++) { + out[i] = new Byte(bin[i]); + } + return out; + } + + private byte[] FloatObjToByte(Float in[]) { + int nelems = java.lang.reflect.Array.getLength((Object) in); + float[] out = new float[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = in[i].floatValue(); + } + return HDFNativeData.floatToByte(0, nelems, out); + } + + private Float[] ByteToFloatObj(byte[] bin) { + float in[] = (float[]) HDFNativeData.byteToFloat(bin); + int nelems = java.lang.reflect.Array.getLength((Object) in); + Float[] out = new Float[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = new Float(in[i]); + } + return out; + } + + private Float[] ByteToFloatObj(int start, int len, byte[] bin) { + float in[] = (float[]) HDFNativeData.byteToFloat(start, len, bin); + int nelems = java.lang.reflect.Array.getLength((Object) in); + Float[] out = new Float[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = new Float(in[i]); + } + return out; + } + + private byte[] DoubleObjToByte(Double in[]) { + int nelems = java.lang.reflect.Array.getLength((Object) in); + double[] out = new double[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = in[i].doubleValue(); + } + return HDFNativeData.doubleToByte(0, nelems, out); + } + + private Double[] ByteToDoubleObj(byte[] bin) { + double in[] = (double[]) HDFNativeData.byteToDouble(bin); + int nelems = java.lang.reflect.Array.getLength((Object) in); + Double[] out = new Double[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = new Double(in[i]); + } + return out; + } + + private Double[] ByteToDoubleObj(int start, int len, byte[] bin) { + double in[] = (double[]) HDFNativeData.byteToDouble(start, len, bin); + int nelems = java.lang.reflect.Array.getLength((Object) in); + Double[] out = new Double[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = new Double(in[i]); + } + return out; + } + + private byte[] LongObjToByte(Long in[]) { + int nelems = java.lang.reflect.Array.getLength((Object) in); + long[] out = new long[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = in[i].longValue(); + } + return HDFNativeData.longToByte(0, nelems, out); + } + + private Long[] ByteToLongObj(byte[] bin) { + long in[] = (long[]) HDFNativeData.byteToLong(bin); + int nelems = java.lang.reflect.Array.getLength((Object) in); + Long[] out = new Long[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = new Long(in[i]); + } + return out; + } + + private Long[] ByteToLongObj(int start, int len, byte[] bin) { + long in[] = (long[]) HDFNativeData.byteToLong(start, len, bin); + int nelems = java.lang.reflect.Array.getLength((Object) in); + Long[] out = new Long[nelems]; + + for (int i = 0; i < nelems; i++) { + out[i] = new Long(in[i]); + } + return out; + } +} + +/** + * This private class is used by HDFArray to discover the shape and type of an + * arbitrary array. + *

+ * We use java.lang.reflection here. + */ +class ArrayDescriptor { + + static String theType = ""; + static Class theClass = null; + static int[] dimlen = null; + static int[] dimstart = null; + static int[] currentindex = null; + static int[] bytetoindex = null; + static int totalSize = 0; + static Object[] objs = null; + static char NT = ' '; /* must be B,S,I,L,F,D, else error */ + static int NTsize = 0; + static int dims = 0; + static String className; + + public ArrayDescriptor(Object anArray) throws HDF5Exception { + + Class tc = anArray.getClass(); + if (tc.isArray() == false) { + /* exception: not an array */ + HDF5Exception ex = new HDF5JavaException( + "ArrayDescriptor: not an array?: "); + throw (ex); + } + + theClass = tc; + + /* + * parse the type descriptor to discover the shape of the array + */ + String ss = tc.toString(); + theType = ss; + int n = 6; + dims = 0; + char c = ' '; + while (n < ss.length()) { + c = ss.charAt(n); + n++; + if (c == '[') { + dims++; + } + } + + String css = ss.substring(ss.lastIndexOf('[') + 1); + Class compC = tc.getComponentType(); + String cs = compC.toString(); + NT = c; /* must be B,S,I,L,F,D, else error */ + if (NT == 'B') { + NTsize = 1; + } + else if (NT == 'S') { + NTsize = 2; + } + else if ((NT == 'I') || (NT == 'F')) { + NTsize = 4; + } + else if ((NT == 'J') || (NT == 'D')) { + NTsize = 8; + } + else if (css.startsWith("Ljava.lang.Byte")) { + NT = 'L'; + className = "java.lang.Byte"; + NTsize = 1; + } + else if (css.startsWith("Ljava.lang.Short")) { + NT = 'L'; + className = "java.lang.Short"; + NTsize = 2; + } + else if (css.startsWith("Ljava.lang.Integer")) { + NT = 'L'; + className = "java.lang.Integer"; + NTsize = 4; + } + else if (css.startsWith("Ljava.lang.Float")) { + NT = 'L'; + className = "java.lang.Float"; + NTsize = 4; + } + else if (css.startsWith("Ljava.lang.Double")) { + NT = 'L'; + className = "java.lang.Double"; + NTsize = 8; + } + else if (css.startsWith("Ljava.lang.Long")) { + NT = 'L'; + className = "java.lang.Long"; + NTsize = 8; + } + else if (css.startsWith("Ljava.lang.String")) { + throw new HDF5JavaException(new String( + "ArrayDesciptor: Error: String array not supported yet")); + } + else { + /* + * exception: not a numeric type + */ + throw new HDF5JavaException(new String( + "ArrayDesciptor: Error: array is not numeric (type is " + + css + ") ?")); + } + + /* fill in the table */ + dimlen = new int[dims + 1]; + dimstart = new int[dims + 1]; + currentindex = new int[dims + 1]; + bytetoindex = new int[dims + 1]; + objs = new Object[dims + 1]; + + Object o = anArray; + objs[0] = o; + dimlen[0] = 1; + dimstart[0] = 0; + currentindex[0] = 0; + int i; + for (i = 1; i <= dims; i++) { + dimlen[i] = java.lang.reflect.Array.getLength((Object) o); + o = java.lang.reflect.Array.get((Object) o, 0); + objs[i] = o; + dimstart[i] = 0; + currentindex[i] = 0; + } + + int j; + int dd; + bytetoindex[dims] = NTsize; + for (i = dims; i >= 0; i--) { + dd = NTsize; + for (j = i; j < dims; j++) { + dd *= dimlen[j + 1]; + } + bytetoindex[i] = dd; + } + + totalSize = bytetoindex[0]; + } + + /** + * Debug dump + */ + public void dumpInfo() { + System.out.println("Type: " + theType); + System.out.println("Class: " + theClass); + System.out.println("NT: " + NT + " NTsize: " + NTsize); + System.out.println("Array has " + dims + " dimensions (" + totalSize + + " bytes)"); + int i; + for (i = 0; i <= dims; i++) { + Class tc = objs[i].getClass(); + String ss = tc.toString(); + System.out.println(i + ": start " + dimstart[i] + ": len " + + dimlen[i] + " current " + currentindex[i] + + " bytetoindex " + bytetoindex[i] + " object " + objs[i] + + " otype " + ss); + } + } +} diff --git a/java/src/hdf/hdf5lib/HDFNativeData.java b/java/src/hdf/hdf5lib/HDFNativeData.java new file mode 100644 index 0000000..66929fb --- /dev/null +++ b/java/src/hdf/hdf5lib/HDFNativeData.java @@ -0,0 +1,481 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib; + +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5JavaException; + +/** + * This class encapsulates native methods to deal with arrays of numbers, + * converting from numbers to bytes and bytes to numbers. + *

+ * These routines are used by class HDFArray to pass data to and from the + * HDF-5 library. + *

+ * Methods xxxToByte() convert a Java array of primitive numbers (int, short, + * ...) to a Java array of bytes. Methods byteToXxx() convert from a Java array + * of bytes into a Java array of primitive numbers (int, short, ...) + *

+ * Variant interfaces convert a section of an array, and also can convert to + * sub-classes of Java Number. + *

+ * See also: hdf.hdf5lib.HDFArray. + */ + +public class HDFNativeData { + + /** + * Convert an array of bytes into an array of ints + * + * @param data + * The input array of bytes + * @return an array of int + */ + public synchronized static native int[] byteToInt(byte[] data); + + /** + * Convert an array of bytes into an array of floats + * + * @param data + * The input array of bytes + * @return an array of float + */ + public synchronized static native float[] byteToFloat(byte[] data); + + /** + * Convert an array of bytes into an array of shorts + * + * @param data + * The input array of bytes + * @return an array of short + */ + public synchronized static native short[] byteToShort(byte[] data); + + /** + * Convert an array of bytes into an array of long + * + * @param data + * The input array of bytes + * @return an array of long + */ + /* + * does this really work? C 'long' is 32 bits, Java 'long' is 64-bits. What + * does this routine actually do? + */ + public synchronized static native long[] byteToLong(byte[] data); + + /** + * Convert an array of bytes into an array of double + * + * @param data + * The input array of bytes + * @return an array of double + */ + public synchronized static native double[] byteToDouble(byte[] data); + + /** + * Convert a range from an array of bytes into an array of int + * + * @param start + * The position in the input array of bytes to start + * @param len + * The number of 'int' to convert + * @param data + * The input array of bytes + * @return an array of 'len' int + */ + public synchronized static native int[] byteToInt(int start, int len, + byte[] data); + + /** + * Convert 4 bytes from an array of bytes into a single int + * + * @param start + * The position in the input array of bytes to start + * @param data + * The input array of bytes + * @return The integer value of the bytes. + */ + public synchronized static int byteToInt(byte[] data, int start) { + int[] ival = new int[1]; + ival = byteToInt(start, 1, data); + return (ival[0]); + } + + /** + * Convert a range from an array of bytes into an array of short + * + * @param start + * The position in the input array of bytes to start + * @param len + * The number of 'short' to convert + * @param data + * The input array of bytes + * @return an array of 'len' short + */ + public synchronized static native short[] byteToShort(int start, int len, + byte[] data); + + /** + * Convert 2 bytes from an array of bytes into a single short + * + * @param start + * The position in the input array of bytes to start + * @param data + * The input array of bytes + * @return The short value of the bytes. + */ + public synchronized static short byteToShort(byte[] data, int start) { + short[] sval = new short[1]; + sval = byteToShort(start, 1, data); + return (sval[0]); + } + + /** + * Convert a range from an array of bytes into an array of float + * + * @param start + * The position in the input array of bytes to start + * @param len + * The number of 'float' to convert + * @param data + * The input array of bytes + * @return an array of 'len' float + */ + public synchronized static native float[] byteToFloat(int start, int len, + byte[] data); + + /** + * Convert 4 bytes from an array of bytes into a single float + * + * @param start + * The position in the input array of bytes to start + * @param data + * The input array of bytes + * @return The float value of the bytes. + */ + public synchronized static float byteToFloat(byte[] data, int start) { + float[] fval = new float[1]; + fval = byteToFloat(start, 1, data); + return (fval[0]); + } + + /** + * Convert a range from an array of bytes into an array of long + * + * @param start + * The position in the input array of bytes to start + * @param len + * The number of 'long' to convert + * @param data + * The input array of bytes + * @return an array of 'len' long + */ + public synchronized static native long[] byteToLong(int start, int len, + byte[] data); + + /** + * Convert 8 bytes from an array of bytes into a single long + * + * @param start + * The position in the input array of bytes to start + * @param data + * The input array of bytes + * @return The long value of the bytes. + */ + public synchronized static long byteToLong(byte[] data, int start) { + long[] lval = new long[1]; + lval = byteToLong(start, 1, data); + return (lval[0]); + } + + /** + * Convert a range from an array of bytes into an array of double + * + * @param start + * The position in the input array of bytes to start + * @param len + * The number of 'double' to convert + * @param data + * The input array of bytes + * @return an array of 'len' double + */ + public synchronized static native double[] byteToDouble(int start, int len, + byte[] data); + + /** + * Convert 8 bytes from an array of bytes into a single double + * + * @param start + * The position in the input array of bytes to start + * @param data + * The input array of bytes + * @return The double value of the bytes. + */ + public synchronized static double byteToDouble(byte[] data, int start) { + double[] dval = new double[1]; + dval = byteToDouble(start, 1, data); + return (dval[0]); + } + + /** + * Convert a range from an array of int into an array of bytes. + * + * @param start + * The position in the input array of int to start + * @param len + * The number of 'int' to convert + * @param data + * The input array of int + * @return an array of bytes + */ + public synchronized static native byte[] intToByte(int start, int len, + int[] data); + + /** + * Convert a range from an array of short into an array of bytes. + * + * @param start + * The position in the input array of int to start + * @param len + * The number of 'short' to convert + * @param data + * The input array of short + * @return an array of bytes + */ + public synchronized static native byte[] shortToByte(int start, int len, + short[] data); + + /** + * Convert a range from an array of float into an array of bytes. + * + * @param start + * The position in the input array of int to start + * @param len + * The number of 'float' to convert + * @param data + * The input array of float + * @return an array of bytes + */ + public synchronized static native byte[] floatToByte(int start, int len, + float[] data); + + /** + * Convert a range from an array of long into an array of bytes. + * + * @param start + * The position in the input array of int to start + * @param len + * The number of 'long' to convert + * @param data + * The input array of long + * @return an array of bytes + */ + public synchronized static native byte[] longToByte(int start, int len, + long[] data); + + /** + * Convert a range from an array of double into an array of bytes. + * + * @param start + * The position in the input array of double to start + * @param len + * The number of 'double' to convert + * @param data + * The input array of double + * @return an array of bytes + */ + public synchronized static native byte[] doubleToByte(int start, int len, + double[] data); + + /** + * Convert a single byte into an array of one byte. + *

+ * (This is a trivial method.) + * + * @param data + * The input byte + * @return an array of bytes + */ + public synchronized static native byte[] byteToByte(byte data); + + /** + * Convert a single Byte object into an array of one byte. + *

+ * (This is an almost trivial method.) + * + * @param data + * The input Byte + * @return an array of bytes + */ + public synchronized static byte[] byteToByte(Byte data) { + return byteToByte(data.byteValue()); + } + + /** + * Convert a single int into an array of 4 bytes. + * + * @param data + * The input int + * @return an array of bytes + */ + public synchronized static native byte[] intToByte(int data); + + /** + * Convert a single Integer object into an array of 4 bytes. + * + * @param data + * The input Integer + * @return an array of bytes + */ + public synchronized static byte[] intToByte(Integer data) { + return intToByte(data.intValue()); + } + + /** + * Convert a single short into an array of 2 bytes. + * + * @param data + * The input short + * @return an array of bytes + */ + public synchronized static native byte[] shortToByte(short data); + + /** + * Convert a single Short object into an array of 2 bytes. + * + * @param data + * The input Short + * @return an array of bytes + */ + public synchronized static byte[] shortToByte(Short data) { + return shortToByte(data.shortValue()); + } + + /** + * Convert a single float into an array of 4 bytes. + * + * @param data + * The input float + * @return an array of bytes + */ + public synchronized static native byte[] floatToByte(float data); + + /** + * Convert a single Float object into an array of 4 bytes. + * + * @param data + * The input Float + * @return an array of bytes + */ + public synchronized static byte[] floatToByte(Float data) { + return floatToByte(data.floatValue()); + }; + + /** + * Convert a single long into an array of 8 bytes. + * + * @param data + * The input long + * @return an array of bytes + */ + public synchronized static native byte[] longToByte(long data); + + /** + * Convert a single Long object into an array of 8 bytes. + * + * @param data + * The input Long + * @return an array of bytes + */ + public synchronized static byte[] longToByte(Long data) { + return longToByte(data.longValue()); + } + + /** + * Convert a single double into an array of 8 bytes. + * + * @param data + * The input double + * @return an array of bytes + */ + public synchronized static native byte[] doubleToByte(double data); + + /** + * Convert a single Double object into an array of 8 bytes. + * + * @param data + * The input Double + * @return an array of bytes + */ + public synchronized static byte[] doubleToByte(Double data) { + return doubleToByte(data.doubleValue()); + } + + /** + * Create a Number object from an array of bytes. + * + * @param barray + * The bytes to be converted + * @param obj + * Input object of the desired output class. Must be a sub-class + * of Number. + * @return A Object of the type of obj. + * + * @exception HDF5Exception + * - Error unsupported type. + */ + public synchronized static Object byteToNumber(byte[] barray, Object obj) + throws HDF5Exception { + Class theClass = obj.getClass(); + String type = theClass.getName(); + Object retobj = null; + + if (type.equals("java.lang.Integer")) { + int[] i = hdf.hdf5lib.HDFNativeData.byteToInt(0, 1, barray); + retobj = new Integer(i[0]); + } + else if (type.equals("java.lang.Byte")) { + retobj = new Byte(barray[0]); + } + else if (type.equals("java.lang.Short")) { + short[] f = hdf.hdf5lib.HDFNativeData + .byteToShort(0, 1, barray); + retobj = new Short(f[0]); + } + else if (type.equals("java.lang.Float")) { + float[] f = hdf.hdf5lib.HDFNativeData + .byteToFloat(0, 1, barray); + retobj = new Float(f[0]); + } + else if (type.equals("java.lang.Long")) { + long[] f = hdf.hdf5lib.HDFNativeData.byteToLong(0, 1, barray); + retobj = new Long(f[0]); + } + else if (type.equals("java.lang.Double")) { + double[] f = hdf.hdf5lib.HDFNativeData.byteToDouble(0, 1, + barray); + retobj = new Double(f[0]); + } + else { + /* exception: unsupported type */ + HDF5Exception ex = new HDF5JavaException( + "byteToNumber: setfield bad type: " + obj + " " + type); + throw (ex); + } + return (retobj); + } +} diff --git a/java/src/hdf/hdf5lib/callbacks/Callbacks.java b/java/src/hdf/hdf5lib/callbacks/Callbacks.java new file mode 100644 index 0000000..5757eef --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/Callbacks.java @@ -0,0 +1,33 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +/** All callback definitions must derive from this interface. Any + * derived interfaces must define a single public method named "callback". + * You are responsible for deregistering your callback (if necessary) + * in its {@link Object#finalize} method. If native code attempts to call + * a callback which has been GC'd, you will likely crash the VM. If + * there is no method to deregister the callback (e.g. atexit + * in the C library), you must ensure that you always keep a live reference + * to the callback object.

+ * A callback should generally never throw an exception, since it doesn't + * necessarily have an encompassing Java environment to catch it. Any + * exceptions thrown will be passed to the default callback exception + * handler. + */ +public interface Callbacks { + +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5D_iterate_cb.java b/java/src/hdf/hdf5lib/callbacks/H5D_iterate_cb.java new file mode 100644 index 0000000..bac3dd9 --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5D_iterate_cb.java @@ -0,0 +1,21 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +//Information class for link callback(for H5Diterate) +public interface H5D_iterate_cb extends Callbacks { + int callback(byte[] elem, long elem_type, int ndim, long[] point, H5D_iterate_t op_data); +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5D_iterate_t.java b/java/src/hdf/hdf5lib/callbacks/H5D_iterate_t.java new file mode 100644 index 0000000..03bcc20 --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5D_iterate_t.java @@ -0,0 +1,22 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +public interface H5D_iterate_t { +/** public ArrayList iterdata = new ArrayList(); + * Any derived interfaces must define the single public variable as above. + */ +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5L_iterate_cb.java b/java/src/hdf/hdf5lib/callbacks/H5L_iterate_cb.java new file mode 100644 index 0000000..5218311 --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5L_iterate_cb.java @@ -0,0 +1,23 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +import hdf.hdf5lib.structs.H5L_info_t; + +//Information class for link callback(for H5Lvisit/H5Lvisit_by_name) +public interface H5L_iterate_cb extends Callbacks { + int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data); +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java b/java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java new file mode 100644 index 0000000..b7c25f4 --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5L_iterate_t.java @@ -0,0 +1,22 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +public interface H5L_iterate_t { +/** public ArrayList iterdata = new ArrayList(); + * Any derived interfaces must define the single public variable as above. + */ +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5O_iterate_cb.java b/java/src/hdf/hdf5lib/callbacks/H5O_iterate_cb.java new file mode 100644 index 0000000..630205f --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5O_iterate_cb.java @@ -0,0 +1,23 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +import hdf.hdf5lib.structs.H5O_info_t; + +//Information class for link callback(for H5Ovisit/H5Ovisit_by_name) +public interface H5O_iterate_cb extends Callbacks { + int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data); +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java b/java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java new file mode 100644 index 0000000..da64f19 --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5O_iterate_t.java @@ -0,0 +1,22 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +public interface H5O_iterate_t { +/** public ArrayList iterdata = new ArrayList(); + * Any derived interfaces must define the single public variable as above. + */ +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5AtomException.java b/java/src/hdf/hdf5lib/exceptions/HDF5AtomException.java new file mode 100644 index 0000000..3309223 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5AtomException.java @@ -0,0 +1,44 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_ATOM + */ + +public class HDF5AtomException extends HDF5LibraryException { + /** + * Constructs an HDF5AtomException with no specified detail + * message. + */ + public HDF5AtomException() { + super(); + } + + /** + * Constructs an HDF5AtomException with the specified detail + * message. + * + * @param s + * the detail message. + */ + public HDF5AtomException(String s) { + super(s); + } + +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5AttributeException.java b/java/src/hdf/hdf5lib/exceptions/HDF5AttributeException.java new file mode 100644 index 0000000..8c1a7b8 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5AttributeException.java @@ -0,0 +1,42 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_ATTR + */ +public class HDF5AttributeException extends HDF5LibraryException { + /** + * Constructs an HDF5AttributeException with no specified + * detail message. + */ + public HDF5AttributeException() { + super(); + } + + /** + * Constructs an HDF5AttributeException with the specified + * detail message. + * + * @param s + * the detail message. + */ + public HDF5AttributeException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5BtreeException.java b/java/src/hdf/hdf5lib/exceptions/HDF5BtreeException.java new file mode 100644 index 0000000..dc82fd9 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5BtreeException.java @@ -0,0 +1,42 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_BTREE + */ +public class HDF5BtreeException extends HDF5LibraryException { + /** + * Constructs an HDF5BtreeException with no specified detail + * message. + */ + public HDF5BtreeException() { + super(); + } + + /** + * Constructs an HDF5BtreeException with the specified detail + * message. + * + * @param s + * the detail message. + */ + public HDF5BtreeException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5DataFiltersException.java b/java/src/hdf/hdf5lib/exceptions/HDF5DataFiltersException.java new file mode 100644 index 0000000..17fd9db --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5DataFiltersException.java @@ -0,0 +1,42 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_PLINE + */ +public class HDF5DataFiltersException extends HDF5LibraryException { + /** + * Constructs an HDF5DataFiltersException with no specified + * detail message. + */ + public HDF5DataFiltersException() { + super(); + } + + /** + * Constructs an HDF5DataFiltersException with the specified + * detail message. + * + * @param s + * the detail message. + */ + public HDF5DataFiltersException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5DataStorageException.java b/java/src/hdf/hdf5lib/exceptions/HDF5DataStorageException.java new file mode 100644 index 0000000..f22c9ec --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5DataStorageException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_STORAGE + */ + +public class HDF5DataStorageException extends HDF5LibraryException { + /** + * Constructs an HDF5DataStorageExceptionn with no specified + * detail message. + */ + public HDF5DataStorageException() { + super(); + } + + /** + * Constructs an HDF5DataStorageException with the specified + * detail message. + * + * @param s + * the detail message. + */ + public HDF5DataStorageException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5DatasetInterfaceException.java b/java/src/hdf/hdf5lib/exceptions/HDF5DatasetInterfaceException.java new file mode 100644 index 0000000..e39709d --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5DatasetInterfaceException.java @@ -0,0 +1,42 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_DATASET + */ +public class HDF5DatasetInterfaceException extends HDF5LibraryException { + /** + * Constructs an HDF5DatasetInterfaceException with no + * specified detail message. + */ + public HDF5DatasetInterfaceException() { + super(); + } + + /** + * Constructs an HDF5DatasetInterfaceException with the + * specified detail message. + * + * @param s + * the detail message. + */ + public HDF5DatasetInterfaceException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5DataspaceInterfaceException.java b/java/src/hdf/hdf5lib/exceptions/HDF5DataspaceInterfaceException.java new file mode 100644 index 0000000..531202c --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5DataspaceInterfaceException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_DATASPACE + */ + +public class HDF5DataspaceInterfaceException extends HDF5LibraryException { + /** + * Constructs an HDF5DataspaceInterfaceException with no + * specified detail message. + */ + public HDF5DataspaceInterfaceException() { + super(); + } + + /** + * Constructs an HDF5DataspaceInterfaceException with the + * specified detail message. + * + * @param s + * the detail message. + */ + public HDF5DataspaceInterfaceException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5DatatypeInterfaceException.java b/java/src/hdf/hdf5lib/exceptions/HDF5DatatypeInterfaceException.java new file mode 100644 index 0000000..3c0c144 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5DatatypeInterfaceException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_DATATYPE + */ + +public class HDF5DatatypeInterfaceException extends HDF5LibraryException { + /** + * Constructs an HDF5DatatypeInterfaceException with no + * specified detail message. + */ + public HDF5DatatypeInterfaceException() { + super(); + } + + /** + * Constructs an HDF5DatatypeInterfaceException with the + * specified detail message. + * + * @param s + * the detail message. + */ + public HDF5DatatypeInterfaceException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5Exception.java b/java/src/hdf/hdf5lib/exceptions/HDF5Exception.java new file mode 100644 index 0000000..8a83ca1 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5Exception.java @@ -0,0 +1,68 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + *

+ * The class HDF5Exception returns errors from the Java HDF5 Interface. + *

+ * Two sub-classes of HDF5Exception are defined: + *

    + *
  1. + * HDF5LibraryException -- errors raised the HDF5 library code + *
  2. + * HDF5JavaException -- errors raised the HDF5 Java wrapper code + *
+ *

+ * These exceptions are sub-classed to represent specific error conditions, as + * needed. In particular, HDF5LibraryException has a sub-class for each major + * error code returned by the HDF5 library. + * + */ +public class HDF5Exception extends Exception { + protected String detailMessage; + + /** + * Constructs an HDF5Exception with no specified detail + * message. + */ + public HDF5Exception() { + super(); + } + + /** + * Constructs an HDF5Exception with the specified detail + * message. + * + * @param message + * the detail message. + */ + public HDF5Exception(String message) { + super(); + detailMessage = message; + } + + /** + * Returns the detail message of this exception + * + * @return the detail message or null if this object does not + * have a detail message. + */ + @Override + public String getMessage() { + return detailMessage; + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5ExternalFileListException.java b/java/src/hdf/hdf5lib/exceptions/HDF5ExternalFileListException.java new file mode 100644 index 0000000..62c5dd8 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5ExternalFileListException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_EFL + */ + +public class HDF5ExternalFileListException extends HDF5LibraryException { + /** + * Constructs an HDF5ExternalFileListException with no + * specified detail message. + */ + public HDF5ExternalFileListException() { + super(); + } + + /** + * Constructs an HDF5ExternalFileListException with the + * specified detail message. + * + * @param s + * the detail message. + */ + public HDF5ExternalFileListException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5FileInterfaceException.java b/java/src/hdf/hdf5lib/exceptions/HDF5FileInterfaceException.java new file mode 100644 index 0000000..0b63b41 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5FileInterfaceException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_FILE + */ + +public class HDF5FileInterfaceException extends HDF5LibraryException { + /** + * Constructs an HDF5FileInterfaceException with no specified + * detail message. + */ + public HDF5FileInterfaceException() { + super(); + } + + /** + * Constructs an HDF5FileInterfaceException with the specified + * detail message. + * + * @param s + * the detail message. + */ + public HDF5FileInterfaceException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5FunctionArgumentException.java b/java/src/hdf/hdf5lib/exceptions/HDF5FunctionArgumentException.java new file mode 100644 index 0000000..c984aae --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5FunctionArgumentException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_ARGS + */ + +public class HDF5FunctionArgumentException extends HDF5LibraryException { + /** + * Constructs an HDF5FunctionArgumentException with no + * specified detail message. + */ + public HDF5FunctionArgumentException() { + super(); + } + + /** + * Constructs an HDF5FunctionArgumentException with the + * specified detail message. + * + * @param s + * the detail message. + */ + public HDF5FunctionArgumentException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5FunctionEntryExitException.java b/java/src/hdf/hdf5lib/exceptions/HDF5FunctionEntryExitException.java new file mode 100644 index 0000000..5dad930 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5FunctionEntryExitException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_FUNC + */ + +public class HDF5FunctionEntryExitException extends HDF5LibraryException { + /** + * Constructs an HDF5FunctionEntryExitException with no + * specified detail message. + */ + public HDF5FunctionEntryExitException() { + super(); + } + + /** + * Constructs an HDF5FunctionEntryExitException with the + * specified detail message. + * + * @param s + * the detail message. + */ + public HDF5FunctionEntryExitException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5HeapException.java b/java/src/hdf/hdf5lib/exceptions/HDF5HeapException.java new file mode 100644 index 0000000..dfe4ced --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5HeapException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_HEAP + */ + +public class HDF5HeapException extends HDF5LibraryException { + /** + * Constructs an HDF5HeapException with no specified detail + * message. + */ + public HDF5HeapException() { + super(); + } + + /** + * Constructs an HDF5HeapException with the specified detail + * message. + * + * @param s + * the detail message. + */ + public HDF5HeapException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5InternalErrorException.java b/java/src/hdf/hdf5lib/exceptions/HDF5InternalErrorException.java new file mode 100644 index 0000000..45a836c --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5InternalErrorException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_INTERNAL + */ + +public class HDF5InternalErrorException extends HDF5LibraryException { + /** + * Constructs an HDF5InternalErrorException with no specified + * detail message. + */ + public HDF5InternalErrorException() { + super(); + } + + /** + * Constructs an HDF5InternalErrorException with the specified + * detail message. + * + * @param s + * the detail message. + */ + public HDF5InternalErrorException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5JavaException.java b/java/src/hdf/hdf5lib/exceptions/HDF5JavaException.java new file mode 100644 index 0000000..2db79ef --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5JavaException.java @@ -0,0 +1,45 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + *

+ * The class HDF5JavaException returns errors from the Java wrapper of theHDF5 + * library. + *

+ * These errors include Java configuration errors, security violations, and + * resource exhaustion. + */ +public class HDF5JavaException extends HDF5Exception { + /** + * Constructs an HDF5JavaException with no specified detail + * message. + */ + public HDF5JavaException() { + super(); + } + + /** + * Constructs an HDF5JavaException with the specified detail + * message. + * + * @param s + * the detail message. + */ + public HDF5JavaException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java b/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java new file mode 100644 index 0000000..8b21ff8 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5LibraryException.java @@ -0,0 +1,383 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +/** + *

+ * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * Each major error code from the HDF-5 Library is represented by a sub-class of + * this class, and by default the 'detailedMessage' is set according to the + * minor error code from the HDF-5 Library. + *

+ * For major and minor error codes, see H5Epublic.h in the HDF-5 library. + * + */ + +@SuppressWarnings("serial") +public class HDF5LibraryException extends HDF5Exception { + /** + * Constructs an HDF5LibraryException with no specified detail + * message. + */ + public HDF5LibraryException() { + super(); + + // this code forces the loading of the HDF-5 library + // to assure that the native methods are available + try { + H5.H5open(); + } + catch (Exception e) { + } + ; + + detailMessage = getMinorError(getMinorErrorNumber()); + } + + /** + * Constructs an HDF5LibraryException with the specified detail + * message. + * + * @param s + * the detail message. + */ + public HDF5LibraryException(String s) { + super(s); + // this code forces the loading of the HDF-5 library + // to assure that the native methods are available + try { + H5.H5open(); + } + catch (Exception e) { + } + ; + } + + /** + * Get the major error number of the first error on the HDF5 library error + * stack. + * + * @return the major error number + */ + public native long getMajorErrorNumber(); + + /** + * Get the minor error number of the first error on the HDF5 library error + * stack. + * + * @return the minor error number + */ + public native long getMinorErrorNumber(); + + /** + * Return a error message for the minor error number. + *

+ * These messages come from H5Epublic.h. + * + * @param err_code + * the error code + * + * @return the string of the minor error + */ + public String getMinorError(long err_code) { + if (err_code == 0) { + return "special zero no error"; + } + else if (err_code == HDF5Constants.H5E_UNINITIALIZED) { + return "information is unitialized"; + } + else if (err_code == HDF5Constants.H5E_UNSUPPORTED) { + return "feature is unsupported"; + } + else if (err_code == HDF5Constants.H5E_BADTYPE) { + return "incorrect type found"; + } + else if (err_code == HDF5Constants.H5E_BADRANGE) { + return "argument out of range"; + } + else if (err_code == HDF5Constants.H5E_BADVALUE) { + return "bad value for argument"; + } + else if (err_code == HDF5Constants.H5E_NOSPACE) { + return "no space available for allocation"; + } + else if (err_code == HDF5Constants.H5E_CANTCOPY) { + return "unable to copy object"; + } + else if (err_code == HDF5Constants.H5E_CANTFREE) { + return "unable to free object"; + } + else if (err_code == HDF5Constants.H5E_ALREADYEXISTS) { + return "Object already exists"; + } + else if (err_code == HDF5Constants.H5E_CANTLOCK) { + return "Unable to lock object"; + } + else if (err_code == HDF5Constants.H5E_CANTUNLOCK) { + return "Unable to unlock object"; + } + else if (err_code == HDF5Constants.H5E_FILEEXISTS) { + return "file already exists"; + } + else if (err_code == HDF5Constants.H5E_FILEOPEN) { + return "file already open"; + } + else if (err_code == HDF5Constants.H5E_CANTCREATE) { + return "Can't create file"; + } + else if (err_code == HDF5Constants.H5E_CANTOPENFILE) { + return "Can't open file"; + } + else if (err_code == HDF5Constants.H5E_CANTCLOSEFILE) { + return "Can't close file"; + } + else if (err_code == HDF5Constants.H5E_NOTHDF5) { + return "not an HDF5 format file"; + } + else if (err_code == HDF5Constants.H5E_BADFILE) { + return "bad file ID accessed"; + } + else if (err_code == HDF5Constants.H5E_TRUNCATED) { + return "file has been truncated"; + } + else if (err_code == HDF5Constants.H5E_MOUNT) { + return "file mount error"; + } + else if (err_code == HDF5Constants.H5E_SEEKERROR) { + return "seek failed"; + } + else if (err_code == HDF5Constants.H5E_READERROR) { + return "read failed"; + } + else if (err_code == HDF5Constants.H5E_WRITEERROR) { + return "write failed"; + } + else if (err_code == HDF5Constants.H5E_CLOSEERROR) { + return "close failed"; + } + else if (err_code == HDF5Constants.H5E_OVERFLOW) { + return "address overflowed"; + } + else if (err_code == HDF5Constants.H5E_FCNTL) { + return "file fcntl failed"; + } + else if (err_code == HDF5Constants.H5E_CANTINIT) { + return "Can't initialize object"; + } + else if (err_code == HDF5Constants.H5E_ALREADYINIT) { + return "object already initialized"; + } + else if (err_code == HDF5Constants.H5E_CANTRELEASE) { + return "Can't release object"; + } + else if (err_code == HDF5Constants.H5E_BADATOM) { + return "Can't find atom information"; + } + else if (err_code == HDF5Constants.H5E_BADGROUP) { + return "Can't find group information"; + } + else if (err_code == HDF5Constants.H5E_CANTREGISTER) { + return "Can't register new atom"; + } + else if (err_code == HDF5Constants.H5E_CANTINC) { + return "Can't increment reference count"; + } + else if (err_code == HDF5Constants.H5E_CANTDEC) { + return "Can't decrement reference count"; + } + else if (err_code == HDF5Constants.H5E_NOIDS) { + return "Out of IDs for group"; + } + else if (err_code == HDF5Constants.H5E_CANTFLUSH) { + return "Can't flush object from cache"; + } + else if (err_code == HDF5Constants.H5E_CANTLOAD) { + return "Can't load object into cache"; + } + else if (err_code == HDF5Constants.H5E_PROTECT) { + return "protected object error"; + } + else if (err_code == HDF5Constants.H5E_NOTCACHED) { + return "object not currently cached"; + } + else if (err_code == HDF5Constants.H5E_NOTFOUND) { + return "object not found"; + } + else if (err_code == HDF5Constants.H5E_EXISTS) { + return "object already exists"; + } + else if (err_code == HDF5Constants.H5E_CANTENCODE) { + return "Can't encode value"; + } + else if (err_code == HDF5Constants.H5E_CANTDECODE) { + return "Can't decode value"; + } + else if (err_code == HDF5Constants.H5E_CANTSPLIT) { + return "Can't split node"; + } + else if (err_code == HDF5Constants.H5E_CANTINSERT) { + return "Can't insert object"; + } + else if (err_code == HDF5Constants.H5E_CANTLIST) { + return "Can't list node"; + } + else if (err_code == HDF5Constants.H5E_LINKCOUNT) { + return "bad object header link count"; + } + else if (err_code == HDF5Constants.H5E_VERSION) { + return "wrong version number"; + } + else if (err_code == HDF5Constants.H5E_ALIGNMENT) { + return "alignment error"; + } + else if (err_code == HDF5Constants.H5E_BADMESG) { + return "unrecognized message"; + } + else if (err_code == HDF5Constants.H5E_CANTDELETE) { + return " Can't delete message"; + } + else if (err_code == HDF5Constants.H5E_CANTOPENOBJ) { + return "Can't open object"; + } + else if (err_code == HDF5Constants.H5E_COMPLEN) { + return "name component is too long"; + } + else if (err_code == HDF5Constants.H5E_LINK) { + return "link count failure"; + } + else if (err_code == HDF5Constants.H5E_CANTCONVERT) { + return "Can't convert datatypes"; + } + else if (err_code == HDF5Constants.H5E_BADSIZE) { + return "Bad size for object"; + } + else if (err_code == HDF5Constants.H5E_CANTCLIP) { + return "Can't clip hyperslab region"; + } + else if (err_code == HDF5Constants.H5E_CANTCOUNT) { + return "Can't count elements"; + } + else if (err_code == HDF5Constants.H5E_CANTSELECT) { + return "Can't select hyperslab"; + } + else if (err_code == HDF5Constants.H5E_CANTNEXT) { + return "Can't move to next iterator location"; + } + else if (err_code == HDF5Constants.H5E_BADSELECT) { + return "Invalid selection"; + } + else if (err_code == HDF5Constants.H5E_CANTGET) { + return "Can't get value"; + } + else if (err_code == HDF5Constants.H5E_CANTSET) { + return "Can't set value"; + } + else if (err_code == HDF5Constants.H5E_DUPCLASS) { + return "Duplicate class name in parent class"; + } + else if (err_code == HDF5Constants.H5E_MPI) { + return "some MPI function failed"; + } + else if (err_code == HDF5Constants.H5E_MPIERRSTR) { + return "MPI Error String"; + // } + // else + // if + // (err_code + // == + // HDF5Constants.H5E_CANTRECV + // ) + // { + // return + // "can't receive messages from processes"; + // } + // else + // if + // (err_code + // == + // HDF5Constants.H5E_CANTALLOC + // ) + // { + // return + // "can't allocate from file"; + } + else if (err_code == HDF5Constants.H5E_NOFILTER) { + return "requested filter is not available"; + } + else if (err_code == HDF5Constants.H5E_CALLBACK) { + return "callback failed"; + } + else if (err_code == HDF5Constants.H5E_CANAPPLY) { + return "error from filter \"can apply\" callback"; + } + else if (err_code == HDF5Constants.H5E_SETLOCAL) { + return "error from filter \"set local\" callback"; + } + else { + return "undefined error(" + err_code + ")"; + } + } + + /** + * Prints this HDF5LibraryException, the HDF-5 Library error + * stack, and and the Java stack trace to the standard error stream. + */ + @Override + public void printStackTrace() { + System.err.println(this); + printStackTrace0(null); // the HDF-5 Library error stack + super.printStackTrace(); // the Java stack trace + } + + /** + * Prints this HDF5LibraryException the HDF-5 Library error + * stack, and and the Java stack trace to the specified print stream. + * + * @param f + * the file print stream. + */ + public void printStackTrace(java.io.File f) { + if ((f == null) || !f.exists() || f.isDirectory() || !f.canWrite()) { + printStackTrace(); + } + else { + try { + java.io.FileOutputStream o = new java.io.FileOutputStream(f); + java.io.PrintWriter p = new java.io.PrintWriter(o); + p.println(this); + p.close(); + } + catch (Exception ex) { + System.err.println(this); + } + ; + // the HDF-5 Library error stack + printStackTrace0(f.getPath()); + super.printStackTrace(); // the Java stack trace + } + } + + /* + * This private method calls the HDF-5 library to extract the error codes + * and error stack. + */ + private native void printStackTrace0(String s); + +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5LowLevelIOException.java b/java/src/hdf/hdf5lib/exceptions/HDF5LowLevelIOException.java new file mode 100644 index 0000000..e0a95d0 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5LowLevelIOException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_IO + */ + +public class HDF5LowLevelIOException extends HDF5LibraryException { + /** + * Constructs an HDF5LowLevelIOException with no specified + * detail message. + */ + public HDF5LowLevelIOException() { + super(); + } + + /** + * Constructs an HDF5LowLevelIOException with the specified + * detail message. + * + * @param s + * the detail message. + */ + public HDF5LowLevelIOException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5MetaDataCacheException.java b/java/src/hdf/hdf5lib/exceptions/HDF5MetaDataCacheException.java new file mode 100644 index 0000000..cbc3b75 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5MetaDataCacheException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_CACHE + */ + +public class HDF5MetaDataCacheException extends HDF5LibraryException { + /** + * Constructs an HDF5MetaDataCacheException with no specified + * detail message. + */ + public HDF5MetaDataCacheException() { + super(); + } + + /** + * Constructs an HDF5MetaDataCacheException with the specified + * detail message. + * + * @param s + * the detail message. + */ + public HDF5MetaDataCacheException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5ObjectHeaderException.java b/java/src/hdf/hdf5lib/exceptions/HDF5ObjectHeaderException.java new file mode 100644 index 0000000..0cdd0d1 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5ObjectHeaderException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_OHDR + */ + +public class HDF5ObjectHeaderException extends HDF5LibraryException { + /** + * Constructs an HDF5ObjectHeaderException with no specified + * detail message. + */ + public HDF5ObjectHeaderException() { + super(); + } + + /** + * Constructs an HDF5ObjectHeaderException with the specified + * detail message. + * + * @param s + * the detail message. + */ + public HDF5ObjectHeaderException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5PropertyListInterfaceException.java b/java/src/hdf/hdf5lib/exceptions/HDF5PropertyListInterfaceException.java new file mode 100644 index 0000000..aa9f668 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5PropertyListInterfaceException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_PLIST + */ + +public class HDF5PropertyListInterfaceException extends HDF5LibraryException { + /** + * Constructs an HDF5PropertyListInterfaceException with no + * specified detail message. + */ + public HDF5PropertyListInterfaceException() { + super(); + } + + /** + * Constructs an HDF5PropertyListInterfaceException with the + * specified detail message. + * + * @param s + * the detail message. + */ + public HDF5PropertyListInterfaceException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5ReferenceException.java b/java/src/hdf/hdf5lib/exceptions/HDF5ReferenceException.java new file mode 100644 index 0000000..2c8c93b --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5ReferenceException.java @@ -0,0 +1,37 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +public class HDF5ReferenceException extends HDF5LibraryException { + /** + * Constructs an HDF5ReferenceException with no specified + * detail message. + */ + public HDF5ReferenceException() { + super(); + } + + /** + * Constructs an HDF5ReferenceException with the specified + * detail message. + * + * @param s + * the detail message. + */ + public HDF5ReferenceException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5ResourceUnavailableException.java b/java/src/hdf/hdf5lib/exceptions/HDF5ResourceUnavailableException.java new file mode 100644 index 0000000..f1c0c60 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5ResourceUnavailableException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_RESOURCE + */ + +public class HDF5ResourceUnavailableException extends HDF5LibraryException { + /** + * Constructs an HDF5ResourceUnavailableException with no + * specified detail message. + */ + public HDF5ResourceUnavailableException() { + super(); + } + + /** + * Constructs an HDF5FunctionArgumentException with the + * specified detail message. + * + * @param s + * the detail message. + */ + public HDF5ResourceUnavailableException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/exceptions/HDF5SymbolTableException.java b/java/src/hdf/hdf5lib/exceptions/HDF5SymbolTableException.java new file mode 100644 index 0000000..87384d1 --- /dev/null +++ b/java/src/hdf/hdf5lib/exceptions/HDF5SymbolTableException.java @@ -0,0 +1,43 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.exceptions; + +/** + * The class HDF5LibraryException returns errors raised by the HDF5 library. + *

+ * This sub-class represents HDF-5 major error code H5E_SYM + */ + +public class HDF5SymbolTableException extends HDF5LibraryException { + /** + * Constructs an HDF5SymbolTableException with no specified + * detail message. + */ + public HDF5SymbolTableException() { + super(); + } + + /** + * Constructs an HDF5SymbolTableException with the specified + * detail message. + * + * @param s + * the detail message. + */ + public HDF5SymbolTableException(String s) { + super(s); + } +} diff --git a/java/src/hdf/hdf5lib/structs/H5AC_cache_config_t.java b/java/src/hdf/hdf5lib/structs/H5AC_cache_config_t.java new file mode 100644 index 0000000..2128d8a --- /dev/null +++ b/java/src/hdf/hdf5lib/structs/H5AC_cache_config_t.java @@ -0,0 +1,99 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.structs; + +import java.io.Serializable; + +//Information struct for H5Pget_mdc_config/H5Pset_mdc_config +public class H5AC_cache_config_t implements Serializable{ + private static final long serialVersionUID = -6748085696476149972L; + // general configuration fields: + public int version; + public boolean rpt_fcn_enabled; + public boolean open_trace_file; + public boolean close_trace_file; + public String trace_file_name; + public boolean evictions_enabled; + public boolean set_initial_size; + public long initial_size; + public double min_clean_fraction; + public long max_size; + public long min_size; + public long epoch_length; + // size increase control fields: + public int incr_mode; // H5C_cache_incr_mode + public double lower_hr_threshold; + public double increment; + public boolean apply_max_increment; + public long max_increment; + public int flash_incr_mode; // H5C_cache_flash_incr_mode + public double flash_multiple; + public double flash_threshold; + // size decrease control fields: + public int decr_mode; // H5C_cache_decr_mode + public double upper_hr_threshold; + public double decrement; + public boolean apply_max_decrement; + public long max_decrement; + public int epochs_before_eviction; + public boolean apply_empty_reserve; + public double empty_reserve; + // parallel configuration fields: + public long dirty_bytes_threshold; + public int metadata_write_strategy; + + public H5AC_cache_config_t (int version, boolean rpt_fcn_enabled, boolean open_trace_file, + boolean close_trace_file, String trace_file_name, boolean evictions_enabled, + boolean set_initial_size, long initial_size, double min_clean_fraction, long max_size, + long min_size, long epoch_length, int incr_mode, double lower_hr_threshold, + double increment, boolean apply_max_increment, long max_increment, int flash_incr_mode, + double flash_multiple, double flash_threshold, int decr_mode, double upper_hr_threshold, + double decrement, boolean apply_max_decrement, long max_decrement, + int epochs_before_eviction, boolean apply_empty_reserve, double empty_reserve, + long dirty_bytes_threshold, int metadata_write_strategy) + { + this.version = version; + this.rpt_fcn_enabled = rpt_fcn_enabled; + this.open_trace_file = open_trace_file; + this.close_trace_file = close_trace_file; + this.trace_file_name = trace_file_name; + this.evictions_enabled = evictions_enabled; + this.set_initial_size = set_initial_size; + this.initial_size = initial_size; + this.min_clean_fraction = min_clean_fraction; + this.max_size = max_size; + this.min_size = min_size; + this.epoch_length = epoch_length; + this.incr_mode = incr_mode; + this.lower_hr_threshold = lower_hr_threshold; + this.increment = increment; + this.apply_max_increment = apply_max_increment; + this.max_increment = flash_incr_mode; + this.flash_incr_mode = flash_incr_mode; + this.flash_multiple = flash_multiple; + this.flash_threshold = flash_threshold; + this.decr_mode = decr_mode; + this.upper_hr_threshold = upper_hr_threshold; + this.decrement = decrement; + this.apply_max_decrement = apply_max_decrement; + this.max_decrement = max_decrement; + this.epochs_before_eviction = epochs_before_eviction; + this.apply_empty_reserve = apply_empty_reserve; + this.empty_reserve = empty_reserve; + this.dirty_bytes_threshold = dirty_bytes_threshold; + this.metadata_write_strategy = metadata_write_strategy; + } +} diff --git a/java/src/hdf/hdf5lib/structs/H5A_info_t.java b/java/src/hdf/hdf5lib/structs/H5A_info_t.java new file mode 100644 index 0000000..b04a757 --- /dev/null +++ b/java/src/hdf/hdf5lib/structs/H5A_info_t.java @@ -0,0 +1,34 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.structs; + +import java.io.Serializable; + +//Information struct for Attribute (For H5Aget_info/H5Aget_info_by_idx/H5Aget_info_by_name) +public class H5A_info_t implements Serializable{ + private static final long serialVersionUID = 2791443594041667613L; + public boolean corder_valid; // Indicate if creation order is valid + public long corder; // Creation order of attribute + public int cset; // Character set of attribute name + public long data_size; // Size of raw data + + H5A_info_t(boolean corder_valid, long corder, int cset, long data_size) { + this.corder_valid = corder_valid; + this.corder = corder; + this.cset = cset; + this.data_size = data_size; + } +} diff --git a/java/src/hdf/hdf5lib/structs/H5G_info_t.java b/java/src/hdf/hdf5lib/structs/H5G_info_t.java new file mode 100644 index 0000000..daa6808 --- /dev/null +++ b/java/src/hdf/hdf5lib/structs/H5G_info_t.java @@ -0,0 +1,27 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.structs; + +import java.io.Serializable; + +//Information struct for group (for H5Gget_info/H5Gget_info_by_name/H5Gget_info_by_idx) +public class H5G_info_t implements Serializable{ + private static final long serialVersionUID = -3746463015312132912L; + public int storage_type; // Type of storage for links in group + public long nlinks; // Number of links in group + public long max_corder; // Current max. creation order value for group + public boolean mounted; // Whether group has a file mounted on it +} diff --git a/java/src/hdf/hdf5lib/structs/H5L_info_t.java b/java/src/hdf/hdf5lib/structs/H5L_info_t.java new file mode 100644 index 0000000..d43853f --- /dev/null +++ b/java/src/hdf/hdf5lib/structs/H5L_info_t.java @@ -0,0 +1,38 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.structs; + +import java.io.Serializable; + +//Information struct for link (for H5Lget_info/H5Lget_info_by_idx) +public class H5L_info_t implements Serializable{ + private static final long serialVersionUID = -4754320605310155033L; + public int type; + public boolean corder_valid; + public long corder; + public int cset; + public long address_val_size; + + H5L_info_t (int type, boolean corder_valid, long corder, + int cset, long address_val_size) + { + this.type = type; + this.corder_valid = corder_valid; + this.corder = corder; + this.cset = cset; + this.address_val_size = address_val_size; + } +} diff --git a/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java b/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java new file mode 100644 index 0000000..86cf883 --- /dev/null +++ b/java/src/hdf/hdf5lib/structs/H5O_hdr_info_t.java @@ -0,0 +1,49 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.structs; + +import java.io.Serializable; + +// Information struct for object header metadata (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx) +public class H5O_hdr_info_t implements Serializable{ + private static final long serialVersionUID = 7883826382952577189L; + public int version; /* Version number of header format in file */ + public int nmesgs; /* Number of object header messages */ + public int nchunks; /* Number of object header chunks */ + public int flags; /* Object header status flags */ + public long space_total; /* Total space for storing object header in file */ + public long space_meta; /* Space within header for object header metadata information */ + public long space_mesg; /* Space within header for actual message information */ + public long space_free; /* Free space within object header */ + public long mesg_present; /* Flags to indicate presence of message type in header */ + public long mesg_shared; /* Flags to indicate message type is shared in header */ + + H5O_hdr_info_t (int version, int nmesgs, int nchunks, int flags, + long space_total, long space_meta, long space_mesg, long space_free, + long mesg_present, long mesg_shared) + { + this.version = version; + this.nmesgs = nmesgs; + this.nchunks = nchunks; + this.flags = flags; + this.space_total = space_total; + this.space_meta = space_meta; + this.space_mesg = space_mesg; + this.space_free = space_free; + this.mesg_present = mesg_present; + this.mesg_shared = mesg_shared; + } +} diff --git a/java/src/hdf/hdf5lib/structs/H5O_info_t.java b/java/src/hdf/hdf5lib/structs/H5O_info_t.java new file mode 100644 index 0000000..a89aaf0 --- /dev/null +++ b/java/src/hdf/hdf5lib/structs/H5O_info_t.java @@ -0,0 +1,54 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.structs; + +import java.io.Serializable; + +//Information struct for object (for H5Oget_info/H5Oget_info_by_name/H5Oget_info_by_idx) +public class H5O_info_t implements Serializable{ + private static final long serialVersionUID = 4691681163544054518L; + public long fileno; /* File number that object is located in */ + public long addr; /* Object address in file */ + public int type; /* Basic object type (group, dataset, etc.) */ + public int rc; /* Reference count of object */ + public long atime; /* Access time */ + public long mtime; /* Modification time */ + public long ctime; /* Change time */ + public long btime; /* Birth time */ + public long num_attrs; /* # of attributes attached to object */ + public H5O_hdr_info_t hdr; /* Object header information */ + /* Extra metadata storage for obj & attributes */ + public H5_ih_info_t meta_size_obj; /* v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */ + public H5_ih_info_t meta_size_attr; /* v2 B-tree & heap for attributes */ + + public H5O_info_t (long fileno, long addr, int type, + int rc, long num_attrs, long atime, long mtime, long ctime, long btime, + H5O_hdr_info_t hdr, H5_ih_info_t meta_size_obj, H5_ih_info_t meta_size_attr) + { + this.fileno = fileno; + this.addr = addr; + this.type = type; + this.rc = rc; + this.num_attrs = num_attrs; + this.atime = atime; + this.mtime = mtime; + this.ctime = ctime; + this.btime = btime; + this.hdr = hdr; + this.meta_size_obj = meta_size_obj; + this.meta_size_attr = meta_size_attr; + } +} diff --git a/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java b/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java new file mode 100644 index 0000000..450f548 --- /dev/null +++ b/java/src/hdf/hdf5lib/structs/H5_ih_info_t.java @@ -0,0 +1,31 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.structs; + +import java.io.Serializable; + +//Information struct for group (for H5Gget_info/H5Gget_info_by_name/H5Gget_info_by_idx) +public class H5_ih_info_t implements Serializable { + private static final long serialVersionUID = -142238015615462707L; + public long index_size; /* btree and/or list */ + public long heap_size; + + H5_ih_info_t (long index_size, long heap_size) + { + this.index_size = index_size; + this.heap_size = heap_size; + } +} diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt new file mode 100644 index 0000000..6ee56c8 --- /dev/null +++ b/java/src/jni/CMakeLists.txt @@ -0,0 +1,84 @@ +cmake_minimum_required (VERSION 3.1.0) +PROJECT (HDF5_JAVA_JNI C CXX) + +set (HDF5_JAVA_JNI_CSRCS + ${HDF5_JAVA_JNI_SOURCE_DIR}/exceptionImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5aImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5Constants.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5dImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5eImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5fImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5gImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5iImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5Imp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5lImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5oImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5plImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5rImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5sImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5tImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5util.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5zImp.c + ${HDF5_JAVA_JNI_SOURCE_DIR}/nativeData.c +) + +set (HDF5_JAVA_JNI_CHDRS + ${HDF5_JAVA_JNI_SOURCE_DIR}/exceptionImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5aImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5dImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5eImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5fImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5gImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5iImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5jni.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5lImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5oImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5pImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5plImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5rImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5sImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5tImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5util.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/h5zImp.h + ${HDF5_JAVA_JNI_SOURCE_DIR}/nativeData.h +) + +INCLUDE_DIRECTORIES( ${HDF5_JAVA_JNI_SOURCE_DIR} ) + +set (CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON) + +########### JNI libraries always must be built shared ############### +add_library (${HDF5_JAVA_JNI_LIB_TARGET} SHARED ${HDF5_JAVA_JNI_CSRCS} ${HDF5_JAVA_JNI_CHDRS}) +TARGET_C_PROPERTIES (${HDF5_JAVA_JNI_LIB_TARGET} SHARED " " " ") +target_link_libraries (${HDF5_JAVA_JNI_LIB_TARGET} ${HDF5_LIB_TARGET}) +set_target_properties (${HDF5_JAVA_JNI_LIB_TARGET} PROPERTIES FOLDER libraries/jni) +SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_JAVA_JNI_LIB_TARGET}") +H5_SET_LIB_OPTIONS (${HDF5_JAVA_JNI_LIB_TARGET} ${HDF5_JAVA_JNI_LIB_NAME} SHARED ${HDF5_JAVA_PACKAGE_SOVERSION}) +if (WIN32) + get_filename_component (HDF5_JAVA_JNI_DLL_NAME ${HDF5_JAVA_JNI_LIB_TARGET} NAME_WE) + # message (STATUS "HDF5_JAVA_JNI_DLL_NAME: ${HDF5_JAVA_JNI_DLL_NAME}") + if (BUILD_TESTING) + add_custom_target (HDF5_JAVA_JNI-Test-Copy ALL + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${HDF5_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${HDF5_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} + COMMENT "Copying ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/${HDF5_JAVA_JNI_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" + ) + add_dependencies (HDF5_JAVA_JNI-Test-Copy ${HDF5_JAVA_JNI_LIB_TARGET}) + endif (BUILD_TESTING) +endif (WIN32) + +#----------------------------------------------------------------------------- +# Add Target(s) to CMake Install for import into other projects +#----------------------------------------------------------------------------- +if (HDF5_EXPORTED_TARGETS) + install ( + TARGETS + ${HDF5_JAVA_JNI_LIB_TARGET} + EXPORT + ${HDF5_JAVA_EXPORTED_TARGETS} + LIBRARY DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries + ARCHIVE DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries + RUNTIME DESTINATION ${HDF5_INSTALL_LIB_DIR} COMPONENT libraries + FRAMEWORK DESTINATION ${HDF5_INSTALL_FWRK_DIR} COMPONENT libraries + ) +endif (HDF5_EXPORTED_TARGETS) diff --git a/java/src/jni/Makefile.am b/java/src/jni/Makefile.am new file mode 100644 index 0000000..764fcdb --- /dev/null +++ b/java/src/jni/Makefile.am @@ -0,0 +1,44 @@ +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +## +## Makefile.am +## Run automake to generate a Makefile.in from this file. +# +# HDF5 Java native interface (JNI) Library Makefile(.in) +# + +include $(top_srcdir)/config/commence.am +include $(top_srcdir)/config/lt_vers.am + +# Mark this directory as part of the JNI API +JAVA_API=yes + +# Include src directory and JNI flags +AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/java/src/jni $(JNIFLAGS) + +# This is our main target +lib_LTLIBRARIES=libhdf5_java.la + +# Add libtool numbers to the HDF5 Java (JNI) library (from config/lt_vers.am) +libhdf5_java_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS) + +# Source files for the library +libhdf5_java_la_SOURCES=exceptionImp.c h5Constants.c nativeData.c h5util.c h5Imp.c \ + h5aImp.c h5dImp.c h5eImp.c h5fImp.c h5gImp.c h5iImp.c h5lImp.c h5oImp.c \ + h5pImp.c h5plImp.c h5rImp.c h5sImp.c h5tImp.c h5zImp.c + +# HDF5 Java (JNI) library depends on HDF5 Library. +libhdf5_java_la_LIBADD=$(LIBHDF5) + +include $(top_srcdir)/config/conclude.am diff --git a/java/src/jni/exceptionImp.c b/java/src/jni/exceptionImp.c new file mode 100644 index 0000000..8623ca9 --- /dev/null +++ b/java/src/jni/exceptionImp.c @@ -0,0 +1,414 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/***********/ +/* Headers */ +/***********/ + +#include "hdf5.h" +#include +#include +#include "jni.h" +#include "h5jni.h" +#include "exceptionImp.h" + + +/*******************/ +/* Local Variables */ +/*******************/ + +/* These types are copied from H5Eprivate.h + * They should be moved to a public include file, and deleted from + * here. + */ + +#define H5E_NSLOTS 32 /*number of slots in an error stack */ + +/* + * The list of error messages in the system is kept as an array of + * error_code/message pairs, one for major error numbers and another for + * minor error numbers. + */ +typedef struct H5E_major_mesg_t { + hid_t error_code; + const char *str; +} H5E_major_mesg_t; + +typedef struct H5E_minor_mesg_t { + hid_t error_code; + const char *str; +} H5E_minor_mesg_t; + +/* major and minor error numbers */ +typedef struct H5E_num_t { + hid_t maj_num; + hid_t min_num; +} H5E_num_t; + +/********************/ +/* Local Macros */ +/********************/ + +#define THROWEXCEPTION(className,args) { \ + jclass jc; \ + jmethodID jm; \ + jobject ex; \ + jc = ENVPTR->FindClass(ENVPAR (className)); \ + if (jc == NULL) { \ + return JNI_FALSE; \ + } \ + jm = ENVPTR->GetMethodID(ENVPAR jc, "", "(Ljava/lang/String;)V"); \ + if (jm == NULL) { \ + return JNI_FALSE; \ + } \ + ex = ENVPTR->NewObjectA (ENVPAR jc, jm, (jvalue*)(args)); \ + if (ENVPTR->Throw(ENVPAR (jthrowable)ex) < 0) { \ + printf("FATAL ERROR: %s: Throw failed\n", (className)); \ + return JNI_FALSE; \ + } \ + return JNI_TRUE; \ +} + +/********************/ +/* Local Prototypes */ +/********************/ + +static const char *defineHDF5LibraryException(hid_t maj_num); +static jboolean H5JNIErrorClass(JNIEnv *env, const char *message, const char *className); + +/* get the major and minor error numbers on the top of the error stack */ +static herr_t +walk_error_callback(unsigned n, const H5E_error2_t *err_desc, void *_err_nums) +{ + H5E_num_t *err_nums = (H5E_num_t *)_err_nums; + + if(err_desc) { + err_nums->maj_num = err_desc->maj_num; + err_nums->min_num = err_desc->min_num; + } /* end if */ + + return 0; +} /* end walk_error_callback() */ + +/* + * Class: hdf_hdf5lib_exceptions_HDF5Library + * Method: H5error_off + * Signature: ()I + * + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5error_1off(JNIEnv *env, jclass clss) +{ + H5Eset_auto2(H5E_DEFAULT, NULL, NULL); + return 0; +} /* end Java_hdf_hdf5lib_H5_H5error_1off() */ + + +/* + * Class: hdf_hdf5lib_exceptions_HDFLibraryException + * Method: printStackTrace0 + * Signature: (Ljava/lang/Object;)V + * + * Call the HDF-5 library to print the HDF-5 error stack to 'file_name'. + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_exceptions_HDF5LibraryException_printStackTrace0( + JNIEnv *env, jobject obj, jstring file_name) +{ + FILE *stream = NULL; + const char *file = NULL; + + if(file_name == NULL) { + H5Eprint2(H5E_DEFAULT, stderr); + } /* end if */ + else { + file = ENVPTR->GetStringUTFChars(ENVPAR file_name, 0); + stream = HDfopen(file, "a+"); + if(stream) { + H5Eprint2(H5E_DEFAULT, stream); + HDfclose(stream); + } /* end if */ + ENVPTR->ReleaseStringUTFChars(ENVPAR file_name, file); + } /* end else */ +} /* end Java_hdf_hdf5lib_exceptions_HDF5LibraryException_printStackTrace0() */ + +/* + * Class: hdf_hdf5lib_exceptions_HDFLibraryException + * Method: getMajorErrorNumber + * Signature: ()J + * + * Extract the HDF-5 major error number from the HDF-5 error stack. + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMajorErrorNumber( + JNIEnv *env, jobject obj) +{ + H5E_num_t err_nums; + err_nums.maj_num = 0; + err_nums.min_num = 0; + + H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &err_nums); + + return err_nums.maj_num; +} /* end Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMajorErrorNumber() */ + +/* + * Class: hdf_hdf5lib_exceptions_HDFLibraryException + * Method: getMinorErrorNumber + * Signature: ()J + * + * Extract the HDF-5 minor error number from the HDF-5 error stack. + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMinorErrorNumber( + JNIEnv *env, jobject obj) +{ + H5E_num_t err_nums; + err_nums.maj_num = 0; + err_nums.min_num = 0; + + H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &err_nums); + + return err_nums.min_num; +} /* end Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMinorErrorNumber() */ + +/* + * Routine to raise particular Java exceptions from C + */ +static +jboolean +H5JNIErrorClass(JNIEnv *env, const char *message, const char *className) +{ + char *args[2]; + jstring str = ENVPTR->NewStringUTF(ENVPAR message); + args[0] = (char *)str; + args[1] = 0; + + THROWEXCEPTION(className, args); +} /* end H5JNIErrorClass() */ + +/* + * Create and throw an 'outOfMemoryException' + * + * Note: This routine never returns from the 'throw', + * and the Java native method immediately raises the + * exception. + */ +jboolean +h5outOfMemory(JNIEnv *env, const char *functName) +{ + return H5JNIErrorClass(env, functName, "java/lang/OutOfMemoryError"); +} /* end h5outOfMemory() */ + + +/* + * A fatal error in a JNI call + * Create and throw an 'InternalError' + * + * Note: This routine never returns from the 'throw', + * and the Java native method immediately raises the + * exception. + */ +jboolean +h5JNIFatalError(JNIEnv *env, const char *functName) +{ + return H5JNIErrorClass(env, functName, "java/lang/InternalError"); +} /* end h5JNIFatalError() */ + +/* + * A NULL argument in an HDF5 call + * Create and throw an 'NullPointerException' + * + * Note: This routine never returns from the 'throw', + * and the Java native method immediately raises the + * exception. + */ +jboolean +h5nullArgument(JNIEnv *env, const char *functName) +{ + return H5JNIErrorClass(env, functName, "java/lang/NullPointerException"); +} /* end h5nullArgument() */ + +/* + * A bad argument in an HDF5 call + * Create and throw an 'IllegalArgumentException' + * + * Note: This routine never returns from the 'throw', + * and the Java native method immediately raises the + * exception. + */ +jboolean +h5badArgument(JNIEnv *env, const char *functName) +{ + return H5JNIErrorClass(env, functName, "java/lang/IllegalArgumentException"); +} /* end h5badArgument() */ + +/* + * Some feature Not implemented yet + * Create and throw an 'UnsupportedOperationException' + * + * Note: This routine never returns from the 'throw', + * and the Java native method immediately raises the + * exception. + */ +jboolean +h5unimplemented(JNIEnv *env, const char *functName) +{ + return H5JNIErrorClass(env, functName, "java/lang/UnsupportedOperationException"); +} /* end h5unimplemented() */ + +/* h5raiseException(). This routine is called to generate + * an arbitrary Java exception with a particular message. + * + * Note: This routine never returns from the 'throw', + * and the Java native method immediately raises the + * exception. + */ +jboolean +h5raiseException(JNIEnv *env, const char *exception, const char *message) +{ + return H5JNIErrorClass(env, message, exception); +} /* end h5raiseException() */ + +/* + * h5libraryError() determines the HDF-5 major error code + * and creates and throws the appropriate sub-class of + * HDF5LibraryException(). This routine should be called + * whenever a call to the HDF-5 library fails, i.e., when + * the return is -1. + * + * Note: This routine never returns from the 'throw', + * and the Java native method immediately raises the + * exception. + */ +jboolean +h5libraryError(JNIEnv *env) +{ + char *args[2]; + const char *exception = NULL; + char *msg_str = NULL; + int num_errs = 0; + hid_t min_num; + hid_t maj_num; + ssize_t msg_size = 0; + H5E_type_t error_msg_type; + jstring str = NULL; + hid_t stk_id = -1; + H5E_num_t exceptionNumbers; + + exceptionNumbers.maj_num = 0; + exceptionNumbers.min_num = 0; + + /* Save current stack contents for future use */ + stk_id = H5Eget_current_stack(); /* This will clear current stack */ + if(stk_id >= 0) + H5Ewalk2(stk_id, H5E_WALK_DOWNWARD, walk_error_callback, &exceptionNumbers); + maj_num = exceptionNumbers.maj_num; + min_num = exceptionNumbers.min_num; + + exception = defineHDF5LibraryException(maj_num); + + /* get the length of the name */ + msg_size = H5Eget_msg(min_num, NULL, NULL, 0); + if(msg_size > 0) { + msg_size++; /* add extra space for the null terminator */ + msg_str = (char*)HDcalloc((size_t)msg_size, sizeof(char)); + if(msg_str) { + msg_size = H5Eget_msg(min_num, &error_msg_type, (char *)msg_str, (size_t)msg_size); + str = ENVPTR->NewStringUTF(ENVPAR msg_str); + HDfree(msg_str); + } /* end if */ + } /* end if */ + else + str = NULL; + if(stk_id >= 0) + H5Eset_current_stack(stk_id); + + args[0] = (char *)str; + args[1] = 0; + THROWEXCEPTION(exception, args); +} /* end h5libraryError() */ + + +/* + * defineHDF5LibraryException() returns the name of the sub-class + * which goes with an HDF-5 error code. + */ +static const char * +defineHDF5LibraryException(hid_t maj_num) +{ + hid_t err_num = maj_num; + + if (H5E_ARGS == err_num) + return "hdf/hdf5lib/exceptions/HDF5FunctionArgumentException"; + else if (H5E_RESOURCE == err_num) + return "hdf/hdf5lib/exceptions/HDF5ResourceUnavailableException"; + else if (H5E_INTERNAL == err_num) + return "hdf/hdf5lib/exceptions/HDF5InternalErrorException"; + else if (H5E_FILE == err_num) + return "hdf/hdf5lib/exceptions/HDF5FileInterfaceException"; + else if (H5E_IO == err_num) + return "hdf/hdf5lib/exceptions/HDF5LowLevelIOException"; + else if (H5E_FUNC == err_num) + return "hdf/hdf5lib/exceptions/HDF5FunctionEntryExitException"; + else if (H5E_ATOM == err_num) + return "hdf/hdf5lib/exceptions/HDF5AtomException"; + else if (H5E_CACHE == err_num) + return "hdf/hdf5lib/exceptions/HDF5MetaDataCacheException"; + else if (H5E_BTREE == err_num) + return "hdf/hdf5lib/exceptions/HDF5BtreeException"; + else if (H5E_SYM == err_num) + return "hdf/hdf5lib/exceptions/HDF5SymbolTableException"; + else if (H5E_HEAP == err_num) + return "hdf/hdf5lib/exceptions/HDF5HeapException"; + else if (H5E_OHDR == err_num) + return "hdf/hdf5lib/exceptions/HDF5ObjectHeaderException"; + else if (H5E_DATATYPE == err_num) + return "hdf/hdf5lib/exceptions/HDF5DatatypeInterfaceException"; + else if (H5E_DATASPACE == err_num) + return "hdf/hdf5lib/exceptions/HDF5DataspaceInterfaceException"; + else if (H5E_DATASET == err_num) + return "hdf/hdf5lib/exceptions/HDF5DatasetInterfaceException"; + else if (H5E_STORAGE == err_num) + return "hdf/hdf5lib/exceptions/HDF5DataStorageException"; + else if (H5E_PLIST == err_num) + return "hdf/hdf5lib/exceptions/HDF5PropertyListInterfaceException"; + else if (H5E_ATTR == err_num) + return "hdf/hdf5lib/exceptions/HDF5AttributeException"; + else if (H5E_PLINE == err_num) + return "hdf/hdf5lib/exceptions/HDF5DataFiltersException"; + else if (H5E_EFL == err_num) + return "hdf/hdf5lib/exceptions/HDF5ExternalFileListException"; + else if (H5E_REFERENCE == err_num) + return "hdf/hdf5lib/exceptions/HDF5ReferenceException"; + + return "hdf/hdf5lib/exceptions/HDF5LibraryException"; +} /* end defineHDF5LibraryException() */ + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + diff --git a/java/src/jni/exceptionImp.h b/java/src/jni/exceptionImp.h new file mode 100644 index 0000000..e238372 --- /dev/null +++ b/java/src/jni/exceptionImp.h @@ -0,0 +1,67 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_exception */ + +#ifndef _Included_hdf_hdf5lib_H5_exception +#define _Included_hdf_hdf5lib_H5_exception + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * Class: hdf_hdf5lib_exceptions_HDF5Library + * Method: H5error_off + * Signature: ()I + * + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5error_1off(JNIEnv *env, jclass clss ); + + +/* + * Class: hdf_hdf5lib_exceptions_HDFLibraryException + * Method: printStackTrace0 + * Signature: (Ljava/lang/Object;)V + * + * Call the HDF-5 library to print the HDF-5 error stack to 'file_name'. + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_exceptions_HDF5LibraryException_printStackTrace0(JNIEnv *env, + jobject obj, jstring file_name); + +/* + * Class: hdf_hdf5lib_exceptions_HDFLibraryException + * Method: getMajorErrorNumber + * Signature: ()J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMajorErrorNumber(JNIEnv *env, jobject obj); + +/* + * Class: hdf_hdf5lib_exceptions_HDFLibraryException + * Method: getMinorErrorNumber + * Signature: ()J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_exceptions_HDF5LibraryException_getMinorErrorNumber(JNIEnv *env, jobject obj); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_exception */ diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c new file mode 100644 index 0000000..f1d49be --- /dev/null +++ b/java/src/jni/h5Constants.c @@ -0,0 +1,692 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include "hdf5.h" + +#pragma GCC diagnostic ignored "-Wmissing-prototypes" + +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1QUARTER_1HADDR_1MAX(JNIEnv *env, jclass cls) { return (hsize_t)HADDR_MAX/4; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1SZIP_1ALLOW_1K13_1OPTION_1MASK(JNIEnv *env, jclass cls) { return H5_SZIP_ALLOW_K13_OPTION_MASK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1SZIP_1CHIP_1OPTION_1MASK(JNIEnv *env, jclass cls) { return H5_SZIP_CHIP_OPTION_MASK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1SZIP_1EC_1OPTION_1MASK(JNIEnv *env, jclass cls) { return H5_SZIP_EC_OPTION_MASK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1SZIP_1MAX_1PIXELS_1PER_1BLOCK(JNIEnv *env, jclass cls) { return H5_SZIP_MAX_PIXELS_PER_BLOCK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1SZIP_1NN_1OPTION_1MASK(JNIEnv *env, jclass cls) { return H5_SZIP_NN_OPTION_MASK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1INDEX_1UNKNOWN(JNIEnv *env, jclass cls) { return H5_INDEX_UNKNOWN; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1INDEX_1NAME(JNIEnv *env, jclass cls) { return H5_INDEX_NAME; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1INDEX_1CRT_1ORDER(JNIEnv *env, jclass cls) { return H5_INDEX_CRT_ORDER; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1INDEX_1N(JNIEnv *env, jclass cls) { return H5_INDEX_N; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1ITER_1UNKNOWN(JNIEnv *env, jclass cls) { return H5_ITER_UNKNOWN; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1ITER_1INC(JNIEnv *env, jclass cls) { return H5_ITER_INC; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1ITER_1DEC(JNIEnv *env, jclass cls) { return H5_ITER_DEC; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1ITER_1NATIVE(JNIEnv *env, jclass cls) { return H5_ITER_NATIVE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5_1ITER_1N(JNIEnv *env, jclass cls) { return H5_ITER_N; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5AC_1CURR_1CACHE_1CONFIG_1VERSION(JNIEnv *env, jclass cls) { return H5AC__CURR_CACHE_CONFIG_VERSION; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5AC_1MAX_1TRACE_1FILE_1NAME_1LEN(JNIEnv *env, jclass cls) { return H5AC__MAX_TRACE_FILE_NAME_LEN; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5AC_1METADATA_1WRITE_1STRATEGY_1PROCESS_1ZERO_1ONLY(JNIEnv *env, jclass cls) { return H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5AC_1METADATA_1WRITE_1STRATEGY_1DISTRIBUTED(JNIEnv *env, jclass cls) { return H5AC_METADATA_WRITE_STRATEGY__DISTRIBUTED; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5C_1incr_1off(JNIEnv *env, jclass cls) { return H5C_incr__off; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5C_1incr_1threshold(JNIEnv *env, jclass cls) { return H5C_incr__threshold; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5C_1flash_1incr_1off(JNIEnv *env, jclass cls) { return H5C_flash_incr__off; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5C_1flash_1incr_1add_1space(JNIEnv *env, jclass cls) { return H5C_flash_incr__add_space; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5C_1decr_1off(JNIEnv *env, jclass cls) { return H5C_decr__off; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5C_1decr_1threshold(JNIEnv *env, jclass cls) { return H5C_decr__threshold; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5C_1decr_1age_1out(JNIEnv *env, jclass cls) { return H5C_decr__age_out; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5C_1decr_1age_1out_1with_1threshold(JNIEnv *env, jclass cls) { return H5C_decr__age_out_with_threshold; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1CHUNK_1IDX_1BTREE(JNIEnv *env, jclass cls) { return H5D_CHUNK_IDX_BTREE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1ALLOC_1TIME_1DEFAULT(JNIEnv *env, jclass cls) { return H5D_ALLOC_TIME_DEFAULT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1ALLOC_1TIME_1EARLY(JNIEnv *env, jclass cls) { return H5D_ALLOC_TIME_EARLY; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1ALLOC_1TIME_1ERROR(JNIEnv *env, jclass cls) { return H5D_ALLOC_TIME_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1ALLOC_1TIME_1INCR(JNIEnv *env, jclass cls) { return H5D_ALLOC_TIME_INCR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1ALLOC_1TIME_1LATE(JNIEnv *env, jclass cls) { return H5D_ALLOC_TIME_LATE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1TIME_1ERROR(JNIEnv *env, jclass cls) { return H5D_FILL_TIME_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1TIME_1ALLOC(JNIEnv *env, jclass cls) { return H5D_FILL_TIME_ALLOC; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1TIME_1NEVER(JNIEnv *env, jclass cls) { return H5D_FILL_TIME_NEVER; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1TIME_1IFSET(JNIEnv *env, jclass cls) { return H5D_FILL_TIME_IFSET; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1VALUE_1DEFAULT(JNIEnv *env, jclass cls) { return H5D_FILL_VALUE_DEFAULT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1VALUE_1ERROR(JNIEnv *env, jclass cls) { return H5D_FILL_VALUE_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1VALUE_1UNDEFINED(JNIEnv *env, jclass cls) { return H5D_FILL_VALUE_UNDEFINED; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1FILL_1VALUE_1USER_1DEFINED(JNIEnv *env, jclass cls) { return H5D_FILL_VALUE_USER_DEFINED; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1LAYOUT_1ERROR(JNIEnv *env, jclass cls) { return H5D_LAYOUT_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1CHUNKED(JNIEnv *env, jclass cls) { return H5D_CHUNKED; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1COMPACT(JNIEnv *env, jclass cls) { return H5D_COMPACT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1CONTIGUOUS(JNIEnv *env, jclass cls) { return H5D_CONTIGUOUS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1VIRTUAL(JNIEnv *env, jclass cls) { return H5D_VIRTUAL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1NLAYOUTS(JNIEnv *env, jclass cls) { return H5D_NLAYOUTS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1SPACE_1STATUS_1ALLOCATED(JNIEnv *env, jclass cls) { return H5D_SPACE_STATUS_ALLOCATED; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1SPACE_1STATUS_1ERROR(JNIEnv *env, jclass cls) { return H5D_SPACE_STATUS_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1SPACE_1STATUS_1NOT_1ALLOCATED(JNIEnv *env, jclass cls) { return H5D_SPACE_STATUS_NOT_ALLOCATED; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1SPACE_1STATUS_1PART_1ALLOCATED(JNIEnv *env, jclass cls) { return H5D_SPACE_STATUS_PART_ALLOCATED; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1VDS_1ERROR(JNIEnv *env, jclass cls) { return H5D_VDS_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1VDS_1FIRST_1MISSING(JNIEnv *env, jclass cls) { return H5D_VDS_FIRST_MISSING; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5D_1VDS_1LAST_1AVAILABLE(JNIEnv *env, jclass cls) { return H5D_VDS_LAST_AVAILABLE; } + +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1ALIGNMENT(JNIEnv *env, jclass cls) { return H5E_ALIGNMENT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1ALREADYEXISTS(JNIEnv *env, jclass cls) { return H5E_ALREADYEXISTS; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1ALREADYINIT(JNIEnv *env, jclass cls) { return H5E_ALREADYINIT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1ARGS(JNIEnv *env, jclass cls) { return H5E_ARGS; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1ATOM(JNIEnv *env, jclass cls) { return H5E_ATOM; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1ATTR(JNIEnv *env, jclass cls) { return H5E_ATTR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADATOM(JNIEnv *env, jclass cls) { return H5E_BADATOM; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADFILE(JNIEnv *env, jclass cls) { return H5E_BADFILE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADGROUP(JNIEnv *env, jclass cls) { return H5E_BADGROUP; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADMESG(JNIEnv *env, jclass cls) { return H5E_BADMESG; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADRANGE(JNIEnv *env, jclass cls) { return H5E_BADRANGE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADSELECT(JNIEnv *env, jclass cls) { return H5E_BADSELECT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADSIZE(JNIEnv *env, jclass cls) { return H5E_BADSIZE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADTYPE(JNIEnv *env, jclass cls) { return H5E_BADTYPE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BADVALUE(JNIEnv *env, jclass cls) { return H5E_BADVALUE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1BTREE(JNIEnv *env, jclass cls) { return H5E_BTREE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CACHE(JNIEnv *env, jclass cls) { return H5E_CACHE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CALLBACK(JNIEnv *env, jclass cls) { return H5E_CALLBACK; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANAPPLY(JNIEnv *env, jclass cls) { return H5E_CANAPPLY; } +/*JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTALLOC(JNIEnv *env, jclass cls) { return H5E_CANTALLOC; }*/ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCLIP(JNIEnv *env, jclass cls) { return H5E_CANTCLIP; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCLOSEFILE(JNIEnv *env, jclass cls) { return H5E_CANTCLOSEFILE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCONVERT(JNIEnv *env, jclass cls) { return H5E_CANTCONVERT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCOPY(JNIEnv *env, jclass cls) { return H5E_CANTCOPY; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCOUNT(JNIEnv *env, jclass cls) { return H5E_CANTCOUNT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTCREATE(JNIEnv *env, jclass cls) { return H5E_CANTCREATE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDEC(JNIEnv *env, jclass cls) { return H5E_CANTDEC; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDECODE(JNIEnv *env, jclass cls) { return H5E_CANTDECODE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTDELETE(JNIEnv *env, jclass cls) { return H5E_CANTDELETE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTENCODE(JNIEnv *env, jclass cls) { return H5E_CANTENCODE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTFLUSH(JNIEnv *env, jclass cls) { return H5E_CANTFLUSH; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTFREE(JNIEnv *env, jclass cls) { return H5E_CANTFREE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTGET(JNIEnv *env, jclass cls) { return H5E_CANTGET; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTINC(JNIEnv *env, jclass cls) { return H5E_CANTINC; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTINIT(JNIEnv *env, jclass cls) { return H5E_CANTINIT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTINSERT(JNIEnv *env, jclass cls) { return H5E_CANTINSERT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTLIST(JNIEnv *env, jclass cls) { return H5E_CANTLIST; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTLOAD(JNIEnv *env, jclass cls) { return H5E_CANTLOAD; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTLOCK(JNIEnv *env, jclass cls) { return H5E_CANTLOCK; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTNEXT(JNIEnv *env, jclass cls) { return H5E_CANTNEXT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTOPENFILE(JNIEnv *env, jclass cls) { return H5E_CANTOPENFILE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTOPENOBJ(JNIEnv *env, jclass cls) { return H5E_CANTOPENOBJ; } +/*JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTRECV(JNIEnv *env, jclass cls) { return H5E_CANTRECV; }*/ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTREGISTER(JNIEnv *env, jclass cls) { return H5E_CANTREGISTER; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTRELEASE(JNIEnv *env, jclass cls) { return H5E_CANTRELEASE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTSELECT(JNIEnv *env, jclass cls) { return H5E_CANTSELECT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTSET(JNIEnv *env, jclass cls) { return H5E_CANTSET; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTSPLIT(JNIEnv *env, jclass cls) { return H5E_CANTSPLIT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CANTUNLOCK(JNIEnv *env, jclass cls) { return H5E_CANTUNLOCK; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1CLOSEERROR(JNIEnv *env, jclass cls) { return H5E_CLOSEERROR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1COMPLEN(JNIEnv *env, jclass cls) { return H5E_COMPLEN; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1DATASET(JNIEnv *env, jclass cls) { return H5E_DATASET; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1DATASPACE(JNIEnv *env, jclass cls) { return H5E_DATASPACE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1DATATYPE(JNIEnv *env, jclass cls) { return H5E_DATATYPE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1DEFAULT(JNIEnv *env, jclass cls) { return H5E_DEFAULT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1DUPCLASS(JNIEnv *env, jclass cls) { return H5E_DUPCLASS; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1EFL(JNIEnv *env, jclass cls) { return H5E_EFL; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1EXISTS(JNIEnv *env, jclass cls) { return H5E_EXISTS; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1FCNTL(JNIEnv *env, jclass cls) { return H5E_FCNTL; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1FILE(JNIEnv *env, jclass cls) { return H5E_FILE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1FILEEXISTS(JNIEnv *env, jclass cls) { return H5E_FILEEXISTS; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1FILEOPEN(JNIEnv *env, jclass cls) { return H5E_FILEOPEN; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1FUNC(JNIEnv *env, jclass cls) { return H5E_FUNC; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1HEAP(JNIEnv *env, jclass cls) { return H5E_HEAP; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1INTERNAL(JNIEnv *env, jclass cls) { return H5E_INTERNAL; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1IO(JNIEnv *env, jclass cls) { return H5E_IO; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1LINK(JNIEnv *env, jclass cls) { return H5E_LINK; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1LINKCOUNT(JNIEnv *env, jclass cls) { return H5E_LINKCOUNT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1MAJOR(JNIEnv *env, jclass cls) { return H5E_MAJOR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1MINOR(JNIEnv *env, jclass cls) { return H5E_MINOR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1MOUNT(JNIEnv *env, jclass cls) { return H5E_MOUNT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1MPI(JNIEnv *env, jclass cls) { return H5E_MPI; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1MPIERRSTR(JNIEnv *env, jclass cls) { return H5E_MPIERRSTR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1NOFILTER(JNIEnv *env, jclass cls) { return H5E_NOFILTER; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1NOIDS(JNIEnv *env, jclass cls) { return H5E_NOIDS; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1NONE_1MAJOR(JNIEnv *env, jclass cls) { return H5E_NONE_MAJOR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1NONE_1MINOR(JNIEnv *env, jclass cls) { return H5E_NONE_MINOR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1NOSPACE(JNIEnv *env, jclass cls) { return H5E_NOSPACE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1NOTCACHED(JNIEnv *env, jclass cls) { return H5E_NOTCACHED; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1NOTFOUND(JNIEnv *env, jclass cls) { return H5E_NOTFOUND; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1NOTHDF5(JNIEnv *env, jclass cls) { return H5E_NOTHDF5; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1OHDR(JNIEnv *env, jclass cls) { return H5E_OHDR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1OVERFLOW(JNIEnv *env, jclass cls) { return H5E_OVERFLOW; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1PLINE(JNIEnv *env, jclass cls) { return H5E_PLINE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1PLIST(JNIEnv *env, jclass cls) { return H5E_PLIST; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1PROTECT(JNIEnv *env, jclass cls) { return H5E_PROTECT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1READERROR(JNIEnv *env, jclass cls) { return H5E_READERROR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1REFERENCE(JNIEnv *env, jclass cls) { return H5E_REFERENCE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1RESOURCE(JNIEnv *env, jclass cls) { return H5E_RESOURCE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1RS(JNIEnv *env, jclass cls) { return H5E_RS; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1SEEKERROR(JNIEnv *env, jclass cls) { return H5E_SEEKERROR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1SETLOCAL(JNIEnv *env, jclass cls) { return H5E_SETLOCAL; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1STORAGE(JNIEnv *env, jclass cls) { return H5E_STORAGE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1SYM(JNIEnv *env, jclass cls) { return H5E_SYM; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1TRUNCATED(JNIEnv *env, jclass cls) { return H5E_TRUNCATED; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1TST(JNIEnv *env, jclass cls) { return H5E_TST; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1UNINITIALIZED(JNIEnv *env, jclass cls) { return H5E_UNINITIALIZED; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1UNSUPPORTED(JNIEnv *env, jclass cls) { return H5E_UNSUPPORTED; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1VERSION(JNIEnv *env, jclass cls) { return H5E_VERSION; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1VFL(JNIEnv *env, jclass cls) { return H5E_VFL; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1WALK_1DOWNWARD(JNIEnv *env, jclass cls) { return H5E_WALK_DOWNWARD; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1WALK_1UPWARD(JNIEnv *env, jclass cls) { return H5E_WALK_UPWARD; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5E_1WRITEERROR(JNIEnv *env, jclass cls) { return H5E_WRITEERROR; } + +/* Java does not have unsigned native types */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsign-conversion" +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1CREAT(JNIEnv *env, jclass cls) { return H5F_ACC_CREAT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1EXCL(JNIEnv *env, jclass cls) { return H5F_ACC_EXCL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1RDONLY(JNIEnv *env, jclass cls) { return H5F_ACC_RDONLY; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1RDWR(JNIEnv *env, jclass cls) { return H5F_ACC_RDWR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1TRUNC(JNIEnv *env, jclass cls) { return H5F_ACC_TRUNC; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1ACC_1DEFAULT(JNIEnv *env, jclass cls) { return H5F_ACC_DEFAULT; } +#pragma GCC diagnostic pop + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1DEFAULT(JNIEnv *env, jclass cls) { return H5F_CLOSE_DEFAULT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1SEMI(JNIEnv *env, jclass cls) { return H5F_CLOSE_SEMI; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1STRONG(JNIEnv *env, jclass cls) { return H5F_CLOSE_STRONG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1CLOSE_1WEAK(JNIEnv *env, jclass cls) { return H5F_CLOSE_WEAK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1EARLIEST(JNIEnv *env, jclass cls){return H5F_LIBVER_EARLIEST;} +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1LIBVER_1LATEST(JNIEnv *env, jclass cls){return H5F_LIBVER_LATEST;} +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1ALL(JNIEnv *env, jclass cls) { return H5F_OBJ_ALL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1ATTR(JNIEnv *env, jclass cls) { return H5F_OBJ_ATTR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1DATASET(JNIEnv *env, jclass cls) { return H5F_OBJ_DATASET; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1DATATYPE(JNIEnv *env, jclass cls) { return H5F_OBJ_DATATYPE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1FILE(JNIEnv *env, jclass cls) { return H5F_OBJ_FILE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1GROUP(JNIEnv *env, jclass cls) { return H5F_OBJ_GROUP; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1OBJ_1LOCAL(JNIEnv *env, jclass cls) { return H5F_OBJ_LOCAL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1SCOPE_1GLOBAL(JNIEnv *env, jclass cls) { return H5F_SCOPE_GLOBAL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1SCOPE_1LOCAL(JNIEnv *env, jclass cls) { return H5F_SCOPE_LOCAL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1UNLIMITED(JNIEnv *env, jclass cls) { return (jint)H5F_UNLIMITED; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1FILE_1SPACE_1DEFAULT(JNIEnv *env, jclass cls) { return H5F_FILE_SPACE_DEFAULT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1FILE_1SPACE_1ALL_1PERSIST(JNIEnv *env, jclass cls) { return H5F_FILE_SPACE_ALL_PERSIST; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1FILE_1SPACE_1ALL(JNIEnv *env, jclass cls) { return H5F_FILE_SPACE_ALL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1FILE_1SPACE_1AGGR_1VFD(JNIEnv *env, jclass cls) { return H5F_FILE_SPACE_AGGR_VFD; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1FILE_1SPACE_1VFD(JNIEnv *env, jclass cls) { return H5F_FILE_SPACE_VFD; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5F_1FILE_1SPACE_1NTYPES(JNIEnv *env, jclass cls) { return H5F_FILE_SPACE_NTYPES; } + +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1CORE(JNIEnv *env, jclass cls) { return H5FD_CORE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1DIRECT(JNIEnv *env, jclass cls) { +#ifdef H5_HAVE_DIRECT + return H5FD_DIRECT; +#else + return -1; +#endif +} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1FAMILY(JNIEnv *env, jclass cls) { return H5FD_FAMILY; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG(JNIEnv *env, jclass cls) { return H5FD_LOG; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MPIO(JNIEnv *env, jclass cls) { return H5FD_MPIO; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MULTI(JNIEnv *env, jclass cls) { return H5FD_MULTI; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1SEC2(JNIEnv *env, jclass cls) { return H5FD_SEC2; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1STDIO(JNIEnv *env, jclass cls) { return H5FD_STDIO; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1WINDOWS(JNIEnv *env, jclass cls) { +#ifdef H5_HAVE_WINDOWS + return H5FD_DIRECT; +#else + return -1; +#endif +} +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1LOC_1READ(JNIEnv *env, jclass cls) { return H5FD_LOG_LOC_READ; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1LOC_1WRITE(JNIEnv *env, jclass cls) { return H5FD_LOG_LOC_WRITE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1LOC_1SEEK(JNIEnv *env, jclass cls) { return H5FD_LOG_LOC_SEEK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1LOC_1IO(JNIEnv *env, jclass cls) { return H5FD_LOG_LOC_IO; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1FILE_1READ(JNIEnv *env, jclass cls) { return H5FD_LOG_FILE_READ; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1FILE_1WRITE(JNIEnv *env, jclass cls) { return H5FD_LOG_FILE_WRITE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1FILE_1IO(JNIEnv *env, jclass cls) { return H5FD_LOG_FILE_IO; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1FLAVOR(JNIEnv *env, jclass cls) { return H5FD_LOG_FLAVOR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1NUM_1READ(JNIEnv *env, jclass cls) { return H5FD_LOG_NUM_READ; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1NUM_1WRITE(JNIEnv *env, jclass cls) { return H5FD_LOG_NUM_WRITE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1NUM_1SEEK(JNIEnv *env, jclass cls) { return H5FD_LOG_NUM_SEEK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1NUM_1TRUNCATE(JNIEnv *env, jclass cls) { return H5FD_LOG_NUM_TRUNCATE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1NUM_1IO(JNIEnv *env, jclass cls) { return H5FD_LOG_NUM_IO; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1OPEN(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_OPEN; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1STAT(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_STAT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1READ(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_READ; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1WRITE(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_WRITE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1SEEK(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_SEEK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1CLOSE(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_CLOSE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1TIME_1IO(JNIEnv *env, jclass cls) { return H5FD_LOG_TIME_IO; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1ALLOC(JNIEnv *env, jclass cls) { return H5FD_LOG_ALLOC; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1LOG_1ALL(JNIEnv *env, jclass cls) { return H5FD_LOG_ALL; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1NOLIST(JNIEnv *env, jclass cls) { return H5FD_MEM_NOLIST; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT(JNIEnv *env, jclass cls) { return H5FD_MEM_DEFAULT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1SUPER(JNIEnv *env, jclass cls) { return H5FD_MEM_SUPER; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1BTREE(JNIEnv *env, jclass cls) { return H5FD_MEM_BTREE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DRAW(JNIEnv *env, jclass cls) { return H5FD_MEM_DRAW; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1GHEAP(JNIEnv *env, jclass cls) { return H5FD_MEM_GHEAP; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1LHEAP(JNIEnv *env, jclass cls) { return H5FD_MEM_LHEAP; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1OHDR(JNIEnv *env, jclass cls) { return H5FD_MEM_OHDR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1NTYPES(JNIEnv *env, jclass cls) { return H5FD_MEM_NTYPES; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1DEFAULT_1HADDR_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)(HADDR_MAX/H5FD_MEM_NTYPES); } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)0; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1SUPER_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)0; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1BTREE_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)(1 * (HADDR_MAX / (H5FD_MEM_NTYPES-1))); } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1DRAW_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)(2 * (HADDR_MAX / (H5FD_MEM_NTYPES-1))); } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1GHEAP_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)(3 * (HADDR_MAX / (H5FD_MEM_NTYPES-1))); } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1LHEAP_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)(4 * (HADDR_MAX / (H5FD_MEM_NTYPES-1))); } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5FD_1MEM_1DEFAULT_1OHDR_1SIZE(JNIEnv *env, jclass cls) { return (hsize_t)(5 * (HADDR_MAX / (H5FD_MEM_NTYPES-1))); } + + +/* Symbols defined for compatibility with previous versions of the HDF5 API. + * + * Use of these symbols is deprecated. + */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1DATASET(JNIEnv *env, jclass cls) { return H5G_DATASET; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1GROUP(JNIEnv *env, jclass cls) { return H5G_GROUP; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK(JNIEnv *env, jclass cls) { return H5G_LINK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1UDLINK(JNIEnv *env, jclass cls) { return H5G_UDLINK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1RESERVED_15(JNIEnv *env, jclass cls) { return H5G_RESERVED_5; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1RESERVED_16(JNIEnv *env, jclass cls) { return H5G_RESERVED_6; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1RESERVED_17(JNIEnv *env, jclass cls) { return H5G_RESERVED_7; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1TYPE(JNIEnv *env, jclass cls) { return H5G_TYPE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1UNKNOWN(JNIEnv *env, jclass cls) { return H5G_UNKNOWN; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK_1ERROR(JNIEnv *env, jclass cls) { return H5G_LINK_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK_1HARD(JNIEnv *env, jclass cls) { return H5G_LINK_HARD; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1LINK_1SOFT(JNIEnv *env, jclass cls) { return H5G_LINK_SOFT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1NLIBTYPES(JNIEnv *env, jclass cls) { return H5G_NLIBTYPES; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1NTYPES(JNIEnv *env, jclass cls) { return H5G_NTYPES; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1NUSERTYPES(JNIEnv *env, jclass cls) { return H5G_NUSERTYPES; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1SAME_1LOC(JNIEnv *env, jclass cls) { return H5G_SAME_LOC; } + +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1STORAGE_1TYPE_1UNKNOWN(JNIEnv *env, jclass cls){ return H5G_STORAGE_TYPE_UNKNOWN; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1STORAGE_1TYPE_1SYMBOL_1TABLE(JNIEnv *env, jclass cls){ return H5G_STORAGE_TYPE_SYMBOL_TABLE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1STORAGE_1TYPE_1COMPACT(JNIEnv *env, jclass cls){ return H5G_STORAGE_TYPE_COMPACT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5G_1STORAGE_1TYPE_1DENSE(JNIEnv *env, jclass cls){ return H5G_STORAGE_TYPE_DENSE; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1UNINIT(JNIEnv *env, jclass cls) { return H5I_UNINIT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1BADID(JNIEnv *env, jclass cls) { return H5I_BADID; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1FILE(JNIEnv *env, jclass cls) { return H5I_FILE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1GROUP(JNIEnv *env, jclass cls) { return H5I_GROUP; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1DATATYPE(JNIEnv *env, jclass cls) { return H5I_DATATYPE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1DATASPACE(JNIEnv *env, jclass cls) { return H5I_DATASPACE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1DATASET(JNIEnv *env, jclass cls) { return H5I_DATASET; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1ATTR(JNIEnv *env, jclass cls) { return H5I_ATTR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1REFERENCE(JNIEnv *env, jclass cls) { return H5I_REFERENCE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1VFL(JNIEnv *env, jclass cls) { return H5I_VFL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1INVALID_1HID(JNIEnv *env, jclass cls) { return H5I_INVALID_HID; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1GENPROP_1CLS(JNIEnv *env, jclass cls) { return H5I_GENPROP_CLS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1GENPROP_1LST(JNIEnv *env, jclass cls) { return H5I_GENPROP_LST; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1ERROR_1CLASS(JNIEnv *env, jclass cls) { return H5I_ERROR_CLASS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1ERROR_1MSG(JNIEnv *env, jclass cls) { return H5I_ERROR_MSG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1ERROR_1STACK(JNIEnv *env, jclass cls) { return H5I_ERROR_STACK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5I_1NTYPES(JNIEnv *env, jclass cls) { return H5I_NTYPES; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5L_1TYPE_1ERROR(JNIEnv *env, jclass cls) { return H5L_TYPE_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5L_1TYPE_1HARD(JNIEnv *env, jclass cls) { return H5L_TYPE_HARD; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5L_1TYPE_1SOFT(JNIEnv *env, jclass cls) { return H5L_TYPE_SOFT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5L_1TYPE_1EXTERNAL(JNIEnv *env, jclass cls) { return H5L_TYPE_EXTERNAL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5L_1TYPE_1MAX(JNIEnv *env, jclass cls) { return H5L_TYPE_MAX; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1SHALLOW_1HIERARCHY_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_SHALLOW_HIERARCHY_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1EXPAND_1SOFT_1LINK_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_EXPAND_SOFT_LINK_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1EXPAND_1EXT_1LINK_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_EXPAND_EXT_LINK_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1EXPAND_1REFERENCE_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_EXPAND_REFERENCE_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1WITHOUT_1ATTR_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_WITHOUT_ATTR_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1COPY_1PRESERVE_1NULL_1FLAG(JNIEnv *env, jclass cls){return H5O_COPY_PRESERVE_NULL_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1NONE_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_NONE_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1SDSPACE_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_SDSPACE_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1DTYPE_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_DTYPE_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1FILL_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_FILL_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1PLINE_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_PLINE_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1ATTR_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_ATTR_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1SHMESG_1ALL_1FLAG(JNIEnv *env, jclass cls){return H5O_SHMESG_ALL_FLAG; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1UNKNOWN(JNIEnv *env, jclass cls) { return H5O_TYPE_UNKNOWN; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1GROUP(JNIEnv *env, jclass cls) { return H5O_TYPE_GROUP; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1DATASET(JNIEnv *env, jclass cls) { return H5O_TYPE_DATASET; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1NAMED_1DATATYPE(JNIEnv *env, jclass cls) { return H5O_TYPE_NAMED_DATATYPE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5O_1TYPE_1NTYPES(JNIEnv *env, jclass cls) { return H5O_TYPE_NTYPES; } + +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1ROOT(JNIEnv *env, jclass cls){return H5P_ROOT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1OBJECT_1CREATE(JNIEnv *env, jclass cls){return H5P_OBJECT_CREATE;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1CREATE(JNIEnv *env, jclass cls){return H5P_FILE_CREATE;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1ACCESS(JNIEnv *env, jclass cls){return H5P_FILE_ACCESS;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1CREATE(JNIEnv *env, jclass cls){return H5P_DATASET_CREATE;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1ACCESS(JNIEnv *env, jclass cls){return H5P_DATASET_ACCESS;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1XFER(JNIEnv *env, jclass cls){return H5P_DATASET_XFER;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1MOUNT(JNIEnv *env, jclass cls){return H5P_FILE_MOUNT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1GROUP_1CREATE(JNIEnv *env, jclass cls){return H5P_GROUP_CREATE;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1GROUP_1ACCESS(JNIEnv *env, jclass cls){return H5P_GROUP_ACCESS;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATATYPE_1CREATE(JNIEnv *env, jclass cls){return H5P_DATATYPE_CREATE;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATATYPE_1ACCESS(JNIEnv *env, jclass cls){return H5P_DATATYPE_ACCESS;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1STRING_1CREATE(JNIEnv *env, jclass cls){return H5P_STRING_CREATE;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1ATTRIBUTE_1CREATE(JNIEnv *env, jclass cls){return H5P_ATTRIBUTE_CREATE;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1ATTRIBUTE_1ACCESS(JNIEnv *env, jclass cls){return H5P_ATTRIBUTE_ACCESS;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1OBJECT_1COPY(JNIEnv *env, jclass cls){return H5P_OBJECT_COPY;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1CREATE(JNIEnv *env, jclass cls){return H5P_LINK_CREATE;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1ACCESS(JNIEnv *env, jclass cls){return H5P_LINK_ACCESS;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_FILE_CREATE_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_FILE_ACCESS_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_DATASET_CREATE_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_DATASET_ACCESS_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATASET_1XFER_1DEFAULT(JNIEnv *env, jclass cls){return H5P_DATASET_XFER_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1FILE_1MOUNT_1DEFAULT(JNIEnv *env, jclass cls){return H5P_FILE_MOUNT_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1GROUP_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_GROUP_CREATE_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1GROUP_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_GROUP_ACCESS_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATATYPE_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_DATATYPE_CREATE_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DATATYPE_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_DATATYPE_ACCESS_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1ATTRIBUTE_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_ATTRIBUTE_CREATE_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1ATTRIBUTE_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_ATTRIBUTE_ACCESS_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1OBJECT_1COPY_1DEFAULT(JNIEnv *env, jclass cls){return H5P_OBJECT_COPY_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1CREATE_1DEFAULT(JNIEnv *env, jclass cls){return H5P_LINK_CREATE_DEFAULT;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1LINK_1ACCESS_1DEFAULT(JNIEnv *env, jclass cls){return H5P_LINK_ACCESS_DEFAULT;} +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1CRT_1ORDER_1TRACKED(JNIEnv *env, jclass cls){return H5P_CRT_ORDER_TRACKED;} +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1CRT_1ORDER_1INDEXED(JNIEnv *env, jclass cls){return H5P_CRT_ORDER_INDEXED;} +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1DEFAULT(JNIEnv *env, jclass cls) { return H5P_DEFAULT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5P_1NO_1CLASS(JNIEnv *env, jclass cls) { return H5P_ROOT; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1ERROR(JNIEnv *env, jclass cls) { return H5PL_TYPE_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5PL_1TYPE_1FILTER(JNIEnv *env, jclass cls) { return H5PL_TYPE_FILTER; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5PL_1FILTER_1PLUGIN(JNIEnv *env, jclass cls) { return H5PL_FILTER_PLUGIN; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5PL_1ALL_1PLUGIN(JNIEnv *env, jclass cls) { return H5PL_ALL_PLUGIN; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5R_1BADTYPE(JNIEnv *env, jclass cls) { return H5R_BADTYPE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5R_1MAXTYPE(JNIEnv *env, jclass cls) { return H5R_MAXTYPE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5R_1OBJ_1REF_1BUF_1SIZE(JNIEnv *env, jclass cls) { return H5R_OBJ_REF_BUF_SIZE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5R_1DSET_1REG_1REF_1BUF_1SIZE(JNIEnv *env, jclass cls) { return H5R_DSET_REG_REF_BUF_SIZE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5R_1OBJECT(JNIEnv *env, jclass cls) { return H5R_OBJECT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5R_1DATASET_1REGION(JNIEnv *env, jclass cls) { return H5R_DATASET_REGION; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1ALL(JNIEnv *env, jclass cls) { return H5S_ALL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1MAX_1RANK(JNIEnv *env, jclass cls) { return H5S_MAX_RANK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1NO_1CLASS(JNIEnv *env, jclass cls) { return H5S_NO_CLASS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1NULL(JNIEnv *env, jclass cls) { return H5S_NULL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SCALAR(JNIEnv *env, jclass cls) { return H5S_SCALAR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1ALL(JNIEnv *env, jclass cls) { return H5S_SEL_ALL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1ERROR(JNIEnv *env, jclass cls) { return H5S_SEL_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1HYPERSLABS(JNIEnv *env, jclass cls) { return H5S_SEL_HYPERSLABS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1N(JNIEnv *env, jclass cls) { return H5S_SEL_N; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1NONE(JNIEnv *env, jclass cls) { return H5S_SEL_NONE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SEL_1POINTS(JNIEnv *env, jclass cls) { return H5S_SEL_POINTS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1AND(JNIEnv *env, jclass cls) { return H5S_SELECT_AND; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1APPEND(JNIEnv *env, jclass cls) { return H5S_SELECT_APPEND; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1INVALID(JNIEnv *env, jclass cls) { return H5S_SELECT_INVALID; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1NOOP(JNIEnv *env, jclass cls) { return H5S_SELECT_NOOP; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1NOTA(JNIEnv *env, jclass cls) { return H5S_SELECT_NOTA; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1NOTB(JNIEnv *env, jclass cls) { return H5S_SELECT_NOTB; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1OR(JNIEnv *env, jclass cls) { return H5S_SELECT_OR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1PREPEND(JNIEnv *env, jclass cls) { return H5S_SELECT_PREPEND; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1SET(JNIEnv *env, jclass cls) { return H5S_SELECT_SET; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SELECT_1XOR(JNIEnv *env, jclass cls) { return H5S_SELECT_XOR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1SIMPLE(JNIEnv *env, jclass cls) { return H5S_SIMPLE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5S_1UNLIMITED(JNIEnv *env, jclass cls) { return (jint)H5S_UNLIMITED; } + +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1B16(JNIEnv *env, jclass cls) { return H5T_ALPHA_B16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1B32(JNIEnv *env, jclass cls) { return H5T_ALPHA_B32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1B64(JNIEnv *env, jclass cls) { return H5T_ALPHA_B64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1B8(JNIEnv *env, jclass cls) { return H5T_ALPHA_B8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1F32(JNIEnv *env, jclass cls) { return H5T_ALPHA_F32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1F64(JNIEnv *env, jclass cls) { return H5T_ALPHA_F64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1I16(JNIEnv *env, jclass cls) { return H5T_ALPHA_I16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1I32(JNIEnv *env, jclass cls) { return H5T_ALPHA_I32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1I64(JNIEnv *env, jclass cls) { return H5T_ALPHA_I64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1I8(JNIEnv *env, jclass cls) { return H5T_ALPHA_I8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1U16(JNIEnv *env, jclass cls) { return H5T_ALPHA_U16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1U32(JNIEnv *env, jclass cls) { return H5T_ALPHA_U32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1U64(JNIEnv *env, jclass cls) { return H5T_ALPHA_U64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ALPHA_1U8(JNIEnv *env, jclass cls) { return H5T_ALPHA_U8; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ARRAY(JNIEnv *env, jclass cls) { return H5T_ARRAY; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1BITFIELD(JNIEnv *env, jclass cls) { return H5T_BITFIELD; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1BKG_1NO(JNIEnv *env, jclass cls) { return H5T_BKG_NO; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1BKG_1YES(JNIEnv *env, jclass cls) { return H5T_BKG_YES; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1C_1S1(JNIEnv *env, jclass cls) { return H5T_C_S1; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1COMPOUND(JNIEnv *env, jclass cls) { return H5T_COMPOUND; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CONV_1CONV(JNIEnv *env, jclass cls) { return H5T_CONV_CONV; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CONV_1FREE(JNIEnv *env, jclass cls) { return H5T_CONV_FREE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CONV_1INIT(JNIEnv *env, jclass cls) { return H5T_CONV_INIT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1ERROR(JNIEnv *env, jclass cls) { return H5T_CSET_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1ASCII(JNIEnv *env, jclass cls) { return H5T_CSET_ASCII; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1UTF8(JNIEnv *env, jclass cls) { return H5T_CSET_UTF8; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_110(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_10; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_111(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_11; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_112(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_12; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_113(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_13; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_114(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_14; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_115(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_15; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_12(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_2; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_13(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_3; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_14(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_4; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_15(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_5; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_16(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_6; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_17(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_7; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_18(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_8; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1CSET_1RESERVED_19(JNIEnv *env, jclass cls) { return H5T_CSET_RESERVED_9; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1DIR_1ASCEND(JNIEnv *env, jclass cls) { return H5T_DIR_ASCEND; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1DIR_1DEFAULT(JNIEnv *env, jclass cls) { return H5T_DIR_DEFAULT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1DIR_1DESCEND(JNIEnv *env, jclass cls) { return H5T_DIR_DESCEND; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ENUM(JNIEnv *env, jclass cls) { return H5T_ENUM; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1FLOAT(JNIEnv *env, jclass cls) { return H5T_FLOAT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1FORTRAN_1S1(JNIEnv *env, jclass cls) { return H5T_FORTRAN_S1; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F32BE(JNIEnv *env, jclass cls) { return H5T_IEEE_F32BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F32LE(JNIEnv *env, jclass cls) { return H5T_IEEE_F32LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F64BE(JNIEnv *env, jclass cls) { return H5T_IEEE_F64BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F64LE(JNIEnv *env, jclass cls) { return H5T_IEEE_F64LE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEGER(JNIEnv *env, jclass cls) { return H5T_INTEGER; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1B16(JNIEnv *env, jclass cls) { return H5T_INTEL_B16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1B32(JNIEnv *env, jclass cls) { return H5T_INTEL_B32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1B64(JNIEnv *env, jclass cls) { return H5T_INTEL_B64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1B8(JNIEnv *env, jclass cls) { return H5T_INTEL_B8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1F32(JNIEnv *env, jclass cls) { return H5T_INTEL_F32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1F64(JNIEnv *env, jclass cls) { return H5T_INTEL_F64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1I16(JNIEnv *env, jclass cls) { return H5T_INTEL_I16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1I32(JNIEnv *env, jclass cls) { return H5T_INTEL_I32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1I64(JNIEnv *env, jclass cls) { return H5T_INTEL_I64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1I8(JNIEnv *env, jclass cls) { return H5T_INTEL_I8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1U16(JNIEnv *env, jclass cls) { return H5T_INTEL_U16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1U32(JNIEnv *env, jclass cls) { return H5T_INTEL_U32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1U64(JNIEnv *env, jclass cls) { return H5T_INTEL_U64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEL_1U8(JNIEnv *env, jclass cls) { return H5T_INTEL_U8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1B16(JNIEnv *env, jclass cls) { return H5T_MIPS_B16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1B32(JNIEnv *env, jclass cls) { return H5T_MIPS_B32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1B64(JNIEnv *env, jclass cls) { return H5T_MIPS_B64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1B8(JNIEnv *env, jclass cls) { return H5T_MIPS_B8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1F32(JNIEnv *env, jclass cls) { return H5T_MIPS_F32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1F64(JNIEnv *env, jclass cls) { return H5T_MIPS_F64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1I16(JNIEnv *env, jclass cls) { return H5T_MIPS_I16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1I32(JNIEnv *env, jclass cls) { return H5T_MIPS_I32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1I64(JNIEnv *env, jclass cls) { return H5T_MIPS_I64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1I8(JNIEnv *env, jclass cls) { return H5T_MIPS_I8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1U16(JNIEnv *env, jclass cls) { return H5T_MIPS_U16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1U32(JNIEnv *env, jclass cls) { return H5T_MIPS_U32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1U64(JNIEnv *env, jclass cls) { return H5T_MIPS_U64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1MIPS_1U8(JNIEnv *env, jclass cls) { return H5T_MIPS_U8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1B16(JNIEnv *env, jclass cls) { return H5T_NATIVE_B16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1B32(JNIEnv *env, jclass cls) { return H5T_NATIVE_B32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1B64(JNIEnv *env, jclass cls) { return H5T_NATIVE_B64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1B8(JNIEnv *env, jclass cls) { return H5T_NATIVE_B8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1CHAR(JNIEnv *env, jclass cls) { return H5T_NATIVE_CHAR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1DOUBLE(JNIEnv *env, jclass cls) { return H5T_NATIVE_DOUBLE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1FLOAT(JNIEnv *env, jclass cls) { return H5T_NATIVE_FLOAT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HADDR(JNIEnv *env, jclass cls) { return H5T_NATIVE_HADDR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HBOOL(JNIEnv *env, jclass cls) { return H5T_NATIVE_HBOOL; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HERR(JNIEnv *env, jclass cls) { return H5T_NATIVE_HERR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HSIZE(JNIEnv *env, jclass cls) { return H5T_NATIVE_HSIZE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1HSSIZE(JNIEnv *env, jclass cls) { return H5T_NATIVE_HSSIZE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1FAST16(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_FAST16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1FAST32(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_FAST32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1FAST64(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_FAST64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1FAST8(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_FAST8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1LEAST16(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_LEAST16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1LEAST32(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_LEAST32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1LEAST64(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_LEAST64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT_1LEAST8(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT_LEAST8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT16(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT32(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT64(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1INT8(JNIEnv *env, jclass cls) { return H5T_NATIVE_INT8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1LDOUBLE(JNIEnv *env, jclass cls) { return H5T_NATIVE_LDOUBLE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1LLONG(JNIEnv *env, jclass cls) { return H5T_NATIVE_LLONG; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1LONG(JNIEnv *env, jclass cls) { return H5T_NATIVE_LONG; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1OPAQUE(JNIEnv *env, jclass cls) { return H5T_NATIVE_OPAQUE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1SCHAR(JNIEnv *env, jclass cls) { return H5T_NATIVE_SCHAR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1SHORT(JNIEnv *env, jclass cls) { return H5T_NATIVE_SHORT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UCHAR(JNIEnv *env, jclass cls) { return H5T_NATIVE_UCHAR; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1FAST16(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_FAST16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1FAST32(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_FAST32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1FAST64(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_FAST64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1FAST8(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_FAST8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1LEAST16(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_LEAST16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1LEAST32(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_LEAST32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1LEAST64(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_LEAST64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT_1LEAST8(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT_LEAST8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT16(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT16; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT32(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT32; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT64(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT64; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1UINT8(JNIEnv *env, jclass cls) { return H5T_NATIVE_UINT8; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1ULLONG(JNIEnv *env, jclass cls) { return H5T_NATIVE_ULLONG; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1ULONG(JNIEnv *env, jclass cls) { return H5T_NATIVE_ULONG; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NATIVE_1USHORT(JNIEnv *env, jclass cls) { return H5T_NATIVE_USHORT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NCLASSES(JNIEnv *env, jclass cls) { return H5T_NCLASSES; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NO_1CLASS(JNIEnv *env, jclass cls) { return H5T_NO_CLASS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NORM_1ERROR(JNIEnv *env, jclass cls) { return H5T_NORM_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NORM_1IMPLIED(JNIEnv *env, jclass cls) { return H5T_NORM_IMPLIED; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NORM_1MSBSET(JNIEnv *env, jclass cls) { return H5T_NORM_MSBSET; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NORM_1NONE(JNIEnv *env, jclass cls) { return H5T_NORM_NONE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NPAD(JNIEnv *env, jclass cls) { return H5T_NPAD; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1NSGN(JNIEnv *env, jclass cls) { return H5T_NSGN; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1OPAQUE(JNIEnv *env, jclass cls) { return H5T_OPAQUE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1OPAQUE_1TAG_1MAX(JNIEnv *env, jclass cls) { return H5T_OPAQUE_TAG_MAX; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ORDER_1BE(JNIEnv *env, jclass cls) { return H5T_ORDER_BE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ORDER_1ERROR(JNIEnv *env, jclass cls) { return H5T_ORDER_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ORDER_1LE(JNIEnv *env, jclass cls) { return H5T_ORDER_LE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ORDER_1NONE(JNIEnv *env, jclass cls) { return H5T_ORDER_NONE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1ORDER_1VAX(JNIEnv *env, jclass cls) { return H5T_ORDER_VAX; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1PAD_1BACKGROUND(JNIEnv *env, jclass cls) { return H5T_PAD_BACKGROUND; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1PAD_1ERROR(JNIEnv *env, jclass cls) { return H5T_PAD_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1PAD_1ONE(JNIEnv *env, jclass cls) { return H5T_PAD_ONE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1PAD_1ZERO(JNIEnv *env, jclass cls) { return H5T_PAD_ZERO; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1PERS_1DONTCARE(JNIEnv *env, jclass cls) { return H5T_PERS_DONTCARE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1PERS_1HARD(JNIEnv *env, jclass cls) { return H5T_PERS_HARD; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1PERS_1SOFT(JNIEnv *env, jclass cls) { return H5T_PERS_SOFT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1REFERENCE(JNIEnv *env, jclass cls) { return H5T_REFERENCE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1SGN_12(JNIEnv *env, jclass cls) { return H5T_SGN_2; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1SGN_1ERROR(JNIEnv *env, jclass cls) { return H5T_SGN_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1SGN_1NONE(JNIEnv *env, jclass cls) { return H5T_SGN_NONE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B16BE(JNIEnv *env, jclass cls) { return H5T_STD_B16BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B16LE(JNIEnv *env, jclass cls) { return H5T_STD_B16LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B32BE(JNIEnv *env, jclass cls) { return H5T_STD_B32BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B32LE(JNIEnv *env, jclass cls) { return H5T_STD_B32LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B64BE(JNIEnv *env, jclass cls) { return H5T_STD_B64BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B64LE(JNIEnv *env, jclass cls) { return H5T_STD_B64LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B8BE(JNIEnv *env, jclass cls) { return H5T_STD_B8BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1B8LE(JNIEnv *env, jclass cls) { return H5T_STD_B8LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I16BE(JNIEnv *env, jclass cls) { return H5T_STD_I16BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I16LE(JNIEnv *env, jclass cls) { return H5T_STD_I16LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I32BE(JNIEnv *env, jclass cls) { return H5T_STD_I32BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I32LE(JNIEnv *env, jclass cls) { return H5T_STD_I32LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I64BE(JNIEnv *env, jclass cls) { return H5T_STD_I64BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I64LE(JNIEnv *env, jclass cls) { return H5T_STD_I64LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I8BE(JNIEnv *env, jclass cls) { return H5T_STD_I8BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1I8LE(JNIEnv *env, jclass cls) { return H5T_STD_I8LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1REF_1DSETREG(JNIEnv *env, jclass cls) { return H5T_STD_REF_DSETREG; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1REF_1OBJ(JNIEnv *env, jclass cls) { return H5T_STD_REF_OBJ; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U16BE(JNIEnv *env, jclass cls) { return H5T_STD_U16BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U16LE(JNIEnv *env, jclass cls) { return H5T_STD_U16LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U32BE(JNIEnv *env, jclass cls) { return H5T_STD_U32BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U32LE(JNIEnv *env, jclass cls) { return H5T_STD_U32LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U64BE(JNIEnv *env, jclass cls) { return H5T_STD_U64BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U64LE(JNIEnv *env, jclass cls) { return H5T_STD_U64LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U8BE(JNIEnv *env, jclass cls) { return H5T_STD_U8BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STD_1U8LE(JNIEnv *env, jclass cls) { return H5T_STD_U8LE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1ERROR(JNIEnv *env, jclass cls) { return H5T_STR_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1NULLPAD(JNIEnv *env, jclass cls) { return H5T_STR_NULLPAD; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1NULLTERM(JNIEnv *env, jclass cls) { return H5T_STR_NULLTERM; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_110(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_10; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_111(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_11; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_112(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_12; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_113(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_13; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_114(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_14; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_115(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_15; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_13(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_3; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_14(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_4; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_15(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_5; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_16(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_6; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_17(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_7; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_18(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_8; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1RESERVED_19(JNIEnv *env, jclass cls) { return H5T_STR_RESERVED_9; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STR_1SPACEPAD(JNIEnv *env, jclass cls) { return H5T_STR_SPACEPAD; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1STRING(JNIEnv *env, jclass cls) { return H5T_STRING; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1TIME(JNIEnv *env, jclass cls) { return H5T_TIME; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1UNIX_1D32BE(JNIEnv *env, jclass cls) { return H5T_UNIX_D32BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1UNIX_1D32LE(JNIEnv *env, jclass cls) { return H5T_UNIX_D32LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1UNIX_1D64BE(JNIEnv *env, jclass cls) { return H5T_UNIX_D64BE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1UNIX_1D64LE(JNIEnv *env, jclass cls) { return H5T_UNIX_D64LE; } +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1VARIABLE(JNIEnv *env, jclass cls) { return (int)H5T_VARIABLE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1VLEN(JNIEnv *env, jclass cls) { return H5T_VLEN; } + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1CB_1CONT(JNIEnv *env, jclass cls) { return H5Z_CB_CONT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1CB_1ERROR(JNIEnv *env, jclass cls) { return H5Z_CB_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1CB_1FAIL(JNIEnv *env, jclass cls) { return H5Z_CB_FAIL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1CB_1NO(JNIEnv *env, jclass cls) { return H5Z_CB_NO; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1DISABLE_1EDC(JNIEnv *env, jclass cls) { return H5Z_DISABLE_EDC; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1ENABLE_1EDC(JNIEnv *env, jclass cls) { return H5Z_ENABLE_EDC; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1ERROR_1EDC(JNIEnv *env, jclass cls) { return H5Z_ERROR_EDC; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1CONFIG_1DECODE_1ENABLED(JNIEnv *env, jclass cls) { return H5Z_FILTER_CONFIG_DECODE_ENABLED; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1CONFIG_1ENCODE_1ENABLED(JNIEnv *env, jclass cls) { return H5Z_FILTER_CONFIG_ENCODE_ENABLED; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1DEFLATE(JNIEnv *env, jclass cls) { return H5Z_FILTER_DEFLATE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1ERROR(JNIEnv *env, jclass cls) { return H5Z_FILTER_ERROR; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1FLETCHER32(JNIEnv *env, jclass cls) { return H5Z_FILTER_FLETCHER32; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1MAX(JNIEnv *env, jclass cls) { return H5Z_FILTER_MAX; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1NBIT(JNIEnv *env, jclass cls) {return H5Z_FILTER_NBIT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1NONE(JNIEnv *env, jclass cls) { return H5Z_FILTER_NONE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1RESERVED(JNIEnv *env, jclass cls) { return H5Z_FILTER_RESERVED; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1SCALEOFFSET(JNIEnv *env, jclass cls){ return H5Z_FILTER_SCALEOFFSET; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1SHUFFLE(JNIEnv *env, jclass cls) { return H5Z_FILTER_SHUFFLE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1SZIP(JNIEnv *env, jclass cls) { return H5Z_FILTER_SZIP; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1DEFMASK(JNIEnv *env, jclass cls) { return H5Z_FLAG_DEFMASK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1INVMASK(JNIEnv *env, jclass cls) { return H5Z_FLAG_INVMASK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1MANDATORY(JNIEnv *env, jclass cls) { return H5Z_FLAG_MANDATORY; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1OPTIONAL(JNIEnv *env, jclass cls) { return H5Z_FLAG_OPTIONAL; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1REVERSE(JNIEnv *env, jclass cls) { return H5Z_FLAG_REVERSE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FLAG_1SKIP_1EDC(JNIEnv *env, jclass cls) { return H5Z_FLAG_SKIP_EDC; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1MAX_1NFILTERS(JNIEnv *env, jclass cls) { return H5Z_MAX_NFILTERS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1NO_1EDC(JNIEnv *env, jclass cls) { return H5Z_NO_EDC; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SO_1INT_1MINBITS_1DEFAULT(JNIEnv *env, jclass cls) { return H5Z_SO_INT_MINBITS_DEFAULT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SO_1FLOAT_1DSCALE(JNIEnv *env, jclass cls){return H5Z_SO_FLOAT_DSCALE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SO_1FLOAT_1ESCALE(JNIEnv *env, jclass cls){return H5Z_SO_FLOAT_ESCALE; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SO_1INT(JNIEnv *env, jclass cls){return H5Z_SO_INT; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SHUFFLE_1USER_1NPARMS(JNIEnv *env, jclass cls) { return H5Z_SHUFFLE_USER_NPARMS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SHUFFLE_1TOTAL_1NPARMS(JNIEnv *env, jclass cls) { return H5Z_SHUFFLE_TOTAL_NPARMS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1USER_1NPARMS(JNIEnv *env, jclass cls) { return H5Z_SZIP_USER_NPARMS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1TOTAL_1NPARMS(JNIEnv *env, jclass cls) { return H5Z_SZIP_TOTAL_NPARMS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1PARM_1MASK(JNIEnv *env, jclass cls) { return H5Z_SZIP_PARM_MASK; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1PARM_1PPB(JNIEnv *env, jclass cls) { return H5Z_SZIP_PARM_PPB; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1PARM_1BPP(JNIEnv *env, jclass cls) { return H5Z_SZIP_PARM_BPP; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SZIP_1PARM_1PPS(JNIEnv *env, jclass cls) { return H5Z_SZIP_PARM_PPS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1NBIT_1USER_1NPARMS(JNIEnv *env, jclass cls) { return H5Z_NBIT_USER_NPARMS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1SCALEOFFSET_1USER_1NPARMS(JNIEnv *env, jclass cls) { return H5Z_SCALEOFFSET_USER_NPARMS; } +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5Z_1FILTER_1ALL(JNIEnv *env, jclass cls) { return H5Z_FILTER_ALL; } + +#pragma GCC diagnostic pop + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + diff --git a/java/src/jni/h5Imp.c b/java/src/jni/h5Imp.c new file mode 100644 index 0000000..05d5d59 --- /dev/null +++ b/java/src/jni/h5Imp.c @@ -0,0 +1,181 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * This code is the C-interface called by Java programs to access the + * general library functions of the HDF5 library. + * + * Each routine wraps a single HDF entry point, generally with the + * analogous arguments and return codes. + * + */ + +#include "hdf5.h" +#include +#include "h5jni.h" +#include "h5Imp.h" + +extern JavaVM *jvm; +extern jobject visit_callback; + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5open + * Signature: ()I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5open(JNIEnv *env, jclass clss) +{ + herr_t retVal = H5open(); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5open */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5close + * Signature: ()I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5close(JNIEnv *env, jclass clss) +{ + herr_t retVal = H5close(); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5close */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5dont_atexit + * Signature: ()I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5dont_1atexit(JNIEnv *env, jclass clss) +{ + herr_t retVal = H5dont_atexit(); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5dont_1atexit */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5get_libversion + * Signature: ([I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5get_1libversion(JNIEnv *env, jclass clss, jintArray libversion) +{ + unsigned *theArray = NULL; + herr_t status = -1; + jboolean isCopy; + + if (libversion == NULL) { + h5nullArgument(env, "H5get_version: libversion is NULL"); + } /* end if */ + else { + theArray = (unsigned*)ENVPTR->GetIntArrayElements(ENVPAR libversion, &isCopy); + if (theArray == NULL) { + h5JNIFatalError( env, "H5get_libversion: input not pinned"); + } /* end if */ + else { + status = H5get_libversion(&(theArray[0]), &(theArray[1]), &(theArray[2])); + + if (status < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR libversion, (jint*)theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + ENVPTR->ReleaseIntArrayElements(ENVPAR libversion, (jint*)theArray,0); + } /* end else */ + } /* end else */ + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5get_1libversion */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5check_version + * Signature: (III)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5check_1version(JNIEnv *env, jclass clss, jint majnum, jint minnum, jint relnum) +{ + return (jint)H5check_version((unsigned)majnum, (unsigned)minnum, (unsigned)relnum); +} /* end Java_hdf_hdf5lib_H5_H5check_1version */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5garbage_collect + * Signature: ()I + * + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5garbage_1collect(JNIEnv *env, jclass clss) +{ + herr_t retVal = H5garbage_collect(); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5garbage_1collect */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5set_free_list_limits + * Signature: (IIIIII)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5set_1free_1list_1limits(JNIEnv *env, jclass clss, jint reg_global_lim, jint reg_list_lim, + jint arr_global_lim, jint arr_list_lim, jint blk_global_lim, jint blk_list_lim ) +{ + herr_t retVal = H5set_free_list_limits((int)reg_global_lim, (int)reg_list_lim, + (int)arr_global_lim, (int)arr_list_lim, (int)blk_global_lim, (int)blk_list_lim); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5set_1free_1list_1limits */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5is_library_threadsafe + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5is_1library_1threadsafe(JNIEnv *env, jclass clss) +{ + hbool_t is_ts = false; + H5is_library_threadsafe(&is_ts); + return (jboolean)is_ts; +} /* end Java_hdf_hdf5lib_H5_H5is_1library_1threadsafe */ + + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5Imp.h b/java/src/jni/h5Imp.h new file mode 100644 index 0000000..6600378 --- /dev/null +++ b/java/src/jni/h5Imp.h @@ -0,0 +1,95 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5 */ + +#ifndef _Included_hdf_hdf5lib_H5_H5 +#define _Included_hdf_hdf5lib_H5_H5 + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5open + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5open + (JNIEnv *, jclass); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5close + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5close + (JNIEnv *, jclass); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5dont_atexit + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5dont_1atexit + (JNIEnv *, jclass); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5get_libversion + * Signature: ([I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5get_1libversion + (JNIEnv *, jclass, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5check_version + * Signature: (III)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5check_1version + (JNIEnv *, jclass, jint, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5garbage_collect + * Signature: ()I + * + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5garbage_1collect + (JNIEnv *, jclass); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5set_free_list_limits + * Signature: (IIIIII)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5set_1free_1list_1limits + (JNIEnv *, jclass, jint, jint, jint, jint, jint, jint ); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5is_library_threadsafe + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5is_1library_1threadsafe + (JNIEnv *, jclass); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5 */ diff --git a/java/src/jni/h5aImp.c b/java/src/jni/h5aImp.c new file mode 100644 index 0000000..a081271 --- /dev/null +++ b/java/src/jni/h5aImp.c @@ -0,0 +1,879 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "hdf5.h" +#include "h5util.h" +#include +#include +#include +#include "h5aImp.h" + +extern JavaVM *jvm; +extern jobject visit_callback; + +#ifdef __cplusplus +#define CBENVPTR (cbenv) +#define CBENVPAR +#define JVMPTR (jvm) +#define JVMPAR +#define JVMPAR2 +#else +#define CBENVPTR (*cbenv) +#define CBENVPAR cbenv, +#define JVMPTR (*jvm) +#define JVMPAR jvm +#define JVMPAR2 jvm, +#endif + +/********************/ +/* Local Prototypes */ +/********************/ + +static herr_t H5A_iterate_cb(hid_t g_id, const char *name, const H5A_info_t *info, void *op_data); + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Acreate + * Signature: (JLjava/lang/String;JJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Acreate(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id, + jlong space_id, jlong create_plist) +{ + hid_t attr_id = -1; + const char *aName; + + PIN_JAVA_STRING(name, aName, -1); + + attr_id = H5Acreate2((hid_t)loc_id, aName, (hid_t)type_id, (hid_t)space_id, (hid_t)create_plist, (hid_t)H5P_DEFAULT); + + UNPIN_JAVA_STRING(name, aName); + + if (attr_id < 0) + h5libraryError(env); + + return (jlong)attr_id; +} /* end Java_hdf_hdf5lib_H5__1H5Acreate */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aopen_name + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Aopen_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring name) +{ + hid_t attr_id = -1; + const char *aName; + + PIN_JAVA_STRING(name, aName, -1); + + attr_id = H5Aopen_name((hid_t)loc_id, aName); + + UNPIN_JAVA_STRING(name,aName); + + if (attr_id < 0) + h5libraryError(env); + + return (jlong)attr_id; +} /* end Java_hdf_hdf5lib_H5__1H5Aopen_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aopen_idx + * Signature: (JI)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Aopen_1idx(JNIEnv *env, jclass clss, jlong loc_id, jint idx) +{ + hid_t attr_id = H5Aopen_idx((hid_t)loc_id, (unsigned int) idx); + + if (attr_id < 0) + h5libraryError(env); + + return (jlong)attr_id; +} /* end Java_hdf_hdf5lib_H5__1H5Aopen_1idx */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Awrite + * Signature: (JJ[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Awrite(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jbyteArray buf) +{ + herr_t status = -1; + jbyte *byteP; + jboolean isCopy; + + if (buf == NULL) { + h5nullArgument( env,"H5Awrite: buf is NULL"); + } /* end if */ + else { + byteP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy); + if (byteP == NULL) { + h5JNIFatalError(env,"H5Awrite: buf is not pinned"); + } /* end if */ + else { + status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, byteP); + + /* free the buffer without copying back */ + ENVPTR->ReleaseByteArrayElements(ENVPAR buf, byteP, JNI_ABORT); + + if (status < 0) + h5libraryError(env); + } + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Awrite */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aread + * Signature: (JJ[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Aread(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jbyteArray buf) +{ + herr_t status = -1; + jbyte *byteP; + jboolean isCopy; + + if (buf == NULL) { + h5nullArgument( env,"H5Aread: buf is NULL"); + } /* end if */ + else { + byteP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy); + if (byteP == NULL) { + h5JNIFatalError( env,"H5Aread: buf is not pinned"); + } /* end if */ + else { + status = H5Aread((hid_t)attr_id, (hid_t)mem_type_id, byteP); + + if (status < 0) { + ENVPTR->ReleaseByteArrayElements(ENVPAR buf, byteP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + ENVPTR->ReleaseByteArrayElements(ENVPAR buf, byteP, 0); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Aread */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_space + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Aget_1space(JNIEnv *env, jclass clss, jlong attr_id) +{ + hid_t retVal = -1; + + retVal = H5Aget_space((hid_t)attr_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Aget_1space */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_type + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Aget_1type(JNIEnv *env, jclass clss, jlong attr_id) +{ + hid_t retVal = -1; + + retVal = H5Aget_type((hid_t)attr_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Aget_1type */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_name + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Aget_1name(JNIEnv *env, jclass clss, jlong attr_id) +{ + char *aName; + jstring str = NULL; + ssize_t buf_size; + + /* get the length of the name */ + buf_size = H5Aget_name((hid_t)attr_id, NULL, 0); + + if (buf_size <= 0) { + h5badArgument(env, "H5Aget_name: buf_size <= 0"); + } /* end if */ + else { + buf_size++; /* add extra space for the null terminator */ + aName = (char*)HDmalloc(sizeof(char) * (size_t)buf_size); + if (aName == NULL) { + h5outOfMemory(env, "H5Aget_name: malloc failed"); + } /* end if */ + else { + buf_size = H5Aget_name((hid_t)attr_id, (size_t)buf_size, aName); + if (buf_size < 0) { + HDfree(aName); + h5libraryError(env); + } /* end if */ + else { + /* save the string; */ + str = ENVPTR->NewStringUTF(ENVPAR aName); + HDfree(aName); + } /* end else */ + } /* end else */ + } /* end else */ + return str; +} /* end Java_hdf_hdf5lib_H5_H5Aget_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_num_attrs + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Aget_1num_1attrs(JNIEnv *env, jclass clss, jlong loc_id) +{ + int retVal = -1; + + retVal = H5Aget_num_attrs((hid_t)loc_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Aget_1num_1attrs */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Adelete + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Adelete(JNIEnv *env, jclass clss, jlong loc_id, jstring name) +{ + herr_t status = -1; + const char *aName; + + PIN_JAVA_STRING(name, aName, -1); + + status = H5Adelete((hid_t)loc_id, aName); + + UNPIN_JAVA_STRING(name, aName); + + if (status < 0) + h5libraryError(env); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Adelete */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5__1H5Aclose(JNIEnv *env, jclass clss, jlong attr_id) +{ + herr_t retVal = -1; + + if (attr_id > 0) + retVal = H5Aclose((hid_t)attr_id); + + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Aclose */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Acreate2 + * Signature: (JLjava/lang/String;JJJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Acreate2(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id, + jlong space_id, jlong create_plist, jlong access_plist) +{ + hid_t status = -1; + const char *aName; + + PIN_JAVA_STRING(name, aName, -1); + + status = H5Acreate2((hid_t)loc_id, aName, (hid_t)type_id, + (hid_t)space_id, (hid_t)create_plist, (hid_t)access_plist ); + + UNPIN_JAVA_STRING(name, aName); + + if (status < 0) + h5libraryError(env); + + return (jlong)status; +} /* end Java_hdf_hdf5lib_H5__1H5Acreate2 */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Aopen + * Signature: (JLjava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Aopen(JNIEnv *env, jclass clss, jlong obj_id, jstring name, jlong access_plist) + +{ + hid_t retVal = -1; + const char *aName; + + PIN_JAVA_STRING(name, aName, -1); + + retVal = H5Aopen((hid_t)obj_id, aName, (hid_t)access_plist); + + UNPIN_JAVA_STRING(name, aName); + + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Aopen */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Aopen_by_idx + * Signature: (JLjava/lang/String;IIJJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Aopen_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint idx_type, jint order, jlong n, jlong aapl_id, jlong lapl_id) +{ + hid_t retVal = -1; + const char *aName; + + PIN_JAVA_STRING(name, aName, -1); + + retVal = H5Aopen_by_idx((hid_t)loc_id, aName, (H5_index_t)idx_type, + (H5_iter_order_t)order, (hsize_t)n, (hid_t)aapl_id, (hid_t)lapl_id); + + UNPIN_JAVA_STRING(name, aName); + + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Aopen_1by_1idx */ + +/* +* Class: hdf_hdf5lib_H5 +* Method: _H5Acreate_by_name +* Signature: (JLjava/lang/String;Ljava/lang/String;JJJJJ)J +*/ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Acreate_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring attr_name, jlong type_id, jlong space_id, jlong acpl_id, jlong aapl_id, jlong lapl_id) +{ + hid_t retVal = -1; + const char *aName; + const char *attrName; + + PIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName, -1); + + retVal = H5Acreate_by_name((hid_t)loc_id, aName, attrName, (hid_t)type_id, + (hid_t)space_id, (hid_t)acpl_id, (hid_t)aapl_id, (hid_t)lapl_id); + + UNPIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName); + + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Acreate_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aexists_by_name + * Signature: (JLjava/lang/String;Ljava/lang/String;J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Aexists_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring attr_name, jlong lapl_id) +{ + htri_t retVal = -1; + const char *aName; + const char *attrName; + + PIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName, JNI_FALSE); + + retVal = H5Aexists_by_name((hid_t)loc_id, aName, attrName, (hid_t)lapl_id); + + UNPIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName); + + if (retVal < 0) + h5libraryError(env); + + return (jboolean)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Aexists_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Arename + * Signature: (JLjava/lang/String;Ljava/lang/String)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Arename(JNIEnv *env, jclass clss, jlong loc_id, jstring old_attr_name, jstring new_attr_name) +{ + herr_t retVal = -1; + const char *oName; + const char *nName; + + PIN_JAVA_STRING_TWO(old_attr_name, oName, new_attr_name, nName, -1); + + retVal = H5Arename((hid_t)loc_id, oName, nName); + + UNPIN_JAVA_STRING_TWO(old_attr_name, oName, new_attr_name, nName); + + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Arename */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Arename_by_name + * Signature: (JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Arename_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring old_attr_name, jstring new_attr_name, jlong lapl_id) +{ + herr_t retVal = -1; + const char *aName; + const char *oName; + const char *nName; + + PIN_JAVA_STRING_THREE(obj_name, aName, old_attr_name, oName, new_attr_name, nName, -1); + + retVal = H5Arename_by_name((hid_t)loc_id, aName, oName, nName, (hid_t)lapl_id); + + UNPIN_JAVA_STRING_THREE(obj_name, aName, old_attr_name, oName, new_attr_name, nName); + + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Arename_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_name_by_idx + * Signature: (JLjava/lang/String;IIJJ)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Aget_1name_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jint idx_type, jint order, jlong n, jlong lapl_id) +{ + size_t buf_size; + char *aValue; + jlong status_size; + jstring str = NULL; + const char *aName; + + PIN_JAVA_STRING(obj_name, aName, NULL); + + /* get the length of the attribute name */ + status_size = H5Aget_name_by_idx((hid_t)loc_id, aName, (H5_index_t)idx_type, + (H5_iter_order_t) order, (hsize_t) n, (char*)NULL, (size_t)0, (hid_t)lapl_id); + + if(status_size < 0) { + UNPIN_JAVA_STRING(obj_name, aName); + h5libraryError(env); + } /* end if */ + else { + buf_size = (size_t)status_size + 1;/* add extra space for the null terminator */ + + aValue = (char*)HDmalloc(sizeof(char) * buf_size); + if (aValue == NULL) { + UNPIN_JAVA_STRING(obj_name, aName); + h5outOfMemory(env, "H5Aget_name_by_idx: malloc failed "); + } /* end if */ + else { + status_size = H5Aget_name_by_idx((hid_t)loc_id, aName, (H5_index_t)idx_type, + (H5_iter_order_t) order, (hsize_t) n, (char*)aValue, (size_t)buf_size, (hid_t)lapl_id); + + UNPIN_JAVA_STRING(obj_name, aName); + + if (status_size < 0) { + HDfree(aValue); + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR aValue); + HDfree(aValue); + if (str == NULL) { + /* exception -- fatal JNI error */ + h5JNIFatalError(env, "H5Aget_name_by_idx: return string not created"); + } /* end if */ + } /* end else */ + } /* end else */ + } /* end else */ + return str; +} /* end Java_hdf_hdf5lib_H5_H5Aget_1name_1by_1idx */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_storage_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Aget_1storage_1size(JNIEnv *env, jclass clss, jlong attr_id) +{ + hsize_t retVal = (hsize_t)-1; + + retVal = H5Aget_storage_size((hid_t)attr_id); +/* probably returns '0' if fails--don't do an exception */ + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Aget_1storage_1size */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_info + * Signature: (J)Lhdf/hdf5lib/structs/H5A_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Aget_1info(JNIEnv *env, jclass clss, jlong attr_id) +{ + herr_t status = -1; + H5A_info_t ainfo; + jvalue args[4]; + jobject ret_obj = NULL; + + status = H5Aget_info((hid_t)attr_id, &ainfo); + + if (status < 0) { + h5libraryError(env); + } /* end if */ + else { + args[0].z = ainfo.corder_valid; + args[1].j = ainfo.corder; + args[2].i = ainfo.cset; + args[3].j = (jlong)ainfo.data_size; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5A_info_t", "(ZJIJ)V", args); + } /* end else */ + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Aget_1info */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_info_by_idx + * Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5A_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jint idx_type, jint order, jlong n, jlong lapl_id) +{ + herr_t status; + H5A_info_t ainfo; + jvalue args[4]; + jobject ret_obj = NULL; + const char *aName; + + PIN_JAVA_STRING(obj_name, aName, NULL); + + status = H5Aget_info_by_idx((hid_t)loc_id, aName, (H5_index_t)idx_type, + (H5_iter_order_t)order, (hsize_t)n, &ainfo, (hid_t)lapl_id); + + UNPIN_JAVA_STRING(obj_name, aName); + + if (status < 0) { + h5libraryError(env); + } /* end if */ + else { + args[0].z = ainfo.corder_valid; + args[1].j = ainfo.corder; + args[2].i = ainfo.cset; + args[3].j = (jlong)ainfo.data_size; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5A_info_t", "(ZJIJ)V", args); + } /* end else */ + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1idx */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_info_by_name + * Signature: (JLjava/lang/String;Ljava/lang/String;J)Lhdf/hdf5lib/structs/H5A_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring attr_name, jlong lapl_id) +{ + const char *aName; + const char *attrName; + herr_t status; + H5A_info_t ainfo; + jvalue args[4]; + jobject ret_obj = NULL; + + PIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName, NULL); + + status = H5Aget_info_by_name((hid_t)loc_id, aName, attrName, &ainfo, (hid_t)lapl_id); + + UNPIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName); + + if (status < 0) { + h5libraryError(env); + } /* end if */ + else { + args[0].z = ainfo.corder_valid; + args[1].j = ainfo.corder; + args[2].i = ainfo.cset; + args[3].j = (jlong)ainfo.data_size; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5A_info_t", "(ZJIJ)V", args); + } /* end else */ + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Adelete_by_name + * Signature: (JLjava/lang/String;Ljava/lang/String;J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Adelete_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring attr_name, jlong lapl_id) +{ + herr_t retVal = -1; + const char *aName; + const char *attrName; + + PIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName, -1); + + retVal = H5Adelete_by_name((hid_t)loc_id, aName, attrName, (hid_t)lapl_id); + + UNPIN_JAVA_STRING_TWO(obj_name, aName, attr_name, attrName); + + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Adelete_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aexists + * Signature: (JLjava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Aexists(JNIEnv *env, jclass clss, jlong obj_id, jstring attr_name) +{ + htri_t bval = JNI_FALSE; + const char *aName; + + PIN_JAVA_STRING(attr_name, aName, JNI_FALSE); + + bval = H5Aexists((hid_t)obj_id, aName); + + UNPIN_JAVA_STRING(attr_name, aName); + + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Aexists */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Adelete_by_idx + * Signature: (JLjava/lang/String;IIJJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Adelete_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jint idx_type, jint order, jlong n, jlong lapl_id) +{ + herr_t status = -1; + const char *aName; + + PIN_JAVA_STRING0(obj_name, aName); + + status = H5Adelete_by_idx((hid_t)loc_id, aName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t)n, (hid_t)lapl_id); + + UNPIN_JAVA_STRING(obj_name, aName); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Adelete_1by_1idx */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Aopen_by_name + * Signature: (JLjava/lang/String;Ljava/lang/String;JJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Aopen_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring obj_name, jstring attr_name, jlong aapl_id, jlong lapl_id) + +{ + hid_t status = -1; + const char *aName; + const char *oName; + + PIN_JAVA_STRING_TWO(obj_name, oName, attr_name, aName, -1); + + status = H5Aopen_by_name((hid_t)loc_id, oName, aName, (hid_t)aapl_id, (hid_t)lapl_id); + + UNPIN_JAVA_STRING_TWO(obj_name, oName, attr_name, aName); + + if (status < 0) + h5libraryError(env); + + return (jlong)status; +} /* end Java_hdf_hdf5lib_H5__1H5Aopen_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_create_plist + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Aget_1create_1plist(JNIEnv *env, jclass clss, jlong attr_id) +{ + hid_t retVal = -1; + + retVal = H5Aget_create_plist((hid_t)attr_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Aget_1create_1plist */ + +static herr_t +H5A_iterate_cb(hid_t g_id, const char *name, const H5A_info_t *info, void *op_data) { + JNIEnv *cbenv; + jint status = -1; + jclass cls; + jmethodID mid; + jstring str; + jmethodID constructor; + jvalue args[4]; + jobject cb_info_t = NULL; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5A_info_t;Lhdf/hdf5lib/callbacks/H5A_iterate_t;)I"); + if (mid != 0) { + str = CBENVPTR->NewStringUTF(CBENVPAR name); + + args[0].z = info->corder_valid; + args[1].j = info->corder; + args[2].i = info->cset; + args[3].j = (jlong)info->data_size; + /* get a reference to your class if you don't have it already */ + cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5A_info_t"); + if (cls != 0) { + /* get a reference to the constructor; the name is */ + constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "", "(ZJIJ)V"); + if (constructor != 0) { + cb_info_t = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args); + + status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, g_id, str, cb_info_t, op_data); + } /* end if (constructor != 0) */ + } /* end if (cls != 0) */ + } /* end if (mid != 0) */ + } /* end if (cls != 0) */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + + return (herr_t)status; +} /* end H5A_iterate_cb */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aiterate + * Signature: (JIIJLjava/lang/Object;Ljava/lang/Object;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Aiterate(JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order, + jlong idx, jobject callback_op, jobject op_data) +{ + hsize_t start_idx = (hsize_t)idx; + herr_t status = -1; + + ENVPTR->GetJavaVM(ENVPAR &jvm); + visit_callback = callback_op; + + if ((op_data == NULL) || (callback_op == NULL)) { + h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL"); + } /* end if */ + else { + status = H5Aiterate2((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)op_data); + + if (status < 0) + h5libraryError(env); + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Aiterate */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aiterate_by_name + * Signature: (JLjava/lang/String;IIJLjava/lang/Object;Ljava/lang/Object;J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name(JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type, jint order, + jlong idx, jobject callback_op, jobject op_data, jlong access_id) +{ + const char *lName; + hsize_t start_idx = (hsize_t)idx; + herr_t status = -1; + + ENVPTR->GetJavaVM(ENVPAR &jvm); + visit_callback = callback_op; + + if ((op_data == NULL) || (callback_op == NULL)) { + h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL"); + } /* end if */ + else { + PIN_JAVA_STRING(name, lName, -1); + + status = H5Aiterate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5A_operator2_t)H5A_iterate_cb, (void*)op_data, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status < 0) + h5libraryError(env); + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name */ + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5aImp.h b/java/src/jni/h5aImp.h new file mode 100644 index 0000000..bbc61f5 --- /dev/null +++ b/java/src/jni/h5aImp.h @@ -0,0 +1,273 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5A */ + +#ifndef _Included_hdf_hdf5lib_H5_H5A +#define _Included_hdf_hdf5lib_H5_H5A + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Acreate + * Signature: (JLjava/lang/String;JJJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Acreate + (JNIEnv *, jclass, jlong, jstring, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aopen_name + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Aopen_1name + (JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aopen_idx + * Signature: (JI)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Aopen_1idx + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Awrite + * Signature: (JJ[B)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Awrite + (JNIEnv *, jclass, jlong, jlong, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aread + * Signature: (JJ[B)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aread + (JNIEnv *, jclass, jlong, jlong, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_space + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Aget_1space + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_type + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Aget_1type + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_name + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Aget_1name + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_num_attrs + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aget_1num_1attrs + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Adelete + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Adelete + (JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Aclose + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Acreate2 + * Signature: (JLjava/lang/String;JJJJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Acreate2 +(JNIEnv *, jclass, jlong, jstring, jlong, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Aopen + * Signature: (JLjava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Aopen + (JNIEnv *, jclass, jlong, jstring, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Aopen_by_idx + * Signature: (JLjava/lang/String;IIJJJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Aopen_1by_1idx + (JNIEnv *, jclass, jlong, jstring, jint, jint, jlong, jlong, jlong); + +/* +* Class: hdf_hdf5lib_H5 +* Method: _H5Acreate_by_name +* Signature: (JLjava/lang/String;Ljava/lang/String;JJJJJ)J +*/ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Acreate_1by_1name +(JNIEnv *, jclass, jlong, jstring, jstring, jlong, jlong, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aexists_by_name + * Signature: (JLjava/lang/String;Ljava/lang/String;J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Aexists_1by_1name + (JNIEnv *, jclass, jlong, jstring, jstring, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Arename + * Signature: (JLjava/lang/String;Ljava/lang/String)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Arename + (JNIEnv *, jclass, jlong, jstring, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Arename_by_name + * Signature: (JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Arename_1by_1name + (JNIEnv *, jclass, jlong, jstring, jstring, jstring, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_name_by_idx + * Signature: (JLjava/lang/String;IIJJ)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Aget_1name_1by_1idx + (JNIEnv *, jclass, jlong, jstring, jint, jint, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_storage_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Aget_1storage_1size + (JNIEnv *, jclass, jlong); + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_info + * Signature: (J)Lhdf/hdf5lib/structs/H5A_info_t; + */ +JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Aget_1info + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_info_by_idx + * Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5A_info_t; + */ +JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1idx + (JNIEnv *, jclass, jlong, jstring, jint, jint, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_info_by_name + * Signature: (JLjava/lang/String;Ljava/lang/String;J)Lhdf/hdf5lib/structs/H5A_info_t; + */ +JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Aget_1info_1by_1name + (JNIEnv *, jclass, jlong, jstring, jstring, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Adelete_by_name + * Signature: (JLjava/lang/String;Ljava/lang/String;J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Adelete_1by_1name + (JNIEnv *, jclass, jlong, jstring, jstring, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aexists + * Signature: (JLjava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Aexists + (JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Adelete_by_idx + * Signature: (JLjava/lang/String;IIJJ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Adelete_1by_1idx + (JNIEnv *, jclass, jlong, jstring, jint, jint, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Aopen_by_name + * Signature: (JLjava/lang/String;Ljava/lang/String;JJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Aopen_1by_1name + (JNIEnv *, jclass, jlong, jstring, jstring, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aget_create_plist + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Aget_1create_1plist + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aiterate + * Signature: (JIIJLjava/lang/Object;Ljava/lang/Object;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aiterate + (JNIEnv*, jclass, jlong, jint, jint, jlong, jobject, jobject); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Aiterate_by_name + * Signature: (JLjava/lang/String;IIJLjava/lang/Object;Ljava/lang/Object;J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Aiterate_1by_1name + (JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jobject, jobject, jlong); + + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5A */ diff --git a/java/src/jni/h5dImp.c b/java/src/jni/h5dImp.c new file mode 100644 index 0000000..f70cb5e --- /dev/null +++ b/java/src/jni/h5dImp.c @@ -0,0 +1,1758 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include +#include +#include +#include "hdf5.h" +#include "h5util.h" +#include "h5dImp.h" + +extern JavaVM *jvm; +extern jobject visit_callback; + +#ifdef __cplusplus + #ifdef _WINDOWS + #include + #endif + #define CBENVPTR (cbenv) + #define CBENVPAR + #define JVMPTR (jvm) + #define JVMPAR + #define JVMPAR2 +#else + #define CBENVPTR (*cbenv) + #define CBENVPAR cbenv, + #define JVMPTR (*jvm) + #define JVMPAR jvm + #define JVMPAR2 jvm, +#endif + +/********************/ +/* Local Prototypes */ +/********************/ + +static herr_t H5DreadVL_str (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf); +static herr_t H5DreadVL_array (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf); +static herr_t H5DwriteVL_str (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf); +static herr_t H5DwriteVL_array (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t file_sid, hid_t xfer_plist_id, jobjectArray buf); + +/********************/ +/* Local Macros */ +/********************/ + +#define PIN_BYTE_ARRAY() { \ + if (isCriticalPinning) \ + buffP = (jbyte*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \ + else \ + buffP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy); \ +} + +#define UNPIN_BYTE_ARRAY(mode) { \ + if (isCriticalPinning) \ + ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \ + else \ + ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, mode); \ +} + +#define PIN_SHORT_ARRAY() { \ + if (isCriticalPinning) \ + buffP = (jshort*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \ + else \ + buffP = ENVPTR->GetShortArrayElements(ENVPAR buf, &isCopy); \ +} + +#define UNPIN_SHORT_ARRAY(mode) { \ + if (isCriticalPinning) \ + ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \ + else \ + ENVPTR->ReleaseShortArrayElements(ENVPAR buf, buffP, mode); \ +} + +#define PIN_INT_ARRAY() { \ + if (isCriticalPinning) \ + buffP = (jint*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \ + else \ + buffP = ENVPTR->GetIntArrayElements(ENVPAR buf, &isCopy); \ +} + +#define UNPIN_INT_ARRAY(mode) { \ + if (isCriticalPinning) \ + ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \ + else \ + ENVPTR->ReleaseIntArrayElements(ENVPAR buf, buffP, mode); \ +} + +#define PIN_LONG_ARRAY() { \ + if (isCriticalPinning) \ + buffP = (jlong*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \ + else \ + buffP = ENVPTR->GetLongArrayElements(ENVPAR buf,&isCopy); \ +} + +#define UNPIN_LONG_ARRAY(mode) { \ + if (isCriticalPinning) \ + ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \ + else \ + ENVPTR->ReleaseLongArrayElements(ENVPAR buf, buffP, mode); \ +} + +#define PIN_FLOAT_ARRAY() { \ + if (isCriticalPinning) \ + buffP = (jfloat*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \ + else \ + buffP = ENVPTR->GetFloatArrayElements(ENVPAR buf, &isCopy); \ +} + +#define UNPIN_FLOAT_ARRAY(mode) { \ + if (isCriticalPinning) \ + ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \ + else \ + ENVPTR->ReleaseFloatArrayElements(ENVPAR buf, buffP, mode); \ +} + +#define PIN_DOUBLE_ARRAY() { \ + if (isCriticalPinning) \ + buffP = (jdouble*)ENVPTR->GetPrimitiveArrayCritical(ENVPAR buf, &isCopy); \ + else \ + buffP = ENVPTR->GetDoubleArrayElements(ENVPAR buf, &isCopy); \ +} + +#define UNPIN_DOUBLE_ARRAY(mode) { \ + if (isCriticalPinning) \ + ENVPTR->ReleasePrimitiveArrayCritical(ENVPAR buf, buffP, mode); \ + else \ + ENVPTR->ReleaseDoubleArrayElements(ENVPAR buf, buffP, mode); \ +} + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dcreate + * Signature: (JLjava/lang/String;JJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Dcreate(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id, + jlong space_id, jlong create_plist_id) +{ + hid_t dset_id = -1; + const char *fileName; + + PIN_JAVA_STRING(name, fileName, -1); + + dset_id = H5Dcreate2((hid_t)loc_id, fileName, (hid_t)type_id, (hid_t)space_id, H5P_DEFAULT, (hid_t)create_plist_id, H5P_DEFAULT); + + UNPIN_JAVA_STRING(name, fileName); + + if (dset_id < 0) + h5libraryError(env); + + return (jlong)dset_id; +} /* end Java_hdf_hdf5lib_H5__1H5Dcreate */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dopen + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Dopen(JNIEnv *env, jclass clss, jlong loc_id, jstring name) +{ + hid_t dset_id = -1; + const char *fileName; + + PIN_JAVA_STRING(name, fileName, -1); + + dset_id = H5Dopen2((hid_t)loc_id, fileName, H5P_DEFAULT); + + UNPIN_JAVA_STRING(name, fileName); + if (dset_id < 0) + h5libraryError(env); + + return (jlong)dset_id; +} /* end Java_hdf_hdf5lib_H5__1H5Dopen */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dget_space + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Dget_1space(JNIEnv *env, jclass clss, jlong dataset_id) +{ + hid_t retVal = -1; + + retVal = H5Dget_space((hid_t)dataset_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Dget_1space */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dget_type + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Dget_1type(JNIEnv *env, jclass clss, jlong dataset_id) +{ + hid_t retVal = -1; + + retVal = H5Dget_type((hid_t)dataset_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Dget_1type */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dget_create_plist + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Dget_1create_1plist(JNIEnv *env, jclass clss, jlong dataset_id) +{ + hid_t retVal = -1; + + retVal = H5Dget_create_plist((hid_t)dataset_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Dget_1create_1plist */ + +static htri_t +H5Tdetect_variable_str(hid_t tid) { + htri_t ret_val = 0; + + if (H5Tget_class(tid) == H5T_COMPOUND) { + unsigned i; + unsigned nm = (unsigned)H5Tget_nmembers(tid); + for(i = 0; i < nm; i++) { + htri_t status = 0; + hid_t mtid = 0; + if((mtid = H5Tget_member_type(tid, i)) < 0) + return -1; /* exit immediately on error */ + if((status = H5Tdetect_variable_str(mtid)) < 0) + return status; /* exit immediately on error */ + ret_val |= status; + H5Tclose (mtid); + } /* end for */ + } /* end if */ + else + ret_val = H5Tis_variable_str(tid); + + return ret_val; +} /* end H5Tdetect_variable_str */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread + * Signature: (JJJJJ[BZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dread(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jbyteArray buf, jboolean isCriticalPinning) +{ + herr_t status; + jbyte *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Dread: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dread: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dread: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Dread: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dread: buf does not support variable length type"); + } /* end else if */ + else { + PIN_BYTE_ARRAY(); + + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dread: buf not pinned"); + } /* end if */ + else { + status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP); + + if (status < 0) { + UNPIN_BYTE_ARRAY(JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + UNPIN_BYTE_ARRAY(0); /* update java buffer for return */ + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dread */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite + * Signature: (JJJJJ[BZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dwrite(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jbyteArray buf, jboolean isCriticalPinning) +{ + herr_t status; + jbyte *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Dwrite: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dwrite: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dwrite: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Dwrite: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dwrite: buf does not support variable length type"); + } /* end else if */ + else { + PIN_BYTE_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dwrite: buf not pinned"); + } /* end if */ + else { + status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP); + + UNPIN_BYTE_ARRAY(JNI_ABORT); /* no need to update buffer */ + + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dwrite */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5__1H5Dclose(JNIEnv *env, jclass clss, jlong dataset_id) +{ + herr_t retVal = -1; + + retVal = H5Dclose((hid_t)dataset_id); + + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Dclose */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dget_storage_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Dget_1storage_1size(JNIEnv *env, jclass clss, jlong dataset_id) +{ + hsize_t retVal = (hsize_t)-1; + + if (dataset_id < 0) { + h5badArgument(env, "H5Dget_storage_size: not a dataset"); + } /* end if */ + else { + retVal = H5Dget_storage_size((hid_t)dataset_id); + } /* end else */ + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Dget_1storage_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dvlen_reclaim + * Signature: (JJJ[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dvlen_1reclaim(JNIEnv *env, jclass clss, jlong type_id, jlong space_id, + jlong xfer_plist_id, jbyteArray buf) +{ + herr_t status = -1; + jbyte *byteP; + jboolean isCopy; + + if (buf == NULL) { + h5nullArgument(env, "H5Dvlen_reclaim: buf is NULL"); + } /* end if */ + else { + byteP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy); + if (byteP == NULL) { + h5JNIFatalError(env, "H5Dvlen_reclaim: buf not pinned"); + } /* end if */ + else { + status = H5Dvlen_reclaim((hid_t)type_id, (hid_t)space_id, (hid_t)xfer_plist_id, byteP); + + ENVPTR->ReleaseByteArrayElements(ENVPAR buf, byteP, JNI_ABORT); + + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dvlen_1reclaim */ + +/* + //////////////////////////////////////////////////////////////////// + // // + // New APIs for read data from library // + // Using H5Dread(..., Object buf) requires function calls // + // theArray.emptyBytes() and theArray.arrayify(buf), which // + // triples the actual memory needed by the data set. // + // Using the following APIs solves the problem. // + // // + //////////////////////////////////////////////////////////////////// +*/ +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_short + * Signature: (JJJJJ[SZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dread_1short(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jshortArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jshort *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Dread_short: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dread: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dread_short: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Dread_short: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dread_short: buf does not support variable length type"); + } /* end else if */ + else { + PIN_SHORT_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dread_short: buf not pinned"); + } /* end if */ + else { + status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP); + + if (status < 0) { + UNPIN_SHORT_ARRAY(JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + UNPIN_SHORT_ARRAY(0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dread_1short */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_short + * Signature: (JJJJJ[SZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dwrite_1short(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jshortArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jshort *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL ) { + h5nullArgument(env, "H5Dwrite_short: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dwrite_short: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dwrite_short: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Dwrite_short: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dwrite_short: buf does not support variable length type"); + } /* end else if */ + else { + PIN_SHORT_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dwrite_short: buf not pinned"); + } /* end if */ + else { + status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP); + + UNPIN_SHORT_ARRAY(JNI_ABORT); + + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1short */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_int + * Signature: (JJJJJ[IZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dread_1int(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jintArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jint *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Dread_int: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dread_int: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dread_int: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Dread_int: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dread_int: buf does not support variable length type"); + } /* end else if */ + else { + PIN_INT_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dread_int: buf not pinned"); + } /* end if */ + else { + status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP); + + if (status < 0) { + UNPIN_INT_ARRAY(JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + UNPIN_INT_ARRAY(0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dread_1int */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_int + * Signature: (JJJJJ[IZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dwrite_1int(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jintArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jint *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Dwrite_int: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dwrite_int: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dwrite_int: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Dwrite_int: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dwrite_int: buf does not support variable length type"); + } /* end else if */ + else { + PIN_INT_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dwrite_int: buf not pinned"); + } /* end if */ + else { + status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP); + + UNPIN_INT_ARRAY(JNI_ABORT); + + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1int */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_long + * Signature: (JJJJJ[JZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dread_1long(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jlongArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jlong *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Dread_long: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dread_long: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dread_long: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Dread_long: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dread_long: buf does not support variable length type"); + } /* end else if */ + else { + PIN_LONG_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dread_long: buf not pinned"); + } /* end if */ + else { + status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP); + + if (status < 0) { + UNPIN_LONG_ARRAY(JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + UNPIN_LONG_ARRAY(0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dread_1long */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_long + * Signature: (JJJJJ[JZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dwrite_1long(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jlongArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jlong *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Dwrite_long: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dwrite_long: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dwrite_long: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Dwrite_long: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dwrite_long: buf does not support variable length type"); + } /* end else if */ + else { + PIN_LONG_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dwrite_long: buf not pinned"); + } /* end if */ + else { + status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP); + + UNPIN_LONG_ARRAY(JNI_ABORT); + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1long */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_float + * Signature: (JJJJJ[FZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dread_1float(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jfloatArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jfloat *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Dread_float: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dread_float: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dread_float: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Dread_float: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dread_float: buf does not support variable length type"); + } /* end else if */ + else { + PIN_FLOAT_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dread_float: buf not pinned"); + } /* end if */ + else { + status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP); + + if (status < 0) { + UNPIN_FLOAT_ARRAY(JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + UNPIN_FLOAT_ARRAY(0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dread_1float */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_float + * Signature: (JJJJJ[FZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dwrite_1float(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jfloatArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jfloat *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Dwrite_float: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dwrite_float: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dwrite_float: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Dwrite_float: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dwrite_float: buf does not support variable length type"); + } /* end else if */ + else { + PIN_FLOAT_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dwrite_float: buf not pinned"); + } /* end if */ + else { + status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP); + + UNPIN_FLOAT_ARRAY(JNI_ABORT); + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1float */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_double + * Signature: (JJJJJ[DZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dread_1double(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jdoubleArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jdouble *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Dread_double: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dread_double: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dread_double: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Dread_double: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dread_double: buf does not support variable length type"); + } /* end else if */ + else { + PIN_DOUBLE_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dread_double: buf not pinned"); + } /* end if */ + else { + status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP); + + if (status < 0) { + UNPIN_DOUBLE_ARRAY(JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + UNPIN_DOUBLE_ARRAY(0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dread_1double */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_double + * Signature: (JJJJJ[DZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dwrite_1double(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jdoubleArray buf, jboolean isCriticalPinning) +{ + herr_t status = -1; + jdouble *buffP; + jboolean isCopy; + htri_t data_class; + + if (buf == NULL) { + h5nullArgument(env, "H5Dwrite_double: buf is NULL"); + } /* end if */ + else if((data_class = H5Tdetect_class(mem_type_id, H5T_VLEN)) < 0) { + h5JNIFatalError(env, "H5Dwrite_double: H5Tdetect_class() failed"); + } /* end else if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dwrite_double: buf does not support variable length type"); + } /* end else if */ + else { + /* recursive detect any vlen string in type (compound, array ...) */ + if((data_class = H5Tdetect_variable_str(mem_type_id)) < 0) { + h5JNIFatalError(env, "H5Dwrite_double: H5Tdetect_variable_str() failed"); + } /* end if */ + else if(data_class == 1) { + h5badArgument(env, "H5Dwrite_double: buf does not support variable length type"); + } /* end else if */ + else { + PIN_DOUBLE_ARRAY(); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dwrite_double: buf not pinned"); + } /* end if */ + else { + status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, buffP); + + UNPIN_DOUBLE_ARRAY(JNI_ABORT); + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1double */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_string + * Signature: (JJJJJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dread_1string(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jobjectArray j_buf) +{ + herr_t status = -1; + char *c_buf; + char *cstr; + size_t str_len; + jsize i; + jsize n; + size_t pos; + jstring jstr; + + c_buf = cstr = NULL; + if (j_buf == NULL) { + h5nullArgument(env, "H5Dread_string: buf is NULL"); + } /* end if */ + else if ((n = ENVPTR->GetArrayLength(ENVPAR j_buf)) <= 0) { + h5nullArgument(env, "H5Dread_string: buf length <= 0"); + } /* end else if */ + else if ((str_len = H5Tget_size((hid_t)mem_type_id)) <=0) { + h5libraryError(env); + } /* end else if */ + else { + if ((cstr = (char*)HDmalloc(str_len + 1)) == NULL) { + h5JNIFatalError(env, "H5Dread_string: memory allocation failed."); + } /* end if */ + else { + if ((c_buf = (char*)HDmalloc((size_t)n * str_len)) == NULL) { + if (cstr) + HDfree(cstr); + cstr = NULL; + h5JNIFatalError(env, "H5Dread_string: memory allocation failed."); + } /* end if */ + else { + status = H5Dread((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, c_buf); + + if (status < 0) { + if (cstr) + HDfree(cstr); + cstr = NULL; + if (c_buf) + HDfree(c_buf); + c_buf = NULL; + h5libraryError(env); + } /* end if */ + else { + pos = 0; + for (i = 0; i < n; i++) { + HDmemcpy(cstr, c_buf+pos, str_len); + cstr[str_len] = '\0'; + jstr = ENVPTR->NewStringUTF(ENVPAR cstr); + ENVPTR->SetObjectArrayElement(ENVPAR j_buf, i, jstr); + pos += str_len; + } /* end for */ + } /* end else */ + + if (c_buf) + HDfree(c_buf); + } /* end else cbuf allocation*/ + + if (cstr) + HDfree(cstr); + } /* end else cstr allocation*/ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dread_1string */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_string + * Signature: (JJJJJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dwrite_1string(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jobjectArray j_buf) +{ + herr_t status = -1; + char *c_buf; + jsize str_len; + jsize i; + jsize n; + + if (j_buf == NULL) { + h5nullArgument(env, "H5Dwrite_string: buf is NULL"); + } /* end if */ + else if ((n = ENVPTR->GetArrayLength(ENVPAR j_buf)) <= 0) { + h5nullArgument(env, "H5Dwrite_string: buf length <= 0"); + } /* end else if */ + else if ((str_len = (jsize)H5Tget_size((hid_t)mem_type_id)) <=0) { + h5libraryError(env); + } /* end else if */ + else { + if ((c_buf = (char*)HDmalloc((size_t)n * (size_t)str_len)) == NULL) { + h5JNIFatalError(env, "H5Dwrite_string: memory allocation failed."); + } /* end if */ + else { + for (i = 0; i < n; i++) { + jstring obj = (jstring)ENVPTR->GetObjectArrayElement(ENVPAR (jobjectArray)j_buf, i); + if (obj != 0) { + jsize length = ENVPTR->GetStringUTFLength(ENVPAR obj); + const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0); + + if (utf8) { + strncpy(&c_buf[i * str_len], utf8, str_len); + } /* end if */ + + ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8); + ENVPTR->DeleteLocalRef(ENVPAR obj); + } /* end if */ + } /* end for */ + + status = H5Dwrite((hid_t)dataset_id, (hid_t)mem_type_id, (hid_t)mem_space_id, + (hid_t)file_space_id, (hid_t)xfer_plist_id, c_buf); + + if (c_buf) + HDfree(c_buf); + c_buf = NULL; + + if (status < 0) { + h5libraryError(env); + } /* end if */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1string */ + +/** + * Read VLEN data into array of arrays. + * Object[] buf contains VL arrays of data points + * Currently only deal with variable length of atomic data types + */ +/* old version */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_VLStrings + * Signature: (JJJJJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dread_1VLStrings(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jobjectArray buf) +{ + herr_t status = -1; + htri_t isVlenStr=0; + + if (buf == NULL) { + h5nullArgument(env, "H5Dread_VLStrings: buf is NULL"); + } /* end if */ + else { + isVlenStr = H5Tis_variable_str((hid_t)mem_type_id); + + if (isVlenStr) { + status = H5DreadVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id, + (hid_t)mem_space_id, (hid_t)file_space_id, + (hid_t)xfer_plist_id, buf); + } /* end if */ + else + h5badArgument(env, "H5Dread_VLStrings: type is not variable length String"); + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dread_1VLStrings */ + +herr_t +H5DreadVL_str (JNIEnv *env, hid_t did, hid_t tid, hid_t mem_sid, hid_t + file_sid, hid_t xfer_plist_id, jobjectArray buf) +{ + char **strs; + jstring jstr; + jint i; + jint n; + herr_t status = -1; + + n = ENVPTR->GetArrayLength(ENVPAR buf); + strs =(char**)HDcalloc((size_t)n, sizeof(char*)); + + if (strs == NULL) { + h5JNIFatalError(env, "H5DreadVL_str: failed to allocate buff for read variable length strings"); + } /* end if */ + else { + status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, strs); + + if (status < 0) { + H5Dvlen_reclaim(tid, mem_sid, xfer_plist_id, strs); + HDfree(strs); + h5JNIFatalError(env, "H5DreadVL_str: failed to read variable length strings"); + } /* end if */ + else { + for (i=0; i < n; i++) { + jstr = ENVPTR->NewStringUTF(ENVPAR strs[i]); + ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr); + H5free_memory (strs[i]); + } /* end for */ + + /* + for repeatedly reading a dataset with a large number of strs (e.g., 1,000,000 strings, + H5Dvlen_reclaim() may crash on Windows because the Java GC will not be able to collect + free space in time. Instead, use "H5free_memory(strs[i])" above to free individual strings + after it is done. + H5Dvlen_reclaim(tid, mem_sid, xfer_plist_id, strs); + */ + + HDfree(strs); + } /* end else */ + } /* end else */ + + return status; +} /* end H5DreadVL_str */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_VLStrings + * Signature: (JJJJJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings(JNIEnv *env, jclass clss, jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jobjectArray buf) +{ + herr_t status = -1; + htri_t isVlenStr=0; + + if (buf == NULL) { + h5nullArgument(env, "H5Dwrite_VLStrings: buf is NULL"); + } /* end if */ + else { + isVlenStr = H5Tis_variable_str((hid_t)mem_type_id); + + if (isVlenStr) { + status = H5DwriteVL_str(env, (hid_t)dataset_id, (hid_t)mem_type_id, + (hid_t)mem_space_id, (hid_t)file_space_id, + (hid_t)xfer_plist_id, buf); + } /* end if */ + else + h5badArgument(env, "H5Dwrite_VLStrings: type is not variable length String"); + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings */ + +herr_t +H5DwriteVL_str(JNIEnv *env, hid_t dataset_id, hid_t mem_type_id, hid_t mem_space_id, + hid_t file_space_id, hid_t xfer_plist_id, jobjectArray buf) +{ + herr_t status = -1; + char **wdata; + jsize size; + jsize i; + + size = ENVPTR->GetArrayLength(ENVPAR (jarray) buf); + wdata = (char**)HDmalloc((size_t)size * sizeof (char*)); + + if (!wdata) { + h5JNIFatalError(env, "H5DwriteVL_string: cannot allocate buffer"); + } /* end if */ + else { + HDmemset(wdata, 0, (size_t)size * sizeof(char*)); + for (i = 0; i < size; ++i) { + jstring obj = (jstring) ENVPTR->GetObjectArrayElement(ENVPAR (jobjectArray)buf, i); + if (obj != 0) { + jsize length = ENVPTR->GetStringUTFLength(ENVPAR obj); + const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0); + + if (utf8) { + wdata[i] = (char*)HDmalloc((size_t)length + 1); + if (wdata[i]) { + HDmemset(wdata[i], 0, (size_t)length + 1); + HDstrncpy(wdata[i], utf8, (size_t)length + 1); + } /* end if */ + } /* end if */ + + ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8); + ENVPTR->DeleteLocalRef(ENVPAR obj); + } /* end if */ + } /* end for (i = 0; i < size; ++i) */ + + status = H5Dwrite(dataset_id, mem_type_id, mem_space_id, file_space_id, xfer_plist_id, wdata); + + /* now free memory*/ + for (i = 0; i < size; i++) { + if(wdata[i]) { + HDfree(wdata[i]); + } /* end if */ + } /* end for */ + HDfree(wdata); + + if (status < 0) + h5libraryError(env); + } /* end else */ + + return status; +} /* end H5DwriteVL_str */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_reg_ref + * Signature: (JJJJJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref (JNIEnv *env, jclass clss, + jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jobjectArray buf) +{ + herr_t status = -1; + h5str_t h5str; + size_t size; + hdset_reg_ref_t *ref_data; + jint i; + jint n; + jstring jstr; + + hid_t region = -1; + hid_t did = (hid_t) dataset_id; + hid_t tid = (hid_t) mem_type_id; + hid_t mem_sid = (hid_t) mem_space_id; + hid_t file_sid = (hid_t) file_space_id; + + n = ENVPTR->GetArrayLength(ENVPAR buf); + size = sizeof(hdset_reg_ref_t); /*H5Tget_size(tid);*/ + ref_data = (hdset_reg_ref_t*)HDmalloc(size * (size_t)n); + + if (ref_data == NULL) { + h5JNIFatalError(env, "H5Dread_reg_ref: failed to allocate buff for read"); + return -1; + } /* end if */ + + status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, ref_data); + + if (status < 0) { + HDfree(ref_data); + h5JNIFatalError(env, "H5Dread_reg_ref: failed to read data"); + return -1; + } /* end if */ + + HDmemset(&h5str, 0, sizeof(h5str_t)); + h5str_new(&h5str, 1024); + for (i=0; iNewStringUTF(ENVPAR h5str.s); + + ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr); + } /* end for */ + + h5str_free(&h5str); + HDfree(ref_data); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_reg_ref_data + * Signature: (JJJJJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref_1data (JNIEnv *env, jclass clss, + jlong dataset_id, jlong mem_type_id, jlong mem_space_id, + jlong file_space_id, jlong xfer_plist_id, jobjectArray buf) +{ + herr_t status = -1; + h5str_t h5str; + size_t size; + hdset_reg_ref_t *ref_data; + jint i; + jint n; + jstring jstr; + + hid_t region_obj; + H5S_sel_type region_type; + + hid_t region = -1; + hid_t did = (hid_t) dataset_id; + hid_t tid = (hid_t) mem_type_id; + hid_t mem_sid = (hid_t) mem_space_id; + hid_t file_sid = (hid_t) file_space_id; + + n = ENVPTR->GetArrayLength(ENVPAR buf); + size = sizeof(hdset_reg_ref_t); /*H5Tget_size(tid);*/ + ref_data = (hdset_reg_ref_t*)HDmalloc(size * (size_t)n); + + if (ref_data == NULL) { + h5JNIFatalError(env, "H5Dread_reg_ref_data: failed to allocate buff for read"); + return -1; + } /* end if */ + + status = H5Dread(did, tid, mem_sid, file_sid, xfer_plist_id, ref_data); + + if (status < 0) { + HDfree(ref_data); + h5JNIFatalError(env, "H5Dread_reg_ref_data: failed to read data"); + return -1; + } /* end if */ + + HDmemset(&h5str, 0, sizeof(h5str_t)); + h5str_new(&h5str, 1024); + for (i=0; i= 0) { + region = H5Rget_region(did, H5R_DATASET_REGION, ref_data[i]); + if (region >= 0) { + region_type = H5Sget_select_type(region); + if(region_type==H5S_SEL_POINTS) { + h5str_dump_region_points_data(&h5str, region, region_obj); + } /* end if */ + else { + h5str_dump_region_blocks_data(&h5str, region, region_obj); + } /* end else */ + + H5Sclose(region); + } /* end if */ + H5Dclose(region_obj); + } /* end if */ + jstr = ENVPTR->NewStringUTF(ENVPAR h5str.s); + + ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr); + } /* end for */ + + h5str_free(&h5str); + HDfree(ref_data); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref_1data */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dcreate2 + * Signature: (JLjava/lang/String;JJJJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Dcreate2(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type_id, + jlong space_id, jlong link_plist_id, jlong create_plist_id, jlong access_plist_id) +{ + hid_t dset_id = -1; + const char *fileName; + + PIN_JAVA_STRING(name, fileName, -1); + + dset_id = H5Dcreate2((hid_t)loc_id, fileName, (hid_t)type_id, (hid_t)space_id, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id); + + UNPIN_JAVA_STRING(name, fileName); + if (dset_id < 0) + h5libraryError(env); + + return (jlong)dset_id; +} /* end Java_hdf_hdf5lib_H5__1H5Dcreate2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dopen2 + * Signature: (JLjava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Dopen2(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist) +{ + hid_t dset_id; + const char *fileName; + + PIN_JAVA_STRING(name, fileName, -1); + + dset_id = H5Dopen2((hid_t)loc_id, fileName, (hid_t)access_plist); + + UNPIN_JAVA_STRING(name, fileName); + if (dset_id < 0) + h5libraryError(env); + + return (jlong)dset_id; +} /* end Java_hdf_hdf5lib_H5__1H5Dopen2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dcreate_anon + * Signature: (JJJJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Dcreate_1anon(JNIEnv *env, jclass clss, jlong loc_id, jlong type_id, jlong space_id, jlong dcpl_id, jlong dapl_id) +{ + hid_t dset_id = -1; + + dset_id = H5Dcreate_anon((hid_t)loc_id, (hid_t)type_id, (hid_t)space_id, (hid_t)dcpl_id, (hid_t)dapl_id); + if (dset_id < 0) + h5libraryError(env); + + return (jlong)dset_id; +} /* end Java_hdf_hdf5lib_H5__1H5Dcreate_1anon */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dget_space_status + * Signature: (J)I; + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dget_1space_1status(JNIEnv *env, jclass clss, jlong loc_id) +{ + H5D_space_status_t space_status = H5D_SPACE_STATUS_ERROR; + + if (H5Dget_space_status((hid_t)loc_id, &space_status) < 0) + h5libraryError(env); + + return (jint)space_status; +} /* end Java_hdf_hdf5lib_H5_H5Dget_1space_1status */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dget_access_plist + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Dget_1access_1plist(JNIEnv *env, jclass clss, jlong loc_id) +{ + hid_t retVal = -1; + + retVal = H5Dget_access_plist((hid_t)loc_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Dget_1access_1plist */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dget_offset + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Dget_1offset(JNIEnv *env, jclass clss, jlong loc_id) +{ + haddr_t offset = HADDR_UNDEF; + + offset = H5Dget_offset((hid_t)loc_id); + if (offset == HADDR_UNDEF) + h5libraryError(env); + + return (jlong)offset; +} /* end Java_hdf_hdf5lib_H5_H5Dget_1offset */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dvlen_get_buf_size + * Signature: (JJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Dvlen_1get_1buf_1size(JNIEnv *env, jclass clss, jlong dataset_id, jlong type_id, jlong space_id) +{ + hsize_t sz = 0; + + if (H5Dvlen_get_buf_size((hid_t)dataset_id, (hid_t)type_id, (hid_t)space_id, &sz) < 0) + h5libraryError(env); + + return (jlong)sz; +} /* end Java_hdf_hdf5lib_H5_H5Dvlen_1get_1buf_1size_1long */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dfill + * Signature: ([BJ[BJJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Dfill(JNIEnv *env, jclass clss, jbyteArray fill, jlong fill_type_id, jbyteArray buf, jlong buf_type_id, jlong space_id) +{ + herr_t status; + jbyte *fillP; + jbyte *buffP; + jboolean isCopy1; + jboolean isCopy2; + + + if (buf == NULL) { + h5nullArgument(env, "H5Dfill: buf is NULL"); + return; + } /* end if */ + buffP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy2); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Dfill: buf not pinned"); + return; + } /* end if */ + + if(fill) { + fillP = ENVPTR->GetByteArrayElements(ENVPAR fill, &isCopy1); + if (fillP == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, JNI_ABORT); + h5JNIFatalError( env, "H5Dfill: fill not pinned"); + return; + } /* end if */ + } /* end if */ + else + fillP = NULL; + + status = H5Dfill((const void*)fillP, (hid_t)fill_type_id, (void*)buffP, (hid_t)buf_type_id, (hid_t)space_id); + if(fillP) { + /* free the buffer without copying back */ + /* end if */ ENVPTR->ReleaseByteArrayElements(ENVPAR fill, fillP, JNI_ABORT); + } + if (status < 0) { + ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + if (isCopy2 == JNI_TRUE) { + ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, 0); + } /* end if */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Dfill */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dset_extent + * Signature: (J[J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Dset_1extent(JNIEnv *env, jclass clss, jlong loc_id, jlongArray buf) +{ + herr_t status; + hsize_t *dims; + jlong *buffP; + jsize rank; + jboolean isCopy; + int i = 0; + + if (buf == NULL) { + h5nullArgument(env, "H5Dset_extent: buf is NULL"); + return; + } /* end if */ + + rank = ENVPTR->GetArrayLength(ENVPAR buf); + if (rank <= 0) { + h5JNIFatalError(env, "H5Dset_extent: rank <=0"); + } /* end if */ + else { + buffP = ENVPTR->GetLongArrayElements(ENVPAR buf, &isCopy); + if (buffP == NULL) { + h5JNIFatalError( env, "H5Dset_extent: buf not pinned"); + } /* end if */ + else { + dims = (hsize_t*)HDmalloc((size_t)rank * sizeof(hsize_t)); + for (i = 0; i< rank; i++) + dims[i] = (hsize_t)buffP[i]; + + status = H5Dset_extent((hid_t)loc_id, (hsize_t*)dims); + + HDfree (dims); + + /* free the buffer without copying back */ + ENVPTR->ReleaseLongArrayElements(ENVPAR buf, buffP, JNI_ABORT); + + if (status < 0) { + h5libraryError(env); + } /* end if */ + } /* end else */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Dset_1extent */ + +static herr_t +H5D_iterate_cb(void* elem, hid_t elem_id, unsigned ndim, const hsize_t *point, void *op_data) { + JNIEnv *cbenv; + jint status; + jclass cls; + jmethodID mid; + jbyteArray elemArray; + jlongArray pointArray; + jsize size; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback); + if (cls == 0) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "([BJI[JLhdf/hdf5lib/callbacks/H5D_iterate_t;)I"); + if (mid == 0) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + + if (elem == NULL) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + if (point == NULL) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + + size = (jsize)H5Tget_size(elem_id); + elemArray = CBENVPTR->NewByteArray(CBENVPAR size); + if (elemArray == NULL) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + CBENVPTR->SetByteArrayRegion(CBENVPAR elemArray, 0, size, (jbyte *)elem); + + pointArray = CBENVPTR->NewLongArray(CBENVPAR 2); + if (pointArray == NULL) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + CBENVPTR->SetLongArrayRegion(CBENVPAR pointArray, 0, 2, (const jlong *)point); + + status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, (void*)elemArray, elem_id, ndim, pointArray, op_data); + + CBENVPTR->GetByteArrayRegion(CBENVPAR elemArray, 0, size, (jbyte *)elem); + + JVMPTR->DetachCurrentThread(JVMPAR); + + return status; +} /* end H5D_iterate_cb */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Diterate + * Signature: ([BJJLjava/lang/Object;Ljava/lang/Object;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Diterate(JNIEnv *env, jclass clss, jbyteArray buf, jlong buf_type, jlong space, + jobject callback_op, jobject op_data) +{ + herr_t status = -1; + jboolean isCopy; + jbyte *buffP; + + ENVPTR->GetJavaVM(ENVPAR &jvm); + visit_callback = callback_op; + + if (op_data == NULL) { + h5nullArgument(env, "H5Diterate: op_data is NULL"); + return -1; + } /* end if */ + if (callback_op == NULL) { + h5nullArgument(env, "H5Diterate: callback_op is NULL"); + return -1; + } /* end if */ + + if (buf == NULL) { + h5nullArgument(env, "H5Diterate: buf is NULL"); + return -1; + } /* end if */ + buffP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy); + if (buffP == NULL) { + h5JNIFatalError(env, "H5Diterate: buf not pinned"); + } /* end if */ + else { + status = H5Diterate((void*)buffP, (hid_t)buf_type, (hid_t)space, (H5D_operator_t)H5D_iterate_cb, (void*)op_data); + + if (status < 0) { + ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + if (isCopy == JNI_TRUE) { + ENVPTR->ReleaseByteArrayElements(ENVPAR buf, buffP, 0); + } /* end if */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Diterate */ + + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5dImp.h b/java/src/jni/h5dImp.h new file mode 100644 index 0000000..12078e8 --- /dev/null +++ b/java/src/jni/h5dImp.h @@ -0,0 +1,319 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5D */ + +#ifndef _Included_hdf_hdf5lib_H5_H5D +#define _Included_hdf_hdf5lib_H5_H5D + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dcreate + * Signature: (JLjava/lang/String;JJJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Dcreate + (JNIEnv*, jclass, jlong, jstring, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dopen + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Dopen + (JNIEnv*, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dget_space + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Dget_1space + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dget_type + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Dget_1type + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dget_create_plist + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Dget_1create_1plist + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread + * Signature: (JJJJJ[BZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jbyteArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite + * Signature: (JJJJJ[BZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dwrite + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jbyteArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Dclose + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dget_storage_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Dget_1storage_1size + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dvlen_reclaim + * Signature: (JJJ[B)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dvlen_1reclaim + (JNIEnv*, jclass, jlong, jlong, jlong, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_short + * Signature: (JJJJJ[SZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1short + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jshortArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_short + * Signature: (JJJJJ[SZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dwrite_1short + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jshortArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_int + * Signature: (JJJJJ[IZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1int + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jintArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_int + * Signature: (JJJJJ[IZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dwrite_1int + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jintArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_long + * Signature: (JJJJJ[JZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1long + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jlongArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_long + * Signature: (JJJJJ[JZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dwrite_1long + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jlongArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_float + * Signature: (JJJJJ[FZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1float + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jfloatArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_float + * Signature: (JJJJJ[FZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dwrite_1float + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jfloatArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_double + * Signature: (JJJJJ[DZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1double + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jdoubleArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_double + * Signature: (JJJJJ[DZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dwrite_1double + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jdoubleArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_string + * Signature: (JJJJJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1string + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_string + * Signature: (JJJJJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dwrite_1string +(JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_VLStrings + * Signature: (JJJJJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1VLStrings +(JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dwrite_VLStrings + * Signature: (JJJJJ[BZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dwrite_1VLStrings + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_reg_ref + * Signature: (JJJJJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref +(JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dread_reg_ref_data + * Signature: (JJJJJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dread_1reg_1ref_1data + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong, jobjectArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dcreate2 + * Signature: (JLjava/lang/String;JJJJJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Dcreate2 + (JNIEnv*, jclass, jlong, jstring, jlong, jlong, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dopen2 + * Signature: (JLjava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Dopen2 + (JNIEnv*, jclass, jlong, jstring, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Dcreate_anon + * Signature: (JJJJJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Dcreate_1anon + (JNIEnv*, jclass, jlong, jlong, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dget_space_status + * Signature: (J)I; + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dget_1space_1status + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dget_access_plist + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Dget_1access_1plist + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dget_offset + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Dget_1offset + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dvlen_get_buf_size + * Signature: (JJJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Dvlen_1get_1buf_1size + (JNIEnv*, jclass, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dfill + * Signature: ([BJ[BJJ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Dfill + (JNIEnv*, jclass, jbyteArray, jlong, jbyteArray, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Dset_extent + * Signature: (J[J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Dset_1extent + (JNIEnv*, jclass, jlong, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Diterate + * Signature: ([BJJLjava/lang/Object;Ljava/lang/Object;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Diterate + (JNIEnv*, jclass, jbyteArray, jlong, jlong, jobject, jobject); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5D */ diff --git a/java/src/jni/h5eImp.c b/java/src/jni/h5eImp.c new file mode 100644 index 0000000..f0c4135 --- /dev/null +++ b/java/src/jni/h5eImp.c @@ -0,0 +1,524 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * This code is the C-interface called by Java programs to access the + * general library functions of the HDF5 library. + * + * Each routine wraps a single HDF entry point, generally with the + * analogous arguments and return codes. + * + * For details of the HDF libraries, see the HDF Documentation at: + * http://www.hdfgroup.org/HDF5/doc/ + * + */ + +#include +#include +#include "hdf5.h" +#include "h5jni.h" +#include "h5eImp.h" + +extern JavaVM *jvm; +extern jobject visit_callback; + +#ifdef __cplusplus + #define CBENVPTR (cbenv) + #define CBENVPAR + #define JVMPTR (jvm) + #define JVMPAR + #define JVMPAR2 +#else /* __cplusplus */ + #define CBENVPTR (*cbenv) + #define CBENVPAR cbenv, + #define JVMPTR (*jvm) + #define JVMPAR jvm + #define JVMPAR2 jvm, +#endif /* __cplusplus */ + +/********************/ +/* Local Prototypes */ +/********************/ + +static herr_t H5E_walk_cb(int nindx, const H5E_error2_t *info, void *op_data); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eauto_is_v2 + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Eauto_1is_1v2(JNIEnv *env, jclass cls, jlong stk_id) +{ + unsigned int is_stack = 0; + + if (stk_id < 0) { + h5badArgument(env, "H5Eauto_is_v2: invalid argument"); + } /* end if */ + else if (H5Eauto_is_v2((hid_t)stk_id, &is_stack) < 0) + h5libraryError(env); + + return (jboolean)is_stack; +} /* end Java_hdf_hdf5lib_H5_H5Eauto_1is_1v2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eregister_class + * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Eregister_1class(JNIEnv *env, jclass cls, jstring cls_name, jstring lib_name, jstring version) +{ + hid_t ret_val = -1; + const char* the_cls_name; + const char* the_lib_name; + const char* the_version; + + PIN_JAVA_STRING_THREE(cls_name, the_cls_name, lib_name, the_lib_name, version, the_version, -1); + + ret_val = H5Eregister_class(the_cls_name, the_lib_name, the_version); + + UNPIN_JAVA_STRING_THREE(cls_name, the_cls_name, lib_name, the_lib_name, version, the_version); + + if (ret_val < 0) + h5libraryError(env); + + return (jlong)ret_val; +} /* end Java_hdf_hdf5lib_H5_H5Eregister_1class */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eunregister_class + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Eunregister_1class(JNIEnv *env, jclass cls, jlong cls_id) +{ + if (cls_id < 0) { + h5badArgument(env, "H5Eunregister_class: invalid argument"); + } /* end if */ + else if (H5Eunregister_class((hid_t)cls_id) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Eunregister_1class */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eclose_msg + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Eclose_1msg(JNIEnv *env, jclass cls, jlong err_id) +{ + if (err_id < 0) { + h5badArgument(env, "H5Eclose_msg: invalid argument"); + } /* end if */ + else if (H5Eclose_msg((hid_t)err_id) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Eclose_1msg */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ecreate_msg + * Signature: (JILjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Ecreate_1msg(JNIEnv *env, jclass cls, jlong err_id, jint msg_type, jstring err_msg) +{ + hid_t ret_val = -1; + const char *the_err_msg; + H5E_type_t error_msg_type = (H5E_type_t)msg_type; + + if (err_id < 0) { + h5badArgument(env, "H5Ecreate_msg: invalid argument"); + } /* end if */ + else { + PIN_JAVA_STRING(err_msg, the_err_msg, -1); + + ret_val = H5Ecreate_msg((hid_t)err_id, error_msg_type, the_err_msg); + + UNPIN_JAVA_STRING(err_msg, the_err_msg); + + if (ret_val < 0) + h5libraryError(env); + } /* end else */ + + return (jlong)ret_val; +} /* end Java_hdf_hdf5lib_H5_H5Ecreate_1msg */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ecreate_stack + * Signature: ()J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Ecreate_1stack(JNIEnv *env, jclass cls) +{ + hid_t ret_val = -1; + + ret_val = H5Ecreate_stack(); + if (ret_val < 0) + h5libraryError(env); + + return (jlong)ret_val; +} /* end Java_hdf_hdf5lib_H5_H5Ecreate_1stack */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eget_current_stack + * Signature: ()J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Eget_1current_1stack(JNIEnv *env, jclass cls) +{ + hid_t ret_val = -1; + + ret_val = H5Eget_current_stack(); + if (ret_val < 0) + h5libraryError(env); + + return (jlong)ret_val; +} /* end Java_hdf_hdf5lib_H5_H5Eget_1current_1stack */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eclose_stack + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Eclose_1stack(JNIEnv *env, jclass cls, jlong stk_id) +{ + if (stk_id < 0) { + h5badArgument(env, "H5Eclose_stack: invalid argument"); + } /* end if */ + else if (H5Eclose_stack((hid_t)stk_id) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Eclose_1stack */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eprint2 + * Signature: (JLjava/lang/Object;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Eprint2(JNIEnv *env, jclass cls, jlong stk_id, jobject stream_obj) +{ + herr_t ret_val = -1; + + if (stk_id < 0) { + h5badArgument(env, "H5Eprint2: invalid argument"); + } /* end if */ + else { + if(!stream_obj) + ret_val = H5Eprint2((hid_t)stk_id, stdout); + else + ret_val = H5Eprint2((hid_t)stk_id, (FILE*)stream_obj); + + if (ret_val < 0) + h5libraryError(env); + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Eprint2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eget_class_name + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Eget_1class_1name(JNIEnv *env, jclass cls, jlong cls_id) +{ + char *namePtr; + jstring str = NULL; + ssize_t buf_size; + + if (cls_id < 0) { + h5badArgument(env, "H5Eget_class_name: invalid argument"); + } /* end if */ + else { + /* get the length of the name */ + buf_size = H5Eget_class_name((hid_t)cls_id, NULL, 0); + + if (buf_size < 0) { + h5badArgument( env, "H5Eget_class_name: buf_size < 0"); + } /* end if */ + else if (buf_size == 0) { + h5badArgument( env, "H5Eget_class_name: No class name"); + } /* end else if */ + else { + buf_size++; /* add extra space for the null terminator */ + namePtr = (char*)HDmalloc(sizeof(char) * (size_t)buf_size); + if (namePtr == NULL) { + h5outOfMemory( env, "H5Eget_class_name: malloc failed"); + } /* end if */ + else { + buf_size = H5Eget_class_name((hid_t)cls_id, (char *)namePtr, (size_t)buf_size); + + if (buf_size < 0) { + HDfree(namePtr); + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR namePtr); + HDfree(namePtr); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + return str; +} /* end Java_hdf_hdf5lib_H5_H5Eget_1class_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eset_current_stack + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Eset_1current_1stack(JNIEnv *env, jclass cls, jlong stk_id) +{ + if (stk_id < 0) { + h5badArgument(env, "H5Eset_current_stack: invalid argument"); + } /* end if */ + else if (H5Eset_current_stack((hid_t)stk_id) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Eset_1current_1stack */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Epop + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Epop(JNIEnv *env, jclass cls, jlong stk_id, jlong count) +{ + if (stk_id < 0) { + h5badArgument(env, "H5Epop: invalid argument"); + } /* end if */ + else if (H5Epop((hid_t)stk_id, (size_t)count) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Epop */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Epush2 + * Signature: (JLjava/lang/String;Ljava/lang/String;IJJJLjava/lang/String;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Epush2(JNIEnv *env, jclass cls, jlong stk_id, jstring filename, jstring funcname, + jint linenumber, jlong class_id, jlong major_id, jlong minor_id, jstring err_desc) +{ + herr_t ret_val = -1; + const char* fName; + const char* fncName; + const char* errMsg; + + if (stk_id < 0) { + h5badArgument(env, "H5Epush: invalid argument"); + } /* end if */ + else if (class_id < 0) { + h5badArgument(env, "H5Epush: invalid class_id argument"); + } /* end else if */ + else if (major_id < 0) { + h5badArgument(env, "H5Epush: invalid major_id argument"); + } /* end else if */ + else if (minor_id < 0) { + h5badArgument(env, "H5Epush: invalid minor_id argument"); + } /* end else if */ + else { + PIN_JAVA_STRING_THREE0(filename, fName, funcname, fncName, err_desc, errMsg); + + ret_val = H5Epush2((hid_t)stk_id, fName, fncName, (unsigned)linenumber, (hid_t)class_id, + (hid_t)major_id, (hid_t)minor_id, errMsg); + + UNPIN_JAVA_STRING_THREE(filename, fName, funcname, fncName, err_desc, errMsg); + + if (ret_val < 0) + h5libraryError(env); + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Epush2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eclear2 + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Eclear2(JNIEnv *env, jclass cls, jlong stk_id) +{ + if (stk_id < 0) { + h5badArgument(env, "H5Eclear2: invalid argument"); + } /* end if */ + else if (H5Eclear2((hid_t)stk_id) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Eclear2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eget_msg + * Signature: (J[I)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Eget_1msg(JNIEnv *env, jclass cls, jlong msg_id, jintArray error_msg_type_list) +{ + char *namePtr; + jstring str = NULL; + jboolean isCopy; + ssize_t buf_size; + jint *theArray; + H5E_type_t error_msg_type; + + if (msg_id < 0) { + h5badArgument(env, "H5Eget_msg: invalid argument"); + } /* end if */ + else if (error_msg_type_list == NULL) { + h5nullArgument(env, "H5Eget_msg: error_msg_type_list is NULL"); + } /* end if */ + else { + /* get the length of the name */ + buf_size = H5Eget_msg((hid_t)msg_id, NULL, NULL, 0); + + if ((buf_size < 0) || (buf_size == 0)) { + h5JNIFatalError(env, "H5Eget_msg: Invalid message"); + } /* end if */ + else { + buf_size++; /* add extra space for the null terminator */ + namePtr = (char*)HDmalloc(sizeof(char) * (size_t)buf_size); + if (namePtr == NULL) { + h5outOfMemory(env, "H5Eget_msg: malloc failed"); + } /* end if */ + else { + theArray = (jint*)ENVPTR->GetIntArrayElements(ENVPAR error_msg_type_list, &isCopy); + if (theArray == NULL) { + HDfree(namePtr); + h5JNIFatalError(env, "H5Eget_msg: error_msg_type_list not pinned"); + } /* end if */ + else { + buf_size = H5Eget_msg((hid_t)msg_id, &error_msg_type, (char *)namePtr, (size_t)buf_size); + + if (buf_size < 0) { + HDfree(namePtr); + ENVPTR->ReleaseIntArrayElements(ENVPAR error_msg_type_list, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + theArray[0] = error_msg_type; + ENVPTR->ReleaseIntArrayElements(ENVPAR error_msg_type_list, theArray, 0); + + str = ENVPTR->NewStringUTF(ENVPAR namePtr); + HDfree(namePtr); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return str; +} /* end Java_hdf_hdf5lib_H5_H5Eget_1msg */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eget_num + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Eget_1num(JNIEnv *env, jclass cls, jlong stk_id) +{ + ssize_t ret_val = -1; + + if (stk_id < 0) { + h5badArgument(env, "H5Eget_num: invalid argument"); + } /* end if */ + else { + ret_val = H5Eget_num((hid_t)stk_id); + if (ret_val < 0) + h5libraryError(env); + } /* end else */ + return (jlong)ret_val; +} /* end Java_hdf_hdf5lib_H5_H5Eget_1num */ + +static herr_t +H5E_walk_cb(int nindx, const H5E_error2_t *info, void *op_data) +{ + JNIEnv *cbenv; + jint status = -1; + jclass cls; + jmethodID mid; + jstring str1, str2, str3; + jmethodID constructor; + jvalue args[7]; + jobject cb_info_t = NULL; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(ILhdf/hdf5lib/structs/H5E_error2_t;Lhdf/hdf5lib/callbacks/H5E_walk_t;)I"); + if (mid != 0) { + args[0].j = info->cls_id; + args[1].j = info->maj_num; + args[2].j = info->min_num; + args[3].i = (jint)info->line; + str1 = CBENVPTR->NewStringUTF(CBENVPAR info->func_name); + args[4].l = str1; + str2 = CBENVPTR->NewStringUTF(CBENVPAR info->file_name); + args[5].l = str2; + str3 = CBENVPTR->NewStringUTF(CBENVPAR info->desc); + args[6].l = str3; + // get a reference to your class if you don't have it already + cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5E_error2_t"); + if (cls != 0) { + // get a reference to the constructor; the name is + constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "", "(JJJILjava/lang/String;Ljava/lang/String;Ljava/lang/String;)V"); + if (constructor != 0) { + cb_info_t = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args); + + status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, nindx, cb_info_t, op_data); + } /* end if (constructor != 0) */ + } /* end if(cls != 0) */ + } /* end if (mid != 0) */ + } /* end if (cls != 0) */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + return (herr_t)status; +} /* end H5E_walk_cb */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ewalk2 + * Signature: (JJLjava/lang/Object;Ljava/lang/Object;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Ewalk2(JNIEnv *env, jclass cls, jlong stk_id, jlong direction, jobject callback_op, jobject op_data) +{ + ENVPTR->GetJavaVM(ENVPAR &jvm); + visit_callback = callback_op; + + if ((op_data == NULL) || (callback_op == NULL)) { + h5nullArgument(env, "H5Ewalk2: op_data or callback_op is NULL"); + } /* end if */ + else if (H5Ewalk2(stk_id, (H5E_direction_t)direction, (H5E_walk2_t)H5E_walk_cb, (void*)op_data) < 0) + h5libraryError(env); +} /* end iJava_hdf_hdf5lib_H5_H5Ewalk2f */ + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5eImp.h b/java/src/jni/h5eImp.h new file mode 100644 index 0000000..c40c013 --- /dev/null +++ b/java/src/jni/h5eImp.h @@ -0,0 +1,167 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5E */ + +#ifndef _Included_hdf_hdf5lib_H5_H5E +#define _Included_hdf_hdf5lib_H5_H5E + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eauto_is_v2 + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Eauto_1is_1v2 + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eregister_class + * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Eregister_1class + (JNIEnv *, jclass, jstring, jstring, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eunregister_class + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eunregister_1class + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eclose_msg + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eclose_1msg + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ecreate_msg + * Signature: (JILjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Ecreate_1msg + (JNIEnv *, jclass, jlong, jint, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ecreate_stack + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Ecreate_1stack + (JNIEnv *, jclass); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eget_current_stack + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Eget_1current_1stack + (JNIEnv *, jclass); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eclose_stack + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eclose_1stack + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eprint2 + * Signature: (JLjava/lang/Object;)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eprint2 + (JNIEnv *, jclass, jlong, jobject); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eget_class_name + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Eget_1class_1name + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eset_current_stack + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eset_1current_1stack + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Epop + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Epop + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Epush2 + * Signature: (JLjava/lang/String;Ljava/lang/String;IJJJLjava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Epush2 + (JNIEnv *, jclass, jlong, jstring, jstring, jint, jlong, jlong, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eclear2 + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Eclear2 + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eget_msg + * Signature: (J[I)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Eget_1msg + (JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Eget_num + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Eget_1num + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ewalk2 + * Signature: (JJLjava/lang/Object;Ljava/lang/Object;)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Ewalk2 + (JNIEnv *, jclass, jlong, jlong, jobject, jobject); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5E */ diff --git a/java/src/jni/h5fImp.c b/java/src/jni/h5fImp.c new file mode 100644 index 0000000..b484fb2 --- /dev/null +++ b/java/src/jni/h5fImp.c @@ -0,0 +1,516 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include +#include +#include "hdf5.h" +#include "h5fImp.h" +#include "h5util.h" + +extern JavaVM *jvm; +extern jobject visit_callback; + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fopen + * Signature: (Ljava/lang/String;IJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Fopen(JNIEnv *env, jclass clss, jstring name, jint flags, jlong access_id) +{ + hid_t status = -1; + const char *fileName; + + PIN_JAVA_STRING(name, fileName, -1); + + status = H5Fopen(fileName, (unsigned)flags, (hid_t)access_id ); + + UNPIN_JAVA_STRING(name, fileName); + + if (status < 0) + h5libraryError(env); + + return (jlong)status; +} /* end Java_hdf_hdf5lib_H5__1H5Fopen */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fcreate + * Signature: (Ljava/lang/String;IJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Fcreate(JNIEnv *env, jclass clss, jstring name, jint flags, jlong create_id, jlong access_id) +{ + hid_t status = -1; + const char *fileName; + + PIN_JAVA_STRING(name, fileName, -1); + + status = H5Fcreate(fileName, (unsigned)flags, create_id, access_id); + + UNPIN_JAVA_STRING(name, fileName); + + if (status < 0) + h5libraryError(env); + + return (jlong)status; +} /* end Java_hdf_hdf5lib_H5__1H5Fcreate */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fflush + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Fflush(JNIEnv *env, jclass clss, jlong object_id, jint scope) +{ + herr_t retVal = -1; + + retVal = H5Fflush((hid_t)object_id, (H5F_scope_t)scope ); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Fflush */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_name + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Fget_1name(JNIEnv *env, jclass cls, jlong file_id) +{ + char *namePtr; + jstring str = NULL; + ssize_t buf_size; + + /* get the length of the name */ + buf_size = H5Fget_name((hid_t)file_id, NULL, 0); + + if (buf_size <= 0) { + h5badArgument(env, "H5Fget_name: buf_size <= 0"); + } /* end if */ + else { + buf_size++; /* add extra space for the null terminator */ + namePtr = (char*)HDmalloc(sizeof(char) * (size_t)buf_size); + if (namePtr == NULL) { + h5outOfMemory(env, "H5Fget_name: malloc failed"); + } /* end if */ + else { + buf_size = H5Fget_name((hid_t)file_id, namePtr, (size_t)buf_size); + if (buf_size < 0) { + HDfree(namePtr); + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR namePtr); + HDfree(namePtr); + }/* end else */ + }/* end else */ + }/* end else */ + + return str; +} /* end Java_hdf_hdf5lib_H5_H5Fget_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fis_hdf5 + * Signature: (Ljava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Fis_1hdf5(JNIEnv *env, jclass clss, jstring name) +{ + htri_t bval = JNI_FALSE; + const char *fileName; + + PIN_JAVA_STRING(name, fileName, JNI_FALSE); + + bval = H5Fis_hdf5(fileName); + + UNPIN_JAVA_STRING(name, fileName); + + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Fis_1hdf5 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_create_plist + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Fget_1create_1plist(JNIEnv *env, jclass clss, jlong file_id) +{ + hid_t retVal = -1; + + retVal = H5Fget_create_plist((hid_t)file_id ); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Fget_1create_1plist */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_access_plist + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Fget_1access_1plist(JNIEnv *env, jclass clss, jlong file_id) +{ + hid_t retVal = -1; + + retVal = H5Fget_access_plist((hid_t)file_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Fget_1access_1plist */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_intent + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Fget_1intent(JNIEnv *env, jclass cls, jlong file_id) +{ + unsigned intent = 0; + + if (H5Fget_intent((hid_t)file_id, &intent) < 0) + h5libraryError(env); + + return (jint)intent; +} /* end Java_hdf_hdf5lib_H5_H5Fget_1intent */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5__1H5Fclose(JNIEnv *env, jclass clss, jlong file_id) +{ + herr_t status = -1; + + if (file_id > 0) + status = H5Fclose((hid_t)file_id ); + + if (status < 0) + h5libraryError(env); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5__1H5Fclose */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fmount + * Signature: (JLjava/lang/String;JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Fmount(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong child_id, jlong plist_id) +{ + herr_t status = -1; + const char *fileName; + + PIN_JAVA_STRING(name, fileName, -1); + + status = H5Fmount((hid_t)loc_id, fileName, (hid_t)child_id, (hid_t)plist_id); + + UNPIN_JAVA_STRING(name, fileName); + + if (status < 0) + h5libraryError(env); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Fmount */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Funmount + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Funmount(JNIEnv *env, jclass clss, jlong loc_id, jstring name) +{ + herr_t status = -1; + const char *fileName; + + PIN_JAVA_STRING(name, fileName, -1); + + status = H5Funmount((hid_t)loc_id, fileName); + + UNPIN_JAVA_STRING(name, fileName); + + if (status < 0) + h5libraryError(env); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Funmount */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_freespace + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Fget_1freespace(JNIEnv *env, jclass cls, jlong file_id) +{ + hssize_t ret_val = H5Fget_freespace((hid_t)file_id); + + if (ret_val < 0) + h5libraryError(env); + + return (jlong)ret_val; +} /* end Java_hdf_hdf5lib_H5_H5Fget_1freespace */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Freopen + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Freopen(JNIEnv *env, jclass clss, jlong file_id) +{ + hid_t retVal = -1; + + retVal = H5Freopen((hid_t)file_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Freopen */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_obj_ids + * Signature: (JIJ[J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids(JNIEnv *env, jclass cls, jlong file_id, jint types, jlong maxObjs, + jlongArray obj_id_list) +{ + ssize_t ret_val = -1; + jlong *obj_id_listP; + jboolean isCopy; + hid_t *id_list; + size_t rank; + size_t i; + + if (obj_id_list == NULL) { + h5nullArgument(env, "H5Fget_obj_ids: obj_id_list is NULL"); + } /* end if */ + else { + obj_id_listP = ENVPTR->GetLongArrayElements(ENVPAR obj_id_list, &isCopy); + if (obj_id_listP == NULL) { + h5JNIFatalError(env, "H5Fget_obj_ids: obj_id_list not pinned"); + } /* end if */ + else { + rank = (size_t)ENVPTR->GetArrayLength(ENVPAR obj_id_list); + + id_list = (hid_t *)HDmalloc(rank * sizeof(hid_t)); + if (id_list == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR obj_id_list, obj_id_listP, JNI_ABORT); + h5JNIFatalError(env, "H5Fget_obj_ids: obj_id_list not converted to hid_t"); + } /* end if */ + else { + ret_val = H5Fget_obj_ids((hid_t)file_id, (unsigned int)types, (size_t)maxObjs, id_list); + + if (ret_val < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR obj_id_list, obj_id_listP, JNI_ABORT); + HDfree(id_list); + h5libraryError(env); + } /* end if */ + else { + for (i = 0; i < rank; i++) { + obj_id_listP[i] = (jlong)id_list[i]; + } /* end for */ + HDfree(id_list); + ENVPTR->ReleaseLongArrayElements(ENVPAR obj_id_list, obj_id_listP, 0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jlong)ret_val; +} /* end Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_obj_count + * Signature: (JI)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Fget_1obj_1count(JNIEnv *env, jclass cls, jlong file_id, jint types) +{ + ssize_t ret_val = H5Fget_obj_count((hid_t)file_id, (unsigned int)types); + + if (ret_val < 0) + h5libraryError(env); + + return (jlong)ret_val; +} /* end Java_hdf_hdf5lib_H5_H5Fget_1obj_1count_1long */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_filesize + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Fget_1filesize(JNIEnv *env, jclass clss, jlong file_id) +{ + hsize_t size = 0; + + if (H5Fget_filesize ((hid_t)file_id, &size) < 0) + h5libraryError(env); + + return (jlong) size; +} /* end Java_hdf_hdf5lib_H5_H5Fget_1filesize */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_mdc_hit_rate + * Signature: (J)D + */ +JNIEXPORT jdouble JNICALL +Java_hdf_hdf5lib_H5_H5Fget_1mdc_1hit_1rate(JNIEnv *env, jclass cls, jlong file_id) +{ + double rate = 0.0; + + if (H5Fget_mdc_hit_rate((hid_t)file_id, &rate) < 0) + h5libraryError(env); + + return (jdouble)rate; +} /* end Java_hdf_hdf5lib_H5_H5Fget_1mdc_1hit_1rate */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_mdc_size + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Fget_1mdc_1size(JNIEnv *env, jclass cls, jlong file_id, jlongArray metadata_cache) +{ + jint size = 0; + jlong *metadata_cache_ptr; + size_t max_size = 0, min_clean_size = 0, cur_size = 0; + int cur_num_entries = -1; + jboolean isCopy; + + if (metadata_cache == NULL) { + h5nullArgument(env, "H5Fget_mdc_size: metadata_cache is NULL"); + } /* end if */ + else { + size = (int)ENVPTR->GetArrayLength(ENVPAR metadata_cache); + if (size < 3) { + h5badArgument(env, "H5Fget_mdc_size: length of metadata_cache < 3."); + } /* end if */ + else { + if (H5Fget_mdc_size((hid_t)file_id, &max_size, &min_clean_size, &cur_size, &cur_num_entries) < 0) { + h5libraryError(env); + } /* end if */ + else { + metadata_cache_ptr = ENVPTR->GetLongArrayElements(ENVPAR metadata_cache, &isCopy); + metadata_cache_ptr[0] = (jlong)max_size; + metadata_cache_ptr[1] = (jlong)min_clean_size; + metadata_cache_ptr[2] = (jlong)cur_size; + ENVPTR->ReleaseLongArrayElements(ENVPAR metadata_cache, metadata_cache_ptr, 0); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)cur_num_entries; +} /* end Java_hdf_hdf5lib_H5_H5Fget_1mdc_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_info + * Signature: (J)Lhdf/hdf5lib/structs/H5F_info2_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Fget_1info(JNIEnv *env, jclass clss, jlong obj_id) +{ + H5F_info2_t finfo; + jvalue args[9]; + jobject ihinfobuf; + jobject ret_obj = NULL; + + if (H5Fget_info2((hid_t)obj_id, &finfo) < 0) { + h5libraryError(env); + } /* end if */ + else { + args[0].j = (jlong)finfo.sohm.msgs_info.index_size; + args[1].j = (jlong)finfo.sohm.msgs_info.heap_size; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args); + ihinfobuf = ret_obj; + + args[0].i = (jint)finfo.super.version; + args[1].j = (jlong)finfo.super.super_size; + args[2].j = (jlong)finfo.super.super_ext_size; + args[3].i = (jint)finfo.free.version; + args[4].j = (jlong)finfo.free.meta_size; + args[5].j = (jlong)finfo.free.tot_space; + args[6].j = (jint)finfo.sohm.version; + args[7].j = (jlong)finfo.sohm.hdr_size; + args[8].l = ihinfobuf; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5F_info2_t", "(IJJIJJIJLhdf/hdf5lib/structs/H5_ih_info_t;)V", args); + } /* end else */ + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Fget_1info */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Freset_mdc_hit_rate_stats + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Freset_1mdc_1hit_1rate_1stats(JNIEnv *env, jclass cls, jlong file_id) +{ + if (H5Freset_mdc_hit_rate_stats((hid_t)file_id) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Freset_1mdc_1hit_1rate_1stats */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fclear_elink_file_cache + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache(JNIEnv *env, jclass cls, jlong file_id) +{ + if (H5Fclear_elink_file_cache((hid_t)file_id) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache */ + + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5fImp.h b/java/src/jni/h5fImp.h new file mode 100644 index 0000000..5a72fab --- /dev/null +++ b/java/src/jni/h5fImp.h @@ -0,0 +1,198 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5F */ + +#ifndef _Included_hdf_hdf5lib_H5_H5F +#define _Included_hdf_hdf5lib_H5_H5F + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fopen + * Signature: (Ljava/lang/String;IJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Fopen + (JNIEnv*, jclass, jstring, jint, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fcreate + * Signature: (Ljava/lang/String;IJJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Fcreate + (JNIEnv*, jclass, jstring, jint, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fflush + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Fflush + (JNIEnv*, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_name + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Fget_1name + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fis_hdf5 + * Signature: (Ljava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Fis_1hdf5 + (JNIEnv*, jclass, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_create_plist + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Fget_1create_1plist + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_access_plist + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Fget_1access_1plist + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_intent + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Fget_1intent + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Fclose + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fmount + * Signature: (JLjava/lang/String;JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Fmount + (JNIEnv*, jclass, jlong, jstring, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Funmount + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Funmount + (JNIEnv*, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_freespace + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Fget_1freespace + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Freopen + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Freopen + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_obj_ids + * Signature: (JIJ[J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Fget_1obj_1ids + (JNIEnv*, jclass, jlong, jint, jlong, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_obj_count + * Signature: (JI)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Fget_1obj_1count + (JNIEnv*, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_filesize + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Fget_1filesize + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_mdc_hit_rate + * Signature: (J)D + */ +JNIEXPORT jdouble JNICALL Java_hdf_hdf5lib_H5_H5Fget_1mdc_1hit_1rate + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_mdc_size + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Fget_1mdc_1size + (JNIEnv*, jclass, jlong, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Freset_mdc_hit_rate_stats + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Freset_1mdc_1hit_1rate_1stats + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fget_info + * Signature: (J)Lhdf/hdf5lib/structs/H5F_info2_t; + */ +JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Fget_1info + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Fclear_elink_file_cache + * Signature: (J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Fclear_1elink_1file_1cache + (JNIEnv *, jclass, jlong); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5F */ diff --git a/java/src/jni/h5gImp.c b/java/src/jni/h5gImp.c new file mode 100644 index 0000000..632942a --- /dev/null +++ b/java/src/jni/h5gImp.c @@ -0,0 +1,257 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include +#include +#include +#include "hdf5.h" +#include "h5util.h" +#include "h5gImp.h" + +extern JavaVM *jvm; +extern jobject visit_callback; + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Gclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5__1H5Gclose(JNIEnv *env, jclass clss, jlong group_id) +{ + herr_t retVal = -1; + + retVal = H5Gclose((hid_t)group_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Gclose */ + +/* + * Create a java object of hdf.h5.structs.H5G_info_t + * public class H5G_info_t { + * public H5G_STORAGE_TYPE storage_type; // Type of storage for links in group + * public long nlinks; // Number of links in group + * public long max_corder; // Current max. creation order value for group + * public int mounted; // Whether group has a file mounted on it + * } + * + */ +jobject +create_H5G_info_t(JNIEnv *env, H5G_info_t group_info) +{ + jclass cls; + jboolean jmounted; + jint storage_type; + jobject obj; + jfieldID fid_storage_type, fid_nlinks, fid_max_corder, fid_mounted; + + cls = ENVPTR->FindClass(ENVPAR "hdf/hdf5lib/structs/H5G_info_t"); + if (cls == NULL) + return NULL; + + obj = ENVPTR->AllocObject(ENVPAR cls); + if (obj == NULL) + return NULL; + + fid_storage_type = ENVPTR->GetFieldID(ENVPAR cls, "storage_type", "I"); + fid_nlinks = ENVPTR->GetFieldID(ENVPAR cls, "nlinks", "J"); + fid_max_corder = ENVPTR->GetFieldID(ENVPAR cls, "max_corder", "J"); + fid_mounted = ENVPTR->GetFieldID(ENVPAR cls, "mounted", "Z"); + + if (fid_storage_type==NULL || fid_nlinks==NULL || fid_max_corder==NULL || fid_mounted == NULL) + return NULL; + + jmounted = (group_info.mounted==0) ? JNI_FALSE : JNI_TRUE; + storage_type = (jint)group_info.storage_type; + + ENVPTR->SetIntField(ENVPAR obj, fid_storage_type, (jint)storage_type); + ENVPTR->SetLongField(ENVPAR obj, fid_nlinks, (jlong)group_info.nlinks); + ENVPTR->SetLongField(ENVPAR obj, fid_max_corder, (jlong)group_info.max_corder); + ENVPTR->SetBooleanField(ENVPAR obj, fid_mounted, jmounted); + + return obj; +} /* end create_H5G_info_t */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Gcreate2 + * Signature: (JLjava/lang/String;JJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Gcreate2(JNIEnv *env, jclass clss, jlong loc_id, jstring name, + jlong link_plist_id, jlong create_plist_id, jlong access_plist_id) +{ + hid_t group_id = -1; + const char *gName; + + PIN_JAVA_STRING(name, gName, -1); + + group_id = H5Gcreate2((hid_t)loc_id, gName, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id ); + + UNPIN_JAVA_STRING(name, gName); + if (group_id < 0) + h5libraryError(env); + + return (jlong)group_id; +} /* end Java_hdf_hdf5lib_H5__1H5Gcreate2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Gcreate_anon + * Signature: (JJJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Gcreate_1anon(JNIEnv *env, jclass cls, jlong loc_id, jlong gcpl_id, jlong gapl_id) +{ + hid_t group_id = -1; + + group_id = H5Gcreate_anon((hid_t)loc_id, (hid_t)gcpl_id, (hid_t)gapl_id); + if (group_id < 0) + h5libraryError(env); + + return (jlong)group_id; +} /* end JNICALL */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Gopen2 + * Signature: (JLjava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Gopen2(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist_id) +{ + hid_t group_id = -1; + const char *gName; + + PIN_JAVA_STRING(name, gName, -1); + + group_id = H5Gopen2((hid_t)loc_id, gName, (hid_t)access_plist_id ); + + UNPIN_JAVA_STRING(name, gName); + + if (group_id < 0) + h5libraryError(env); + + return (jlong)group_id; +} /* end Java_hdf_hdf5lib_H5__1H5Gopen2 */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Gget_create_plist + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Gget_1create_1plist(JNIEnv *env, jclass cls, jlong loc_id) +{ + hid_t plist_id = H5Gget_create_plist((hid_t)loc_id); + + if (plist_id < 0) + h5libraryError(env); + + return (jlong)plist_id; +} /* end Java_hdf_hdf5lib_H5_H5Gget_1create_1plist */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Gget_info + * Signature: (J)Lhdf/hdf5lib/structs/H5G_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Gget_1info(JNIEnv *env, jclass cls, jlong loc_id) +{ + H5G_info_t group_info; + + if (H5Gget_info((hid_t)loc_id, &group_info) < 0) { + h5libraryError(env); + return NULL; + } /* end if */ + + return create_H5G_info_t(env, group_info); +} /* end Java_hdf_hdf5lib_H5_H5Gget_1info */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Gget_info_by_name + * Signature: (JLjava/lang/String;J)Lhdf/hdf5lib/structs/H5G_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1name(JNIEnv *env, jclass cls, jlong loc_id, jstring name, jlong lapl_id) +{ + herr_t ret_val = -1; + const char *gName; + H5G_info_t group_info; + + PIN_JAVA_STRING(name, gName, NULL); + + ret_val = H5Gget_info_by_name((hid_t)loc_id, gName, &group_info, (hid_t)lapl_id); + + UNPIN_JAVA_STRING(name, gName); + + if (ret_val < 0) { + h5libraryError(env); + return NULL; + } /* end if */ + + return create_H5G_info_t(env, group_info); +} /* end Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Gget_info_by_idx + * Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5G_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx(JNIEnv *env, jclass cls, jlong loc_id, jstring name, jint index_type, + jint order, jlong n, jlong lapl_id) +{ + herr_t ret_val = -1; + const char *gName; + H5G_info_t group_info; + H5_index_t cindex_type = (H5_index_t)index_type; + H5_iter_order_t corder = (H5_iter_order_t)order; + + PIN_JAVA_STRING(name, gName, NULL); + + ret_val = H5Gget_info_by_idx((hid_t)loc_id, gName, cindex_type, + corder, (hsize_t)n, &group_info, (hid_t)lapl_id); + + UNPIN_JAVA_STRING(name, gName); + + if (ret_val < 0) { + h5libraryError(env); + return NULL; + } /* end if */ + + return create_H5G_info_t(env, group_info); +} /* end Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx */ + + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5gImp.h b/java/src/jni/h5gImp.h new file mode 100644 index 0000000..2b9bc57 --- /dev/null +++ b/java/src/jni/h5gImp.h @@ -0,0 +1,96 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5G */ + +#ifndef _Included_hdf_hdf5lib_H5_H5G +#define _Included_hdf_hdf5lib_H5_H5G + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Gclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Gclose + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Gcreate2 + * Signature: (JLjava/lang/String;JJJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Gcreate2 + (JNIEnv*, jclass, jlong, jstring, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Gcreate_anon + * Signature: (JJJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Gcreate_1anon + (JNIEnv*, jclass, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Gopen2 + * Signature: (JLjava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Gopen2 + (JNIEnv*, jclass, jlong, jstring, jlong); + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Gget_create_plist + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Gget_1create_1plist +(JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Gget_info + * Signature: (J)Lhdf/hdf5lib/structs/H5G_info_t; + */ +JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Gget_1info + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Gget_info_by_name + * Signature: (JLjava/lang/String;J)Lhdf/hdf5lib/structs/H5G_info_t; + */ +JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1name + (JNIEnv*, jclass, jlong, jstring, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Gget_info_by_idx + * Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5G_info_t; + */ +JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Gget_1info_1by_1idx + (JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jlong); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5G */ diff --git a/java/src/jni/h5iImp.c b/java/src/jni/h5iImp.c new file mode 100644 index 0000000..e7d663f --- /dev/null +++ b/java/src/jni/h5iImp.c @@ -0,0 +1,289 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "hdf5.h" +#include +#include +#include "h5jni.h" +#include "h5iImp.h" + +extern JavaVM *jvm; +extern jobject visit_callback; + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iget_type + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Iget_1type(JNIEnv *env, jclass clss, jlong obj_id) +{ + H5I_type_t retVal = H5I_BADID; + + retVal = H5Iget_type((hid_t)obj_id); + if (retVal == H5I_BADID) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Iget_1type */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iget_name + * Signature: (JLjava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Iget_1name(JNIEnv *env, jclass clss, jlong obj_id, jobjectArray name, jlong buf_size) +{ + char *aName; + jstring str; + hssize_t size = -1; + long bs; + + bs = (long)buf_size; + if (bs <= 0) { + h5badArgument(env, "H5Iget_name: buf_size <= 0"); + } /* end if */ + else { + aName = (char*)HDmalloc(sizeof(char) * (size_t)bs); + if (aName == NULL) { + h5outOfMemory(env, "H5Iget_name: malloc failed"); + } /* end if */ + else { + size = H5Iget_name((hid_t)obj_id, aName, (size_t)buf_size); + if (size < 0) { + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR aName); + ENVPTR->SetObjectArrayElement(ENVPAR name, 0, str); + } + HDfree(aName); + } + } + return (jlong)size; +} /* end Java_hdf_hdf5lib_H5_H5Iget_1name */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iget_ref + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Iget_1ref(JNIEnv *env, jclass clss, jlong obj_id) +{ + int retVal = -1; + + retVal = H5Iget_ref((hid_t)obj_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Iget_1ref */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iinc_ref + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Iinc_1ref(JNIEnv *env, jclass clss, jlong obj_id) +{ + int retVal = -1; + + retVal = H5Iinc_ref((hid_t)obj_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Iinc_1ref */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Idec_1ref + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Idec_1ref(JNIEnv *env, jclass clss, jlong obj_id) +{ + int retVal = -1; + + retVal = H5Idec_ref((hid_t)obj_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Idec_1ref */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iget_file_id + * Signature: (J)J + */ + +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Iget_1file_1id(JNIEnv *env, jclass clss, jlong obj_id) +{ + hid_t file_id = -1; + + file_id = H5Iget_file_id((hid_t)obj_id); + if (file_id < 0) + h5libraryError(env); + + return (jlong) file_id; +} /* end Java_hdf_hdf5lib_H5_H5Iget_1file_1id */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iget_type_ref + * Signature: (I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Iget_1type_1ref(JNIEnv *env, jclass clss, jint type) +{ + int retVal = -1; + + retVal = H5Iget_type_ref((H5I_type_t)type); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Iget_1type_1ref */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Idec_type_ref + * Signature: (I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Idec_1type_1ref(JNIEnv *env, jclass clss, jint type) +{ + int retVal = -1; + + retVal = H5Idec_type_ref((H5I_type_t)type); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Idec_1type_1ref */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iinc_type_ref + * Signature: (I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Iinc_1type_1ref(JNIEnv *env, jclass clss, jint type) +{ + int retVal = -1; + + retVal = H5Iinc_type_ref((H5I_type_t)type); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Iinc_1type_1ref */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Inmembers + * Signature: (I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Inmembers(JNIEnv *env, jclass clss, jint type) +{ + hsize_t num_members; + + if (H5Inmembers((H5I_type_t)type, &num_members) < 0) + h5libraryError(env); + + return (jint)num_members; +} /* end Java_hdf_hdf5lib_H5_H5Inmembers */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iis_valid + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Iis_1valid(JNIEnv *env, jclass clss, jlong obj_id) +{ + htri_t bval = JNI_FALSE; + + bval = H5Iis_valid((hid_t)obj_id); + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Iis_1valid */ +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Itype_exists + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Itype_1exists(JNIEnv *env, jclass clss, jint type) +{ + htri_t bval = JNI_FALSE; + + bval = H5Itype_exists((H5I_type_t)type); + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end else Java_hdf_hdf5lib_H5_H5Itype_1exists */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iclear_type + * Signature: (IZ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Iclear_1type(JNIEnv *env, jclass clss, jint type, jboolean force) +{ + if (H5Iclear_type((H5I_type_t)type, (hbool_t)force) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Iclear_1type */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Idestroy_type + * Signature: (I)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Idestroy_1type(JNIEnv *env, jclass clss, jint type) +{ + if (H5Idestroy_type((H5I_type_t)type) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Idestroy_1type */ + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5iImp.h b/java/src/jni/h5iImp.h new file mode 100644 index 0000000..fe36b5b --- /dev/null +++ b/java/src/jni/h5iImp.h @@ -0,0 +1,143 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5I */ + +#ifndef _Included_hdf_hdf5lib_H5_H5I +#define _Included_hdf_hdf5lib_H5_H5I + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iget_type + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Iget_1type + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iget_name + * Signature: (JLjava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Iget_1name + (JNIEnv*, jclass, jlong, jobjectArray, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iget_ref + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Iget_1ref + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iinc_ref + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Iinc_1ref + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Idec_1ref + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Idec_1ref + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iget_file_id + * Signature: (J)J + */ + +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Iget_1file_1id + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iget_type_ref + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Iget_1type_1ref + (JNIEnv*, jclass, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Idec_type_ref + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Idec_1type_1ref + (JNIEnv*, jclass, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iinc_type_ref + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Iinc_1type_1ref + (JNIEnv*, jclass, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Inmembers + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Inmembers + (JNIEnv*, jclass, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iis_valid + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Iis_1valid + (JNIEnv*, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Itype_exists + * Signature: (I)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Itype_1exists + (JNIEnv*, jclass, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Iclear_type + * Signature: (IZ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Iclear_1type + (JNIEnv*, jclass, jint, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Idestroy_type + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Idestroy_1type + (JNIEnv*, jclass, jint); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5I */ diff --git a/java/src/jni/h5jni.h b/java/src/jni/h5jni.h new file mode 100644 index 0000000..da49eeb --- /dev/null +++ b/java/src/jni/h5jni.h @@ -0,0 +1,249 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#include +#include "H5version.h" +#include +#include "H5private.h" + +#ifndef _Included_h5jni +#define _Included_h5jni + +#ifdef __cplusplus + #define ENVPTR (env) + #define ENVPAR + #define ENVONLY + #define CBENVPTR (cbenv) + #define CBENVPAR + #define JVMPTR (jvm) + #define JVMPAR + #define JVMPAR2 +#else /* __cplusplus */ + #define ENVPTR (*env) + #define ENVPAR env, + #define ENVONLY env + #define CBENVPTR (*cbenv) + #define CBENVPAR cbenv, + #define JVMPTR (*jvm) + #define JVMPAR jvm + #define JVMPAR2 jvm, +#endif /* __cplusplus */ + +/* Macros for class access */ +/* Calling code must define ret_obj as jobject */ +#define CALL_CONSTRUCTOR(classname,classsig,args) { \ + jclass cls; \ + jmethodID constructor; \ + cls = ENVPTR->FindClass(ENVPAR (classname)); \ + if (cls == 0) { \ + h5JNIFatalError(env, "JNI error: GetObjectClass\n"); \ + ret_obj = NULL; \ + } \ + constructor = ENVPTR->GetMethodID(ENVPAR cls, "", (classsig)); \ + if (constructor == 0) { \ + h5JNIFatalError(env, "JNI error: GetMethodID failed\n"); \ + ret_obj = NULL; \ + } \ + ret_obj = ENVPTR->NewObjectA(ENVPAR cls, constructor, (args)); \ +} + + +/* Macros for string access */ +#define PIN_JAVA_STRING(javastr,localstr,retdefault) { \ + jboolean isCopy; \ + if ((javastr) == NULL) { \ + h5nullArgument(env, "java string is NULL"); \ + return (retdefault); \ + } \ + (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy); \ + if ((localstr) == NULL) { \ + h5JNIFatalError(env, "local c string is not pinned"); \ + return (retdefault); \ + } \ +} + +#define PIN_JAVA_STRING0(javastr,localstr) { \ + jboolean isCopy; \ + if ((javastr) == NULL) { \ + h5nullArgument(env, "java string is NULL"); \ + return; \ + } \ + (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy); \ + if ((localstr) == NULL) { \ + h5JNIFatalError(env, "local c string is not pinned"); \ + return; \ + } \ +} + +#define UNPIN_JAVA_STRING(javastr,localstr) { \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \ +} + +#define PIN_JAVA_STRING_TWO(javastr,localstr,java2str,local2str,retdefault) { \ + jboolean isCopy; \ + if ((javastr) == NULL) { \ + h5nullArgument(env, "java string is NULL"); \ + return (retdefault); \ + } \ + if ((java2str) == NULL) { \ + h5nullArgument(env, "second java string is NULL"); \ + return (retdefault); \ + } \ + (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy); \ + if ((localstr) == NULL) { \ + h5JNIFatalError(env, "local c string is not pinned"); \ + return (retdefault); \ + } \ + (local2str) = ENVPTR->GetStringUTFChars(ENVPAR (java2str), &isCopy); \ + if ((local2str) == NULL) { \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \ + h5JNIFatalError(env, "second local c string is not pinned"); \ + return (retdefault); \ + } \ +} + +#define PIN_JAVA_STRING_TWO0(javastr,localstr,java2str,local2str) { \ + jboolean isCopy; \ + if ((javastr) == NULL) { \ + h5nullArgument(env, "java string is NULL"); \ + return; \ + } \ + if ((java2str) == NULL) { \ + h5nullArgument(env, "second java string is NULL"); \ + return; \ + } \ + (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy); \ + if ((localstr) == NULL) { \ + h5JNIFatalError(env, "local c string is not pinned"); \ + return; \ + } \ + (local2str) = ENVPTR->GetStringUTFChars(ENVPAR (java2str), &isCopy); \ + if ((local2str) == NULL) { \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \ + h5JNIFatalError(env, "second local c string is not pinned"); \ + return; \ + } \ +} + +#define UNPIN_JAVA_STRING_TWO(javastr,localstr,java2str,local2str) { \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (java2str), (local2str)); \ +} + +#define PIN_JAVA_STRING_THREE(javastr,localstr,java2str,local2str,java3str,local3str,retdefault) { \ + jboolean isCopy; \ + if ((javastr) == NULL) { \ + h5nullArgument(env, "java string is NULL"); \ + return (retdefault); \ + } \ + if ((java2str) == NULL) { \ + h5nullArgument(env, "second java string is NULL"); \ + return (retdefault); \ + } \ + if ((java3str) == NULL) { \ + h5nullArgument(env, "third java string is NULL"); \ + return (retdefault); \ + } \ + (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy); \ + if ((localstr) == NULL) { \ + h5JNIFatalError(env, "local c string is not pinned"); \ + return (retdefault); \ + } \ + (local2str) = ENVPTR->GetStringUTFChars(ENVPAR (java2str), &isCopy); \ + if ((local2str) == NULL) { \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \ + h5JNIFatalError(env, "second local c string is not pinned"); \ + return (retdefault); \ + } \ + (local3str) = ENVPTR->GetStringUTFChars(ENVPAR (java3str), &isCopy); \ + if ((local3str) == NULL) { \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (java2str), (local2str)); \ + h5JNIFatalError(env, "third local c string is not pinned"); \ + return (retdefault); \ + } \ +} + +#define PIN_JAVA_STRING_THREE0(javastr,localstr,java2str,local2str,java3str,local3str) { \ + jboolean isCopy; \ + if ((javastr) == NULL) { \ + h5nullArgument(env, "java string is NULL"); \ + return; \ + } \ + if ((java2str) == NULL) { \ + h5nullArgument(env, "second java string is NULL"); \ + return; \ + } \ + if ((java3str) == NULL) { \ + h5nullArgument(env, "third java string is NULL"); \ + return; \ + } \ + (localstr) = ENVPTR->GetStringUTFChars(ENVPAR (javastr), &isCopy); \ + if ((localstr) == NULL) { \ + h5JNIFatalError(env, "local c string is not pinned"); \ + return; \ + } \ + (local2str) = ENVPTR->GetStringUTFChars(ENVPAR (java2str), &isCopy); \ + if ((local2str) == NULL) { \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \ + h5JNIFatalError(env, "second local c string is not pinned"); \ + return; \ + } \ + (local3str) = ENVPTR->GetStringUTFChars(ENVPAR (java3str), &isCopy); \ + if ((local3str) == NULL) { \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (java2str), (local2str)); \ + h5JNIFatalError(env, "third local c string is not pinned"); \ + return; \ + } \ +} + +#define UNPIN_JAVA_STRING_THREE(javastr,localstr,java2str,local2str,java3str,local3str) { \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (javastr), (localstr)); \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (java2str), (local2str)); \ + ENVPTR->ReleaseStringUTFChars(ENVPAR (java3str), (local3str)); \ +} + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +extern jboolean h5JNIFatalError(JNIEnv *, const char *); +extern jboolean h5nullArgument(JNIEnv *, const char *); +extern jboolean h5badArgument (JNIEnv *, const char *); +extern jboolean h5outOfMemory (JNIEnv *, const char *); +extern jboolean h5libraryError(JNIEnv *env ); +extern jboolean h5raiseException(JNIEnv *, const char *, const char *); +extern jboolean h5unimplemented( JNIEnv *env, const char *functName); + +/* implemented at H5.c */ +extern jint get_enum_value(JNIEnv *env, jobject enum_obj); +extern jobject get_enum_object(JNIEnv *env, const char* enum_class_name, + jint enum_val, const char* enum_field_desc); + +/* implemented at H5G.c */ +extern jobject create_H5G_info_t(JNIEnv *env, H5G_info_t group_info); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_h5jni */ diff --git a/java/src/jni/h5lImp.c b/java/src/jni/h5lImp.c new file mode 100644 index 0000000..739e43b --- /dev/null +++ b/java/src/jni/h5lImp.c @@ -0,0 +1,736 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include +#include "hdf5.h" +#include "h5jni.h" +#include "h5lImp.h" + +extern JavaVM *jvm; +extern jobject visit_callback; + +/********************/ +/* Local Prototypes */ +/********************/ + +static herr_t H5L_iterate_cb(hid_t g_id, const char *name, const H5L_info_t *info, void *op_data); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lcopy + * Signature: (JLjava/lang/String;JLjava/lang/String;JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Lcopy(JNIEnv *env, jclass clss, jlong cur_loc_id, jstring cur_name, jlong dst_loc_id, + jstring dst_name, jlong create_id, jlong access_id) +{ + herr_t status = -1; + const char *lCurName; + const char *lDstName; + + PIN_JAVA_STRING_TWO0(cur_name, lCurName, dst_name, lDstName); + + status = H5Lcopy((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id); + + UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Lcopy */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lcreate_external + * Signature: (Ljava/lang/String;Ljava/lang/String;JLjava/lang/String;JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Lcreate_1external(JNIEnv *env, jclass clss, jstring file_name, jstring cur_name, + jlong dst_loc_id, jstring dst_name, jlong create_id, jlong access_id) +{ + herr_t status = -1; + const char *lFileName; + const char *lCurName; + const char *lDstName; + + PIN_JAVA_STRING_THREE0(file_name, lFileName, cur_name, lCurName, dst_name, lDstName); + + status = H5Lcreate_external(lFileName, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id); + + UNPIN_JAVA_STRING_THREE(file_name, lFileName, cur_name, lCurName, dst_name, lDstName); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Lcreate_1external */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lcreate_hard + * Signature: (JLjava/lang/String;JLjava/lang/String;JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Lcreate_1hard(JNIEnv *env, jclass clss, jlong cur_loc_id, jstring cur_name, + jlong dst_loc_id, jstring dst_name, jlong create_id, jlong access_id) +{ + herr_t status = -1; + const char *lCurName; + const char *lDstName; + + PIN_JAVA_STRING_TWO0(cur_name, lCurName, dst_name, lDstName); + + status = H5Lcreate_hard((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id); + + UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Lcreate_1hard */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lcreate_soft + * Signature: (Ljava/lang/String;JLjava/lang/String;JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Lcreate_1soft(JNIEnv *env, jclass clss, jstring cur_name, jlong dst_loc_id, + jstring dst_name, jlong create_id, jlong access_id) +{ + herr_t status = -1; + const char *lCurName; + const char *lDstName; + + PIN_JAVA_STRING_TWO0(cur_name, lCurName, dst_name, lDstName); + + status = H5Lcreate_soft(lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id); + + UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Lcreate_1soft */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ldelete + * Signature: (JLjava/lang/String;J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Ldelete(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id) +{ + herr_t status = -1; + const char *lName; + + PIN_JAVA_STRING0(name, lName); + + status = H5Ldelete((hid_t)loc_id, lName, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Ldelete */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ldelete_by_idx + * Signature: (JLjava/lang/String;IIJJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Ldelete_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring name, + jint index_field, jint order, jlong link_n, jlong access_id) +{ + hsize_t n = (hsize_t)link_n; + herr_t status; + const char *lName; + + PIN_JAVA_STRING0(name, lName); + + status = H5Ldelete_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, n, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Ldelete_1by_1idx */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lexists + * Signature: (JLjava/lang/String;J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Lexists(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id) +{ + htri_t bval = JNI_FALSE; + const char *lName; + + PIN_JAVA_STRING(name, lName, JNI_FALSE); + + bval = H5Lexists((hid_t)loc_id, lName, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Lexists */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lget_info + * Signature: (JLjava/lang/String;J)Lhdf/hdf5lib/structs/H5L_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Lget_1info(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id) +{ + jobject ret_obj = NULL; + jvalue args[5]; + herr_t status; + H5L_info_t infobuf; + const char *lName; + + PIN_JAVA_STRING(name, lName, NULL); + + status = H5Lget_info((hid_t)loc_id, lName, &infobuf, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status < 0) { + h5libraryError(env); + } /* end if */ + else { + args[0].i = infobuf.type; + args[1].z = infobuf.corder_valid; + args[2].j = infobuf.corder; + args[3].i = infobuf.cset; + if(infobuf.type==0) + args[4].j = (jlong)infobuf.u.address; + else + args[4].j = (jlong)infobuf.u.val_size; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5L_info_t", "(IZJIJ)V", args); + } /* end else */ + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Lget_1info */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lget_info_by_idx + * Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5L_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Lget_1info_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring name, + jint index_field, jint order, jlong link_n, jlong access_id) +{ + jobject ret_obj = NULL; + jvalue args[5]; + herr_t status; + H5L_info_t infobuf; + const char *lName; + + PIN_JAVA_STRING(name, lName, NULL); + + status = H5Lget_info_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status < 0) { + h5libraryError(env); + } /* end if */ + else { + args[0].i = infobuf.type; + args[1].z = infobuf.corder_valid; + args[2].j = infobuf.corder; + args[3].i = infobuf.cset; + if(infobuf.type==0) + args[4].j = (jlong)infobuf.u.address; + else + args[4].j = (jlong)infobuf.u.val_size; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5L_info_t", "(IZJIJ)V", args); + } /* end els */ + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Lget_1info_1by_1idx */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lget_name_by_idx + * Signature: (JLjava/lang/String;IIJJ)Ljava/lang/String; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Lget_1name_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring name, + jint index_field, jint order, jlong link_n, jlong access_id) +{ + jlong status_size; + jstring str = NULL; + size_t buf_size; + const char *lName; + char *lValue; + + PIN_JAVA_STRING(name, lName, NULL); + + /* get the length of the link name */ + status_size = H5Lget_name_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (char*)NULL, (size_t)0, H5P_DEFAULT); + if(status_size < 0) { + UNPIN_JAVA_STRING(name, lName); + h5libraryError(env); + } /* end if */ + else { + buf_size = (size_t)status_size + 1;/* add extra space for the null terminator */ + + lValue = (char*)HDmalloc(sizeof(char) * buf_size); + if (lValue == NULL) { + UNPIN_JAVA_STRING(name, lName); + h5outOfMemory(env, "H5Lget_name_by_idx: malloc failed "); + } /* end if */ + else { + status_size = H5Lget_name_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (char*)lValue, (size_t)buf_size, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status_size < 0) { + HDfree(lValue); + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR lValue); + HDfree(lValue); + if (str == NULL) + h5JNIFatalError(env, "H5Lget_name_by_idx: return string not created"); + } /* end else */ + } /* end else */ + } /* end else */ + return str; +} /* end Java_hdf_hdf5lib_H5_H5Lget_1name_1by_1idx */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lget_value + * Signature: (JLjava/lang/String;[Ljava/lang/String;J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Lget_1value(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jobjectArray link_value, jlong access_id) +{ + size_t buf_size; + herr_t status; + H5L_info_t infobuf; + const char *lName; + char *lValue; + const char *file_name; + const char *obj_name; + jstring str; + + PIN_JAVA_STRING(name, lName, -1); + + infobuf.type = -1; + /* get the length of the link val */ + status = H5Lget_info((hid_t)loc_id, lName, &infobuf, H5P_DEFAULT); + if(status < 0) { + UNPIN_JAVA_STRING(name, lName); + h5libraryError(env); + } /* end if */ + else { + buf_size = infobuf.u.val_size + 1;/* add extra space for the null terminator */ + + if(infobuf.type == H5L_TYPE_HARD) { + UNPIN_JAVA_STRING(name, lName); + h5JNIFatalError(env, "H5Lget_val: link is hard type"); + } /* end if */ + else { + lValue = (char*)HDmalloc(sizeof(char) * buf_size); + if (lValue == NULL) { + UNPIN_JAVA_STRING(name, lName); + h5outOfMemory(env, "H5Lget_val: malloc failed"); + } /* end if */ + else { + status = H5Lget_val((hid_t)loc_id, lName, (void*)lValue, buf_size, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status < 0) { + HDfree(lValue); + h5libraryError(env); + } /* end if */ + else if(infobuf.type == H5L_TYPE_EXTERNAL) { + status = H5Lunpack_elink_val(lValue, (size_t)infobuf.u.val_size, (unsigned*)NULL, &file_name, &obj_name); + if (status < 0) { + HDfree(lValue); + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR obj_name); + if (str == NULL) { + HDfree(lValue); + h5JNIFatalError(env, "H5Lget_val: return string not created"); + } /* end if */ + else { + ENVPTR->SetObjectArrayElement(ENVPAR link_value, 0, str); + + str = ENVPTR->NewStringUTF(ENVPAR file_name); + if (str == NULL) { + HDfree(lValue); + h5JNIFatalError(env, "H5Lget_val: return string not created"); + } /* end if */ + else { + ENVPTR->SetObjectArrayElement(ENVPAR link_value, 1, str); + HDfree(lValue); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR lValue); + if (str == NULL) { + /* exception -- fatal JNI error */ + HDfree(lValue); + h5JNIFatalError(env, "H5Lget_val: return string not created"); + } /* end if */ + else { + ENVPTR->SetObjectArrayElement(ENVPAR link_value, 0, str); + HDfree(lValue); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return infobuf.type; +} /* end Java_hdf_hdf5lib_H5_H5Lget_1val */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lget_value_by_idx + * Signature: (JLjava/lang/String;IIJ[Ljava/lang/String;J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Lget_1value_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jint index_field, jint order, + jlong link_n, jobjectArray link_value, jlong access_id) +{ + herr_t status; + size_t buf_size; + H5L_info_t infobuf; + const char *lName; + void *lValue; + const char *file_name; + const char *obj_name; + jstring str; + + PIN_JAVA_STRING(name, lName, -1); + + infobuf.type = -1; + /* get the length of the link valuee */ + status = H5Lget_info_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (hid_t)access_id); + if(status < 0) { + UNPIN_JAVA_STRING(name, lName); + h5libraryError(env); + return -1; + } /* end if */ + else { + buf_size = infobuf.u.val_size; + if(buf_size < 0) { + UNPIN_JAVA_STRING(name, lName); + h5libraryError(env); + return -1; + } /* end if */ + else { + lValue = (void*)HDmalloc(buf_size); + if (lValue == NULL) { + UNPIN_JAVA_STRING(name, lName); + h5outOfMemory(env, "H5Lget_val_by_idx: malloc failed "); + return -1; + } /* end if */ + else { + status = H5Lget_val_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (void*)lValue, (size_t)buf_size, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status < 0) { + HDfree(lValue); + h5libraryError(env); + } /* end if */ + else if(infobuf.type == H5L_TYPE_EXTERNAL) { + status = H5Lunpack_elink_val((char*)lValue, (size_t)infobuf.u.val_size, (unsigned*)NULL, (const char**)&file_name, (const char**)&obj_name); + if (status < 0) { + HDfree(lValue); + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR obj_name); + if (str == NULL) { + HDfree(lValue); + h5JNIFatalError(env, "H5Lget_val_by_idx: return string not created"); + } /* end if */ + else { + ENVPTR->SetObjectArrayElement(ENVPAR link_value, 0, str); + + str = ENVPTR->NewStringUTF(ENVPAR file_name); + if (str == NULL) { + HDfree(lValue); + h5JNIFatalError(env, "H5Lget_val_by_idx: return string not created"); + } /* end if */ + else { + ENVPTR->SetObjectArrayElement(ENVPAR link_value, 1, str); + HDfree(lValue); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR (char *)lValue); + if (str == NULL) { + HDfree(lValue); + h5JNIFatalError(env, "H5Lget_val_by_idx: return string not created"); + } /* end if */ + else { + ENVPTR->SetObjectArrayElement(ENVPAR link_value, 0, str); + HDfree(lValue); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + return infobuf.type; +} /* end Java_hdf_hdf5lib_H5_H5Lget_1val_1by_1idx */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lmove + * Signature: (JLjava/lang/String;JLjava/lang/String;JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Lmove(JNIEnv *env, jclass clss, jlong cur_loc_id, jstring cur_name, + jlong dst_loc_id, jstring dst_name, jlong create_id, jlong access_id) +{ + herr_t status = -1; + const char *lCurName; + const char *lDstName; + + PIN_JAVA_STRING_TWO0(cur_name, lCurName, dst_name, lDstName); + + status = H5Lmove((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id); + + UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName); + + if (status < 0) + h5libraryError(env); + +} /* end Java_hdf_hdf5lib_H5_H5Lmove */ + +static herr_t +H5L_iterate_cb(hid_t g_id, const char *name, const H5L_info_t *info, void *op_data) { + JNIEnv *cbenv; + jint status; + jclass cls; + jmethodID mid; + jstring str; + jmethodID constructor; + jvalue args[5]; + jobject cb_info_t = NULL; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5L_info_t;Lhdf/hdf5lib/callbacks/H5L_iterate_t;)I"); + if (mid != 0) { + str = CBENVPTR->NewStringUTF(CBENVPAR name); + + args[0].i = info->type; + args[1].z = info->corder_valid; + args[2].j = info->corder; + args[3].i = info->cset; + if(info->type==0) + args[4].j = (jlong)info->u.address; + else + args[4].j = (jlong)info->u.val_size; + // get a reference to your class if you don't have it already + cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5L_info_t"); + if (cls != 0) { + // get a reference to the constructor; the name is + constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "", "(IZJIJ)V"); + if (constructor != 0) { + cb_info_t = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args); + + status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, g_id, str, cb_info_t, op_data); + } /* end if */ + } /* end if */ + } /* end if */ + } /* end if */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + return status; +} /* end H5L_iterate_cb */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lvisit + * Signature: (JIILjava/lang/Object;Ljava/lang/Object;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Lvisit(JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order, + jobject callback_op, jobject op_data) +{ + herr_t status = -1; + + ENVPTR->GetJavaVM(ENVPAR &jvm); + visit_callback = callback_op; + + if ((op_data == NULL) || (callback_op == NULL)) { + h5nullArgument(env, "H5Lvisit: op_data or callback_op is NULL"); + } /* end if */ + else { + status = H5Lvisit((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data); + if (status < 0) + h5libraryError(env); + } /* end else */ + + return status; +} /* end Java_hdf_hdf5lib_H5_H5Lvisit */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lvisit_by_name + * Signature: (JLjava/lang/String;IILjava/lang/Object;Ljava/lang/Object;J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name(JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type, jint order, + jobject callback_op, jobject op_data, jlong access_id) +{ + herr_t status = -1; + const char *lName; + + ENVPTR->GetJavaVM(ENVPAR &jvm); + visit_callback = callback_op; + + if ((op_data == NULL) || (callback_op == NULL)) { + h5nullArgument(env, "H5Lvisit_by_name: op_data or callback_op is NULL"); + } /* end if */ + else { + PIN_JAVA_STRING(name, lName, -1); + + status = H5Lvisit_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status < 0) + h5libraryError(env); + } /* end else */ + + return status; +} /* end Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Literate + * Signature: (JIIJLjava/lang/Object;Ljava/lang/Object;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Literate(JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order, + jlong idx, jobject callback_op, jobject op_data) +{ + hsize_t start_idx = (hsize_t)idx; + herr_t status = -1; + + ENVPTR->GetJavaVM(ENVPAR &jvm); + visit_callback = callback_op; + + if ((op_data == NULL) || (callback_op == NULL)) { + h5nullArgument(env, "H5Literate: op_data or callback_op is NULL"); + } /* end if */ + else { + status = H5Literate((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data); + + if (status < 0) + h5libraryError(env); + } /* end else */ + + return status; +} /* end Java_hdf_hdf5lib_H5_H5Literate */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Literate_by_name + * Signature: (JLjava/lang/String;IIJLjava/lang/Object;Ljava/lang/Object;J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Literate_1by_1name(JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type, jint order, + jlong idx, jobject callback_op, jobject op_data, jlong access_id) +{ + hsize_t start_idx = (hsize_t)idx; + herr_t status = -1; + const char *lName; + + ENVPTR->GetJavaVM(ENVPAR &jvm); + visit_callback = callback_op; + + if ((op_data == NULL) || (callback_op == NULL)) { + h5nullArgument(env, "H5Literate_by_name: op_data or callback_op is NULL"); + } /* end if */ + else { + PIN_JAVA_STRING(name, lName, -1); + + status = H5Literate_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (hsize_t*)&start_idx, (H5L_iterate_t)H5L_iterate_cb, (void*)op_data, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status < 0) + h5libraryError(env); + } /* end else */ + + return status; +} /* end Java_hdf_hdf5lib_H5_H5Literate_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lis_registered + * Signature: (I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Lis_1registered(JNIEnv *env, jclass clss, jint link_cls_id) +{ + htri_t ret_val = H5Lis_registered((H5L_type_t)link_cls_id); + + if (ret_val < 0) + h5libraryError(env); + + return (int)ret_val; +} /* end Java_hdf_hdf5lib_H5_H5Lis_1registered */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Lunregister + * Signature: (I)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Lunregister(JNIEnv *env, jclass clss, jint link_cls_id) +{ + if (H5Lunregister((H5L_type_t)link_cls_id) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Lunregister */ + + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5lImp.h b/java/src/jni/h5lImp.h new file mode 100644 index 0000000..f0a9a63 --- /dev/null +++ b/java/src/jni/h5lImp.h @@ -0,0 +1,183 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5_H5L */ + +#ifndef _Included_hdf_hdf5lib_H5_H5L +#define _Included_hdf_hdf5lib_H5_H5L + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lcopy + * Signature: (JLjava/lang/String;JLjava/lang/String;JJ)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Lcopy + (JNIEnv*, jclass, jlong, jstring, jlong, jstring, jlong, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lcreate_external + * Signature: (Ljava/lang/String;Ljava/lang/String;JLjava/lang/String;JJ)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Lcreate_1external + (JNIEnv*, jclass, jstring, jstring, jlong, jstring, jlong, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lcreate_hard + * Signature: (JLjava/lang/String;JLjava/lang/String;JJ)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Lcreate_1hard + (JNIEnv*, jclass, jlong, jstring, jlong, jstring, jlong, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lcreate_soft + * Signature: (Ljava/lang/String;JLjava/lang/String;JJ)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Lcreate_1soft + (JNIEnv*, jclass, jstring, jlong, jstring, jlong, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Ldelete + * Signature: (JLjava/lang/String;J)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Ldelete + (JNIEnv*, jclass, jlong, jstring, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Ldelete_by_idx + * Signature: (JLjava/lang/String;IIJJ)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Ldelete_1by_1idx + (JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lexists + * Signature: (JLjava/lang/String;J)Z + */ + JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Lexists + (JNIEnv*, jclass, jlong, jstring, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lget_info + * Signature: (JLjava/lang/String;J)Lhdf/hdf5lib/structs/H5L_info_t; + */ + JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Lget_1info + (JNIEnv*, jclass, jlong, jstring, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lget_info_by_idx + * Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5L_info_t; + */ + JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Lget_1info_1by_1idx + (JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lget_name_by_idx + * Signature: (JLjava/lang/String;IIJJ)Ljava/lang/String; + */ + JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Lget_1name_1by_1idx + (JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lget_value + * Signature: (JLjava/lang/String;[Ljava/lang/String;J)I + */ + JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Lget_1value + (JNIEnv*, jclass, jlong, jstring, jobjectArray, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lget_value_by_idx + * Signature: (JLjava/lang/String;IIJ[Ljava/lang/String;J)I + */ + JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Lget_1value_1by_1idx + (JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jobjectArray, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lmove + * Signature: (JLjava/lang/String;JLjava/lang/String;JJ)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Lmove + (JNIEnv*, jclass, jlong, jstring, jlong, jstring, jlong, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lvisit + * Signature: (JIILjava/lang/Object;Ljava/lang/Object;)I + */ + JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Lvisit + (JNIEnv*, jclass, jlong, jint, jint, jobject, jobject); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lvisit_by_name + * Signature: (JLjava/lang/String;IILjava/lang/Object;Ljava/lang/Object;J)I + */ + JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Lvisit_1by_1name + (JNIEnv*, jclass, jlong, jstring, jint, jint, jobject, jobject, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Literate + * Signature: (JIIJLjava/lang/Object;Ljava/lang/Object;)I + */ + JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Literate + (JNIEnv*, jclass, jlong, jint, jint, jlong, jobject, jobject); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Literate_by_name + * Signature: (JLjava/lang/String;IIJLjava/lang/Object;Ljava/lang/Object;J)I + */ + JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Literate_1by_1name + (JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jobject, jobject, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lis_registered + * Signature: (I)I + */ + JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Lis_1registered + (JNIEnv*, jclass, jint); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Lunregister + * Signature: (I)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Lunregister + (JNIEnv*, jclass, jint); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5L */ diff --git a/java/src/jni/h5oImp.c b/java/src/jni/h5oImp.c new file mode 100644 index 0000000..c38ec9a --- /dev/null +++ b/java/src/jni/h5oImp.c @@ -0,0 +1,766 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include "hdf5.h" +#include "h5jni.h" +#include "h5oImp.h" + +extern JavaVM *jvm; +extern jobject visit_callback; + +/********************/ +/* Local Prototypes */ +/********************/ + +static herr_t H5O_iterate_cb(hid_t g_id, const char *name, const H5O_info_t *info, void *op_data); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Oopen + * Signature: (JLjava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Oopen(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist_id) +{ + hid_t status; + const char *oName; + + PIN_JAVA_STRING(name, oName, -1); + + status = H5Oopen((hid_t)loc_id, oName, (hid_t)access_plist_id ); + + UNPIN_JAVA_STRING(name, oName); + + if (status < 0) + h5libraryError(env); + + return (jlong)status; +} /* end Java_hdf_hdf5lib_H5__1H5Oopen */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Oclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5__1H5Oclose(JNIEnv *env, jclass clss, jlong object_id) +{ + herr_t retVal = H5Oclose((hid_t)object_id); + + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Oclose */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ocopy + * Signature: (JLjava/lang/String;JLjava/lang/String;JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Ocopy(JNIEnv *env, jclass clss, jlong cur_loc_id, jstring cur_name, + jlong dst_loc_id, jstring dst_name, jlong create_id, jlong access_id) +{ + herr_t status = -1; + const char *lCurName; + const char *lDstName; + + PIN_JAVA_STRING_TWO0(cur_name, lCurName, dst_name, lDstName); + + status = H5Ocopy((hid_t)cur_loc_id, lCurName, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id); + + UNPIN_JAVA_STRING_TWO(cur_name, lCurName, dst_name, lDstName); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Ocopy */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oget_info + * Signature: (J)Lhdf/hdf5lib/structs/H5O_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Oget_1info(JNIEnv *env, jclass clss, jlong loc_id) +{ + herr_t status = -1; + H5O_info_t infobuf; + jvalue args[12]; + jobject hdrinfobuf; + jobject ihinfobuf1; + jobject ihinfobuf2; + jobject ret_obj = NULL; + + status = H5Oget_info((hid_t)loc_id, &infobuf); + + if (status < 0) { + h5libraryError(env); + return NULL; + } /* end if */ + + args[0].i = (jint)infobuf.hdr.version; + args[1].i = (jint)infobuf.hdr.nmesgs; + args[2].i = (jint)infobuf.hdr.nchunks; + args[3].i = (jint)infobuf.hdr.flags; + args[4].j = (jlong)infobuf.hdr.space.total; + args[5].j = (jlong)infobuf.hdr.space.meta; + args[6].j = (jlong)infobuf.hdr.space.mesg; + args[7].j = (jlong)infobuf.hdr.space.free; + args[8].j = (jlong)infobuf.hdr.mesg.present; + args[9].j = (jlong)infobuf.hdr.mesg.shared; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5O_hdr_info_t", "(IIIIJJJJJJ)V", args); + hdrinfobuf = ret_obj; + + args[0].j = (jlong)infobuf.meta_size.obj.index_size; + args[1].j = (jlong)infobuf.meta_size.obj.heap_size; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args); + ihinfobuf1 = ret_obj; + args[0].j = (jlong)infobuf.meta_size.attr.index_size; + args[1].j = (jlong)infobuf.meta_size.attr.heap_size; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args); + ihinfobuf2 = ret_obj; + + args[0].j = (jlong)infobuf.fileno; + args[1].j = (jlong)infobuf.addr; + args[2].i = infobuf.type; + args[3].i = (jint)infobuf.rc; + args[4].j = (jlong)infobuf.num_attrs; + args[5].j = infobuf.atime; + args[6].j = infobuf.mtime; + args[7].j = infobuf.ctime; + args[8].j = infobuf.btime; + args[9].l = hdrinfobuf; + args[10].l = ihinfobuf1; + args[11].l = ihinfobuf2; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5O_info_t", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args); + + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Oget_1info */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oget_info_by_name + * Signature: (JLjava/lang/String;J)Lhdf/hdf5lib/structs/H5O_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id) +{ + const char *lName; + herr_t status = -1; + H5O_info_t infobuf; + jvalue args[12]; + jobject hdrinfobuf; + jobject ihinfobuf1; + jobject ihinfobuf2; + jobject ret_obj = NULL; + + PIN_JAVA_STRING(name, lName, NULL); + + status = H5Oget_info_by_name((hid_t)loc_id, lName, &infobuf, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status < 0) { + h5libraryError(env); + return NULL; + } /* end if */ + + args[0].i = (jint)infobuf.hdr.version; + args[1].i = (jint)infobuf.hdr.nmesgs; + args[2].i = (jint)infobuf.hdr.nchunks; + args[3].i = (jint)infobuf.hdr.flags; + args[4].j = (jlong)infobuf.hdr.space.total; + args[5].j = (jlong)infobuf.hdr.space.meta; + args[6].j = (jlong)infobuf.hdr.space.mesg; + args[7].j = (jlong)infobuf.hdr.space.free; + args[8].j = (jlong)infobuf.hdr.mesg.present; + args[9].j = (jlong)infobuf.hdr.mesg.shared; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5O_hdr_info_t", "(IIIIJJJJJJ)V", args); + hdrinfobuf = ret_obj; + + args[0].j = (jlong)infobuf.meta_size.obj.index_size; + args[1].j = (jlong)infobuf.meta_size.obj.heap_size; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args); + ihinfobuf1 = ret_obj; + args[0].j = (jlong)infobuf.meta_size.attr.index_size; + args[1].j = (jlong)infobuf.meta_size.attr.heap_size; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args); + ihinfobuf2 = ret_obj; + + args[0].j = (jlong)infobuf.fileno; + args[1].j = (jlong)infobuf.addr; + args[2].i = infobuf.type; + args[3].i = (jint)infobuf.rc; + args[4].j = (jlong)infobuf.num_attrs; + args[5].j = infobuf.atime; + args[6].j = infobuf.mtime; + args[7].j = infobuf.ctime; + args[8].j = infobuf.btime; + args[9].l = hdrinfobuf; + args[10].l = ihinfobuf1; + args[11].l = ihinfobuf2; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5O_info_t", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args); + + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oget_info_by_idx + * Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5O_info_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, + jstring name, jint index_field, jint order, jlong link_n, jlong access_id) +{ + const char *lName; + herr_t status; + H5O_info_t infobuf; + jvalue args[12]; + jobject hdrinfobuf; + jobject ihinfobuf1; + jobject ihinfobuf2; + jobject ret_obj = NULL; + + PIN_JAVA_STRING(name, lName, NULL); + + status = H5Oget_info_by_idx((hid_t)loc_id, lName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, &infobuf, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status < 0) { + h5libraryError(env); + return NULL; + } /* end if */ + + args[0].i = (jint)infobuf.hdr.version; + args[1].i = (jint)infobuf.hdr.nmesgs; + args[2].i = (jint)infobuf.hdr.nchunks; + args[3].i = (jint)infobuf.hdr.flags; + args[4].j = (jlong)infobuf.hdr.space.total; + args[5].j = (jlong)infobuf.hdr.space.meta; + args[6].j = (jlong)infobuf.hdr.space.mesg; + args[7].j = (jlong)infobuf.hdr.space.free; + args[8].j = (jlong)infobuf.hdr.mesg.present; + args[9].j = (jlong)infobuf.hdr.mesg.shared; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5O_hdr_info_t", "(IIIIJJJJJJ)V", args); + hdrinfobuf = ret_obj; + + args[0].j = (jlong)infobuf.meta_size.obj.index_size; + args[1].j = (jlong)infobuf.meta_size.obj.heap_size; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args); + ihinfobuf1 = ret_obj; + args[0].j = (jlong)infobuf.meta_size.attr.index_size; + args[1].j = (jlong)infobuf.meta_size.attr.heap_size; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5_ih_info_t", "(JJ)V", args); + ihinfobuf2 = ret_obj; + + args[0].j = (jlong)infobuf.fileno; + args[1].j = (jlong)infobuf.addr; + args[2].i = infobuf.type; + args[3].i = (jint)infobuf.rc; + args[4].j = (jlong)infobuf.num_attrs; + args[5].j = infobuf.atime; + args[6].j = infobuf.mtime; + args[7].j = infobuf.ctime; + args[8].j = infobuf.btime; + args[9].l = hdrinfobuf; + args[10].l = ihinfobuf1; + args[11].l = ihinfobuf2; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5O_info_t", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V", args); + + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Olink + * Signature: (JJLjava/lang/String;JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Olink(JNIEnv *env, jclass clss, jlong cur_loc_id, jlong dst_loc_id, + jstring dst_name, jlong create_id, jlong access_id) +{ + herr_t status = -1; + const char *lDstName; + + PIN_JAVA_STRING0(dst_name, lDstName); + + status = H5Olink((hid_t)cur_loc_id, (hid_t)dst_loc_id, lDstName, (hid_t)create_id, (hid_t)access_id); + + UNPIN_JAVA_STRING(dst_name, lDstName); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Olink */ + +static herr_t +H5O_iterate_cb(hid_t g_id, const char *name, const H5O_info_t *info, void *op_data) +{ + JNIEnv *cbenv; + jint status = -1; + jclass cls; + jmethodID mid; + jstring str; + jmethodID constructor; + jvalue args[12]; + jobject hdrinfobuf; + jobject ihinfobuf1; + jobject ihinfobuf2; + jobject cb_info_t = NULL; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) { + /* printf("JNI H5O_iterate_cb error: AttachCurrentThread failed\n"); */ + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback); + if (cls == 0) { + /* printf("JNI H5O_iterate_cb error: GetObjectClass failed\n"); */ + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/structs/H5O_info_t;Lhdf/hdf5lib/callbacks/H5O_iterate_t;)I"); + if (mid == 0) { + /* printf("JNI H5O_iterate_cb error: GetMethodID failed\n"); */ + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + str = CBENVPTR->NewStringUTF(CBENVPAR name); + + args[0].i = (jint)info->hdr.version; + args[1].i = (jint)info->hdr.nmesgs; + args[2].i = (jint)info->hdr.nchunks; + args[3].i = (jint)info->hdr.flags; + args[4].j = (jlong)info->hdr.space.total; + args[5].j = (jlong)info->hdr.space.meta; + args[6].j = (jlong)info->hdr.space.mesg; + args[7].j = (jlong)info->hdr.space.free; + args[8].j = (jlong)info->hdr.mesg.present; + args[9].j = (jlong)info->hdr.mesg.shared; + // get a reference to the H5_hdr_info_t class + cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5O_hdr_info_t"); + if (cls == 0) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + // get a reference to the constructor; the name is + constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "", "(IIIIJJJJJJ)V"); + if (constructor == 0) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + hdrinfobuf = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args); + + args[0].j = (jlong)info->meta_size.obj.index_size; + args[1].j = (jlong)info->meta_size.obj.heap_size; + // get a reference to the H5_ih_info_t class + cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5_ih_info_t"); + if (cls == 0) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + // get a reference to the constructor; the name is + constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "", "(JJ)V"); + if (constructor == 0) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + ihinfobuf1 = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args); + args[0].j = (jlong)info->meta_size.attr.index_size; + args[1].j = (jlong)info->meta_size.attr.heap_size; + ihinfobuf2 = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args); + + args[0].j = (jlong)info->fileno; + args[1].j = (jlong)info->addr; + args[2].i = info->type; + args[3].i = (jint)info->rc; + args[4].j = (jlong)info->num_attrs; + args[5].j = info->atime; + args[6].j = info->mtime; + args[7].j = info->ctime; + args[8].j = info->btime; + args[9].l = hdrinfobuf; + args[10].l = ihinfobuf1; + args[11].l = ihinfobuf2; + // get a reference to the H5O_info_t class + cls = CBENVPTR->FindClass(CBENVPAR "hdf/hdf5lib/structs/H5O_info_t"); + if (cls == 0) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + // get a reference to the constructor; the name is + constructor = CBENVPTR->GetMethodID(CBENVPAR cls, "", "(JJIIJJJJJLhdf/hdf5lib/structs/H5O_hdr_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;Lhdf/hdf5lib/structs/H5_ih_info_t;)V"); + if (constructor == 0) { + JVMPTR->DetachCurrentThread(JVMPAR); + return -1; + } /* end if */ + cb_info_t = CBENVPTR->NewObjectA(CBENVPAR cls, constructor, args); + + status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, g_id, str, cb_info_t, op_data); + + JVMPTR->DetachCurrentThread(JVMPAR); + + return status; +} /* end H5O_iterate_cb */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ovisit + * Signature: (JIILjava/lang/Object;Ljava/lang/Object;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Ovisit(JNIEnv *env, jclass clss, jlong grp_id, jint idx_type, jint order, + jobject callback_op, jobject op_data) +{ + herr_t status = -1; + + ENVPTR->GetJavaVM(ENVPAR &jvm); + visit_callback = callback_op; + + if (op_data == NULL) { + h5nullArgument(env, "H5Ovisit: op_data is NULL"); + return -1; + } /* end if */ + if (callback_op == NULL) { + h5nullArgument(env, "H5Ovisit: callback_op is NULL"); + return -1; + } /* end if */ + + status = H5Ovisit((hid_t)grp_id, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data); + + if (status < 0) + h5libraryError(env); + + return status; +} /* end Java_hdf_hdf5lib_H5_H5Ovisit */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Ovisit_by_name + * Signature: (JLjava/lang/String;IILjava/lang/Object;Ljava/lang/Object;J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name(JNIEnv *env, jclass clss, jlong grp_id, jstring name, jint idx_type, jint order, + jobject callback_op, jobject op_data, jlong access_id) +{ + herr_t status = -1; + const char *lName; + + ENVPTR->GetJavaVM(ENVPAR &jvm); + visit_callback = callback_op; + + if (op_data == NULL) { + h5nullArgument(env, "H5Ovisit_by_name: op_data is NULL"); + return -1; + } /* end if */ + if (callback_op == NULL) { + h5nullArgument(env, "H5Ovisit_by_name: callback_op is NULL"); + return -1; + } /* end if */ + + PIN_JAVA_STRING(name, lName, -1); + + status = H5Ovisit_by_name((hid_t)grp_id, lName, (H5_index_t)idx_type, (H5_iter_order_t)order, (H5O_iterate_t)H5O_iterate_cb, (void*)op_data, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, lName); + + if (status < 0) + h5libraryError(env); + + return status; +} /* end Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oset_comment + * Signature: (JLjava/lang/String;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Oset_1comment(JNIEnv *env, jclass clss, jlong loc_id, jstring comment) +{ + herr_t status = -1; + const char *oComment; + jboolean isCopy; + + if (comment == NULL) { + oComment = NULL; + } /* end if */ + else { + oComment = ENVPTR->GetStringUTFChars(ENVPAR comment, &isCopy); + if (oComment == NULL) { + h5JNIFatalError( env, "H5Oset_comment: comment not pinned"); + return; + } /* end if */ + } /* end else */ + + status = H5Oset_comment((hid_t)loc_id, oComment); + + if(oComment) + ENVPTR->ReleaseStringUTFChars(ENVPAR comment, oComment); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Oset_1comment */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oset_comment_by_name + * Signature: (JLjava/lang/String;Ljava/lang/String;J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Oset_1comment_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, + jstring name, jstring comment, jlong access_id) +{ + herr_t status = -1; + const char *oName; + const char *oComment; + + PIN_JAVA_STRING0(name, oName); + + if (comment == NULL) { + oComment = NULL; + } /* end if */ + else { + jboolean isCopy; + oComment = ENVPTR->GetStringUTFChars(ENVPAR comment, &isCopy); + if (oComment == NULL) { + UNPIN_JAVA_STRING(name, oName); + h5JNIFatalError( env, "H5Oset_comment_by_name: comment not pinned"); + return; + } /* end if */ + } /* end else */ + + status = H5Oset_comment_by_name((hid_t)loc_id, oName, oComment, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, oName); + + if(oComment) + ENVPTR->ReleaseStringUTFChars(ENVPAR comment, oComment); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Oset_1comment_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oget_comment + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Oget_1comment(JNIEnv *env, jclass clss, jlong loc_id) +{ + char *oComment; + ssize_t buf_size; + ssize_t status; + jstring str = NULL; + + /* get the length of the comment */ + buf_size = H5Oget_comment((hid_t)loc_id, NULL, 0); + if (buf_size < 0) { + h5badArgument( env, "H5Oget_comment: buf_size < 0"); + return NULL; + } /* end if */ + if (buf_size == 0) { + return NULL; + } /* end if */ + + buf_size++; /* add extra space for the null terminator */ + oComment = (char *)HDmalloc(sizeof(char) * (size_t)buf_size); + if (oComment == NULL) { + /* exception -- out of memory */ + h5outOfMemory( env, "H5Oget_comment: malloc failed"); + return NULL; + } /* end if */ + + status = H5Oget_comment((hid_t)loc_id, oComment, (size_t)buf_size); + + if (status >= 0) { + /* may throw OutOfMemoryError */ + str = ENVPTR->NewStringUTF(ENVPAR oComment); + HDfree(oComment); + if (str == NULL) { + h5JNIFatalError( env, "H5Oget_comment: return string not allocated"); + } /* end if */ + } /* end if */ + else { + HDfree(oComment); + h5libraryError(env); + } /* end else */ + + return (jstring)str; +} /* end Java_hdf_hdf5lib_H5_H5Oget_1comment */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oget_comment_by_name + * Signature: (JLjava/lang/String;J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id) +{ + char *oComment; + const char *oName; + ssize_t buf_size; + ssize_t status; + jstring str = NULL; + + PIN_JAVA_STRING(name, oName, NULL); + + /* get the length of the comment */ + buf_size = H5Oget_comment_by_name((hid_t)loc_id, oName, NULL, 0, (hid_t)access_id); + if (buf_size < 0) { + UNPIN_JAVA_STRING(name, oName); + h5badArgument( env, "H5Oget_comment_by_name: buf_size < 0"); + return NULL; + } /* end if */ + if (buf_size == 0) { + UNPIN_JAVA_STRING(name, oName); + return NULL; + } /* end if */ + + buf_size++; /* add extra space for the null terminator */ + oComment = (char *)HDmalloc(sizeof(char) * (size_t)buf_size); + if (oComment == NULL) { + UNPIN_JAVA_STRING(name, oName); + h5outOfMemory( env, "H5Oget_comment_by_name: malloc failed"); + return NULL; + } /* end if */ + + status = H5Oget_comment_by_name((hid_t)loc_id, oName, oComment, (size_t)buf_size, (hid_t)access_id); + UNPIN_JAVA_STRING(name, oName); + + if (status >= 0) { + /* may throw OutOfMemoryError */ + str = ENVPTR->NewStringUTF(ENVPAR oComment); + HDfree(oComment); + if (str == NULL) { + h5JNIFatalError( env, "H5Oget_comment_by_name: return string not allocated"); + } /* end if */ + } /* end if */ + else { + HDfree(oComment); + h5libraryError(env); + } /* end else */ + + return (jstring)str; +} /* end Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oexists_by_name + * Signature: (JLjava/lang/String;J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Oexists_1by_1name(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_id) +{ + htri_t bval = JNI_FALSE; + const char *oName; + + PIN_JAVA_STRING(name, oName, JNI_FALSE); + + bval = H5Oexists_by_name((hid_t)loc_id, oName, (hid_t)access_id); + + UNPIN_JAVA_STRING(name, oName); + + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Oexists_1by_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Odecr_refcount + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Odecr_1refcount(JNIEnv *env, jclass clss, jlong object_id) +{ + if (H5Odecr_refcount((hid_t)object_id) < 0) + h5libraryError(env); +} +/* end Java_hdf_hdf5lib_H5_H5Odecr_1refcount */ +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Oincr_refcount + * Signature: (J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Oincr_1refcount(JNIEnv *env, jclass clss, jlong object_id) +{ + if (H5Oincr_refcount((hid_t)object_id) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Oincr_1refcount */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Oopen_by_addr + * Signature: (JJ)J; + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Oopen_1by_1addr(JNIEnv *env, jclass clss, jlong loc_id, jlong addr) +{ + hid_t retVal = -1; + + retVal = H5Oopen_by_addr((hid_t)loc_id, (haddr_t)addr ); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Oopen_1by_1addr */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Oopen_by_idx + * Signature: (JLjava/lang/String;IIJJ)J; + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Oopen_1by_1idx(JNIEnv *env, jclass clss, jlong loc_id, jstring name, + jint index_field, jint order, jlong link_n, jlong lapl_id) +{ + hid_t retVal = -1; + const char *oName; + + PIN_JAVA_STRING(name, oName, -1); + + retVal = H5Oopen_by_idx((hid_t)loc_id, oName, (H5_index_t)index_field, (H5_iter_order_t)order, (hsize_t)link_n, (hid_t)lapl_id ); + + UNPIN_JAVA_STRING(name, oName); + + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Oopen_1by_1idx */ + + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5oImp.h b/java/src/jni/h5oImp.h new file mode 100644 index 0000000..e6889b2 --- /dev/null +++ b/java/src/jni/h5oImp.h @@ -0,0 +1,175 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5_H5O */ + +#ifndef _Included_hdf_hdf5lib_H5_H5O +#define _Included_hdf_hdf5lib_H5_H5O + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + + /* + * Class: hdf_hdf5lib_H5 + * Method: _H5Oopen + * Signature: (JLjava/lang/String;J)J + */ + JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Oopen + (JNIEnv*, jclass, jlong, jstring, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: _H5Oclose + * Signature: (J)I + */ + JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Oclose + (JNIEnv*, jclass, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Ocopy + * Signature: (JLjava/lang/String;JLjava/lang/String;JJ)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Ocopy + (JNIEnv*, jclass, jlong, jstring, jlong, jstring, jlong, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Oget_info + * Signature: (J)Lhdf/hdf5lib/structs/H5O_info_t; + */ + JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Oget_1info + (JNIEnv*, jclass, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Oget_info_by_name + * Signature: (JLjava/lang/String;J)Lhdf/hdf5lib/structs/H5O_info_t; + */ + JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1name + (JNIEnv*, jclass, jlong, jstring, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Oget_info_by_idx + * Signature: (JLjava/lang/String;IIJJ)Lhdf/hdf5lib/structs/H5O_info_t; + */ + JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Oget_1info_1by_1idx + (JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Olink + * Signature: (JJLjava/lang/String;JJ)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Olink + (JNIEnv*, jclass, jlong, jlong, jstring, jlong, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Ovisit + * Signature: (JIILjava/lang/Object;Ljava/lang/Object;)I + */ + JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Ovisit + (JNIEnv*, jclass, jlong, jint, jint, jobject, jobject); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Ovisit_by_name + * Signature: (JLjava/lang/String;IILjava/lang/Object;Ljava/lang/Object;J)I + */ + JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Ovisit_1by_1name + (JNIEnv*, jclass, jlong, jstring, jint, jint, jobject, jobject, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Oset_comment + * Signature: (JLjava/lang/String;)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Oset_1comment + (JNIEnv*, jclass, jlong, jstring); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Oset_comment_by_name + * Signature: (JLjava/lang/String;Ljava/lang/String;J)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Oset_1comment_1by_1name + (JNIEnv*, jclass, jlong, jstring, jstring, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Oget_comment + * Signature: (J)Ljava/lang/String; + */ + JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Oget_1comment + (JNIEnv*, jclass, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Oget_comment_by_name + * Signature: (JLjava/lang/String;J)Ljava/lang/String; + */ + JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Oget_1comment_1by_1name + (JNIEnv*, jclass, jlong, jstring, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Oexists_by_name + * Signature: (JLjava/lang/String;J)Z + */ + JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Oexists_1by_1name + (JNIEnv*, jclass, jlong, jstring, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Odecr_refcount + * Signature: (J)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Odecr_1refcount + (JNIEnv*, jclass, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: H5Oincr_refcount + * Signature: (J)V + */ + JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Oincr_1refcount + (JNIEnv*, jclass, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: _H5Oopen_by_addr + * Signature: (JJ)J; + */ + JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Oopen_1by_1addr + (JNIEnv*, jclass, jlong, jlong); + + /* + * Class: hdf_hdf5lib_H5 + * Method: _H5Oopen_by_idx + * Signature: (JLjava/lang/String;IIJJ)J; + */ + JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Oopen_1by_1idx + (JNIEnv*, jclass, jlong, jstring, jint, jint, jlong, jlong); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5O */ diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c new file mode 100644 index 0000000..f4fee74 --- /dev/null +++ b/java/src/jni/h5pImp.c @@ -0,0 +1,5344 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include "hdf5.h" +#include "h5util.h" +#include "h5pImp.h" + +extern JavaVM *jvm; +extern jobject visit_callback; +extern jobject copy_callback; +extern jobject close_callback; +extern jobject create_callback; +extern jobject compare_callback; +extern jobject get_callback; +extern jobject set_callback; +extern jobject delete_callback; + +/********************/ +/* Local Prototypes */ +/********************/ + +static herr_t H5P_cls_create_func_cb(hid_t prop_id, void *create_data); +static herr_t H5P_cls_copy_func_cb(hid_t new_prop_id, hid_t old_prop_id, void *copy_data); +static herr_t H5P_cls_close_func_cb(hid_t prop_id, void *close_data); + +static herr_t H5P_prp_create_func_cb(const char *name, size_t size, void *value); +static herr_t H5P_prp_copy_func_cb(const char *name, size_t size, void *value); +static herr_t H5P_prp_close_func_cb(const char *name, size_t size, void *value); +static int H5P_prp_compare_func_cb(void *value1, void *value2, size_t size); +static herr_t H5P_prp_get_func_cb(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P_prp_set_func_cb(hid_t prop_id, const char *name, size_t size, void *value); +static herr_t H5P_prp_delete_func_cb(hid_t prop_id, const char *name, size_t size, void *value); + +static herr_t H5P_iterate_cb(hid_t prop_id, const char *name, void *op_data); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pcreate + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Pcreate(JNIEnv *env, jclass clss, jlong type) +{ + hid_t retVal = -1; + + retVal = H5Pcreate((hid_t)type); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Pcreate */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5__1H5Pclose(JNIEnv *env, jclass clss, jlong plist) +{ + herr_t retVal = 0; + + if (plist > 0) + retVal = H5Pclose((hid_t)plist); + + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Pclose */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_class + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1class(JNIEnv *env, jclass clss, jlong plist) +{ + hid_t retVal = -1; + + retVal = retVal = H5Pget_class((hid_t) plist); + if (retVal == H5P_ROOT) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1class */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pcopy + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Pcopy(JNIEnv *env, jclass clss, jlong plist) +{ + hid_t retVal = -1; + + retVal = H5Pcopy((hid_t)plist); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Pcopy */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_version + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1version(JNIEnv *env, jclass clss, jlong plist, jintArray version_info) +{ + herr_t status = -1; + jint *theArray; + jboolean isCopy; + + if (version_info == NULL) { + h5nullArgument(env, "H5Pget_version: version_info input array is NULL"); + } /* end if */ + else if (ENVPTR->GetArrayLength(ENVPAR version_info) < 4) { + h5badArgument(env, "H5Pget_version: version_info input array < 4"); + } /* end else if */ + else { + theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR version_info, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_version: version_info not pinned"); + } /* end if */ + else { + status = H5Pget_version((hid_t)plist, (unsigned *)&(theArray[0]), + (unsigned *)&(theArray[1]), (unsigned *)&(theArray[2]), (unsigned *)&(theArray[3])); + if (status < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR version_info, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR version_info, theArray, 0); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1version */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_userblock + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1userblock(JNIEnv *env, jclass clss, jlong plist, jlong size) +{ + herr_t retVal = -1; + long sz = (long)size; + + retVal = H5Pset_userblock((hid_t)plist, (hsize_t)sz); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1userblock */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_userblock + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1userblock(JNIEnv *env, jclass clss, jlong plist, jlongArray size) +{ + herr_t status = -1; + jlong *theArray; + jboolean isCopy; + hsize_t s; + + if (size == NULL) { + h5nullArgument(env, "H5Pget_userblock: size is NULL"); + } /* end if */ + else { + theArray = (jlong*)ENVPTR->GetLongArrayElements(ENVPAR size, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_userblock: size not pinned"); + } /* end if */ + else { + status = H5Pget_userblock((hid_t)plist, &s); + + if (status < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR size, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + theArray[0] = (jlong)s; + ENVPTR->ReleaseLongArrayElements(ENVPAR size, theArray, 0); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1userblock */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_sizes + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1sizes(JNIEnv *env, jclass clss, jlong plist, jint sizeof_addr, jint sizeof_size) +{ + herr_t retVal = -1; + + retVal = H5Pset_sizes((hid_t)plist, (size_t)sizeof_addr, (size_t)sizeof_size); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1sizes */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_sizes + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1sizes(JNIEnv *env, jclass clss, jlong plist, jlongArray size) +{ + herr_t status = -1; + jlong *theArray; + jboolean isCopy; + size_t ss; + size_t sa; + + if (size == NULL) { + h5nullArgument(env, "H5Pget_sizes: size is NULL"); + } /* end if */ + else if (ENVPTR->GetArrayLength(ENVPAR size) < 2) { + h5badArgument(env, "H5Pget_sizes: size input array < 2 elements"); + } + else { + theArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR size, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_sizes: size not pinned"); + } /* end if */ + else { + status = H5Pget_sizes((hid_t)plist, &sa, &ss); + if (status < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR size, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + theArray[0] = (jlong)sa; + theArray[1] = (jlong)ss; + ENVPTR->ReleaseLongArrayElements(ENVPAR size, theArray, 0); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1sizes */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_sym_k + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1sym_1k(JNIEnv *env, jclass clss, jlong plist, jint ik, jint lk) +{ + herr_t retVal = -1; + + retVal = H5Pset_sym_k((hid_t)plist, (unsigned)ik, (unsigned)lk); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1sym_1k */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_sym_k + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1sym_1k(JNIEnv *env, jclass clss, jlong plist, jintArray size) +{ + herr_t status = -1; + jint *theArray; + jboolean isCopy; + + if (size == NULL) { + h5nullArgument(env, "H5Pget_sym_k: size is NULL"); + } /* end if */ + else if (ENVPTR->GetArrayLength(ENVPAR size) < 2) { + h5badArgument(env, "H5Pget_sym_k: size < 2 elements"); + } /* end else if */ + else { + theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR size, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_sym_k: size not pinned"); + } /* end if */ + else { + status = H5Pget_sym_k((hid_t)plist, (unsigned *)&(theArray[0]), (unsigned *)&(theArray[1])); + if (status < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR size, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR size, theArray, 0); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1sym_1k */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_istore_k + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1istore_1k(JNIEnv *env, jclass clss, jlong plist, jint ik) +{ + herr_t retVal = -1; + + retVal = H5Pset_istore_k((hid_t)plist, (unsigned)ik); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1istore_1k */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_istore_k + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1istore_1k(JNIEnv *env, jclass clss, jlong plist, jintArray ik) +{ + herr_t status = -1; + jint *theArray; + jboolean isCopy; + + if (ik == NULL) { + h5nullArgument(env, "H5Pget_store_k: ik is NULL"); + } /* end if */ + else { + theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR ik, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_store_k: size not pinned"); + } /* end if */ + else { + status = H5Pget_istore_k((hid_t)plist, (unsigned *)&(theArray[0])); + if (status < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR ik, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR ik, theArray, 0); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1istore_1k */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_layout + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1layout(JNIEnv *env, jclass clss, jlong plist, jint layout) +{ + herr_t retVal = -1; + + retVal = H5Pset_layout((hid_t)plist, (H5D_layout_t)layout); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1layout */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_layout + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1layout(JNIEnv *env, jclass clss, jlong plist) +{ + H5D_layout_t retVal = H5D_LAYOUT_ERROR; + + retVal = H5Pget_layout((hid_t)plist); + if (retVal == H5D_LAYOUT_ERROR) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1layout */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_chunk + * Signature: (JI[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1chunk(JNIEnv *env, jclass clss, jlong plist, jint ndims, jbyteArray dim) +{ + herr_t status = -1; + jbyte *theArray; + jboolean isCopy; + hsize_t *da; + hsize_t *lp; + jlong *jlp; + size_t i; + size_t rank; + + if (dim == NULL) { + h5nullArgument(env, "H5Pset_chunk: dim array is NULL"); + } /* end if */ + else { + i = (size_t)ENVPTR->GetArrayLength(ENVPAR dim); + rank = i / sizeof(jlong); + if (rank < ndims) { + h5badArgument(env, "H5Pset_chunk: dims array < ndims"); + } /* end if */ + else { + theArray = (jbyte *)ENVPTR->GetByteArrayElements(ENVPAR dim, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pset_chunk: dim array not pinned"); + } /* end if */ + else { + da = lp = (hsize_t *)HDmalloc(rank * sizeof(hsize_t)); + if (da == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR dim, theArray, JNI_ABORT); + h5JNIFatalError(env, "H5Pset_chunk: dims not converted to hsize_t"); + } /* end if */ + else { + jlp = (jlong *)theArray; + for (i = 0; i < rank; i++) { + *lp = (hsize_t)*jlp; + lp++; + jlp++; + } /* end if */ + + status = H5Pset_chunk((hid_t)plist, (int)ndims, da); + + ENVPTR->ReleaseByteArrayElements(ENVPAR dim, theArray, JNI_ABORT); + HDfree(da); + + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1chunk */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_chunk + * Signature: (JI[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1chunk(JNIEnv *env, jclass clss, jlong plist, jint max_ndims, jlongArray dims) +{ + herr_t status = -1; + jlong *theArray; + jboolean isCopy; + hsize_t *da; + int i; + + if (dims == NULL) { + h5nullArgument(env, "H5Pget_chunk: dims is NULL"); + } /* end if */ + else if (ENVPTR->GetArrayLength(ENVPAR dims) < max_ndims) { + h5badArgument(env, "H5Pget_chunk: dims array < max_ndims"); + } /* end else if */ + else { + theArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR dims, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_chunk: input dims not pinned"); + } /* end if */ + else { + da = (hsize_t *)HDmalloc((size_t)max_ndims * sizeof(hsize_t)); + if (da == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, theArray, JNI_ABORT); + h5JNIFatalError(env, "H5Pget_chunk: dims not converted to hsize_t"); + } /* end if */ + else { + status = H5Pget_chunk((hid_t)plist, (int)max_ndims, da); + + if (status < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, theArray, JNI_ABORT); + HDfree (da); + h5libraryError(env); + } /* end if */ + else { + for (i = 0; i < max_ndims; i++) { + theArray[i] = (jlong)da[i]; + } + HDfree (da); + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, theArray, 0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1chunk */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_alignment + * Signature: (JJJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1alignment(JNIEnv *env, jclass clss, jlong plist, jlong threshold, jlong alignment) +{ + herr_t retVal = -1; + long thr = (long)threshold; + long align = (long)alignment; + + retVal = H5Pset_alignment((hid_t)plist, (hsize_t)thr, (hsize_t)align); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1alignment */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_alignment + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1alignment(JNIEnv *env, jclass clss, jlong plist, jlongArray alignment) +{ + herr_t status = -1; + jlong *theArray; + jboolean isCopy; + hsize_t t; + hsize_t a; + + if (alignment == NULL) { + h5nullArgument(env, "H5Pget_alignment: input alignment is NULL"); + } /* end if */ + else { + if (ENVPTR->GetArrayLength(ENVPAR alignment) < 2) { + h5badArgument(env, "H5Pget_alignment: alignment input array < 2"); + } /* end if */ + else { + theArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR alignment, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_alignment: input array not pinned"); + } /* end if */ + else { + status = H5Pget_alignment((hid_t)plist, &t, &a); + if (status < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR alignment, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + theArray[0] = (jlong)t; + theArray[1] = (jlong)a; + ENVPTR->ReleaseLongArrayElements(ENVPAR alignment, theArray, 0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1alignment */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_external + * Signature: (JLjava/lang/String;JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1external(JNIEnv *env, jclass clss, jlong plist, jstring name, jlong offset, jlong size) +{ + herr_t status = -1; + const char *fileName; + off_t off; + hsize_t sz; + hid_t plid; + + plid = (hid_t)plist; + off = (off_t)offset; + sz = (hsize_t)size; + + PIN_JAVA_STRING(name, fileName, -1); + + status = H5Pset_external(plid, fileName, off, sz); + + UNPIN_JAVA_STRING(name, fileName); + + if (status < 0) + h5libraryError(env); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1external */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_external_count + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1external_1count(JNIEnv *env, jclass clss, jlong plist) +{ + int retVal = -1; + + retVal = H5Pget_external_count((hid_t)plist); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1external_1count */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_external + * Signature: (JIJ[Ljava/lang/String;[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1external(JNIEnv *env, jclass clss, jlong plist, jint idx, jlong name_size, + jobjectArray name, jlongArray size) +{ + herr_t status = -1; + jlong *theArray; + jboolean isCopy; + char *file; + jstring str; + off_t o; + hsize_t s; + + if (name_size < 0) { + h5badArgument(env, "H5Pget_external: name_size < 0"); + return -1; + } /* end if */ + else if (name_size == 0) { + file = NULL; + } /* end else if */ + else { + file = (char *)HDmalloc(sizeof(char)*(size_t)name_size); + } /* end else */ + + if (size != NULL) { + if (ENVPTR->GetArrayLength(ENVPAR size) < 2) { + HDfree(file); + h5badArgument(env, "H5Pget_external: size input array < 2"); + return -1; + } /* end if */ + theArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR size, &isCopy); + if (theArray == NULL) { + HDfree(file); + h5JNIFatalError( env, "H5Pget_external: size array not pinned"); + return -1; + } /* end if */ + } /* end if */ + + status = H5Pget_external((hid_t) plist, (unsigned)idx, (size_t)name_size, + file, (off_t *)&o, (hsize_t *)&s); + if (status < 0) { + if (size != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR size, theArray, JNI_ABORT); + } /* end if */ + HDfree(file); + h5libraryError(env); + } /* end if */ + else { + if (size != NULL) { + theArray[0] = o; + theArray[1] = (jlong)s; + ENVPTR->ReleaseLongArrayElements(ENVPAR size, theArray, 0); + } /* end if */ + + if (file != NULL) { + /* NewStringUTF may throw OutOfMemoryError */ + str = ENVPTR->NewStringUTF(ENVPAR file); + if (str == NULL) { + HDfree(file); + h5JNIFatalError(env, "H5Pget_external: return array not created"); + } /* end if */ + else { + /* SetObjectArrayElement may raise exceptions */ + ENVPTR->SetObjectArrayElement(ENVPAR name, 0, (jobject)str); + HDfree(file); + } /* end else */ + } /* end if */ + } /* end else */ + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1external */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fill_value + * Signature: (JJ[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fill_1value(JNIEnv *env, jclass clss, jlong plist_id, jlong type_id, jbyteArray value) +{ + jint status = -1; + jbyte *byteP; + jboolean isCopy; + + if (value != NULL) { + byteP = ENVPTR->GetByteArrayElements(ENVPAR value, &isCopy); + if (byteP == NULL) { + h5JNIFatalError(env, "H5Pget_fill_value: value array not pinned"); + return -1; + } /* end if */ + } /* end if */ + + status = H5Pset_fill_value((hid_t)plist_id, (hid_t)type_id, byteP); + + if (value != NULL) + ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT); + + if (status < 0) + h5libraryError(env); + + return status; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fill_1value */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fill_value + * Signature: (JJ[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1fill_1value(JNIEnv *env, jclass clss, jlong plist_id, jlong type_id, jbyteArray value) +{ + jint status = -1; + jbyte *byteP; + jboolean isCopy; + + if (value == NULL) { + h5badArgument(env, "H5Pget_fill_value: value is NULL"); + } /* end if */ + else { + byteP = ENVPTR->GetByteArrayElements(ENVPAR value, &isCopy); + if (byteP == NULL) { + h5JNIFatalError(env, "H5Pget_fill_value: value array not pinned"); + } /* end if */ + else { + status = H5Pget_fill_value((hid_t)plist_id, (hid_t)type_id, byteP); + if (status < 0) { + ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, 0); + } /* end else */ + } /* end else */ + + return status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1fill_1value */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_filter + * Signature: (JIIJ[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1filter(JNIEnv *env, jclass clss, jlong plist, jint filter, jint flags, + jlong cd_nelmts, jintArray cd_values) +{ + herr_t status = -1; + jint *theArray; + jboolean isCopy; + + if (cd_values == NULL) { + status = H5Pset_filter((hid_t)plist, (H5Z_filter_t)filter, + (unsigned int)flags, (size_t)cd_nelmts, NULL); + if (status < 0) + h5libraryError(env); + } /* end if */ + else { + theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR cd_values, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pset_filter: input array not pinned"); + }/* end if */ + else { + status = H5Pset_filter((hid_t)plist, (H5Z_filter_t)filter, + (unsigned int)flags, (size_t)cd_nelmts, (const unsigned int *)theArray); + ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, theArray, JNI_ABORT); + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1filter */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_nfilters + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1nfilters(JNIEnv *env, jclass clss, jlong plist) +{ + int retVal = -1; + + retVal = H5Pget_nfilters((hid_t)plist); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1nfilters */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_filter + * Signature: (JI[I[J[IJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1filter(JNIEnv *env, jclass clss, jlong plist, jint filter_number, jintArray flags, + jlongArray cd_nelmts, jintArray cd_values, jlong namelen, jobjectArray name) +{ + herr_t status = -1; + jint *flagsArray; + jlong *cd_nelmtsArray; + jint *cd_valuesArray; + jboolean isCopy; + jstring str; + char *filter; + + if (namelen <= 0) { + h5badArgument(env, "H5Pget_filter: namelen <= 0"); + } /* end if */ + else if (flags == NULL) { + h5badArgument(env, "H5Pget_filter: flags is NULL"); + } /* end else if */ + else if (cd_nelmts == NULL) { + h5badArgument(env, "H5Pget_filter: cd_nelmts is NULL"); + } /* end else if */ + else if (cd_values == NULL) { + h5badArgument(env, "H5Pget_filter: cd_values is NULL"); + } /* end else if */ + else { + filter = (char *)HDmalloc(sizeof(char)*(size_t)namelen); + if (filter == NULL) { + h5outOfMemory(env, "H5Pget_filter: namelent malloc failed"); + return -1; + } /* end if */ + flagsArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR flags, &isCopy); + if (flagsArray == NULL) { + HDfree(filter); + h5JNIFatalError(env, "H5Pget_filter: flags array not pinned"); + return -1; + } /* end if */ + cd_nelmtsArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR cd_nelmts, &isCopy); + if (cd_nelmtsArray == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + HDfree(filter); + h5JNIFatalError(env, "H5Pget_filter: nelmts array not pinned"); + return -1; + } /* end if */ + cd_valuesArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR cd_values, &isCopy); + if (cd_valuesArray == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + HDfree(filter); + h5JNIFatalError(env, "H5Pget_filter: elmts array not pinned"); + return -1; + } /* end if */ + + { /* direct cast (size_t *)variable fails on 32-bit environment */ + long long cd_nelmts_temp = *(cd_nelmtsArray); + size_t cd_nelmts_t = (size_t)cd_nelmts_temp; + unsigned int filter_config; + status = H5Pget_filter2((hid_t)plist, (unsigned)filter_number, + (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray, + (size_t)namelen, filter, &filter_config); + + *cd_nelmtsArray = (jlong)cd_nelmts_t; + } /* end direct cast special */ + + if (status < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + HDfree(filter); + h5libraryError(env); + } /* end if */ + else { + ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, 0); + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, 0); + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, 0); + + /* NewStringUTF may throw OutOfMemoryError */ + str = ENVPTR->NewStringUTF(ENVPAR filter); + HDfree(filter); + if (str == NULL) { + h5JNIFatalError(env, "H5Pget_filter: return string not pinned"); + } /* end if */ + else { + /* SetObjectArrayElement may throw exceptiosn */ + ENVPTR->SetObjectArrayElement(ENVPAR name, 0, (jobject)str); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_driver + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1driver(JNIEnv *env, jclass clss, jlong plist) +{ + hid_t retVal = -1; + + retVal = H5Pget_driver((hid_t) plist); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1driver */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_cache + * Signature: (JIJJD)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1cache(JNIEnv *env, jclass clss, jlong plist, jint mdc_nelmts, jlong rdcc_nelmts, + jlong rdcc_nbytes, jdouble rdcc_w0) +{ + herr_t retVal = -1; + + retVal = H5Pset_cache((hid_t)plist, (int)mdc_nelmts, (size_t)rdcc_nelmts, + (size_t)rdcc_nbytes, (double) rdcc_w0); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1cache */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_cache + * Signature: (J[I[J[J[D)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1cache(JNIEnv *env, jclass clss, jlong plist, jintArray mdc_nelmts, + jlongArray rdcc_nelmts, jlongArray rdcc_nbytes, jdoubleArray rdcc_w0) +{ + herr_t status = -1; + jint mode; + jdouble *w0Array; + jlong *rdcc_nelmtsArray; + jlong *nbytesArray; + jboolean isCopy; + + if (rdcc_w0 == NULL) { + w0Array = (jdouble *)NULL; + } /* end if */ + else { + w0Array = (jdouble *)ENVPTR->GetDoubleArrayElements(ENVPAR rdcc_w0, &isCopy); + if (w0Array == NULL) { + h5JNIFatalError(env, "H5Pget_cache: w0_array array not pinned"); + return -1; + } /* end if */ + } /* end else */ + + if (rdcc_nelmts == NULL) { + rdcc_nelmtsArray = (jlong *) NULL; + } /* end if */ + else { + rdcc_nelmtsArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR rdcc_nelmts, &isCopy); + if (rdcc_nelmtsArray == NULL) { + /* exception -- out of memory */ + if (w0Array != NULL) { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR rdcc_w0, w0Array, JNI_ABORT); + } + h5JNIFatalError(env, "H5Pget_cache: rdcc_nelmts array not pinned"); + return -1; + } /* end if */ + } /* end else */ + + if (rdcc_nbytes == NULL) { + nbytesArray = (jlong *) NULL; + } /* end if */ + else { + nbytesArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR rdcc_nbytes, &isCopy); + if (nbytesArray == NULL) { + if (w0Array != NULL) { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR rdcc_w0, w0Array, JNI_ABORT); + } /* end if */ + if (rdcc_nelmtsArray != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR rdcc_nelmts, rdcc_nelmtsArray, JNI_ABORT); + } /* end if */ + h5JNIFatalError(env, "H5Pget_cache: nbytesArray array not pinned"); + return -1; + } /* end if */ + } /* end else */ + + { /* direct cast (size_t *)variable fails on 32-bit environment */ + long long rdcc_nelmts_temp = *(rdcc_nelmtsArray); + size_t rdcc_nelmts_t = (size_t)rdcc_nelmts_temp; + long long nbytes_temp = *(nbytesArray); + size_t nbytes_t = (size_t)nbytes_temp; + + status = H5Pget_cache((hid_t)plist, (int *)NULL, &rdcc_nelmts_t, + &nbytes_t, (double *)w0Array); + + *rdcc_nelmtsArray = (jlong)rdcc_nelmts_t; + *nbytesArray = (jlong)nbytes_t; + } /* end direct cast special */ + + + if (status < 0) { + mode = JNI_ABORT; + } /* end if */ + else { + mode = 0; /* commit and free */ + } /* end else */ + + if (rdcc_nelmtsArray != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR rdcc_nelmts, rdcc_nelmtsArray, mode); + } /* end if */ + + if (nbytesArray != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR rdcc_nbytes, nbytesArray, mode); + } /* end if */ + + if (w0Array != NULL) { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR rdcc_w0, w0Array, mode); + } /* end if */ + + if (status < 0) { + h5libraryError(env); + } /* end if */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1cache */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_buffer + * Signature: (JJ[B[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1buffer(JNIEnv *env, jclass clss, jlong plist, jlong size, jbyteArray tconv, jbyteArray bkg) +{ + h5unimplemented(env, "H5Pset_buffer: not implemented"); + return -1; +#ifdef notdef + +/* DON'T IMPLEMENT THIS!!! */ + jint status = -1; + jbyte *tconvP; + jbyte *bkgP; + jboolean isCopy; + + if (tconv == NULL) + tconvP = (jbyte *)NULL; + else { + tconvP = ENVPTR->GetByteArrayElements(ENVPAR tconv, &isCopy); + if (tconvP == NULL) { + h5JNIFatalError(env, "H5Pset_buffer: tconv not pinned"); + return -1; + } + } + if (bkg == NULL) + bkgP = (jbyte *)NULL; + else { + bkgP = ENVPTR->GetByteArrayElements(ENVPAR bkg, &isCopy); + if (bkgP == NULL) { + h5JNIFatalError(env, "H5Pset_buffer: bkg not pinned"); + return -1; + } + } + + status = H5Pset_buffer((hid_t)plist, (size_t)size, tconvP, bkgP); + if (status < 0) { + if (tconv != NULL) + ENVPTR->ReleaseByteArrayElements(ENVPAR tconv, tconvP, JNI_ABORT); + if (bkg != NULL) + ENVPTR->ReleaseByteArrayElements(ENVPAR bkg, bkgP, JNI_ABORT); + h5libraryError(env); + return -1; + } + + if (tconv != NULL) + ENVPTR->ReleaseByteArrayElements(ENVPAR tconv, tconvP, 0); + if (bkg != NULL) + ENVPTR->ReleaseByteArrayElements(ENVPAR bkg, bkgP, 0); + + return status; +#endif +} /* end Java_hdf_hdf5lib_H5_H5Pset_1buffer */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_buffer + * Signature: (J[B[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1buffer(JNIEnv *env, jclass clss, jlong plist, jbyteArray tconv, jbyteArray bkg) +{ + h5unimplemented(env, "H5Pget_buffer: not implemented"); + return -1; +#ifdef notdef + +/* DON'T IMPLEMENT THIS!!! */ + jlong status = -1; + jbyte *tconvP; + jbyte *bkgP; + jboolean isCopy; + + if (tconv == NULL) { + h5nullArgument(env, "H5Pget_buffer: tconv input array is NULL"); + return -1; + } + tconvP = ENVPTR->GetByteArrayElements(ENVPAR tconv, &isCopy); + if (tconvP == NULL) { + h5JNIFatalError(env, "H5Pget_buffer: tconv not pinned"); + return -1; + } + if (bkg == NULL) { + h5nullArgument(env, "H5Pget_buffer: bkg array is NULL"); + return -1; + } + bkgP = ENVPTR->GetByteArrayElements(ENVPAR bkg, &isCopy); + if (bkgP == NULL) { + h5JNIFatalError(env, "H5Pget_buffer: bkg not pinned"); + return -1; + } + + status = H5Pget_buffer((hid_t)plist, tconvP, bkgP); + if (status < 0) { + ENVPTR->ReleaseByteArrayElements(ENVPAR tconv, tconvP, JNI_ABORT); + ENVPTR->ReleaseByteArrayElements(ENVPAR bkg, bkgP, JNI_ABORT); + h5libraryError(env); + return -1; + } + ENVPTR->ReleaseByteArrayElements(ENVPAR tconv, tconvP, 0); + ENVPTR->ReleaseByteArrayElements(ENVPAR bkg, bkgP, 0); + + return status; +#endif +} /* end Java_hdf_hdf5lib_H5_H5Pget_1buffer */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_buffer_size + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1buffer_1size(JNIEnv *env, jclass clss, jlong plist, jlong size) +{ + if (H5Pset_buffer((hid_t)plist, (size_t)size, NULL, NULL) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1buffer_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_buffer_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1buffer_1size(JNIEnv *env, jclass clss, jlong plist) +{ + size_t size = 0; + + size = H5Pget_buffer((hid_t)plist, NULL, NULL); + if (size == 0) + h5libraryError(env); + + return (jlong)size; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1buffer_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_preserve + * Signature: (JZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1preserve(JNIEnv *env, jclass clss, jlong plist, jboolean status) +{ + hbool_t st; + herr_t retVal = -1; + + if (status == JNI_TRUE) { + st = TRUE; + } /* end if */ + else if (status == JNI_FALSE) { + st = false; + } /* end else if */ + else { + h5badArgument(env, "H5Pset_preserve: status not TRUE or FALSE"); + return -1; + } /* end else */ + + retVal = H5Pset_preserve((hid_t)plist, st); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1preserve */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_preserve + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1preserve(JNIEnv *env, jclass clss, jlong plist) +{ + herr_t retVal = -1; + + retVal = H5Pget_preserve((hid_t)plist); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1preserve */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_deflate + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1deflate(JNIEnv *env, jclass clss, jlong plist, jint level) +{ + herr_t retVal = -1; + + retVal = H5Pset_deflate((hid_t)plist, (unsigned)level); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1deflate */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_gc_references + * Signature: (JZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1gc_1references(JNIEnv *env, jclass clss, jlong fapl_id, jboolean gc_ref) +{ + herr_t retVal = -1; + unsigned gc_ref_val; + + if (gc_ref == JNI_TRUE) + gc_ref_val = 1; + else + gc_ref_val = 0; + + retVal = H5Pset_gc_references((hid_t)fapl_id, gc_ref_val); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1gc_1references */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_gc_references + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1gc_1references(JNIEnv *env, jclass clss, jlong fapl_id) +{ + unsigned gc_ref_val = 0; + jboolean bval = JNI_FALSE; + + if (H5Pget_gc_references((hid_t)fapl_id, (unsigned *)&gc_ref_val) < 0) { + h5libraryError(env); + } /* end if */ + else { + if (gc_ref_val == 1) + bval = JNI_TRUE; + } /* end else */ + + return bval; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1gc_1references */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_btree_ratios + * Signature: (JDDD)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1btree_1ratios(JNIEnv *env, jclass clss, jlong plist_id, jdouble left, jdouble middle, jdouble right) +{ + herr_t status = -1; + + status = H5Pset_btree_ratios((hid_t)plist_id, (double)left,(double)middle, (double)right); + if (status < 0) + h5libraryError(env); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1btree_1ratios */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_btree_ratios + * Signature: (J[D[D[D)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios(JNIEnv *env, jclass clss, jlong plist_id, jdoubleArray left, + jdoubleArray middle, jdoubleArray right) +{ + herr_t status = -1; + jdouble *leftP; + jdouble *middleP; + jdouble *rightP; + jboolean isCopy; + + if (left == NULL) { + h5nullArgument(env, "H5Pget_btree_ratios: left input array is NULL"); + } /* end if */ + else if (middle == NULL) { + h5nullArgument(env, "H5Pget_btree_ratios: middle input array is NULL"); + } /* end else if */ + else if (right == NULL) { + h5nullArgument(env, "H5Pget_btree_ratios: right input array is NULL"); + } /* end else if */ + else { + leftP = (jdouble *)ENVPTR->GetDoubleArrayElements(ENVPAR left, &isCopy); + if (leftP == NULL) { + h5JNIFatalError(env, "H5Pget_btree_ratios: left not pinned"); + } /* end if */ + else { + middleP = (jdouble *)ENVPTR->GetDoubleArrayElements(ENVPAR middle, &isCopy); + if (middleP == NULL) { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR left, leftP, JNI_ABORT); + h5JNIFatalError(env, "H5Pget_btree_ratios: middle not pinned"); + } /* end if */ + else { + rightP = (jdouble *)ENVPTR->GetDoubleArrayElements(ENVPAR right, &isCopy); + if (rightP == NULL) { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR left, leftP, JNI_ABORT); + ENVPTR->ReleaseDoubleArrayElements(ENVPAR middle, middleP, JNI_ABORT); + h5JNIFatalError(env, "H5Pget_btree_ratios: middle not pinned"); + } /* end if */ + else { + status = H5Pget_btree_ratios((hid_t)plist_id, (double *)leftP, + (double *)middleP, (double *)rightP); + if (status < 0) { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR left, leftP, JNI_ABORT); + ENVPTR->ReleaseDoubleArrayElements(ENVPAR middle, middleP, JNI_ABORT); + ENVPTR->ReleaseDoubleArrayElements(ENVPAR right, rightP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR left, leftP, 0); + ENVPTR->ReleaseDoubleArrayElements(ENVPAR middle, middleP, 0); + ENVPTR->ReleaseDoubleArrayElements(ENVPAR right, rightP, 0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_small_data_block_size + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1small_1data_1block_1size(JNIEnv *env, jclass clss, jlong plist, jlong size) +{ + long sz = (long)size; + herr_t retVal = -1; + + retVal = H5Pset_small_data_block_size((hid_t)plist, (hsize_t)sz); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1small_1data_1block_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_small_data_block_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1small_1data_1block_1size(JNIEnv *env, jclass clss, jlong plist) +{ + hsize_t s; + + if (H5Pget_small_data_block_size((hid_t)plist, &s) < 0) + h5libraryError(env); + + return (jlong)s; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1small_1data_1block_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_alloc_time + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1alloc_1time(JNIEnv *env, jclass clss, jlong plist, jint alloc_time) +{ + herr_t retVal = -1; + + retVal = H5Pset_alloc_time((hid_t)plist, (H5D_alloc_time_t)alloc_time); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1alloc_1time */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_alloc_time + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1alloc_1time(JNIEnv *env, jclass clss, jlong plist, jintArray alloc_time) +{ + herr_t retVal = -1; + jint *theArray; + jboolean isCopy; + H5D_alloc_time_t time; + + if (alloc_time == NULL) { + /* exception ? */ + h5nullArgument(env, "H5Pget_alloc_time: alloc_time is NULL"); + } /* end if */ + else { + theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR alloc_time, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_alloc_time: alloc_time not pinned"); + } /* end if */ + else { + retVal = H5Pget_alloc_time((hid_t)plist, &time); + if (retVal < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR alloc_time, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + theArray[0] = time; + ENVPTR->ReleaseIntArrayElements(ENVPAR alloc_time, theArray, 0); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1alloc_1time */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fill_time + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fill_1time(JNIEnv *env, jclass clss, jlong plist, jint fill_time) +{ + herr_t retVal = -1; + + retVal = H5Pset_fill_time((hid_t)plist, (H5D_fill_time_t)fill_time); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fill_1time */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fill_time + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1fill_1time(JNIEnv *env, jclass clss, jlong plist, jintArray fill_time) +{ + herr_t retVal = -1; + jint *theArray; + jboolean isCopy; + H5D_fill_time_t time; + + if (fill_time == NULL) { + /* exception ? */ + h5nullArgument(env, "H5Pget_fill_time: fill_time is NULL"); + } /* end if */ + else { + theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR fill_time, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_fill_time: fill_time not pinned"); + } /* end if */ + else { + retVal = H5Pget_fill_time((hid_t)plist, &time); + if (retVal < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR fill_time, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + theArray[0] = (jint)time; + ENVPTR->ReleaseIntArrayElements(ENVPAR fill_time, theArray, 0); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1fill_1time */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pfill_value_defined + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pfill_1value_1defined(JNIEnv *env, jclass clss, jlong plist, jintArray status) +{ + herr_t retVal = -1; + jint *theArray; + jboolean isCopy; + H5D_fill_value_t value; + + if (status == NULL) { + /* exception ? */ + h5nullArgument(env, "H5Pfill_value_defined: status is NULL"); + } /* end if */ + else { + theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR status, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pfill_value_defined: status not pinned"); + } /* end if */ + else { + retVal = H5Pfill_value_defined((hid_t)plist, &value); + if (retVal < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR status, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + theArray[0] = value; + ENVPTR->ReleaseIntArrayElements(ENVPAR status, theArray, 0); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pfill_1value_1defined */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fletcher32 + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fletcher32(JNIEnv *env, jclass clss, jlong plist) +{ + herr_t retVal = -1; + + retVal = H5Pset_fletcher32((hid_t)plist); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fletcher32 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_edc_check + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1edc_1check(JNIEnv *env, jclass clss, jlong plist, jint check) +{ + herr_t retVal = -1; + + retVal = H5Pset_edc_check((hid_t)plist, (H5Z_EDC_t)check); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1edc_1check */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_edc_check + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1edc_1check(JNIEnv *env, jclass clss, jlong plist) +{ + H5Z_EDC_t retVal = -1; + + retVal = H5Pget_edc_check((hid_t)plist); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1edc_1check */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_shuffle + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1shuffle(JNIEnv *env, jclass clss, jlong plist) +{ + herr_t retVal = -1; + + retVal = H5Pset_shuffle((hid_t)plist); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1shuffle */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_szip + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1szip(JNIEnv *env, jclass clss, jlong plist, jint options_mask, jint pixels_per_block) +{ + herr_t retVal = -1; + + retVal = H5Pset_szip((hid_t)plist, (unsigned int)options_mask, (unsigned int)pixels_per_block); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1szip */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_hyper_vector_size + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1hyper_1vector_1size(JNIEnv *env, jclass clss, jlong plist, jlong vector_size) +{ + herr_t retVal = -1; + + retVal = H5Pset_hyper_vector_size((hid_t)plist, (size_t)vector_size); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1hyper_1vector_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_hyper_vector_size + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1hyper_1vector_1size(JNIEnv *env, jclass clss, jlong plist, jlongArray vector_size) +{ + herr_t retVal = -1; + jlong *theArray; + size_t size; + jboolean isCopy; + + if (vector_size == NULL) { + /* exception ? */ + h5nullArgument(env, "H5Pget_hyper_vector_size: vector_size is NULL"); + } /* end if */ + else { + theArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR vector_size, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_hyper_vector_size: vector_size not pinned"); + } /* end if */ + else { + retVal = H5Pget_hyper_vector_size((hid_t)plist, &size); + if (retVal < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR vector_size, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + theArray[0] = (jlong)size; + ENVPTR->ReleaseLongArrayElements(ENVPAR vector_size, theArray, 0); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1hyper_1vector_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pall_filters_avail + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Pall_1filters_1avail(JNIEnv *env, jclass clss, jlong dcpl_id) +{ + htri_t bval = JNI_FALSE; + + bval = H5Pall_filters_avail((hid_t)dcpl_id); + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Pall_1filters_1avail */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pmodify_filter + * Signature: (JIIJ[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pmodify_1filter(JNIEnv *env, jclass clss, jlong plist, jint filter, + jint flags, jlong cd_nelmts, jintArray cd_values) +{ + herr_t status = -1; + jint *cd_valuesP; + jboolean isCopy; + + if (cd_values == NULL) { + h5nullArgument(env, "H5Pmodify_filter: cd_values is NULL"); + } /* end if */ + else { + cd_valuesP = ENVPTR->GetIntArrayElements(ENVPAR cd_values,&isCopy); + if (cd_valuesP == NULL) { + h5JNIFatalError(env, "H5Pmodify_filter: cd_values not pinned"); + } /* end if */ + else { + status = H5Pmodify_filter((hid_t)plist, (H5Z_filter_t)filter,(const unsigned int)flags, + (size_t)cd_nelmts, (unsigned int *)cd_valuesP); + + ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesP, JNI_ABORT); + + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pmodify_1filter */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_filter_by_id + * Signature: (JI[I[J[IJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id(JNIEnv *env, jclass clss, jlong plist, jint filter, + jintArray flags, jlongArray cd_nelmts, jintArray cd_values, jlong namelen, jobjectArray name) +{ + jboolean isCopy; + herr_t status = -1; + jint *cd_valuesArray; + jint *flagsArray; + jlong *cd_nelmtsArray; + jstring str; + char *aName; + int i = 0; + int rank; + long bs; + + bs = (long)namelen; + if (bs <= 0) { + h5badArgument(env, "H5Pget_filter_by_id: namelen <= 0"); + } /* end if */ + else if (flags == NULL) { + h5nullArgument(env, "H5Pget_filter_by_id: flags is NULL"); + } /* end else if */ + else if (cd_nelmts == NULL) { + h5nullArgument(env, "H5Pget_filter_by_id: cd_nelms is NULL"); + } /* end else if */ + else if (cd_values == NULL) { + h5nullArgument(env, "H5Pget_filter_by_id: cd_values is NULL"); + } /* end else if */ + else if (name == NULL) { + h5nullArgument(env, "H5Pget_filter_by_id: name is NULL"); + } /* end else if */ + else { + aName = (char*)HDmalloc(sizeof(char) * (size_t)bs); + if (aName == NULL) { + h5outOfMemory(env, "H5Pget_filter_by_id: malloc failed"); + return -1; + } /* end if */ + + flagsArray = ENVPTR->GetIntArrayElements(ENVPAR flags, &isCopy); + if (flagsArray == NULL) { + HDfree(aName); + h5JNIFatalError(env, "H5Pget_filter_by_id: flags not pinned"); + return -1; + } /* end if */ + + cd_nelmtsArray = ENVPTR->GetLongArrayElements(ENVPAR cd_nelmts, &isCopy); + if (cd_nelmtsArray == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + HDfree(aName); + h5JNIFatalError(env, "H5Pget_filter_by_id: cd_nelms not pinned"); + return -1; + } /* end if */ + + cd_valuesArray = ENVPTR->GetIntArrayElements(ENVPAR cd_values, &isCopy); + rank = ENVPTR->GetArrayLength(ENVPAR cd_values); + if (cd_valuesArray == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, JNI_ABORT); + HDfree(aName); + h5JNIFatalError(env, "H5Pget_filter_by_id: cd_values array not converted to unsigned int."); + return -1; + } /* end if */ + + { /* direct cast (size_t *)variable fails on 32-bit environment */ + long long cd_nelmts_temp = *(cd_nelmtsArray); + size_t cd_nelmts_t = (size_t)cd_nelmts_temp; + unsigned int filter_config; + + status = H5Pget_filter_by_id2( (hid_t)plist, (H5Z_filter_t)filter, + (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray, + (size_t)namelen, (char *)aName, &filter_config); + + *cd_nelmtsArray = (jlong)cd_nelmts_t; + } /* end direct cast special */ + + if (status < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, JNI_ABORT); + HDfree(aName); + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR aName); + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, 0); + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, 0); + ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, 0); + + HDfree(aName); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fclose_degree + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fclose_1degree(JNIEnv *env, jclass clss, jlong plist, jint fc_degree) +{ + herr_t retVal = -1; + + retVal = H5Pset_fclose_degree((hid_t)plist, (H5F_close_degree_t)fc_degree); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fclose_1degree */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fclose_degree + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1fclose_1degree(JNIEnv *env, jclass clss, jlong plist) +{ + H5F_close_degree_t degree; + + if (H5Pget_fclose_degree((hid_t)plist, °ree) < 0) + h5libraryError(env); + + return (jint)degree; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1fclose_1degree */ + + +/********************************************************************** + * * + * File access properties * + * * + **********************************************************************/ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_family + * Signature: (JJJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fapl_1family(JNIEnv *env, jclass clss, jlong plist, jlong memb_size, jlong memb_plist) +{ + long ms = (long)memb_size; + herr_t retVal = -1; + + retVal = H5Pset_fapl_family((hid_t)plist, (hsize_t)ms, (hid_t)memb_plist); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1family */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fapl_family + * Signature: (J[J[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family(JNIEnv *env, jclass clss, jlong tid, jlongArray memb_size, jlongArray memb_plist) +{ + herr_t status = -1; + jlong *sizeArray; + jlong *plistArray; + jboolean isCopy; + hsize_t *sa; + size_t i; + size_t rank; + + if (memb_size == NULL) { + h5nullArgument(env, "H5Pget_family: memb_size is NULL"); + } /* end if */ + else if (memb_plist == NULL) { + h5nullArgument(env, "H5Pget_family: memb_plist is NULL"); + } /* end else if */ + else { + sizeArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR memb_size, &isCopy); + if (sizeArray == NULL) { + h5JNIFatalError(env, "H5Pget_family: sizeArray not pinned"); + return -1; + } /* end if */ + rank = (size_t)ENVPTR->GetArrayLength(ENVPAR memb_size); + sa = (hsize_t *)HDmalloc(rank * sizeof(hsize_t)); + if (sa == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR memb_size, sizeArray, JNI_ABORT); + h5JNIFatalError(env, "H5Screate-simple: dims not converted to hsize_t"); + return -1; + } /* end if */ + plistArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR memb_plist, &isCopy); + if (plistArray == NULL) { + HDfree(sa); + ENVPTR->ReleaseLongArrayElements(ENVPAR memb_size, sizeArray, JNI_ABORT); + h5JNIFatalError(env, "H5Pget_family: plistArray not pinned"); + return -1; + } /* end if */ + + status = H5Pget_fapl_family ((hid_t)tid, sa, (hid_t *)plistArray); + + if (status < 0) { + HDfree(sa); + ENVPTR->ReleaseLongArrayElements(ENVPAR memb_size, sizeArray, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR memb_plist, plistArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + for (i = 0; i < rank; i++) { + sizeArray[i] = (jlong)sa[i]; + } /* end for */ + HDfree(sa); + ENVPTR->ReleaseLongArrayElements(ENVPAR memb_size, sizeArray, 0); + ENVPTR->ReleaseLongArrayElements(ENVPAR memb_plist, plistArray, 0); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_core + * Signature: (JJZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fapl_1core(JNIEnv *env, jclass clss, jlong fapl_id, jlong increment, jboolean backing_store) +{ + herr_t retVal = -1; + + retVal = H5Pset_fapl_core((hid_t)fapl_id, (size_t)increment, (hbool_t)backing_store); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1core */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fapl_core + * Signature: (J[J[Z)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core(JNIEnv *env, jclass clss, jlong fapl_id, jlongArray increment, jbooleanArray backing_store) +{ + herr_t status = -1; + jlong *incArray; + jboolean *backArray; + jboolean isCopy; + + if (increment == NULL) { + h5nullArgument(env, "H5Pget_fapl_core: increment is NULL"); + } /* end if */ + else if (backing_store == NULL) { + h5nullArgument(env, "H5Pget_fapl_core: backing_store is NULL"); + } /* end else if */ + else { + incArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR increment, &isCopy); + if (incArray == NULL) { + h5JNIFatalError(env, "H5Pget_fapl_core: incArray not pinned"); + return -1; + } /* end if */ + + backArray = (jboolean *)ENVPTR->GetBooleanArrayElements(ENVPAR backing_store, &isCopy); + if (backArray == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR increment, incArray, JNI_ABORT); + h5JNIFatalError(env, "H5Pget_fapl_core: backArray not pinned"); + return -1; + } /* end if */ + + { /* direct cast (size_t *)variable fails on 32-bit environment */ + long long inc_temp = *(incArray); + size_t inc_t = (size_t)inc_temp; + + status = H5Pget_fapl_core((hid_t)fapl_id, &inc_t, (hbool_t *)backArray); + + *incArray = (jlong)inc_t; + } /* end direct cast special */ + + if (status < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR increment, incArray, JNI_ABORT); + ENVPTR->ReleaseBooleanArrayElements(ENVPAR backing_store, backArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + ENVPTR->ReleaseLongArrayElements(ENVPAR increment, incArray, 0); + ENVPTR->ReleaseBooleanArrayElements(ENVPAR backing_store, backArray, 0); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_family_offset + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1family_1offset(JNIEnv *env, jclass clss, jlong fapl_id, jlong offset) +{ + herr_t retVal = -1; + + retVal = H5Pset_family_offset ((hid_t)fapl_id, (hsize_t)offset); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1family_1offset */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_family_offset + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1family_1offset(JNIEnv *env, jclass clss, jlong fapl_id) +{ + hsize_t offset = 0; + herr_t retVal = -1; + + retVal = H5Pget_family_offset ((hid_t)fapl_id, &offset); + if (retVal < 0) + h5libraryError(env); + + return (jlong)offset; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1family_1offset */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_log + * Signature: (JLjava/lang/String;JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log(JNIEnv *env, jclass clss, jlong fapl_id, jstring logfile, jlong flags, jlong buf_size) +{ + herr_t retVal = -1; + const char *pLogfile; + + PIN_JAVA_STRING0(logfile, pLogfile); + + retVal = H5Pset_fapl_log( (hid_t)fapl_id, pLogfile, (unsigned long long)flags, (size_t)buf_size ); + + UNPIN_JAVA_STRING(logfile, pLogfile); + + if (retVal < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Premove_filter + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5P1remove_1filter(JNIEnv *env, jclass clss, jlong obj_id, jint filter) +{ + herr_t status = -1; + + status = H5Premove_filter ((hid_t)obj_id, (H5Z_filter_t)filter); + if (status < 0) + h5libraryError(env); + + return status; +} /* end Java_hdf_hdf5lib_H5_H5P1remove_1filter */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset + * Signature: (JLjava/lang/String;I)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pset(JNIEnv *env, jclass clss, jlong plid, jstring name, jint val) +{ + hid_t retVal = -1; + const char *cstr; + + PIN_JAVA_STRING(name, cstr, -1); + + retVal = H5Pset((hid_t)plid, cstr, &val); + + UNPIN_JAVA_STRING(name, cstr); + + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pexist + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pexist(JNIEnv *env, jclass clss, jlong plid, jstring name) +{ + hid_t retVal = -1; + const char *cstr; + + PIN_JAVA_STRING(name, cstr, -1); + + retVal = H5Pexist((hid_t)plid, cstr); + + UNPIN_JAVA_STRING(name, cstr); + + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pexist */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_size + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1size(JNIEnv *env, jclass clss, jlong plid, jstring name) +{ + hid_t retVal = -1; + const char *cstr; + size_t size; + + PIN_JAVA_STRING(name, cstr, -1); + + retVal = H5Pget_size((hid_t)plid, cstr, &size); + + UNPIN_JAVA_STRING(name, cstr); + + if (retVal < 0) + h5libraryError(env); + + return (jlong) size; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_nprops + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1nprops(JNIEnv *env, jclass clss, jlong plid) +{ + size_t nprops; + + if (H5Pget_nprops((hid_t)plid, &nprops) < 0) + h5libraryError(env); + + return (jlong)nprops; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1nprops */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_class_name + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1class_1name(JNIEnv *env, jclass clss, jlong plid) +{ + char *c_str; + jstring j_str; + + c_str = H5Pget_class_name((hid_t)plid); + if (c_str == NULL) { + h5libraryError(env); + } /* end if */ + else { + j_str = ENVPTR->NewStringUTF(ENVPAR c_str); + H5free_memory(c_str); + + if (j_str == NULL) + h5JNIFatalError(env,"H5Pget_class_name: return string failed"); + } /* end else */ + return j_str; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1class_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_class_parent + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1class_1parent(JNIEnv *env, jclass clss, jlong plid) +{ + hid_t retVal = -1; + + retVal = H5Pget_class_parent((hid_t)plid); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1class_1parent */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pisa_class + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pisa_1class(JNIEnv *env, jclass clss, jlong plid, jlong pcls) +{ + htri_t retVal = -1; + + retVal = H5Pisa_class((hid_t)plid, (hid_t)pcls); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pisa_1class */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget(JNIEnv *env, jclass clss, jlong plid, jstring name) +{ + herr_t retVal = -1; + const char *cstr; + jint val; + + PIN_JAVA_STRING(name, cstr, -1); + + retVal = H5Pget((hid_t)plid, cstr, &val); + + UNPIN_JAVA_STRING(name, cstr); + + if (retVal < 0) + h5libraryError(env); + + return (jint)val; +} /* end Java_hdf_hdf5lib_H5_H5Pget */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pequal + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pequal(JNIEnv *env, jclass clss, jlong plid1, jlong plid2) +{ + htri_t retVal = -1; + + retVal = H5Pequal((hid_t)plid1, (hid_t)plid2); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pequal */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pcopy_prop + * Signature: (JJLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pcopy_1prop(JNIEnv *env, jclass clss, jlong dst_plid, jlong src_plid, jstring name) +{ + herr_t retVal = -1; + const char *cstr; + + PIN_JAVA_STRING(name, cstr, -1); + + retVal = H5Pcopy_prop((hid_t)dst_plid, (hid_t)src_plid, cstr); + + UNPIN_JAVA_STRING(name, cstr); + + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pcopy_1prop */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Premove + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Premove(JNIEnv *env, jclass clss, jlong plid, jstring name) +{ + herr_t retVal = -1; + const char *cstr; + + PIN_JAVA_STRING(name, cstr, -1); + + retVal = H5Premove((hid_t)plid, cstr); + + UNPIN_JAVA_STRING(name, cstr); + + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Premove */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Punregister + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Punregister(JNIEnv *env, jclass clss, jlong plid, jstring name) +{ + herr_t retVal = -1; + const char *cstr; + + PIN_JAVA_STRING(name, cstr, -1); + + retVal = H5Punregister((hid_t)plid, cstr); + + UNPIN_JAVA_STRING(name, cstr); + + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Punregister */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Pclose_class + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5__1H5Pclose_1class(JNIEnv *env, jclass clss, jlong plid) +{ + herr_t retVal = -1; + + retVal = H5Pclose_class((hid_t)plid); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_filter2 + * Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1filter2(JNIEnv *env, jclass clss, jlong plist, jint filter_number, + jintArray flags, jlongArray cd_nelmts, jintArray cd_values, jlong namelen, + jobjectArray name, jintArray filter_config) +{ + herr_t status = -1; + jint *flagsArray; + jlong *cd_nelmtsArray; + jint *cd_valuesArray; + jint *filter_configArray; + jboolean isCopy; + char *filter; + jstring str; + + if (namelen <= 0) { + h5badArgument(env, "H5Pget_filter: namelen <= 0"); + } /* end if */ + else if (flags == NULL) { + h5badArgument(env, "H5Pget_filter: flags is NULL"); + } /* end else if */ + else if (cd_nelmts == NULL) { + h5badArgument(env, "H5Pget_filter: cd_nelmts is NULL"); + } /* end else if */ + else if (filter_config == NULL) { + h5badArgument(env, "H5Pget_filter: filter_config is NULL"); + } /* end else if */ + else { + filter = (char*)HDmalloc(sizeof(char)*(size_t)namelen); + if (filter == NULL) { + h5outOfMemory(env, "H5Pget_filter: namelent malloc failed"); + return -1; + } /* end if */ + flagsArray = (jint*)ENVPTR->GetIntArrayElements(ENVPAR flags, &isCopy); + if (flagsArray == NULL) { + HDfree(filter); + h5JNIFatalError(env, "H5Pget_filter: flags array not pinned"); + return -1; + } /* end if */ + + cd_nelmtsArray = (jlong*)ENVPTR->GetLongArrayElements(ENVPAR cd_nelmts, &isCopy); + if (cd_nelmtsArray == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + HDfree(filter); + h5JNIFatalError(env, "H5Pget_filter: nelmts array not pinned"); + return -1; + } /* end if */ + filter_configArray = (jint*)ENVPTR->GetIntArrayElements(ENVPAR filter_config, &isCopy); + if (filter_configArray == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + HDfree(filter); + h5JNIFatalError(env, "H5Pget_filter: filter_config array not pinned"); + return -1; + } /* end if */ + + if (*cd_nelmtsArray == 0 && cd_values == NULL) { + /* direct cast (size_t *)variable fails on 32-bit environment */ + long long cd_nelmts_temp = 0; + size_t cd_nelmts_t = (size_t)cd_nelmts_temp; + + status = H5Pget_filter2((hid_t)plist, (unsigned)filter_number, + (unsigned int *)flagsArray, &cd_nelmts_t, NULL, + (size_t)namelen, filter, (unsigned int *)filter_configArray); + + *cd_nelmtsArray = (jlong)cd_nelmts_t; + } /* end if */ + else { + if (cd_values == NULL) { + h5badArgument(env, "H5Pget_filter: cd_values is NULL"); + return -1; + } /* end if */ + cd_valuesArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR cd_values, &isCopy); + if (cd_valuesArray == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR filter_config, filter_configArray, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + HDfree(filter); + h5JNIFatalError(env, "H5Pget_filter: elmts array not pinned"); + return -1; + } /* end if */ + + { /* direct cast (size_t *)variable fails on 32-bit environment */ + long long cd_nelmts_temp = *(cd_nelmtsArray); + size_t cd_nelmts_t = (size_t)cd_nelmts_temp; + + status = H5Pget_filter2((hid_t)plist, (unsigned)filter_number, + (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray, + (size_t)namelen, filter, (unsigned int *)filter_configArray); + + *cd_nelmtsArray = (jlong)cd_nelmts_t; + } /* end direct cast special */ + } /* end else */ + + if (status < 0) { + if (cd_values) + ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR filter_config, filter_configArray, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + HDfree(filter); + h5libraryError(env); + } /* end if */ + else { + if (cd_values) + ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, 0); + ENVPTR->ReleaseIntArrayElements(ENVPAR filter_config, filter_configArray, 0); + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, 0); + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, 0); + /* NewStringUTF may throw OutOfMemoryError */ + str = ENVPTR->NewStringUTF(ENVPAR filter); + HDfree(filter); + if (str == NULL) + h5JNIFatalError(env, "H5Pget_filter: return string not pinned"); + else + ENVPTR->SetObjectArrayElement(ENVPAR name, 0, (jobject)str); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_filter_by_id2 + * Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2(JNIEnv *env, jclass clss, jlong plist, jint filter, + jintArray flags, jlongArray cd_nelmts, jintArray cd_values, jlong namelen, jobjectArray name, jintArray filter_config) +{ + herr_t status = -1; + int i = 0; + jint *cd_valuesArray; + jint *flagsArray; + jint *filter_configArray; + jlong *cd_nelmtsArray; + jboolean isCopy; + long bs; + char *aName; + jstring str; + + bs = (long)namelen; + if (bs <= 0) { + h5badArgument(env, "H5Pget_filter_by_id: namelen <= 0"); + } /* end if */ + else if (flags == NULL) { + h5nullArgument(env, "H5Pget_filter_by_id: flags is NULL"); + } /* end else if */ + else if (cd_nelmts == NULL) { + h5nullArgument(env, "H5Pget_filter_by_id: cd_nelms is NULL"); + } /* end else if */ + else if (cd_values == NULL) { + h5nullArgument(env, "H5Pget_filter_by_id: cd_values is NULL"); + } /* end else if */ + else if (name == NULL) { + h5nullArgument(env, "H5Pget_filter_by_id: name is NULL"); + } /* end else if */ + else if (filter_config == NULL) { + h5badArgument(env, "H5Pget_filter_by_id: filter_config is NULL"); + } /* end else if */ + else { + aName = (char*)HDmalloc(sizeof(char) * (size_t)bs); + if (aName == NULL) { + h5outOfMemory(env, "H5Pget_filter_by_id: malloc failed"); + return -1; + } /* end if */ + flagsArray = ENVPTR->GetIntArrayElements(ENVPAR flags,&isCopy); + if (flagsArray == NULL) { + HDfree(aName); + h5JNIFatalError(env, "H5Pget_filter_by_id: flags not pinned"); + return -1; + } /* end if */ + cd_nelmtsArray = ENVPTR->GetLongArrayElements(ENVPAR cd_nelmts, &isCopy); + if (cd_nelmtsArray == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + HDfree(aName); + h5JNIFatalError(env, "H5Pget_filter_by_id: cd_nelms not pinned"); + return -1; + } /* end if */ + cd_valuesArray = ENVPTR->GetIntArrayElements(ENVPAR cd_values, &isCopy); + if (cd_valuesArray == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT); + HDfree(aName); + h5JNIFatalError(env, "H5Pget_filter_by_id: cd_values array not converted to unsigned int."); + return -1; + } /* end if */ + filter_configArray = ENVPTR->GetIntArrayElements(ENVPAR filter_config, &isCopy); + if (filter_configArray == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, JNI_ABORT); + HDfree(aName); + h5JNIFatalError(env, "H5Pget_filter_by_id: flags not pinned"); + return -1; + } /* end if */ + + { /* direct cast (size_t *)variable fails on 32-bit environment */ + long long cd_nelmts_temp = *(cd_nelmtsArray); + size_t cd_nelmts_t = (size_t)cd_nelmts_temp; + + status = H5Pget_filter_by_id2((hid_t)plist, (H5Z_filter_t)filter, + (unsigned int *)flagsArray, &cd_nelmts_t, (unsigned int *)cd_valuesArray, + (size_t)namelen, (char *)aName, (unsigned int *)filter_configArray); + + *cd_nelmtsArray = (jlong)cd_nelmts_t; + } /* end direct cast special handling */ + + if (status < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR filter_config, filter_configArray, JNI_ABORT); + HDfree(aName); + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR aName); + HDfree(aName); + ENVPTR->ReleaseIntArrayElements(ENVPAR flags, flagsArray, 0); + ENVPTR->ReleaseLongArrayElements(ENVPAR cd_nelmts, cd_nelmtsArray, 0); + ENVPTR->ReleaseIntArrayElements(ENVPAR cd_values, cd_valuesArray, 0); + ENVPTR->ReleaseIntArrayElements(ENVPAR filter_config, filter_configArray, 0); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_nlinks + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1nlinks(JNIEnv *env, jclass clss, jlong lapl_id) +{ + size_t nlinks; + if (H5Pget_nlinks((hid_t)lapl_id, &nlinks) < 0) + h5libraryError(env); + + return (jlong) nlinks; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1nlinks */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_nlinks + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1nlinks(JNIEnv *env, jclass clss, jlong lapl_id, jlong nlinks) +{ + herr_t retVal = -1; + + if (nlinks <= 0) { + h5badArgument(env, "H5Pset_1nlinks: nlinks_l <= 0"); + } /* end if */ + else { + retVal = H5Pset_nlinks((hid_t)lapl_id, (size_t)nlinks); + if(retVal < 0) + h5libraryError(env); + } /* end else */ + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1nlinks */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_libver_bounds + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds(JNIEnv *env, jclass clss, jlong fapl_id, jintArray libver) +{ + herr_t retVal = -1; + H5F_libver_t *theArray = NULL; + jboolean isCopy; + + if (libver == NULL) { + h5nullArgument(env, "H5Pget_libver_bounds: libversion bounds is NULL"); + } /* end if */ + else { + theArray = (H5F_libver_t*)ENVPTR->GetIntArrayElements(ENVPAR libver, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_libver_bounds: input not pinned"); + } /* end if */ + else { + retVal = H5Pget_libver_bounds((hid_t)fapl_id, &(theArray[0]), &(theArray[1])); + if(retVal < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR libver, (jint*)theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR libver, (jint*)theArray, 0); + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_libver_bounds + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds(JNIEnv *env, jclass clss, jlong fapl_id, jint low, jint high) +{ + herr_t retVal = -1; + + if ((H5F_libver_t)high != H5F_LIBVER_LATEST) { + h5badArgument(env, "H5Pset_libver_bounds: invalid high library version bound"); + } /* end if */ + else if(((H5F_libver_t)low !=H5F_LIBVER_EARLIEST) && ((H5F_libver_t)low != H5F_LIBVER_LATEST)) { + h5badArgument(env, "H5Pset_libver_bounds: invalid low library version bound"); + } /* end else if */ + else { + retVal = H5Pset_libver_bounds((hid_t)fapl_id, (H5F_libver_t)low, (H5F_libver_t)high); + if(retVal < 0) + h5libraryError(env); + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_link_creation_order + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1link_1creation_1order(JNIEnv *env, jclass clss, jlong gcpl_id) +{ + unsigned crt_order_flags; + + if(H5Pget_link_creation_order((hid_t)gcpl_id, &crt_order_flags) < 0) + h5libraryError(env); + + return (jint)crt_order_flags; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1link_1creation_1order */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_link_creation_order + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order(JNIEnv *env, jclass clss, jlong gcpl_id, jint crt_order_flags) +{ + herr_t retVal = -1; + + retVal = H5Pset_link_creation_order((hid_t)gcpl_id, (unsigned)crt_order_flags); + if(retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_attr_creation_order + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1attr_1creation_1order(JNIEnv *env, jclass clss, jlong ocpl_id) +{ + unsigned crt_order_flags; + + if(H5Pget_attr_creation_order((hid_t)ocpl_id, &crt_order_flags) < 0) + h5libraryError(env); + + return (jint)crt_order_flags; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1attr_1creation_1order */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_attr_creation_order + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1attr_1creation_1order(JNIEnv *env, jclass clss, jlong ocpl_id, jint crt_order_flags) +{ + herr_t retVal = -1; + + retVal = H5Pset_attr_creation_order((hid_t)ocpl_id, (unsigned)crt_order_flags); + if(retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1attr_1creation_1order */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_copy_object + * Signature: (JI)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1copy_1object(JNIEnv *env, jclass clss, jlong ocp_plist_id, jint copy_options) +{ + herr_t retVal = -1; + + retVal = H5Pset_copy_object((hid_t)ocp_plist_id, (unsigned)copy_options); + if(retVal < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1copy_1object */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_copy_object + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1copy_1object(JNIEnv *env, jclass clss, jlong ocp_plist_id) +{ + unsigned copy_options; + + if(H5Pget_copy_object((hid_t)ocp_plist_id, ©_options) < 0) + h5libraryError(env); + + return (jint)copy_options; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1copy_1object */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_create_intermediate_group + * Signature: (JZ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1create_1intermediate_1group(JNIEnv *env, jclass clss, jlong lcpl_id, jboolean crt_intermed_group) +{ + herr_t retVal = -1; + + retVal = H5Pset_create_intermediate_group((hid_t)lcpl_id, (unsigned)crt_intermed_group); + if(retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1create_1intermediate_1group */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_create_intermediate_group + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1create_1intermediate_1group(JNIEnv *env, jclass clss, jlong lcpl_id) +{ + unsigned crt_intermed_group; + + if(H5Pget_create_intermediate_group((hid_t)lcpl_id, &crt_intermed_group) < 0) + h5libraryError(env); + + return (jboolean)crt_intermed_group; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1create_1intermediate_1group */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_data_transform + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1data_1transform(JNIEnv *env, jclass clss, jlong plist_id, jstring expression) +{ + herr_t retVal = -1; + const char *express; + + PIN_JAVA_STRING(expression, express, -1); + + retVal = H5Pset_data_transform((hid_t)plist_id, express); + + UNPIN_JAVA_STRING(expression, express); + + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1data_1transform */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_data_transform + * Signature: (J[Ljava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1data_1transform(JNIEnv *env, jclass clss, jlong plist_id, jobjectArray expression, jlong size) +{ + size_t buf_size; + char *express; + jlong express_size = -1; + jstring str = NULL; + + if (size <= 0) { + h5badArgument(env, "H5Pget_data_transform: size <= 0"); + } /* end if */ + else { + express_size = (jlong)H5Pget_data_transform((hid_t)plist_id, (char*)NULL, (size_t)size); + if(express_size < 0) { + h5libraryError(env); + } /* end if */ + else { + buf_size = (size_t)express_size + 1;/* add extra space for the null terminator */ + express = (char*)HDmalloc(sizeof(char) * buf_size); + if (express == NULL) { + h5outOfMemory(env, "H5Pget_data_transform: malloc failed "); + } /* end if */ + else { + express_size = (jlong)H5Pget_data_transform((hid_t)plist_id, express, (size_t)size); + if (express_size < 0) { + HDfree(express); + h5libraryError(env); + } + else { + str = ENVPTR->NewStringUTF(ENVPAR express); + HDfree(express); + if (str == NULL) + h5JNIFatalError(env, "H5Pget_data_transform: return string not created"); + else + ENVPTR->SetObjectArrayElement(ENVPAR expression, 0, str); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + return express_size; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1data_1transform */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_elink_acc_flags + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1elink_1acc_1flags(JNIEnv *env, jclass clss, jlong lapl_id) +{ + unsigned flags; + + if(H5Pget_elink_acc_flags((hid_t)lapl_id, &flags) < 0) + h5libraryError(env); + + return (jint)flags; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1elink_1acc_1flags */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_elink_acc_flags + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags(JNIEnv *env, jclass clss, jlong lapl_id, jint flags) +{ + herr_t retVal = -1; + + if (((unsigned) flags != H5F_ACC_RDWR) && + ((unsigned) flags != H5F_ACC_RDONLY) && + ((unsigned) flags != H5F_ACC_DEFAULT)) { + h5badArgument(env, "H5Pset_elink_acc_flags: invalid flags value"); + } /* end if */ + else { + retVal = H5Pset_elink_acc_flags((hid_t)lapl_id, (unsigned)flags); + if (retVal < 0) + h5libraryError(env); + } /* end else */ + return (jint) retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_link_phase_change + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1link_1phase_1change(JNIEnv *env, jclass clss, jlong gcpl_id, jint max_compact, jint min_dense) +{ + herr_t retVal = -1; + + if(max_compact < min_dense) { + h5badArgument(env, "H5Pset_link_phase_change: max compact value must be >= min dense value"); + } /* end if */ + else if(max_compact > 65535) { + h5badArgument(env, "H5Pset_link_phase_change: max compact value must be < 65536"); + } /* end else if */ + else if(min_dense > 65535) { + h5badArgument(env, "H5Pset_link_phase_change: min dense value must be < 65536"); + } /* end else if */ + else { + retVal = H5Pset_link_phase_change((hid_t)gcpl_id, (unsigned)max_compact, (unsigned)min_dense); + if(retVal < 0) + h5libraryError(env); + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1link_1phase_1change */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_link_phase_change + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change (JNIEnv *env, jclass clss, jlong gcpl_id, jintArray links) +{ + herr_t retVal = -1; + unsigned *theArray = NULL; + jboolean isCopy; + + if (links == NULL) { + h5nullArgument( env, "H5Pget_link_phase_change: links is NULL"); + } /* end if */ + else { + theArray = (unsigned *)ENVPTR->GetIntArrayElements(ENVPAR links, &isCopy); + if (theArray == NULL) { + h5JNIFatalError( env, "H5Pget_link_phase_change: input not pinned"); + } /* end if */ + else { + retVal = H5Pget_link_phase_change((hid_t)gcpl_id, &(theArray[0]), &(theArray[1])); + if(retVal < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR links, (jint *)theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR links, (jint *)theArray, 0); + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_attr_phase_change + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1attr_1phase_1change(JNIEnv *env, jclass clss, jlong ocpl_id, jintArray attributes) +{ + herr_t retVal = -1; + unsigned *theArray = NULL; + jboolean isCopy; + + if (attributes == NULL) { + h5nullArgument(env, "H5Pget_attr_phase_change: attributes is NULL"); + } /* end if */ + else { + theArray = (unsigned *)ENVPTR->GetIntArrayElements(ENVPAR attributes, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_attr_phase_change: input not pinned"); + } /* end if */ + else { + retVal = H5Pget_attr_phase_change((hid_t)ocpl_id, &(theArray[0]), &(theArray[1])); + if(retVal < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR attributes, (jint *)theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR attributes, (jint *)theArray, 0); + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1attr_1phase_1change */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_attr_phase_change + * Signature: (JII)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1attr_1phase_1change(JNIEnv *env, jclass clss, jlong ocpl_id, jint max_compact, jint min_dense) +{ + herr_t retVal = -1; + + retVal = H5Pset_attr_phase_change((hid_t)ocpl_id, (unsigned)max_compact, (unsigned)min_dense); + if(retVal < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1attr_1phase_1change */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_shared_mesg_phase_change + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1phase_1change(JNIEnv *env, jclass clss, jlong fcpl_id, jintArray size) +{ + herr_t retVal = -1; + unsigned *theArray = NULL; + jboolean isCopy; + + if (size == NULL) { + h5nullArgument(env, "H5Pget_shared_mesg_phase_change: size is NULL"); + } /* end if */ + else { + theArray = (unsigned *)ENVPTR->GetIntArrayElements(ENVPAR size, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_shared_mesg_phase_change: input not pinned"); + } /* end if */ + else { + retVal = H5Pget_shared_mesg_phase_change((hid_t)fcpl_id, &(theArray[0]), &(theArray[1])); + if(retVal < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR size, (jint *)theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR size, (jint *)theArray, 0); + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1phase_1change */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_shared_mesg_phase_change + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1phase_1change(JNIEnv *env, jclass clss, jlong fcpl_id, jint max_list, jint min_btree) +{ + herr_t retVal = -1; + + /* Check that values are sensible. The min_btree value must be no greater + * than the max list plus one. + * + * Range check to make certain they will fit into encoded form. + */ + + if(max_list + 1 < min_btree) { + h5badArgument(env, "H5Pset_shared_mesg_phase_change: minimum B-tree value is greater than maximum list value"); + } /* end if */ + else if(max_list > H5O_SHMESG_MAX_LIST_SIZE) { + h5badArgument(env, "H5Pset_shared_mesg_phase_change: max list value is larger than H5O_SHMESG_MAX_LIST_SIZE"); + } /* end else if */ + else if(min_btree > H5O_SHMESG_MAX_LIST_SIZE) { + h5badArgument(env, "H5Pset_shared_mesg_phase_change: min btree value is larger than H5O_SHMESG_MAX_LIST_SIZE"); + } /* end else if */ + else { + retVal = H5Pset_shared_mesg_phase_change((hid_t)fcpl_id, (unsigned)max_list, (unsigned)min_btree); + if(retVal < 0) + h5libraryError(env); + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1phase_1change */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_shared_mesg_nindexes + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1nindexes(JNIEnv *env, jclass clss, jlong fcpl_id) +{ + unsigned nindexes; + + if(H5Pget_shared_mesg_nindexes((hid_t)fcpl_id, &nindexes) < 0) + h5libraryError(env); + + return (jint)nindexes; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1nindexes */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_shared_mesg_nindexes + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1nindexes(JNIEnv *env, jclass clss, jlong plist_id, jint nindexes) +{ + herr_t retVal = -1; + + if (nindexes > H5O_SHMESG_MAX_NINDEXES) { + h5badArgument(env, "H5Pset_shared_mesg_nindexes: number of indexes is greater than H5O_SHMESG_MAX_NINDEXES"); + } /* end if */ + else { + retVal = H5Pset_shared_mesg_nindexes((hid_t)plist_id, (unsigned)nindexes); + if(retVal < 0) + h5libraryError(env); + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1nindexes */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_shared_mesg_index + * Signature: (JIII)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1index(JNIEnv *env, jclass clss, jlong fcpl_id, jint index_num, + jint mesg_type_flags, jint min_mesg_size) +{ + herr_t retVal = -1; + unsigned nindexes;/* Number of SOHM indexes */ + + /* Check arguments */ + if(mesg_type_flags > H5O_SHMESG_ALL_FLAG) { + h5badArgument(env, "H5Pset_shared_mesg_index: unrecognized flags in mesg_type_flags"); + } /* end if */ + else if(H5Pget_shared_mesg_nindexes((hid_t)fcpl_id, &nindexes) < 0) { /* Read the current number of indexes */ + h5libraryError(env); + } /* end else if */ + else { + /* Range check */ + if((unsigned)index_num >= nindexes) { + h5badArgument(env, "H5Pset_shared_mesg_index: index_num is too large; no such index"); + } /* end if */ + else { + retVal = H5Pset_shared_mesg_index((hid_t)fcpl_id, (unsigned)index_num, (unsigned) mesg_type_flags, (unsigned) min_mesg_size); + if(retVal < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1index */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_shared_mesg_index + * Signature: (JI[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1index(JNIEnv *env, jclass clss, jlong fcpl_id, jint index_num, jintArray mesg_info) +{ + herr_t retVal = -1; + unsigned nindexes;/* Number of SOHM indexes */ + unsigned *theArray = NULL; + jboolean isCopy; + + /* Read the current number of indexes */ + if(H5Pget_shared_mesg_nindexes((hid_t)fcpl_id, &nindexes)<0) { + h5libraryError(env); + } /* end if */ + else { + /* Range check */ + if((unsigned)index_num >= nindexes) { + h5badArgument(env, "H5Pget_shared_mesg_index: index_num is too large; no such index"); + } /* end if */ + else if (mesg_info == NULL) { + h5nullArgument(env, "H5Pget_shared_mesg_index: mesg_info is NULL"); + } /* end else if */ + else { + theArray = (unsigned *)ENVPTR->GetIntArrayElements(ENVPAR mesg_info, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_shared_mesg_index: input not pinned"); + } /* end if */ + else { + retVal = H5Pget_shared_mesg_index((hid_t)fcpl_id, (unsigned)index_num, &(theArray[0]), &(theArray[1])); + if(retVal < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR mesg_info, (jint*)theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR mesg_info, (jint*)theArray, 0); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1index */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_local_heap_size_hint + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1local_1heap_1size_1hint(JNIEnv *env, jclass clss, jlong gcpl_id, jlong size_hint) +{ + herr_t retVal = -1; + + retVal = H5Pset_local_heap_size_hint((hid_t)gcpl_id, (size_t)size_hint); + if(retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1local_1heap_1size_1hint */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_local_heap_size_hint + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1local_1heap_1size_1hint(JNIEnv *env, jclass clss, jlong gcpl_id) +{ + size_t size_hint; + + if(H5Pget_local_heap_size_hint((hid_t)gcpl_id, &size_hint) < 0) + h5libraryError(env); + + return (jlong)size_hint; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1local_1heap_1size_1hint */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_nbit + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1nbit(JNIEnv *env, jclass clss, jlong plist_id) +{ + herr_t retVal = -1; + + retVal = H5Pset_nbit((hid_t)plist_id); + if(retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1nbit */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_scaleoffset + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1scaleoffset(JNIEnv *env, jclass clss, jlong plist_id, jint scale_type, jint scale_factor) +{ + herr_t retVal = -1; + + /* Check arguments */ + if(scale_factor < 0) { + h5badArgument(env, "H5Pset_scaleoffset: scale factor must be > 0"); + } /* end if */ + else { + if(scale_type != H5Z_SO_FLOAT_DSCALE && scale_type != H5Z_SO_FLOAT_ESCALE && scale_type != H5Z_SO_INT){ + h5badArgument(env, "H5Pset_scaleoffset: invalid scale type"); + } /* end if */ + else { + retVal = H5Pset_scaleoffset((hid_t)plist_id, (H5Z_SO_scale_type_t)scale_type, scale_factor); + if(retVal < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1scaleoffset */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_est_link_info + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info(JNIEnv *env, jclass clss, jlong gcpl_id, jint est_num_entries, jint est_name_len) +{ + herr_t retVal = -1; + + /* Range check values */ + if((est_num_entries > 65535) || (est_name_len > 65535)) { + h5badArgument(env, "H5Pset_est_link_info: est. name length or number of entries must be < 65536"); + } /* end if */ + else { + retVal = H5Pset_est_link_info((hid_t)gcpl_id, (unsigned)est_num_entries, (unsigned)est_name_len); + if(retVal < 0) + h5libraryError(env); + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_est_link_info + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info(JNIEnv *env, jclass clss, jlong gcpl_id, jintArray link_info) +{ + herr_t retVal = -1; + unsigned *theArray = NULL; + jboolean isCopy; + + if (link_info == NULL) { + h5nullArgument(env, "H5Pget_est_link_info: link_info is NULL"); + } /* end if */ + else { + theArray = (unsigned *)ENVPTR->GetIntArrayElements(ENVPAR link_info,&isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_est_link_info: input not pinned"); + } /* end if */ + else { + retVal= H5Pget_est_link_info((hid_t)gcpl_id, &(theArray[0]), &(theArray[1])); + if(retVal < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR link_info, (jint *)theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR link_info, (jint *)theArray, 0); + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_elink_fapl + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1elink_1fapl(JNIEnv *env, jclass clss, jlong lapl_id, jlong fapl_id) +{ + herr_t retVal = -1; + + retVal = H5Pset_elink_fapl((hid_t)lapl_id, (hid_t)fapl_id); + if(retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1fapl */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Pget_elink_fapl + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Pget_1elink_1fapl(JNIEnv *env, jclass clss, jlong lapl_id) +{ + hid_t retVal = -1; + + retVal = H5Pget_elink_fapl((hid_t)lapl_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Pget_1elink_1fapl */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_elink_prefix + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1elink_1prefix(JNIEnv *env, jclass clss, jlong lapl_id, jstring prefix) +{ + herr_t retVal = -1; + const char *aName; + + PIN_JAVA_STRING(prefix, aName, -1); + + retVal = H5Pset_elink_prefix((hid_t)lapl_id, aName); + + UNPIN_JAVA_STRING(prefix, aName); + + if(retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1prefix */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_elink_prefix + * Signature: (J[Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix(JNIEnv *env, jclass clss, jlong lapl_id, jobjectArray prefix) +{ + size_t size = 0; + char *pre; + jlong prefix_size; + jstring str = NULL; + + if (prefix == NULL) { + h5nullArgument(env, "H5Pget_elink_prefix: prefix is NULL"); + } /* end if */ + else { + prefix_size = (jlong)H5Pget_elink_prefix((hid_t)lapl_id, (char*)NULL, size); + if(prefix_size < 0) { + h5libraryError(env); + } /* end if */ + else { + size = (size_t)prefix_size + 1;/* add extra space for the null terminator */ + pre = (char*)HDmalloc(sizeof(char)*size); + if (pre == NULL) { + h5outOfMemory(env, "H5Pget_elink_prefix: malloc failed "); + } /* end if */ + else { + prefix_size = (jlong)H5Pget_elink_prefix((hid_t)lapl_id, (char*)pre, size); + + if (prefix_size < 0) { + HDfree(pre); + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR pre); + HDfree(pre); + if (str == NULL) { + h5JNIFatalError(env, "H5Pget_elink_prefix: return string not created"); + } /* end if */ + else + ENVPTR->SetObjectArrayElement(ENVPAR prefix, 0, str); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return prefix_size; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_direct + * Signature: (JJJJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fapl_1direct(JNIEnv *env, jclass clss, jlong fapl_id, jlong alignment, + jlong block_size, jlong cbuf_size) +{ + herr_t retVal = -1; + +#ifdef H5_HAVE_DIRECT + retVal = H5Pset_fapl_direct((hid_t)fapl_id, (size_t)alignment, (size_t)block_size, (size_t)cbuf_size); +#endif + if(retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1direct */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fapl_direct + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1fapl_1direct(JNIEnv *env, jclass clss, jlong fapl_id, jlongArray info) +{ + herr_t retVal = -1; + +#ifdef H5_HAVE_DIRECT + size_t alignment = 0; + size_t block_size = 0; + size_t cbuf_size = 0; + jlong *theArray; + jboolean isCopy; + if (info == NULL) { + h5nullArgument(env, "H5Pget_fapl_direct: info input array is NULL"); + } /* end if */ + else { + if (ENVPTR->GetArrayLength(ENVPAR info) < 3) { + h5badArgument( env, "H5Pget_fapl_direct: info input array < 4"); + } /* end if */ + else { + theArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR info, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Pget_fapl_direct: info not pinned"); + } /* end if */ + else { + retVal = H5Pget_fapl_direct((hid_t)fapl_id, &alignment, &block_size, &cbuf_size); + if(retVal < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR info, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + theArray[0] = (jlong)alignment; + theArray[1] = (jlong)block_size; + theArray[2] = (jlong)cbuf_size; + ENVPTR->ReleaseLongArrayElements(ENVPAR info, theArray, 0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ +#else + if (retVal < 0) + h5libraryError(env); +#endif + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1fapl_1direct */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_sec2 + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fapl_1sec2(JNIEnv *env, jclass clss, jlong fapl_id) +{ + herr_t retVal = -1; + + retVal = H5Pset_fapl_sec2((hid_t) fapl_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1sec2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_stdio + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fapl_1stdio(JNIEnv *env, jclass clss, jlong fapl_id) +{ + herr_t retVal = -1; + + retVal = H5Pset_fapl_stdio((hid_t) fapl_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1stdio */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_windows + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fapl_1windows(JNIEnv *env, jclass clss, jlong fapl_id) +{ + herr_t retVal = -1; + +#ifdef H5_HAVE_WINDOWS + retVal = H5Pset_fapl_windows((hid_t) fapl_id); +#endif + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1windows */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fapl_muti + * Signature: (J[I[J[Ljava/lang/String;[J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi(JNIEnv *env, jclass clss, jlong tid, jintArray memb_map, + jlongArray memb_fapl, jobjectArray memb_name, jlongArray memb_addr) +{ + herr_t status = -1; + int i; + jint *themapArray = NULL; + jlong *thefaplArray = NULL; + jlong *theaddrArray = NULL; + char **mName = NULL; + jstring str; + jboolean isCopy; + int relax = 0; + + if (memb_map) { + themapArray = (jint*)ENVPTR->GetIntArrayElements(ENVPAR memb_map, &isCopy); + if (themapArray == NULL) { + h5JNIFatalError(env, "H5Pget_fapl_muti: memb_map not pinned"); + return 0; + } /* end if */ + } /* end if */ + + if (memb_fapl) { + thefaplArray = (jlong*)ENVPTR->GetLongArrayElements(ENVPAR memb_fapl, &isCopy); + if (thefaplArray == NULL) { + if (memb_map) ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, JNI_ABORT); + h5JNIFatalError(env, "H5Pget_fapl_muti: memb_fapl not pinned"); + return 0; + } /* end if */ + } /* end if */ + + if (memb_addr) { + theaddrArray = (jlong*)ENVPTR->GetLongArrayElements(ENVPAR memb_addr, &isCopy); + if (theaddrArray == NULL) { + if (memb_map) ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, JNI_ABORT); + if (memb_fapl) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_fapl, thefaplArray, JNI_ABORT); + h5JNIFatalError(env, "H5Pget_fapl_muti: memb_addr not pinned"); + return 0; + } /* end if */ + } /* end if */ + + if (memb_name) + mName = (char**)HDcalloc(H5FD_MEM_NTYPES, sizeof (*mName)); + + status = H5Pget_fapl_multi((hid_t)tid, (H5FD_mem_t*)themapArray, (hid_t*)thefaplArray, mName, (haddr_t*)theaddrArray, (hbool_t*)&relax); + + if (status < 0) { + if (memb_map) ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, JNI_ABORT); + if (memb_fapl) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_fapl, thefaplArray, JNI_ABORT); + if (memb_addr) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_addr, theaddrArray, JNI_ABORT); + if (memb_name) h5str_array_free(mName, H5FD_MEM_NTYPES); + h5libraryError(env); + } /* end if */ + else { + if (memb_map) ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, 0); + if (memb_fapl) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_fapl, thefaplArray, 0); + if (memb_addr) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_addr, theaddrArray, 0); + + if (memb_name) { + if (mName) { + for (i = 0; i < H5FD_MEM_NTYPES; i++) { + if (*(mName + i)) { + str = ENVPTR->NewStringUTF(ENVPAR *(mName+i)); + ENVPTR->SetObjectArrayElement(ENVPAR memb_name, i, (jobject)str); + } /* end if */ + } /* for (i=0; iGetIntArrayElements(ENVPAR memb_map, &isCopy); + if (themapArray == NULL) { + h5JNIFatalError(env, "H5Pget_fapl_muti: memb_map not pinned"); + return; + } /* end if */ + } /* end if */ + + if (memb_fapl) { + thefaplArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR memb_fapl, &isCopy); + if (thefaplArray == NULL) { + if (memb_map) + ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, JNI_ABORT); + h5JNIFatalError(env, "H5Pget_fapl_muti: memb_fapl not pinned"); + return; + } /* end if */ + } /* end if */ + + if (memb_addr) { + theaddrArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR memb_addr, &isCopy); + if (theaddrArray == NULL) { + if (memb_map) + ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, JNI_ABORT); + if (memb_fapl) + ENVPTR->ReleaseLongArrayElements(ENVPAR memb_fapl, thefaplArray, JNI_ABORT); + h5JNIFatalError(env, "H5Pget_fapl_muti: memb_addr not pinned"); + return; + } /* end if */ + } /* end if */ + + HDmemset(member_name, 0, H5FD_MEM_NTYPES * sizeof(char*)); + if (memb_name) { + int i; + for (i = 0; i < H5FD_MEM_NTYPES; i++) { + jstring obj = (jstring) ENVPTR->GetObjectArrayElement(ENVPAR (jobjectArray) memb_name, i); + if (obj != 0) { + jsize length = ENVPTR->GetStringUTFLength(ENVPAR obj); + const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0); + + if (utf8) { + member_name[i] = (char*)HDmalloc(strlen(utf8) + 1); + if (member_name[i]) { + strcpy(member_name[i], utf8); + } /* end if */ + } /* end if */ + + ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8); + ENVPTR->DeleteLocalRef(ENVPAR obj); + } /* end if */ + } /* end for */ + mName = (const char **)member_name; + } /* end if */ + + status = H5Pset_fapl_multi((hid_t)tid, (const H5FD_mem_t *)themapArray, (const hid_t *)thefaplArray, mName, (const haddr_t *)theaddrArray, (hbool_t)relax); + + if (status < 0) { + if (memb_map) ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, JNI_ABORT); + if (memb_fapl) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_fapl, thefaplArray, JNI_ABORT); + if (memb_addr) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_addr, theaddrArray, JNI_ABORT); + if (memb_name) { + int i; + for (i = 0; i < H5FD_MEM_NTYPES; i++) + HDfree(member_name[i]); + } /* end if */ + h5libraryError(env); + } /* end if */ + else { + if (memb_map) ENVPTR->ReleaseIntArrayElements(ENVPAR memb_map, themapArray, 0); + if (memb_fapl) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_fapl, thefaplArray, 0); + if (memb_addr) ENVPTR->ReleaseLongArrayElements(ENVPAR memb_addr, theaddrArray, 0); + if (memb_name) { + if (mName != NULL) { + int i; + Sjc = ENVPTR->FindClass(ENVPAR "java/lang/String"); + if (Sjc != NULL) { + for (i = 0; i < H5FD_MEM_NTYPES; i++) { + rstring = ENVPTR->NewStringUTF(ENVPAR member_name[i]); + o = ENVPTR->GetObjectArrayElement(ENVPAR memb_name, i); + if (o != NULL) { + bb = ENVPTR->IsInstanceOf(ENVPAR o, Sjc); + if (bb == JNI_TRUE) { + ENVPTR->SetObjectArrayElement(ENVPAR memb_name, i, (jobject)rstring); + } /* end if */ + ENVPTR->DeleteLocalRef(ENVPAR o); + } /* end if */ + HDfree(member_name[i]); + } /* end for */ + } /* end if */ + } /* end if */ + } /* end if */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_split + * Signature: (JLjava/lang/String;JLjava/lang/String;J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split(JNIEnv *env, jclass clss, jlong fapl_id, jstring metaext, jlong meta_pl_id, jstring rawext, jlong raw_pl_id) +{ + herr_t retVal = -1; + const char *mstr; + const char *rstr; + + PIN_JAVA_STRING_TWO0(metaext, mstr, rawext, rstr); + + retVal = H5Pset_fapl_split((hid_t)fapl_id, mstr, (hid_t)meta_pl_id, rstr, (hid_t)raw_pl_id); + + UNPIN_JAVA_STRING_TWO(metaext, mstr, rawext, rstr); + + if (retVal < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_meta_block_size + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1meta_1block_1size(JNIEnv *env, jclass clss, jlong plist, jlong size) +{ + long sz = (long)size; + + if (H5Pset_meta_block_size((hid_t)plist, (hsize_t)sz) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1meta_1block_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_meta_block_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1meta_1block_1size(JNIEnv *env, jclass clss, jlong plist) +{ + hsize_t s; + + if (H5Pget_meta_block_size((hid_t)plist, &s) < 0) + h5libraryError(env); + + return (jlong)s; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1meta_1block_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_sieve_buf_size + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1sieve_1buf_1size(JNIEnv *env, jclass clss, jlong plist, jlong size) +{ + size_t sz = (size_t)size; + + if (H5Pset_sieve_buf_size((hid_t)plist, (size_t)sz) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1sieve_1buf_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_sieve_buf_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1sieve_1buf_1size(JNIEnv *env, jclass clss, jlong plist) +{ + size_t s; + + if ( H5Pget_sieve_buf_size((hid_t)plist, &s) < 0) + h5libraryError(env); + + return (jlong)s; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1sieve_1buf_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_elink_file_cache_size + * Signature: (JI)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1elink_1file_1cache_1size(JNIEnv *env, jclass clss, jlong plist, jint size) +{ + unsigned sz = (unsigned)size; + + if (H5Pset_elink_file_cache_size((hid_t)plist, (unsigned)sz) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1file_1cache_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_elink_file_cache_size + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1elink_1file_1cache_1size(JNIEnv *env, jclass clss, jlong plist) +{ + unsigned s; + + if (H5Pget_elink_file_cache_size((hid_t)plist, &s) < 0) + h5libraryError(env); + + return (jint)s; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1elink_1file_1cache_1size */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_mdc_config + * Signature: (J)Lhdf/hdf5lib/structs/H5AC_cache_config_t; + */ +JNIEXPORT jobject JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config(JNIEnv *env, jclass clss, jlong plist) +{ + H5AC_cache_config_t cacheinfo; + herr_t status = -1; + jvalue args[30]; + jstring j_str = NULL; + jobject ret_obj = NULL; + + HDmemset(&cacheinfo, 0, sizeof(H5AC_cache_config_t)); + cacheinfo.version = H5AC__CURR_CACHE_CONFIG_VERSION; + + status = H5Pget_mdc_config((hid_t)plist, &cacheinfo); + + if (status < 0) { + h5libraryError(env); + } /* end if */ + else { + args[0].i = cacheinfo.version; + args[1].z = cacheinfo.rpt_fcn_enabled; + args[2].z = cacheinfo.open_trace_file; + args[3].z = cacheinfo.close_trace_file; + if (cacheinfo.trace_file_name != NULL) { + j_str = ENVPTR->NewStringUTF(ENVPAR cacheinfo.trace_file_name); + } /* end if */ + args[4].l = j_str; + args[5].z = cacheinfo.evictions_enabled; + args[6].z = cacheinfo.set_initial_size; + args[7].j = (jlong)cacheinfo.initial_size; + args[8].d = cacheinfo.min_clean_fraction; + args[9].j = (jlong)cacheinfo.max_size; + args[10].j = (jlong)cacheinfo.min_size; + args[11].j = cacheinfo.epoch_length; + args[12].i = cacheinfo.incr_mode; + args[13].d = cacheinfo.lower_hr_threshold; + args[14].d = cacheinfo.increment; + args[15].z = cacheinfo.apply_max_increment; + args[16].j = (jlong)cacheinfo.max_increment; + args[17].i = cacheinfo.flash_incr_mode; + args[18].d = cacheinfo.flash_multiple; + args[19].d = cacheinfo.flash_threshold; + args[20].i = cacheinfo.decr_mode; + args[21].d = cacheinfo.upper_hr_threshold; + args[22].d = cacheinfo.decrement; + args[23].z = cacheinfo.apply_max_decrement; + args[24].j = (jlong)cacheinfo.max_decrement; + args[25].i = cacheinfo.epochs_before_eviction; + args[26].z = cacheinfo.apply_empty_reserve; + args[27].d = cacheinfo.empty_reserve; + args[28].j = (jlong)cacheinfo.dirty_bytes_threshold; + args[29].i = cacheinfo.metadata_write_strategy; + CALL_CONSTRUCTOR("hdf/hdf5lib/structs/H5AC_cache_config_t", "(IZZZLjava/lang/String;ZZJDJJJIDDZJIDDIDDZJIZDJI)V", args); + } /* end else */ + return ret_obj; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_mdc_config + * Signature: (JLhdf/hdf5lib/structs/H5AC_cache_config_t;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config(JNIEnv *env, jclass clss, jlong plist, jobject cache_config) +{ + herr_t status = -1; + jclass cls; + jfieldID fid; + jstring j_str; + const char *str; + H5AC_cache_config_t cacheinfo; + + cls = ENVPTR->GetObjectClass(ENVPAR cache_config); + fid = ENVPTR->GetFieldID(ENVPAR cls, "version", "I"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: version"); + return; + } /* end if */ + cacheinfo.version = ENVPTR->GetIntField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading version failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "rpt_fcn_enabled", "Z"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: rpt_fcn_enabled"); + return; + } /* end if */ + cacheinfo.rpt_fcn_enabled = ENVPTR->GetBooleanField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading rpt_fcn_enabled failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "open_trace_file", "Z"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: open_trace_file"); + return; + } /* end if */ + cacheinfo.open_trace_file = ENVPTR->GetBooleanField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading open_trace_file failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "close_trace_file", "Z"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: close_trace_file"); + return; + } /* end if */ + cacheinfo.close_trace_file = ENVPTR->GetBooleanField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading close_trace_file failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "trace_file_name", "Ljava/lang/String;"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: trace_file_name"); + return; + } /* end if */ + j_str = (jstring)ENVPTR->GetObjectField(ENVPAR cache_config, fid); + str = ENVPTR->GetStringUTFChars(ENVPAR j_str, NULL); + if (str == NULL) { + h5JNIFatalError(env, "H5Pset_mdc_config: out of memory trace_file_name"); + return; + } /* end if */ + strncpy(cacheinfo.trace_file_name, str, 1025); + ENVPTR->ReleaseStringUTFChars(ENVPAR j_str, str); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading trace_file_name failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "evictions_enabled", "Z"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: evictions_enabled"); + return; + } /* end if */ + cacheinfo.evictions_enabled = ENVPTR->GetBooleanField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading evictions_enabled failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "set_initial_size", "Z"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: set_initial_size"); + return; + } /* end if */ + cacheinfo.set_initial_size = ENVPTR->GetBooleanField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading set_initial_size failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "initial_size", "J"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: initial_size"); + return; + } /* end if */ + cacheinfo.initial_size = (size_t)ENVPTR->GetLongField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading initial_size failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "min_clean_fraction", "D"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: min_clean_fraction"); + return; + } /* end if */ + cacheinfo.min_clean_fraction = ENVPTR->GetDoubleField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading min_clean_fraction failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "max_size", "J"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: max_size"); + return; + } /* end if */ + cacheinfo.max_size = (size_t)ENVPTR->GetLongField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading max_size failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "min_size", "J"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: min_size"); + return; + } /* end if */ + cacheinfo.min_size = (size_t)ENVPTR->GetLongField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading min_size failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "epoch_length", "J"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: epoch_length"); + return; + } + cacheinfo.epoch_length = (long int)ENVPTR->GetLongField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading epoch_length failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "incr_mode", "I"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: incr_mode"); + return; + } /* end if */ + cacheinfo.incr_mode = ENVPTR->GetIntField(ENVPAR cache_config, fid); /*(enum H5C_cache_incr_mode) */ + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading incr_mode failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "lower_hr_threshold", "D"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: lower_hr_threshold"); + return; + } /* end if */ + cacheinfo.lower_hr_threshold = ENVPTR->GetDoubleField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading lower_hr_threshold failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "increment", "D"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: increment"); + return; + } /* end if */ + cacheinfo.increment = ENVPTR->GetDoubleField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading increment failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "apply_max_increment", "Z"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: apply_max_increment"); + return; + } /* end if */ + cacheinfo.apply_max_increment = ENVPTR->GetBooleanField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading apply_max_increment failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "max_increment", "J"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: max_increment"); + return; + } /* end if */ + cacheinfo.max_increment = (size_t)ENVPTR->GetLongField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading max_increment failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "flash_incr_mode", "I"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: flash_incr_mode"); + return; + } /* end if */ + cacheinfo.flash_incr_mode = ENVPTR->GetIntField(ENVPAR cache_config, fid); /*(enum H5C_cache_flash_incr_mode) */ + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading flash_incr_mode failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "flash_multiple", "D"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: flash_multiple"); + return; + } /* end if */ + cacheinfo.flash_multiple = ENVPTR->GetDoubleField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading flash_multiple failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "flash_threshold", "D"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: flash_threshold"); + return; + } /* end if */ + cacheinfo.flash_threshold = ENVPTR->GetDoubleField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading flash_threshold failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "decr_mode", "I"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: decr_mode"); + return; + } /* end if */ + cacheinfo.decr_mode = ENVPTR->GetIntField(ENVPAR cache_config, fid); /*(enum H5C_cache_decr_mode) */ + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading decr_mode failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "upper_hr_threshold", "D"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: upper_hr_threshold"); + return; + } /* end if */ + cacheinfo.upper_hr_threshold = ENVPTR->GetDoubleField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading upper_hr_threshold failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "decrement", "D"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: decrement"); + return; + } /* end if */ + cacheinfo.decrement = ENVPTR->GetDoubleField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading decrement failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "apply_max_decrement", "Z"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: apply_max_decrement"); + return; + } /* end if */ + cacheinfo.apply_max_decrement = ENVPTR->GetBooleanField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading apply_max_decrement failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "max_decrement", "J"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: max_decrement"); + return; + } /* end if */ + cacheinfo.max_decrement = (size_t)ENVPTR->GetLongField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading max_decrement failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "epochs_before_eviction", "I"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: epochs_before_eviction"); + return; + } /* end if */ + cacheinfo.epochs_before_eviction = ENVPTR->GetIntField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading epochs_before_eviction failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "apply_empty_reserve", "Z"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: apply_empty_reserve"); + return; + } /* end if */ + cacheinfo.apply_empty_reserve = ENVPTR->GetBooleanField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading apply_empty_reserve failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "empty_reserve", "D"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: empty_reserve"); + return; + } /* end if */ + cacheinfo.empty_reserve = ENVPTR->GetDoubleField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading empty_reserve failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "dirty_bytes_threshold", "J"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: dirty_bytes_threshold"); + return; + } /* end if */ + cacheinfo.dirty_bytes_threshold = (size_t)ENVPTR->GetLongField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading dirty_bytes_threshold failed"); + return; + } /* end if */ + + fid = ENVPTR->GetFieldID(ENVPAR cls, "metadata_write_strategy", "I"); + if(fid == 0) { + h5badArgument(env, "H5Pset_mdc_config: metadata_write_strategy"); + return; + } /* end if */ + cacheinfo.metadata_write_strategy = ENVPTR->GetIntField(ENVPAR cache_config, fid); + if(ENVPTR->ExceptionOccurred(ENVONLY)) { + h5JNIFatalError(env, "H5Pset_mdc_config: loading metadata_write_strategy failed"); + return; + } /* end if */ + + status = H5Pset_mdc_config((hid_t)plist, &cacheinfo); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_chunk_cache + * Signature: (JJJD)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1chunk_1cache(JNIEnv *env, jclass clss, jlong dapl, jlong rdcc_nslots, + jlong rdcc_nbytes, jdouble rdcc_w0) +{ + if (H5Pset_chunk_cache((hid_t)dapl, (size_t)rdcc_nslots, (size_t)rdcc_nbytes, (double) rdcc_w0) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1chunk_1cache */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_chunk_cache + * Signature: (J[J[J[D)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache(JNIEnv *env, jclass clss, jlong dapl, jlongArray rdcc_nslots, + jlongArray rdcc_nbytes, jdoubleArray rdcc_w0) +{ + herr_t status = -1; + jint mode; + jdouble *w0Array; + jlong *rdcc_nslotsArray; + jlong *nbytesArray; + jboolean isCopy; + + if (rdcc_w0 == NULL) { + w0Array = (jdouble *)NULL; + } /* end if */ + else { + w0Array = (jdouble *)ENVPTR->GetDoubleArrayElements(ENVPAR rdcc_w0, &isCopy); + if (w0Array == NULL) { + h5JNIFatalError(env, "H5Pget_chunk_cache: w0_array array not pinned"); + return; + } /* end if */ + } /* end else */ + + if (rdcc_nslots == NULL) { + rdcc_nslotsArray = (jlong *)NULL; + } /* end if */ + else { + rdcc_nslotsArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR rdcc_nslots, &isCopy); + if (rdcc_nslotsArray == NULL) { + /* exception -- out of memory */ + if (w0Array != NULL) { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR rdcc_w0, w0Array, JNI_ABORT); + } /* end if */ + h5JNIFatalError(env, "H5Pget_chunk_cache: rdcc_nslots array not pinned"); + return; + } /* end if */ + } /* end else */ + + if (rdcc_nbytes == NULL) { + nbytesArray = (jlong *)NULL; + } /* end if */ + else { + nbytesArray = (jlong *)ENVPTR->GetLongArrayElements(ENVPAR rdcc_nbytes, &isCopy); + if (nbytesArray == NULL) { + if (w0Array != NULL) { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR rdcc_w0, w0Array, JNI_ABORT); + } /* end if */ + if (rdcc_nslotsArray != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR rdcc_nslots, rdcc_nslotsArray, JNI_ABORT); + } /* end if */ + h5JNIFatalError(env, "H5Pget_chunk_cache: nbytesArray array not pinned"); + return; + } /* end if */ + } /* end else */ + + { /* direct cast (size_t *)variable fails on 32-bit environment */ + long long rdcc_nslots_temp = *(rdcc_nslotsArray); + size_t rdcc_nslots_t = (size_t)rdcc_nslots_temp; + long long nbytes_temp = *(nbytesArray); + size_t nbytes_t = (size_t)nbytes_temp; + + status = H5Pget_chunk_cache((hid_t)dapl, &rdcc_nslots_t, &nbytes_t, (double *)w0Array); + + *rdcc_nslotsArray = (jlong)rdcc_nslots_t; + *nbytesArray = (jlong)nbytes_t; + } /* end direct cast special handling */ + + if (status < 0) { + mode = JNI_ABORT; + } /* end if */ + else { + mode = 0; /* commit and free */ + } /* end else */ + + if (rdcc_nslotsArray != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR rdcc_nslots, rdcc_nslotsArray, mode); + } + /* end if */ + if (nbytesArray != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR rdcc_nbytes, nbytesArray, mode); + } /* end if */ + + if (w0Array != NULL) { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR rdcc_w0, w0Array, mode); + } /* end if */ + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_obj_track_times + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1obj_1track_1times(JNIEnv *env, jclass clss, jlong objplid) +{ + hbool_t track_times; + + if (H5Pget_obj_track_times((hid_t)objplid, &track_times) < 0) { + h5libraryError(env); + return JNI_FALSE; + } /* end if */ + if (track_times == 1) { + return JNI_TRUE; + } /* end if */ + return JNI_FALSE; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1obj_1track_1times */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_obj_track_times + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1obj_1track_1times(JNIEnv *env, jclass clss, jlong objplid, jboolean track_times) +{ + hbool_t track; + + if (track_times == JNI_TRUE) { + track = 1; + } /* end if */ + else { + track = 0; + } /* end else */ + + if (H5Pset_obj_track_times((hid_t)objplid, track) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1obj_1track_1times */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_char_encoding + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1char_1encoding(JNIEnv *env, jclass clss, jlong acpl) +{ + H5T_cset_t encoding; + + if (H5Pget_char_encoding((hid_t)acpl, &encoding) < 0) + h5libraryError(env); + + return encoding; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1char_1encoding */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_char_encoding + * Signature: (JI)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1char_1encoding(JNIEnv *env, jclass clss, jlong acpl, jint encoding) +{ + if (H5Pset_char_encoding((hid_t)acpl, (H5T_cset_t)encoding) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1char_1encoding */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_virtual + * Signature: (JJLjava/lang/String;Ljava/lang/String;J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1virtual(JNIEnv *env, jclass clss, jlong dcpl_id, jlong vspace_id, + jstring src_file_name, jstring src_dset_name, jlong src_space_id) +{ + herr_t retVal = -1; + const char *fstr; + const char *dstr; + + PIN_JAVA_STRING_TWO0(src_file_name, fstr, src_dset_name, dstr); + + retVal = H5Pset_virtual((hid_t)dcpl_id, (hid_t)vspace_id, fstr, dstr, (hid_t)src_space_id); + + UNPIN_JAVA_STRING_TWO(src_file_name, fstr, src_dset_name, dstr); + + if (retVal < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_count + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1virtual_1count(JNIEnv *env, jclass clss, jlong dcpl_id) +{ + size_t s; + + if (H5Pget_virtual_count((hid_t)dcpl_id, &s) < 0) + h5libraryError(env); + + return (jlong)s; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1count */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_vspace + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1virtual_1vspace(JNIEnv *env, jclass clss, jlong dcpl_id, jlong index) +{ + hid_t space_id = -1; + + space_id = H5Pget_virtual_vspace((hid_t)dcpl_id, (size_t)index); + if (space_id < 0) + h5libraryError(env); + + return (jlong)space_id; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1vspace */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_srcspace + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1virtual_1srcspace(JNIEnv *env, jclass clss, jlong dcpl_id, jlong index) +{ + hid_t space_id = -1; + + space_id = H5Pget_virtual_srcspace((hid_t)dcpl_id, (size_t)index); + if (space_id < 0) + h5libraryError(env); + + return (jlong)space_id; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1srcspace */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_filename + * Signature: (JJ)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename(JNIEnv *env, jclass clss, jlong dcpl_id, jlong index) +{ + char *fname; + ssize_t buf_size; + ssize_t status; + jstring str = NULL; + + /* get the length of the filename */ + buf_size = H5Pget_virtual_filename((hid_t)dcpl_id, (size_t)index, NULL, 0); + if (buf_size < 0) { + h5badArgument( env, "H5Pget_virtual_filename: buf_size < 0"); + } /* end if */ + else if (buf_size >= 0) { + buf_size++; /* add extra space for the null terminator */ + fname = (char *)HDmalloc(sizeof(char) * (size_t)buf_size); + if (fname == NULL) { + h5outOfMemory( env, "H5Pget_virtual_filename: malloc failed"); + } /* end if */ + else { + status = H5Pget_virtual_filename((hid_t)dcpl_id, (size_t)index, fname, (size_t)buf_size); + + if (status >= 0) { + str = ENVPTR->NewStringUTF(ENVPAR fname); + HDfree(fname); + if (str == NULL) + h5JNIFatalError( env, "H5Pget_virtual_filename: return string not allocated"); + } /* end if */ + else { + HDfree(fname); + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else if */ + + return (jstring)str; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_dsetname + * Signature: (JJ)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname(JNIEnv *env, jclass clss, jlong dcpl_id, jlong index) +{ + char *dname; + ssize_t buf_size; + ssize_t status; + jstring str = NULL; + + /* get the length of the filename */ + buf_size = H5Pget_virtual_dsetname((hid_t)dcpl_id, (size_t)index, NULL, 0); + if (buf_size < 0) { + h5badArgument( env, "H5Pget_virtual_dsetname: buf_size < 0"); + } /* end if */ + else if (buf_size > 0) { + buf_size++; /* add extra space for the null terminator */ + dname = (char *)HDmalloc(sizeof(char) * (size_t)buf_size); + if (dname == NULL) { + h5outOfMemory( env, "H5Pget_virtual_dsetname: malloc failed"); + } /* end if */ + else { + status = H5Pget_virtual_dsetname((hid_t)dcpl_id, (size_t)index, dname, (size_t)buf_size); + + if (status >= 0) { + str = ENVPTR->NewStringUTF(ENVPAR dname); + HDfree(dname); + if (str == NULL) + h5JNIFatalError( env, "H5Pget_virtual_dsetname: return string not allocated"); + } /* end if */ + else { + HDfree(dname); + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else if */ + return (jstring)str; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_view + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1virtual_1view(JNIEnv *env, jclass clss, jlong dapl_id) +{ + H5D_vds_view_t virtual_view; + + if (H5Pget_virtual_view((hid_t)dapl_id, &virtual_view) < 0) + h5libraryError(env); + + return (jint)virtual_view; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1view */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_virtual_view + * Signature: (JI)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1virtual_1view(JNIEnv *env, jclass clss, jlong dapl_id, jint view) +{ + if (H5Pset_virtual_view((hid_t)dapl_id, (H5D_vds_view_t)view) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual_1view */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_printf_gap + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap(JNIEnv *env, jclass clss, jlong dapl_id) +{ + hsize_t gap_size; + + if (H5Pget_virtual_printf_gap((hid_t)dapl_id, &gap_size) < 0) + h5libraryError(env); + + return (jlong)gap_size; +} /* end Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_virtual_printf_gap + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap(JNIEnv *env, jclass clss, jlong dapl_id, jlong gap_size) +{ + if (H5Pset_virtual_printf_gap((hid_t)dapl_id, (hsize_t)gap_size) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_file_space + * Signature: (J[I[J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pget_1file_1space(JNIEnv *env, jclass clss, jlong fcpl_id, jintArray strategy, jlongArray threshold) +{ + herr_t status = -1; + jint *thestrategyArray = NULL; + jlong *thethresholdArray = NULL; + jboolean isCopy; + + if (strategy) { + thestrategyArray = (jint*)ENVPTR->GetIntArrayElements(ENVPAR strategy, &isCopy); + if (thestrategyArray == NULL) { + h5JNIFatalError(env, "H5Pget_file_space: strategy not pinned"); + return; + } + } + + if (threshold) { + thethresholdArray = (jlong*)ENVPTR->GetLongArrayElements(ENVPAR threshold, &isCopy); + if (thethresholdArray == NULL) { + if (strategy) ENVPTR->ReleaseIntArrayElements(ENVPAR strategy, thestrategyArray, JNI_ABORT); + h5JNIFatalError(env, "H5Pget_file_space: threshold not pinned"); + return; + } /* end if */ + } /* end if */ + + status = H5Pget_file_space((hid_t)fcpl_id, (H5F_file_space_type_t*)thestrategyArray, (hsize_t*)thethresholdArray); + + if (status < 0) { + if (strategy) ENVPTR->ReleaseIntArrayElements(ENVPAR strategy, thestrategyArray, JNI_ABORT); + if (threshold) ENVPTR->ReleaseLongArrayElements(ENVPAR threshold, thethresholdArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + if (strategy) ENVPTR->ReleaseIntArrayElements(ENVPAR strategy, thestrategyArray, 0); + if (threshold) ENVPTR->ReleaseLongArrayElements(ENVPAR threshold, thethresholdArray, 0); + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Pget_1file_1space */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_file_space + * Signature: (JIJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pset_1file_1space(JNIEnv *env, jclass clss, jlong fcpl_id, jint strategy, jlong threshold) +{ + if (H5Pset_file_space((hid_t)fcpl_id, (H5F_file_space_type_t)strategy, (hsize_t)threshold) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Pset_1file_1space */ + + +static herr_t +H5P_cls_create_cb(hid_t prop_id, void *create_data) +{ + JNIEnv *cbenv; + jint status = -1; + jclass cls; + jmethodID mid; + jmethodID constructor; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR create_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLhdf/hdf5lib/callbacks/H5P_cls_create_func_t;)I"); + if (mid != 0) { + /* fprintf(stderr, "JNI H5P_cls_create_func_cb execute\n"); fflush(stderr); */ + status = CBENVPTR->CallIntMethod(CBENVPAR create_callback, mid, prop_id, create_data); + /* fprintf(stderr, "\nJNI H5P_cls_create_func_cb status: %d\n", status); fflush(stderr); */ + } /* end if */ + } /* end if */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + return status; +} /* end H5P_cls_create_cb */ + +static herr_t +H5P_cls_copy_cb(hid_t new_prop_id, hid_t old_prop_id, void *copy_data) +{ + JNIEnv *cbenv; + jint status; + jclass cls; + jmethodID mid; + jmethodID constructor; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR copy_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JJLhdf/hdf5lib/callbacks/H5P_cls_copy_func_t;)I"); + if (mid != 0) { + status = CBENVPTR->CallIntMethod(CBENVPAR copy_callback, mid, new_prop_id, old_prop_id, copy_data); + } /* end if */ + } /* end if */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + return status; +} /* end H5P_cls_ccopy_cb */ + +static herr_t +H5P_cls_close_cb(hid_t prop_id, void *close_data) +{ + JNIEnv *cbenv; + jint status; + jclass cls; + jmethodID mid; + jmethodID constructor; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR close_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLhdf/hdf5lib/callbacks/H5P_cls_close_func_t;)I"); + if (mid != 0) { + status = CBENVPTR->CallIntMethod(CBENVPAR close_callback, mid, prop_id, close_data); + } /* end if */ + } /* end if */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + return status; +} /* end H5P_cls_close_cb */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Pcreate_class_nocb + * Signature: (JLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb(JNIEnv *env, jclass clss, jlong parent_class, jstring name) +{ + hid_t class_id = -1; + const char *cstr; + + PIN_JAVA_STRING(name, cstr, -1); + + class_id = H5Pcreate_class((hid_t)parent_class, cstr, NULL, NULL, NULL, NULL, NULL, NULL); + + UNPIN_JAVA_STRING(name, cstr); + + if (class_id < 0) + h5libraryError(env); + + return (jlong)class_id; +} /* end Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Pcreate_class + * Signature: (JLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Pcreate_1class(JNIEnv *env, jclass clss, jlong parent_class, jstring name, jobject create_op, + jobject create_data, jobject copy_op, jobject copy_data, jobject close_op, jobject close_data) +{ + hid_t class_id = -1; + const char *cstr; + copy_callback = copy_op; + close_callback = close_op; + create_callback = create_op; + + PIN_JAVA_STRING(name, cstr, -1); + + class_id = H5Pcreate_class((hid_t)parent_class, cstr, (H5P_cls_create_func_t)H5P_cls_create_cb, (void*) create_data, + (H5P_cls_copy_func_t)H5P_cls_copy_cb, (void*) copy_data, (H5P_cls_close_func_t)H5P_cls_close_cb, (void*) close_data); + + UNPIN_JAVA_STRING(name, cstr); + + if (class_id < 0) + h5libraryError(env); + + return (jlong)class_id; +} /* end Java_hdf_hdf5lib_H5__1H5Pcreate_1class */ + +static herr_t +H5P_prp_create_cb(const char *name, size_t size, void *value) +{ + JNIEnv *cbenv; + jint status; + jclass cls; + jmethodID mid; + jmethodID constructor; + jstring str; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR create_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(Ljava/lang/String;J[B)I"); + if (mid != 0) { + str = CBENVPTR->NewStringUTF(CBENVPAR name); + status = CBENVPTR->CallIntMethod(CBENVPAR create_callback, mid, str, size, value); + } /* end if */ + } /* end if */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + return status; +} /* end H5P_prp_create_cb */ + +static herr_t +H5P_prp_copy_cb(const char *name, size_t size, void *value) +{ + JNIEnv *cbenv; + jint status; + jclass cls; + jmethodID mid; + jmethodID constructor; + jstring str; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR copy_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(Ljava/lang/String;J[B)I"); + if (mid != 0) { + str = CBENVPTR->NewStringUTF(CBENVPAR name); + status = CBENVPTR->CallIntMethod(CBENVPAR copy_callback, mid, str, size, value); + } /* end if */ + } /* end if */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + return status; +} /* end H5P_prp_copy_cb */ + +static herr_t +H5P_prp_close_cb(const char *name, size_t size, void *value) +{ + JNIEnv *cbenv; + jint status; + jclass cls; + jmethodID mid; + jmethodID constructor; + jstring str; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR close_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(Ljava/lang/String;J[B)I"); + if (mid != 0) { + str = CBENVPTR->NewStringUTF(CBENVPAR name); + status = CBENVPTR->CallIntMethod(CBENVPAR close_callback, mid, str, size, value); + } /* end if */ + } /* end if */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + return status; +} /* end H5P_prp_close_cb */ + +static int +H5P_prp_compare_cb(void *value1, void *value2, size_t size) +{ + JNIEnv *cbenv; + jint status; + jclass cls; + jmethodID mid; + jmethodID constructor; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR compare_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "([B[BJ)I"); + if (mid != 0) { + status = CBENVPTR->CallIntMethod(CBENVPAR compare_callback, mid, value1, value2, size); + } /* end if */ + } /* end if */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + return status; +} /* end H5P_prp_compare_cb */ + +static herr_t +H5P_prp_get_cb(hid_t prop_id, const char *name, size_t size, void *value) +{ + JNIEnv *cbenv; + jint status; + jclass cls; + jmethodID mid; + jmethodID constructor; + jstring str; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR get_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;J[B)I"); + if (mid != 0) { + str = CBENVPTR->NewStringUTF(CBENVPAR name); + status = CBENVPTR->CallIntMethod(CBENVPAR get_callback, mid, prop_id, str, size, value); + } /* end if */ + } /* end if */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + return status; +} /* end H5P_prp_get_cb */ + +static herr_t +H5P_prp_set_cb(hid_t prop_id, const char *name, size_t size, void *value) +{ + JNIEnv *cbenv; + jint status; + jclass cls; + jmethodID mid; + jmethodID constructor; + jstring str; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR set_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;J[B)I"); + if (mid != 0) { + str = CBENVPTR->NewStringUTF(CBENVPAR name); + status = CBENVPTR->CallIntMethod(CBENVPAR set_callback, mid, prop_id, str, size, value); + } /* end if */ + } /* end if */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + return status; +} /* end H5P_prp_set_cb */ + +static herr_t +H5P_prp_delete_cb(hid_t prop_id, const char *name, size_t size, void *value) +{ + JNIEnv *cbenv; + jint status; + jclass cls; + jmethodID mid; + jmethodID constructor; + jstring str; + + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) == 0) { + cls = CBENVPTR->GetObjectClass(CBENVPAR delete_callback); + if (cls != 0) { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;J[B)I"); + if (mid != 0) { + str = CBENVPTR->NewStringUTF(CBENVPAR name); + status = CBENVPTR->CallIntMethod(CBENVPAR delete_callback, mid, prop_id, str, size, value); + } /* end if */ + } /* end if */ + } /* end if */ + JVMPTR->DetachCurrentThread(JVMPAR); + return status; +} /* end H5P_prp_delete_cb */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pregister2_nocb + * Signature: (JLjava/lang/String;J[B)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pregister2_1nocb(JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size, jbyteArray def_value) +{ + herr_t status = -1; + jbyte *buffP; + jboolean isCopy2; + const char *cstr; + + PIN_JAVA_STRING0(name, cstr); + buffP = ENVPTR->GetByteArrayElements(ENVPAR def_value, &isCopy2); + if (buffP == NULL) { + UNPIN_JAVA_STRING(name, cstr); + h5JNIFatalError(env, "H5Pregister2: buf not pinned"); + } /* end if */ + else { + status = H5Pregister2((hid_t)cls_id, cstr, (size_t)prp_size, (void*)buffP, NULL, NULL, NULL, NULL, NULL, NULL, NULL); + + UNPIN_JAVA_STRING(name, cstr); + if (status < 0) { + ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, 0); + } /* end else */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Pregister2_1nocb */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pregister2 + * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pregister2(JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size, + jbyteArray def_value, jobject prp_create, jobject prp_set, jobject prp_get, jobject prp_delete, + jobject prp_copy, jobject prp_cmp, jobject prp_close) +{ + herr_t status = -1; + jbyte *buffP; + jboolean isCopy2; + const char *cstr; + copy_callback = prp_copy; + close_callback = prp_close; + create_callback = prp_create; + compare_callback = prp_cmp; + set_callback = prp_set; + get_callback = prp_get; + delete_callback = prp_delete; + + PIN_JAVA_STRING0(name, cstr); + buffP = ENVPTR->GetByteArrayElements(ENVPAR def_value, &isCopy2); + if (buffP == NULL) { + UNPIN_JAVA_STRING(name, cstr); + h5JNIFatalError(env, "H5Pregister2: buf not pinned"); + } /* end if */ + else { + status = H5Pregister2((hid_t)cls_id, cstr, (size_t)prp_size, (void*)buffP, (H5P_prp_create_func_t)H5P_prp_create_cb, + (H5P_prp_set_func_t)H5P_prp_set_cb, (H5P_prp_get_func_t)H5P_prp_get_cb, (H5P_prp_delete_func_t)H5P_prp_delete_cb, + (H5P_prp_copy_func_t)H5P_prp_copy_cb, (H5P_prp_compare_func_t)H5P_prp_compare_cb, (H5P_prp_close_func_t)H5P_prp_close_cb); + + UNPIN_JAVA_STRING(name, cstr); + if (status < 0) { + ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, 0); + } /* end else */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Pregister2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pinsert2_nocb + * Signature: (JLjava/lang/String;J[B)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pinsert2_1nocb(JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size, jbyteArray def_value) +{ + herr_t status = -1; + jbyte *buffP; + jboolean isCopy2; + const char *cstr; + + PIN_JAVA_STRING0(name, cstr); + buffP = ENVPTR->GetByteArrayElements(ENVPAR def_value, &isCopy2); + if (buffP == NULL) { + UNPIN_JAVA_STRING(name, cstr); + h5JNIFatalError(env, "H5Pinsert2: buf not pinned"); + } /* end if */ + else { + status = H5Pinsert2((hid_t)cls_id, cstr, (size_t)prp_size, (void*)buffP, NULL, NULL, NULL, NULL, NULL, NULL); + + UNPIN_JAVA_STRING(name, cstr); + if (status < 0) { + ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, 0); + } /* end else */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Pinsert2 */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pinsert2 + * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Pinsert2(JNIEnv *env, jclass clss, jlong cls_id, jstring name, jlong prp_size, + jbyteArray def_value, jobject prp_set, jobject prp_get, jobject prp_delete, + jobject prp_copy, jobject prp_cmp, jobject prp_close) +{ + herr_t status = -1; + jbyte *buffP; + jboolean isCopy2; + const char *cstr; + copy_callback = prp_copy; + close_callback = prp_close; + compare_callback = prp_cmp; + set_callback = prp_set; + get_callback = prp_get; + delete_callback = prp_delete; + + PIN_JAVA_STRING0(name, cstr); + buffP = ENVPTR->GetByteArrayElements(ENVPAR def_value, &isCopy2); + if (buffP == NULL) { + UNPIN_JAVA_STRING(name, cstr); + h5JNIFatalError(env, "H5Pinsert2: buf not pinned"); + } /* end if */ + else { + status = H5Pinsert2((hid_t)cls_id, cstr, (size_t)prp_size, (void*)buffP, + (H5P_prp_set_func_t)H5P_prp_set_cb, (H5P_prp_get_func_t)H5P_prp_get_cb, (H5P_prp_delete_func_t)H5P_prp_delete_cb, + (H5P_prp_copy_func_t)H5P_prp_copy_cb, (H5P_prp_compare_func_t)H5P_prp_compare_cb, (H5P_prp_close_func_t)H5P_prp_close_cb); + + UNPIN_JAVA_STRING(name, cstr); + if (status < 0) { + ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + ENVPTR->ReleaseByteArrayElements(ENVPAR def_value, buffP, 0); + } /* end else */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Pinsert2 */ + +static herr_t +H5P_iterate_cb(hid_t prop_id, const char *name, void *op_data) +{ + JNIEnv *cbenv; + jint status = -1; + jclass cls; + jmethodID mid; + jstring str; + jmethodID constructor; + + /* fprintf(stderr, "\nJNI H5P_iterate_cb entered\n"); fflush(stderr); */ + if(JVMPTR->AttachCurrentThread(JVMPAR2 (void**)&cbenv, NULL) != 0) { + /* fprintf(stderr, "\nJNI H5P_iterate_cb error: AttachCurrentThread failed\n"); fflush(stderr); */ + JVMPTR->DetachCurrentThread(JVMPAR); + } /* end if */ + else { + cls = CBENVPTR->GetObjectClass(CBENVPAR visit_callback); + if (cls == 0) { + /* fprintf(stderr, "\nJNI H5P_iterate_cb error: GetObjectClass failed\n"); fflush(stderr); */ + JVMPTR->DetachCurrentThread(JVMPAR); + } /* end if */ + else { + mid = CBENVPTR->GetMethodID(CBENVPAR cls, "callback", "(JLjava/lang/String;Lhdf/hdf5lib/callbacks/H5P_iterate_t;)I"); + if (mid == 0) { + /* fprintf(stderr, "\nJNI H5P_iterate_cb error: GetMethodID failed\n"); fflush(stderr); */ + JVMPTR->DetachCurrentThread(JVMPAR); + } /* end if */ + else { + str = CBENVPTR->NewStringUTF(CBENVPAR name); + + /* fprintf(stderr, "JNI H5P_iterate_cb execute\n"); fflush(stderr); */ + status = CBENVPTR->CallIntMethod(CBENVPAR visit_callback, mid, prop_id, str, op_data); + /* fprintf(stderr, "\nJNI H5P_iterate_cb status: %d\n", status); fflush(stderr); */ + } /* end else */ + } /* end else */ + } /* end else */ + + JVMPTR->DetachCurrentThread(JVMPAR); + /* fprintf(stderr, "\nJNI H5P_iterate_cb leave\n"); fflush(stderr); */ + + return status; +} /* end H5P_iterate_cb */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Piterate + * Signature: (J[ILjava/lang/Object;Ljava/lang/Object;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Piterate(JNIEnv *env, jclass clss, jlong prop_id, jintArray idx, + jobject callback_op, jobject op_data) +{ + herr_t status = -1; + jint *theArray = NULL; + jboolean isCopy; + + ENVPTR->GetJavaVM(ENVPAR &jvm); + visit_callback = callback_op; + + if (op_data == NULL) { + h5nullArgument(env, "H5Piterate: op_data is NULL"); + } /* end if */ + else if (callback_op == NULL) { + h5nullArgument(env, "H5Piterate: callback_op is NULL"); + } /* end else if */ + else { + if (idx == NULL) { + status = H5Piterate((hid_t)prop_id, NULL, (H5P_iterate_t)H5P_iterate_cb, (void*)op_data); + } /* end if */ + else { + theArray = (jint *)ENVPTR->GetIntArrayElements(ENVPAR idx, &isCopy); + if (theArray == NULL) { + h5JNIFatalError(env, "H5Piterate: idx not pinned"); + return -1; + } /* end if */ + status = H5Piterate((hid_t)prop_id, (int*)&theArray[0], (H5P_iterate_t)H5P_iterate_cb, (void*)op_data); + } /* end else */ + + if (status < 0) { + if(idx) + ENVPTR->ReleaseIntArrayElements(ENVPAR idx, theArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else if (idx) + ENVPTR->ReleaseIntArrayElements(ENVPAR idx, theArray, 0); + } /* end else */ + + return status; +} /* end Java_hdf_hdf5lib_H5_H5Piterate */ + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5pImp.h b/java/src/jni/h5pImp.h new file mode 100644 index 0000000..ea1ee52 --- /dev/null +++ b/java/src/jni/h5pImp.h @@ -0,0 +1,1313 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5_H5P */ + +#ifndef _Included_hdf_hdf5lib_H5_H5P +#define _Included_hdf_hdf5lib_H5_H5P + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pcreate + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Pcreate +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Pclose +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_class + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1class +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pcopy + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Pcopy +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_version + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1version +(JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_userblock + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1userblock +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_userblock + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1userblock +(JNIEnv *, jclass, jlong, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_sizes + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1sizes +(JNIEnv *, jclass, jlong, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_sizes + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1sizes +(JNIEnv *, jclass, jlong, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_sym_k + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1sym_1k +(JNIEnv *, jclass, jlong, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_sym_k + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1sym_1k +(JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_istore_k + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1istore_1k +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_istore_k + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1istore_1k +(JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_layout + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1layout +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_layout + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1layout +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_chunk + * Signature: (JI[B)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1chunk +(JNIEnv *, jclass, jlong, jint, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_chunk + * Signature: (JI[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1chunk +(JNIEnv *, jclass, jlong, jint, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_alignment + * Signature: (JJJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1alignment +(JNIEnv *, jclass, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_alignment + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1alignment +(JNIEnv *, jclass, jlong, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_external + * Signature: (JLjava/lang/String;JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1external +(JNIEnv *, jclass, jlong, jstring, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_external_count + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1external_1count +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_external + * Signature: (JIJ[Ljava/lang/String;[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1external +(JNIEnv *, jclass, jlong, jint, jlong, jobjectArray, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fill_value + * Signature: (JJ[B)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fill_1value +(JNIEnv *, jclass, jlong, jlong, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fill_value + * Signature: (JJ[B)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1fill_1value +(JNIEnv *, jclass, jlong, jlong, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_filter + * Signature: (JIIJ[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1filter +(JNIEnv *, jclass, jlong, jint, jint, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_nfilters + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1nfilters +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_filter + * Signature: (JI[I[J[IJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1filter +(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_driver + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1driver +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_cache + * Signature: (JIJJD)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1cache +(JNIEnv *, jclass, jlong, jint, jlong, jlong, jdouble); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_cache + * Signature: (J[I[J[J[D)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1cache +(JNIEnv *, jclass, jlong, jintArray, jlongArray, jlongArray, jdoubleArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_buffer + * Signature: (JJ[B[B)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1buffer +(JNIEnv *, jclass, jlong, jlong, jbyteArray, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_buffer + * Signature: (J[B[B)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1buffer +(JNIEnv *, jclass, jlong, jbyteArray, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_buffer_size + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1buffer_1size +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_buffer_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1buffer_1size +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_preserve + * Signature: (JZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1preserve +(JNIEnv *, jclass, jlong, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_preserve + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1preserve +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_deflate + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1deflate +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_gc_references + * Signature: (JZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1gc_1references +(JNIEnv *, jclass, jlong, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_gc_references + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pget_1gc_1references +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_btree_ratios + * Signature: (JDDD)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1btree_1ratios +(JNIEnv *, jclass, jlong, jdouble, jdouble, jdouble); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_btree_ratios + * Signature: (J[D[D[D)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1btree_1ratios +(JNIEnv *, jclass, jlong, jdoubleArray, jdoubleArray, jdoubleArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_small_data_block_size + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1small_1data_1block_1size +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_small_data_block_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1small_1data_1block_1size +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_alloc_time + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1alloc_1time +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_alloc_time + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1alloc_1time +(JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fill_time + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fill_1time +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fill_time + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1fill_1time +(JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pfill_value_defined + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pfill_1value_1defined +(JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fletcher32 + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fletcher32 +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_edc_check + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1edc_1check +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_edc_check + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1edc_1check +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_shuffle + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1shuffle +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_szip + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1szip +(JNIEnv *, jclass, jlong, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_hyper_vector_size + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1hyper_1vector_1size +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_hyper_vector_size + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1hyper_1vector_1size +(JNIEnv *, jclass, jlong, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pall_filters_avail + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pall_1filters_1avail +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pmodify_filter + * Signature: (JIIJ[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pmodify_1filter +(JNIEnv *, jclass, jlong, jint, jint, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_filter_by_id + * Signature: (JI[I[J[IJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id +(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fclose_degree + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fclose_1degree +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fclose_degree + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1fclose_1degree +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_family + * Signature: (JJJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1family +(JNIEnv *, jclass, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fapl_family + * Signature: (J[J[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1fapl_1family +(JNIEnv *, jclass, jlong, jlongArray, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_core + * Signature: (JJZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1core +(JNIEnv *, jclass, jlong, jlong, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fapl_core + * Signature: (J[J[Z)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1fapl_1core +(JNIEnv *, jclass, jlong, jlongArray, jbooleanArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_family_offset + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1family_1offset +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_family_offset + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1family_1offset +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_log + * Signature: (JLjava/lang/String;JJ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1log +(JNIEnv *, jclass, jlong, jstring, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Premove_filter + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5P1remove_1filter +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset + * Signature: (JLjava/lang/String;I)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pset +(JNIEnv *, jclass, jlong, jstring, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pexist + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pexist +(JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_size + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1size +(JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_nprops + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1nprops +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_class_name + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Pget_1class_1name +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_class_parent + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1class_1parent +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pisa_class + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pisa_1class +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget +(JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pequal + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pequal +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pcopy_prop + * Signature: (JJLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pcopy_1prop +(JNIEnv *, jclass, jlong, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Premove + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Premove +(JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Punregister + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Punregister +(JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Pclose_class + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Pclose_1class +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_filter2 + * Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1filter2 +(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_filter_by_id2 + * Signature: (JI[I[J[IJ[Ljava/lang/String;[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1filter_1by_1id2 +(JNIEnv *, jclass, jlong, jint, jintArray, jlongArray, jintArray, jlong, jobjectArray, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_nlinks + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1nlinks +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_nlinks + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1nlinks +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_libver_bounds + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1libver_1bounds +(JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_libver_bounds + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1libver_1bounds +(JNIEnv *, jclass, jlong, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_link_creation_order + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1link_1creation_1order +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_link_creation_order + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1link_1creation_1order +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_attr_creation_order + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1attr_1creation_1order +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_attr_creation_order + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1attr_1creation_1order +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_copy_object + * Signature: (JI)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1copy_1object +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_copy_object + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1copy_1object +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_create_intermediate_group + * Signature: (JZ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1create_1intermediate_1group +(JNIEnv *, jclass, jlong, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_create_intermediate_group + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pget_1create_1intermediate_1group +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_data_transform + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1data_1transform +(JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_data_transform + * Signature: (J[Ljava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1data_1transform +(JNIEnv *, jclass, jlong, jobjectArray, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_elink_acc_flags + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1elink_1acc_1flags +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_elink_acc_flags + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_link_phase_change + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1link_1phase_1change +(JNIEnv *, jclass, jlong, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_link_phase_change + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1link_1phase_1change +(JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_attr_phase_change + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1attr_1phase_1change +(JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_attr_phase_change + * Signature: (JII)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1attr_1phase_1change +(JNIEnv *, jclass, jlong, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_shared_mesg_phase_change + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1phase_1change +(JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_shared_mesg_phase_change + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1phase_1change +(JNIEnv *, jclass, jlong, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_shared_mesg_nindexes + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1nindexes +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_shared_mesg_nindexes + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1nindexes +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_shared_mesg_index + * Signature: (JIII)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1shared_1mesg_1index +(JNIEnv *, jclass, jlong, jint, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_shared_mesg_index + * Signature: (JI[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1shared_1mesg_1index +(JNIEnv *, jclass, jlong, jint, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_local_heap_size_hint + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1local_1heap_1size_1hint +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_local_heap_size_hint + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1local_1heap_1size_1hint +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_nbit + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1nbit +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_scaleoffset + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1scaleoffset +(JNIEnv *, jclass, jlong, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_est_link_info + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1est_1link_1info +(JNIEnv *, jclass, jlong, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_est_link_info + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1est_1link_1info +(JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_elink_fapl + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1elink_1fapl +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Pget_elink_fapl + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Pget_1elink_1fapl +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_elink_prefix + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1elink_1prefix +(JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_elink_prefix + * Signature: (J[Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1elink_1prefix +(JNIEnv *, jclass, jlong, jobjectArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_direct + * Signature: (JJJJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1direct +(JNIEnv *, jclass, jlong, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fapl_direct + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1fapl_1direct +(JNIEnv *, jclass, jlong, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_sec2 + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1sec2 +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_stdio + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1stdio +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_windows + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1windows +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_fapl_muti + * Signature: (J[I[J[Ljava/lang/String;[J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pget_1fapl_1multi +(JNIEnv *, jclass, jlong, jintArray, jlongArray, jobjectArray, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_muti + * Signature: (J[I[J[Ljava/lang/String;[JZ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi +(JNIEnv *, jclass, jlong, jintArray, jlongArray, jobjectArray, jlongArray, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_fapl_split + * Signature: (JLjava/lang/String;JLjava/lang/String;J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1fapl_1split +(JNIEnv *, jclass, jlong, jstring, jlong, jstring, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_meta_block_size + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1meta_1block_1size +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_meta_block_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1meta_1block_1size +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_sieve_buf_size + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1sieve_1buf_1size +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_sieve_buf_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1sieve_1buf_1size +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_elink_file_cache_size + * Signature: (JI)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1elink_1file_1cache_1size +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_elink_file_cache_size + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1elink_1file_1cache_1size +(JNIEnv *, jclass, jlong); + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_mdc_config + * Signature: (J)Lhdf/hdf5lib/structs/H5AC_cache_config_t; + */ +JNIEXPORT jobject JNICALL Java_hdf_hdf5lib_H5_H5Pget_1mdc_1config +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_mdc_config + * Signature: (JLhdf/hdf5lib/structs/H5AC_cache_config_t;)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config +(JNIEnv *, jclass, jlong, jobject); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_chunk_cache + * Signature: (JJJD)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1chunk_1cache +(JNIEnv *, jclass, jlong, jlong, jlong, jdouble); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_chunk_cache + * Signature: (J[J[J[D)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pget_1chunk_1cache +(JNIEnv *, jclass, jlong, jlongArray, jlongArray, jdoubleArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_obj_track_times + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pget_1obj_1track_1times +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_obj_track_times + * Signature: (JZ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1obj_1track_1times +(JNIEnv *, jclass, jlong, jboolean); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_char_encoding + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1char_1encoding +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_char_encoding + * Signature: (JI)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1char_1encoding +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_virtual + * Signature: (JJLjava/lang/String;Ljava/lang/String;J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1virtual +(JNIEnv *, jclass, jlong, jlong, jstring, jstring, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_count + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1count +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_vspace + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1vspace +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_srcspace + * Signature: (JJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1srcspace +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_filename + * Signature: (JJ)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1filename +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_dsetname + * Signature: (JJ)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1dsetname +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_view + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1view +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_virtual_view + * Signature: (JI)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1virtual_1view +(JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_virtual_printf_gap + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pget_1virtual_1printf_1gap +(JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_virtual_printf_gap + * Signature: (JJ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1virtual_1printf_1gap +(JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pget_file_space + * Signature: (J[I[J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pget_1file_1space +(JNIEnv *, jclass, jlong, jintArray, jlongArray); + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pset_file_space + * Signature: (JIJ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pset_1file_1space +(JNIEnv *, jclass, jlong, jint, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Pcreate_class_nocb + * Signature: (JLjava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Pcreate_1class_1nocb + (JNIEnv*, jclass, jlong, jstring); +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Pcreate_class + * Signature: (JLjava/lang/String;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Pcreate_1class + (JNIEnv*, jclass, jlong, jstring, jobject, jobject, jobject, jobject, jobject, jobject); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pregister2_nocb + * Signature: (JLjava/lang/String;J[B)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pregister2_1nocb + (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pregister2 + * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pregister2 + (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray, jobject, jobject, jobject, jobject, jobject, jobject, jobject); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pinsert2_nocb + * Signature: (JLjava/lang/String;J[B)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pinsert2_1nocb + (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Pinsert2 + * Signature: (JLjava/lang/String;J[BLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Pinsert2 + (JNIEnv*, jclass, jlong, jstring, jlong, jbyteArray, jobject, jobject, jobject, jobject, jobject, jobject); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Piterate + * Signature: (J[ILjava/lang/Object;Ljava/lang/Object;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Piterate + (JNIEnv*, jclass, jlong, jintArray, jobject, jobject); + + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5P */ diff --git a/java/src/jni/h5rImp.c b/java/src/jni/h5rImp.c new file mode 100644 index 0000000..9b19bfb --- /dev/null +++ b/java/src/jni/h5rImp.c @@ -0,0 +1,324 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "hdf5.h" +#include +#include +#include "h5jni.h" +#include "h5rImp.h" + +extern JavaVM *jvm; +extern jobject visit_callback; + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rcreate + * Signature: ([BJLjava/lang/String;IJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Rcreate(JNIEnv *env, jclass clss, jbyteArray ref, jlong loc_id, jstring name, jint ref_type, jlong space_id) +{ + const char *rName; + herr_t status = -1; + jbyte *refP; + jboolean isCopy2; + + PIN_JAVA_STRING(name, rName, -1); + + if (ref == NULL) { + UNPIN_JAVA_STRING(name, rName); + h5nullArgument( env, "H5Rcreate: ref is NULL"); + } /* end if */ + else { + if ((ref_type == H5R_OBJECT) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_OBJ_REF_BUF_SIZE) { + UNPIN_JAVA_STRING(name, rName); + h5badArgument( env, "H5Rcreate: ref input array != H5R_OBJ_REF_BUF_SIZE"); + } /* end if */ + else if ((ref_type == H5R_DATASET_REGION) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_DSET_REG_REF_BUF_SIZE) { + UNPIN_JAVA_STRING(name, rName); + h5badArgument( env, "H5Rcreate: region ref input array != H5R_DSET_REG_REF_BUF_SIZE"); + } /* end else if */ + else if ((ref_type != H5R_OBJECT) && (ref_type != H5R_DATASET_REGION)) { + UNPIN_JAVA_STRING(name, rName); + h5badArgument( env, "H5Rcreate: ref_type unknown type "); + } /* end else if */ + else { + refP = (jbyte*)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy2); + if (refP == NULL) { + UNPIN_JAVA_STRING(name, rName); + h5JNIFatalError(env, "H5Rcreate: ref not pinned"); + } /* end if */ + else { + status = H5Rcreate(refP, (hid_t)loc_id, rName, (H5R_type_t)ref_type, (hid_t)space_id); + + UNPIN_JAVA_STRING(name, rName); + if (status < 0) { + ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, 0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Rcreate */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Rdereference + * Signature: (JJI[B)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Rdereference(JNIEnv *env, jclass clss, jlong dataset, jlong access_list, jint ref_type, jbyteArray ref) +{ + jboolean isCopy; + jbyte *refP; + hid_t retVal = -1; + + if (ref == NULL) { + h5nullArgument( env, "H5Rdereference: ref is NULL"); + } /* end if */ + else if ((ref_type == H5R_OBJECT) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_OBJ_REF_BUF_SIZE) { + h5badArgument( env, "H5Rdereference: obj ref input array != H5R_OBJ_REF_BUF_SIZE"); + } /* end else if */ + else if ((ref_type == H5R_DATASET_REGION) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_DSET_REG_REF_BUF_SIZE) { + h5badArgument( env, "H5Rdereference: region ref input array != H5R_DSET_REG_REF_BUF_SIZE"); + } /* end else if */ + else { + refP = (jbyte*)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy); + if (refP == NULL) { + h5JNIFatalError(env, "H5Rderefernce: ref not pinned"); + } /* end if */ + else { + retVal = H5Rdereference2((hid_t)dataset, (hid_t)access_list, (H5R_type_t)ref_type, refP); + + ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT); + + if (retVal < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Rdereference */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rget_region + * Signature: (JI[B)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Rget_1region(JNIEnv *env, jclass clss, jlong dataset, jint ref_type, jbyteArray ref) +{ + hid_t retVal = -1; + jboolean isCopy; + jbyte *refP; + + if (ref_type != H5R_DATASET_REGION) { + h5badArgument( env, "H5Rget_region: bad ref_type "); + } /* end if */ + else if (ref == NULL) { + h5nullArgument( env, "H5Rget_region: ref is NULL"); + } /* end if */ + else if ( ENVPTR->GetArrayLength(ENVPAR ref) != H5R_DSET_REG_REF_BUF_SIZE) { + h5badArgument( env, "H5Rget_region: region ref input array != H5R_DSET_REG_REF_BUF_SIZE"); + } /* end if */ + else { + refP = (jbyte*)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy); + if (refP == NULL) { + h5JNIFatalError(env, "H5Rget_region: ref not pinned"); + } /* end if */ + else { + retVal = H5Rget_region((hid_t)dataset, (H5R_type_t)ref_type, refP); + + ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT); + + if (retVal < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Rget_1region */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5G_obj_t H5Rget_obj_type + * Signature: (JI[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Rget_1obj_1type(JNIEnv *env, jclass clss, jlong loc_id, jint ref_type, jbyteArray ref) +{ + int retVal =-1; + jboolean isCopy; + jbyte *refP; + H5O_type_t object_info; + + + if (ref == NULL) { + h5nullArgument( env, "H5Rget_object_type: ref is NULL"); + } /* end if */ + else { + refP = (jbyte*)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy); + if (refP == NULL) { + h5JNIFatalError(env, "H5Rget_object_type: ref not pinned"); + } /* end if */ + else { + retVal = H5Rget_obj_type2((hid_t)loc_id, (H5R_type_t)ref_type, refP, &object_info); + if(retVal >= 0) + retVal = object_info; + + ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT); + + if (retVal < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Rget_1obj_1type */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: int H5Rget_obj_type2 + * Signature: (JI[B[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Rget_1obj_1type2(JNIEnv *env, jclass clss, jlong loc_id, jint ref_type, jbyteArray ref, jintArray ref_obj) +{ + + jint status; + jboolean isCopy; + jbyte *refP; + jint *ref_objP; + int retVal = -1; + + + if (ref == NULL) { + h5nullArgument( env, "H5Rget_object_type: ref is NULL"); + } /* end if */ + else if (ref_obj == NULL) { + h5nullArgument( env, "H5Rget_object_type: ref_obj is NULL"); + } /* end else if */ + else { + refP = (jbyte *)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy); + if (refP == NULL) { + h5JNIFatalError(env, "H5Rget_object_type: ref not pinned"); + } /* end if */ + else { + ref_objP = (jint *)ENVPTR->GetIntArrayElements(ENVPAR ref_obj, &isCopy); + if (ref_objP == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR ref,refP,0); + h5JNIFatalError(env, "H5Rget_object_type: ref_obj not pinned"); + } /* end if */ + else { + status = H5Rget_obj_type2((hid_t)loc_id, (H5R_type_t)ref_type, refP, (H5O_type_t*)ref_objP); + retVal = ref_objP[0]; + + ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT); + if (status < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR ref_obj,ref_objP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + ENVPTR->ReleaseIntArrayElements(ENVPAR ref_obj, ref_objP, 0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Rget_1obj_1type2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rget_name + * Signature: (JI[B[Ljava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Rget_1name(JNIEnv *env, jclass clss, jlong loc_id, jint ref_type, jbyteArray ref, jobjectArray name, jlong size) +{ + jlong ret_val = -1; + jbyte *refP; + jboolean isCopy; + char *aName = NULL; + jstring str; + size_t bs; + + bs = (size_t)size; + if (bs <= 0) { + h5badArgument(env, "H5Rget_name: size <= 0"); + } /* end if */ + else if (ref == NULL) { + h5nullArgument(env, "H5Rget_name: ref is NULL"); + } /* end else if */ + else { + if ((ref_type == H5R_OBJECT) && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_OBJ_REF_BUF_SIZE) { + h5badArgument(env, "H5Rget_name: obj ref input array != H5R_OBJ_REF_BUF_SIZE"); + } /* end if */ + else if ((ref_type == H5R_DATASET_REGION) + && ENVPTR->GetArrayLength(ENVPAR ref) != H5R_DSET_REG_REF_BUF_SIZE) { + h5badArgument(env, "H5Rget_name: region ref input array != H5R_DSET_REG_REF_BUF_SIZE"); + } /* end else if */ + else { + refP = (jbyte *)ENVPTR->GetByteArrayElements(ENVPAR ref, &isCopy); + if (refP == NULL) { + h5JNIFatalError(env, "H5Rget_name: ref not pinned"); + } /* end if */ + else { + aName = (char*)HDmalloc(sizeof(char)*bs); + if (aName == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT); + h5outOfMemory(env, "H5Rget_name: malloc failed"); + } /* end if */ + else { + ret_val = (jlong)H5Rget_name((hid_t)loc_id, (H5R_type_t)ref_type, refP, aName, bs) ; + + ENVPTR->ReleaseByteArrayElements(ENVPAR ref, refP, JNI_ABORT); + if (ret_val < 0) { + HDfree(aName); + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR aName); + ENVPTR->SetObjectArrayElement(ENVPAR name, 0, str); + + HDfree(aName); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return ret_val; +} /* end Java_hdf_hdf5lib_H5_H5Rget_1name */ + + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5rImp.h b/java/src/jni/h5rImp.h new file mode 100644 index 0000000..2afb345 --- /dev/null +++ b/java/src/jni/h5rImp.h @@ -0,0 +1,78 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5R */ + +#ifndef _Included_hdf_hdf5lib_H5_H5R +#define _Included_hdf_hdf5lib_H5_H5R + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rcreate + * Signature: ([BJLjava/lang/String;IJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Rcreate + (JNIEnv *, jclass, jbyteArray, jlong, jstring, jint, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Rdereference + * Signature: (JJI[B)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Rdereference + (JNIEnv *, jclass, jlong, jlong, jint, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rget_region + * Signature: (JI[B)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Rget_1region + (JNIEnv *, jclass, jlong, jint, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5G_obj_t H5Rget_obj_type + * Signature: (JI[B)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Rget_1obj_1type + (JNIEnv *, jclass, jlong, jint, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: int H5Rget_obj_type2 + * Signature: (JI[B[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Rget_1obj_1type2 + (JNIEnv *, jclass, jlong, jint, jbyteArray, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Rget_name + * Signature: (JI[B[Ljava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Rget_1name + (JNIEnv *, jclass, jlong, jint, jbyteArray, jobjectArray, jlong); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5R */ diff --git a/java/src/jni/h5sImp.c b/java/src/jni/h5sImp.c new file mode 100644 index 0000000..2aad3d0 --- /dev/null +++ b/java/src/jni/h5sImp.c @@ -0,0 +1,1408 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include "hdf5.h" +#include "h5jni.h" +#include "h5sImp.h" + +extern JavaVM *jvm; +extern jobject visit_callback; + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Screate + * Signature: (I)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Screate(JNIEnv *env, jclass clss, jint type) +{ + hid_t retVal = -1; + + retVal = H5Screate((H5S_class_t) type); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Screate */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Screate_simple + * Signature: (I[J[J)G + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Screate_1simple(JNIEnv *env, jclass clss, jint rank, + jlongArray dims, jlongArray maxdims) +{ + hid_t retVal = -1; + jlong *dimsP, *maxdimsP; + jboolean isCopy; + hsize_t *sa = NULL; + hsize_t *msa = NULL; + int i; + int drank, mrank; + hsize_t *lp; + jlong *jlp; + + if (rank < 0) { + h5badArgument(env, "H5Screate_simple: rank is invalid"); + } /* end if */ + else if (dims == NULL) { + h5nullArgument(env, "H5Screate_simple: dims is NULL"); + } /* end else if */ + else { + drank = (int)ENVPTR->GetArrayLength(ENVPAR dims); + if (drank != rank) { + h5badArgument(env, "H5Screate_simple: dims rank is invalid"); + return -1; + } /* end if */ + if (maxdims != NULL) { + mrank = (int)ENVPTR->GetArrayLength(ENVPAR maxdims); + if (mrank != rank) { + h5badArgument(env, "H5Screate_simple: maxdims rank is invalid"); + return -1; + } /* end if */ + } /* end if */ + dimsP = ENVPTR->GetLongArrayElements(ENVPAR dims, &isCopy); + if (dimsP == NULL) { + h5JNIFatalError(env, "H5Screate_simple: dims not pinned"); + return -1; + } /* end if */ + + sa = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (sa == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + h5JNIFatalError(env, "H5Screate_simple: dims not converted to hsize_t"); + return -1; + } /* end if */ + + jlp = (jlong *) dimsP; + for (i = 0; i < rank; i++) { + *lp = (hsize_t) *jlp; + lp++; + jlp++; + } /* end for */ + + if (maxdims == NULL) { + maxdimsP = NULL; + msa = (hsize_t *)maxdimsP; + } /* end if */ + else { + maxdimsP = ENVPTR->GetLongArrayElements(ENVPAR maxdims, &isCopy); + if (maxdimsP == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + HDfree(sa); + h5JNIFatalError(env, "H5Screate_simple: maxdims not pinned"); + return -1; + } /* end if */ + msa = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (msa == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT); + HDfree(sa); + h5JNIFatalError(env, "H5Screate_simple: dims not converted to hsize_t"); + return -1; + } /* end if */ + jlp = (jlong *)maxdimsP; + for (i = 0; i < mrank; i++) { + *lp = (hsize_t)*jlp; + lp++; + jlp++; + } /* end for */ + } /* end else */ + + retVal = H5Screate_simple(rank, (const hsize_t *)sa, (const hsize_t *)msa); + + if (maxdimsP != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT); + if (msa) + HDfree(msa); + } /* end if */ + + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + if (sa) + HDfree(sa); + + if (retVal < 0) + h5libraryError(env); + } /* end else */ + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Screate_1simple */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Scopy + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Scopy(JNIEnv *env, jclass clss, jlong space_id) +{ + hid_t retVal = -1; + + retVal = H5Scopy(space_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Scopy */ + +#ifdef notdef +// 10/28/99 -- added code to copy the array -- this is not used, +// but serves as a reminder in case we try to implement this in +// the future.... +/* + * Note: the argument coord is actually long coord[][], which has been + * flattened by the caller. + */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sselect_elements + * Signature: (JII[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sselect_1elements(JNIEnv *env, jclass clss, jlong space_id, jint op, jint num_elemn, jlongArray coord) +{ + herr_t status = -1; + jint i; + jlong *P; + jboolean isCopy; + hssize_t *sa; + int rank; + + if (coord == NULL) { + h5nullArgument( env, "H5Sselect_elements: coord is NULL"); + return -1; + } /* end if */ + + P = ENVPTR->GetLongArrayElements(ENVPAR env,coord,&isCopy); + if (P == NULL) { + h5JNIFatalError(env, "H5Sselect_elements: coord not pinned"); + return -1; + } /* end if */ + sa = (hssize_t *)HDmalloc( (size_t)num_elems * 2 * sizeof(hssize_t)); + if (sa == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR env,coord,P,JNI_ABORT); + h5JNIFatalError(env, "H5Sselect_elements: coord array not converted to hssize_t"); + return -1; + } /* end if */ + for (i= 0; i < (num_elsms * 2); i++) { + sa[i] = P[i]; + } /* end for */ + + status = H5Sselect_elements (space_id, (H5S_seloper_t)op, num_elemn, (const hssize_t **)&sa); + ENVPTR->ReleaseLongArrayElements(ENVPAR env, coord, P, JNI_ABORT); + HDfree(sa); + + if (status < 0) + h5libraryError(env); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Sselect_1elements */ +#endif + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sselect_elements + * Signature: (JII[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sselect_1elements(JNIEnv *env, jclass clss, jlong space_id, jint op, + jint num_elemn, jbyteArray coord) +{ + int ii; + hsize_t *lp = NULL; + hsize_t *llp; + jlong *jlp; + herr_t status = -1; + jbyte *P; + jboolean isCopy; + jsize size; + int nlongs; + + if (coord == NULL) { + h5nullArgument(env, "H5Sselect_elements: coord is NULL"); + } /* end if */ + else { + P = ENVPTR->GetByteArrayElements(ENVPAR coord, &isCopy); + if (P == NULL) { + h5JNIFatalError(env, "H5Sselect_elements: coord not pinned"); + } /* end if */ + else { + size = (int)ENVPTR->GetArrayLength(ENVPAR coord); + nlongs = (int)((size_t)size / sizeof(jlong)); + lp = (hsize_t *)HDmalloc((size_t)nlongs * sizeof(hsize_t)); + jlp = (jlong *) P; + llp = lp; + for (ii = 0; ii < nlongs; ii++) { + *lp = (hsize_t) *jlp; + lp++; + jlp++; + } /* end for */ + + status = H5Sselect_elements(space_id, (H5S_seloper_t)op, (size_t)num_elemn, (const hsize_t *)llp); + + ENVPTR->ReleaseByteArrayElements(ENVPAR coord, P, JNI_ABORT); + + if (llp) + HDfree(llp); + + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Sselect_1elements */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sselect_all + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sselect_1all(JNIEnv *env, jclass clss, jlong space_id) +{ + herr_t retVal = -1; + + retVal = H5Sselect_all(space_id); + if (retVal < 0) + h5libraryError(env); + + return (jint) retVal; +} /* end Java_hdf_hdf5lib_H5_H5Sselect_1all */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sselect_none + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sselect_1none(JNIEnv *env, jclass clss, jlong space_id) +{ + herr_t retVal = -1; + + retVal = H5Sselect_none(space_id); + if (retVal < 0) + h5libraryError(env); + + return (jint) retVal; +} /* end Java_hdf_hdf5lib_H5_H5Sselect_1none */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sselect_valid + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Sselect_1valid(JNIEnv *env, jclass clss, jlong space_id) +{ + htri_t bval = JNI_FALSE; + + bval = H5Sselect_valid(space_id); + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Sselect_1valid */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_simple_extent_npoints + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1npoints(JNIEnv *env, jclass clss, jlong space_id) +{ + hssize_t retVal = H5Sget_simple_extent_npoints(space_id); + + if (retVal < 0) + h5libraryError(env); + + return (jlong) retVal; +} /* end Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1npoints */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_npoints + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Sget_1select_1npoints(JNIEnv *env, jclass clss, jlong space_id) +{ + hssize_t retVal = H5Sget_select_npoints(space_id); + + if (retVal < 0) + h5libraryError(env); + + return (jlong) retVal; +} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1npoints */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_type + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sget_1select_1type(JNIEnv *env, jclass clss, jlong space_id) +{ + int retVal = -1; + + retVal = H5Sget_select_type(space_id); + if (retVal < 0) + h5libraryError(env); + + return (jint) retVal; +} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1type */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_simple_extent_ndims + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1ndims(JNIEnv *env, jclass clss, jlong space_id) +{ + int retVal = -1; + + retVal = H5Sget_simple_extent_ndims(space_id); + if (retVal < 0) + h5libraryError(env); + + return (jint) retVal; +} /* end Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1ndims */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_simple_extent_dims + * Signature: (J[J[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims(JNIEnv *env, jclass clss, jlong space_id, + jlongArray dims, jlongArray maxdims) +{ + int status = -1; + jlong *dimsP, *maxdimsP; + jboolean isCopy; + hsize_t *sa; + hsize_t *msa; + int i; + int rank = -1; + int mrank; + + if (dims == NULL) { + dimsP = NULL; + sa = (hsize_t *) dimsP; + } /* end if */ + else { + dimsP = ENVPTR->GetLongArrayElements(ENVPAR dims, &isCopy); + if (dimsP == NULL) { + h5JNIFatalError(env, "H5Pget_simple_extent_dims: dims not pinned"); + return -1; + } /* end if */ + rank = (int)ENVPTR->GetArrayLength(ENVPAR dims); + sa = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (sa == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + h5JNIFatalError(env, "H5Sget_simple_extent_dims: dims not converted to hsize_t"); + return -1; + } /* end if */ + } /* end else */ + if (maxdims == NULL) { + maxdimsP = NULL; + msa = (hsize_t *) maxdimsP; + } /* end if */ + else { + maxdimsP = ENVPTR->GetLongArrayElements(ENVPAR maxdims, &isCopy); + if (maxdimsP == NULL) { + if (dimsP != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + HDfree(sa); + } /* end if */ + h5JNIFatalError(env, "H5Pget_simple_extent_dims: maxdims not pinned"); + return -1; + } /* end if */ + mrank = (int) ENVPTR->GetArrayLength(ENVPAR maxdims); + if (rank < 0) + rank = mrank; + else if (mrank != rank) { + if (dimsP != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + HDfree(sa); + } /* end if */ + ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT); + h5JNIFatalError(env, "H5Sget_simple_extent_dims: maxdims rank not same as dims"); + return -1; + } /* end else if */ + msa = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (msa == NULL) { + if (dimsP != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + HDfree(sa); + } /* end if */ + ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT); + h5JNIFatalError(env, "H5Sget_simple_extent_dims: maxdims not converted to hsize_t"); + return -1; + } /* end if */ + } /* end else */ + + status = H5Sget_simple_extent_dims(space_id, (hsize_t *)sa, (hsize_t *)msa); + + if (status < 0) { + if (dimsP != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + HDfree(sa); + } /* end if */ + if (maxdimsP != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT); + HDfree(msa); + } /* end if */ + h5libraryError(env); + return -1; + } /* end if */ + + if (dimsP != NULL) { + for (i = 0; i < rank; i++) { + dimsP[i] = (jlong)sa[i]; + } /* end for */ + HDfree(sa); + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, 0); + } /* end if */ + if (maxdimsP != NULL) { + for (i = 0; i < rank; i++) { + maxdimsP[i] = (jlong)msa[i]; + } /* end for */ + HDfree(msa); + ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, 0); + } /* end if */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_simple_extent_type + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1type(JNIEnv *env, jclass clss, jlong space_id) +{ + H5S_class_t retVal = H5S_NO_CLASS; + + if (space_id < 0) + h5libraryError(env); + + retVal = H5Sget_simple_extent_type(space_id); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1type */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sset_extent_simple + * Signature: (JI[J[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple(JNIEnv *env, jclass clss, jlong space_id, + jint rank, jlongArray dims, jlongArray maxdims) +{ + herr_t status = -1; + jlong *dimsP, *maxdimsP; + jboolean isCopy; + hsize_t *sa; + hsize_t *msa; + int i; + int drank, mrank; + hsize_t *lp; + jlong *jlp; + + if (dims == NULL) { + h5nullArgument(env, "H5Sset_simple_extent: dims is NULL"); + return -1; + } /* end if */ + drank = (int) ENVPTR->GetArrayLength(ENVPAR dims); + if (drank != rank) { + h5badArgument(env, "H5Screate_simple: dims rank is invalid"); + return -1; + } /* end if */ + if (maxdims != NULL) { + mrank = (int) ENVPTR->GetArrayLength(ENVPAR maxdims); + if (mrank != rank) { + h5badArgument(env, "H5Screate_simple: maxdims rank is invalid"); + return -1; + } /* end if */ + } /* end if */ + dimsP = ENVPTR->GetLongArrayElements(ENVPAR dims, &isCopy); + if (dimsP == NULL) { + h5JNIFatalError(env, "H5Pset_simple_extent: dims not pinned"); + return -1; + } /* end if */ + sa = lp = (hsize_t *) malloc((size_t)rank * sizeof(hsize_t)); + if (sa == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + h5JNIFatalError(env, "H5Sset_simple_extent: dims not converted to hsize_t"); + return -1; + } /* end if */ + jlp = (jlong *) dimsP; + for (i = 0; i < rank; i++) { + *lp = (hsize_t) *jlp; + lp++; + jlp++; + } /* end for */ + if (maxdims == NULL) { + maxdimsP = NULL; + msa = (hsize_t *) maxdimsP; + } /* end if */ + else { + maxdimsP = ENVPTR->GetLongArrayElements(ENVPAR maxdims, &isCopy); + if (maxdimsP == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + h5JNIFatalError(env, "H5Pset_simple_extent: maxdims not pinned"); + return -1; + } /* end if */ + msa = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (msa == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT); + HDfree(sa); + h5JNIFatalError(env, "H5Sset_simple_extent: maxdims not converted to hsize_t"); + return -1; + } /* end if */ + jlp = (jlong *) maxdimsP; + for (i = 0; i < rank; i++) { + *lp = (hsize_t) *jlp; + lp++; + jlp++; + } /* end for */ + } /* end else */ + + status = H5Sset_extent_simple(space_id, rank, (hsize_t *) sa, (hsize_t *) msa); + + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + HDfree(sa); + if (maxdimsP != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR maxdims, maxdimsP, JNI_ABORT); + HDfree(msa); + } /* end if */ + + if (status < 0) + h5libraryError(env); + + return (jint)status; +} /* end v */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sis_simple + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Sis_1simple(JNIEnv *env, jclass clss, jlong space_id) +{ + htri_t bval = JNI_FALSE; + + bval = H5Sis_simple(space_id); + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Sis_1simple */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Soffset_simple + * Signature: (J[B)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Soffset_1simple(JNIEnv *env, jclass clss, jlong space_id, jbyteArray offset) +{ + herr_t status; + jbyte *P = NULL; + jboolean isCopy; + hssize_t *sa; + size_t rank; + size_t i; + hssize_t *lp; + jlong *jlp; + + if (offset != NULL) { + P = ENVPTR->GetByteArrayElements(ENVPAR offset, &isCopy); + if (P == NULL) { + h5JNIFatalError(env, "H5Soffset_simple: offset not pinned"); + return -1; + } /* end if */ + i = (size_t)ENVPTR->GetArrayLength(ENVPAR offset); + rank = i / sizeof(jlong); + sa = lp = (hssize_t *)HDmalloc((size_t)rank * sizeof(hssize_t)); + if (sa == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR offset, P, JNI_ABORT); + h5JNIFatalError(env, "H5Soffset_simple: offset not converted to hssize_t"); + return -1; + } /* end if */ + jlp = (jlong *) P; + for (i = 0; i < rank; i++) { + *lp = (hssize_t) *jlp; + lp++; + jlp++; + } /* end for */ + } /* end if */ + else { + P = NULL; + sa = (hssize_t *) P; + } /* end else */ + + status = H5Soffset_simple(space_id, sa); + if (P != NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR offset, P, JNI_ABORT); + HDfree(sa); + } /* end if */ + + if (status < 0) + h5libraryError(env); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Soffset_1simple */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sextent_copy + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sextent_1copy(JNIEnv *env, jclass clss, jlong space_id, jlong src_id) +{ + herr_t retVal = -1; + + retVal = H5Sextent_copy(space_id, src_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Sextent_1copy */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sextent_equal + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Sextent_1equal(JNIEnv *env, jclass clss, jlong space_id, jlong src_id) +{ + htri_t bval = JNI_FALSE; + + bval = H5Sextent_equal(space_id, src_id); + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Sextent_1equal */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sset_extent_none + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sset_1extent_1none(JNIEnv *env, jclass clss, jlong space_id) +{ + herr_t retVal = -1; + + retVal = H5Sset_extent_none(space_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Sset_1extent_1none */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sselect_hyperslab + * Signature: (JI[J[J[J[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab(JNIEnv *env, jclass clss, jlong space_id, jint op, + jlongArray start, jlongArray stride, jlongArray count, jlongArray block) +{ + herr_t status = -1; + jlong *startP, *strideP, *countP, *blockP; + jboolean isCopy; + hsize_t *strt; + hsize_t *strd; + hsize_t *cnt; + hsize_t *blk; + int rank; + int i; + hsize_t *lp; + jlong *jlp; + + if (start == NULL) { + h5nullArgument(env, "H5Sselect_hyperslab: start is NULL"); + } /* end if */ + else if (count == NULL) { + h5nullArgument(env, "H5Sselect_hyperslab: count is NULL"); + } /* end if */ + else { + rank = (int) ENVPTR->GetArrayLength(ENVPAR start); + if (rank != ENVPTR->GetArrayLength(ENVPAR count)) { + h5badArgument(env, "H5Sselect_hyperslab: count and start have different rank!"); + return -1; + } /* end if */ + + startP = ENVPTR->GetLongArrayElements(ENVPAR start, &isCopy); + if (startP == NULL) { + h5JNIFatalError(env, "H5Sselect_hyperslab: start not pinned"); + return -1; + } /* end if */ + strt = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (strt == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + h5JNIFatalError(env, "H5Sselect_hyperslab: start not converted to hsize_t"); + return -1; + } /* end if */ + + jlp = (jlong *) startP; + for (i = 0; i < rank; i++) { + *lp = (hsize_t) *jlp; + lp++; + jlp++; + } /* end if */ + + countP = ENVPTR->GetLongArrayElements(ENVPAR count, &isCopy); + if (countP == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + HDfree(strt); + h5JNIFatalError(env, "H5Sselect_hyperslab: count not pinned"); + return -1; + } /* end if */ + cnt = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (cnt == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT); + HDfree(strt); + h5JNIFatalError(env, "H5Sselect_hyperslab: count not converted to hsize_t"); + return -1; + } /* end if */ + + jlp = (jlong *) countP; + for (i = 0; i < rank; i++) { + *lp = (hsize_t) *jlp; + lp++; + jlp++; + } /* end if */ + if (stride == NULL) { + strideP = NULL; + strd = (hsize_t *) strideP; + } /* end if */ + else { + strideP = ENVPTR->GetLongArrayElements(ENVPAR stride, &isCopy); + if (strideP == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + HDfree(cnt); + HDfree(strt); + h5badArgument(env, "H5Sselect_hyperslab: stride not pinned"); + return -1; + } /* end if */ + strd = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (strd == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT); + HDfree(cnt); + HDfree(strt); + h5JNIFatalError(env, "H5Sselect_hyperslab: stride not converted to hsize_t"); + return -1; + } /* end if */ + jlp = (jlong *) strideP; + for (i = 0; i < rank; i++) { + *lp = (hsize_t) *jlp; + lp++; + jlp++; + } /* end if */ + } /* end if */ + if (block == NULL) { + blockP = NULL; + blk = (hsize_t *) blockP; + } /* end if */ + else { + blockP = ENVPTR->GetLongArrayElements(ENVPAR block, &isCopy); + if (blockP == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + HDfree(cnt); + HDfree(strt); + if (strd != NULL) + free(strd); + + h5JNIFatalError(env, "H5Sselect_hyperslab: block not pinned"); + return -1; + } /* end if */ + blk = lp = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (blk == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR block, blockP, JNI_ABORT); + HDfree(cnt); + HDfree(strt); + if (strd != NULL) + free(strd); + + h5JNIFatalError(env, "H5Sget_simple_extent: block not converted to hsize_t"); + return -1; + } /* end if */ + jlp = (jlong *) blockP; + for (i = 0; i < rank; i++) { + *lp = (hsize_t) *jlp; + lp++; + jlp++; + } /* end for */ + } /* end else */ + + status = H5Sselect_hyperslab(space_id, (H5S_seloper_t) op, (const hsize_t *) strt, (const hsize_t *) strd, + (const hsize_t *) cnt, (const hsize_t *) blk); + + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT); + HDfree(strt); + HDfree(cnt); + if (strideP != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT); + HDfree(strd); + } /* end if */ + if (blockP != NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR block, blockP, JNI_ABORT); + HDfree(blk); + } /* end if */ + + if (status < 0) + h5libraryError(env); + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5__1H5Sclose(JNIEnv *env, jclass clss, jlong space_id) +{ + herr_t retVal = -1; + + retVal = H5Sclose(space_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Sclose */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_hyper_nblocks + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1nblocks(JNIEnv *env, jclass clss, jlong spaceid) +{ + hssize_t retVal = -1; + + retVal = H5Sget_select_hyper_nblocks((hid_t) spaceid); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1nblocks */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_elem_npoints + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1npoints(JNIEnv *env, jclass clss, jlong spaceid) +{ + hssize_t retVal = -1; + + retVal = H5Sget_select_elem_npoints((hid_t) spaceid); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1npoints */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_hyper_blocklist + * Signature: (JJJ[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist(JNIEnv *env, jclass clss, + jlong spaceid, jlong startblock, jlong numblocks, jlongArray buf) +{ + herr_t status = -1; + jlong *bufP; + jboolean isCopy; + hsize_t *ba; + int i; + int rank; + hsize_t st; + hsize_t nb; + + st = (hsize_t) startblock; + nb = (hsize_t) numblocks; + + if (buf == NULL) { + h5nullArgument(env, "H5Sget_select_hyper_blocklist: buf is NULL"); + } /* end if */ + else { + rank = H5Sget_simple_extent_ndims(spaceid); + if (rank <= 0) + rank = 1; + if (ENVPTR->GetArrayLength(ENVPAR buf) < (numblocks * rank)) { + h5badArgument(env, "H5Sget_select_hyper_blocklist: buf input array too small"); + } /* end if */ + else { + bufP = ENVPTR->GetLongArrayElements(ENVPAR buf, &isCopy); + if (bufP == NULL) { + h5JNIFatalError(env, "H5Sget_select_hyper_blocklist: buf not pinned"); + } /* end if */ + else { + ba = (hsize_t *) malloc((size_t)nb * 2 * (size_t)rank * sizeof(hsize_t)); + if (ba == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, JNI_ABORT); + h5JNIFatalError(env, "H5Screate-simple: buffer not converted to hsize_t"); + } /* end if */ + else { + status = H5Sget_select_hyper_blocklist((hid_t)spaceid, st, nb, (hsize_t *)ba); + + if (status < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, JNI_ABORT); + free(ba); + h5libraryError(env); + } /* end if */ + else { + for (i = 0; i < (numblocks * 2 * rank); i++) { + bufP[i] = (jlong)ba[i]; + } /* end for */ + free(ba); + ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, 0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_elem_pointlist + * Signature: (JJJ[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1pointlist(JNIEnv *env, jclass clss, jlong spaceid, + jlong startpoint, jlong numpoints, jlongArray buf) +{ + herr_t status = -1; + jlong *bufP; + jboolean isCopy; + hsize_t *ba; + int i; + int rank; + + if (buf == NULL) { + h5nullArgument(env, "H5Sget_select_elem_pointlist: buf is NULL"); + } /* end if */ + else { + rank = H5Sget_simple_extent_ndims(spaceid); + if (rank <= 0) + rank = 1; + if (ENVPTR->GetArrayLength(ENVPAR buf) < (numpoints * rank)) { + h5badArgument(env, "H5Sget_select_elem_pointlist: buf input array too small"); + } /* end if */ + else { + bufP = ENVPTR->GetLongArrayElements(ENVPAR buf, &isCopy); + if (bufP == NULL) { + h5JNIFatalError(env, "H5Sget_select_elem_pointlist: buf not pinned"); + } /* end if */ + else { + ba = (hsize_t *)HDmalloc(((size_t)numpoints * (size_t)rank) * sizeof(hsize_t)); + if (ba == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, JNI_ABORT); + h5JNIFatalError(env, "H5Sget_select_elem_pointlist: buf not converted to hsize_t"); + } /* end if */ + else { + status = H5Sget_select_elem_pointlist((hid_t) spaceid, (hsize_t)startpoint, (hsize_t)numpoints, (hsize_t *)ba); + + if (status < 0) { + HDfree(ba); + ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + for (i = 0; i < (numpoints * rank); i++) { + bufP[i] = (jlong)ba[i]; + } /* end for */ + HDfree(ba); + ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, 0); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end if */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_bounds + * Signature: (J[J[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds(JNIEnv *env, jclass clss, jlong spaceid, + jlongArray start, jlongArray end) +{ + herr_t status = -1; + jlong *startP, *endP; + jboolean isCopy; + hsize_t *strt; + hsize_t *en; + int rank; + int i; + + if (start == NULL) { + h5nullArgument(env, "H5Sget_select_bounds: start is NULL"); + } /* end if */ + else if (end == NULL) { + h5nullArgument(env, "H5Sget_select_bounds: end is NULL"); + } /* end else if */ + else { + startP = ENVPTR->GetLongArrayElements(ENVPAR start, &isCopy); + if (startP == NULL) { + h5JNIFatalError(env, "H5Sget_select_bounds: start not pinned"); + return -1; + } /* end if */ + rank = (int) ENVPTR->GetArrayLength(ENVPAR start); + strt = (hsize_t *)malloc((size_t)rank * sizeof(hsize_t)); + if (strt == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + h5JNIFatalError(env, "H5Sget_select_bounds: start not converted to hsize_t"); + return -1; + } /* end if */ + + endP = ENVPTR->GetLongArrayElements(ENVPAR end, &isCopy); + if (endP == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + free(strt); + h5JNIFatalError(env, "H5Sget_select_bounds: end not pinned"); + return -1; + } /* end if */ + en = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (en == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR end, endP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + HDfree(strt); + h5JNIFatalError(env, "H5Sget_simple_extent: dims not converted to hsize_t"); + return -1; + } /* end if */ + + status = H5Sget_select_bounds((hid_t) spaceid, (hsize_t *) strt, (hsize_t *) en); + + if (status < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR end, endP, JNI_ABORT); + HDfree(strt); + HDfree(en); + h5libraryError(env); + } /* end if */ + else { + for (i = 0; i < rank; i++) { + startP[i] = (jlong)strt[i]; + endP[i] = (jlong)en[i]; + } /* end for */ + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, 0); + ENVPTR->ReleaseLongArrayElements(ENVPAR end, endP, 0); + HDfree(strt); + HDfree(en); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sencode + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_H5_H5Sencode(JNIEnv *env, jclass cls, jlong obj_id) +{ + herr_t status = -1; + unsigned char *bufPtr; + size_t buf_size = 0; + jbyteArray returnedArray = NULL; + + if (obj_id < 0) { + h5badArgument(env, "H5Sencode: invalid argument"); + } /* end if */ + else { + status = H5Sencode(obj_id, NULL, &buf_size); + + if (status < 0) { + h5libraryError(env); + } /* end else if */ + else if (buf_size < 0) { + h5badArgument(env, "H5Sencode: buf_size < 0"); + } /* end if */ + else { + bufPtr = (unsigned char*)HDcalloc((size_t) 1, buf_size); + if (bufPtr == NULL) { + h5outOfMemory(env, "H5Sencode: calloc failed"); + } /* end if */ + else { + status = H5Sencode((hid_t) obj_id, bufPtr, &buf_size); + + if (status < 0) { + HDfree(bufPtr); + h5libraryError(env); + } /* end if */ + else { + returnedArray = ENVPTR->NewByteArray(ENVPAR (jsize)buf_size); + ENVPTR->SetByteArrayRegion(ENVPAR returnedArray, 0, (jsize)buf_size, (jbyte*) bufPtr); + HDfree(bufPtr); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return returnedArray; +} /* end Java_hdf_hdf5lib_H5_H5Sencode */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sdecode + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Sdecode(JNIEnv *env, jclass cls, jbyteArray buf) +{ + hid_t sid = -1; + jbyte *bufP; + jboolean isCopy; + + if (buf == NULL) { + h5nullArgument(env, "H5Sdecode: buf is NULL"); + } /* end if */ + else { + bufP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy); + if (bufP == NULL) { + h5JNIFatalError( env, "H5Sdecode: buf not pinned"); + } /* end if */ + else { + sid = H5Sdecode(bufP); + + ENVPTR->ReleaseByteArrayElements(ENVPAR buf, bufP, JNI_ABORT); + + if (sid < 0) + h5libraryError(env); + } /* end else if */ + } /* end else if */ + + return (jlong)sid; +} /* end Java_hdf_hdf5lib_H5_H5Sdecode */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sis_regular_hyperslab + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Sis_1regular_1hyperslab(JNIEnv *env, jclass cls, jlong obj_id) +{ + htri_t bval = JNI_FALSE; + + bval = H5Sis_regular_hyperslab((hid_t)obj_id); + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Sis_1regular_1hyperslab */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_regular_hyperslab + * Signature: (J[J[J[J[J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab(JNIEnv *env, jclass clss, jlong space_id, + jlongArray start, jlongArray stride, jlongArray count, jlongArray block) +{ + herr_t status; + jlong *startP, *strideP, *countP, *blockP; + jboolean isCopy; + hsize_t *strt; + hsize_t *strd; + hsize_t *cnt; + hsize_t *blk; + int rank; + int i; + + if (start == NULL) { + h5nullArgument(env, "H5Sget_regular_hyperslab: start is NULL"); + } /* end if */ + else if (count == NULL) { + h5nullArgument(env, "H5Sget_regular_hyperslab: count is NULL"); + } /* end else if */ + else { + rank = (int) ENVPTR->GetArrayLength(ENVPAR start); + if (rank != ENVPTR->GetArrayLength(ENVPAR count)) { + h5badArgument(env, "H5Sget_regular_hyperslab: count and start have different rank!"); + return; + } /* end if */ + + startP = ENVPTR->GetLongArrayElements(ENVPAR start, &isCopy); + if (startP == NULL) { + h5JNIFatalError(env, "H5Sget_regular_hyperslab: start not pinned"); + return; + } /* end if */ + strt = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (strt == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + h5JNIFatalError(env, "H5Sget_regular_hyperslab: start not converted to hsize_t"); + return; + } /* end if */ + + countP = ENVPTR->GetLongArrayElements(ENVPAR count, &isCopy); + if (countP == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + HDfree(strt); + h5JNIFatalError(env, "H5Sget_regular_hyperslab: count not pinned"); + return; + } /* end if */ + cnt = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (cnt == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT); + HDfree(strt); + h5JNIFatalError(env, "H5Sget_regular_hyperslab: count not converted to hsize_t"); + return; + } /* end if */ + + strideP = ENVPTR->GetLongArrayElements(ENVPAR stride, &isCopy); + if (strideP == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + HDfree(cnt); + HDfree(strt); + h5badArgument(env, "H5Sget_regular_hyperslab: stride not pinned"); + return; + } /* end if */ + strd = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (strd == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT); + HDfree(cnt); + HDfree(strt); + h5JNIFatalError(env, "H5Sget_regular_hyperslab: stride not converted to hsize_t"); + return; + } /* end if */ + + blockP = ENVPTR->GetLongArrayElements(ENVPAR block, &isCopy); + if (blockP == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + HDfree(cnt); + HDfree(strt); + HDfree(strd); + h5JNIFatalError(env, "H5Sget_regular_hyperslab: block not pinned"); + return; + } /* end if */ + blk = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t)); + if (blk == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR block, blockP, JNI_ABORT); + HDfree(cnt); + HDfree(strt); + HDfree(strd); + h5JNIFatalError(env, "H5Sget_regular_hyperslab: block not converted to hsize_t"); + return; + } /* end if */ + + status = H5Sget_regular_hyperslab(space_id, (hsize_t *) strt, (hsize_t *) strd, (hsize_t *) cnt, (hsize_t *) blk); + + if (status < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR block, blockP, JNI_ABORT); + HDfree(strt); + HDfree(cnt); + HDfree(strd); + HDfree(blk); + h5libraryError(env); + } /* end if */ + else { + for (i = 0; i < (rank); i++) { + startP[i] = (jlong)strt[i]; + countP[i] = (jlong)cnt[i]; + strideP[i] = (jlong)strd[i]; + blockP[i] = (jlong)blk[i]; + } /* end for */ + HDfree(strt); + HDfree(cnt); + HDfree(strd); + HDfree(blk); + ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, 0); + ENVPTR->ReleaseLongArrayElements(ENVPAR count, countP, 0); + ENVPTR->ReleaseLongArrayElements(ENVPAR stride, strideP, 0); + ENVPTR->ReleaseLongArrayElements(ENVPAR block, blockP, 0); + } /* end else */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab */ + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5sImp.h b/java/src/jni/h5sImp.h new file mode 100644 index 0000000..007b9a7 --- /dev/null +++ b/java/src/jni/h5sImp.h @@ -0,0 +1,288 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5S */ + +#ifndef _Included_hdf_hdf5lib_H5_H5S +#define _Included_hdf_hdf5lib_H5_H5S + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Screate + * Signature: (I)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Screate( + JNIEnv *, jclass, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Screate_simple + * Signature: (I[J[J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Screate_1simple( + JNIEnv *, jclass, jint, jlongArray, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Scopy + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Scopy( + JNIEnv *, jclass, jlong); + +#ifdef notdef +// 10/28/99 -- added code to copy the array -- this is not used, +// but serves as a reminder in case we try to implement this in +// the future.... +/* + * Note: the argument coord is actually long coord[][], which has been + * flattened by the caller. + */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sselect_elements + * Signature: (JII[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sselect_1elements +(JNIEnv *, jclass, jlong, jint, jint, jlongArray); +#endif + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sselect_elements + * Signature: (JII[B)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sselect_1elements( + JNIEnv *, jclass, jlong, jint, jint, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sselect_all + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sselect_1all( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sselect_none + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sselect_1none( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sselect_valid + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Sselect_1valid( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_simple_extent_npoints + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1npoints( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_npoints + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Sget_1select_1npoints( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_type + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sget_1select_1type( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_simple_extent_ndims + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1ndims( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_simple_extent_dims + * Signature: (J[J[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1dims( + JNIEnv *, jclass, jlong, jlongArray, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_simple_extent_type + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sget_1simple_1extent_1type( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sset_extent_simple + * Signature: (JI[J[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple( + JNIEnv *, jclass, jlong, jint, jlongArray, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sis_simple + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Sis_1simple( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Soffset_simple + * Signature: (J[B)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Soffset_1simple( + JNIEnv *, jclass, jlong, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sextent_copy + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sextent_1copy( + JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sextent_equal + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Sextent_1equal + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sset_extent_none + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sset_1extent_1none( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sselect_hyperslab + * Signature: (JI[J[J[J[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sselect_1hyperslab( + JNIEnv *, jclass, jlong, jint, jlongArray, jlongArray, jlongArray, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Sclose( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_hyper_nblocks + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1nblocks( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_elem_npoints + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1npoints( + JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_hyper_blocklist + * Signature: (JJJ[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist( + JNIEnv *, jclass, jlong, jlong, jlong, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_elem_pointlist + * Signature: (JJJ[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sget_1select_1elem_1pointlist( + JNIEnv *, jclass, jlong, jlong, jlong, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_select_bounds + * Signature: (J[J[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds( + JNIEnv *, jclass, jlong, jlongArray, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sencode + * Signature: (J)[B + */ +JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_H5_H5Sencode + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sdecode + * Signature: ([B)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Sdecode + (JNIEnv *, jclass, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sis_regular_hyperslab + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Sis_1regular_1hyperslab + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Sget_regular_hyperslab + * Signature: (J[J[J[J[J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Sget_1regular_1hyperslab( + JNIEnv *, jclass, jlong, jlongArray, jlongArray, jlongArray, jlongArray); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5S */ diff --git a/java/src/jni/h5tImp.c b/java/src/jni/h5tImp.c new file mode 100644 index 0000000..83882a0 --- /dev/null +++ b/java/src/jni/h5tImp.c @@ -0,0 +1,1588 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include +#include +#include +#include "hdf5.h" +#include "h5jni.h" +#include "h5tImp.h" + +extern JavaVM *jvm; +extern jobject visit_callback; + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Topen2 + * Signature: (JLjava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Topen2(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong access_plist) +{ + hid_t status; + const char *tName; + + PIN_JAVA_STRING(name, tName, -1); + + status = H5Topen2((hid_t)loc_id, tName, (hid_t)access_plist); + + UNPIN_JAVA_STRING(name, tName); + + if (status < 0) + h5libraryError(env); + + return (jlong)status; +} /* end Java_hdf_hdf5lib_H5__1H5Topen2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tcommitted + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Tcommitted(JNIEnv *env, jclass clss, jlong type_id) +{ + htri_t bval = JNI_FALSE; + + bval = H5Tcommitted(type_id); + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Tcommitted */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Tcreate + * Signature: (IJ)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Tcreate(JNIEnv *env, jclass clss, jint dclass, jlong size) +{ + hid_t retVal = -1; + + retVal = H5Tcreate((H5T_class_t )dclass, (size_t)size); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Tcreate */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tcopy + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Tcopy(JNIEnv *env, jclass clss, jlong type_id) +{ + hid_t retVal = -1; + + retVal = H5Tcopy((hid_t)type_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Tcopy */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tequal + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Tequal(JNIEnv *env, jclass clss, jlong type_id1, jlong type_id2) +{ + htri_t bval = JNI_FALSE; + + bval = H5Tequal((hid_t)type_id1, (hid_t)type_id2); + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Tequal */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tlock + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tlock(JNIEnv *env, jclass clss, jlong type_id) +{ + herr_t retVal = -1; + + retVal = H5Tlock((hid_t)type_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tlock */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_class + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1class(JNIEnv *env, jclass clss, jlong type_id) +{ + H5T_class_t retVal = H5T_NO_CLASS; + + retVal = H5Tget_class((hid_t)type_id); + if (retVal == H5T_NO_CLASS) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1class */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1size(JNIEnv *env, jclass clss, jlong type_id) +{ + size_t retVal = 0; + + retVal = H5Tget_size((hid_t)type_id); + if (retVal == 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1size*/ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_size + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1size(JNIEnv *env, jclass clss, jlong type_id, jlong size) +{ + size_t tsize = (size_t)size; + herr_t retVal = -1; + + retVal = H5Tset_size((hid_t)type_id, tsize); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end ifJava_hdf_hdf5lib_H5_H5Tset_1size */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_order + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1order(JNIEnv *env, jclass clss, jlong type_id) +{ + H5T_order_t retVal = H5T_ORDER_ERROR; + + retVal = H5Tget_order((hid_t)type_id); + if (retVal == H5T_ORDER_ERROR) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1order */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_order + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1order(JNIEnv *env, jclass clss, jlong type_id, jint order) +{ + herr_t retVal = -1; + + retVal = H5Tset_order((hid_t)type_id, (H5T_order_t)order); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tset_1order */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_precision + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1precision(JNIEnv *env, jclass clss, jlong type_id) +{ + size_t retVal = 0; + + retVal = H5Tget_precision((hid_t)type_id); + if (retVal == 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1precision */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_precision_long + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1precision_1long(JNIEnv *env, jclass clss, jlong type_id) +{ + size_t retVal = 0; + + retVal = H5Tget_precision((hid_t)type_id); + if (retVal == 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1precision_1long */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_precision + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1precision(JNIEnv *env, jclass clss, jlong type_id, jlong precision) +{ + herr_t retVal = -1; + + retVal = H5Tset_precision((hid_t)type_id, (size_t)precision); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tset_1precision */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_offset + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1offset(JNIEnv *env, jclass clss, jlong type_id) +{ + int retVal = -1; + + retVal = H5Tget_offset((hid_t)type_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1offset */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_offset + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1offset(JNIEnv *env, jclass clss, jlong type_id, jlong offset) +{ + herr_t retVal = -1; + + retVal = H5Tset_offset((hid_t)type_id, (size_t)offset); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tset_1offset */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_pad + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1pad(JNIEnv *env, jclass clss, jlong type_id, jintArray pad) +{ + herr_t status = -1; + jboolean isCopy; + jint *P; + + if (pad == NULL) { + h5nullArgument(env, "H5Tget_pad: pad is NULL"); + } /* end if */ + else { + P = ENVPTR->GetIntArrayElements(ENVPAR pad, &isCopy); + if (P == NULL) { + h5JNIFatalError(env, "H5Tget_pad: pad not pinned"); + } /* end if */ + else { + status = H5Tget_pad((hid_t)type_id, (H5T_pad_t *)&(P[0]), (H5T_pad_t *)&(P[1])); + + if (status < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR pad, P, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR pad, P, 0); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1pad */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_pad + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1pad(JNIEnv *env, jclass clss, jlong type_id, jint lsb, jint msb) +{ + herr_t retVal = -1; + + retVal = H5Tset_pad((hid_t)type_id, (H5T_pad_t)lsb, (H5T_pad_t)msb); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tset_1pad */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_sign + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1sign(JNIEnv *env, jclass clss, jlong type_id) +{ + H5T_sign_t retVal = H5T_SGN_ERROR; + + retVal = H5Tget_sign((hid_t)type_id); + if (retVal == H5T_SGN_ERROR) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1sign */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_sign + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1sign(JNIEnv *env, jclass clss, jlong type_id, jint sign) +{ + herr_t retVal = -1; + + retVal = H5Tset_sign((hid_t)type_id, (H5T_sign_t)sign); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tset_1sign */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_fields_int + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1fields_1int(JNIEnv *env, jclass clss, jlong type_id, jintArray fields) +{ + herr_t status; + jboolean isCopy; + jint *P; + + if (fields == NULL) { + h5nullArgument(env, "H5Tget_fields: fields is NULL"); + } /* end if */ + else if (ENVPTR->GetArrayLength(ENVPAR fields) < 5) { + h5badArgument(env, "H5Tget_fields: fields input array < order 5"); + } /* end else if */ + else { + P = ENVPTR->GetIntArrayElements(ENVPAR fields, &isCopy); + if (P == NULL) { + h5JNIFatalError(env, "H5Tget_fields: fields not pinned"); + } /* end if */ + else { + status = H5Tget_fields((hid_t)type_id, (size_t *)&(P[0]), (size_t *)&(P[1]), (size_t *)&(P[2]), (size_t *)&(P[3]), (size_t *)&(P[4])); + + if (status < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR fields, P, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR fields, P, 0); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1fields_1int */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_fields + * Signature: (J[J)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1fields(JNIEnv *env, jclass clss, jlong type_id, jlongArray fields) +{ + herr_t status; + jboolean isCopy; + jlong *fieldsArray; + + if (fields == NULL) { + h5nullArgument(env, "H5Tget_fields: fields is NULL"); + } /* end if */ + else if (ENVPTR->GetArrayLength(ENVPAR fields) < 5) { + h5badArgument(env, "H5Tget_fields: fields input array < order 5"); + } /* end else if */ + else { + fieldsArray = ENVPTR->GetLongArrayElements(ENVPAR fields, &isCopy); + if (fieldsArray == NULL) { + h5JNIFatalError(env, "H5Tget_fields: fields not pinned"); + } /* end if */ + else { + { /* direct cast (size_t *)variable fails on 32-bit environment */ + size_t spos_t = 0; + size_t epos_t = 0; + size_t esize_t = 0; + size_t mpos_t = 0; + size_t msize_t = 0; + long long fields_temp = *(&fieldsArray[0]); + spos_t = (size_t)fields_temp; + fields_temp = *(&fieldsArray[1]); + epos_t = (size_t)fields_temp; + fields_temp = *(&fieldsArray[2]); + esize_t = (size_t)fields_temp; + fields_temp = *(&fieldsArray[3]); + mpos_t = (size_t)fields_temp; + fields_temp = *(&fieldsArray[4]); + msize_t = (size_t)fields_temp; + + status = H5Tget_fields((hid_t)type_id, &spos_t, &epos_t, &esize_t, &mpos_t, &msize_t); + + *(&fieldsArray[0]) = (jlong)spos_t; + *(&fieldsArray[1]) = (jlong)epos_t; + *(&fieldsArray[2]) = (jlong)esize_t; + *(&fieldsArray[3]) = (jlong)mpos_t; + *(&fieldsArray[4]) = (jlong)msize_t; + } /* end direct cast special handling */ + + if (status < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR fields, fieldsArray, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseLongArrayElements(ENVPAR fields, fieldsArray, 0); + } /* end else */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Tget_1fields */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_fields + * Signature: (JJJJJJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1fields(JNIEnv *env, jclass clss, jlong type_id, jlong spos, jlong epos, + jlong esize, jlong mpos, jlong msize) +{ + if (H5Tset_fields((hid_t)type_id, (size_t)spos, (size_t)epos, (size_t)esize, (size_t)mpos, (size_t)msize) < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Tset_1fields */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_ebias + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1ebias(JNIEnv *env, jclass clss, jlong type_id) +{ + size_t retVal = 0; + + retVal = H5Tget_ebias((hid_t)type_id); + if (retVal == 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1ebias */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_ebias_long + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1ebias_1long(JNIEnv *env, jclass clss, jlong type_id) +{ + size_t retVal = 0; + + retVal = H5Tget_ebias((hid_t)type_id); + if (retVal == 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1ebias_1long */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_ebias + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1ebias(JNIEnv *env, jclass clss, jlong type_id, jlong ebias) +{ + herr_t retVal = -1; + + retVal = H5Tset_ebias((hid_t)type_id, (size_t)ebias); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tset_1ebias */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_norm + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1norm(JNIEnv *env, jclass clss, jlong type_id) +{ + H5T_norm_t retVal = H5T_NORM_ERROR; + + retVal = H5Tget_norm((hid_t)type_id); + if (retVal == H5T_NORM_ERROR) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1norm */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_norm + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1norm(JNIEnv *env, jclass clss, jlong type_id, jint norm) +{ + herr_t retVal = -1; + + retVal = H5Tset_norm((hid_t)type_id, (H5T_norm_t )norm); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tset_1norm */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_inpad + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1inpad(JNIEnv *env, jclass clss, jlong type_id) +{ + H5T_pad_t retVal = H5T_PAD_ERROR; + + retVal = H5Tget_inpad((hid_t)type_id ); + if (retVal == H5T_PAD_ERROR) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1inpad */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_inpad + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1inpad(JNIEnv *env, jclass clss, jlong type_id, jint inpad) +{ + herr_t retVal = -1; + + retVal = H5Tset_inpad((hid_t)type_id, (H5T_pad_t) inpad); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tset_1inpad */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_cset + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1cset(JNIEnv *env, jclass clss, jlong type_id) +{ + H5T_cset_t retVal = H5T_CSET_ERROR; + + retVal = H5Tget_cset((hid_t)type_id); + if (retVal == H5T_CSET_ERROR) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1cset */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_cset + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1cset(JNIEnv *env, jclass clss, jlong type_id, jint cset) +{ + herr_t retVal = -1; + + retVal = H5Tset_cset((hid_t)type_id, (H5T_cset_t)cset); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tset_1cset */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_strpad + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1strpad(JNIEnv *env, jclass clss, jlong type_id) +{ + H5T_str_t retVal = H5T_STR_ERROR; + + retVal = H5Tget_strpad((hid_t)type_id); + if (retVal == H5T_STR_ERROR) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1strpad */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_strpad + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1strpad(JNIEnv *env, jclass clss, jlong type_id, jint strpad) +{ + herr_t retVal = -1; + + retVal = H5Tset_strpad((hid_t)type_id, (H5T_str_t)strpad); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tset_1strpad */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_nmembers + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1nmembers(JNIEnv *env, jclass clss, jlong type_id) +{ + int retVal = -1; + + retVal = H5Tget_nmembers((hid_t)type_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1nmembers */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_name + * Signature: (JI)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1member_1name(JNIEnv *env, jclass clss, jlong type_id, jint field_idx) +{ + char *name; + jstring str = NULL; + + name = H5Tget_member_name((hid_t)type_id, (unsigned)field_idx); + if (name != NULL) { + str = ENVPTR->NewStringUTF(ENVPAR name); + H5free_memory(name); + + if (str == NULL) + h5JNIFatalError(env, "H5Tget_member_name: returned string not created"); + } /* end if */ + + return str; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1member_1name */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_index + * Signature: (JLjava/lang/String)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1member_1index(JNIEnv *env, jclass clss, jlong type_id, jstring field_name) +{ + const char *tName; + int index = -1; + + PIN_JAVA_STRING(field_name, tName, -1); + + index = H5Tget_member_index((hid_t)type_id, tName); + + UNPIN_JAVA_STRING(field_name, tName); + + if (index < 0) + h5libraryError(env); + + return (jint)index; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1member_1index */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_type + * Signature: (JI)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Tget_1member_1type(JNIEnv *env, jclass clss, jlong type_id, jint field_idx) +{ + hid_t retVal = -1; + + retVal = H5Tget_member_type((hid_t)type_id, (unsigned)field_idx); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Tget_1member_1type */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_offset + * Signature: (JI)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1member_1offset(JNIEnv *env, jclass clss, jlong type_id, jint memno) +{ + return (jlong)H5Tget_member_offset((hid_t)type_id, (unsigned)memno); +} /* end Java_hdf_hdf5lib_H5_H5Tget_1member_1offset */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_class + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1member_1class(JNIEnv *env, jclass clss, jlong type_id, jint memno) +{ + int retVal = -1; + + retVal = H5Tget_member_class((hid_t)type_id, (unsigned)memno); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1member_1class */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tinsert + * Signature: (JLjava/lang/String;JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tinsert(JNIEnv *env, jclass clss, jlong type_id, jstring name, jlong offset, jlong field_id) +{ + herr_t status; + const char *tName; + long off = (long)offset; + + PIN_JAVA_STRING(name, tName, -1); + + status = H5Tinsert((hid_t)type_id, tName, (size_t)off, field_id); + + UNPIN_JAVA_STRING(name,tName); + if (status < 0) + h5libraryError(env); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Tinsert */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tpack + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tpack(JNIEnv *env, jclass clss, jlong type_id) +{ + herr_t retVal = -1; + + retVal = H5Tpack((hid_t)type_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Tpack */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Tclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5__1H5Tclose(JNIEnv *env, jclass clss, jlong type_id) +{ + herr_t retVal = -1; + + retVal = H5Tclose((hid_t)type_id); + if (retVal < 0) + h5libraryError(env); + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Tclose */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Tvlen_create + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Tvlen_1create(JNIEnv *env, jclass clss, jlong base_id) +{ + hid_t retVal = -1; + + retVal = H5Tvlen_create((hid_t)base_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Tvlen_1create */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_tag + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tset_1tag(JNIEnv *env, jclass clss, jlong type, jstring tag) +{ + herr_t status = -1; + const char *tagP; + + PIN_JAVA_STRING(tag, tagP, -1); + + status = H5Tset_tag((hid_t)type, tagP); + + UNPIN_JAVA_STRING(tag,tagP); + + if (status < 0) + h5libraryError(env); + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Tset_1tag */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_tag + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1tag(JNIEnv *env, jclass clss, jlong type) +{ + jstring str = NULL; + char *tag; + + tag = H5Tget_tag((hid_t)type); + if (tag != NULL) { + str = ENVPTR->NewStringUTF(ENVPAR tag); + H5free_memory(tag); + + if (str == NULL) + h5JNIFatalError(env, "H5Tget_tag: returned string not created"); + } /* end if */ + + return str; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1tag */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_super + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Tget_1super(JNIEnv *env, jclass clss, jlong type_id) +{ + hid_t retVal = -1; + + retVal = H5Tget_super((hid_t)type_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Tget_1super */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Tenum_create + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Tenum_1create(JNIEnv *env, jclass clss, jlong base_id) +{ + hid_t retVal = -1; + + retVal = H5Tenum_create((hid_t)base_id); + if (retVal < 0) + h5libraryError(env); + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Tenum_1create */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tenum_insert_int + * Signature: (JLjava/lang/String;[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tenum_1insert_1int(JNIEnv *env, jclass clss, jlong type_id, jstring name, jintArray value) +{ + herr_t status = -1; + jint *intP; + const char *nameP; + jboolean isCopy2; + + if (value == NULL ) { + h5nullArgument(env, "H5Tenum_insert: value is NULL"); + } /* end if */ + else { + PIN_JAVA_STRING(name, nameP, -1); + + intP = ENVPTR->GetIntArrayElements(ENVPAR value, &isCopy2); + if (intP == NULL) { + UNPIN_JAVA_STRING(name, nameP); + h5JNIFatalError(env, "H5Tenum_insert: value not pinned"); + return -1; + } /* end if */ + else { + status = H5Tenum_insert((hid_t)type_id, nameP, intP); + + UNPIN_JAVA_STRING(name, nameP); + ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, JNI_ABORT); + + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Tenum_1insert_1int */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tenum_insert + * Signature: (JLjava/lang/String;[B)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Tenum_1insert(JNIEnv *env, jclass clss, jlong type_id, jstring name, jbyteArray value) +{ + herr_t status = -1; + jbyte *byteP; + const char *nameP; + jboolean isCopy2; + + if (value == NULL) { + h5nullArgument(env, "H5Tenum_insert: value is NULL"); + } /* end if */ + else { + PIN_JAVA_STRING0(name, nameP); + + byteP = ENVPTR->GetByteArrayElements(ENVPAR value, &isCopy2); + if (byteP == NULL) { + UNPIN_JAVA_STRING(name, nameP); + h5JNIFatalError(env, "H5Tenum_insert: value not pinned"); + } /* end if */ + else { + status = H5Tenum_insert((hid_t)type_id, nameP, byteP); + + UNPIN_JAVA_STRING(name, nameP); + ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT); + + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Tenum_1insert */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tenum_nameof_int + * Signature: (J[I[Ljava/lang/String;I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tenum_1nameof_1int(JNIEnv *env, jclass clss, jlong type_id, jintArray value, jobjectArray name, + jint size) +{ + herr_t status = -1; + jint *intP; + char *nameP; + jboolean isCopy; + jstring str; + + if (size <= 0) { + h5badArgument(env, "H5Tenum_nameof: name size < 0"); + } /* end if */ + else if (value == NULL) { + h5nullArgument(env, "H5Tenum_nameof: value is NULL"); + } /* end if */ + else { + nameP = (char*)HDmalloc(sizeof(char) * (size_t)size); + if (nameP == NULL) { + /* exception -- out of memory */ + h5outOfMemory(env, "H5Tenum_nameof: malloc name size"); + } /* end if */ + else { + intP = ENVPTR->GetIntArrayElements(ENVPAR value, &isCopy); + if (intP == NULL) { + HDfree(nameP); + h5JNIFatalError(env, "H5Tenum_nameof: value not pinned"); + } /* end if */ + else { + status = H5Tenum_nameof((hid_t)type_id, intP, nameP, (size_t)size); + + ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, JNI_ABORT); + + if (status < 0) { + HDfree(nameP); + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR nameP); + HDfree(nameP); + if (str == NULL) { + h5JNIFatalError(env, "H5Tenum_nameof: return array not created"); + } /* end if */ + else + ENVPTR->SetObjectArrayElement(ENVPAR name, 0, (jobject)str); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Tenum_1nameof_1int */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tenum_nameof + * Signature: (J[BJ)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL +Java_hdf_hdf5lib_H5_H5Tenum_1nameof(JNIEnv *env, jclass clss, jlong type_id, jbyteArray value, jlong size) +{ + herr_t status = -1; + jbyte *byteP; + char *nameP; + jboolean isCopy; + jstring str = NULL; + + if (size <= 0) { + h5badArgument(env, "H5Tenum_nameof: name size < 0"); + } /* end if */ + else if (value == NULL ) { + h5nullArgument(env, "H5Tenum_nameof: value is NULL"); + } /* end if */ + else { + nameP = (char*)HDmalloc(sizeof(char) * (size_t)size); + if (nameP == NULL) { + h5outOfMemory(env, "H5Tenum_nameof: malloc name size"); + } /* end if */ + else { + byteP = ENVPTR->GetByteArrayElements(ENVPAR value, &isCopy); + if (byteP == NULL) { + HDfree(nameP); + h5JNIFatalError(env, "H5Tenum_nameof: value not pinned"); + } /* end if */ + else { + status = H5Tenum_nameof((hid_t)type_id, byteP, nameP, (size_t)size); + + /* free the buffer without copying back */ + ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT); + + if (status < 0) { + HDfree(nameP); + h5libraryError(env); + } /* end if */ + else { + str = ENVPTR->NewStringUTF(ENVPAR nameP); + HDfree(nameP); + if (str == NULL) { + h5JNIFatalError(env, "H5Tenum_nameof: return array not created"); + } /* end if */ + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return str; +} /* end Java_hdf_hdf5lib_H5_H5Tenum_1nameof */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tenum_valueof_int + * Signature: (JLjava/lang/String;[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tenum_1valueof_1int(JNIEnv *env, jclass clss, jlong type_id, jstring name, jintArray value) +{ + herr_t status = -1; + jint *intP; + const char *nameP; + jboolean isCopy2; + + if (value == NULL) { + h5nullArgument(env, "H5Tenum_valueof: value is NULL"); + } /* end if */ + else { + PIN_JAVA_STRING(name, nameP, -1); + + intP = ENVPTR->GetIntArrayElements(ENVPAR value, &isCopy2); + if (intP == NULL) { + UNPIN_JAVA_STRING(name, nameP); + h5JNIFatalError(env, "H5Tenum_valueof: value not pinned"); + } /* end if */ + else { + status = H5Tenum_valueof((hid_t)type_id, nameP, intP); + + UNPIN_JAVA_STRING(name, nameP); + + if (status < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, 0); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Tenum_1valueof_1int */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tenum_valueof + * Signature: (JLjava/lang/String;[B)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Tenum_1valueof(JNIEnv *env, jclass clss, jlong type_id, jstring name, jbyteArray value) +{ + herr_t status = -1; + jbyte *byteP; + const char *nameP; + jboolean isCopy2; + + if (value == NULL) { + h5nullArgument(env, "H5Tenum_valueof: value is NULL"); + } /* end if */ + else { + PIN_JAVA_STRING0(name, nameP); + + byteP = ENVPTR->GetByteArrayElements(ENVPAR value, &isCopy2); + if (byteP == NULL) { + UNPIN_JAVA_STRING(name,nameP); + h5JNIFatalError(env, "H5Tenum_valueof: value not pinned"); + } /* end if */ + else { + status = H5Tenum_valueof((hid_t)type_id, nameP, byteP); + + UNPIN_JAVA_STRING(name, nameP); + + if (status < 0) { + ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, 0); + } /* end else */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Tenum_1valueof */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_value_int + * Signature: (JI[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1member_1value_1int(JNIEnv *env, jclass clss, jlong type_id, jint membno, jintArray value) +{ + herr_t status = -1; + jint *intP; + jboolean isCopy; + + if (value == NULL) { + h5nullArgument(env, "H5Tget_member_value: value is NULL"); + } /* end if */ + else { + intP = ENVPTR->GetIntArrayElements(ENVPAR value, &isCopy); + if (intP == NULL) { + h5JNIFatalError(env, "H5Tget_member_value: value not pinned"); + } /* end if */ + else { + status = H5Tget_member_value((hid_t)type_id, (unsigned)membno, intP); + + + if (status < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseIntArrayElements(ENVPAR value, intP, 0); + } /* end else */ + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1member_1value_1int */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_value + * Signature: (JI[B)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1member_1value(JNIEnv *env, jclass clss, jlong type_id, jint membno, jbyteArray value) +{ + herr_t status = -1; + jbyte *byteP; + jboolean isCopy; + + if (value == NULL) { + h5nullArgument( env, "H5Tget_member_value: value is NULL"); + } /* end if */ + else { + byteP = ENVPTR->GetByteArrayElements(ENVPAR value,&isCopy); + if (byteP == NULL) { + h5JNIFatalError(env, "H5Tget_member_value: value not pinned"); + } /* end if */ + else { + status = H5Tget_member_value((hid_t)type_id, (unsigned)membno, byteP); + + if (status < 0) { + ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else + ENVPTR->ReleaseByteArrayElements(ENVPAR value, byteP, 0); + } /* end else */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Tget_1member_1value */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_array_dims + * Signature: (J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1array_1ndims(JNIEnv *env, jclass clss, jlong type_id) +{ + int ndims = -1; + + ndims = H5Tget_array_ndims((hid_t)type_id); + if (ndims < 0) + h5libraryError(env); + + return (jint)ndims; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1array_1ndims */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tarray_get_dims + * Signature: (J[I[I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1array_1dims(JNIEnv *env, jclass clss, jlong type_id, jintArray dims, jintArray perms) +{ + int ndims = -1; + int dlen; + int i; + jint *dimsP; + hsize_t *cdims = NULL; + jboolean isCopy; + + if (dims == NULL) { + h5nullArgument( env, "H5Tget_array_dims: value is NULL"); + } /* end if */ + else { + dimsP = ENVPTR->GetIntArrayElements(ENVPAR dims, &isCopy); + if (dimsP == NULL) { + h5JNIFatalError(env, "H5Tget_array_dims: dimsP not pinned"); + } /* end if */ + else { + dlen = ENVPTR->GetArrayLength(ENVPAR dims); + cdims = (hsize_t*)HDmalloc((size_t)dlen * sizeof(hsize_t)); + + ndims = H5Tget_array_dims2((hid_t)type_id, cdims); + + if (ndims < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + for (i = 0; i < dlen; i++) { + dimsP[i] = (jint) cdims[i]; + } /* end for */ + ENVPTR->ReleaseIntArrayElements(ENVPAR dims, dimsP, 0); + + if (cdims) HDfree(cdims); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)ndims; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1array_1dims */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tis_variable_str + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Tis_1variable_1str(JNIEnv *env, jclass clss, jlong type_id) +{ + htri_t bval = JNI_FALSE; + + bval = H5Tis_variable_str((hid_t)type_id); + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Tis_1variable_1str */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_native_type + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5__1H5Tget_1native_1type(JNIEnv *env, jclass clss, jlong type_id, jint direction) +{ + hid_t native_tid = -1; + + native_tid = H5Tget_native_type((hid_t)type_id, (H5T_direction_t)direction); + + if (native_tid < 0) + h5libraryError(env); + + return (jint)native_tid; +} /* end Java_hdf_hdf5lib_H5__1H5Tget_1native_1type */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tdetect_class + * Signature: (JI)Z + */ +JNIEXPORT jboolean JNICALL +Java_hdf_hdf5lib_H5_H5Tdetect_1class(JNIEnv *env, jclass clss, jlong type_id, jint dtype_class) +{ + htri_t bval = JNI_FALSE; + + bval = H5Tdetect_class((hid_t)type_id, (H5T_class_t)dtype_class); + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) + h5libraryError(env); + + return (jboolean)bval; +} /* end Java_hdf_hdf5lib_H5_H5Tdetect_1class */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tcommit + * Signature: (JLjava/lang/String;JJJJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Tcommit(JNIEnv *env, jclass clss, jlong loc_id, jstring name, jlong type, + jlong link_plist_id, jlong create_plist_id, jlong access_plist_id) +{ + herr_t status = -1; + const char *tName; + + PIN_JAVA_STRING0(name, tName); + + status = H5Tcommit2((hid_t)loc_id, tName, (hid_t)type, (hid_t)link_plist_id, (hid_t)create_plist_id, (hid_t)access_plist_id); + + UNPIN_JAVA_STRING(name, tName); + + if (status < 0) + h5libraryError(env); +} /* end Java_hdf_hdf5lib_H5_H5Tcommit */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Tarray_create2 + * Signature: (JI[J)J + */ +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_H5__1H5Tarray_1create2(JNIEnv *env, jclass clss, jlong base_id, jint rank, jlongArray dims) +{ + hid_t retVal = -1; + jlong *dimsP; + int dlen; + hsize_t *cdims = NULL; + jboolean isCopy; + int i; + + if (rank <= 0) { + h5badArgument(env, "H5Tarray_create: rank is < 1"); + } /* end if */ + else if (dims == NULL) { + h5nullArgument(env, "H5Tarray_create: dims is NULL"); + } /* end else if */ + else { + dimsP = ENVPTR->GetLongArrayElements(ENVPAR dims, &isCopy); + if (dimsP == NULL) { + h5JNIFatalError( env, "H5Tarray_create: dimsP not pinned"); + } /* end if */ + else { + dlen = ENVPTR->GetArrayLength(ENVPAR dims); + if (dlen != rank) { + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + } /* end if */ + else { + cdims = (hsize_t*)HDmalloc((size_t)dlen * sizeof(hsize_t)); + for (i = 0; i < dlen; i++) { + cdims[i] = (hsize_t)dimsP[i]; + } /* end for */ + + retVal = H5Tarray_create2((hid_t)base_id, (unsigned)rank, (const hsize_t*)cdims); + + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, 0); + + HDfree(cdims); + if (retVal < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jlong)retVal; +} /* end Java_hdf_hdf5lib_H5__1H5Tarray_1create2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tarray_get_dims2 + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Tget_1array_1dims2(JNIEnv *env, jclass clss, jlong type_id, jlongArray dims) +{ + int ndims = -1; + int dlen; + int i; + jlong *dimsP; + hsize_t *cdims=NULL; + jboolean isCopy; + + if (dims == NULL) { + h5nullArgument(env, "H5Tget_array_dims: value is NULL"); + } /* end if */ + else { + dimsP = ENVPTR->GetLongArrayElements(ENVPAR dims,&isCopy); + if (dimsP == NULL) { + h5JNIFatalError(env, "H5Tget_array_dims: dimsP not pinned"); + } /* end if */ + else { + dlen = ENVPTR->GetArrayLength(ENVPAR dims); + cdims = (hsize_t*)HDmalloc((size_t)dlen * sizeof(hsize_t)); + + ndims = H5Tget_array_dims2((hid_t)type_id, (hsize_t*)cdims); + + if (ndims < 0) { + if (cdims) + free(cdims); + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT); + h5libraryError(env); + } /* end if */ + else { + for (i = 0; i < dlen; i++) { + dimsP[i] = (jlong) cdims[i]; + } /* end for */ + ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, 0); + + if (cdims) + HDfree(cdims); + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)ndims; +} /* end Java_hdf_hdf5lib_H5_H5Tget_1array_1dims2 */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tconvert + * Signature: (JJJ[B[BJ)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5Tconvert(JNIEnv *env, jclass clss, jlong src_id, jlong dst_id, jlong nelmts, + jbyteArray buf, jbyteArray background, jlong plist_id) +{ + herr_t status; + jbyte *bufP; + jbyte *bgP = NULL; + jboolean isCopy; + + if (nelmts <= 0) { + h5badArgument(env, "H5Tconvert: name nelmts < 0"); + } /* end if */ + else { + bufP = ENVPTR->GetByteArrayElements(ENVPAR buf, &isCopy); + if (bufP == NULL) { + h5JNIFatalError(env, "H5Tconvert: value not pinned"); + } /* end if */ + else { + if (background) + bgP = ENVPTR->GetByteArrayElements(ENVPAR background, &isCopy); + + status = H5Tconvert((hid_t)src_id, (hid_t)dst_id, (size_t)nelmts, (void *)bufP, (void *)bgP, (hid_t)plist_id) ; + + ENVPTR->ReleaseByteArrayElements(ENVPAR buf, bufP, 0); + + if (bgP) + ENVPTR->ReleaseByteArrayElements(ENVPAR background, bgP, 0); + + if (status < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5Tconvert */ + + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5tImp.h b/java/src/jni/h5tImp.h new file mode 100644 index 0000000..f9e6985 --- /dev/null +++ b/java/src/jni/h5tImp.h @@ -0,0 +1,550 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5T */ + +#ifndef _Included_hdf_hdf5lib_H5_H5T +#define _Included_hdf_hdf5lib_H5_H5T + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Topen2 + * Signature: (JLjava/lang/String;J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Topen2 + (JNIEnv *, jclass, jlong, jstring, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tcommitted + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Tcommitted + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Tcreate + * Signature: (IJ)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tcreate + (JNIEnv *, jclass, jint, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Tcopy + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tcopy + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tequal + * Signature: (JJ)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Tequal + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tlock + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tlock + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_class + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1class + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_size + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Tget_1size + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_size + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1size + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_order + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1order + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_order + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1order + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_precision + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1precision + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_precision_long + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Tget_1precision_1long + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_precision + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1precision + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_offset + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1offset + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_offset + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1offset + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_pad + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1pad + (JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_pad + * Signature: (JII)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1pad + (JNIEnv *, jclass, jlong, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_sign + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1sign + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_sign + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1sign + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_fields_int + * Signature: (J[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1fields_1int + (JNIEnv *, jclass, jlong, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_fields + * Signature: (J[J)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Tget_1fields + (JNIEnv *, jclass, jlong, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_fields + * Signature: (JJJJJJ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Tset_1fields + (JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_ebias + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1ebias + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_ebias_long + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Tget_1ebias_1long + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_ebias + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1ebias + (JNIEnv *, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_norm + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1norm + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_norm + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1norm + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_inpad + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1inpad + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_inpad + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1inpad + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_cset + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1cset + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_cset + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1cset + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_strpad + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1strpad + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_strpad + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1strpad + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_nmembers + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1nmembers + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_name + * Signature: (JI)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Tget_1member_1name + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_index + * Signature: (JLjava/lang/String)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1member_1index + (JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_type + * Signature: (JI)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tget_1member_1type + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_offset + * Signature: (JI)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Tget_1member_1offset + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_class + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1member_1class + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tinsert + * Signature: (JLjava/lang/String;JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tinsert + (JNIEnv *, jclass, jlong, jstring, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tpack + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tpack + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Tclose + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Tclose + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Tvlen_create + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tvlen_1create + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tset_tag + * Signature: (JLjava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tset_1tag + (JNIEnv *, jclass, jlong, jstring); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_tag + * Signature: (J)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Tget_1tag + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_super + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tget_1super + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Tenum_create + * Signature: (J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tenum_1create + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tenum_insert_int + * Signature: (JLjava/lang/String;[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tenum_1insert_1int + (JNIEnv *, jclass, jlong, jstring, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tenum_insert + * Signature: (JLjava/lang/String;[B)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Tenum_1insert + (JNIEnv *, jclass, jlong, jstring, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tenum_nameof_int + * Signature: (J[I[Ljava/lang/String;I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tenum_1nameof_1int + (JNIEnv *, jclass, jlong, jintArray, jobjectArray, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tenum_nameof + * Signature: (J[BJ)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_hdf_hdf5lib_H5_H5Tenum_1nameof + (JNIEnv *, jclass, jlong, jbyteArray, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tenum_valueof_int + * Signature: (JLjava/lang/String;[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tenum_1valueof_1int + (JNIEnv *, jclass, jlong, jstring, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tenum_valueof + * Signature: (JLjava/lang/String;[B)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Tenum_1valueof + (JNIEnv *, jclass, jlong, jstring, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_value_int + * Signature: (JI[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1member_1value_1int + (JNIEnv *, jclass, jlong, jint, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_member_value + * Signature: (JI[B)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Tget_1member_1value + (JNIEnv *, jclass, jlong, jint, jbyteArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_array_ndims + * Signature: (J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1array_1ndims + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_array_dims + * Signature: (J[I[I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1array_1dims + (JNIEnv *, jclass, jlong, jintArray, jintArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tis_variable_str + * Signature: (J)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Tis_1variable_1str + (JNIEnv *, jclass, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_native_type + * Signature: (JI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Tget_1native_1type + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tdetect_class + * Signature: (JI)Z + */ +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Tdetect_1class + (JNIEnv *, jclass, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tcommit + * Signature: (JLjava/lang/String;JJJJ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Tcommit + (JNIEnv *, jclass, jlong, jstring, jlong, jlong, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: _H5Tarray_create2 + * Signature: (JI[J)J + */ +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tarray_1create2 + (JNIEnv *, jclass, jlong, jint, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tget_array_dims2 + * Signature: (J[J)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Tget_1array_1dims2 + (JNIEnv *, jclass, jlong, jlongArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Tconvert + * Signature: (JJJ[B[BJ)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5Tconvert + (JNIEnv *, jclass, jlong, jlong, jlong, jbyteArray, jbyteArray, jlong); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5T */ diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c new file mode 100644 index 0000000..90c8ad2 --- /dev/null +++ b/java/src/jni/h5util.c @@ -0,0 +1,2592 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include +#include +#include "hdf5.h" +#include "h5util.h" + +/* size of hyperslab buffer when a dataset is bigger than H5TOOLS_MALLOCSIZE */ +hsize_t H5TOOLS_BUFSIZE = (32 * 1024 * 1024); /* 32 MB */ +int H5TOOLS_TEXT_BLOCK = 16; /* Number of elements on a line in a text export file */ + +JavaVM *jvm; +jobject visit_callback; +jobject copy_callback; +jobject close_callback; +jobject create_callback; +jobject compare_callback; +jobject get_callback; +jobject set_callback; +jobject delete_callback; + +/********************/ +/* Local Prototypes */ +/********************/ + +static int h5str_dump_region_blocks(h5str_t *str, hid_t region, hid_t region_obj); +static int h5str_dump_region_points(h5str_t *str, hid_t region, hid_t region_obj); +static int h5str_is_zero(const void *_mem, size_t size); +static hid_t h5str_get_native_type(hid_t type); +static hid_t h5str_get_little_endian_type(hid_t type); +static hid_t h5str_get_big_endian_type(hid_t type); +static htri_t h5str_detect_vlen(hid_t tid); +static htri_t h5str_detect_vlen_str(hid_t tid); +static int h5tools_dump_simple_data(FILE *stream, hid_t container, hid_t type, void *_mem, hsize_t nelmts); +static int h5str_render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t block_nelmts); +static int render_bin_output_region_data_blocks(FILE *stream, hid_t region_id, + hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata); +static int render_bin_output_region_blocks(FILE *stream, hid_t region_space, + hid_t region_id, hid_t container); +static int render_bin_output_region_data_points(FILE *stream, hid_t region_space, hid_t region_id, + hid_t container, int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata); +static int render_bin_output_region_points(FILE *stream, hid_t region_space, + hid_t region_id, hid_t container); + +/** frees memory held by array of strings */ +void +h5str_array_free(char **strs, size_t len) { + size_t i; + + if (!strs || len <= 0) + return; + + for (i = 0; i < len; i++) { + if (*(strs + i)) + HDfree(*(strs + i)); + } /* for (i=0; i 0) { + str->s = (char *)HDmalloc(len); + str->max = len; + str->s[0] = '\0'; + } /* end if */ +} /* end h5str_new */ + +/** free string memory */ +void +h5str_free(h5str_t *str) { + if (str && str->max > 0) { + HDfree(str->s); + HDmemset(str, 0, sizeof(h5str_t)); + } /* end if */ +} /* end h5str_free */ + +/** reset the max size of the string */ +void +h5str_resize(h5str_t *str, size_t new_len) { + char *new_str; + + if (!str || new_len <= 0 || str->max == new_len) + return; + + new_str = (char *)HDmalloc(new_len); + if (new_len > str->max) /* increase memory */ + HDstrcpy(new_str, str->s); + else + HDstrncpy(new_str, str->s, new_len - 1); + + HDfree(str->s); + str->s = new_str; + str->max = new_len; +} /* end h5str_resize */ + +/* appends a copy of the string pointed to by cstr to the h5str. + Return Value: + the char string point to str->s + */ +char* +h5str_append(h5str_t *str, const char* cstr) { + size_t len; + + if (!str) + return NULL; + else if (!cstr) + return str->s; + + len = HDstrlen(str->s) + HDstrlen(cstr); + while (len >= str->max) /* not enough to hold the new string, double the space */ + { + h5str_resize(str, str->max * 2); + } + + return HDstrcat(str->s, cstr); +} /* end h5str_append */ + +/** print value of a data point into string. + Return Value: + On success, the total number of characters printed is returned. + On error, a negative number is returned. + */ +size_t +h5str_sprintf(h5str_t *str, hid_t container, hid_t tid, void *ptr, int expand_data) { + unsigned char tmp_uchar = 0; + char tmp_char = 0; + unsigned short tmp_ushort = 0; + short tmp_short = 0; + unsigned int tmp_uint = 0; + int tmp_int = 0; + unsigned long tmp_ulong = 0; + long tmp_long = 0; + unsigned long long tmp_ullong = 0; + long long tmp_llong = 0; + float tmp_float = 0.0; + double tmp_double = 0.0; + long double tmp_ldouble = 0.0; + static char fmt_llong[8], fmt_ullong[8]; + + hid_t mtid = -1; + size_t offset; + size_t nll; + char *this_str; + size_t this_strlen; + int n; + int len; + hvl_t *vlptr; + char *cptr = (char*) ptr; + unsigned char *ucptr = (unsigned char*) ptr; + H5T_class_t tclass = H5Tget_class(tid); + size_t size = H5Tget_size(tid); + H5T_sign_t nsign = H5Tget_sign(tid); + int bdata_print = 0; + + if (!str || !ptr) + return 0; + + /* Build default formats for long long types */ + if (!fmt_llong[0]) { + sprintf(fmt_llong, "%%%sd", H5_PRINTF_LL_WIDTH); + sprintf(fmt_ullong, "%%%su", H5_PRINTF_LL_WIDTH); + } /* end if */ + + this_str = NULL; + this_strlen = 0; + + switch (tclass) { + case H5T_FLOAT: + if (sizeof(float) == size) { + /* if (H5Tequal(tid, H5T_NATIVE_FLOAT)) */ + HDmemcpy(&tmp_float, ptr, sizeof(float)); + this_str = (char*)HDmalloc(25); + sprintf(this_str, "%g", tmp_float); + } + else if (sizeof(double) == size) { + /* if (H5Tequal(tid, H5T_NATIVE_DOUBLE)) */ + HDmemcpy(&tmp_double, ptr, sizeof(double)); + this_str = (char*)HDmalloc(25); + sprintf(this_str, "%g", tmp_double); + } +#if H5_SIZEOF_LONG_DOUBLE !=0 + else if (sizeof(long double) == size) { + /* if (H5Tequal(tid, H5T_NATIVE_LDOUBLE)) */ + HDmemcpy(&tmp_ldouble, ptr, sizeof(long double)); + this_str = (char*)HDmalloc(27); + sprintf(this_str, "%Lf", tmp_ldouble); + } +#endif + break; + case H5T_STRING: + { + char *tmp_str; + size = 0; + + if (H5Tis_variable_str(tid)) { + tmp_str = *(char**) ptr; + if (tmp_str != NULL) + size = HDstrlen(tmp_str); + } + else { + tmp_str = cptr; + } + + /* Check for NULL pointer for string */ + if (tmp_str == NULL) { + this_str = (char *)HDmalloc(5); + HDstrncpy(this_str, "NULL", 4); + } + else { + if (size > 0) { + this_str = (char *)HDmalloc(size+1); + HDstrncpy(this_str, tmp_str, size); + } + } + } + break; + case H5T_INTEGER: + if (sizeof(char) == size) { + if(H5T_SGN_NONE == nsign) { + /* if (H5Tequal(tid, H5T_NATIVE_UCHAR)) */ + HDmemcpy(&tmp_uchar, ptr, sizeof(unsigned char)); + this_str = (char*)HDmalloc(7); + sprintf(this_str, "%u", tmp_uchar); + } + else { + /* if (H5Tequal(tid, H5T_NATIVE_SCHAR)) */ + HDmemcpy(&tmp_char, ptr, sizeof(char)); + this_str = (char*)HDmalloc(7); + sprintf(this_str, "%hhd", tmp_char); + } + } + else if (sizeof(int) == size) { + if(H5T_SGN_NONE == nsign) { + /* if (H5Tequal(tid, H5T_NATIVE_UINT)) */ + HDmemcpy(&tmp_uint, ptr, sizeof(unsigned int)); + this_str = (char*)HDmalloc(14); + sprintf(this_str, "%u", tmp_uint); + } + else { + /* if (H5Tequal(tid, H5T_NATIVE_INT)) */ + HDmemcpy(&tmp_int, ptr, sizeof(int)); + this_str = (char*)HDmalloc(14); + sprintf(this_str, "%d", tmp_int); + } + } + else if (sizeof(short) == size) { + if(H5T_SGN_NONE == nsign) { + /* if (H5Tequal(tid, H5T_NATIVE_USHORT)) */ + HDmemcpy(&tmp_ushort, ptr, sizeof(unsigned short)); + this_str = (char*)HDmalloc(9); + sprintf(this_str, "%u", tmp_ushort); + } + else { + /* if (H5Tequal(tid, H5T_NATIVE_SHORT)) */ + HDmemcpy(&tmp_short, ptr, sizeof(short)); + this_str = (char*)HDmalloc(9); + sprintf(this_str, "%d", tmp_short); + } + } + else if (sizeof(long) == size) { + if(H5T_SGN_NONE == nsign) { + /* if (H5Tequal(tid, H5T_NATIVE_ULONG)) */ + HDmemcpy(&tmp_ulong, ptr, sizeof(unsigned long)); + this_str = (char*)HDmalloc(23); + sprintf(this_str, "%lu", tmp_ulong); + } + else { + /* if (H5Tequal(tid, H5T_NATIVE_LONG)) */ + HDmemcpy(&tmp_long, ptr, sizeof(long)); + this_str = (char*)HDmalloc(23); + sprintf(this_str, "%ld", tmp_long); + } + } + else if (sizeof(long long) == size) { + if(H5T_SGN_NONE == nsign) { + /* if (H5Tequal(tid, H5T_NATIVE_ULLONG)) */ + HDmemcpy(&tmp_ullong, ptr, sizeof(unsigned long long)); + this_str = (char*)HDmalloc(25); + sprintf(this_str, fmt_ullong, tmp_ullong); + } + else { + /* if (H5Tequal(tid, H5T_NATIVE_LLONG)) */ + HDmemcpy(&tmp_llong, ptr, sizeof(long long)); + this_str = (char*)HDmalloc(25); + sprintf(this_str, fmt_llong, tmp_llong); + } + } + break; + case H5T_COMPOUND: + { + unsigned i; + n = H5Tget_nmembers(tid); + h5str_append(str, " {"); + + for (i = 0; i < n; i++) { + offset = H5Tget_member_offset(tid, i); + mtid = H5Tget_member_type(tid, i); + h5str_sprintf(str, container, mtid, cptr + offset, expand_data); + if (i < n - 1) + h5str_append(str, ", "); + H5Tclose(mtid); + } + h5str_append(str, "} "); + } + break; + case H5T_ENUM: + { + char enum_name[1024]; + if (H5Tenum_nameof(tid, ptr, enum_name, sizeof enum_name) >= 0) { + h5str_append(str, enum_name); + } + else { + size_t i; + nll = H5Tget_size(tid); + this_str = (char*)HDmalloc(4 * (nll + 1)); + + if (1 == nll) { + sprintf(this_str, "0x%02x", ucptr[0]); + } + else { + for (i = 0; i < (int)nll; i++) + sprintf(this_str, "%s%02x", i ? ":" : "", ucptr[i]); + } + } + } + break; + case H5T_REFERENCE: + if (h5str_is_zero(ptr, size)) { + h5str_append(str, "NULL"); + } + else { + if (H5R_DSET_REG_REF_BUF_SIZE == size) { + /* if (H5Tequal(tid, H5T_STD_REF_DSETREG)) */ + /* + * Dataset region reference -- + * show the type and the referenced object + */ + char ref_name[1024]; + hid_t region_obj; + hid_t region; + H5S_sel_type region_type; + + /* get name of the dataset the region reference points to using H5Rget_name */ + region_obj = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, ptr); + if (region_obj >= 0) { + region = H5Rget_region(container, H5R_DATASET_REGION, ptr); + if (region >= 0) { + if(expand_data) { + region_type = H5Sget_select_type(region); + if(region_type==H5S_SEL_POINTS) { + h5str_dump_region_points_data(str, region, region_obj); + } + else { + h5str_dump_region_blocks_data(str, region, region_obj); + } + } + else { + if(H5Rget_name(region_obj, H5R_DATASET_REGION, ptr, (char*)ref_name, 1024) >= 0) { + h5str_append(str, ref_name); + } + + region_type = H5Sget_select_type(region); + + if(region_type==H5S_SEL_POINTS) { + h5str_append(str, " REGION_TYPE POINT"); + h5str_dump_region_points(str, region, region_obj); + } + else { + h5str_append(str, " REGION_TYPE BLOCK"); + h5str_dump_region_blocks(str, region, region_obj); + } + } + + H5Sclose(region); + } + H5Dclose(region_obj); + } + } + else if (H5R_OBJ_REF_BUF_SIZE == size) { + /* if (H5Tequal(tid, H5T_STD_REF_OBJ)) */ + /* + * Object references -- show the type and OID of the referenced + * object. + */ + H5O_info_t oi; + hid_t obj; + + this_str = (char*)HDmalloc(64); + obj = H5Rdereference2(container, H5P_DEFAULT, H5R_OBJECT, ptr); + H5Oget_info(obj, &oi); + + /* Print object data and close object */ + sprintf(this_str, "%u-%lu", (unsigned) oi.type, oi.addr); + H5Oclose(obj); + } + } + break; + case H5T_ARRAY: + { + int rank = 0; + hsize_t i, dims[H5S_MAX_RANK], total_elmts; + h5str_append(str, "[ "); + + mtid = H5Tget_super(tid); + size = H5Tget_size(mtid); + rank = H5Tget_array_ndims(tid); + + H5Tget_array_dims2(tid, dims); + + total_elmts = 1; + for (i = 0; i < rank; i++) + total_elmts *= dims[i]; + + for (i = 0; i < total_elmts; i++) { + h5str_sprintf(str, container, mtid, cptr + i * size, expand_data); + if (i < total_elmts - 1) + h5str_append(str, ", "); + } + H5Tclose(mtid); + h5str_append(str, "] "); + } + break; + case H5T_VLEN: + { + unsigned int i; + mtid = H5Tget_super(tid); + size = H5Tget_size(mtid); + + vlptr = (hvl_t *) cptr; + + nll = vlptr->len; + for (i = 0; i < (int)nll; i++) { + h5str_sprintf(str, container, mtid, ((char *) (vlptr->p)) + i * size, expand_data); + if (i < (int)nll - 1) + h5str_append(str, ", "); + } + H5Tclose(mtid); + } + break; + + default: + { + /* All other types get printed as hexadecimal */ + size_t i; + nll = H5Tget_size(tid); + this_str = (char*)HDmalloc(4 * (nll + 1)); + + if (1 == nll) { + sprintf(this_str, "0x%02x", ucptr[0]); + } + else { + for (i = 0; i < (int)nll; i++) + sprintf(this_str, "%s%02x", i ? ":" : "", ucptr[i]); + } + } + break; + } /* end switch */ + + if (this_str) { + h5str_append(str, this_str); + this_strlen = HDstrlen(str->s); + HDfree(this_str); + } /* end if */ + + return this_strlen; +} /* end h5str_sprintf */ + +/*------------------------------------------------------------------------- + * Purpose: Print the data values from a dataset referenced by region blocks. + * + * Description: + * This is a special case subfunction to print the data in a region reference of type blocks. + * + * Return: + * The function returns FAIL if there was an error, otherwise SUCEED + *------------------------------------------------------------------------- + */ +static int +h5str_print_region_data_blocks(hid_t region_id, + h5str_t *str, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata) +{ + hsize_t *dims1 = NULL; + hsize_t *start = NULL; + hsize_t *count = NULL; + hsize_t blkndx; + hsize_t total_size[H5S_MAX_RANK]; + unsigned int region_flags; /* buffer extent flags */ + hsize_t numelem; + hsize_t numindex; + size_t jndx; + unsigned indx; + size_t type_size; + int ret_value = SUCCEED; + hid_t mem_space = -1; + hid_t sid1 = -1; + void *region_buf = NULL; + + /* Get the dataspace of the dataset */ + if((sid1 = H5Dget_space(region_id)) >= 0) { + + /* Allocate space for the dimension array */ + if((dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) { + + /* find the dimensions of each data space from the block coordinates */ + numelem = 1; + for (jndx = 0; jndx < ndims; jndx++) { + dims1[jndx] = ptdata[jndx + (size_t)ndims] - ptdata[jndx] + 1; + numelem = dims1[jndx] * numelem; + } /* end for */ + + /* Create dataspace for reading buffer */ + if((mem_space = H5Screate_simple(ndims, dims1, NULL)) >= 0) { + if((type_size = H5Tget_size(type_id)) > 0) { + if((region_buf = HDmalloc(type_size * (size_t)numelem)) != NULL) { + /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */ + /* 1 2 n 1 2 n */ + if((start = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) { + if((count = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) { + for (blkndx = 0; blkndx < nblocks; blkndx++) { + for (indx = 0; indx < ndims; indx++) { + start[indx] = ptdata[indx + blkndx * (hsize_t)ndims * 2]; + count[indx] = dims1[indx]; + } /* end for */ + + if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) >= 0) { + if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) >= 0) { + if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) { + for (numindex = 0; numindex < numelem; numindex++) { + h5str_sprintf(str, region_id, type_id, ((char*)region_buf + numindex * type_size), 1); + + if (numindex + 1 < numelem) + h5str_append(str, ", "); + } /* end for (jndx = 0; jndx < numelem; jndx++, region_elmtno++, ctx.cur_elmt++) */ + } /* end if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) */ + } /* end if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) >= 0) */ + } /* end if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) >= 0) */ + } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */ + + HDfree(count); + } /* end if((count = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */ + else + ret_value = -1; + + HDfree(start); + } /* end if((start = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */ + else + ret_value = -1; + + HDfree(region_buf); + } /* end if((region_buf = HDmalloc(type_size * (size_t)numelem)) != NULL) */ + else + ret_value = -1; + } /* end if((type_size = H5Tget_size(type_id)) > 0) */ + else + ret_value = -1; + + if(H5Sclose(mem_space) < 0) + ret_value = -1; + } /* end if((mem_space = H5Screate_simple(ndims, dims1, NULL)) >= 0) */ + else + ret_value = -1; + + HDfree(dims1); + } /* end if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */ + else + ret_value = -1; + + if(H5Sclose(sid1) < 0) + ret_value = -1; + } /* end if((sid1 = H5Dget_space(region_id)) >= 0) */ + else + ret_value = -1; + + return ret_value; +} /* end h5str_print_region_data_blocks */ + +int +h5str_dump_region_blocks_data(h5str_t *str, hid_t region, hid_t region_id) +{ + int ret_value = 0; + hssize_t nblocks; + hsize_t alloc_size; + hsize_t *ptdata; + hid_t dtype = -1; + hid_t type_id = -1; + char tmp_str[256]; + int ndims = H5Sget_simple_extent_ndims(region); + + /* + * This function fails if the region does not have blocks. + */ + H5E_BEGIN_TRY { + nblocks = H5Sget_select_hyper_nblocks(region); + } H5E_END_TRY; + + /* Print block information */ + if (nblocks > 0) { + int i; + + alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]); + if (alloc_size == (hsize_t)((size_t) alloc_size)) { + ptdata = (hsize_t *)HDmalloc((size_t) alloc_size); + H5Sget_select_hyper_blocklist(region, (hsize_t) 0, + (hsize_t) nblocks, ptdata); + + + if((dtype = H5Dget_type(region_id)) >= 0) { + if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) { + + h5str_print_region_data_blocks(region_id, str, ndims, type_id, nblocks, ptdata); + + if(H5Tclose(type_id) < 0) + ret_value = -1; + } /* end if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) */ + else + ret_value = -1; + + if(H5Tclose(dtype) < 0) + ret_value = -1; + } /* end if((dtype = H5Dget_type(region_id)) >= 0) */ + else + ret_value = -1; + HDfree(ptdata); + } /* if (alloc_size == (hsize_t)((size_t)alloc_size)) */ + } /* if (nblocks > 0) */ + + return ret_value; +} /* end h5str_dump_region_blocks_data */ + +static int +h5str_dump_region_blocks(h5str_t *str, hid_t region, hid_t region_id) +{ + int ret_value = 0; + hssize_t nblocks; + hsize_t alloc_size; + hsize_t *ptdata; + hid_t dtype = -1; + hid_t type_id = -1; + char tmp_str[256]; + int ndims = H5Sget_simple_extent_ndims(region); + + /* + * This function fails if the region does not have blocks. + */ + H5E_BEGIN_TRY { + nblocks = H5Sget_select_hyper_nblocks(region); + } H5E_END_TRY; + + /* Print block information */ + if (nblocks > 0) { + int i; + + alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]); + if (alloc_size == (hsize_t)((size_t) alloc_size)) { + ptdata = (hsize_t *)HDmalloc((size_t) alloc_size); + H5Sget_select_hyper_blocklist(region, (hsize_t) 0, + (hsize_t) nblocks, ptdata); + + h5str_append(str, " {"); + for (i = 0; i < nblocks; i++) { + int j; + + h5str_append(str, " "); + + /* Start coordinates and opposite corner */ + for (j = 0; j < ndims; j++) { + tmp_str[0] = '\0'; + sprintf(tmp_str, "%s%lu", j ? "," : "(", + (unsigned long) ptdata[i * 2 * ndims + j]); + h5str_append(str, tmp_str); + } + + for (j = 0; j < ndims; j++) { + tmp_str[0] = '\0'; + sprintf(tmp_str, "%s%lu", j ? "," : ")-(", + (unsigned long) ptdata[i * 2 * ndims + j + ndims]); + h5str_append(str, tmp_str); + } + h5str_append(str, ") "); + tmp_str[0] = '\0'; + } + h5str_append(str, " }"); + + HDfree(ptdata); + } /* if (alloc_size == (hsize_t)((size_t)alloc_size)) */ + } /* if (nblocks > 0) */ + + return ret_value; +} /* end h5str_dump_region_blocks */ + +/*------------------------------------------------------------------------- + * Purpose: Print the data values from a dataset referenced by region points. + * + * Description: + * This is a special case subfunction to print the data in a region reference of type points. + * + * Return: + * The function returns FAIL on error, otherwise SUCCEED + *------------------------------------------------------------------------- + */ +static int +h5str_print_region_data_points(hid_t region_space, hid_t region_id, + h5str_t *str, int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata) +{ + hsize_t *dims1 = NULL; + hsize_t total_size[H5S_MAX_RANK]; + size_t jndx; + unsigned indx; + size_t type_size; + int ret_value = SUCCEED; + unsigned int region_flags; /* buffer extent flags */ + hid_t mem_space = -1; + void *region_buf = NULL; + char tmp_str[256]; + + /* Allocate space for the dimension array */ + if((dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) { + + dims1[0] = (hsize_t)npoints; + + /* Create dataspace for reading buffer */ + if((mem_space = H5Screate_simple(1, dims1, NULL)) >= 0) { + + if((type_size = H5Tget_size(type_id)) > 0) { + + if((region_buf = HDmalloc(type_size * (size_t)npoints)) != NULL) { + + if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) >= 0) { + + for (jndx = 0; jndx < npoints; jndx++) { + if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) { + + h5str_sprintf(str, region_id, type_id, ((char*)region_buf + jndx * type_size), 1); + + if (jndx + 1 < npoints) + h5str_append(str, ", "); + + } /* end if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) */ + } /* end for (jndx = 0; jndx < npoints; jndx++, elmtno++) */ + } /* end if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) >= 0) */ + else + ret_value = -1; + + HDfree(region_buf); + } /* end if((region_buf = HDmalloc(type_size * (size_t)npoints)) != NULL) */ + else + ret_value = -1; + } /* end if((type_size = H5Tget_size(type_id)) > 0) */ + else + ret_value = -1; + + if(H5Sclose(mem_space) < 0) + ret_value = -1; + } /* end if((mem_space = H5Screate_simple(1, dims1, NULL)) >= 0) */ + else + ret_value = -1; + HDfree(dims1); + } /* end if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */ + else + ret_value = -1; + + return ret_value; +} /* end h5str_print_region_data_points */ + +int +h5str_dump_region_points_data(h5str_t *str, hid_t region, hid_t region_id) +{ + int ret_value = 0; + hssize_t npoints; + hsize_t alloc_size; + hsize_t *ptdata; + char tmp_str[256]; + hid_t dtype = -1; + hid_t type_id = -1; + int ndims = H5Sget_simple_extent_ndims(region); + + /* + * This function fails if the region does not have points. + */ + H5E_BEGIN_TRY { + npoints = H5Sget_select_elem_npoints(region); + } H5E_END_TRY; + + /* Print point information */ + if (npoints > 0) { + int i; + + alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]); + if (alloc_size == (hsize_t)((size_t) alloc_size)) { + ptdata = (hsize_t *)HDmalloc((size_t) alloc_size); + H5Sget_select_elem_pointlist(region, (hsize_t) 0, + (hsize_t) npoints, ptdata); + + if((dtype = H5Dget_type(region_id)) >= 0) { + if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) { + + h5str_print_region_data_points(region, region_id, + str, ndims, type_id, npoints, ptdata); + + if(H5Tclose(type_id) < 0) + ret_value = -1; + } /* end if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) */ + else + ret_value = -1; + + if(H5Tclose(dtype) < 0) + ret_value = -1; + } /* end if((dtype = H5Dget_type(region_id)) >= 0) */ + else + ret_value = -1; + HDfree(ptdata); + } + } + + return ret_value; +} /* end h5str_dump_region_points_data */ + +static int +h5str_dump_region_points(h5str_t *str, hid_t region, hid_t region_id) +{ + int ret_value = 0; + hssize_t npoints; + hsize_t alloc_size; + hsize_t *ptdata; + char tmp_str[256]; + hid_t dtype = -1; + hid_t type_id = -1; + int ndims = H5Sget_simple_extent_ndims(region); + + /* + * This function fails if the region does not have points. + */ + H5E_BEGIN_TRY { + npoints = H5Sget_select_elem_npoints(region); + } H5E_END_TRY; + + /* Print point information */ + if (npoints > 0) { + int i; + + alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]); + if (alloc_size == (hsize_t)((size_t) alloc_size)) { + ptdata = (hsize_t *)HDmalloc((size_t) alloc_size); + H5Sget_select_elem_pointlist(region, (hsize_t) 0, + (hsize_t) npoints, ptdata); + + h5str_append(str, " {"); + for (i = 0; i < npoints; i++) { + int j; + + h5str_append(str, " "); + + for (j = 0; j < ndims; j++) { + tmp_str[0] = '\0'; + sprintf(tmp_str, "%s%lu", j ? "," : "(", + (unsigned long) (ptdata[i * ndims + j])); + h5str_append(str, tmp_str); + } /* end for (j = 0; j < ndims; j++) */ + + h5str_append(str, ") "); + } /* end for (i = 0; i < npoints; i++) */ + h5str_append(str, " }"); + + HDfree(ptdata); + } /* end if (alloc_size == (hsize_t)((size_t) alloc_size)) */ + } /* end if (npoints > 0) */ + + return ret_value; +} /* end h5str_dump_region_points */ + +static int +h5str_is_zero(const void *_mem, size_t size) { + const unsigned char *mem = (const unsigned char *) _mem; + + while (size-- > 0) + if (mem[size]) + return 0; + + return 1; +} /* end h5str_is_zero */ + +/*------------------------------------------------------------------------- + * Function: h5str_detect_vlen_str + * + * Purpose: Recursive check for variable length string of a datatype. + * + * Return: + * TRUE : type conatains any variable length string + * FALSE : type doesn't contain any variable length string + * Negative value: error occur + * + *------------------------------------------------------------------------- + */ +static htri_t +h5str_detect_vlen_str(hid_t tid) +{ + H5T_class_t tclass = H5T_NO_CLASS; + htri_t ret = 0; + + ret = H5Tis_variable_str(tid); + if((ret == 1) || (ret < 0)) + goto done; + + tclass = H5Tget_class(tid); + if(tclass == H5T_ARRAY || tclass == H5T_VLEN) { + hid_t btid = H5Tget_super(tid); + + if(btid < 0) { + ret = (htri_t)btid; + goto done; + } /* end if */ + ret = h5str_detect_vlen_str(btid); + if((ret == 1) || (ret < 0)) { + H5Tclose(btid); + goto done; + } /* end if */ + } /* end if */ + else if(tclass == H5T_COMPOUND) { + unsigned i = 0; + int n = H5Tget_nmembers(tid); + + if(n < 0) { + n = ret; + goto done; + } /* end if */ + + for(i = 0; i < n; i++) { + hid_t mtid = H5Tget_member_type(tid, i); + + ret = h5str_detect_vlen_str(mtid); + if((ret == 1) || (ret < 0)) { + H5Tclose(mtid); + goto done; + } + H5Tclose(mtid); + } /* end for */ + } /* end else */ + +done: + return ret; +} /* end h5str_detect_vlen_str */ + +/*------------------------------------------------------------------------- + * Function: h5str_get_native_type + * + * Purpose: Wrapper around H5Tget_native_type() to work around + * Problems with bitfields. + * + * Return: Success: datatype ID + * Failure: FAIL + *------------------------------------------------------------------------- + */ +static hid_t +h5str_get_native_type(hid_t type) +{ + hid_t p_type; + H5T_class_t type_class; + + type_class = H5Tget_class(type); + if(type_class==H5T_BITFIELD) + p_type=H5Tcopy(type); + else + p_type = H5Tget_native_type(type,H5T_DIR_DEFAULT); + + return(p_type); +} /* end h5str_get_native_type */ + + +/*------------------------------------------------------------------------- + * Function: h5str_get_little_endian_type + * + * Purpose: Get a little endian type from a file type + * + * Return: Success: datatype ID + * Failure: FAIL + *------------------------------------------------------------------------- + */ +static hid_t +h5str_get_little_endian_type(hid_t tid) +{ + hid_t p_type=-1; + H5T_class_t type_class; + size_t size; + H5T_sign_t sign; + + type_class = H5Tget_class(tid); + size = H5Tget_size(tid); + sign = H5Tget_sign(tid); + + switch( type_class ) + { + case H5T_INTEGER: + { + if ( size == 1 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I8LE); + else if ( size == 2 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I16LE); + else if ( size == 4 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I32LE); + else if ( size == 8 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I64LE); + else if ( size == 1 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U8LE); + else if ( size == 2 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U16LE); + else if ( size == 4 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U32LE); + else if ( size == 8 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U64LE); + } + break; + + case H5T_FLOAT: + if ( size == 4) + p_type=H5Tcopy(H5T_IEEE_F32LE); + else if ( size == 8) + p_type=H5Tcopy(H5T_IEEE_F64LE); + break; + + case H5T_TIME: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_STRING: + case H5T_COMPOUND: + case H5T_REFERENCE: + case H5T_ENUM: + case H5T_VLEN: + case H5T_ARRAY: + break; + + default: + break; + + } + + return(p_type); +} /* end h5str_get_little_endian_type */ + +/*------------------------------------------------------------------------- + * Function: h5str_get_big_endian_type + * + * Purpose: Get a big endian type from a file type + * + * Return: Success: datatype ID + * Failure: FAIL + *------------------------------------------------------------------------- + */ +static hid_t +h5str_get_big_endian_type(hid_t tid) +{ + hid_t p_type=-1; + H5T_class_t type_class; + size_t size; + H5T_sign_t sign; + + type_class = H5Tget_class(tid); + size = H5Tget_size(tid); + sign = H5Tget_sign(tid); + + switch( type_class ) + { + case H5T_INTEGER: + { + if ( size == 1 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I8BE); + else if ( size == 2 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I16BE); + else if ( size == 4 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I32BE); + else if ( size == 8 && sign == H5T_SGN_2) + p_type=H5Tcopy(H5T_STD_I64BE); + else if ( size == 1 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U8BE); + else if ( size == 2 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U16BE); + else if ( size == 4 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U32BE); + else if ( size == 8 && sign == H5T_SGN_NONE) + p_type=H5Tcopy(H5T_STD_U64BE); + } + break; + + case H5T_FLOAT: + if ( size == 4) + p_type=H5Tcopy(H5T_IEEE_F32BE); + else if ( size == 8) + p_type=H5Tcopy(H5T_IEEE_F64BE); + break; + + case H5T_TIME: + case H5T_BITFIELD: + case H5T_OPAQUE: + case H5T_STRING: + case H5T_COMPOUND: + case H5T_REFERENCE: + case H5T_ENUM: + case H5T_VLEN: + case H5T_ARRAY: + break; + + default: + break; + + } + + return(p_type); +} /* end h5str_get_big_endian_type */ + +/*------------------------------------------------------------------------- + * Function: h5str_detect_vlen + * + * Purpose: Recursive check for any variable length data in given type. + * + * Return: + * 1 : type conatains any variable length data + * 0 : type doesn't contain any variable length data + * Negative value: error occur + *------------------------------------------------------------------------- + */ +static htri_t +h5str_detect_vlen(hid_t tid) +{ + htri_t ret; + + /* recursive detect any vlen data values in type (compound, array ...) */ + ret = H5Tdetect_class(tid, H5T_VLEN); + if((ret == 1) || (ret < 0)) + goto done; + + /* recursive detect any vlen string in type (compound, array ...) */ + ret = h5str_detect_vlen_str(tid); + if((ret == 1) || (ret < 0)) + goto done; + +done: + return ret; +} /* end h5str_detect_vlen */ + +/*------------------------------------------------------------------------- + * Function: render_bin_output + * + * Purpose: Write one element of memory buffer to a binary file stream + * + * Return: Success: SUCCEED + * Failure: FAIL + *------------------------------------------------------------------------- + */ +static int +h5str_render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t block_nelmts) +{ + int ret_value = 0; + unsigned char *mem = (unsigned char*)_mem; + size_t size; /* datum size */ + hsize_t block_index; + H5T_class_t type_class; + + if((size = H5Tget_size(tid)) > 0) { + + if((type_class = H5Tget_class(tid)) >= 0) { + + switch (type_class) { + case H5T_INTEGER: + case H5T_FLOAT: + case H5T_ENUM: + block_index = block_nelmts * size; + while(block_index > 0) { + size_t bytes_in = 0; /* # of bytes to write */ + size_t bytes_wrote = 0; /* # of bytes written */ + size_t item_size = size; /* size of items in bytes */ + + if(block_index > sizeof(size_t)) + bytes_in = sizeof(size_t); + else + bytes_in = (size_t)block_index; + + bytes_wrote = fwrite(mem, 1, bytes_in, stream); + + if(bytes_wrote != bytes_in || (0 == bytes_wrote && ferror(stream))) { + ret_value = -1; + break; + } + + block_index -= (hsize_t)bytes_wrote; + mem = mem + bytes_wrote; + } + break; + case H5T_STRING: + { + unsigned int i; + H5T_str_t pad; + char *s; + unsigned char tempuchar; + + pad = H5Tget_strpad(tid); + + for (block_index = 0; block_index < block_nelmts; block_index++) { + mem = ((unsigned char*)_mem) + block_index * size; + + if (H5Tis_variable_str(tid)) { + s = *(char**) mem; + if (s != NULL) + size = strlen(s); + } + else { + s = (char *) mem; + } + for (i = 0; i < size && (s[i] || pad != H5T_STR_NULLTERM); i++) { + HDmemcpy(&tempuchar, &s[i], sizeof(unsigned char)); + if (1 != fwrite(&tempuchar, sizeof(unsigned char), 1, stream)) { + ret_value = -1; + break; + } + } /* i */ + if(ret_value < 0) + break; + } /* for (block_index = 0; block_index < block_nelmts; block_index++) */ + } + break; + case H5T_COMPOUND: + { + unsigned j; + hid_t memb; + unsigned nmembs; + size_t offset; + + nmembs = (unsigned)H5Tget_nmembers(tid); + + for (block_index = 0; block_index < block_nelmts; block_index++) { + mem = ((unsigned char*)_mem) + block_index * size; + for (j = 0; j < nmembs; j++) { + offset = H5Tget_member_offset(tid, j); + memb = H5Tget_member_type(tid, j); + + if (h5str_render_bin_output(stream, container, memb, mem + offset, 1) < 0) { + H5Tclose(memb); + ret_value = -1; + break; + } + + H5Tclose(memb); + } + if(ret_value < 0) + break; + } + } + break; + case H5T_ARRAY: + { + int k, ndims; + hsize_t i, dims[H5S_MAX_RANK], temp_nelmts, nelmts; + hid_t memb; + + /* get the array's base datatype for each element */ + memb = H5Tget_super(tid); + ndims = H5Tget_array_ndims(tid); + H5Tget_array_dims2(tid, dims); + + /* calculate the number of array elements */ + for (k = 0, nelmts = 1; k < ndims; k++) { + temp_nelmts = nelmts; + temp_nelmts *= dims[k]; + nelmts = (size_t) temp_nelmts; + } + + for (block_index = 0; block_index < block_nelmts; block_index++) { + mem = ((unsigned char*)_mem) + block_index * size; + /* dump the array element */ + if (h5str_render_bin_output(stream, container, memb, mem, nelmts) < 0) { + ret_value = -1; + break; + } + } + H5Tclose(memb); + } + break; + case H5T_VLEN: + { + unsigned int i; + hsize_t nelmts; + hid_t memb; + + /* get the VL sequences's base datatype for each element */ + memb = H5Tget_super(tid); + + for (block_index = 0; block_index < block_nelmts; block_index++) { + mem = ((unsigned char*)_mem) + block_index * size; + /* Get the number of sequence elements */ + nelmts = ((hvl_t *) mem)->len; + + /* dump the array element */ + if (h5str_render_bin_output(stream, container, memb, ((char *) (((hvl_t *) mem)->p)), nelmts) < 0) { + ret_value = -1; + break; + } + } + H5Tclose(memb); + } + break; + case H5T_REFERENCE: + { + if (H5Tequal(tid, H5T_STD_REF_DSETREG)) { + /* region data */ + hid_t region_id, region_space; + H5S_sel_type region_type; + + for (block_index = 0; block_index < block_nelmts; block_index++) { + mem = ((unsigned char*)_mem) + block_index * size; + region_id = H5Rdereference2(container, H5P_DEFAULT, H5R_DATASET_REGION, mem); + if (region_id >= 0) { + region_space = H5Rget_region(container, H5R_DATASET_REGION, mem); + if (region_space >= 0) { + region_type = H5Sget_select_type(region_space); + if(region_type == H5S_SEL_POINTS) + ret_value = render_bin_output_region_points(stream, region_space, region_id, container); + else + ret_value = render_bin_output_region_blocks(stream, region_space, region_id, container); + H5Sclose(region_space); + } /* end if (region_space >= 0) */ + H5Dclose(region_id); + } /* end if (region_id >= 0) */ + if(ret_value < 0) + break; + } + } + else if (H5Tequal(tid, H5T_STD_REF_OBJ)) { + ; + } + } + break; + default: + for (block_index = 0; block_index < block_nelmts; block_index++) { + mem = ((unsigned char*)_mem) + block_index * size; + if (size != fwrite(mem, sizeof(char), size, stream)) { + ret_value = -1; + break; + } + } + break; + } + } /* end if((type_class = H5Tget_class(tid)) >= 0) */ + else + ret_value = -1; + } /* end if((size = H5Tget_size(tid)) > 0) */ + else + ret_value = -1; + + return ret_value; +} /* end h5str_render_bin_output */ + +/*------------------------------------------------------------------------- + * Purpose: Print the data values from a dataset referenced by region blocks. + * + * Description: + * This is a special case subfunction to print the data in a region reference of type blocks. + * + * Return: + * The function returns FAIL if there was an error, otherwise SUCEED + * + *------------------------------------------------------------------------- + */ +static int +render_bin_output_region_data_blocks(FILE *stream, hid_t region_id, + hid_t container, int ndims, hid_t type_id, hssize_t nblocks, hsize_t *ptdata) +{ + hsize_t *dims1 = NULL; + hsize_t *start = NULL; + hsize_t *count = NULL; + hsize_t numelem; + hsize_t numindex; + hsize_t total_size[H5S_MAX_RANK]; + int jndx; + size_t type_size; + hid_t mem_space = -1; + void *region_buf = NULL; + int blkndx; + hid_t sid1 = -1; + int ret_value = SUCCEED; + + /* Get the dataspace of the dataset */ + if((sid1 = H5Dget_space(region_id)) >= 0) { + /* Allocate space for the dimension array */ + if((dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) { + /* find the dimensions of each data space from the block coordinates */ + numelem = 1; + for (jndx = 0; jndx < ndims; jndx++) { + dims1[jndx] = ptdata[jndx + ndims] - ptdata[jndx] + 1; + numelem = dims1[jndx] * numelem; + } + + /* Create dataspace for reading buffer */ + if((mem_space = H5Screate_simple(ndims, dims1, NULL)) >= 0) { + if((type_size = H5Tget_size(type_id)) > 0) { + if((region_buf = HDmalloc(type_size * (size_t)numelem)) != NULL) { + /* Select (x , x , ..., x ) x (y , y , ..., y ) hyperslab for reading memory dataset */ + /* 1 2 n 1 2 n */ + if((start = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) { + if((count = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) { + for (blkndx = 0; blkndx < nblocks; blkndx++) { + for (jndx = 0; jndx < ndims; jndx++) { + start[jndx] = ptdata[jndx + blkndx * ndims * 2]; + count[jndx] = dims1[jndx]; + } + + if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) >= 0) { + if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) >= 0) { + if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) { + ret_value = h5str_render_bin_output(stream, container, type_id, (char*)region_buf, numelem); + } /* end if(H5Sget_simple_extent_dims(mem_space, total_size, NULL) >= 0) */ + else { + ret_value = -1; + break; + } + } /* end if(H5Dread(region_id, type_id, mem_space, sid1, H5P_DEFAULT, region_buf) >= 0) */ + else { + ret_value = -1; + break; + } + } /* end if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, start, NULL, count, NULL) >= 0) */ + else { + ret_value = -1; + break; + } + /* Render the region data element end */ + } /* end for (blkndx = 0; blkndx < nblocks; blkndx++) */ + + HDfree(count); + } /* end if((count = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */ + else + ret_value = -1; + HDfree(start); + } /* end if((start = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */ + else + ret_value = -1; + HDfree(region_buf); + } /* end if((region_buf = HDmalloc(type_size * (size_t)numelem)) != NULL) */ + else + ret_value = -1; + } /* end if((type_size = H5Tget_size(type_id)) > 0) */ + else + ret_value = -1; + + if(H5Sclose(mem_space) < 0) + ret_value = -1; + } /* end if((mem_space = H5Screate_simple(ndims, dims1, NULL)) >= 0) */ + else + ret_value = -1; + HDfree(dims1); + } /* end if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */ + else + ret_value = -1; + if(H5Sclose(sid1) < 0) + ret_value = -1; + } /* end if((sid1 = H5Dget_space(region_id)) >= 0) */ + else + ret_value = -1; + + return ret_value; +} /* end render_bin_output_region_data_blocks */ + +/*------------------------------------------------------------------------- + * Purpose: Print some values from a dataset referenced by region blocks. + * + * Description: + * This is a special case subfunction to dump a region reference using blocks. + * + * Return: + * The function returns False if ERROR, otherwise True + * + *------------------------------------------------------------------------- + */ +static int +render_bin_output_region_blocks(FILE *stream, hid_t region_space, hid_t region_id, hid_t container) +{ + int ret_value = SUCCEED; + hssize_t nblocks; + hsize_t alloc_size; + hsize_t *ptdata = NULL; + int ndims; + hid_t dtype; + hid_t type_id; + + if((nblocks = H5Sget_select_hyper_nblocks(region_space)) > 0) { + /* Print block information */ + if((ndims = H5Sget_simple_extent_ndims(region_space)) >= 0) { + alloc_size = (hsize_t)nblocks * (hsize_t)ndims * 2 * (hsize_t)sizeof(ptdata[0]); + if((ptdata = (hsize_t*)HDmalloc((size_t)alloc_size)) != NULL) { + if(H5Sget_select_hyper_blocklist(region_space, (hsize_t)0, (hsize_t)nblocks, ptdata) >= 0) { + if((dtype = H5Dget_type(region_id)) >= 0) { + if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) { + ret_value = render_bin_output_region_data_blocks(stream, region_id, container, ndims, + type_id, nblocks, ptdata); + + if(H5Tclose(type_id) < 0) + ret_value = -1; + } /* end if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) */ + else + ret_value = -1; + + if(H5Tclose(dtype) < 0) + ret_value = -1; + } /* end if((dtype = H5Dget_type(region_id)) >= 0) */ + else + ret_value = -1; + } /* end if(H5Sget_select_hyper_blocklist(region_space, (hsize_t) 0, (hsize_t) nblocks, ptdata) >= 0) */ + else + ret_value = -1; + + HDfree(ptdata); + } /* end if((ptdata = (hsize_t*) HDmalloc((size_t) alloc_size)) != NULL) */ + else + ret_value = -1; + } /* end if((ndims = H5Sget_simple_extent_ndims(region_space)) >= 0) */ + else + ret_value = -1; + } /* end if((nblocks = H5Sget_select_hyper_nblocks(region_space)) > 0) */ + else + ret_value = -1; + + return ret_value; +} /* end render_bin_output_region_blocks */ + +/*------------------------------------------------------------------------- + * Purpose: Print the data values from a dataset referenced by region points. + * + * Description: + * This is a special case subfunction to print the data in a region reference of type points. + * + * Return: + * The function returns FAIL on error, otherwise SUCCEED + * + *------------------------------------------------------------------------- + */ +static int +render_bin_output_region_data_points(FILE *stream, hid_t region_space, hid_t region_id, + hid_t container, int ndims, hid_t type_id, hssize_t npoints, hsize_t *ptdata) +{ + hsize_t *dims1 = NULL; + int jndx; + size_t type_size; + hid_t mem_space = -1; + void *region_buf = NULL; + int ret_value = SUCCEED; + + if((type_size = H5Tget_size(type_id)) > 0) { + if((region_buf = HDmalloc(type_size * (size_t)npoints)) != NULL) { + /* Allocate space for the dimension array */ + if((dims1 = (hsize_t *)HDmalloc(sizeof(hsize_t) * (size_t)ndims)) != NULL) { + dims1[0] = (hsize_t)npoints; + if((mem_space = H5Screate_simple(1, dims1, NULL)) >= 0) { + if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) >= 0) { + if(H5Sget_simple_extent_dims(region_space, dims1, NULL) >= 0) { + ret_value = h5str_render_bin_output(stream, container, type_id, (char*)region_buf, (hsize_t)npoints); + } /* end if(H5Sget_simple_extent_dims(region_space, dims1, NULL) >= 0) */ + else + ret_value = -1; + } /* end if(H5Dread(region_id, type_id, mem_space, region_space, H5P_DEFAULT, region_buf) >= 0) */ + else + ret_value = -1; + } /* end if((mem_space = H5Screate_simple(1, dims1, NULL)) >= 0) */ + else + ret_value = -1; + + HDfree(dims1); + } /* end if((dims1 = (hsize_t *) malloc(sizeof(hsize_t) * ndims)) != NULL) */ + else + ret_value = -1; + HDfree(region_buf); + } /* end if((region_buf = malloc(type_size * (size_t)npoints)) != NULL) */ + else + ret_value = -1; + + if(H5Sclose(mem_space) < 0) + ret_value = -1; + } /* end if((type_size = H5Tget_size(type_id)) > 0) */ + else + ret_value = -1; + + return ret_value; +} /* end render_bin_output_region_data_points */ + +/*------------------------------------------------------------------------- + * Purpose: Print some values from a dataset referenced by region points. + * + * Description: + * This is a special case subfunction to dump a region reference using points. + * + * Return: + * The function returns False if the last dimension has been reached, otherwise True + * + *------------------------------------------------------------------------- + */ +static int +render_bin_output_region_points(FILE *stream, hid_t region_space, hid_t region_id, hid_t container) +{ + int ret_value = SUCCEED; + hssize_t npoints; + hsize_t alloc_size; + hsize_t *ptdata; + int ndims; + hid_t dtype; + hid_t type_id; + + if((npoints = H5Sget_select_elem_npoints(region_space)) > 0) { + /* Allocate space for the dimension array */ + if((ndims = H5Sget_simple_extent_ndims(region_space)) >= 0) { + alloc_size = (hsize_t)npoints * (hsize_t)ndims * (hsize_t)sizeof(ptdata[0]); + if(NULL != (ptdata = (hsize_t *)HDmalloc((size_t)alloc_size))) { + if(H5Sget_select_elem_pointlist(region_space, (hsize_t)0, (hsize_t)npoints, ptdata) >= 0) { + if((dtype = H5Dget_type(region_id)) >= 0) { + if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) { + ret_value = render_bin_output_region_data_points(stream, region_space, region_id, + container, ndims, type_id, npoints, ptdata); + + if(H5Tclose(type_id) < 0) + ret_value = -1; + } /* end if((type_id = H5Tget_native_type(dtype, H5T_DIR_DEFAULT)) >= 0) */ + else + ret_value = -1; + + if(H5Tclose(dtype) < 0) + ret_value = -1; + } /* end if((dtype = H5Dget_type(region_id)) >= 0) */ + else + ret_value = -1; + } /* end if(H5Sget_select_elem_pointlist(region_space, (hsize_t) 0, (hsize_t) npoints, ptdata) >= 0) */ + else + ret_value = -1; + + HDfree(ptdata); + } /* end if(NULL != (ptdata = (hsize_t *)HDmalloc((size_t) alloc_size))) */ + else + ret_value = -1; + } /* end if((ndims = H5Sget_simple_extent_ndims(region_space)) >= 0) */ + else + ret_value = -1; + + } /* end if((npoints = H5Sget_select_elem_npoints(region_space)) > 0) */ + else + ret_value = -1; + + return ret_value; +} /* end render_bin_output_region_points */ + +int +h5str_dump_simple_dset(FILE *stream, hid_t dset, int binary_order) +{ + int ret_value = SUCCEED; + hid_t f_space = -1; /* file data space */ + hsize_t elmtno; /* counter */ + size_t i; /* counter */ + int ndims; + int carry; /* counter carry value */ + hsize_t zero[8]; /* vector of zeros */ + unsigned int flags; /* buffer extent flags */ + hsize_t total_size[H5S_MAX_RANK]; /* total size of dataset*/ + + /* Print info */ + size_t p_type_nbytes; /* size of memory type */ + hsize_t p_nelmts; /* total selected elmts */ + + /* Stripmine info */ + hsize_t sm_size[H5S_MAX_RANK]; /* stripmine size */ + hsize_t sm_nbytes; /* bytes per stripmine */ + hsize_t sm_nelmts; /* elements per stripmine*/ + unsigned char *sm_buf = NULL; /* buffer for raw data */ + hid_t sm_space = -1; /* stripmine data space */ + + /* Hyperslab info */ + hsize_t hs_offset[H5S_MAX_RANK]; /* starting offset */ + hsize_t hs_size[H5S_MAX_RANK]; /* size this pass */ + hsize_t hs_nelmts; /* elements in request */ + + /* VL data special information */ + unsigned int vl_data = 0; /* contains VL datatypes */ + hid_t p_type = -1; + hid_t f_type = -1; + + if(dset < 0) return -1; + f_type = H5Dget_type(dset); + if (binary_order == 1) + p_type = h5str_get_native_type(f_type); + else if (binary_order == 2) + p_type = h5str_get_little_endian_type(f_type); + else if (binary_order == 3) + p_type = h5str_get_big_endian_type(f_type); + else + p_type = H5Tcopy(f_type); + + H5Tclose(f_type); + + if (p_type >= 0) { + if((f_space = H5Dget_space(dset)) >= 0) { + ndims = H5Sget_simple_extent_ndims(f_space); + + if ((size_t)ndims <= (sizeof(sm_size)/sizeof(sm_size[0]))) { + H5Sget_simple_extent_dims(f_space, total_size, NULL); + + /* calculate the number of elements we're going to print */ + p_nelmts = 1; + + if (ndims > 0) { + for (i = 0; i < ndims; i++) + p_nelmts *= total_size[i]; + } /* end if */ + + if (p_nelmts > 0) { + /* Check if we have VL data in the dataset's datatype */ + if (h5str_detect_vlen(p_type) != 0) + vl_data = 1; + + /* + * Determine the strip mine size and allocate a buffer. The strip mine is + * a hyperslab whose size is manageable. + */ + sm_nbytes = p_type_nbytes = H5Tget_size(p_type); + + if (ndims > 0) { + for (i = (size_t)ndims; i > 0; --i) { + hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes; + if ( size == 0) /* datum size > H5TOOLS_BUFSIZE */ + size = 1; + sm_size[i - 1] = (((total_size[i - 1]) < (size)) ? (total_size[i - 1]) : (size)); + sm_nbytes *= sm_size[i - 1]; + } + } + + if(sm_nbytes > 0) { + sm_buf = (unsigned char *)HDmalloc((size_t)sm_nbytes); + + sm_nelmts = sm_nbytes / p_type_nbytes; + sm_space = H5Screate_simple(1, &sm_nelmts, NULL); + + /* The stripmine loop */ + HDmemset(hs_offset, 0, sizeof hs_offset); + HDmemset(zero, 0, sizeof zero); + + for (elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) { + /* Calculate the hyperslab size */ + if (ndims > 0) { + for (i = 0, hs_nelmts = 1; i < ndims; i++) { + hs_size[i] = (((total_size[i] - hs_offset[i]) < (sm_size[i])) ? (total_size[i] - hs_offset[i]) : (sm_size[i])); + hs_nelmts *= hs_size[i]; + } + + H5Sselect_hyperslab(f_space, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL); + H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL); + } + else { + H5Sselect_all(f_space); + H5Sselect_all(sm_space); + hs_nelmts = 1; + } + + /* Read the data */ + if (H5Dread(dset, p_type, sm_space, f_space, H5P_DEFAULT, sm_buf) >= 0) { + + if (binary_order == 99) + ret_value = h5tools_dump_simple_data(stream, dset, p_type, sm_buf, hs_nelmts); + else + ret_value = h5str_render_bin_output(stream, dset, p_type, sm_buf, hs_nelmts); + + /* Reclaim any VL memory, if necessary */ + if (vl_data) + H5Dvlen_reclaim(p_type, sm_space, H5P_DEFAULT, sm_buf); + } + else { + ret_value = -1; + break; + } + + if(ret_value < 0) break; + + /* Calculate the next hyperslab offset */ + for (i = (size_t)ndims, carry = 1; i > 0 && carry; --i) { + hs_offset[i - 1] += hs_size[i - 1]; + + if (hs_offset[i - 1] == total_size[i - 1]) + hs_offset[i - 1] = 0; + else + carry = 0; + } + } + + if(sm_buf) + HDfree(sm_buf); + } + if(sm_space >= 0 && H5Sclose(sm_space) < 0) + ret_value = -1; + } + } + if(f_space >= 0 && H5Sclose(f_space) < 0) + ret_value = -1; + } /* end if((f_space = H5Dget_space(dset)) >= 0) */ + else + ret_value = -1; + + if (p_type >= 0) + H5Tclose(p_type); + } + return ret_value; +} /* end h5str_dump_simple_dset */ + +static int +h5tools_dump_simple_data(FILE *stream, hid_t container, hid_t type, void *_mem, hsize_t nelmts) +{ + int ret_value = 0; + int line_count; + unsigned char *mem = (unsigned char*)_mem; + size_t size; /* datum size */ + H5T_class_t type_class; + hsize_t i; /*element counter */ + h5str_t buffer; /*string into which to render */ + + if((size = H5Tget_size(type)) > 0) { + for (i = 0, line_count = 0; i < nelmts; i++, line_count++) { + size_t bytes_in = 0; /* # of bytes to write */ + size_t bytes_wrote = 0; /* # of bytes written */ + void* memref = mem + i * size; + + /* Render the data element*/ + h5str_new(&buffer, 32 * size); + bytes_in = h5str_sprintf(&buffer, container, type, memref, 1); + if(i > 0) { + HDfprintf(stream, ", "); + if (line_count >= H5TOOLS_TEXT_BLOCK) { + line_count = 0; + HDfprintf(stream, "\n"); + } + } + HDfprintf(stream, "%s", buffer.s); + h5str_free(&buffer); + } /* end for (i = 0; i < nelmts... */ + HDfprintf(stream, "\n"); + } /* end if((size = H5Tget_size(tid)) > 0) */ + else + ret_value = -1; + + return ret_value; +} /* end h5tools_dump_simple_data */ + +/* + * Utility Java APIs + * Functions designed to workaround issues with the Java-C interface + */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5AwriteVL + * Signature: (JJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5AwriteVL(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf) +{ + herr_t status = -1; + char **wdata; + jsize size; + jint i; + + size = ENVPTR->GetArrayLength(ENVPAR (jarray) buf); + + wdata = (char**)HDcalloc((size_t)size + 1, sizeof(char*)); + if (!wdata) { + h5JNIFatalError(env, "H5AwriteVL: cannot allocate buffer"); + } /* end if */ + else { + HDmemset(wdata, 0, (size_t)size * sizeof(char*)); + for (i = 0; i < size; ++i) { + jstring obj = (jstring) ENVPTR->GetObjectArrayElement(ENVPAR (jobjectArray) buf, i); + if (obj != 0) { + jsize length = ENVPTR->GetStringUTFLength(ENVPAR obj); + const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0); + + if (utf8) { + wdata[i] = (char*)HDmalloc((size_t)length + 1); + if (wdata[i]) { + HDmemset(wdata[i], 0, ((size_t)length + 1)); + HDstrncpy(wdata[i], utf8, (size_t)length); + } /* end if */ + } /* end if */ + + ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8); + ENVPTR->DeleteLocalRef(ENVPAR obj); + } /* end if */ + } /* end for (i = 0; i < size; ++i) */ + + status = H5Awrite((hid_t)attr_id, (hid_t)mem_type_id, wdata); + + for (i = 0; i < size; i++) { + if(wdata[i]) { + HDfree(wdata[i]); + } /* end if */ + } /* end for */ + HDfree(wdata); + + if (status < 0) + h5libraryError(env); + } /* end else */ + + return (jint)status; +} /* end Java_hdf_hdf5lib_H5_H5AwriteVL */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5AreadVL + * Signature: (JJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5AreadVL(JNIEnv *env, jclass clss, jlong attr_id, jlong mem_type_id, jobjectArray buf) +{ + herr_t status = -1; + jstring jstr; + char **strs; + int i, n; + hid_t sid; + hsize_t dims[H5S_MAX_RANK]; + + n = ENVPTR->GetArrayLength(ENVPAR buf); + + strs =(char **)HDmalloc((size_t)n * sizeof(char *)); + if (strs == NULL) { + h5JNIFatalError( env, "H5AreadVL: failed to allocate buff for read variable length strings"); + } /* end if */ + else { + status = H5Aread(attr_id, mem_type_id, strs); + if (status < 0) { + dims[0] = (hsize_t)n; + sid = H5Screate_simple(1, dims, NULL); + H5Dvlen_reclaim(mem_type_id, sid, H5P_DEFAULT, strs); + H5Sclose(sid); + HDfree(strs); + h5JNIFatalError(env, "H5AreadVL: failed to read variable length strings"); + } /* end if */ + else { + for (i=0; iNewStringUTF(ENVPAR strs[i]); + ENVPTR->SetObjectArrayElement(ENVPAR buf, i, jstr); + HDfree (strs[i]); + } /* end for */ + + /* + for repeatedly reading an attribute with a large number of strs (e.g., 1,000,000 strings, + H5Dvlen_reclaim() may crash on Windows because the Java GC will not be able to collect + free space in time. Instead, use "free(strs[i])" to free individual strings + after it is done. + H5Dvlen_reclaim(tid, sid, H5P_DEFAULT, strs); + */ + + HDfree(strs); + } /* end else */ + } /* end else */ + return status; +} /* end Java_hdf_hdf5lib_H5_H5AreadVL */ + +/* + * Copies the content of one dataset to another dataset + * Class: hdf_hdf5lib_H5 + * Method: H5Acopy + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Acopy(JNIEnv *env, jclass clss, jlong src_id, jlong dst_id) +{ + jbyte *buf; + herr_t retVal = -1; + hid_t src_did = (hid_t)src_id; + hid_t dst_did = (hid_t)dst_id; + hid_t tid = -1; + hid_t sid = -1; + hsize_t total_size = 0; + + + sid = H5Aget_space(src_did); + if (sid < 0) { + h5libraryError(env); + } /* end if */ + else { + tid = H5Aget_type(src_did); + if (tid < 0) { + H5Sclose(sid); + h5libraryError(env); + } /* end if */ + else { + total_size = (hsize_t)H5Sget_simple_extent_npoints(sid) * (hsize_t)H5Tget_size(tid); + + H5Sclose(sid); + + buf = (jbyte *)HDmalloc( (size_t)total_size * sizeof(jbyte)); + if (buf == NULL) { + H5Tclose(tid); + h5outOfMemory( env, "H5Acopy: malloc failed"); + } /* end if */ + else { + retVal = H5Aread(src_did, tid, buf); + H5Tclose(tid); + + if (retVal < 0) { + HDfree(buf); + h5libraryError(env); + } /* end if */ + else { + tid = H5Aget_type(dst_did); + if (tid < 0) { + HDfree(buf); + h5libraryError(env); + } /* end if */ + else { + retVal = H5Awrite(dst_did, tid, buf); + + H5Tclose(tid); + HDfree(buf); + + if (retVal < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Acopy */ + +/* + * Copies the content of one dataset to another dataset + * Class: hdf_hdf5lib_H5 + * Method: H5Dcopy + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Dcopy(JNIEnv *env, jclass clss, jlong src_id, jlong dst_id) +{ + jbyte *buf; + herr_t retVal = -1; + hid_t src_did = (hid_t)src_id; + hid_t dst_did = (hid_t)dst_id; + hid_t tid = -1; + hid_t sid = -1; + hsize_t total_size = 0, total_allocated_size; + + total_allocated_size = H5Dget_storage_size(src_did); + if (total_allocated_size <=0) + return 0; // nothing to write; + + sid = H5Dget_space(src_did); + if (sid < 0) { + h5libraryError(env); + return -1; + } /* end if */ + + tid = H5Dget_type(src_did); + if (tid < 0) { + H5Sclose(sid); + h5libraryError(env); + return -1; + } /* end if */ + + total_size = (hsize_t)H5Sget_simple_extent_npoints(sid) * (hsize_t)H5Tget_size(tid); + + H5Sclose(sid); + + buf = (jbyte*)HDmalloc((size_t)total_size * sizeof(jbyte)); + if (buf == NULL) { + H5Tclose(tid); + h5outOfMemory(env, "H5Dcopy: malloc failed"); + return -1; + } /* end if */ + + retVal = H5Dread(src_did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + H5Tclose(tid); + + if (retVal < 0) { + HDfree(buf); + h5libraryError(env); + return (jint)retVal; + } /* end if */ + + tid = H5Dget_type(dst_did); + if (tid < 0) { + HDfree(buf); + h5libraryError(env); + return -1; + } /* end if */ + retVal = H5Dwrite(dst_did, tid, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf); + H5Tclose(tid); + HDfree(buf); + + if (retVal < 0) { + h5libraryError(env); + } /* end if */ + + return (jint)retVal; +} /* end Java_hdf_hdf5lib_H5_H5Dcopy */ + +/* +///////////////////////////////////////////////////////////////////////////////// +// +// +// Add these methods so that we don't need to call H5Gget_objtype_by_idx +// in a loop to get information for all the object in a group, which takes +// a lot of time to finish if the number of objects is more than 10,000 +// +///////////////////////////////////////////////////////////////////////////////// +*/ + +#ifdef __cplusplus + herr_t obj_info_all(hid_t g_id, const char *name, const H5L_info_t *linfo, void *op_data); + herr_t obj_info_max(hid_t g_id, const char *name, const H5L_info_t *linfo, void *op_data); + int H5Gget_obj_info_max(hid_t, char **, int *, int *, unsigned long *, long); + int H5Gget_obj_info_full( hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *fno, unsigned long *objno, int indexType, int indexOrder); +#else + static herr_t obj_info_all(hid_t g_id, const char *name, const H5L_info_t *linfo, void *op_data); + static herr_t obj_info_max(hid_t g_id, const char *name, const H5L_info_t *linfo, void *op_data); + static int H5Gget_obj_info_max(hid_t, char **, int *, int *, unsigned long *, long); + static int H5Gget_obj_info_full( hid_t loc_id, char **objname, int *otype, int *ltype, unsigned long *fno, unsigned long *objno, int indexType, int indexOrder); +#endif + +typedef struct info_all +{ + char **objname; + int *otype; + int *ltype; + unsigned long *objno; + unsigned long *fno; + unsigned long idxnum; + int count; +} info_all_t; + + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Gget_obj_info_full + * Signature: (JLjava/lang/String;[Ljava/lang/String;[I[I[J[JIII)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1full(JNIEnv *env, jclass clss, jlong loc_id, jstring group_name, + jobjectArray objName, jintArray oType, jintArray lType, jlongArray fNo, + jlongArray oRef, jint n, jint indx_type, jint indx_order) +{ + herr_t ret_val = -1; + const char *gName = NULL; + char **oName = NULL; + jboolean isCopy; + jstring str; + jint *otarr; + jint *ltarr; + jlong *refP; + jlong *fnoP; + unsigned long *refs=NULL; + unsigned long *fnos=NULL; + hid_t gid = (hid_t)loc_id; + int i; + int indexType = indx_type; + int indexOrder = indx_order; + + if (oType == NULL) { + h5nullArgument(env, "H5Gget_obj_info_full: oType is NULL"); + } + else if (lType == NULL) { + h5nullArgument(env, "H5Gget_obj_info_full: lType is NULL"); + } + else if (oRef == NULL) { + h5nullArgument(env, "H5Gget_obj_info_full: oRef is NULL"); + } + else if (fNo == NULL) { + h5nullArgument(env, "H5Gget_obj_info_full: fNo is NULL"); + } + else { + otarr = ENVPTR->GetIntArrayElements(ENVPAR oType, &isCopy); + if (otarr == NULL) { + h5JNIFatalError(env, "H5Gget_obj_info_full: otype not pinned"); + return -1; + } /* end if */ + ltarr = ENVPTR->GetIntArrayElements(ENVPAR lType, &isCopy); + if (ltarr == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT); + h5JNIFatalError(env, "H5Gget_obj_info_full: ltype not pinned"); + return -1; + } /* end if */ + refP = ENVPTR->GetLongArrayElements(ENVPAR oRef, &isCopy); + if (refP == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT); + h5JNIFatalError(env, "H5Gget_obj_info_full: oRef not pinned"); + return -1; + } /* end if */ + fnoP = ENVPTR->GetLongArrayElements(ENVPAR fNo, &isCopy); + if (fnoP == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT); + h5JNIFatalError(env, "H5Gget_obj_info_full: fNo not pinned"); + return -1; + } /* end if */ + oName = (char **)HDcalloc((size_t)n, sizeof(*oName)); + if (!oName) { + ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR fNo, fnoP, JNI_ABORT); + h5JNIFatalError(env, "H5Gget_obj_info_full: oName not allocated"); + return -1; + } /* end if */ + + refs = (unsigned long *)HDcalloc((size_t)n, sizeof(unsigned long)); + fnos = (unsigned long *)HDcalloc((size_t)n, sizeof(unsigned long)); + if (!refs || !fnos) { + ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR fNo, fnoP, JNI_ABORT); + h5str_array_free(oName, (size_t)n); + if (refs) + HDfree(refs); + if (fnos) + HDfree(fnos); + h5JNIFatalError(env, "H5Gget_obj_info_full: result arrays not allocated"); + return -1; + } /* end if */ + + if (group_name != NULL) { + gid = -1; + gName = ENVPTR->GetStringUTFChars(ENVPAR group_name, &isCopy); + if (gName != NULL) { + gid = H5Gopen2((hid_t)loc_id, gName, H5P_DEFAULT); + + ENVPTR->ReleaseStringUTFChars(ENVPAR group_name, gName); + } /* end if */ + if(gid < 0) { + ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR fNo, fnoP, JNI_ABORT); + h5str_array_free(oName, (size_t)n); + HDfree(refs); + HDfree(fnos); + h5JNIFatalError(env, "H5Gget_obj_info_full: could not get group identifier"); + return -1; + } /* end if */ + } /* end if */ + + ret_val = H5Gget_obj_info_full(gid, oName, (int *)otarr, (int *)ltarr, fnos, refs, indexType, indexOrder); + + ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, 0); + ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, 0); + + if (group_name != NULL) + H5Gclose(gid); + + if (ret_val < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR fNo, fnoP, JNI_ABORT); + h5str_array_free(oName, (size_t)n); + HDfree(refs); + HDfree(fnos); + h5libraryError(env); + } /* end if */ + else { + for (i=0; iReleaseLongArrayElements(ENVPAR oRef, refP, 0); + + for (i=0; iReleaseLongArrayElements(ENVPAR fNo, fnoP, 0); + + for (i=0; iNewStringUTF(ENVPAR *(oName+i)); + ENVPTR->SetObjectArrayElement(ENVPAR objName, i, (jobject)str); + } /* end if */ + } /* for (i=0; iGetIntArrayElements(ENVPAR oType, &isCopy); + if (otarr == NULL) { + h5JNIFatalError(env, "H5Gget_obj_info_max: otype not pinned"); + return -1; + } /* end if */ + + ltarr = ENVPTR->GetIntArrayElements(ENVPAR lType, &isCopy); + if (ltarr == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT); + h5JNIFatalError(env, "H5Gget_obj_info_max: ltype not pinned"); + return -1; + } /* end if */ + + refP = ENVPTR->GetLongArrayElements(ENVPAR oRef, &isCopy); + if (refP == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT); + h5JNIFatalError(env, "H5Gget_obj_info_max: oRef not pinned"); + return -1; + } /* end if */ + + oName = (char **)HDcalloc((size_t)n, sizeof(*oName)); + if (!oName) { + ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT); + h5JNIFatalError(env, "H5Gget_obj_info_max: oName not allocated"); + return -1; + } /* end if */ + refs = (unsigned long *)HDcalloc((size_t)n, sizeof(unsigned long)); + if (!refs) { + ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, JNI_ABORT); + ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, JNI_ABORT); + ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT); + h5str_array_free(oName, (size_t)n); + h5JNIFatalError(env, "H5Gget_obj_info_max: result array not allocated"); + return -1; + } /* end if */ + + ret_val = H5Gget_obj_info_max((hid_t)loc_id, oName, (int*)otarr, (int*)ltarr, refs, maxnum ); + ENVPTR->ReleaseIntArrayElements(ENVPAR lType, ltarr, 0); + ENVPTR->ReleaseIntArrayElements(ENVPAR oType, otarr, 0); + + if (ret_val < 0) { + ENVPTR->ReleaseLongArrayElements(ENVPAR oRef, refP, JNI_ABORT); + h5str_array_free(oName, (size_t)n); + HDfree(refs); + h5libraryError(env); + } /* end if */ + else { + for (i=0; iReleaseLongArrayElements(ENVPAR oRef, refP, 0); + + for (i=0; iNewStringUTF(ENVPAR *(oName+i)); + ENVPTR->SetObjectArrayElement(ENVPAR objName, i, (jobject)str); + } + } /* for (i=0; iotype+datainfo->count) = -1; + *(datainfo->ltype+datainfo->count) = -1; + *(datainfo->objname+datainfo->count) = (char *)HDmalloc(strlen(name)+1); + HDstrcpy(*(datainfo->objname+datainfo->count), name); + *(datainfo->objno+datainfo->count) = (unsigned long)-1; + } /* end if */ + else { + *(datainfo->otype+datainfo->count) = object_info.type; + *(datainfo->ltype+datainfo->count) = info->type; + *(datainfo->objname+datainfo->count) = (char *)HDmalloc(HDstrlen(name)+1); + HDstrcpy(*(datainfo->objname+datainfo->count), name); + + *(datainfo->fno+datainfo->count) = object_info.fileno; + *(datainfo->objno+datainfo->count) = (unsigned long)object_info.addr; + /* + if(info->type==H5L_TYPE_HARD) + *(datainfo->objno+datainfo->count) = (unsigned long)info->u.address; + else + *(datainfo->objno+datainfo->count) = info->u.val_size; + */ + } /* end else */ + + datainfo->count++; + + return 0; +} /* end obj_info_all */ + +herr_t +obj_info_max(hid_t loc_id, const char *name, const H5L_info_t *info, void *op_data) +{ + int type = -1; + herr_t retVal = 0; + info_all_t *datainfo = (info_all_t*)op_data; + H5O_info_t object_info; + + retVal = H5Oget_info(loc_id, &object_info); + if (retVal < 0) { + *(datainfo->otype+datainfo->count) = -1; + *(datainfo->ltype+datainfo->count) = -1; + *(datainfo->objname+datainfo->count) = NULL; + *(datainfo->objno+datainfo->count) = (unsigned long)-1; + return 1; + } /* end if */ + else { + *(datainfo->otype+datainfo->count) = object_info.type; + *(datainfo->ltype+datainfo->count) = info->type; + /* this will be freed by h5str_array_free(oName, n)*/ + *(datainfo->objname+datainfo->count) = (char *)HDmalloc(HDstrlen(name)+1); + strcpy(*(datainfo->objname+datainfo->count), name); + if(info->type==H5L_TYPE_HARD) + *(datainfo->objno+datainfo->count) = (unsigned long)info->u.address; + else + *(datainfo->objno+datainfo->count) = info->u.val_size; + } /* end else */ + datainfo->count++; + if(datainfo->count < (int)datainfo->idxnum) + return 0; + else + return 1; +} /* end obj_info_max */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5export_dataset + * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V + */ +JNIEXPORT void JNICALL +Java_hdf_hdf5lib_H5_H5export_1dataset(JNIEnv *env, jclass cls, jstring file_export_name, jstring file_name, jstring object_path, jint binary_order) +{ + herr_t status = -1; + herr_t ret_val = -1; + hid_t file_id = -1; + hid_t dataset_id = -1; + FILE *stream; + const char *file_export; + const char *object_name; + const char *fileName; + jboolean isCopy2; + + if (file_export_name == NULL) { + h5nullArgument(env, "HDF5Library_export_data: file_export_name is NULL"); + } /* end if */ + else if (object_path == NULL) { + h5nullArgument(env, "HDF5Library_export_data: object_path is NULL"); + } /* end else if */ + else { + PIN_JAVA_STRING0(file_name, fileName); + + file_id = H5Fopen(fileName, (unsigned)H5F_ACC_RDWR, (hid_t)H5P_DEFAULT); + + UNPIN_JAVA_STRING(file_name, fileName); + + if (file_id < 0) { + /* throw exception */ + h5libraryError(env); + } /* end if */ + else { + object_name = ENVPTR->GetStringUTFChars(ENVPAR object_path, &isCopy2); + if (object_name == NULL) { + h5JNIFatalError( env, "H5Dopen: object name not pinned"); + } /* end if */ + else { + dataset_id = H5Dopen2(file_id, object_name, H5P_DEFAULT); + + ENVPTR->ReleaseStringUTFChars(ENVPAR object_path, object_name); + + if (dataset_id < 0) { + H5Fclose(file_id); + h5libraryError(env); + } /* end if */ + else { + file_export = ENVPTR->GetStringUTFChars(ENVPAR file_export_name, 0); + stream = HDfopen(file_export, "w+"); + ENVPTR->ReleaseStringUTFChars(ENVPAR file_export_name, file_export); + + ret_val = h5str_dump_simple_dset(stream, dataset_id, binary_order); + + if (stream) + HDfclose(stream); + + H5Dclose(dataset_id); + + H5Fclose(file_id); + + if (ret_val < 0) + h5libraryError(env); + } /* end else */ + } /* end else */ + } /* end else */ + } /* end else */ +} /* end Java_hdf_hdf5lib_H5_H5export_1dataset */ + +#ifdef __cplusplus +} +#endif diff --git a/java/src/jni/h5util.h b/java/src/jni/h5util.h new file mode 100644 index 0000000..fcf343d --- /dev/null +++ b/java/src/jni/h5util.h @@ -0,0 +1,108 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifndef H5UTIL_H__ +#define H5UTIL_H__ + +#include "h5jni.h" + +#ifndef SUCCEED +#define SUCCEED 0 +#endif + +#ifndef FAIL +#define FAIL (-1) +#endif + +typedef struct h5str_t { + char *s; + size_t max; /* the allocated size of the string */ +} h5str_t; + +extern void h5str_new (h5str_t *str, size_t len); +extern void h5str_free (h5str_t *str); +extern void h5str_resize (h5str_t *str, size_t new_len); +extern char* h5str_append (h5str_t *str, const char* cstr); +extern size_t h5str_sprintf(h5str_t *str, hid_t container, hid_t tid, void *buf, int expand_data); +extern void h5str_array_free(char **strs, size_t len); +extern int h5str_dump_simple_dset(FILE *stream, hid_t dset, int binary_order); +extern int h5str_dump_region_blocks_data(h5str_t *str, hid_t region, hid_t region_obj); +extern int h5str_dump_region_points_data(h5str_t *str, hid_t region, hid_t region_obj); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5AwriteVL + * Signature: (JJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5AwriteVL + (JNIEnv *, jclass, jlong, jlong, jobjectArray); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5AreadVL + * Signature: (JJ[Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5AreadVL + (JNIEnv *, jclass, jlong, jlong, jobjectArray); + +/* + * Copies the content of one dataset to another dataset + * Class: hdf_hdf5lib_H5 + * Method: H5Acopy + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Acopy + (JNIEnv *, jclass, jlong, jlong); + +/* + * Copies the content of one dataset to another dataset + * Class: hdf_hdf5lib_H5 + * Method: H5Dcopy + * Signature: (JJ)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Dcopy + (JNIEnv*, jclass, jlong, jlong); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Gget_obj_info_full + * Signature: (JLjava/lang/String;[Ljava/lang/String;[I[I[J[JIII)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1full + (JNIEnv*, jclass, jlong, jstring, jobjectArray, jintArray, jintArray, jlongArray, jlongArray, jint, jint, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Gget_obj_info_max + * Signature: (J[Ljava/lang/String;[I[I[JJI)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Gget_1obj_1info_1max + (JNIEnv*, jclass, jlong, jobjectArray, jintArray, jintArray, jlongArray, jlong, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5export_dataset + * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5export_1dataset + (JNIEnv*, jclass, jstring, jstring, jstring, jint); + +#endif /* H5UTIL_H__ */ diff --git a/java/src/jni/h5zImp.c b/java/src/jni/h5zImp.c new file mode 100644 index 0000000..a60854d --- /dev/null +++ b/java/src/jni/h5zImp.c @@ -0,0 +1,84 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "hdf5.h" +#include +#include +#include "h5jni.h" +#include "h5zImp.h" + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Zunregister + * Signature: (I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Zunregister(JNIEnv *env, jclass clss, jint filter) +{ + herr_t retValue = H5Zunregister((H5Z_filter_t)filter); + + if (retValue < 0) + h5libraryError(env); + + return (jint)retValue; +} /* end Java_hdf_hdf5lib_H5_H5Zunregister */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Zfilter_avail + * Signature: (I)I + */ +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Zfilter_1avail(JNIEnv *env, jclass clss, jint filter) +{ + herr_t retValue = H5Zfilter_avail((H5Z_filter_t)filter); + + if (retValue < 0) + h5libraryError(env); + + return (jint)retValue; +} /* end Java_hdf_hdf5lib_H5_H5Zfilter_1avail */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Zget_filter_info + * Signature: (I)I + */ + +JNIEXPORT jint JNICALL +Java_hdf_hdf5lib_H5_H5Zget_1filter_1info(JNIEnv *env, jclass clss, jint filter) +{ + unsigned int flags = 0; + + if (H5Zget_filter_info ((H5Z_filter_t) filter, (unsigned *) &flags) < 0) + h5libraryError(env); + + return (jint)flags; +} /* end Java_hdf_hdf5lib_H5_H5Zget_1filter_1info */ + + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5zImp.h b/java/src/jni/h5zImp.h new file mode 100644 index 0000000..de0d6e6 --- /dev/null +++ b/java/src/jni/h5zImp.h @@ -0,0 +1,55 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5Z */ + +#ifndef _Included_hdf_hdf5lib_H5_H5Z +#define _Included_hdf_hdf5lib_H5_H5Z + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Zunregister + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Zunregister + (JNIEnv *, jclass, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Zfilter_avail + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Zfilter_1avail + (JNIEnv *, jclass, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5Zget_filter_info + * Signature: (I)I + */ + +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5Zget_1filter_1info + (JNIEnv *, jclass, jint); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5Z */ diff --git a/java/src/jni/nativeData.c b/java/src/jni/nativeData.c new file mode 100644 index 0000000..da86e09 --- /dev/null +++ b/java/src/jni/nativeData.c @@ -0,0 +1,1195 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ +/* + * This module contains the implementation of all the native methods + * used for number conversion. This is represented by the Java + * class HDFNativeData. + * + * These routines convert one dimensional arrays of bytes into + * one-D arrays of other types (int, float, etc) and vice versa. + * + * These routines are called from the Java parts of the Java-C + * interface. + * + * ***Important notes: + * + * 1. These routines are designed to be portable--they use the + * C compiler to do the required native data manipulation. + * 2. These routines copy the data at least once -- a serious + * but unavoidable performance hit. + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include +#include "hdf5.h" +#include "h5jni.h" +#include "nativeData.h" + + +/* returns int [] */ +JNIEXPORT jintArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_byteToInt___3B(JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */ +{ + jbyte *barr; + jintArray rarray = NULL; + int blen; + jint *iarray; + jboolean bb; + char *bp; + jint *iap; + int ii; + int len; + + if (bdata == NULL) { + h5nullArgument( env, "byteToInt: bdata is NULL?"); + } /* end if */ + else { + barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb); + if (barr == NULL) { + h5JNIFatalError(env, "byteToInt: pin failed"); + } /* end if */ + else { + blen = ENVPTR->GetArrayLength(ENVPAR bdata); + + len = blen/(int)sizeof(jint); + rarray = ENVPTR->NewIntArray(ENVPAR len); + if (rarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5outOfMemory( env, "byteToInt" ); + return NULL; + } /* end if */ + + iarray = ENVPTR->GetIntArrayElements(ENVPAR rarray,&bb); + if (iarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5JNIFatalError(env, "byteToInt: pin iarray failed"); + return NULL; + } /* end if */ + + bp = (char *)barr; + iap = iarray; + for (ii = 0; ii < len; ii++) { + *iap = *(jint *)bp; + iap++; + bp += sizeof(jint); + } /* end for */ + + ENVPTR->ReleaseIntArrayElements(ENVPAR rarray,iarray, 0); + } /* end else */ + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + } /* end else */ + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_byteToInt___3B */ + +/* returns float [] */ +JNIEXPORT jfloatArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_byteToFloat___3B(JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */ +{ + jbyte *barr; + jfloatArray rarray; + int blen; + jfloat *farray; + jboolean bb; + char *bp; + jfloat *iap; + int ii; + int len; + + if (bdata == NULL) { + h5nullArgument( env, "byteToFloat: bdata is NULL?"); + return NULL; + } /* end if */ + barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb); + if (barr == NULL) { + h5JNIFatalError(env, "byteToFloat: pin failed"); + return NULL; + } /* end if */ + blen = ENVPTR->GetArrayLength(ENVPAR bdata); + + len = blen/(int)sizeof(jfloat); + rarray = ENVPTR->NewFloatArray(ENVPAR len); + if (rarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5outOfMemory( env, "byteToFloat" ); + return NULL; + } /* end if */ + farray = ENVPTR->GetFloatArrayElements(ENVPAR rarray,&bb); + if (farray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5JNIFatalError(env, "byteToFloat: pin farray failed"); + return NULL; + } /* end if */ + + bp = (char *)barr; + iap = farray; + for (ii = 0; ii < len; ii++) { + *iap = *(jfloat *)bp; + iap++; + bp += sizeof(jfloat); + } /* end for */ + + ENVPTR->ReleaseFloatArrayElements(ENVPAR rarray,farray, 0); + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_byteToFloat___3B */ + +/* returns short [] */ +JNIEXPORT jshortArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_byteToShort___3B(JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */ +{ + jbyte *barr; + jshortArray rarray; + int blen; + jshort *sarray; + jboolean bb; + char *bp; + jshort *iap; + int ii; + int len; + + if (bdata == NULL) { + h5nullArgument( env, "byteToShort: bdata is NULL?"); + return NULL; + } /* end if */ + barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb); + if (barr == NULL) { + h5JNIFatalError(env, "byteToShort: pin failed"); + return NULL; + } /* end if */ + + blen = ENVPTR->GetArrayLength(ENVPAR bdata); + + len = blen/(int)sizeof(jshort); + rarray = ENVPTR->NewShortArray(ENVPAR len); + if (rarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5outOfMemory( env, "byteToShort" ); + return NULL; + } /* end if */ + + sarray = ENVPTR->GetShortArrayElements(ENVPAR rarray,&bb); + if (sarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5JNIFatalError(env, "byteToShort: pin sarray failed"); + return NULL; + } /* end if */ + + bp = (char *)barr; + iap = sarray; + for (ii = 0; ii < len; ii++) { + *iap = *(jshort *)bp; + iap++; + bp += sizeof(jshort); + } /* end for */ + + ENVPTR->ReleaseShortArrayElements(ENVPAR rarray,sarray, 0); + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_byteToShort___3B */ + + +/* returns long [] */ +JNIEXPORT jlongArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_byteToLong___3B(JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */ +{ + jbyte *barr; + jlongArray rarray; + int blen; + jlong *larray; + jboolean bb; + char *bp; + jlong *iap; + int ii; + int len; + + if (bdata == NULL) { + h5nullArgument( env, "byteToLong: bdata is NULL?"); + return NULL; + } /* end if */ + barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb); + if (barr == NULL) { + h5JNIFatalError(env, "byteToLong: pin failed"); + return NULL; + } /* end if */ + blen = ENVPTR->GetArrayLength(ENVPAR bdata); + + len = blen/(int)sizeof(jlong); + rarray = ENVPTR->NewLongArray(ENVPAR len); + if (rarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5outOfMemory( env, "byteToLong" ); + return NULL; + } /* end if */ + + larray = ENVPTR->GetLongArrayElements(ENVPAR rarray,&bb); + if (larray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5JNIFatalError(env, "byteToLong: pin larray failed"); + return NULL; + } /* end if */ + + bp = (char *)barr; + iap = larray; + for (ii = 0; ii < len; ii++) { + *iap = *(jlong *)bp; + iap++; + bp += sizeof(jlong); + } /* end for */ + ENVPTR->ReleaseLongArrayElements(ENVPAR rarray,larray, 0); + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_byteToLong___3B */ + + +/* returns double [] */ +JNIEXPORT jdoubleArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_byteToDouble___3B(JNIEnv *env, jclass clss, jbyteArray bdata) /* IN: array of bytes */ +{ + jbyte *barr; + jdoubleArray rarray; + int blen; + jdouble *darray; + jboolean bb; + char *bp; + jdouble *iap; + int ii; + int len; + + if (bdata == NULL) { + h5nullArgument( env, "byteToDouble: bdata is NULL?"); + return NULL; + } /* end if */ + barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb); + if (barr == NULL) { + h5JNIFatalError(env, "byteToDouble: pin failed"); + return NULL; + } /* end if */ + blen = ENVPTR->GetArrayLength(ENVPAR bdata); + + len = blen/(int)sizeof(jdouble); + rarray = ENVPTR->NewDoubleArray(ENVPAR len); + if (rarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5outOfMemory( env, "byteToDouble" ); + return NULL; + } /* end if */ + + darray = ENVPTR->GetDoubleArrayElements(ENVPAR rarray,&bb); + if (darray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5JNIFatalError(env, "byteToDouble: pin darray failed"); + return NULL; + } /* end if */ + + bp = (char *)barr; + iap = darray; + for (ii = 0; ii < len; ii++) { + *iap = *(jdouble *)bp; + iap++; + bp += sizeof(jdouble); + } /* end for */ + + ENVPTR->ReleaseDoubleArrayElements(ENVPAR rarray,darray,0); + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_byteToDouble___3B */ + + +/* returns int [] */ +JNIEXPORT jintArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_byteToInt__II_3B(JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */ +{ + char *bp; + jbyte *barr; + jintArray rarray; + int blen; + jint *iarray; + jint *iap; + int ii; + jboolean bb; + + if (bdata == NULL) { + h5nullArgument( env, "byteToInt: bdata is NULL?"); + return NULL; + } /* end if */ + barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb); + if (barr == NULL) { + h5JNIFatalError(env, "byteToInt: pin failed"); + return NULL; + } /* end if */ + + blen = ENVPTR->GetArrayLength(ENVPAR bdata); + if ((start < 0) || ((int)(start + (len*(int)sizeof(jint))) > blen)) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5JNIFatalError(env, "byteToInt: getLen failed"); + return NULL; + } /* end if */ + + bp = (char *)barr + start; + + rarray = ENVPTR->NewIntArray(ENVPAR len); + if (rarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5outOfMemory( env, "byteToInt" ); + return NULL; + } /* end if */ + + iarray = ENVPTR->GetIntArrayElements(ENVPAR rarray,&bb); + if (iarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5JNIFatalError(env, "byteToInt: pin iarray failed"); + return NULL; + } /* end if */ + + iap = iarray; + for (ii = 0; ii < len; ii++) { + *iap = *(jint *)bp; + iap++; + bp += sizeof(jint); + } /* end for */ + + ENVPTR->ReleaseIntArrayElements(ENVPAR rarray,iarray, 0); + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_byteToInt__II_3B */ + +/* returns short [] */ +JNIEXPORT jshortArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_byteToShort__II_3B(JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */ +{ + char *bp; + jbyte *barr; + jshortArray rarray; + int blen; + jshort *iarray; + jshort *iap; + int ii; + jboolean bb; + + if (bdata == NULL) { + h5nullArgument( env, "byteToShort: bdata is NULL?"); + return NULL; + } /* end if */ + barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb); + if (barr == NULL) { + h5JNIFatalError( env, "byteToShort: getByte failed?"); + return NULL; + } /* end if */ + + blen = ENVPTR->GetArrayLength(ENVPAR bdata); + if ((start < 0) || ((int)(start + (len*(int)sizeof(jshort))) > blen)) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5badArgument( env, "byteToShort: start or len is out of bounds"); + return NULL; + } /* end if */ + + bp = (char *)barr + start; + + rarray = ENVPTR->NewShortArray(ENVPAR len); + if (rarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5outOfMemory( env, "byteToShort" ); + return NULL; + } /* end if */ + + iarray = ENVPTR->GetShortArrayElements(ENVPAR rarray,&bb); + if (iarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5JNIFatalError( env, "byteToShort: getShort failed?"); + return NULL; + } /* end if */ + + iap = iarray; + for (ii = 0; ii < len; ii++) { + *iap = *(jshort *)bp; + iap++; + bp += sizeof(jshort); + } /* end for */ + + ENVPTR->ReleaseShortArrayElements(ENVPAR rarray,iarray, 0); + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_byteToShort__II_3B */ + +/* returns float [] */ +JNIEXPORT jfloatArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_byteToFloat__II_3B(JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */ +{ + char *bp; + jbyte *barr; + jfloatArray rarray; + int blen; + jfloat *iarray; + jfloat *iap; + int ii; + jboolean bb; + + if (bdata == NULL) { + h5nullArgument( env, "byteToFloat: bdata is NULL?"); + return NULL; + } /* end if */ + barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb); + if (barr == NULL) { + h5JNIFatalError( env, "byteToFloat: getByte failed?"); + return NULL; + } /* end if */ + + blen = ENVPTR->GetArrayLength(ENVPAR bdata); + if ((start < 0) || ((int)(start + (len*(int)sizeof(jfloat))) > blen)) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5badArgument( env, "byteToFloat: start or len is out of bounds"); + return NULL; + } /* end if */ + + bp = (char *)barr + start; + + rarray = ENVPTR->NewFloatArray(ENVPAR len); + if (rarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5outOfMemory( env, "byteToFloat" ); + return NULL; + } /* end if */ + + iarray = ENVPTR->GetFloatArrayElements(ENVPAR rarray,&bb); + if (iarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5JNIFatalError( env, "byteToFloat: getFloat failed?"); + return NULL; + } /* end if */ + + iap = iarray; + for (ii = 0; ii < len; ii++) { + *iap = *(jfloat *)bp; + iap++; + bp += sizeof(jfloat); + } /* end for */ + + ENVPTR->ReleaseFloatArrayElements(ENVPAR rarray,iarray, 0); + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_byteToFloat__II_3B */ + +/* returns long [] */ +JNIEXPORT jlongArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_byteToLong__II_3B(JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */ +{ + char *bp; + jbyte *barr; + jlongArray rarray; + int blen; + jlong *iarray; + jlong *iap; + int ii; + jboolean bb; + + if (bdata == NULL) { + h5nullArgument( env, "byteToLong: bdata is NULL?"); + return NULL; + } /* end if */ + barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb); + if (barr == NULL) { + h5JNIFatalError( env, "byteToLong: getByte failed?"); + return NULL; + } /* end if */ + + blen = ENVPTR->GetArrayLength(ENVPAR bdata); + if ((start < 0) || ((int)(start + (len*(int)sizeof(jlong))) > blen)) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5badArgument( env, "byteToLong: start or len is out of bounds"); + return NULL; + } /* end if */ + + bp = (char *)barr + start; + + rarray = ENVPTR->NewLongArray(ENVPAR len); + if (rarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5outOfMemory( env, "byteToLong" ); + return NULL; + } /* end if */ + + iarray = ENVPTR->GetLongArrayElements(ENVPAR rarray,&bb); + if (iarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5JNIFatalError( env, "byteToLong: getLong failed?"); + return NULL; + } /* end if */ + + iap = iarray; + for (ii = 0; ii < len; ii++) { + + *iap = *(jlong *)bp; + iap++; + bp += sizeof(jlong); + } /* end for */ + + ENVPTR->ReleaseLongArrayElements(ENVPAR rarray,iarray, 0); + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_byteToLong__II_3B */ + +/* returns double [] */ +JNIEXPORT jdoubleArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_byteToDouble__II_3B(JNIEnv *env, jclass clss, jint start, jint len, jbyteArray bdata) /* IN: array of bytes */ +{ + char *bp; + jbyte *barr; + jdoubleArray rarray; + int blen; + jdouble *iarray; + jdouble *iap; + int ii; + jboolean bb; + + if (bdata == NULL) { + h5nullArgument( env, "byteToDouble: bdata is NULL?"); + return NULL; + } /* end if */ + barr = ENVPTR->GetByteArrayElements(ENVPAR bdata,&bb); + if (barr == NULL) { + h5JNIFatalError( env, "byteToDouble: getByte failed?"); + return NULL; + } /* end if */ + + blen = ENVPTR->GetArrayLength(ENVPAR bdata); + if ((start < 0) || ((int)(start + (len*(int)sizeof(jdouble))) > blen)) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5badArgument( env, "byteToDouble: start or len is out of bounds"); + return NULL; + } /* end if */ + + bp = (char *)barr + start; + + rarray = ENVPTR->NewDoubleArray(ENVPAR len); + if (rarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5outOfMemory( env, "byteToDouble" ); + return NULL; + } /* end if */ + + iarray = ENVPTR->GetDoubleArrayElements(ENVPAR rarray,&bb); + if (iarray == NULL) { + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + h5JNIFatalError( env, "byteToDouble: getDouble failed?"); + return NULL; + } /* end if */ + + iap = iarray; + for (ii = 0; ii < len; ii++) { + *iap = *(jdouble *)bp; + iap++; + bp += sizeof(jdouble); + } /* end for */ + + ENVPTR->ReleaseDoubleArrayElements(ENVPAR rarray,iarray, 0); + ENVPTR->ReleaseByteArrayElements(ENVPAR bdata,barr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_byteToDouble__II_3B */ + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_intToByte__II_3I(JNIEnv *env, jclass clss, jint start, jint len, jintArray idata) /* IN: array of int */ +{ + jint *ip; + jint *iarr; + int ilen; + jbyteArray rarray; + int blen; + jbyte *barray; + jbyte *bap; + jboolean bb; + int ii; + int ij; + union things { + int ival; + char bytes[4]; + } u; + + if (idata == NULL) { + h5nullArgument( env, "intToByte: idata is NULL?"); + return NULL; + } /* end if */ + + iarr = ENVPTR->GetIntArrayElements(ENVPAR idata,&bb); + if (iarr == NULL) { + h5JNIFatalError( env, "intToByte: getInt failed?"); + return NULL; + } /* end if */ + + ilen = ENVPTR->GetArrayLength(ENVPAR idata); + if ((start < 0) || (((start + len)) > ilen)) { + ENVPTR->ReleaseIntArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5badArgument( env, "intToByte: start or len is out of bounds"); + return NULL; + } /* end if */ + + ip = iarr + start; + + blen = ilen * (int)sizeof(jint); + rarray = ENVPTR->NewByteArray(ENVPAR blen); + if (rarray == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5outOfMemory( env, "intToByte" ); + return NULL; + } /* end if */ + + barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb); + if (barray == NULL) { + ENVPTR->ReleaseIntArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5JNIFatalError( env, "intToByte: getByte failed?"); + return NULL; + } /* end if */ + + bap = barray; + for (ii = 0; ii < len; ii++) { + u.ival = *ip++; + for (ij = 0; ij < sizeof(jint); ij++) { + *bap = u.bytes[ij]; + bap++; + } /* end for */ + } /* end for */ + + ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,barray, 0); + ENVPTR->ReleaseIntArrayElements(ENVPAR idata,iarr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_intToByte__II_3I */ + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_shortToByte__II_3S(JNIEnv *env, jclass clss, jint start, jint len, jshortArray idata) /* IN: array of short */ +{ + jshort *ip; + jshort *iarr; + int ilen; + jbyteArray rarray; + int blen; + jbyte *barray; + jbyte *bap; + jboolean bb; + int ii; + int ij; + union things { + short ival; + char bytes[4]; + } u; + + if (idata == NULL) { + h5nullArgument( env, "shortToByte: idata is NULL?"); + return NULL; + } /* end if */ + iarr = ENVPTR->GetShortArrayElements(ENVPAR idata,&bb); + if (iarr == NULL) { + h5JNIFatalError( env, "shortToByte: getShort failed?"); + return NULL; + } /* end if */ + + ilen = ENVPTR->GetArrayLength(ENVPAR idata); + if ((start < 0) || (((start + len)) > ilen)) { + ENVPTR->ReleaseShortArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5badArgument( env, "shortToByte: start or len is out of bounds"); + return NULL; + } /* end if */ + + ip = iarr + start; + + blen = ilen * (int)sizeof(jshort); + rarray = ENVPTR->NewByteArray(ENVPAR blen); + if (rarray == NULL) { + ENVPTR->ReleaseShortArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5outOfMemory( env, "shortToByte" ); + return NULL; + } /* end if */ + + barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb); + if (barray == NULL) { + ENVPTR->ReleaseShortArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5JNIFatalError( env, "shortToByte: getByte failed?"); + return NULL; + } /* end if */ + + bap = barray; + for (ii = 0; ii < len; ii++) { + u.ival = *ip++; + for (ij = 0; ij < sizeof(jshort); ij++) { + *bap = u.bytes[ij]; + bap++; + } /* end for */ + } /* end for */ + + ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,barray, 0); + ENVPTR->ReleaseShortArrayElements(ENVPAR idata,iarr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_shortToByte__II_3S */ + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_floatToByte__II_3F(JNIEnv *env, jclass clss, jint start, jint len, jfloatArray idata) /* IN: array of float */ +{ + jfloat *ip; + jfloat *iarr; + int ilen; + jbyteArray rarray; + int blen; + jbyte *barray; + jbyte *bap; + jboolean bb; + int ii; + int ij; + union things { + float ival; + char bytes[4]; + } u; + + if (idata == NULL) { + h5nullArgument( env, "floatToByte: idata is NULL?"); + return NULL; + } /* end if */ + iarr = ENVPTR->GetFloatArrayElements(ENVPAR idata,&bb); + if (iarr == NULL) { + h5JNIFatalError( env, "floatToByte: getFloat failed?"); + return NULL; + } /* end if */ + + ilen = ENVPTR->GetArrayLength(ENVPAR idata); + if ((start < 0) || (((start + len)) > ilen)) { + ENVPTR->ReleaseFloatArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5badArgument( env, "floatToByte: start or len is out of bounds"); + return NULL; + } /* end if */ + + ip = iarr + start; + + blen = ilen * (int)sizeof(jfloat); + rarray = ENVPTR->NewByteArray(ENVPAR blen); + if (rarray == NULL) { + ENVPTR->ReleaseFloatArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5outOfMemory( env, "floatToByte" ); + return NULL; + } /* end if */ + + barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb); + if (barray == NULL) { + ENVPTR->ReleaseFloatArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5JNIFatalError( env, "floatToByte: getByte failed?"); + return NULL; + } /* end if */ + + bap = barray; + for (ii = 0; ii < len; ii++) { + u.ival = *ip++; + for (ij = 0; ij < sizeof(jfloat); ij++) { + *bap = u.bytes[ij]; + bap++; + } /* end for */ + } /* end for */ + + ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,barray, 0); + ENVPTR->ReleaseFloatArrayElements(ENVPAR idata,iarr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_floatToByte__II_3F */ + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_doubleToByte__II_3D(JNIEnv *env, jclass clss, jint start, jint len, jdoubleArray idata) /* IN: array of double */ +{ + jdouble *ip; + jdouble *iarr; + int ilen; + jbyteArray rarray; + int blen; + jbyte *barray; + jbyte *bap; + jboolean bb; + int ii; + int ij; + union things { + double ival; + char bytes[8]; + } u; + + if (idata == NULL) { + h5nullArgument( env, "doubleToByte: idata is NULL?"); + return NULL; + } /* end if */ + iarr = ENVPTR->GetDoubleArrayElements(ENVPAR idata,&bb); + if (iarr == NULL) { + h5JNIFatalError( env, "doubleToByte: getDouble failed?"); + return NULL; + } /* end if */ + + ilen = ENVPTR->GetArrayLength(ENVPAR idata); + if ((start < 0) || (((start + len)) > ilen)) { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5badArgument( env, "doubleToByte: start or len is out of bounds"); + return NULL; + } /* end if */ + + ip = iarr + start; + + blen = ilen * (int)sizeof(jdouble); + rarray = ENVPTR->NewByteArray(ENVPAR blen); + if (rarray == NULL) { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5outOfMemory( env, "doubleToByte" ); + return NULL; + } /* end if */ + + barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb); + if (barray == NULL) { + ENVPTR->ReleaseDoubleArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5JNIFatalError( env, "doubleToByte: getByte failed?"); + return NULL; + } /* end if */ + + bap = barray; + for (ii = 0; ii < len; ii++) { + u.ival = *ip++; + for (ij = 0; ij < sizeof(jdouble); ij++) { + *bap = u.bytes[ij]; + bap++; + } /* end for */ + } /* end for */ + + ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,barray, 0); + ENVPTR->ReleaseDoubleArrayElements(ENVPAR idata,iarr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_doubleToByte__II_3D */ + + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_longToByte__II_3J(JNIEnv *env, jclass clss, jint start, jint len, jlongArray idata) /* IN: array of long */ +{ + jlong *ip; + jlong *iarr; + int ilen; + jbyteArray rarray; + int blen; + jbyte *barray; + jbyte *bap; + jboolean bb; + int ii; + int ij; + union things { + jlong ival; + char bytes[8]; + } u; + + if (idata == NULL) { + h5nullArgument( env, "longToByte: idata is NULL?"); + return NULL; + } /* end if */ + iarr = ENVPTR->GetLongArrayElements(ENVPAR idata,&bb); + if (iarr == NULL) { + h5JNIFatalError( env, "longToByte: getLong failed?"); + return NULL; + } /* end if */ + + ilen = ENVPTR->GetArrayLength(ENVPAR idata); + if ((start < 0) || (((start + len)) > ilen)) { + ENVPTR->ReleaseLongArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5badArgument( env, "longToByte: start or len is out of bounds?\n"); + return NULL; + } /* end if */ + + ip = iarr + start; + + blen = ilen * (int)sizeof(jlong); + rarray = ENVPTR->NewByteArray(ENVPAR blen); + if (rarray == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5outOfMemory( env, "longToByte" ); + return NULL; + } /* end if */ + + barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb); + if (barray == NULL) { + ENVPTR->ReleaseLongArrayElements(ENVPAR idata,iarr,JNI_ABORT); + h5JNIFatalError( env, "longToByte: getByte failed?"); + return NULL; + } /* end if */ + + bap = barray; + for (ii = 0; ii < len; ii++) { + u.ival = *ip++; + for (ij = 0; ij < sizeof(jlong); ij++) { + *bap = u.bytes[ij]; + bap++; + } /* end for */ + } /* end for */ + + ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,barray, 0); + ENVPTR->ReleaseLongArrayElements(ENVPAR idata,iarr,JNI_ABORT); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_longToByte__II_3J */ + + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_intToByte__I(JNIEnv *env, jclass clss, jint idata) /* IN: int */ +{ + jbyteArray rarray; + jbyte *barray; + jbyte *bap; + int ij; + jboolean bb; + union things { + int ival; + char bytes[sizeof(int)]; + } u; + + rarray = ENVPTR->NewByteArray(ENVPAR sizeof(jint)); + if (rarray == NULL) { + h5outOfMemory( env, "intToByte" ); + return NULL; + } /* end if */ + + barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb); + if (barray == NULL) { + h5JNIFatalError( env, "intToByte: getByte failed?"); + return NULL; + } /* end if */ + + bap = barray; + u.ival = idata; + for (ij = 0; ij < sizeof(jint); ij++) { + *bap = u.bytes[ij]; + bap++; + } /* end for */ + + ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,barray, 0); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_intToByte__I */ + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_floatToByte__F(JNIEnv *env, jclass clss, jfloat idata) /* IN: int */ +{ + jbyteArray rarray; + jbyte *barray; + jbyte *bap; + jboolean bb; + int ij; + union things { + float ival; + char bytes[sizeof(float)]; + } u; + + rarray = ENVPTR->NewByteArray(ENVPAR sizeof(jfloat)); + if (rarray == NULL) { + h5outOfMemory( env, "floatToByte" ); + return NULL; + } /* end if */ + + barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb); + if (barray == NULL) { + h5JNIFatalError( env, "floatToByte: getByte failed?"); + return NULL; + } /* end if */ + + bap = barray; + u.ival = idata; + for (ij = 0; ij < sizeof(jfloat); ij++) { + *bap = u.bytes[ij]; + bap++; + } /* end for */ + + ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,(jbyte *)barray, 0); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_floatToByte__F */ + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_shortToByte__S(JNIEnv *env, jclass clss, jshort idata) /* IN: short */ +{ + jbyteArray rarray; + jbyte *barray; + jbyte *bap; + jboolean bb; + int ij; + union things { + short ival; + char bytes[sizeof(short)]; + } u; + + rarray = ENVPTR->NewByteArray(ENVPAR sizeof(jshort)); + if (rarray == NULL) { + h5outOfMemory( env, "shortToByte" ); + return NULL; + } /* end if */ + + barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb); + if (barray == NULL) { + h5JNIFatalError( env, "shortToByte: getShort failed?"); + return NULL; + } /* end if */ + + bap = barray; + u.ival = idata; + for (ij = 0; ij < sizeof(jshort); ij++) { + *bap = u.bytes[ij]; + bap++; + } /* end for */ + + ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,(jbyte *)barray, 0); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_shortToByte__S */ + + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_doubleToByte__D(JNIEnv *env, jclass clss, jdouble idata) /* IN: double */ +{ + jbyteArray rarray; + jbyte *barray; + jbyte *bap; + jboolean bb; + int ij; + union things { + double ival; + char bytes[sizeof(double)]; + } u; + + rarray = ENVPTR->NewByteArray(ENVPAR sizeof(jdouble)); + if (rarray == NULL) { + h5outOfMemory( env, "doubleToByte" ); + return NULL; + } /* end if */ + + barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb); + if (barray == NULL) { + h5JNIFatalError( env, "doubleToByte: getDouble failed?"); + return NULL; + } /* end if */ + + bap = barray; + u.ival = idata; + for (ij = 0; ij < sizeof(jdouble); ij++) { + *bap = u.bytes[ij]; + bap++; + } /* end for */ + + ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,(jbyte *)barray, 0); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_doubleToByte__D */ + + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_longToByte__J(JNIEnv *env, jclass clss, jlong idata) /* IN: array of long */ +{ + jbyteArray rarray; + jbyte *barray; + jbyte *bap; + jboolean bb; + int ij; + union things { + jlong ival; + char bytes[sizeof(jlong)]; + } u; + + rarray = ENVPTR->NewByteArray(ENVPAR sizeof(jlong)); + if (rarray == NULL) { + h5outOfMemory( env, "longToByte" ); + return NULL; + } /* end if */ + + barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb); + if (barray == NULL) { + h5JNIFatalError( env, "longToByte: getLong failed?"); + return NULL; + } /* end if */ + + bap = barray; + u.ival = idata; + for (ij = 0; ij < sizeof(jlong); ij++) { + *bap = u.bytes[ij]; + bap++; + } /* end for */ + + ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,(jbyte *)barray, 0); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_longToByte__J */ + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL +Java_hdf_hdf5lib_HDFNativeData_byteToByte__B(JNIEnv *env, jclass clss, jbyte idata) /* IN: array of long */ +{ + jbyteArray rarray; + jbyte *barray; + jbyte *bap; + jboolean bb; + int ij; + union things { + jbyte ival; + char bytes[sizeof(jbyte)]; + } u; + + rarray = ENVPTR->NewByteArray(ENVPAR sizeof(jbyte)); + if (rarray == NULL) { + h5outOfMemory( env, "byteToByte" ); + return NULL; + } /* end if */ + + barray = ENVPTR->GetByteArrayElements(ENVPAR rarray,&bb); + if (barray == NULL) { + h5JNIFatalError( env, "byteToByte: getByte failed?"); + return NULL; + } /* end if */ + + bap = barray; + u.ival = idata; + for (ij = 0; ij < sizeof(jbyte); ij++) { + *bap = u.bytes[ij]; + bap++; + } /* end for */ + + ENVPTR->ReleaseByteArrayElements(ENVPAR rarray,(jbyte *)barray, 0); + + return rarray; +} /* end Java_hdf_hdf5lib_HDFNativeData_byteToByte__B */ + + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/nativeData.h b/java/src/jni/nativeData.h new file mode 100644 index 0000000..1af06b4 --- /dev/null +++ b/java/src/jni/nativeData.h @@ -0,0 +1,115 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_HDFNativeData */ + +#ifndef _Included_hdf_hdf5lib_HDFNativeData +#define _Included_hdf_hdf5lib_HDFNativeData + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + + +/* returns int [] */ +JNIEXPORT jintArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToInt___3B +(JNIEnv *, jclass, jbyteArray); + +/* returns float [] */ +JNIEXPORT jfloatArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToFloat___3B +(JNIEnv *, jclass, jbyteArray); + +/* returns short [] */ +JNIEXPORT jshortArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToShort___3B +(JNIEnv *, jclass, jbyteArray); + +/* returns long [] */ +JNIEXPORT jlongArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToLong___3B +(JNIEnv *, jclass, jbyteArray); + +/* returns double [] */ +JNIEXPORT jdoubleArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToDouble___3B +(JNIEnv *, jclass, jbyteArray); + +/* returns int [] */ +JNIEXPORT jintArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToInt__II_3B +(JNIEnv *, jclass, jint, jint, jbyteArray); + +/* returns short [] */ +JNIEXPORT jshortArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToShort__II_3B +(JNIEnv *, jclass, jint, jint, jbyteArray); + +/* returns float [] */ +JNIEXPORT jfloatArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToFloat__II_3B +(JNIEnv *, jclass, jint, jint, jbyteArray); + +/* returns long [] */ +JNIEXPORT jlongArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToLong__II_3B +(JNIEnv *, jclass, jint, jint, jbyteArray); + +/* returns double [] */ +JNIEXPORT jdoubleArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToDouble__II_3B +(JNIEnv *, jclass, jint, jint, jbyteArray); + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_intToByte__II_3I +(JNIEnv *, jclass, jint, jint, jintArray); + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_shortToByte__II_3S +(JNIEnv *, jclass, jint, jint, jshortArray); + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_floatToByte__II_3F +(JNIEnv *, jclass, jint, jint, jfloatArray); + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_doubleToByte__II_3D +(JNIEnv *, jclass, jint, jint, jdoubleArray); + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_longToByte__II_3J +(JNIEnv *, jclass, jint, jint, jlongArray); + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_intToByte__I +(JNIEnv *, jclass, jint); + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_floatToByte__F +(JNIEnv *, jclass, jfloat); + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_shortToByte__S +(JNIEnv *, jclass, jshort); + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_doubleToByte__D +(JNIEnv *env, jclass, jdouble); + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_longToByte__J +(JNIEnv *, jclass, jlong); + +/* returns byte [] */ +JNIEXPORT jbyteArray JNICALL Java_hdf_hdf5lib_HDFNativeData_byteToByte__B +(JNIEnv *, jclass, jbyte); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_HDFNativeData */ diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt new file mode 100644 index 0000000..2632b18 --- /dev/null +++ b/java/test/CMakeLists.txt @@ -0,0 +1,114 @@ +cmake_minimum_required (VERSION 3.1.0) +PROJECT (HDF5_JAVA_TEST Java) + +set (CMAKE_VERBOSE_MAKEFILE 1) + +INCLUDE_DIRECTORIES ( + ${HDF5_JAVA_JNI_BINARY_DIR} + ${HDF5_JAVA_HDF5_LIB_DIR} +) + +set (HDF5_JAVA_TEST_SRCS + TestH5.java + TestH5E.java + TestH5Edefault.java + TestH5Eregister.java + TestH5Fparams.java + TestH5Fbasic.java + TestH5F.java + TestH5Gbasic.java + TestH5G.java + TestH5Giterate.java + TestH5Sbasic.java + TestH5S.java + TestH5Tparams.java + TestH5Tbasic.java + TestH5T.java + TestH5Dparams.java + TestH5D.java + TestH5Dplist.java + TestH5Lparams.java + TestH5Lbasic.java + TestH5Lcreate.java + TestH5R.java + TestH5P.java + TestH5PData.java + TestH5Pfapl.java + TestH5Pvirtual.java + TestH5Plist.java + TestH5A.java + TestH5Oparams.java + TestH5Obasic.java + TestH5Ocreate.java + TestH5Ocopy.java + TestH5PL.java + TestH5Z.java + TestAll.java +) + +file (WRITE ${PROJECT_BINARY_DIR}/Manifest.txt +"Main-Class: test.TestAll +" +) + +set (CMAKE_JAVA_INCLUDE_PATH "${HDF5_JAVA_LIB_DIR}/junit.jar;${HDF5_JAVA_LIB_DIR}/hamcrest-core.jar;${HDF5_JAVA_JARS};${HDF5_JAVA_LOGGING_JAR};${HDF5_JAVA_LOGGING_SIMPLE_JAR}") + +add_jar (${HDF5_JAVA_TEST_LIB_TARGET} MANIFEST ${PROJECT_BINARY_DIR}/Manifest.txt ${HDF5_JAVA_TEST_SRCS}) + +get_target_property (${HDF5_JAVA_TEST_LIB_TARGET}_JAR_FILE ${HDF5_JAVA_TEST_LIB_TARGET} JAR_FILE) +#install_jar (${HDF5_JAVA_TEST_LIB_TARGET} ${HJAVA_INSTALL_DATA_DIR}/tests tests) +#get_target_property (${HDF5_JAVA_TEST_LIB_TARGET}_CLASSPATH ${HDF5_JAVA_TEST_LIB_TARGET} CLASSDIR) + +add_dependencies (${HDF5_JAVA_TEST_LIB_TARGET} ${HDF5_JAVA_HDF5_LIB_TARGET}) +set_target_properties (${HDF5_JAVA_TEST_LIB_TARGET} PROPERTIES FOLDER test/java) + +set (HDF_JAVA_TEST_FILES + h5ex_g_iterate.hdf + JUnit-interface.txt +) + +foreach (h5_file ${HDF_JAVA_TEST_FILES}) + set (dest "${PROJECT_BINARY_DIR}/${h5_file}") + #message (STATUS " Copying ${h5_file}") + add_custom_command ( + TARGET ${HDF5_JAVA_TEST_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/${h5_file} ${dest} + ) +endforeach (h5_file ${HDF_JAVA_TEST_FILES}) + +if (WIN32) + set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") +else (WIN32) + set (CMAKE_JAVA_INCLUDE_FLAG_SEP ":") +endif (WIN32) + +set (CMAKE_JAVA_CLASSPATH ".") +foreach (CMAKE_INCLUDE_PATH ${CMAKE_JAVA_INCLUDE_PATH}) + set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${CMAKE_INCLUDE_PATH}") +endforeach (CMAKE_INCLUDE_PATH) +set (CMAKE_JAVA_CLASSPATH "${CMAKE_JAVA_CLASSPATH}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${${HDF5_JAVA_TEST_LIB_TARGET}_JAR_FILE}") +set (testfilter "OK (598 tests)") + +if (CMAKE_BUILD_TYPE MATCHES Debug) + set (CMD_ARGS "-Dhdf.hdf5lib.H5.loadLibraryName=hdf5_java_debug;") +endif(CMAKE_BUILD_TYPE MATCHES Debug) + +add_test ( + NAME JUnit-interface + COMMAND "${CMAKE_COMMAND}" + -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" + -D "TEST_CLASSPATH:STRING=${CMAKE_JAVA_CLASSPATH}" + -D "TEST_ARGS:STRING=${CMD_ARGS}-ea;org.junit.runner.JUnitCore" + -D "TEST_PROGRAM=test.TestAll" + -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" + -D "TEST_FOLDER=${HDF5_BINARY_DIR}/java/test" + -D "TEST_OUTPUT=JUnit-interface.out" +# -D "TEST_LOG_LEVEL=trace" + -D "TEST_EXPECT=0" + -D "TEST_MASK_ERROR=TRUE" + -D "TEST_FILTER:STRING=${testfilter}" + -D "TEST_REFERENCE=JUnit-interface.txt" + -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" +) diff --git a/java/test/JUnit-interface.txt b/java/test/JUnit-interface.txt new file mode 100644 index 0000000..f065dd4 --- /dev/null +++ b/java/test/JUnit-interface.txt @@ -0,0 +1,652 @@ +JUnit version 4.11 +.testJ2C +.testIsSerializable +.testH5garbage_collect +.testH5error_off +.serializeToDisk +.testH5open +.testH5check_version +.testH5get_libversion +.testH5set_free_list_limits +.testH5Eregister_class_lib_name_null +.testH5Eregister_class_version_null +.testH5Eunregister_class_invalid_classid +.testH5Eregister_class +.testH5Eregister_class_cls_name_null +.testH5EprintInt +.testH5Eset_current_stack_invalid_stkid +.testH5Eset_current_stack +.testH5Eget_num +.testH5Eclear +.testH5Eprint +.testH5Epush_null_name +.testH5Eget_num_with_msg +.testH5Eclear2_with_msg +.testH5Epush_invalid_stkid +.testH5Eget_current_stack +.testH5Ecreate_stack +.testH5Eget_msg_invalid_msgid +.testH5Eauto_is_v2 +.testH5EclearInt +.testH5Eauto_is_v2_invalid_stkid +.testH5Eclose_msg_invalid_errid +.testH5Eclose_stack_invalid_stackid +.testH5Eget_class_name_invalid_classname +.testH5Eget_num_invalid_stkid +.testH5EprintInt_invalid_classid +.testH5Epop +.testH5Epop_invalid_stkid +.testH5Eget_current_stack_pop +.testH5Eget_class_name_invalid_classid +.testH5Ecreate_msg_invalid_errid +.testH5Eclear2_invalid_stkid +.testH5Eprint2_invalid_classid +.testH5EprintInt +.testH5Eget_msg_major +.testH5Eget_msg_minor +.testH5Eget_msg +.testH5Eget_num +.testH5Epush +.testH5Ewalk +.testH5Eget_class_name +.testH5Eget_num_with_msg +.testH5Eclear2 +.testH5Eprint2 +.testH5Ecreate_msg_major +.testH5Ecreate_msg_minor +.testH5Ecreate_stack +.testH5Ecreate_msg_name_null +.testH5Eauto_is_v2 +.testH5EclearInt +.testH5Epop +.testH5Fcreate_null +.testH5Fflush_local +.testH5Fget_info +.testH5Fmount_null +.testH5Fcreate +.testH5Fflush_global +.testH5Funmount_null +.testH5Fclose_negative +.testH5Fopen_null +.testH5Fis_hdf5_null +.testH5Fis_hdf5_text +.testH5Fget_mdc_size +.testH5Fget_mdc_hit_rate +.testH5Fis_hdf5 +.testH5Fget_freespace +.testH5Fclose +.testH5Fget_filesize +.testH5Fcreate_EXCL +.testH5Freopen_closed +.testH5Freset_mdc_hit_rate_stats +.testH5Fget_name +.testH5Fcreate +.testH5Fclear_elink_file_cache +.testH5Fclose_twice +.testH5Freopen +.testH5Fopen_read_only +.testH5Fget_access_plist +.testH5Fget_obj_ids +.testH5Fget_intent_rdwr +.testH5Fget_access_plist_closed +.testH5Fget_create_plist_closed +.testH5Fget_intent_rdonly +.testH5Fget_create_plist +.testH5Fget_obj_count +.testH5Gget_info_by_name_not_exists +.testH5Gget_info_by_idx_not_exists +.testH5Gget_info_by_name +.testH5Gget_create_plist +.testH5Gopen +.testH5Gget_info_by_idx_null +.testH5Gopen_not_exists +.testH5Gclose +.testH5Gcreate_anon +.testH5Gcreate_null +.testH5Gget_info_by_idx_fileid +.testH5Gclose_invalid +.testH5Gopen_invalid +.testH5Gget_info_invalid +.testH5Gcreate_invalid +.testH5Gcreate_exists +.testH5Gget_info_by_name_null +.testH5Gget_info_by_name_invalid +.testH5Gget_create_plist_invalid +.testH5Gcreate +.testH5Gget_info_by_name_fileid +.testH5Gget_info_by_idx_invalid +.testH5Gopen_null +.testH5Gget_info_by_idx +.testH5Gget_info +.testH5Gget_info_by_name +.testH5Gget_create_plist +.testH5Gopen +.testH5Gget_obj_info_all_gid2 +.testH5Gget_obj_info_all_byIndexType +.testH5Gget_obj_info_max_limit +.testH5Gget_obj_info_all +.testH5Gget_obj_info_max +.testH5Gget_obj_info_all_gid +.testH5Gget_info_by_idx +.testH5Gget_info +.testH5Gget_obj_info_all +.testH5Sclose_invalid +.testH5Screate_simple_max_default +.testH5Screate_simple_dims_null +.testH5Sdecode_null +.testH5Screate_simple_dims_exceed +.testH5Screate_simple_unlimted_1d +.testH5Screate_simple_dims_invalid +.testH5Screate_scalar +.testH5Screate_simple +.testH5Screate_simple_rank_invalid +.testH5Sget_simple_extent_type_invalid +.testH5Sencode_invalid +.testH5Screate_null +.testH5Screate_simple_extent +.testH5Screate_invalid +.testH5Screate_simple_unlimted +.testH5Sget_select_npoints +.testH5Sget_select_type +.testH5Sset_extent_simple +.testH5Sget_select_hyper +.testH5Sget_select_valid +.testH5Sget_select_elem_pointlist +.testH5Sset_extent_none +.testH5Sencode_decode_scalar_dataspace +.testH5Soffset_simple +.testH5Scopy +.testH5Sget_simple_extent_ndims +.testH5Sextent_equal +.testH5Sget_simple_extent_dims +.testH5Sget_simple_extent_type +.testH5Shyper_regular +.testH5Sget_select_bounds +.testH5Sget_select_elem_pointlist_invalid +.testH5Sget_simple_extent_npoints +.testH5Sextent_copy +.testH5Sencode_decode_null_dataspace +.testH5Sis_simple +.testH5Sget_simple_extent_dims_null +.testH5Sselect_none +.testH5Tget_member_type_invalid +.testH5Tenum_insert_null +.testH5Tget_offset_invalid +.testH5Tset_precision_invalid +.testH5Tget_inpad_invalid +.testH5Tenum_nameof_invalid +.testH5Tget_member_value_invalid +.testH5Tenum_nameof_value_null +.testH5Tcreate_invalid +.testH5Tget_strpad_invalid +.testH5Tenum_valueof_invalid +.testH5Tget_fields_null +.testH5Topen_null +.testH5Tpack_invalid +.testH5Tcommit_null +.testH5Tinsert_invalid +.testH5Tenum_valueof_null +.testH5Tset_norm_invalid +.testH5Tlock_invalid +.testH5Tarray_create_invalid +.testH5Tget_member_value_null +.testH5Tset_offset_invalid +.testH5Tget_fields_invalid +.testH5Tequal_invalid +.testH5Tget_ebias_long_invalid +.testH5Tget_cset_invalid +.testH5Tget_size_invalid +.testH5Tset_strpad_invalid +.testH5Tset_ebias_invalid +.testH5Tget_sign_invalid +.testH5Tget_member_index_invalid +.testH5Tget_precision_invalid +.testH5Tset_fields_invalid +.testH5Tcopy_invalid +.testH5Tget_pad_invalid +.testH5Tset_order_invalid +.testH5Tget_member_class_invalid +.testH5Tget_super_invalid +.testH5Tget_class_invalid +.testH5Topen_invalid +.testH5Tget_precision_long_invalid +.testH5Tget_ebias_invalid +.testH5Tget_native_type_invalid +.testH5Tget_fields_length_invalid +.testH5Tget_norm_invalid +.testH5Tenum_nameof_invalid_size +.testH5Tset_pad_invalid +.testH5Tget_pad_null +.testH5Tset_tag_null +.testH5Tget_order_invalid +.testH5Tcommit_invalid +.testH5Tget_array_ndims_invalid +.testH5Tset_tag_invalid +.testH5Tvlen_create_invalid +.testH5Tenum_create_invalid +.testH5Tinsert_null +.testH5Tset_inpad_invalid +.testH5Tenum_valueof_name_null +.testH5Tset_cset_invalid +.testH5Tclose_invalid +.testH5Tget_nmembers_invalid +.testH5Tarray_create_value_null +.testH5Tset_size_invalid +.testH5Tenum_insert_invalid +.testH5Tget_array_dims_null +.testH5Tget_member_index_null +.testH5Tset_sign_invalid +.testH5Tenum_insert_name_null +.testH5Tequal_not +.testH5Tcopy +.testH5Tequal +.testH5Torder_size +.testH5Tconvert +.testH5Tvlen_create +.testH5Tenum_create_functions +.testH5Tenum_functions +.testH5Tget_class +.testH5Tget_array_ndims +.testH5Tequal_type_error +.testH5Tget_array_dims +.testH5Tset_size +.testH5Tis_variable_str +.testH5Tcompound_functions +.testH5Tget_size +.testH5Tarray_create +.testH5Topaque_functions +.testH5Dget_space_status_invalid +.testH5Dget_access_plist_invalid +.testH5Dget_type_invalid +.testH5Dget_create_plist_invalid +.testH5Dget_offset_invalid +.testH5Dvlen_get_buf_size_invalid +.testH5Dcreate_null +.testH5Dset_extent_status_null +.testH5Dvlen_reclaim_null +.testH5Dcreate_invalid +.testH5Dcreate_anon_invalid +.testH5Dset_extent_status_invalid +.testH5Dvlen_reclaim_invalid +.testH5Dopen_invalid +.testH5Dclose_invalid +.testH5Dget_storage_size_invalid +.testH5Dget_space_invalid +.testH5Dopen_null +.testH5Dget_storage_size +.testH5Diterate_write +.testH5Dcreate +.testH5Dget_offset +.testH5Dget_type +.testH5Dfill +.testH5Dopen +.testH5Dcreate_anon +.testH5Dfill_null +.testH5Dget_storage_size_empty +.testH5Diterate +.testH5Dget_access_plist +.testH5Dvlen_read_invalid_buffer +.testH5Dvlen_get_buf_size +.testH5Dget_space_closed +.testH5Dget_space_status +.testH5Dvlen_write_read +.testH5Dget_space +.testH5Dget_type_closed +.testH5Dset_extent +.testH5Lcopy_invalid +.testH5Lget_value_by_idx_null +.testH5Lcreate_external_invalid +.testH5Lexists_null +.testH5Lget_info_invalid +.testH5Lget_name_by_idx_invalid +.testH5Lmove_null_current +.testH5Literate_by_name_nullname +.testH5Lvisit_by_name_nullname +.testH5Lvisit_null +.testH5Lget_name_by_idx_null +.testH5Lcreate_hard_null_dest +.testH5Lget_value_null +.testH5Lcreate_external_null_dest +.testH5Lcreate_external_null_file +.testH5Lcreate_external_null_current +.testH5Ldelete_null +.testH5Lexists_invalid +.testH5Lmove_invalid +.testH5Lcreate_hard_invalid +.testH5Lcopy_null_dest +.testH5Lcreate_soft_null_current +.testH5Lcopy_null_current +.testH5Lget_info_by_idx_null +.testH5Literate_null +.testH5Ldelete_invalid +.testH5Lvisit_by_name_null +.testH5Ldelete_by_idx_invalid +.testH5Lget_info_by_idx_invalid +.testH5Ldelete_by_idx_null +.testH5Lcreate_soft_invalid +.testH5Lcreate_hard_null_current +.testH5Lget_value_by_idx_invalid +.testH5Lmove_null_dest +.testH5Lget_info_null +.testH5Literate_by_name_null +.testH5Lcreate_soft_null_dest +.testH5Lget_value_invalid +.testH5Lget_info_by_idx_not_exist_name +.testH5Lget_name_by_idx_not_exist +.testH5Lvisit +.testH5Lget_name_by_idx_n0 +.testH5Lget_name_by_idx_n3 +.testH5Lvisit_by_name +.testH5Literate_by_name +.testH5Lget_info_hardlink +.testH5Literate +.testH5Lget_info_by_idx_n0 +.testH5Lget_info_by_idx_n3 +.testH5Lget_info_by_idx_name_not_exist_create +.testH5Lexists +.testH5Lget_info_by_idx_name_not_exist_name +.testH5Lget_info_by_idx_not_exist_create +.testH5Lget_info_not_exist +.testH5Lget_info_dataset +.testH5Lget_info_by_idx_n0_create +.testH5Ldelete_soft_link_dangle +.testH5Lget_value_by_idx_external_create +.testH5Ldelete_by_idx_not_exist_create +.testH5Lvisit_create +.testH5Lmove_dst_link_exists +.testH5Lcreate_soft_dangle +.testH5Literate_create +.testH5Lcopy_cur_not_exists +.testH5Lcopy +.testH5Lmove +.testH5Lget_value_by_idx_n2_create +.testH5Lget_value_soft +.testH5Ldelete_by_idx_n2_name +.testH5Lget_info_by_idx_n1_create +.testH5Lcreate_external +.testH5Lget_value_dangle +.testH5Lcreate_hard_dst_link_exists +.testH5Lget_value_by_idx_n2_name +.testH5Lcreate_soft_dst_link_exists +.testH5Lcreate_hard +.testH5Lcreate_soft +.testH5Lmove_cur_not_exists +.testH5Lcreate_hard_cur_not_exists +.testH5Lget_info_softlink_dangle +.testH5Ldelete_by_idx_n2_create +.testH5Ldelete_soft_link +.testH5Lget_info_externallink +.testH5Lcopy_dst_link_exists +.testH5Lget_value_by_idx_external_name +.testH5Ldelete_by_idx_not_exist_name +.testH5Lget_info_softlink +.testH5Lget_value_external +.testH5Lget_value_by_idx_not_exist_create +.testH5Lget_value_by_idx_not_exist_name +.testH5Ldelete_hard_link +.testH5Rgetregion_Nullreference +.testH5Rget_obj_type2_Invalidreftype +.testH5Rdereference +.testH5Rget_name +.testH5Rcreate_Invalidreftype +.testH5Rget_name_NULLreference +.testH5Rget_region +.testH5Rdereference_Nullreference +.testH5Rcreate_refobj +.testH5Rcreate_Invalidspace_id +.testH5Rdereference_Invalidreference +.testH5Rgetregion_Badreferencetype +.testH5Rcreate_regionrefobj +.testH5Rget_name_Invalidreftype +.testH5Rgetregion_Invalidreftype +.testH5Rget_obj_type2 +.testH5Rcreate_InvalidObjectName +.testH5Pset_nbit +.testH5Pset_shared_mesg_index_InvalidFlag +.testH5Pset_shared_mesg_phase_change +.testH5PH5Pset_shared_mesg_phase_change_HighMaxlistValue +.testH5P_layout +.testH5Pget_link_creation_order +.testH5Pset_shared_mesg_nindexes_InvalidHIGHnindexes +.testH5Pget_shared_mesg_index_Invalid_indexnum +.testH5Pset_data_transform_NullExpression +.testH5Pset_elink_prefix_null +.testH5Pget_elink_prefix +.testH5Pget_nlinks +.testH5Pset_libver_bounds_invalidhigh +.testH5Pget_char_encoding +.testH5P_istore_k +.testH5Pget_link_phase_change +.testH5Pset_link_phase_change_max_compactLESSTHANmin_dense +.testH5Pget_shared_mesg_phase_change_EqualsSET +.testH5Pset_scaleoffset_Invalidscale_type +.testH5Pget_istore_k_null +.testH5Pset_libver_bounds_invalidlow +.testH5Pset_est_link_info +.testH5Pget_link_phase_change_Null +.testH5P_fill_time +.testH5Pget_userblock_null +.testH5Pset_link_creation_order_tracked +.testH5Pset_shared_mesg_index +.testH5Pset_copy_object +.testH5Pset_link_creation_order_trackedPLUSindexed +.testH5Pset_copy_object_invalidobject +.testH5Pset_est_link_info_InvalidValues +.testH5P_file_space +.testH5Pset_local_heap_size_hint +.testH5Pget_est_link_info +.testH5Pset_scaleoffset +.testH5Pset_create_intermediate_group_invalidobject +.testH5PH5Pset_shared_mesg_phase_change_HighMinbtreeValue +.testH5Pset_create_intermediate_group +.testH5P_alloc_time +.testH5Pset_elink_acc_flags +.testH5Pset_link_phase_change_Highmax_Compact +.testH5P_chunk +.testH5P_sizes +.testH5Pset_link_creation_order_invalidvalue +.testH5P_sym_k +.testH5PH5Pset_shared_mesg_phase_change_MinbtreeGreaterThanMaxlist +.testH5Pget_version_null +.testH5Pset_scaleoffset_Invalidscale_factor +.testH5Pget_elink_prefix_null +.testH5Pget_data_transform_IllegalSize +.testH5Pget_create_intermediate_group +.testH5Pset_shared_mesg_nindexes +.testH5Pset_attr_creation_order_trackedPLUSindexed +.testH5Pget_sym_k_null +.testH5Pset_nlinks +.testH5P_obj_track_times +.testH5P_userblock +.testH5Pget_local_heap_size_hint +.testH5Pset_shared_mesg_index_Invalid_indexnum +.testH5Pset_data_transform_InvalidExpression1 +.testH5Pset_data_transform_InvalidExpression2 +.testH5Pget_attr_phase_change +.testH5Pget_data_transform +.testH5Pget_create_intermediate_group_notcreated +.testH5Pset_elink_prefix +.testH5Pget_attr_creation_order +.testH5Pset_attr_creation_order_invalidvalue +.testH5Pget_shared_mesg_phase_change +.testH5Pget_shared_mesg_index +.testH5Pset_link_phase_change +.testH5Pget_shared_mesg_nindexes +.testH5Pget_version +.testH5Pset_elink_acc_flags_InvalidFlag1 +.testH5Pset_elink_acc_flags_InvalidFlag2 +.testH5Pget_link_phase_change_EqualsSet +.testH5Pget_elink_acc_flags +.testH5Pget_data_transform_ExpressionNotSet +.testH5P_fill_value +.testH5Pget_sizes_null +.testH5Pset_data_transform +.testH5Pset_attr_creation_order_tracked +.testH5P_buffer +.testH5Pdata_transform +.testH5P_elink_fapl +.testH5P_fapl_direct +.testH5P_alignment +.testH5P_fapl_family +.testH5P_chunk_cache +.testH5P_meta_block_size +.testH5Pget_elink_fapl +.testH5Pset_mdc_config +.testH5P_small_data_block_size +.testH5Pset_fapl_log +.testH5Pset_libver_bounds +.testH5P_sieve_buf_size +.testH5P_elink_file_cache_size +.testH5P_cache +.testH5Pget_mdc_config +.testH5P_fapl_muti_defaults +.testH5Pget_libver_bounds +.testH5P_btree_ratios +.testH5P_fapl_muti_nulls +.testH5Pset_fapl_sec2 +.testH5Pmulti_transform +.testH5Pset_elink_fapl_NegativeID +.testH5Pset_fapl_stdio +.testH5P_edc_check +.testH5Pset_elink_fapl +.testH5P_hyper_vector_size +.testH5P_gc_references +.testH5P_family_offset +.testH5P_fapl_core +.testH5P_fapl_muti +.testH5P_fapl_split +.testH5Pset_fapl_windows +.testH5P_fclose_degree +.testH5Pget_source_datasetname +.testH5Pvirtual_storage +.testH5Pget_selection_source_dataset +.testH5Pget_source_filename +.testH5Pget_virtual_count +.testH5Pset_get_virtual_view +.testH5Pget_mapping_parameters +.testH5P_genprop_basic_class +.testH5P_genprop_class_iter +.testH5P_genprop_basic_class_prop +.testH5P_genprop_basic_list_prop +.testH5Acreate2_nullname +.testH5Acreate_by_name +.testH5Aget_name_by_idx +.testH5Aget_storage_size +.testH5Aiterate +.testH5Aopen_by_idx +.testH5Aopen_invalidname +.testH5Aopen +.testH5Aget_info_by_name +.testH5Aget_create_plist +.testH5Adelete_by_name +.testH5Aopen_by_name +.testH5Aget_info +.testH5Aget_name +.testH5Aexists +.testH5Aget_info_by_idx +.testH5Arename +.testH5Adelete_by_idx_name1 +.testH5Adelete_by_idx_name2 +.testH5Adelete_by_idx_order +.testH5Arename_by_name +.testH5Acreate2_invalidobject +.testH5Acreate2 +.testH5Aiterate_by_name +.testH5Adelete_by_idx_null +.testH5Adelete_by_idx_invalidobject +.testH5Awrite_readVL +.testH5Aget_info1 +.testH5Oget_comment_by_name_null +.testH5Ovisit_by_name_nullname +.testH5Oget_info_invalid +.testH5Ovisit_by_name_null +.testH5Oget_comment_invalid +.testH5Oset_comment_by_name_invalid +.testH5Oopen_null +.testH5Oclose_invalid +.testH5Oget_comment_by_name_invalid +.testH5Ocopy_null_dest +.testH5Olink_invalid +.testH5Oget_info_by_idx_invalid +.testH5Oget_info_by_idx_null +.testH5Olink_null_dest +.testH5Oget_info_by_name_invalid +.testH5Oget_info_by_name_null +.testH5Ocopy_invalid +.testH5Oset_comment_by_name_null +.testH5Ocopy_null_current +.testH5Oset_comment_invalid +.testH5Oopen_invalid +.testH5Ovisit_null +.testH5Oexists_by_name +.testH5Oget_info_by_idx_n0 +.testH5Oget_info_by_idx_n3 +.testH5Oget_info_by_name_not_exist_name +.testH5Ovisit_by_name +.testH5Oget_info_by_idx_name_not_exist_name +.testH5Oget_info_datatype +.testH5Oget_info_by_idx_not_exist_name +.testH5Oopen_by_idx_n0 +.testH5Oopen_by_idx_n3 +.testH5Oopen_not_exists +.testH5Ovisit +.testH5Oget_info_by_idx_not_exist_create +.testH5Oget_info_by_name_hardlink +.testH5Oget_info_by_name_group +.testH5Oopen_by_addr +.testH5Oget_info_by_name_not_exists +.testH5Oget_info_by_name_dataset +.testH5Oget_info_group +.testH5Oget_info_by_name_datatype +.testH5Oget_info_hardlink +.testH5Oget_info_by_idx_name_not_exist_create +.testH5Oget_info_dataset +.testH5OcopyRefsDatasettosameFile +.testH5OcopyRefsDatasettodiffFile +.testH5OcopyRefsAttr +.testH5Oget_info_by_idx_n0_create +.testH5Oget_info_softlink_dangle +.testH5Oget_info_softlink +.testH5Oget_info_externallink +.testH5Ocopy +.testH5Olink +.testH5Ocomment_by_name +.testH5Oget_info_by_idx_n1_create +.testH5Ocomment +.testH5Oinc_dec_count +.testH5Ocomment_by_name_clear +.testH5Ovisit_create +.testH5Ocopy_dst_link_exists +.testH5Ocomment_clear +.testH5Ocopy_cur_not_exists +.TestH5PLplugins +.testH5Zfilter_avail +.testH5Zunregister_predefined +.testH5Zget_filter_info + +Time: XXXX + +OK (624 tests) + +HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): + #000: (file name) line (number) in H5Fopen(): can't set access and transfer property lists + major: File accessibilty + minor: Can't set value + #001: (file name) line (number) in H5P_verify_apl_and_dxpl(): not the required access property list + major: Property lists + minor: Inappropriate type + #002: (file name) line (number) in H5P_isa_class(): not a property list + major: Invalid arguments to routine + minor: Inappropriate type +HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): + #000: (file name) line (number) in H5Fopen(): can't set access and transfer property lists + major: File accessibilty + minor: Can't set value + #001: (file name) line (number) in H5P_verify_apl_and_dxpl(): not the required access property list + major: Property lists + minor: Inappropriate type + #002: (file name) line (number) in H5P_isa_class(): not a property list + major: Invalid arguments to routine + minor: Inappropriate type +[main] INFO hdf.hdf5lib.H5 - HDF5 library: hdf5_java +[main] INFO hdf.hdf5lib.H5 - successfully loaded from java.library.path diff --git a/java/test/Makefile.am b/java/test/Makefile.am new file mode 100644 index 0000000..1cb41df --- /dev/null +++ b/java/test/Makefile.am @@ -0,0 +1,103 @@ +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +## +## Makefile.am +## Run automake to generate a Makefile.in from this file. +## +# +# HDF5 Java native interface (JNI) Library Test Makefile(.in) + +include $(top_srcdir)/config/commence.am + +# Mark this directory as part of the JNI API +JAVA_API=yes + +JAVAROOT = .classes + +classes: + $(MKDIR_P) $(@D)/$(JAVAROOT) + +pkgpath = test +hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar +jarfile = jar$(PACKAGE_TARNAME)test.jar + +CLASSPATH_ENV=CLASSPATH=.:$(JAVAROOT):$(top_builddir)/java/src/$(hdfjarfile):$(top_srcdir)/java/lib/junit.jar:$(top_srcdir)/java/lib/hamcrest-core.jar:$(top_srcdir)/java/lib/slf4j-api-1.7.5.jar:$(top_srcdir)/java/lib/ext/slf4j-simple-1.7.5.jar:$$CLASSPATH +AM_JAVACFLAGS = $(H5_JAVACFLAGS) -deprecation + +noinst_JAVA = \ + TestH5.java \ + TestH5E.java \ + TestH5Edefault.java \ + TestH5Eregister.java \ + TestH5Fparams.java \ + TestH5Fbasic.java \ + TestH5F.java \ + TestH5Gbasic.java \ + TestH5G.java \ + TestH5Giterate.java \ + TestH5Sbasic.java \ + TestH5S.java \ + TestH5Tparams.java \ + TestH5Tbasic.java \ + TestH5T.java \ + TestH5Dparams.java \ + TestH5D.java \ + TestH5Dplist.java \ + TestH5Lparams.java \ + TestH5Lbasic.java \ + TestH5Lcreate.java \ + TestH5R.java \ + TestH5P.java \ + TestH5PData.java \ + TestH5Pfapl.java \ + TestH5Pvirtual.java \ + TestH5Plist.java \ + TestH5A.java \ + TestH5Oparams.java \ + TestH5Obasic.java \ + TestH5Ocreate.java \ + TestH5Ocopy.java \ + TestH5PL.java \ + TestH5Z.java \ + TestAll.java + +$(jarfile): classnoinst.stamp classes + $(JAR) cvf $@ -C $(JAVAROOT)/ $(pkgpath) + +noinst_DATA = $(jarfile) + +.PHONY: classes + +check_SCRIPTS = junit.sh +TEST_SCRIPT = $(check_SCRIPTS) + +CLEANFILES = classnoinst.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class junit.sh + +#JAVA_JUNIT = $(JAVA_SRCS) +#noinst_JAVA = @JAVA_JUNIT@ +#EXTRA_JAVA = $(JAVA_JUNIT) +TESTS_JUNIT = AllJunitTests +#EXTRA_TEST = $(TESTS_JUNIT) + +AllJunitTests : + echo "#! /bin/sh" > $@ + echo "exec @JUNIT@ test.TestAll" >> $@ + chmod +x $@ + +clean: + rm -rf $(JAVAROOT) + rm -f $(jarfile) + rm -f classnoinst.stamp + +include $(top_srcdir)/config/conclude.am diff --git a/java/test/TestAll.java b/java/test/TestAll.java new file mode 100644 index 0000000..e3abe21 --- /dev/null +++ b/java/test/TestAll.java @@ -0,0 +1,40 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +@RunWith(Suite.class) +@Suite.SuiteClasses( { TestH5.class, + TestH5Eregister.class, + TestH5Edefault.class, + TestH5E.class, + TestH5Fparams.class, TestH5Fbasic.class, TestH5F.class, + TestH5Gbasic.class, TestH5G.class, TestH5Giterate.class, + TestH5Sbasic.class, TestH5S.class, + TestH5Tparams.class, TestH5Tbasic.class, TestH5T.class, + TestH5Dparams.class, TestH5D.class, TestH5Dplist.class, + TestH5Lparams.class, TestH5Lbasic.class, TestH5Lcreate.class, + TestH5R.class, + TestH5P.class, TestH5PData.class, TestH5Pfapl.class, TestH5Pvirtual.class, TestH5Plist.class, + TestH5A.class, + TestH5Oparams.class, TestH5Obasic.class, TestH5Ocopy.class, TestH5Ocreate.class, + TestH5PL.class, TestH5Z.class +}) + +public class TestAll { +} diff --git a/java/test/TestH5.java b/java/test/TestH5.java new file mode 100644 index 0000000..1a78bea --- /dev/null +++ b/java/test/TestH5.java @@ -0,0 +1,257 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +/** + * @author xcao + * + */ +public class TestH5 { + @Rule public TestName testname = new TestName(); + @Before + public void showTestName() { + System.out.print(testname.getMethodName()); + } + @After + public void nextTestName() { + System.out.println(); + } + + /** + * Test method for {@link hdf.hdf5lib.H5#J2C(int)}. + * NOTE: + * H5F_ACC_DEBUG no longer prints any special debug info. The symbol is + * being retained and will be listed as deprecated in HDF5 1.10.0. + */ + @Test + public void testJ2C() { + int H5F_ACC_RDONLY = 0x0000; + int H5F_ACC_RDWR = 0x0001; + int H5F_ACC_TRUNC = 0x0002; + int H5F_ACC_EXCL = 0x0004; + int H5F_ACC_DEBUG = 0x0000; // HDFFV-1074 was 0x0008; + int H5F_ACC_CREAT = 0x0010; + int H5F_OBJ_FILE = 0x0001; + int H5F_OBJ_DATASET = 0x0002; + int H5F_OBJ_GROUP = 0x0004; + int H5F_OBJ_DATATYPE = 0x0008; + int H5F_OBJ_ATTR = 0x0010; + int H5F_OBJ_ALL = H5F_OBJ_FILE | H5F_OBJ_DATASET | H5F_OBJ_GROUP + | H5F_OBJ_DATATYPE | H5F_OBJ_ATTR; + int H5F_OBJ_LOCAL = 0x0020; + + int definedValues[] = { H5F_ACC_RDONLY, H5F_ACC_RDWR, H5F_ACC_TRUNC, + H5F_ACC_EXCL, H5F_ACC_DEBUG, H5F_ACC_CREAT, H5F_OBJ_FILE, + H5F_OBJ_DATASET, H5F_OBJ_GROUP, H5F_OBJ_DATATYPE, H5F_OBJ_ATTR, + H5F_OBJ_ALL, H5F_OBJ_LOCAL }; + + int j2cValues[] = { HDF5Constants.H5F_ACC_RDONLY, + HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5F_ACC_EXCL, H5F_ACC_DEBUG, + HDF5Constants.H5F_ACC_CREAT, HDF5Constants.H5F_OBJ_FILE, + HDF5Constants.H5F_OBJ_DATASET, HDF5Constants.H5F_OBJ_GROUP, + HDF5Constants.H5F_OBJ_DATATYPE, HDF5Constants.H5F_OBJ_ATTR, + HDF5Constants.H5F_OBJ_ALL, HDF5Constants.H5F_OBJ_LOCAL }; + + for (int i = 0; i < definedValues.length; i++) { + assertEquals(definedValues[i], j2cValues[i]); + } + + assertFalse(H5F_ACC_RDONLY == HDF5Constants.H5F_ACC_RDWR); + assertFalse(H5F_OBJ_FILE == HDF5Constants.H5F_OBJ_GROUP); + } + + /** + * Test method for {@link hdf.hdf5lib.H5#H5error_off()}. + */ + @Test + public void testH5error_off() { + try { + H5.H5error_off(); + } + catch (Throwable err) { + fail("H5.H5error_off failed: " + err); + } + } + + /** + * Test method for {@link hdf.hdf5lib.H5#H5open()}. + */ + @Test + public void testH5open() { + try { + H5.H5open(); + } + catch (Throwable err) { + fail("H5.H5open failed: " + err); + } + } + + /** + * Test method for {@link hdf.hdf5lib.H5#H5garbage_collect()}. + */ + @Test + public void testH5garbage_collect() { + try { + H5.H5garbage_collect(); + } + catch (Throwable err) { + fail("H5.H5garbage_collect failed: " + err); + } + } + + /** + * Test method for + * {@link hdf.hdf5lib.H5#H5set_free_list_limits(int, int, int, int, int, int)} + * . + */ + @Test + public void testH5set_free_list_limits() { + int reg_global_lim = 1; + int reg_list_lim = 1; + int arr_global_lim = 1; + int arr_list_lim = 1; + int blk_global_lim = 1; + int blk_list_lim = 1; + + try { + H5.H5set_free_list_limits(reg_global_lim, reg_list_lim, + arr_global_lim, arr_list_lim, blk_global_lim, blk_list_lim); + } + catch (Throwable err) { + fail("H5.H5set_free_list_limits failed: " + err); + } + } + + /** + * Test method for {@link hdf.hdf5lib.H5#H5get_libversion(int[])}. + */ + @Test + public void testH5get_libversion() { + int libversion[] = { 1, 9, 0 }; + + try { + H5.H5get_libversion(libversion); + } + catch (Throwable err) { + fail("H5.H5get_libversion: " + err); + } + + for (int i = 0; i < 2; i++) + assertEquals(H5.LIB_VERSION[i], libversion[i]); + + for (int i = 0; i < 2; i++) + assertFalse(libversion[i] == 0); + } + + /** + * Test method for + * {@link hdf.hdf5lib.H5#H5check_version(int, int, int)}. + */ + @Test + public void testH5check_version() { + int majnum = 1, minnum = 9, relnum = 0; + + try { + H5.H5check_version(majnum, minnum, relnum); + } + catch (Throwable err) { + fail("H5.H5check_version failed: " + err); + } + + try { + H5.H5check_version(-1, 0, 0); + } + catch (Throwable err) { + fail("H5.H5check_version failed: " + err); + } + } + + @Test + public void testIsSerializable() { + H5 test = new H5(); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + ObjectOutputStream oos; + try { + oos = new ObjectOutputStream(out); + oos.writeObject(test); + oos.close(); + } + catch (IOException err) { + err.printStackTrace(); + fail("ObjectOutputStream failed: " + err); + } + assertTrue(out.toByteArray().length > 0); + + } + + @SuppressWarnings("static-access") + @Test + public void serializeToDisk() + { + try { + H5 test = new H5(); + + FileOutputStream fos = new FileOutputStream("temph5.ser"); + ObjectOutputStream oos = new ObjectOutputStream(fos); + oos.writeObject(test); + oos.close(); + } + catch (Exception ex) { + fail("Exception thrown during test: " + ex.toString()); + } + + try { + FileInputStream fis = new FileInputStream("temph5.ser"); + ObjectInputStream ois = new ObjectInputStream(fis); + H5 test = (hdf.hdf5lib.H5) ois.readObject(); + ois.close(); + + assertTrue("H5.LIB_VERSION[0]", test.LIB_VERSION[0]==H5.LIB_VERSION[0]); + assertTrue("H5.LIB_VERSION[1]", test.LIB_VERSION[1]==H5.LIB_VERSION[1]); +// assertTrue("H5.LIB_VERSION[2]", test.LIB_VERSION[2]==H5.LIB_VERSION[2]); + + // Clean up the file + new File("temph5.ser").delete(); + } + catch (Exception ex) { + fail("Exception thrown during test: " + ex.toString()); + } + } +} diff --git a/java/test/TestH5A.java b/java/test/TestH5A.java new file mode 100644 index 0000000..fb7b31a --- /dev/null +++ b/java/test/TestH5A.java @@ -0,0 +1,1119 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.callbacks.H5A_iterate_cb; +import hdf.hdf5lib.callbacks.H5A_iterate_t; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.structs.H5A_info_t; + +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5A { + @Rule public TestName testname = new TestName(); + private static final String H5_FILE = "test.h5"; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + long H5fid = -1; + long H5dsid = -1; + long H5did = -1; + long[] H5dims = { DIM_X, DIM_Y }; + long type_id = -1; + long space_id = -1; + long lapl_id = -1; + + private final void _deleteFile(String filename) { + File file = new File(filename); + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + private final long _createDataset(long fid, long dsid, String name, long dapl) { + long did = -1; + try { + did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5A._createDataset: ", did > 0); + + return did; + } + + @Before + public void createH5file() throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0", H5.getOpenIDCount() == 0); + System.out.print(testname.getMethodName()); + + try { + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue("TestH5A.createH5file: H5.H5Fcreate: ", H5fid > 0); + H5dsid = H5.H5Screate_simple(2, H5dims, null); + assertTrue("TestH5A.createH5file: H5.H5Screate_simple: ", H5dsid > 0); + H5did = _createDataset(H5fid, H5dsid, "dset", + HDF5Constants.H5P_DEFAULT); + assertTrue("TestH5A.createH5file: _createDataset: ", H5did > 0); + space_id = H5.H5Screate(HDF5Constants.H5S_NULL); + assertTrue(space_id > 0); + lapl_id = H5.H5Pcreate(HDF5Constants.H5P_ATTRIBUTE_ACCESS); + assertTrue(lapl_id > 0); + type_id = H5.H5Tenum_create(HDF5Constants.H5T_STD_I32LE); + assertTrue(type_id > 0); + int status = H5.H5Tenum_insert(type_id, "test", 1); + assertTrue(status >= 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5A.createH5file: " + err); + } + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5did > 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + + _deleteFile(H5_FILE); + + if (type_id > 0) + try {H5.H5Tclose(type_id);} catch (Exception ex) {} + if (space_id > 0) + try {H5.H5Sclose(space_id);} catch (Exception ex) {} + if (lapl_id > 0) + try {H5.H5Pclose(lapl_id);} catch (Exception ex) {} + System.out.println(); + } + + @Test + public void testH5Acreate2() { + long attr_id = -1; + try { + attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue("testH5Acreate2", attr_id >= 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Acreate2: " + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + } + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Acreate2_invalidobject() throws Throwable { + H5.H5Acreate(H5dsid, "dset", type_id, space_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = NullPointerException.class) + public void testH5Acreate2_nullname() throws Throwable { + H5.H5Acreate(H5did, null, type_id, space_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Aopen() { + String attr_name = "dset"; + long attribute_id = -1; + long attr_id = -1; + + try { + attr_id = H5.H5Acreate(H5did, attr_name, type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + + // Opening the existing attribute, attr_name(Created by H5ACreate2) + // attached to an object identifier. + attribute_id = H5.H5Aopen(H5did, attr_name, + HDF5Constants.H5P_DEFAULT); + assertTrue("testH5Aopen: H5Aopen", attribute_id >= 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aopen: " + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + if (attribute_id > 0) + try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + } + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Aopen_invalidname() throws Throwable { + H5.H5Aopen(H5did, "attr_name", HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Aopen_by_idx() { + long loc_id = H5did; + String obj_name = "."; + int idx_type = HDF5Constants.H5_INDEX_CRT_ORDER; + int order = HDF5Constants.H5_ITER_INC; + long n = 0; + long attr_id = -1; + long attribute_id = -1; + long aapl_id = HDF5Constants.H5P_DEFAULT; + + try { + attr_id = H5.H5Acreate(H5did, "file", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + + // Opening the existing attribute, obj_name(Created by H5ACreate2) + // by index, attached to an object identifier. + attribute_id = H5.H5Aopen_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, + 0, HDF5Constants.H5P_DEFAULT, lapl_id); + + assertTrue("testH5Aopen_by_idx: H5Aopen_by_idx", attribute_id >= 0); + + // Negative test- Error should be thrown when H5Aopen_by_idx is + // called + // with n=5 and we do not have 5 attributes created. + try { + n = 5; + H5.H5Aopen_by_idx(loc_id, obj_name, idx_type, order, n, + aapl_id, lapl_id); + fail("Negative Test Failed:- Error not Thrown when n is invalid."); + } + catch (AssertionError err) { + fail("H5.H5Aopen_by_idx: " + err); + } + catch (HDF5LibraryException err) {} + + // Negative test- Error should be thrown when H5Aopen_by_idx is + // called + // with an invalid object name(which hasn't been created). + try { + n = 0; + obj_name = "file"; + H5.H5Aopen_by_idx(loc_id, obj_name, idx_type, order, n, + aapl_id, lapl_id); + fail("Negative Test Failed:- Error not Thrown when attribute name is invalid."); + } + catch (AssertionError err) { + fail("H5.H5Aopen_by_idx: " + err); + } + catch (HDF5LibraryException err) {} + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aopen_by_idx: " + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + if (attribute_id > 0) + try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Acreate_by_name() { + String obj_name = "."; + String attr_name = "DATASET"; + long attribute_id = -1; + boolean bool_val = false; + + try { + attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + assertTrue("testH5Acreate_by_name: H5Acreate_by_name", + attribute_id >= 0); + + // Check if the name of attribute attached to the object specified + // by loc_id and obj_name exists.It should be true. + bool_val = H5.H5Aexists_by_name(H5fid, obj_name, attr_name, + lapl_id); + assertTrue("testH5Acreate_by_name: H5Aexists_by_name", + bool_val == true); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Acreate_by_name " + err); + } + finally { + if (attribute_id > 0) + try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Arename() throws Throwable, HDF5LibraryException, NullPointerException { + long loc_id = H5fid; + String old_attr_name = "old"; + String new_attr_name = "new"; + long attr_id = -1; + int ret_val = -1; + boolean bool_val = false; + + try { + attr_id = H5.H5Acreate(loc_id, old_attr_name, type_id, space_id, HDF5Constants.H5P_DEFAULT, lapl_id); + + ret_val = H5.H5Arename(loc_id, old_attr_name, new_attr_name); + + // Check the return value.It should be non negative. + assertTrue("testH5Arename: H5Arename", ret_val >= 0); + + // Check if the new name of attribute attached to the object + // specified by loc_id and obj_name exists.It should be true. + bool_val = H5.H5Aexists(loc_id, new_attr_name); + assertTrue("testH5Arename: H5Aexists", bool_val == true); + + // Check if the old name of attribute attached to the object + // specified by loc_id and obj_name exists. It should equal false. + bool_val = H5.H5Aexists(loc_id, old_attr_name); + assertEquals(bool_val, false); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Arename " + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Arename_by_name() { + long loc_id = H5fid; + String obj_name = "."; + String old_attr_name = "old"; + String new_attr_name = "new"; + long attr_id = -1; + int ret_val = -1; + boolean bool_val = false; + + try { + attr_id = H5.H5Acreate_by_name(loc_id, obj_name, old_attr_name, + type_id, space_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, lapl_id); + + ret_val = H5.H5Arename_by_name(loc_id, obj_name, old_attr_name, + new_attr_name, lapl_id); + + // Check the return value.It should be non negative. + assertTrue("testH5Arename_by_name: H5Arename_by_name", ret_val >= 0); + + // Check if the new name of attribute attached to the object + // specified by loc_id and obj_name exists.It should be true. + bool_val = H5.H5Aexists_by_name(loc_id, obj_name, new_attr_name, + lapl_id); + assertTrue("testH5Arename_by_name: H5Aexists_by_name", + bool_val == true); + + // Check if the old name of attribute attached to the object + // specified by loc_id and obj_name exists. It should equal false. + bool_val = H5.H5Aexists_by_name(loc_id, obj_name, old_attr_name, + lapl_id); + assertEquals(bool_val, false); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Arename_by_name " + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Aget_name() { + String obj_name = "."; + String attr_name = "DATASET1"; + String ret_name = null; + long attribute_id = -1; + + try { + attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + assertTrue("testH5Aget_name: H5Acreate_by_name ", attribute_id > 0); + ret_name = H5.H5Aget_name(attribute_id); + assertEquals(ret_name, attr_name); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Aget_name " + err); + } + finally { + if (attribute_id > 0) + try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + } + } + + + @Test + public void testH5Aget_name_by_idx() { + long loc_id = H5fid; + String obj_name = "."; + String attr_name = "DATASET1", attr2_name = "DATASET2"; + String ret_name = null; + int idx_type = HDF5Constants.H5_INDEX_NAME; + int order = HDF5Constants.H5_ITER_INC; + int n = 0; + long attr1_id = -1; + long attr2_id = -1; + + try { + attr1_id = H5.H5Acreate_by_name(loc_id, obj_name, attr_name, + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr2_id = H5.H5Acreate_by_name(loc_id, obj_name, attr2_name, + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + + // getting the 1st attribute name(n=0). + ret_name = H5.H5Aget_name_by_idx(loc_id, obj_name, idx_type, order, + n, lapl_id); + assertFalse("H5Aget_name_by_idx ", ret_name == null); + assertEquals(ret_name, attr_name); + + // getting the second attribute name(n=1) + ret_name = H5.H5Aget_name_by_idx(loc_id, obj_name, idx_type, order, + 1, lapl_id); + assertFalse("H5Aget_name_by_idx ", ret_name == null); + assertEquals(ret_name, attr2_name); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aget_name_by_idx " + err); + } + finally { + if (attr1_id > 0) + try {H5.H5Aclose(attr1_id);} catch (Exception ex) {} + if (attr2_id > 0) + try {H5.H5Aclose(attr2_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Aget_storage_size() { + long attr_id = -1; + long attr_size = -1; + + try { + attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + + attr_size = H5.H5Aget_storage_size(attr_id); + assertTrue("The size of attribute is :", attr_size == 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aget_storage_size: " + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Aget_info() { + H5A_info_t attr_info = null; + long attribute_id = -1; + long attr_id = -1; + + try { + attr_id = H5.H5Acreate(H5did, "dset", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + attribute_id = H5.H5Aopen(H5did, "dset", HDF5Constants.H5P_DEFAULT); + // Calling H5Aget_info with attribute_id returned from H5Aopen. + attr_info = H5.H5Aget_info(attribute_id); + assertFalse("H5Aget_info ", attr_info == null); + assertTrue("Corder_Valid should be false", + attr_info.corder_valid == false); + assertTrue("Character set used for attribute name", + attr_info.cset == HDF5Constants.H5T_CSET_ASCII); + assertTrue("Corder ", attr_info.corder == 0); + assertEquals(attr_info.data_size, H5.H5Aget_storage_size(attr_id)); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aget_info: " + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + if (attribute_id > 0) + try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Aget_info1() { + H5A_info_t attr_info = null; + long attribute_id = -1; + long attr_id = -1; + int order = HDF5Constants.H5_ITER_INC; + + try { + attr_id = H5.H5Acreate(H5did, ".", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + attribute_id = H5.H5Aopen_by_idx(H5did, ".", + HDF5Constants.H5_INDEX_CRT_ORDER, order, 0, + HDF5Constants.H5P_DEFAULT, lapl_id); + // Calling H5Aget_info with attribute_id returned from + // H5Aopen_by_idx. + attr_info = H5.H5Aget_info(attribute_id); + + assertFalse("H5Aget_info ", attr_info == null); + assertTrue("Corder_Valid should be true", + attr_info.corder_valid == true); + assertTrue("Character set", + attr_info.cset == HDF5Constants.H5T_CSET_ASCII); + assertTrue("Corder ", attr_info.corder == 0); + assertEquals(attr_info.data_size, H5.H5Aget_storage_size(attr_id)); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aget_info1: " + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + if (attribute_id > 0) + try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Aget_info_by_idx() { + long attr_id = -1; + long attr2_id = -1;; + H5A_info_t attr_info = null; + + try { + attr_id = H5.H5Acreate(H5did, "dset1", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + attr2_id = H5.H5Acreate(H5did, "dataset2", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + + //Verify info for 1st attribute, in increasing creation order + attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, lapl_id); + assertNotNull(attr_info); + assertTrue("Corder ", attr_info.corder == 0);//should equal 0 as this is the order of 1st attribute created. + assertEquals(attr_info.data_size, H5.H5Aget_storage_size(attr_id)); + + //Verify info for 2nd attribute, in increasing creation order + attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 1, lapl_id); + assertNotNull(attr_info); + assertTrue("Corder", attr_info.corder == 1); + assertEquals(attr_info.data_size, H5.H5Aget_storage_size(attr2_id)); + + //verify info for 2nd attribute, in decreasing creation order + attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_DEC, 0, lapl_id); + assertNotNull(attr_info); + assertTrue("Corder", attr_info.corder == 1); //should equal 1 as this is the order of 2nd attribute created. + + //verify info for 1st attribute, in decreasing creation order + attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_DEC, 1, lapl_id); + assertNotNull(attr_info); + assertTrue("Corder", attr_info.corder == 0); //should equal 0 as this is the order of 1st attribute created. + + //verify info for 1st attribute, in increasing name order + attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 1, lapl_id); + assertNotNull(attr_info); + assertTrue("Corder", attr_info.corder == 0); //should equal 0 as this is the order of 1st attribute created. + + //verify info for 2nd attribute, in decreasing name order + attr_info = H5.H5Aget_info_by_idx(H5did, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_DEC, 1, lapl_id); + assertNotNull(attr_info); + assertTrue("Corder", attr_info.corder == 1); //should equal 1 as this is the order of 2nd attribute created. + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aget_info_by_idx:" + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + if (attr2_id > 0) + try {H5.H5Aclose(attr2_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Aget_info_by_name() { + long attr_id = -1; + H5A_info_t attr_info = null; + String obj_name = "."; + String attr_name = "DATASET"; + + try { + attr_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, type_id, + space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr_info = H5.H5Aget_info_by_name(H5fid, obj_name, attr_name, + lapl_id); + assertNotNull(attr_info); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aget_info_by_name:" + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Adelete_by_name() { + long attr_id = -1; + int ret_val = -1; + boolean bool_val = false; + boolean exists = false; + + try { + attr_id = H5.H5Acreate_by_name(H5fid, ".", "DATASET", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + ret_val = H5.H5Adelete_by_name(H5fid, ".", "DATASET", lapl_id); + assertTrue("H5Adelete_by_name", ret_val >= 0); + + // Check if the Attribute still exists. + bool_val = H5.H5Aexists_by_name(H5fid, ".", "DATASET", + lapl_id); + assertFalse("testH5Adelete_by_name: H5Aexists_by_name", bool_val); + exists = H5.H5Aexists(H5fid, "DATASET"); + assertFalse("testH5Adelete_by_name: H5Aexists ",exists); + + // Negative test. Error thrown when we try to delete an attribute + // that has already been deleted. + try{ + ret_val = H5.H5Adelete_by_name(H5fid, ".", "DATASET", lapl_id); + fail("Negative Test Failed: Error Not thrown."); + } + catch (AssertionError err) { + fail("H5.H5Adelete_by_name: " + err); + } + catch (HDF5LibraryException err) {} + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Adelete_by_name " + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Aexists() { + boolean exists = false; + long attr_id = -1; + long attribute_id = -1; + + try { + exists = H5.H5Aexists(H5fid, "None"); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aexists: " + err); + } + assertFalse("H5Aexists ", exists); + + try { + attr_id = H5.H5Acreate(H5fid, "dset", type_id, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + exists = H5.H5Aexists(H5fid, "dset"); + assertTrue("H5Aexists ", exists); + + attribute_id = H5.H5Acreate_by_name(H5fid, ".", "attribute", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + exists = H5.H5Aexists(H5fid, "attribute"); + assertTrue("H5Aexists ", exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aexists: " + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + if (attribute_id > 0) + try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Adelete_by_idx_order() { + boolean exists = false; + long attr1_id = -1; + long attr2_id = -1; + long attr3_id = -1; + long attr4_id = -1; + + try { + attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr4_id = H5.H5Acreate_by_name(H5fid, ".", "attribute4", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + + H5.H5Adelete_by_idx(H5fid, ".", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 3, lapl_id); + exists = H5.H5Aexists(H5fid, "attribute4"); + assertFalse("H5Adelete_by_idx: H5Aexists", exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Adelete_by_idx: " + err); + } + finally { + if (attr1_id > 0) + try {H5.H5Aclose(attr1_id);} catch (Exception ex) {} + if (attr2_id > 0) + try {H5.H5Aclose(attr2_id);} catch (Exception ex) {} + if (attr3_id > 0) + try {H5.H5Aclose(attr3_id);} catch (Exception ex) {} + if (attr4_id > 0) + try {H5.H5Aclose(attr4_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Adelete_by_idx_name1() { + boolean exists = false; + long attr1_id = -1; + long attr2_id = -1; + long attr3_id = -1; + + try { + attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + H5.H5Adelete_by_idx(H5fid, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, lapl_id); + exists = H5.H5Aexists(H5fid, "attribute3"); + assertFalse("H5Adelete_by_idx: H5Aexists", exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Adelete_by_idx: " + err); + } + finally { + if (attr1_id > 0) + try {H5.H5Aclose(attr1_id);} catch (Exception ex) {} + if (attr2_id > 0) + try {H5.H5Aclose(attr2_id);} catch (Exception ex) {} + if (attr3_id > 0) + try {H5.H5Aclose(attr3_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Adelete_by_idx_name2() { + boolean exists = false; + long attr1_id = -1; + long attr2_id = -1; + long attr3_id = -1; + long attr4_id = -1; + + try { + attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr4_id = H5.H5Acreate_by_name(H5fid, ".", "attribute4", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + + H5.H5Adelete_by_idx(H5fid, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_DEC, 3, lapl_id); + exists = H5.H5Aexists(H5fid, "attribute1"); + assertFalse("H5Adelete_by_idx: H5Aexists", exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Adelete_by_idx: " + err); + } + finally { + if (attr1_id > 0) + try {H5.H5Aclose(attr1_id);} catch (Exception ex) {} + if (attr2_id > 0) + try {H5.H5Aclose(attr2_id);} catch (Exception ex) {} + if (attr3_id > 0) + try {H5.H5Aclose(attr3_id);} catch (Exception ex) {} + if (attr4_id > 0) + try {H5.H5Aclose(attr4_id);} catch (Exception ex) {} + } + } + + @Test(expected = NullPointerException.class) + public void testH5Adelete_by_idx_null() throws Throwable { + H5.H5Adelete_by_idx(H5fid, null, HDF5Constants.H5_INDEX_CRT_ORDER, + HDF5Constants.H5_ITER_INC, 0, lapl_id); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Adelete_by_idx_invalidobject() throws Throwable { + H5.H5Adelete_by_idx(H5fid, "invalid", HDF5Constants.H5_INDEX_CRT_ORDER, + HDF5Constants.H5_ITER_INC, 0, lapl_id); + } + + @Test + public void testH5Aopen_by_name() { + String obj_name = "."; + String attr_name = "DATASET"; + long attribute_id = -1; + long aid = -1; + + try { + attribute_id = H5.H5Acreate_by_name(H5fid, obj_name, attr_name, + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + + //open Attribute by name + if(attribute_id >= 0) { + try { + aid = H5.H5Aopen_by_name(H5fid, obj_name, attr_name, HDF5Constants.H5P_DEFAULT, lapl_id); + assertTrue("testH5Aopen_by_name: ", aid>=0); + } + catch(Throwable err) { + err.printStackTrace(); + fail("H5.H5Aopen_by_name " + err); + } + } + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aopen_by_name " + err); + } + finally { + if (aid > 0) + try {H5.H5Aclose(aid);} catch (Exception ex) {} + if (attribute_id > 0) + try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Awrite_readVL() { + String attr_name = "VLdata"; + long attr_id = -1; + long atype_id = -1; + long aspace_id = -1; + String[] str_data = { "Parting", "is such", "sweet", "sorrow." }; + long[] dims = { str_data.length }; + long lsize = 1; + + try { + atype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + assertTrue("testH5Awrite_readVL.H5Tcopy: ", atype_id >= 0); + H5.H5Tset_size(atype_id, HDF5Constants.H5T_VARIABLE); + assertTrue("testH5Awrite_readVL.H5Tis_variable_str", H5.H5Tis_variable_str(atype_id)); + } + catch (Exception err) { + if (atype_id > 0) + try {H5.H5Tclose(atype_id);} catch (Exception ex) {} + err.printStackTrace(); + fail("H5.testH5Awrite_readVL: " + err); + } + + try { + aspace_id = H5.H5Screate_simple(1, dims, null); + assertTrue(aspace_id > 0); + attr_id = H5.H5Acreate(H5did, attr_name, atype_id, aspace_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue("testH5Awrite_readVL: ", attr_id >= 0); + + H5.H5AwriteVL(attr_id, atype_id, str_data); + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + + for (int j = 0; j < dims.length; j++) { + lsize *= dims[j]; + } + String[] strs = new String[(int) lsize]; + for (int j = 0; j < lsize; j++) { + strs[j] = ""; + } + try { + H5.H5AreadVL(attr_id, atype_id, strs); + } + catch (Exception ex) { + ex.printStackTrace(); + } + assertTrue("testH5Awrite_readVL:", str_data[0].equals(strs[0])); + assertTrue("testH5Awrite_readVL:", str_data[1].equals(strs[1])); + assertTrue("testH5Awrite_readVL:", str_data[2].equals(strs[2])); + assertTrue("testH5Awrite_readVL:", str_data[3].equals(strs[3])); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.testH5Awrite_readVL: " + err); + } + finally { + if (attr_id > 0) + try {H5.H5Aclose(attr_id);} catch (Exception ex) {} + if (aspace_id > 0) + try {H5.H5Sclose(aspace_id);} catch (Exception ex) {} + if (atype_id > 0) + try {H5.H5Tclose(atype_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Aget_create_plist() { + String attr_name = "DATASET1"; + int char_encoding = 0; + long plist_id = -1; + long attribute_id = -1; + + try { + plist_id = H5.H5Pcreate(HDF5Constants.H5P_ATTRIBUTE_CREATE); + assertTrue(plist_id > 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Aget_create_plist: H5Pcreate " + err); + } + try { + // Get the character encoding and ensure that it is the default (ASCII) + try { + char_encoding = H5.H5Pget_char_encoding(plist_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_char_encoding: " + err); + } + assertTrue("testH5Aget_create_plist: get_char_encoding", char_encoding == HDF5Constants.H5T_CSET_ASCII); + + // Create an attribute for the dataset using the property list + try { + attribute_id = H5.H5Acreate(H5fid, attr_name, type_id, space_id, plist_id, HDF5Constants.H5P_DEFAULT); + assertTrue("testH5Aget_create_plist: H5Acreate", attribute_id >= 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Acreate: " + err); + } + + /* Close the property list, and get the attribute's property list */ + H5.H5Pclose(plist_id); + plist_id = H5.H5Aget_create_plist(attribute_id); + assertTrue(plist_id > 0); + + /* Get the character encoding and ensure that it is the default (ASCII) */ + try { + char_encoding = H5.H5Pget_char_encoding(plist_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_char_encoding: " + err); + } + assertTrue("testH5Aget_create_plist: get_char_encoding", char_encoding == HDF5Constants.H5T_CSET_ASCII); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Aget_create_plist " + err); + } + finally { + if (plist_id > 0) + try {H5.H5Pclose(plist_id);} catch (Exception ex) {} + if (attribute_id > 0) + try {H5.H5Aclose(attribute_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Aiterate() { + long attr1_id = -1; + long attr2_id = -1; + long attr3_id = -1; + long attr4_id = -1; + + class idata { + public String attr_name = null; + idata(String name) { + this.attr_name = name; + } + } + class H5A_iter_data implements H5A_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + H5A_iterate_t iter_data = new H5A_iter_data(); + class H5A_iter_callback implements H5A_iterate_cb { + public int callback(long group, String name, H5A_info_t info, H5A_iterate_t op_data) { + idata id = new idata(name); + ((H5A_iter_data)op_data).iterdata.add(id); + return 0; + } + } + try { + attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr4_id = H5.H5Acreate_by_name(H5fid, ".", "attribute4", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + H5A_iterate_cb iter_cb = new H5A_iter_callback(); + try { + H5.H5Aiterate(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0L, iter_cb, iter_data); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aiterate: " + err); + } + assertFalse("H5Aiterate ",((H5A_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Aiterate "+((H5A_iter_data)iter_data).iterdata.size(),((H5A_iter_data)iter_data).iterdata.size()==4); + assertTrue("H5Aiterate "+(((H5A_iter_data)iter_data).iterdata.get(0)).attr_name,(((H5A_iter_data)iter_data).iterdata.get(0)).attr_name.compareToIgnoreCase("attribute1")==0); + assertTrue("H5Aiterate "+(((H5A_iter_data)iter_data).iterdata.get(1)).attr_name,(((H5A_iter_data)iter_data).iterdata.get(1)).attr_name.compareToIgnoreCase("attribute2")==0); + assertTrue("H5Aiterate "+((idata)((H5A_iter_data)iter_data).iterdata.get(2)).attr_name,(((H5A_iter_data)iter_data).iterdata.get(2)).attr_name.compareToIgnoreCase("attribute3")==0); + assertTrue("H5Aiterate "+((idata)((H5A_iter_data)iter_data).iterdata.get(3)).attr_name,((idata)((H5A_iter_data)iter_data).iterdata.get(3)).attr_name.compareToIgnoreCase("attribute4")==0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Aiterate: " + err); + } + finally { + if (attr1_id > 0) + try {H5.H5Aclose(attr1_id);} catch (Exception ex) {} + if (attr2_id > 0) + try {H5.H5Aclose(attr2_id);} catch (Exception ex) {} + if (attr3_id > 0) + try {H5.H5Aclose(attr3_id);} catch (Exception ex) {} + if (attr4_id > 0) + try {H5.H5Aclose(attr4_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Aiterate_by_name() { + long attr1_id = -1; + long attr2_id = -1; + long attr3_id = -1; + long attr4_id = -1; + + class idata { + public String attr_name = null; + idata(String name) { + this.attr_name = name; + } + } + class H5A_iter_data implements H5A_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + H5A_iterate_t iter_data = new H5A_iter_data(); + class H5A_iter_callback implements H5A_iterate_cb { + public int callback(long group, String name, H5A_info_t info, H5A_iterate_t op_data) { + idata id = new idata(name); + ((H5A_iter_data)op_data).iterdata.add(id); + return 0; + } + } + try { + attr1_id = H5.H5Acreate_by_name(H5fid, ".", "attribute4", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr2_id = H5.H5Acreate_by_name(H5fid, ".", "attribute3", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr3_id = H5.H5Acreate_by_name(H5fid, ".", "attribute2", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + attr4_id = H5.H5Acreate_by_name(H5fid, ".", "attribute1", + type_id, space_id, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, lapl_id); + H5A_iterate_cb iter_cb = new H5A_iter_callback(); + try { + H5.H5Aiterate_by_name(H5fid, ".", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Aiterate_by_name: " + err); + } + assertFalse("H5Aiterate_by_name ",((H5A_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Aiterate_by_name "+((H5A_iter_data)iter_data).iterdata.size(),((H5A_iter_data)iter_data).iterdata.size()==4); + assertTrue("H5Aiterate_by_name "+((idata)((H5A_iter_data)iter_data).iterdata.get(1)).attr_name,((idata)((H5A_iter_data)iter_data).iterdata.get(1)).attr_name.compareToIgnoreCase("attribute2")==0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Aiterate: " + err); + } + finally { + if (attr1_id > 0) + try {H5.H5Aclose(attr1_id);} catch (Exception ex) {} + if (attr2_id > 0) + try {H5.H5Aclose(attr2_id);} catch (Exception ex) {} + if (attr3_id > 0) + try {H5.H5Aclose(attr3_id);} catch (Exception ex) {} + if (attr4_id > 0) + try {H5.H5Aclose(attr4_id);} catch (Exception ex) {} + } + } + +} + + + diff --git a/java/test/TestH5D.java b/java/test/TestH5D.java new file mode 100644 index 0000000..9e359e2 --- /dev/null +++ b/java/test/TestH5D.java @@ -0,0 +1,892 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.HDFNativeData; +import hdf.hdf5lib.callbacks.H5D_iterate_cb; +import hdf.hdf5lib.callbacks.H5D_iterate_t; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5D { + @Rule public TestName testname = new TestName(); + private static final String H5_FILE = "test.h5"; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + private static final int RANK = 2; + long H5fid = -1; + long H5dsid = -1; + long H5dtid = -1; + long H5did = -1; + long H5did0 = -1; + long H5dcpl_id = -1; + long[] H5dims = { DIM_X, DIM_Y }; + + // Values for the status of space allocation + enum H5D_space_status { + H5D_SPACE_STATUS_ERROR(-1), H5D_SPACE_STATUS_NOT_ALLOCATED(0), H5D_SPACE_STATUS_PART_ALLOCATED( + 1), H5D_SPACE_STATUS_ALLOCATED(2); + + private int code; + + H5D_space_status(int space_status) { + this.code = space_status; + } + + public int getCode() { + return this.code; + } + } + + private final void _deleteFile(String filename) { + File file = new File(filename); + + if (file.exists()) { + try {file.delete();} + catch (SecurityException e) {} + } + } + + private final void _createPDataset(long fid, long dsid, String name, long dcpl_val) { + + try { + H5dcpl_id = H5.H5Pcreate(dcpl_val); + } + catch (Exception err) { + err.printStackTrace(); + fail("H5.H5Pcreate: " + err); + } + assertTrue("testH5D._createPDataset: H5.H5Pcreate: ", H5dcpl_id >= 0); + + // Set the allocation time to "early". This way we can be sure + // that reading from the dataset immediately after creation will + // return the fill value. + try { + H5.H5Pset_alloc_time(H5dcpl_id, HDF5Constants.H5D_ALLOC_TIME_EARLY); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + H5did0 = H5.H5Dcreate(fid, name, + HDF5Constants.H5T_STD_I32BE, dsid, + HDF5Constants.H5P_DEFAULT, H5dcpl_id, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5D._createPDataset.H5Dcreate: ", H5did0 >= 0); + } + + private final void _createDataset(long fid, long dsid, String name, long dapl) { + try { + H5did = H5.H5Dcreate(fid, name, + HDF5Constants.H5T_STD_I32BE, dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5D._createDataset.H5Dcreate: ", H5did >= 0); + } + + private final void _createVLDataset(long fid, long dsid, String name, long dapl) { + try { + H5dtid = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Tcopy: " + err); + } + assertTrue("TestH5D._createVLDataset.H5Tcopy: ", H5dtid >= 0); + try { + H5.H5Tset_size(H5dtid, HDF5Constants.H5T_VARIABLE); + assertTrue("TestH5D._createVLDataset.H5Tis_variable_str", H5.H5Tis_variable_str(H5dtid)); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Tset_size: " + err); + } + try { + H5did = H5.H5Dcreate(fid, name, H5dtid, dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5D._createVLDataset.H5Dcreate: ", H5did >= 0); + } + + private final void _closeH5file() throws HDF5LibraryException { + if (H5dcpl_id >= 0) + try {H5.H5Pclose(H5dcpl_id);} catch (Exception ex) {} + if (H5did0 >= 0) + try {H5.H5Dclose(H5did0);} catch (Exception ex) {} + if (H5did >= 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + if (H5dtid > 0) + try {H5.H5Tclose(H5dtid);} catch (Exception ex) {} + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + } + + private final void _openH5file(String name, long dapl) { + try { + H5fid = H5.H5Fopen(H5_FILE, + HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5D._openH5file: " + err); + } + assertTrue("TestH5D._openH5file: H5.H5Fopen: ",H5fid >= 0); + try { + H5did = H5.H5Dopen(H5fid, name, dapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5D._openH5file: " + err); + } + assertTrue("TestH5D._openH5file: H5.H5Dopen: ",H5did >= 0); + try { + H5dsid = H5.H5Dget_space(H5did); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5D._openH5file: " + err); + } + assertTrue("TestH5D._openH5file: H5.H5Screate_simple: ",H5dsid > 0); + } + + @Before + public void createH5file() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + try { + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5dsid = H5.H5Screate_simple(RANK, H5dims, null); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5D.createH5file: " + err); + } + assertTrue("TestH5D.createH5file: H5.H5Fcreate: ",H5fid >= 0); + assertTrue("TestH5D.createH5file: H5.H5Screate_simple: ",H5dsid >= 0); + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5dcpl_id >= 0) + try {H5.H5Pclose(H5dcpl_id);} catch (Exception ex) {} + if (H5did0 >= 0) + try {H5.H5Dclose(H5did0);} catch (Exception ex) {} + if (H5did >= 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + if (H5dtid > 0) + try {H5.H5Tclose(H5dtid);} catch (Exception ex) {} + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + + _deleteFile(H5_FILE); + System.out.println(); + } + + @Test + public void testH5Dcreate() { + long dataset_id = -1; + try { + dataset_id = H5.H5Dcreate(H5fid, "dset", + HDF5Constants.H5T_STD_I32BE, H5dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dcreate: " + err); + } + assertTrue(dataset_id >= 0); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception err) { + err.printStackTrace(); + } + } + + @Test + public void testH5Dcreate_anon() { + long dataset_id = -1; + try { + dataset_id = H5.H5Dcreate_anon(H5fid, HDF5Constants.H5T_STD_I32BE, + H5dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dcreate_anon: " + err); + } + assertTrue(dataset_id >= 0); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception err) { + err.printStackTrace(); + } + } + + @Test + public void testH5Dopen() { + long dataset_id = -1; + _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + + try { + H5.H5Dclose(H5did); + H5did = -1; + dataset_id = H5.H5Dopen(H5fid, "dset", HDF5Constants.H5P_DEFAULT); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dopen: " + err); + } + assertTrue("testH5Dopen: ", dataset_id >= 0); + + // End access to the dataset and release resources used by it. + try { + if (dataset_id >= 0) + H5.H5Dclose(dataset_id); + } + catch (Exception err) { + err.printStackTrace(); + } + } + + @Test + public void testH5Dget_storage_size_empty() { + long storage_size = 0; + _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + + try { + storage_size = H5.H5Dget_storage_size(H5did); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dget_storage_size: " + err); + } + assertTrue("testH5Dget_storage_size: ", storage_size == 0); + } + + @Test + public void testH5Dget_storage_size() { + long storage_size = 0; + int[][] dset_data = new int[DIM_X][DIM_Y]; + int FILLVAL = 99; + _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + + // Initialize the dataset. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + dset_data[indx][jndx] = FILLVAL; + + try { + if (H5did >= 0) + H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data[0]); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + storage_size = H5.H5Dget_storage_size(H5did); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dget_storage_size: " + err); + } + assertTrue("testH5Dget_storage_size: "+storage_size, storage_size == DIM_X*DIM_Y*4); + } + + @Test + public void testH5Dget_access_plist() { + long dapl_id = -1; + int pequal = -1; + long test_dapl_id = -1; + + try { + test_dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dget_access_plist: H5.H5Pcreate: " + err); + } + assertTrue("testH5Dget_access_plist: test_dapl_id: ", test_dapl_id >= 0); + + _createDataset(H5fid, H5dsid, "dset", test_dapl_id); + + try { + dapl_id = H5.H5Dget_access_plist(H5did); + assertTrue("testH5Dget_access_plist: dapl_id: ", dapl_id >= 0); + pequal = H5.H5Pequal(dapl_id, test_dapl_id); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dget_access_plist: H5.H5Dget_access_plist: " + err); + } + + // End access to the dataset and release resources used by it. + try { + if (dapl_id >= 0) + H5.H5Pclose(dapl_id); + } + catch (Exception err) { + err.printStackTrace(); + } + try { + if (test_dapl_id >= 0) + H5.H5Pclose(test_dapl_id); + } + catch (Exception err) { + err.printStackTrace(); + } + assertTrue("testH5Dget_access_plist: ", pequal > 0); + } + + @Test + public void testH5Dget_space_status() { + int[][] write_dset_data = new int[DIM_X][DIM_Y]; + int space_status = -1; + int space_status0 = -1; + + // Initialize the dataset. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + write_dset_data[indx][jndx] = indx * jndx - jndx; + + _createPDataset(H5fid, H5dsid, "dset0", HDF5Constants.H5P_DATASET_CREATE); + _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + + // Retrieve and print space status and storage size for dset0. + try { + space_status0 = H5.H5Dget_space_status(H5did0); + } + catch (Exception e) { + e.printStackTrace(); + } + assertTrue("testH5Dget_space_status0 - H5.H5Dget_space_status: ", space_status0 == H5D_space_status.H5D_SPACE_STATUS_ALLOCATED.getCode()); + + // Retrieve and print space status and storage size for dset. + try { + space_status = H5.H5Dget_space_status(H5did); + } + catch (Exception e) { + e.printStackTrace(); + } + assertFalse("testH5Dget_space_status - H5.H5Dget_space_status: ", space_status == H5D_space_status.H5D_SPACE_STATUS_ALLOCATED.getCode()); + + // Write the data to the dataset. + try { + H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, write_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Retrieve and print space status and storage size for dset. + try { + space_status = H5.H5Dget_space_status(H5did); + } + catch (Exception e) { + e.printStackTrace(); + } + assertTrue("testH5Dget_space_status - H5.H5Dget_space_status: ", space_status == H5D_space_status.H5D_SPACE_STATUS_ALLOCATED.getCode()); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dget_space_closed() throws Throwable { + long dataset_id = -1; + try { + dataset_id = H5.H5Dcreate(H5fid, "dset", + HDF5Constants.H5T_STD_I32BE, H5dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5D.testH5Dget_space_closed: ", dataset_id >= 0); + H5.H5Dclose(dataset_id); + + H5.H5Dget_space(dataset_id); + } + + @Test + public void testH5Dget_space() { + long dataspace_id = -1; + _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + + try { + dataspace_id = H5.H5Dget_space(H5did); + } + catch (Exception err) { + err.printStackTrace(); + fail("H5.H5Dget_space: " + err); + } + assertTrue("TestH5D.testH5Dget_space: ", dataspace_id >= 0); + + // End access to the dataspace and release resources used by it. + try { + if (dataspace_id >= 0) + H5.H5Sclose(dataspace_id); + } + catch (Exception err) { + err.printStackTrace(); + } + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dget_type_closed() throws Throwable { + long dataset_id = -1; + try { + dataset_id = H5.H5Dcreate(H5fid, "dset", + HDF5Constants.H5T_STD_I32BE, H5dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5D.testH5Dget_type_closed: ", dataset_id >= 0); + H5.H5Dclose(dataset_id); + + H5.H5Dget_type(dataset_id); + } + + @Test + public void testH5Dget_type() { + long datatype_id = -1; + _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + + try { + datatype_id = H5.H5Dget_type(H5did); + } + catch (Exception err) { + err.printStackTrace(); + fail("H5.H5Dget_type: " + err); + } + assertTrue("TestH5D.testH5Dget_type: ", datatype_id >= 0); + + // End access to the datatype and release resources used by it. + try { + if (datatype_id >= 0) + H5.H5Tclose(datatype_id); + } + catch (Exception err) { + err.printStackTrace(); + } + } + + @Test + public void testH5Dget_offset() { + int[][] write_dset_data = new int[DIM_X][DIM_Y]; + long dset_address = 0; + _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + + try { + // Test dataset address. Should be undefined. + dset_address = H5.H5Dget_offset(H5did); + } + catch (HDF5LibraryException hdfex) { + ; + } + catch (Exception err) { + err.printStackTrace(); + fail("H5.H5Dget_offset: " + err); + } + // Write the data to the dataset. + try { + H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, write_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + // Test dataset address. + dset_address = H5.H5Dget_offset(H5did); + } + catch (Exception err) { + err.printStackTrace(); + fail("H5.H5Dget_offset: " + err); + } + + assertTrue("TestH5D.testH5Dget_offset: ", dset_address >= 0); + } + + @Test + public void testH5Dfill_null() { + int[] buf_data = new int[DIM_X*DIM_Y]; + + // Initialize memory buffer + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) { + buf_data[(indx * DIM_Y) + jndx] = indx * jndx - jndx; + } + byte[] buf_array = HDFNativeData.intToByte(0, DIM_X*DIM_Y, buf_data); + + // Fill selection in memory + try { + H5.H5Dfill(null, HDF5Constants.H5T_NATIVE_UINT, buf_array, HDF5Constants.H5T_NATIVE_UINT, H5dsid); + } + catch (Exception err) { + err.printStackTrace(); + fail("H5.H5Dfill: " + err); + } + buf_data = HDFNativeData.byteToInt(buf_array); + + // Verify memory buffer the hard way + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + assertTrue("H5.H5Dfill: [" + indx+","+jndx + "] ", buf_data[(indx * DIM_Y) + jndx] == 0); + } + + @Test + public void testH5Dfill() { + int[] buf_data = new int[DIM_X*DIM_Y]; + byte[] fill_value = HDFNativeData.intToByte(254); + + // Initialize memory buffer + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) { + buf_data[(indx * DIM_Y) + jndx] = indx * jndx - jndx; + } + byte[] buf_array = HDFNativeData.intToByte(0, DIM_X*DIM_Y, buf_data); + + // Fill selection in memory + try { + H5.H5Dfill(fill_value, HDF5Constants.H5T_NATIVE_UINT, buf_array, HDF5Constants.H5T_NATIVE_UINT, H5dsid); + } + catch (Exception err) { + err.printStackTrace(); + fail("H5.H5Dfill: " + err); + } + buf_data = HDFNativeData.byteToInt(buf_array); + + // Verify memory buffer the hard way + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + assertTrue("H5.H5Dfill: [" + indx+","+jndx + "] ", buf_data[(indx * DIM_Y) + jndx] == 254); + } + + @Test + public void testH5Diterate() { + final int SPACE_RANK = 2; + final int SPACE_FILL = 254; + + class H5D_iter_data implements H5D_iterate_t { + public int fill_value; /* The fill value to check */ + public long fill_curr_coord; /* Current coordinate to examine */ + public long[] fill_coords; /* Pointer to selection's coordinates */ + } + + H5D_iterate_t iter_data = new H5D_iter_data(); + + class H5D_iter_callback implements H5D_iterate_cb { + public int callback(byte[] elem_buf, long elem_id, int ndim, long[] point, H5D_iterate_t op_data) { + //Check value in current buffer location + int element = HDFNativeData.byteToInt(elem_buf, 0); + if(element != ((H5D_iter_data)op_data).fill_value) + return -1; + //Check number of dimensions + if(ndim != SPACE_RANK) + return(-1); + //Check Coordinates + long[] fill_coords = new long[2]; + fill_coords[0] = ((H5D_iter_data)op_data).fill_coords[(int) (2 * ((H5D_iter_data)op_data).fill_curr_coord)]; + fill_coords[1] = ((H5D_iter_data)op_data).fill_coords[(int) (2 * ((H5D_iter_data)op_data).fill_curr_coord) + 1]; + ((H5D_iter_data)op_data).fill_curr_coord++; + if(fill_coords[0] != point[0]) + return(-1); + if(fill_coords[1] != point[1]) + return(-1); + + return(0); + } + } + + int[] buf_data = new int[DIM_X*DIM_Y]; + byte[] fill_value = HDFNativeData.intToByte(SPACE_FILL); + + // Initialize memory buffer + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) { + buf_data[(indx * DIM_Y) + jndx] = indx * jndx - jndx; + } + byte[] buf_array = HDFNativeData.intToByte(0, DIM_X*DIM_Y, buf_data); + + // Fill selection in memory + try { + H5.H5Dfill(fill_value, HDF5Constants.H5T_NATIVE_UINT, buf_array, HDF5Constants.H5T_NATIVE_UINT, H5dsid); + } + catch (Exception err) { + err.printStackTrace(); + fail("H5.H5Diterate: " + err); + } + + // Initialize the iterator structure + ((H5D_iter_data)iter_data).fill_value = SPACE_FILL; + ((H5D_iter_data)iter_data).fill_curr_coord = 0; + // Set the coordinates of the selection + ((H5D_iter_data)iter_data).fill_coords = new long[DIM_X*DIM_Y*SPACE_RANK]; /* Coordinates of selection */ + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) { + ((H5D_iter_data)iter_data).fill_coords[2*(indx * DIM_Y + jndx)] = indx; + ((H5D_iter_data)iter_data).fill_coords[2*(indx * DIM_Y + jndx) + 1] = jndx; + } /* end for */ + + // Iterate through selection, verifying correct data + H5D_iterate_cb iter_cb = new H5D_iter_callback(); + int op_status = -1; + try { + op_status = H5.H5Diterate(buf_array, HDF5Constants.H5T_NATIVE_UINT, H5dsid, iter_cb, iter_data); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Diterate: " + err); + } + assertTrue("H5Diterate ", op_status == 0); + } + + @Test + public void testH5Diterate_write() { + final int SPACE_RANK = 2; + final int SPACE_FILL = 254; + + class H5D_iter_data implements H5D_iterate_t { + public int fill_value; /* The fill value to check */ + public long fill_curr_coord; /* Current coordinate to examine */ + public long[] fill_coords; /* Pointer to selection's coordinates */ + } + + H5D_iterate_t iter_data = new H5D_iter_data(); + + class H5D_iter_callback implements H5D_iterate_cb { + public int callback(byte[] elem_buf, long elem_id, int ndim, long[] point, H5D_iterate_t op_data) { + //Check value in current buffer location + int element = HDFNativeData.byteToInt(elem_buf, 0); + if(element != ((H5D_iter_data)op_data).fill_value) + return -1; + //Check number of dimensions + if(ndim != SPACE_RANK) + return(-1); + //Check Coordinates + long[] fill_coords = new long[2]; + fill_coords[0] = ((H5D_iter_data)op_data).fill_coords[(int) (2 * ((H5D_iter_data)op_data).fill_curr_coord)]; + fill_coords[1] = ((H5D_iter_data)op_data).fill_coords[(int) (2 * ((H5D_iter_data)op_data).fill_curr_coord) + 1]; + ((H5D_iter_data)op_data).fill_curr_coord++; + if(fill_coords[0] != point[0]) + return(-1); + if(fill_coords[1] != point[1]) + return(-1); + element -= 128; + byte[] new_elembuf = HDFNativeData.intToByte(element); + elem_buf[0] = new_elembuf[0]; + elem_buf[1] = new_elembuf[1]; + elem_buf[2] = new_elembuf[2]; + elem_buf[3] = new_elembuf[3]; + return(0); + } + } + + int[] buf_data = new int[DIM_X*DIM_Y]; + byte[] fill_value = HDFNativeData.intToByte(SPACE_FILL); + + // Initialize memory buffer + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) { + buf_data[(indx * DIM_Y) + jndx] = indx * jndx - jndx; + } + byte[] buf_array = HDFNativeData.intToByte(0, DIM_X*DIM_Y, buf_data); + + // Fill selection in memory + try { + H5.H5Dfill(fill_value, HDF5Constants.H5T_NATIVE_UINT, buf_array, HDF5Constants.H5T_NATIVE_UINT, H5dsid); + } + catch (Exception err) { + err.printStackTrace(); + fail("H5.H5Diterate: " + err); + } + + // Initialize the iterator structure + ((H5D_iter_data)iter_data).fill_value = SPACE_FILL; + ((H5D_iter_data)iter_data).fill_curr_coord = 0; + // Set the coordinates of the selection + ((H5D_iter_data)iter_data).fill_coords = new long[DIM_X*DIM_Y*SPACE_RANK]; /* Coordinates of selection */ + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) { + ((H5D_iter_data)iter_data).fill_coords[2*(indx * DIM_Y + jndx)] = indx; + ((H5D_iter_data)iter_data).fill_coords[2*(indx * DIM_Y + jndx) + 1] = jndx; + } /* end for */ + + // Iterate through selection, verifying correct data + H5D_iterate_cb iter_cb = new H5D_iter_callback(); + int op_status = -1; + try { + op_status = H5.H5Diterate(buf_array, HDF5Constants.H5T_NATIVE_UINT, H5dsid, iter_cb, iter_data); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Diterate: " + err); + } + assertTrue("H5Diterate ", op_status == 0); + + buf_data = HDFNativeData.byteToInt(buf_array); + + // Verify memory buffer the hard way + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + assertTrue("H5.H5Diterate: [" + indx+","+jndx + "] "+buf_data[(indx * DIM_Y) + jndx], buf_data[(indx * DIM_Y) + jndx] == 126); + } + + @Test + public void testH5Dvlen_get_buf_size() { + String[] str_data = { "Parting", "is such", "sweet", "sorrow.", + "Testing", "one", "two", "three.", + "Dog,", "man's", "best", "friend.", + "Diamonds", "are", "a", "girls!", + "S A", "T U R", "D A Y", "night", + "That's", "all", "folks", "!!!" }; + long vl_size = -1; /* Number of bytes used */ + long str_data_bytes = 0; + for (int idx = 0; idx < str_data.length; idx++) + str_data_bytes += str_data[idx].length() + 1; //Account for terminating null + + _createVLDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + + try { + if ((H5did >= 0) && (H5dtid >= 0)) + H5.H5Dwrite_VLStrings(H5did, H5dtid, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, str_data); + } + catch (Exception e) { + e.printStackTrace(); + } + try { + vl_size = H5.H5Dvlen_get_buf_size(H5did, H5dtid, H5dsid); + } + catch (Exception e) { + e.printStackTrace(); + } + assertTrue("H5Dvlen_get_buf_size " + vl_size + " == " + str_data_bytes, vl_size == str_data_bytes); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Dvlen_read_invalid_buffer() throws Throwable { + String[] str_data = { "Parting", "is such", "sweet", "sorrow.", + "Testing", "one", "two", "three.", + "Dog,", "man's", "best", "friend.", + "Diamonds", "are", "a", "girls!", + "S A", "T U R", "D A Y", "night", + "That's", "all", "folks", "!!!" }; + byte[] read_data = new byte[512]; + + _createVLDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + + try { + H5.H5Dwrite_VLStrings(H5did, H5dtid, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, str_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + H5.H5Dread(H5did, H5dtid, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, read_data); + } + + @Test + public void testH5Dvlen_write_read() { + String[] str_wdata = { "Parting", "is such", "sweet", "sorrow.", + "Testing", "one", "two", "three.", + "Dog,", "man's", "best", "friend.", + "Diamonds", "are", "a", "girls!", + "S A", "T U R", "D A Y", "night", + "That's", "all", "folks", "!!!" }; + String[] str_rdata = new String[DIM_X * DIM_Y]; + + _createVLDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + + try { + if ((H5did >= 0) && (H5dtid >= 0)) + H5.H5Dwrite_VLStrings(H5did, H5dtid, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, str_wdata); + } + catch (Exception e) { + e.printStackTrace(); + } + try { + if ((H5did >= 0) && (H5dtid >= 0)) + H5.H5Dread_VLStrings(H5did, H5dtid, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, str_rdata); + } + catch (Exception e) { + e.printStackTrace(); + } + for (int v = 0; v < DIM_X * DIM_Y; v++) + assertTrue("testH5Dvlen_write_read " + str_wdata[v] + " == " + str_rdata[v], str_wdata[v] == str_wdata[v]); + } + +} diff --git a/java/test/TestH5Dparams.java b/java/test/TestH5Dparams.java new file mode 100644 index 0000000..f056027 --- /dev/null +++ b/java/test/TestH5Dparams.java @@ -0,0 +1,134 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertTrue; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Dparams { + @Rule public TestName testname = new TestName(); + + @Before + public void checkOpenIDs() { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + @After + public void nextTestName() { + System.out.println(); + } + + @Test//(expected = HDF5LibraryException.class) + public void testH5Dclose_invalid() throws Throwable { + long did = H5.H5Dclose(-1); + assertTrue(did == 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Dcreate_null() throws Throwable { + H5.H5Dcreate(-1, null, 0, 0, 0, 0, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dcreate_invalid() throws Throwable { + H5.H5Dcreate(-1, "Bogus", -1, -1, -1, -1, -1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dcreate_anon_invalid() throws Throwable { + H5.H5Dcreate_anon(-1, -1, -1, -1, -1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dget_access_plist_invalid() throws Throwable { + H5.H5Dget_access_plist(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dget_create_plist_invalid() throws Throwable { + H5.H5Dget_create_plist(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dget_offset_invalid() throws Throwable { + H5.H5Dget_offset(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dget_space_invalid() throws Throwable { + H5.H5Dget_space(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dget_type_invalid() throws Throwable { + H5.H5Dget_type(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dget_space_status_invalid() throws Throwable { + int status = H5.H5Dget_space_status(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dset_extent_status_invalid() throws Throwable { + long[] size = new long[2]; + H5.H5Dset_extent(-1, size); + } + + @Test(expected = NullPointerException.class) + public void testH5Dset_extent_status_null() throws Throwable { + H5.H5Dset_extent(-1, null); + } + + @Test(expected = NullPointerException.class) + public void testH5Dopen_null() throws Throwable { + H5.H5Dopen(-1, null, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dopen_invalid() throws Throwable { + H5.H5Dopen(-1, "Bogus", 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dvlen_get_buf_size_invalid() throws Throwable { + H5.H5Dvlen_get_buf_size(-1, -1, -1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Dvlen_reclaim_invalid() throws Throwable { + byte[] buf = new byte[2]; + H5.H5Dvlen_reclaim(-1, -1, -1, buf); + } + + @Test(expected = NullPointerException.class) + public void testH5Dvlen_reclaim_null() throws Throwable { + H5.H5Dvlen_reclaim(-1, -1, -1, null); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Dget_storage_size_invalid() throws Throwable { + H5.H5Dget_storage_size(-1); + } + +} diff --git a/java/test/TestH5Dplist.java b/java/test/TestH5Dplist.java new file mode 100644 index 0000000..eb1669f --- /dev/null +++ b/java/test/TestH5Dplist.java @@ -0,0 +1,216 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Dplist { + @Rule public TestName testname = new TestName(); + private static final String H5_FILE = "test.h5"; + private static final int DIM_X = 4; + private static final int DIM_Y = 7; + private static final int EDIM_X = 6; + private static final int EDIM_Y = 10; + private static final int CHUNK_X = 4; + private static final int CHUNK_Y = 4; + private static final int NDIMS = 2; + private static final int FILLVAL = 99; + private static final int RANK = 2; + long H5fid = -1; + long H5dsid = -1; + long H5did = -1; + long H5dcpl_id = -1; + long[] H5dims = { DIM_X, DIM_Y }; + long[] H5extdims = { EDIM_X, EDIM_Y }; + long[] H5chunk_dims = { CHUNK_X, CHUNK_Y }; + long[] H5maxdims = { HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED }; + + private final void _deleteFile(String filename) { + File file = new File(filename); + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + private final void _createPDataset(long fid, long dsid, String name, long dcpl_val) { + try { + H5dcpl_id = H5.H5Pcreate(dcpl_val); + } + catch (Exception err) { + err.printStackTrace(); + fail("H5.H5Pcreate: " + err); + } + assertTrue("TestH5Dplist._createPDataset: ", H5dcpl_id > 0); + + // Set the chunk size. + try { + H5.H5Pset_chunk(H5dcpl_id, NDIMS, H5chunk_dims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Set the fill value for the dataset + try { + int[] fill_value = { FILLVAL }; + H5.H5Pset_fill_value(H5dcpl_id, HDF5Constants.H5T_NATIVE_INT, fill_value); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Set the allocation time to "early". This way we can be sure + // that reading from the dataset immediately after creation will + // return the fill value. + try { + H5.H5Pset_alloc_time(H5dcpl_id, HDF5Constants.H5D_ALLOC_TIME_EARLY); + } + catch (Exception e) { + e.printStackTrace(); + } + + _createDataset(H5fid, H5dsid, "dset", H5dcpl_id, HDF5Constants.H5P_DEFAULT); + } + + private final void _createDataset(long fid, long dsid, String name, long dcpl, long dapl) { + try { + H5did = H5.H5Dcreate(fid, name, + HDF5Constants.H5T_STD_I32BE, dsid, + HDF5Constants.H5P_DEFAULT, dcpl, dapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5Dplist._createDataset: ",H5did > 0); + } + + @Before + public void createH5file() throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + try { + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5dsid = H5.H5Screate_simple(RANK, H5dims, H5maxdims); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Dplist.createH5file: " + err); + } + assertTrue("TestH5Dplist.createH5file: H5.H5Fcreate: ",H5fid > 0); + assertTrue("TestH5Dplist.createH5file: H5.H5Screate_simple: ",H5dsid > 0); + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5dcpl_id >= 0) + try {H5.H5Pclose(H5dcpl_id);} catch (Exception ex) {} + if (H5did > 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + + _deleteFile(H5_FILE); + System.out.println(); + } + + @Test + public void testH5Dset_extent() { + int[][] write_dset_data = new int[DIM_X][DIM_Y]; + int[][] read_dset_data = new int[DIM_X][DIM_Y]; + int[][] extend_dset_data = new int[EDIM_X][EDIM_Y]; + + // Initialize the dataset. + for (int indx = 0; indx < DIM_X; indx++) + for (int jndx = 0; jndx < DIM_Y; jndx++) + write_dset_data[indx][jndx] = indx * jndx - jndx; + + _createPDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DATASET_CREATE); + + // Read values from the dataset, which has not been written to yet. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, read_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + assertTrue("testH5Dset_extent - H5.H5Dread: ", read_dset_data[0][0] == 99); + + // Write the data to the dataset. + try { + H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_INT, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, write_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read the data back. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, read_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + assertTrue("testH5Dset_extent - H5.H5Dread: ", read_dset_data[3][6] == 12); + + // Extend the dataset. + try { + H5.H5Dset_extent(H5did, H5extdims); + } + catch (Exception e) { + e.printStackTrace(); + } + + // Read from the extended dataset. + try { + H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_INT, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, extend_dset_data); + } + catch (Exception e) { + e.printStackTrace(); + } + assertTrue("testH5Dset_extent - H5.H5Dread: ", extend_dset_data[3][6] == 12); + assertTrue("testH5Dset_extent - H5.H5Dread: ", extend_dset_data[4][8] == 99); + } + +} diff --git a/java/test/TestH5E.java b/java/test/TestH5E.java new file mode 100644 index 0000000..028369d --- /dev/null +++ b/java/test/TestH5E.java @@ -0,0 +1,553 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.callbacks.H5E_walk_cb; +import hdf.hdf5lib.callbacks.H5E_walk_t; +import hdf.hdf5lib.structs.H5E_error2_t; + +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5E { + @Rule public TestName testname = new TestName(); + long hdf_java_classid = -1; + long current_stackid = -1; + + @Before + public void H5Eget_stack_class() { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + hdf_java_classid = -1; + try { + hdf_java_classid = H5.H5Eregister_class("HDF-Java-Error", + "hdf-java", "2.5"); + current_stackid = H5.H5Eget_current_stack(); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_stack_class: " + err); + } + } + + @After + public void H5Erestore_stack_class() { + try { + H5.H5Eunregister_class(hdf_java_classid); + hdf_java_classid = -1; + H5.H5Eclose_stack(current_stackid); + current_stackid = -1; + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Erestore_stack_class: " + err); + } + System.out.println(); + } + + @Test + public void testH5Eget_class_name() { + try { + String class_name = H5.H5Eget_class_name(hdf_java_classid); + assertNotNull("H5.H5Eget_class_name: " + class_name, class_name); + assertEquals("H5.H5Eget_class_name: ", "HDF-Java-Error", class_name); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_class_name: " + err); + } + } + + @Test + public void testH5Eprint2() { + try { + assertFalse(current_stackid < 0); + H5.H5Eprint2(current_stackid, null); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eprint2: " + err); + } + } + + @Ignore("Tested with create_msg_major[minor]") + public void testH5Eclose_msg() { + fail("Not yet implemented"); + } + + @Test(expected = NullPointerException.class) + public void testH5Ecreate_msg_name_null() throws Throwable { + H5.H5Ecreate_msg(hdf_java_classid, HDF5Constants.H5E_MAJOR, null); + } + + @Test + public void testH5Ecreate_msg_major() { + try { + long err_id = H5.H5Ecreate_msg(hdf_java_classid, + HDF5Constants.H5E_MAJOR, "Error in Test"); + assertFalse("H5.H5Ecreate_msg_major: " + err_id, err_id < 0); + H5.H5Eclose_msg(err_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ecreate_msg_major: " + err); + } + } + + @Test + public void testH5Ecreate_msg_minor() { + try { + long err_id = H5.H5Ecreate_msg(hdf_java_classid, + HDF5Constants.H5E_MINOR, "Error in Test Function"); + assertFalse("H5.H5Ecreate_msg_minor: " + err_id, err_id < 0); + H5.H5Eclose_msg(err_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ecreate_msg_minor: " + err); + } + } + + @Test + public void testH5Eget_msg() { + int[] error_msg_type = { HDF5Constants.H5E_MINOR }; + long err_id = -1; + String msg = null; + try { + err_id = H5.H5Ecreate_msg(hdf_java_classid, + HDF5Constants.H5E_MAJOR, "Error in Test"); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_msg: " + err); + } + assertFalse("H5.H5Eget_msg: H5Ecreate_msg - " + err_id, err_id < 0); + try { + msg = H5.H5Eget_msg(err_id, error_msg_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_msg: " + err); + } + assertNotNull("H5.H5Eget_msg: " + msg, msg); + assertEquals("H5.H5Eget_msg: ", "Error in Test", msg); + assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MAJOR, + error_msg_type[0]); + try { + H5.H5Eclose_msg(err_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_msg: " + err); + } + } + + @Test + public void testH5Eget_msg_major() { + + try { + H5.H5Fopen("test", 0, 1); + } + catch (HDF5LibraryException hdferr) { + int[] error_msg_type = { HDF5Constants.H5E_MAJOR }; + String msg = null; + try { + msg = H5.H5Eget_msg(hdferr.getMajorErrorNumber(), + error_msg_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_msg: " + err); + } + assertNotNull("H5.H5Eget_msg: " + msg, msg); + assertEquals("H5.H5Eget_msg: ", "Invalid arguments to routine", + msg); + assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MAJOR, + error_msg_type[0]); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_msg: " + err); + } + } + + @Test + public void testH5Eget_msg_minor() { + try { + H5.H5Fopen("test", 0, 1); + } + catch (HDF5LibraryException hdferr) { + int[] error_msg_type = { HDF5Constants.H5E_MINOR }; + String msg = null; + try { + msg = H5.H5Eget_msg(hdferr.getMinorErrorNumber(), + error_msg_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_msg: " + err); + } + assertNotNull("H5.H5Eget_msg: " + msg, msg); + assertEquals("H5.H5Eget_msg: ", "Inappropriate type", msg); + assertEquals("H5.H5Eget_msg: ", HDF5Constants.H5E_MINOR, + error_msg_type[0]); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_msg: " + err); + } + } + + @Test + public void testH5Ecreate_stack() { + long stk_id = -1; + try { + stk_id = H5.H5Ecreate_stack(); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ecreate_stack: " + err); + } + assertFalse("H5.H5Ecreate_stack: " + stk_id, stk_id < 0); + try { + H5.H5Eclose_stack(stk_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ecreate_stack: " + err); + } + } + + @Test + public void testH5Epop() { + try { + H5.H5Eset_current_stack(current_stackid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Epop: " + err); + } + + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + } + + // save current stack contents + try { + current_stackid = H5.H5Eget_current_stack(); + } + catch (HDF5LibraryException err) { + err.printStackTrace(); + fail("H5.H5Epop: " + err); + } + + long num_msg = -1; + try { + num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Epop: " + err); + } + + assertTrue("H5.H5Epop #:" + num_msg, num_msg == 0); + + try { + num_msg = H5.H5Eget_num(current_stackid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Epop: " + err); + } + + assertTrue("H5.H5Epop #:" + num_msg, num_msg == 3); + + try { + H5.H5Epop(current_stackid, 1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Epop: " + err); + } + + try { + num_msg = H5.H5Eget_num(current_stackid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Epop: " + err); + } + + assertTrue("H5.H5Epop", num_msg == 2); + } + + @Test + public void testH5Epush() { + String err_func = "testH5Epush"; + String err_msg = "Error message"; + long estack_id = -1; + long maj_err_id = -1; + long min_err_id = -1; + long num_msg = -1; + + try { + try { + maj_err_id = H5.H5Ecreate_msg(hdf_java_classid, HDF5Constants.H5E_MAJOR, "Error in Test"); + assertFalse("testH5Epush: H5.H5Ecreate_msg_major: " + maj_err_id, maj_err_id < 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Epush: H5.H5Ecreate_msg_major: " + err); + } + try { + min_err_id = H5.H5Ecreate_msg(hdf_java_classid, HDF5Constants.H5E_MINOR, "Error in Test Function"); + assertFalse("H5.H5Ecreate_msg_minor: " + min_err_id, min_err_id < 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Epush: H5.H5Ecreate_msg_minor: " + err); + } + + try { + estack_id = H5.H5Ecreate_stack(); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Epush: H5.H5Ecreate_stack: " + err); + } + assertFalse("testH5Epush: H5.H5Ecreate_stack: " + estack_id, estack_id < 0); + + try { + num_msg = H5.H5Eget_num(estack_id); + assertTrue("testH5Epush #:" + num_msg, num_msg == 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Epush: H5.H5Eget_num: " + err); + } + + H5.H5Epush(estack_id, "TestH5E.java", err_func, 354, hdf_java_classid, maj_err_id, min_err_id, err_msg); + + try { + num_msg = H5.H5Eget_num(estack_id); + assertTrue("testH5Epush #:" + num_msg, num_msg == 1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Epush: H5.H5Eget_num: " + err); + } + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Epush: " + err); + } + finally { + if (estack_id >= 0) + try {H5.H5Eclose_stack(estack_id);} catch (Exception ex) {} + if (maj_err_id >= 0) + try {H5.H5Eclose_msg(maj_err_id);} catch (Exception ex) {} + if (min_err_id >= 0) + try {H5.H5Eclose_msg(min_err_id);} catch (Exception ex) {} + } + } /* end test_create() */ + + @Test + public void testH5EprintInt() { + assertFalse(current_stackid < 0); + try { + H5.H5Eprint2(current_stackid, null); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5EprintInt: " + err); + } + } + + @Test + public void testH5EclearInt() { + try { + H5.H5Eclear(current_stackid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5EclearInt: " + err); + } + } + + @Test + public void testH5Eclear2() { + try { + H5.H5Eclear2(current_stackid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eclear2: " + err); + } + } + + @Test + public void testH5Eauto_is_v2() { + boolean is_v2 = false; + try { + is_v2 = H5.H5Eauto_is_v2(current_stackid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eauto_is_v2: " + err); + } + assertTrue("H5.H5Eauto_is_v2: ", is_v2); + } + + @Test + public void testH5Eget_num() { + long num_msg = -1; + try { + num_msg = H5.H5Eget_num(current_stackid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_num: " + err); + } + assertTrue("H5.H5Eget_num", num_msg == 0); + } + + @Test + public void testH5Eget_num_with_msg() { + try { + H5.H5Eset_current_stack(current_stackid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Epop: " + err); + } + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + } + + // save current stack contents + try { + current_stackid = H5.H5Eget_current_stack(); + } + catch (HDF5LibraryException err) { + err.printStackTrace(); + fail("H5.H5Epop: " + err); + } + + long num_msg = -1; + try { + num_msg = H5.H5Eget_num(current_stackid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Epop: " + err); + } + assertTrue("H5.H5Eget_num_with_msg #:" + num_msg, num_msg > 0); + } + + @Test + public void testH5Ewalk() { + class wdata { + public String err_desc = null; + public String func_name = null; + public int line = -1; + wdata(String desc, String func, int lineno) { + this.err_desc = new String(desc); + this.func_name = new String(func); + this.line = lineno; + } + } + class H5E_walk_data implements H5E_walk_t { + public ArrayList walkdata = new ArrayList(); + } + H5E_walk_t walk_data = new H5E_walk_data(); + class H5E_walk_callback implements H5E_walk_cb { + public int callback(int nidx, H5E_error2_t info, H5E_walk_t op_data) { + wdata wd = new wdata(info.desc, info.func_name, info.line); + ((H5E_walk_data)op_data).walkdata.add(wd); + return 0; + } + } + H5E_walk_cb walk_cb = new H5E_walk_callback(); + long num_msg = -1; + + try { + H5.H5Eset_current_stack(current_stackid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Ewalk:H5Eset_current_stack " + err); + } + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + } + + // save current stack contents + try { + current_stackid = H5.H5Eget_current_stack(); + } + catch (HDF5LibraryException err) { + err.printStackTrace(); + fail("H5.H5Epop: " + err); + } + + try { + num_msg = H5.H5Eget_num(current_stackid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Ewalk:H5Eget_num " + err); + } + assertTrue("testH5Ewalk #:" + num_msg, num_msg == 3); + + try { + H5.H5Ewalk2(current_stackid, HDF5Constants.H5E_WALK_UPWARD, walk_cb, walk_data); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Ewalk:H5Ewalk2 " + err); + } + assertFalse("testH5Ewalk:H5Ewalk2 ",((H5E_walk_data)walk_data).walkdata.isEmpty()); + assertTrue("testH5Ewalk:H5Ewalk2 "+((H5E_walk_data)walk_data).walkdata.size(),((H5E_walk_data)walk_data).walkdata.size()==3); + assertTrue("testH5Ewalk:H5Ewalk2 "+((wdata)((H5E_walk_data)walk_data).walkdata.get(0)).line,((wdata)((H5E_walk_data)walk_data).walkdata.get(0)).line==3767); + assertTrue("testH5Ewalk:H5Ewalk2 "+((wdata)((H5E_walk_data)walk_data).walkdata.get(1)).line,((wdata)((H5E_walk_data)walk_data).walkdata.get(1)).line==5506); + assertTrue("testH5Ewalk:H5Ewalk2 "+((wdata)((H5E_walk_data)walk_data).walkdata.get(1)).func_name,((wdata)((H5E_walk_data)walk_data).walkdata.get(1)).func_name.compareToIgnoreCase("H5P_verify_apl_and_dxpl")==0); + assertTrue("testH5Ewalk:H5Ewalk2 "+((wdata)((H5E_walk_data)walk_data).walkdata.get(0)).err_desc,((wdata)((H5E_walk_data)walk_data).walkdata.get(0)).err_desc.compareToIgnoreCase("not a property list")==0); + assertTrue("testH5Ewalk:H5Ewalk2 "+((wdata)((H5E_walk_data)walk_data).walkdata.get(1)).err_desc,((wdata)((H5E_walk_data)walk_data).walkdata.get(1)).err_desc.compareToIgnoreCase("not the required access property list")==0); + } + +} diff --git a/java/test/TestH5Edefault.java b/java/test/TestH5Edefault.java new file mode 100644 index 0000000..510aa2f --- /dev/null +++ b/java/test/TestH5Edefault.java @@ -0,0 +1,564 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Edefault { + @Rule public TestName testname = new TestName(); + + @Before + public void H5Eset_default_stack() { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + try { + // Clear any active stack messages + H5.H5Eclear2(HDF5Constants.H5E_DEFAULT); + } + catch (HDF5LibraryException err) { + err.printStackTrace(); + fail("H5Eset_default_stack: " + err); + } + } + @After + public void nextTestName() { + System.out.println(); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Eprint2_invalid_classid() throws Throwable { + H5.H5Eprint2(-1, null); + } + + @Test + public void testH5Eprint() { + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + } + try { + H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eprint: " + err); + } + } + + @Test + public void testH5Eget_current_stack() { + long num_msg = -1; + long num_msg_default = -1; + long stack_id = -1; + long stack_id_default = HDF5Constants.H5E_DEFAULT; + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + //default stack id will be different after exception + stack_id_default = HDF5Constants.H5E_DEFAULT; + //err.printStackTrace(); //This will clear the error stack + } + // Verify we have the correct number of messages + try { + num_msg_default = H5.H5Eget_num(stack_id_default); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, + num_msg_default == 3); + + //Save a copy of the current stack and clears the current stack + try { + stack_id = H5.H5Eget_current_stack(); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + assertFalse("H5.H5Eget_current_stack: get_current_stack - " + + stack_id, stack_id < 0); + assertFalse("H5.H5Eget_current_stack: get_current_stack - " + + stack_id, stack_id == stack_id_default); + + // Verify we have the correct number of messages + try { + num_msg_default = H5.H5Eget_num(stack_id_default); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, + num_msg_default == 0); + + //Verify the copy has the correct number of messages + try { + num_msg = H5.H5Eget_num(stack_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, + num_msg == 3); + + try { + H5.H5Eclose_stack(stack_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + } + + @Test + public void testH5Eget_current_stack_pop() { + long num_msg = -1; + long num_msg_default = -1; + long stack_id = -1; + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + //err.printStackTrace(); //This will clear the error stack + } + + // Verify we have the correct number of messages + try { + num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, + num_msg_default == 3); + + //Save a copy of the current stack and clears the current stack + try { + stack_id = H5.H5Eget_current_stack(); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + assertFalse("H5.H5Eget_current_stack: get_current_stack - " + + stack_id, stack_id < 0); + assertFalse("H5.H5Eget_current_stack: get_current_stack - " + + stack_id, stack_id == HDF5Constants.H5E_DEFAULT); + + // Verify we have the correct number of messages + try { + num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, + num_msg_default == 0); + + //Verify the copy has the correct number of messages + try { + num_msg = H5.H5Eget_num(stack_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, + num_msg == 3); + + //Generate errors on default stack + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + //err.printStackTrace(); //This will clear the error stack + } + + // Verify we have the correct number of messages + try { + num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg_default, + num_msg_default == 3); + + //Remove one message from the current stack + try { + H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1); + num_msg_default = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + assertTrue("H5.H5Eget_current_stack: pop #:" + num_msg_default, + num_msg_default == 2); + + //Verify the copy still has the correct number of messages + try { + num_msg = H5.H5Eget_num(stack_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + assertTrue("H5.H5Eget_current_stack: get_num #:" + num_msg, + num_msg == 3); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Eclose_stack_invalid_stackid() throws Throwable { + H5.H5Eclose_stack(-1); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Eget_class_name_invalid_classid() throws Throwable { + H5.H5Eget_class_name(-1); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Eget_class_name_invalid_classname() throws Throwable { + H5.H5Eget_class_name(HDF5Constants.H5E_DEFAULT); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Eclose_msg_invalid_errid() throws Throwable { + H5.H5Eclose_msg(-1); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Ecreate_msg_invalid_errid() throws Throwable { + H5.H5Ecreate_msg(-1, HDF5Constants.H5E_MAJOR, "null"); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Eget_msg_invalid_msgid() throws Throwable { + H5.H5Eget_msg(-1, null); + } + + @Test + public void testH5Ecreate_stack() { + try { + long stack_id = H5.H5Ecreate_stack(); + assertTrue("H5.H5Ecreate_stack", stack_id > 0); + H5.H5Eclose_stack(stack_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ecreate_stack: " + err); + } + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Eset_current_stack_invalid_stkid() throws Throwable { + H5.H5Eset_current_stack(-1); + } + + @Test + public void testH5Eset_current_stack() { + long num_msg = -1; + long stack_id = -1; + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + //err.printStackTrace(); //This will clear the error stack + } + + // Verify we have the correct number of messages + try { + num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eset_current_stack: " + err); + } + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, + num_msg == 3); + + //Save a copy of the current stack + try { + stack_id = H5.H5Eget_current_stack(); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eset_current_stack: " + err); + } + assertFalse("H5.H5Eset_current_stack: get_current_stack - " + + stack_id, stack_id < 0); + assertFalse("H5.H5Eset_current_stack: get_current_stack - " + + stack_id, stack_id == HDF5Constants.H5E_DEFAULT); + + //Verify the copy has the correct number of messages + try { + num_msg = H5.H5Eget_num(stack_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eset_current_stack: " + err); + } + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, + num_msg == 3); + + //Generate errors on default stack + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + //err.printStackTrace(); //This will clear the error stack + } + + // Verify we have the correct number of messages + try { + num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_current_stack: " + err); + } + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, + num_msg == 3); + + //Remove one message from the current stack + try { + H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1); + num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eset_current_stack: " + err); + } + assertTrue("H5.H5Eset_current_stack: pop #:" + num_msg, + num_msg == 2); + + //Verify the copy still has the correct number of messages + try { + num_msg = H5.H5Eget_num(stack_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eset_current_stack: " + err); + } + assertTrue("H5.H5Eset_current_stack: get_num #:" + num_msg, + num_msg == 3); + + try { + H5.H5Eset_current_stack(stack_id); + num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eset_current_stack: " + err); + } + assertTrue("H5.H5Eset_current_stack: get_num - " + num_msg, + num_msg == 3); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Epop_invalid_stkid() throws Throwable { + H5.H5Epop(-1, 0); + } + + @Test + public void testH5Epop() throws Throwable { + long num_msg = -1; + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + } + try { + num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Epop: " + err); + } + assertTrue("H5.H5Epop before #:" + num_msg, num_msg == 3); + try { + H5.H5Epop(HDF5Constants.H5E_DEFAULT, 1); + num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Epop: " + err); + } + assertTrue("H5.H5Epop after #:" + num_msg, num_msg == 2); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Epush_invalid_stkid() throws Throwable { + H5.H5Epush(-1, "Invalid", "Invalid", 0, -1, -1, -1, "Invalid message"); + } + + @Test(expected = NullPointerException.class) + public void testH5Epush_null_name() throws Throwable { + H5.H5Epush(HDF5Constants.H5E_DEFAULT, null, "Invalid", 0, HDF5Constants.H5E_DEFAULT, HDF5Constants.H5E_DEFAULT, HDF5Constants.H5E_DEFAULT, "Invalid message"); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5EprintInt_invalid_classid() throws Throwable { + H5.H5Eprint2(-1, null); + } + + @Test + public void testH5EprintInt() { + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + } + try { + H5.H5Eprint2(HDF5Constants.H5E_DEFAULT, null); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5EprintInt: " + err); + } + } + + @Test + public void testH5EclearInt() { + try { + H5.H5Eclear(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5EclearInt: " + err); + } + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Eclear2_invalid_stkid() throws Throwable { + H5.H5Eclear2(-1); + } + + @Test + public void testH5Eclear() { + try { + H5.H5Eclear2(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eclear2: " + err); + } + } + + @Test + public void testH5Eclear2_with_msg() { + long num_msg = -1; + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + } + try { + num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eclear2_with_msg: " + err); + } + assertTrue("H5.H5Eclear2_with_msg before #:" + num_msg, + num_msg == 3); + try { + H5.H5Eclear2(HDF5Constants.H5E_DEFAULT); + num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eclear2_with_msg: " + err); + } + assertTrue("H5.H5Eclear2_with_msg after #:" + num_msg, num_msg == 0); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Eauto_is_v2_invalid_stkid() throws Throwable { + H5.H5Eauto_is_v2(-1); + } + + @Test + public void testH5Eauto_is_v2() { + boolean is_v2 = false; + try { + is_v2 = H5.H5Eauto_is_v2(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eauto_is_v2: " + err); + } + assertTrue("H5.H5Eauto_is_v2: ", is_v2); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Eget_num_invalid_stkid() throws Throwable { + H5.H5Eget_num(-1); + } + + @Test + public void testH5Eget_num() { + long num_msg = -1; + try { + num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_num: " + err); + } + assertTrue("H5.H5Eget_num #:" + num_msg, num_msg == 0); + } + + @Test + public void testH5Eget_num_with_msg() { + long num_msg = -1; + try { + H5.H5Fopen("test", 0, 1); + } + catch (Throwable err) { + } + try { + num_msg = H5.H5Eget_num(HDF5Constants.H5E_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Eget_num_with_msg: " + err); + } + assertTrue("H5.H5Eget_num_with_msg #:" + num_msg, num_msg > 0); + } + +} diff --git a/java/test/TestH5Eregister.java b/java/test/TestH5Eregister.java new file mode 100644 index 0000000..13e0ca2 --- /dev/null +++ b/java/test/TestH5Eregister.java @@ -0,0 +1,78 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import hdf.hdf5lib.H5; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Eregister { + @Rule public TestName testname = new TestName(); + + @Before + public void checkOpenIDs() { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + @After + public void nextTestName() { + System.out.println(); + } + + @Test(expected = NullPointerException.class) + public void testH5Eregister_class_cls_name_null() throws Throwable { + H5.H5Eregister_class(null, "libname", "version"); + } + + @Test(expected = NullPointerException.class) + public void testH5Eregister_class_lib_name_null() throws Throwable { + H5.H5Eregister_class("clsname", null, "version"); + } + + @Test(expected = NullPointerException.class) + public void testH5Eregister_class_version_null() throws Throwable { + H5.H5Eregister_class("clsname", "libname", null); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Eunregister_class_invalid_classid() throws Throwable { + H5.H5Eunregister_class(-1); + } + + @Test + public void testH5Eregister_class() { + long hdf_java_classid = -1; + try { + hdf_java_classid = H5.H5Eregister_class("HDF-Java-Error", + "hdf-java", "2.5"); + } + catch (Throwable err) { + fail("H5.H5Eregister_class: " + err); + } + try { + H5.H5Eunregister_class(hdf_java_classid); + } + catch (Throwable err) { + fail("H5.H5Eunregister_class: " + err); + } + } +} diff --git a/java/test/TestH5F.java b/java/test/TestH5F.java new file mode 100644 index 0000000..3451187 --- /dev/null +++ b/java/test/TestH5F.java @@ -0,0 +1,332 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5F { + @Rule public TestName testname = new TestName(); + private static final String H5_FILE = "test.h5"; + + private static final int COUNT_OBJ_FILE = 1; + private static final int COUNT_OBJ_DATASET = 0; + private static final int COUNT_OBJ_GROUP = 0; + private static final int COUNT_OBJ_DATATYPE = 0; + private static final int COUNT_OBJ_ATTR = 0; + private static final int COUNT_OBJ_ALL = (COUNT_OBJ_FILE + + COUNT_OBJ_DATASET + COUNT_OBJ_GROUP + COUNT_OBJ_DATATYPE + COUNT_OBJ_ATTR); + private static final int[] OBJ_COUNTS = { COUNT_OBJ_FILE, + COUNT_OBJ_DATASET, COUNT_OBJ_GROUP, COUNT_OBJ_DATATYPE, + COUNT_OBJ_ATTR, COUNT_OBJ_ALL }; + private static final int[] OBJ_TYPES = { HDF5Constants.H5F_OBJ_FILE, + HDF5Constants.H5F_OBJ_DATASET, HDF5Constants.H5F_OBJ_GROUP, + HDF5Constants.H5F_OBJ_DATATYPE, HDF5Constants.H5F_OBJ_ATTR, + HDF5Constants.H5F_OBJ_ALL }; + long H5fid = -1; + + private final void _deleteFile(String filename) { + File file = new File(filename); + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + @Before + public void createH5file() + throws HDF5LibraryException, NullPointerException { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + H5fid = -1; + } + _deleteFile(H5_FILE); + System.out.println(); + } + + @Test + public void testH5Fget_create_plist() { + long plist = -1; + + try { + plist = H5.H5Fget_create_plist(H5fid); + } + catch (Throwable err) { + fail("H5.H5Fget_create_plist: " + err); + } + assertTrue(plist > 0); + try {H5.H5Pclose(plist);} catch (HDF5LibraryException e) {e.printStackTrace();} + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Fget_create_plist_closed() throws Throwable { + long fid = -1; + + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + H5fid = -1; + } + + try { + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + try { + H5.H5Fclose(fid); + } + catch (Exception ex) { + } + + // it should fail because the file was closed. + H5.H5Fget_create_plist(fid); + } + + @Test + public void testH5Fget_access_plist() { + long plist = -1; + + try { + plist = H5.H5Fget_access_plist(H5fid); + } + catch (Throwable err) { + fail("H5.H5Fget_access_plist: " + err); + } + assertTrue(plist > 0); + try {H5.H5Pclose(plist);} catch (HDF5LibraryException e) {e.printStackTrace();} + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Fget_access_plist_closed() throws Throwable { + long fid = -1; + + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + H5fid = -1; + } + + try { + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + try { + H5.H5Fclose(fid); + } + catch (Exception ex) { + } + + // it should fail because the file was closed. + H5.H5Fget_access_plist(fid); + } + + @Test + public void testH5Fget_intent_rdwr() { + int intent = 0; + long fid = -1; + + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + H5fid = -1; + } + + try { + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + try { + intent = H5.H5Fget_intent(fid); + } + catch (Throwable err) { + fail("H5.H5Fget_intent: " + err); + } + assertEquals(HDF5Constants.H5F_ACC_RDWR, intent); + + try { + H5.H5Fclose(fid); + } + catch (Exception ex) { + } + } + + @Test + public void testH5Fget_intent_rdonly() { + int intent = 0; + long fid = -1; + + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + H5fid = -1; + } + + try { + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + try { + intent = H5.H5Fget_intent(fid); + } + catch (Throwable err) { + fail("H5.H5Fget_intent: " + err); + } + assertEquals(HDF5Constants.H5F_ACC_RDONLY, intent); + + try { + H5.H5Fclose(fid); + } + catch (Exception ex) { + } + } + + @Test + public void testH5Fget_obj_count() { + long count = -1; + + for (int i = 0; i < OBJ_TYPES.length; i++) { + try { + count = H5.H5Fget_obj_count(H5fid, OBJ_TYPES[i]); + } + catch (Throwable err) { + fail("H5.H5Fget_obj_count: " + err); + } + + assertEquals(count, OBJ_COUNTS[i]); + } + } + + @Test + public void testH5Fget_obj_ids() { + long count = 0; + long max_objs = 100; + long[] obj_id_list = new long[(int)max_objs]; + int[] open_obj_counts = new int[OBJ_TYPES.length]; + + for (int i = 0; i < OBJ_TYPES.length; i++) + open_obj_counts[i] = 0; + + open_obj_counts[0] = 1; + for (int i = 0; i < OBJ_TYPES.length - 1; i++) + open_obj_counts[OBJ_TYPES.length - 1] += open_obj_counts[i]; + + for (int i = 0; i < OBJ_TYPES.length; i++) { + try { + count = H5.H5Fget_obj_ids(H5fid, OBJ_TYPES[i], max_objs, + obj_id_list); + } + catch (Throwable err) { + fail("H5.H5Fget_obj_ids: " + err); + } + assertEquals(count, open_obj_counts[i]); + } + } + /** + * TODO: need to add objects to the file after H5G[D,T]create() functions + * are implemented. + */ + // + // @Test + // public void testH5Fmount_unmount() { + // String file1 = "src.h5"; + // String file2 = "dst.h5"; + // String group1 = "/G"; + // String group2 = "/MOUNTED"; + // + // _createH5File(file1); + // _createH5File(file2); + // + // int fid1 = _openFile(file1, HDF5Constants.H5F_ACC_RDWR); + // assertTrue(fid1 > 0); + // + // int fid2 = _openFile(file2, HDF5Constants.H5F_ACC_RDWR); + // assertTrue(fid2 > 0); + // + // // create a group at file1 + // int gid = _createGroup(fid1, group1); + // try { H5.H5Gclose(gid); } catch (Exception ex) {} + // + // // create a group at file 2 + // gid = _createGroup(fid2, group2); + // try { H5.H5Gclose(gid); } catch (Exception ex) {} + // + // // before mount, "/G/MOUNTED" does not exists in file1 + // gid = _openGroup(fid1, group1+group2); + // assertTrue(gid < 0); + // + // // Mount file2 under G in the file1 + // try { + // H5.H5Fmount(fid1, group1, fid2, HDF5Constants.H5P_DEFAULT); + // } + // catch (Throwable err) { + // fail("H5.H5Fmount: "+err); + // } + // + // // now file1 should have group "/G/MOUNTED" + // gid = _openGroup(fid1, group1+group2); + // assertTrue(gid > 0); + // try { H5.H5Gclose(gid); } catch (Exception ex) {} + // + // // unmount file2 from file1 + // try { + // H5.H5Funmount(fid1, group1); + // } + // catch (Throwable err) { + // fail("H5.H5Funmount: "+err); + // } + // + // // file2 was unmounted from file1, "/G/MOUNTED" does not exists in file1 + // gid = _openGroup(fid1, group1+group2); + // assertTrue(gid < 0); + // + // try { H5.H5Fclose(fid1); } catch (Exception ex) {} + // try { H5.H5Fclose(fid2); } catch (Exception ex) {} + // + // _deleteFile(file1); + // _deleteFile(file2); + // } +} diff --git a/java/test/TestH5Fbasic.java b/java/test/TestH5Fbasic.java new file mode 100644 index 0000000..c08daff --- /dev/null +++ b/java/test/TestH5Fbasic.java @@ -0,0 +1,320 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Fbasic { + @Rule public TestName testname = new TestName(); + private static final String H5_FILE = "test.h5"; + private static final String TXT_FILE = "test.txt"; + long H5fid = -1; + + private final void _deleteFile(String filename) { + File file = new File(filename); + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + @Before + public void createH5file() throws HDF5LibraryException, NullPointerException { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + } + _deleteFile(H5_FILE); + System.out.println(); + } + + @Test + public void testH5Fcreate() { + assertTrue(H5fid > 0); + } + + @Test + public void testH5Fis_hdf5() { + boolean isH5 = false; + + try { + isH5 = H5.H5Fis_hdf5(H5_FILE); + } + catch (Throwable err) { + fail("H5.H5Fis_hdf5 failed on " + H5_FILE + ": " + err); + } + assertTrue(isH5 == true); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Fcreate_EXCL() throws Throwable { + H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_EXCL, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Fopen_read_only() throws Throwable { + long fid = -1; + + try { + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + try { + H5.H5Fclose(fid); + } + catch (Exception ex) { + } + + // set the file to read-only + File file = new File(H5_FILE); + if (file.setWritable(false)) { + // this should fail. + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, + HDF5Constants.H5P_DEFAULT); + + try { + H5.H5Fclose(fid); + } + catch (Exception ex) { + } + } + else { + fail("File.setWritable(true) failed."); + } + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Freopen_closed() throws Throwable { + long fid = -1; + long fid2 = -1; + + try { + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + + try { + H5.H5Fclose(fid); + } + catch (Exception ex) { + } + + // should fail because the file was closed. + fid2 = H5.H5Freopen(fid); + } + + @Test + public void testH5Freopen() { + long fid = -1; + long fid2 = -1; + + try { + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + + try { + fid2 = H5.H5Freopen(fid); + } + catch (Throwable err) { + fail("H5.H5Freopen: " + err); + } + assertTrue(fid2 > 0); + + try { + H5.H5Fclose(fid2); + } + catch (Exception ex) { + } + + try { + H5.H5Fclose(fid); + } + catch (Exception ex) { + } + } + + @Test + public void testH5Fclose() { + long fid = -1; + + try { + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + + try { + H5.H5Fclose(fid); + } + catch (Throwable err) { + fail("H5.H5Fclose: " + err); + } + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Fclose_twice() throws Throwable { + long fid = -1; + + try { + fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDWR, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + + try { + H5.H5Fclose(fid); + } + catch (Throwable err) { + fail("H5.H5Fclose: " + err); + } + + // it should fail since the file was closed. + H5.H5Fclose(fid); + } + + @Test + public void testH5Fget_freespace() { + long freeSpace = 0; + + try { + freeSpace = H5.H5Fget_freespace(H5fid); + } + catch (Throwable err) { + fail("H5.H5Fget_freespace: " + err); + } + assertEquals(freeSpace, 0); + } + + // TODO add/and delete objects and test freespace + + @Test + public void testH5Fget_filesize() { + long fileSize = 0; + + try { + fileSize = H5.H5Fget_filesize(H5fid); + } + catch (Throwable err) { + fail("H5.H5Fget_freespace: " + err); + } + assertTrue(fileSize > 0); + } + + // TODO add/and delete objects and test freespace + + @Test + public void testH5Fget_mdc_hit_rate() { + double rate; + + try { + rate = H5.H5Fget_mdc_hit_rate(H5fid); + } + catch (Throwable err) { + fail("H5.H5Fget_mdc_hit_rate: " + err); + } + } + + @Test + public void testH5Fget_mdc_size() { + int nentries = -1; + long cache_sizes[] = new long[3]; + + try { + nentries = H5.H5Fget_mdc_size(H5fid, cache_sizes); + } + catch (Throwable err) { + fail("H5.H5Fget_mdc_size: " + err); + } + assertTrue("H5.H5Fget_mdc_size #:" + nentries, nentries == 4); + } + + // TODO: test more cases of different cache sizes. + + @Test + public void testH5Freset_mdc_hit_rate_stats() { + + try { + H5.H5Freset_mdc_hit_rate_stats(H5fid); + } + catch (Throwable err) { + fail("H5.H5Freset_mdc_hit_rate_stats: " + err); + } + } + + @Test + public void testH5Fget_name() { + String fname = null; + + try { + fname = H5.H5Fget_name(H5fid); + } + catch (Throwable err) { + fail("H5.H5Fget_name: " + err); + } + assertNotNull(fname); + assertEquals(fname, H5_FILE); + } + + @Test + public void testH5Fclear_elink_file_cache() { + + try { + H5.H5Fclear_elink_file_cache(H5fid); + } + catch (Throwable err) { + fail("H5.H5Freset_mdc_hit_rate_stats: " + err); + } + } +} diff --git a/java/test/TestH5Fparams.java b/java/test/TestH5Fparams.java new file mode 100644 index 0000000..2d67f3d --- /dev/null +++ b/java/test/TestH5Fparams.java @@ -0,0 +1,215 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.structs.H5F_info2_t; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Fparams { + @Rule public TestName testname = new TestName(); + + @Before + public void checkOpenIDs() { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + @After + public void nextTestName() { + System.out.println(); + } + + @Test(expected = NullPointerException.class) + public void testH5Fcreate_null() throws Throwable { + H5.H5Fcreate(null, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = NullPointerException.class) + public void testH5Fopen_null() throws Throwable { + H5.H5Fopen(null, HDF5Constants.H5F_ACC_RDWR, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = NullPointerException.class) + public void testH5Fis_hdf5_null() throws Throwable { + H5.H5Fis_hdf5(null); + } + + @Test(expected = NullPointerException.class) + public void testH5Fmount_null() throws Throwable { + H5.H5Fmount(-1, null, -1, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = NullPointerException.class) + public void testH5Funmount_null() throws Throwable { + H5.H5Funmount(-1, null); + } + + @Test + public void testH5Fis_hdf5_text() { + File txtFile = null; + boolean isH5 = false; + + try { + txtFile = new File("test.txt"); + if (!txtFile.exists()) + txtFile.createNewFile(); + isH5 = H5.H5Fis_hdf5("test.txt"); + } + catch (Throwable err) { + fail("H5.H5Fis_hdf5 failed on test.txt: " + err); + } + + assertFalse(isH5); + + try { + txtFile.delete(); + } + catch (SecurityException e) { + ;// e.printStackTrace(); + } + } + + @Test//(expected = HDF5LibraryException.class) + public void testH5Fclose_negative() throws Throwable { + // cannot close a file with negative id. + int fid = H5.H5Fclose(-1); + assertTrue(fid == 0); + } + + @Test + public void testH5Fcreate() { + long fid = -1; + File file = null; + + try { + fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + if (fid > 0) { + H5.H5Fclose(fid); + } + file = new File("test.h5"); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + + if (file.exists()) { + try { + file.delete(); + } + catch (SecurityException e) { + ;// e.printStackTrace(); + } + } + } + + @Test + public void testH5Fflush_global() { + long fid = -1; + + try { + fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + + try { + H5.H5Fflush(fid, HDF5Constants.H5F_SCOPE_GLOBAL); + } + catch (Throwable err) { + fail("H5.H5Fflush: " + err); + } + + try { + H5.H5Fclose(fid); + } + catch (Exception ex) { + } + } + + @Test + public void testH5Fflush_local() { + long fid = -1; + + try { + fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + + try { + H5.H5Fflush(fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + fail("H5.H5Fflush: " + err); + } + + try { + H5.H5Fclose(fid); + } + catch (Exception ex) { + } + } + + @Test + public void testH5Fget_info() { + long fid = -1; + + try { + try { + fid = H5.H5Fcreate("test.h5", HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + fail("H5.H5Fopen: " + err); + } + + try { + H5F_info2_t finfo = H5.H5Fget_info(fid); + assertEquals(finfo.super_version, 0); + assertEquals(finfo.free_version, 0); + assertEquals(finfo.sohm_version, 0); + } + catch (Throwable err) { + fail("H5.H5Fget_info: " + err); + } + } + catch (Exception e) { + e.printStackTrace(); + } + finally { + try {H5.H5Fclose(fid);} catch (Exception ex) {} + } + } +} diff --git a/java/test/TestH5G.java b/java/test/TestH5G.java new file mode 100644 index 0000000..32329bb --- /dev/null +++ b/java/test/TestH5G.java @@ -0,0 +1,505 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.structs.H5G_info_t; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5G { + @Rule public TestName testname = new TestName(); + private static final String H5_FILE = "test.h5"; + private static final String H5_FILE2 = "test2.h5"; + private static final String[] GROUPS = { "/G1", "/G1/G11", "/G1/G12", + "/G1/G11/G111", "/G1/G11/G112", "/G1/G11/G113", "/G1/G11/G114" }; + private static final String[] GROUPS2 = { "/G1", "/G1/G14", "/G1/G12", "/G1/G13", "/G1/G11"}; + long H5fid = -1; + long H5fid2 = -1; + + private final long _createGroup(long fid, String name) { + long gid = -1; + try { + gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gcreate: " + err); + } + assertTrue("TestH5G._createGroup: ", gid > 0); + + return gid; + } + + private final long _createGroup2(long fid, String name) { + long gid = -1; + long gcpl = -1; + try { + gcpl = H5.H5Pcreate(HDF5Constants.H5P_GROUP_CREATE); //create gcpl + } + catch (final Exception ex) { + fail("H5.H5Pcreate(): " + ex); + } + assertTrue("TestH5G._createGroup2: ", gcpl >= 0); + try { + H5.H5Pset_link_creation_order(gcpl, HDF5Constants.H5P_CRT_ORDER_TRACKED + + HDF5Constants.H5P_CRT_ORDER_INDEXED); // Set link creation order + } + catch (final Exception ex) { + try {H5.H5Pclose(gcpl);} catch (final Exception exx) {} + fail("H5.H5Pset_link_creation_order: " + ex); + } + try { + gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, + gcpl, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gcreate: " + err); + } + finally { + try {H5.H5Pclose(gcpl);} catch (final Exception ex) {} + } + assertTrue("TestH5G._createGroup2: ", gid > 0); + + return gid; + } + + private final long _openGroup(long fid, String name) { + long gid = -1; + try { + gid = H5.H5Gopen(fid, name, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + gid = -1; + err.printStackTrace(); + fail("H5.H5Gopen: " + err); + } + assertTrue("TestH5G._openGroup: ", gid > 0); + + return gid; + } + + private final void _deleteFile(String filename) { + File file = new File(filename); + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + @Before + public void createH5file() + throws HDF5LibraryException, NullPointerException { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + try { + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + + H5fid2 = H5.H5Fcreate(H5_FILE2, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.createH5file: " + err); + } + assertTrue("TestH5G.createH5file: H5.H5Fcreate: ", H5fid > 0); + assertTrue("TestH5G.createH5file: H5.H5Fcreate: ", H5fid2 > 0); + + long gid = -1; + + for (int i = 0; i < GROUPS.length; i++) { + gid = _createGroup(H5fid, GROUPS[i]); + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + for (int i = 0; i < GROUPS2.length; i++) { + gid = _createGroup2(H5fid2, GROUPS2[i]); + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + H5.H5Fflush(H5fid2, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + } + if (H5fid2 > 0) { + try {H5.H5Fclose(H5fid2);} catch (Exception ex) {} + } + _deleteFile(H5_FILE); + _deleteFile(H5_FILE2); + System.out.println(); + } + + @Test + public void testH5Gopen() { + long gid = -1; + for (int i = 0; i < GROUPS.length; i++) { + try { + gid = H5.H5Gopen(H5fid, GROUPS[i], HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gopen: H5.H5Gopen: " + err); + } + assertTrue("TestH5G.testH5Gopen: ", gid > 0); + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } + } + } + + @Test + public void testH5Gget_create_plist() { + long gid = -1; + long pid = -1; + + for (int i = 0; i < GROUPS.length; i++) { + try { + gid = H5.H5Gopen(H5fid, GROUPS[i], HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_create_plist: H5.H5Gopen: " + err); + } + assertTrue("TestH5G.testH5Gget_create_plist: ", gid > 0); + + try { + pid = H5.H5Gget_create_plist(gid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_create_plist: H5.H5Gget_create_plist: " + err); + } + assertTrue("TestH5G.testH5Gget_create_plist: ", pid > 0); + + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } + } + } + + @Test + public void testH5Gget_info() { + H5G_info_t info = null; + + for (int i = 0; i < GROUPS.length; i++) { + + try { + info = H5.H5Gget_info(H5fid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_info: H5.H5Gget_info: " + err); + } + assertNotNull("TestH5G.testH5Gget_info: ", info); + } + } + + @Test + public void testH5Gget_info_by_name() { + H5G_info_t info = null; + + for (int i = 0; i < GROUPS.length; i++) { + try { + info = H5.H5Gget_info_by_name(H5fid, GROUPS[i], + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_info_by_name: H5.H5Gget_info_by_name: " + err); + } + assertNotNull("TestH5G.testH5Gget_info_by_name: ", info); + } + } + + @Test + public void testH5Gget_info_by_idx() { + H5G_info_t info = null; + for (int i = 0; i < 2; i++) { + try { + info = H5.H5Gget_info_by_idx(H5fid, "/G1", + HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, + i, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_info_by_idx: H5.H5Gget_info_by_idx: " + err); + } + assertNotNull("TestH5G.testH5Gget_info_by_idx: ", info); + } + } + + @Test + public void testH5Gget_obj_info_all() { + H5G_info_t info = null; + + long gid = _openGroup(H5fid, GROUPS[0]); + + try { + info = H5.H5Gget_info(gid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_obj_info_all: H5.H5Gget_info: " + err); + } + finally { + try {H5.H5Gclose(gid);} catch (Exception ex) { } + } + assertNotNull("TestH5G.testH5Gget_obj_info_all: ", info); + assertTrue("TestH5G.testH5Gget_obj_info_all: number of links is empty", info.nlinks > 0); + String objNames[] = new String[(int) info.nlinks]; + int objTypes[] = new int[(int) info.nlinks]; + int lnkTypes[] = new int[(int) info.nlinks]; + long objRefs[] = new long[(int) info.nlinks]; + + int names_found = 0; + try { + names_found = H5.H5Gget_obj_info_all(H5fid, GROUPS[0], objNames, + objTypes, lnkTypes, objRefs, HDF5Constants.H5_INDEX_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_obj_info_all: H5.H5Gget_obj_info_all: " + err); + } + + assertTrue("number found[" + names_found + "] different than expected[" + + objNames.length + "]", names_found == objNames.length); + for (int i = 0; i < objNames.length; i++) { + assertNotNull("name #" + i + " does not exist", objNames[i]); + assertTrue("TestH5G.testH5Gget_obj_info_all: ", objNames[i].length() > 0); + } + } + + @Test + public void testH5Gget_obj_info_all_gid() { + H5G_info_t info = null; + + long gid = _openGroup(H5fid, GROUPS[0]); + + try { + info = H5.H5Gget_info(gid); + assertNotNull("TestH5G.testH5Gget_obj_info_all_gid: ", info); + assertTrue("TestH5G.testH5Gget_obj_info_all_gid: number of links is empty", info.nlinks > 0); + String objNames[] = new String[(int) info.nlinks]; + long objRefs[] = new long[(int) info.nlinks]; + int lnkTypes[] = new int[(int) info.nlinks]; + int objTypes[] = new int[(int) info.nlinks]; + + int names_found = 0; + try { + names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes, + objRefs, HDF5Constants.H5_INDEX_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_obj_info_all_gid: H5.H5Gget_obj_info_all: " + err); + } + + assertTrue("TestH5G.testH5Gget_obj_info_all_gid: number found[" + names_found + "] different than expected[" + + objNames.length + "]", names_found == objNames.length); + for (int i = 0; i < objNames.length; i++) { + assertNotNull("TestH5G.testH5Gget_obj_info_all_gid: name #" + i + " does not exist", objNames[i]); + assertTrue("TestH5G.testH5Gget_obj_info_all_gid: ", objNames[i].length() > 0); + } + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_obj_info_all_gid: H5.H5Gget_info: " + err); + } + finally { + try {H5.H5Gclose(gid);} catch (Exception ex) { } + } + } + + @Test + public void testH5Gget_obj_info_all_gid2() { + H5G_info_t info = null; + + long gid = _openGroup(H5fid, GROUPS[1]); + + try { + info = H5.H5Gget_info(gid); + assertNotNull("TestH5G.testH5Gget_obj_info_all_gid2: ", info); + assertTrue("TestH5G.testH5Gget_obj_info_all_gid2: number of links is empty", info.nlinks > 0); + String objNames[] = new String[(int) info.nlinks]; + long objRefs[] = new long[(int) info.nlinks]; + int lnkTypes[] = new int[(int) info.nlinks]; + int objTypes[] = new int[(int) info.nlinks]; + + int names_found = 0; + try { + names_found = H5.H5Gget_obj_info_all(gid, null, objNames, objTypes, lnkTypes, + objRefs, HDF5Constants.H5_INDEX_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_obj_info_all_gid2: H5.H5Gget_obj_info_all: " + err); + } + + assertTrue("TestH5G.testH5Gget_obj_info_all_gid2: number found[" + names_found + "] different than expected[" + + objNames.length + "]", names_found == objNames.length); + for (int i = 0; i < objNames.length; i++) { + assertNotNull("TestH5G.testH5Gget_obj_info_all_gid2: name #" + i + " does not exist", objNames[i]); + assertTrue("TestH5G.testH5Gget_obj_info_all_gid2: ", objNames[i].length() > 0); + } + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_obj_info_all_gid2: H5.H5Gget_info: " + err); + } + finally { + try {H5.H5Gclose(gid);} catch (Exception ex) { } + } + } + + @Test + public void testH5Gget_obj_info_max() { + long gid = _openGroup(H5fid, GROUPS[0]); + long groups_max_size = GROUPS.length + 1; + String objNames[] = new String[(int)groups_max_size]; + int objTypes[] = new int[(int)groups_max_size]; + int lnkTypes[] = new int[(int)groups_max_size]; + long objRefs[] = new long[(int)groups_max_size]; + + int names_found = 0; + try { + names_found = H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes, + objRefs, groups_max_size); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_obj_info_max: H5.H5Gget_obj_info_max: " + err); + } + finally { + try {H5.H5Gclose(gid);} catch (Exception ex) { } + } + + // expected number does not include root group + assertTrue("TestH5G.testH5Gget_obj_info_max: number found[" + names_found + "] different than expected[" + + (GROUPS.length - 1) + "]", names_found == (GROUPS.length - 1)); + for (int i = 0; i < GROUPS.length-1; i++) { + assertNotNull("TestH5G.testH5Gget_obj_info_max: name #"+i+" does not exist",objNames[i]); + assertTrue("TestH5G.testH5Gget_obj_info_max: ", objNames[i].length()>0); + } + } + + @Test + public void testH5Gget_obj_info_max_limit() { + long gid = _openGroup(H5fid, GROUPS[0]); + long groups_max_size = GROUPS.length - 3; + String objNames[] = new String[(int)groups_max_size]; + int objTypes[] = new int[(int)groups_max_size]; + int lnkTypes[] = new int[(int)groups_max_size]; + long objRefs[] = new long[(int)groups_max_size]; + + int names_found = 0; + try { + names_found = H5.H5Gget_obj_info_max(gid, objNames, objTypes, lnkTypes, + objRefs, groups_max_size); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_obj_info_max_limit: H5.H5Gget_obj_info_max: " + err); + } + finally { + try {H5.H5Gclose(gid);} catch (Exception ex) { } + } + + assertTrue("TestH5G.testH5Gget_obj_info_max_limit: number found[" + names_found + "] different than expected[" + + groups_max_size + "]", names_found == groups_max_size); + for (int i = 0; i < objNames.length; i++) { + assertNotNull("TestH5G.testH5Gget_obj_info_max_limit: name #" + i + " does not exist", objNames[i]); + assertTrue("TestH5G.testH5Gget_obj_info_max_limit: ", objNames[i].length() > 0); + } + } + + @Test + public void testH5Gget_obj_info_all_byIndexType() { + H5G_info_t info = null; + + long gid = _openGroup(H5fid2, GROUPS2[0]); + + try { + info = H5.H5Gget_info(gid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_obj_info_all_byIndexType: H5.H5Gget_info: " + err); + } + finally { + try {H5.H5Gclose(gid);} catch (Exception ex) { } + } + + assertNotNull("TestH5G.testH5Gget_obj_info_all_byIndexType: ", info); + assertTrue("TestH5G.testH5Gget_obj_info_all_byIndexType: number of links is empty", info.nlinks > 0); + String objNames[] = new String[(int) info.nlinks]; + int objTypes[] = new int[(int) info.nlinks]; + int lnkTypes[] = new int[(int) info.nlinks]; + long objRefs[] = new long[(int) info.nlinks]; + + try { + H5.H5Gget_obj_info_all(H5fid2, GROUPS2[0], objNames, + objTypes, lnkTypes, objRefs, HDF5Constants.H5_INDEX_CRT_ORDER); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_obj_info_all_byIndexType: H5.H5Gget_obj_info_all: " + err); + } + + assertEquals("G12",objNames[1]); + assertEquals("G13", objNames[2] ); + assertEquals("G11", objNames[3] ); + + try { + H5.H5Gget_obj_info_all(H5fid2, GROUPS2[0], objNames, + objTypes, lnkTypes, objRefs, HDF5Constants.H5_INDEX_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5G.testH5Gget_obj_info_all_byIndexType: H5.H5Gget_obj_info_all: " + err); + } + + assertEquals("G12",objNames[1]); + assertEquals("G13", objNames[2] ); + assertEquals("G14", objNames[3] ); + } + +} diff --git a/java/test/TestH5Gbasic.java b/java/test/TestH5Gbasic.java new file mode 100644 index 0000000..70acef4 --- /dev/null +++ b/java/test/TestH5Gbasic.java @@ -0,0 +1,371 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.structs.H5G_info_t; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Gbasic { + @Rule public TestName testname = new TestName(); + private static final String H5_FILE = "test.h5"; + long H5fid = -1; + + private final long _createGroup(long fid, String name) { + long gid = -1; + try { + gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gcreate: " + err); + } + + return gid; + } + + private final void _deleteFile(String filename) { + File file = new File(filename); + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + @Before + public void createH5file() + throws HDF5LibraryException, NullPointerException { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + } + _deleteFile(H5_FILE); + System.out.println(); + } + + @Test//(expected = HDF5LibraryException.class) + public void testH5Gclose_invalid() throws Throwable { + long gid = H5.H5Gclose(-1); + assertTrue(gid == 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Gcreate_null() throws Throwable { + long gid = -1; + + // it should fail because the group name is null + gid = H5.H5Gcreate(H5fid, null, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Gcreate_invalid() throws Throwable { + H5.H5Gcreate(-1, "Invalid ID", HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Gcreate() { + long gid = -1; + try { + gid = H5.H5Gcreate(H5fid, "/testH5Gcreate", + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gcreate: " + err); + } + assertTrue(gid > 0); + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + @Test + public void testH5Gclose() { + long gid = _createGroup(H5fid, "/testH5Gcreate"); + assertTrue(gid > 0); + + try { + H5.H5Gclose(gid); + } + catch (Throwable err) { + fail("H5Gclose: " + err); + } + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Gcreate_exists() throws Throwable { + long gid = _createGroup(H5fid, "/testH5Gcreate"); + assertTrue(gid > 0); + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + + // it should failed now because the group already exists in file + gid = H5.H5Gcreate(H5fid, "/testH5Gcreate", + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Gcreate_anon() { + long gid = -1; + try { + gid = H5.H5Gcreate_anon(H5fid, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gcreate_anon: " + err); + } + assertTrue(gid > 0); + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + @Test(expected = NullPointerException.class) + public void testH5Gopen_null() throws Throwable { + long gid = -1; + + gid = H5.H5Gopen(H5fid, null, HDF5Constants.H5P_DEFAULT); + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Gopen_invalid() throws Throwable { + H5.H5Gopen(-1, "Invalid ID", HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Gopen_not_exists() throws Throwable { + long gid = -1; + + gid = H5.H5Gopen(H5fid, "Never_created", HDF5Constants.H5P_DEFAULT); + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + @Test + public void testH5Gopen() { + long gid = _createGroup(H5fid, "/testH5Gcreate"); + assertTrue(gid > 0); + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + + try { + gid = H5.H5Gopen(H5fid, "/testH5Gcreate", + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gopen: " + err); + } + assertTrue(gid > 0); + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Gget_create_plist_invalid() throws Throwable { + H5.H5Gget_create_plist(-1); + } + + @Test + public void testH5Gget_create_plist() { + long pid = -1; + long gid = _createGroup(H5fid, "/testH5Gcreate"); + assertTrue(gid > 0); + + try { + pid = H5.H5Gget_create_plist(gid); + } + catch (Throwable err) { + try {H5.H5Gclose(gid);} catch (Exception ex) {} + err.printStackTrace(); + fail("H5.H5Gget_create_plist: " + err); + } + assertTrue(pid > 0); + + try {H5.H5Pclose(pid);} catch (Exception ex) {} + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Gget_info_invalid() throws Throwable { + H5.H5Gget_info(-1); + } + + @Test + public void testH5Gget_info() { + H5G_info_t info = null; + long gid = _createGroup(H5fid, "/testH5Gcreate"); + assertTrue(gid > 0); + + try { + info = H5.H5Gget_info(gid); + } + catch (Throwable err) { + try {H5.H5Gclose(gid);} catch (Exception ex) {} + err.printStackTrace(); + fail("H5.H5Gget_info: " + err); + } + assertNotNull(info); + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + @Test(expected = NullPointerException.class) + public void testH5Gget_info_by_name_null() throws Throwable { + H5.H5Gget_info_by_name(-1, null, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Gget_info_by_name_invalid() throws Throwable { + H5.H5Gget_info_by_name(-1, "/testH5Gcreate", HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Gget_info_by_name_not_exists() throws Throwable { + H5.H5Gget_info_by_name(H5fid, "/testH5Gcreate", + HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Gget_info_by_name() { + H5G_info_t info = null; + long gid = _createGroup(H5fid, "/testH5Gcreate"); + assertTrue(gid > 0); + + try { + info = H5.H5Gget_info_by_name(gid, "/testH5Gcreate", + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + try {H5.H5Gclose(gid);} catch (Exception ex) {} + err.printStackTrace(); + fail("H5.H5Gget_info_by_name: " + err); + } + assertNotNull(info); + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + @Test + public void testH5Gget_info_by_name_fileid() { + H5G_info_t info = null; + long gid = _createGroup(H5fid, "/testH5Gcreate"); + assertTrue(gid > 0); + try {H5.H5Gclose(gid);} catch (Exception ex) {} + + try { + info = H5.H5Gget_info_by_name(H5fid, "/testH5Gcreate", + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + try {H5.H5Gclose(gid);} catch (Exception ex) {} + err.printStackTrace(); + fail("H5.H5Gget_info_by_name: " + err); + } + assertNotNull(info); + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + @Test(expected = NullPointerException.class) + public void testH5Gget_info_by_idx_null() throws Throwable { + H5.H5Gget_info_by_idx(-1, null, HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_INC, 1L, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Gget_info_by_idx_invalid() throws Throwable { + H5.H5Gget_info_by_idx(-1, "/testH5Gcreate", HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_INC, 1L, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Gget_info_by_idx_not_exists() throws Throwable { + H5.H5Gget_info_by_idx(H5fid, "/testH5Gcreate", + HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 1L, + HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Gget_info_by_idx() { + H5G_info_t info = null; + long gid = _createGroup(H5fid, "/testH5Gcreate"); + assertTrue(gid > 0); + + try { + info = H5.H5Gget_info_by_idx(gid, "/", HDF5Constants.H5_INDEX_NAME, + HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gget_info_by_idx: " + err); + } + assertNotNull(info); + + try {H5.H5Gclose(gid);} catch (Exception ex) {} + } + + @Test + public void testH5Gget_info_by_idx_fileid() { + H5G_info_t info = null; + long gid = _createGroup(H5fid, "/testH5Gcreate"); + assertTrue(gid > 0); + try {H5.H5Gclose(gid);} catch (Exception ex) {} + + try { + info = H5.H5Gget_info_by_idx(H5fid, "/", + HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gget_info_by_idx: " + err); + } + assertNotNull(info); + } + +} diff --git a/java/test/TestH5Giterate.java b/java/test/TestH5Giterate.java new file mode 100644 index 0000000..17f594e --- /dev/null +++ b/java/test/TestH5Giterate.java @@ -0,0 +1,136 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.structs.H5G_info_t; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Giterate { + @Rule public TestName testname = new TestName(); + private static final String H5_FILE = "h5ex_g_iterate.hdf"; + long H5fid = -1; + + private final long _openGroup(long fid, String name) { + long gid = -1; + try { + gid = H5.H5Gopen(fid, name, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + gid = -1; + err.printStackTrace(); + fail("H5.H5Gcreate: " + err); + } + + return gid; + } + + @Before + public void openH5file() + throws HDF5LibraryException, NullPointerException { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + try { + H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Fopen: openH5file: " + err); + } + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + } + System.out.println(); + } + + @Test + public void testH5Gget_obj_info_all() { + H5G_info_t info = null; + + long gid = _openGroup(H5fid, "/"); + + try { + info = H5.H5Gget_info(gid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gget_info: " + err); + } + try { + H5.H5Gclose(gid); + } + catch (Exception ex) { + } + assertNotNull(info); + assertTrue("number of links is empty", info.nlinks > 0); + String objNames[] = new String[(int) info.nlinks]; + int objTypes[] = new int[(int) info.nlinks]; + int lnkTypes[] = new int[(int) info.nlinks]; + long objRefs[] = new long[(int) info.nlinks]; + + int names_found = 0; + try { + names_found = H5.H5Gget_obj_info_all(H5fid, "/", objNames, + objTypes, lnkTypes, objRefs, HDF5Constants.H5_INDEX_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gget_obj_info_all: " + err); + } + + assertTrue("number found[" + names_found + "] different than expected[" + + objNames.length + "]", names_found == objNames.length); + for (int i = 0; i < objNames.length; i++) { + assertNotNull("name #" + i + " does not exist", objNames[i]); + assertTrue(objNames[i].length() > 0); + if (objTypes[i]==HDF5Constants.H5O_TYPE_GROUP) { + assertTrue("Group is index: "+i + " ",i==2); + assertTrue("Group is : "+objNames[i] + " ",objNames[i].compareToIgnoreCase("G1")==0); + } + else if (objTypes[i]==HDF5Constants.H5O_TYPE_DATASET) { + assertTrue("Dataset is index: "+i + " ",(i==0)||(i==3)); + if(i==0) + assertTrue("Dataset is : "+objNames[i] + " ",objNames[i].compareToIgnoreCase("DS1")==0); + else + assertTrue("Dataset is : "+objNames[i] + " ",objNames[i].compareToIgnoreCase("L1")==0); + } + else if (objTypes[i]==HDF5Constants.H5O_TYPE_NAMED_DATATYPE) { + assertTrue("Datatype is index: "+i + " ",i==1); + assertTrue("Datatype is : "+objNames[i] + " ",objNames[i].compareToIgnoreCase("DT1")==0); + } + else { + fail(" Unknown at index: " + i + " " + objNames[i]); + } + } + } + +} diff --git a/java/test/TestH5Lbasic.java b/java/test/TestH5Lbasic.java new file mode 100644 index 0000000..c35519e --- /dev/null +++ b/java/test/TestH5Lbasic.java @@ -0,0 +1,371 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.callbacks.H5L_iterate_cb; +import hdf.hdf5lib.callbacks.H5L_iterate_t; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.structs.H5L_info_t; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Lbasic { + @Rule public TestName testname = new TestName(); + private static final String H5_FILE = "h5ex_g_iterate.hdf"; + long H5fid = -1; + + @Before + public void openH5file() + throws HDF5LibraryException, NullPointerException { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + try { + H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Fopen: openH5file: " + err); + } + } + + @After + public void closeH5file() throws HDF5LibraryException { + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + } + System.out.println(); + } + + @Test + public void testH5Lexists() { + boolean link_exists = false; + try { + link_exists = H5.H5Lexists(H5fid, "None", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lexists: " + err); + } + assertFalse("H5Lexists ",link_exists); + try { + link_exists = H5.H5Lexists(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lexists: " + err); + } + assertTrue("H5Lexists ",link_exists); + try { + link_exists = H5.H5Lexists(H5fid, "G1/DS2", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lexists: " + err); + } + assertTrue("H5Lexists ",link_exists); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_info_not_exist() throws Throwable { + H5.H5Lget_info(H5fid, "None", HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Lget_info_dataset() { + H5L_info_t link_info = null; + try { + link_info = H5.H5Lget_info(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info: " + err); + } + assertFalse("H5Lget_info ",link_info==null); + assertTrue("H5Lget_info link type",link_info.type==HDF5Constants.H5L_TYPE_HARD); + } + + @Test + public void testH5Lget_info_hardlink() { + H5L_info_t link_info = null; + try { + link_info = H5.H5Lget_info(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info: " + err); + } + assertFalse("H5Lget_info ",link_info==null); + assertTrue("H5Lget_info link type",link_info.type==HDF5Constants.H5L_TYPE_HARD); + assertTrue("Link Address ",link_info.address_val_size>0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_info_by_idx_name_not_exist_name() throws Throwable { + H5.H5Lget_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_info_by_idx_name_not_exist_create() throws Throwable { + H5.H5Lget_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_info_by_idx_not_exist_name() throws Throwable { + H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_info_by_idx_not_exist_create() throws Throwable { + H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Lget_info_by_idx_n0() { + H5L_info_t link_info = null; + H5L_info_t link_info2 = null; + try { + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info_by_idx: " + err); + } + assertFalse("H5Lget_info_by_idx ",link_info==null); + assertTrue("H5Lget_info_by_idx link type",link_info.type==HDF5Constants.H5L_TYPE_HARD); + try { + link_info2 = H5.H5Lget_info(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info: " + err); + } + assertTrue("Link Address ",link_info.address_val_size==link_info2.address_val_size); + } + + @Test + public void testH5Lget_info_by_idx_n3() { + H5L_info_t link_info = null; + H5L_info_t link_info2 = null; + try { + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info_by_idx: " + err); + } + assertFalse("H5Lget_info_by_idx ",link_info==null); + assertTrue("H5Lget_info_by_idx link type",link_info.type==HDF5Constants.H5L_TYPE_HARD); + try { + link_info2 = H5.H5Lget_info(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info: " + err); + } + assertTrue("Link Address ",link_info.address_val_size==link_info2.address_val_size); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_name_by_idx_not_exist() throws Throwable { + H5.H5Lget_name_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Lget_name_by_idx_n0() { + String link_name = null; + try { + link_name = H5.H5Lget_name_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_name_by_idx: " + err); + } + assertFalse("H5Lget_name_by_idx ",link_name==null); + assertTrue("Link Name ",link_name.compareTo("DS1")==0); + } + + @Test + public void testH5Lget_name_by_idx_n3() { + String link_name = null; + try { + link_name = H5.H5Lget_name_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_name_by_idx: " + err); + } + assertFalse("H5Lget_name_by_idx ",link_name==null); + assertTrue("Link Name ",link_name.compareTo("L1")==0); + } + + @Test + public void testH5Lvisit() { + class idata { + public String link_name = null; + public int link_type = -1; + idata(String name, int type) { + this.link_name = name; + this.link_type = type; + } + } + class H5L_iter_data implements H5L_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + H5L_iterate_t iter_data = new H5L_iter_data(); + class H5L_iter_callback implements H5L_iterate_cb { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + idata id = new idata(name, info.type); + ((H5L_iter_data)op_data).iterdata.add(id); + return 0; + } + } + H5L_iterate_cb iter_cb = new H5L_iter_callback(); + try { + H5.H5Lvisit(H5fid, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lvisit: " + err); + } + assertFalse("H5Lvisit ",((H5L_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Lvisit "+((H5L_iter_data)iter_data).iterdata.size(),((H5L_iter_data)iter_data).iterdata.size()==5); + assertTrue("H5Lvisit "+(((H5L_iter_data)iter_data).iterdata.get(0)).link_name,(((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS1")==0); + assertTrue("H5Lvisit "+(((H5L_iter_data)iter_data).iterdata.get(1)).link_name,(((H5L_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DT1")==0); + assertTrue("H5Lvisit "+(((H5L_iter_data)iter_data).iterdata.get(2)).link_name,(((H5L_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("G1")==0); + assertTrue("H5Lvisit "+(((H5L_iter_data)iter_data).iterdata.get(3)).link_name,(((H5L_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("G1/DS2")==0); + assertTrue("H5Lvisit "+(((H5L_iter_data)iter_data).iterdata.get(4)).link_name,(((H5L_iter_data)iter_data).iterdata.get(4)).link_name.compareToIgnoreCase("L1")==0); + } + + @Test + public void testH5Lvisit_by_name() { + class idata { + public String link_name = null; + public int link_type = -1; + idata(String name, int type) { + this.link_name = name; + this.link_type = type; + } + } + class H5L_iter_data implements H5L_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + H5L_iterate_t iter_data = new H5L_iter_data(); + class H5L_iter_callback implements H5L_iterate_cb { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + idata id = new idata(name, info.type); + ((H5L_iter_data)op_data).iterdata.add(id); + return 0; + } + } + H5L_iterate_cb iter_cb = new H5L_iter_callback(); + try { + H5.H5Lvisit_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lvisit_by_name: " + err); + } + assertFalse("H5Lvisit_by_name ",((H5L_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Lvisit_by_name "+((H5L_iter_data)iter_data).iterdata.size(),((H5L_iter_data)iter_data).iterdata.size()==1); + assertTrue("H5Lvisit_by_name "+(((H5L_iter_data)iter_data).iterdata.get(0)).link_name,(((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS2")==0); + } + + @Test + public void testH5Literate() { + class idata { + public String link_name = null; + public int link_type = -1; + idata(String name, int type) { + this.link_name = name; + this.link_type = type; + } + } + class H5L_iter_data implements H5L_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + H5L_iterate_t iter_data = new H5L_iter_data(); + class H5L_iter_callback implements H5L_iterate_cb { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + idata id = new idata(name, info.type); + ((H5L_iter_data)op_data).iterdata.add(id); + return 0; + } + } + H5L_iterate_cb iter_cb = new H5L_iter_callback(); + try { + H5.H5Literate(H5fid, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L, iter_cb, iter_data); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Literate: " + err); + } + assertFalse("H5Literate ",((H5L_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Literate "+((H5L_iter_data)iter_data).iterdata.size(),((H5L_iter_data)iter_data).iterdata.size()==4); + assertTrue("H5Literate "+(((H5L_iter_data)iter_data).iterdata.get(0)).link_name,(((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS1")==0); + assertTrue("H5Literate "+(((H5L_iter_data)iter_data).iterdata.get(1)).link_name,(((H5L_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DT1")==0); + assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name,(((H5L_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("G1")==0); + assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("L1")==0); + } + + @Test + public void testH5Literate_by_name() { + class idata { + public String link_name = null; + public int link_type = -1; + idata(String name, int type) { + this.link_name = name; + this.link_type = type; + } + } + class H5L_iter_data implements H5L_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + H5L_iterate_t iter_data = new H5L_iter_data(); + class H5L_iter_callback implements H5L_iterate_cb { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + idata id = new idata(name, info.type); + ((H5L_iter_data)op_data).iterdata.add(id); + return 0; + } + } + H5L_iterate_cb iter_cb = new H5L_iter_callback(); + try { + H5.H5Literate_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0L, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Literate_by_name: " + err); + } + assertFalse("H5Literate_by_name ",((H5L_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Literate_by_name "+((H5L_iter_data)iter_data).iterdata.size(),((H5L_iter_data)iter_data).iterdata.size()==1); + assertTrue("H5Literate_by_name "+((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS2")==0); + } + +} diff --git a/java/test/TestH5Lcreate.java b/java/test/TestH5Lcreate.java new file mode 100644 index 0000000..2fbd9e3 --- /dev/null +++ b/java/test/TestH5Lcreate.java @@ -0,0 +1,819 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.util.ArrayList; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.callbacks.H5L_iterate_cb; +import hdf.hdf5lib.callbacks.H5L_iterate_t; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.structs.H5L_info_t; + +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Lcreate { + @Rule public TestName testname = new TestName(); + private static final String H5_EXTFILE = "h5ex_g_iterate.hdf"; + private static final String H5_FILE = "test.h5"; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + long H5fcpl = -1; + long H5fid = -1; + long H5dsid = -1; + long H5did1 = -1; + long H5did2 = -1; + long H5gcpl = -1; + long H5gid = -1; + long[] H5dims = { DIM_X, DIM_Y }; + + private final void _deleteFile(String filename) { + File file = new File(filename); + + if (file.exists()) { + try { + file.delete(); + } + catch (Exception e) { + e.printStackTrace(); + } + } + } + + private final long _createDataset(long fid, long dsid, String name, long dapl) { + long did = -1; + try { + did = H5.H5Dcreate(fid, name, + HDF5Constants.H5T_STD_I32BE, dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5L._createDataset: ",did > 0); + + return did; + } + + private final long _createGroup(long fid, String name) { + long gid = -1; + try { + H5gcpl = HDF5Constants.H5P_DEFAULT; + gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, + H5gcpl, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gcreate: " + err); + } + assertTrue("TestH5L._createGroup: ",gid > 0); + + return gid; + } + + private final void _createHardLink(long fid, long cid, String curname, long did, String dstname, long lcpl, long lapl) { + boolean link_exists = false; + try { + H5.H5Lcreate_hard(cid, curname, did, dstname, lcpl, lapl); + H5.H5Fflush(fid, HDF5Constants.H5F_SCOPE_LOCAL); + link_exists = H5.H5Lexists(did, dstname, lapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lcreate_hard: " + err); + } + assertTrue("TestH5L._createHardLink ", link_exists); + } + + private final void _createSoftLink(long fid, String curname, long did, String dstname, long lcpl, long lapl) { + boolean link_exists = false; + try { + H5.H5Lcreate_soft(curname, did, dstname, lcpl, lapl); + H5.H5Fflush(fid, HDF5Constants.H5F_SCOPE_LOCAL); + link_exists = H5.H5Lexists(did, dstname, lapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lcreate_soft: " + err); + } + assertTrue("TestH5L._createSoftLink ", link_exists); + } + + private final void _createExternalLink(long fid, String ext_filename, String curname, long did, String dstname, long lcpl, long lapl) { + boolean link_exists = false; + try { + H5.H5Lcreate_external(ext_filename, curname, did, dstname, lcpl, lapl); + H5.H5Fflush(fid, HDF5Constants.H5F_SCOPE_LOCAL); + link_exists = H5.H5Lexists(did, dstname, lapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lcreate_external: " + err); + } + assertTrue("TestH5L._createExternalLink ", link_exists); + } + + @Before + public void createH5file() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + try { + H5fcpl = H5.H5Pcreate(HDF5Constants.H5P_FILE_CREATE); + H5.H5Pset_link_creation_order(H5fcpl, HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + H5fcpl, HDF5Constants.H5P_DEFAULT); + H5dsid = H5.H5Screate_simple(2, H5dims, null); + H5did1 = _createDataset(H5fid, H5dsid, "DS1", HDF5Constants.H5P_DEFAULT); + H5gid = _createGroup(H5fid, "/G1"); + H5did2 = _createDataset(H5gid, H5dsid, "DS2", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5L.createH5file: " + err); + } + assertTrue("TestH5L.createH5file: H5.H5Fcreate: ",H5fid > 0); + assertTrue("TestH5L.createH5file: H5.H5Screate_simple: ",H5dsid > 0); + assertTrue("TestH5L.createH5file: H5.H5Gcreate: ",H5gid > 0); + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5gid > 0) + try {H5.H5Gclose(H5gid);} catch (Exception ex) {} + if (H5gcpl > 0) + try {H5.H5Pclose(H5gcpl);} catch (Exception ex) {} + if (H5did2 > 0) + try {H5.H5Dclose(H5did2);} catch (Exception ex) {} + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5did1 > 0) + try {H5.H5Dclose(H5did1);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + if (H5fcpl > 0) + try {H5.H5Pclose(H5fcpl);} catch (Exception ex) {} + + _deleteFile(H5_FILE); + System.out.println(); + } + + @Test + public void testH5Lget_info_by_idx_n0_create() { + H5L_info_t link_info = null; + try { + int order = H5.H5Pget_link_creation_order(H5fcpl); + assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info_by_idx_n0_create:H5Pget_link_creation_order " + err); + } + try { + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info_by_idx: " + err); + } + assertFalse("H5Lget_info_by_idx ", link_info==null); + assertTrue("H5Lget_info_by_idx link type", link_info.type==HDF5Constants.H5L_TYPE_HARD); + } + + @Test + public void testH5Lget_info_by_idx_n1_create() { + H5L_info_t link_info = null; + try { + int order = H5.H5Pget_link_creation_order(H5fcpl); + assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info_by_idx_n1_create:H5Pget_link_creation_order " + err); + } + try { + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 1, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info_by_idx: " + err); + } + assertFalse("H5Lget_info_by_idx ", link_info==null); + assertTrue("H5Lget_info_by_idx link type", link_info.type==HDF5Constants.H5L_TYPE_HARD); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lcreate_hard_cur_not_exists() throws Throwable { + H5.H5Lcreate_hard(H5fid, "None", H5fid, "DS1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Lcreate_hard() { + try { + H5.H5Lcreate_hard(H5fid, "DS1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + boolean link_exists = H5.H5Lexists(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + assertTrue("testH5Lcreate_hard:H5Lexists ", link_exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lexists: " + err); + } + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lcreate_hard_dst_link_exists() throws Throwable { + _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Lcreate_hard(H5fid, "L1", H5fid, "/G1/DS2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Ldelete_hard_link() { + _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + H5.H5Ldelete(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + boolean link_exists = H5.H5Lexists(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + assertFalse("testH5Lcreate_hard:H5Lexists ", link_exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lexists: " + err); + } + } + + @Test + public void testH5Lcreate_soft() { + try { + H5.H5Lcreate_soft("DS1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + boolean link_exists = H5.H5Lexists(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + assertTrue("testH5Lcreate_soft:H5Lexists ", link_exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lexists: " + err); + } + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lcreate_soft_dst_link_exists() throws Throwable { + _createSoftLink(H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Lcreate_soft("L1", H5fid, "/G1/DS2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Ldelete_soft_link() { + _createSoftLink(H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + H5.H5Ldelete(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + boolean link_exists = H5.H5Lexists(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + assertFalse("testH5Lcreate_soft:H5Lexists ", link_exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lexists: " + err); + } + } + + @Test + public void testH5Lget_info_softlink() { + H5L_info_t link_info = null; + _createSoftLink(H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + link_info = H5.H5Lget_info(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info: " + err); + } + assertFalse("H5Lget_info ", link_info==null); + assertTrue("H5Lget_info link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT); + assertTrue("Link Address ", link_info.address_val_size>0); + } + + @Test + public void testH5Lget_value_soft() { + String[] link_value = {null, null}; + int link_type = -1; + + _createSoftLink(H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + link_type = H5.H5Lget_value(H5fid, "L1", link_value, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_value: " + err); + } + assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_SOFT); + assertFalse("H5Lget_value ", link_value[0]==null); + assertTrue("Link Value ", link_value[0].compareTo("/G1/DS2")==0); + } + + @Test + public void testH5Lcreate_soft_dangle() { + try { + H5.H5Lcreate_soft("DS3", H5fid, "L2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + boolean link_exists = H5.H5Lexists(H5fid, "L2", HDF5Constants.H5P_DEFAULT); + assertTrue("testH5Lcreate_soft:H5Lexists ", link_exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lexists: " + err); + } + } + + @Test + public void testH5Ldelete_soft_link_dangle() { + _createSoftLink(H5fid, "DS3", H5fid, "L2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + H5.H5Ldelete(H5fid, "L2", HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + boolean link_exists = H5.H5Lexists(H5fid, "L2", HDF5Constants.H5P_DEFAULT); + assertFalse("testH5Lcreate_soft:H5Lexists ", link_exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lexists: " + err); + } + } + + @Test + public void testH5Lget_info_softlink_dangle() { + H5L_info_t link_info = null; + _createSoftLink(H5fid, "DS3", H5fid, "L2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + link_info = H5.H5Lget_info(H5fid, "L2", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info: " + err); + } + assertFalse("H5Lget_info ", link_info==null); + assertTrue("H5Lget_info link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT); + assertTrue("Link Address ", link_info.address_val_size>0); + } + + @Test + public void testH5Lget_value_dangle() { + String[] link_value = {null,null}; + int link_type = -1; + + _createSoftLink(H5fid, "DS3", H5fid, "L2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + link_type = H5.H5Lget_value(H5fid, "L2", link_value, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_value: " + err); + } + assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_SOFT); + assertFalse("H5Lget_value ", link_value[0]==null); + assertTrue("Link Value ", link_value[0].compareTo("DS3")==0); + } + + @Test + public void testH5Lcreate_external() { + try { + H5.H5Lcreate_external(H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + boolean link_exists = H5.H5Lexists(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + assertTrue("testH5Lcreate_external:H5Lexists ", link_exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lexists: " + err); + } + } + + @Test + public void testH5Lget_info_externallink() { + H5L_info_t link_info = null; + _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + link_info = H5.H5Lget_info(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info: " + err); + } + assertFalse("H5Lget_info ", link_info==null); + assertTrue("H5Lget_info link type", link_info.type==HDF5Constants.H5L_TYPE_EXTERNAL); + assertTrue("Link Address ", link_info.address_val_size>0); + } + + @Test + public void testH5Lget_value_external(){ + String[] link_value = {null,null}; + int link_type = -1; + + _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + link_type = H5.H5Lget_value(H5fid, "L1", link_value, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_value: " + err); + } + assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_EXTERNAL); + assertFalse("H5Lget_value ", link_value[0]==null); + assertFalse("H5Lget_value ", link_value[1]==null); + assertTrue("Link Value ", link_value[0].compareTo("DT1")==0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lcopy_cur_not_exists() throws Throwable { + H5.H5Lcopy(H5fid, "None", H5fid, "DS1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Lcopy() { + try { + H5.H5Lcopy(H5fid, "DS1", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + boolean link_exists = H5.H5Lexists(H5fid, "CPY1", HDF5Constants.H5P_DEFAULT); + assertTrue("testH5Lcopy:H5Lexists ", link_exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Lcopy:H5Lexists: " + err); + } + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lcopy_dst_link_exists() throws Throwable { + _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Lcopy(H5fid, "CPY1", H5fid, "/G1/DS2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lmove_cur_not_exists() throws Throwable { + H5.H5Lmove(H5fid, "None", H5fid, "DS1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Lmove() { + try { + H5.H5Lmove(H5fid, "DS1", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + boolean link_exists = H5.H5Lexists(H5fid, "CPY1", HDF5Constants.H5P_DEFAULT); + assertTrue("testH5Lmove:H5Lexists ", link_exists); + link_exists = H5.H5Lexists(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + assertFalse("testH5Lmove:H5Lexists ", link_exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Lmove:H5Lexists: " + err); + } + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lmove_dst_link_exists() throws Throwable { + _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Lmove(H5fid, "CPY1", H5fid, "/G1/DS2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_value_by_idx_not_exist_name() throws Throwable { + String[] link_value = {null,null}; + H5.H5Lget_value_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, link_value, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_value_by_idx_not_exist_create() throws Throwable { + String[] link_value = {null,null}; + H5.H5Lget_value_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, link_value, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Lget_value_by_idx_n2_name() { + H5L_info_t link_info = null; + String[] link_value = {null,null}; + int link_type = -1; + + _createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info_by_idx: " + err); + } + assertFalse("testH5Lget_value_by_idx_n2 ",link_info==null); + assertTrue("testH5Lget_value_by_idx_n2 link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT); + try { + link_type = H5.H5Lget_value_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, link_value, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_value_by_idx: " + err); + } + assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_SOFT); + assertFalse("testH5Lget_value_by_idx_n2 ", link_value[0]==null); + assertTrue("testH5Lget_value_by_idx_n2 Link Value ", link_value[0].compareTo("/G1/DS2")==0); + } + + @Test + public void testH5Lget_value_by_idx_n2_create() { + H5L_info_t link_info = null; + String[] link_value = {null,null}; + int link_type = -1; + + try { + int order = H5.H5Pget_link_creation_order(H5fcpl); + assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_value_by_idx_n2_create: H5Pget_link_creation_order " + err); + } + _createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info_by_idx: " + err); + } + assertFalse("testH5Lget_value_by_idx_n2 ", link_info==null); + assertTrue("testH5Lget_value_by_idx_n2 link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT); + try { + link_type = H5.H5Lget_value_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, link_value, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_value_by_idx: " + err); + } + assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_SOFT); + assertFalse("testH5Lget_value_by_idx_n2 ", link_value[0]==null); + assertTrue("testH5Lget_value_by_idx_n2 Link Value ", link_value[0].compareTo("/G1/DS2")==0); + } + + @Test + public void testH5Lget_value_by_idx_external_name() { + H5L_info_t link_info = null; + String[] link_value = {null,null}; + int link_type = -1; + + _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info_by_idx: " + err); + } + assertFalse("testH5Lget_value_by_idx_ext ", link_info==null); + assertTrue("testH5Lget_value_by_idx_ext link type "+link_info.type, link_info.type==HDF5Constants.H5L_TYPE_EXTERNAL); + try { + link_type = H5.H5Lget_value_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, link_value, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_value_by_idx: " + err); + } + assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_EXTERNAL); + assertFalse("testH5Lget_value_by_idx_ext ", link_value[0]==null); + assertFalse("testH5Lget_value_by_idx_ext ", link_value[1]==null); + assertTrue("testH5Lget_value_by_idx_ext Link Value ", link_value[0].compareTo("DT1")==0); + } + + @Test + public void testH5Lget_value_by_idx_external_create() { + H5L_info_t link_info = null; + String[] link_value = {null,null}; + int link_type = -1; + + _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info_by_idx: " + err); + } + assertFalse("testH5Lget_value_by_idx_ext ", link_info==null); + assertTrue("testH5Lget_value_by_idx_ext link type "+link_info.type, link_info.type==HDF5Constants.H5L_TYPE_EXTERNAL); + try { + link_type = H5.H5Lget_value_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, link_value, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_value_by_idx: " + err); + } + assertTrue("Link Type", link_type == HDF5Constants.H5L_TYPE_EXTERNAL); + assertFalse("testH5Lget_value_by_idx_ext ", link_value[0]==null); + assertFalse("testH5Lget_value_by_idx_ext ", link_value[1]==null); + assertTrue("testH5Lget_value_by_idx_ext Link Value ", link_value[0].compareTo("DT1")==0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Ldelete_by_idx_not_exist_name() throws Throwable { + H5.H5Ldelete_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Ldelete_by_idx_not_exist_create() throws Throwable { + H5.H5Ldelete_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Ldelete_by_idx_n2_name() { + H5L_info_t link_info = null; + _createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info_by_idx: " + err); + } + assertFalse("testH5Ldelete_by_idx_n2 ", link_info==null); + assertTrue("testH5Ldelete_by_idx_n2 link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT); + try { + H5.H5Ldelete_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ldelete_by_idx: " + err); + } + try { + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + } + catch (HDF5LibraryException err) { + link_info = null; + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ldelete_by_idx: " + err); + } + assertTrue("testH5Ldelete_by_idx_n2 ",link_info==null); + } + + @Test + public void testH5Ldelete_by_idx_n2_create() { + H5L_info_t link_info = null; + _createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lget_info_by_idx: " + err); + } + assertFalse("testH5Ldelete_by_idx_n2 ", link_info==null); + assertTrue("testH5Ldelete_by_idx_n2 link type", link_info.type==HDF5Constants.H5L_TYPE_SOFT); + try { + H5.H5Ldelete_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ldelete_by_idx: " + err); + } + try { + link_info = H5.H5Lget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 2, HDF5Constants.H5P_DEFAULT); + } + catch (HDF5LibraryException err) { + link_info = null; + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ldelete_by_idx: " + err); + } + assertTrue("testH5Ldelete_by_idx_n2 ",link_info==null); + } + + @Test + public void testH5Lvisit_create() { + try { + int order = H5.H5Pget_link_creation_order(H5fcpl); + assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lvisit_create: H5Pget_link_creation_order " + err); + } + + _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + _createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + + class idata { + public String link_name = null; + public int link_type = -1; + idata(String name, int type) { + this.link_name = name; + this.link_type = type; + } + } + class H5L_iter_data implements H5L_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + H5L_iterate_t iter_data = new H5L_iter_data(); + class H5L_iter_callback implements H5L_iterate_cb { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + idata id = new idata(name, info.type); + ((H5L_iter_data)op_data).iterdata.add(id); + return 0; + } + } + H5L_iterate_cb iter_cb = new H5L_iter_callback(); + try { + H5.H5Lvisit(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, iter_cb, iter_data); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lvisit: " + err); + } + assertFalse("H5Lvisit ",((H5L_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Lvisit "+((H5L_iter_data)iter_data).iterdata.size(),((H5L_iter_data)iter_data).iterdata.size()==6); + assertTrue("H5Lvisit "+((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS1")==0); + assertTrue("H5Lvisit "+((idata)((H5L_iter_data)iter_data).iterdata.get(1)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("G1")==0); + assertTrue("H5Lvisit "+((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("G1/DS2")==0); + assertTrue("H5Lvisit "+((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("CPY1")==0); + assertTrue("H5Lvisit "+((idata)((H5L_iter_data)iter_data).iterdata.get(4)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(4)).link_name.compareToIgnoreCase("LE")==0); + assertTrue("H5Lvisit "+((idata)((H5L_iter_data)iter_data).iterdata.get(5)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(5)).link_name.compareToIgnoreCase("LS")==0); + } + + @Test + public void testH5Literate_create() { + try { + int order = H5.H5Pget_link_creation_order(H5fcpl); + assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Literate_create: H5Pget_link_creation_order " + err); + } + + _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + _createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + + class idata { + public String link_name = null; + public int link_type = -1; + idata(String name, int type) { + this.link_name = name; + this.link_type = type; + } + } + class H5L_iter_data implements H5L_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + H5L_iterate_t iter_data = new H5L_iter_data(); + class H5L_iter_callback implements H5L_iterate_cb { + public int callback(long group, String name, H5L_info_t info, H5L_iterate_t op_data) { + idata id = new idata(name, info.type); + ((H5L_iter_data)op_data).iterdata.add(id); + return 0; + } + } + H5L_iterate_cb iter_cb = new H5L_iter_callback(); + try { + H5.H5Literate(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, iter_cb, iter_data); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Literate: " + err); + } + assertFalse("H5Literate ",((H5L_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Literate "+((H5L_iter_data)iter_data).iterdata.size(),((H5L_iter_data)iter_data).iterdata.size()==5); + assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase("DS1")==0); + assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(1)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("G1")==0); + assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("CPY1")==0); + assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("LE")==0); + assertTrue("H5Literate "+((idata)((H5L_iter_data)iter_data).iterdata.get(4)).link_name,((idata)((H5L_iter_data)iter_data).iterdata.get(4)).link_name.compareToIgnoreCase("LS")==0); + } + +} diff --git a/java/test/TestH5Lparams.java b/java/test/TestH5Lparams.java new file mode 100644 index 0000000..9a2c204 --- /dev/null +++ b/java/test/TestH5Lparams.java @@ -0,0 +1,231 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertTrue; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Lparams { + @Rule public TestName testname = new TestName(); + + @Before + public void checkOpenIDs() { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + @After + public void nextTestName() { + System.out.println(); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_value_invalid() throws Throwable { + H5.H5Lget_value(-1, "Bogus", null, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Lget_value_null() throws Throwable { + H5.H5Lget_value(-1, null, null, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lexists_invalid() throws Throwable { + H5.H5Lexists(-1, "Bogus", -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Lexists_null() throws Throwable { + H5.H5Lexists(-1, null, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_info_invalid() throws Throwable { + H5.H5Lget_info(-1, "Bogus", -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Lget_info_null() throws Throwable { + H5.H5Lget_info(-1, null, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_info_by_idx_invalid() throws Throwable { + H5.H5Lget_info_by_idx(-1, "Bogus", -1, -1, -1L, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Lget_info_by_idx_null() throws Throwable { + H5.H5Lget_info_by_idx(-1, null, 0, 0, 0L, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_name_by_idx_invalid() throws Throwable { + H5.H5Lget_name_by_idx(-1, "Bogus", -1, -1, -1L, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Lget_name_by_idx_null() throws Throwable { + H5.H5Lget_name_by_idx(-1, null, 0, 0, 0L, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lcreate_hard_invalid() throws Throwable { + H5.H5Lcreate_hard(-1, "Bogus", -1, "Bogus", -1, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Lcreate_hard_null_current() throws Throwable { + H5.H5Lcreate_hard(-1, null, 0, "Bogus", 0, 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Lcreate_hard_null_dest() throws Throwable { + H5.H5Lcreate_hard(-1, "Bogus", 0, null, 0, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Ldelete_invalid() throws Throwable { + H5.H5Ldelete(-1, "Bogus", -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Ldelete_null() throws Throwable { + H5.H5Ldelete(-1, null, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lcreate_soft_invalid() throws Throwable { + H5.H5Lcreate_soft( "Bogus", -1, "Bogus", -1, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Lcreate_soft_null_current() throws Throwable { + H5.H5Lcreate_soft(null, 0, "Bogus", 0, 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Lcreate_soft_null_dest() throws Throwable { + H5.H5Lcreate_soft("Bogus", 0, null, 0, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lcreate_external_invalid() throws Throwable { + H5.H5Lcreate_external("PathToFile", "Bogus", -1, "Bogus", -1, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Lcreate_external_null_file() throws Throwable { + H5.H5Lcreate_external(null, "Bogus", 0, "Bogus", 0, 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Lcreate_external_null_current() throws Throwable { + H5.H5Lcreate_external("PathToFile", null, 0, "Bogus", 0, 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Lcreate_external_null_dest() throws Throwable { + H5.H5Lcreate_external("PathToFile", "Bogus", 0, null, 0, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lcopy_invalid() throws Throwable { + H5.H5Lcopy(-1, "Bogus", -1, "Bogus", -1, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Lcopy_null_current() throws Throwable { + H5.H5Lcopy(-1, null, 0, "Bogus", 0, 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Lcopy_null_dest() throws Throwable { + H5.H5Lcopy(-1, "Bogus", 0, null, 0, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lmove_invalid() throws Throwable { + H5.H5Lmove(-1, "Bogus", -1, "Bogus", -1, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Lmove_null_current() throws Throwable { + H5.H5Lmove(-1, null, 0, "Bogus", 0, 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Lmove_null_dest() throws Throwable { + H5.H5Lmove(-1, "Bogus", 0, null, 0, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Lget_value_by_idx_invalid() throws Throwable { + H5.H5Lget_value_by_idx(-1, "Bogus", -1, -1, -1L, null, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Lget_value_by_idx_null() throws Throwable { + H5.H5Lget_value_by_idx(-1, null, 0, 0, 0L, null, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Ldelete_by_idx_invalid() throws Throwable { + H5.H5Ldelete_by_idx(-1, "Bogus", -1, -1, -1L, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Ldelete_by_idx_null() throws Throwable { + H5.H5Ldelete_by_idx(-1, null, 0, 0, 0L, 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Lvisit_null() throws Throwable { + H5.H5Lvisit(-1, -1, -1, null, null); + } + + @Test(expected = NullPointerException.class) + public void testH5Lvisit_by_name_nullname() throws Throwable { + H5.H5Lvisit_by_name(-1, null, -1, -1, null, null, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Lvisit_by_name_null() throws Throwable { + H5.H5Lvisit_by_name(-1, "Bogus", -1, -1, null, null, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Literate_null() throws Throwable { + H5.H5Literate(-1, -1, -1, -1, null, null); + } + + @Test(expected = NullPointerException.class) + public void testH5Literate_by_name_nullname() throws Throwable { + H5.H5Literate_by_name(-1, null, -1, -1, -1, null, null, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Literate_by_name_null() throws Throwable { + H5.H5Literate_by_name(-1, "Bogus", -1, -1, -1, null, null, -1); + } + +} diff --git a/java/test/TestH5Obasic.java b/java/test/TestH5Obasic.java new file mode 100644 index 0000000..b564089 --- /dev/null +++ b/java/test/TestH5Obasic.java @@ -0,0 +1,488 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.callbacks.H5O_iterate_cb; +import hdf.hdf5lib.callbacks.H5O_iterate_t; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.structs.H5O_info_t; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Obasic { + @Rule public TestName testname = new TestName(); + private static final String H5_FILE = "h5ex_g_iterate.hdf"; + private static long H5la_ds1 = -1; + private static long H5la_l1 = -1; + private static long H5la_dt1 = -1; + private static long H5la_g1 = -1; + long H5fid = -1; + + @Before + public void openH5file() + throws HDF5LibraryException, NullPointerException { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + try { + H5fid = H5.H5Fopen(H5_FILE, HDF5Constants.H5F_ACC_RDONLY, + HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Fopen: openH5file: " + err); + } + } + + @After + public void closeH5file() throws HDF5LibraryException { + if (H5fid > 0) { + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + } + System.out.println(); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oopen_not_exists() throws Throwable { + long oid = -1; + + oid = H5.H5Oopen(H5fid, "Never_created", HDF5Constants.H5P_DEFAULT); + + try {H5.H5Oclose(oid);} catch (Exception ex) {} + } + + @Test + public void testH5Oget_info_dataset() { + long oid = -1; + H5O_info_t obj_info = null; + + try { + oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info: " + err); + } + assertFalse("H5Oget_info ",obj_info==null); + assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + try {H5.H5Oclose(oid);} catch (Exception ex) {} + } + + @Test + public void testH5Oget_info_hardlink() { + long oid = -1; + H5O_info_t obj_info = null; + try { + oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info: " + err); + } + assertFalse("H5Oget_info ",obj_info==null); + assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + try {H5.H5Oclose(oid);} catch (Exception ex) {} + } + + @Test + public void testH5Oget_info_group() { + long oid = -1; + H5O_info_t obj_info = null; + try { + oid = H5.H5Oopen(H5fid, "G1", HDF5Constants.H5P_DEFAULT); + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info: " + err); + } + assertFalse("H5Oget_info ",obj_info==null); + assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_GROUP); + try {H5.H5Oclose(oid);} catch (Exception ex) {} + } + + @Test + public void testH5Oget_info_datatype() { + long oid = -1; + H5O_info_t obj_info = null; + try { + oid = H5.H5Oopen(H5fid, "DT1", HDF5Constants.H5P_DEFAULT); + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info: " + err); + } + assertFalse("H5Oget_info ",obj_info==null); + assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_NAMED_DATATYPE); + try {H5.H5Oclose(oid);} catch (Exception ex) {} + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_info_by_name_not_exist_name() throws Throwable { + H5.H5Oget_info_by_name(H5fid, "None", HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_info_by_name_not_exists() throws Throwable { + H5.H5Oget_info_by_name(H5fid, "Bogus", HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Oget_info_by_name_dataset() { + H5O_info_t obj_info = null; + + try { + obj_info = H5.H5Oget_info_by_name(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info: " + err); + } + assertFalse("H5Oget_info ",obj_info==null); + assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + } + + @Test + public void testH5Oget_info_by_name_hardlink() { + H5O_info_t obj_info = null; + try { + obj_info = H5.H5Oget_info_by_name(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info: " + err); + } + assertFalse("H5Oget_info ",obj_info==null); + assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + } + + @Test + public void testH5Oget_info_by_name_group() { + H5O_info_t obj_info = null; + try { + obj_info = H5.H5Oget_info_by_name(H5fid, "G1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info: " + err); + } + assertFalse("H5Oget_info ",obj_info==null); + assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_GROUP); + } + + @Test + public void testH5Oget_info_by_name_datatype() { + H5O_info_t obj_info = null; + try { + obj_info = H5.H5Oget_info_by_name(H5fid, "DT1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info: " + err); + } + assertFalse("H5Oget_info ",obj_info==null); + assertTrue("H5Oget_info object type",obj_info.type==HDF5Constants.H5O_TYPE_NAMED_DATATYPE); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_info_by_idx_name_not_exist_name() throws Throwable { + H5.H5Oget_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_info_by_idx_name_not_exist_create() throws Throwable { + H5.H5Oget_info_by_idx(H5fid, "None", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_info_by_idx_not_exist_name() throws Throwable { + H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_info_by_idx_not_exist_create() throws Throwable { + H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 5, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Oget_info_by_idx_n0() { + long oid = -1; + H5O_info_t obj_info = null; + try { + oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oget_info_by_idx_n0:H5.H5Oget_info: " + err); + } + H5la_ds1 = obj_info.addr; + try {H5.H5Oclose(oid);} catch (Exception ex) {} + try { + obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oget_info_by_idx_n0:H5.H5Oget_info_by_idx: " + err); + } + assertFalse("testH5Oget_info_by_idx_n0:H5Oget_info_by_idx ",obj_info==null); + assertTrue("testH5Oget_info_by_idx_n0:H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + assertTrue("testH5Oget_info_by_idx_n0:Link Address ",obj_info.addr==H5la_ds1); + } + + @Test + public void testH5Oget_info_by_idx_n3() { + long oid = -1; + H5O_info_t obj_info = null; + try { + oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oget_info_by_idx_n3:H5.H5Oget_info: " + err); + } + H5la_l1 = obj_info.addr; + try {H5.H5Oclose(oid);} catch (Exception ex) {} + try { + obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oget_info_by_idx_n3:H5.H5Oget_info_by_idx: " + err); + } + assertFalse("testH5Oget_info_by_idx_n3:H5Oget_info_by_idx ",obj_info==null); + assertTrue("testH5Oget_info_by_idx_n3:H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + assertTrue("testH5Oget_info_by_idx_n3:Link Address ",obj_info.addr==H5la_l1); + } + + @Test + public void testH5Ovisit() { + class idata { + public String link_name = null; + public int link_type = -1; + idata(String name, int type) { + this.link_name = name; + this.link_type = type; + } + } + class H5O_iter_data implements H5O_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + H5O_iterate_t iter_data = new H5O_iter_data(); + class H5O_iter_callback implements H5O_iterate_cb { + public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) { + idata id = new idata(name, info.type); + ((H5O_iter_data)op_data).iterdata.add(id); + return 0; + } + } + H5O_iterate_cb iter_cb = new H5O_iter_callback(); + try { + H5.H5Ovisit(H5fid, HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ovisit: " + err); + } + assertFalse("H5Ovisit ",((H5O_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Ovisit "+((H5O_iter_data)iter_data).iterdata.size(),((H5O_iter_data)iter_data).iterdata.size()==5); + assertTrue("H5Ovisit "+(((H5O_iter_data)iter_data).iterdata.get(0)).link_name,(((H5O_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase(".")==0); + assertTrue("H5Ovisit "+(((H5O_iter_data)iter_data).iterdata.get(1)).link_name,(((H5O_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DS1")==0); + assertTrue("H5Ovisit "+(((H5O_iter_data)iter_data).iterdata.get(2)).link_name,(((H5O_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("DT1")==0); + assertTrue("H5Ovisit "+(((H5O_iter_data)iter_data).iterdata.get(3)).link_name,(((H5O_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("G1")==0); + assertTrue("H5Ovisit "+(((H5O_iter_data)iter_data).iterdata.get(4)).link_name,(((H5O_iter_data)iter_data).iterdata.get(4)).link_name.compareToIgnoreCase("G1/DS2")==0); +// assertTrue("H5Ovisit "+((idata)((H5O_iter_data)iter_data).iterdata.get(5)).link_name,((idata)((H5O_iter_data)iter_data).iterdata.get(5)).link_name.compareToIgnoreCase("L1")==0); + } + + @Test + public void testH5Ovisit_by_name() { + class idata { + public String link_name = null; + public int link_type = -1; + idata(String name, int type) { + this.link_name = name; + this.link_type = type; + } + } + class H5O_iter_data implements H5O_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + H5O_iterate_t iter_data = new H5O_iter_data(); + class H5O_iter_callback implements H5O_iterate_cb { + public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) { + idata id = new idata(name, info.type); + ((H5O_iter_data)op_data).iterdata.add(id); + return 0; + } + } + H5O_iterate_cb iter_cb = new H5O_iter_callback(); + try { + H5.H5Ovisit_by_name(H5fid, "G1", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, iter_cb, iter_data, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ovisit_by_name: " + err); + } + assertFalse("H5Ovisit_by_name ",((H5O_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Ovisit_by_name "+((H5O_iter_data)iter_data).iterdata.size(),((H5O_iter_data)iter_data).iterdata.size()==2); + assertTrue("H5Ovisit_by_name "+(((H5O_iter_data)iter_data).iterdata.get(0)).link_name,(((H5O_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase(".")==0); + assertTrue("H5Ovisit_by_name "+(((H5O_iter_data)iter_data).iterdata.get(1)).link_name,(((H5O_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DS2")==0); + } + + @Test + public void testH5Oexists_by_name() { + boolean name_exists = false; + try { + name_exists = H5.H5Oexists_by_name(H5fid, "G1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oexists_by_name: " + err); + } + assertTrue("H5Oexists_by_name ", name_exists); + //TODO get dangling link result + } + + @Test + public void testH5Oopen_by_addr() { + long oid = -1; + H5O_info_t obj_info = null; + try { + try { + oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oopen_by_addr: H5.H5Oget_info: " + err); + } + H5la_ds1 = obj_info.addr; + try {H5.H5Oclose(oid);} catch (Exception ex) {} + try { + oid = H5.H5Oopen_by_addr(H5fid, H5la_ds1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oopen_by_addr: H5.H5Oopen_by_addr: " + err); + } + try { + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oopen_by_addr: H5.H5Oget_info: " + err); + } + assertFalse("testH5Oopen_by_addr: H5Oget_info ",obj_info==null); + assertTrue("testH5Oopen_by_addr: H5Oget_info link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + assertTrue("testH5Oopen_by_addr: Link Address ",obj_info.addr==H5la_ds1); + } + finally { + try{H5.H5Oclose(oid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Oopen_by_idx_n0() { + long oid = -1; + H5O_info_t obj_info = null; + try { + try { + oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oopen_by_idx_n0: H5.H5Oget_info: " + err); + } + H5la_ds1 = obj_info.addr; + try {H5.H5Oclose(oid);} catch (Exception ex) {} + try { + oid = H5.H5Oopen_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oopen_by_addr: H5.H5Oopen_by_addr: " + err); + } + try { + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oopen_by_idx_n0: H5.H5Oget_info_by_idx: " + err); + } + assertFalse("testH5Oopen_by_idx_n0: H5Oget_info_by_idx ",obj_info==null); + assertTrue("testH5Oopen_by_idx_n0: H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + assertTrue("testH5Oopen_by_idx_n0: Link Address ",obj_info.addr==H5la_ds1); + } + finally { + try{H5.H5Oclose(oid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Oopen_by_idx_n3() { + long oid = -1; + H5O_info_t obj_info = null; + try { + try { + oid = H5.H5Oopen(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oopen_by_idx_n3:H5.H5Oget_info: " + err); + } + H5la_l1 = obj_info.addr; + try {H5.H5Oclose(oid);} catch (Exception ex) {} + try { + oid = H5.H5Oopen_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_NAME, HDF5Constants.H5_ITER_INC, 3, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oopen_by_addr: H5.H5Oopen_by_addr: " + err); + } + try { + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oopen_by_idx_n3:H5.H5Oget_info_by_idx: " + err); + } + assertFalse("testH5Oopen_by_idx_n3:H5Oget_info_by_idx ",obj_info==null); + assertTrue("testH5Oopen_by_idx_n3:H5Oget_info_by_idx link type",obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + assertTrue("testH5Oopen_by_idx_n3:Link Address ",obj_info.addr==H5la_l1); + } + finally { + try{H5.H5Oclose(oid);} catch (Exception ex) {} + } + } +} diff --git a/java/test/TestH5Ocopy.java b/java/test/TestH5Ocopy.java new file mode 100644 index 0000000..62dd886 --- /dev/null +++ b/java/test/TestH5Ocopy.java @@ -0,0 +1,365 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Ocopy { + @Rule public TestName testname = new TestName(); + private static final String FILENAME = "testRefsattribute.h5"; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + long H5fid = -1; + long H5dsid = -1; + long H5did1 = -1; + long H5did2 = -1; + long H5gcpl = -1; + long H5gid = -1; + long H5dsid2 = -1; + long[] dims = { 2 }; + + private final void _deleteFile(String filename) { + File file = new File(filename); + + if (file.exists()) { + try { + file.delete(); + } + catch (Exception e) { + e.printStackTrace(); + } + } + } + + private final long _createDataset(long fid, long dsid, String name, long dapl) { + long did = -1; + try { + did = H5.H5Dcreate(fid, name, + HDF5Constants.H5T_STD_I32BE, dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5O._createDataset: ",did >= 0); + + return did; + } + + private final long _createGroup(long fid, String name) { + long gid = -1; + try { + H5gcpl = HDF5Constants.H5P_DEFAULT; + gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, + H5gcpl, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gcreate: " + err); + } + assertTrue("TestH5O._createGroup: ",gid >= 0); + + return gid; + } + + @Before + public void createH5file() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + try { + H5fid = H5.H5Fcreate(FILENAME, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5dsid2 = H5.H5Screate(HDF5Constants.H5S_SCALAR); + H5did1 = _createDataset(H5fid, H5dsid2, "DS2", HDF5Constants.H5P_DEFAULT); + H5dsid = H5.H5Screate_simple(1, dims, null); + H5gid = _createGroup(H5fid, "/G1"); + H5did2 = _createDataset(H5gid, H5dsid, "DS1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5O.createH5file: " + err); + } + assertTrue("TestH5O.createH5file: H5.H5Fcreate: ",H5fid >= 0); + assertTrue("TestH5O.createH5file: H5.H5Screate_simple: ",H5dsid >= 0); + assertTrue("TestH5O.createH5file: H5.H5Gcreate: ",H5gid >= 0); + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5gid > 0) + try {H5.H5Gclose(H5gid);} catch (Exception ex) {} + if (H5did2 > 0) + try {H5.H5Dclose(H5did2);} catch (Exception ex) {} + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5dsid2 > 0) + try {H5.H5Sclose(H5dsid2);} catch (Exception ex) {} + if (H5did1 > 0) + try {H5.H5Dclose(H5did1);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + + _deleteFile(FILENAME); + System.out.println(); + } + + @Test + public void testH5OcopyRefsAttr() { + long ocp_plist_id = -1; + byte rbuf0[]=null , rbuf1[] = null; + byte[] dset_data = new byte[16]; + long attribute_id = -1; + + + try { + rbuf0 = H5.H5Rcreate(H5fid, "/G1", HDF5Constants.H5R_OBJECT, -1); + rbuf1 = H5.H5Rcreate(H5fid, "DS2", HDF5Constants.H5R_OBJECT, -1); + //System.arraycopy(rbuf0, 0, dset_data, 0, 8); + System.arraycopy(rbuf1, 0, dset_data, 8, 8); + } + catch (Exception ex) { + fail("testH5OcopyRefsAttr: H5Rcreate failed"); + } + + try { + attribute_id = H5.H5Acreate(H5did2, "A1", HDF5Constants.H5T_STD_REF_OBJ, H5dsid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue("testH5OcopyRefsAttr.H5Acreate: ", attribute_id >= 0); + H5.H5Awrite(attribute_id, HDF5Constants.H5T_STD_REF_OBJ, dset_data); + + H5.H5Aclose(attribute_id); + } + catch (Exception ex) { + fail("testH5OcopyRefsAttr: H5Awrite failed"); + } + finally { + try {H5.H5Aclose(attribute_id);} catch (Exception exx) {} + } + + try { + ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY); + assertTrue("testH5OcopyRefsAttr.H5Pcreate: ", ocp_plist_id >= 0); + H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG); + H5.H5Ocopy(H5fid, ".", H5fid, "CPYREF", ocp_plist_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception ex) { + fail("testH5OcopyRefsAttr: H5Ocopy failed"); + } + finally { + try {H5.H5Pclose(ocp_plist_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5OcopyRefsDatasettodiffFile() { + byte rbuf1[] = null; + byte[] dset_data = new byte[16]; + long ocp_plist_id = -1; + long dataset_id = -1; + long H5fid2 = -1; + + try { + rbuf1 = H5.H5Rcreate(H5fid, "DS2", HDF5Constants.H5R_OBJECT, -1); + System.arraycopy(rbuf1, 0, dset_data, 8, 8); + + dataset_id = H5.H5Dcreate(H5fid, "DSREF", + HDF5Constants.H5T_STD_REF_OBJ, H5dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue("testH5OcopyRefsDatasettodiffFile.H5Dcreate: ", dataset_id >= 0); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF_OBJ, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + H5.H5Dclose(dataset_id); + } + catch (Exception ex) { + fail("testH5OcopyRefsDatasettodiffFile: create dataset failed"); + } + finally { + try {H5.H5Dclose(dataset_id);} catch (Exception exx) {} + } + + try { + //create new file + H5fid2 = H5.H5Fcreate("copy.h5", HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue("testH5OcopyRefsDatasettodiffFile.H5Fcreate: ", H5fid2 >= 0); + H5.H5Fflush(H5fid2, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Exception ex) { + try {H5.H5Fclose(H5fid2);} catch (Exception exx) {} + fail("testH5OcopyRefsDatasettodiffFile: H5Fcreate failed"); + } + + try { + //create object copy property list id and set the flags. + ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY); + assertTrue("testH5OcopyRefsDatasettodiffFile.H5Pcreate: ", ocp_plist_id >= 0); + H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG); + + //Perform copy function. + H5.H5Ocopy(H5fid, ".", H5fid2, "CPYREFD", ocp_plist_id, HDF5Constants.H5P_DEFAULT); + } + catch (Exception ex){ + ex.printStackTrace(); + fail("testH5OcopyRefsDatasettodiffFile: H5Ocopy failed"); + } + finally { + try {H5.H5Pclose(ocp_plist_id);} catch (Exception ex) {} + try {H5.H5Fclose(H5fid2);} catch (Exception ex) {} + } + } + + @Test + public void testH5OcopyRefsDatasettosameFile() { + byte rbuf0[]=null , rbuf1[] = null; + byte[] dset_data = new byte[16]; + long ocp_plist_id = -1; + long dataset_id = -1; + long did = -1; + int obj_type = -1; + byte[] read_data = new byte[16]; + + try { + rbuf0 = H5.H5Rcreate(H5fid, "/G1", HDF5Constants.H5R_OBJECT, -1); + rbuf1 = H5.H5Rcreate(H5fid, "DS2", HDF5Constants.H5R_OBJECT, -1); + System.arraycopy(rbuf0, 0, dset_data, 0, 8); + System.arraycopy(rbuf1, 0, dset_data, 8, 8); + + //Create a dataset and write object references to it. + dataset_id = H5.H5Dcreate(H5fid, "DSREF", + HDF5Constants.H5T_STD_REF_OBJ, H5dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue("testH5OcopyRefsDatasettosameFile.H5Dcreate: ", dataset_id >= 0); + H5.H5Dwrite(dataset_id, HDF5Constants.H5T_STD_REF_OBJ, + HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, dset_data); + //Close the dataset. + H5.H5Dclose(dataset_id); + } + catch (Exception ex) { + try {H5.H5Dclose(dataset_id);} catch (Exception exx) {} + fail("testH5OcopyRefsDatasettosameFile: create dataset failed"); + } + + try { + ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY); + assertTrue("testH5OcopyRefsDatasettosameFile.H5Pcreate: ", ocp_plist_id >= 0); + H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG); + } + catch (Exception ex) { + try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {} + fail("testH5OcopyRefsDatasettosameFile: H5Pset_copy_object failed"); + } + + //Perform copy function. + try { + H5.H5Ocopy(H5fid, "DSREF", H5fid, "CPYREFD", ocp_plist_id, HDF5Constants.H5P_DEFAULT); + } + catch(Exception ex) { + try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {} + fail("testH5OcopyRefsDatasettosameFile: H5Ocopy failed"); + } + + //Open the dataset that has been copied + try { + did = H5.H5Dopen(H5fid, "DSREF", HDF5Constants.H5P_DEFAULT); + assertTrue("testH5OcopyRefsDatasettosameFile.H5Dopen: ", did >= 0); + } + catch (Exception e) { + try {H5.H5Dclose(did);} catch (Exception exx) {} + e.printStackTrace(); + fail("testH5OcopyRefsDatasettosameFile: H5Dopen failed"); + } + + try { + //Read the dataset object references in the read_data buffer. + H5.H5Dread(did, HDF5Constants.H5T_STD_REF_OBJ, HDF5Constants.H5S_ALL,HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, read_data); + System.arraycopy(read_data, 0, rbuf0, 0, 8); + System.arraycopy(read_data, 8, rbuf1, 0, 8); + + //Get the type of object the reference points to. + obj_type = H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_OBJECT, rbuf1); + assertEquals(obj_type, HDF5Constants.H5O_TYPE_DATASET); + + obj_type = H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_OBJECT, rbuf0); + assertEquals(obj_type, HDF5Constants.H5O_TYPE_GROUP); + } + catch (Exception ex) { + ex.printStackTrace(); + } + finally { + try {H5.H5Dclose(did);} catch (Exception ex) {} + try {H5.H5Pclose(ocp_plist_id);} catch (Exception ex) {} + } + } + +// @Ignore because of JIRA HDF5-9547 +// @Test(expected = HDF5LibraryException.class) +// public void testH5OcopyInvalidRef() throws Throwable { +// final long _pid_ = HDF5Constants.H5P_DEFAULT; +// long sid = -1; +// long did = -1; +// long aid = -1; +// +// try { +// sid = H5.H5Screate_simple(1, new long[] {1}, null); +// assertTrue("testH5OcopyInvalidRef.H5Screate_simple: ", sid >= 0); +// did = H5.H5Dcreate(H5fid, "Dataset_with_invalid_Ref", HDF5Constants.H5T_NATIVE_INT, sid, _pid_, _pid_, _pid_); +// assertTrue("testH5OcopyInvalidRef.H5Dcreate: ", did > 0); +// aid = H5.H5Acreate(did, "Invalid_Ref", HDF5Constants.H5T_STD_REF_OBJ, sid, _pid_, _pid_); +// assertTrue("testH5OcopyInvalidRef.H5Acreate: ", aid > 0); +// H5.H5Awrite(aid, HDF5Constants.H5T_STD_REF_OBJ, new long[]{-1}); +// } +// catch (Exception ex) { +// ex.printStackTrace(); +// } +// finally { +// try {H5.H5Dclose(did);} catch (Exception exx) {} +// try {H5.H5Aclose(aid);} catch (Exception exx) {} +// try {H5.H5Sclose(sid);} catch (Exception exx) {} +// } +// +// long ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY); +// assertTrue("testH5OcopyInvalidRef.H5Pcreate: ", ocp_plist_id >= 0); +// H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG); +// try { +// H5.H5Ocopy(H5fid, "/Dataset_with_invalid_Ref", H5fid, "/Dataset_with_invalid_Ref_cp", ocp_plist_id, _pid_); +// } +// finally { +// try {H5.H5Pclose(ocp_plist_id);} catch (Exception exx) {} +// } +// } + +} diff --git a/java/test/TestH5Ocreate.java b/java/test/TestH5Ocreate.java new file mode 100644 index 0000000..0edecba --- /dev/null +++ b/java/test/TestH5Ocreate.java @@ -0,0 +1,562 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.util.ArrayList; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.callbacks.H5O_iterate_cb; +import hdf.hdf5lib.callbacks.H5O_iterate_t; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.structs.H5O_info_t; + +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Ocreate { + @Rule public TestName testname = new TestName(); + private static final String H5_EXTFILE = "h5ex_g_iterate.hdf"; + private static final String H5_FILE = "test.h5"; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + long H5fcpl = -1; + long H5fid = -1; + long H5dsid = -1; + long H5did1 = -1; + long H5did2 = -1; + long H5gcpl = -1; + long H5gid = -1; + long[] H5dims = { DIM_X, DIM_Y }; + + private final void _deleteFile(String filename) { + File file = new File(filename); + + if (file.exists()) { + try { + file.delete(); + } + catch (Exception e) { + e.printStackTrace(); + } + } + } + + private final long _createDataset(long fid, long dsid, String name, long dapl) { + long did = -1; + try { + did = H5.H5Dcreate(fid, name, + HDF5Constants.H5T_STD_I32BE, dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5O._createDataset: ",did > 0); + + return did; + } + + private final long _createGroup(long fid, String name) { + long gid = -1; + try { + H5gcpl = HDF5Constants.H5P_DEFAULT; + gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, + H5gcpl, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gcreate: " + err); + } + assertTrue("TestH5O._createGroup: ",gid > 0); + + return gid; + } + + private final void _createHardLink(long fid, long cid, String curname, long did, String dstname, long lcpl, long lapl) { + boolean link_exists = false; + try { + H5.H5Lcreate_hard(cid, curname, did, dstname, lcpl, lapl); + H5.H5Fflush(fid, HDF5Constants.H5F_SCOPE_LOCAL); + link_exists = H5.H5Lexists(did, dstname, lapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lcreate_hard: " + err); + } + assertTrue("TestH5O._createHardLink ", link_exists); + } + + private final void _createSoftLink(long fid, String curname, long did, String dstname, long lcpl, long lapl) { + boolean link_exists = false; + try { + H5.H5Lcreate_soft(curname, did, dstname, lcpl, lapl); + H5.H5Fflush(fid, HDF5Constants.H5F_SCOPE_LOCAL); + link_exists = H5.H5Lexists(did, dstname, lapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lcreate_soft: " + err); + } + assertTrue("TestH5O._createSoftLink ", link_exists); + } + + private final void _createExternalLink(long fid, String ext_filename, String curname, long did, String dstname, long lcpl, long lapl) { + boolean link_exists = false; + try { + H5.H5Lcreate_external(ext_filename, curname, did, dstname, lcpl, lapl); + H5.H5Fflush(fid, HDF5Constants.H5F_SCOPE_LOCAL); + link_exists = H5.H5Lexists(did, dstname, lapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Lcreate_external: " + err); + } + assertTrue("TestH5O._createExternalLink ", link_exists); + } + + @Before + public void createH5file() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + try { + H5fcpl = H5.H5Pcreate(HDF5Constants.H5P_FILE_CREATE); + H5.H5Pset_link_creation_order(H5fcpl, HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + H5fcpl, HDF5Constants.H5P_DEFAULT); + H5dsid = H5.H5Screate_simple(2, H5dims, null); + H5did1 = _createDataset(H5fid, H5dsid, "DS1", HDF5Constants.H5P_DEFAULT); + H5gid = _createGroup(H5fid, "/G1"); + H5did2 = _createDataset(H5gid, H5dsid, "DS2", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5O.createH5file: " + err); + } + assertTrue("TestH5O.createH5file: H5.H5Fcreate: ",H5fid > 0); + assertTrue("TestH5O.createH5file: H5.H5Screate_simple: ",H5dsid > 0); + assertTrue("TestH5O.createH5file: H5.H5Gcreate: ",H5gid > 0); + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5gid > 0) + try {H5.H5Gclose(H5gid);} catch (Exception ex) {} + if (H5gcpl > 0) + try {H5.H5Pclose(H5gcpl);} catch (Exception ex) {} + if (H5did2 > 0) + try {H5.H5Dclose(H5did2);} catch (Exception ex) {} + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5did1 > 0) + try {H5.H5Dclose(H5did1);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + if (H5fcpl > 0) + try {H5.H5Pclose(H5fcpl);} catch (Exception ex) {} + + _deleteFile(H5_FILE); + System.out.println(); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Ocopy_cur_not_exists() throws Throwable { + H5.H5Ocopy(H5fid, "None", H5fid, "DS1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Ocopy() { + try { + H5.H5Ocopy(H5fid, "DS1", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + boolean link_exists = H5.H5Lexists(H5fid, "CPY1", HDF5Constants.H5P_DEFAULT); + assertTrue("testH5Ocopy:H5Lexists ",link_exists); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ocopy: " + err); + } + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Ocopy_dst_link_exists() throws Throwable { + _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Ocopy(H5fid, "CPY1", H5fid, "/G1/DS2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Oget_info_by_idx_n0_create() { + H5O_info_t obj_info = null; + try { + int order = H5.H5Pget_link_creation_order(H5fcpl); + assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info_by_idx_n0:H5Pget_link_creation_order " + err); + } + try { + obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 0, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info_by_idx: " + err); + } + assertFalse("H5Oget_info_by_idx ", obj_info==null); + assertTrue("H5Oget_info_by_idx link type", obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + } + + @Test + public void testH5Oget_info_by_idx_n1_create() { + H5O_info_t obj_info = null; + try { + int order = H5.H5Pget_link_creation_order(H5fcpl); + assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info_by_idx_n1:H5Pget_link_creation_order " + err); + } + try { + obj_info = H5.H5Oget_info_by_idx(H5fid, "/", HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, 1, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info_by_idx: " + err); + } + assertFalse("H5Oget_info_by_idx ", obj_info==null); + assertTrue("H5Oget_info_by_idx link type", obj_info.type==HDF5Constants.H5O_TYPE_GROUP); + } + + @Test + public void testH5Oget_info_softlink() { + H5O_info_t obj_info = null; + _createSoftLink(H5fid, "/G1/DS2", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + obj_info = H5.H5Oget_info_by_name(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info: " + err); + } + assertFalse("H5Oget_info ", obj_info==null); + assertTrue("H5Oget_info link type", obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + assertTrue("Link Address ", obj_info.addr>0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_info_softlink_dangle() throws Throwable { + _createSoftLink(H5fid, "DS3", H5fid, "L2", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Oget_info_by_name(H5fid, "L2", HDF5Constants.H5P_DEFAULT); + } + + @Test + public void testH5Oget_info_externallink() { + H5O_info_t obj_info = null; + _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "L1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + try { + obj_info = H5.H5Oget_info_by_name(H5fid, "L1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info: " + err); + } + assertFalse("H5Oget_info ", obj_info==null); + assertTrue("H5Oget_info link type", obj_info.type==HDF5Constants.H5O_TYPE_NAMED_DATATYPE); + assertTrue("Link Address ", obj_info.addr>0); + } + + @Test + public void testH5Olink() { + long oid = -1; + H5O_info_t obj_info = null; + H5O_info_t dst_obj_info = null; + try { + oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + obj_info = H5.H5Oget_info(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info: " + err); + } + try { + H5.H5Olink(oid, H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Olink: " + err); + } + try {H5.H5Oclose(oid);} catch (Exception ex) {} + + assertFalse("H5Oget_info ", obj_info==null); + assertTrue("H5Oget_info object type", obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + + try { + dst_obj_info = H5.H5Oget_info_by_name(H5fid, "CPY1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_info_by_name: " + err); + } + assertFalse("H5Oget_info ", dst_obj_info==null); + assertTrue("H5Oget_info object type", dst_obj_info.type==HDF5Constants.H5O_TYPE_DATASET); + } + + @Test + public void testH5Ovisit_create() { + try { + int order = H5.H5Pget_link_creation_order(H5fcpl); + assertTrue("creation order :"+order, order == HDF5Constants.H5P_CRT_ORDER_TRACKED+HDF5Constants.H5P_CRT_ORDER_INDEXED); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ovisit_create:H5Pget_link_creation_order " + err); + } + + _createHardLink(H5fid, H5fid, "/G1/DS2", H5fid, "CPY1", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + _createExternalLink(H5fid, H5_EXTFILE, "DT1", H5fid, "LE", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + _createSoftLink(H5fid, "/G1/DS2", H5fid, "LS", HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + + class idata { + public String link_name = null; + public int link_type = -1; + idata(String name, int type) { + this.link_name = name; + this.link_type = type; + } + } + class H5O_iter_data implements H5O_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + H5O_iterate_t iter_data = new H5O_iter_data(); + class H5O_iter_callback implements H5O_iterate_cb { + public int callback(long group, String name, H5O_info_t info, H5O_iterate_t op_data) { + idata id = new idata(name, info.type); + ((H5O_iter_data)op_data).iterdata.add(id); + return 0; + } + } + H5O_iterate_cb iter_cb = new H5O_iter_callback(); + try { + H5.H5Ovisit(H5fid, HDF5Constants.H5_INDEX_CRT_ORDER, HDF5Constants.H5_ITER_INC, iter_cb, iter_data); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Ovisit: " + err); + } + assertFalse("H5Ovisit ", ((H5O_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Ovisit "+((H5O_iter_data)iter_data).iterdata.size(), ((H5O_iter_data)iter_data).iterdata.size()==4); + assertTrue("H5Ovisit "+((idata)((H5O_iter_data)iter_data).iterdata.get(0)).link_name, ((idata)((H5O_iter_data)iter_data).iterdata.get(0)).link_name.compareToIgnoreCase(".")==0); + assertTrue("H5Ovisit "+((idata)((H5O_iter_data)iter_data).iterdata.get(1)).link_name, ((idata)((H5O_iter_data)iter_data).iterdata.get(1)).link_name.compareToIgnoreCase("DS1")==0); + assertTrue("H5Ovisit "+((idata)((H5O_iter_data)iter_data).iterdata.get(2)).link_name, ((idata)((H5O_iter_data)iter_data).iterdata.get(2)).link_name.compareToIgnoreCase("G1")==0); + assertTrue("H5Ovisit "+((idata)((H5O_iter_data)iter_data).iterdata.get(3)).link_name, ((idata)((H5O_iter_data)iter_data).iterdata.get(3)).link_name.compareToIgnoreCase("G1/DS2")==0); + } + + @Test + public void testH5Ocomment() { + long oid = -1; + String obj_comment = null; + try { + oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + H5.H5Oset_comment(oid, "Test Comment"); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oset_comment: " + err); + } + try { + obj_comment = H5.H5Oget_comment(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_comment: " + err); + } + try {H5.H5Oclose(oid);} catch (Exception ex) {} + assertFalse("H5Oget_comment: ", obj_comment==null); + assertTrue("H5Oget_comment: ", obj_comment.compareTo("Test Comment")==0); + } + + @Test + public void testH5Ocomment_clear() { + long oid = -1; + String obj_comment = null; + try { + oid = H5.H5Oopen(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + H5.H5Oset_comment(oid, "Test Comment"); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oset_comment: " + err); + } + try { + obj_comment = H5.H5Oget_comment(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_comment: " + err); + } + assertFalse("H5Oget_comment: ", obj_comment==null); + assertTrue("H5Oget_comment: ", obj_comment.compareTo("Test Comment")==0); + try { + H5.H5Oset_comment(oid, null); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oset_comment: " + err); + } + try { + obj_comment = H5.H5Oget_comment(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_comment: " + err); + } + try {H5.H5Oclose(oid);} catch (Exception ex) {} + assertTrue("H5Oget_comment: ", obj_comment==null); + } + + @Test + public void testH5Ocomment_by_name() { + String obj_comment = null; + try { + H5.H5Oset_comment_by_name(H5fid, "DS1", "Test Comment", HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oset_comment_by_name: " + err); + } + try { + obj_comment = H5.H5Oget_comment_by_name(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_comment_by_name: " + err); + } + assertFalse("H5Oget_comment_by_name: ", obj_comment==null); + assertTrue("H5Oget_comment_by_name: ", obj_comment.compareTo("Test Comment")==0); + } + + @Test + public void testH5Ocomment_by_name_clear() { + String obj_comment = null; + try { + H5.H5Oset_comment_by_name(H5fid, "DS1", "Test Comment", HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oset_comment_by_name: " + err); + } + try { + obj_comment = H5.H5Oget_comment_by_name(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_comment_by_name: " + err); + } + assertFalse("H5Oget_comment_by_name: ", obj_comment==null); + assertTrue("H5Oget_comment_by_name: ", obj_comment.compareTo("Test Comment")==0); + try { + H5.H5Oset_comment_by_name(H5fid, "DS1", null, HDF5Constants.H5P_DEFAULT); + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oset_comment_by_name: " + err); + } + try { + obj_comment = H5.H5Oget_comment_by_name(H5fid, "DS1", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Oget_comment_by_name: " + err); + } + assertTrue("H5Oget_comment_by_name: ", obj_comment==null); + } + + @Test + public void testH5Oinc_dec_count() { + long oid = -1; + H5O_info_t obj_info = null; + try { + try { + oid = H5.H5Oopen(H5fid, "G1", HDF5Constants.H5P_DEFAULT); + obj_info = H5.H5Oget_info(oid); + assertFalse("testH5Oinc_dec_count: H5Oget_info ",obj_info==null); + assertTrue("testH5Oinc_dec_count: H5Oget_info reference count",obj_info.rc==1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oinc_dec_count: H5.H5Oget_info: " + err); + } + try { + H5.H5Oincr_refcount(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oinc_dec_count: H5.H5Oincr_refcount: " + err); + } + try { + obj_info = H5.H5Oget_info(oid); + assertFalse("testH5Oinc_dec_count: H5Oget_info ",obj_info==null); + assertTrue("testH5Oinc_dec_count: H5Oget_info reference count",obj_info.rc==2); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oinc_dec_count: H5.H5Oget_info: " + err); + } + try { + H5.H5Odecr_refcount(oid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oinc_dec_count: H5.H5Odecr_refcount: " + err); + } + try { + obj_info = H5.H5Oget_info(oid); + assertFalse("testH5Oinc_dec_count: H5Oget_info ",obj_info==null); + assertTrue("testH5Oinc_dec_count: H5Oget_info reference count",obj_info.rc==1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Oinc_dec_count: H5.H5Oget_info: " + err); + } + } + finally { + try{H5.H5Oclose(oid);} catch (Exception ex) {} + } + } + +} diff --git a/java/test/TestH5Oparams.java b/java/test/TestH5Oparams.java new file mode 100644 index 0000000..ced66f5 --- /dev/null +++ b/java/test/TestH5Oparams.java @@ -0,0 +1,154 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertTrue; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Oparams { + @Rule public TestName testname = new TestName(); + + @Before + public void checkOpenIDs() { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + @After + public void nextTestName() { + System.out.println(); + } + + @Test//(expected = HDF5LibraryException.class) + public void testH5Oclose_invalid() throws Throwable { + long oid = H5.H5Oclose(-1); + assertTrue(oid == 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Oopen_null() throws Throwable { + H5.H5Oopen(-1, null, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oopen_invalid() throws Throwable { + H5.H5Oopen(-1, "Bogus", 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Ocopy_invalid() throws Throwable { + H5.H5Ocopy(-1, "Bogus", -1, "Bogus", -1, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Ocopy_null_current() throws Throwable { + H5.H5Ocopy(-1, null, 0, "Bogus", 0, 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Ocopy_null_dest() throws Throwable { + H5.H5Ocopy(-1, "Bogus", 0, null, 0, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_info_invalid() throws Throwable { + H5.H5Oget_info(-1); + } + + @Test(expected = NullPointerException.class) + public void testH5Oget_info_by_name_null() throws Throwable { + H5.H5Oget_info_by_name(-1, null, HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_info_by_name_invalid() throws Throwable { + H5.H5Oget_info_by_name(-1, "/testH5Gcreate", HDF5Constants.H5P_DEFAULT); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oget_info_by_idx_invalid() throws Throwable { + H5.H5Oget_info_by_idx(-1, "Bogus", -1, -1, -1L, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Oget_info_by_idx_null() throws Throwable { + H5.H5Oget_info_by_idx(-1, null, 0, 0, 0L, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Olink_invalid() throws Throwable { + H5.H5Olink(-1, -1, "Bogus", -1, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Olink_null_dest() throws Throwable { + H5.H5Olink(-1, 0, null, 0, 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Ovisit_null() throws Throwable { + H5.H5Ovisit(-1, -1, -1, null, null); + } + + @Test(expected = NullPointerException.class) + public void testH5Ovisit_by_name_nullname() throws Throwable { + H5.H5Ovisit_by_name(-1, null, -1, -1, null, null, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Ovisit_by_name_null() throws Throwable { + H5.H5Ovisit_by_name(-1, "Bogus", -1, -1, null, null, -1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oset_comment_invalid() throws Throwable { + H5.H5Oset_comment(-1, "Bogus"); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Oget_comment_invalid() throws Throwable { + H5.H5Oget_comment(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Oset_comment_by_name_invalid() throws Throwable { + H5.H5Oset_comment_by_name(-1, "Bogus", null, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Oset_comment_by_name_null() throws Throwable { + H5.H5Oset_comment_by_name(-1, null, null, -1); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Oget_comment_by_name_invalid() throws Throwable { + H5.H5Oget_comment_by_name(-1, "Bogus", -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Oget_comment_by_name_null() throws Throwable { + H5.H5Oget_comment_by_name(-1, null, -1); + } + +} diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java new file mode 100644 index 0000000..2a0fc34 --- /dev/null +++ b/java/test/TestH5P.java @@ -0,0 +1,1221 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5P { + @Rule public TestName testname = new TestName(); + + private static final String H5_FILE = "test.h5"; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + long[] H5dims = { DIM_X, DIM_Y }; + long H5fid = -1; + long H5dsid = -1; + long H5did = -1; + long lapl_id = -1; + long fapl_id = -1; + long fcpl_id = -1; + long ocpl_id = -1; + long ocp_plist_id = -1; + long lcpl_id = -1; + long plapl_id = -1; + long plist_id = -1; + long gapl_id = -1; + long gcpl_id = -1; + long acpl_id = -1; + + private final void _deleteFile(String filename) { + File file = new File(filename); + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + private final long _createDataset(long fid, long dsid, String name, long dapl) { + long did = -1; + try { + did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5P._createDataset: ", did > 0); + + return did; + } + + private final void _createH5File(long fcpl, long fapl) { + try { + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + fcpl, fapl); + H5dsid = H5.H5Screate_simple(2, H5dims, null); + H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5P.createH5file: " + err); + } + assertTrue("TestH5P.createH5file: H5.H5Fcreate: ", H5fid > 0); + assertTrue("TestH5P.createH5file: H5.H5Screate_simple: ", H5dsid > 0); + assertTrue("TestH5P.createH5file: _createDataset: ", H5did > 0); + + try { + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + } + } + + public void deleteH5file() throws HDF5LibraryException { + _deleteFile(H5_FILE); + } + + @Before + public void createH5fileProperties() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + try { + lapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS); + fapl_id = H5.H5Pcreate(HDF5Constants.H5P_FILE_ACCESS); + fcpl_id = H5.H5Pcreate(HDF5Constants.H5P_FILE_CREATE); + ocpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + ocp_plist_id = H5.H5Pcreate(HDF5Constants.H5P_OBJECT_COPY); + lcpl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_CREATE); + plapl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_ACCESS); + plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); + gapl_id = H5.H5Pcreate(HDF5Constants.H5P_GROUP_ACCESS); + gcpl_id = H5.H5Pcreate(HDF5Constants.H5P_GROUP_CREATE); + acpl_id = H5.H5Pcreate(HDF5Constants.H5P_ATTRIBUTE_CREATE); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5P.createH5file: " + err); + } + assertTrue(lapl_id > 0); + assertTrue(fapl_id > 0); + assertTrue(fcpl_id > 0); + assertTrue(ocpl_id > 0); + assertTrue(ocp_plist_id > 0); + assertTrue(lcpl_id > 0); + assertTrue(plapl_id>0); + assertTrue(plist_id > 0); + assertTrue(gapl_id > 0); + assertTrue(gcpl_id >0); + assertTrue(acpl_id >0); + } + + @After + public void deleteH5fileProperties() throws HDF5LibraryException { + if (lapl_id >0) + try {H5.H5Pclose(lapl_id);} catch (Exception ex) {} + if (fapl_id >0) + try {H5.H5Pclose(fapl_id);} catch (Exception ex) {} + if (fcpl_id >0) + try {H5.H5Pclose(fcpl_id);} catch (Exception ex) {} + if (ocpl_id >0) + try {H5.H5Pclose(ocpl_id);} catch (Exception ex) {} + if (ocp_plist_id >0) + try {H5.H5Pclose(ocp_plist_id);} catch (Exception ex) {} + if (lcpl_id >0) + try {H5.H5Pclose(lcpl_id);} catch (Exception ex) {} + if (plapl_id >0) + try {H5.H5Pclose(plapl_id);} catch (Exception ex) {} + if (plist_id >0) + try {H5.H5Pclose(plist_id);} catch (Exception ex) {} + if (gapl_id >0) + try {H5.H5Pclose(gapl_id);} catch (Exception ex) {} + if (gcpl_id >0) + try {H5.H5Pclose(gcpl_id);} catch (Exception ex) {} + if (acpl_id >0) + try {H5.H5Pclose(acpl_id);} catch (Exception ex) {} + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5did > 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + System.out.println(); + } + + @Test + public void testH5Pget_nlinks() { + long nlinks = -1; + try { + nlinks = (long) H5.H5Pget_nlinks(lapl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Pget_nlinks: " + err); + } + assertTrue("testH5Pget_nlinks", nlinks > 0); + // Check the default value of nlinks. + assertEquals(nlinks, 16L); + } + + @Test + public void testH5Pset_nlinks() { + long nlinks = 20; + int ret_val = -1; + try { + ret_val = H5.H5Pset_nlinks(lapl_id, nlinks); + nlinks = (long) H5.H5Pget_nlinks(lapl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Pset_nlinks: " + err); + } + assertTrue("testH5Pset_nlinks", ret_val >= 0); + // Check the value of nlinks retrieved from H5Pget_nlinks function. + assertEquals(nlinks, 20L); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pset_libver_bounds_invalidlow() throws Throwable { + H5.H5Pset_libver_bounds(fapl_id, 5, HDF5Constants.H5F_LIBVER_LATEST); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pset_libver_bounds_invalidhigh() throws Throwable { + H5.H5Pset_libver_bounds(fapl_id, HDF5Constants.H5F_LIBVER_LATEST, 5); + } + + @Test + public void testH5Pget_link_creation_order() { + int crt_order_flags = 0; + try { + crt_order_flags = H5.H5Pget_link_creation_order(fcpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_link_creation_order: " + err); + } + assertTrue("testH5Pget_link_creation_order", crt_order_flags >= 0); + } + + @Test + public void testH5Pset_link_creation_order_trackedPLUSindexed() { + int ret_val = -1; + int crt_order_flags = HDF5Constants.H5P_CRT_ORDER_TRACKED + HDF5Constants.H5P_CRT_ORDER_INDEXED; + int crtorderflags = 0; + + try { + ret_val = H5.H5Pset_link_creation_order(fcpl_id, crt_order_flags); + crtorderflags = H5.H5Pget_link_creation_order(fcpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_link_creation_order: " + err); + } + assertTrue("testH5Pset_link_creation_order_trackedPLUSindexed",ret_val >= 0); + assertEquals(crt_order_flags, crtorderflags); + } + + @Test + public void testH5Pset_link_creation_order_tracked() { + int ret_val = -1; + int crtorderflags = 0; + + try { + ret_val = H5.H5Pset_link_creation_order(fcpl_id, HDF5Constants.H5P_CRT_ORDER_TRACKED); + crtorderflags = H5.H5Pget_link_creation_order(fcpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_link_creation_order: " + err); + } + assertTrue("testH5Pset_link_creation_order_tracked",ret_val >= 0); + assertEquals(HDF5Constants.H5P_CRT_ORDER_TRACKED, crtorderflags); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Pset_link_creation_order_invalidvalue() throws Throwable { + H5.H5Pset_link_creation_order(fcpl_id, HDF5Constants.H5P_CRT_ORDER_INDEXED); + } + + @Test + public void testH5Pget_attr_creation_order() { + int crt_order_flags = 0; + + try { + crt_order_flags = H5.H5Pget_attr_creation_order(ocpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_attr_creation_order: " + err); + } + assertTrue("testH5Pget_attr_creation_order", crt_order_flags >= 0); + } + + @Test + public void testH5Pset_attr_creation_order_trackedPLUSindexed() { + int ret_val = -1; + int crt_order_flags = HDF5Constants.H5P_CRT_ORDER_TRACKED + HDF5Constants.H5P_CRT_ORDER_INDEXED; + int crtorderflags = 0; + + try { + ret_val = H5.H5Pset_attr_creation_order(ocpl_id, crt_order_flags); + crtorderflags = H5.H5Pget_attr_creation_order(ocpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_attr_creation_order: " + err); + } + assertTrue("testH5Pset_attr_creation_order_trackedPLUSindexed", ret_val >= 0); + assertEquals(crt_order_flags, crtorderflags); + } + + @Test + public void testH5Pset_attr_creation_order_tracked() { + int ret_val = -1; + int crtorderflags = 0; + + try { + ret_val = H5.H5Pset_attr_creation_order(ocpl_id, HDF5Constants.H5P_CRT_ORDER_TRACKED); + crtorderflags = H5.H5Pget_attr_creation_order(ocpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_attr_creation_order: " + err); + } + assertTrue("testH5Pset_attr_creation_order_tracked", ret_val >= 0); + assertEquals(HDF5Constants.H5P_CRT_ORDER_TRACKED, crtorderflags); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Pset_attr_creation_order_invalidvalue() throws Throwable { + H5.H5Pset_attr_creation_order(ocpl_id, HDF5Constants.H5P_CRT_ORDER_INDEXED); + } + + @Test + public void testH5Pset_copy_object() { + + int cpy_option = -1; + + try { + H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_SHALLOW_HIERARCHY_FLAG); + cpy_option = H5.H5Pget_copy_object(ocp_plist_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_copy_object: " + err); + } + assertEquals(HDF5Constants.H5O_COPY_SHALLOW_HIERARCHY_FLAG, cpy_option); + + try { + H5.H5Pset_copy_object(ocp_plist_id, HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG); + cpy_option = H5.H5Pget_copy_object(ocp_plist_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_copy_object: " + err); + } + assertEquals(HDF5Constants.H5O_COPY_EXPAND_REFERENCE_FLAG, cpy_option); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Pset_copy_object_invalidobject() throws Throwable { + H5.H5Pset_copy_object(HDF5Constants.H5P_DEFAULT, HDF5Constants.H5O_COPY_SHALLOW_HIERARCHY_FLAG); + } + + @Test + public void testH5Pset_create_intermediate_group() { + + int ret_val = -1; + try { + ret_val = H5.H5Pset_create_intermediate_group(lcpl_id, true); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_create_intermediate_group: " + err); + } + assertTrue(ret_val>=0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Pset_create_intermediate_group_invalidobject() throws Throwable { + H5.H5Pset_create_intermediate_group(ocp_plist_id, true); + } + + @Test + public void testH5Pget_create_intermediate_group() { + boolean flag = false; + try { + H5.H5Pset_create_intermediate_group(lcpl_id, true); + flag = H5.H5Pget_create_intermediate_group(lcpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_create_intermediate_group: " + err); + } + assertEquals(true, flag); + } + + @Test + public void testH5Pget_create_intermediate_group_notcreated() { + boolean flag = true; + try { + flag = H5.H5Pget_create_intermediate_group(lcpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_create_intermediate_group_notcreated: " + err); + } + assertEquals(false, flag); + } + + @Test + public void testH5Pset_data_transform() { + + String expression = "(5/9.0)*(x-32)"; + int ret_val = -1; + + try { + ret_val= H5.H5Pset_data_transform(plist_id, expression); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_data_transform: " + err); + } + assertTrue(ret_val>=0); + } + + @Test(expected = NullPointerException.class) + public void testH5Pset_data_transform_NullExpression() throws Throwable { + H5.H5Pset_data_transform(plist_id, null); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Pset_data_transform_InvalidExpression1() throws Throwable { + H5.H5Pset_data_transform(plist_id, ""); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Pset_data_transform_InvalidExpression2() throws Throwable { + H5.H5Pset_data_transform(plist_id, "hello"); + } + + @Test + public void testH5Pget_data_transform() { + + String expression = "(5/9.0)*(x-32)"; + String [] express = {""}; + long express_size = 0; + long size = 20; + + try { + H5.H5Pset_data_transform(plist_id, expression); + express_size = H5.H5Pget_data_transform(plist_id, express, size); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_data_transform: " + err); + } + assertTrue(express_size>=0); + assertTrue("The data transform expression: ", expression.equals(express[0])); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Pget_data_transform_ExpressionNotSet() throws Throwable { + String [] express = {""}; + H5.H5Pget_data_transform(plist_id, express, 20); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pget_data_transform_IllegalSize() throws Throwable { + String [] express = {""}; + H5.H5Pset_data_transform(plist_id, "(5/9.0)*(x-32)"); + H5.H5Pget_data_transform(plist_id, express, 0); + } + + @Test + public void testH5Pget_elink_acc_flags() { + + int get_flags = -1; + try { + get_flags = H5.H5Pget_elink_acc_flags(gapl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_elink_acc_flags: " + err); + } + assertTrue("H5Pget_elink_acc_flags", get_flags >= 0); + assertEquals(HDF5Constants.H5F_ACC_DEFAULT, get_flags); + } + + @Test + public void testH5Pset_elink_acc_flags() { + + int get_flags = -1; + int ret_val = -1; + try { + ret_val = H5.H5Pset_elink_acc_flags(lapl_id, HDF5Constants.H5F_ACC_RDWR); + get_flags = H5.H5Pget_elink_acc_flags(lapl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_elink_acc_flags: " + err); + } + assertTrue("H5Pset_elink_acc_flags", ret_val >= 0); + assertEquals(HDF5Constants.H5F_ACC_RDWR, get_flags); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pset_elink_acc_flags_InvalidFlag1() throws Throwable { + H5.H5Pset_elink_acc_flags(lapl_id, HDF5Constants.H5F_ACC_TRUNC); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pset_elink_acc_flags_InvalidFlag2() throws Throwable { + H5.H5Pset_elink_acc_flags(lapl_id, -1); + } + + @Test + public void testH5Pset_link_phase_change() { + + int ret_val = -1; + try { + ret_val = H5.H5Pset_link_phase_change(fcpl_id , 2, 2); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_link_phase_change: " + err); + } + assertTrue("H5Pset_link_phase_change", ret_val >= 0); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pset_link_phase_change_Highmax_Compact() throws Throwable { + H5.H5Pset_link_phase_change(fcpl_id , 70000000, 3); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pset_link_phase_change_max_compactLESSTHANmin_dense() throws Throwable { + H5.H5Pset_link_phase_change(fcpl_id , 5, 6); + } + + @Test + public void testH5Pget_link_phase_change() { + int ret_val = -1; + int[] links = new int[2]; + + try { + ret_val = H5.H5Pget_link_phase_change(fcpl_id, links); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_link_phase_change: " + err); + } + assertTrue("testH5Pget_link_phase_change", ret_val >= 0); + assertEquals("Default value of maximum compact storage", 8, links[0]); + assertEquals("Default value of minimum dense storage", 6, links[1]); + } + + @Test + public void testH5Pget_link_phase_change_EqualsSet() { + int[] links = new int[2]; + try { + H5.H5Pset_link_phase_change(fcpl_id , 10, 7); + H5.H5Pget_link_phase_change(fcpl_id, links); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_link_phase_change_EqualsSet: " + err); + } + assertEquals("Value of maximum compact storage set", 10, links[0]); + assertEquals("Value of minimum dense storage set", 7, links[1]); + } + + @Test(expected = NullPointerException.class) + public void testH5Pget_link_phase_change_Null() throws Throwable { + H5.H5Pget_link_phase_change(fcpl_id, null); + } + + @Test + public void testH5Pget_attr_phase_change() { + int ret_val = -1; + int[] attributes = new int[2]; + + try { + ret_val = H5.H5Pget_attr_phase_change(ocpl_id, attributes); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_attr_phase_change: " + err); + } + assertTrue("testH5Pget_attr_phase_change", ret_val >= 0); + assertEquals("Default value of the max. no. of attributes stored in compact storage", 8, attributes[0]); + assertEquals("Default value of the min. no. of attributes stored in dense storage", 6, attributes[1]); + try { + H5.H5Pset_attr_phase_change(ocpl_id, 9, 5); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_attr_phase_change: " + err); + } + try { + ret_val = H5.H5Pget_attr_phase_change(ocpl_id, attributes); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_attr_phase_change: " + err); + } + assertTrue("testH5Pget_attr_phase_change", ret_val >= 0); + assertEquals("Default value of the max. no. of attributes stored in compact storage", 9, attributes[0]); + assertEquals("Default value of the min. no. of attributes stored in dense storage", 5, attributes[1]); + } + + @Test + public void testH5Pget_shared_mesg_phase_change() { + int ret_val = -1; + int[] size = new int[2]; + + try { + ret_val = H5.H5Pget_shared_mesg_phase_change(fcpl_id, size); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_shared_mesg_phase_change: " + err); + } + assertTrue("testH5Pget_shared_mesg_phase_change", ret_val >= 0); + } + + @Test + public void testH5Pget_shared_mesg_phase_change_EqualsSET() { + int[] size = new int[2]; + + try { + H5.H5Pset_shared_mesg_phase_change(fcpl_id,50, 40); + H5.H5Pget_shared_mesg_phase_change(fcpl_id, size); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_shared_mesg_phase_change_EqualsSET: " + err); + } + assertEquals("Value of maximum list set", 50, size[0]); + assertEquals("Value of minimum btree set", 40, size[1]); + } + + @Test + public void testH5Pset_shared_mesg_phase_change() { + + int ret_val = -1; + try { + ret_val = H5.H5Pset_shared_mesg_phase_change(fcpl_id,2, 1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_shared_mesg_phase_change: " + err); + } + assertTrue("H5Pset_shared_mesg_phase_change", ret_val >= 0); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5PH5Pset_shared_mesg_phase_change_HighMaxlistValue() throws Throwable { + H5.H5Pset_shared_mesg_phase_change(fcpl_id, 5001, 4000); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5PH5Pset_shared_mesg_phase_change_HighMinbtreeValue() throws Throwable { + H5.H5Pset_shared_mesg_phase_change(fcpl_id, 5000, 5001); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5PH5Pset_shared_mesg_phase_change_MinbtreeGreaterThanMaxlist() throws Throwable { + H5.H5Pset_link_phase_change(fcpl_id , 3, 7); + } + + @Test + public void testH5Pget_shared_mesg_nindexes() { + + int nindexes = -1; + try { + nindexes = H5.H5Pget_shared_mesg_nindexes(fcpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_shared_mesg_nindexes: " + err); + } + assertTrue("H5Pget_shared_mesg_nindexes", nindexes >= 0); + } + + @Test + public void testH5Pset_shared_mesg_nindexes() { + + int nindexes = -1; + int ret_val = -1; + try { + ret_val = H5.H5Pset_shared_mesg_nindexes(fcpl_id, 7); + nindexes = H5.H5Pget_shared_mesg_nindexes(fcpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_shared_mesg_nindexes: " + err); + } + assertTrue("H5Pset_shared_mesg_nindexes", ret_val >= 0); + assertEquals("Value of nindexes is equal to value set",7 ,nindexes); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pset_shared_mesg_nindexes_InvalidHIGHnindexes()throws Throwable { + H5.H5Pset_shared_mesg_nindexes(fcpl_id, 9); + } + + @Test + public void testH5Pset_shared_mesg_index() { + + int ret_val = -1; + try { + H5.H5Pset_shared_mesg_nindexes(fcpl_id, 2); + ret_val = H5.H5Pset_shared_mesg_index(fcpl_id, 0,HDF5Constants.H5O_SHMESG_ATTR_FLAG, 10); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_shared_mesg_index: " + err); + } + assertTrue("H5Pset_shared_mesg_index", ret_val >= 0); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pset_shared_mesg_index_Invalid_indexnum() throws Throwable { + H5.H5Pset_shared_mesg_index(fcpl_id, 2,HDF5Constants.H5O_SHMESG_ATTR_FLAG, 10); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pset_shared_mesg_index_InvalidFlag() throws Throwable { + H5.H5Pset_shared_mesg_nindexes(fcpl_id, 7); + H5.H5Pset_shared_mesg_index(fcpl_id, 2,HDF5Constants.H5O_SHMESG_ALL_FLAG + 1, 10); + } + + @Test + public void testH5Pget_shared_mesg_index() { + + int ret_val = -1; + int[] mesg_info = new int[2]; + try { + H5.H5Pset_shared_mesg_nindexes(fcpl_id, 2); + H5.H5Pset_shared_mesg_index(fcpl_id, 0,HDF5Constants.H5O_SHMESG_ATTR_FLAG, 10); + ret_val = H5.H5Pget_shared_mesg_index(fcpl_id, 0, mesg_info); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_shared_mesg_index: " + err); + } + assertTrue("H5Pget_shared_mesg_index", ret_val >= 0); + assertEquals("Type of message", HDF5Constants.H5O_SHMESG_ATTR_FLAG, mesg_info[0]); + assertEquals("minimum message size", 10, mesg_info[1]); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pget_shared_mesg_index_Invalid_indexnum() throws Throwable { + int[] mesg_info = new int[2]; + H5.H5Pget_shared_mesg_index(fcpl_id, 0, mesg_info); + } + + @Test + public void testH5Pset_local_heap_size_hint() { + int ret_val = -1; + try { + ret_val = H5.H5Pset_local_heap_size_hint(gcpl_id, 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_local_heap_size_hint: " + err); + } + assertTrue("H5Pset_local_heap_size_hint", ret_val >= 0); + } + + @Test + public void testH5Pget_local_heap_size_hint() { + long size_hint = -1; + try { + size_hint = H5.H5Pget_local_heap_size_hint(gcpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_local_heap_size_hint: " + err); + } + assertTrue("H5Pget_local_heap_size_hint", size_hint >= 0); + } + + @Test + public void testH5Pset_nbit() { + int ret_val = -1; + try { + ret_val = H5.H5Pset_nbit(ocpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_nbit: " + err); + } + assertTrue("H5Pset_nbit", ret_val >= 0); + } + + @Test + public void testH5Pset_scaleoffset() { + int ret_val = -1; + int scale_type = HDF5Constants.H5Z_SO_FLOAT_DSCALE; + int scale_factor = HDF5Constants.H5Z_SO_INT_MINBITS_DEFAULT; + try { + ret_val = H5.H5Pset_scaleoffset(ocpl_id, scale_type, scale_factor); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_scaleoffset: " + err); + } + assertTrue("H5Pset_scaleoffset", ret_val >= 0); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pset_scaleoffset_Invalidscale_type() throws Throwable { + H5.H5Pset_scaleoffset(ocpl_id, 3, 1); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pset_scaleoffset_Invalidscale_factor() throws Throwable { + H5.H5Pset_scaleoffset(ocpl_id, HDF5Constants.H5Z_SO_INT, -1); + } + + @Test + public void testH5Pset_est_link_info() { + int ret_val = -1; + try { + ret_val = H5.H5Pset_est_link_info(gcpl_id, 0,10); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_est_link_info: " + err); + } + assertTrue("H5Pset_est_link_info", ret_val >= 0); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Pset_est_link_info_InvalidValues() throws Throwable { + H5.H5Pset_est_link_info(gcpl_id, 100000,10); + } + + @Test + public void testH5Pget_est_link_info() { + int ret_val = -1; + int[] link_info = new int[2]; + try { + ret_val = H5.H5Pget_est_link_info(gcpl_id, link_info); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_est_link_info: " + err); + } + assertTrue("H5Pget_est_link_info", ret_val >= 0); + } + + @Test + public void testH5Pset_elink_prefix() { + int ret_val = -1; + String prefix = "tmp"; + try { + ret_val = H5.H5Pset_elink_prefix(plapl_id, prefix); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_est_link_info: " + err); + } + assertTrue("H5Pset_elink_prefix", ret_val >= 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Pset_elink_prefix_null() throws Throwable{ + H5.H5Pset_elink_prefix(plapl_id, null); + } + + @Test + public void testH5Pget_elink_prefix() { + String prefix = "tmp"; + String[] pre = {""}; + long prefix_size = 0; + + try { + H5.H5Pset_elink_prefix(plapl_id, prefix); + prefix_size = H5.H5Pget_elink_prefix(plapl_id, pre); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_elink_prefix: " + err); + } + assertTrue(prefix_size>=0); + assertTrue("The prefix: ", prefix.equals(pre[0])); + } + + @Test(expected = NullPointerException.class) + public void testH5Pget_elink_prefix_null() throws Throwable { + H5.H5Pget_elink_prefix(plapl_id, null); + } + + @Test(expected = NullPointerException.class) + public void testH5Pget_version_null() throws Throwable { + H5.H5Pget_version(fcpl_id, null); + } + + @Test + public void testH5Pget_version() { + int[] version_info = {255,255,255,255}; + + try { + _createH5File(fcpl_id, fapl_id); + H5.H5Pget_version(fcpl_id, version_info); + deleteH5file(); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_version: " + err); + } + assertTrue("super block version: "+version_info[0], version_info[0] == 0); + assertTrue("global freelist version: "+version_info[1], version_info[1] == 0); + assertTrue("symbol table version: "+version_info[2], version_info[2] == 0); + assertTrue("shared object header version: "+version_info[3], version_info[3] == 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Pget_userblock_null() throws Throwable { + H5.H5Pget_userblock(fcpl_id, null); + } + + @Test + public void testH5P_userblock() { + int[] version_info = {255,255,255,255}; + long[] size = {0}; + + try { + H5.H5Pset_userblock(fcpl_id, 1024); + _createH5File(fcpl_id, fapl_id); + + /* Close FCPL */ + H5.H5Pclose(fcpl_id); + + /* Get the file's dataset creation property list */ + fcpl_id = H5.H5Fget_create_plist(H5fid); + + /* Get the file's version information */ + H5.H5Pget_version(fcpl_id, version_info); + H5.H5Pget_userblock(fcpl_id, size); + deleteH5file(); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_userblock: " + err); + } + assertTrue("super block version: "+version_info[0], version_info[0] == 0); + assertTrue("global freelist version: "+version_info[1], version_info[1] == 0); + assertTrue("symbol table version: "+version_info[2], version_info[2] == 0); + assertTrue("shared object header version: "+version_info[3], version_info[3] == 0); + assertTrue("user block size: "+size[0], size[0] == 1024); + } + + @Test(expected = NullPointerException.class) + public void testH5Pget_sizes_null() throws Throwable { + H5.H5Pget_sizes(fcpl_id, null); + } + + @Test + public void testH5P_sizes() { + int[] version_info = {255,255,255,255}; + long[] size = {0,0}; + + try { + H5.H5Pset_sizes(fcpl_id, 4, 8); + _createH5File(fcpl_id, fapl_id); + + /* Close FCPL */ + H5.H5Pclose(fcpl_id); + + /* Get the file's dataset creation property list */ + fcpl_id = H5.H5Fget_create_plist(H5fid); + + /* Get the file's version information */ + H5.H5Pget_version(fcpl_id, version_info); + H5.H5Pget_sizes(fcpl_id, size); + deleteH5file(); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_sizes: " + err); + } + assertTrue("super block version: "+version_info[0], version_info[0] == 0); + assertTrue("global freelist version: "+version_info[1], version_info[1] == 0); + assertTrue("symbol table version: "+version_info[2], version_info[2] == 0); + assertTrue("shared object header version: "+version_info[3], version_info[3] == 0); + assertTrue("sizeof_addr size: "+size[0], size[0] == 4); + assertTrue("sizeof_size size: "+size[1], size[1] == 8); + } + + @Test(expected = NullPointerException.class) + public void testH5Pget_sym_k_null() throws Throwable { + H5.H5Pget_sym_k(fcpl_id, null); + } + + @Test + public void testH5P_sym_k() { + int[] version_info = {255,255,255,255}; + int[] size = {0,0}; + + try { + H5.H5Pset_sym_k(fcpl_id, 32, 8); + _createH5File(fcpl_id, fapl_id); + + /* Close FCPL */ + H5.H5Pclose(fcpl_id); + + /* Get the file's dataset creation property list */ + fcpl_id = H5.H5Fget_create_plist(H5fid); + + /* Get the file's version information */ + H5.H5Pget_version(fcpl_id, version_info); + H5.H5Pget_sym_k(fcpl_id, size); + deleteH5file(); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_sym_k: " + err); + } + assertTrue("super block version: "+version_info[0], version_info[0] == 0); + assertTrue("global freelist version: "+version_info[1], version_info[1] == 0); + assertTrue("symbol table version: "+version_info[2], version_info[2] == 0); + assertTrue("shared object header version: "+version_info[3], version_info[3] == 0); + assertTrue("symbol table tree rank: "+size[0], size[0] == 32); + assertTrue("symbol table node size: "+size[1], size[1] == 8); + } + + @Test(expected = NullPointerException.class) + public void testH5Pget_istore_k_null() throws Throwable { + H5.H5Pget_istore_k(fcpl_id, null); + } + + @Test + public void testH5P_istore_k() { + int[] version_info = {255,255,255,255}; + int[] size = {0}; + + try { + H5.H5Pset_istore_k(fcpl_id, 64); + _createH5File(fcpl_id, fapl_id); + + /* Close FCPL */ + H5.H5Pclose(fcpl_id); + + /* Get the file's dataset creation property list */ + fcpl_id = H5.H5Fget_create_plist(H5fid); + + /* Get the file's version information */ + H5.H5Pget_version(fcpl_id, version_info); + H5.H5Pget_istore_k(fcpl_id, size); + deleteH5file(); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_sym_k: " + err); + } + assertTrue("super block version: "+version_info[0], version_info[0] == 1); + assertTrue("global freelist version: "+version_info[1], version_info[1] == 0); + assertTrue("symbol table version: "+version_info[2], version_info[2] == 0); + assertTrue("shared object header version: "+version_info[3], version_info[3] == 0); + assertTrue("chunked storage b-tree 1/2-rank: "+size[0], size[0] == 64); + } + + @Test + public void testH5P_obj_track_times() { + boolean default_ret_val = false; + boolean ret_val = true; + try { + default_ret_val = H5.H5Pget_obj_track_times(ocpl_id); + H5.H5Pset_obj_track_times(ocpl_id, false); + ret_val = H5.H5Pget_obj_track_times(ocpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_obj_track_times: " + err); + } + assertTrue("H5Pget_obj_track_times default", default_ret_val); + assertFalse("H5Pget_obj_track_times", ret_val); + } + + @Test + public void testH5Pget_char_encoding() { + int char_encoding = 0; + + try { + char_encoding = H5.H5Pget_char_encoding(acpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_char_encoding: " + err); + } + assertTrue("testH5Pget_char_encoding", char_encoding == HDF5Constants.H5T_CSET_ASCII); + try { + H5.H5Pset_char_encoding(acpl_id, HDF5Constants.H5T_CSET_UTF8); + char_encoding = H5.H5Pget_char_encoding(acpl_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_char_encoding: " + err); + } + assertTrue("testH5Pget_char_encoding", char_encoding == HDF5Constants.H5T_CSET_UTF8); + } + + @Test + public void testH5P_fill_time() { + int[] fill_time = {0}; + + try { + H5.H5Pget_fill_time(ocpl_id, fill_time); + assertTrue("fill_time: "+fill_time[0], fill_time[0] == HDF5Constants.H5D_FILL_TIME_IFSET); + H5.H5Pset_fill_time(ocpl_id, HDF5Constants.H5D_FILL_TIME_ALLOC); + H5.H5Pget_fill_time(ocpl_id, fill_time); + assertTrue("fill_time: "+fill_time[0], fill_time[0] == HDF5Constants.H5D_FILL_TIME_ALLOC); + H5.H5Pset_fill_time(ocpl_id, HDF5Constants.H5D_FILL_TIME_NEVER); + H5.H5Pget_fill_time(ocpl_id, fill_time); + assertTrue("fill_time: "+fill_time[0], fill_time[0] == HDF5Constants.H5D_FILL_TIME_NEVER); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_fill_time: " + err); + } + } + + @Test + public void testH5P_alloc_time() { + int[] alloc_time = {0}; + + try { + H5.H5Pget_alloc_time(ocpl_id, alloc_time); + assertTrue("alloc_time: "+alloc_time[0], alloc_time[0] == HDF5Constants.H5D_ALLOC_TIME_LATE); + H5.H5Pset_alloc_time(ocpl_id, HDF5Constants.H5D_ALLOC_TIME_EARLY); + H5.H5Pget_alloc_time(ocpl_id, alloc_time); + assertTrue("alloc_time: "+alloc_time[0], alloc_time[0] == HDF5Constants.H5D_ALLOC_TIME_EARLY); + H5.H5Pset_alloc_time(ocpl_id, HDF5Constants.H5D_ALLOC_TIME_INCR); + H5.H5Pget_alloc_time(ocpl_id, alloc_time); + assertTrue("alloc_time: "+alloc_time[0], alloc_time[0] == HDF5Constants.H5D_ALLOC_TIME_INCR); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_alloc_time: " + err); + } + } + + @Test + public void testH5P_fill_value() { + int[] fill_value = {-1}; + int[] fill_value_status = {-1}; + + try { + H5.H5Pfill_value_defined(ocpl_id, fill_value_status); + assertTrue("fill_value_status: "+fill_value_status[0], fill_value_status[0] == HDF5Constants.H5D_FILL_VALUE_DEFAULT); + H5.H5Pget_fill_value(ocpl_id, HDF5Constants.H5T_NATIVE_INT, fill_value); + assertTrue("fill_value: "+fill_value[0], fill_value[0] == 0); + fill_value[0] = 255; + H5.H5Pset_fill_value(ocpl_id, HDF5Constants.H5T_NATIVE_INT, fill_value); + H5.H5Pget_fill_value(ocpl_id, HDF5Constants.H5T_NATIVE_INT, fill_value); + assertTrue("fill_value: "+fill_value[0], fill_value[0] == 255); + H5.H5Pfill_value_defined(ocpl_id, fill_value_status); + assertTrue("fill_value_status: "+fill_value_status[0], fill_value_status[0] == HDF5Constants.H5D_FILL_VALUE_USER_DEFINED); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_fill_value: " + err); + } + } + + @Test + public void testH5P_layout() { + int layout_type = -1; + + try { + layout_type = H5.H5Pget_layout(ocpl_id); + assertTrue("layout: "+layout_type, layout_type == HDF5Constants.H5D_CONTIGUOUS); + H5.H5Pset_layout(ocpl_id, HDF5Constants.H5D_COMPACT); + layout_type = H5.H5Pget_layout(ocpl_id); + assertTrue("layout: "+layout_type, layout_type == HDF5Constants.H5D_COMPACT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_layout: " + err); + } + } + + @Test + public void testH5P_chunk() { + long[] chunk_size = {0,0}; + long[] chunk_new_size = {2,3}; + int layout_type = -1; + + try { + H5.H5Pset_chunk(ocpl_id, 2, chunk_new_size); + H5.H5Pget_chunk(ocpl_id, 2, chunk_size); + assertTrue("chunk: "+chunk_size[0], chunk_size[0] == chunk_new_size[0]); + assertTrue("chunk: "+chunk_size[1], chunk_size[1] == chunk_new_size[1]); + layout_type = H5.H5Pget_layout(ocpl_id); + assertTrue("layout: "+layout_type, layout_type == HDF5Constants.H5D_CHUNKED); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_chunk: " + err); + } + } + + @Test + public void testH5P_file_space() { + long[] threshold = {0}; + int[] strategy = {0}; + try { + H5.H5Pget_file_space(fcpl_id, strategy, threshold); + assertTrue("strategy: "+strategy[0], strategy[0] == HDF5Constants.H5F_FILE_SPACE_ALL); + assertTrue("theshold: "+threshold[0], threshold[0] == 1); + H5.H5Pset_file_space(fcpl_id, HDF5Constants.H5F_FILE_SPACE_ALL_PERSIST, 10); + H5.H5Pget_file_space(fcpl_id, strategy, threshold); + assertTrue("strategy: "+strategy[0], strategy[0] == HDF5Constants.H5F_FILE_SPACE_ALL_PERSIST); + assertTrue("theshold: "+threshold[0], threshold[0] == 10); + H5.H5Pset_file_space(fcpl_id, HDF5Constants.H5F_FILE_SPACE_VFD, 0); + H5.H5Pget_file_space(fcpl_id, strategy, threshold); + assertTrue("strategy: "+strategy[0], strategy[0] == HDF5Constants.H5F_FILE_SPACE_VFD); + assertTrue("theshold: "+threshold[0], threshold[0] == 10); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5P_file_space: " + err); + } + } +} diff --git a/java/test/TestH5PData.java b/java/test/TestH5PData.java new file mode 100644 index 0000000..7fc154d --- /dev/null +++ b/java/test/TestH5PData.java @@ -0,0 +1,170 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.text.DecimalFormat; +import java.text.NumberFormat; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5PData { + @Rule public TestName testname = new TestName(); + + private static final String H5_FILE = "test.h5"; + private static final int DIM_X = 12; + private static final int DIM_Y = 18; + long H5fid = -1; + long H5dsid = -1; + long H5did = -1; + long plist_id = -1; + long[] H5dims = { DIM_X, DIM_Y }; + double windchillF[][] = + {{36.0, 31.0, 25.0, 19.0, 13.0, 7.0, 1.0, -5.0, -11.0, -16.0, -22.0, -28.0, -34.0, -40.0, -46.0, -52.0, -57.0, -63.0}, + {34.0, 27.0, 21.0, 15.0, 9.0, 3.0, -4.0, -10.0, -16.0, -22.0, -28.0, -35.0, -41.0, -47.0, -53.0, -59.0, -66.0, -72.0}, + {32.0, 25.0, 19.0, 13.0, 6.0, 0.0, -7.0, -13.0, -19.0, -26.0, -32.0, -39.0, -45.0, -51.0, -58.0, -64.0, -71.0, -77.0}, + {30.0, 24.0, 17.0, 11.0, 4.0, -2.0, -9.0, -15.0, -22.0, -29.0, -35.0, -42.0, -48.0, -55.0, -61.0, -68.0, -74.0, -81.0}, + {29.0, 23.0, 16.0, 9.0, 3.0, -4.0, -11.0, -17.0, -24.0, -31.0, -37.0, -44.0, -51.0, -58.0, -64.0, -71.0, -78.0, -84.0}, + {28.0, 22.0, 15.0, 8.0, 1.0, -5.0, -12.0, -19.0, -26.0, -33.0, -39.0, -46.0, -53.0, -60.0, -67.0, -73.0, -80.0, -87.0}, + {28.0, 21.0, 14.0, 7.0, 0.0, -7.0, -14.0, -21.0, -27.0, -34.0, -41.0, -48.0, -55.0, -62.0, -69.0, -76.0, -82.0, -89.0}, + {27.0, 20.0, 13.0, 6.0, -1.0, -8.0, -15.0, -22.0, -29.0, -36.0, -43.0, -50.0, -57.0, -64.0, -71.0, -78.0, -84.0, -91.0}, + {26.0, 19.0, 12.0, 5.0, -2.0, -9.0, -16.0, -23.0, -30.0, -37.0, -44.0, -51.0, -58.0, -65.0, -72.0, -79.0, -86.0, -93.0}, + {26.0, 19.0, 12.0, 4.0, -3.0, -10.0, -17.0, -24.0, -31.0, -38.0, -45.0, -52.0, -60.0, -67.0, -74.0, -81.0, -88.0, -95.0}, + {25.0, 18.0, 11.0, 4.0, -3.0, -11.0, -18.0, -25.0, -32.0, -39.0, -46.0, -54.0, -61.0, -68.0, -75.0, -82.0, -89.0, -97.0}, + {25.0, 17.0, 10.0, 3.0, -4.0, -11.0, -19.0, -26.0, -33.0, -40.0, -48.0, -55.0, -62.0, -69.0, -76.0, -84.0, -91.0, -98.0} + }; + + private final void _deleteFile(String filename) { + File file = new File(filename); + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + private final long _createFloatDataset(long fid, long dsid, String name, long dapl) { + long did = -1; + try { + did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_NATIVE_FLOAT, dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5PData._createFloatDataset: ", did > 0); + + return did; + } + + @Before + public void createH5file() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + try { + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5dsid = H5.H5Screate_simple(2, H5dims, null); + H5did = _createFloatDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5PData.createH5file: " + err); + } + assertTrue("TestH5PData.createH5file: H5.H5Fcreate: ",H5fid > 0); + assertTrue("TestH5PData.createH5file: H5.H5Screate_simple: ",H5dsid > 0); + assertTrue("TestH5PData.createH5file: _createFloatDataset: ",H5did > 0); + assertTrue(plist_id > 0); + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5did > 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + + _deleteFile(H5_FILE); + + if (plist_id > 0) + try {H5.H5Pclose(plist_id);} catch (Exception ex) {} + System.out.println(); + } + + @Test + public void testH5Pdata_transform() { + String f_to_c = "(5/9.0)*(x-32)"; + double windchillFread[][] = new double[DIM_X][DIM_Y]; + double windchillC; + NumberFormat formatter = new DecimalFormat("#0.000"); + + try { + H5.H5Pset_data_transform(plist_id, f_to_c); + H5.H5Dwrite(H5did, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + plist_id, windchillF); + H5.H5Dread(H5did, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, windchillFread); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pdata_transform: " + err); + } + for(int row = 0; row < DIM_X; row++) + for(int col = 0; col < DIM_Y; col++) { + windchillC = (5/9.0)*(windchillF[row][col]-32); + String Cstr = formatter.format(windchillC); + String Fread = formatter.format(windchillFread[row][col]); + assertTrue("H5Pdata_transform: <"+row+","+col+">"+Fread+"="+Cstr, Fread.compareTo(Cstr)==0); + } + } + + @Test + public void testH5P_buffer() { + long default_size = 0; + long size = 0; + + try { + default_size = H5.H5Pget_buffer_size(plist_id); + H5.H5Pset_buffer_size(plist_id, DIM_X*DIM_Y); + size = H5.H5Pget_buffer_size(plist_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_buffer fail: " + err); + } + assertTrue("H5P_buffer default: "+default_size, default_size==1024*1024); + assertTrue("H5P_buffer size: "+size, size==DIM_X*DIM_Y); + } +} diff --git a/java/test/TestH5Pfapl.java b/java/test/TestH5Pfapl.java new file mode 100644 index 0000000..555afe0 --- /dev/null +++ b/java/test/TestH5Pfapl.java @@ -0,0 +1,1325 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; +import java.text.DecimalFormat; +import java.text.NumberFormat; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.structs.H5AC_cache_config_t; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Pfapl { + @Rule public TestName testname = new TestName(); + + private static final String H5_FILE = "test.h5"; + private static final String H5_LOG_FILE = "test.log"; + private static final String H5_FAMILY_FILE = "test%05d"; + private static final String H5_MULTI_FILE = "testmulti"; + private static char MULTI_LETTERS[] = {'X','s','b','r','g','l','o'}; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + private static final int DIMF_X = 12; + private static final int DIMF_Y = 18; + long H5fid = -1; + long H5dsid = -1; + long H5did = -1; + long H5Fdsid = -1; + long H5Fdid = -1; + long[] H5dims = { DIM_X, DIM_Y }; + long fapl_id = -1; + long plapl_id = -1; + long dapl_id = -1; + long plist_id = -1; + long btplist_id = -1; + long[] H5Fdims = { DIMF_X, DIMF_Y }; + double windchillF[][] = + {{36.0, 31.0, 25.0, 19.0, 13.0, 7.0, 1.0, -5.0, -11.0, -16.0, -22.0, -28.0, -34.0, -40.0, -46.0, -52.0, -57.0, -63.0}, + {34.0, 27.0, 21.0, 15.0, 9.0, 3.0, -4.0, -10.0, -16.0, -22.0, -28.0, -35.0, -41.0, -47.0, -53.0, -59.0, -66.0, -72.0}, + {32.0, 25.0, 19.0, 13.0, 6.0, 0.0, -7.0, -13.0, -19.0, -26.0, -32.0, -39.0, -45.0, -51.0, -58.0, -64.0, -71.0, -77.0}, + {30.0, 24.0, 17.0, 11.0, 4.0, -2.0, -9.0, -15.0, -22.0, -29.0, -35.0, -42.0, -48.0, -55.0, -61.0, -68.0, -74.0, -81.0}, + {29.0, 23.0, 16.0, 9.0, 3.0, -4.0, -11.0, -17.0, -24.0, -31.0, -37.0, -44.0, -51.0, -58.0, -64.0, -71.0, -78.0, -84.0}, + {28.0, 22.0, 15.0, 8.0, 1.0, -5.0, -12.0, -19.0, -26.0, -33.0, -39.0, -46.0, -53.0, -60.0, -67.0, -73.0, -80.0, -87.0}, + {28.0, 21.0, 14.0, 7.0, 0.0, -7.0, -14.0, -21.0, -27.0, -34.0, -41.0, -48.0, -55.0, -62.0, -69.0, -76.0, -82.0, -89.0}, + {27.0, 20.0, 13.0, 6.0, -1.0, -8.0, -15.0, -22.0, -29.0, -36.0, -43.0, -50.0, -57.0, -64.0, -71.0, -78.0, -84.0, -91.0}, + {26.0, 19.0, 12.0, 5.0, -2.0, -9.0, -16.0, -23.0, -30.0, -37.0, -44.0, -51.0, -58.0, -65.0, -72.0, -79.0, -86.0, -93.0}, + {26.0, 19.0, 12.0, 4.0, -3.0, -10.0, -17.0, -24.0, -31.0, -38.0, -45.0, -52.0, -60.0, -67.0, -74.0, -81.0, -88.0, -95.0}, + {25.0, 18.0, 11.0, 4.0, -3.0, -11.0, -18.0, -25.0, -32.0, -39.0, -46.0, -54.0, -61.0, -68.0, -75.0, -82.0, -89.0, -97.0}, + {25.0, 17.0, 10.0, 3.0, -4.0, -11.0, -19.0, -26.0, -33.0, -40.0, -48.0, -55.0, -62.0, -69.0, -76.0, -84.0, -91.0, -98.0} + }; + + private final void _deleteFile(String filename) { + File file = null; + try { + file = new File(filename); + } + catch (Throwable err) {} + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + private final void _deleteLogFile() { + File file = null; + try { + file = new File(H5_LOG_FILE); + } + catch (Throwable err) {} + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + private final void _deleteFamilyFile() { + File file = null; + for(int indx = 0; ;indx++) { + java.text.DecimalFormat myFormat = new java.text.DecimalFormat("00000"); + try { + file = new File("test"+myFormat.format(new Integer(indx))+".h5"); + } + catch (Throwable err) {} + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + else + return; + } + } + + private final void _deleteMultiFile() { + File file = null; + for(int indx = 1;indx<7;indx++) { + try { + file = new File(H5_MULTI_FILE+"-"+MULTI_LETTERS[indx]+".h5"); + } + catch (Throwable err) {} + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + } + + private final long _createDataset(long fid, long dsid, String name, long dapl) { + long did = -1; + try { + did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_STD_I32BE, dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5Pfapl._createDataset: ", did > 0); + + return did; + } + + private final void _createFloatDataset() { + try { + H5Fdsid = H5.H5Screate_simple(2, H5Fdims, null); + H5Fdid = H5.H5Dcreate(H5fid, "dsfloat", HDF5Constants.H5T_NATIVE_FLOAT, H5Fdsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5Pfapl._createFloatDataset: ", H5Fdid > 0); + + try { + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + } + } + + private final void _createH5multiFileDS() { + try { + H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createH5file: " + err); + } + assertTrue("TestH5Pfapl.createH5file: _createDataset: ", H5did > 0); + + try { + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + } + } + + private final void _createH5File(long fapl) { + try { + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, fapl); + H5dsid = H5.H5Screate_simple(2, H5dims, null); + H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createH5file: " + err); + } + assertTrue("TestH5Pfapl.createH5file: H5.H5Fcreate: ", H5fid > 0); + assertTrue("TestH5Pfapl.createH5file: H5.H5Screate_simple: ", H5dsid > 0); + assertTrue("TestH5Pfapl.createH5file: _createDataset: ", H5did > 0); + + try { + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + } + } + + private final void _createH5familyFile(long fapl) { + try { + H5fid = H5.H5Fcreate(H5_FAMILY_FILE+".h5", HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, fapl); + H5dsid = H5.H5Screate_simple(2, H5dims, null); + H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createH5file: " + err); + } + assertTrue("TestH5Pfapl.createH5file: H5.H5Fcreate: ", H5fid > 0); + assertTrue("TestH5Pfapl.createH5file: H5.H5Screate_simple: ", H5dsid > 0); + assertTrue("TestH5Pfapl.createH5file: _createDataset: ", H5did > 0); + + try { + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + } + } + + private final void _createH5multiFile(long fapl) { + try { + H5fid = H5.H5Fcreate(H5_MULTI_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, fapl); + H5dsid = H5.H5Screate_simple(2, H5dims, null); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createH5file: " + err); + } + assertTrue("TestH5Pfapl.createH5file: H5.H5Fcreate: ", H5fid > 0); + assertTrue("TestH5Pfapl.createH5file: H5.H5Screate_simple: ", H5dsid > 0); + + try { + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + } + } + + public void deleteH5file() { + _deleteFile(H5_FILE); + } + + public void deleteH5familyfile() { + _deleteFamilyFile(); + } + + public void deleteH5multifile() { + _deleteMultiFile(); + } + + @Before + public void createFileAccess() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + try { + fapl_id = H5.H5Pcreate(HDF5Constants.H5P_FILE_ACCESS); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createFileAccess: " + err); + } + assertTrue(fapl_id > 0); + try { + plapl_id = H5.H5Pcreate(HDF5Constants.H5P_LINK_ACCESS); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createFileAccess: " + err); + } + assertTrue(plapl_id > 0); + try { + plist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); + btplist_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_XFER); + dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pfapl.createFileAccess: " + err); + } + assertTrue(plist_id > 0); + assertTrue(btplist_id > 0); + assertTrue(dapl_id > 0); + } + + @After + public void deleteFileAccess() throws HDF5LibraryException { + if (fapl_id > 0) + try {H5.H5Pclose(fapl_id);} catch (Exception ex) {} + if (plapl_id > 0) + try {H5.H5Pclose(plapl_id);} catch (Exception ex) {} + if (dapl_id > 0) + try {H5.H5Pclose(dapl_id);} catch (Exception ex) {} + if (plist_id > 0) + try {H5.H5Pclose(plist_id);} catch (Exception ex) {} + if (btplist_id > 0) + try {H5.H5Pclose(btplist_id);} catch (Exception ex) {} + + if (H5Fdsid > 0) + try {H5.H5Sclose(H5Fdsid);} catch (Exception ex) {} + if (H5Fdid > 0) + try {H5.H5Dclose(H5Fdid);} catch (Exception ex) {} + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5did > 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + System.out.println(); + } + + @Test + public void testH5Pget_libver_bounds() { + int ret_val = -1; + int[] libver = new int[2]; + + try { + ret_val = H5.H5Pget_libver_bounds(fapl_id, libver); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_libver_bounds: " + err); + } + assertTrue("testH5Pget_libver_bounds", ret_val >= 0); + // Check the Earliest Version if the library + assertEquals(HDF5Constants.H5F_LIBVER_EARLIEST, libver[0]); + // Check the Latest Version if the library + assertEquals(HDF5Constants.H5F_LIBVER_LATEST, libver[1]); + } + + @Test + public void testH5Pset_libver_bounds() { + + int ret_val = -1; + int low = HDF5Constants.H5F_LIBVER_EARLIEST; + int high = HDF5Constants.H5F_LIBVER_LATEST; + int[] libver = new int[2]; + + try { + ret_val = H5.H5Pset_libver_bounds(fapl_id, low, high); + H5.H5Pget_libver_bounds(fapl_id, libver); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_libver_bounds: " + err); + } + assertTrue("testH5Pset_libver_bounds", ret_val >= 0); + // Check the Earliest Version if the library + assertEquals(HDF5Constants.H5F_LIBVER_EARLIEST, libver[0]); + // Check the Latest Version if the library + assertEquals(HDF5Constants.H5F_LIBVER_LATEST, libver[1]); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Pset_elink_fapl_NegativeID() throws Throwable { + H5.H5Pset_elink_fapl(-1, fapl_id ); + } + + @Test + public void testH5Pset_elink_fapl() { + int ret_val = -1; + try { + ret_val = H5.H5Pset_elink_fapl(plapl_id, fapl_id ); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_elink_fapl: " + err); + } + assertTrue("H5Pset_elink_fapl", ret_val >= 0); + } + + @Test + public void testH5Pget_elink_fapl() { + long ret_val_id = -1; + try { + ret_val_id = H5.H5Pget_elink_fapl(plapl_id); + assertTrue("H5Pget_elink_fapl", ret_val_id >= 0); + assertEquals(HDF5Constants.H5P_DEFAULT, ret_val_id ); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_elink_fapl: " + err); + } + finally { + if (ret_val_id > 0) + try {H5.H5Pclose(ret_val_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5P_elink_fapl() { + long ret_val_id = -1; + try { + H5.H5Pset_elink_fapl(plapl_id, fapl_id ); + ret_val_id = H5.H5Pget_elink_fapl(plapl_id); + assertTrue("H5P_elink_fapl", ret_val_id >= 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_elink_fapl: " + err); + } + finally { + if (ret_val_id > 0) + try {H5.H5Pclose(ret_val_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5P_elink_file_cache_size() { + long elink_fapl_id = -1; + int efc_size = 0; + try { + H5.H5Pset_elink_fapl(plapl_id, fapl_id ); + elink_fapl_id = H5.H5Pget_elink_fapl(plapl_id); + assertTrue("H5P_elink_file_cache_size", elink_fapl_id >= 0); + try { + efc_size = H5.H5Pget_elink_file_cache_size(elink_fapl_id); + assertTrue("H5P_elink_file_cache_size default", efc_size == 0); + } + catch (UnsupportedOperationException err) { + System.out.println(err.getMessage()); + } + try { + efc_size = 8; + H5.H5Pset_elink_file_cache_size(elink_fapl_id, efc_size); + efc_size = H5.H5Pget_elink_file_cache_size(elink_fapl_id); + assertTrue("H5P_elink_file_cache_size 8", efc_size == 8); + } + catch (UnsupportedOperationException err) { + System.out.println(err.getMessage()); + } + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_elink_file_cache_size: " + err); + } + finally { + if (elink_fapl_id > 0) + try {H5.H5Pclose(elink_fapl_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5P_btree_ratios() { + double[] left = {0.1}; + double[] middle = {0.5}; + double[] right = {0.7}; + try { + H5.H5Pset_btree_ratios(plist_id, left[0], middle[0], right[0]); + H5.H5Pget_btree_ratios(plist_id, left, middle, right); + assertTrue("H5P_btree_ratios", left[0] == 0.1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_btree_ratios: " + err); + } + } + + @Test + public void testH5P_edc_check() { + int ret_val_id = -1; + try { + ret_val_id = H5.H5Pget_edc_check(plist_id); + assertTrue("H5P_edc_check", ret_val_id == HDF5Constants.H5Z_ENABLE_EDC); + H5.H5Pset_edc_check(plist_id, HDF5Constants.H5Z_DISABLE_EDC); + ret_val_id = H5.H5Pget_edc_check(plist_id); + assertTrue("H5P_edc_check", ret_val_id == HDF5Constants.H5Z_DISABLE_EDC); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_edc_check: " + err); + } + } + + @Test + public void testH5P_fclose_degree() { + int ret_val_id = -1; + try { + ret_val_id = H5.H5Pget_fclose_degree(fapl_id); + assertTrue("H5Pget_fclose_degree default", ret_val_id == HDF5Constants.H5F_CLOSE_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_fclose_degree: default " + err); + } + try { + H5.H5Pset_fclose_degree(fapl_id, HDF5Constants.H5F_CLOSE_STRONG); + ret_val_id = H5.H5Pget_fclose_degree(fapl_id); + assertTrue("H5Pget_fclose_degree", ret_val_id == HDF5Constants.H5F_CLOSE_STRONG); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_fclose_degree: H5F_CLOSE_STRONG " + err); + } + try { + H5.H5Pset_fclose_degree(fapl_id, HDF5Constants.H5F_CLOSE_SEMI); + ret_val_id = H5.H5Pget_fclose_degree(fapl_id); + assertTrue("H5Pget_fclose_degree", ret_val_id == HDF5Constants.H5F_CLOSE_SEMI); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_fclose_degree: H5F_CLOSE_SEMI " + err); + } + } + + @Test + public void testH5P_alignment() { + long[] align = {0,0}; + try { + H5.H5Pget_alignment(fapl_id, align); + assertTrue("H5P_alignment threshold default", align[0] == 1); + assertTrue("H5P_alignment alignment default", align[1] == 1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_alignment: default " + err); + } + try { + align[0] = 1024; + align[1] = 2048; + H5.H5Pset_alignment(fapl_id, align[0], align[1]); + H5.H5Pget_alignment(fapl_id, align); + assertTrue("H5P_alignment threshold", align[0] == 1024); + assertTrue("H5P_alignment alignment", align[1] == 2048); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_alignment: " + err); + } + } + + @Test + public void testH5P_meta_block_size() { + long meta_size = 0; + try { + meta_size = H5.H5Pget_meta_block_size(fapl_id); + assertTrue("H5P_meta_block_size default", meta_size == 2048); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_meta_block_size: default " + err); + } + try { + meta_size = 4096; + H5.H5Pset_meta_block_size(fapl_id, meta_size); + meta_size = H5.H5Pget_meta_block_size(fapl_id); + assertTrue("H5P_meta_block_size 4096", meta_size == 4096); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_meta_block_size: " + err); + } + } + + @Test + public void testH5P_small_data_block_size() { + long align = 0; + try { + align = H5.H5Pget_small_data_block_size(fapl_id); + assertTrue("H5P_small_data_block_size default", align == 2048); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_small_data_block_size: default " + err); + } + try { + align = 4096; + H5.H5Pset_small_data_block_size(fapl_id, align); + align = H5.H5Pget_small_data_block_size(fapl_id); + assertTrue("H5P_small_data_block_size 4096", align == 4096); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_small_data_block_size: " + err); + } + } + + @Test + public void testH5P_hyper_vector_size() { + long[] align = {0}; + try { + H5.H5Pget_hyper_vector_size(plist_id, align); + assertTrue("H5P_hyper_vector_size default", align[0] == 1024); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_hyper_vector_size: default " + err); + } + try { + align[0] = 4096; + H5.H5Pset_hyper_vector_size(plist_id, align[0]); + H5.H5Pget_hyper_vector_size(plist_id, align); + assertTrue("H5P_hyper_vector_size 4096", align[0] == 4096); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_hyper_vector_size: " + err); + } + } + + @Test + public void testH5P_cache() { + long[] rdcc_nelmts = {0}; + long[] rdcc_nbytes = {0}; + double[] rdcc_w0 = {0}; + try { + H5.H5Pget_cache(fapl_id, null, rdcc_nelmts, rdcc_nbytes, rdcc_w0); + assertTrue("H5P_cache default", rdcc_nelmts[0] == 521); + assertTrue("H5P_cache default", rdcc_nbytes[0] == (1024*1024)); + assertTrue("H5P_cache default", rdcc_w0[0] == 0.75); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_cache: default " + err); + } + try { + rdcc_nelmts[0] = 4096; + H5.H5Pset_cache(fapl_id, 0, rdcc_nelmts[0], rdcc_nbytes[0], rdcc_w0[0]); + H5.H5Pget_cache(fapl_id, null, rdcc_nelmts, rdcc_nbytes, rdcc_w0); + assertTrue("H5P_cache 4096", rdcc_nelmts[0] == 4096); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_cache: " + err); + } + } + + @Test + public void testH5P_chunk_cache() { + long[] rdcc_nslots = {0}; + long[] rdcc_nbytes = {0}; + double[] rdcc_w0 = {0}; + try { + H5.H5Pget_chunk_cache(dapl_id, rdcc_nslots, rdcc_nbytes, rdcc_w0); + assertTrue("H5P_chunk_cache default", rdcc_nslots[0] == 521); + assertTrue("H5P_chunk_cache default", rdcc_nbytes[0] == (1024*1024)); + assertTrue("H5P_chunk_cache default", rdcc_w0[0] == 0.75); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_chunk_cache: default " + err); + } + try { + rdcc_nslots[0] = 4096; + H5.H5Pset_chunk_cache(dapl_id, rdcc_nslots[0], rdcc_nbytes[0], rdcc_w0[0]); + H5.H5Pget_chunk_cache(dapl_id, rdcc_nslots, rdcc_nbytes, rdcc_w0); + assertTrue("H5P_chunk_cache 4096", rdcc_nslots[0] == 4096); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_chunk_cache: " + err); + } + } + + @Test + public void testH5P_sieve_buf_size() { + long buf_size = 0; + try { + buf_size = H5.H5Pget_sieve_buf_size(fapl_id); + assertTrue("H5P_sieve_buf_size default", buf_size == (64*1024)); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_sieve_buf_size: default " + err); + } + try { + buf_size = 4096; + H5.H5Pset_sieve_buf_size(fapl_id, buf_size); + buf_size = H5.H5Pget_sieve_buf_size(fapl_id); + assertTrue("H5P_sieve_buf_size 4096", buf_size == 4096); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_sieve_buf_size: " + err); + } + } + + @Test + public void testH5P_gc_references() { + boolean ret_val_id = false; + try { + H5.H5Pset_gc_references(fapl_id, true); + ret_val_id = H5.H5Pget_gc_references(fapl_id); + assertTrue("H5P_gc_references", ret_val_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5P_gc_references: " + err); + } + } + + @Test + public void testH5Pget_mdc_config() { + H5AC_cache_config_t cache_config = null; + try { + cache_config = H5.H5Pget_mdc_config(fapl_id); + assertTrue("H5Pget_mdc_config", cache_config.version==HDF5Constants.H5AC_CURR_CACHE_CONFIG_VERSION); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_mdc_config: " + err); + } + } + + @Test + public void testH5Pset_mdc_config() { + H5AC_cache_config_t cache_config = null; + try { + cache_config = H5.H5Pget_mdc_config(fapl_id); + assertTrue("H5Pset_mdc_config", cache_config.version==HDF5Constants.H5AC_CURR_CACHE_CONFIG_VERSION); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_mdc_config: " + err); + } + try { + cache_config.decr_mode = HDF5Constants.H5C_decr_off; + H5.H5Pset_mdc_config(fapl_id, cache_config); + cache_config = H5.H5Pget_mdc_config(fapl_id); + assertTrue("H5Pset_mdc_config", cache_config.version==HDF5Constants.H5AC_CURR_CACHE_CONFIG_VERSION); + assertTrue("H5Pset_mdc_config", cache_config.decr_mode==HDF5Constants.H5C_decr_off); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_mdc_config: " + err); + } + } + + @Test + public void testH5P_fapl_core() { + if (HDF5Constants.H5FD_CORE < 0) + return; + try { + H5.H5Pset_fapl_core(fapl_id, 4096, false); + long driver_type = H5.H5Pget_driver(fapl_id); + assertTrue("H5Pget_driver: core = "+ driver_type, HDF5Constants.H5FD_CORE==driver_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_fapl_core: " + err); + } + try { + long[] increment = {-1}; + boolean[] backingstore = {true}; + H5.H5Pget_fapl_core(fapl_id, increment, backingstore); + assertTrue("H5Pget_fapl_core: increment="+increment[0], increment[0]==4096); + assertTrue("H5Pget_fapl_core: backingstore="+backingstore[0], !backingstore[0]); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_fapl_core: " + err); + } + } + + @Test + public void testH5P_fapl_family() { + if (HDF5Constants.H5FD_FAMILY < 0) + return; + try { + H5.H5Pset_fapl_family(fapl_id, 1024, HDF5Constants.H5P_DEFAULT); + long driver_type = H5.H5Pget_driver(fapl_id); + assertTrue("H5Pget_driver: family = "+ driver_type, HDF5Constants.H5FD_FAMILY==driver_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_fapl_family: " + err); + } + try { + long[] member_size = {0}; + long[] member_fapl = {-1}; + H5.H5Pget_fapl_family(fapl_id, member_size, member_fapl); + assertTrue("H5Pget_fapl_family: member_size="+member_size[0], member_size[0]==1024); + assertTrue("H5Pget_fapl_family: member_fapl ", H5.H5P_equal(member_fapl[0], HDF5Constants.H5P_FILE_ACCESS_DEFAULT)); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_fapl_family: " + err); + } + _createH5familyFile(fapl_id); + deleteH5familyfile(); + } + + @Test + public void testH5P_family_offset() { + if (HDF5Constants.H5FD_FAMILY < 0) + return; + try { + H5.H5Pset_fapl_family(fapl_id, 1024, HDF5Constants.H5P_DEFAULT); + long driver_type = H5.H5Pget_driver(fapl_id); + assertTrue("H5Pget_driver: family = "+ driver_type, HDF5Constants.H5FD_FAMILY==driver_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_fapl_family: " + err); + } + _createH5familyFile(fapl_id); + long family_offset = 512; + try { + H5.H5Pset_family_offset(fapl_id, family_offset); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_fapl_family: " + err); + } + try { + long offset = H5.H5Pget_family_offset(fapl_id); + assertTrue("H5Pget_fapl_family: offset="+offset, offset==family_offset); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_fapl_family: " + err); + } + deleteH5familyfile(); + } + + @Test + public void testH5Pset_fapl_sec2() { + if (HDF5Constants.H5FD_SEC2 < 0) + return; + try { + H5.H5Pset_fapl_sec2(fapl_id); + long driver_type = H5.H5Pget_driver(fapl_id); + assertTrue("H5Pget_driver: sec2 = "+ driver_type, HDF5Constants.H5FD_SEC2==driver_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_fapl_sec2: " + err); + } + _createH5File(fapl_id); + deleteH5file(); + } + + @Test + public void testH5Pset_fapl_stdio() { + if (HDF5Constants.H5FD_STDIO < 0) + return; + try { + H5.H5Pset_fapl_stdio(fapl_id); + long driver_type = H5.H5Pget_driver(fapl_id); + assertTrue("H5Pget_driver: stdio = "+ driver_type, HDF5Constants.H5FD_STDIO==driver_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_fapl_stdio: " + err); + } + _createH5File(fapl_id); + deleteH5file(); + } + + @Test + public void testH5Pset_fapl_log() { + if (HDF5Constants.H5FD_LOG < 0) + return; + try { + long log_flags = HDF5Constants.H5FD_LOG_LOC_IO; + H5.H5Pset_fapl_log(fapl_id, H5_LOG_FILE, log_flags, 1024); + long driver_type = H5.H5Pget_driver(fapl_id); + assertTrue("H5Pget_driver: log = "+ driver_type, HDF5Constants.H5FD_LOG==driver_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_fapl_log: " + err); + } + _createH5File(fapl_id); + deleteH5file(); + _deleteLogFile(); + } + + @Test + public void testH5P_fapl_muti_nulls() { + if (HDF5Constants.H5FD_MULTI < 0) + return; + + int[] member_map = null; + long[] member_fapl = null; + String[] member_name = null; + long[] member_addr = null; + + try { + H5.H5Pset_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr, true); + long driver_type = H5.H5Pget_driver(fapl_id); + assertTrue("H5Pget_driver: muti = "+ driver_type, HDF5Constants.H5FD_MULTI==driver_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_fapl_muti: " + err); + } + try { + boolean relax = H5.H5Pget_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr); + assertTrue("H5Pget_fapl_muti: relax ", relax); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_fapl_muti: " + err); + } + _createH5multiFile(fapl_id); + deleteH5multifile(); + } + + @Test + public void testH5P_fapl_muti_defaults() { + if (HDF5Constants.H5FD_MULTI < 0) + return; + int H5FD_MEM_NTYPES = HDF5Constants.H5FD_MEM_NTYPES; // 7 + + long sH5FD_MEM_DEFAULT_HADDR = HDF5Constants.H5FD_DEFAULT_HADDR_SIZE; + long sH5FD_MEM_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_SIZE; + long sH5FD_MEM_SUPER_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_SUPER_SIZE; + long sH5FD_MEM_BTREE_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_BTREE_SIZE; + long sH5FD_MEM_DRAW_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_DRAW_SIZE; + long sH5FD_MEM_GHEAP_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_GHEAP_SIZE; + long sH5FD_MEM_LHEAP_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_LHEAP_SIZE; + long sH5FD_MEM_OHDR_HADDR = HDF5Constants.H5FD_MEM_DEFAULT_OHDR_SIZE; + int[] member_map = null; + long[] member_fapl = null; + String[] member_name = null; + long[] member_addr = null; + + try { + H5.H5Pset_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr, true); + long driver_type = H5.H5Pget_driver(fapl_id); + assertTrue("H5Pget_driver: muti = "+ driver_type, HDF5Constants.H5FD_MULTI==driver_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_fapl_muti: " + err); + } + try { + member_map = new int[HDF5Constants.H5FD_MEM_NTYPES]; + member_fapl = new long[HDF5Constants.H5FD_MEM_NTYPES]; + member_name = new String[HDF5Constants.H5FD_MEM_NTYPES]; + member_addr = new long[HDF5Constants.H5FD_MEM_NTYPES]; + boolean relax = H5.H5Pget_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr); + assertTrue("H5Pget_fapl_muti: relax ", relax); + assertTrue("H5Pget_fapl_muti: member_map="+member_map[HDF5Constants.H5FD_MEM_DEFAULT], member_map[HDF5Constants.H5FD_MEM_DEFAULT] == HDF5Constants.H5FD_MEM_DEFAULT); + assertTrue("H5Pget_fapl_muti: member_fapl ", H5.H5P_equal(member_fapl[HDF5Constants.H5FD_MEM_DEFAULT], HDF5Constants.H5P_FILE_ACCESS_DEFAULT)); + assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_DEFAULT], member_name[HDF5Constants.H5FD_MEM_DEFAULT].compareTo("%s-X.h5")==0); + assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_SUPER], member_name[HDF5Constants.H5FD_MEM_SUPER].compareTo("%s-s.h5")==0); + assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_BTREE], member_name[HDF5Constants.H5FD_MEM_BTREE].compareTo("%s-b.h5")==0); + assertTrue("H5Pget_fapl_muti: member_name="+member_name[HDF5Constants.H5FD_MEM_DRAW], member_name[HDF5Constants.H5FD_MEM_DRAW].compareTo("%s-r.h5")==0); + assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_DEFAULT], member_addr[HDF5Constants.H5FD_MEM_DEFAULT] == sH5FD_MEM_HADDR); + assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_SUPER], member_addr[HDF5Constants.H5FD_MEM_SUPER] == sH5FD_MEM_SUPER_HADDR); + assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_BTREE], member_addr[HDF5Constants.H5FD_MEM_BTREE] == sH5FD_MEM_BTREE_HADDR); + assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_DRAW], member_addr[HDF5Constants.H5FD_MEM_DRAW] == sH5FD_MEM_DRAW_HADDR); + assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_GHEAP], member_addr[HDF5Constants.H5FD_MEM_GHEAP] == sH5FD_MEM_GHEAP_HADDR); + assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_LHEAP], member_addr[HDF5Constants.H5FD_MEM_LHEAP] == sH5FD_MEM_LHEAP_HADDR); + assertTrue("H5Pget_fapl_muti: member_addr="+member_addr[HDF5Constants.H5FD_MEM_OHDR], member_addr[HDF5Constants.H5FD_MEM_OHDR] == sH5FD_MEM_OHDR_HADDR); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_fapl_muti: " + err); + } + _createH5multiFile(fapl_id); + _createH5multiFileDS(); + deleteH5multifile(); + } + + @Test + public void testH5P_fapl_muti() { + if (HDF5Constants.H5FD_MULTI < 0) + return; + long HADDR_DEFAULT_SIZE = HDF5Constants.H5FD_DEFAULT_HADDR_SIZE; + int[] member_map = new int[HDF5Constants.H5FD_MEM_NTYPES]; + long[] member_fapl = new long[HDF5Constants.H5FD_MEM_NTYPES]; + String[] member_name = new String[HDF5Constants.H5FD_MEM_NTYPES]; + long[] member_addr = new long[HDF5Constants.H5FD_MEM_NTYPES]; + + for(int mt=HDF5Constants.H5FD_MEM_DEFAULT; mt= HADDR_DEFAULT_SIZE/4 || file_size <= HADDR_DEFAULT_SIZE/2); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_fapl_muti:H5Fget_filesize " + err); + } + _createH5multiFileDS(); + deleteH5multifile(); + File file = new File(H5_MULTI_FILE+"-super.h5"); + if (file.exists()) { + try { + file.delete(); + } + catch (SecurityException e) { + ;// e.printStackTrace(); + } + } + file = new File(H5_MULTI_FILE+"-btree.h5"); + if (file.exists()) { + try { + file.delete(); + } + catch (SecurityException e) { + ;// e.printStackTrace(); + } + } + file = new File(H5_MULTI_FILE+"-draw.h5"); + if (file.exists()) { + try { + file.delete(); + } + catch (SecurityException e) { + ;// e.printStackTrace(); + } + } + file = new File(H5_MULTI_FILE+"-gheap.h5"); + if (file.exists()) { + try { + file.delete(); + } + catch (SecurityException e) { + ;// e.printStackTrace(); + } + } + } + + @Test + public void testH5P_fapl_split() { + if (HDF5Constants.H5FD_MULTI < 0) + return; + + try { + H5.H5Pset_fapl_split(fapl_id, "-meta.h5", HDF5Constants.H5P_DEFAULT, "-raw.h5", HDF5Constants.H5P_DEFAULT); + long driver_type = H5.H5Pget_driver(fapl_id); + assertTrue("H5Pget_driver: split = "+ driver_type, HDF5Constants.H5FD_MULTI==driver_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_fapl_split: " + err); + } + try { + int[] member_map = new int[HDF5Constants.H5FD_MEM_NTYPES]; + long[] member_fapl = new long[HDF5Constants.H5FD_MEM_NTYPES]; + String[] member_name = new String[HDF5Constants.H5FD_MEM_NTYPES]; + long[] member_addr = new long[HDF5Constants.H5FD_MEM_NTYPES]; + boolean relax = H5.H5Pget_fapl_multi(fapl_id, member_map, member_fapl, member_name, member_addr); + assertTrue("H5Pget_fapl_multi: relax ", relax); + assertTrue("H5Pget_fapl_multi: member_name="+member_name[HDF5Constants.H5FD_MEM_SUPER], member_name[HDF5Constants.H5FD_MEM_SUPER].compareTo("%s-meta.h5")==0); + assertTrue("H5Pget_fapl_multi: member_name="+member_name[HDF5Constants.H5FD_MEM_DRAW], member_name[HDF5Constants.H5FD_MEM_DRAW].compareTo("%s-raw.h5")==0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_fapl_split: " + err); + } + _createH5multiFile(fapl_id); + deleteH5multifile(); + File file = new File(H5_MULTI_FILE+"-meta.h5"); + if (file.exists()) { + try { + file.delete(); + } + catch (SecurityException e) { + ;// e.printStackTrace(); + } + } + file = new File(H5_MULTI_FILE+"-raw.h5"); + if (file.exists()) { + try { + file.delete(); + } + catch (SecurityException e) { + ;// e.printStackTrace(); + } + } + } + + @Test + public void testH5P_fapl_direct() { + if (HDF5Constants.H5FD_DIRECT < 0) + return; + try { + H5.H5Pset_fapl_direct(fapl_id, 1024, 4096, 8*4096); + long driver_type = H5.H5Pget_driver(fapl_id); + assertTrue("H5Pget_driver: direct = "+ driver_type, HDF5Constants.H5FD_DIRECT==driver_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_fapl_direct: " + err); + } + try { + long[] params = {-1, -1, -1}; + H5.H5Pget_fapl_direct(fapl_id, params); + assertTrue("H5Pget_fapl_direct: alignment="+params[0], params[0]==1024); + assertTrue("H5Pget_fapl_direct: block_size="+params[1], params[1]==4096); + assertTrue("H5Pget_fapl_direct: cbuf_size="+params[2], params[2]==8*4096); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_fapl_direct: " + err); + } + _createH5File(fapl_id); + deleteH5file(); + } + + @Test + public void testH5Pset_fapl_windows() { + if (HDF5Constants.H5FD_WINDOWS < 0) + return; + try { + H5.H5Pset_fapl_windows(fapl_id); + long driver_type = H5.H5Pget_driver(fapl_id); + assertTrue("H5Pget_driver: windows = "+ driver_type, HDF5Constants.H5FD_WINDOWS==driver_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_fapl_windows: " + err); + } + _createH5File(fapl_id); + deleteH5file(); + } + + @Test + public void testH5Pmulti_transform() { + if (HDF5Constants.H5FD_MULTI < 0) + return; + String f_to_c = "(5/9.0)*(x-32)"; + double windchillFread[][] = new double[DIMF_X][DIMF_Y]; + double windchillC; + NumberFormat formatter = new DecimalFormat("#0.000"); + long HADDRMAX = HDF5Constants.H5FD_DEFAULT_HADDR_SIZE; + + int[] member_map = new int[HDF5Constants.H5FD_MEM_NTYPES]; + long[] member_fapl = new long[HDF5Constants.H5FD_MEM_NTYPES]; + String[] member_name = new String[HDF5Constants.H5FD_MEM_NTYPES]; + long[] member_addr = new long[HDF5Constants.H5FD_MEM_NTYPES]; + + try { + H5.H5Pset_data_transform(plist_id, f_to_c); + H5.H5Pset_btree_ratios(btplist_id, 0.1, 0.5, 0.7); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pdata_transform: " + err); + } + + for(int mt=HDF5Constants.H5FD_MEM_DEFAULT; mt= HADDRMAX/4 || file_size <= HADDRMAX/2); + _createH5multiFileDS(); + _createFloatDataset(); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pdata_transform: " + err); + } + try { + H5.H5Dwrite(H5Fdid, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + plist_id, windchillF); + H5.H5Dread(H5Fdid, HDF5Constants.H5T_NATIVE_DOUBLE, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, + HDF5Constants.H5P_DEFAULT, windchillFread); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pdata_transform: " + err); + } + for(int row = 0; row < DIMF_X; row++) { + for(int col = 0; col < DIMF_Y; col++) { + windchillC = (5/9.0)*(windchillF[row][col]-32); + String Cstr = formatter.format(windchillC); + String Fread = formatter.format(windchillFread[row][col]); + assertTrue("H5Pdata_transform: <"+row+","+col+">"+Fread+"="+Cstr, Fread.compareTo(Cstr)==0); + } + } + deleteH5multifile(); + File file = new File(H5_MULTI_FILE+"-super.h5"); + if (file.exists()) { + try { + file.delete(); + } + catch (SecurityException e) { + ;// e.printStackTrace(); + } + } + file = new File(H5_MULTI_FILE+"-btree.h5"); + if (file.exists()) { + try { + file.delete(); + } + catch (SecurityException e) { + ;// e.printStackTrace(); + } + } + file = new File(H5_MULTI_FILE+"-draw.h5"); + if (file.exists()) { + try { + file.delete(); + } + catch (SecurityException e) { + ;// e.printStackTrace(); + } + } + file = new File(H5_MULTI_FILE+"-gheap.h5"); + if (file.exists()) { + try { + file.delete(); + } + catch (SecurityException e) { + ;// e.printStackTrace(); + } + } + } +} diff --git a/java/test/TestH5R.java b/java/test/TestH5R.java new file mode 100644 index 0000000..72e0bfb --- /dev/null +++ b/java/test/TestH5R.java @@ -0,0 +1,335 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5R { + @Rule public TestName testname = new TestName(); + private static final String H5_FILE = "testH5R.h5"; + private static final int DIM_X = 4; + private static final int DIM_Y = 6; + long H5fid = -1; + long H5dsid = -1; + long H5did = -1; + long H5gid = -1; + long H5did2 = -1; + long[] H5dims = { DIM_X, DIM_Y }; + + private final void _deleteFile(String filename) { + File file = null; + try { + file = new File(filename); + } + catch (Throwable err) {} + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + private final long _createDataset(long fid, long dsid, String name, long dapl) { + long did = -1; + try { + did = H5.H5Dcreate(fid, name, + HDF5Constants.H5T_STD_I32BE, dsid, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, dapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5R._createDataset: ",did > 0); + + return did; + } + + private final long _createGroup(long fid, String name) { + long gid = -1; + try { + gid = H5.H5Gcreate(fid, name, HDF5Constants.H5P_DEFAULT, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Gcreate: " + err); + } + assertTrue("TestH5R._createGroup: ",gid > 0); + + return gid; + } + + @Before + public void createH5file() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + try { + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5dsid = H5.H5Screate_simple(2, H5dims, null); + H5gid = _createGroup(H5fid, "Group1"); + H5did2 = _createDataset(H5gid, H5dsid, "dset2", HDF5Constants.H5P_DEFAULT); + H5did = _createDataset(H5fid, H5dsid, "dset", HDF5Constants.H5P_DEFAULT); + + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5R.createH5file: " + err); + } + assertTrue("TestH5R.createH5file: H5.H5Fcreate: ",H5fid > 0); + assertTrue("TestH5R.createH5file: H5.H5Screate_simple: ",H5dsid > 0); + assertTrue("TestH5R.createH5file: _createDataset: ",H5did > 0); + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5did > 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + if (H5gid > 0) + try {H5.H5Gclose(H5gid);} catch (Exception ex) {} + if (H5did2 > 0) + try {H5.H5Dclose(H5did2);} catch (Exception ex) {} + + _deleteFile(H5_FILE); + System.out.println(); + } + + @Test + public void testH5Rget_name() { + long loc_id=H5fid; + int ref_type=HDF5Constants.H5R_OBJECT; + long ret_val=-1; + byte[] ref=null; + String[] name= {""}; + String objName = "/dset"; + + try { + ref = H5.H5Rcreate(H5fid, objName, ref_type, -1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Rget_name:H5Rcreate " + err); + } + + try { + ret_val = H5.H5Rget_name(loc_id, ref_type, ref, name, 16); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Rget_name: " + err); + } + + assertTrue("testH5Rget_name: H5Rget_name", ret_val>0); + assertTrue("The name of the object: ", objName.equals(name[0])); + } + + @Test + public void testH5Rget_obj_type2() { + int ref_type=HDF5Constants.H5R_OBJECT; + byte[] ref=null; + + String objName = "/dset"; + int obj_type = -1;; + + try { + ref = H5.H5Rcreate(H5fid, objName, ref_type, -1); + } + catch(Throwable err) { + err.printStackTrace(); + } + + try { + obj_type = H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_OBJECT, ref); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Rget_obj_type2: " + err); + } + assertEquals(obj_type, HDF5Constants.H5O_TYPE_DATASET); + } + + @Test + public void testH5Rcreate_refobj() { + byte[] ref = null; + + try { + ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Rcreate: " + err); + } + assertNotNull(ref); + } + + @Test + public void testH5Rcreate_regionrefobj() { + byte[] ref = null; + try { + ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Rcreate: " + err); + } + assertNotNull(ref); + } + + @Test + public void testH5Rdereference() { + byte[] ref1 = null; + byte[] ref2 = null; + long dataset_id = -1; + long group_id = -1; + try { + //Create reference on dataset + ref1 = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); + dataset_id= H5.H5Rdereference(H5fid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_DATASET_REGION, ref1); + + //Create reference on group + ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1); + group_id= H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref2); + assertNotNull(ref1); + assertNotNull(ref2); + assertTrue(dataset_id>=0); + assertTrue(group_id>=0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Rdereference " + err); + } + finally { + try {H5.H5Dclose(dataset_id);} catch (Exception ex) {} + try {H5.H5Gclose(group_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Rget_region() { + byte[] ref = null; + long dsid = -1; + try { + ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); + dsid = H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); + assertNotNull(ref); + assertTrue(dsid>=0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Rget_region: " + err); + } + finally { + try {H5.H5Sclose(dsid);} catch (Exception ex) {} + } + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Rget_name_Invalidreftype() throws Throwable { + byte[] ref = null; + String[] name= {""}; + ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1); + H5.H5Rget_name(H5fid, HDF5Constants.H5R_DATASET_REGION, ref, name, 16); + } + + @Test(expected = NullPointerException.class) + public void testH5Rget_name_NULLreference() throws Throwable { + byte[] ref = null; + String[] name= {""}; + H5.H5Rget_name(H5fid, HDF5Constants.H5R_OBJECT, ref, name, 16); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Rget_obj_type2_Invalidreftype() throws Throwable { + byte[] ref = null; + ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, -1); + H5.H5Rget_obj_type(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Rcreate_InvalidObjectName() throws Throwable { + H5.H5Rcreate(H5fid, "/GROUPS", HDF5Constants.H5R_OBJECT, -1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Rcreate_Invalidspace_id() throws Throwable { + H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, -1); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Rcreate_Invalidreftype() throws Throwable { + H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_BADTYPE, -1); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Rgetregion_Invalidreftype() throws Throwable { + byte[] ref = null; + ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, H5dsid); + H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Rgetregion_Badreferencetype() throws Throwable { + byte[] ref = null; + ref = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_OBJECT, H5dsid); + H5.H5Rget_region(H5fid, HDF5Constants.H5R_OBJECT, ref); + } + + @Test(expected = NullPointerException.class) + public void testH5Rgetregion_Nullreference() throws Throwable { + byte[] ref = null; + H5.H5Rget_region(H5fid, HDF5Constants.H5R_DATASET_REGION, ref); + } + + @Test(expected = NullPointerException.class) + public void testH5Rdereference_Nullreference() throws Throwable { + byte[] ref = null; + H5.H5Rdereference(H5did2, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Rdereference_Invalidreference() throws Throwable { + byte[] ref1 = null; + byte[] ref2 = null; + ref1 = H5.H5Rcreate(H5fid, "/dset", HDF5Constants.H5R_DATASET_REGION, H5dsid); + ref2 = H5.H5Rcreate(H5gid, "/Group1", HDF5Constants.H5R_OBJECT, -1); + H5.H5Rdereference(H5gid, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5R_OBJECT, ref1); + } + +} diff --git a/java/test/TestH5S.java b/java/test/TestH5S.java new file mode 100644 index 0000000..909ab02 --- /dev/null +++ b/java/test/TestH5S.java @@ -0,0 +1,590 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5S { + @Rule public TestName testname = new TestName(); + long H5sid = -1; + int H5rank = 2; + long H5dims[] = {5, 5}; + long H5maxdims[] = {10, 10}; + + @Before + public void createH5file() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + H5sid = H5.H5Screate_simple(H5rank, H5dims, H5maxdims); + assertTrue("H5.H5Screate_simple_extent", H5sid > 0); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5sid > 0) { + try {H5.H5Sclose(H5sid);} catch (Exception ex) {} + } + System.out.println(); + } + + @Test + public void testH5Sget_simple_extent_ndims() { + int read_rank = -1; + try { + read_rank = H5.H5Sget_simple_extent_ndims(H5sid); + assertTrue("H5.H5Sget_simple_extent_ndims", H5rank == read_rank); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sget_simple_extent_ndims: " + err); + } + } + + @Test + public void testH5Sget_simple_extent_dims_null() { + int read_rank = -1; + + try { + read_rank = H5.H5Sget_simple_extent_dims(H5sid, null, null); + assertTrue("H5.H5Sget_simple_extent_dims", H5rank == read_rank); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sget_simple_extent_dims: " + err); + } + } + + @Test + public void testH5Sget_simple_extent_dims() { + int read_rank = -1; + long dims[] = {5, 5}; + long maxdims[] = {10, 10}; + + try { + read_rank = H5.H5Sget_simple_extent_dims(H5sid, dims, maxdims); + assertTrue("H5.H5Sget_simple_extent_dims", H5rank == read_rank); + assertTrue("H5.H5Sget_simple_extent_dims:dims", H5dims[0] == dims[0]); + assertTrue("H5.H5Sget_simple_extent_dims:maxdims", H5maxdims[0] == maxdims[0]); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sget_simple_extent_dims: " + err); + } + } + + @Test + public void testH5Sget_simple_extent_npoints() { + long num_elements = -1; + try { + num_elements = H5.H5Sget_simple_extent_npoints(H5sid); + assertTrue("H5.H5Sget_simple_extent_npoints", (H5dims[0]*H5dims[1]) == num_elements); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sget_simple_extent_npoints: " + err); + } + } + + @Test + public void testH5Sget_simple_extent_type() { + int read_type = -1; + try { + read_type = H5.H5Sget_simple_extent_type(H5sid); + assertTrue("H5.H5Sget_simple_extent_type", HDF5Constants.H5S_SIMPLE == read_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sget_simple_extent_type: " + err); + } + } + + @Test + public void testH5Sis_simple() { + boolean result = false; + + try { + result = H5.H5Sis_simple(H5sid); + assertTrue("H5.H5Sis_simple", result); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sis_simple: " + err); + } + } + + @Test + public void testH5Sset_extent_simple() { + long num_elements = -1; + try { + H5.H5Sset_extent_simple(H5sid, H5rank, H5maxdims, H5maxdims); + num_elements = H5.H5Sget_simple_extent_npoints(H5sid); + assertTrue("H5.H5Sget_simple_extent_npoints", (H5maxdims[0]*H5maxdims[1]) == num_elements); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sset_extent_simple: " + err); + } + } + + @Test + public void testH5Sget_select_type() { + int read_type = -1; + try { + read_type = H5.H5Sget_select_type(H5sid); + assertTrue("H5.H5Sget_select_type", HDF5Constants.H5S_SEL_ALL == read_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sset_extent_none: " + err); + } + } + + @Test + public void testH5Sset_extent_none() { + int read_type = -1; + try { + H5.H5Sset_extent_none(H5sid); + read_type = H5.H5Sget_simple_extent_type(H5sid); + assertTrue("H5.H5Sget_simple_extent_type: "+read_type, HDF5Constants.H5S_NO_CLASS == read_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sset_extent_none: " + err); + } + } + + @Test + public void testH5Scopy() { + long sid = -1; + int read_rank = -1; + + try { + sid = H5.H5Scopy(H5sid); + assertTrue("H5.H5Sis_simple", sid > 0); + read_rank = H5.H5Sget_simple_extent_ndims(sid); + assertTrue("H5.H5Screate_simple_extent_ndims", H5rank == read_rank); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Scopy: " + err); + } + finally { + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Sextent_copy() { + long sid = -1; + int class_type = -1; + + try { + sid = H5.H5Screate(HDF5Constants.H5S_NULL); + assertTrue("H5.H5Screate_null", sid > 0); + H5.H5Sextent_copy(sid, H5sid); + class_type = H5.H5Sget_simple_extent_type(sid); + assertTrue("H5.H5Screate_null: type", class_type == HDF5Constants.H5S_SIMPLE); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sextent_copy: " + err); + } + finally { + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Sextent_equal() { + long sid = -1; + boolean result = false; + + try { + sid = H5.H5Screate(HDF5Constants.H5S_NULL); + assertTrue("H5.H5Screate_null",sid > 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Screate: null " + err); + } + + try { + result = H5.H5Sextent_equal(sid, H5sid); + assertFalse("H5.testH5Sextent_equal",result); + H5.H5Sextent_copy(sid, H5sid); + result = H5.H5Sextent_equal(sid, H5sid); + assertTrue("H5.testH5Sextent_equal", result); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sextent_copy " + err); + } + finally { + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Sencode_decode_null_dataspace() { + long sid = -1; + long decoded_sid = -1; + byte[] null_sbuf = null; + boolean result = false; + + try { + sid = H5.H5Screate(HDF5Constants.H5S_NULL); + assertTrue("H5.H5Screate_null", sid > 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Screate: null " + err); + } + + try { + null_sbuf = H5.H5Sencode(sid); + assertFalse("H5.testH5Sencode", null_sbuf==null); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sencode " + err); + } + finally { + if(null_sbuf == null) { + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + try { + decoded_sid = H5.H5Sdecode(null_sbuf); + assertTrue("H5.testH5Sdecode", decoded_sid>0); + + result = H5.H5Sextent_equal(sid, decoded_sid); + assertTrue("H5.testH5Sextent_equal", result); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sdecode " + err); + } + finally { + try {H5.H5Sclose(decoded_sid);} catch (Exception ex) {} + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Sencode_decode_scalar_dataspace() { + long sid = -1; + long decoded_sid = -1; + byte[] scalar_sbuf = null; + boolean result = false; + int iresult = -1; + long lresult = -1; + + try { + sid = H5.H5Screate(HDF5Constants.H5S_SCALAR); + assertTrue("H5.H5Screate_null", sid > 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Screate: null " + err); + } + + try { + scalar_sbuf = H5.H5Sencode(sid); + assertFalse("H5.testH5Sencode", scalar_sbuf==null); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sencode " + err); + } + finally { + if(scalar_sbuf == null) { + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + try { + decoded_sid = H5.H5Sdecode(scalar_sbuf); + assertTrue("H5.testH5Sdecode", decoded_sid>0); + + result = H5.H5Sextent_equal(sid, decoded_sid); + assertTrue("H5.testH5Sextent_equal", result); + + /* Verify decoded dataspace */ + lresult = H5.H5Sget_simple_extent_npoints(decoded_sid); + assertTrue("H5.testH5Sget_simple_extent_npoints", lresult==1); + + iresult = H5.H5Sget_simple_extent_ndims(decoded_sid); + assertTrue("H5.testH5Sget_simple_extent_ndims", iresult==0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sdecode " + err); + } + finally { + try {H5.H5Sclose(decoded_sid);} catch (Exception ex) {} + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Sselect_none() { + int read_type = -1; + try { + H5.H5Sselect_none(H5sid); + read_type = H5.H5Sget_select_type(H5sid); + assertTrue("H5.H5Sget_select_type: "+read_type, HDF5Constants.H5S_SEL_NONE == read_type); + H5.H5Sselect_all(H5sid); + read_type = H5.H5Sget_select_type(H5sid); + assertTrue("H5.H5Sget_select_type: "+read_type, HDF5Constants.H5S_SEL_ALL == read_type); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sset_extent_none: " + err); + } + } + + @Test + public void testH5Sget_select_npoints() { + long coord[][] = {{0,1},{2,4},{5,6}}; /* Coordinates for point selection */ + long num_elements = -1; + try { + H5.H5Sselect_elements(H5sid, HDF5Constants.H5S_SELECT_SET, 3, coord); + num_elements = H5.H5Sget_select_npoints(H5sid); + assertTrue("H5.H5Sget_select_npoints: "+num_elements, 3 == num_elements); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sget_select_npoints: " + err); + } + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Sget_select_elem_pointlist_invalid() throws Throwable { + long coord[][] = {{0,1},{2,4},{5,6}}; /* Coordinates for point selection */ + long getcoord[] = {-1,-1}; /* Coordinates for get point selection */ + try { + H5.H5Sselect_elements(H5sid, HDF5Constants.H5S_SELECT_SET, 3, coord); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sget_select_elem_pointlist: " + err); + } + H5.H5Sget_select_elem_pointlist(H5sid, 0, 3, getcoord); + } + + @Test + public void testH5Sget_select_elem_pointlist() { + long coord[][] = {{0,1},{2,3},{4,5}}; /* Coordinates for point selection */ + long getcoord[] = {-1,-1,-1,-1,-1,-1}; /* Coordinates for get point selection */ + try { + H5.H5Sselect_elements(H5sid, HDF5Constants.H5S_SELECT_SET, 3, coord); + H5.H5Sget_select_elem_pointlist(H5sid, 0, 3, getcoord); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[0][0] == getcoord[0]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[0][1] == getcoord[1]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[1][0] == getcoord[2]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[1][1] == getcoord[3]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[2][0] == getcoord[4]); + assertTrue("H5.H5Sget_select_elem_pointlist", coord[2][1] == getcoord[5]); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sget_select_elem_pointlist: " + err); + } + } + + @Test + public void testH5Sget_select_bounds() { + long lowbounds[] = {-1,-1}; + long hibounds[] = {-1,-1}; + try { + H5.H5Sget_select_bounds(H5sid, lowbounds, hibounds); + assertTrue("H5.H5Sget_select_bounds", 0 == lowbounds[0]); + assertTrue("H5.H5Sget_select_bounds", 0 == lowbounds[1]); + assertTrue("H5.H5Sget_select_bounds", (H5dims[0]-1) == hibounds[0]); + assertTrue("H5.H5Sget_select_bounds", (H5dims[1]-1) == hibounds[1]); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sget_select_bounds: " + err); + } + } + + @Test + public void testH5Soffset_simple() { + long coord[][] = {{2,2},{2,4},{4,2},{4,4}}; /* Coordinates for point selection */ + long lowbounds[] = {-1,-1}; + long hibounds[] = {-1,-1}; + try { + H5.H5Sselect_elements(H5sid, HDF5Constants.H5S_SELECT_SET, 4, coord); + H5.H5Sget_select_bounds(H5sid, lowbounds, hibounds); + assertTrue("H5.H5Sget_select_bounds", 2 == lowbounds[0]); + assertTrue("H5.H5Sget_select_bounds", 2 == lowbounds[1]); + assertTrue("H5.H5Sget_select_bounds", (H5dims[0]-1) == hibounds[0]); + assertTrue("H5.H5Sget_select_bounds", (H5dims[1]-1) == hibounds[1]); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sget_select_bounds: " + err); + } + try { + long offset[] = {-1,-1}; + H5.H5Soffset_simple(H5sid, offset); + H5.H5Sget_select_bounds(H5sid, lowbounds, hibounds); + assertTrue("H5.H5Sget_select_bounds", 1 == lowbounds[0]); + assertTrue("H5.H5Sget_select_bounds", 1 == lowbounds[1]); + assertTrue("H5.H5Sget_select_bounds", (H5dims[0]-2) == hibounds[0]); + assertTrue("H5.H5Sget_select_bounds", (H5dims[1]-2) == hibounds[1]); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Soffset_simple: " + err); + } + } + + @Test + public void testH5Sget_select_hyper() { + long space1 = -1; + long start[] = {0,0}; + long stride[] = {1,1}; + long count[] = {1,1}; + long block[] = {4,4}; + long nblocks; // Number of hyperslab blocks + long blocks[] = {-1, -1, -1, -1, -1, -1, -1, -1}; // List of blocks + try { + // Copy "all" selection & space + space1 = H5.H5Scopy(H5sid); + assertTrue("H5.H5Scopy", H5sid > 0); + // 'AND' "all" selection with another hyperslab + H5.H5Sselect_hyperslab(space1, HDF5Constants.H5S_SELECT_AND, start, stride, count, block); + + // Verify that there is only one block + nblocks = H5.H5Sget_select_hyper_nblocks(space1); + assertTrue("H5Sget_select_hyper_nblocks", nblocks == 1); + + // Retrieve the block defined + H5.H5Sget_select_hyper_blocklist(space1, 0, nblocks, blocks); + + // Verify that the correct block is defined + assertTrue("H5.H5Sget_select_hyper_blocklist", start[0] == blocks[0]); + assertTrue("H5.H5Sget_select_hyper_blocklist", start[1] == blocks[1]); + assertTrue("H5.H5Sget_select_hyper_blocklist", (block[0]-1) == blocks[2]); + assertTrue("H5.H5Sget_select_hyper_blocklist", (block[1]-1) == blocks[3]); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sget_select_bounds: " + err); + } + finally { + try {H5.H5Sclose(space1);} catch (Exception ex) {} + } + } + + @Test + public void testH5Sget_select_valid() { + long space1 = -1; + long start[] = {1,0}; + long stride[] = {1,1}; + long count[] = {2,3}; + long block[] = {1,1}; + long offset[] = {0,0}; // Offset of selection + + try { + // Copy "all" selection & space + space1 = H5.H5Scopy(H5sid); + assertTrue("H5.H5Scopy", H5sid > 0); + // 'AND' "all" selection with another hyperslab + H5.H5Sselect_hyperslab(space1, HDF5Constants.H5S_SELECT_SET, start, stride, count, block); + + // Check a valid offset + offset[0]=-1; + offset[1]=0; + H5.H5Soffset_simple(space1, offset); + assertTrue("H5Sselect_valid", H5.H5Sselect_valid(space1)); + + // Check an invalid offset + offset[0]=10; + offset[1]=0; + H5.H5Soffset_simple(space1, offset); + assertFalse("H5Sselect_valid", H5.H5Sselect_valid(space1)); + + /* Reset offset */ + offset[0]=0; + offset[1]=0; + H5.H5Soffset_simple(space1, offset); + assertTrue("H5Sselect_valid", H5.H5Sselect_valid(space1)); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Sget_select_valid: " + err); + } + finally { + try {H5.H5Sclose(space1);} catch (Exception ex) {} + } + } + + @Test + public void testH5Shyper_regular() { + long start[] = {1,0}; + long stride[] = {1,1}; + long count[] = {2,3}; + long block[] = {1,1}; + long q_start[] = new long[2]; + long q_stride[] = new long[2]; + long q_count[] = new long[2]; + long q_block[] = new long[2]; + boolean is_regular = false; + + try { + // Set "regular" hyperslab selection + H5.H5Sselect_hyperslab(H5sid, HDF5Constants.H5S_SELECT_SET, start, stride, count, block); + + // Query if 'hyperslab' selection is regular hyperslab (should be TRUE) + is_regular = H5.H5Sis_regular_hyperslab(H5sid); + assertTrue("H5.H5Sis_regular_hyperslab", is_regular); + + // Retrieve the hyperslab parameters + H5.H5Sget_regular_hyperslab(H5sid, q_start, q_stride, q_count, q_block); + + /* Verify the hyperslab parameters */ + for(int u = 0; u < H5rank; u++) { + assertTrue("H5Sget_regular_hyperslab, start", start[u] == q_start[u]); + assertTrue("H5Sget_regular_hyperslab, stride", stride[u] == q_stride[u]); + assertTrue("H5Sget_regular_hyperslab, count", count[u] == q_count[u]); + assertTrue("H5Sget_regular_hyperslab, block", block[u] == q_block[u]); + } /* end for */ + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Sget_select_valid: " + err); + } + } +} diff --git a/java/test/TestH5Sbasic.java b/java/test/TestH5Sbasic.java new file mode 100644 index 0000000..2731a06 --- /dev/null +++ b/java/test/TestH5Sbasic.java @@ -0,0 +1,247 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Sbasic { + @Rule public TestName testname = new TestName(); + + @Before + public void checkOpenIDs() { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + @After + public void nextTestName() { + System.out.println(); + } + + @Test//(expected = HDF5LibraryException.class) + public void testH5Sclose_invalid() throws Throwable { + long sid = H5.H5Sclose(-1); + assertTrue(sid == 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Screate_invalid() throws Throwable { + H5.H5Screate(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Sget_simple_extent_type_invalid() throws Throwable { + H5.H5Sget_simple_extent_type(-1); + } + + @Test + public void testH5Screate_scalar() { + long sid = -1; + int class_type = -1; + try { + sid = H5.H5Screate(HDF5Constants.H5S_SCALAR); + assertTrue("H5.H5Screate_scalar",sid > 0); + class_type = H5.H5Sget_simple_extent_type(sid); + assertTrue("H5.H5Screate_scalar: type",class_type == HDF5Constants.H5S_SCALAR); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Screate: " + err); + } + finally { + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Screate_null() { + long sid = -1; + int class_type = -1; + try { + sid = H5.H5Screate(HDF5Constants.H5S_NULL); + assertTrue("H5.H5Screate_null", sid > 0); + class_type = H5.H5Sget_simple_extent_type(sid); + assertTrue("H5.H5Screate_null: type", class_type == HDF5Constants.H5S_NULL); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Screate: " + err); + } + finally { + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + @Test(expected = NullPointerException.class) + public void testH5Screate_simple_dims_null() throws Throwable { + H5.H5Screate_simple(2, (long[])null, null); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Screate_simple_rank_invalid() throws Throwable { + long dims[] = {5, 5}; + H5.H5Screate_simple(-1, dims, null); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Screate_simple_dims_invalid() throws Throwable { + long dims[] = {2, 2}; + H5.H5Screate_simple(5, dims, null); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Screate_simple_dims_exceed() throws Throwable { + long dims[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20, + 21,22,23,24,25,26,27,28,29,30,31,32,33,35}; + H5.H5Screate_simple(35, dims, null); + } + +//H5Screate_simple was changed to allow a dim of 0 +// @Ignore(expected = HDF5LibraryException.class) +// public void testH5Screate_simple_dims_zero() { +// long dims[] = {0, 0}; +// H5.H5Screate_simple(2, dims, null); +// } + + @Test + public void testH5Screate_simple() { + long sid = -1; + int class_type = -1; + int rank = 2; + long dims[] = {5, 5}; + long maxdims[] = {10, 10}; + + try { + sid = H5.H5Screate_simple(rank, dims, maxdims); + assertTrue("H5.H5Screate_simple", sid > 0); + class_type = H5.H5Sget_simple_extent_type(sid); + assertTrue("H5.H5Screate_simple: type", class_type == HDF5Constants.H5S_SIMPLE); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Screate_simple: " + err); + } + finally { + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Screate_simple_unlimted() { + long sid = -1; + int class_type = -1; + int rank = 2; + long dims[] = {5, 5}; + long maxdims[] = {HDF5Constants.H5S_UNLIMITED, HDF5Constants.H5S_UNLIMITED}; + + try { + sid = H5.H5Screate_simple(rank, dims, maxdims); + assertTrue("H5.H5Screate_simple", sid > 0); + class_type = H5.H5Sget_simple_extent_type(sid); + assertTrue("H5.H5Screate_simple: type", class_type == HDF5Constants.H5S_SIMPLE); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Screate_simple: " + err); + } + finally { + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Screate_simple_unlimted_1d() { + long sid = -1; + int class_type = -1; + int rank = 1; + long dims[] = {5}; + long maxdims[] = {HDF5Constants.H5S_UNLIMITED}; + + try { + sid = H5.H5Screate_simple(rank, dims, maxdims); + assertTrue("H5.H5Screate_simple", sid > 0); + class_type = H5.H5Sget_simple_extent_type(sid); + assertTrue("H5.H5Screate_simple: type", class_type == HDF5Constants.H5S_SIMPLE); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Screate_simple: " + err); + } + finally { + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Screate_simple_max_default() { + long sid = -1; + int rank = 2; + long dims[] = {5, 5}; + + try { + sid = H5.H5Screate_simple(rank, dims, null); + assertTrue("H5.H5Screate_simple_max_default", sid > 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Screate_simple: " + err); + } + finally { + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Screate_simple_extent() { + long sid = -1; + int rank = 2; + long dims[] = {5, 5}; + long maxdims[] = {10, 10}; + + try { + sid = H5.H5Screate(HDF5Constants.H5S_SIMPLE); + assertTrue("H5.H5Screate_simple_extent",sid > 0); + H5.H5Sset_extent_simple(sid, rank, dims, maxdims); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Screate: " + err); + } + finally { + try {H5.H5Sclose(sid);} catch (Exception ex) {} + } + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Sencode_invalid() throws Throwable { + H5.H5Sencode(-1); + } + + @Test(expected = NullPointerException.class) + public void testH5Sdecode_null() throws Throwable { + H5.H5Sdecode(null); + } + +} diff --git a/java/test/TestH5T.java b/java/test/TestH5T.java new file mode 100644 index 0000000..e03b97f --- /dev/null +++ b/java/test/TestH5T.java @@ -0,0 +1,459 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5T { + @Rule public TestName testname = new TestName(); + private static final String H5_FILE = "test.h5"; + long H5fid = -1; + long H5strdid = -1; + + private final void _deleteFile(String filename) { + File file = null; + try { + file = new File(filename); + } + catch (Throwable err) {} + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + @Before + public void createH5file() throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0", H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + assertTrue("H5.H5Fcreate", H5fid > 0); + H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + assertTrue("H5.H5Tcopy", H5strdid > 0); + + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5strdid >= 0) + try {H5.H5Tclose(H5strdid);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + + _deleteFile(H5_FILE); + System.out.println(); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tequal_type_error() throws Throwable { + H5.H5Tequal(HDF5Constants.H5T_INTEGER, H5strdid); + } + + @Test + public void testH5Tget_class() { + try { + int result = H5.H5Tget_class(H5strdid); + assertTrue("H5.H5Tget_class", result > 0); + String class_name = H5.H5Tget_class_name(result); + assertTrue("H5.H5Tget_class", class_name.compareTo("H5T_STRING")==0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tget_class: " + err); + } + } + + @Test + public void testH5Tget_size() { + long dt_size = -1; + + try { + dt_size = H5.H5Tget_size(H5strdid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tget_size:H5.H5Tget_size " + err); + } + assertTrue("testH5Tget_size", dt_size > 0); + } + + @Test + public void testH5Tset_size() { + long dt_size = 5; + + try { + H5.H5Tset_size(H5strdid, dt_size); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tset_size:H5.H5Tset_size " + err); + } + try { + dt_size = H5.H5Tget_size(H5strdid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tget_size:H5.H5Tget_size " + err); + } + assertTrue("testH5Tget_size", dt_size == 5); + } + + @Test + public void testH5Tarray_create() { + long filetype_id = -1; + long[] adims = { 3, 5 }; + + try { + filetype_id = H5.H5Tarray_create(HDF5Constants.H5T_STD_I64LE, 2, adims); + assertTrue("testH5Tarray_create", filetype_id >= 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tarray_create.H5Tarray_create " + err); + } + finally { + if (filetype_id >= 0) + try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Tget_array_ndims() { + long filetype_id = -1; + int ndims = 0; + long[] adims = { 3, 5 }; + + try { + filetype_id = H5.H5Tarray_create(HDF5Constants.H5T_STD_I64LE, 2, adims); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tarray_create.H5Tarray_create " + err); + } + assertTrue("testH5Tget_array_ndims:H5Tarray_create", filetype_id >= 0); + try { + ndims = H5.H5Tget_array_ndims(filetype_id); + assertTrue("testH5Tget_array_ndims", ndims == 2); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tget_array_ndims.H5Tget_array_ndims " + err); + } + finally { + if (filetype_id >= 0) + try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Tget_array_dims() { + long filetype_id = -1; + int ndims = 0; + long[] adims = { 3, 5 }; + long[] rdims = new long[2]; + + try { + filetype_id = H5.H5Tarray_create(HDF5Constants.H5T_STD_I64LE, 2, adims); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tarray_create.H5Tarray_create " + err); + } + assertTrue("testH5Tget_array_dims:H5Tarray_create", filetype_id >= 0); + try { + ndims = H5.H5Tget_array_dims(filetype_id, rdims); + assertTrue("testH5Tget_array_dims", ndims == 2); + assertTrue("testH5Tget_array_dims", adims[0] == rdims[0]); + assertTrue("testH5Tget_array_dims", adims[1] == rdims[1]); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tget_array_dims.H5Tget_array_dims " + err); + } + finally { + if (filetype_id >= 0) + try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Tenum_functions() { + long filetype_id =-1; + String enum_type ="Enum_type"; + byte[] enum_val = new byte[1]; + String enum_name = null; + + // Create a enumerate datatype + try { + filetype_id = H5.H5Tcreate(HDF5Constants.H5T_ENUM, (long)1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tenum_functions:H5Tcreate " + err); + } + assertTrue("testH5Tenum_functions:H5Tcreate", filetype_id >= 0); + try { + enum_val[0]=10; + H5.H5Tenum_insert(filetype_id, "RED", enum_val); + enum_val[0]=11; + H5.H5Tenum_insert(filetype_id, "GREEN", enum_val); + enum_val[0]=12; + H5.H5Tenum_insert(filetype_id, "BLUE", enum_val); + enum_val[0]=13; + H5.H5Tenum_insert(filetype_id, "ORANGE", enum_val); + enum_val[0]=14; + H5.H5Tenum_insert(filetype_id, "YELLOW", enum_val); + + // Query member number and member index by member name, for enumeration type. + assertTrue("Can't get member number", H5.H5Tget_nmembers(filetype_id) == 5); + assertTrue("Can't get correct index number", H5.H5Tget_member_index(filetype_id, "ORANGE") == 3); + + // Commit enumeration datatype and close it */ + H5.H5Tcommit(H5fid, enum_type, filetype_id, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + + H5.H5Tclose(filetype_id); + + // Open the dataytpe for query + filetype_id = H5.H5Topen(H5fid, enum_type, HDF5Constants.H5P_DEFAULT); + assertTrue("testH5Tenum_functions:H5Tcreate", filetype_id >= 0); + + // Query member number and member index by member name, for enumeration type + assertTrue("Can't get member number", H5.H5Tget_nmembers(filetype_id) == 5); + assertTrue("Can't get correct index number", H5.H5Tget_member_index(filetype_id, "ORANGE") == 3); + + // Query member value by member name, for enumeration type + H5.H5Tenum_valueof (filetype_id, "ORANGE", enum_val); + assertTrue("Incorrect value for enum member", enum_val[0]==13); + + // Query member value by member index, for enumeration type + H5.H5Tget_member_value (filetype_id, 2, enum_val); + assertTrue("Incorrect value for enum member", enum_val[0]==12); + + // Query member name by member value, for enumeration type + enum_val[0] = 14; + enum_name = H5.H5Tenum_nameof(filetype_id, enum_val, 16); + assertTrue("Incorrect name for enum member", enum_name.compareTo("YELLOW")==0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tenum_functions:query " + err); + } + finally { + if (filetype_id >= 0) + try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Tenum_create_functions() { + long filetype_id = -1; + byte[] enum_val = new byte[1]; + + // Create a enumerate datatype + try { + filetype_id = H5.H5Tenum_create(HDF5Constants.H5T_NATIVE_INT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tenum_create_functions:H5Tcreate " + err); + } + assertTrue("testH5Tenum_create_functions:H5Tcreate", filetype_id >= 0); + try { + enum_val[0]=10; + H5.H5Tenum_insert(filetype_id, "RED", enum_val); + enum_val[0]=11; + H5.H5Tenum_insert(filetype_id, "GREEN", enum_val); + enum_val[0]=12; + H5.H5Tenum_insert(filetype_id, "BLUE", enum_val); + enum_val[0]=13; + H5.H5Tenum_insert(filetype_id, "ORANGE", enum_val); + enum_val[0]=14; + H5.H5Tenum_insert(filetype_id, "YELLOW", enum_val); + + // Query member number and member index by member name, for enumeration type. + assertTrue("Can't get member number", H5.H5Tget_nmembers(filetype_id) == 5); + assertTrue("Can't get correct index number", H5.H5Tget_member_index(filetype_id, "ORANGE") == 3); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tenum_create_functions:H5Tget_nmembers " + err); + } + finally { + if (filetype_id >= 0) + try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Topaque_functions() { + long filetype_id = -1; + String opaque_name = null; + + // Create a opaque datatype + try { + filetype_id = H5.H5Tcreate(HDF5Constants.H5T_OPAQUE, (long)4); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Topaque_functions:H5Tcreate " + err); + } + assertTrue("testH5Topaque_functions:H5Tcreate", filetype_id >= 0); + + try { + H5.H5Tset_tag(filetype_id, "opaque type"); + opaque_name = H5.H5Tget_tag(filetype_id); + assertTrue("Incorrect tag for opaque type", opaque_name.compareTo("opaque type")==0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Topaque_functions:H5Tset_get_tag " + err); + } + finally { + if (filetype_id >= 0) + try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Tvlen_create() { + long filetype_id = -1; + + try { + filetype_id = H5.H5Tvlen_create(HDF5Constants.H5T_C_S1); + assertTrue("testH5Tvlen_create", filetype_id >= 0); + + // Check if datatype is VL type + int vlclass = H5.H5Tget_class(filetype_id); + assertTrue("testH5Tvlen_create:H5Tget_class", vlclass == HDF5Constants.H5T_VLEN); + assertFalse("testH5Tis_variable_str:H5Tget_class", vlclass == HDF5Constants.H5T_STRING); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tvlen_create.H5Tvlen_create " + err); + } + finally { + if (filetype_id >= 0) + try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Tis_variable_str() { + long filetype_id = -1; + + try { + filetype_id = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + assertTrue("testH5Tis_variable_str.H5Tcopy: ", filetype_id >= 0); + + // Convert to variable-length string + H5.H5Tset_size(filetype_id, HDF5Constants.H5T_VARIABLE); + + // Check if datatype is VL string + int vlclass = H5.H5Tget_class(filetype_id); + assertTrue("testH5Tis_variable_str:H5Tget_class", vlclass == HDF5Constants.H5T_STRING); + assertFalse("testH5Tvlen_create:H5Tget_class", vlclass == HDF5Constants.H5T_VLEN); + + assertTrue("testH5Tis_variable_str:H5Tis_variable_str", H5.H5Tis_variable_str(filetype_id)); + + // Verify that the class detects as a string + assertTrue("testH5Tis_variable_str:H5Tdetect_class", H5.H5Tdetect_class(filetype_id, HDF5Constants.H5T_STRING)); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tis_variable_str " + err); + } + finally { + if (filetype_id >= 0) + try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} + } + } + + @Test + public void testH5Tcompound_functions() { + long filetype_id =-1; + + // Create a compound datatype + try { + filetype_id = H5.H5Tcreate(HDF5Constants.H5T_COMPOUND, (long)16); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tcompound_functions:H5Tcreate " + err); + } + assertTrue("testH5Tcompound_functions:H5Tcreate", filetype_id >= 0); + try { + H5.H5Tinsert(filetype_id, "Lon", 0, HDF5Constants.H5T_NATIVE_DOUBLE); + H5.H5Tinsert(filetype_id, "Lat", 8, HDF5Constants.H5T_NATIVE_DOUBLE); + + // Query member number and member index by member name, for enumeration type. + assertTrue("Can't get member number", H5.H5Tget_nmembers(filetype_id) == 2); + assertTrue("Can't get correct index number", H5.H5Tget_member_index(filetype_id, "Lat") == 1); + + // We started to support this function for compound type in 1.8.6 release. + int order = H5.H5Tget_order(filetype_id); + assertFalse("Can't get order for compound type.", order == HDF5Constants.H5T_ORDER_ERROR); + assertTrue("Wrong order for this type.", (order == HDF5Constants.H5T_ORDER_LE) || (order == HDF5Constants.H5T_ORDER_BE)); + + // Make certain that the correct classes can be detected + assertTrue("Can't get correct class", H5.H5Tdetect_class(filetype_id, HDF5Constants.H5T_COMPOUND)); + assertTrue("Can't get correct class", H5.H5Tdetect_class(filetype_id, HDF5Constants.H5T_FLOAT)); + // Make certain that an incorrect class is not detected + assertFalse("Can get incorrect class", H5.H5Tdetect_class(filetype_id, HDF5Constants.H5T_TIME)); + + // Query member name by member index + String index_name = H5.H5Tget_member_name (filetype_id, 0); + assertTrue("Incorrect name for member index", index_name.compareTo("Lon")==0); + + // Query member offset by member no + long index_offset = H5.H5Tget_member_offset (filetype_id, 1); + assertTrue("Incorrect offset for member no", index_offset == 8); + + // Query member type by member index + long index_type = H5.H5Tget_member_type (filetype_id, 0); + assertTrue("Incorrect type for member index", H5.H5Tequal(HDF5Constants.H5T_NATIVE_DOUBLE, index_type)); + if (index_type >= 0) + try {H5.H5Tclose(index_type);} catch (Exception ex) {} + + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tcompound_functions:query " + err); + } + finally { + if (filetype_id >= 0) + try {H5.H5Tclose(filetype_id);} catch (Exception ex) {} + } + } + +} diff --git a/java/test/TestH5Tbasic.java b/java/test/TestH5Tbasic.java new file mode 100644 index 0000000..950f1c7 --- /dev/null +++ b/java/test/TestH5Tbasic.java @@ -0,0 +1,161 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Tbasic { + @Rule public TestName testname = new TestName(); + + @Before + public void checkOpenIDs() { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + @After + public void nextTestName() { + System.out.println(); + } + + @Test + public void testH5Tcopy() { + long H5strdid = -1; + try { + H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + assertTrue("H5.H5Tcopy",H5strdid > 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tcopy: " + err); + } + finally { + if (H5strdid >= 0) + try {H5.H5Tclose(H5strdid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Tequal() { + long H5strdid = -1; + try { + H5strdid = H5.H5Tcopy(HDF5Constants.H5T_C_S1); + assertTrue("H5.H5Tcopy",H5strdid > 0); + boolean teq = H5.H5Tequal(HDF5Constants.H5T_C_S1, H5strdid); + assertTrue("H5.H5Tequal",teq); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tequal: " + err); + } + finally { + if (H5strdid >= 0) + try {H5.H5Tclose(H5strdid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Tequal_not() { + long H5strdid = -1; + try { + H5strdid = H5.H5Tcopy(HDF5Constants.H5T_STD_U64LE); + assertTrue("H5.H5Tcopy",H5strdid > 0); + boolean teq = H5.H5Tequal(HDF5Constants.H5T_IEEE_F32BE, H5strdid); + assertFalse("H5.H5Tequal",teq); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Tequal_not: " + err); + } + finally { + if (H5strdid >= 0) + try {H5.H5Tclose(H5strdid);} catch (Exception ex) {} + } + } + + @Test + public void testH5Tconvert() { + String[] strs = {"a1234","b1234"}; + int srcLen = 5; + int dstLen = 10; + long srcId = -1; + long dstId = -1; + int dimSize = strs.length; + byte[] buf = new byte[dimSize*dstLen]; + + for (int i=0; i 0); + H5.H5Tset_size(H5strdid, (long)5); + assertTrue(HDF5Constants.H5T_ORDER_NONE == H5.H5Tget_order(H5strdid)); + H5.H5Tset_order(H5strdid, HDF5Constants.H5T_ORDER_NONE); + assertTrue(HDF5Constants.H5T_ORDER_NONE == H5.H5Tget_order(H5strdid)); + assertTrue(5 == H5.H5Tget_size(H5strdid)); + + // Variable length string + H5.H5Tset_size(H5strdid, HDF5Constants.H5T_VARIABLE); + H5.H5Tset_order(H5strdid, HDF5Constants.H5T_ORDER_BE); + assertTrue(HDF5Constants.H5T_ORDER_BE == H5.H5Tget_order(H5strdid)); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Torder: " + err); + } + finally { + if (H5strdid >= 0) + try {H5.H5Tclose(H5strdid);} catch (Exception ex) {} + } + } +} diff --git a/java/test/TestH5Tparams.java b/java/test/TestH5Tparams.java new file mode 100644 index 0000000..15cc6af --- /dev/null +++ b/java/test/TestH5Tparams.java @@ -0,0 +1,389 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertTrue; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Tparams { + @Rule public TestName testname = new TestName(); + + @Before + public void checkOpenIDs() { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + @After + public void nextTestName() { + System.out.println(); + } + + @Test//(expected = HDF5LibraryException.class) + public void testH5Tclose_invalid() throws Throwable { + long tid = H5.H5Tclose(-1); + assertTrue(tid == 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tcopy_invalid() throws Throwable { + H5.H5Tcopy(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tequal_invalid() throws Throwable { + H5.H5Tequal(-1, -1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tlock_invalid() throws Throwable { + H5.H5Tlock(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_class_invalid() throws Throwable { + H5.H5Tget_class(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_size_invalid() throws Throwable { + H5.H5Tget_size(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_size_invalid() throws Throwable { + H5.H5Tset_size(-1, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_order_invalid() throws Throwable { + H5.H5Tget_order(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_order_invalid() throws Throwable { + H5.H5Tset_order(-1, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_precision_invalid() throws Throwable { + H5.H5Tget_precision(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_precision_long_invalid() throws Throwable { + H5.H5Tget_precision_long(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_precision_invalid() throws Throwable { + H5.H5Tset_precision(-1, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_offset_invalid() throws Throwable { + H5.H5Tget_offset(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_offset_invalid() throws Throwable { + H5.H5Tset_offset(-1, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tcreate_invalid() throws Throwable { + H5.H5Tcreate(-1, (long)0); + } + + @Test(expected = NullPointerException.class) + public void testH5Topen_null() throws Throwable { + H5.H5Topen(-1, null, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Topen_invalid() throws Throwable { + H5.H5Topen(-1, "Bogus", 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Tcommit_null() throws Throwable { + H5.H5Tcommit(-1, null, 0, -1, -1, -1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tcommit_invalid() throws Throwable { + H5.H5Tcommit(-1, "Bogus", -1, -1, -1, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Tget_pad_null() throws Throwable { + H5.H5Tget_pad(-1, null); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_pad_invalid() throws Throwable { + int[] pad = new int[2]; + H5.H5Tget_pad(-1, pad); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_pad_invalid() throws Throwable { + H5.H5Tset_pad(-1, -1, -1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_sign_invalid() throws Throwable { + H5.H5Tget_sign(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_sign_invalid() throws Throwable { + H5.H5Tset_sign(-1, 0); + } + + @Test(expected = NullPointerException.class) + public void testH5Tget_fields_null() throws Throwable { + H5.H5Tget_fields(-1, (long[])null); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Tget_fields_length_invalid() throws Throwable { + long[] fields = new long[2]; + H5.H5Tget_fields(-1, fields); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_fields_invalid() throws Throwable { + long[] fields = new long[5]; + H5.H5Tget_fields(-1, fields); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_fields_invalid() throws Throwable { + H5.H5Tset_fields(-1, -1, -1, -1, -1, -1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_ebias_invalid() throws Throwable { + H5.H5Tget_ebias(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_ebias_long_invalid() throws Throwable { + H5.H5Tget_ebias_long(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_ebias_invalid() throws Throwable { + H5.H5Tset_ebias(-1, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_norm_invalid() throws Throwable { + H5.H5Tget_norm(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_norm_invalid() throws Throwable { + H5.H5Tset_norm(-1, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_inpad_invalid() throws Throwable { + H5.H5Tget_inpad(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_inpad_invalid() throws Throwable { + H5.H5Tset_inpad(-1, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_cset_invalid() throws Throwable { + H5.H5Tget_cset(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_cset_invalid() throws Throwable { + H5.H5Tset_cset(-1, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_strpad_invalid() throws Throwable { + H5.H5Tget_strpad(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_strpad_invalid() throws Throwable { + H5.H5Tset_strpad(-1, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_nmembers_invalid() throws Throwable { + H5.H5Tget_nmembers(-1); + } + + @Test(expected = NullPointerException.class) + public void testH5Tget_member_index_null() throws Throwable { + H5.H5Tget_member_index(-1, null); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_member_index_invalid() throws Throwable { + H5.H5Tget_member_index(-1, "Bogus"); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_member_type_invalid() throws Throwable { + H5.H5Tget_member_type(-1, -1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_member_class_invalid() throws Throwable { + H5.H5Tget_member_class(-1, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Tinsert_null() throws Throwable { + H5.H5Tinsert(-1, null, 0, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tinsert_invalid() throws Throwable { + H5.H5Tinsert(-1, "Bogus", 0, 0); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tpack_invalid() throws Throwable { + H5.H5Tpack(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tvlen_create_invalid() throws Throwable { + H5.H5Tvlen_create(-1); + } + + @Test(expected = NullPointerException.class) + public void testH5Tset_tag_null() throws Throwable { + H5.H5Tset_tag(-1, null); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tset_tag_invalid() throws Throwable { + H5.H5Tset_tag(-1, "Bogus"); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_super_invalid() throws Throwable { + H5.H5Tget_super(-1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tenum_create_invalid() throws Throwable { + H5.H5Tenum_create(-1); + } + + @Test(expected = NullPointerException.class) + public void testH5Tenum_insert_name_null() throws Throwable { + H5.H5Tenum_insert(-1, null, (byte[])null); + } + + @Test(expected = NullPointerException.class) + public void testH5Tenum_insert_null() throws Throwable { + H5.H5Tenum_insert(-1, "bogus", (byte[])null); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tenum_insert_invalid() throws Throwable { + byte[] enumtype = new byte[2]; + H5.H5Tenum_insert(-1, "bogus", enumtype); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Tenum_nameof_invalid_size() throws Throwable { + H5.H5Tenum_nameof(-1, null, -1); + } + + @Test(expected = NullPointerException.class) + public void testH5Tenum_nameof_value_null() throws Throwable { + H5.H5Tenum_nameof(-1, null, 1); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tenum_nameof_invalid() throws Throwable { + byte[] btype = new byte[2]; + H5.H5Tenum_nameof(-1, btype, 1); + } + + @Test(expected = NullPointerException.class) + public void testH5Tenum_valueof_name_null() throws Throwable { + H5.H5Tenum_valueof(-1, null, (byte[])null); + } + + @Test(expected = NullPointerException.class) + public void testH5Tenum_valueof_null() throws Throwable { + H5.H5Tenum_valueof(-1, "bogus", (byte[])null); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tenum_valueof_invalid() throws Throwable { + byte[] btype = new byte[2]; + H5.H5Tenum_valueof(-1, "bogus", btype); + } + + @Test(expected = NullPointerException.class) + public void testH5Tget_member_value_null() throws Throwable { + H5.H5Tget_member_value(-1, -1, (byte[])null); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_member_value_invalid() throws Throwable { + byte[] btype = new byte[2]; + H5.H5Tget_member_value(-1, -1, btype); + } + + @Test(expected = IllegalArgumentException.class) + public void testH5Tarray_create_invalid() throws Throwable { + H5.H5Tarray_create(-1, -1, null); + } + + @Test(expected = NullPointerException.class) + public void testH5Tarray_create_value_null() throws Throwable { + H5.H5Tarray_create(-1, 1, null); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_array_ndims_invalid() throws Throwable { + H5.H5Tget_array_ndims(-1); + } + + @Test(expected = NullPointerException.class) + public void testH5Tget_array_dims_null() throws Throwable { + H5.H5Tget_array_dims(-1, null); + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Tget_native_type_invalid() throws Throwable { + H5.H5Tget_native_type(-1); + } + +} diff --git a/java/test/TestH5Z.java b/java/test/TestH5Z.java new file mode 100644 index 0000000..bdf3f1d --- /dev/null +++ b/java/test/TestH5Z.java @@ -0,0 +1,100 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Z { + @Rule public TestName testname = new TestName(); + + @Before + public void checkOpenIDs() { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + @After + public void nextTestName() { + System.out.println(); + } + + @Test + public void testH5Zfilter_avail() { + try { + int filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_DEFLATE); + assertTrue("H5.H5Zfilter_avail_DEFLATE", filter_found > 0); + filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_FLETCHER32); + assertTrue("H5.H5Zfilter_avail_FLETCHER32", filter_found > 0); + filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_NBIT); + assertTrue("H5.H5Zfilter_avail_NBIT", filter_found > 0); + filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SCALEOFFSET); + assertTrue("H5.H5Zfilter_avail_SCALEOFFSET", filter_found > 0); + filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SHUFFLE); + assertTrue("H5.H5Zfilter_avail_SHUFFLE", filter_found > 0); +// filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SZIP); +// assertTrue("H5.H5Zfilter_avail_SZIP", filter_found > 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Zfilter_avail " + err); + } + } + + @Test + public void testH5Zget_filter_info() { + try { + int filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_DEFLATE); + assertTrue("H5.H5Zget_filter_info_DEFLATE_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); + assertTrue("H5.H5Zget_filter_info_DEFLATE_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_FLETCHER32); + assertTrue("H5.H5Zget_filter_info_FLETCHER32_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); + assertTrue("H5.H5Zget_filter_info_FLETCHER32_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_NBIT); + assertTrue("H5.H5Zget_filter_info_NBIT_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); + assertTrue("H5.H5Zget_filter_info_NBIT_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SCALEOFFSET); + assertTrue("H5.H5Zget_filter_info_SCALEOFFSET_DECODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); + assertTrue("H5.H5Zget_filter_info_SCALEOFFSET_ENCODE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SHUFFLE); + assertTrue("H5.H5Zget_filter_info_DECODE_SHUFFLE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); + assertTrue("H5.H5Zget_filter_info_ENCODE_SHUFFLE_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); +// filter_flag = H5.H5Zget_filter_info(HDF5Constants.H5Z_FILTER_SZIP); +// assertTrue("H5.H5Zget_filter_info_DECODE_SZIP_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_DECODE_ENABLED) > 0); +// assertTrue("H5.H5Zget_filter_info_ENCODE_SZIP_ENABLED", (filter_flag & HDF5Constants.H5Z_FILTER_CONFIG_ENCODE_ENABLED) > 0); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Zget_filter_info " + err); + } + } + + @Test(expected = HDF5LibraryException.class) + public void testH5Zunregister_predefined() throws Throwable { + int filter_found = H5.H5Zfilter_avail(HDF5Constants.H5Z_FILTER_SHUFFLE); + assertTrue("H5.H5Zfilter_avail", filter_found > 0); + + H5.H5Zunregister(HDF5Constants.H5Z_FILTER_SHUFFLE); + } +} diff --git a/java/test/h5ex_g_iterate.hdf b/java/test/h5ex_g_iterate.hdf new file mode 100644 index 0000000..e462703 Binary files /dev/null and b/java/test/h5ex_g_iterate.hdf differ diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in new file mode 100644 index 0000000..6878b3b --- /dev/null +++ b/java/test/junit.sh.in @@ -0,0 +1,234 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have +# access to either file, you may request a copy from help@hdfgroup.org. +# + +top_builddir=@top_builddir@ +top_srcdir=@top_srcdir@ +srcdir=@srcdir@ + +TESTNAME=JUnitInterface +EXIT_SUCCESS=0 +EXIT_FAILURE=1 + +# Set up default variable values if not supplied by the user. +RM='rm -rf' +CMP='cmp' +DIFF='diff -c' +CP='cp' +DIRNAME='dirname' +LS='ls' +AWK='awk' + +nerrors=0 + +# where the libs exist +HDFLIB_HOME="$top_srcdir/java/lib" +BLDLIBDIR="$top_builddir/java/lib" +BLDDIR="." +HDFTEST_HOME="$top_srcdir/java/test" +JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar +TESTJARFILE=jar@PACKAGE_TARNAME@test.jar +test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR + +###################################################################### +# library files +# -------------------------------------------------------------------- +# All the library files copy from source directory to test directory +# NOTE: Keep this framework to add/remove test files. +# This list are also used for checking exist. +# Comment '#' without space can be used. +# -------------------------------------------------------------------- +LIST_LIBRARY_FILES=" +$HDFLIB_HOME/hamcrest-core.jar +$HDFLIB_HOME/junit.jar +$HDFLIB_HOME/slf4j-api-1.7.5.jar +$HDFLIB_HOME/ext/slf4j-simple-1.7.5.jar +$top_builddir/src/.libs/libhdf5.* +$top_builddir/java/src/jni/.libs/libhdf5_java.* +$top_builddir/java/src/$JARFILE +" +LIST_DATA_FILES=" +$HDFTEST_HOME/h5ex_g_iterate.hdf +" + +# +# copy files from source dirs to test dir +# +COPY_LIBFILES="$LIST_LIBRARY_FILES" + +COPY_LIBFILES_TO_BLDLIBDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_LIBFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDLIBDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done +} + +CLEAN_LIBFILES_AND_BLDLIBDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $BLDLIBDIR + fi +} + +COPY_DATAFILES="$LIST_DATA_FILES" + +COPY_DATAFILES_TO_BLDDIR() +{ + # copy test files. Used -f to make sure get a new copy + for tstfile in $COPY_DATAFILES + do + # ignore '#' comment + echo $tstfile | tr -d ' ' | grep '^#' > /dev/null + RET=$? + if [ $RET -eq 1 ]; then + # skip cp if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $CP -f $tstfile $BLDDIR + if [ $? -ne 0 ]; then + echo "Error: FAILED to copy $tstfile ." + + # Comment out this to CREATE expected file + exit $EXIT_FAILURE + fi + fi + fi + done +} + +CLEAN_DATAFILES_AND_BLDDIR() +{ + # skip rm if srcdir is same as destdir + # this occurs when build/test performed in source dir and + # make cp fail + SDIR=`$DIRNAME $tstfile` + INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then + $RM $BLDDIR/*.hdf + $RM $BLDDIR/*.out + fi +} + +# Print a line-line message left justified in a field of 70 characters +# beginning with the word "Testing". +# +TESTING() { + SPACES=" " + echo "Testing $* $SPACES" | cut -c1-70 | tr -d '\012' +} + +# where Java is installed (requires jdk1.7.x) +JAVAEXE=@JAVA@ +JAVAEXEFLAGS=@H5_JAVAFLAGS@ + +############################################################################### +# DO NOT MODIFY BELOW THIS LINE +############################################################################### + +# prepare for test +COPY_LIBFILES_TO_BLDLIBDIR +COPY_DATAFILES_TO_BLDDIR + +CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/junit.jar:"$BLDLIBDIR"/hamcrest-core.jar:"$BLDLIBDIR"/slf4j-api-1.7.5.jar:"$BLDLIBDIR"/slf4j-simple-1.7.5.jar:"$TESTJARFILE"" + +TEST=/usr/bin/test +if [ ! -x /usr/bin/test ] +then +TEST=`which test` +fi + +if $TEST -z "$CLASSPATH"; then + CLASSPATH="" +fi +CLASSPATH=$CPATH":"$CLASSPATH +export CLASSPATH + +if $TEST -n "$JAVAPATH" ; then + PATH=$JAVAPATH":"$PATH + export PATH +fi + +if $TEST -e /bin/uname; then + os_name=`/bin/uname -s` +elif $TEST -e /usr/bin/uname; then + os_name=`/usr/bin/uname -s` +else + os_name=unknown +fi + +if $TEST -z "$LD_LIBRARY_PATH" ; then + LD_LIBRARY_PATH="" +fi + +case $os_name in + Darwin) + DYLD_LIBRARY_PATH=$BLDLIBDIR:$DYLD_LIBRARY_PATH + export DYLD_LIBRARY_PATH + LD_LIBRARY_PATH=$DYLD_LIBRARY_PATH + ;; + *) + LD_LIBRARY_PATH=$BLDLIBDIR:$LD_LIBRARY_PATH + ;; +esac + +export LD_LIBRARY_PATH + +echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestAll" +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestAll) + +# Clean up temporary files/directories +CLEAN_LIBFILES_AND_BLDLIBDIR +CLEAN_DATAFILES_AND_BLDDIR + +# Report test results and exit +if test $nerrors -eq 0 ; then + echo "All $TESTNAME tests passed." + exit $EXIT_SUCCESS +else + echo "$TESTNAME tests failed with $nerrors errors." + exit $EXIT_FAILURE +fi diff --git a/m4/ax_check_class.m4 b/m4/ax_check_class.m4 new file mode 100644 index 0000000..098aa77 --- /dev/null +++ b/m4/ax_check_class.m4 @@ -0,0 +1,144 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_class.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_CLASS +# +# DESCRIPTION +# +# AX_CHECK_CLASS tests the existence of a given Java class, either in a +# jar or in a '.class' file. +# +# *Warning*: its success or failure can depend on a proper setting of the +# CLASSPATH env. variable. +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Stephane Bortzmeyer +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 7 + +AU_ALIAS([AC_CHECK_CLASS], [AX_CHECK_CLASS]) +AC_DEFUN([AX_CHECK_CLASS],[ +AC_REQUIRE([AX_PROG_JAVA]) +ac_var_name=`echo $1 | sed 's/\./_/g'` +dnl Normaly I'd use a AC_CACHE_CHECK here but since the variable name is +dnl dynamic I need an extra level of extraction +AC_MSG_CHECKING([for $1 class]) +AC_CACHE_VAL(ax_cv_class_$ac_var_name, [ +if test x$ac_cv_prog_uudecode_base64 = xyes; then +dnl /** +dnl * Test.java: used to test dynamicaly if a class exists. +dnl */ +dnl public class Test +dnl { +dnl +dnl public static void +dnl main( String[] argv ) +dnl { +dnl Class lib; +dnl if (argv.length < 1) +dnl { +dnl System.err.println ("Missing argument"); +dnl System.exit (77); +dnl } +dnl try +dnl { +dnl lib = Class.forName (argv[0]); +dnl } +dnl catch (ClassNotFoundException e) +dnl { +dnl System.exit (1); +dnl } +dnl lib = null; +dnl System.exit (0); +dnl } +dnl +dnl } +cat << \EOF > Test.uue +begin-base64 644 Test.class +yv66vgADAC0AKQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE +bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 +bWJlclRhYmxlDAAKAAsBAANlcnIBABVMamF2YS9pby9QcmludFN0cmVhbTsJ +AA0ACQcADgEAEGphdmEvbGFuZy9TeXN0ZW0IABABABBNaXNzaW5nIGFyZ3Vt +ZW50DAASABMBAAdwcmludGxuAQAVKExqYXZhL2xhbmcvU3RyaW5nOylWCgAV +ABEHABYBABNqYXZhL2lvL1ByaW50U3RyZWFtDAAYABkBAARleGl0AQAEKEkp +VgoADQAXDAAcAB0BAAdmb3JOYW1lAQAlKExqYXZhL2xhbmcvU3RyaW5nOylM +amF2YS9sYW5nL0NsYXNzOwoAHwAbBwAgAQAPamF2YS9sYW5nL0NsYXNzBwAi +AQAgamF2YS9sYW5nL0NsYXNzTm90Rm91bmRFeGNlcHRpb24BAAY8aW5pdD4B +AAMoKVYMACMAJAoAAwAlAQAKU291cmNlRmlsZQEACVRlc3QuamF2YQAhAAEA +AwAAAAAAAgAJAAUABgABAAcAAABtAAMAAwAAACkqvgSiABCyAAwSD7YAFBBN +uAAaKgMyuAAeTKcACE0EuAAaAUwDuAAasQABABMAGgAdACEAAQAIAAAAKgAK +AAAACgAAAAsABgANAA4ADgATABAAEwASAB4AFgAiABgAJAAZACgAGgABACMA +JAABAAcAAAAhAAEAAQAAAAUqtwAmsQAAAAEACAAAAAoAAgAAAAQABAAEAAEA +JwAAAAIAKA== +==== +EOF + if $UUDECODE Test.uue; then + : + else + echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AS_MESSAGE_LOG_FD + echo "configure: failed file was:" >&AS_MESSAGE_LOG_FD + cat Test.uue >&AS_MESSAGE_LOG_FD + ac_cv_prog_uudecode_base64=no + fi + rm -f Test.uue + if AC_TRY_COMMAND($JAVA $JAVAFLAGS Test $1) >/dev/null 2>&1; then + eval "ac_cv_class_$ac_var_name=yes" + else + eval "ac_cv_class_$ac_var_name=no" + fi + rm -f Test.class +else + AX_TRY_COMPILE_JAVA([$1], , [eval "ac_cv_class_$ac_var_name=yes"], + [eval "ac_cv_class_$ac_var_name=no"]) +fi +eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`" +eval "HAVE_$ac_var_name=$`echo ac_cv_class_$ac_var_val`" +HAVE_LAST_CLASS=$ac_var_val +if test x$ac_var_val = xyes; then + ifelse([$2], , :, [$2]) +else + ifelse([$3], , :, [$3]) +fi +]) +dnl for some reason the above statment didn't fall though here? +dnl do scripts have variable scoping? +eval "ac_var_val=$`eval echo ac_cv_class_$ac_var_name`" +AC_MSG_RESULT($ac_var_val) +]) diff --git a/m4/ax_check_classpath.m4 b/m4/ax_check_classpath.m4 new file mode 100644 index 0000000..3c9081a --- /dev/null +++ b/m4/ax_check_classpath.m4 @@ -0,0 +1,60 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_classpath.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_CLASSPATH +# +# DESCRIPTION +# +# AX_CHECK_CLASSPATH just displays the CLASSPATH, for the edification of +# the user. +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Stephane Bortzmeyer +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 5 + +AU_ALIAS([AC_CHECK_CLASSPATH], [AX_CHECK_CLASSPATH]) +AC_DEFUN([AX_CHECK_CLASSPATH],[ +if test "x$CLASSPATH" = x; then + echo "You have no CLASSPATH, I hope it is good" +else + echo "You have CLASSPATH $CLASSPATH, hope it is correct" +fi +]) diff --git a/m4/ax_check_java_home.m4 b/m4/ax_check_java_home.m4 new file mode 100644 index 0000000..cfe8f58 --- /dev/null +++ b/m4/ax_check_java_home.m4 @@ -0,0 +1,80 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_java_home.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_JAVA_HOME +# +# DESCRIPTION +# +# Check for Sun Java (JDK / JRE) installation, where the 'java' VM is in. +# If found, set environment variable JAVA_HOME = Java installation home, +# else left JAVA_HOME untouch, which in most case means JAVA_HOME is +# empty. +# +# LICENSE +# +# Copyright (c) 2008 Gleen Salmon +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 6 + +AU_ALIAS([AC_CHECK_JAVA_HOME], [AX_CHECK_JAVA_HOME]) + +AC_DEFUN([AX_CHECK_JAVA_HOME], +[AC_MSG_CHECKING([for JAVA_HOME]) +# We used a fake loop so that we can use "break" to exit when the result +# is found. +while true +do + # If the user defined JAVA_HOME, don't touch it. + test "${JAVA_HOME+set}" = set && break + + # On Mac OS X 10.5 and following, run /usr/libexec/java_home to get + # the value of JAVA_HOME to use. + # (http://developer.apple.com/library/mac/#qa/qa2001/qa1170.html). + JAVA_HOME=`/usr/libexec/java_home 2>/dev/null` + test x"$JAVA_HOME" != x && break + + # See if we can find the java executable, and compute from there. + TRY_JAVA_HOME=`ls -dr /usr/java/* 2> /dev/null | head -n 1` + if test x$TRY_JAVA_HOME != x; then + PATH=$PATH:$TRY_JAVA_HOME/bin + fi + AC_PATH_PROG([JAVA_PATH_NAME], [java]) + if test "x$JAVA_PATH_NAME" != x; then + JAVA_HOME=`echo $JAVA_PATH_NAME | sed "s/\(.*\)[[/]]bin[[/]]java.*/\1/"` + break + fi + + AC_MSG_NOTICE([Could not compute JAVA_HOME]) + break +done +AC_MSG_RESULT([$JAVA_HOME]) +]) diff --git a/m4/ax_check_junit.m4 b/m4/ax_check_junit.m4 new file mode 100644 index 0000000..39b52d1 --- /dev/null +++ b/m4/ax_check_junit.m4 @@ -0,0 +1,70 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_junit.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_JUNIT +# +# DESCRIPTION +# +# AX_CHECK_JUNIT tests the availability of the Junit testing framework, +# and set some variables for conditional compilation of the test suite by +# automake. +# +# If available, JUNIT is set to a command launching the text based user +# interface of Junit, @JAVA_JUNIT@ is set to $JAVA_JUNIT and @TESTS_JUNIT@ +# is set to $TESTS_JUNIT, otherwise they are set to empty values. +# +# You can use these variables in your Makefile.am file like this : +# +# # Some of the following classes are built only if junit is available +# JAVA_JUNIT = Class1Test.java Class2Test.java AllJunitTests.java +# +# noinst_JAVA = Example1.java Example2.java @JAVA_JUNIT@ +# +# EXTRA_JAVA = $(JAVA_JUNIT) +# +# TESTS_JUNIT = AllJunitTests +# +# TESTS = StandaloneTest1 StandaloneTest2 @TESTS_JUNIT@ +# +# EXTRA_TESTS = $(TESTS_JUNIT) +# +# AllJunitTests : +# echo "#! /bin/sh" > $@ +# echo "exec @JUNIT@ my.package.name.AllJunitTests" >> $@ +# chmod +x $@ +# +# LICENSE +# +# Copyright (c) 2008 Luc Maisonobe +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 5 + +AU_ALIAS([AC_CHECK_JUNIT], [AX_CHECK_JUNIT]) +AC_DEFUN([AX_CHECK_JUNIT],[ +AC_CACHE_VAL(ac_cv_prog_JUNIT,[ +AC_CHECK_CLASS(junit.textui.TestRunner) +if test x"`eval 'echo $ac_cv_class_junit_textui_TestRunner'`" != xno ; then + ac_cv_prog_JUNIT='$(CLASSPATH_ENV) $(JAVA) $(JAVAFLAGS) junit.textui.TestRunner' +fi]) +AC_MSG_CHECKING([for junit]) +if test x"`eval 'echo $ac_cv_prog_JUNIT'`" != x ; then + JUNIT="$ac_cv_prog_JUNIT" + JAVA_JUNIT='$(JAVA_JUNIT)' + TESTS_JUNIT='$(TESTS_JUNIT)' +else + JUNIT= + JAVA_JUNIT= + TESTS_JUNIT= +fi +AC_MSG_RESULT($JAVA_JUNIT) +AC_SUBST(JUNIT) +AC_SUBST(JAVA_JUNIT) +AC_SUBST(TESTS_JUNIT)]) diff --git a/m4/ax_check_rqrd_class.m4 b/m4/ax_check_rqrd_class.m4 new file mode 100644 index 0000000..8f14241 --- /dev/null +++ b/m4/ax_check_rqrd_class.m4 @@ -0,0 +1,62 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_rqrd_class.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_RQRD_CLASS +# +# DESCRIPTION +# +# AX_CHECK_RQRD_CLASS tests the existence of a given Java class, either in +# a jar or in a '.class' file and fails if it doesn't exist. Its success +# or failure can depend on a proper setting of the CLASSPATH env. +# variable. +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Stephane Bortzmeyer +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 5 + +AU_ALIAS([AC_CHECK_RQRD_CLASS], [AX_CHECK_RQRD_CLASS]) +AC_DEFUN([AX_CHECK_RQRD_CLASS],[ +CLASS=`echo $1|sed 's/\./_/g'` +AC_CHECK_CLASS($1) +if test "$HAVE_LAST_CLASS" = "no"; then + AC_MSG_ERROR([Required class $1 missing, exiting.]) +fi +]) diff --git a/m4/ax_java_check_class.m4 b/m4/ax_java_check_class.m4 new file mode 100644 index 0000000..917638a --- /dev/null +++ b/m4/ax_java_check_class.m4 @@ -0,0 +1,85 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_java_check_class.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_JAVA_CHECK_CLASS(,,) +# +# DESCRIPTION +# +# Test if a Java class is available. Based on AX_PROG_JAVAC_WORKS. This +# version uses a cache variable which is both compiler, options and +# classpath dependent (so if you switch from javac to gcj it correctly +# notices and redoes the test). +# +# The macro tries to compile a minimal program importing . Some +# newer compilers moan about the failure to use this but fail or produce a +# class file anyway. All moaing is sunk to /dev/null since I only wanted +# to know if the class could be imported. This is a recommended followup +# to AX_CHECK_JAVA_PLUGIN with classpath appropriately adjusted. +# +# LICENSE +# +# Copyright (c) 2008 Duncan Simpson +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 9 + +AU_ALIAS([DPS_JAVA_CHECK_CLASS], [AX_JAVA_CHECK_CLASS]) +AC_DEFUN([AX_JAVA_CHECK_CLASS],[ +m4_define([cache_val],[m4_translit(ax_cv_have_java_class_$1, " ." ,"__")]) +if test "x$CLASSPATH" != "x"; then +xtra=" with classpath ${CLASSPATH}" +xopts=`echo ${CLASSPATH} | ${SED} 's/^ *://'` +xopts="-classpath $xopts" +else xtra=""; xopts=""; fi +cache_var="cache_val"AS_TR_SH([_Jc_${JAVAC}_Cp_${CLASSPATH}]) +AC_CACHE_CHECK([if the $1 class is available$xtra], [$cache_var], [ +JAVA_TEST=Test.java +CLASS_TEST=Test.class +cat << \EOF > $JAVA_TEST +/* [#]xline __oline__ "configure" */ +import $1; +public class Test { +} +EOF +if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $xopts $JAVA_TEST) >/dev/null 2>&1; then + eval "${cache_var}=yes" +else + eval "${cache_var}=no" + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat $JAVA_TEST >&AS_MESSAGE_LOG_FD +fi +rm -f $JAVA_TEST $CLASS_TEST +]) +if eval 'test "x$'${cache_var}'" = "xyes"'; then +$2 +true; else +$3 +false; fi]) diff --git a/m4/ax_java_options.m4 b/m4/ax_java_options.m4 new file mode 100644 index 0000000..36c10d9 --- /dev/null +++ b/m4/ax_java_options.m4 @@ -0,0 +1,48 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_java_options.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_JAVA_OPTIONS +# +# DESCRIPTION +# +# AX_JAVA_OPTIONS adds configure command line options used for Java m4 +# macros. This Macro is optional. +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Devin Weaver +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 6 + +AU_ALIAS([AC_JAVA_OPTIONS], [AX_JAVA_OPTIONS]) +AC_DEFUN([AX_JAVA_OPTIONS],[ +AC_ARG_WITH(java-prefix, + [ --with-java-prefix=PFX prefix where Java runtime is installed (optional)]) +AC_ARG_WITH(javac-flags, + [ --with-javac-flags=FLAGS flags to pass to the Java compiler (optional)]) +AC_ARG_WITH(java-flags, + [ --with-java-flags=FLAGS flags to pass to the Java VM (optional)]) +JAVAPREFIX=$with_java_prefix +JAVACFLAGS=$with_javac_flags +JAVAFLAGS=$with_java_flags +AC_SUBST(JAVAPREFIX)dnl +AC_SUBST(JAVACFLAGS)dnl +AC_SUBST(JAVAFLAGS)dnl +AC_SUBST(JAVA)dnl +AC_SUBST(JAVAC)dnl +]) diff --git a/m4/ax_jni_include_dir.m4 b/m4/ax_jni_include_dir.m4 new file mode 100644 index 0000000..becb33a --- /dev/null +++ b/m4/ax_jni_include_dir.m4 @@ -0,0 +1,132 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_jni_include_dir.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_JNI_INCLUDE_DIR +# +# DESCRIPTION +# +# AX_JNI_INCLUDE_DIR finds include directories needed for compiling +# programs using the JNI interface. +# +# JNI include directories are usually in the Java distribution. This is +# deduced from the value of $JAVA_HOME, $JAVAC, or the path to "javac", in +# that order. When this macro completes, a list of directories is left in +# the variable JNI_INCLUDE_DIRS. +# +# Example usage follows: +# +# AX_JNI_INCLUDE_DIR +# +# for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS +# do +# CPPFLAGS="$CPPFLAGS -I$JNI_INCLUDE_DIR" +# done +# +# If you want to force a specific compiler: +# +# - at the configure.in level, set JAVAC=yourcompiler before calling +# AX_JNI_INCLUDE_DIR +# +# - at the configure level, setenv JAVAC +# +# Note: This macro can work with the autoconf M4 macros for Java programs. +# This particular macro is not part of the original set of macros. +# +# LICENSE +# +# Copyright (c) 2008 Don Anderson +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 11 + +AU_ALIAS([AC_JNI_INCLUDE_DIR], [AX_JNI_INCLUDE_DIR]) +AC_DEFUN([AX_JNI_INCLUDE_DIR],[ + +JNI_INCLUDE_DIRS="" + +if test "x$JAVA_HOME" != x; then + _JTOPDIR="$JAVA_HOME" +else + if test "x$JAVAC" = x; then + JAVAC=javac + fi + AC_PATH_PROG([_ACJNI_JAVAC], [$JAVAC], [no]) + if test "x$_ACJNI_JAVAC" = xno; then + AC_MSG_ERROR([cannot find JDK; try setting \$JAVAC or \$JAVA_HOME]) + fi + _ACJNI_FOLLOW_SYMLINKS("$_ACJNI_JAVAC") + _JTOPDIR=`echo "$_ACJNI_FOLLOWED" | sed -e 's://*:/:g' -e 's:/[[^/]]*$::'` +fi + +case "$host_os" in + darwin*) # Apple JDK is at /System location and has headers symlinked elsewhere + case "$_JTOPDIR" in + /System/Library/Frameworks/JavaVM.framework/*) + _JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` + _JINC="$_JTOPDIR/Headers";; + *) _JINC="$_JTOPDIR/include";; + esac;; + *) _JINC="$_JTOPDIR/include";; +esac +_AS_ECHO_LOG([_JTOPDIR=$_JTOPDIR]) +_AS_ECHO_LOG([_JINC=$_JINC]) + +# On Mac OS X 10.6.4, jni.h is a symlink: +# /System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/jni.h +# -> ../../CurrentJDK/Headers/jni.h. +AC_CHECK_FILE([$_JINC/jni.h], + [JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JINC"], + [_JTOPDIR=`echo "$_JTOPDIR" | sed -e 's:/[[^/]]*$::'` + AC_CHECK_FILE([$_JTOPDIR/include/jni.h], + [JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include"], + AC_MSG_ERROR([cannot find JDK header files])) + ]) + +# get the likely subdirectories for system specific java includes +case "$host_os" in +bsdi*) _JNI_INC_SUBDIRS="bsdos";; +freebsd*) _JNI_INC_SUBDIRS="freebsd";; +darwin*) _JNI_INC_SUBDIRS="darwin";; +linux*) _JNI_INC_SUBDIRS="linux genunix";; +osf*) _JNI_INC_SUBDIRS="alpha";; +solaris*) _JNI_INC_SUBDIRS="solaris";; +mingw*) _JNI_INC_SUBDIRS="win32";; +cygwin*) _JNI_INC_SUBDIRS="win32";; +*) _JNI_INC_SUBDIRS="genunix";; +esac + +# add any subdirectories that are present +for JINCSUBDIR in $_JNI_INC_SUBDIRS +do + if test -d "$_JTOPDIR/include/$JINCSUBDIR"; then + JNI_INCLUDE_DIRS="$JNI_INCLUDE_DIRS $_JTOPDIR/include/$JINCSUBDIR" + fi +done +]) + +# _ACJNI_FOLLOW_SYMLINKS +# Follows symbolic links on , +# finally setting variable _ACJNI_FOLLOWED +# ---------------------------------------- +AC_DEFUN([_ACJNI_FOLLOW_SYMLINKS],[ +# find the include directory relative to the javac executable +_cur="$1" +while ls -ld "$_cur" 2>/dev/null | grep " -> " >/dev/null; do + AC_MSG_CHECKING([symlink for $_cur]) + _slink=`ls -ld "$_cur" | sed 's/.* -> //'` + case "$_slink" in + /*) _cur="$_slink";; + # 'X' avoids triggering unwanted echo options. + *) _cur=`echo "X$_cur" | sed -e 's/^X//' -e 's:[[^/]]*$::'`"$_slink";; + esac + AC_MSG_RESULT([$_cur]) +done +_ACJNI_FOLLOWED="$_cur" +])# _ACJNI diff --git a/m4/ax_prog_jar.m4 b/m4/ax_prog_jar.m4 new file mode 100644 index 0000000..3c60fca --- /dev/null +++ b/m4/ax_prog_jar.m4 @@ -0,0 +1,49 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_prog_jar.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAR +# +# DESCRIPTION +# +# AX_PROG_JAR tests for an existing jar program. It uses the environment +# variable JAR then tests in sequence various common jar programs. +# +# If you want to force a specific compiler: +# +# - at the configure.in level, set JAR=yourcompiler before calling +# AX_PROG_JAR +# +# - at the configure level, setenv JAR +# +# You can use the JAR variable in your Makefile.in, with @JAR@. +# +# Note: This macro depends on the autoconf M4 macros for Java programs. It +# is VERY IMPORTANT that you download that whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. +# +# The general documentation of those macros, as well as the sample +# configure.in, is included in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Egon Willighagen +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 7 + +AU_ALIAS([AC_PROG_JAR], [AX_PROG_JAR]) +AC_DEFUN([AX_PROG_JAR],[ +AS_IF([test "x$JAVAPREFIX" = x], + [test "x$JAR" = x && AC_CHECK_PROGS([JAR], [jar])], + [test "x$JAR" = x && AC_CHECK_PROGS([JAR], [jar], [], [$JAVAPREFIX/bin])]) +test "x$JAR" = x && AC_MSG_ERROR([no acceptable jar program found in \$PATH]) +AC_PROVIDE([$0])dnl +]) diff --git a/m4/ax_prog_java.m4 b/m4/ax_prog_java.m4 new file mode 100644 index 0000000..03961db --- /dev/null +++ b/m4/ax_prog_java.m4 @@ -0,0 +1,115 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_prog_java.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAVA +# +# DESCRIPTION +# +# Here is a summary of the main macros: +# +# AX_PROG_JAVAC: finds a Java compiler. +# +# AX_PROG_JAVA: finds a Java virtual machine. +# +# AX_CHECK_CLASS: finds if we have the given class (beware of CLASSPATH!). +# +# AX_CHECK_RQRD_CLASS: finds if we have the given class and stops +# otherwise. +# +# AX_TRY_COMPILE_JAVA: attempt to compile user given source. +# +# AX_TRY_RUN_JAVA: attempt to compile and run user given source. +# +# AX_JAVA_OPTIONS: adds Java configure options. +# +# AX_PROG_JAVA tests an existing Java virtual machine. It uses the +# environment variable JAVA then tests in sequence various common Java +# virtual machines. For political reasons, it starts with the free ones. +# You *must* call [AX_PROG_JAVAC] before. +# +# If you want to force a specific VM: +# +# - at the configure.in level, set JAVA=yourvm before calling AX_PROG_JAVA +# +# (but after AC_INIT) +# +# - at the configure level, setenv JAVA +# +# You can use the JAVA variable in your Makefile.in, with @JAVA@. +# +# *Warning*: its success or failure can depend on a proper setting of the +# CLASSPATH env. variable. +# +# TODO: allow to exclude virtual machines (rationale: most Java programs +# cannot run with some VM like kaffe). +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. +# +# A Web page, with a link to the latest CVS snapshot is at +# . +# +# This is a sample configure.in Process this file with autoconf to produce +# a configure script. +# +# AC_INIT(UnTag.java) +# +# dnl Checks for programs. +# AC_CHECK_CLASSPATH +# AX_PROG_JAVAC +# AX_PROG_JAVA +# +# dnl Checks for classes +# AX_CHECK_RQRD_CLASS(org.xml.sax.Parser) +# AX_CHECK_RQRD_CLASS(com.jclark.xml.sax.Driver) +# +# AC_OUTPUT(Makefile) +# +# LICENSE +# +# Copyright (c) 2008 Stephane Bortzmeyer +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 9 + +AU_ALIAS([AC_PROG_JAVA], [AX_PROG_JAVA]) +AC_DEFUN([AX_PROG_JAVA],[ +m4_define([m4_ax_prog_java_list], [kaffe java])dnl +AS_IF([test "x$JAVAPREFIX" = x], + [test x$JAVA = x && AC_CHECK_PROGS([JAVA], [m4_ax_prog_java_list])], + [test x$JAVA = x && AC_CHECK_PROGS([JAVA], [m4_ax_prog_java_list], [], [$JAVAPREFIX/bin])]) +test x$JAVA = x && AC_MSG_ERROR([no acceptable Java virtual machine found in \$PATH]) +m4_undefine([m4_ax_prog_java_list])dnl +AX_PROG_JAVA_WORKS +AC_PROVIDE([$0])dnl +]) diff --git a/m4/ax_prog_java_cc.m4 b/m4/ax_prog_java_cc.m4 new file mode 100644 index 0000000..3df064f --- /dev/null +++ b/m4/ax_prog_java_cc.m4 @@ -0,0 +1,104 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_prog_java_cc.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAVA_CC +# +# DESCRIPTION +# +# Finds the appropriate java compiler on your path. By preference the java +# compiler is gcj, then jikes then javac. +# +# The macro can take one argument specifying a space separated list of +# java compiler names. +# +# For example: +# +# AX_PROG_JAVA_CC(javac, gcj) +# +# The macro also sets the compiler options variable: JAVA_CC_OPTS to +# something sensible: +# +# - for GCJ it sets it to: @GCJ_OPTS@ +# (if GCJ_OPTS is not yet defined then it is set to "-C") +# +# - no other compiler has applicable options yet +# +# Here's an example configure.in: +# +# AC_INIT(Makefile.in) +# AX_PROG_JAVA_CC() +# AC_OUTPUT(Makefile) +# dnl End. +# +# And here's the start of the Makefile.in: +# +# PROJECT_ROOT := @srcdir@ +# # Tool definitions. +# JAVAC := @JAVA_CC@ +# JAVAC_OPTS := @JAVA_CC_OPTS@ +# JAR_TOOL := @jar_tool@ +# +# LICENSE +# +# Copyright (c) 2008 Nic Ferrier +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 4 + +# AX_PROG_JAVA_CC([COMPILER ...]) +# -------------------------- +# COMPILER ... is a space separated list of java compilers to search for. +# This just gives the user an opportunity to specify an alternative +# search list for the java compiler. +AU_ALIAS([AC_PROG_JAVA_CC], [AX_PROG_JAVA_CC]) +AC_DEFUN([AX_PROG_JAVA_CC], +[AC_ARG_VAR([JAVA_CC], [java compiler command])dnl +AC_ARG_VAR([JAVA_CC_FLAGS], [java compiler flags])dnl +m4_ifval([$1], + [AC_CHECK_TOOLS(JAVA_CC, [$1])], +[AC_CHECK_TOOL(JAVA_CC, gcj) +if test -z "$JAVA_CC"; then + AC_CHECK_TOOL(JAVA_CC, javac) +fi +if test -z "$JAVA_CC"; then + AC_CHECK_TOOL(JAVA_CC, jikes) +fi +]) + +if test "$JAVA_CC" = "gcj"; then + if test "$GCJ_OPTS" = ""; then + AC_SUBST(GCJ_OPTS,-C) + fi + AC_SUBST(JAVA_CC_OPTS, @GCJ_OPTS@, + [Define the compilation options for GCJ]) +fi +test -z "$JAVA_CC" && AC_MSG_ERROR([no acceptable java compiler found in \$PATH]) +])# AX_PROG_JAVA_CC diff --git a/m4/ax_prog_java_works.m4 b/m4/ax_prog_java_works.m4 new file mode 100644 index 0000000..54e132a --- /dev/null +++ b/m4/ax_prog_java_works.m4 @@ -0,0 +1,134 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_prog_java_works.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAVA_WORKS +# +# DESCRIPTION +# +# Internal use ONLY. +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Stephane Bortzmeyer +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 9 + +AU_ALIAS([AC_PROG_JAVA_WORKS], [AX_PROG_JAVA_WORKS]) +AC_DEFUN([AX_PROG_JAVA_WORKS], [ +AC_PATH_PROG(UUDECODE, uudecode, [no]) +if test x$UUDECODE != xno; then +AC_CACHE_CHECK([if uudecode can decode base 64 file], ac_cv_prog_uudecode_base64, [ +dnl /** +dnl * Test.java: used to test if java compiler works. +dnl */ +dnl public class Test +dnl { +dnl +dnl public static void +dnl main( String[] argv ) +dnl { +dnl System.exit (0); +dnl } +dnl +dnl } +cat << \EOF > Test.uue +begin-base64 644 Test.class +yv66vgADAC0AFQcAAgEABFRlc3QHAAQBABBqYXZhL2xhbmcvT2JqZWN0AQAE +bWFpbgEAFihbTGphdmEvbGFuZy9TdHJpbmc7KVYBAARDb2RlAQAPTGluZU51 +bWJlclRhYmxlDAAKAAsBAARleGl0AQAEKEkpVgoADQAJBwAOAQAQamF2YS9s +YW5nL1N5c3RlbQEABjxpbml0PgEAAygpVgwADwAQCgADABEBAApTb3VyY2VG +aWxlAQAJVGVzdC5qYXZhACEAAQADAAAAAAACAAkABQAGAAEABwAAACEAAQAB +AAAABQO4AAyxAAAAAQAIAAAACgACAAAACgAEAAsAAQAPABAAAQAHAAAAIQAB +AAEAAAAFKrcAErEAAAABAAgAAAAKAAIAAAAEAAQABAABABMAAAACABQ= +==== +EOF +if $UUDECODE Test.uue; then + ac_cv_prog_uudecode_base64=yes +else + echo "configure: __oline__: uudecode had trouble decoding base 64 file 'Test.uue'" >&AS_MESSAGE_LOG_FD + echo "configure: failed file was:" >&AS_MESSAGE_LOG_FD + cat Test.uue >&AS_MESSAGE_LOG_FD + ac_cv_prog_uudecode_base64=no +fi +rm -f Test.uue]) +fi +if test x$ac_cv_prog_uudecode_base64 != xyes; then + rm -f Test.class + AC_MSG_WARN([I have to compile Test.class from scratch]) + if test x$ac_cv_prog_javac_works = xno; then + AC_MSG_ERROR([Cannot compile java source. $JAVAC does not work properly]) + fi + if test x$ac_cv_prog_javac_works = x; then + AX_PROG_JAVAC + fi +fi +AC_CACHE_CHECK(if $JAVA works, ac_cv_prog_java_works, [ +JAVA_TEST=Test.java +CLASS_TEST=Test.class +TEST=Test +changequote(, )dnl +cat << \EOF > $JAVA_TEST +/* [#]line __oline__ "configure" */ +public class Test { +public static void main (String args[]) { + System.exit (0); +} } +EOF +changequote([, ])dnl +if test x$ac_cv_prog_uudecode_base64 != xyes; then + if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) && test -s $CLASS_TEST; then + : + else + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat $JAVA_TEST >&AS_MESSAGE_LOG_FD + AC_MSG_ERROR(The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)) + fi +fi +if AC_TRY_COMMAND($JAVA -classpath . $JAVAFLAGS $TEST) >/dev/null 2>&1; then + ac_cv_prog_java_works=yes +else + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat $JAVA_TEST >&AS_MESSAGE_LOG_FD + AC_MSG_ERROR(The Java VM $JAVA failed (see config.log, check the CLASSPATH?)) +fi +rm -fr $JAVA_TEST $CLASS_TEST Test.uue +]) +AC_PROVIDE([$0])dnl +] +) diff --git a/m4/ax_prog_javac.m4 b/m4/ax_prog_javac.m4 new file mode 100644 index 0000000..d061243 --- /dev/null +++ b/m4/ax_prog_javac.m4 @@ -0,0 +1,79 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_prog_javac.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAVAC +# +# DESCRIPTION +# +# AX_PROG_JAVAC tests an existing Java compiler. It uses the environment +# variable JAVAC then tests in sequence various common Java compilers. For +# political reasons, it starts with the free ones. +# +# If you want to force a specific compiler: +# +# - at the configure.in level, set JAVAC=yourcompiler before calling +# AX_PROG_JAVAC +# +# - at the configure level, setenv JAVAC +# +# You can use the JAVAC variable in your Makefile.in, with @JAVAC@. +# +# *Warning*: its success or failure can depend on a proper setting of the +# CLASSPATH env. variable. +# +# TODO: allow to exclude compilers (rationale: most Java programs cannot +# compile with some compilers like guavac). +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Stephane Bortzmeyer +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 7 + +AU_ALIAS([AC_PROG_JAVAC], [AX_PROG_JAVAC]) +AC_DEFUN([AX_PROG_JAVAC],[ +m4_define([m4_ax_prog_javac_list],["gcj -C" guavac jikes javac])dnl +AS_IF([test "x$JAVAPREFIX" = x], + [test "x$JAVAC" = x && AC_CHECK_PROGS([JAVAC], [m4_ax_prog_javac_list])], + [test "x$JAVAC" = x && AC_CHECK_PROGS([JAVAC], [m4_ax_prog_javac_list], [], [$JAVAPREFIX/bin])]) +m4_undefine([m4_ax_prog_javac_list])dnl +test "x$JAVAC" = x && AC_MSG_ERROR([no acceptable Java compiler found in \$PATH]) +AX_PROG_JAVAC_WORKS +AC_PROVIDE([$0])dnl +]) diff --git a/m4/ax_prog_javac_works.m4 b/m4/ax_prog_javac_works.m4 new file mode 100644 index 0000000..7dfa1e3 --- /dev/null +++ b/m4/ax_prog_javac_works.m4 @@ -0,0 +1,72 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_prog_javac_works.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAVAC_WORKS +# +# DESCRIPTION +# +# Internal use ONLY. +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Stephane Bortzmeyer +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 2 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 6 + +AU_ALIAS([AC_PROG_JAVAC_WORKS], [AX_PROG_JAVAC_WORKS]) +AC_DEFUN([AX_PROG_JAVAC_WORKS],[ +AC_CACHE_CHECK([if $JAVAC works], ac_cv_prog_javac_works, [ +JAVA_TEST=Test.java +CLASS_TEST=Test.class +cat << \EOF > $JAVA_TEST +/* [#]line __oline__ "configure" */ +public class Test { +} +EOF +if AC_TRY_COMMAND($JAVAC $JAVACFLAGS $JAVA_TEST) >/dev/null 2>&1; then + ac_cv_prog_javac_works=yes +else + AC_MSG_ERROR([The Java compiler $JAVAC failed (see config.log, check the CLASSPATH?)]) + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat $JAVA_TEST >&AS_MESSAGE_LOG_FD +fi +rm -f $JAVA_TEST $CLASS_TEST +]) +AC_PROVIDE([$0])dnl +]) diff --git a/m4/ax_prog_javadoc.m4 b/m4/ax_prog_javadoc.m4 new file mode 100644 index 0000000..bcb6045 --- /dev/null +++ b/m4/ax_prog_javadoc.m4 @@ -0,0 +1,50 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_prog_javadoc.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAVADOC +# +# DESCRIPTION +# +# AX_PROG_JAVADOC tests for an existing javadoc generator. It uses the +# environment variable JAVADOC then tests in sequence various common +# javadoc generator. +# +# If you want to force a specific compiler: +# +# - at the configure.in level, set JAVADOC=yourgenerator before calling +# AX_PROG_JAVADOC +# +# - at the configure level, setenv JAVADOC +# +# You can use the JAVADOC variable in your Makefile.in, with @JAVADOC@. +# +# Note: This macro depends on the autoconf M4 macros for Java programs. It +# is VERY IMPORTANT that you download that whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. +# +# The general documentation of those macros, as well as the sample +# configure.in, is included in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Egon Willighagen +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 8 + +AU_ALIAS([AC_PROG_JAVADOC], [AX_PROG_JAVADOC]) +AC_DEFUN([AX_PROG_JAVADOC],[ +AS_IF([test "x$JAVAPREFIX" = x], + [test "x$JAVADOC" = x && AC_CHECK_PROGS([JAVADOC], [javadoc])], + [test "x$JAVADOC" = x && AC_CHECK_PROGS([JAVADOC], [javadoc], [], [$JAVAPREFIX/bin])]) +test "x$JAVADOC" = x && AC_MSG_ERROR([no acceptable javadoc generator found in \$PATH]) +AC_PROVIDE([$0])dnl +]) diff --git a/m4/ax_prog_javah.m4 b/m4/ax_prog_javah.m4 new file mode 100644 index 0000000..cefc616 --- /dev/null +++ b/m4/ax_prog_javah.m4 @@ -0,0 +1,64 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_prog_javah.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_PROG_JAVAH +# +# DESCRIPTION +# +# AX_PROG_JAVAH tests the availability of the javah header generator and +# looks for the jni.h header file. If available, JAVAH is set to the full +# path of javah and CPPFLAGS is updated accordingly. +# +# LICENSE +# +# Copyright (c) 2008 Luc Maisonobe +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 8 + +AU_ALIAS([AC_PROG_JAVAH], [AX_PROG_JAVAH]) +AC_DEFUN([AX_PROG_JAVAH],[ +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_CPP])dnl +AC_PATH_PROG(JAVAH,javah) +AS_IF([test -n "$ac_cv_path_JAVAH"], + [ + AC_TRY_CPP([#include ],,[ + ac_save_CPPFLAGS="$CPPFLAGS" + _ACJAVAH_FOLLOW_SYMLINKS("$ac_cv_path_JAVAH") + ax_prog_javah_bin_dir=`AS_DIRNAME([$_ACJAVAH_FOLLOWED])` + ac_dir="`AS_DIRNAME([$ax_prog_javah_bin_dir])`/include" + AS_CASE([$build_os], + [cygwin*], + [ac_machdep=win32], + [ac_machdep=`AS_ECHO($build_os) | sed 's,[[-0-9]].*,,'`]) + CPPFLAGS="$ac_save_CPPFLAGS -I$ac_dir -I$ac_dir/$ac_machdep" + AC_TRY_CPP([#include ], + ac_save_CPPFLAGS="$CPPFLAGS", + AC_MSG_WARN([unable to include ])) + CPPFLAGS="$ac_save_CPPFLAGS"]) + ]) +]) + +AC_DEFUN([_ACJAVAH_FOLLOW_SYMLINKS],[ +# find the include directory relative to the javac executable +_cur="$1" +while ls -ld "$_cur" 2>/dev/null | grep " -> " >/dev/null; do + AC_MSG_CHECKING([symlink for $_cur]) + _slink=`ls -ld "$_cur" | sed 's/.* -> //'` + case "$_slink" in + /*) _cur="$_slink";; + # 'X' avoids triggering unwanted echo options. + *) _cur=`echo "X$_cur" | sed -e 's/^X//' -e 's:[[^/]]*$::'`"$_slink";; + esac + AC_MSG_RESULT([$_cur]) +done +_ACJAVAH_FOLLOWED="$_cur" +]) diff --git a/m4/ax_try_compile_java.m4 b/m4/ax_try_compile_java.m4 new file mode 100644 index 0000000..a8ed6b2 --- /dev/null +++ b/m4/ax_try_compile_java.m4 @@ -0,0 +1,55 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_try_compile_java.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_TRY_COMPILE_JAVA +# +# DESCRIPTION +# +# AX_TRY_COMPILE_JAVA attempt to compile user given source. +# +# *Warning*: its success or failure can depend on a proper setting of the +# CLASSPATH env. variable. +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Devin Weaver +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 8 + +AU_ALIAS([AC_TRY_COMPILE_JAVA], [AX_TRY_COMPILE_JAVA]) +AC_DEFUN([AX_TRY_COMPILE_JAVA],[ +AC_REQUIRE([AX_PROG_JAVAC])dnl +cat << \EOF > Test.java +/* [#]line __oline__ "configure" */ +ifelse([$1], , , [import $1;]) +public class Test { +[$2] +} +EOF +if AC_TRY_COMMAND($JAVAC $JAVACFLAGS Test.java) && test -s Test.class +then +dnl Don't remove the temporary files here, so they can be examined. + ifelse([$3], , :, [$3]) +else + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat Test.java >&AS_MESSAGE_LOG_FD +ifelse([$4], , , [ rm -fr Test.java Test.class + $4 +])dnl +fi +rm -fr Test.java Test.class]) diff --git a/m4/ax_try_run_java.m4 b/m4/ax_try_run_java.m4 new file mode 100644 index 0000000..c680f03 --- /dev/null +++ b/m4/ax_try_run_java.m4 @@ -0,0 +1,56 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_try_run_java.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_TRY_RUN_JAVA +# +# DESCRIPTION +# +# AX_TRY_RUN_JAVA attempt to compile and run user given source. +# +# *Warning*: its success or failure can depend on a proper setting of the +# CLASSPATH env. variable. +# +# Note: This is part of the set of autoconf M4 macros for Java programs. +# It is VERY IMPORTANT that you download the whole set, some macros depend +# on other. Unfortunately, the autoconf archive does not support the +# concept of set of macros, so I had to break it for submission. The +# general documentation, as well as the sample configure.in, is included +# in the AX_PROG_JAVA macro. +# +# LICENSE +# +# Copyright (c) 2008 Devin Weaver +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 2 + +AU_ALIAS([AC_TRY_RUN_JAVA], [AX_TRY_RUN_JAVA]) +AC_DEFUN([AX_TRY_RUN_JAVA],[ +AC_REQUIRE([AX_PROG_JAVAC])dnl +AC_REQUIRE([AX_PROG_JAVA])dnl +cat << \EOF > Test.java +/* [#]line __oline__ "configure" */ +ifelse([$1], , , [include $1;]) +public class Test { +[$2] +} +EOF +if AC_TRY_COMMAND($JAVAC $JAVACFLAGS Test.java) && test -s Test.class && ($JAVA $JAVAFLAGS Test; exit) 2>/dev/null +then +dnl Don't remove the temporary files here, so they can be examined. + ifelse([$3], , :, [$3]) +else + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat Test.java >&AS_MESSAGE_LOG_FD +ifelse([$4], , , [ rm -fr Test.java Test.class + $4 +])dnl +fi +rm -fr Test.java Test.class]) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3647eb9..7413e28 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -894,7 +894,7 @@ if (BUILD_SHARED_LIBS) target_link_libraries (${HDF5_LIBSH_TARGET} ${MPI_C_LIBRARIES}) endif (H5_HAVE_PARALLEL AND MPI_C_FOUND) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_LIBSH_TARGET}") - H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED) + H5_SET_LIB_OPTIONS (${HDF5_LIBSH_TARGET} ${HDF5_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) set_target_properties (${HDF5_LIBSH_TARGET} PROPERTIES FOLDER libraries COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB" diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index 3bb2936..b54257f 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -60,6 +60,9 @@ Languages: @BUILD_CXX_CONDITIONAL_TRUE@ Shared C++ Library: @enable_shared@ @BUILD_CXX_CONDITIONAL_TRUE@ Static C++ Library: @enable_static@ + JAVA: @HDF_JAVA@ +@BUILD_JAVA_CONDITIONAL_TRUE@ JAVA Compiler: @JAVA_VERSION@ + Features: --------- Parallel HDF5: @PARALLEL@ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d2dd282..789844f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -51,7 +51,7 @@ if (BUILD_SHARED_LIBS) target_link_libraries (${HDF5_TEST_LIBSH_TARGET} "wsock32.lib") endif (MINGW) target_link_libraries (${HDF5_TEST_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) - H5_SET_LIB_OPTIONS (${HDF5_TEST_LIBSH_TARGET} ${HDF5_TEST_LIB_NAME} SHARED) + H5_SET_LIB_OPTIONS (${HDF5_TEST_LIBSH_TARGET} ${HDF5_TEST_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) set_target_properties (${HDF5_TEST_LIBSH_TARGET} PROPERTIES FOLDER libraries/test COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB" @@ -96,7 +96,7 @@ endif (BUILD_SHARED_LIBS) target_link_libraries (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) H5_SET_LIB_OPTIONS ( ${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_PLUGIN_LIB_NAME} - SHARED + SHARED ${HDF5_PACKAGE_SOVERSION} HDF5_TEST_PLUGIN_LIB_NAME_RELEASE HDF5_TEST_PLUGIN_LIB_NAME_DEBUG ) @@ -127,7 +127,7 @@ endif (BUILD_SHARED_LIBS) target_link_libraries (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) H5_SET_LIB_OPTIONS ( ${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_PLUGIN_LIB_NAME} - SHARED + SHARED ${HDF5_PACKAGE_SOVERSION} HDF5_TEST_PLUGIN_LIB_NAME_RELEASE HDF5_TEST_PLUGIN_LIB_NAME_DEBUG ) -- cgit v0.12 From 198ceb5fcc2bc9fd9893bf5905e6fc352c3d6d0a Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Sun, 28 Feb 2016 21:45:23 -0500 Subject: [svn-r29227] HDFFV-9552: merge in java code. new files added. --- java/src/hdf/hdf5lib/callbacks/H5A_iterate_cb.java | 23 + java/src/hdf/hdf5lib/callbacks/H5A_iterate_t.java | 22 + java/src/hdf/hdf5lib/callbacks/H5E_walk_cb.java | 23 + java/src/hdf/hdf5lib/callbacks/H5E_walk_t.java | 22 + .../hdf5lib/callbacks/H5P_cls_close_func_cb.java | 21 + .../hdf5lib/callbacks/H5P_cls_close_func_t.java | 22 + .../hdf5lib/callbacks/H5P_cls_copy_func_cb.java | 21 + .../hdf/hdf5lib/callbacks/H5P_cls_copy_func_t.java | 22 + .../hdf5lib/callbacks/H5P_cls_create_func_cb.java | 21 + .../hdf5lib/callbacks/H5P_cls_create_func_t.java | 22 + java/src/hdf/hdf5lib/callbacks/H5P_iterate_cb.java | 21 + java/src/hdf/hdf5lib/callbacks/H5P_iterate_t.java | 22 + .../hdf5lib/callbacks/H5P_prp_close_func_cb.java | 21 + .../hdf5lib/callbacks/H5P_prp_compare_func_cb.java | 21 + .../hdf5lib/callbacks/H5P_prp_copy_func_cb.java | 21 + .../hdf5lib/callbacks/H5P_prp_create_func_cb.java | 21 + .../hdf5lib/callbacks/H5P_prp_delete_func_cb.java | 21 + .../hdf/hdf5lib/callbacks/H5P_prp_get_func_cb.java | 21 + .../hdf/hdf5lib/callbacks/H5P_prp_set_func_cb.java | 21 + java/src/hdf/hdf5lib/structs/H5E_error2_t.java | 41 + java/src/hdf/hdf5lib/structs/H5F_info2_t.java | 47 + java/src/jni/h5plImp.c | 64 ++ java/src/jni/h5plImp.h | 46 + java/test/TestH5PL.java | 61 ++ java/test/TestH5Plist.java | 1013 ++++++++++++++++++++ java/test/TestH5Pvirtual.java | 433 +++++++++ 26 files changed, 2114 insertions(+) create mode 100644 java/src/hdf/hdf5lib/callbacks/H5A_iterate_cb.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5A_iterate_t.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5E_walk_cb.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5E_walk_t.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_cb.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_t.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_cb.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_t.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_cb.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_t.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5P_iterate_cb.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5P_iterate_t.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5P_prp_close_func_cb.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5P_prp_compare_func_cb.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5P_prp_copy_func_cb.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5P_prp_create_func_cb.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5P_prp_delete_func_cb.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5P_prp_get_func_cb.java create mode 100644 java/src/hdf/hdf5lib/callbacks/H5P_prp_set_func_cb.java create mode 100644 java/src/hdf/hdf5lib/structs/H5E_error2_t.java create mode 100644 java/src/hdf/hdf5lib/structs/H5F_info2_t.java create mode 100644 java/src/jni/h5plImp.c create mode 100644 java/src/jni/h5plImp.h create mode 100644 java/test/TestH5PL.java create mode 100644 java/test/TestH5Plist.java create mode 100644 java/test/TestH5Pvirtual.java diff --git a/java/src/hdf/hdf5lib/callbacks/H5A_iterate_cb.java b/java/src/hdf/hdf5lib/callbacks/H5A_iterate_cb.java new file mode 100644 index 0000000..fa390a2 --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5A_iterate_cb.java @@ -0,0 +1,23 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +import hdf.hdf5lib.structs.H5A_info_t; + +//Information class for link callback(for H5Aiterate) +public interface H5A_iterate_cb extends Callbacks { + int callback(long group, String name, H5A_info_t info, H5A_iterate_t op_data); +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5A_iterate_t.java b/java/src/hdf/hdf5lib/callbacks/H5A_iterate_t.java new file mode 100644 index 0000000..4816f8f --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5A_iterate_t.java @@ -0,0 +1,22 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +public interface H5A_iterate_t { +/** public ArrayList iterdata = new ArrayList(); + * Any derived interfaces must define the single public variable as above. + */ +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5E_walk_cb.java b/java/src/hdf/hdf5lib/callbacks/H5E_walk_cb.java new file mode 100644 index 0000000..672d151 --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5E_walk_cb.java @@ -0,0 +1,23 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +import hdf.hdf5lib.structs.H5E_error2_t; + +//Information class for link callback(for H5Ewalk) +public interface H5E_walk_cb extends Callbacks { + int callback(int nidx, H5E_error2_t info, H5E_walk_t op_data); +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5E_walk_t.java b/java/src/hdf/hdf5lib/callbacks/H5E_walk_t.java new file mode 100644 index 0000000..f3f8a39 --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5E_walk_t.java @@ -0,0 +1,22 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +public interface H5E_walk_t { +/** public ArrayList iterdata = new ArrayList(); + * Any derived interfaces must define the single public variable as above. + */ +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_cb.java new file mode 100644 index 0000000..dcd4ed2 --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_cb.java @@ -0,0 +1,21 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +//Information class for link callback(for H5Pcreate_class) +public interface H5P_cls_close_func_cb extends Callbacks { + int callback(long prop_id, H5P_cls_close_func_t close_data); +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_t.java b/java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_t.java new file mode 100644 index 0000000..222bd26 --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5P_cls_close_func_t.java @@ -0,0 +1,22 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +public interface H5P_cls_close_func_t { +/** public ArrayList iterdata = new ArrayList(); + * Any derived interfaces must define the single public variable as above. + */ +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_cb.java new file mode 100644 index 0000000..0dc8a94 --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_cb.java @@ -0,0 +1,21 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +//Information class for link callback(for H5Pcreate_class) +public interface H5P_cls_copy_func_cb extends Callbacks { + int callback(long new_prop_id, long old_prop_id, H5P_cls_copy_func_t copy_data); +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_t.java b/java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_t.java new file mode 100644 index 0000000..eed29bb --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5P_cls_copy_func_t.java @@ -0,0 +1,22 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +public interface H5P_cls_copy_func_t { +/** public ArrayList iterdata = new ArrayList(); + * Any derived interfaces must define the single public variable as above. + */ +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_cb.java new file mode 100644 index 0000000..777e302 --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_cb.java @@ -0,0 +1,21 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +//Information class for link callback(for H5Pcreate_class) +public interface H5P_cls_create_func_cb extends Callbacks { + int callback(long prop_id, H5P_cls_create_func_t create_data); +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_t.java b/java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_t.java new file mode 100644 index 0000000..78973f0 --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5P_cls_create_func_t.java @@ -0,0 +1,22 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +public interface H5P_cls_create_func_t { +/** public ArrayList iterdata = new ArrayList(); + * Any derived interfaces must define the single public variable as above. + */ +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_iterate_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_iterate_cb.java new file mode 100644 index 0000000..0d98325 --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5P_iterate_cb.java @@ -0,0 +1,21 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +//Information class for link callback(for H5Piterate) +public interface H5P_iterate_cb extends Callbacks { + int callback(long plist, String name, H5P_iterate_t op_data); +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_iterate_t.java b/java/src/hdf/hdf5lib/callbacks/H5P_iterate_t.java new file mode 100644 index 0000000..dbbf80d --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5P_iterate_t.java @@ -0,0 +1,22 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +public interface H5P_iterate_t { +/** public ArrayList iterdata = new ArrayList(); + * Any derived interfaces must define the single public variable as above. + */ +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_prp_close_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_prp_close_func_cb.java new file mode 100644 index 0000000..3ea44ac --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5P_prp_close_func_cb.java @@ -0,0 +1,21 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +//Information class for link callback(for H5Pregister2) +public interface H5P_prp_close_func_cb extends Callbacks { + int callback(String name, long size, byte[] value); +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_prp_compare_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_prp_compare_func_cb.java new file mode 100644 index 0000000..0daaca5 --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5P_prp_compare_func_cb.java @@ -0,0 +1,21 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +//Information class for link callback(for H5Pregister2) +public interface H5P_prp_compare_func_cb extends Callbacks { + int callback(byte[] value1, byte[] value2, long size); +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_prp_copy_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_prp_copy_func_cb.java new file mode 100644 index 0000000..4e560e2 --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5P_prp_copy_func_cb.java @@ -0,0 +1,21 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +//Information class for link callback(for H5Pregister2) +public interface H5P_prp_copy_func_cb extends Callbacks { + int callback(String name, long size, byte[] value); +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_prp_create_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_prp_create_func_cb.java new file mode 100644 index 0000000..dc4fee1 --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5P_prp_create_func_cb.java @@ -0,0 +1,21 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +//Information class for link callback(for H5Pregister2) +public interface H5P_prp_create_func_cb extends Callbacks { + int callback(String name, long size, byte[] value); +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_prp_delete_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_prp_delete_func_cb.java new file mode 100644 index 0000000..9aa27ab --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5P_prp_delete_func_cb.java @@ -0,0 +1,21 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +//Information class for link callback(for H5Pregister2) +public interface H5P_prp_delete_func_cb extends Callbacks { + int callback(long prop_id, String name, long size, byte[] value); +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_prp_get_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_prp_get_func_cb.java new file mode 100644 index 0000000..bfc7b37 --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5P_prp_get_func_cb.java @@ -0,0 +1,21 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +//Information class for link callback(for H5Pregister2) +public interface H5P_prp_get_func_cb extends Callbacks { + int callback(long prop_id, String name, long size, byte[] value); +} diff --git a/java/src/hdf/hdf5lib/callbacks/H5P_prp_set_func_cb.java b/java/src/hdf/hdf5lib/callbacks/H5P_prp_set_func_cb.java new file mode 100644 index 0000000..c1e9b00 --- /dev/null +++ b/java/src/hdf/hdf5lib/callbacks/H5P_prp_set_func_cb.java @@ -0,0 +1,21 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.callbacks; + +//Information class for link callback(for H5Pregister2) +public interface H5P_prp_set_func_cb extends Callbacks { + int callback(long prop_id, String name, long size, byte[] value); +} diff --git a/java/src/hdf/hdf5lib/structs/H5E_error2_t.java b/java/src/hdf/hdf5lib/structs/H5E_error2_t.java new file mode 100644 index 0000000..b7cd60a --- /dev/null +++ b/java/src/hdf/hdf5lib/structs/H5E_error2_t.java @@ -0,0 +1,41 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.structs; + +import java.io.Serializable; + +//Information struct for Attribute (For H5Ewalk) +public class H5E_error2_t implements Serializable{ + private static final long serialVersionUID = 279144359041667613L; + + public long cls_id; //class ID + public long maj_num; //major error ID + public long min_num; //minor error number + public int line; //line in file where error occurs + public String func_name; //function in which error occurred + public String file_name; //file in which error occurred + public String desc; //optional supplied description + + H5E_error2_t(long cls_id, long maj_num, long min_num, int line, String func_name, String file_name, String desc) { + this.cls_id = cls_id; + this.maj_num = maj_num; + this.min_num = min_num; + this.line = line; + this.func_name = func_name; + this.file_name = file_name; + this.desc = desc; + } +} diff --git a/java/src/hdf/hdf5lib/structs/H5F_info2_t.java b/java/src/hdf/hdf5lib/structs/H5F_info2_t.java new file mode 100644 index 0000000..8fbde68 --- /dev/null +++ b/java/src/hdf/hdf5lib/structs/H5F_info2_t.java @@ -0,0 +1,47 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package hdf.hdf5lib.structs; + +import java.io.Serializable; + +//Information struct for object (for H5Fget_info) +public class H5F_info2_t implements Serializable{ + private static final long serialVersionUID = 4691681162544054518L; + public int super_version; // Superblock version # + public long super_size; // Superblock size + public long super_ext_size; // Superblock extension size + public int free_version; // Version # of file free space management + public long free_meta_size; // Free space manager metadata size + public long free_tot_space; // Amount of free space in the file + public int sohm_version; // Version # of shared object header info + public long sohm_hdr_size; // Shared object header message header size + public H5_ih_info_t sohm_msgs_info; // Shared object header message index & heap size + + public H5F_info2_t (int super_version, long super_size, long super_ext_size, + int free_version, long free_meta_size, long free_tot_space, + int sohm_version, long sohm_hdr_size, H5_ih_info_t sohm_msgs_info) + { + this.super_version = super_version; + this.super_size = super_size; + this.super_ext_size = super_ext_size; + this.free_version = free_version; + this.free_meta_size = free_meta_size; + this.free_tot_space = free_tot_space; + this.sohm_version = sohm_version; + this.sohm_hdr_size = sohm_hdr_size; + this.sohm_msgs_info = sohm_msgs_info; + } +} diff --git a/java/src/jni/h5plImp.c b/java/src/jni/h5plImp.c new file mode 100644 index 0000000..dfaeb53 --- /dev/null +++ b/java/src/jni/h5plImp.c @@ -0,0 +1,64 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * For details of the HDF libraries, see the HDF Documentation at: + * http://hdfdfgroup.org/HDF5/doc/ + * + */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#include "hdf5.h" +#include +#include "h5jni.h" +#include "h5plImp.h" + +extern JavaVM *jvm; +extern jobject visit_callback; + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5PLset_loading_state + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5PLset_1loading_1state + (JNIEnv *env, jclass clss, jint plugin_flags) +{ + if (H5PLset_loading_state((unsigned int)plugin_flags) < 0) { + h5libraryError(env); + } +} + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5PLget_loading_state + * Signature: (V)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5PLget_1loading_1state + (JNIEnv *env, jclass clss) +{ + unsigned int plugin_type = 0; + if (H5PLget_loading_state(&plugin_type) < 0) { + h5libraryError(env); + } + return (jint)plugin_type; +} + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ diff --git a/java/src/jni/h5plImp.h b/java/src/jni/h5plImp.h new file mode 100644 index 0000000..7c55bf4 --- /dev/null +++ b/java/src/jni/h5plImp.h @@ -0,0 +1,46 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* Header for class hdf_hdf5lib_H5_H5PL */ + +#ifndef _Included_hdf_hdf5lib_H5_H5PL +#define _Included_hdf_hdf5lib_H5_H5PL + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5PLset_loading_state + * Signature: (I)V + */ +JNIEXPORT void JNICALL Java_hdf_hdf5lib_H5_H5PLset_1loading_1state + (JNIEnv *, jclass, jint); + +/* + * Class: hdf_hdf5lib_H5 + * Method: H5PLget_loading_state + * Signature: (V)I + */ +JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5_H5PLget_1loading_1state + (JNIEnv *, jclass); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif /* __cplusplus */ + +#endif /* _Included_hdf_hdf5lib_H5_H5PL */ diff --git a/java/test/TestH5PL.java b/java/test/TestH5PL.java new file mode 100644 index 0000000..afcb88a --- /dev/null +++ b/java/test/TestH5PL.java @@ -0,0 +1,61 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5PL { + @Rule public TestName testname = new TestName(); + + @Before + public void checkOpenIDs() { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + } + @After + public void nextTestName() { + System.out.println(); + } + + @Test + public void TestH5PLplugins() { + try { + int plugin_flags = H5.H5PLget_loading_state(); + assertTrue("H5.H5PLget_loading_state: "+plugin_flags, plugin_flags == HDF5Constants.H5PL_ALL_PLUGIN); + int new_setting = plugin_flags & ~HDF5Constants.H5PL_FILTER_PLUGIN; + H5.H5PLset_loading_state (new_setting); + int changed_flags = H5.H5PLget_loading_state(); + assertTrue("H5.H5PLget_loading_state: "+changed_flags, changed_flags == new_setting); + H5.H5PLset_loading_state (plugin_flags); + changed_flags = H5.H5PLget_loading_state(); + assertTrue("H5.H5PLget_loading_state: "+changed_flags, changed_flags == HDF5Constants.H5PL_ALL_PLUGIN); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5PLplugins " + err); + } + } +} diff --git a/java/test/TestH5Plist.java b/java/test/TestH5Plist.java new file mode 100644 index 0000000..c4dee01 --- /dev/null +++ b/java/test/TestH5Plist.java @@ -0,0 +1,1013 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.util.ArrayList; +import java.io.File; +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.nio.charset.StandardCharsets; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.HDFNativeData; +import hdf.hdf5lib.callbacks.H5P_cls_close_func_cb; +import hdf.hdf5lib.callbacks.H5P_cls_close_func_t; +import hdf.hdf5lib.callbacks.H5P_cls_copy_func_cb; +import hdf.hdf5lib.callbacks.H5P_cls_copy_func_t; +import hdf.hdf5lib.callbacks.H5P_cls_create_func_cb; +import hdf.hdf5lib.callbacks.H5P_cls_create_func_t; +import hdf.hdf5lib.callbacks.H5P_prp_set_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_get_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_delete_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_copy_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_compare_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_close_func_cb; +import hdf.hdf5lib.callbacks.H5P_prp_create_func_cb; +import hdf.hdf5lib.callbacks.H5P_iterate_cb; +import hdf.hdf5lib.callbacks.H5P_iterate_t; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; +import hdf.hdf5lib.structs.H5AC_cache_config_t; + +import org.junit.After; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Plist { + @Rule public TestName testname = new TestName(); + + // Property definitions + private static final String CLASS1_NAME = "Class 1"; + private static final String CLASS1_PATH = "root/Class 1"; + + private static final String CLASS2_NAME = "Class 2"; + private static final String CLASS2_PATH = "root/Class 1/Class 2"; + + // Property definitions + private static final String PROP1_NAME = "Property 1"; + private static final int prop1_def = 10; // Property 1 default value + private static final int PROP1_SIZE = 2; + + private static final String PROP2_NAME = "Property 2"; + private static final float prop2_def = 3.14F; // Property 2 default value + private static final int PROP2_SIZE = 8; + + private static final String PROP3_NAME = "Property 3"; + private static final char[] prop3_def = {'T','e','n',' ','c','h','a','r','s',' '}; // Property 3 default value + private static final int PROP3_SIZE = 10; + + private static final String PROP4_NAME = "Property 4"; + private static final double prop4_def = 1.41F; // Property 4 default value + private static final int PROP4_SIZE = 8; + + private static final String [] pnames = { // Names of properties for iterator + PROP1_NAME, + PROP2_NAME, + PROP3_NAME, + PROP4_NAME}; + + long plist_class_id = -1; + + @Before + public void createPropClass()throws NullPointerException, HDF5Exception + { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + // Create a new generic class, derived from the root of the class hierarchy + try { + plist_class_id = H5.H5Pcreate_class_nocb(HDF5Constants.H5P_ROOT, CLASS1_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Plist.H5Pcreate_class: " + err); + } + assertTrue(plist_class_id > 0); + } + + @After + public void deleteFileAccess() throws HDF5LibraryException { + if (plist_class_id > 0) + try {H5.H5Pclose(plist_class_id);} catch (Exception ex) {} + System.out.println(); + } + + // Test basic generic property list code. Tests creating new generic classes. + @Test + public void testH5P_genprop_basic_class() { + int status = -1; + long cid1 = -1; // Generic Property class ID + long cid2 = -1; // Generic Property class ID + long cid3 = -1; // Generic Property class ID + String name = null; // Name of class + + try { + // Check class name + try { + name = H5.H5Pget_class_name(plist_class_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_class_name plist_class_id: " + err); + } + assertTrue("Class names don't match!, "+name+"="+CLASS1_NAME+"\n", name.compareTo(CLASS1_NAME)==0); + + // Check class parent + try { + cid2 = H5.H5Pget_class_parent(plist_class_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_class_parent cid2: " + err); + } + + // Verify class parent correct + try { + status = H5.H5Pequal(cid2, HDF5Constants.H5P_ROOT); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pequal cid2: " + err); + } + assertTrue("H5Pequal cid2", status >= 0); + + // Make certain false postives aren't being returned + try { + status = H5.H5Pequal(cid2, HDF5Constants.H5P_FILE_CREATE); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pequal cid2: " + err); + } + assertTrue("H5Pequal cid2", status >= 0); + + // Close parent class + try { + H5.H5Pclose_class(cid2); + cid2 = -1; + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pclose_class cid2: " + err); + } + + // Close class + try { + H5.H5Pclose_class(plist_class_id); + plist_class_id = -1; + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pclose_class plist_class_id: " + err); + } + + // Create another new generic class, derived from file creation class + try { + cid1 = H5.H5Pcreate_class_nocb(HDF5Constants.H5P_FILE_CREATE, CLASS2_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pcreate_class cid1: " + err); + } + assertTrue("H5Pcreate_class cid1", cid1 >= 0); + + // Check class name + try { + name = H5.H5Pget_class_name(cid1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_class_name cid1: " + err); + } + assertTrue("Class names don't match!, "+name+"="+CLASS2_NAME+"\n", name.compareTo(CLASS2_NAME)==0); + + // Check class parent + try { + cid2 = H5.H5Pget_class_parent(cid1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_class_parent cid2: " + err); + } + assertTrue("H5Pget_class_parent cid2 ", cid2 >= 0); + + // Verify class parent correct + try { + status = H5.H5Pequal(cid2, HDF5Constants.H5P_FILE_CREATE); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pequal cid2: " + err); + } + assertTrue("H5Pequal cid2 ", status >= 0); + + // Check class parent's parent + try { + cid3 = H5.H5Pget_class_parent(cid2); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_class_parent cid3: " + err); + } + assertTrue("H5Pget_class_parent cid3", cid3 >= 0); + + // Verify class parent's parent correct + try { + status = H5.H5Pequal(cid3, HDF5Constants.H5P_GROUP_CREATE); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pequal cid3: " + err); + } + assertTrue("H5Pequal cid3 ", status >= 0); + + // Close parent class's parent + try { + H5.H5Pclose_class(cid3); + cid3 = -1; + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pclose_class cid3: " + err); + } + + // Close parent class's parent + try { + H5.H5Pclose_class(cid2); + cid2 = -1; + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pclose_class cid2: " + err); + } + + // Close parent class's parent + try { + H5.H5Pclose_class(cid1); + cid1 = -1; + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pclose_class cid1: " + err); + } + } + finally { + if (cid3 > 0) + try {H5.H5Pclose_class(cid3);} catch (Throwable err) {} + if (cid2 > 0) + try {H5.H5Pclose_class(cid2);} catch (Throwable err) {} + if (cid1 > 0) + try {H5.H5Pclose_class(cid1);} catch (Throwable err) {} + } + } + + // Test basic generic property list code. Tests adding properties to generic classes. + @Test + public void testH5P_genprop_basic_class_prop() { + int status = -1; + long size = -1; // Generic Property size + long nprops = -1; // Generic Property class number + + // Check the number of properties in class + try { + nprops = H5.H5Pget_nprops(plist_class_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_nprops plist_class_id: " + err); + } + assertTrue("H5Pget_nprops: "+nprops, nprops==0); + + // Check the existance of the first property (should fail) + try { + status = H5.H5Pexist(plist_class_id, PROP1_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pexist plist_class_id: " + err); + } + assertTrue("H5Pexist plist_class_id "+PROP1_NAME, status == 0); + + // Insert first property into class (with no callbacks) + try { + byte[] prop_value = HDFNativeData.intToByte(prop1_def); + + H5.H5Pregister2_nocb(plist_class_id, PROP1_NAME, PROP1_SIZE, prop_value); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pregister2 plist_class_id: "+PROP1_NAME + err); + } + + // Try to insert the first property again (should fail) + try { + byte[] prop_value = HDFNativeData.intToByte(prop1_def); + + H5.H5Pregister2_nocb(plist_class_id, PROP1_NAME, PROP1_SIZE, prop_value); + fail("H5Pregister2 plist_class_id: "+PROP1_NAME); + } + catch (Throwable err) { + } + + // Check the existance of the first property + try { + status = H5.H5Pexist(plist_class_id, PROP1_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pexist plist_class_id: " + err); + } + assertTrue("H5Pexist plist_class_id "+PROP1_NAME, status == 1); + + // Check the size of the first property + try { + size = H5.H5Pget_size(plist_class_id, PROP1_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_size PROP1_NAME: " + err); + } + assertTrue("H5Pget_size "+PROP1_NAME +" size: "+size, size == PROP1_SIZE); + + // Check the number of properties in class + try { + nprops = H5.H5Pget_nprops(plist_class_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_nprops plist_class_id: " + err); + } + assertTrue("H5Pget_nprops: "+nprops, nprops==1); + + // Insert second property into class (with no callbacks) + try { + byte[] prop_value = HDFNativeData.floatToByte(prop2_def); + + H5.H5Pregister2_nocb(plist_class_id, PROP2_NAME, PROP2_SIZE, prop_value); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pregister2 plist_class_id: "+PROP2_NAME + err); + } + + // Try to insert the second property again (should fail) + try { + byte[] prop_value = HDFNativeData.floatToByte(prop2_def); + + H5.H5Pregister2_nocb(plist_class_id, PROP2_NAME, PROP2_SIZE, prop_value); + fail("H5Pregister2 plist_class_id: "+PROP2_NAME); + } + catch (Throwable err) { + } + + // Check the existance of the second property + try { + status = H5.H5Pexist(plist_class_id, PROP2_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pexist plist_class_id: " + err); + } + assertTrue("H5Pexist plist_class_id "+PROP2_NAME, status == 1); + + // Check the size of the second property + try { + size = H5.H5Pget_size(plist_class_id, PROP2_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_size PROP2_NAME: " + err); + } + assertTrue("H5Pget_size "+PROP2_NAME +" size: "+size, size == PROP2_SIZE); + + // Check the number of properties in class + try { + nprops = H5.H5Pget_nprops(plist_class_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_nprops plist_class_id: " + err); + } + assertTrue("H5Pget_nprops: "+nprops, nprops==2); + + // Insert third property into class (with no callbacks) + try { + byte[] prop_value = new String(prop3_def).getBytes(StandardCharsets.UTF_8); + + H5.H5Pregister2_nocb(plist_class_id, PROP3_NAME, PROP3_SIZE, prop_value); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pregister2 plist_class_id: "+PROP3_NAME + err); + } + + // Check the existance of the third property + try { + status = H5.H5Pexist(plist_class_id, PROP3_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pexist plist_class_id: " + err); + } + assertTrue("H5Pexist plist_class_id "+PROP3_NAME, status == 1); + + // Check the size of the third property + try { + size = H5.H5Pget_size(plist_class_id, PROP3_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_size PROP3_NAME: " + err); + } + assertTrue("H5Pget_size "+PROP3_NAME +" size: "+size, size == PROP3_SIZE); + + // Check the number of properties in class + try { + nprops = H5.H5Pget_nprops(plist_class_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_nprops plist_class_id: " + err); + } + assertTrue("H5Pget_nprops: "+nprops, nprops==3); + + // Unregister first property + try { + H5.H5Punregister(plist_class_id, PROP1_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Punregister plist_class_id: "+PROP1_NAME + err); + } + + // Try to check the size of the first property (should fail) + try { + size = H5.H5Pget_size(plist_class_id, PROP1_NAME); + fail("H5Pget_size PROP1_NAME"); + } + catch (Throwable err) { + } + + // Check the number of properties in class + try { + nprops = H5.H5Pget_nprops(plist_class_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_nprops plist_class_id: " + err); + } + assertTrue("H5Pget_nprops: "+nprops, nprops==2); + + // Unregister second property + try { + H5.H5Punregister(plist_class_id, PROP2_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Punregister plist_class_id: "+PROP2_NAME + err); + } + + // Check the number of properties in class + try { + nprops = H5.H5Pget_nprops(plist_class_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_nprops plist_class_id: " + err); + } + assertTrue("H5Pget_nprops: "+nprops, nprops==1); + + // Unregister third property + try { + H5.H5Punregister(plist_class_id, PROP3_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Punregister plist_class_id: "+PROP3_NAME + err); + } + + // Check the number of properties in class + try { + nprops = H5.H5Pget_nprops(plist_class_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_nprops plist_class_id: " + err); + } + assertTrue("H5Pget_nprops: "+nprops, nprops==0); + } + + // Test basic generic property list code. Tests iterating over properties in a generic class. + @Test + public void testH5P_genprop_class_iter() { + class idata { + public String[] iter_names= null; + public int iter_count = -1; + idata(String[] names, int count) { + this.iter_names = names; + this.iter_count = count; + } + } + class H5P_iter_data implements H5P_iterate_t { + public ArrayList iterdata = new ArrayList(); + } + H5P_iterate_t iter_data = new H5P_iter_data(); + + class H5P_iter_callback implements H5P_iterate_cb { + public int callback(long list_id, String name, H5P_iterate_t op_data) { + idata id = ((H5P_iter_data)op_data).iterdata.get(0); + return name.compareTo(id.iter_names[id.iter_count++]); + } + } + H5P_iterate_cb iter_cb = new H5P_iter_callback(); + + long size = -1; // Generic Property size + long nprops = -1; // Generic Property class number + int[] idx = {0}; // Index to start iteration at + + // Insert first property into class (with no callbacks) */ + try { + byte[] prop_value = HDFNativeData.intToByte(prop1_def); + + H5.H5Pregister2_nocb(plist_class_id, PROP1_NAME, PROP1_SIZE, prop_value); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pregister2 plist_class_id: "+PROP1_NAME + err); + } + + // Insert second property into class (with no callbacks) */ + try { + byte[] prop_value = HDFNativeData.floatToByte(prop2_def); + + H5.H5Pregister2_nocb(plist_class_id, PROP2_NAME, PROP2_SIZE, prop_value); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pregister2 plist_class_id: "+PROP2_NAME + err); + } + + // Insert third property into class (with no callbacks) */ + try { + byte[] prop_value = new String(prop3_def).getBytes(StandardCharsets.UTF_8); + + H5.H5Pregister2_nocb(plist_class_id, PROP3_NAME, PROP3_SIZE, prop_value); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pregister2 plist_class_id: "+PROP3_NAME + err); + } + + // Insert fourth property into class (with no callbacks) */ + try { + byte[] prop_value = HDFNativeData.doubleToByte(prop4_def); + + H5.H5Pregister2_nocb(plist_class_id, PROP4_NAME, PROP4_SIZE, prop_value); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pregister2 plist_class_id: "+PROP4_NAME + err); + } + + // Check the number of properties in class */ + try { + nprops = H5.H5Pget_nprops(plist_class_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_nprops plist_class_id: " + err); + } + assertTrue("H5Pget_nprops: "+nprops, nprops==4); + + // Iterate over all properties in class */ + idata id = new idata(pnames, 0); + ((H5P_iter_data)iter_data).iterdata.add(id); + try { + H5.H5Piterate(plist_class_id, null, iter_cb, iter_data); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Piterate: " + err); + } + assertFalse("H5Piterate ",((H5P_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Piterate "+((H5P_iter_data)iter_data).iterdata.size(),((H5P_iter_data)iter_data).iterdata.size()==1); + assertTrue("H5Piterate "+(((H5P_iter_data)iter_data).iterdata.get(0)).iter_count,((idata)((H5P_iter_data)iter_data).iterdata.get(0)).iter_count==4); + + // Iterate over last three properties in class */ + idx[0] = 1; + ((H5P_iter_data)iter_data).iterdata.get(0).iter_count = 1; + try { + H5.H5Piterate(plist_class_id, idx, iter_cb, iter_data); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Piterate: " + err); + } + assertFalse("H5Piterate ",((H5P_iter_data)iter_data).iterdata.isEmpty()); + assertTrue("H5Piterate "+((H5P_iter_data)iter_data).iterdata.size(),((H5P_iter_data)iter_data).iterdata.size()==1); + assertTrue("H5Piterate "+(((H5P_iter_data)iter_data).iterdata.get(0)).iter_count,((idata)((H5P_iter_data)iter_data).iterdata.get(0)).iter_count==4); + + assertTrue("H5Piterate: "+nprops+"="+idx[0], nprops == idx[0]); + } + + // Test basic generic property list code. + // Tests creating new generic property lists and adding and + // removing properties from them. + @Test + public void testH5P_genprop_basic_list_prop() { + int status = -1; + long lid1 = -1; // Generic Property list ID + long nprops = -1; // Number of properties in class + + try { + // Add several properties (several w/default values) + + // Insert first property into class (with no callbacks) + try { + byte[] prop_value = HDFNativeData.intToByte(prop1_def); + + H5.H5Pregister2_nocb(plist_class_id, PROP1_NAME, PROP1_SIZE, prop_value); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pregister2 plist_class_id: "+PROP1_NAME + err); + } + + // Insert second property into class (with no callbacks) + try { + byte[] prop_value = HDFNativeData.floatToByte(prop2_def); + + H5.H5Pregister2_nocb(plist_class_id, PROP2_NAME, PROP2_SIZE, prop_value); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pregister2 plist_class_id: "+PROP2_NAME + err); + } + + // Create a property list from the class + try { + lid1 = H5.H5Pcreate(plist_class_id); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pcreate lid1: " + err); + } + + // Check the number of properties in class + try { + nprops = H5.H5Pget_nprops(lid1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_nprops lid1: " + err); + } + assertTrue("H5Pget_nprops: "+nprops, nprops==2); + + // Add temporary properties + + // Insert first temporary property into list (with no callbacks) + try { + byte[] prop_value = new String(prop3_def).getBytes(StandardCharsets.UTF_8); + + H5.H5Pinsert2_nocb(lid1, PROP3_NAME, PROP3_SIZE, prop_value); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pinsertr2 lid1: "+PROP3_NAME + err); + } + + // Insert second temporary property into list (with no callbacks) + try { + byte[] prop_value = HDFNativeData.doubleToByte(prop4_def); + + H5.H5Pinsert2_nocb(lid1, PROP4_NAME, PROP4_SIZE, prop_value); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pinsert2 lid1: "+PROP4_NAME + err); + } + + // Check the number of properties in class + try { + nprops = H5.H5Pget_nprops(lid1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pget_nprops lid1: " + err); + } + assertTrue("H5Pget_nprops: "+nprops, nprops==4); + + // Check existence of all properties + try { + status = H5.H5Pexist(lid1, PROP1_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pexist plist_class_id: " + err); + } + assertTrue("H5Pexist lid1 "+PROP1_NAME, status == 1); + try { + status = H5.H5Pexist(lid1, PROP2_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pexist plist_class_id: " + err); + } + assertTrue("H5Pexist lid1 "+PROP2_NAME, status == 1); + try { + status = H5.H5Pexist(lid1, PROP3_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pexist plist_class_id: " + err); + } + assertTrue("H5Pexist lid1 "+PROP3_NAME, status == 1); + try { + status = H5.H5Pexist(lid1, PROP4_NAME); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pexist plist_class_id: " + err); + } + assertTrue("H5Pexist lid1 "+PROP4_NAME, status == 1); + + } + finally { + if (lid1 > 0) + try {H5.H5Pclose(lid1);} catch (Throwable err) {} + } + } + +// // Test basic generic property list code. Tests callbacks for property lists in a generic class. +// @Test +// public void testH5P_genprop_class_callback() { +// class cdata { +// public long cls_id = -1; +// public int cls_count = -1; +// cdata(long id, int count) { +// this.cls_id = id; +// this.cls_count = count; +// } +// } +// class H5P_cls_create_data implements H5P_cls_create_func_t { +// public ArrayList clsdata = new ArrayList(); +// } +// H5P_cls_create_func_t cls_create_data = new H5P_cls_create_data(); +// +// class H5P_cls_create_callback implements H5P_cls_create_func_cb { +// public int callback(long list_id, H5P_cls_create_func_t cls_data) { +// System.err.println("H5P_cls_create_callback enter"); +// cdata cd = ((H5P_cls_create_data)cls_create_data).clsdata.get(0); +// cd.cls_count++; +// cd.cls_id = list_id; +// return 0; +// } +// } +// H5P_cls_create_func_cb cls_create_cb = new H5P_cls_create_callback(); +// +// class H5P_cls_copy_data implements H5P_cls_copy_func_t { +// public ArrayList clsdata = new ArrayList(); +// } +// H5P_cls_copy_func_t cls_copy_data = new H5P_cls_copy_data(); +// +// class H5P_cls_copy_callback implements H5P_cls_copy_func_cb { +// public int callback(long list_id1, long list_id2, H5P_cls_copy_func_t cls_data) { +// cdata cd = ((H5P_cls_copy_data)cls_copy_data).clsdata.get(0); +// cd.cls_count++; +// cd.cls_id = list_id1; +// return 0; +// } +// } +// H5P_cls_copy_func_cb cls_copy_cb = new H5P_cls_copy_callback(); +// +// class H5P_cls_close_data implements H5P_cls_close_func_t { +// public ArrayList clsdata = new ArrayList(); +// } +// H5P_cls_close_func_t cls_close_data = new H5P_cls_close_data(); +// +// class H5P_cls_close_callback implements H5P_cls_close_func_cb { +// public int callback(long list_id, H5P_cls_close_func_t cls_data) { +// cdata cd = ((H5P_cls_close_data)cls_close_data).clsdata.get(0); +// cd.cls_count++; +// cd.cls_id = list_id; +// return 0; +// } +// } +// H5P_cls_close_func_cb cls_close_cb = new H5P_cls_close_callback(); +// +// long cid1 = -1; // Generic Property class ID +// long cid2 = -1; // Generic Property class ID +// long lid1 = -1; // Generic Property list ID +// long lid2 = -1; // Generic Property list ID +// long lid3 = -1; // Generic Property list ID +// long nprops = -1; // Number of properties in class +// +// try { +// // Create a new generic class, derived from the root of the class hierarchy +// try { +// cid1 = H5.H5Pcreate_class(HDF5Constants.H5P_ROOT, CLASS1_NAME, cls_create_cb, cls_create_data, cls_copy_cb, cls_copy_data, cls_close_cb, cls_close_data); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("H5Pcreate_class cid1: " + err); +// } +// assertTrue("H5Pcreate_class cid1", cid1 >= 0); +// +// // Insert first property into class (with no callbacks) +// try { +// byte[] prop_value = HDFNativeData.intToByte(prop1_def); +// +// H5.H5Pregister2(cid1, PROP1_NAME, PROP1_SIZE, prop_value, null, null, null, null, null, null, null); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("H5Pregister2 cid1: "+PROP1_NAME + err); +// } +// +// // Insert second property into class (with no callbacks) +// try { +// byte[] prop_value = HDFNativeData.floatToByte(prop2_def); +// +// H5.H5Pregister2(cid1, PROP2_NAME, PROP2_SIZE, prop_value, null, null, null, null, null, null, null); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("H5Pregister2 cid1: "+PROP2_NAME + err); +// } +// +// // Insert third property into class (with no callbacks) +// try { +// byte[] prop_value = new String(prop3_def).getBytes(StandardCharsets.UTF_8); +// +// H5.H5Pregister2(cid1, PROP3_NAME, PROP3_SIZE, prop_value, null, null, null, null, null, null, null); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("H5Pregister2 cid1: "+PROP3_NAME + err); +// } +// +// // Check the number of properties in class +// try { +// nprops = H5.H5Pget_nprops(cid1); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("H5Pget_nprops cid1: " + err); +// } +// assertTrue("H5Pget_nprops: "+nprops, nprops==3); +// +// // Initialize class callback structs +// cdata create_id = new cdata(-1, 0); +// cdata copy_id = new cdata(-1, 0); +// cdata close_id = new cdata(-1, 0); +// ((H5P_cls_create_data)cls_create_data).clsdata.add(create_id); +// ((H5P_cls_copy_data)cls_copy_data).clsdata.add(copy_id); +// ((H5P_cls_close_data)cls_close_data).clsdata.add(close_id); +// +// // Create a property list from the class +// try { +// lid1 = H5.H5Pcreate(cid1); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("H5Pcreate lid1: " + err); +// } +// +// // Verify that the creation callback occurred +// assertFalse("H5Pcreate ",((H5P_cls_create_data)cls_create_data).clsdata.isEmpty()); +// assertTrue("H5Pcreate "+((H5P_cls_create_data)cls_create_data).clsdata.get(0).cls_id ,((H5P_cls_create_data)cls_create_data).clsdata.get(0).cls_id == lid1); +// assertTrue("H5Pcreate "+(((H5P_cls_create_data)cls_create_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_create_data)cls_create_data).clsdata.get(0)).cls_count==1); +// +// // Check the number of properties in list +// try { +// nprops = H5.H5Pget_nprops(lid1); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("H5Pget_nprops lid1: " + err); +// } +// assertTrue("H5Pget_nprops: "+nprops, nprops==3); +// +// // Create another property list from the class +// try { +// lid2 = H5.H5Pcreate(cid1); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("H5Pcreate lid2: " + err); +// } +// +// /* Verify that the creation callback occurred */ +// assertFalse("H5Pcreate ",((H5P_cls_create_data)cls_create_data).clsdata.isEmpty()); +// assertTrue("H5Pcreate "+((H5P_cls_create_data)cls_create_data).clsdata.get(0).cls_id ,((H5P_cls_create_data)cls_create_data).clsdata.get(0).cls_id == lid2); +// assertTrue("H5Pcreate "+(((H5P_cls_create_data)cls_create_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_create_data)cls_create_data).clsdata.get(0)).cls_count==2); +// +// // Check the number of properties in list +// try { +// nprops = H5.H5Pget_nprops(lid2); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("H5Pget_nprops lid2: " + err); +// } +// assertTrue("H5Pget_nprops: "+nprops, nprops==3); +// +// // Create another property list by copying an existing list +// try { +// lid3= H5.H5Pcopy(lid1); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("H5Pcopy lid3: " + err); +// } +// +// // Verify that the copy callback occurred +// assertFalse("H5Pcopy ",((H5P_cls_copy_data)cls_copy_data).clsdata.isEmpty()); +// assertTrue("H5Pcopy "+((H5P_cls_copy_data)cls_copy_data).clsdata.get(0).cls_id ,((H5P_cls_copy_data)cls_copy_data).clsdata.get(0).cls_id == lid3); +// assertTrue("H5Pcopy "+(((H5P_cls_copy_data)cls_copy_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_copy_data)cls_copy_data).clsdata.get(0)).cls_count==1); +// +// // Check the number of properties in list +// try { +// nprops = H5.H5Pget_nprops(lid3); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("H5Pget_nprops lid3: " + err); +// } +// assertTrue("H5Pget_nprops: "+nprops, nprops==3); +// +// // Close first list +// try { +// H5.H5Pclose(lid1); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("H5Pclose lid1: " + err); +// } +// +// /* Verify that the close callback occurred */ +// assertFalse("H5Pclose ",((H5P_cls_close_data)cls_close_data).clsdata.isEmpty()); +// assertTrue("H5Pclose "+((H5P_cls_close_data)cls_close_data).clsdata.get(0).cls_id ,((H5P_cls_close_data)cls_copy_data).clsdata.get(0).cls_id == lid1); +// assertTrue("H5Pclose "+(((H5P_cls_close_data)cls_close_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_close_data)cls_copy_data).clsdata.get(0)).cls_count==1); +// +// // Close second list +// try { +// H5.H5Pclose(lid2); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("H5Pclose lid2: " + err); +// } +// +// // Verify that the close callback occurred +// assertTrue("H5Pclose "+((H5P_cls_close_data)cls_close_data).clsdata.get(0).cls_id ,((H5P_cls_close_data)cls_close_data).clsdata.get(0).cls_id == lid2); +// assertTrue("H5Pclose "+(((H5P_cls_close_data)cls_close_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_close_data)cls_close_data).clsdata.get(0)).cls_count==2); +// +// // Close third list +// try { +// H5.H5Pclose(lid3); +// } +// catch (Throwable err) { +// err.printStackTrace(); +// fail("H5Pclose lid3: " + err); +// } +// +// // Verify that the close callback occurred +// assertTrue("H5Pclose "+((H5P_cls_close_data)cls_close_data).clsdata.get(0).cls_id ,((H5P_cls_close_data)cls_close_data).clsdata.get(0).cls_id == lid3); +// assertTrue("H5Pclose "+(((H5P_cls_close_data)cls_close_data).clsdata.get(0)).cls_count,((cdata)((H5P_cls_close_data)cls_close_data).clsdata.get(0)).cls_count==3); +// } +// finally { +// if (lid3 > 0) +// try {H5.H5Pclose(lid3);} catch (Throwable err) {} +// if (lid2 > 0) +// try {H5.H5Pclose(lid2);} catch (Throwable err) {} +// if (lid1 > 0) +// try {H5.H5Pclose(lid1);} catch (Throwable err) {} +// if (cid2 > 0) +// try {H5.H5Pclose_class(cid2);} catch (Throwable err) {} +// if (cid1 > 0) +// try {H5.H5Pclose_class(cid1);} catch (Throwable err) {} +// } +// } + +} diff --git a/java/test/TestH5Pvirtual.java b/java/test/TestH5Pvirtual.java new file mode 100644 index 0000000..9372ae1 --- /dev/null +++ b/java/test/TestH5Pvirtual.java @@ -0,0 +1,433 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +package test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.io.File; + +import hdf.hdf5lib.H5; +import hdf.hdf5lib.HDF5Constants; +import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5LibraryException; + +import org.junit.After; +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TestName; + +public class TestH5Pvirtual { + @Rule public TestName testname = new TestName(); + + private static final String H5_FILE = "vds.h5"; + private static final String SRC_FILE[] = { + "v-0.h5", + "v-1.h5", + "v-2.h5" + }; + private static final String SRC_DATASET[] = { + "A", + "B", + "C" + }; + private static final int DIM_Y = 6; + private static final int VDSDIM_X = 4; + private static final int VDSDIM_Y = 6; + private static final int fill_value = -1; + long[] H5dims = { DIM_Y }; + long[] VDSH5dims = { VDSDIM_X, VDSDIM_Y }; + long H5fid = -1; + long H5dsid = -1; + long H5dssid = -1; + long H5dvsid = -1; + long H5did = -1; + long H5dcplid = -1; + long H5dapl_id = -1; + + private final void _deleteFile(String filename) { + File file = new File(filename); + + if (file.exists()) { + try {file.delete();} catch (SecurityException e) {} + } + } + + private final long _createDataset(long fid, long dsid, String name, long dcpl, long dapl) { + long did = -1; + long space_id = -1; + long[] start = {0, 0}; + long[] stride = null; + long[] count = {1, 1}; + long[] block = {1, VDSDIM_Y}; + + try { + H5dssid = H5.H5Screate_simple(1, H5dims, null); + for (int i = 0; i < 3; i++) { + start[0] = i; + /* Select i-th row in the virtual dataset; selection in the source datasets is the same. */ + H5.H5Sselect_hyperslab(dsid, HDF5Constants.H5S_SELECT_SET, start, stride, count, block); + H5.H5Pset_virtual(dcpl, dsid, SRC_FILE[i], SRC_DATASET[i], H5dssid); + } + did = H5.H5Dcreate(fid, name, HDF5Constants.H5T_NATIVE_INT, dsid, + HDF5Constants.H5P_DEFAULT, dcpl, dapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5Pvirtual._createDataset: ", did > 0); + + return did; + } + + private final void _createH5File(long fcpl, long fapl) { + int[] dset_data = new int[DIM_Y]; + // Create source files and datasets + for (int i=0; i < 3; i++) { + long space_id = -1; + long dset_id = -1; + long file_id = -1; + for (int j = 0; j < DIM_Y; j++) dset_data[j] = i+1; + + try { + file_id = H5.H5Fcreate(SRC_FILE[i], HDF5Constants.H5F_ACC_TRUNC, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + space_id = H5.H5Screate_simple(1, H5dims, null); + dset_id = H5.H5Dcreate(file_id, SRC_DATASET[i], HDF5Constants.H5T_NATIVE_INT, space_id, + HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5.H5Dwrite (dset_id, HDF5Constants.H5T_NATIVE_INT, HDF5Constants.H5S_ALL, HDF5Constants.H5S_ALL, HDF5Constants.H5P_DEFAULT, + dset_data); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pvirtual.createH5file: " + err); + } + finally { + if (dset_id > 0) + try {H5.H5Dclose(dset_id);} catch (Exception ex) {} + if (space_id > 0) + try {H5.H5Sclose(space_id);} catch (Exception ex) {} + if (file_id > 0) + try {H5.H5Fclose(file_id);} catch (Exception ex) {} + } + } + + try { + int[] fill_value = {-1}; + H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5dsid = H5.H5Screate_simple(2, VDSH5dims, null); + H5dcplid = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + H5.H5Pset_fill_value(H5dcplid, HDF5Constants.H5T_NATIVE_INT, fill_value); + } + catch (Throwable err) { + err.printStackTrace(); + fail("TestH5Pvirtual.createH5file: " + err); + } + assertTrue("TestH5Pvirtual.createH5file: H5.H5Fcreate: ", H5fid > 0); + assertTrue("TestH5Pvirtual.createH5file: H5.H5Screate_simple: ", H5dsid > 0); + assertTrue("TestH5Pvirtual.createH5file: H5.H5Pcreate: ", H5dcplid > 0); + + try { + H5.H5Fflush(H5fid, HDF5Constants.H5F_SCOPE_LOCAL); + } + catch (Throwable err) { + err.printStackTrace(); + } + } + + @Before + public void createH5file() + throws NullPointerException, HDF5Exception { + assertTrue("H5 open ids is 0",H5.getOpenIDCount()==0); + System.out.print(testname.getMethodName()); + _createH5File(HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + H5dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS); + assertTrue("TestH5Pvirtual.createH5file: H5.H5Pcreate: ", H5dapl_id > 0); + } + + @After + public void deleteH5file() throws HDF5LibraryException { + if (H5dapl_id > 0) + try {H5.H5Pclose(H5dapl_id);} catch (Exception ex) {} + if (H5dcplid > 0) + try {H5.H5Pclose(H5dcplid);} catch (Exception ex) {} + if (H5dsid > 0) + try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5fid > 0) + try {H5.H5Fclose(H5fid);} catch (Exception ex) {} + for (int i = 0; i < 3; i++) { + _deleteFile(SRC_FILE[i]); + } + _deleteFile(H5_FILE); + System.out.println(); + } + + @Test + public void testH5Pvirtual_storage() { + int layout = -1; + + H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id); + try { + layout = H5.H5Pget_layout (H5dcplid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Pget_layout: " + err); + } + finally { + if (H5dssid > 0) + try {H5.H5Sclose(H5dssid);} catch (Exception ex) {} + if (H5did > 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + } + assertTrue("testH5Pvirtual_storage", HDF5Constants.H5D_VIRTUAL == layout); + } + + @Test + public void testH5Pget_virtual_count() { + long num_map = -1; + + H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id); + try { + num_map = H5.H5Pget_virtual_count(H5dcplid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Pget_virtual_count: " + err); + } + finally { + if (H5dssid > 0) + try {H5.H5Sclose(H5dssid);} catch (Exception ex) {} + if (H5did > 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + } + assertTrue("testH5Pget_virtual_count: "+num_map, num_map >= 0); + } + + @Test + public void testH5Pget_source_filename() throws Throwable { + String filename = null; + + H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id); + try { + filename = (H5.H5Pget_virtual_filename (H5dcplid, 2)); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Pget_virtual_filename: " + err); + } + finally { + if (H5dssid > 0) + try {H5.H5Sclose(H5dssid);} catch (Exception ex) {} + if (H5did > 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + } + assertTrue("testH5Pget_source_filename: "+filename, filename.compareTo("v-2.h5") == 0); + } + + @Test + public void testH5Pget_source_datasetname() throws Throwable { + String datasetname = null; + + H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id); + try { + datasetname = H5.H5Pget_virtual_dsetname (H5dcplid, 1); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Pget_virtual_dsetname: " + err); + } + finally { + if (H5dssid > 0) + try {H5.H5Sclose(H5dssid);} catch (Exception ex) {} + if (H5did > 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + } + assertTrue("testH5Pget_source_datasetname: "+datasetname, datasetname.compareTo("B") == 0); + } + + @Test + public void testH5Pget_selection_source_dataset() throws Throwable { + long src_space = -1; + long src_selection = -1; + + H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id); + try { + src_space = H5.H5Pget_virtual_srcspace (H5dcplid, 0); + src_selection = H5.H5Sget_select_type(src_space); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Pget_selection_source_dataset: " + err); + } + finally { + if (src_space > 0) + try {H5.H5Sclose(src_space);} catch (Exception ex) {} + if (H5dssid > 0) + try {H5.H5Sclose(H5dssid);} catch (Exception ex) {} + if (H5did > 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + } + assertTrue("testH5Pget_selection_source_dataset", src_selection == HDF5Constants.H5S_SEL_ALL); + } + + @Test + public void testH5Pget_mapping_parameters() { + long num_map = -1; + + H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id); + try { + try { + num_map = H5.H5Pget_virtual_count(H5dcplid); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Pget_virtual_count: " + err); + } + for (int i = 0; i < num_map; i++) { + int vselection = -1; + long vspace = -1; + long nblocks; // Number of hyperslab blocks + long blocks[] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; // List of blocks + long[] start = {i, 0}; + long[] stride = {1, 1}; + long[] count = {1, 1}; + long[] block = {1, VDSDIM_Y}; + long q_start[] = new long[2]; + long q_stride[] = new long[2]; + long q_count[] = new long[2]; + long q_block[] = new long[2]; + boolean is_regular = false; + + try { + try { + vspace = H5.H5Pget_virtual_vspace (H5dcplid, i); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Pget_virtual_vspace: " + err); + } + try { + vselection = H5.H5Sget_select_type(vspace); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Sget_select_type: " + err); + } + assertTrue("testH5Pget_mapping_parameters["+i+"]", vselection == HDF5Constants.H5S_SEL_HYPERSLABS); + + // Verify that there is only one block + nblocks = H5.H5Sget_select_hyper_nblocks(vspace); + assertTrue("H5Sget_select_hyper_nblocks", nblocks == 1); + + // Retrieve the block defined + H5.H5Sget_select_hyper_blocklist(vspace, 0, nblocks, blocks); + + // Verify that the correct block is defined + assertTrue("H5.H5Sget_select_hyper_blocklist["+i+"] [0]: "+blocks[0], start[0] == blocks[0]); + assertTrue("H5.H5Sget_select_hyper_blocklist["+i+"] [1]: "+blocks[1], start[1] == blocks[1]); + assertTrue("H5.H5Sget_select_hyper_blocklist["+i+"] [2]: "+blocks[2], (block[0]-1+i) == blocks[2]); + assertTrue("H5.H5Sget_select_hyper_blocklist["+i+"] [3]: "+blocks[3], (block[1]-1) == blocks[3]); + // We also can use new APIs to get start, stride, count and block + is_regular = H5.H5Sis_regular_hyperslab(vspace); + assertTrue("H5.H5Sis_regular_hyperslab", is_regular); + H5.H5Sget_regular_hyperslab (vspace, q_start, q_stride, q_count, q_block); + + // Verify the hyperslab parameters + for(int u = 0; u < 2; u++) { + assertTrue("H5Sget_regular_hyperslab, start", start[u] == q_start[u]); + assertTrue("H5Sget_regular_hyperslab, stride", stride[u] == q_stride[u]); + assertTrue("H5Sget_regular_hyperslab, count", count[u] == q_count[u]); + assertTrue("H5Sget_regular_hyperslab, block", block[u] == q_block[u]); + } + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.testH5Pget_mapping_parameters: " + err); + } + finally { + if (vspace > 0) + try {H5.H5Sclose(vspace);} catch (Exception ex) {} + } + } + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Pget_mapping_parameters: " + err); + } + finally { + if (H5dssid > 0) + try {H5.H5Sclose(H5dssid);} catch (Exception ex) {} + if (H5did > 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + } + } + + @Test + public void testH5Pset_get_virtual_view() { + int ret_val = -1; + H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id); + try { + ret_val = H5.H5Pget_virtual_view(H5dapl_id); + assertTrue("H5Pget_virtual_view", ret_val >= 0); + assertEquals(HDF5Constants.H5D_VDS_LAST_AVAILABLE, ret_val); + H5.H5Pset_virtual_view(H5dapl_id, HDF5Constants.H5D_VDS_FIRST_MISSING); + ret_val = H5.H5Pget_virtual_view(H5dapl_id); + assertTrue("H5Pget_virtual_view", ret_val >= 0); + assertEquals(HDF5Constants.H5D_VDS_FIRST_MISSING, ret_val); + } + catch (Throwable err) { + err.printStackTrace(); + fail("testH5Pset_get_virtual_view: " + err); + } + finally { + if (H5dssid > 0) + try {H5.H5Sclose(H5dssid);} catch (Exception ex) {} + if (H5did > 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + } + } + + @Ignore + public void testH5Pset_get_virtual_printf_gap() { + long ret_val = -1; + H5did = _createDataset(H5fid, H5dsid, "VDS", H5dcplid, H5dapl_id); + try { + ret_val = H5.H5Pget_virtual_printf_gap(H5dapl_id); + assertTrue("H5Pget_virtual_printf_gap", ret_val >= 0); + assertEquals(0, ret_val); + H5.H5Pset_virtual_printf_gap(H5dapl_id, 2); + ret_val = H5.H5Pget_virtual_view(H5dapl_id); + assertTrue("H5Pget_virtual_printf_gap", ret_val >= 0); + assertEquals(2, ret_val); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5Pset_get_virtual_printf_gap: " + err); + } + finally { + if (H5dssid > 0) + try {H5.H5Sclose(H5dssid);} catch (Exception ex) {} + if (H5did > 0) + try {H5.H5Dclose(H5did);} catch (Exception ex) {} + } + } +} -- cgit v0.12 From 6e9e1d67f5ad5712b5ccdf710dd237f6f2e85a5d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 29 Feb 2016 12:25:27 -0500 Subject: [svn-r29229] Turn java OFF by default. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4fb9262..648ae7a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -926,7 +926,7 @@ endif (HDF5_BUILD_FORTRAN AND HDF5_BUILD_HL_LIB) # Option to build HDF5 Java Library #----------------------------------------------------------------------------- if (EXISTS "${HDF5_SOURCE_DIR}/java" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/java") - option (HDF5_BUILD_JAVA "Build Java HDF5 Library" ON) + option (HDF5_BUILD_JAVA "Build Java HDF5 Library" OFF) if (HDF5_BUILD_JAVA) add_subdirectory (${HDF5_SOURCE_DIR}/java ${PROJECT_BINARY_DIR}/java) endif (HDF5_BUILD_JAVA) -- cgit v0.12 From 83b5bed5d437e8a09d1c94038b3ada966947c2b9 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 29 Feb 2016 15:47:35 -0500 Subject: [svn-r29231] Check if szip is enabled before attempting to run example with szip. --- java/examples/datasets/CMakeLists.txt | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/java/examples/datasets/CMakeLists.txt b/java/examples/datasets/CMakeLists.txt index 2338325..077c6bb 100644 --- a/java/examples/datasets/CMakeLists.txt +++ b/java/examples/datasets/CMakeLists.txt @@ -83,6 +83,16 @@ MACRO (ADD_H5_TEST resultfile resultcode) ENDMACRO (ADD_H5_TEST file) if (BUILD_TESTING) + +# detect whether the encoder is present. + if (H5_HAVE_FILTER_DEFLATE) + set (USE_FILTER_DEFLATE "true") + endif (H5_HAVE_FILTER_DEFLATE) + + if (H5_HAVE_FILTER_SZIP) + set (USE_FILTER_SZIP "true") + endif (H5_HAVE_FILTER_SZIP) + foreach (example ${HDF_JAVA_EXAMPLES}) if (${example} STREQUAL "H5Ex_D_External") add_test ( @@ -116,6 +126,13 @@ if (BUILD_TESTING) ) set_tests_properties (JAVA_datasets-${example}-copy-objects PROPERTIES DEPENDS JAVA_datasets-${example}-clearall-objects) set (last_test "JAVA_datasets-${example}-copy-objects") - ADD_H5_TEST (${example} 0) + if (${example} STREQUAL "H5Ex_D_Szip") + if (USE_FILTER_SZIP) + ADD_H5_TEST (${example} 0) + endif (USE_FILTER_SZIP) + else (${example} STREQUAL "H5Ex_D_Szip") + ADD_H5_TEST (${example} 0) + endif (${example} STREQUAL "H5Ex_D_Szip") + endforeach (example ${HDF_JAVA_EXAMPLES}) endif (BUILD_TESTING) -- cgit v0.12 From a0485058d6049c8585bf346c775a458fa3a8bc74 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 29 Feb 2016 15:56:08 -0500 Subject: [svn-r29232] add debug symbols library to install --- java/src/jni/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/java/src/jni/CMakeLists.txt b/java/src/jni/CMakeLists.txt index 6ee56c8..ef80072 100644 --- a/java/src/jni/CMakeLists.txt +++ b/java/src/jni/CMakeLists.txt @@ -71,6 +71,7 @@ endif (WIN32) # Add Target(s) to CMake Install for import into other projects #----------------------------------------------------------------------------- if (HDF5_EXPORTED_TARGETS) + INSTALL_TARGET_PDB (${HDF5_JAVA_JNI_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries) install ( TARGETS ${HDF5_JAVA_JNI_LIB_TARGET} -- cgit v0.12 From c9ea243157006c37dd3bfc380814aa929c30c0ac Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 29 Feb 2016 16:07:27 -0500 Subject: [svn-r29233] Add ARGN option for soversion arguments --- config/cmake/HDF5Macros.cmake | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/config/cmake/HDF5Macros.cmake b/config/cmake/HDF5Macros.cmake index bd86f34..d88e672 100644 --- a/config/cmake/HDF5Macros.cmake +++ b/config/cmake/HDF5Macros.cmake @@ -1,7 +1,13 @@ #------------------------------------------------------------------------------- macro (H5_SET_LIB_OPTIONS libtarget libname libtype) set (LIB_OUT_NAME "${libname}") + # SOVERSION passed in ARGN when shared if (${libtype} MATCHES "SHARED") + if (ARGN) + set (PACKAGE_SOVERSION ${ARGN}) + else (ARGN) + set (PACKAGE_SOVERSION ${HDF5_PACKAGE_SOVERSION}) + endif (ARGN) if (WIN32) set (LIBHDF_VERSION ${HDF5_PACKAGE_VERSION_MAJOR}) else (WIN32) @@ -9,9 +15,9 @@ macro (H5_SET_LIB_OPTIONS libtarget libname libtype) endif (WIN32) set_target_properties (${libtarget} PROPERTIES VERSION ${LIBHDF_VERSION}) if (WIN32) - set (${LIB_OUT_NAME} "${LIB_OUT_NAME}-${HDF5_PACKAGE_SOVERSION}") + set (${LIB_OUT_NAME} "${LIB_OUT_NAME}-${PACKAGE_SOVERSION}") else (WIN32) - set_target_properties (${libtarget} PROPERTIES SOVERSION ${HDF5_PACKAGE_SOVERSION}) + set_target_properties (${libtarget} PROPERTIES SOVERSION ${PACKAGE_SOVERSION}) endif (WIN32) endif (${libtype} MATCHES "SHARED") HDF_SET_LIB_OPTIONS (${libtarget} ${LIB_OUT_NAME} ${libtype}) @@ -39,4 +45,5 @@ macro (H5_SET_LIB_OPTIONS libtarget libname libtype) endif (${libtype} MATCHES "SHARED") endif (HDF5_BUILD_FRAMEWORKS) endif (APPLE) + endmacro (H5_SET_LIB_OPTIONS) -- cgit v0.12 From 8538eedde3bacf5dac103280c4a257510dbd1744 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 29 Feb 2016 16:24:31 -0500 Subject: [svn-r29234] Fix H5 LIB OPTIONS macro for correct ARGN support --- test/CMakeLists.txt | 14 ++------------ tools/h5repack/CMakeLists.txt | 7 +------ tools/lib/CMakeLists.txt | 18 ++++-------------- 3 files changed, 7 insertions(+), 32 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 789844f..8793fa8 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -94,12 +94,7 @@ endif (BUILD_SHARED_LIBS) add_library (${HDF5_TEST_PLUGIN_LIB_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${test_lib}.c) TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_LIB_TARGET} SHARED " " " ") target_link_libraries (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) - H5_SET_LIB_OPTIONS ( - ${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_PLUGIN_LIB_NAME} - SHARED ${HDF5_PACKAGE_SOVERSION} - HDF5_TEST_PLUGIN_LIB_NAME_RELEASE - HDF5_TEST_PLUGIN_LIB_NAME_DEBUG - ) + H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_PLUGIN_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) set_target_properties (${HDF5_TEST_PLUGIN_LIB_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN) #----------------------------------------------------------------------------- @@ -125,12 +120,7 @@ endif (BUILD_SHARED_LIBS) add_library (${HDF5_TEST_PLUGIN_LIB_TARGET} SHARED ${HDF5_TEST_SOURCE_DIR}/${test_lib}.c) TARGET_C_PROPERTIES (${HDF5_TEST_PLUGIN_LIB_TARGET} SHARED " " " ") target_link_libraries (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) - H5_SET_LIB_OPTIONS ( - ${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_PLUGIN_LIB_NAME} - SHARED ${HDF5_PACKAGE_SOVERSION} - HDF5_TEST_PLUGIN_LIB_NAME_RELEASE - HDF5_TEST_PLUGIN_LIB_NAME_DEBUG - ) + H5_SET_LIB_OPTIONS (${HDF5_TEST_PLUGIN_LIB_TARGET} ${HDF5_TEST_PLUGIN_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) set_target_properties (${HDF5_TEST_PLUGIN_LIB_TARGET} PROPERTIES FOLDER libraries/TEST_PLUGIN) #----------------------------------------------------------------------------- diff --git a/tools/h5repack/CMakeLists.txt b/tools/h5repack/CMakeLists.txt index 9b1fbcf..d8542a4 100644 --- a/tools/h5repack/CMakeLists.txt +++ b/tools/h5repack/CMakeLists.txt @@ -56,12 +56,7 @@ if (BUILD_TESTING) add_library (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED dynlib_rpk.c) TARGET_C_PROPERTIES (${HDF5_TOOL_PLUGIN_LIB_TARGET} SHARED " " " ") target_link_libraries (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TEST_LIB_TARGET}) - H5_SET_LIB_OPTIONS ( - ${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} - SHARED ${HDF5_PACKAGE_SOVERSION} - HDF5_TOOL_PLUGIN_LIB_NAME_RELEASE - HDF5_TOOL_PLUGIN_LIB_NAME_DEBUG - ) + H5_SET_LIB_OPTIONS (${HDF5_TOOL_PLUGIN_LIB_TARGET} ${HDF5_TOOL_PLUGIN_LIB_NAME} SHARED ${HDF5_PACKAGE_SOVERSION}) # make plugins dir file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/plugins") diff --git a/tools/lib/CMakeLists.txt b/tools/lib/CMakeLists.txt index 0b39a2b..ce1ad34 100644 --- a/tools/lib/CMakeLists.txt +++ b/tools/lib/CMakeLists.txt @@ -41,13 +41,8 @@ add_library (${HDF5_TOOLS_LIB_TARGET} STATIC ${H5_TOOLS_LIB_SRCS} ${H5_TOOLS_LIB TARGET_C_PROPERTIES (${HDF5_TOOLS_LIB_TARGET} STATIC " " " ") target_link_libraries (${HDF5_TOOLS_LIB_TARGET} ${HDF5_LIB_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIB_TARGET}") -H5_SET_LIB_OPTIONS ( - ${HDF5_TOOLS_LIB_TARGET} ${HDF5_TOOLS_LIB_NAME} - STATIC - HDF5_TOOLS_LIB_NAME_RELEASE - HDF5_TOOLS_LIB_NAME_DEBUG -) -set_target_properties (${HDF5_TOOLS_LIB_TARGET} PROPERTIES +H5_SET_LIB_OPTIONS (${HDF5_TOOLS_LIB_TARGET} ${HDF5_TOOLS_LIB_NAME} STATIC) +set_target_properties (${HDF5_TOOLS_LIB_TARGET} PROPERTIES FOLDER libraries/tools INTERFACE_INCLUDE_DIRECTORIES "$/include>" ) @@ -59,13 +54,8 @@ if (BUILD_SHARED_LIBS) TARGET_C_PROPERTIES (${HDF5_TOOLS_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_LIBSH_TARGET}) set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_TOOLS_LIBSH_TARGET}") - H5_SET_LIB_OPTIONS ( - ${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TOOLS_LIB_NAME} - SHARED ${HDF5_TOOLS_PACKAGE_SOVERSION} - HDF5_TOOLS_LIB_NAME_RELEASE - HDF5_TOOLS_LIB_NAME_DEBUG - ) - set_target_properties (${HDF5_TOOLS_LIBSH_TARGET} PROPERTIES + H5_SET_LIB_OPTIONS (${HDF5_TOOLS_LIBSH_TARGET} ${HDF5_TOOLS_LIB_NAME} SHARED ${HDF5_TOOLS_PACKAGE_SOVERSION}) + set_target_properties (${HDF5_TOOLS_LIBSH_TARGET} PROPERTIES FOLDER libraries/tools COMPILE_DEFINITIONS "H5_BUILT_AS_DYNAMIC_LIB" INTERFACE_INCLUDE_DIRECTORIES "$/include>" -- cgit v0.12 From 6152dd65320487bde762171530f0465edc34fb36 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 1 Mar 2016 09:50:49 -0500 Subject: [svn-r29236] Check for shared libs only within enable-java block --- configure.ac | 232 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 116 insertions(+), 116 deletions(-) diff --git a/configure.ac b/configure.ac index d547ac5..e304481 100644 --- a/configure.ac +++ b/configure.ac @@ -214,13 +214,13 @@ fi ## turning on debug or profiling flags for the compiler. The search order ## is: ## -## CPU-VENDOR-OS -## VENDOR-OS -## CPU-OS -## CPU-VENDOR -## OS -## VENDOR -## CPU +## CPU-VENDOR-OS +## VENDOR-OS +## CPU-OS +## CPU-VENDOR +## OS +## VENDOR +## CPU ## ## If the `OS' ends with a version number then remove it. For instance, ## `freebsd3.1' would become `freebsd' @@ -458,11 +458,11 @@ fi if test "X$HDF_FORTRAN" = "Xyes"; then -## We will output an include file for Fortran, H5config_f.inc which -## contains various configure definitions used by the Fortran Library. -## Prepend H5_ to all macro names. This avoids name conflict between HDF5 macro +## We will output an include file for Fortran, H5config_f.inc which +## contains various configure definitions used by the Fortran Library. +## Prepend H5_ to all macro names. This avoids name conflict between HDF5 macro ## names and those generated by another software package that uses the HDF5 library. - AC_CONFIG_HEADERS([fortran/src/H5config_f.inc], + AC_CONFIG_HEADERS([fortran/src/H5config_f.inc], [cat fortran/src/H5config_f.inc | sed '1d;s%^/\* \(.*\) \*/%\1%;s/#define /#define H5_/;s/#undef /#undef H5_/' >fortran/src/H5config_f.inc.tmp; mv -f fortran/src/H5config_f.inc.tmp fortran/src/H5config_f.inc]) AC_SUBST([FC]) @@ -501,7 +501,7 @@ if test "X$HDF_FORTRAN" = "Xyes"; then ## Checking if the compiler supports the required Fortran 2003 features and ## stopping if it does not. PAC_PROG_FC_HAVE_F2003_REQUIREMENTS - + if test "X$HAVE_F2003_REQUIREMENTS" = "Xno"; then AC_MSG_ERROR([Fortran compiler lacks required Fortran 2003 features; unsupported Fortran 2003 compiler, remove --enable-fortran]) fi @@ -517,7 +517,7 @@ if test "X$HDF_FORTRAN" = "Xyes"; then ## See if the fortran compiler supports the intrinsic function "C_SIZEOF" PAC_PROG_FC_C_SIZEOF - + ## See if the fortran compiler supports the intrinsic function "STORAGE_SIZE" PAC_PROG_FC_STORAGE_SIZE @@ -526,12 +526,12 @@ if test "X$HDF_FORTRAN" = "Xyes"; then FC_SIZEOF_A="STORAGE_SIZE(a, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)" FC_SIZEOF_B="STORAGE_SIZE(b, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)" FC_SIZEOF_C="STORAGE_SIZE(c, c_size_t)/STORAGE_SIZE(c_char_'a',c_size_t)" - else + else if test "X$HAVE_SIZEOF_FORTRAN" = "Xyes";then FC_SIZEOF_A="SIZEOF(a)" FC_SIZEOF_B="SIZEOF(b)" FC_SIZEOF_C="SIZEOF(c)" - else + else ## If neither intrinsic functions SIZEOF or STORAGE_SIZE is available then stop configure with an error AC_MSG_ERROR([Fortran compiler requires either intrinsic functions SIZEOF or STORAGE_SIZE]) fi @@ -541,7 +541,7 @@ if test "X$HDF_FORTRAN" = "Xyes"; then PAC_PROG_FC_ISO_FORTRAN_ENV ## Check KIND and size of native integer PAC_FC_NATIVE_INTEGER - + ## Find all available KINDs PAC_FC_AVAIL_KINDS ## Find all sizeofs for available KINDs @@ -552,7 +552,7 @@ if test "X$HDF_FORTRAN" = "Xyes"; then AC_SUBST([PAC_FC_MAX_REAL_PRECISION]) AC_SUBST([PAC_FC_ALL_INTEGER_KINDS]) AC_SUBST([PAC_FC_ALL_REAL_KINDS_SIZEOF]) - AC_SUBST([PAC_FC_ALL_INTEGER_KINDS_SIZEOF]) + AC_SUBST([PAC_FC_ALL_INTEGER_KINDS_SIZEOF]) AC_SUBST([PAC_FORTRAN_NATIVE_INTEGER_KIND]) AC_SUBST([PAC_FORTRAN_NATIVE_INTEGER_SIZEOF]) AC_SUBST([PAC_FORTRAN_NATIVE_REAL_KIND]) @@ -564,8 +564,8 @@ if test "X$HDF_FORTRAN" = "Xyes"; then AC_SUBST([FORTRAN_C_LONG_DOUBLE_IS_UNIQUE]) AC_SUBST([FORTRAN_SIZEOF_LONG_DOUBLE]) AC_SUBST([H5CONFIG_F_NUM_RKIND]) - AC_SUBST([H5CONFIG_F_RKIND]) - AC_SUBST([H5CONFIG_F_RKIND_SIZEOF]) + AC_SUBST([H5CONFIG_F_RKIND]) + AC_SUBST([H5CONFIG_F_RKIND_SIZEOF]) AC_SUBST([H5CONFIG_F_NUM_IKIND]) AC_SUBST([H5CONFIG_F_IKIND]) AC_SUBST([Fortran_COMPILER_ID]) @@ -574,7 +574,7 @@ if test "X$HDF_FORTRAN" = "Xyes"; then ## Setting definition if there is a 16 byte fortran integer if `echo $PAC_FC_ALL_INTEGER_KINDS_SIZEOF | grep '16' >/dev/null`; then - HAVE_Fortran_INTEGER_SIZEOF_16="1" + HAVE_Fortran_INTEGER_SIZEOF_16="1" AC_DEFINE([HAVE_Fortran_INTEGER_SIZEOF_16], [1], [Determine if INTEGER*16 is available]) else HAVE_Fortran_INTEGER_SIZEOF_16="0" @@ -588,7 +588,7 @@ if test "X$HDF_FORTRAN" = "Xyes"; then if test "X$HAVE_C_SIZEOF_FORTRAN" = "Xyes"; then AC_DEFINE([FORTRAN_HAVE_C_SIZEOF], [1], [Define if we have Fortran intrinsic C_SIZEOF]) fi - + if test "X$HAVE_SIZEOF_FORTRAN" = "Xyes"; then AC_DEFINE([FORTRAN_HAVE_SIZEOF], [1], [Define if we have Fortran intrinsic SIZEOF]) fi @@ -596,9 +596,9 @@ if test "X$HDF_FORTRAN" = "Xyes"; then ## See if C_LONG_DOUBLE is available PAC_PROG_FC_HAVE_C_LONG_DOUBLE - FORTRAN_HAVE_C_LONG_DOUBLE="0" + FORTRAN_HAVE_C_LONG_DOUBLE="0" if test "X$HAVE_C_LONG_DOUBLE_FORTRAN" = "Xyes"; then - FORTRAN_HAVE_C_LONG_DOUBLE="1" + FORTRAN_HAVE_C_LONG_DOUBLE="1" AC_DEFINE([FORTRAN_HAVE_C_LONG_DOUBLE], [1], [Define if we have Fortran C_LONG_DOUBLE]) fi @@ -613,7 +613,7 @@ if test "X$HDF_FORTRAN" = "Xyes"; then FORTRAN_C_LONG_DOUBLE_IS_UNIQUE="0" fi fi - + FORTRAN_SIZEOF_LONG_DOUBLE=${ac_cv_sizeof_long_double} AC_DEFINE_UNQUOTED([FORTRAN_SIZEOF_LONG_DOUBLE], ["${ac_cv_sizeof_long_double}"], [Determine the size of C long double]) @@ -624,7 +624,7 @@ if test "X$HDF_FORTRAN" = "Xyes"; then dnl remove the invalid kind from the list if test "$ac_cv_sizeof___float128" != 0;then - if test "$ac_cv_sizeof___float128" != "$max_real_fortran_sizeof" && + if test "$ac_cv_sizeof___float128" != "$max_real_fortran_sizeof" && test "${ac_cv_sizeof_long_double}" != "$max_real_fortran_sizeof" && dnl account for the fact that the C compiler can have 16-byte __float128 and the Fortran compiler only has 8-byte doubles, dnl so we don't want to remove the 8-byte Fortran doubles. This is sometimes the case if different C and Fortran vendors @@ -639,7 +639,7 @@ if test "X$HDF_FORTRAN" = "Xyes"; then fi fi AC_MSG_CHECKING([for Fortran interoperable KINDS with C]) - AC_MSG_RESULT([$PAC_FC_ALL_REAL_KINDS]) + AC_MSG_RESULT([$PAC_FC_ALL_REAL_KINDS]) dnl count the number of real kinds H5CONFIG_F_NUM_RKIND="INTEGER, PARAMETER :: num_rkinds = `echo \"[$]PAC_FC_ALL_REAL_KINDS\" | tr -d -c ',\n' | awk '{ print length + 1; }'`" @@ -669,7 +669,7 @@ HDF_CXX=no ## AC_PROG_CXX defines some macros that Automake 1.9.x uses and will ## miss even if c++ is not enabled. AC_PROG_CXX -AC_PROG_CXXCPP ## this is checked for when AC_HEADER_STDC is done +AC_PROG_CXXCPP ## this is checked for when AC_HEADER_STDC is done AC_MSG_CHECKING([if c++ interface enabled]) @@ -802,36 +802,36 @@ fi ## The following variables are used to distinguish between building a ## serial and parallel library. ## -## HAVE_PARALLEL -- defined in H5config.h if we are building -## a parallel library even if configure wasn't -## able to find some header file or library that -## might be required. This is defined if the -## user explicitly states -## that a parallel library is being built by supplying -## the `--enable-parallel' configure switch. -## -## PARALLEL -- This variable is set to a non-null value if -## we're building a parallel version of the library. -## -## RUNSERIAL -- This is a command which will be prepended to -## the executable name to run the executable using -## a single process. For serial versions of the -## library this will normally be empty. For parallel -## versions it might be something like `mpiexec -n 1'. -## The value of this variable is substituted in *.in -## files. -## -## RUNPARALLEL -- This is a command which will be prepended to -## the executable name to run the executable on -## multiple processors. For the serial library the -## value will normally be the empty string. For -## parallel library it should be something like -## "mpiexec -n \$\${NPROCS:=6}" where NPROCS will -## eventually contain the number of processors on which -## to run the executable (the double dollarsigns are to -## protect the expansion until make executes the -## command). The value of this variable is -## substituted in *.in files. +## HAVE_PARALLEL -- defined in H5config.h if we are building +## a parallel library even if configure wasn't +## able to find some header file or library that +## might be required. This is defined if the +## user explicitly states +## that a parallel library is being built by supplying +## the `--enable-parallel' configure switch. +## +## PARALLEL -- This variable is set to a non-null value if +## we're building a parallel version of the library. +## +## RUNSERIAL -- This is a command which will be prepended to +## the executable name to run the executable using +## a single process. For serial versions of the +## library this will normally be empty. For parallel +## versions it might be something like `mpiexec -n 1'. +## The value of this variable is substituted in *.in +## files. +## +## RUNPARALLEL -- This is a command which will be prepended to +## the executable name to run the executable on +## multiple processors. For the serial library the +## value will normally be the empty string. For +## parallel library it should be something like +## "mpiexec -n \$\${NPROCS:=6}" where NPROCS will +## eventually contain the number of processors on which +## to run the executable (the double dollarsigns are to +## protect the expansion until make executes the +## command). The value of this variable is +## substituted in *.in files. ## AC_SUBST([PARALLEL]) AC_SUBST([RUNSERIAL]) @@ -864,36 +864,36 @@ AC_ARG_ENABLE([java], [HDF_JAVA=$enableval], [HDF_JAVA=no]) -if test "X$HDF_JAVA" = "Xyes" && test "X${enable_shared}" != "Xno"; then - echo "yes" - if test "X$CLASSPATH" = "X"; then - H5_CLASSPATH=".:$srcdir/java/lib" - else - H5_CLASSPATH=".:$CLASSPATH:$srcdir/java/lib" - fi -## Checks for programs. - AX_JAVA_OPTIONS - H5_JAVACFLAGS=$JAVACFLAGS - H5_JAVAFLAGS=$JAVAFLAGS - AX_PROG_JAVAC - AX_PROG_JAVA - AX_PROG_JAR - AX_PROG_JAVADOC - ## Find the include directories needed for building JNI code - AX_JNI_INCLUDE_DIR() - for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS - do - JNIFLAGS="$JNIFLAGS -I$JNI_INCLUDE_DIR" - done - ## Find junit for testing the JNI code - AX_CHECK_CLASSPATH() - CLASSPATH_ENV=$H5_CLASSPATH - AX_CHECK_JUNIT() - AX_CHECK_JAVA_HOME +if test "X$HDF_JAVA" = "Xyes" + if test "X${enable_shared}" != "Xno"; then + echo "yes" + if test "X$CLASSPATH" = "X"; then + H5_CLASSPATH=".:$srcdir/java/lib" + else + H5_CLASSPATH=".:$CLASSPATH:$srcdir/java/lib" + fi + ## Checks for programs. + AX_JAVA_OPTIONS + H5_JAVACFLAGS=$JAVACFLAGS + H5_JAVAFLAGS=$JAVAFLAGS + AX_PROG_JAVAC + AX_PROG_JAVA + AX_PROG_JAR + AX_PROG_JAVADOC + ## Find the include directories needed for building JNI code + AX_JNI_INCLUDE_DIR() + for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS + do + JNIFLAGS="$JNIFLAGS -I$JNI_INCLUDE_DIR" + done + ## Find junit for testing the JNI code + AX_CHECK_CLASSPATH() + CLASSPATH_ENV=$H5_CLASSPATH + AX_CHECK_JUNIT() + AX_CHECK_JAVA_HOME - AC_MSG_RESULT([yes]) -else - if test "X${enable_shared}" = "Xno"; then + AC_MSG_RESULT([yes]) + else AC_MSG_ERROR([Java requires shared libraries to be built]) fi HDF_JAVA="no" @@ -1888,7 +1888,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ double d; } u; } di_struct_t; - di_struct_t x = {0, { .d = 0.0}}; ]])], + di_struct_t x = {0, { .d = 0.0}}; ]])], [AC_DEFINE([HAVE_C99_DESIGNATED_INITIALIZER], [1], [Define if the compiler understands C99 designated initialization of structs and unions]) AC_MSG_RESULT([yes])], @@ -2088,7 +2088,7 @@ AC_ARG_ENABLE([optimization], at several levels: High, with aggressive optimizations turned on; debug, with optimizations that are unlikely to interfere with debugging or profiling; - and none, with no optimizations at all. + and none, with no optimizations at all. See the compiler-specific config/*-flags file for more details. Alternatively, optimization options can @@ -2446,11 +2446,11 @@ case "X-$enable_parallel" in ## Try link a simple MPI program. AC_MSG_CHECKING([whether a simple MPI-IO C program can be linked]) AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], - [[ MPI_Init(0, (void *)0); - MPI_File_open(0, (void *)0, 0, 0, (void *)0);]])], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - AC_MSG_ERROR([unable to link a simple MPI-IO C program])]) + [[ MPI_Init(0, (void *)0); + MPI_File_open(0, (void *)0, 0, 0, (void *)0);]])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AC_MSG_ERROR([unable to link a simple MPI-IO C program])]) if test "X$HDF_FORTRAN" = "Xyes"; then PAC_PROG_FC_MPI_CHECK @@ -2721,13 +2721,13 @@ fi ## ---------------------------------------------------------------------- ## Decide whether the data accuracy has higher priority during data ## conversions. If not, some hard conversions will still be prefered even -## though the data may be wrong (for example, some compilers don't +## though the data may be wrong (for example, some compilers don't ## support denormalized floating values) to maximize speed. -## +## AC_MSG_CHECKING([whether data accuracy is guaranteed during data conversions]) AC_ARG_ENABLE([dconv-accuracy], [AS_HELP_STRING([--enable-dconv-accuracy], - [if data accuracy is guaranteed during + [if data accuracy is guaranteed during data conversions [default=yes]])], [DATA_ACCURACY=$enableval], [DATA_ACCURACY=yes]) @@ -2943,19 +2943,19 @@ else unsigned long long ull; unsigned char s[16]; int ret = 0; - + if(sizeof(long double) == 16) { - /*make sure the long double type is the same as the failing type + /*make sure the long double type is the same as the failing type *which has 16 bytes in size and 11 bits of exponent. If it is, - *the bit sequence should be like below. It's not - *a decent way to check but this info isn't available. */ + *the bit sequence should be like below. It's not + *a decent way to check but this info isn't available. */ memcpy(s, &ld, 16); if(s[0]==0x43 && s[1]==0x51 && s[2]==0xcc && s[3]==0xf3 && s[4]==0x85 && s[5]==0xeb && s[6]==0xc8 && s[7]==0xa0 && s[8]==0xbf && s[9]==0xcc && s[10]==0x2a && s[11]==0x3c) { /*slightly adjust the bit sequence (s[8]=0xdf). The converted - *values will go wild on Mac OS 10.4 and IRIX64 6.5.*/ + *values will go wild on Mac OS 10.4 and IRIX64 6.5.*/ s[0]=0x43; s[1]=0x51; s[2]=0xcc; s[3]=0xf3; s[4]=0x85; s[5]=0xeb; s[6]=0xc8; s[7]=0xa0; s[8]=0xdf; s[9]=0xcc; s[10]=0x2a; s[11]=0x3c; @@ -2964,11 +2964,11 @@ else memcpy(&ld, s, 16); ll = (long long)ld; ull = (unsigned long long)ld; - + if(ll != 20041683600089728 || ull != 20041683600089728) ret = 1; - } - } + } + } done: exit(ret); } @@ -3006,17 +3006,17 @@ else unsigned long long ull; unsigned char s[16]; int flag=0, ret=0; - + /*Determine if long double has 16 byte in size, 11 bit exponent, and - *the bias is 0x3ff */ - if(sizeof(long double) == 16) { + *the bias is 0x3ff */ + if(sizeof(long double) == 16) { ld = 1.0L; memcpy(s, &ld, 16); if(s[0]==0x3f && s[1]==0xf0 && s[2]==0x00 && s[3]==0x00 && - s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00) - flag = 1; + s[4]==0x00 && s[5]==0x00 && s[6]==0x00 && s[7]==0x00) + flag = 1; } - + if(flag==1 && sizeof(long long)==8) { ll = 0x01ffffffffffffffLL; ld = (long double)ll; @@ -3026,7 +3026,7 @@ else s[4]!=0xff || s[5]!=0xff || s[6]!=0xff || s[7]!=0xff || s[8]!=0xf0 || s[9]!=0x00 || s[10]!=0x00 || s[11]!=0x00) ret = 1; - } + } if(flag==1 && sizeof(unsigned long long)==8) { ull = 0x01ffffffffffffffULL; ld = (long double)ull; @@ -3035,11 +3035,11 @@ else s[4]!=0xff || s[5]!=0xff || s[6]!=0xff || s[7]!=0xff || s[8]!=0xf0 || s[9]!=0x00 || s[10]!=0x00 || s[11]!=0x00) ret = 1; - } + } done: exit(ret); } - ]])],[hdf5_cv_llong_to_ldouble_correct=yes], [hdf5_cv_llong_to_ldouble_correct=no],[])]) + ]])],[hdf5_cv_llong_to_ldouble_correct=yes], [hdf5_cv_llong_to_ldouble_correct=no],[])]) fi if test ${hdf5_cv_llong_to_ldouble_correct} = "yes"; then @@ -3316,9 +3316,9 @@ esac AC_MSG_CHECKING([whether to have library information embedded in the executables]) AC_ARG_ENABLE([embedded-libinfo], [AS_HELP_STRING([--enable-embedded-libinfo], - [Enable embedded library information [default=yes]])], - [enable_embedded_libinfo=$enableval], - [enable_embedded_libinfo=yes]) + [Enable embedded library information [default=yes]])], + [enable_embedded_libinfo=$enableval], + [enable_embedded_libinfo=yes]) if test "${enable_embedded_libinfo}" = "yes"; then AC_MSG_RESULT([yes]) -- cgit v0.12 From 16e529f5a9309b7fffaa856a5b7600152cf43da8 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 1 Mar 2016 10:04:39 -0500 Subject: [svn-r29237] Missed a "then" --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index e304481..4aa3f74 100644 --- a/configure.ac +++ b/configure.ac @@ -864,7 +864,7 @@ AC_ARG_ENABLE([java], [HDF_JAVA=$enableval], [HDF_JAVA=no]) -if test "X$HDF_JAVA" = "Xyes" +if test "X$HDF_JAVA" = "Xyes"; then if test "X${enable_shared}" != "Xno"; then echo "yes" if test "X$CLASSPATH" = "X"; then -- cgit v0.12 From 7705a4d914c4b5aaa0607137ef3554ff2423ab16 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 1 Mar 2016 10:25:56 -0500 Subject: [svn-r29239] Add HDF_JAVA AC_SUST line for settings file --- configure.ac | 3 +++ 1 file changed, 3 insertions(+) diff --git a/configure.ac b/configure.ac index 4aa3f74..5fd8de3 100644 --- a/configure.ac +++ b/configure.ac @@ -855,6 +855,9 @@ esac ## Check if they would like the Java native interface (JNI) compiled ## +## This needs to be exposed for the library info file even if JAVA is disabled. +AC_SUBST([HDF_JAVA]) + AC_SUBST([H5_CLASSPATH]) H5_CLASSPATH="" AC_MSG_CHECKING([if Java JNI interface enabled]) -- cgit v0.12 From 281a4901f6c8cf04f53f2ddaac96fe8da1fe8345 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 1 Mar 2016 11:00:56 -0500 Subject: [svn-r29242] Set default or override val --- configure.ac | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 5fd8de3..d51511a 100644 --- a/configure.ac +++ b/configure.ac @@ -858,14 +858,16 @@ esac ## This needs to be exposed for the library info file even if JAVA is disabled. AC_SUBST([HDF_JAVA]) +## Default is no JAVA +HDF_JAVA=no + AC_SUBST([H5_CLASSPATH]) H5_CLASSPATH="" AC_MSG_CHECKING([if Java JNI interface enabled]) AC_ARG_ENABLE([java], [AS_HELP_STRING([--enable-java], [Compile the Java JNI interface [default=no]])], - [HDF_JAVA=$enableval], - [HDF_JAVA=no]) + [HDF_JAVA=$enableval]) if test "X$HDF_JAVA" = "Xyes"; then if test "X${enable_shared}" != "Xno"; then -- cgit v0.12 From c9c8ec5f7c64c3cdb746c4d15084a7f524ea2998 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Tue, 1 Mar 2016 11:28:33 -0500 Subject: [svn-r29245] use HDONE_ERROR instead of HGOTO after done. --- src/H5Dio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/H5Dio.c b/src/H5Dio.c index 3a022c3..ae42702 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -548,7 +548,7 @@ done: #ifdef H5_DEBUG_BUILD /* release the metadata dxpl that was copied in the init function */ if(H5I_dec_ref(io_info.md_dxpl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close metadata dxpl") + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close metadata dxpl") #endif /* H5_DEBUG_BUILD */ #ifdef H5_HAVE_PARALLEL /* Shut down io_info struct */ @@ -808,7 +808,7 @@ done: #ifdef H5_DEBUG_BUILD /* release the metadata dxpl that was copied in the init function */ if(H5I_dec_ref(io_info.md_dxpl_id) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close metadata dxpl") + HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, FAIL, "can't close metadata dxpl") #endif /* H5_DEBUG_BUILD */ #ifdef H5_HAVE_PARALLEL /* Shut down io_info struct */ -- cgit v0.12 From e836bfd01011cd3b669f107a18980b5d1335d794 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 1 Mar 2016 12:48:41 -0500 Subject: [svn-r29247] Fix return type --- java/src/jni/h5tImp.c | 6 +++--- java/src/jni/h5tImp.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/java/src/jni/h5tImp.c b/java/src/jni/h5tImp.c index 83882a0..1f587de 100644 --- a/java/src/jni/h5tImp.c +++ b/java/src/jni/h5tImp.c @@ -1386,9 +1386,9 @@ Java_hdf_hdf5lib_H5_H5Tis_1variable_1str(JNIEnv *env, jclass clss, jlong type_id /* * Class: hdf_hdf5lib_H5 * Method: H5Tget_native_type - * Signature: (JI)I + * Signature: (JI)J */ -JNIEXPORT jint JNICALL +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tget_1native_1type(JNIEnv *env, jclass clss, jlong type_id, jint direction) { hid_t native_tid = -1; @@ -1398,7 +1398,7 @@ Java_hdf_hdf5lib_H5__1H5Tget_1native_1type(JNIEnv *env, jclass clss, jlong type_ if (native_tid < 0) h5libraryError(env); - return (jint)native_tid; + return (jlong)native_tid; } /* end Java_hdf_hdf5lib_H5__1H5Tget_1native_1type */ /* diff --git a/java/src/jni/h5tImp.h b/java/src/jni/h5tImp.h index f9e6985..9755a91 100644 --- a/java/src/jni/h5tImp.h +++ b/java/src/jni/h5tImp.h @@ -498,9 +498,9 @@ JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Tis_1variable_1str /* * Class: hdf_hdf5lib_H5 * Method: H5Tget_native_type - * Signature: (JI)I + * Signature: (JI)J */ -JNIEXPORT jint JNICALL Java_hdf_hdf5lib_H5__1H5Tget_1native_1type +JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5__1H5Tget_1native_1type (JNIEnv *, jclass, jlong, jint); /* -- cgit v0.12 From 16f23888326b0350a28505a0c368cda8941de837 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 1 Mar 2016 12:54:56 -0500 Subject: [svn-r29248] Fix test results for HDF_JAVA --- configure.ac | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index d51511a..b4492b1 100644 --- a/configure.ac +++ b/configure.ac @@ -900,8 +900,10 @@ if test "X$HDF_JAVA" = "Xyes"; then AC_MSG_RESULT([yes]) else AC_MSG_ERROR([Java requires shared libraries to be built]) + HDF_JAVA="no" + AC_MSG_RESULT([no]) fi - HDF_JAVA="no" +else AC_MSG_RESULT([no]) fi -- cgit v0.12 From f0a7f5978eee69d9ac297179b1bc48e95df30840 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 3 Mar 2016 08:56:44 -0500 Subject: [svn-r29257] HDFFV-9705: h5dump should not print filters or allocation time info for VDS files --- tools/lib/h5tools_dump.c | 317 +++++++++++++++--------------- tools/testfiles/vds/tvds_layout-1.ddl | 6 - tools/testfiles/vds/tvds_layout-2.ddl | 6 - tools/testfiles/vds/tvds_layout-3_1.ddl | 6 - tools/testfiles/vds/tvds_layout-3_2.ddl | 6 - tools/testfiles/vds/tvds_layout-4.ddl | 6 - tools/testfiles/vds/tvds_layout-5.ddl | 6 - tools/testfiles/vds/vds_layout-eiger.ddl | 6 - tools/testfiles/vds/vds_layout-maxmin.ddl | 6 - 9 files changed, 160 insertions(+), 205 deletions(-) diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 1876e4f..b19a755 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -2869,7 +2869,7 @@ h5tools_dump_oid(FILE *stream, const h5tool_format_t *info, *------------------------------------------------------------------------- */ static void -h5tools_print_virtual_selection(hid_t vspace, +h5tools_print_virtual_selection(hid_t vspace, FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx/*in,out*/, h5tools_str_t *buffer/*string into which to render */, @@ -3308,175 +3308,176 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, * FILTERS *------------------------------------------------------------------------- */ - + if (H5D_VIRTUAL != stl) { ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); - - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "%s %s", FILTERS, BEGIN); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); - ctx->indent_level++; + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s", FILTERS, BEGIN); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - if(nfilters) { - for(i = 0; i < nfilters; i++) { - cd_nelmts = NELMTS(cd_values); - filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts, - cd_values, sizeof(f_name), f_name, NULL); + ctx->indent_level++; - if(filtn < 0) - continue; /* nothing to print for invalid filter */ + if(nfilters) { + for(i = 0; i < nfilters; i++) { + cd_nelmts = NELMTS(cd_values); + filtn = H5Pget_filter2(dcpl_id, (unsigned)i, &filt_flags, &cd_nelmts, + cd_values, sizeof(f_name), f_name, NULL); - ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + if(filtn < 0) + continue; /* nothing to print for invalid filter */ - h5tools_str_reset(&buffer); - switch(filtn) { - case H5Z_FILTER_DEFLATE: - h5tools_str_append(&buffer, "%s %s %s %d %s", DEFLATE, BEGIN, DEFLATE_LEVEL, cd_values[0], END); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - break; - case H5Z_FILTER_SHUFFLE: - h5tools_str_append(&buffer, "%s", SHUFFLE); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - break; - case H5Z_FILTER_FLETCHER32: - h5tools_str_append(&buffer, "%s", FLETCHER32); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - break; - case H5Z_FILTER_SZIP: - szip_options_mask = cd_values[0];; - szip_pixels_per_block = cd_values[1]; - - h5tools_str_append(&buffer, "%s %s", SZIP, BEGIN); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); - ctx->indent_level++; + h5tools_str_reset(&buffer); + switch(filtn) { + case H5Z_FILTER_DEFLATE: + h5tools_str_append(&buffer, "%s %s %s %d %s", DEFLATE, BEGIN, DEFLATE_LEVEL, cd_values[0], END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + break; + case H5Z_FILTER_SHUFFLE: + h5tools_str_append(&buffer, "%s", SHUFFLE); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + break; + case H5Z_FILTER_FLETCHER32: + h5tools_str_append(&buffer, "%s", FLETCHER32); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + break; + case H5Z_FILTER_SZIP: + szip_options_mask = cd_values[0];; + szip_pixels_per_block = cd_values[1]; - ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + h5tools_str_append(&buffer, "%s %s", SZIP, BEGIN); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "PIXELS_PER_BLOCK %d", szip_pixels_per_block); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + ctx->indent_level++; - ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); - h5tools_str_reset(&buffer); - if(szip_options_mask & H5_SZIP_CHIP_OPTION_MASK) - h5tools_str_append(&buffer, "MODE %s", "HARDWARE"); - else if(szip_options_mask & H5_SZIP_ALLOW_K13_OPTION_MASK) - h5tools_str_append(&buffer, "MODE %s", "K13"); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "PIXELS_PER_BLOCK %d", szip_pixels_per_block); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); - h5tools_str_reset(&buffer); - if(szip_options_mask & H5_SZIP_EC_OPTION_MASK) - h5tools_str_append(&buffer, "CODING %s", "ENTROPY"); - else if(szip_options_mask & H5_SZIP_NN_OPTION_MASK) - h5tools_str_append(&buffer, "CODING %s", "NEAREST NEIGHBOUR"); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_reset(&buffer); + if(szip_options_mask & H5_SZIP_CHIP_OPTION_MASK) + h5tools_str_append(&buffer, "MODE %s", "HARDWARE"); + else if(szip_options_mask & H5_SZIP_ALLOW_K13_OPTION_MASK) + h5tools_str_append(&buffer, "MODE %s", "K13"); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); - h5tools_str_reset(&buffer); - if(szip_options_mask & H5_SZIP_LSB_OPTION_MASK) - h5tools_str_append(&buffer, "BYTE_ORDER %s", "LSB"); - else if(szip_options_mask & H5_SZIP_MSB_OPTION_MASK) - h5tools_str_append(&buffer, "BYTE_ORDER %s", "MSB"); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_reset(&buffer); + if(szip_options_mask & H5_SZIP_EC_OPTION_MASK) + h5tools_str_append(&buffer, "CODING %s", "ENTROPY"); + else if(szip_options_mask & H5_SZIP_NN_OPTION_MASK) + h5tools_str_append(&buffer, "CODING %s", "NEAREST NEIGHBOUR"); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - if(szip_options_mask & H5_SZIP_RAW_OPTION_MASK) { ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "HEADER %s", "RAW"); + if(szip_options_mask & H5_SZIP_LSB_OPTION_MASK) + h5tools_str_append(&buffer, "BYTE_ORDER %s", "LSB"); + else if(szip_options_mask & H5_SZIP_MSB_OPTION_MASK) + h5tools_str_append(&buffer, "BYTE_ORDER %s", "MSB"); h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - } - ctx->indent_level--; + if(szip_options_mask & H5_SZIP_RAW_OPTION_MASK) { + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); - ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "HEADER %s", "RAW"); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + } - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "%s", END); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - break; - case H5Z_FILTER_NBIT: - h5tools_str_append(&buffer, "%s", NBIT); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - break; - case H5Z_FILTER_SCALEOFFSET: - h5tools_str_append(&buffer, "%s %s %s %d %s", SCALEOFFSET, BEGIN, SCALEOFFSET_MINBIT, cd_values[0], END); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - break; - default: - h5tools_str_append(&buffer, "%s %s", "USER_DEFINED_FILTER", BEGIN); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + ctx->indent_level--; - ctx->indent_level++; + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); - ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s", END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + break; + case H5Z_FILTER_NBIT: + h5tools_str_append(&buffer, "%s", NBIT); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + break; + case H5Z_FILTER_SCALEOFFSET: + h5tools_str_append(&buffer, "%s %s %s %d %s", SCALEOFFSET, BEGIN, SCALEOFFSET_MINBIT, cd_values[0], END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + break; + default: + h5tools_str_append(&buffer, "%s %s", "USER_DEFINED_FILTER", BEGIN); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "FILTER_ID %d", filtn); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + ctx->indent_level++; - if(f_name[0] != '\0') { ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "COMMENT %s", f_name); + h5tools_str_append(&buffer, "FILTER_ID %d", filtn); h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - } - if (cd_nelmts) { + + if(f_name[0] != '\0') { + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "COMMENT %s", f_name); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + } + if (cd_nelmts) { + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s %s ","PARAMS", BEGIN); + for (j=0; jindent_level--; + ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "%s %s ","PARAMS", BEGIN); - for (j=0; jindent_level--; + break; + }/*switch*/ + } /*i*/ + }/*nfilters*/ + else { - ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "%s",END); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - break; - }/*switch*/ - } /*i*/ - }/*nfilters*/ - else { + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "NONE"); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + } + ctx->indent_level--; ctx->need_prefix = TRUE; h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "NONE"); + h5tools_str_append(&buffer, "%s",END); h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - } - ctx->indent_level--; - - ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); - - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "%s",END); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + } /* end if (H5D_VIRTUAL != stl) */ /*------------------------------------------------------------------------- * FILLVALUE @@ -3542,46 +3543,48 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, * ALLOCATION_TIME *------------------------------------------------------------------------- */ - ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + if (H5D_VIRTUAL != stl) { + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "ALLOCATION_TIME %s", BEGIN); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "ALLOCATION_TIME %s", BEGIN); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - ctx->indent_level++; + ctx->indent_level++; - ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); - h5tools_str_reset(&buffer); - H5Pget_alloc_time(dcpl_id, &at); - switch(at) { - case H5D_ALLOC_TIME_EARLY: - h5tools_str_append(&buffer, "%s", "H5D_ALLOC_TIME_EARLY"); - break; - case H5D_ALLOC_TIME_INCR: - h5tools_str_append(&buffer, "%s", "H5D_ALLOC_TIME_INCR"); - break; - case H5D_ALLOC_TIME_LATE: - h5tools_str_append(&buffer, "%s", "H5D_ALLOC_TIME_LATE"); - break; - case H5D_ALLOC_TIME_ERROR: - case H5D_ALLOC_TIME_DEFAULT: - default: - HDassert(0); - break; - } - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_reset(&buffer); + H5Pget_alloc_time(dcpl_id, &at); + switch(at) { + case H5D_ALLOC_TIME_EARLY: + h5tools_str_append(&buffer, "%s", "H5D_ALLOC_TIME_EARLY"); + break; + case H5D_ALLOC_TIME_INCR: + h5tools_str_append(&buffer, "%s", "H5D_ALLOC_TIME_INCR"); + break; + case H5D_ALLOC_TIME_LATE: + h5tools_str_append(&buffer, "%s", "H5D_ALLOC_TIME_LATE"); + break; + case H5D_ALLOC_TIME_ERROR: + case H5D_ALLOC_TIME_DEFAULT: + default: + HDassert(0); + break; + } + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); - ctx->indent_level--; + ctx->indent_level--; - ctx->need_prefix = TRUE; - h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); + ctx->need_prefix = TRUE; + h5tools_simple_prefix(stream, info, ctx, curr_pos, 0); - h5tools_str_reset(&buffer); - h5tools_str_append(&buffer, "%s", END); - h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + h5tools_str_reset(&buffer); + h5tools_str_append(&buffer, "%s", END); + h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); + } /* end if (H5D_VIRTUAL != stl) */ h5tools_str_close(&buffer); } diff --git a/tools/testfiles/vds/tvds_layout-1.ddl b/tools/testfiles/vds/tvds_layout-1.ddl index 5d8a62c..b5351f2 100644 --- a/tools/testfiles/vds/tvds_layout-1.ddl +++ b/tools/testfiles/vds/tvds_layout-1.ddl @@ -125,16 +125,10 @@ GROUP "/" { } } } - FILTERS { - NONE - } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET VALUE -9 } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } DATA { (0,0,0): 10, 10, 10, 10, 10, 10, 10, 10, (0,1,0): 10, 10, 10, 10, 10, 10, 10, 10, diff --git a/tools/testfiles/vds/tvds_layout-2.ddl b/tools/testfiles/vds/tvds_layout-2.ddl index af6b718..53407c7 100644 --- a/tools/testfiles/vds/tvds_layout-2.ddl +++ b/tools/testfiles/vds/tvds_layout-2.ddl @@ -105,16 +105,10 @@ GROUP "/" { } } } - FILTERS { - NONE - } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET VALUE -9 } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } DATA { (0,0,0): 10, 10, 10, 10, 10, 10, 10, 40, 40, 40, 40, 40, 40, 40, (0,1,0): 10, 10, 10, 10, 10, 10, 10, 40, 40, 40, 40, 40, 40, 40, diff --git a/tools/testfiles/vds/tvds_layout-3_1.ddl b/tools/testfiles/vds/tvds_layout-3_1.ddl index 968327d..e75fe36 100644 --- a/tools/testfiles/vds/tvds_layout-3_1.ddl +++ b/tools/testfiles/vds/tvds_layout-3_1.ddl @@ -125,16 +125,10 @@ GROUP "/" { } } } - FILTERS { - NONE - } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET VALUE -9 } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } DATA { (0,0,0): -9, -9, -9, -9, -9, -9, -9, -9, (0,1,0): 10, 10, 10, 10, 10, 10, 10, 10, diff --git a/tools/testfiles/vds/tvds_layout-3_2.ddl b/tools/testfiles/vds/tvds_layout-3_2.ddl index 7e14ec2..5b63269 100644 --- a/tools/testfiles/vds/tvds_layout-3_2.ddl +++ b/tools/testfiles/vds/tvds_layout-3_2.ddl @@ -105,16 +105,10 @@ GROUP "/" { } } } - FILTERS { - NONE - } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET VALUE -9 } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } DATA { (0,0,0): -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, (0,0,15): -9, -9, -9, -9, diff --git a/tools/testfiles/vds/tvds_layout-4.ddl b/tools/testfiles/vds/tvds_layout-4.ddl index 018644e..a449d0c 100644 --- a/tools/testfiles/vds/tvds_layout-4.ddl +++ b/tools/testfiles/vds/tvds_layout-4.ddl @@ -25,16 +25,10 @@ GROUP "/" { } } } - FILTERS { - NONE - } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET VALUE -9 } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } DATA { (0,0,0): 10, 10, 10, 10, (0,1,0): 10, 10, 10, 10, diff --git a/tools/testfiles/vds/tvds_layout-5.ddl b/tools/testfiles/vds/tvds_layout-5.ddl index b43629a..1698eb4 100644 --- a/tools/testfiles/vds/tvds_layout-5.ddl +++ b/tools/testfiles/vds/tvds_layout-5.ddl @@ -65,16 +65,10 @@ GROUP "/" { } } } - FILTERS { - NONE - } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET VALUE -9 } - ALLOCATION_TIME { - H5D_ALLOC_TIME_INCR - } DATA { (0,0,0): 10, 10, 10, 10, (0,1,0): 10, 10, 10, 10, diff --git a/tools/testfiles/vds/vds_layout-eiger.ddl b/tools/testfiles/vds/vds_layout-eiger.ddl index 0ea4994..eb448ab 100644 --- a/tools/testfiles/vds/vds_layout-eiger.ddl +++ b/tools/testfiles/vds/vds_layout-eiger.ddl @@ -20,16 +20,10 @@ GROUP "/" { } } } - FILTERS { - NONE - } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET VALUE 0 } - ALLOCATION_TIME { - H5D_ALLOC_TIME_LATE - } DATA { (0,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (0,1,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/tools/testfiles/vds/vds_layout-maxmin.ddl b/tools/testfiles/vds/vds_layout-maxmin.ddl index 0b5b583..fb58815 100644 --- a/tools/testfiles/vds/vds_layout-maxmin.ddl +++ b/tools/testfiles/vds/vds_layout-maxmin.ddl @@ -85,16 +85,10 @@ GROUP "/" { } } } - FILTERS { - NONE - } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET VALUE 0 } - ALLOCATION_TIME { - H5D_ALLOC_TIME_LATE - } DATA { (0,0,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, (0,1,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -- cgit v0.12 From 28ee82a07b127484de618ca72f9c0caf049d79fe Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 3 Mar 2016 09:07:49 -0500 Subject: [svn-r29259] HDFFV-9066: Improve h5dump usage statement for -O F, -ddl=F option. --- tools/h5dump/h5dump.c | 2 +- tools/testfiles/h5dump-help.txt | 2 +- tools/testfiles/pbits/tnofilename-with-packed-bits.ddl | 2 +- tools/testfiles/pbits/tpbitsIncomplete.ddl | 2 +- tools/testfiles/pbits/tpbitsLengthExceeded.ddl | 2 +- tools/testfiles/pbits/tpbitsLengthPositive.ddl | 2 +- tools/testfiles/pbits/tpbitsMaxExceeded.ddl | 2 +- tools/testfiles/pbits/tpbitsOffsetExceeded.ddl | 2 +- tools/testfiles/pbits/tpbitsOffsetNegative.ddl | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/h5dump/h5dump.c b/tools/h5dump/h5dump.c index 7c24fa4..553db93 100644 --- a/tools/h5dump/h5dump.c +++ b/tools/h5dump/h5dump.c @@ -244,7 +244,7 @@ usage(const char *prog) PRINTVALSTREAM(rawoutstream, " -o F, --output=F Output raw data into file F\n"); PRINTVALSTREAM(rawoutstream, " -b B, --binary=B Binary file output, of form B\n"); PRINTVALSTREAM(rawoutstream, " -O F, --ddl=F Output ddl text into file F\n"); - PRINTVALSTREAM(rawoutstream, " Do not use filename F to suppress ddl display\n"); + PRINTVALSTREAM(rawoutstream, " Use blank(empty) filename F to suppress ddl display\n"); PRINTVALSTREAM(rawoutstream, "--------------- Object Options ---------------\n"); PRINTVALSTREAM(rawoutstream, " -a P, --attribute=P Print the specified attribute\n"); PRINTVALSTREAM(rawoutstream, " If an attribute name contains a slash (/), escape the\n"); diff --git a/tools/testfiles/h5dump-help.txt b/tools/testfiles/h5dump-help.txt index 7ebefc6..fe22a1b 100644 --- a/tools/testfiles/h5dump-help.txt +++ b/tools/testfiles/h5dump-help.txt @@ -11,7 +11,7 @@ usage: h5dump [OPTIONS] files -o F, --output=F Output raw data into file F -b B, --binary=B Binary file output, of form B -O F, --ddl=F Output ddl text into file F - Do not use filename F to suppress ddl display + Use blank(empty) filename F to suppress ddl display --------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the diff --git a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl index 1a1b7e8..767cbbf 100644 --- a/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl +++ b/tools/testfiles/pbits/tnofilename-with-packed-bits.ddl @@ -11,7 +11,7 @@ usage: h5dump [OPTIONS] files -o F, --output=F Output raw data into file F -b B, --binary=B Binary file output, of form B -O F, --ddl=F Output ddl text into file F - Do not use filename F to suppress ddl display + Use blank(empty) filename F to suppress ddl display --------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the diff --git a/tools/testfiles/pbits/tpbitsIncomplete.ddl b/tools/testfiles/pbits/tpbitsIncomplete.ddl index 2a2778a..d791b41 100644 --- a/tools/testfiles/pbits/tpbitsIncomplete.ddl +++ b/tools/testfiles/pbits/tpbitsIncomplete.ddl @@ -11,7 +11,7 @@ usage: h5dump [OPTIONS] files -o F, --output=F Output raw data into file F -b B, --binary=B Binary file output, of form B -O F, --ddl=F Output ddl text into file F - Do not use filename F to suppress ddl display + Use blank(empty) filename F to suppress ddl display --------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the diff --git a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl index 5e00073..5235aa7 100644 --- a/tools/testfiles/pbits/tpbitsLengthExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsLengthExceeded.ddl @@ -11,7 +11,7 @@ usage: h5dump [OPTIONS] files -o F, --output=F Output raw data into file F -b B, --binary=B Binary file output, of form B -O F, --ddl=F Output ddl text into file F - Do not use filename F to suppress ddl display + Use blank(empty) filename F to suppress ddl display --------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the diff --git a/tools/testfiles/pbits/tpbitsLengthPositive.ddl b/tools/testfiles/pbits/tpbitsLengthPositive.ddl index f2574d4..697bff8 100644 --- a/tools/testfiles/pbits/tpbitsLengthPositive.ddl +++ b/tools/testfiles/pbits/tpbitsLengthPositive.ddl @@ -11,7 +11,7 @@ usage: h5dump [OPTIONS] files -o F, --output=F Output raw data into file F -b B, --binary=B Binary file output, of form B -O F, --ddl=F Output ddl text into file F - Do not use filename F to suppress ddl display + Use blank(empty) filename F to suppress ddl display --------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the diff --git a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl index 15c0abc..900c0b5 100644 --- a/tools/testfiles/pbits/tpbitsMaxExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsMaxExceeded.ddl @@ -11,7 +11,7 @@ usage: h5dump [OPTIONS] files -o F, --output=F Output raw data into file F -b B, --binary=B Binary file output, of form B -O F, --ddl=F Output ddl text into file F - Do not use filename F to suppress ddl display + Use blank(empty) filename F to suppress ddl display --------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the diff --git a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl index c62e290..65123d0 100644 --- a/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl +++ b/tools/testfiles/pbits/tpbitsOffsetExceeded.ddl @@ -11,7 +11,7 @@ usage: h5dump [OPTIONS] files -o F, --output=F Output raw data into file F -b B, --binary=B Binary file output, of form B -O F, --ddl=F Output ddl text into file F - Do not use filename F to suppress ddl display + Use blank(empty) filename F to suppress ddl display --------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the diff --git a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl index 5621a60..d352e34 100644 --- a/tools/testfiles/pbits/tpbitsOffsetNegative.ddl +++ b/tools/testfiles/pbits/tpbitsOffsetNegative.ddl @@ -11,7 +11,7 @@ usage: h5dump [OPTIONS] files -o F, --output=F Output raw data into file F -b B, --binary=B Binary file output, of form B -O F, --ddl=F Output ddl text into file F - Do not use filename F to suppress ddl display + Use blank(empty) filename F to suppress ddl display --------------- Object Options --------------- -a P, --attribute=P Print the specified attribute If an attribute name contains a slash (/), escape the -- cgit v0.12 From d0444d4f2b3e2833cbbc545785a76d97fac1bbbc Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 3 Mar 2016 10:27:48 -0500 Subject: [svn-r29261] HDFFV-9241: Print fill value as "DEFAULT" instead of value 0 --- tools/lib/h5tools_dump.c | 22 ++++++++++++++++------ tools/testfiles/tallfilters.ddl | 2 +- tools/testfiles/tchunked.ddl | 2 +- tools/testfiles/tcompact.ddl | 2 +- tools/testfiles/tcontiguos.ddl | 2 +- tools/testfiles/tdeflate.ddl | 2 +- tools/testfiles/texternal.ddl | 2 +- tools/testfiles/tfill.ddl | 6 +++--- tools/testfiles/tfletcher32.ddl | 2 +- tools/testfiles/tnbit.ddl | 2 +- tools/testfiles/tscaleoffset.ddl | 2 +- tools/testfiles/tshuffle.ddl | 2 +- tools/testfiles/tszip.ddl | 2 +- tools/testfiles/tuserfilter.ddl | 2 +- tools/testfiles/vds/vds_layout-eiger.ddl | 2 +- tools/testfiles/vds/vds_layout-maxmin.ddl | 2 +- 16 files changed, 33 insertions(+), 23 deletions(-) diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index b19a755..b6a53f3 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -3522,12 +3522,22 @@ h5tools_dump_dcpl(FILE *stream, const h5tool_format_t *info, h5tools_str_reset(&buffer); h5tools_str_append(&buffer, "%s ", "VALUE "); H5Pfill_value_defined(dcpl_id, &fvstatus); - if(fvstatus == H5D_FILL_VALUE_UNDEFINED) - h5tools_str_append(&buffer, "%s", "H5D_FILL_VALUE_UNDEFINED"); - else { - ctx->indent_level--; - h5tools_print_fill_value(&buffer, info, ctx, dcpl_id, type_id, obj_id); - ctx->indent_level++; + switch (fvstatus) { + case H5D_FILL_VALUE_UNDEFINED: + h5tools_str_append(&buffer, "%s", "H5D_FILL_VALUE_UNDEFINED"); + break; + case H5D_FILL_VALUE_DEFAULT: + h5tools_str_append(&buffer, "%s", "H5D_FILL_VALUE_DEFAULT"); + break; + case H5D_FILL_VALUE_USER_DEFINED: + ctx->indent_level--; + h5tools_print_fill_value(&buffer, info, ctx, dcpl_id, type_id, obj_id); + ctx->indent_level++; + break; + case H5D_FILL_VALUE_ERROR: + default: + HDassert(0); + break; } h5tools_render_element(stream, info, ctx, &buffer, &curr_pos, (size_t)ncols, (hsize_t)0, (hsize_t)0); ctx->indent_level--; diff --git a/tools/testfiles/tallfilters.ddl b/tools/testfiles/tallfilters.ddl index ac6762a..ff2454c 100644 --- a/tools/testfiles/tallfilters.ddl +++ b/tools/testfiles/tallfilters.ddl @@ -21,7 +21,7 @@ DATASET "all" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/testfiles/tchunked.ddl b/tools/testfiles/tchunked.ddl index b68b233..bf620fe 100644 --- a/tools/testfiles/tchunked.ddl +++ b/tools/testfiles/tchunked.ddl @@ -12,7 +12,7 @@ COMMENT "This is a dataset with chunked storage" } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/testfiles/tcompact.ddl b/tools/testfiles/tcompact.ddl index 918e2eb..977f959 100644 --- a/tools/testfiles/tcompact.ddl +++ b/tools/testfiles/tcompact.ddl @@ -12,7 +12,7 @@ COMMENT "This is a dataset with compact storage" } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_EARLY diff --git a/tools/testfiles/tcontiguos.ddl b/tools/testfiles/tcontiguos.ddl index 8e0158e..3f045e5 100644 --- a/tools/testfiles/tcontiguos.ddl +++ b/tools/testfiles/tcontiguos.ddl @@ -13,7 +13,7 @@ COMMENT "This is a dataset with contiguous storage" } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_LATE diff --git a/tools/testfiles/tdeflate.ddl b/tools/testfiles/tdeflate.ddl index 5603911..9b92d0e 100644 --- a/tools/testfiles/tdeflate.ddl +++ b/tools/testfiles/tdeflate.ddl @@ -11,7 +11,7 @@ DATASET "deflate" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/testfiles/texternal.ddl b/tools/testfiles/texternal.ddl index 279831a..59cd22c 100644 --- a/tools/testfiles/texternal.ddl +++ b/tools/testfiles/texternal.ddl @@ -14,7 +14,7 @@ DATASET "external" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_LATE diff --git a/tools/testfiles/tfill.ddl b/tools/testfiles/tfill.ddl index 45497fd..556f4f2 100644 --- a/tools/testfiles/tfill.ddl +++ b/tools/testfiles/tfill.ddl @@ -13,7 +13,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE [ 0, 0, 0 ] + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_LATE @@ -136,7 +136,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_ALLOC - VALUE () + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_LATE @@ -158,7 +158,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_LATE diff --git a/tools/testfiles/tfletcher32.ddl b/tools/testfiles/tfletcher32.ddl index c341ded..01460e2 100644 --- a/tools/testfiles/tfletcher32.ddl +++ b/tools/testfiles/tfletcher32.ddl @@ -11,7 +11,7 @@ DATASET "fletcher32" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/testfiles/tnbit.ddl b/tools/testfiles/tnbit.ddl index bd32eaa..fd5d1cf 100644 --- a/tools/testfiles/tnbit.ddl +++ b/tools/testfiles/tnbit.ddl @@ -11,7 +11,7 @@ DATASET "nbit" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/testfiles/tscaleoffset.ddl b/tools/testfiles/tscaleoffset.ddl index ba49c70..a039736 100644 --- a/tools/testfiles/tscaleoffset.ddl +++ b/tools/testfiles/tscaleoffset.ddl @@ -11,7 +11,7 @@ DATASET "scaleoffset" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/testfiles/tshuffle.ddl b/tools/testfiles/tshuffle.ddl index 5c183fe..b0477db 100644 --- a/tools/testfiles/tshuffle.ddl +++ b/tools/testfiles/tshuffle.ddl @@ -11,7 +11,7 @@ DATASET "shuffle" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/testfiles/tszip.ddl b/tools/testfiles/tszip.ddl index 6fdd92f..06e2259 100644 --- a/tools/testfiles/tszip.ddl +++ b/tools/testfiles/tszip.ddl @@ -17,7 +17,7 @@ DATASET "szip" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/testfiles/tuserfilter.ddl b/tools/testfiles/tuserfilter.ddl index 24745b9..f77fb17 100644 --- a/tools/testfiles/tuserfilter.ddl +++ b/tools/testfiles/tuserfilter.ddl @@ -15,7 +15,7 @@ DATASET "myfilter" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/testfiles/vds/vds_layout-eiger.ddl b/tools/testfiles/vds/vds_layout-eiger.ddl index eb448ab..d32a139 100644 --- a/tools/testfiles/vds/vds_layout-eiger.ddl +++ b/tools/testfiles/vds/vds_layout-eiger.ddl @@ -22,7 +22,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } DATA { (0,0,0): 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, diff --git a/tools/testfiles/vds/vds_layout-maxmin.ddl b/tools/testfiles/vds/vds_layout-maxmin.ddl index fb58815..790fc1c 100644 --- a/tools/testfiles/vds/vds_layout-maxmin.ddl +++ b/tools/testfiles/vds/vds_layout-maxmin.ddl @@ -87,7 +87,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } DATA { (0,0,0): 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -- cgit v0.12 From 49e774296b7af09c31741b3db6f51381c1a4b867 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 3 Mar 2016 11:02:55 -0500 Subject: [svn-r29262] HDFFV-9241: Print fill value as "DEFAULT" instead of value 0 --- .../testfiles/deflate_limit.h5repack_layout.h5.ddl | 14 +++++++------- .../testfiles/h5repack_layout.UD.h5-plugin_none.ddl | 14 +++++++------- .../h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl | 14 +++++++------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl b/tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl index b8e7e68..80b8a19 100644 --- a/tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl +++ b/tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl @@ -12,7 +12,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR @@ -30,7 +30,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR @@ -48,7 +48,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR @@ -66,7 +66,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR @@ -84,7 +84,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR @@ -102,7 +102,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR @@ -120,7 +120,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/h5repack/testfiles/h5repack_layout.UD.h5-plugin_none.ddl b/tools/h5repack/testfiles/h5repack_layout.UD.h5-plugin_none.ddl index fb94c21..66c4c69 100644 --- a/tools/h5repack/testfiles/h5repack_layout.UD.h5-plugin_none.ddl +++ b/tools/h5repack/testfiles/h5repack_layout.UD.h5-plugin_none.ddl @@ -12,7 +12,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR @@ -30,7 +30,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR @@ -48,7 +48,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR @@ -66,7 +66,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR @@ -84,7 +84,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR @@ -102,7 +102,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR @@ -120,7 +120,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR diff --git a/tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl b/tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl index 7a3a01e..87b133d 100644 --- a/tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl +++ b/tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl @@ -16,7 +16,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR @@ -38,7 +38,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR @@ -60,7 +60,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR @@ -82,7 +82,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR @@ -104,7 +104,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR @@ -126,7 +126,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR @@ -148,7 +148,7 @@ GROUP "/" { } FILLVALUE { FILL_TIME H5D_FILL_TIME_IFSET - VALUE 0 + VALUE H5D_FILL_VALUE_DEFAULT } ALLOCATION_TIME { H5D_ALLOC_TIME_INCR -- cgit v0.12 From 6e7e6bb3aa3b0106d44d7b50e79d1c6281940257 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 4 Mar 2016 10:22:29 -0500 Subject: [svn-r29266] Header generation default should be OFF. For Trunk - cacheinit.cmake should enable it ON --- config/cmake/cacheinit.cmake | 2 ++ src/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/config/cmake/cacheinit.cmake b/config/cmake/cacheinit.cmake index 5cae21b..8e88aea 100644 --- a/config/cmake/cacheinit.cmake +++ b/config/cmake/cacheinit.cmake @@ -6,6 +6,8 @@ set (CMAKE_INSTALL_FRAMEWORK_PREFIX "Library/Frameworks" CACHE STRING "Frameworks installation directory" FORCE) +set (HDF5_GENERATE_HEADERS ON CACHE BOOL "Rebuild Generated Files" FORCE) + set (HDF_PACKAGE_EXT "" CACHE STRING "Name of HDF package extension" FORCE) set (HDF5_BUILD_FORTRAN ON CACHE BOOL "Build FORTRAN support" FORCE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7413e28..f013148 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -779,7 +779,7 @@ set (H5_GENERATED_HEADERS ${HDF5_SRC_DIR}/H5overflow.h ) -option (HDF5_GENERATE_HEADERS "Rebuild Generated Files" ON) +option (HDF5_GENERATE_HEADERS "Rebuild Generated Files" OFF) mark_as_advanced (HDF5_GENERATE_HEADERS) if (HDF5_GENERATE_HEADERS) set_source_files_properties(${H5_GENERATED_HEADERS} PROPERTIES GENERATED TRUE) -- cgit v0.12 From 9592119ffd4b87b3cdb08f1ad8eaf7f3d221554c Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Fri, 4 Mar 2016 14:49:14 -0500 Subject: [svn-r29269] Purpose: Improve Packet Table library Description: The Packet Table API used to have fixed-length and variable-length functions (i.e., H5PTcreate_fl and H5PTcreate_vl), but in 2006, the vlen functions were ifdef'ed out with VLPT_REMOVED, see HDFFV-442. The majority of this revision includes removing unused vlen stuff, adding various vlen tests, initial code cleanup, and first pass of commenting. Details: - Removed the VLPT_REMOVED ifdef, but keep H5PTis_varlen and the free function because they are useful or even needed, but the free function's name is changed to be more appropriate for both read/write buffers, i.e., H5PTfree_vlen_buff. - The new test file, test_packet_vlen.c, contains tests showing packet tables, containing various types of vlen data, can be created with the fixed-length function - Two accessor functions were added per HDFFV-8623/patch 003. /* Returns the ID of the dataset associated with the packet table */ hid_t H5PTget_dataset(hid_t table_id); /* Returns the ID of the datatype the packet table uses */ hid_t H5PTget_type(hid_t table_id); - Various cleanup: replacing 0/-1 with SUCCEED/FAIL and H5I_BADID with H5I_INVALID_HID, and removing many warnings. Platforms tested: Linux/32 2.6 (jam) Linux/64 (platypus) Darwin (osx1010test) --- hl/src/H5PT.c | 528 +++++++++++++-------- hl/src/H5PTpublic.h | 68 +-- hl/test/Makefile.am | 3 + hl/test/h5hltest.h | 2 + hl/test/test_packet.c | 520 +++++++-------------- hl/test/test_packet_vlen.c | 1098 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 1643 insertions(+), 576 deletions(-) create mode 100644 hl/test/test_packet_vlen.c diff --git a/hl/src/H5PT.c b/hl/src/H5PT.c index 6ed1ac0..e2d6a3d 100644 --- a/hl/src/H5PT.c +++ b/hl/src/H5PT.c @@ -48,15 +48,15 @@ static herr_t H5PT_get_index(htbl_t *table_id, hsize_t *pt_index); */ /*------------------------------------------------------------------------- - * Function: H5PTcreate_fl + * Function: H5PTcreate * * Purpose: Creates a dataset containing a table and returns the Identifier - * of the table. + * of the table. (Copied mostly from H5PTcreate_fl) * - * Return: Success: table ID, Failure: Negative + * Return: Success: table ID, Failure: FAIL * - * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu - * James Laird, jlaird@ncsa.uiuc.edu + * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu (Author of H5PTcreate_fl) + * James Laird, jlaird@ncsa.uiuc.edu (Author of H5PTcreate_fl) * * Date: March 12, 2004 * @@ -65,80 +65,93 @@ static herr_t H5PT_get_index(htbl_t *table_id, hsize_t *pt_index); * table is initially of size 0. * * Modifications: + * Mar 1, 2016 + * This function is added to replace H5PTcreate_fl and it differs + * from H5PTcreate_fl only because its last argument is plist_id + * instead of compression; this is to allow flexible compression. + * -BMR * *------------------------------------------------------------------------- */ - -hid_t H5PTcreate_fl ( hid_t loc_id, - const char *dset_name, - hid_t dtype_id, - hsize_t chunk_size, - int compression ) +hid_t H5PTcreate(hid_t loc_id, + const char *dset_name, + hid_t dtype_id, + hsize_t chunk_size, + hid_t plist_id) { htbl_t * table = NULL; - hid_t dset_id = H5I_BADID; - hid_t space_id = H5I_BADID; - hid_t plist_id = H5I_BADID; + hid_t dset_id = H5I_INVALID_HID; + hid_t space_id = H5I_INVALID_HID; + hid_t plistcopy_id = H5I_INVALID_HID; hsize_t dims[1]; hsize_t dims_chunk[1]; hsize_t maxdims[1]; - hid_t ret_value; + hid_t ret_value = H5I_INVALID_HID; /* check the arguments */ if (dset_name == NULL) { - goto out; + goto error; } /* Register the packet table ID type if this is the first table created */ if(H5PT_ptable_id_type < 0) if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0) - goto out; + goto error; /* Get memory for the table identifier */ table = (htbl_t *)HDmalloc(sizeof(htbl_t)); + if ( table == NULL ) { + goto error; + } + table->dset_id = H5I_INVALID_HID; + table->type_id = H5I_INVALID_HID; /* Create a simple data space with unlimited size */ dims[0] = 0; dims_chunk[0] = chunk_size; maxdims[0] = H5S_UNLIMITED; if((space_id = H5Screate_simple(1, dims, maxdims)) < 0) - goto out; + goto error; /* Modify dataset creation properties to enable chunking */ - plist_id = H5Pcreate(H5P_DATASET_CREATE); - if(H5Pset_chunk(plist_id, 1, dims_chunk) < 0) - goto out; - if(compression >= 0 && compression <= 9) - if(H5Pset_deflate(plist_id, (unsigned)compression) < 0) - goto out; + if (plist_id == H5P_DEFAULT) { + plistcopy_id = H5Pcreate(H5P_DATASET_CREATE); + } + else { + plistcopy_id = H5Pcopy(plist_id); + } + if (chunk_size > 0) + { + if(H5Pset_chunk(plistcopy_id, 1, dims_chunk) < 0) + goto error; + } /* Create the dataset. */ - if((dset_id = H5Dcreate2(loc_id, dset_name, dtype_id, space_id, H5P_DEFAULT, plist_id, H5P_DEFAULT)) < 0) - goto out; + if((dset_id = H5Dcreate2(loc_id, dset_name, dtype_id, space_id, H5P_DEFAULT, plistcopy_id, H5P_DEFAULT)) < 0) + goto error; + + /* Create the table identifier */ + table->dset_id = dset_id; /* Terminate access to the data space. */ if(H5Sclose(space_id) < 0) - goto out; + goto error; /* End access to the property list */ - if(H5Pclose(plist_id) < 0) - goto out; - - /* Create the table identifier */ - table->dset_id = dset_id; + if(H5Pclose(plistcopy_id) < 0) + goto error; if((table->type_id = H5Tcopy(dtype_id)) < 0) - goto out; + goto error; if((table->type_id = H5Tget_native_type(table->type_id, H5T_DIR_DEFAULT)) < 0) - goto out; + goto error; H5PT_create_index(table); table->size = 0; /* Get an ID for this table */ ret_value = H5Iregister(H5PT_ptable_id_type, table); - if(ret_value != H5I_INVALID_HID) H5PT_ptable_count++; else @@ -146,32 +159,38 @@ hid_t H5PTcreate_fl ( hid_t loc_id, return ret_value; - out: - H5E_BEGIN_TRY - H5Sclose(space_id); - H5Pclose(plist_id); - H5Dclose(dset_id); - if(table) - HDfree(table); - H5E_END_TRY - return H5I_INVALID_HID; -} +error: + if (space_id != H5I_INVALID_HID) + H5Sclose(space_id); + if (plistcopy_id != H5I_INVALID_HID) + H5Pclose(plistcopy_id); + if (dset_id != H5I_INVALID_HID) + H5Dclose(dset_id); + if (table) + { + if (table->type_id != H5I_INVALID_HID) + H5Tclose(table->type_id); + HDfree(table); + } + + return ret_value; +} /* H5PTcreate */ + -#ifdef H5_VLPT_ENABLED /*------------------------------------------------------------------------- - * Function: H5PTcreate_vl + * Function: H5PTcreate_fl * - * Purpose: Creates a dataset containing a table of variable length records - * and returns the Identifier of the table. + * Purpose: Creates a dataset containing a table and returns the Identifier + * of the table. * * Return: Success: table ID, Failure: Negative * * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu * James Laird, jlaird@ncsa.uiuc.edu * - * Date: April 12, 2004 + * Date: March 12, 2004 * - * Comments: This function does not handle compression or fill data + * Comments: This function does not handle fill data * currently. Fill data is not necessary because the * table is initially of size 0. * @@ -179,38 +198,104 @@ hid_t H5PTcreate_fl ( hid_t loc_id, * *------------------------------------------------------------------------- */ -hid_t H5PTcreate_vl ( hid_t loc_id, - const char*dset_name, - hsize_t chunk_size) + +hid_t H5PTcreate_fl ( hid_t loc_id, + const char *dset_name, + hid_t dtype_id, + hsize_t chunk_size, + int compression ) { - hid_t ret_value=H5I_BADID; - hid_t vltype; + htbl_t * table = NULL; + hid_t dset_id = H5I_INVALID_HID; + hid_t space_id = H5I_INVALID_HID; + hid_t plist_id = H5I_INVALID_HID; + hsize_t dims[1]; + hsize_t dims_chunk[1]; + hsize_t maxdims[1]; + hid_t ret_value = H5I_INVALID_HID; /* check the arguments */ if (dset_name == NULL) { - goto out; + goto error; + } + + /* Register the packet table ID type if this is the first table created */ + if(H5PT_ptable_id_type < 0) + if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0) + goto error; + + /* Get memory for the table identifier */ + table = (htbl_t *)HDmalloc(sizeof(htbl_t)); + if ( table == NULL ) { + goto error; } + table->dset_id = H5I_INVALID_HID; + table->type_id = H5I_INVALID_HID; + + /* Create a simple data space with unlimited size */ + dims[0] = 0; + dims_chunk[0] = chunk_size; + maxdims[0] = H5S_UNLIMITED; + if((space_id = H5Screate_simple(1, dims, maxdims)) < 0) + goto error; + + /* Modify dataset creation properties to enable chunking */ + plist_id = H5Pcreate(H5P_DATASET_CREATE); + if(H5Pset_chunk(plist_id, 1, dims_chunk) < 0) + goto error; + if(compression >= 0 && compression <= 9) + if(H5Pset_deflate(plist_id, (unsigned)compression) < 0) + goto error; + + /* Create the dataset. */ + if((dset_id = H5Dcreate2(loc_id, dset_name, dtype_id, space_id, H5P_DEFAULT, plist_id, H5P_DEFAULT)) < 0) + goto error; - /* Create a variable length type that uses single bytes as its base type */ - vltype = H5Tvlen_create(H5T_NATIVE_UCHAR); - if(vltype < 0) - goto out; + /* Create the table identifier */ + table->dset_id = dset_id; - if((ret_value=H5PTcreate_fl(loc_id, dset_name, vltype, chunk_size, 0)) < 0) - goto out; + /* Terminate access to the data space. */ + if(H5Sclose(space_id) < 0) + goto error; - /* close the vltype */ - if(H5Tclose(vltype) < 0) - goto out; + /* End access to the property list */ + if(H5Pclose(plist_id) < 0) + goto error; + + if((table->type_id = H5Tcopy(dtype_id)) < 0) + goto error; + + if((table->type_id = H5Tget_native_type(table->type_id, H5T_DIR_DEFAULT)) < 0) + goto error; + + H5PT_create_index(table); + table->size = 0; + + /* Get an ID for this table */ + ret_value = H5Iregister(H5PT_ptable_id_type, table); + if(ret_value != H5I_INVALID_HID) + H5PT_ptable_count++; + else + H5PT_close(table); return ret_value; -out: - if(ret_value != H5I_BADID) - H5PTclose(ret_value); - return H5I_BADID; -} -#endif /* H%_VLPT_ENABLED */ +error: + if (space_id != H5I_INVALID_HID) + H5Sclose(space_id); + if (plist_id != H5I_INVALID_HID) + H5Pclose(plist_id); + if (dset_id != H5I_INVALID_HID) + H5Dclose(dset_id); + if (table) + { + if (table->type_id != H5I_INVALID_HID) + H5Tclose(table->type_id); + HDfree(table); + } + + return ret_value; +} /* H5PTcreate_fl */ /*------------------------------------------------------------------------- * Function: H5PTopen @@ -239,58 +324,59 @@ out: hid_t H5PTopen( hid_t loc_id, const char *dset_name ) { - hid_t type_id=H5I_BADID; - hid_t space_id=H5I_BADID; + hid_t type_id=H5I_INVALID_HID; + hid_t space_id=H5I_INVALID_HID; htbl_t * table = NULL; - hid_t ret_value; hsize_t dims[1]; + hid_t ret_value = H5I_INVALID_HID; /* check the arguments */ if (dset_name == NULL) { - goto out; + goto error; } /* Register the packet table ID type if this is the first table created */ if( H5PT_ptable_id_type < 0) if((H5PT_ptable_id_type = H5Iregister_type((size_t)H5PT_HASH_TABLE_SIZE, 0, (H5I_free_t)H5PT_free_id)) < 0) - goto out; + goto error; table = (htbl_t *)HDmalloc(sizeof(htbl_t)); - if ( table == NULL ) { - goto out; + goto error; } - table->dset_id = H5I_BADID; - table->type_id = H5I_BADID; + table->dset_id = H5I_INVALID_HID; + table->type_id = H5I_INVALID_HID; /* Open the dataset */ if((table->dset_id = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) - goto out; - if(table->dset_id < 0) - goto out; + goto error; /* Get the dataset's disk datatype */ if((type_id = H5Dget_type(table->dset_id)) < 0) - goto out; + goto error; /* Get the table's native datatype */ if((table->type_id = H5Tget_native_type(type_id, H5T_DIR_ASCEND)) < 0) - goto out; + goto error; + /* Close the disk datatype */ if(H5Tclose(type_id) < 0) - goto out; + goto error; + type_id = H5I_INVALID_HID; /* Initialize the current record pointer */ if((H5PT_create_index(table)) < 0) - goto out; + goto error; /* Get number of records in table */ if((space_id=H5Dget_space(table->dset_id)) < 0) - goto out; - if( H5Sget_simple_extent_dims( space_id, dims, NULL) < 0) - goto out; + goto error; + if(H5Sget_simple_extent_dims(space_id, dims, NULL) < 0) + goto error; if(H5Sclose(space_id) < 0) - goto out; + goto error; + space_id = H5I_INVALID_HID; + table->size = dims[0]; /* Get an ID for this table */ @@ -303,33 +389,36 @@ hid_t H5PTopen( hid_t loc_id, return ret_value; -out: - H5E_BEGIN_TRY - H5Tclose(type_id); - H5Sclose(space_id); - if(table) - { - H5Dclose(table->dset_id); - H5Tclose(table->type_id); - HDfree(table); - } - H5E_END_TRY - return H5I_INVALID_HID; -} +error: + if (type_id != H5I_INVALID_HID) + H5Dclose(type_id); + if (space_id != H5I_INVALID_HID) + H5Sclose(space_id); + if(table) + { + if (table->type_id != H5I_INVALID_HID) + H5Tclose(table->type_id); + if (table->dset_id != H5I_INVALID_HID) + H5Dclose(table->dset_id); + HDfree(table); + } + + return ret_value; +} /* H5PTopen */ /*------------------------------------------------------------------------- * Function: H5PT_free_id * * Purpose: Free an id. Callback for H5Iregister_type. * - * Return: Success: 0, Failure: N/A + * Return: Success: SUCCEED, Failure: N/A *------------------------------------------------------------------------- */ static herr_t H5PT_free_id(void *id) { HDfree(id); - return 0; + return SUCCEED; } /*------------------------------------------------------------------------- @@ -338,7 +427,7 @@ H5PT_free_id(void *id) * Purpose: Closes a table (i.e. cleans up all open resources used by a * table). * - * Return: Success: 0, Failure: -1 + * Return: Success: SUCCEED, Failure: FAIL * * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu * James Laird, jlaird@ncsa.uiuc.edu @@ -355,21 +444,21 @@ static herr_t H5PT_close( htbl_t* table) { if(table == NULL) - goto out; + goto error; /* Close the dataset */ if(H5Dclose(table->dset_id) < 0) - goto out; + goto error; /* Close the memory datatype */ if(H5Tclose(table->type_id) < 0) - goto out; + goto error; HDfree(table); - return 0; + return SUCCEED; -out: +error: if(table) { H5E_BEGIN_TRY @@ -378,7 +467,7 @@ out: H5E_END_TRY HDfree(table); } - return -1; + return FAIL; } /*------------------------------------------------------------------------- @@ -387,7 +476,7 @@ out: * Purpose: Closes a table (i.e. cleans up all open resources used by a * table). * - * Return: Success: 0, Failure: -1 + * Return: Success: SUCCEED, Failure: FAIL * * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu * James Laird, jlaird@ncsa.uiuc.edu @@ -406,11 +495,11 @@ herr_t H5PTclose( hid_t table_id ) /* Remove the ID from the library */ if((table = (htbl_t *)H5Iremove_verify(table_id, H5PT_ptable_id_type)) ==NULL) - goto out; + goto error; /* If the library found the table, remove it */ if( H5PT_close(table) < 0) - goto out; + goto error; /* One less packet table open */ H5PT_ptable_count--; @@ -423,10 +512,10 @@ herr_t H5PTclose( hid_t table_id ) H5PT_ptable_id_type = H5I_UNINIT; } - return 0; + return SUCCEED; -out: - return -1; +error: + return FAIL; } @@ -442,7 +531,7 @@ out: * * Purpose: Appends packets to the end of a packet table * - * Return: Success: 0, Failure: -1 + * Return: Success: SUCCEED, Failure: FAIL * * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu * James Laird, jlaird@ncsa.uiuc.edu @@ -463,22 +552,22 @@ herr_t H5PTappend( hid_t table_id, /* Find the table struct from its ID */ if((table = (htbl_t *) H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL) - goto out; + goto error; /* If we are asked to write 0 records, just do nothing */ if(nrecords == 0) - return 0; + return SUCCEED; if((H5TB_common_append_records(table->dset_id, table->type_id, nrecords, table->size, data)) < 0) - goto out; + goto error; /* Update table size */ table->size += nrecords; - return 0; + return SUCCEED; -out: - return -1; +error: + return FAIL; } /*------------------------------------------------------------------------- @@ -495,7 +584,7 @@ out: * Purpose: Reads packets starting at the current index and updates * that index * - * Return: Success: 0, Failure: -1 + * Return: Success: SUCCEED, Failure: FAIL * * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu * James Laird, jlaird@ncsa.uiuc.edu @@ -517,22 +606,22 @@ herr_t H5PTget_next( hid_t table_id, /* Find the table struct from its ID */ if((table = (htbl_t *) H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL) - goto out; + goto error; /* If nrecords == 0, do nothing */ if(nrecords == 0) - return 0; + return SUCCEED; if((H5TB_common_read_records(table->dset_id, table->type_id, table->current_index, nrecords, table->size, data)) < 0) - goto out; + goto error; /* Update the current index */ table->current_index += nrecords; - return 0; + return SUCCEED; -out: - return -1; +error: + return FAIL; } /*------------------------------------------------------------------------- @@ -540,7 +629,7 @@ out: * * Purpose: Reads packets from anywhere in a packet table * - * Return: Success: 0, Failure: -1 + * Return: Success: SUCCEED, Failure: FAIL * * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu * James Laird, jlaird@ncsa.uiuc.edu @@ -564,20 +653,20 @@ herr_t H5PTread_packets( hid_t table_id, /* find the table struct from its ID */ table = (htbl_t *) H5Iobject_verify(table_id, H5PT_ptable_id_type); if(table == NULL) - goto out; + goto error; /* If nrecords == 0, do nothing */ if(nrecords == 0) - return 0; + return SUCCEED; if( H5TB_common_read_records(table->dset_id, table->type_id, start, nrecords, table->size, data) < 0) - goto out; + goto error; - return 0; + return SUCCEED; -out: - return -1; +error: + return FAIL; } /*------------------------------------------------------------------------- @@ -592,7 +681,7 @@ out: * * Purpose: Resets, sets, and gets the current record index for a packet table * - * Return: Success: 0, Failure: -1 + * Return: Success: SUCCEED, Failure: FAIL * * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu * James Laird, jlaird@ncsa.uiuc.edu @@ -611,37 +700,37 @@ H5PT_create_index(htbl_t *table) if( table != NULL) { table->current_index = 0; - return 0; + return SUCCEED; } - return -1; + return FAIL; } static herr_t -H5PT_set_index(htbl_t *table, hsize_t index) +H5PT_set_index(htbl_t *table, hsize_t pt_index) { /* Ensure index is valid */ if( table != NULL ) { - if( index < table->size ) + if( pt_index < table->size ) { - table->current_index = index; - return 0; + table->current_index = pt_index; + return SUCCEED; } } - return -1; + return FAIL; } static herr_t -H5PT_get_index(htbl_t *table, hsize_t *index) +H5PT_get_index(htbl_t *table, hsize_t *pt_index) { /* Ensure index is valid */ if( table != NULL ) { - if(index) - *index = table->current_index; - return 0; + if(pt_index) + *pt_index = table->current_index; + return SUCCEED; } - return -1; + return FAIL; } /*------------------------------------------------------------------------- @@ -649,7 +738,7 @@ H5PT_get_index(htbl_t *table, hsize_t *index) * * Purpose: Resets, sets, and gets the current record index for a packet table * - * Return: Success: 0, Failure: -1 + * Return: Success: SUCCEED, Failure: FAIL * * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu * James Laird, jlaird@ncsa.uiuc.edu @@ -668,7 +757,7 @@ herr_t H5PTcreate_index(hid_t table_id) /* find the table struct from its ID */ if((table = (htbl_t *) (htbl_t *) H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL) - return -1; + return FAIL; return H5PT_create_index(table); } @@ -679,7 +768,7 @@ herr_t H5PTset_index(hid_t table_id, hsize_t pt_index) /* find the table struct from its ID */ if((table = (htbl_t *) H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL) - return -1; + return FAIL; return H5PT_set_index(table, pt_index); } @@ -690,7 +779,7 @@ herr_t H5PTget_index(hid_t table_id, hsize_t *pt_index) /* find the table struct from its ID */ if((table = (htbl_t *) H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL) - return -1; + return FAIL; return H5PT_get_index(table, pt_index); } @@ -705,9 +794,9 @@ herr_t H5PTget_index(hid_t table_id, hsize_t *pt_index) /*------------------------------------------------------------------------- * Function: H5PTget_num_packets * - * Purpose: Returns by reference the number of packets in the dataset + * Purpose: Returns by reference the number of packets in the packet table * - * Return: Success: 0, Failure: -1 + * Return: Success: SUCCEED, Failure: FAIL * * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu * James Laird, jlaird@ncsa.uiuc.edu @@ -727,14 +816,15 @@ herr_t H5PTget_num_packets( hid_t table_id, hsize_t *nrecords) /* find the table struct from its ID */ if((table = (htbl_t *) H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL) - goto out; + goto error; if(nrecords) *nrecords = table->size; - return 0; -out: - return -1; + return SUCCEED; + +error: + return FAIL; } @@ -743,7 +833,7 @@ out: * * Purpose: Validates a table identifier * - * Return: Success: 0, Failure: -1 + * Return: Success: SUCCEED, Failure: FAIL * * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu * James Laird, jlaird@ncsa.uiuc.edu @@ -761,19 +851,18 @@ herr_t H5PTis_valid(hid_t table_id) { /* find the table struct from its ID */ if(H5Iobject_verify(table_id, H5PT_ptable_id_type) ==NULL) - return -1; + return FAIL; - return 0; + return SUCCEED; } -#ifdef H5_VLPT_ENABLED /*------------------------------------------------------------------------- * Function: H5PTis_varlen * * Purpose: Returns 1 if a table_id corresponds to a packet table of variable- * length records or 0 for fixed-length records. * - * Return: True: 1, False: 0, Failure: -1 + * Return: True: 1, False: 0, Failure: FAIL * * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu * James Laird, jlaird@ncsa.uiuc.edu @@ -794,17 +883,18 @@ herr_t H5PTis_varlen(hid_t table_id) /* find the table struct from its ID */ if((table = (htbl_t *) H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL) - goto out; + goto error; if((type = H5Tget_class( table->type_id )) == H5T_NO_CLASS) - goto out; + goto error; if( type == H5T_VLEN ) return 1; else return 0; -out: - return -1; + +error: + return FAIL; } /*------------------------------------------------------------------------- @@ -815,12 +905,12 @@ out: */ /*------------------------------------------------------------------------- - * Function: H5PTfree_vlen_readbuff + * Function: H5PTfree_vlen_buff * * Purpose: Frees memory used when reading from a variable length packet * table. * - * Return: Success: 0, Failure: -1 + * Return: Success: SUCCEED, Failure: FAIL * -2 if memory was reclaimed but another error occurred * * Programmer: Nat Furrer, nfurrer@ncsa.uiuc.edu @@ -836,25 +926,25 @@ out: *------------------------------------------------------------------------- */ -herr_t H5PTfree_vlen_readbuff( hid_t table_id, +herr_t H5PTfree_vlen_buff( hid_t table_id, size_t _bufflen, void * buff ) { - hid_t space_id = H5I_BADID; + hid_t space_id = H5I_INVALID_HID; htbl_t * table; hsize_t bufflen = _bufflen; herr_t ret_value; /* find the table struct from its ID */ if((table = (htbl_t *) H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL) - goto out; + goto error; if((space_id = H5Screate_simple(1, &bufflen, NULL)) < 0) - goto out; + goto error; /* Free the memory. If this succeeds, ret_value should be 0. */ if((ret_value = H5Dvlen_reclaim(table->type_id, space_id, H5P_DEFAULT, buff)) < 0) - goto out; + goto error; /* If the dataspace cannot be closed, return -2 to indicate that memory */ /* was freed successfully but an error still occurred. */ @@ -863,11 +953,83 @@ herr_t H5PTfree_vlen_readbuff( hid_t table_id, return ret_value; -out: +error: H5E_BEGIN_TRY H5Sclose(space_id); H5E_END_TRY - return -1; + return FAIL; +} /* H5PTfree_vlen_buff */ + +/*------------------------------------------------------------------------- + * + * Accessor functions + * + *------------------------------------------------------------------------- + */ +/*------------------------------------------------------------------------- + * Function: H5PTget_dataset + * + * Purpose: Returns the backend dataset of this packet table + * + * Return: Success: SUCCEED, Failure: FAIL + * + * Programmer: User's patch 0003, HDFFV-8623. -BMR + * + * Date: Feb 10, 2016 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ +hid_t H5PTget_dataset(hid_t table_id) +{ + htbl_t * table; + hid_t ret_value = H5I_INVALID_HID; + + /* find the table struct from its ID */ + if((table = (htbl_t *) H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL) + goto error; + + ret_value = table->dset_id; + +error: + + return ret_value; } -#endif /* H5_VLPT_ENABLED */ +/*------------------------------------------------------------------------- + * Function: H5PTget_type + * + * Purpose: Returns the backend type of this packet table + * + * Return: Success: datatype ID, Failure: H5I_INVALID_HID + * + * Programmer: User's patch 0003, HDFFV-8623. -BMR + * + * Date: Feb 10, 2016 + * + * Comments: + * + * Modifications: + * + * + *------------------------------------------------------------------------- + */ +hid_t H5PTget_type( hid_t table_id) +{ + htbl_t * table; + hid_t ret_value = H5I_INVALID_HID; + + /* find the table struct from its ID */ + if((table = (htbl_t *) H5Iobject_verify(table_id, H5PT_ptable_id_type)) == NULL) + goto error; + + ret_value = table->type_id; + +error: + + return ret_value; +} diff --git a/hl/src/H5PTpublic.h b/hl/src/H5PTpublic.h index f919010..420275a 100644 --- a/hl/src/H5PTpublic.h +++ b/hl/src/H5PTpublic.h @@ -22,74 +22,58 @@ extern "C" { #endif /*------------------------------------------------------------------------- - * * Create/Open/Close functions - * *------------------------------------------------------------------------- */ +/* NOTE: H5PTcreate is replacing H5PTcreate_fl for better name due to the + removal of H5PTcreate_vl. H5PTcreate_fl may be retired in 1.8.19. */ +H5_HLDLL hid_t H5PTcreate(hid_t loc_id, const char *dset_name, + hid_t dtype_id, hsize_t chunk_size, hid_t plist_id); -H5_HLDLL hid_t H5PTcreate_fl ( hid_t loc_id, - const char *dset_name, - hid_t dtype_id, - hsize_t chunk_size, - int compression ); +H5_HLDLL hid_t H5PTopen(hid_t loc_id, const char *dset_name); -#ifdef VLPT_REMOVED -H5_HLDLL hid_t H5PTcreate_vl ( hid_t loc_id, - const char *dset_name, - hsize_t chunk_size ); -#endif /* VLPT_REMOVED */ +H5_HLDLL herr_t H5PTclose(hid_t table_id); -H5_HLDLL hid_t H5PTopen( hid_t loc_id, - const char *dset_name ); - -H5_HLDLL herr_t H5PTclose( hid_t table_id ); +/* This function may be removed from the packet table in release 1.8.19. */ +H5_HLDLL hid_t H5PTcreate_fl(hid_t loc_id, const char *dset_name, + hid_t dtype_id, hsize_t chunk_size, int compression); /*------------------------------------------------------------------------- - * * Write functions - * *------------------------------------------------------------------------- */ - -H5_HLDLL herr_t H5PTappend( hid_t table_id, - size_t nrecords, - const void * data ); +H5_HLDLL herr_t H5PTappend(hid_t table_id, size_t nrecords, const void *data); /*------------------------------------------------------------------------- - * * Read functions - * *------------------------------------------------------------------------- */ +H5_HLDLL herr_t H5PTget_next(hid_t table_id, size_t nrecords, void * data); +H5_HLDLL herr_t H5PTread_packets(hid_t table_id, hsize_t start, + size_t nrecords, void *data); -H5_HLDLL herr_t H5PTget_next( hid_t table_id, - size_t nrecords, - void * data ); +/*------------------------------------------------------------------------- + * Inquiry functions + *------------------------------------------------------------------------- + */ +H5_HLDLL herr_t H5PTget_num_packets(hid_t table_id, hsize_t *nrecords); -H5_HLDLL herr_t H5PTread_packets( hid_t table_id, - hsize_t start, - size_t nrecords, - void *data ); +H5_HLDLL herr_t H5PTis_valid(hid_t table_id); + +H5_HLDLL herr_t H5PTis_varlen(hid_t table_id); /*------------------------------------------------------------------------- * - * Inquiry functions + * Accessor functions * *------------------------------------------------------------------------- */ +H5_HLDLL hid_t H5PTget_dataset(hid_t table_id); -H5_HLDLL herr_t H5PTget_num_packets( hid_t table_id, - hsize_t *nrecords ); - -H5_HLDLL herr_t H5PTis_valid( hid_t table_id ); - -#ifdef VLPT_REMOVED -H5_HLDLL herr_t H5PTis_varlen( hid_t table_id ); -#endif /* VLPT_REMOVED */ +H5_HLDLL hid_t H5PTget_type(hid_t table_id); /*------------------------------------------------------------------------- * @@ -113,11 +97,9 @@ H5_HLDLL herr_t H5PTget_index( hid_t table_id, *------------------------------------------------------------------------- */ -#ifdef VLPT_REMOVED -H5_HLDLL herr_t H5PTfree_vlen_readbuff( hid_t table_id, +H5_HLDLL herr_t H5PTfree_vlen_buff( hid_t table_id, size_t bufflen, void * buff ); -#endif /* VLPT_REMOVED */ #ifdef __cplusplus } diff --git a/hl/test/Makefile.am b/hl/test/Makefile.am index 0809deb..32d14b6 100644 --- a/hl/test/Makefile.am +++ b/hl/test/Makefile.am @@ -49,4 +49,7 @@ CHECK_CLEANFILES+=combine_tables[1-2].h5 test_ds[1-9].h5 test_ds10.h5 \ test_packet_table.h5 test_packet_compress.h5 test_detach.h5 \ test_dectris.h5 +# Sources for test_packet executable +test_packet_SOURCES=test_packet.c test_packet_vlen.c + include $(top_srcdir)/config/conclude.am diff --git a/hl/test/h5hltest.h b/hl/test/h5hltest.h index e8292d2..9a5e702 100644 --- a/hl/test/h5hltest.h +++ b/hl/test/h5hltest.h @@ -36,5 +36,7 @@ /* Implements verbose 'assert' with 'goto error' exit */ #define VERIFY(condition, string) do { if (!(condition)) FAIL_PUTS_ERROR(string) } while(0) +int test_packet_table_with_varlen(void); + #endif /* _H5HLTEST_H */ diff --git a/hl/test/test_packet.c b/hl/test/test_packet.c index 345aecb..e2ca2b5 100644 --- a/hl/test/test_packet.c +++ b/hl/test/test_packet.c @@ -31,9 +31,6 @@ #define TEST_FILE_NAME "test_packet_table.h5" #define TEST_COMPRESS_FILE "test_packet_compress.h5" #define PT_NAME "Test Packet Table" -#ifdef VLPT_REMOVED -#define VL_TABLE_NAME "Varlen Test Table" -#endif /* VLPT_REMOVED */ #define H5TB_TABLE_NAME "Table1" /*------------------------------------------------------------------------- @@ -77,9 +74,9 @@ static int cmp_par(size_t i, size_t j, particle_t *rbuf, particle_t *wbuf ) rbuf[i].longi != wbuf[j].longi || !H5_FLT_ABS_EQUAL(rbuf[i].pressure,wbuf[j].pressure) || !H5_DBL_ABS_EQUAL(rbuf[i].temperature,wbuf[j].temperature) ) { - return -1; + return FAIL; } - return 0; + return SUCCEED; } /*------------------------------------------------------------------------- @@ -95,22 +92,22 @@ make_particle_type(void) /* Create the memory data type. */ if ((type_id = H5Tcreate (H5T_COMPOUND, type_size )) < 0 ) - return -1; + return FAIL; /* Insert fields. */ string_type = H5Tcopy( H5T_C_S1 ); H5Tset_size( string_type, (size_t)16 ); if ( H5Tinsert(type_id, "Name", HOFFSET(particle_t, name) , string_type ) < 0 ) - return -1; + return FAIL; if ( H5Tinsert(type_id, "Lat", HOFFSET(particle_t, lati) , H5T_NATIVE_INT ) < 0 ) - return -1; + return FAIL; if ( H5Tinsert(type_id, "Long", HOFFSET(particle_t, longi) , H5T_NATIVE_INT ) < 0 ) - return -1; + return FAIL; if ( H5Tinsert(type_id, "Pressure", HOFFSET(particle_t, pressure) , H5T_NATIVE_FLOAT ) < 0 ) - return -1; + return FAIL; if ( H5Tinsert(type_id, "Temperature", HOFFSET(particle_t, temperature) , H5T_NATIVE_DOUBLE ) < 0 ) - return -1; + return FAIL; return type_id; } @@ -156,9 +153,9 @@ static int create_hl_table(hid_t fid) chunk_size, fill_data, compress, testPart ); if(status<0) - return -1; + return FAIL; else - return 0; + return SUCCEED; } @@ -188,23 +185,21 @@ static int test_create_close(hid_t fid) table = H5PTcreate_fl(fid, PT_NAME, part_t, (hsize_t)100, -1); H5Tclose(part_t); if( H5PTis_valid(table) < 0) - goto out; -#ifdef VLPT_REMOVED + goto error; if( H5PTis_varlen(table) != 0) - goto out; -#endif /* VLPT_REMOVED */ + goto error; /* Close the table */ err = H5PTclose(table); if( err < 0) - goto out; + goto error; PASSED(); - return 0; + return SUCCEED; - out: +error: H5_FAILED(); - return -1; + return FAIL; } /*------------------------------------------------------------------------- @@ -224,23 +219,22 @@ static int test_open(hid_t fid) /* Open the table */ table = H5PTopen(fid, PT_NAME); if( H5PTis_valid(table) < 0) - goto out; -#ifdef VLPT_REMOVED + goto error; if( H5PTis_varlen(table) != 0) - goto out; -#endif /* VLPT_REMOVED */ + goto error; /* Close the table */ err = H5PTclose(table); if( err < 0) - goto out; + goto error; PASSED(); - return 0; + return SUCCEED; - out: +error: + if (table > 0) H5PTclose(table); H5_FAILED(); - return -1; + return FAIL; } /*------------------------------------------------------------------------- @@ -261,52 +255,52 @@ static int test_append(hid_t fid) /* Open the table */ table = H5PTopen(fid, PT_NAME); if( H5PTis_valid(table) < 0) - goto out; + goto error; /* Count the number of packets in the table */ err = H5PTget_num_packets(table, &count); if( err < 0) - goto out; + goto error; /* There should be 0 records in the table */ if( count != 0 ) - goto out; + goto error; /* Append one particle */ err = H5PTappend(table, (size_t)1, &(testPart[0])); if( err < 0) - goto out; + goto error; /* Append several particles */ err = H5PTappend(table, (size_t)6, &(testPart[1])); if( err < 0) - goto out; + goto error; /* Append one more particle */ err = H5PTappend(table, (size_t)1, &(testPart[7])); if( err < 0) - goto out; + goto error; /* Count the number of packets in the table */ err = H5PTget_num_packets(table, &count); if( err < 0) - goto out; + goto error; /* There should be 8 records in the table now */ if( count != 8 ) - goto out; + goto error; /* Close the table */ err = H5PTclose(table); if( err < 0) - goto out; + goto error; PASSED(); - return 0; + return SUCCEED; - out: +error: H5_FAILED(); - if( H5PTis_valid(table) < 0) + if( H5PTis_valid(table) > 0) H5PTclose(table); - return -1; + return FAIL; } /*------------------------------------------------------------------------- @@ -328,44 +322,44 @@ static int test_read(hid_t fid) /* Open the table */ table = H5PTopen(fid, PT_NAME); if( H5PTis_valid(table) < 0) - goto out; + goto error; /* Read several particles */ err = H5PTread_packets(table, (hsize_t)0, 3, &(readBuf[0])); if( err < 0) - goto out; + goto error; /* Read one particle */ err = H5PTread_packets(table, (hsize_t)3, 1, &(readBuf[3])); if( err < 0) - goto out; + goto error; /* Read several particles */ err = H5PTread_packets(table, (hsize_t)4, (NRECORDS - 4 ), &(readBuf[4])); if( err < 0) - goto out; + goto error; /* Ensure that particles were read correctly */ for(c=0; c 0) H5PTclose(table); - return -1; + return FAIL; } /*------------------------------------------------------------------------- @@ -389,21 +383,21 @@ static int test_get_next(hid_t fid) /* Open the table */ table = H5PTopen(fid, PT_NAME); if( H5PTis_valid(table) < 0) - goto out; + goto error; /* Read several particles consecutively */ for(c=0; c < NRECORDS; c++) { - err = H5PTget_next(table, 1, &readBuf[c]); + err = H5PTget_next(table, (size_t)1, &readBuf[c]); if(err < 0) - goto out; + goto error; } /* Ensure that particles were read correctly */ for(c=0; c 0) H5PTclose(table); - return -1; + return FAIL; } /*------------------------------------------------------------------------- @@ -466,7 +460,7 @@ static int test_big_table(hid_t fid) table = H5PTcreate_fl(fid, "Packet Test Dataset2", part_t, (hsize_t)33, -1); H5Tclose(part_t); if( H5PTis_valid(table) < 0) - goto out; + goto error; /* Add many particles */ for(c = 0; c < BIG_TABLE_SIZE ; c+=8) @@ -474,222 +468,44 @@ static int test_big_table(hid_t fid) /* Append eight particles at once*/ err = H5PTappend(table, (size_t)8, &(testPart[0])); if( err < 0) - goto out; + goto error; } /* Count the number of packets in the table */ err = H5PTget_num_packets(table, &count); if( err < 0) - goto out; + goto error; if( count != BIG_TABLE_SIZE ) - goto out; + goto error; /* Read particles to ensure that all of them were written correctly */ /* Also, ensure that H5PTcreate_fl set the current packet to */ /* the first packet in the table */ for(c = 0; c < BIG_TABLE_SIZE; c++) { - err = H5PTget_next(table, 1, &readPart); + err = H5PTget_next(table, (size_t)1, &readPart); if(err < 0) - goto out; + goto error; /* Ensure that particles were read correctly */ if( cmp_par(c % 8, 0, testPart, &readPart) != 0) - goto out; + goto error; } /* Close the table */ err = H5PTclose(table); if( err < 0) - goto out; + goto error; PASSED(); - return 0; + return SUCCEED; - out: +error: H5_FAILED(); - if( H5PTis_valid(table) < 0) + if( H5PTis_valid(table) > 0) H5PTclose(table); - return -1; -} - -#ifdef VLPT_REMOVED -/*------------------------------------------------------------------------- - * test_varlen - * - * Tests creation, opening, closing, writing, reading, etc. on a - * variable-length packet table. - * - *------------------------------------------------------------------------- - */ -static int test_varlen(hid_t fid) -{ - herr_t err; - hid_t table=H5I_BADID; - hsize_t count; - - /* Buffers to hold data */ - hvl_t writeBuffer[NRECORDS]; - hvl_t readBuffer[NRECORDS]; - - /* This example has three different sizes of "record": longs, shorts, and particles */ - long longBuffer[NRECORDS]; - short shortBuffer[NRECORDS]; - int x; - - TESTING("variable-length packet tables"); - - /* Initialize buffers */ - for(x=0; x 0) H5PTclose(table); - return -1; + return FAIL; } /*------------------------------------------------------------------------- @@ -767,12 +583,12 @@ static int test_opaque(hid_t fid) static int test_compress(void) { - hid_t fid1 = -1; + hid_t fid1 = H5I_INVALID_HID; herr_t err; - hid_t table = -1; - hid_t part_t = -1; - hid_t dset_id = -1; - hid_t plist_id = -1; + hid_t table = H5I_INVALID_HID; + hid_t part_t = H5I_INVALID_HID; + hid_t dset_id = H5I_INVALID_HID; + hid_t plist_id = H5I_INVALID_HID; size_t c; size_t num_elems = 1; unsigned filter_vals[1]; @@ -812,7 +628,7 @@ test_compress(void) HDmemset(readPart, 0, sizeof(readPart)); for(c = 0; c < BIG_TABLE_SIZE; c++) { - err = H5PTget_next(table, 1, readPart); + err = H5PTget_next(table, (size_t)1, readPart); if(err < 0) TEST_ERROR; /* Ensure that particles were read correctly */ @@ -881,7 +697,7 @@ test_compress(void) if( err < 0) TEST_ERROR; PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -892,7 +708,7 @@ error: H5Fclose(fid1); } H5E_END_TRY H5_FAILED(); - return -1; + return FAIL; } /*------------------------------------------------------------------------- @@ -932,54 +748,54 @@ static int test_rw_nonnative_dt(hid_t fid) ptable = H5PTcreate_fl(fid, "Packet Test Dataset, Non-native", H5T_STD_I32LE, (hsize_t)100, -1); } if(ptable == H5I_INVALID_HID) - goto out; + goto error; /* Write one packet to the packet table */ - if( (err = H5PTappend(ptable, (hsize_t)1, &(writeBuffer[0]))) < 0 ) - goto out; + if( (err = H5PTappend(ptable, (size_t)1, &(writeBuffer[0]))) < 0 ) + goto error; /* Write several packets to the packet table */ - if( (err = H5PTappend(ptable, (hsize_t)4, &(writeBuffer[1]))) < 0) - goto out; + if( (err = H5PTappend(ptable, (size_t)4, &(writeBuffer[1]))) < 0) + goto error; if( (err = H5PTclose(ptable)) < 0) - goto out; + goto error; /* Open the Packet table */ if( (ptable = H5PTopen(fid, "Packet Test Dataset, Non-native")) < 0) - goto out; + goto error; /* Get the number of packets in the packet table. This should be five. */ if( (err = H5PTget_num_packets(ptable, &count)) < 0) - goto out; + goto error; if( (int)count != 5 ) - goto out; + goto error; /* Initialize packet table's "current record" */ if( (err = H5PTcreate_index(ptable)) < 0) - goto out; + goto error; /* Iterate through packets, read each one back */ for(x=0; x<5; x++) { - if( (err = H5PTget_next(ptable, (hsize_t)1, &(readBuffer[x]))) < 0) - goto out; + if( (err = H5PTget_next(ptable, (size_t)1, &(readBuffer[x]))) < 0) + goto error; if( x != readBuffer[x]) - goto out; + goto error; } /* Close the packet table */ if( (err = H5PTclose(ptable)) < 0) - goto out; + goto error; PASSED(); - return 0; + return SUCCEED; - out: +error: H5_FAILED(); - if( H5PTis_valid(ptable) < 0) + if( H5PTis_valid(ptable) > 0) H5PTclose(ptable); - return -1; + return FAIL; } /*------------------------------------------------------------------------- @@ -992,7 +808,7 @@ static int test_rw_nonnative_dt(hid_t fid) */ static int test_error(hid_t fid) { - hid_t id = H5I_BADID; + hid_t id = H5I_INVALID_HID; int id_open=0; particle_t readBuf[1]; @@ -1000,121 +816,121 @@ static int test_error(hid_t fid) /* Create a HL table */ if(create_hl_table(fid) < 0) - goto out; + goto error; /* Try to open things that are not packet tables */ H5E_BEGIN_TRY if(H5PTopen(fid, "Bogus_name") >= 0) - goto out; + goto error; if(H5PTopen(fid, "group1") >= 0) - goto out; + goto error; H5E_END_TRY /* Try to execute packet table commands on an invalid ID */ H5E_BEGIN_TRY if(H5PTis_valid(id) >= 0) - goto out; -#ifdef VLPT_REMOVED + goto error; if(H5PTis_varlen(id) >= 0) - goto out; -#endif /* VLPT_REMOVED */ + goto error; if(H5PTclose(id) >= 0) - goto out; + goto error; if(H5PTappend(id, (size_t)1, testPart) >= 0) - goto out; + goto error; if(H5PTread_packets(id, (hsize_t)0, 1, readBuf) >= 0) - goto out; + goto error; if(H5PTcreate_index(id) >= 0) - goto out; + goto error; if(H5PTset_index(id, (hsize_t)1) >= 0) - goto out; + goto error; if(H5PTget_index(id, NULL) >= 0) - goto out; + goto error; H5E_END_TRY /* Open a high-level non-packet (H5TB) table and try to */ /* execute commands on it. */ if((id=H5Dopen2(fid, H5TB_TABLE_NAME, H5P_DEFAULT)) <0) - goto out; + goto error; id_open = 1; H5E_BEGIN_TRY if(H5PTis_valid(id) >= 0) - goto out; -#ifdef VLPT_REMOVED + goto error; if(H5PTis_varlen(id) >= 0) - goto out; -#endif /* VLPT_REMOVED */ + goto error; if(H5PTclose(id) >= 0) - goto out; + goto error; if(H5PTappend(id, (size_t)1, testPart) >= 0) - goto out; + goto error; if(H5PTread_packets(id, (hsize_t)0, 1, readBuf) >= 0) - goto out; + goto error; if(H5PTcreate_index(id) >= 0) - goto out; + goto error; if(H5PTset_index(id, (hsize_t)1) >= 0) - goto out; + goto error; if(H5PTget_index(id, NULL) >= 0) - goto out; + goto error; H5E_END_TRY id_open=0; if(H5Dclose(id) <0) - goto out; + goto error; /* Open and close a packet table. Try to execute */ /* commands on the closed ID. */ if((id=H5PTopen(fid, PT_NAME))<0) - goto out; + goto error; if(H5PTclose(id) <0) - goto out; + goto error; H5E_BEGIN_TRY if(H5PTis_valid(id) >= 0) - goto out; -#ifdef VLPT_REMOVED + goto error; if(H5PTis_varlen(id) >= 0) - goto out; -#endif /* VLPT_REMOVED */ + goto error; if(H5PTclose(id) >= 0) - goto out; + goto error; if(H5PTappend(id, (size_t)1, testPart) >= 0) - goto out; + goto error; if(H5PTread_packets(id, (hsize_t)0, 1, readBuf) >= 0) - goto out; + goto error; if(H5PTcreate_index(id) >= 0) - goto out; + goto error; if(H5PTset_index(id, (hsize_t)1) >= 0) - goto out; + goto error; if(H5PTget_index(id, NULL) >= 0) - goto out; + goto error; H5E_END_TRY PASSED(); - return 0; + return SUCCEED; -out: +error: H5_FAILED(); if(id_open) H5Dclose(id); - return -1; + return FAIL; } - +/*------------------------------------------------------------------------- + * test_packet_table(): Invokes individual tests to ensure that all + * functions work correctly, except for the variable-length related + * functions, which are tested in "test_packet_vlen.c". + * + *------------------------------------------------------------------------- + */ static int test_packet_table(hid_t fid) { if( test_create_close(fid) < 0 ) - return -1; + return FAIL; if( test_open(fid) < 0 ) - return -1; + return FAIL; /* test_append must be run before test_count and test_read, as it */ /* creates the packet table they use. */ if( test_append(fid) < 0 ) - return -1; + return FAIL; /* These tests will not necessarily cause failures in each other, so we don't abort the other tests if one fails. */ @@ -1122,24 +938,24 @@ static int test_packet_table(hid_t fid) test_get_next(fid); test_big_table(fid); test_rw_nonnative_dt(fid); -#ifdef VLPT_REMOVED - test_varlen(fid); -#endif /* VLPT_REMOVED */ test_opaque(fid); test_compress(); test_error(fid); - return 0; + return SUCCEED; } +/* + * +*/ int main(void) { - /* identifier for the file */ - hid_t fid; - int status = 0; + /* identifier for the file that is used in FL PT tests */ + hid_t fid; + int status = 0; /*------------------------------------------------------------------------- - * Packet test: test each function of the packet table + * Packet test: test each function of the packet table library *------------------------------------------------------------------------- */ @@ -1148,12 +964,16 @@ int main(void) HDputs("Testing packet table"); - /* run tests */ - if ( test_packet_table(fid) < 0) - status = 1; + /* Test packet table with fixed length */ + if (test_packet_table(fid) < 0) + status = 1; + + /* Test packet table with variable length, using separate data file */ + if (test_packet_table_with_varlen() < 0) + status = 1; - /* close */ - H5Fclose(fid); + /* Close the file */ + H5Fclose(fid); - return status; + return status; } diff --git a/hl/test/test_packet_vlen.c b/hl/test/test_packet_vlen.c new file mode 100644 index 0000000..4d55226 --- /dev/null +++ b/hl/test/test_packet_vlen.c @@ -0,0 +1,1098 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include "h5hltest.h" + +/*------------------------------------------------------------------------- + * Packet Table with Variable-Length test + * + *------------------------------------------------------------------------- + */ + +#define NRECORDS 5 +#define TEST_FILE_NAME "test_packet_table_vlen.h5" +#define PT_VLEN_ATOMIC "Dataset with VL of Atomic types" +#define PT_VLEN_COMP "Dataset with VL of Compound Types" +#define PT_COMP_VLEN "Dataset with Compound Type of VL types" +#define PT_VLEN_VLEN "Dataset with VL of VL types" +#define PT_FIXED_LEN "Fixed-length Packet Table" +#define SPACE3_RANK 1 +#define L1_INCM 16 +#define L2_INCM 8 +#define NAME_BUF_SIZE 80 + +/*------------------------------------------------------------------------- + * Local functions + *------------------------------------------------------------------------- + */ + +/* Verifies that the packet table is a variable- or fixed-length */ +static int verify_ptlengthtype(hid_t fid, const char *table_name, herr_t checked_value); + +/* Adds an attribute to the named packet table */ +static int adding_attribute(hid_t fid, const char *table_name, const char *attr_name); + +/* Verifies that the named attribute was written and is read correctly */ +static int verify_attribute(hid_t fid, const char *table_name, const char *attr_name); + +/*------------------------------------------------------------------------- + * test_VLof_atomic(): Test that a packet table with VL datatypes of atomic + * datatypes can be created and written correctly. (HDFFV-442) + * + * 2016/01/27 -BMR + *------------------------------------------------------------------------- + */ +static int test_VLof_atomic(void) +{ + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */ + hsize_t count; /* Number of records in the table */ + int ii, jj; /* Loop variables */ + hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ + hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ + char msg[80]; /* For error message */ + herr_t ret; /* Returned status from a callee */ + + TESTING3(" with vlen of atomic"); + + /* Allocate and initialize VL data to write (copied from C test) */ + for (ii=0; ii 0) H5PTclose(ptable); + if (fid > 0) H5Fclose(fid); + H5PTfree_vlen_buff(ptable, NRECORDS, readBuf); + H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); + H5_FAILED(); + return FAIL; +} /* test_VLof_atomic */ + +/*------------------------------------------------------------------------- + * test_VLof_comptype(): Test that a packet table with VL datatypes of + * compound datatypes can be created and written correctly. (HDFFV-442) + * + * 2016/01/27 -BMR + *------------------------------------------------------------------------- + */ +static int test_VLof_comptype(void) +{ + /* Struct that the VL sequences are composed of */ + typedef struct { + int i; + float f; + } VLcomp_t; + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */ + hid_t cmptype=H5I_INVALID_HID; /* Compound datatype */ + hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ + hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ + hsize_t count; /* Number of records in the table */ + int ii, jj; /* Loop variables */ + char msg[80]; /* For error message */ + herr_t ret; + + TESTING3(" with vlen of compound datatypes"); + + /* Allocate and initialize VL data to write (copied from C test) */ + for (ii=0; ii 0) H5PTclose(ptable); + if (fid > 0) H5Fclose(fid); + H5PTfree_vlen_buff(ptable, NRECORDS, readBuf); + H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); + H5_FAILED(); + return FAIL; +} /* test_VLof_comptype */ + +/*------------------------------------------------------------------------- + * test_compound_VL_VL(): Test that a packet table of compound datatypes + * containing VL datatypes can be created and written + * correctly. (HDFFV-442) + * + * 2016/01/27 -BMR + *------------------------------------------------------------------------- + */ +static int test_compound_VL_VLtype(void) +{ + /* Struct that the VL sequences are composed of */ + typedef struct { + int i; + float f; + hvl_t v; + } compVLVL_t; + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t space=H5I_INVALID_HID; /* Dataspace identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */ + hid_t vlofvl=H5I_INVALID_HID; /* Variable length datatype */ + hid_t comp_vlvl=H5I_INVALID_HID; /* ID of a compound datatype containing + a VL of VL of atomic datatype */ + hsize_t dims1[] = {NRECORDS}; + hsize_t count; /* Number of records in the table */ + compVLVL_t writeBuf[NRECORDS];/* Buffer to hold data to be written */ + compVLVL_t readBuf[NRECORDS]; /* Buffer to hold read data */ + hvl_t *t1, *t2; + int ii, jj, kk; /* Loop variables */ + char msg[80]; /* For error message */ + herr_t ret; /* Returned status from a callee */ + + TESTING3(" with compound datatype containing vlen datatype"); + + /* Allocate and initialize VL data to write (copied from C test) */ + for (ii=0; iip = HDmalloc((jj+L2_INCM)*sizeof(unsigned int)); + if (t1->p == NULL) { + fprintf(stderr, "Cannot allocate memory for VL data! ii=%d\n",ii); + goto error; + } + t1->len = jj+L2_INCM; + for (kk=0; kkp)[kk] = ii*100 + jj*10 + kk; + } + } /* end for */ + + /* Open the file */ + fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); + if (fid < 0) + goto error; + + /* Create dataspace for datasets */ + space = H5Screate_simple(SPACE3_RANK, dims1, NULL); + if (space < 0) + goto error; + + /* Create a VL datatype of an atomic type */ + vlatomic = H5Tvlen_create (H5T_NATIVE_UINT); + if (vlatomic < 0) + goto error; + + /* Create a VL datatype of the VL of atomic datatype */ + vlofvl = H5Tvlen_create (vlatomic); + if (vlofvl < 0) + goto error; + + /* Create the base compound type */ + comp_vlvl = H5Tcreate(H5T_COMPOUND, sizeof(compVLVL_t)); + if (comp_vlvl < 0) + goto error; + + /* Insert fields: atomic, atomic, vlen */ + ret = H5Tinsert(comp_vlvl, "i", HOFFSET(compVLVL_t, i), H5T_NATIVE_INT); + if (ret < 0) + goto error; + ret = H5Tinsert(comp_vlvl, "f", HOFFSET(compVLVL_t, f), H5T_NATIVE_FLOAT); + if (ret < 0) + goto error; + ret = H5Tinsert(comp_vlvl, "v", HOFFSET(compVLVL_t, v), vlofvl); + if (ret < 0) + goto error; + + /* Create a packet table that uses a compound datatype of vlen datatype */ + ptable = H5PTcreate_fl(fid, PT_COMP_VLEN, comp_vlvl, (hsize_t)1, 0); + + /* Ensure that PT is created successfully */ + if (ptable == H5I_INVALID_HID) + goto error; + + /* Close the vlen datatype */ + if (H5Tclose(comp_vlvl) < 0) + goto error; + + /* Write the entire buffer to the packet table */ + ret = H5PTappend(ptable, (size_t)NRECORDS, writeBuf ); + if (ret < 0) + goto error; + + /* Get the number of packets in the packet table, should be NRECORDS. */ + ret = H5PTget_num_packets(ptable, &count); + if (ret < 0) + goto error; + + sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); + VERIFY(count == NRECORDS, msg); + + /* Read all five packets back */ + ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)NRECORDS, (void*)readBuf ); + if (ret < 0) + goto error; + + /* Compare data read in */ + for (ii = 0; ii < NRECORDS; ii++) { + if (writeBuf[ii].i != readBuf[ii].i) { + fprintf(stderr, "Integer components don't match!, writeBuf[%d].i=%d, readBuf[%d].i=%d\n",(int)ii,(int)writeBuf[ii].i,(int)ii,(int)readBuf[ii].i); + continue; + } /* end if */ + if (!H5_FLT_ABS_EQUAL(writeBuf[ii].f,readBuf[ii].f)) { + fprintf(stderr, "Float components don't match!, writeBuf[%d].f=%f, readBuf[%d].f=%f\n",(int)ii,(double)writeBuf[ii].f,(int)ii,(double)readBuf[ii].f); + continue; + } /* end if */ + + if (writeBuf[ii].v.len != readBuf[ii].v.len) { + fprintf(stderr, "%d: VL data length don't match!, writeBuf[%d].v.len=%d, readBuf[%d].v.len=%d\n",__LINE__,(int)ii,(int)writeBuf[ii].v.len,(int)ii,(int)readBuf[ii].v.len); + continue; + } /* end if */ + + for (t1=(hvl_t *)(writeBuf[ii].v.p), t2=(hvl_t *)(readBuf[ii].v.p), jj=0; (size_t)jjlen != t2->len) { + fprintf(stderr, "%d: VL data length don't match!, ii=%d, jj=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)ii,(int)jj,(int)t1->len,(int)t2->len); + continue; + } /* end if */ + for (kk=0; (size_t)kklen; kk++) { + if (((unsigned int *)t1->p)[kk] != ((unsigned int *)t2->p)[kk] ) { + fprintf(stderr, "VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n",(int)kk, (int)((unsigned int *)t1->p)[kk], (int)kk, (int)((unsigned int *)t2->p)[kk]); + continue; + } /* end if */ + } /* end for */ + } /* end for */ + } /* end for */ + + /* Free the buffers */ + ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf); + if (ret < 0) + goto error; + ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); + if (ret < 0) + goto error; + + /* Close the packet table */ + ret = H5PTclose(ptable); + if (ret < 0) + goto error; + + /* Release datatypes */ + if (H5Tclose(vlatomic) < 0) + goto error; + if (H5Tclose(vlofvl) < 0) + goto error; + + /* Close the file */ + if (H5Fclose(fid) < 0) + goto error; + + PASSED(); + return SUCCEED; + +error: /* An error has occurred. Clean up and exit. */ + if (H5PTis_valid(ptable) > 0) H5PTclose(ptable); + if (fid > 0) H5Fclose(fid); + H5PTfree_vlen_buff(ptable, NRECORDS, readBuf); + H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); + H5_FAILED(); + return FAIL; +} /* test_compound_VL_VLtype */ + +/*------------------------------------------------------------------------- + * test_VLof_VLtype(): Test that a packet table of VL datatype with VL + * datatypes of atomic datatypes can be created and written + * correctly. (HDFFV-442) + * + * 2016/01/27 -BMR + *------------------------------------------------------------------------- + */ +static int test_VLof_VLtype(void) +{ + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */ + hid_t vlofvl=H5I_INVALID_HID; /* VL datatype of VL datatypes */ + hsize_t count; /* Number of records in the table */ + hvl_t *t1; /* pointer to advance */ + int ii, jj, kk; /* Loop variables */ + hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ + hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ + char msg[80]; /* For error message */ + herr_t ret; /* Returned status from a callee */ + + TESTING3(" with vlen datatype of vlen datatype"); + + /* Allocate and initialize VL data to write (copied from C test) */ + for (ii=0; ii< NRECORDS; ii++) { + writeBuf[ii].p = HDmalloc((ii+1)*sizeof(hvl_t)); + if (writeBuf[ii].p == NULL) { + fprintf(stderr, "Cannot allocate memory for VL data! ii=%u\n",ii); + goto error; + } /* end if */ + writeBuf[ii].len = ii+1; + for (t1=(hvl_t *)(writeBuf[ii].p), jj=0; jj<(ii+1); jj++, t1++) + { + t1->p = HDmalloc((jj+1)*sizeof(unsigned int)); + if (t1->p == NULL) { + fprintf(stderr, "Cannot allocate memory for VL data! ii=%u\n",ii); + goto error; + } + t1->len = jj+1; + for (kk=0; kk<(jj+1); kk++) + ((unsigned int *)t1->p)[kk] = ii*100+jj*10+kk; + } /* end for */ + } /* end for */ + + /* Open the file */ + fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); + if (fid < 0) + goto error; + + /* Create a VL datatype of an atomic type */ + vlatomic = H5Tvlen_create (H5T_NATIVE_UINT); + if (vlatomic < 0) + goto error; + + vlofvl = H5Tvlen_create (vlatomic); + if (vlofvl < 0) + goto error; + + /* Create a packet table that uses a vlen datatype of vlen datatype */ + ptable = H5PTcreate_fl(fid, PT_VLEN_VLEN, vlofvl, (hsize_t)1, 0); + + /* Ensure that PT is created successfully */ + if (ptable == H5I_INVALID_HID) + goto error; + + /* Close the vlen datatype */ + if (H5Tclose(vlofvl) < 0) + goto error; + + /* Write the entire buffer to the packet table */ + ret = H5PTappend(ptable, (size_t)5, writeBuf ); + if (ret < 0) + goto error; + + /* Get the number of packets in the packet table, should be NRECORDS. */ + ret = H5PTget_num_packets(ptable, &count); + if (ret < 0) + goto error; + + sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); + VERIFY(count == NRECORDS, msg); + + /* Read all five packets back */ + ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)5, (void*)readBuf ); + if (ret < 0) + goto error; + + /* Free the buffers */ + ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf); + if (ret < 0) + goto error; + ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); + if (ret < 0) + goto error; + + /* Close the packet table */ + ret = H5PTclose(ptable); + if (ret < 0) + goto error; + + /* Close the file */ + if (H5Fclose(fid) < 0) + goto error; + + PASSED(); + return SUCCEED; + +error: /* An error has occurred. Clean up and exit. */ + if (H5PTis_valid(ptable) > 0) H5PTclose(ptable); + if (fid > 0) H5Fclose(fid); + H5PTfree_vlen_buff(ptable, NRECORDS, readBuf); + H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); + H5_FAILED(); + return FAIL; +} /* test_VLof_VLtype */ + +/*------------------------------------------------------------------------- + * verify_ptlengthtype() - helper function, verifies that the named packet + * table is a fixed-length or variable-length as indicated by the last + * argument. + * + * 2016/01/27 -BMR + *------------------------------------------------------------------------- + */ +static int verify_ptlengthtype(hid_t fid, const char *table_name, herr_t expected_value) +{ + hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */ + herr_t is_varlen = 0; + herr_t ret = FAIL; + + /* Open the named packet table */ + if( (ptable = H5PTopen(fid, table_name)) < 0) + goto error; + + /* Verify the value returned from H5PTis_varlen is as expected */ + is_varlen = H5PTis_varlen(ptable); + if (is_varlen == FAIL) + goto error; + else if (is_varlen == expected_value) + ret = SUCCEED; + else + { + char lenthtype[20]; + HDstrcpy(lenthtype, "fixed-length"); + if (expected_value == 1) + HDstrcpy(lenthtype, "variable-length"); + fprintf(stderr, "\nPacket table '%s' should be %s but is not\n", table_name, lenthtype); + ret = FAIL; + } + + /* Close the packet table */ + if (H5PTclose(ptable) < 0) + goto error; + + return ret; + +error: /* An error has occurred. Clean up and exit. */ + if (H5PTis_valid(ptable) > 0) H5PTclose(ptable); + return ret; +} /* verify_ptlengthtype */ + +/*------------------------------------------------------------------------- + * test_H5PTis_varlen(): Test that H5PTis_varlen works correctly on both + * fixed- and variable-length packet tables. + * + * Description: + * - Added a fixed-length packet table to the file for variety + * - Use the helper funtion verify_ptlengthtype to test H5PTis_varlen + * on each packet table. + * + * 2016/01/27 -BMR + *------------------------------------------------------------------------- + */ +static int test_H5PTis_varlen(void) +{ + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + herr_t ret; /* Returned status from a callee */ + + TESTING("H5PTis_varlen"); + + /* Open the file */ + fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); + if (fid < 0) + goto error; + + /* Create a new table */ + ptable = H5PTcreate_fl(fid, "Fixed-length Packet Table", H5T_STD_I32BE, (hsize_t)100, -1); + + /* Ensure that PT is created successfully */ + if (ptable == H5I_INVALID_HID) + goto error; + + /* Close the packet table */ + ret = H5PTclose(ptable); + if (ret < 0) + goto error; + + /* Close the file */ + if (H5Fclose(fid) < 0) + goto error; + + /* Open the file */ + fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); + if (fid < 0) + goto error; + + /* Open each packet table, and verify that H5PTis_varlen returns correct + type for each table */ + ret = verify_ptlengthtype(fid, PT_VLEN_ATOMIC, 1); /* vlen of atomic */ + if (ret < 0) + goto error; + ret = verify_ptlengthtype(fid, PT_VLEN_COMP, 1); /* vlen of compound */ + if (ret < 0) + goto error; + ret = verify_ptlengthtype(fid, PT_COMP_VLEN, 0); /* compound of vlen, no vlen */ + if (ret < 0) + goto error; + ret = verify_ptlengthtype(fid, PT_VLEN_VLEN, 1); /* vlen of vlen */ + if (ret < 0) + goto error; + ret = verify_ptlengthtype(fid, PT_FIXED_LEN, 0); /* no vlen */ + if (ret < 0) + goto error; + + /* Close the file */ + if (H5Fclose(fid) < 0) + goto error; + + PASSED(); + return SUCCEED; + +error: /* An error has occurred. Clean up and exit. */ + if (fid > 0) H5Fclose(fid); + H5_FAILED(); + return FAIL; +} /* test_H5PTis_varlen */ + +/*------------------------------------------------------------------------- + * adding_attribute() - helper function, adds an attribute to the named + * packet table. + * Note: + * For simplicity, the attributes that are added to the packet tables + * have the same characteristics except their names. They have the + * same type, space, and values. + * + * 2016/01/27 -BMR + *------------------------------------------------------------------------- + */ +#define ATTR_RANK 1 +#define ATTR_DIM 3 +int attr_data[ATTR_DIM]={256,11945,-22107}; /* values to be written to attr */ + +static int adding_attribute(hid_t fid, const char *table_name, const char *attr_name) +{ + hid_t ptable = H5I_INVALID_HID; /* Packet table identifier */ + hid_t space_id = H5I_INVALID_HID; /* Dataspace for the attribute */ + hid_t attr_id = H5I_INVALID_HID; /* Attribute identifier */ + hid_t dset_id = H5I_INVALID_HID; /* Dataset identifier */ + hsize_t dims[] = {ATTR_DIM}; /* Dimension for dataspace */ + int ret = FAIL; /* Returned status from a callee */ + + /* Create dataspace for attribute */ + space_id = H5Screate_simple(ATTR_RANK, dims, NULL); + if (space_id < 0) + goto error; + + /* Open the named packet table */ + if( (ptable = H5PTopen(fid, table_name)) < 0) + goto error; + + dset_id = H5PTget_dataset(ptable); + if (dset_id < 0) + goto error; + + /* Add the specified attribute to it */ + attr_id = H5Acreate(dset_id, attr_name, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT); + if (attr_id < 0) + goto error; + + /* Write attribute values */ + ret = H5Awrite(attr_id, H5T_NATIVE_INT, attr_data); + if (ret < 0) + goto error; + + /* Close the attribute */ + if (H5Aclose(attr_id) < 0) + goto error; + + /* Close the packet table */ + if (H5PTclose(ptable) < 0) + goto error; + + return SUCCEED; + +error: /* An error has occurred. Clean up and exit. */ + if (H5PTis_valid(ptable) > 0) H5PTclose(ptable); + return ret; +} /* adding_attribute */ + +/*------------------------------------------------------------------------- + * verify_attribute() - helper function, verifies the named attribute can + * be read correctly. + * + * 2016/01/27 -BMR + *------------------------------------------------------------------------- + */ +static herr_t verify_attribute(hid_t fid, const char *table_name, const char *attr_name) +{ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t space_id=H5I_INVALID_HID; /* Dataspace for the attribute */ + hid_t attr_id=H5I_INVALID_HID; /* Attribute identifier */ + hid_t dset_id=H5I_INVALID_HID; /* Dataset associated with the pt */ + hsize_t dims[] = {ATTR_DIM}; /* Dimensions for dataspace */ + int read_data[ATTR_DIM]; /* Output buffer */ + int ii; + herr_t ret = FAIL; /* Returned status from a callee */ + + /* Create dataspace for attribute */ + space_id = H5Screate_simple(ATTR_RANK, dims, NULL); + if (space_id < 0) + goto error; + + /* Open the named packet table */ + ptable = H5PTopen(fid, table_name); + if (ptable < 0) + goto error; + + /* Get the dataset id of this packet table */ + dset_id = H5PTget_dataset(ptable); + if (dset_id < 0) + goto error; + + /* Open first attribute for the dataset */ + attr_id = H5Aopen(dset_id, attr_name, H5P_DEFAULT); + if (attr_id < 0) + goto error; + + /* Read attribute values */ + ret = H5Aread(attr_id, H5T_NATIVE_INT, read_data); + if (ret < 0) + goto error; + + /* Verify values read in */ + for (ii = 0; ii < ATTR_DIM; ii++) + if (attr_data[ii] != read_data[ii]) + TestErrPrintf("%d: attribute data different: attr_data[%d]=%d, read_data[%d]=%d\n", __LINE__, ii, attr_data[ii], ii, read_data[ii]); + + /* Close the attribute */ + if (H5Aclose(attr_id) < 0) + goto error; + + /* Close the packet table */ + if (H5PTclose(ptable) < 0) + goto error; + + return SUCCEED; + +error: /* An error has occurred. Clean up and exit. */ + if (attr_id > 0) H5Aclose(attr_id); + if (H5PTis_valid(ptable) > 0) H5PTclose(ptable); + return ret; +} /* verify_attribute */ + +/*------------------------------------------------------------------------- + * test_attributes(): Test adding attributes to packet tables + * + * Description: + * Added attributes to some random packet tables in the file. + * + * 2016/01/27 -BMR + *------------------------------------------------------------------------- + */ +static int test_attributes(void) +{ + hid_t fid=H5I_INVALID_HID; /* File identifier */ + hid_t attr_id=H5I_INVALID_HID; /* Attribute identifier */ + herr_t ret = FAIL; /* Returned status from a callee */ + + TESTING("adding attributes to packet tables"); + + /* Open the file */ + fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); + if (fid < 0) + goto error; + + /* Add an arbitrary attribute to a few packet tables, using helper func */ + attr_id = adding_attribute(fid, PT_VLEN_ATOMIC, "Attribute 1"); + if (attr_id < 0) + goto error; + attr_id = adding_attribute(fid, PT_VLEN_COMP, "Attribute 2"); + if (attr_id < 0) + goto error; + attr_id = adding_attribute(fid, PT_COMP_VLEN, "Attribute 3"); + if (attr_id < 0) + goto error; + + /* Close the file */ + if (H5Fclose(fid) < 0) + goto error; + + /* Open the file again */ + fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); + if (fid < 0) + goto error; + + /* Read each attribute and verify the values, using helper function */ + ret = verify_attribute(fid, PT_VLEN_ATOMIC, "Attribute 1"); + if (ret < 0) + goto error; + ret = verify_attribute(fid, PT_VLEN_COMP, "Attribute 2"); + if (ret < 0) + goto error; + ret = verify_attribute(fid, PT_COMP_VLEN, "Attribute 3"); + if (ret < 0) + goto error; + + /* Close the file */ + if (H5Fclose(fid) < 0) + goto error; + + PASSED(); + return(ret); + +error: /* An error has occurred. Clean up and exit. */ + H5Fclose(fid); + H5_FAILED(); + return FAIL; +} /* test_attributes */ + +/*------------------------------------------------------------------------- + * verify_accessors() - helper function, verifies that various info can be + * retrieved correctly using the info returned by the accessor functions. + * + * Description: + * Testing functions H5PTget_dataset and H5PTget_type + * + * - Opens the named packet table + * - Gets its associated dataset ID then calls a C function on that ID + * to verify the dataset name + * - Gets its associated datatype ID then calls a C function on that ID + * to verify that the packet table is variable- or fixed-length as + * indicated by the expected_value argument + * + * 2016/01/27 -BMR + *------------------------------------------------------------------------- + */ +static herr_t verify_accessors(const char *table_name, herr_t expected_value) +{ + hid_t fid=H5I_INVALID_HID; /* File identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t dset_id=H5I_INVALID_HID; /* Dataset associated with the pt */ + hid_t dtype_id=H5I_INVALID_HID; /* Dataset identifier */ + char buf[NAME_BUF_SIZE]; + ssize_t name_size; + herr_t is_varlen = 0; + herr_t ret = FAIL; /* Returned status from a callee */ + + /* Open the file. */ + fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); + if (fid < 0) + goto error; + + /* Open the named packet table. */ + ptable = H5PTopen(fid, table_name); + if (ptable < 0) + goto error; + + /* Get the associated dataset ID. */ + dset_id = H5PTget_dataset(ptable); + if (dset_id < 0) + goto error; + + /* Check if the packet table's name matches its associated dataset's. */ + *buf = '\0'; + name_size = H5Iget_name(dset_id, (char*)buf, NAME_BUF_SIZE); + VERIFY(HDstrcmp(buf, table_name), "Names of dataset and packet table don't match"); + + /* Get the packet table's datatype ID */ + dtype_id = H5PTget_type(ptable); + if (dtype_id < 0) + goto error; + + /* Check if the type class matches that of the packet table. */ + is_varlen = H5Tdetect_class(dtype_id, H5T_VLEN); + if (is_varlen == FAIL) /* failure occurred */ + goto error; + else if (is_varlen == expected_value) /* length types match */ + ret = SUCCEED; + else /* length types don't match */ + { + /* Give lengthtype "fixed-length" or "variable-length" depending on the + expected_value passed in, then print the error message. */ + char lenthtype[20]; + HDstrcpy(lenthtype, "fixed-length"); + if (expected_value == 1) + HDstrcpy(lenthtype, "variable-length"); + fprintf(stderr, "\nThe dataset '%s' should be %s but is not\n", table_name, lenthtype); + ret = FAIL; + } + + /* Close the packet table */ + if (H5PTclose(ptable) < 0) + goto error; + + return SUCCEED; + +error: /* An error has occurred. Clean up and exit. */ + if (H5PTis_valid(ptable) > 0) H5PTclose(ptable); + return ret; +} /* verify_accessors */ + +/*------------------------------------------------------------------------- + * test_accessors(): Test the accessor functions + * + * Description: + * Retrieves the dataset and datatype IDs and verifies various info + * to ensure these IDs are correct. + * + * 2016/01/27 -BMR + *------------------------------------------------------------------------- + */ +static int test_accessors(void) +{ + hid_t fid=H5I_INVALID_HID; /* File identifier */ + hid_t ptable=H5I_INVALID_HID; /* File identifier */ + herr_t ret = FAIL; /* Returned status from a callee */ + + TESTING("accessor functions"); + + /* Open the file */ + fid = H5Fopen(TEST_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); + if (fid < 0) + goto error; + + ret = verify_accessors(PT_VLEN_ATOMIC, TRUE); + if (ret < 0) + goto error; + + ret = verify_accessors(PT_FIXED_LEN, FALSE); + if (ret < 0) + goto error; + + /* Close the file */ + if (H5Fclose(fid) < 0) + goto error; + + PASSED(); + return SUCCEED; + +error: /* An error has occurred. Clean up and exit. */ + if (H5PTis_valid(ptable) > 0) H5PTclose(ptable); + if (fid > 0) H5Fclose(fid); + H5_FAILED(); + return FAIL; +} /* test_accessors */ + +/*------------------------------------------------------------------------- + * test_packet_table_with_varlen(): Invokes individual tests to ensure that + * packet tables with variable length are created and written correctly + * without the specific VL PT functionality. (HDFFV-442) + * + * 2016/01/27 -BMR + *------------------------------------------------------------------------- + */ +int test_packet_table_with_varlen(void) +{ + hid_t fid=H5I_INVALID_HID; /* File identifier */ + int status = SUCCEED; + + /* Create a file using default properties */ + fid = H5Fcreate(TEST_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid < 0) + return FAIL; + + /* Close the file. The file will be opened by each test function below */ + if (H5Fclose(fid) < 0) + return FAIL; + + HDputs("Testing packet table with various variable-length datatypes"); + + /* If any test fails, move on to subsequent test, but status will indicate + there is a failure. */ + + /* Test variable length of a simple type */ + if (test_VLof_atomic() < 0) + status = FAIL; + + /* Test variable length of a compound type */ + if (test_VLof_comptype() < 0) + status = FAIL; + + /* Test compound type with variable length */ + if (test_compound_VL_VLtype() < 0) + status = FAIL; + + /* Test variable length of a variable length */ + if (test_VLof_VLtype() < 0) + status = FAIL; + + /* Test variable length of a variable length */ + if (test_H5PTis_varlen() < 0) + status = FAIL; + + /* Test adding attributes to packet table */ + if (test_attributes() < 0) + status = FAIL; + + /* Test accessor functions */ + if (test_accessors() < 0) + status = FAIL; + + return(status); +} -- cgit v0.12 From 2a714ac4c0c0a230a019616dbf80bb03ce39c18d Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Fri, 4 Mar 2016 14:50:52 -0500 Subject: [svn-r29270] Description: Updated for "Improve Packet Table library" commit 29269. --- MANIFEST | 1 + release_docs/RELEASE.txt | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/MANIFEST b/MANIFEST index 27be844..7386c76 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2370,6 +2370,7 @@ ./hl/test/test_image.c ./hl/test/test_lite.c ./hl/test/test_packet.c +./hl/test/test_packet_vlen.c ./hl/test/test_table.c ./hl/test/test_ds_le.h5 ./hl/test/test_ds_be.h5 diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 2c9c79f..a830d93 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -60,6 +60,17 @@ New Features High-Level APIs: ------ + - New public functions in Packet Table API + + Two accessor functions were added per HDFFV-8623/patch 003. + /* Returns the ID of the dataset associated with the packet table */ + hid_t H5PTget_dataset(hid_t table_id); + + /* Returns the ID of the datatype the packet table uses */ + hid_t H5PTget_type(hid_t table_id); + + (BMR, 2016/03/04, HDFFV-8623) + Documentation ------------- @@ -87,6 +98,19 @@ Bug Fixes since HDF5-1.8.0 release High-Level APIs: ------ + - Packet Table is updated. + + In the Packet Table C API, there are changes with the following functions, + which had been ifdef'ed out with VLPT_REMOVED since 2006 + * H5PTcreate_vl, is removed from this release + * H5PTfree_vlen_readbuff, is renamed to H5PTfree_vlen_buff + * H5PTis_varlen, is made available again + + Various cleanup: replacing 0/-1 with SUCCEED/FAIL and H5I_BADID with + H5I_INVALID_HID. + + (BMR, 2016/03/04, HDFFV-442) + Fortran High-Level APIs: ------ -- cgit v0.12 From 1f10dc7f119e612f91bedbc6a9ecb65f314cc707 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 4 Mar 2016 15:12:05 -0500 Subject: [svn-r29272] Add code to deal with two source files for test_packet test. --- hl/test/CMakeLists.txt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hl/test/CMakeLists.txt b/hl/test/CMakeLists.txt index 916dcf3..bf598c4 100644 --- a/hl/test/CMakeLists.txt +++ b/hl/test/CMakeLists.txt @@ -48,9 +48,19 @@ HL_ADD_EXE (test_ds) HL_ADD_EXE (test_dset_opt) HL_ADD_EXE (test_image) HL_ADD_EXE (test_lite) -HL_ADD_EXE (test_packet) HL_ADD_EXE (test_table) +# test_packet has two source files +add_executable (hl_test_packet test_packet.c test_packet_vlen.c) +TARGET_NAMING (hl_test_packet STATIC) +TARGET_C_PROPERTIES (hl_test_packet STATIC " " " ") +target_link_libraries (hl_test_packet + ${HDF5_HL_LIB_TARGET} + ${HDF5_LIB_TARGET} + ${HDF5_TEST_LIB_TARGET} +) +set_target_properties (hl_test_packet PROPERTIES FOLDER test/hl) + # -------------------------------------------------------------------- # This executable is used to generate test files for the test_ds test. # It should only be run during development when new test files are needed -- cgit v0.12 From 40cdbe0b8dc5ad618920d6a33a818cfa42c3f241 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 4 Mar 2016 15:41:12 -0500 Subject: [svn-r29274] HDFFV-9698: fix subsetting issues with h5dump --- MANIFEST | 7 ++ tools/h5dump/CMakeTests.cmake | 25 +++++ tools/h5dump/h5dumpgentest.c | 177 ++++++++++++++++++----------- tools/h5dump/testh5dump.sh.in | 13 +++ tools/lib/h5tools_dump.c | 8 +- tools/testfiles/tints4dims.ddl | 202 ++++++++++++++++++++++++++++++++++ tools/testfiles/tints4dims.h5 | Bin 0 -> 9824 bytes tools/testfiles/tints4dimsBlock2.ddl | 16 +++ tools/testfiles/tints4dimsBlockEq.ddl | 30 +++++ tools/testfiles/tints4dimsCount2.ddl | 22 ++++ tools/testfiles/tints4dimsCountEq.ddl | 30 +++++ tools/testfiles/tints4dimsStride2.ddl | 22 ++++ 12 files changed, 480 insertions(+), 72 deletions(-) create mode 100644 tools/testfiles/tints4dims.ddl create mode 100644 tools/testfiles/tints4dims.h5 create mode 100644 tools/testfiles/tints4dimsBlock2.ddl create mode 100644 tools/testfiles/tints4dimsBlockEq.ddl create mode 100644 tools/testfiles/tints4dimsCount2.ddl create mode 100644 tools/testfiles/tints4dimsCountEq.ddl create mode 100644 tools/testfiles/tints4dimsStride2.ddl diff --git a/MANIFEST b/MANIFEST index 7386c76..7de29fb 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1535,6 +1535,13 @@ ./tools/testfiles/tindicessub3.ddl ./tools/testfiles/tindicessub4.ddl ./tools/testfiles/tindicessub1.ddl +./tools/testfiles/tints4dims.ddl +./tools/testfiles/tints4dimsBlock2.ddl +./tools/testfiles/tints4dimsBlockEq.ddl +./tools/testfiles/tints4dimsCount2.ddl +./tools/testfiles/tints4dimsCountEq.ddl +./tools/testfiles/tints4dimsStride2.ddl +./tools/testfiles/tints4dims.h5 ./tools/testfiles/tintsattrs.ddl ./tools/testfiles/tintsattrs.h5 ./tools/testfiles/tlarge_objname.ddl diff --git a/tools/h5dump/CMakeTests.cmake b/tools/h5dump/CMakeTests.cmake index c256e11..9f7e2b0 100644 --- a/tools/h5dump/CMakeTests.cmake +++ b/tools/h5dump/CMakeTests.cmake @@ -103,6 +103,12 @@ ${HDF5_TOOLS_SRC_DIR}/testfiles/tindicessub3.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tindicessub4.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tindicesyes.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tints4dims.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tints4dimsBlock2.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tints4dimsBlockEq.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tints4dimsCount2.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tints4dimsCountEq.ddl + ${HDF5_TOOLS_SRC_DIR}/testfiles/tints4dimsStride2.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tintsattrs.ddl ${HDF5_TOOLS_SRC_DIR}/testfiles/tlarge_objname.ddl #${HDF5_TOOLS_SRC_DIR}/testfiles/tldouble.ddl @@ -244,6 +250,7 @@ ${HDF5_TOOLS_SRC_DIR}/testfiles/tgrp_comments.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/thlink.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/thyperslab.h5 + ${HDF5_TOOLS_SRC_DIR}/testfiles/tints4dims.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tintsattrs.h5 ${HDF5_TOOLS_SRC_DIR}/testfiles/tlarge_objname.h5 #${HDF5_TOOLS_SRC_DIR}/testfiles/tldouble.h5 @@ -915,6 +922,18 @@ texceedsubblock.out.err tindicesyes.out tindicesyes.out.err + tints4dims.out + tints4dims.out.err + tints4dimsBlock2.out + tints4dimsBlock2.out.err + tints4dimsBlockEq.out + tints4dimsBlockEq.out.err + tints4dimsCount2.out + tints4dimsCount2.out.err + tints4dimsCountEq.out + tints4dimsCountEq.out.err + tints4dimsStride2.out + tints4dimsStride2.out.err tintsattrs.out tintsattrs.out.err tlarge_objname.out @@ -1236,6 +1255,12 @@ ADD_H5_TEST (tdset-3s 0 --enable-error-stack -d "/dset1[1,1;;;]" tdset.h5) ADD_H5_TEST (tno-subset 0 --enable-error-stack --no-compact-subset -d "AHFINDERDIRECT::ah_centroid_t[0] it=0 tl=0" tno-subset.h5) + ADD_H5_TEST (tints4dimsCount2 0 --enable-error-stack -d FourDimInts -s 0,0,0,0 -c 2,2,2,2 tints4dims.h5) + ADD_H5_TEST (tints4dimsBlock2 0 --enable-error-stack -d FourDimInts -s 0,0,0,0 -c 1,1,1,1 -k 2,2,2,2 tints4dims.h5) + ADD_H5_TEST (tints4dimsStride2 0 --enable-error-stack -d FourDimInts -s 0,0,0,0 -S 2,2,2,2 -c 2,2,2,2 tints4dims.h5) + ADD_H5_TEST (tints4dimsCountEq 0 --enable-error-stack -d FourDimInts -s 0,0,0,0 -S 2,2,1,1 -k 1,2,1,1 -c 2,2,4,4 tints4dims.h5) + ADD_H5_TEST (tints4dimsBlockEq 0 --enable-error-stack -d FourDimInts -s 0,0,0,0 -S 2,2,1,1 -c 2,2,1,1 -k 1,2,4,4 tints4dims.h5) + # test printing characters in ASCII instead of decimal ADD_H5_TEST (tchar1 0 --enable-error-stack -r tchar.h5) diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 80051d4..668e3f7 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -110,6 +110,7 @@ #define FILE78 "tscalarintattrsize.h5" #define FILE79 "tintsattrs.h5" #define FILE80 "tbitnopaque.h5" +#define FILE81 "tints4dims.h5" /*------------------------------------------------------------------------- * prototypes @@ -271,20 +272,20 @@ typedef struct s1_t { #define THRESHOLD10 10 /* Free space section threshold */ /* "FILE66" macros and for FILE69 */ -#define F66_XDIM 8 +#define F66_XDIM 8 #define F66_DATASETU08 "DU08BITS" #define F66_DATASETS08 "DS08BITS" -#define F66_YDIM8 8 +#define F66_YDIM8 8 #define F66_DATASETU16 "DU16BITS" #define F66_DATASETS16 "DS16BITS" -#define F66_YDIM16 16 +#define F66_YDIM16 16 #define F66_DATASETU32 "DU32BITS" #define F66_DATASETS32 "DS32BITS" -#define F66_YDIM32 32 +#define F66_YDIM32 32 #define F66_DATASETU64 "DU64BITS" #define F66_DATASETS64 "DS64BITS" #define F66_YDIM64 64 -#define F66_DUMMYDBL "DummyDBL" +#define F66_DUMMYDBL "DummyDBL" /* "FILE70" macros and for FILE71 */ /* Name of dataset to create in datafile */ @@ -352,6 +353,13 @@ typedef struct s1_t { #define F80_DIM32 32 +#define F81_DATASETNAME "FourDimInts" +#define F81_RANK 4 +#define F81_WDIM 10 +#define F81_XDIM 8 +#define F81_YDIM 6 +#define F81_ZDIM 4 + static void gent_group(void) { @@ -568,7 +576,7 @@ static void gent_softlink(void) * Function: gent_softlink2 * * Purpose: Create soft links to various objects. - * Return: + * Return: * SUCCEED * FAIL * Programmer: Jonathan Kim @@ -582,7 +590,7 @@ static int gent_softlink2(void) hid_t gid1 = -1, gid2 = -1; hid_t datatype = -1; hid_t dset1 = -1, dset2 = -1; - hid_t dataspace = -1; + hid_t dataspace = -1; hsize_t dimsf[2]; /* dataset dimensions */ int data1[NX][NY] = {{0,0},{1,1},{2,2},{3,3}}; int data2[NX][NY] = {{0,0},{0,1},{0,2},{3,3}}; @@ -626,7 +634,7 @@ static int gent_softlink2(void) status = H5Tcommit2(fileid1, "dtype", datatype, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); if (status < 0) { - fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", FILE4_1); + fprintf(stderr, "Error: %s> H5Tcommit2 failed.\n", FILE4_1); status = FAIL; goto out; } @@ -2896,9 +2904,9 @@ static void gent_vldatatypes5(void) } /* This is big enough to make h5dump to use hyperslap to read - from file and display portion by portion. This also prints out array indices + from file and display portion by portion. This also prints out array indices via region reference for testing refion reference output. - Note: this was added originally prepared for bug2092. before the fix h5dump didn't + Note: this was added originally prepared for bug2092. before the fix h5dump didn't display array indices every 262 x N (N > 0) based on 2000x1000 dims. */ #define SPACE_ARRAY1BIG_DIM 2000 @@ -2945,7 +2953,7 @@ static void gent_array1_big(void) fid1 = H5Fcreate(FILE25_BIG, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); /*------------------------- - * Array type dataset + * Array type dataset */ /* Create dataspace for datasets */ sid1 = H5Screate_simple(SPACE1_RANK, sdims1, NULL); @@ -2961,7 +2969,7 @@ static void gent_array1_big(void) HDassert(ret >= 0); /*--------------------------- - * Region Reference dataset + * Region Reference dataset */ /* Create dataspace for the reference dataset */ sid2 = H5Screate_simple(SPACE1_RANK, dims2, NULL); @@ -5210,7 +5218,7 @@ static void gent_zero_dim_size(void) space = H5Screate_simple(SPACE3_RANK, dims1, NULL); /* dataset */ - dataset = H5Dcreate2(fid, "dset of 0 dimension size", H5T_STD_I32BE, space, H5P_DEFAULT, + dataset = H5Dcreate2(fid, "dset of 0 dimension size", H5T_STD_I32BE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); /* nothing should be written */ H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, &dset_buf); @@ -7064,7 +7072,7 @@ gent_packedbits(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETU16, H5T_STD_U16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - valu16bits = (uint16_t) ~0u; /* all 1s */ + valu16bits = (uint16_t) ~0u; /* all 1s */ for(i = 0; i < dims[0]; i++){ dsetu16[i][0] = valu16bits; for(j = 1; j < dims[1]; j++) @@ -7081,7 +7089,7 @@ gent_packedbits(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETU32, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - valu32bits = (uint32_t) ~0u; /* all 1s */ + valu32bits = (uint32_t) ~0u; /* all 1s */ for(i = 0; i < dims[0]; i++){ dsetu32[i][0] = valu32bits; for(j = 1; j < dims[1]; j++) @@ -7115,7 +7123,7 @@ gent_packedbits(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETS08, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - val8bits = (int8_t) ~0; /* all 1s */ + val8bits = (int8_t) ~0; /* all 1s */ for(i = 0; i < dims[0]; i++){ dset8[i][0] = val8bits; for(j = 1; j < dims[1]; j++) @@ -7132,7 +7140,7 @@ gent_packedbits(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETS16, H5T_STD_I16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - val16bits = (int16_t) ~0; /* all 1s */ + val16bits = (int16_t) ~0; /* all 1s */ for(i = 0; i < dims[0]; i++){ dset16[i][0] = val16bits; for(j = 1; j < dims[1]; j++) @@ -7149,7 +7157,7 @@ gent_packedbits(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETS32, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - val32bits = (int32_t) ~0; /* all 1s */ + val32bits = (int32_t) ~0; /* all 1s */ for(i = 0; i < dims[0]; i++){ dset32[i][0] = val32bits; for(j = 1; j < dims[1]; j++) @@ -8638,7 +8646,7 @@ static void gent_compound_int_array(void) { valu8bits = (uint8_t) ~0u; /* all 1s */ for(n = 0; n < dims[0]; n++){ - Cmpd1[m].dsetu8[n] = valu8bits; + Cmpd1[m].dsetu8[n] = valu8bits; valu8bits <<= 1; } @@ -8647,7 +8655,7 @@ static void gent_compound_int_array(void) { valu16bits = (uint16_t) ~0u; /* all 1s */ for(n = 0; n < dims[0]; n++){ - Cmpd1[m].dsetu16[n] = valu16bits; + Cmpd1[m].dsetu16[n] = valu16bits; valu16bits <<= 1; } @@ -8656,7 +8664,7 @@ static void gent_compound_int_array(void) { valu32bits = (uint32_t) ~0u; /* all 1s */ for(n = 0; n < dims[0]; n++){ - Cmpd1[m].dsetu32[n] = valu32bits; + Cmpd1[m].dsetu32[n] = valu32bits; valu32bits <<= 1; } @@ -8665,7 +8673,7 @@ static void gent_compound_int_array(void) { valu64bits = (uint64_t) ~0Lu; /* all 1s */ for(n = 0; n < dims[0]; n++){ - Cmpd1[m].dsetu64[n] = valu64bits; + Cmpd1[m].dsetu64[n] = valu64bits; valu64bits <<= 1; } @@ -8674,7 +8682,7 @@ static void gent_compound_int_array(void) { val8bits = (int8_t) ~0; /* all 1s */ for(n = 0; n < dims[0]; n++){ - Cmpd1[m].dset8[n] = val8bits; + Cmpd1[m].dset8[n] = val8bits; val8bits <<= 1; } @@ -8683,7 +8691,7 @@ static void gent_compound_int_array(void) { val16bits = (int16_t) ~0; /* all 1s */ for(n = 0; n < dims[0]; n++){ - Cmpd1[m].dset16[n] = val16bits; + Cmpd1[m].dset16[n] = val16bits; val16bits <<= 1; } @@ -8692,7 +8700,7 @@ static void gent_compound_int_array(void) { val32bits = (int32_t) ~0; /* all 1s */ for(n = 0; n < dims[0]; n++){ - Cmpd1[m].dset32[n] = val32bits; + Cmpd1[m].dset32[n] = val32bits; val32bits <<= 1; } @@ -8701,7 +8709,7 @@ static void gent_compound_int_array(void) { val64bits = (int64_t) ~0L; /* all 1s */ for(n = 0; n < dims[0]; n++){ - Cmpd1[m].dset64[n] = val64bits; + Cmpd1[m].dset64[n] = val64bits; val64bits <<= 1; } @@ -8709,7 +8717,7 @@ static void gent_compound_int_array(void) { dims[0] = F76_DIM8; for(n = 0; n < dims[0]; n++) - Cmpd1[m].dsetdbl[n] = 0.0001F + n; + Cmpd1[m].dsetdbl[n] = 0.0001F + n; } /* Create the array data type for the 8 bits signed int array */ @@ -8884,64 +8892,64 @@ static void gent_compound_ints(void) { for (m = 0; m < F77_LENGTH; m++) { /* Array of 8 bits unsigned int */ - if((m % F76_DIM8) == 0) - valu8bits = (uint8_t) ~0u; /* all 1s */ - Cmpd1[m].dsetu8 = valu8bits; - Cmpd2[m].dsetu8 = valu8bits; + if((m % F76_DIM8) == 0) + valu8bits = (uint8_t) ~0u; /* all 1s */ + Cmpd1[m].dsetu8 = valu8bits; + Cmpd2[m].dsetu8 = valu8bits; valu8bits <<= 1; /* Array of 16 bits unsigned int */ - if((m % F76_DIM16) == 0) + if((m % F76_DIM16) == 0) valu16bits = (uint16_t) ~0u; /* all 1s */ - Cmpd1[m].dsetu16 = valu16bits; - Cmpd2[m].dsetu16 = valu16bits; - valu16bits <<= 1; + Cmpd1[m].dsetu16 = valu16bits; + Cmpd2[m].dsetu16 = valu16bits; + valu16bits <<= 1; /* Array of 32 bits unsigned int */ - if((m % F76_DIM32) == 0) + if((m % F76_DIM32) == 0) valu32bits = (uint32_t) ~0u; /* all 1s */ - Cmpd1[m].dsetu32 = valu32bits; - Cmpd2[m].dsetu32 = valu32bits; - valu32bits <<= 1; + Cmpd1[m].dsetu32 = valu32bits; + Cmpd2[m].dsetu32 = valu32bits; + valu32bits <<= 1; /* Array of 64 bits unsigned int */ - if((m % F76_DIM64) == 0) + if((m % F76_DIM64) == 0) valu64bits = (uint64_t) ~0Lu; /* all 1s */ - Cmpd1[m].dsetu64 = valu64bits; - Cmpd2[m].dsetu64 = valu64bits; - valu64bits <<= 1; + Cmpd1[m].dsetu64 = valu64bits; + Cmpd2[m].dsetu64 = valu64bits; + valu64bits <<= 1; /* Array of 8 bits signed int */ - if((m % F76_DIM8) == 0) + if((m % F76_DIM8) == 0) val8bits = (int8_t) ~0; /* all 1s */ - Cmpd1[m].dset8 = val8bits; - Cmpd2[m].dset8 = val8bits; - val8bits <<= 1; + Cmpd1[m].dset8 = val8bits; + Cmpd2[m].dset8 = val8bits; + val8bits <<= 1; /* Array of 16 bits signed int */ - if((m % F76_DIM16) == 0) + if((m % F76_DIM16) == 0) val16bits = (int16_t) ~0; /* all 1s */ - Cmpd1[m].dset16 = val16bits; - Cmpd2[m].dset16 = val16bits; - val16bits <<= 1; + Cmpd1[m].dset16 = val16bits; + Cmpd2[m].dset16 = val16bits; + val16bits <<= 1; /* Array of 32 bits signed int */ - if((m % F76_DIM32) == 0) + if((m % F76_DIM32) == 0) val32bits = (int32_t) ~0; /* all 1s */ - Cmpd1[m].dset32 = val32bits; - Cmpd2[m].dset32 = val32bits; - val32bits <<= 1; + Cmpd1[m].dset32 = val32bits; + Cmpd2[m].dset32 = val32bits; + val32bits <<= 1; /* Array of 64 bits signed int */ - if((m % F76_DIM64) == 0) + if((m % F76_DIM64) == 0) val64bits = (int64_t) ~0L; /* all 1s */ - Cmpd1[m].dset64 = val64bits; - Cmpd2[m].dset64 = val64bits; - val64bits <<= 1; + Cmpd1[m].dset64 = val64bits; + Cmpd2[m].dset64 = val64bits; + val64bits <<= 1; /* Double Dummy set for failure tests */ - Cmpd1[m].dsetdbl = 0.0001F + m; - Cmpd2[m].dsetdbl = 0.0001F + m; + Cmpd1[m].dsetdbl = 0.0001F + m; + Cmpd2[m].dsetdbl = 0.0001F + m; } /* Create the dataspace */ @@ -9352,7 +9360,7 @@ gent_intsattrs(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETU16, H5T_STD_U16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - valu16bits = (uint16_t) ~0u; /* all 1s */ + valu16bits = (uint16_t) ~0u; /* all 1s */ for(i = 0; i < dims[0]; i++){ dsetu16[i][0] = valu16bits; asetu16[i*dims[1]] = dsetu16[i][0]; @@ -9379,7 +9387,7 @@ gent_intsattrs(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETU32, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - valu32bits = (uint32_t) ~0u; /* all 1s */ + valu32bits = (uint32_t) ~0u; /* all 1s */ for(i = 0; i < dims[0]; i++){ dsetu32[i][0] = valu32bits; asetu32[i*dims[1]] = dsetu32[i][0]; @@ -9433,7 +9441,7 @@ gent_intsattrs(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETS08, H5T_STD_I8LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - val8bits = (int8_t) ~0; /* all 1s */ + val8bits = (int8_t) ~0; /* all 1s */ for(i = 0; i < dims[0]; i++){ dset8[i][0] = val8bits; aset8[i*dims[1]] = dset8[i][0]; @@ -9460,7 +9468,7 @@ gent_intsattrs(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETS16, H5T_STD_I16LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - val16bits = (int16_t) ~0; /* all 1s */ + val16bits = (int16_t) ~0; /* all 1s */ for(i = 0; i < dims[0]; i++){ dset16[i][0] = val16bits; aset16[i*dims[1]] = dset16[i][0]; @@ -9487,7 +9495,7 @@ gent_intsattrs(void) space = H5Screate_simple(2, dims, NULL); dataset = H5Dcreate2(fid, F66_DATASETS32, H5T_STD_I32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); - val32bits = (int32_t) ~0; /* all 1s */ + val32bits = (int32_t) ~0; /* all 1s */ for(i = 0; i < dims[0]; i++){ dset32[i][0] = val32bits; aset32[i*dims[1]] = dset32[i][0]; @@ -9710,6 +9718,41 @@ static void gent_bitnopaquefields(void) H5Fclose(file); } +/*------------------------------------------------------------------------- + * Function: gent_intsfourdims + * + * Purpose: Generate a file to be used in the h5dump subsetting tests. + * One datasets of unsigned int types are created in four dimensions 2,4,6,10. + *------------------------------------------------------------------------- + */ +static void +gent_intsfourdims(void) +{ + hid_t fid, dataset, space, tid; + hsize_t dims[F81_RANK]; + uint32_t dset1[F81_ZDIM][F81_YDIM][F81_XDIM][F81_WDIM]; + unsigned int i, j, k, l; + + fid = H5Fcreate(FILE81, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Dataset of 32 bits unsigned int */ + dims[0] = F81_ZDIM; dims[1] = F81_YDIM; dims[2] = F81_XDIM; dims[3] = F81_WDIM; + space = H5Screate_simple(F81_RANK, dims, NULL); + dataset = H5Dcreate2(fid, F81_DATASETNAME, H5T_STD_U32LE, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + for(i = 0; i < F81_ZDIM; i++) + for(j = 0; j < F81_YDIM; j++) + for(k = 0; k < F81_XDIM; k++) + for(l = 0; l < F81_WDIM; l++) + dset1[i][j][k][l] = i*F81_YDIM*F81_XDIM*F81_WDIM + j*F81_XDIM*F81_WDIM + k*F81_WDIM + l; + + H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset1); + H5Sclose(space); + H5Dclose(dataset); + + H5Fclose(fid); +} + /*------------------------------------------------------------------------- * Function: main @@ -9802,6 +9845,8 @@ int main(void) gent_intsattrs(); gent_bitnopaquefields(); + gent_intsfourdims(); + return 0; } diff --git a/tools/h5dump/testh5dump.sh.in b/tools/h5dump/testh5dump.sh.in index 267ac44..6d481c6 100644 --- a/tools/h5dump/testh5dump.sh.in +++ b/tools/h5dump/testh5dump.sh.in @@ -133,6 +133,7 @@ $SRC_H5DUMP_TESTFILES/tgrp_comments.h5 $SRC_H5DUMP_TESTFILES/thlink.h5 $SRC_H5DUMP_TESTFILES/thyperslab.h5 $SRC_H5DUMP_TESTFILES/tintsattrs.h5 +$SRC_H5DUMP_TESTFILES/tints4dims.h5 $SRC_H5DUMP_TESTFILES/tlarge_objname.h5 #$SRC_H5DUMP_TESTFILES/tldouble.h5 $SRC_H5DUMP_TESTFILES/tlonglinks.h5 @@ -265,6 +266,12 @@ $SRC_H5DUMP_TESTFILES/tindicessub2.ddl $SRC_H5DUMP_TESTFILES/tindicessub3.ddl $SRC_H5DUMP_TESTFILES/tindicessub4.ddl $SRC_H5DUMP_TESTFILES/tindicesyes.ddl +$SRC_H5DUMP_TESTFILES/tints4dims.ddl +$SRC_H5DUMP_TESTFILES/tints4dimsBlock2.ddl +$SRC_H5DUMP_TESTFILES/tints4dimsBlockEq.ddl +$SRC_H5DUMP_TESTFILES/tints4dimsCount2.ddl +$SRC_H5DUMP_TESTFILES/tints4dimsCountEq.ddl +$SRC_H5DUMP_TESTFILES/tints4dimsStride2.ddl $SRC_H5DUMP_TESTFILES/tintsattrs.ddl $SRC_H5DUMP_TESTFILES/tlarge_objname.ddl #$SRC_H5DUMP_TESTFILES/tldouble.ddl @@ -1106,6 +1113,12 @@ TOOLTEST tall-5s.ddl --enable-error-stack -d "/g1/g1.1/dset1.1.2[0;2;10;]" tall. TOOLTEST tdset-3s.ddl --enable-error-stack -d "/dset1[1,1;;;]" tdset.h5 TOOLTEST tno-subset.ddl --enable-error-stack --no-compact-subset -d "AHFINDERDIRECT::ah_centroid_t[0] it=0 tl=0" tno-subset.h5 +TOOLTEST tints4dimsCount2.ddl --enable-error-stack -d FourDimInts -s 0,0,0,0 -c 2,2,2,2 tints4dims.h5 +TOOLTEST tints4dimsBlock2.ddl --enable-error-stack -d FourDimInts -s 0,0,0,0 -c 1,1,1,1 -k 2,2,2,2 tints4dims.h5 +TOOLTEST tints4dimsStride2.ddl --enable-error-stack -d FourDimInts -s 0,0,0,0 -S 2,2,2,2 -c 2,2,2,2 tints4dims.h5 +TOOLTEST tints4dimsCountEq.ddl --enable-error-stack -d FourDimInts -s 0,0,0,0 -S 2,2,1,1 -k 1,2,1,1 -c 2,2,4,4 tints4dims.h5 +TOOLTEST tints4dimsBlockEq.ddl --enable-error-stack -d FourDimInts -s 0,0,0,0 -S 2,2,1,1 -c 2,2,1,1 -k 1,2,4,4 tints4dims.h5 + # test printing characters in ASCII instead of decimal TOOLTEST tchar1.ddl --enable-error-stack -r tchar.h5 diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index b6a53f3..5fb35bf 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -1359,7 +1359,7 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools if (ctx->ndims > 2) { for (i = 0; i < (size_t) ctx->ndims - 2; i++) { - max_start[i] = temp_start[i] + sset->count.data[i]; + max_start[i] = temp_start[i] + sset->count.data[i] * sset->stride.data[i]; temp_count[i] = 1; } } @@ -1401,14 +1401,10 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools /* increment start dimension */ do { reset_dim = 0; - temp_start[current_outer_dim]++; + temp_start[current_outer_dim] += sset->stride.data[current_outer_dim]; if (temp_start[current_outer_dim] >= max_start[current_outer_dim]) { temp_start[current_outer_dim] = sset->start.data[current_outer_dim]; - /* consider block */ - if (sset->block.data[current_outer_dim] > 1) - temp_start[current_outer_dim]++; - current_outer_dim--; reset_dim = 1; } diff --git a/tools/testfiles/tints4dims.ddl b/tools/testfiles/tints4dims.ddl new file mode 100644 index 0000000..ba5c852 --- /dev/null +++ b/tools/testfiles/tints4dims.ddl @@ -0,0 +1,202 @@ +HDF5 "tints4dims.h5" { +GROUP "/" { + DATASET "FourDimInts" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 4, 6, 8, 10 ) / ( 4, 6, 8, 10 ) } + DATA { + (0,0,0,0): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, + (0,0,1,0): 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + (0,0,2,0): 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + (0,0,3,0): 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + (0,0,4,0): 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + (0,0,5,0): 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + (0,0,6,0): 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + (0,0,7,0): 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, + (0,1,0,0): 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, + (0,1,1,0): 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + (0,1,2,0): 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + (0,1,3,0): 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + (0,1,4,0): 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + (0,1,5,0): 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + (0,1,6,0): 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + (0,1,7,0): 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + (0,2,0,0): 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, + (0,2,1,0): 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, + (0,2,2,0): 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, + (0,2,3,0): 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + (0,2,4,0): 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, + (0,2,5,0): 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, + (0,2,6,0): 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + (0,2,7,0): 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, + (0,3,0,0): 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + (0,3,1,0): 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + (0,3,2,0): 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + (0,3,3,0): 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + (0,3,4,0): 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + (0,3,5,0): 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, + (0,3,6,0): 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, + (0,3,7,0): 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + (0,4,0,0): 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, + (0,4,1,0): 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, + (0,4,2,0): 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, + (0,4,3,0): 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, + (0,4,4,0): 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, + (0,4,5,0): 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, + (0,4,6,0): 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, + (0,4,7,0): 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, + (0,5,0,0): 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, + (0,5,1,0): 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, + (0,5,2,0): 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, + (0,5,3,0): 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, + (0,5,4,0): 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, + (0,5,5,0): 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, + (0,5,6,0): 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, + (0,5,7,0): 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, + (1,0,0,0): 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, + (1,0,1,0): 490, 491, 492, 493, 494, 495, 496, 497, 498, 499, + (1,0,2,0): 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, + (1,0,3,0): 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, + (1,0,4,0): 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, + (1,0,5,0): 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, + (1,0,6,0): 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, + (1,0,7,0): 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, + (1,1,0,0): 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, + (1,1,1,0): 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, + (1,1,2,0): 580, 581, 582, 583, 584, 585, 586, 587, 588, 589, + (1,1,3,0): 590, 591, 592, 593, 594, 595, 596, 597, 598, 599, + (1,1,4,0): 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, + (1,1,5,0): 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, + (1,1,6,0): 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, + (1,1,7,0): 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, + (1,2,0,0): 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, + (1,2,1,0): 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, + (1,2,2,0): 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, + (1,2,3,0): 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, + (1,2,4,0): 680, 681, 682, 683, 684, 685, 686, 687, 688, 689, + (1,2,5,0): 690, 691, 692, 693, 694, 695, 696, 697, 698, 699, + (1,2,6,0): 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, + (1,2,7,0): 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, + (1,3,0,0): 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, + (1,3,1,0): 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, + (1,3,2,0): 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, + (1,3,3,0): 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, + (1,3,4,0): 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, + (1,3,5,0): 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, + (1,3,6,0): 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, + (1,3,7,0): 790, 791, 792, 793, 794, 795, 796, 797, 798, 799, + (1,4,0,0): 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, + (1,4,1,0): 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, + (1,4,2,0): 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, + (1,4,3,0): 830, 831, 832, 833, 834, 835, 836, 837, 838, 839, + (1,4,4,0): 840, 841, 842, 843, 844, 845, 846, 847, 848, 849, + (1,4,5,0): 850, 851, 852, 853, 854, 855, 856, 857, 858, 859, + (1,4,6,0): 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, + (1,4,7,0): 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, + (1,5,0,0): 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, + (1,5,1,0): 890, 891, 892, 893, 894, 895, 896, 897, 898, 899, + (1,5,2,0): 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, + (1,5,3,0): 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, + (1,5,4,0): 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, + (1,5,5,0): 930, 931, 932, 933, 934, 935, 936, 937, 938, 939, + (1,5,6,0): 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, + (1,5,7,0): 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, + (2,0,0,0): 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, + (2,0,1,0): 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, + (2,0,2,0): 980, 981, 982, 983, 984, 985, 986, 987, 988, 989, + (2,0,3,0): 990, 991, 992, 993, 994, 995, 996, 997, 998, 999, + (2,0,4,0): 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009, + (2,0,5,0): 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 1018, 1019, + (2,0,6,0): 1020, 1021, 1022, 1023, 1024, 1025, 1026, 1027, 1028, 1029, + (2,0,7,0): 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, + (2,1,0,0): 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, + (2,1,1,0): 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, + (2,1,2,0): 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, + (2,1,3,0): 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, + (2,1,4,0): 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, + (2,1,5,0): 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, + (2,1,6,0): 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, + (2,1,7,0): 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, + (2,2,0,0): 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, + (2,2,1,0): 1130, 1131, 1132, 1133, 1134, 1135, 1136, 1137, 1138, 1139, + (2,2,2,0): 1140, 1141, 1142, 1143, 1144, 1145, 1146, 1147, 1148, 1149, + (2,2,3,0): 1150, 1151, 1152, 1153, 1154, 1155, 1156, 1157, 1158, 1159, + (2,2,4,0): 1160, 1161, 1162, 1163, 1164, 1165, 1166, 1167, 1168, 1169, + (2,2,5,0): 1170, 1171, 1172, 1173, 1174, 1175, 1176, 1177, 1178, 1179, + (2,2,6,0): 1180, 1181, 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1189, + (2,2,7,0): 1190, 1191, 1192, 1193, 1194, 1195, 1196, 1197, 1198, 1199, + (2,3,0,0): 1200, 1201, 1202, 1203, 1204, 1205, 1206, 1207, 1208, 1209, + (2,3,1,0): 1210, 1211, 1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, + (2,3,2,0): 1220, 1221, 1222, 1223, 1224, 1225, 1226, 1227, 1228, 1229, + (2,3,3,0): 1230, 1231, 1232, 1233, 1234, 1235, 1236, 1237, 1238, 1239, + (2,3,4,0): 1240, 1241, 1242, 1243, 1244, 1245, 1246, 1247, 1248, 1249, + (2,3,5,0): 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, + (2,3,6,0): 1260, 1261, 1262, 1263, 1264, 1265, 1266, 1267, 1268, 1269, + (2,3,7,0): 1270, 1271, 1272, 1273, 1274, 1275, 1276, 1277, 1278, 1279, + (2,4,0,0): 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, + (2,4,1,0): 1290, 1291, 1292, 1293, 1294, 1295, 1296, 1297, 1298, 1299, + (2,4,2,0): 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, 1308, 1309, + (2,4,3,0): 1310, 1311, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, + (2,4,4,0): 1320, 1321, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, + (2,4,5,0): 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, + (2,4,6,0): 1340, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, + (2,4,7,0): 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, + (2,5,0,0): 1360, 1361, 1362, 1363, 1364, 1365, 1366, 1367, 1368, 1369, + (2,5,1,0): 1370, 1371, 1372, 1373, 1374, 1375, 1376, 1377, 1378, 1379, + (2,5,2,0): 1380, 1381, 1382, 1383, 1384, 1385, 1386, 1387, 1388, 1389, + (2,5,3,0): 1390, 1391, 1392, 1393, 1394, 1395, 1396, 1397, 1398, 1399, + (2,5,4,0): 1400, 1401, 1402, 1403, 1404, 1405, 1406, 1407, 1408, 1409, + (2,5,5,0): 1410, 1411, 1412, 1413, 1414, 1415, 1416, 1417, 1418, 1419, + (2,5,6,0): 1420, 1421, 1422, 1423, 1424, 1425, 1426, 1427, 1428, 1429, + (2,5,7,0): 1430, 1431, 1432, 1433, 1434, 1435, 1436, 1437, 1438, 1439, + (3,0,0,0): 1440, 1441, 1442, 1443, 1444, 1445, 1446, 1447, 1448, 1449, + (3,0,1,0): 1450, 1451, 1452, 1453, 1454, 1455, 1456, 1457, 1458, 1459, + (3,0,2,0): 1460, 1461, 1462, 1463, 1464, 1465, 1466, 1467, 1468, 1469, + (3,0,3,0): 1470, 1471, 1472, 1473, 1474, 1475, 1476, 1477, 1478, 1479, + (3,0,4,0): 1480, 1481, 1482, 1483, 1484, 1485, 1486, 1487, 1488, 1489, + (3,0,5,0): 1490, 1491, 1492, 1493, 1494, 1495, 1496, 1497, 1498, 1499, + (3,0,6,0): 1500, 1501, 1502, 1503, 1504, 1505, 1506, 1507, 1508, 1509, + (3,0,7,0): 1510, 1511, 1512, 1513, 1514, 1515, 1516, 1517, 1518, 1519, + (3,1,0,0): 1520, 1521, 1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, + (3,1,1,0): 1530, 1531, 1532, 1533, 1534, 1535, 1536, 1537, 1538, 1539, + (3,1,2,0): 1540, 1541, 1542, 1543, 1544, 1545, 1546, 1547, 1548, 1549, + (3,1,3,0): 1550, 1551, 1552, 1553, 1554, 1555, 1556, 1557, 1558, 1559, + (3,1,4,0): 1560, 1561, 1562, 1563, 1564, 1565, 1566, 1567, 1568, 1569, + (3,1,5,0): 1570, 1571, 1572, 1573, 1574, 1575, 1576, 1577, 1578, 1579, + (3,1,6,0): 1580, 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588, 1589, + (3,1,7,0): 1590, 1591, 1592, 1593, 1594, 1595, 1596, 1597, 1598, 1599, + (3,2,0,0): 1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607, 1608, 1609, + (3,2,1,0): 1610, 1611, 1612, 1613, 1614, 1615, 1616, 1617, 1618, 1619, + (3,2,2,0): 1620, 1621, 1622, 1623, 1624, 1625, 1626, 1627, 1628, 1629, + (3,2,3,0): 1630, 1631, 1632, 1633, 1634, 1635, 1636, 1637, 1638, 1639, + (3,2,4,0): 1640, 1641, 1642, 1643, 1644, 1645, 1646, 1647, 1648, 1649, + (3,2,5,0): 1650, 1651, 1652, 1653, 1654, 1655, 1656, 1657, 1658, 1659, + (3,2,6,0): 1660, 1661, 1662, 1663, 1664, 1665, 1666, 1667, 1668, 1669, + (3,2,7,0): 1670, 1671, 1672, 1673, 1674, 1675, 1676, 1677, 1678, 1679, + (3,3,0,0): 1680, 1681, 1682, 1683, 1684, 1685, 1686, 1687, 1688, 1689, + (3,3,1,0): 1690, 1691, 1692, 1693, 1694, 1695, 1696, 1697, 1698, 1699, + (3,3,2,0): 1700, 1701, 1702, 1703, 1704, 1705, 1706, 1707, 1708, 1709, + (3,3,3,0): 1710, 1711, 1712, 1713, 1714, 1715, 1716, 1717, 1718, 1719, + (3,3,4,0): 1720, 1721, 1722, 1723, 1724, 1725, 1726, 1727, 1728, 1729, + (3,3,5,0): 1730, 1731, 1732, 1733, 1734, 1735, 1736, 1737, 1738, 1739, + (3,3,6,0): 1740, 1741, 1742, 1743, 1744, 1745, 1746, 1747, 1748, 1749, + (3,3,7,0): 1750, 1751, 1752, 1753, 1754, 1755, 1756, 1757, 1758, 1759, + (3,4,0,0): 1760, 1761, 1762, 1763, 1764, 1765, 1766, 1767, 1768, 1769, + (3,4,1,0): 1770, 1771, 1772, 1773, 1774, 1775, 1776, 1777, 1778, 1779, + (3,4,2,0): 1780, 1781, 1782, 1783, 1784, 1785, 1786, 1787, 1788, 1789, + (3,4,3,0): 1790, 1791, 1792, 1793, 1794, 1795, 1796, 1797, 1798, 1799, + (3,4,4,0): 1800, 1801, 1802, 1803, 1804, 1805, 1806, 1807, 1808, 1809, + (3,4,5,0): 1810, 1811, 1812, 1813, 1814, 1815, 1816, 1817, 1818, 1819, + (3,4,6,0): 1820, 1821, 1822, 1823, 1824, 1825, 1826, 1827, 1828, 1829, + (3,4,7,0): 1830, 1831, 1832, 1833, 1834, 1835, 1836, 1837, 1838, 1839, + (3,5,0,0): 1840, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849, + (3,5,1,0): 1850, 1851, 1852, 1853, 1854, 1855, 1856, 1857, 1858, 1859, + (3,5,2,0): 1860, 1861, 1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, + (3,5,3,0): 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, + (3,5,4,0): 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, + (3,5,5,0): 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899, + (3,5,6,0): 1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, + (3,5,7,0): 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, 1919 + } + } +} +} diff --git a/tools/testfiles/tints4dims.h5 b/tools/testfiles/tints4dims.h5 new file mode 100644 index 0000000..2fe8321 Binary files /dev/null and b/tools/testfiles/tints4dims.h5 differ diff --git a/tools/testfiles/tints4dimsBlock2.ddl b/tools/testfiles/tints4dimsBlock2.ddl new file mode 100644 index 0000000..f414e10 --- /dev/null +++ b/tools/testfiles/tints4dimsBlock2.ddl @@ -0,0 +1,16 @@ +HDF5 "tints4dims.h5" { +DATASET "FourDimInts" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 4, 6, 8, 10 ) / ( 4, 6, 8, 10 ) } + SUBSET { + START ( 0, 0, 0, 0 ); + STRIDE ( 1, 1, 1, 1 ); + COUNT ( 1, 1, 1, 1 ); + BLOCK ( 2, 2, 2, 2 ); + DATA { + (0,0,0,0): 0, 1, 80, 81, 480, 481, 560, 561, + (0,0,1,0): 10, 11, 90, 91, 490, 491, 570, 571 + } + } +} +} diff --git a/tools/testfiles/tints4dimsBlockEq.ddl b/tools/testfiles/tints4dimsBlockEq.ddl new file mode 100644 index 0000000..6625780 --- /dev/null +++ b/tools/testfiles/tints4dimsBlockEq.ddl @@ -0,0 +1,30 @@ +HDF5 "tints4dims.h5" { +DATASET "FourDimInts" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 4, 6, 8, 10 ) / ( 4, 6, 8, 10 ) } + SUBSET { + START ( 0, 0, 0, 0 ); + STRIDE ( 2, 2, 1, 1 ); + COUNT ( 2, 2, 1, 1 ); + BLOCK ( 1, 2, 4, 4 ); + DATA { + (0,0,0,0): 0, 1, 2, 3, 80, 81, 82, 83, + (0,0,1,0): 10, 11, 12, 13, 90, 91, 92, 93, + (0,0,2,0): 20, 21, 22, 23, 100, 101, 102, 103, + (0,0,3,0): 30, 31, 32, 33, 110, 111, 112, 113 + (0,2,0,0): 160, 161, 162, 163, 240, 241, 242, 243, + (0,2,1,0): 170, 171, 172, 173, 250, 251, 252, 253, + (0,2,2,0): 180, 181, 182, 183, 260, 261, 262, 263, + (0,2,3,0): 190, 191, 192, 193, 270, 271, 272, 273 + (2,0,0,0): 960, 961, 962, 963, 1040, 1041, 1042, 1043, + (2,0,1,0): 970, 971, 972, 973, 1050, 1051, 1052, 1053, + (2,0,2,0): 980, 981, 982, 983, 1060, 1061, 1062, 1063, + (2,0,3,0): 990, 991, 992, 993, 1070, 1071, 1072, 1073 + (2,2,0,0): 1120, 1121, 1122, 1123, 1200, 1201, 1202, 1203, + (2,2,1,0): 1130, 1131, 1132, 1133, 1210, 1211, 1212, 1213, + (2,2,2,0): 1140, 1141, 1142, 1143, 1220, 1221, 1222, 1223, + (2,2,3,0): 1150, 1151, 1152, 1153, 1230, 1231, 1232, 1233 + } + } +} +} diff --git a/tools/testfiles/tints4dimsCount2.ddl b/tools/testfiles/tints4dimsCount2.ddl new file mode 100644 index 0000000..500e418 --- /dev/null +++ b/tools/testfiles/tints4dimsCount2.ddl @@ -0,0 +1,22 @@ +HDF5 "tints4dims.h5" { +DATASET "FourDimInts" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 4, 6, 8, 10 ) / ( 4, 6, 8, 10 ) } + SUBSET { + START ( 0, 0, 0, 0 ); + STRIDE ( 1, 1, 1, 1 ); + COUNT ( 2, 2, 2, 2 ); + BLOCK ( 1, 1, 1, 1 ); + DATA { + (0,0,0,0): 0, 1, + (0,0,1,0): 10, 11 + (0,1,0,0): 80, 81, + (0,1,1,0): 90, 91 + (1,0,0,0): 480, 481, + (1,0,1,0): 490, 491 + (1,1,0,0): 560, 561, + (1,1,1,0): 570, 571 + } + } +} +} diff --git a/tools/testfiles/tints4dimsCountEq.ddl b/tools/testfiles/tints4dimsCountEq.ddl new file mode 100644 index 0000000..8b17bfc --- /dev/null +++ b/tools/testfiles/tints4dimsCountEq.ddl @@ -0,0 +1,30 @@ +HDF5 "tints4dims.h5" { +DATASET "FourDimInts" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 4, 6, 8, 10 ) / ( 4, 6, 8, 10 ) } + SUBSET { + START ( 0, 0, 0, 0 ); + STRIDE ( 2, 2, 1, 1 ); + COUNT ( 2, 2, 4, 4 ); + BLOCK ( 1, 2, 1, 1 ); + DATA { + (0,0,0,0): 0, 1, 2, 3, 80, 81, 82, 83, + (0,0,1,0): 10, 11, 12, 13, 90, 91, 92, 93, + (0,0,2,0): 20, 21, 22, 23, 100, 101, 102, 103, + (0,0,3,0): 30, 31, 32, 33, 110, 111, 112, 113 + (0,2,0,0): 160, 161, 162, 163, 240, 241, 242, 243, + (0,2,1,0): 170, 171, 172, 173, 250, 251, 252, 253, + (0,2,2,0): 180, 181, 182, 183, 260, 261, 262, 263, + (0,2,3,0): 190, 191, 192, 193, 270, 271, 272, 273 + (2,0,0,0): 960, 961, 962, 963, 1040, 1041, 1042, 1043, + (2,0,1,0): 970, 971, 972, 973, 1050, 1051, 1052, 1053, + (2,0,2,0): 980, 981, 982, 983, 1060, 1061, 1062, 1063, + (2,0,3,0): 990, 991, 992, 993, 1070, 1071, 1072, 1073 + (2,2,0,0): 1120, 1121, 1122, 1123, 1200, 1201, 1202, 1203, + (2,2,1,0): 1130, 1131, 1132, 1133, 1210, 1211, 1212, 1213, + (2,2,2,0): 1140, 1141, 1142, 1143, 1220, 1221, 1222, 1223, + (2,2,3,0): 1150, 1151, 1152, 1153, 1230, 1231, 1232, 1233 + } + } +} +} diff --git a/tools/testfiles/tints4dimsStride2.ddl b/tools/testfiles/tints4dimsStride2.ddl new file mode 100644 index 0000000..7ec98fc --- /dev/null +++ b/tools/testfiles/tints4dimsStride2.ddl @@ -0,0 +1,22 @@ +HDF5 "tints4dims.h5" { +DATASET "FourDimInts" { + DATATYPE H5T_STD_U32LE + DATASPACE SIMPLE { ( 4, 6, 8, 10 ) / ( 4, 6, 8, 10 ) } + SUBSET { + START ( 0, 0, 0, 0 ); + STRIDE ( 2, 2, 2, 2 ); + COUNT ( 2, 2, 2, 2 ); + BLOCK ( 1, 1, 1, 1 ); + DATA { + (0,0,0,0): 0, 2, + (0,0,2,0): 20, 22 + (0,2,0,0): 160, 162, + (0,2,2,0): 180, 182 + (2,0,0,0): 960, 962, + (2,0,2,0): 980, 982 + (2,2,0,0): 1120, 1122, + (2,2,2,0): 1140, 1142 + } + } +} +} -- cgit v0.12 From 027c960fd1cb402664502947ae18e3fd0239e9fc Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 4 Mar 2016 15:49:15 -0500 Subject: [svn-r29275] HDFFV-9698: fix subsetting issues with h5dump --- release_docs/RELEASE.txt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index a830d93..0b13a59 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -95,6 +95,16 @@ Bug Fixes since HDF5-1.8.0 release Tools ----- + - h5dump subsetting fixed for dims greater then two + + When a dataset has more then two dimensions, subsetting would incorrectly + calculate the data that needed to be displayed. + + Added in block and stride calculation that account for dimensions greater then two. + NOTE: lines that have line breaks inserted because of display length calculations, may + have index info that is incorrect until the next dimension break. + + (ADB, 2016/03/04, HDFFV-9698) High-Level APIs: ------ @@ -302,8 +312,8 @@ The following platforms are not supported but have been tested for this release. gfortran 4.6.1 20110422 Mac OS X El Capitan 10.11 Apple clang/clang++ version 7.0.0 from Xcode 7.0.1 - 64-bit gfortran GNU Fortran (GCC) 5.2.0 - (VM) + 64-bit gfortran GNU Fortran (GCC) 5.2.0 + (VM) Debian7.5.0 3.2.0-4-686 #1 SMP Debian 3.2.51-1 i686 GNU/Linux gcc (Debian 4.7.2-5) 4.7.2 -- cgit v0.12 From f5b516d0c942c8200fac1e899761e52c399056fc Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 4 Mar 2016 22:36:14 -0500 Subject: [svn-r29279] Tidying of H5C_load_entry() before complicated merge. No significant code changes. Smoke checked on 64-bit Windows 10 with VS 2015 Pro. --- src/H5C.c | 194 +++++++++++++++++++++----------------------------------------- 1 file changed, 64 insertions(+), 130 deletions(-) diff --git a/src/H5C.c b/src/H5C.c index 97ce4c6..8df9679 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -8130,12 +8130,12 @@ done: * Function: H5C_load_entry * * Purpose: Attempt to load the entry at the specified disk address - * and with the specified type into memory. If successful. - * return the in memory address of the entry. Return NULL - * on failure. + * and with the specified type into memory. If successful. + * return the in memory address of the entry. Return NULL + * on failure. * - * Note that this function simply loads the entry into - * core. It does not insert it into the cache. + * Note that this function simply loads the entry into + * core. It does not insert it into the cache. * * Return: Non-NULL on success / NULL on failure. * @@ -8144,35 +8144,35 @@ done: *------------------------------------------------------------------------- */ static void * -H5C_load_entry(H5F_t * f, - hid_t dxpl_id, +H5C_load_entry(H5F_t * f, + hid_t dxpl_id, #ifdef H5_HAVE_PARALLEL - hbool_t coll_access, + hbool_t coll_access, #endif /* H5_HAVE_PARALLEL */ - const H5C_class_t * type, - haddr_t addr, - void * udata) + const H5C_class_t * type, + haddr_t addr, + void * udata) { - hbool_t dirty = FALSE; /* Flag indicating whether thing was dirtied during deserialize */ - hbool_t compressed = FALSE; /* flag indicating whether thing */ - /* will be run through filters on */ - /* on read and write. Usually FALSE */ - /* set to true if appropriate. */ - size_t compressed_size = 0; /* entry compressed size if */ - /* known -- otherwise uncompressed. */ - /* Zero indicates compression not */ - /* enabled. */ - void * image = NULL; /* Buffer for disk image */ - void * thing = NULL; /* Pointer to thing loaded */ - H5C_cache_entry_t * entry; /* Alias for thing loaded, as cache entry */ - size_t len; /* Size of image in file */ - unsigned u; /* Local index variable */ + hbool_t dirty = FALSE; /* Flag indicating whether thing was dirtied during deserialize */ + hbool_t compressed = FALSE; /* flag indicating whether thing */ + /* will be run through filters on */ + /* on read and write. Usually FALSE */ + /* set to true if appropriate. */ + size_t compressed_size = 0; /* entry compressed size if */ + /* known -- otherwise uncompressed. */ + /* Zero indicates compression not */ + /* enabled. */ + void * image = NULL; /* Buffer for disk image */ + void * thing = NULL; /* Pointer to thing loaded */ + H5C_cache_entry_t *entry = NULL; /* Alias for thing loaded, as cache entry */ + size_t len; /* Size of image in file */ + unsigned u; /* Local index variable */ #ifdef H5_HAVE_PARALLEL - int mpi_rank = 0; /* MPI process rank */ - MPI_Comm comm = MPI_COMM_NULL; /* File MPI Communicator */ - int mpi_code; /* MPI error code */ + int mpi_rank = 0; /* MPI process rank */ + MPI_Comm comm = MPI_COMM_NULL; /* File MPI Communicator */ + int mpi_code; /* MPI error code */ #endif /* H5_HAVE_PARALLEL */ - void * ret_value = NULL; /* Return value */ + void * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -8211,74 +8211,15 @@ H5C_load_entry(H5F_t * f, /* Check for possible speculative read off the end of the file */ if(type->flags & H5C__CLASS_SPECULATIVE_LOAD_FLAG) { -/* Quincey has added patches for eoa calculations -- leave the original - * code around until we see the effect of these patches. - * JRM -- 1/1/15 - */ -#if 0 /* original code */ /* JRM */ - /* the original version of this code has several problems: - * - * First, the sblock is not available until the sblock - * has been read in, which causes a seg fault. This is - * dealt with easily enough by testing to see if - * f->shared->sblock is NULL, and calling H5FD_get_base_addr() - * to obtain the base addr when it is. - * - * The second issue is more subtle. H5F_get_eoa() calls - * H5FD_get_eoa(). However, this function returns the EOA as - * a relative address -- i.e. relative to the base address. - * This means that the base addr + addr < eoa sanity check will - * fail whenever the super block is not at address 0 when - * reading in the first chunk of the super block. - * - * To address these issues, I have rewritten the code to - * simply verify that the address plus length is less than - * the eoa. I think this is sufficient, but further testing - * should tell me if it isn't. - * JRM -- 8/29/14 - */ - haddr_t eoa; /* End-of-allocation in the file */ - haddr_t base_addr; /* Base address of file data */ - - /* Get the file's end-of-allocation value */ - eoa = H5F_get_eoa(f, type->mem_type); - HDassert(H5F_addr_defined(eoa)); - - /* Get the file's base address */ - if ( f->shared->sblock ) - - base_addr = H5F_BASE_ADDR(f); - - else { /* sblock not loaded yet -- use file driver info */ - - HDassert(f->shared->lf); - base_addr = H5FD_get_base_addr(f->shared->lf); - - } - HDassert(H5F_addr_defined(base_addr)); - - /* Check for bad address in general */ - if((addr + base_addr) > eoa) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, \ - "address of object past end of allocation") - - /* Check if the amount of data to read will be past the eoa */ - if((addr + base_addr + len) > eoa) - /* Trim down the length of the metadata */ - len = (size_t)(eoa - (addr + base_addr)); - -#else /* modified code */ /* JRM */ - haddr_t eoa; /* End-of-allocation in the file */ H5FD_mem_t cooked_type; - /* if type == H5FD_MEM_GHEAP, H5F_block_read() forces + /* if type == H5FD_MEM_GHEAP, H5F_block_read() forces * type to H5FD_MEM_DRAW via its call to H5F__accum_read(). * Thus we do the same for purposes of computing the eoa * for sanity checks. */ - cooked_type = - (type->mem_type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type->mem_type; + cooked_type = (type->mem_type == H5FD_MEM_GHEAP) ? H5FD_MEM_DRAW : type->mem_type; /* Get the file's end-of-allocation value */ eoa = H5F_get_eoa(f, cooked_type); @@ -8287,27 +8228,23 @@ H5C_load_entry(H5F_t * f, /* Check for bad address in general */ if ( H5F_addr_gt(addr, eoa) ) - - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, \ - "address of object past end of allocation") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "address of object past end of allocation") /* Check if the amount of data to read will be past the eoa */ if( H5F_addr_gt((addr + len), eoa) ) { /* Trim down the length of the metadata */ - /* Note that for some cache clients, this will cause an - * assertion failure. JRM -- 8/29/14 + * assertion failure. JRM -- 8/29/14 */ len = (size_t)(eoa - addr); - } + } /* end if */ if ( len <= 0 ) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, \ - "len not positive after adjustment for EOA.") + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "len not positive after adjustment for EOA.") + + } /* end if */ -#endif /* modified code */ /* JRM */ - } /* Allocate the buffer for reading the on-disk entry image */ if(NULL == (image = H5MM_malloc(len + H5C_IMAGE_EXTRA_SPACE))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer.") @@ -8330,14 +8267,17 @@ H5C_load_entry(H5F_t * f, #ifdef H5_HAVE_PARALLEL if(!coll_access || 0 == mpi_rank) { #endif /* H5_HAVE_PARALLEL */ + if(H5F_block_read(f, type->mem_type, addr, len, dxpl_id, image) < 0) HGOTO_ERROR(H5E_CACHE, H5E_READERROR, NULL, "Can't read image*") #ifdef H5_HAVE_PARALLEL } /* end if */ + /* if the collective metadata read optimization is turned on, - bcast the metadata read from process 0 to all ranks in the file - communicator */ + * bcast the metadata read from process 0 to all ranks in the file + * communicator + */ if(coll_access) { int buf_size; @@ -8356,7 +8296,7 @@ H5C_load_entry(H5F_t * f, if(type->image_len) { size_t new_len; /* New size of on-disk image */ - /* set magic and type field in *entry_ptr. While the image_len + /* set magic and type field in *entry_ptr. While the image_len * callback shouldn't touch the cache specific fields, it may check * these fields to ensure that it it has received the expected * value. @@ -8368,22 +8308,22 @@ H5C_load_entry(H5F_t * f, entry->magic = H5C__H5C_CACHE_ENTRY_T_MAGIC; entry->type = type; - /* verify that compressed and compressed_len are initialized */ + /* verify that compressed and compressed_len are initialized */ HDassert(compressed == FALSE); HDassert(compressed_size == 0); /* Get the actual image size for the thing */ if(type->image_len(thing, &new_len, &compressed, &compressed_size) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "can't retrieve image length") + HGOTO_ERROR(H5E_CACHE, H5E_CANTGET, NULL, "can't retrieve image length") - if(new_len == 0) - HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "image length is 0") + if(new_len == 0) + HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, NULL, "image length is 0") HDassert(((type->flags & H5C__CLASS_COMPRESSED_FLAG) != 0) || ((compressed == FALSE) && (compressed_size == 0))); HDassert((compressed == TRUE) || (compressed_size == 0)); - if(new_len != len) { + if(new_len != len) { if(type->flags & H5C__CLASS_COMPRESSED_FLAG) { @@ -8395,12 +8335,12 @@ H5C_load_entry(H5F_t * f, * size -- which must equal len. * * We can't verify the uncompressed size, but we can - * verify the rest with the following assertions. + * verify the rest with the following assertions. */ - HDassert(compressed); + HDassert(compressed); HDassert(compressed_size == len); - /* new_len should contain the uncompressed size. Set len + /* new_len should contain the uncompressed size. Set len * equal to new_len, so that the cache will use the * uncompressed size for purposes of space allocation, etc. */ @@ -8410,11 +8350,11 @@ H5C_load_entry(H5F_t * f, void *new_image; /* Buffer for disk image */ - /* compressed must be FALSE, and compressed_size + /* compressed must be FALSE, and compressed_size * must be zero. */ - HDassert(!compressed); - HDassert(compressed_size == 0); + HDassert(!compressed); + HDassert(compressed_size == 0); /* Adjust the size of the image to match new_len */ if(NULL == (new_image = H5MM_realloc(image, @@ -8425,9 +8365,7 @@ H5C_load_entry(H5F_t * f, image = new_image; #if H5C_DO_MEMORY_SANITY_CHECKS - HDmemcpy(((uint8_t *)image) + new_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); - #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ /* If the thing's image needs to be bigger for a speculatively @@ -8452,6 +8390,7 @@ H5C_load_entry(H5F_t * f, #ifdef H5_HAVE_PARALLEL if(!coll_access || 0 == mpi_rank) { #endif /* H5_HAVE_PARALLEL */ + /* Go get the on-disk image again */ if(H5F_block_read(f, type->mem_type, addr, new_len, dxpl_id, image) < 0) @@ -8472,13 +8411,12 @@ H5C_load_entry(H5F_t * f, #endif /* H5_HAVE_PARALLEL */ /* Deserialize on-disk image into native memory form again */ - if(NULL == (thing = type->deserialize(image, new_len, - udata, &dirty))) + if(NULL == (thing = type->deserialize(image, new_len, udata, &dirty))) HGOTO_ERROR(H5E_CACHE, H5E_CANTLOAD, NULL, "Can't deserialize image") #ifndef NDEBUG - { - /* new_compressed and new_compressed_size must be + { + /* new_compressed and new_compressed_size must be * initialize to FALSE / 0 respectively, as clients * that don't use compression may ignore these two * parameters. @@ -8500,7 +8438,7 @@ H5C_load_entry(H5F_t * f, HDassert(new_new_len == new_len); HDassert(!new_compressed); HDassert(new_compressed_size == 0); - } + } /* end block */ #endif /* NDEBUG */ } /* end if (new_len > len) */ @@ -8512,7 +8450,7 @@ H5C_load_entry(H5F_t * f, HGOTO_ERROR(H5E_CACHE, H5E_UNSUPPORTED, NULL, \ "size of non-speculative, non-compressed object changed") } - } /* end if (new_len != len) */ + } /* end if (new_len != len) */ } /* end if */ entry = (H5C_cache_entry_t *)thing; @@ -8564,10 +8502,10 @@ H5C_load_entry(H5F_t * f, entry->flush_in_progress = FALSE; entry->destroy_in_progress = FALSE; - entry->ring = H5C_RING_UNDEFINED; + entry->ring = H5C_RING_UNDEFINED; /* Initialize flush dependency height fields */ - entry->flush_dep_parent = NULL; + entry->flush_dep_parent = NULL; for(u = 0; u < H5C__NUM_FLUSH_DEP_HEIGHTS; u++) entry->child_flush_dep_height_rc[u] = 0; entry->flush_dep_height = 0; @@ -8592,13 +8530,9 @@ H5C_load_entry(H5F_t * f, done: /* Cleanup on error */ if(NULL == ret_value) { - /* Release resources */ - if ( thing && type->free_icr(thing) < 0 ) - - HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, \ - "free_icr callback failed") - + if(thing && type->free_icr(thing) < 0) + HDONE_ERROR(H5E_CACHE, H5E_CANTFLUSH, NULL, "free_icr callback failed") if(image) image = H5MM_xfree(image); } /* end if */ -- cgit v0.12 From a6c9f83aeed62d62ded380944c17f815ce640b1b Mon Sep 17 00:00:00 2001 From: Elena Pourmal Date: Sun, 6 Mar 2016 13:15:05 -0500 Subject: [svn-r29292] Maintenance: Restored RELEASE.txt from rev 27551 and added entries from Allen and Binh-Minh. Other main changes that were done to trunk should be documented before the 1.10.0 code freeze. This file will be added as HISTORY-1_9_0-1_10_0.txt to the 1_10 branch when the branch is created and will be part of the HDF5 1.10.* source distribution. --- release_docs/RELEASE.txt | 1289 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 1174 insertions(+), 115 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 0b13a59..1440f37 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -5,19 +5,19 @@ HDF5 version 1.9.234 currently under development INTRODUCTION This document describes the differences between HDF5-1.9.0 and -HDF5 1.9.x snapshot, and contains information on the platforms -tested and known problems in HDF5-1.9.x. +HDF5 1.9.x snapshot, and contains information on the platforms +tested and known problems in HDF5-1.9.x. For more details check the HISTORY*.txt files in the HDF5 source. -Links to HDF5 1.9.x source code can be found on The HDF Group's +Links to HDF5 1.9.x source code can be found on The HDF Group's development FTP server at the following location: ftp://ftp.hdfgroup.uiuc.edu/pub/outgoing/hdf5/snapshots -User documentation for the snapshot can be accessed directly at this location: +User documentation for the snapshot can be accessed directly at this location: http://www.hdfgroup.uiuc.edu/HDF5/doc_dev_snapshot/H5_dev/ For more information, see the HDF5 home page: - + http://www.hdfgroup.org/HDF5/ If you have any questions or comments, please send them to the HDF Help Desk: @@ -41,101 +41,1164 @@ New Features Configuration: ------------- + - cmakehdf5: configure options added to enable or disable the building of + different API's and testings. See "cmakehdf5 --help" for details. + (AKC - 2014/12/09 HDFFV-8932) + - Autotools: Automake updated to 1.14.1 (ADB - 2014/04/08) + - CMake: Moved minimum CMake version to 2.8.11 which enables better library + include processing. (ADB - 2014/03/26) + - New configuration option added to change the default plugin path. + configure option is --with-default-plugin=location + cmake option is -DH5_DEFAULT_PLUGINDIR:PATH=location + HDFFV-8513. (ADB 2013/09/04) + - Rename FFLAGS to FCFLAGS in configure (ADB 2013/08/13) + - CMake minimum is now 2.8.10. (ADB 2013/01/14) + - A new tool, cmakehdf5, which is a build command script similar to + buildhdf5 is added and is available in the bin directory. + (AKC - 2012/12/12) + - Fixed AIX Fortran compiler flags to use appropriate settings for + debugging, profiling, optimization situations. HDFFV-8069. (AKC + 2012/09/27) + - Updated to latest autotools and changed all hard *.sh scripts to + configure managed *.sh.in files. Removed overloading of autotools + TESTS variable by examples and tests. Renamed configure.in to + configure.ac. (ADB - 2012/08/23 - HDFFV-8129) + - Added code to display the version information of XL fortran and C++ + in the summary of configure. (AKC - 2012/02/28 - HDFFV-7793) + - Configure now generates Makefiles that build in "silent make mode" + by default in which compile and link lines are significantly + simplified for clarity. To override this and view actual compile and + link lines during building, the --disable-silent-rules flag can be used + at configure time, or the 'make' command can be followed by V=1, to + indicate a "verbose" make. (MAM - 2011/4/14). + - Added mpicc and mpif90 as the default C and Fortran compilers for Linux + systems when --enable-parallel is specified but no $CC or $FC is defined. + (AKC - 2011/2/7) + - Added a new configure option, "--enable-unsupported", which can + be used to stop configure from preventing the use of unsupported + configure option combinations, such as c++ in parallel or parallel + HDF5 with threadsafe. Use at your own risk, as it may result in a + library that won't compile or run as expected! + (MAM - 2010/11/17 - Bug 2061) + - PHDF5 changed to use "mpiexec", instead of mpirun, as the default MPI + applications startup command as defined in the MPI-2 definition, section + 4.1. (AKC - 2010/6/11 - Bug 1921) + - Configure now adds appropriate defines for supporting large (64-bit) + files on all systems, where supported, by default, instead of only linux. + This largefile support is controllable with the --enable-largefile + configure option. This is replacing the linux-specific --enable-linux-lfs + option, which has been removed from configure. + (MAM - 2010/05/05 - 1772/1434) + - Upgraded versions of autotools used to generate configuration suite. + We now use Automake 1.11.1, Autoconf 2.65, and Libtool 2.2.6b. + MAM 2010/04/15. + - Added the xlc-* and mpcc_r-* BASENAME patterns to be recognized as IBM + compilers so that the ibm compiler options can be added properly. This + allows non-system-default compiler command names (e.g. xlc-m.n.k.l) be + recognized. AKC 2009/11/26. + - Configuration suite now uses Automake 1.11 and Autoconf 2.64. + MAM 2009/08/11. + - Changed default Gnu fortran compiler from g95 to gfortran since + gfortran is more likely installed with gcc now. -AKC 2009/07/19- + - Added libtool version numbers to generated c++, fortran, and + hl libraries. MAM 2009/04/19. + - Regenerated Makefile.ins using Automake 1.10.2. MAM 2009/04/19. + - Added a Make target of check-all-install to test the correctness of + installing via the prefix= or $DESTDIR options. AKC - 2009/04/14 + - Configuration suite now uses Libtool 2.2.6a. MAM 2008/10/24 + + - Configuration suite now uses Autoconf 2.61, Automake 1.10.1. + MAM 2008/05/05. + + - The new configure option "--disable-sharedlib-rpath" disables + embedding the '-Wl,-rpath' information into executables when + shared libraries are produced, and instead solely relies on the + information in LD_LIBRARY_PATH. (MAM - 2008/05/15) Library: -------- + - H5F_ACC_DEBUG labeled "deprecated" + + The symbol was originally used to emit some extra debugging + informationi in the multi VFD. The underlying functionality + was removed due to disuse in HDF5 1.8.16 though the symbol + remained defined since it was visible in H5Fpublic.h. + + In this release, the symbol has been labeled deprecated and will + not be defined when H5_NO_DEPRECATED_SYMBOLS is defined. + + (DER - 2015-04-30, HDFFV-1074) + + - The library can load filter libraries dynamically during runtime. Users + can set the search path through environment variable HDF5_PLUGIN_PATH + and call H5Pset_filter to enable a dynamic filter. (SLU - 2013/04/08) + - Added new API functions H5Dscatter and H5Dgather to scatter data to and + and gather data from a selection within a memory buffer. + (NAF - 2013/02/05) + - The library now supports the data conversion from enumeration to numeric + (integer and floating-point number) datatypes. See Issue 8221. + (SLU - 2012/10/23) + - The data sieve buffer size was for all the datasets in the file. It + could waste memory if any dataset size is smaller than the sieve buffer + size. Now the library picks the smaller one between the dataset size + and the sieve buffer size from the file access property. See Issue 7934. + (SLU - 2012/4/2) + - I added a new parameter of object access property list to the function + H5Rdereference (Issue 2763). It's called H5Rdereference2 now. The former + H5Rdereference function has been deprecated to H5Rdereference1. (SLU - + 2011/7/18) + - H5Tcreate now supports string type (fixed-length and variable-length). + (SLU - 2011/05/20) + - Added ability to cache files opened through external links. Added new + public functions H5Pset_elink_file_cache_size(), + H5Pget_elink_file_cache_size(), and H5Fclear_elink_file_cache(). + (NAF - 2011/02/17) + - Removed all old code for Metraowerks compilers, bracketed by + __MWERKS__). Metraowerks compiler is long gone. (AKC - 2010/11/17) + - Added support for threadsafety on windows using the windows threads + library. Use the HDF5_ENABLE_THREADSAFE option in CMake while on a + windows platform to enable this functionality. This is supported on + Windows Vista and newer Windows operating systems. (MAM - 2010/09/10) + - When a mandatory filter failed to write data chunks, the dataset + couldn't close (bug 1260). The fix releases all resources and closes + the dataset but returns a failure. (SLU - 2010/9/8) + - H5Tset_order and H5Tget_order now support all data types. A new byte + order H5T_ORDER_MIXED has been added specifically for compound datatype + and its derived type. Please see bug #1934. (SLU - 2010/8/23) + - Improved performance of the chunk cache by avoiding unnecessary b-tree + lookups of chunks already in cache. (NAF - 2010/06/15) + - Greatly improved performance of extending a dataset with early + allocation. (NAF - 2010/03/24 - 1637) + - Added support for filtering densely stored groups. Many of the API + functions related to filters have been extended to support dense groups + as well as datasets. Pipeline messages can now be stored in a group's + object header. (NAF/QAK - 2009/10/8) + - The embedded library information is displayed by H5check_version() if a + version mismatch is detected. Also changed H5check_version() to + suppress the warning message totally if $HDF5_DISABLE_VERSION_CHECK is 2 + or higher. (Old behavior treated 3 or higher the same as 1, that is + print a warning and allows the program to continue. (AKC - 2009/9/28) + - If a user does not care for the extra library information insert + in the executables, he may turn it off by --disable-embedded-libinfo + during configure. (AKC - 2009/9/15) + - Corrected problem where library would re-write the superblock in a file + opened for R/W access, even when no changes were made to the file. + (QAK - 2009/08/20, Bz#1473) + - Separated "factory" free list class from block free lists. These free + lists are dynamically created and manage blocks of a fixed size. + H5set_free_list_limits() will use the same settings specified for block + free lists for factory free lists. (NAF - 2009/04/08) + - Added support for dense attributes to H5Ocopy. (XCao/NAF - 2009/01/29) + - Added H5Pset_elink_cb and H5Pget_elink_cb functions to support a + user-defined callback function for external link traversal. + (NAF - 2009/01/08) + - Added H5Pset_elink_acc_flags and H5Pget_elink_acc_flags functions to + allow the user to specify the file access flags used to open the target + file of an external link. (NAF - 2009/01/08) + - Added H5Pset_chunk_cache() and H5Pget_chunk_cache() functions to allow + individual rdcc configuration for each dataset. Added + H5Dget_access_plist() function to retrieve a dataset access property + list from a dataset. (NAF - 2008/11/12) + - Added H5Iis_valid() function to check if an id is valid without producing + an error message. (NAF - 2008/11/5) + - Added two new public routines: H5Pget_elink_fapl() and + H5Pset_elink_fapl(). (see bug #1247) (VC - 2008/10/13) + - Improved free space tracking in file to be faster. (QAK - 2008/10/06) + - Added 'mounted' field to H5G_info_t struct. (QAK - 2008/07/15) Parallel Library: ----------------- + - Add H5Pget_mpio_no_collective_cause() function that retrive reasons + why the collective I/O was broken during read/write IO access. + (JKM - 2012/08/30 HDFFV-8143) + - Special Collective IO (IO when some processes do not contribute to the + IO) and Complex Derived Datatype MPI functionalities are no longer + conditionally enabled in the library by configure. They are always + enabled in order to take advantage of performance boosts from these + behaviors. Older MPI implementations that do not allow for these + functionalities can no longer by used by HDF5. (MAM - 2011/07/08). + - Modified parallel tests to run with arbitrary number of processes. The + modified tests are testphdf5 (parallel dataset access), t_chunk_alloc + (chunk allocation), and t_posix_compliant (posix compliance). The rest of + the parallel tests already use in the code the number of processes + available in the communicator. (CMC - 2009/04/28) Fortran Library: ---------------- + - Added parallel routine H5Pget_mpio_actual_io_mode_f (MSB - 2012/09/27) + + - Added for the C API the Fortran wrapper: + h5ocopy_f (MSB - 2012/03/22) + + + HDF5 Fortran library was enhanced to support Fortran 2003 standard. + The following features are available when the HDF5 library is configured + using --enable-fortran --enable-fortran2003 configure flags AND + if fortran compiler is Fortran2003 compliant: + + - Subroutines overloaded with the C_PTR derived type: + h5pget_f + h5pget_fill_value_f + h5pinsert_f + h5pregister_f + h5pset_f + h5pset_fill_value_f + h5rcreate_f + h5rderefrence_f + h5rget_name_f + h5rget_obj_type_f + - Subroutines overloaded with the C_PTR derived type + and simplified signatures: + h5aread_f + h5awrite_f + h5dread_f + h5dwrite_f + - New subroutines + h5dvlen_reclaim_f + h5literate_by_name_f + h5literate_f + h5ovisit_f + h5tconvert_f + + - Subroutines with additional optional parameters: + h5pcreate_class_f + (EIP - 2011/10/14) + + - Added for the C APIs the Fortran wrappers: + h5dget_access_plist_f + h5iis_valid_f + h5pset_chunk_cache_f + h5pget_chunk_cache_f + (MSB - 2009/04/17) + + + C++ Library: ------------ + - New member functions + + Overloaded CommonFG::getObjnameByIdx to take char* for name + + Overloaded CommonFG::getObjTypeByIdx to return type name as a char*. + (BMR - 2010/05/02) + + DataSet::getInMemDataSize() to simplify getting the dataset's + data size in memory. (BMR - 2009/07/26) + - These member functions were added as wrapper for H5Rdereference to + replace the incorrect IdComponent::dereference(). + void H5Object::dereference(H5File& h5file, void* ref) + void H5Object::dereference(H5Object& obj, void* ref) + In addition, these constructors were added to create the associated + objects by way of dereference: + Attribute(H5Object& obj, void* ref); + Attribute(H5File& file, void* ref); + DataSet(H5Object& obj, void* ref); + DataSet(H5File& file, void* ref); + DataType(H5Object& obj, void* ref); + DataType(H5File& file, void* ref); + Group(H5Object& obj, void* ref); + Group(H5File& obj, void* ref); + (BMR - 2008/08/10) - Tools: - ------ + Tools: + ------ + - h5repack: Added ability to use plugin filters. HDFFV-8345 (ADB - 2013/09/04). + - h5dump: Added option -N --any_path, which searches the file for paths that + match the search path. HDFFV-7989 (ADB - 2013/08/12). + - h5dump: Added optional arg 0 to -A, which excludes attributes from display. + HDFFV-8134 (ADB - 2013/08/01). + - h5dump: Fixed displaying compression ratio for unknown or user-defined + filters. HDFFV-8344 (XCAO 2013/03/19) + - h5dump: Changed UNKNOWN_FILTER to USER_DEFINED_FILTER for user defined filter. + HDFFV-8346 (XCAO 2013/03/19) + - h5dump: Added capability for "-a" option to show attributes containing "/" + by using an escape character. For example, for a dataset "/dset" + containing attribute "speed(m/h)", use "h5dump -a "/dset/speed(\/h)" + to show the content of the attribute. See details at HDFFV-7523 + (PC -- 2012/03/12) + - h5dump: Added ability to apply command options across multiple files using a + wildcard in the filename. Example; "h5dump -H -d Dataset1 tarr*.h5". + HDFFV-7876 (ADB - 2012/03/12). + - h5repack: Improved performance for big chunked datasets (size > 128MB) + when used with layout (-l) or compression (-f) option. + It would perform much better prior to the improvement, + especially for cases that chunk dimentions looks like + "1024x5x1" (compare to "1x5x1024"). When bigger numbers + are toward front and smaller number is toward back in chunk + dimentions. HDFFV-7862 (JKM - 2012/03/01) + - h5dump: Added new option --no-compact-subset. This option will not + interpret the '[' character as starting the compact form of + subsetting. This is useful when the "h5dump error: unable to + open dataset "datset_name"" message is output because a dataset + name contains a '[' character. HDFFV-7689 (ADB - 2012/01/31) + - h5dump: Corrected schema location: + + (ADB - 2011/08/10) + - h5diff: Added new level for -v (verbose) option. The new levels are + 1 and 2. So -v1 and -v2 can be specified to view more + information about attributes differences. + Bug#2121 (JKM 2011/3/23) + - h5dump: Added new option --enable-error-stack. This option will display + error stack information in the output stream. This is useful + when the "h5dump: Unable to print data" message is output. + (ADB - 2011/02/24) + - h5diff: Add a new flag --exclude-path. Specified path to an object will + be excluded from comparing the two files or two groups. If group + is specified all the member objects will be excluded. + (JKM - 2010/09/16). + - h5ls: Add new flag --no-dangling-links. (refer to --help for details) + (JKM - 2010/06/15) + - h5ls: Add new flag --follow-symlinks. (refer to --help for details) + (JKM - 2010/05/25) + - h5diff: Add new flag --no-dangling-links. (refer to --help for details) + (JKM - 2010/02/10) + - h5diff: Add new flag --follow-symlinks. (refer to --help for details) + (JKM - 2010/01/25) + - h5diff: fix for displaying garbage value on LE machine for BE data. + (JKM - 2009/11/20) + - h5dump: subsetting now allows default for count. Also trailing ; in short form + can be omitted after last specified value. + (ADB - 2009/09/04) + - h5dump/h5ls: now can display data in region references + using new -R, --region flag. + (ADB - 2009/09/04) + - h5diff: new flag, -c, --compare, list objects that are not comparable. + (PVN - 2009/4/10 - 1368) + - h5diff new flag, -N, --nan, avoids NaNs detection. (PVN - 2009/4/10) + - h5dump correctly specifies XML dtd / schema urls (ADB - 2009/4/3 - 1519) + - h5repack now handles group creation order. (PVN - 2009/4/2 - 1402) + - h5dump: added a printing of the compression ratio of uncompressed and compressed + sizes for cases where compression filters are present. (PVN - 2008/05/01) + - h5dump: added an option to allow a user defined formatting string for printf + regarding floating point numbers. (PVN - 2008/05/06) + - h5dump: support for external links, display the object that the external link + points to. (PVN - 2008/05/12) + - h5repack: add a userblock to an HDF5 file during the repack. (PVN - 2008/08/26) + - h5repack: add 2 options that call H5Pset_alignment in the repacked file. (PVN - 2008/08/29) + - h5ls: added capability to traverse through external links when the -r + (recursive) flag is given. (NAF - 2008/09/16) + - h5ls: added -E option to enable traversal of external links. h5ls will + not traverse external links without this flag being set. + (NAF - 2008/10/06) + - h5diff: added support for long double (PVN - 2008/10/28) + - h5dump: binary output defaults to NATIVE with -b optionally accepting + the form of binary output (NATIVE, FILE, BE, LE). (PVN - 2008/10/30) + - h5diff: return 1 for file differences when both file graphs differ by any object. + Error return code was changed to 2 from -1. (PVN - 2008/10/30) + - h5import: TEXTFPE (scientific format) was deprecated. Use TEXTFP + instead (PVN - 2008/10/30) + - h5repack: When user doesn't specify a chunk size, h5repack now defines a default + chunk size as the same size of the size of the hyperslab used to read the chunks. + The size of the hyperslabs are defined as the size of each dimension or a + predefined constant, whatever is smaller. This assures that the chunk + read fits in the chunk cache. (PVN - 2008/11/21) + - h5diff: h5diff treats two INFINITY values different. Fixed by checking (value==expect) + before call ABS(...) at h5diff_array.c This will make that (INF==INF) is true + (INF is treated as an number instead of NaN) (PC -- 2009/07/28) + - h5diff: add option "--use-system-epsilon" to print difference if (|a-b| > EPSILON) + Change default to use strict equality (PC -- 2009/09/12) + + High-Level APIs: ------ - - New public functions in Packet Table API + - New public functions in Packet Table API Two accessor functions were added per HDFFV-8623/patch 003. - /* Returns the ID of the dataset associated with the packet table */ + /* Returns the ID of the dataset associated with the packet table */ hid_t H5PTget_dataset(hid_t table_id); /* Returns the ID of the datatype the packet table uses */ hid_t H5PTget_type(hid_t table_id); - - (BMR, 2016/03/04, HDFFV-8623) - - - Documentation - ------------- + (BMR, 2016/03/04, HDFFV-8623) + + - A new API function H5DOwrite_chunk. It writes a data chunk directly + into a file bypassing hyperslab selection, data conversion, and + filter pipeline. The user must be careful with the function and + clearly understand the I/O process of the library. + (SLU - 2013/2/11) + - New API: h5ltpath_valid (Fortran: h5ltpath_valid_f) which checks + if a path is correct and determines if a link resolves to a valid + object and checks that the link does not dangle. (MSB- 2012/3/15) + + - Added Fortran wrappers for Dimension Scale APIs. HDFFV-3797 + h5dsset_scale_f + h5dsattach_scale_f + h5dsdetach_scale_f + h5dsis_attached_f + h5dsis_scale_f + h5dsset_label_f + h5dsget_label_f + h5dsget_scale_name_f + h5dsget_num_scales_f + (EIP for SB - 2011/10/13) + + - Table: In version 3.0 of Table, "NROWS" (used to store number of records) was + deprecated (PVN - 2008/11/24) + + Documentation + ------------- Support for new platforms, languages and compilers. ======================================= + - Intel V11.1 uses now -O3 optimization in production mode (EIP - 2010/10/08) + - PathScale compilers are recognized and can build the HDF5 library + properly. AKC - 2009/7/28 - + - SunOS 5.11 (emu) 32-bit and 64-bit with Sun C/C++ 5.12 compiler and + Sun Fortran 95 8.6 compiler. (SLU - 2013/04/15) Bug Fixes since HDF5-1.8.0 release ================================== Library ------- + - Incorrect usage of list in CMake COMPILE_DEFINITIONS set_property + + The CMake command, set_property with COMPILE_DEFINITIONS property + needs a quoted semi-colon separated list of values. CMake will + transform the list to a series of -D{value} for the compile. + + (ADB - 2014/12/09, HDFV-9041) + + - H5Z.c: H5Zfilter_avail(H5Z_filter_t id) + Added else block if the call to the internal H5Z_filter_avail(id) does not + fail and returns FALSE. This block calls the H5PL_load(H5PL_TYPE_FILTER, (int)id) + function to attempt to dynamically load the filter plugin. + (ADB - 2014/03/03 HDFFV-8629) + - Added const qualifier to source buffer parameters in H5Dgather and + H5D_scatter_func_t (H5Dscatter callback). (NAF - 2013/7/02) + - Fixed an error involving failure to write fill values to the user's + buffer when reading unallocated chunks from datasets that have a + fill value set to H5D_FILL_VALUE_DEFAULT. A consequence of this + was the reporting of spurious data values in h5dump and h5diff + output. + (HDFFV-8247; JP - 2013/05/03) + - Fixed an error that could occur when calling H5Ocopy within an + H5Literate callback (and possibly other situations). + (NAF - 2012/7/25 - HDFFV-5853) + - Fixed an error that would occur when copying an object with attribute + creation order tracked and indexed. (NAF - 2012/3/28 - HDFFV-7762) + - Fixed a bug in H5Ocopy(): When copying an opened object, call the + object's flush class action to ensure that cached data is flushed + so that H5Ocopy will get the correct data. + (VC - 2012/3/27 - HDFFV-7853) + - When an application tries to write or read many small data chunks and + runs out of memory, the library had a seg fault. The fix is to + return the error stack with proper information. (SLU - 2012/3/23. + Issue 7785) + - H5Pset_data_transform had seg fault in some cases like x*-100. It + works correctly now and handles other cases like 100-x or 2/x. + (SLU - 2012/3/15. Issue 7922) + - Fixed rare corruption bugs that could occur when using the new object + header format. (NAF - 2012/3/15 - HDFFV-7879) + - Creating a dataset in a read-only file caused seg fault when the file + is closed. It's fixed. The attemp to create a dataset will fail + with the error stack indicating the file is read-only. (SLU - + 2012/1/25. Issue 7756) + - Fixed a seg fault that could occur when shrinking a dataset with chunks + larger than 1 MB. (NAF - 2011/11/30 - HDFFV-7833) + - Fixed a bug that could cause file corruption when copying named + datatypes to a file using shared messages. (NAF - 2011/11/14) + - Fixed a bug that could cause H5Oget_info to return the wrong address + after copying a named datatype. (NAF - 2011/11/14) + - The library allowed the conversion of strings between ASCII and UTF8 + (Issue 7582). We have corrected it to report an error under this + situation. (SLU - 2011/11/8) + - The library had seg fault when it tried to shrink the size of compound type + through H5Tset_size immediately after the type was created (Issue + 7618). It's fixed now. (SLU - 2011/10/26) + - Fixed a bug that occurred when using H5Ocopy on a committed datatype + containing an attribute using that committed datatype. + (NAF - 2011/10/13 - Issue 5854) + - #ifdef _WIN32 instances changed to #ifdef H5_HAVE_WIN32_API and added + H5_HAVE_VISUAL_STUDIO checks where necessary. CMake only as configure + never set _WIN32. + - CLANG compiler with the options -fcatch-undefined-behavior and -ftrapv + discovered 3 problems in tests and tools' library (Issue 7674): + 1. In dsets.c, left shifting an unsigned int for 32 bits or more + caused undefined behavior. + 2. In dt_arith.c, the INIT_INTEGER macro definition has an overflow + when the value is negative minimal and is being subtracted one. + 3. In tools/lib/h5tools_str.c, right shifting an int value for 32 bits + or more caused undefined behavior. + All the problems have been corrected. (SLU - 2011/9/2) + - In v1.6 library, there was EOA for the whole MULTI file saved in the + super block. We took it out in v1.8 library because it's meaningless + for the MULTI file. v1.8 library saves the EOA for the metadata file, + instead. But this caused some backward compatibility problem. + v1.8 library couldn't open the file created with v1.6 library. We + fixed the problem by checking the EOA value to detect the file + created with v1.6 library. (SLU - 2011/6/22) + - When a dataset had filters and reading data failed, the error message + didn't say which filter isn't registered. It's fixed now. + (SLU - 2011/6/3) + - The datatype handler created with H5Tencode/decode used to have the + reference count 0 (zero). I have fixed it. It is 1 (one) now. + (SLU - 2011/2/18) + - Fixed a bug that caused big endian machines to generate corrupt files + when using the scale-offset filter with floating point data or + fill values. Note that such datasets will no longer be readable + by any machine after this patch. (NAF - 2010/02/02 - Bug 2131) + - Retrieving a link's name by index in the case where the link is + external and the file that the link refers to doesn't exist will + now fail gracefully rather than cause a segmentation fault. + (MAM - 2010/11/17) + - Modified library to always cache symbol table information. Libraries + version 1.6.3 have a bug which causes them to require this + information for some operations. (NAF - 2010/09/21 - 1864) + - Fixed a bug that could occur when getting information for a new-style + group that was previously opened through a file handle that was + later closed. (NAF - 2010/09/15) + - Added define check in H5public.h if stdint.h is supported by the C++ + compiler. This define is only available on Windows with VS2010 and + using CMake to build the library. (ADB - 2010/09/13 - Bug 1938) + - H5Eset_current_stack now also closes the error stack to be set as the + default. This is to avoid a potential problem (Bug 1799). + (SLU - 2010/9/7) + - Fixed the bug in the filter's public CAN_APPLY function. The return + value should be htri_t not herr_t (Bug #1239). (SLU - 2010/8/5) + - Fixed a bug in the direct I/O driver that could render files with + certain kinds of unaligned data unreadable or corrupt them. + (NAF - 2010/07/28) + - valgrind reported an error of copying data to itself when a new attribute + is written (Bug #1956). I fixed it by taking out the memcpy step in + the attribute code. (SLU - 2010/07/28) + - Fixed a bug that could cause file corruption when using non-default + sizes of addresses and/or lengths. This bug could also cause + uncorrupted files with this property to be unreadable. This bug + was introduced in 1.8.5. (NAF - 2010/07/16 - 1951) + - Fixed a file corruption bug that could happen when shrinking a + compressed dataset. (NAF - 2010/05/20) + - Fixed some memory leaks in VL datatype conversion when strings are + used as fill values. (MAM - 2010/05/12 - BZ# 1826) + - Fixed a bug when copying objects with NULL references with the + H5O_COPY_EXPAND_REFERENCE_FLAG flag set. (NAF - 2010/04/08 - 1815) + - Files can now be concurrently opened more than once using the core file + driver, as long as the backing store is used. (NAF - 2010/03/09) + - Added support for H5O_COPY_EXPAND_EXT_LINK_FLAG to H5Ocopy. External + links will now be expanded if this flag is set. + (NAF - 2010/03/05 - 1733) + - Fixed a bug where the library, when traversing an external link, would + reopen the source file if nothing else worked. (NAF - 2010/03/05) + - Fixed an intermittent bug in the b-tree code which could be triggered + by expanding and shrinking chunked datasets in certain ways. + (NAF - 2010/02/16) + - H5Tdetect_class said a VL string is a string type. But when it's + in a compound type, it said it's a VL type (Bug #1584). I fixed it + to be consistent. It always return string type. (SLU - 2009/12/10) + - Fixed a bug where writing and deleting many global heap objects (i.e. + variable length data) would render the file unreadable. Previously + created files exhibiting this problem should now be readable. + (NAF - 2009/10/27 - 1483) + - Fixed incorrect return value for H5Pget_preserve. (AKC - 2009/10/08 - 1628) + - Fixed an assertion failure that occurred when H5Ocopy was called on a + dataset using a vlen inside a compound. (NAF - 2009/10/02 - 1597) + - Fixed incorrect return value for H5Pget_filter_by_id1/2 in H5Ppublic.h. + (NAF - 2009/09/25 - 1620) + - Fixed a bug where properties weren't being compared with the registered + compare callback. (NAF - 2009/09/25 - 1555) + - Fixed a bug where H5Pget_fitler_by_id would succeed when called for a + filter that wasn't present. (NAF - 2009/06/25 - 1250) + - Fixed an issue with committed compound datatypes containing a vlen. + Also fixed memory leaks involving committed datatypes. + (NAF - 2009/06/10 - 1593) + - Added versioning to H5Z_class_t struct to allow compatibility with 1.6 + API. (NAF - 2009/04/20 - 1533) + - Fixed a problem with using data transforms with non-native types in the + file. (NAF - 2009/04/20 - 1548) + - Added direct.h include file to windows section of H5private.h + to fix _getcwd() warning. (ADB - 2009/04/14 - 1536) + - Fixed a bug that prevented external links from working after calling + H5close(). (NAF - 2009/04/10 - 1539) + - Modified library to write cached symbol table information to the + superblock, to allow library versions 1.3.0 to 1.6.3 to read files + created by this version. (NAF - 2009/04/08 - 1423) + - Changed skip lists to use a deterministic algorithm. The library should + now never call rand() or srand(). (NAF - 2009/04/08 - 503) + - Fixed a bug where H5Lcopy and H5Lmove wouldn't create intermediate + groups when that property was set. (NAF - 2009/04/07 - 1526) + - Fixed a bug that caused files with a user block to grow by the size of + the user block every time they were opened. + (NAF - 2009/03/26 - 1499) + - Fixed a rare problem that could occur with files using the old (pre 1.4) + array datatype. (NAF - 2009/03/23) + - Modified library to be able to open files with corrupt root group symbol + table messages, and correct these errors if they are found. Such + files can only be successfully opened with write access. + (NAF - 2009/03/23 - 1189) + - Removed the long_long #define and replaced all instances with + "long long". This caused problems with third party products. All + currently supported compliers support the type. (ADB - 2009/03/05) + - Fixed various bugs that could prevent the fill value from being written + in certain rare cases. (NAF - 2009/02/26 - 1469) + - Fixed a bug that prevented more than one dataset chunk from being cached + at a time. (NAF - 2009/02/12 - 1015) + - Fixed an assertion failure caused by opening an attribute multiple times + through multiple file handles. (NAF - 2009/02/12 - 1420) + - Fixed a problem that could prevent the user from adding attributes (or + any object header message) in some circumstances. + (NAF - 2009/02/12 - 1427) + - Fixed a bug that could cause problems when an attribute was added to a + committed datatype using the committed datatype's datatype. + (NAF - 2009/02/12) + - Fixed a bug that could cause problems when copying an object with a + shared message in its own object header. (NAF - 2009/01/29) + - Changed H5Tset_order to properly reject H5T_ORDER_NONE for most + datatypes. (NAF - 2009/01/27 - 1443) + - Fixed a bug where H5Tpack wouldn't remove trailing space from an + otherwise packed compound type. (NAF - 2009/01/14) + - Fixed up some old v2 btree assertions that get run in debug mode that + were previously failing on compilation, and removed some of the + more heavily outdated and non-rewritable ones. (MAM - 2008/12/15) + - Fixed a bug that could cause problems when "automatically" unmounting + multiple files. (NAF - 2008/11/17) + - H5Ovisit and H5Ovisit_by_name will now properly terminate when the + callback function returns a positive value on the starting object. + (NAF - 2008/11/03) + - Fixed an error where a null message could be created that was larger + than could be written to the file. (NAF - 2008/10/23) + - Corrected error with family/split/multi VFD not updating driver info + when "latest" version of the file format used. (QAK - 2008/10/14) + - Corrected alignment+threshold errors to work correctly when metadata + aggregation is enabled. (QAK - 2008/10/06) + - Changed H5Fget_obj_count and H5Fget_obj_ids to ignore objects registered + by the library for internal library use. (NAF - 2008/10/06) + - Fixed potential memory leak during compound conversion. + (NAF - 2008/10/06) + - Changed the return value of H5Fget_obj_count from INT to SSIZE_T. Also + changed the return value of H5Fget_obj_ids from HERR_T to SSIZE_T and + the type of the parameter MAX_OBJS from INT to SIZE_T. (SLU - 2008/09/26) + - Fixed an issue that could cause data to be improperly overwritten + during compound type conversion. (NAF - 2008/09/19) + - Fixed pointer alignment violations that could occur during vlen + conversion. (NAF - 2008/09/16) + - Fixed problem where library could cause a segmentation fault when + an invalid location ID was given to H5Giterate(). (QAK - 2008/08/19) + - Fixed improper shutdown when objects have reference count > 1. The + library now tracks reference count due to the application separately + from that due to internal library routines. (NAF - 2008/08/19) + - Fixed assertion failure caused by incorrect array datatype version. + (NAF - 2008/08/08) + - Fixed an issue where mount point traversal would fail when using + multiple handles for the child. (NAF - 2008/08/07) + - Fixed an issue where mount points were inaccessible when using multiple + file handles for the parent. The mount table is now in the shared + file structure (the parent pointer is still in the top structure). + (NAF - 2008/08/07) + - when an attribute was opened twice and data was written with one of the handles, + the file didn't have the data. It happened because each handle had its own + object structure, and the empty one overwrote the data with fill value. This is + fixed by making some attribute information like the data be shared in the + attribute structure. SLU - 2008/07/22 + - Fixed issue where a group could have a file mounted on it twice. + (QAK - 2008/07/15) + - Fixed a Windows-specific issue in the ohdr test which was causing users + in some timezones to get false errors. This a deficiency in the Windows + mktime() function, and has been handled properly. SJW - 2008/06/19 + - Fixed the problem with the searching of target file for H5Lcreate_external(). + The searching pattern will depend on whether the target file's + pathname is an absolute or a relative path. Please see the description + in the RM for H5Lcreate_external(). (VC - 2008/04/08) + - Fixed possible file corruption bug when encoding datatype + descriptions for compound datatypes whose size was between + 256 & 511 bytes and the file was opened with the "use the + latest format" property enabled (with H5Pset_libver_bounds). + (QAK - 2008/03/13) + - Fixed bug in H5Aget_num_attrs() routine to handle invalid location + ID correctly. (QAK - 2008/03/11) + - H5Dset_extent: when shrinking dimensions, some chunks were not deleted. + (PVN - 2009/01/8) + - Added code to maintain a min_clean_fraction in the metadata cache when + in serial mode. (MAM - 2009/01/9) + + Configuration ------------- + - CMake: When CMake commands are executed individually on the command line + and the external filters are being built, the CMAKE_BUILD_TYPE define + must be set to the same value as the configuration + (-DCMAKE_BUILD_TYPE:STRING=Release if using -C Release). This is needed + by the the szip and zlib filter build commands. (ADB - HDFFV-8695) + - CMake: Remove use of XLATE_UTILITY program. (ADB - 2014/03/28 HDFFV-8640) + - CMake: Added missing quotes in setting the CMAKE_EXE_LINKER_FLAGS for the + MPI option. (ADB - 2014/02/27 HDFFV-8674) + - Modified H5detect.c to scan floating point types for padding bits before + analyzing the type further. This should fix problems with gcc 4.8 + (NAF - 2013/09/19 - HDFFV-8523/HDFFV-8500) + - Fixed Makefile issue in which "-Wl," was not properly specified + prior to -rpath when building parallel fortran libraries with + an Intel compiler. (MAM - 2012/03/26) + - Makefiles generated by other packages using h5cc as the compiler + no longer error when 'make' is invoked more than once in order + to 'rebuild' after changes to source. (MAM - 2012/03/26) + - Added --enable-fortran2003 flag to enable Fortran2003 support + in the HDF5 Fortran library. The flag should be used along with the + --enable-fortran flag and takes affect only when Fortran compiler + is Fortran2003 compliant. (EIP - 2011/11/14) + + - In Windows platform, the default VFD, was Windows VFD, is restored back + to the SEC2, aka POSIX, VFD. The Windows VFD is deprecated. HDFFV-7740 + (AKC 2011/09/26) + - Removed config/ibm-aix6.x. All IBM-AIX settings are in one file, + ibm-aix. (AKC - 2011/4/14) + - Shared C libraries are no longer disabled on Mac when Fortran + is enabled. Shared Fortran libraries are still not supported on Mac, + so configure will disable them by default, but this is overridable + with the new --enable-unsupported configure option. The configure + summary has been updated to reflect the fact that the shared-ness of + the C++/Fortran wrapper libraries may not align with the C library. + (MAM - 04/11/2011 - HDFFV-4353). + - Removed recognition of the parallel compilers of LAM(hcc) and + ChMPIon(cmpicc) since we have no access to these two MPI implementations + and cannot verify their correctness. (AKC - 2010/7/14 - Bug 1921) + - Removed the following config files, as we no longer support them: + config/dec-osf*, config/hpux11.00, config/irix5.x, + config/powerpc-ibm-aix4.x config/rs6000-ibm-aix5.x config/unicos* + MAM - 2009/10/08 + - Modified configure and make process to properly preserve user's CFLAGS + (and company) environment variables. Build will now properly use + automake's AM_CFLAGS for any compiler flags set by the configure + process. Configure will no longer modify CFLAGS directly, nor will + setting CFLAGS during make completely replace what configure has set up. + MAM - 2009/10/08 + - Support for TFLOPS, config/intel-osf1, is removed since the TFLOPS + machine has long retired. AKC - 2009/10/06. + - Added $(EXEEXT) extension to H5detect when it's executed in the + src/Makfile to generate H5Tinit.c so it works correctly on platforms + that require the full extension when running executables. + MAM - 2009/10/01 - BZ #1613 + - Configure will now set FC and CXX to "no" when fortran and c++ + are not being compiled, respectively, so configure will not run + some of the compiler tests for these languages when they are not + being used. MAM - 2009/10/01 + - The PathScale compiler (v3.2) was mistaken as gcc v4.2.0 but it fails to + recognize some gcc options. Fixed. (see bug 1301). AKC - 2009/7/28 - + - The --enable-static-exec flag will now properly place the -static flag + on the link line of all installed executables. This will force the + executable to link with static libraries over shared libraries, provided + the static libraries are available. MAM - 2009/08/31 - BZ #1583 + - The --includedir=DIR configuration option now works as intended, and can + be used to specify the location to install C header files. The default + location remains unchanged, residing at ${prefix}/include. + MAM - 2009/03/10 - BZ #1381 + - Configure no longer removes the '-g' flag from CFLAGS when in production + mode if it has been explicitly set in the CFLAGS environment variable + prior to configuration. MAM - 2009/03/09 - BZ #1401. + - Fixed error with 'make check install' failing due to h5dump + needing other tools built first. MAM - 2008/10/24. + - Wpen using shared szip, it is no longer necessary to specify + the path to the shared szip libraries in LD_LIBRARY_PATH. MAM - + 2008/10/24. + - The file libhdf5_fortran.settings is not installed since its content + is included in libhdf5.settings now. AKC - 2008/10/21 + - "make DESTDIR=xxx install" failed to install some tools and files + (e.g., h5cc and fortran modules). Fixed. AKC - 2008/10/8. + - Autotools: An export of LD_LIBRARY_PATH= was + removed from configure and make installcheck was revised to run + scripts installed in share/hdf5_examples to use the installed h5cc, etc. + to compile and run example source files also installed there. Make + installcheck will now fail when a shared szip or other external lib file + cannot be found in the same manner that executables compiled and linked + with h5cc will fail to run when those lib files cannot be found after + install. Make installcheck should pass after setting LD_LIBRARY_PATH to the + szip location. + (LRK - 2014/04/16) Performance ------------- - + - Removed program perform/benchpar from the enable-build-all list. The + program will be retired or moved to another location. HDFFV-8156 + (AKC 2012/10/01) + - Retired program perform/mpi-perf. Its purpose has been incorporated + into h5perf before. (AKC 2012/09/20) + - ifdefs added to tests around include unistd.h and function to simulate + getlogin() on Windows. + (ADB - 2011/08/15) + - perf_serial test added to Windows projects and check batch file. + (ADB - 2009/06/11) Fortran -------- + - Fixed a typo in return value of the nh5dread_f_c function ( was 1 + instead of 0 on success); fixed the return value to make it consistent + with other Fortran functions; cleaned the code from debug statements. + (EIP - 2012/06/23) - Tools - ----- - - h5dump subsetting fixed for dims greater then two + - Fixed problem writing/reading control characters to a dataset; writing + a string containing: alerts, backspace, carriage_return, form_feed, + horizontal_tab, vertical_tab, new_line is now tested and working. + (MSB - 2012/09/01) + + - Corrected the integer type of H5S_UNLIMITED_F to HSIZE_T (MSB - 2012/09/01) - When a dataset has more then two dimensions, subsetting would incorrectly - calculate the data that needed to be displayed. + - Corrected the number of continuation lines in the src files + to be less then 32 lines for F95 compliance. (MSB - 2012/10/01) - Added in block and stride calculation that account for dimensions greater then two. - NOTE: lines that have line breaks inserted because of display length calculations, may - have index info that is incorrect until the next dimension break. + Tools + ----- + - h5dump subsetting fixed for dims greater then two + When a dataset has more then two dimensions, subsetting would incorrectly + calculate the data that needed to be displayed. + Added in block and stride calculation that account for dimensions greater + then two. NOTE: lines that have line breaks inserted because of display + length calculations, may have index info that is incorrect until the next + dimension break. (ADB, 2016/03/04, HDFFV-9698) + - h5repack: h5repack would not attempt to remove UD filters. Added a + check to h5repack for UD filters that checks if the filter can + be dynamically loaded. This will require a change in the library to + add the H5PL_load() to the H5Zfilter_avail(). (ADB - 2014/03/03 HDFFV-8629) + - h5repack: Fixed failure for converting a layout of small chunked dataset + (size < 1K) to contiguous layout. HDFFV-8214 (JKM 2013/03/18) + - h5diff: Fixed to return correct exit code 1 when detect unique extra + attribute. Prior to this fix, h5diff returned exit code 0 indicating + two files are identical. HDFFV-7643 (JKM 2013/02/15) + - h5diff: Improved speed when comparing HDF5 files with lots of + attributes. Much slower performance was identified with release + version from 1.8.7 to 1.8.10 compared to 1.8.6. (JKM 2012/10/19) + - h5repack: "h5repack -f NONE file1.h5 out.h5" command failed if + source file contains chunked dataset and a chunk dim is bigger than + the dataset dim. Another issue is that the command changed max dims + if chunk dim is smaller than the dataset dim. + These issue occurred when dataset size is smaller than 64k (compact + size limit) Fixed both. + HDFFV-8012 (JKM 2012/09/24) + - h5diff: Fixed not to accumulate attribute difference to dataset + difference in verbose mode (-v, -r), which caused incorrect + difference between dataset and group/datatype object if attribute + exist with any differences. This also lead to fix inconsistent + format indicating difference between dataset and group/datatype + object. HDFFV-5919 (JKM 2012/09/05) + - h5diff: Fixed the incorrect result when comparing attribute data + values and the data type has same class but different size. + HDFFV-7942 (JKM 2012/08/15) + - ph5diff: Fixed intermittent hang issue on a certain operation in + parallel mode. It was detected by daily test for comparing + non-comparable objects, but it could have occurred in other + operations depend on machine condition. HDFFV-8003 (JKM 2012/08/01) + - h5diff: Fixed test failure for "make check" due to failure of + copying test files when performed in HDF5 source tree. Also applied + to other tools. + HDFFV-8107 (JKM 2012/08/01) + - h5diff: Fixed the Function COPY_TESTFILES_TO_TESTDIR() of + testh5diff.sh to better report when there is an error in the file + copying. HDFFV-8105 (AKC -2012/07/22) + - h5diff: Fixed not to check and display dangling link status without + --follow-symlinks option. This also improved performance when + comparing lots of external links without the --follow-symlinks + option. HDFFV-7998 (JKM 2012/04/26) + - h5unjam: Fixed sefgault when used -V (show version) option. + HDFFV-8001 (JKM 2012/04/19) + - h5repack: Fixed a failure when change the chunk size of a specified + chunked dataset with unlimited max dims. HDFFV-7993 (JKM 2012/04/11) + - h5diff: Fixed failure for comparing same named object with different + object types in comparing groups. Prior to the fix, h5diff resulted + in error. After the fix, h5diff detects such case as non-comparable + and display messages accordingly. HDFFV-7664 (JKM 2012/03/28) + - h5diff: If unique objects exists only in one file and try to exclude + the unique objects with --exclude-path option, h5diff missed + excluding some objects. + Fixed to exclude objects correctly in such case. + HDFFV-7837 (JKM 2012/03/20) + - h5dump: Added tools library error stack to properly catch error + information generated within the library. + HDFFV-7958 (ADB 2012/03/12) + - h5dump: Dangling links no longer throw error message, change process + when open link fails. + HDFFV-7839 (ADB 2012/03/12) + - h5diff: When two symbolic dangling links are compared with + --follow-symlinks option, the result should be same. It worked for + comparing two files, but didn't work for comparing two objects. + HDFFV-7835 (JKM 2012/03/09) + - h5dump: Refactored code to remove duplicated functions. Split XML + functions from DDL functions. Corrected indentation and formatting + errors. Also fixed subsetting counting overflow (HDFFV-5874). Verified + all tools call tools_init() in main. + HDFFV-7560 (ADB 2012/02/17) + - h5diff: fixed to prevent from displaying error stack message when + comparing the two dangling symlinks with follow-symlinks option. + HDFFV-7836 (JKM 2012/01/13) + - h5repack: fixed memory leak for handling variable length string in + attribute. HDFFV-7840 (JKM 2012/01/06) + - h5ls: fixed segfault when access region reference data in an + attribute. HDFFV-7838 (JKM 2011/12/29) + - h5diff: fixed segfault over non-comparable attribute with different + dimention or rank, along with '-c' option to display details. + HDFFV-7770 (JKM 2011/10/24) + - Fixed h5diff to display all the comparable object and attribute + regardless of non-comparables. HDFFV-7693 (JKM 2011/09/16) + - Fixed h5repack to update values of references(object and region) of + attributes in h5repack for 1) references, 2) ARRAY of references, + 3) VLEN of references, and 4) COMPOUND of references. + (JIRA HDF5 5932) PC -2011/09/14 + - h5diff: fixed segfault over dataset with container types + (array,lven) with multiple nested compound types. + (ex: compound->array->compound, compound->vlen->compound) + HDFFV-7712 JKM (2011/09/01) + - h5repack: added macro to handle failure in H5Dread/write when memory + allocation failed inside the library. (PC -- 2011/08/19) + - Fixed h5jam not to allow specifying an HDF5 formatted file as input + file for -u (user block file) option, because the original HDF5 file + will not be accessible if allows. HDFFV-5941 (JKM 2011/08/15) + - Revised command help pages of h5jam and h5unjam. The descriptions + were not up to date and some were missing. + HDFFV-7515 (JKM 2011/08/15) + - h5repack: h5repack failed to copy dataset if the layout is changed + from chunked with unlimited dims to contiguous. HDFFV-7649 + (PC -- 2011/07/15) + - h5diff: "--delta" option considers two NaN of the same type are + different, which is wrong based on h5diff description in Reference + Manual. HDFFV-7656 (PC -- 2011/07/15) + - Fixed h5diff to display instructive error message and exit with 1 + when mutually exclusive options (-d, -p and --use-system-epsilon) + are used together. HDFFV-7600 (JKM 2011/07/07) + - Fixed h5dump to display the first line of each element into correct + position for multiple dimention array type. + Before this fix, the first line of each element in array were + displayed after the last line of previous element without + moving to the next line (+indentation). + Bug #HDFFV-5878 (JKM 2011/06/15) + - Fixed h5dump to display correct value for H5T_STD_I8LE dataset + on a system (ppc64, linux, Big-Endian, clustering). + Bug #HDFFV-7594 (ABERT & JKM 2011/05/12) + - Fixed h5diff to compare file itself correctly. Previously h5diff + reported either different or not compatible in certain cases even + comparing file itself. This fix also improve performance when + comparing same target objects through verifying the obj&file + addresses before comparing the details in the objects (ex: datasets + or attributes) Bug #HDFFV-5928 (XCAO & JKM 2011/05/06) + - Updated h5dump test case script to prevent entire test failure upon + source directory is read-only. Bug# HDFFV-4342 (JKM 2011/4/12) + - Fixed h5dump displaying incorrect values for H5T_STD_I8BE type data in + attribute on Big-Endian machine. H5T_STD_I8BE is unsigned 8bit type, + so h5dump is supposed to display -2 instead of 254. It worked + correctly on Little-Endian system , but not on Big-Endian system. + Bug #HDFFV-4358 (JKM 2011/04/08) + - Updated to unify option name to '--enable-error-stack' for printing + HDF5 error stack messages for HDF5 tools. h5ls and h5dump for now. + For h5ls, this replaces "-e/--errors" option, which is deprecated. + Bug#2182 (JKM 2011/3/30) + - Fix h5diff for --use-system-epsilon option: the calculation changed + from ( |a - b| / b ) to ( |a - b| ). This was decided for better + performance. Bug#2184 (JKM 2011/3/24) + - Fixed output for H5T_REFERENCE in h5dump. According to the BNF document + the output of a H5T_REFERENCE should be followed by the type; + ::= H5T_REFERENCE { } + ::= H5T_STD_REF_OBJECT | H5T_STD_REF_DSETREG + Previously this was only displayed if the -R option was used. + Bug#1725 (ADB 2011/3/28) + - Fix h5diff issues for #1: h5diff compared attributes correctly only + when two objects have the same number of attributes and attribute + names are identical, #2: didn't display useful information about + attribute difference. Bug#2121 (JKM 2011/3/17) + - Fixed memory leak for h5diff when accessing symbolic links with + --follow-symlink option. Bug#2214 (JKM 2011/3/18) + - Fixed memory leak for h5diff when access variable length string + data. Bug#2216 (JKM 2011/3/18) + - Fixed and improved help page for -a option of h5ls. + Bug#1904 (JKM 2011/3/11) + - Fixed h5dump not to include attribute values in the output file when + h5dump "-y -o output_file" options were used. The problem was introduced + in HDF5 1.8.6 by showing data pointed by region references. (XCAO 2011/3/9) + - Fixed h5copy to be able to copy any object into the same HDF5 file. + Previously h5copy displayed error message when target file is same + as source file. (XCAO 2011/3/8) + - Fixed h5dump for skipping some values for long array type dataset on + Windows. This issue only occurred on Windows due to the different + return behavior from _vsnprintf() funtion. Bug#2161 (JKM 2011/3/3) + - Fixed h5dump for skipping array indices every certain number + when the array type dataset is relatively big. The certain number + varies according to the size of array. Bug#2092 (JKM 2011/2/15). + - Fixed h5diff for the segfault when compares compound datasets + with combination of fixed length string types and vlen string types + in certain orders. bug#2089 (JKM 2010/12/28) + - Improve h5diff performance. 1) use HDmemcmp() before comparing each + elements. 2) replace expensive H5Tequals() calls 3) retrieve datatype + information at dataset level not each element level for compound + datasets + - Fixed h5ls to display nested compound type with curly bracket + when -S (--simple) option is used with -l (--label), so it shows + which member (in curly bracket) belong to which nested compound type + and make the output make sense. bug#1979 (JKM 2010/11/09) + - Fixed h5diff to handle variable-length strings in a compound dataset + correctly. (also variable-length string array in a compound dataset) + Garbage values were displayed when h5diff compared multiple + variable-length strings in a compound type dataset. + Bug#1989 (JKM 2010/10/28) + - Fixed h5copy to fail gracefully when copying object to non-exist + group without -p option. Bug#2040 (JKM 2010/10/18) + - Fixed to compare member objects and groups recursively when two + files or groups are specified to be compared. Bug#1975 + (JKM 2010/9/16) + - Make h5repack be able to convert a layout to COMPACT for small size + dataset as default. bug#1896 (JKM 2010/09/15) + - Change h5ls not to manipulate special characters in object name or + attribute name for smart display. bug#1784 (JKM 2010/06/28) + - Fixed h5ls to return exit code 1 (error) when non-existent file is + specified. bug#1793. (JKM 2010/04/27) + - h5copy failed to copy dangling link when the link is specified + directly. bug#1817. (JKM 2010/04/22) + - h5repack lost attributes from a dataset of reference type. bug#1726. + (JKM 2010/3/25) + - h5repack sets NULL for object reference value for group or + named datatype. bug#1814. (JKM 2010/03/19) + - h5diff: fixed incorrect behavior (hang) in parallel mode when + specify invalid options (ex: -v and -q) (JKM 2010/02/17) + - h5dump/h5ls display buffer resize fixed in tools library. + (ADB - 2009/07/21 - 1520) + - Fixed many problems that could occur when using h5repack with named + datatypes. (NAF - 2009/4/20 - 1516/1466) + - h5dump, h5diff, h5repack were not reading (by hyperslabs) datasets + that have a datatype datum size greater than H5TOOLS_BUFSIZE, a + constant defined as 1024Kb, such as array types with large + dimensions (PVN - 2009/4/1 - 1501) + - h5import: By selecting a compression type, a big endian byte order was being + selected (PVN - 2009/3/11 - 1462) + - zip_perf.c had missing argument on one of the open() calls. Fixed. + (AKC - 2008/12/9) + - h5dump now checks for uniqueness of committed datatypes. + (NAF - 2008/10/15) + - Fixed unnecessary indentation of committed datatypes in h5dump. + (NAF - 2008/10/15) + - Fixed bugs in h5stat:segmemtation fault when printing groups and + print warning message when traversal of objects is unsuccessful. + (see bug #1253) (VC- 2008/10/13) + - Fixed bug in h5ls that prevented relative group listings (like + "h5ls foo.h5/bar") from working correctly (QAK - 2008/06/03) + - Fixed bug in h5diff that prevented datasets & attributes with + variable-length string elements from comparing correctly. + (QAK - 2008/02/28) + - h5import bug on Windows w/binary datasets. fread in windows needs a + binary file to be open with 'rb' instead of 'r' otherwise it + terminates execution if an end of file character is found on the + input file. Besides that the binary file generated needs to be open + with 'wb' , otherwise an end of line character is read twice. + (PVN - 2008/02/19) + - Fixed bug in h5dump that caused binary output to be made only for the first + dataset, when several datasets were requested. (PVN - 2008/04/07) + - h5dump: when doing binary output (-b), the stdout printing of attributes + was done incorrectly. Removed printing of attributes when doing binary + output. PVN - 2008/06/05 - (ADB, 2016/03/04, HDFFV-9698) High-Level APIs: ------ - - Packet Table is updated. + - Packet Table is updated. + + In the Packet Table C API, there are changes with the following functions, + which had been ifdef'ed out with VLPT_REMOVED since 2006 + * H5PTcreate_vl, is removed from this release + * H5PTfree_vlen_readbuff, is renamed to H5PTfree_vlen_buff + * H5PTis_varlen, is made available again + + Various cleanup: replacing 0/-1 with SUCCEED/FAIL and H5I_BADID with + H5I_INVALID_HID. (BMR, 2016/03/04, HDFFV-442) + + - Fixed problem with H5DSget_scale_name including the NULL terminator in + the size calculation returned by the function. The API does not + include the NULL terminator in the size returned (MSB- 2013/2/10) + + - Fixed problem with H5TBdelete_record destroying all data following the deletion + of a row. (MSB- 2012/7/26) + + - Fixed H5LTget_attribute_string not closing an object identifier when an + error occurs. (MSB- 2012/7/21) + + - Fixed the H5LTdtype_to_text function. It had some memory problems when + dealing with some complicated data types. HDFFVI-7701 (SLU - 2011/10/19) + + - Fixed a bug in H5DSattach_scale, H5DSis_attached and H5DSdetach_scale + caused by using H5Tget_native_type function to determine the native + type for reading REFERENCE_LIST attribute. The bug was exposed + on Mac PPC. + (EIP - 2010/05/22 -1851) + - Fixed a bug in the H5DSdetach_scale function when 0 bytes + were allocated after the last reference to a dim. scale + was removed from the list of references in a VL element of the + DIMENSION_LIST attribute; modified the function to comply + with the Spec: DIMENSION_LIST attribute is deleted now when no + dimension scales left attached. + (EIP - 2010/05/14 -1822) + - Fixed a bug where the H5TB API would forget the order of fields when + added out of offset order. (NAF - 2009/10/27 - 1582) + - H5DSis_attached failed to account for different platform types. Added a + get native type call. (ADB - 2009/9/29 - 1562) + - Dimension scales: The scale index return value in H5DSiterate_scales was not always + incremented. (PVN - 2009/4/8 - 1538) - In the Packet Table C API, there are changes with the following functions, - which had been ifdef'ed out with VLPT_REMOVED since 2006 - * H5PTcreate_vl, is removed from this release - * H5PTfree_vlen_readbuff, is renamed to H5PTfree_vlen_buff - * H5PTis_varlen, is made available again + Fortran High-Level APIs: + ------ - Various cleanup: replacing 0/-1 with SUCCEED/FAIL and H5I_BADID with - H5I_INVALID_HID. + - Lite: The h5ltget_attribute_string_f used to return the C NULL character in the + returned character buffer. The returned Fortran charactor buffer now does + not return the C NULL character. (MSB - 2012/3/23) + - Lite: The h5ltget_dataset_info_f function (gets information about a dataset) + was not correctly returning the dimension array. (PVN - 2009/3/23) + - Lite: the h5ltread_dataset_string_f and h5ltget_attribute_string_f functions + had memory problems with the g95 fortran compiler. (PVN � 5/13/2009) 1522 - (BMR, 2016/03/04, HDFFV-442) - Fortran High-Level APIs: - ------ - Documentation - ------------- + + Documentation + ------------- + F90 APIs -------- + - Modified the h5open_f and h5close_f subroutines to not to call H5open + and H5close correspodningly. While the H5open call just adds overhead, + the H5close call called by an Fortran application shuts down the HDF5 + library making it unaccessible to the application. + HDFFV-915 (EIP & SB - 2011/10/13) + C++ APIs -------- + - The constructor PropList::PropList(id) was fixed to act properly + according to the nature of 'id'. When 'id' is a property class id, + a new property list will be created. When 'id' id a property list id, + a copy of the property list will be made. (BMR - 2010/5/9) + - The parameters 'size' and 'bufsize' in CommonFG::getLinkval and + CommonFG::getComment, respectively, now have default values for + user's convenience. (BMR - 2009/10/23) + - NULL pointer accessing was fixed, bugzilla 1061. (BMR - 2009/10/05) + - read/write methods of DataSet and Attribute classes were fixed + to handle string correctly. (BMR - 2009/07/26) + - Fixed bug that caused segfaults in Attribute::read. (BMR - 2008/04/20) + - Fixed bug in PropList::getClassName to use portable HDfree instead + of free. (BMR - 2008/04/20) + - Fixed a design bug which allowed an Attribute object to create/modify + attributes (bugzilla #1068). The API class hierarchy was revised + to address the problem. Classes AbstractDS and Attribute are moved + out of H5Object. Class Attribute now multiply inherits from + IdComponent and AbstractDs and class DataSet from H5Object and + AbstractDs. In addition, the data member IdComponent::id was + moved into subclasses: Attribute, DataSet, DataSpace, DataType, + H5File, Group, and PropList. (BMR - 2008/08/10) + - IdComponent::dereference was incorrect and replaced as described + in "New Features" section. + (BMR - 2008/08/10) Testing ------- + - tools/h5diff/testh5diff.sh is run in every "make check", even after it + has passed in the previous run. It should not run again if there is no + code changes. Fixed. (AKC - 2013/07/19 HDFFV-8392) + - In some Mac system, testlibinfo.sh failed with this error: + Check file ../src/.libs/libhdf5.7.dylib + strings: object: ../src/.libs/libhdf5.7.dylib malformed object \ + (unknown load command 15) + The strings command of Mac inspects library files and older + versions of strings may not know newer library format, resulting + in errors. Fixed by sending the library file as stdin to the strings + coommand to avoid this problem. (AKC - 2013/03/08 HDFFV-8305) + + - Fixed a typo in the ERROR macro in test/testhdf5.h. It segmentation + faulted when used before. (AKC - 2013/02/12 HDFFV-8267) Supported Platforms @@ -159,17 +1222,17 @@ Supported Platforms #1 SMP x86_64 GNU/Linux compilers for 64-bit applications; (koala) Version 4.1.2 20080704 (Red Hat 4.1.2-54) Version 4.8.2 - Intel(R) C, C++, Fortran Compilers for - applications running on Intel(R) 64; + Intel(R) C, C++, Fortran Compilers for + applications running on Intel(R) 64; Version 14.0.2 (Build 20140120) Linux 2.6.32-431.11.2.el6 GNU C (gcc), Fortran (gfortran), C++ (g++) #1 SMP x86_64 GNU/Linux compilers: (platypus) Version 4.4.7 20120313 Version 4.8.2 - PGI C, Fortran, C++ for 64-bit target on + PGI C, Fortran, C++ for 64-bit target on x86-64; - Version 13.7-0 + Version 13.7-0 Intel(R) C (icc), C++ (icpc), Fortran (icc) compilers: Version 14.0.2 (Build 20140120) @@ -179,7 +1242,7 @@ Supported Platforms (ostrich) GNU Fortran (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4) IBM XL C/C++ V13.1 IBM XL Fortran V15.1 - + Linux 2.6.32-220.23.1.1chaos Intel C, C++, Fortran Compilers ch5.x86_64 GNU/Linux Version 12.1.5.339 (LLNL Aztec) @@ -196,14 +1259,14 @@ Supported Platforms Visual Studio 2010 w/ Intel Fortran 14 (cmake) Visual Studio 2012 w/ Intel Fortran 15 (cmake) Visual Studio 2013 w/ Intel Fortran 15 (cmake) - Cygwin(CYGWIN_NT-6.1 2.2.0(0.289/5/3) gcc(4.9.3) compiler and gfortran) + Cygwin(CYGWIN_NT-6.1 1.7.34(0.285/5/3) gcc(4.9.2) compiler and gfortran) (cmake and autotools) Windows 7 x64 Visual Studio 2008 (cmake) Visual Studio 2010 w/ Intel Fortran 14 (cmake) Visual Studio 2012 w/ Intel Fortran 15 (cmake) Visual Studio 2013 w/ Intel Fortran 15 (cmake) - + Windows 8.1 Visual Studio 2012 w/ Intel Fortran 15 (cmake) Visual Studio 2013 w/ Intel Fortran 15 (cmake) @@ -216,23 +1279,23 @@ Supported Platforms Mac OS X Mountain Lion 10.8.1 cc Apple clang version 4.0 from Xcode 4.5.1 (owl) c++ Apple clang version 4.0 from Xcode 4.5.1 - gcc i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 from Xcode 4.5.1 - g++ i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 from Xcode 4.5.1 - gfortran GNU Fortran (GCC) 4.6.2 + gcc i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 from Xcode 4.5.1 + g++ i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 from Xcode 4.5.1 + gfortran GNU Fortran (GCC) 4.6.2 Tested Configuration Features Summary ===================================== In the tables below - y = tested + y = tested n = not tested in this release C = Cluster W = Workstation x = not working in this release dna = does not apply ( ) = footnote appears below second table - = testing incomplete on this feature or platform + = testing incomplete on this feature or platform Platform C F90/ F90 C++ zlib SZIP parallel F2003 parallel @@ -260,30 +1323,30 @@ CentOS 6.4 Linux 2.6.32 x86_64 PGI n y/y n y y y Linux 2.6.32-431.11.2.el6.ppc64 n y/n n y y y -Platform Shared Shared Shared Thread- - C libs F90 libs C++ libs safe -Solaris2.11 32-bit y y y y -Solaris2.11 64-bit y y y y +Platform Shared Shared Shared Thread- + C libs F90 libs C++ libs safe +Solaris2.11 32-bit y y y y +Solaris2.11 64-bit y y y y Windows 7 y y y y Windows 7 x64 y y y y Windows 7 Cygwin n n n y Windows 7 x64 Cygwin n n n y Windows 8 y y y y Windows 8 x64 y y y y -Mac OS X Lion 10.7.3 32-bit y n y y -Mac OS X Lion 10.7.3 64-bit y n y y -Mac OS X Mountain Lion 10.8.1 64-bit y n y y +Mac OS X Lion 10.7.3 32-bit y n y y +Mac OS X Lion 10.7.3 64-bit y n y y +Mac OS X Mountain Lion 10.8.1 64-bit y n y y Mac OS X Mavericks 10.9.1 64-bit y n y y -AIX 6.1 32- and 64-bit y n n y -CentOS 5.9 Linux 2.6.18-308 i686 GNU y y y y -CentOS 5.9 Linux 2.6.18-308 i686 Intel y y y n -CentOS 5.9 Linux 2.6.18-308 i686 PGI y y y n -CentOS 5.9 Linux 2.6.18 x86_64 GNU y y y y -CentOS 5.9 Linux 2.6.18 x86_64 Intel y y y n +AIX 6.1 32- and 64-bit y n n y +CentOS 5.9 Linux 2.6.18-308 i686 GNU y y y y +CentOS 5.9 Linux 2.6.18-308 i686 Intel y y y n +CentOS 5.9 Linux 2.6.18-308 i686 PGI y y y n +CentOS 5.9 Linux 2.6.18 x86_64 GNU y y y y +CentOS 5.9 Linux 2.6.18 x86_64 Intel y y y n CentOS 6.4 Linux 2.6.32 x86_64 GNU y y y n CentOS 6.4 Linux 2.6.32 x86_64 Intel y y y n -CentOS 6.4 Linux 2.6.32 x86_64 PGI y y y n -Linux 2.6.32-431.11.2.el6.ppc64 y y y n +CentOS 6.4 Linux 2.6.32 x86_64 PGI y y y n +Linux 2.6.32-431.11.2.el6.ppc64 y y y n Compiler versions for each platform are listed in the preceding "Supported Platforms" table. @@ -299,7 +1362,7 @@ The following platforms are not supported but have been tested for this release. Linux 2.6.18-431.11.2.el6 MPICH mpich 3.1.2 compiled with #1 SMP x86_64 GNU/Linux gcc 4.9.1 and gfortran 4.9.1 - (platypus) g95 (GCC 4.0.3 (g95 0.94!) + (platypus) g95 (GCC 4.0.3 (g95 0.94!) FreeBSD 8.2-STABLE i386 gcc 4.2.1 [FreeBSD] 20070719 (loyalty) gcc 4.6.1 20110422 @@ -311,10 +1374,6 @@ The following platforms are not supported but have been tested for this release. g++ 4.6.1 20110422 gfortran 4.6.1 20110422 - Mac OS X El Capitan 10.11 Apple clang/clang++ version 7.0.0 from Xcode 7.0.1 - 64-bit gfortran GNU Fortran (GCC) 5.2.0 - (VM) - Debian7.5.0 3.2.0-4-686 #1 SMP Debian 3.2.51-1 i686 GNU/Linux gcc (Debian 4.7.2-5) 4.7.2 GNU Fortran (Debian 4.7.2-5) 4.7.2 @@ -354,7 +1413,7 @@ The following platforms are not supported but have been tested for this release. gcc (Ubuntu/Linaro 4.9.1-0ubuntu1) 4.9.1 GNU Fortran (Ubuntu/Linaro 4.9.1-0ubuntu1) 4.9.1 (cmake and autotools) - + Cray Linux Environment (CLE) PrgEnv-pgi/4.0.46 hopper.nersc.gov pgcc 12.5-0 64-bit target on x86-64 Linux -tp shanghai pgf90 12.5-0 64-bit target on x86-64 Linux -tp shanghai @@ -370,20 +1429,20 @@ Known Problems * CLANG compiler with the options -fcatch-undefined-behavior and -ftrapv catches some undefined behavior in the alignment algorithm of the macro DETECT_I - in H5detect.c (Issue 8147). Since the algorithm is trying to detect the alignment - of integers, ideally the flag -fcatch-undefined-behavior shouldn't to be used for - H5detect.c. In the future, we can separate flags for H5detect.c from the rest of + in H5detect.c (Issue 8147). Since the algorithm is trying to detect the alignment + of integers, ideally the flag -fcatch-undefined-behavior shouldn't to be used for + H5detect.c. In the future, we can separate flags for H5detect.c from the rest of the library. (SLU - 2013/10/16) * The 5.9 C++ compiler on Sun failed to compile a C++ test ttypes.cpp. It complains with this message: "/home/hdf5/src/H5Vprivate.h", line 130: Error: __func__ is not defined. - + The reason is that __func__ is a predefined identifier in C99 standard. The HDF5 C library uses it in H5private.h. The test ttypes.cpp includes - H5private.h (H5Tpkg.h<-H5Fprivate.h<-H5Vprivate.h<-H5private.h). Sun's 5.9 + H5private.h (H5Tpkg.h<-H5Fprivate.h<-H5Vprivate.h<-H5private.h). Sun's 5.9 C++ compiler doesn't support __func__, thus fails to compile the C++ test. - But 5.11 C++ compiler does. To check whether your Sun C++ compiler knows this + But 5.11 C++ compiler does. To check whether your Sun C++ compiler knows this identifier, try to compile the following simple C++ program: #include @@ -401,23 +1460,23 @@ Known Problems * The data conversion test dt_arith.c has failures (segmentation fault) from "long double" to other datatypes during hard conversion when the library - is built with the default GCC 4.2.1 on Mac Lion system. It only happens - with optimization (-O3, -O2, and -O1). Some newer versions of GCC do not + is built with the default GCC 4.2.1 on Mac Lion system. It only happens + with optimization (-O3, -O2, and -O1). Some newer versions of GCC do not have this problem. Users should disable optimization or try newer version of GCC. (Issue 8017. SLU - 2012/6/12) * The data conversion test dt_arith.c fails in "long double" to integer conversion on Ubuntu 11.10 (3.0.0.13 kernal) with GCC 4.6.1 if the library is built with optimization -O3 or -O2. The older GCC (4.5) or newer kernal - (3.2.2 on Fedora) doesn't have the problem. Users should lower down the - optimization level (-O1 or -O0) by defining CFLAGS in the command line of + (3.2.2 on Fedora) doesn't have the problem. Users should lower down the + optimization level (-O1 or -O0) by defining CFLAGS in the command line of "configure" like: CFLAGS=-O1 ./configure - It will overwrite the library's default optimization level. (Issue 7829. + It will overwrite the library's default optimization level. (Issue 7829. SLU - 2012/2/7) - + * --with-mpe configure option does not work with Mpich2. AKC - 2011/03/10) * While working on the 1.8.6 release of HDF5, a bug was discovered that can @@ -440,7 +1499,7 @@ Known Problems cause H5Fcreate() with H5F_ACC_EXCL to fail even when the file is not existing. This is due to the MPI_File_open() call failing if the amode has the MPI_MODE_EXCL bit set. (See bug 1468 for details.) AKC - 2009/8/11 - + * Parallel tests failed with 16 processes with data inconsistency at testphdf5 / dataset_readAll. Parallel tests also failed with 32 and 64 processes with collective abort of all ranks at t_posix_compliant / allwrite_allread_blocks @@ -449,19 +1508,19 @@ Known Problems * For SNL, spirit/liberty/thunderbird: The serial tests pass but parallel tests failed with MPI-IO file locking message. AKC - 2007/6/25. * On Intel 64 Linux cluster (RH 4, Linux 2.6.9) with Intel 10.0 compilers use - -mp -O1 compilation flags to build the libraries. Higher level of optimization - causes failures in several HDF5 library tests. + -mp -O1 compilation flags to build the libraries. Higher level of optimization + causes failures in several HDF5 library tests. * For HPUX 11.23 many tools tests failed for 64-bit version when linked to the shared libraries (tested for 1.8.0-beta2) * For SNL, Red Storm: only paralle HDF5 is supported. The serial tests pass and the parallel tests also pass with lots of non-fatal error messages. -* on SUN 5.10 C++ test fails in the "Testing Shared Datatypes with Attributes" test +* on SUN 5.10 C++ test fails in the "Testing Shared Datatypes with Attributes" test * configuring with --enable-debug=all produces compiler errors on most platforms. Users who want to run HDF5 in debug mode should use --enable-debug rather than --enable-debug=all to enable debugging information on most modules. * On Mac OS 10.4, test/dt_arith.c has some errors in conversion from long - double to (unsigned) long long and from (unsigned)long long to long double. + double to (unsigned) long long and from (unsigned)long long to long double. * On Altix SGI with Intel 9.0 testmeta.c would not compile with -O3 optimization flag. * On VAX, Scaleoffset filter isn't supported. The filter cannot be applied to @@ -474,19 +1533,19 @@ Known Problems contribute no IO and the application asks to do IO with collective, we found that when using 4 processors, a simple collective write will be hung sometimes. This can be verified with t_mpi test under testpar. -* The dataset created or rewritten with the v1.6.3 library or after can't - be read with the v1.6.2 library or before when Fletcher32 EDC(filter) is - enabled. There was a bug in the calculating code of the Fletcher32 - checksum in the library before v1.6.3. The checksum value wasn't consistent - between big-endian and little-endian systems. This bug was fixed in - Release 1.6.3. However, after fixing the bug, the checksum value is no - longer the same as before on little-endian system. The library release +* The dataset created or rewritten with the v1.6.3 library or after can't + be read with the v1.6.2 library or before when Fletcher32 EDC(filter) is + enabled. There was a bug in the calculating code of the Fletcher32 + checksum in the library before v1.6.3. The checksum value wasn't consistent + between big-endian and little-endian systems. This bug was fixed in + Release 1.6.3. However, after fixing the bug, the checksum value is no + longer the same as before on little-endian system. The library release after 1.6.4 can still read the dataset created or rewritten with the library of v1.6.2 or before. SLU - 2005/6/30 * For the version 6(6.02 and 6.04) of Portland Group compiler on AMD Opteron processor, there's a bug in the compiler for optimization(-O2). The library - failed in several tests but all related to multi driver. The problem has - been reported to the vendor. + failed in several tests but all related to multi driver. The problem has + been reported to the vendor. * On IBM AIX systems, parallel HDF5 mode will fail some tests with error messages like "INFO: 0031-XXX ...". This is from the command poe. Set the environment variable MP_INFOLEVEL to 0 to minimize the messages @@ -500,7 +1559,7 @@ Known Problems to provide a mean to run poe without the debug socket. * The C++ library's tests fails when compiling with PGI C++ compiler. The - workaround until the problem is correctly handled is to use the + workaround until the problem is correctly handled is to use the flag "--instantiate=local" prior to the configure and build steps, as: setenv CXX "pgCC --instantiate=local" for pgCC 5.02 and higher @@ -514,9 +1573,9 @@ Known Problems * The --enable-static-exec configure flag will only statically link libraries if the static version of that library is present. If only the shared version of a library exists (i.e., most system libraries on Solaris, AIX, and Mac, - for example, only have shared versions), the flag should still result in a - successful compilation, but note that the installed executables will not be - fully static. Thus, the only guarantee on these systems is that the + for example, only have shared versions), the flag should still result in a + successful compilation, but note that the installed executables will not be + fully static. Thus, the only guarantee on these systems is that the executable is statically linked with just the HDF5 library. * With the gcc 2.95.2 compiler, HDF 5 uses the `-ansi' flag during @@ -524,7 +1583,7 @@ Known Problems able to handle the `long long' datatype with the warning: warning: ANSI C does not support `long long' - + This warning is innocuous and can be safely ignored. * Certain platforms give false negatives when testing h5ls: @@ -542,35 +1601,35 @@ Known Problems * On some platforms that use Intel and Absoft compilers to build HDF5 fortran library, compilation may fail for fortranlib_test.f90, fflush1.f90 and fflush2.f90 - complaining about exit subroutine. Comment out the line + complaining about exit subroutine. Comment out the line IF (total_error .ne. 0) CALL exit (total_error) * Information about building with PGI and Intel compilers is available in INSTALL file sections 5.7 and 5.8 * On at least one system, (SDSC DataStar), the scheduler (in this case - LoadLeveler) sends job status updates to standard error when you run + LoadLeveler) sends job status updates to standard error when you run any executable that was compiled with the parallel compilers. - This causes problems when running "make check" on parallel builds, as + This causes problems when running "make check" on parallel builds, as many of the tool tests function by saving the output from test runs, - and comparing it to an exemplar. + and comparing it to an exemplar. The best solution is to reconfigure the target system so it no longer inserts the extra text. However, this may not be practical. - In such cases, one solution is to "setenv HDF5_Make_Ignore yes" prior to - the configure and build. This will cause "make check" to continue after + In such cases, one solution is to "setenv HDF5_Make_Ignore yes" prior to + the configure and build. This will cause "make check" to continue after detecting errors in the tool tests. However, in the case of SDSC DataStar, it also leaves you with some 150 "failed" tests to examine by hand. A second solution is to write a script to run serial tests and filter out the text added by the scheduler. A sample script used on SDSC - DataStar is given below, but you will probably have to customize it - for your installation. + DataStar is given below, but you will probably have to customize it + for your installation. - Observe that the basic idea is to insert the script as the first item - on the command line which executes the the test. The script then + Observe that the basic idea is to insert the script as the first item + on the command line which executes the the test. The script then executes the test and filters out the offending text before passing it on. @@ -592,11 +1651,11 @@ Known Problems exit $RETURN_VALUE You get the HDF make files and test scipts to execute your filter script - by setting the environment variable "RUNSERIAL" to the full path of the - script prior to running configure for parallel builds. Remember to + by setting the environment variable "RUNSERIAL" to the full path of the + script prior to running configure for parallel builds. Remember to "unsetenv RUNSERIAL" before running configure for a serial build. - Note that the RUNSERIAL environment variable exists so that we can + Note that the RUNSERIAL environment variable exists so that we can can prefix serial runs as necessary on the target system. On DataStar, no prefix is necessary. However on an MPICH system, the prefix might have to be set to something like "/usr/local/mpi/bin/mpirun -np 1" to -- cgit v0.12 From f83c88d9ae90e41cc5a3f402dedf7cf1fccd02f4 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Sun, 6 Mar 2016 17:01:59 -0500 Subject: [svn-r29295] Replaced H5Acreate with H5Acreate2 in hl/test/test_packet_vlen.c line 758 to eliminate error with configure option --wit-default-api-version=v16. Tested with option and h5committest.new. --- hl/test/test_packet_vlen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hl/test/test_packet_vlen.c b/hl/test/test_packet_vlen.c index 4d55226..10051fa 100644 --- a/hl/test/test_packet_vlen.c +++ b/hl/test/test_packet_vlen.c @@ -758,7 +758,7 @@ static int adding_attribute(hid_t fid, const char *table_name, const char *attr_ goto error; /* Add the specified attribute to it */ - attr_id = H5Acreate(dset_id, attr_name, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT); + attr_id = H5Acreate2(dset_id, attr_name, H5T_NATIVE_INT, space_id, H5P_DEFAULT, H5P_DEFAULT); if (attr_id < 0) goto error; -- cgit v0.12 From 3247df1224d2f226a03144fb556b2a3435794871 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 7 Mar 2016 08:29:12 -0500 Subject: [svn-r29301] Update valgrind cacheinit file to match regular. --- config/cmake/mccacheinit.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/cmake/mccacheinit.cmake b/config/cmake/mccacheinit.cmake index e54db1f..2bebcf2 100644 --- a/config/cmake/mccacheinit.cmake +++ b/config/cmake/mccacheinit.cmake @@ -6,6 +6,8 @@ set (CMAKE_INSTALL_FRAMEWORK_PREFIX "Library/Frameworks" CACHE STRING "Frameworks installation directory" FORCE) +set (HDF5_GENERATE_HEADERS ON CACHE BOOL "Rebuild Generated Files" FORCE) + set (BUILD_SHARED_LIBS OFF CACHE BOOL "Build Shared Libraries" FORCE) set (BUILD_TESTING ON CACHE BOOL "Build HDF5 Unit Testing" FORCE) -- cgit v0.12 From b346cb0599da3b46f892365ad2ebd1e55ea173f3 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Mon, 7 Mar 2016 10:42:30 -0500 Subject: [svn-r29306] Purpose: Add function Description: Added member function ArrayType::operator= because ArrayType has pointer data members. Platforms tested: Linux/32 2.6 (jam) Linux/64 (platypus) Darwin (osx1010test) --- c++/src/H5AbstractDs.cpp | 2 +- c++/src/H5AbstractDs.h | 2 +- c++/src/H5ArrayType.cpp | 38 +++++++++++++++ c++/src/H5ArrayType.h | 3 ++ c++/src/H5Attribute.cpp | 6 +-- c++/src/H5CommonFG.cpp | 2 +- c++/src/H5DataSet.cpp | 6 +-- c++/src/H5DataSpace.cpp | 6 +-- c++/src/H5DataType.cpp | 6 +-- c++/src/H5Exception.cpp | 6 +-- c++/src/H5Group.cpp | 6 +-- c++/src/H5PropList.cpp | 3 +- c++/test/tarray.cpp | 120 ++++++++++++++++++++++++++++++++++++++++------- release_docs/RELEASE.txt | 7 +++ 14 files changed, 165 insertions(+), 48 deletions(-) diff --git a/c++/src/H5AbstractDs.cpp b/c++/src/H5AbstractDs.cpp index 4e9a4d5..8d88c53 100644 --- a/c++/src/H5AbstractDs.cpp +++ b/c++/src/H5AbstractDs.cpp @@ -49,7 +49,7 @@ AbstractDs::AbstractDs(){} // removal does not raise any problems in 1.10, it will be removed from 1.8 in // subsequent releases. //-------------------------------------------------------------------------- -AbstractDs::AbstractDs(const hid_t ds_id){} +// Mar 2016 -BMR, AbstractDs::AbstractDs(const hid_t ds_id){} //-------------------------------------------------------------------------- // Function: AbstractDs::getTypeClass diff --git a/c++/src/H5AbstractDs.h b/c++/src/H5AbstractDs.h index ee2e45e..6975d6f 100644 --- a/c++/src/H5AbstractDs.h +++ b/c++/src/H5AbstractDs.h @@ -85,7 +85,7 @@ class H5_DLLCPP AbstractDs { // other will be removed from 1.10 release, and then from 1.8 if its // removal does not raise any problems in two 1.10 releases. - AbstractDs(const hid_t h5_id); + // Mar 2016 -BMR, AbstractDs(const hid_t h5_id); // Copy constructor // AbstractDs( const AbstractDs& original ); diff --git a/c++/src/H5ArrayType.cpp b/c++/src/H5ArrayType.cpp index 0f09631..5792467 100644 --- a/c++/src/H5ArrayType.cpp +++ b/c++/src/H5ArrayType.cpp @@ -93,6 +93,44 @@ ArrayType::ArrayType(const DataType& base_type, int ndims, const hsize_t* dims) } //-------------------------------------------------------------------------- +// Function: ArrayType::operator= +///\brief Assignment operator +///\param rhs - IN: Reference to the existing array datatype +///\return Reference to ArrayType instance +///\exception H5::DataTypeIException +/// std::bad_alloc +// Description +// Closes the id on the lhs object first with setId, then copies +// each data member from the rhs object. +// Programmer Binh-Minh Ribler - Mar 2016 +// Modification +//-------------------------------------------------------------------------- +ArrayType& ArrayType::operator=(const ArrayType& rhs) +{ + if (this != &rhs) + { + // handling references to this id + try { + setId(rhs.id); + // Note: a = b, so there are two objects with the same hdf5 id + // that's why incRefCount is needed, and it is called by setId + } + catch (Exception close_error) { + throw DataTypeIException(inMemFunc("operator="), close_error.getDetailMsg()); + } + + // Copy the rank of the rhs array + rank = rhs.rank; + + // Allocate space then copy the dimensions from the rhs array + dimensions = new hsize_t[rank]; + for (int i = 0; i < rank; i++) + dimensions[i] = rhs.dimensions[i]; + } + return(*this); +} + +//-------------------------------------------------------------------------- // Function: ArrayType::setArrayInfo ///\brief Retrieves the rank and dimensions from the array datatype /// and store the info in this ArrayType object. diff --git a/c++/src/H5ArrayType.h b/c++/src/H5ArrayType.h index c0f4b38..ddbb5e2 100644 --- a/c++/src/H5ArrayType.h +++ b/c++/src/H5ArrayType.h @@ -31,6 +31,9 @@ class H5_DLLCPP ArrayType : public DataType { // specified base type. ArrayType(const DataType& base_type, int ndims, const hsize_t* dims); + // Assignment operator + ArrayType& operator=(const ArrayType& rhs); + // Stores the rank and dimensions in memory. void setArrayInfo(); diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index ea8c5bb..a6a8fee 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -60,9 +60,8 @@ Attribute::Attribute() : AbstractDs(), IdComponent(), id(H5I_INVALID_HID) {} ///\param original - IN: Original Attribute object to copy // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Attribute::Attribute(const Attribute& original) : AbstractDs(), IdComponent() +Attribute::Attribute(const Attribute& original) : AbstractDs(), IdComponent(), id(original.id) { - id = original.getId(); incRefCount(); // increment number of references to this id } @@ -74,9 +73,8 @@ Attribute::Attribute(const Attribute& original) : AbstractDs(), IdComponent() ///\exception H5::AttributeIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Attribute::Attribute(const hid_t existing_id) : AbstractDs(), IdComponent() +Attribute::Attribute(const hid_t existing_id) : AbstractDs(), IdComponent(), id(existing_id) { - id = existing_id; incRefCount(); // increment number of references to this id } diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index c88f6c1..8bb31c4 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -328,7 +328,7 @@ void CommonFG::unlink( const H5std_string& name ) const /// Exercise care in moving groups as it is possible to render /// data in a file inaccessible with Group::move. Please refer /// to the Group Interface in the HDF5 User's Guide for details at: -/// http://www.hdfgroup.org/HDF5/doc/UG/UG_frame09Groups.html +/// https://www.hdfgroup.org/HDF5/doc/UG/HDF5_Users_Guide-Responsive%20HTML5/index.html#t=HDF5_Users_Guide%2FGroups%2FHDF5_Groups.htm // Programmer Binh-Minh Ribler - 2000 // Modification // 2007: QAK modified to use H5L APIs - BMR diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 059da85..3747967 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -67,9 +67,8 @@ DataSet::DataSet() : H5Object(), AbstractDs(), id(H5I_INVALID_HID) {} // when one of those objects is deleted, the id will be closed if // the reference counter is only 1. //-------------------------------------------------------------------------- -DataSet::DataSet(const hid_t existing_id) : H5Object(), AbstractDs() +DataSet::DataSet(const hid_t existing_id) : H5Object(), AbstractDs(), id(existing_id) { - id = existing_id; incRefCount(); // increment number of references to this id } @@ -79,9 +78,8 @@ DataSet::DataSet(const hid_t existing_id) : H5Object(), AbstractDs() ///\param original - IN: DataSet instance to copy // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DataSet::DataSet(const DataSet& original) : H5Object(), AbstractDs() +DataSet::DataSet(const DataSet& original) : H5Object(), AbstractDs(), id(original.id) { - id = original.getId(); incRefCount(); // increment number of references to this id } diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp index 311180f..42ac4c7 100644 --- a/c++/src/H5DataSpace.cpp +++ b/c++/src/H5DataSpace.cpp @@ -132,9 +132,8 @@ DataSpace::DataSpace( int rank, const hsize_t * dims, const hsize_t * maxdims) : ///\exception H5::DataSpaceIException // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DataSpace::DataSpace(const hid_t existing_id) : IdComponent() +DataSpace::DataSpace(const hid_t existing_id) : IdComponent(), id(existing_id) { - id = existing_id; incRefCount(); // increment number of references to this id } @@ -144,9 +143,8 @@ DataSpace::DataSpace(const hid_t existing_id) : IdComponent() ///\param original - IN: DataSpace object to copy // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DataSpace::DataSpace(const DataSpace& original) : IdComponent() +DataSpace::DataSpace(const DataSpace& original) : IdComponent(), id(original.id) { - id = original.getId(); incRefCount(); // increment number of references to this id } diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index 1bbabe3..54df7e0 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -69,9 +69,8 @@ DataType::DataType() : H5Object(), id(H5I_INVALID_HID) {} // Removed second argument, "predefined", after changing to the // new ref counting mechanism that relies on C's ref counting. //-------------------------------------------------------------------------- -DataType::DataType(const hid_t existing_id) : H5Object() +DataType::DataType(const hid_t existing_id) : H5Object(), id(existing_id) { - id = existing_id; incRefCount(); // increment number of references to this id } @@ -136,9 +135,8 @@ DataType::DataType(const Attribute& attr, const void* ref, H5R_type_t ref_type, ///\brief Copy constructor: makes a copy of the original DataType object. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -DataType::DataType(const DataType& original) : H5Object() +DataType::DataType(const DataType& original) : H5Object(), id(original.id) { - id = original.getId(); incRefCount(); // increment number of references to this id } diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp index 1ca059b..270b232 100644 --- a/c++/src/H5Exception.cpp +++ b/c++/src/H5Exception.cpp @@ -47,11 +47,7 @@ Exception::Exception(const H5std_string& func, const H5std_string& message) : de ///\param orig - IN: Exception instance to copy // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Exception::Exception( const Exception& orig ) -{ - detail_message = orig.detail_message; - func_name = orig.func_name; -} +Exception::Exception( const Exception& orig ) : detail_message(orig.detail_message), func_name(orig.func_name) {} //-------------------------------------------------------------------------- // Function: Exception::getMajorString diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index 0823d0e..f9aabcb 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -60,9 +60,8 @@ Group::Group() : H5Object(), CommonFG(), id(H5I_INVALID_HID) {} ///\param original - IN: Original group to copy // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Group::Group(const Group& original) : H5Object(), CommonFG() +Group::Group(const Group& original) : H5Object(), CommonFG(), id(original.id) { - id = original.getId(); incRefCount(); // increment number of references to this id } @@ -83,9 +82,8 @@ hid_t Group::getLocId() const ///\param existing_id - IN: Id of an existing group // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Group::Group(const hid_t existing_id) : H5Object(), CommonFG() +Group::Group(const hid_t existing_id) : H5Object(), CommonFG(), id(existing_id) { - id = existing_id; incRefCount(); // increment number of references to this id } diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index 807aa0a..81bb023 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -104,9 +104,8 @@ PropList::PropList() : IdComponent(), id(H5P_DEFAULT) {} ///\param original - IN: The original property list to copy // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -PropList::PropList(const PropList& original) : IdComponent() +PropList::PropList(const PropList& original) : IdComponent(), id(original.id) { - id = original.getId(); incRefCount(); // increment number of references to this id } diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp index 69b4438..e73cfd0 100644 --- a/c++/test/tarray.cpp +++ b/c++/test/tarray.cpp @@ -42,9 +42,9 @@ #include "h5cpputil.h" // C++ utilility header file const H5std_string FILENAME("tarray.h5"); -const hsize_t SPACE1_RANK = 1; +const int SPACE1_RANK = 1; const hsize_t SPACE1_DIM1 = 4; -const hsize_t ARRAY1_RANK = 1; +const int ARRAY1_RANK = 1; const hsize_t ARRAY1_DIM1 = 4; typedef enum flt_t { @@ -83,15 +83,21 @@ static void test_array_compound_array() hsize_t sdims1[] = {SPACE1_DIM1}; hsize_t tdims1[] = {ARRAY1_DIM1}; int nmemb; // Number of compound members - int ii, jj, kk; // counting variables + int ii; // counting variables + hsize_t idxi, idxj, idxk; // dimension indicing variables H5T_class_t mclass; // Datatype class for field // Initialize array data to write - for (ii =0; ii < SPACE1_DIM1; ii++) - for (jj = 0; jj < ARRAY1_DIM1; jj++) { - wdata[ii][jj].i = ii * 10 + jj; - for(kk = 0; kk < ARRAY1_DIM1; kk++) - wdata[ii][jj].f[kk]=(float)(ii * 10.0F + jj * 2.5F + kk); + for (idxi =0; idxi < SPACE1_DIM1; idxi++) + for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) { + wdata[idxi][idxj].i = idxi * 10 + idxj; + for(idxk = 0; idxk < ARRAY1_DIM1; idxk++) + { + float temp = idxi * 10.0 + idxj * 2.5 + idxk; + //wdata[idxi][idxj].f[idxk]=(float)(idxi * 10.0F + idxj * 2.5F + idxk); + wdata[idxi][idxj].f[idxk] = temp; + //wdata[idxi][idxj].f[idxk] = static_cast(temp); + } } // end for try { @@ -130,6 +136,7 @@ static void test_array_compound_array() // Create a dataset DataSet dataset = file1.createDataSet("Dataset1", arrtype, space); + dataset = file1.openDataSet("Dataset1"); // Write dataset to disk dataset.write(wdata, arrtype); @@ -153,7 +160,8 @@ static void test_array_compound_array() // Verify that it is an array of compounds DataType dstype = dataset.getDataType(); mclass = dstype.getClass(); - verify_val(mclass, H5T_ARRAY, "f2_type.getClass", __LINE__, __FILE__); + verify_val(mclass==H5T_ARRAY, true, "f2_type.getClass", __LINE__, __FILE__); + dstype.close(); // Get the array datatype to check @@ -170,7 +178,7 @@ static void test_array_compound_array() // Check the array dimensions for (ii =0; ii Date: Mon, 7 Mar 2016 11:01:53 -0500 Subject: [svn-r29307] Add Java to new configuration --- release_docs/RELEASE.txt | 568 ++++++++++++++++++++++++----------------------- 1 file changed, 287 insertions(+), 281 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index b1088e9..23fc6c9 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -5,19 +5,19 @@ HDF5 version 1.9.234 currently under development INTRODUCTION This document describes the differences between HDF5-1.9.0 and -HDF5 1.9.x snapshot, and contains information on the platforms -tested and known problems in HDF5-1.9.x. +HDF5 1.9.x snapshot, and contains information on the platforms +tested and known problems in HDF5-1.9.x. For more details check the HISTORY*.txt files in the HDF5 source. -Links to HDF5 1.9.x source code can be found on The HDF Group's +Links to HDF5 1.9.x source code can be found on The HDF Group's development FTP server at the following location: ftp://ftp.hdfgroup.uiuc.edu/pub/outgoing/hdf5/snapshots -User documentation for the snapshot can be accessed directly at this location: +User documentation for the snapshot can be accessed directly at this location: http://www.hdfgroup.uiuc.edu/HDF5/doc_dev_snapshot/H5_dev/ For more information, see the HDF5 home page: - + http://www.hdfgroup.org/HDF5/ If you have any questions or comments, please send them to the HDF Help Desk: @@ -41,6 +41,10 @@ New Features Configuration: ------------- + - Java JNI library API wrappers and supporting files added as HDF_JAVA language + option. Both configure and CMake disable this option by default. + HDFFV-9552 (ADB 2016/02.28) + - CMake minimum is now 3.1.0. (ADB 2015/11/14) - cmakehdf5: configure options added to enable or disable the building of different API's and testings. See "cmakehdf5 --help" for details. (AKC - 2014/12/09 HDFFV-8932) @@ -77,20 +81,20 @@ New Features - Added a new configure option, "--enable-unsupported", which can be used to stop configure from preventing the use of unsupported configure option combinations, such as c++ in parallel or parallel - HDF5 with threadsafe. Use at your own risk, as it may result in a - library that won't compile or run as expected! + HDF5 with threadsafe. Use at your own risk, as it may result in a + library that won't compile or run as expected! (MAM - 2010/11/17 - Bug 2061) - PHDF5 changed to use "mpiexec", instead of mpirun, as the default MPI applications startup command as defined in the MPI-2 definition, section 4.1. (AKC - 2010/6/11 - Bug 1921) - Configure now adds appropriate defines for supporting large (64-bit) files on all systems, where supported, by default, instead of only linux. - This largefile support is controllable with the --enable-largefile + This largefile support is controllable with the --enable-largefile configure option. This is replacing the linux-specific --enable-linux-lfs - option, which has been removed from configure. + option, which has been removed from configure. (MAM - 2010/05/05 - 1772/1434) - Upgraded versions of autotools used to generate configuration suite. - We now use Automake 1.11.1, Autoconf 2.65, and Libtool 2.2.6b. + We now use Automake 1.11.1, Autoconf 2.65, and Libtool 2.2.6b. MAM 2010/04/15. - Added the xlc-* and mpcc_r-* BASENAME patterns to be recognized as IBM compilers so that the ibm compiler options can be added properly. This @@ -99,16 +103,16 @@ New Features - Configuration suite now uses Automake 1.11 and Autoconf 2.64. MAM 2009/08/11. - Changed default Gnu fortran compiler from g95 to gfortran since - gfortran is more likely installed with gcc now. -AKC 2009/07/19- - - Added libtool version numbers to generated c++, fortran, and + gfortran is more likely installed with gcc now. -AKC 2009/07/19- + - Added libtool version numbers to generated c++, fortran, and hl libraries. MAM 2009/04/19. - Regenerated Makefile.ins using Automake 1.10.2. MAM 2009/04/19. - Added a Make target of check-all-install to test the correctness of installing via the prefix= or $DESTDIR options. AKC - 2009/04/14 - Configuration suite now uses Libtool 2.2.6a. MAM 2008/10/24 - - Configuration suite now uses Autoconf 2.61, Automake 1.10.1. - MAM 2008/05/05. + - Configuration suite now uses Autoconf 2.61, Automake 1.10.1. + MAM 2008/05/05. - The new configure option "--disable-sharedlib-rpath" disables embedding the '-Wl,-rpath' information into executables when @@ -128,7 +132,7 @@ New Features not be defined when H5_NO_DEPRECATED_SYMBOLS is defined. (DER - 2015-04-30, HDFFV-1074) - + - The library can load filter libraries dynamically during runtime. Users can set the search path through environment variable HDF5_PLUGIN_PATH and call H5Pset_filter to enable a dynamic filter. (SLU - 2013/04/08) @@ -137,13 +141,13 @@ New Features (NAF - 2013/02/05) - The library now supports the data conversion from enumeration to numeric (integer and floating-point number) datatypes. See Issue 8221. - (SLU - 2012/10/23) + (SLU - 2012/10/23) - The data sieve buffer size was for all the datasets in the file. It could waste memory if any dataset size is smaller than the sieve buffer size. Now the library picks the smaller one between the dataset size and the sieve buffer size from the file access property. See Issue 7934. (SLU - 2012/4/2) - - I added a new parameter of object access property list to the function + - I added a new parameter of object access property list to the function H5Rdereference (Issue 2763). It's called H5Rdereference2 now. The former H5Rdereference function has been deprecated to H5Rdereference1. (SLU - 2011/7/18) @@ -154,10 +158,10 @@ New Features H5Pget_elink_file_cache_size(), and H5Fclear_elink_file_cache(). (NAF - 2011/02/17) - Removed all old code for Metraowerks compilers, bracketed by - __MWERKS__). Metraowerks compiler is long gone. (AKC - 2010/11/17) + __MWERKS__). Metraowerks compiler is long gone. (AKC - 2010/11/17) - Added support for threadsafety on windows using the windows threads - library. Use the HDF5_ENABLE_THREADSAFE option in CMake while on a - windows platform to enable this functionality. This is supported on + library. Use the HDF5_ENABLE_THREADSAFE option in CMake while on a + windows platform to enable this functionality. This is supported on Windows Vista and newer Windows operating systems. (MAM - 2010/09/10) - When a mandatory filter failed to write data chunks, the dataset couldn't close (bug 1260). The fix releases all resources and closes @@ -166,7 +170,7 @@ New Features order H5T_ORDER_MIXED has been added specifically for compound datatype and its derived type. Please see bug #1934. (SLU - 2010/8/23) - Improved performance of the chunk cache by avoiding unnecessary b-tree - lookups of chunks already in cache. (NAF - 2010/06/15) + lookups of chunks already in cache. (NAF - 2010/06/15) - Greatly improved performance of extending a dataset with early allocation. (NAF - 2010/03/24 - 1637) - Added support for filtering densely stored groups. Many of the API @@ -209,7 +213,7 @@ New Features Parallel Library: ----------------- - Add H5Pget_mpio_no_collective_cause() function that retrive reasons - why the collective I/O was broken during read/write IO access. + why the collective I/O was broken during read/write IO access. (JKM - 2012/08/30 HDFFV-8143) - Special Collective IO (IO when some processes do not contribute to the IO) and Complex Derived Datatype MPI functionalities are no longer @@ -218,10 +222,10 @@ New Features behaviors. Older MPI implementations that do not allow for these functionalities can no longer by used by HDF5. (MAM - 2011/07/08). - Modified parallel tests to run with arbitrary number of processes. The - modified tests are testphdf5 (parallel dataset access), t_chunk_alloc + modified tests are testphdf5 (parallel dataset access), t_chunk_alloc (chunk allocation), and t_posix_compliant (posix compliance). The rest of the parallel tests already use in the code the number of processes - available in the communicator. (CMC - 2009/04/28) + available in the communicator. (CMC - 2009/04/28) Fortran Library: ---------------- @@ -269,7 +273,7 @@ New Features h5dget_access_plist_f h5iis_valid_f h5pset_chunk_cache_f - h5pget_chunk_cache_f + h5pget_chunk_cache_f (MSB - 2009/04/17) @@ -314,75 +318,75 @@ New Features match the search path. HDFFV-7989 (ADB - 2013/08/12). - h5dump: Added optional arg 0 to -A, which excludes attributes from display. HDFFV-8134 (ADB - 2013/08/01). - - h5dump: Fixed displaying compression ratio for unknown or user-defined + - h5dump: Fixed displaying compression ratio for unknown or user-defined filters. HDFFV-8344 (XCAO 2013/03/19) - h5dump: Changed UNKNOWN_FILTER to USER_DEFINED_FILTER for user defined filter. HDFFV-8346 (XCAO 2013/03/19) - - h5dump: Added capability for "-a" option to show attributes containing "/" - by using an escape character. For example, for a dataset "/dset" - containing attribute "speed(m/h)", use "h5dump -a "/dset/speed(\/h)" + - h5dump: Added capability for "-a" option to show attributes containing "/" + by using an escape character. For example, for a dataset "/dset" + containing attribute "speed(m/h)", use "h5dump -a "/dset/speed(\/h)" to show the content of the attribute. See details at HDFFV-7523 - (PC -- 2012/03/12) + (PC -- 2012/03/12) - h5dump: Added ability to apply command options across multiple files using a wildcard in the filename. Example; "h5dump -H -d Dataset1 tarr*.h5". HDFFV-7876 (ADB - 2012/03/12). - h5repack: Improved performance for big chunked datasets (size > 128MB) - when used with layout (-l) or compression (-f) option. - It would perform much better prior to the improvement, - especially for cases that chunk dimentions looks like + when used with layout (-l) or compression (-f) option. + It would perform much better prior to the improvement, + especially for cases that chunk dimentions looks like "1024x5x1" (compare to "1x5x1024"). When bigger numbers are toward front and smaller number is toward back in chunk dimentions. HDFFV-7862 (JKM - 2012/03/01) - h5dump: Added new option --no-compact-subset. This option will not - interpret the '[' character as starting the compact form of - subsetting. This is useful when the "h5dump error: unable to + interpret the '[' character as starting the compact form of + subsetting. This is useful when the "h5dump error: unable to open dataset "datset_name"" message is output because a dataset name contains a '[' character. HDFFV-7689 (ADB - 2012/01/31) - - h5dump: Corrected schema location: - (ADB - 2011/08/10) - h5diff: Added new level for -v (verbose) option. The new levels are - 1 and 2. So -v1 and -v2 can be specified to view more - information about attributes differences. + 1 and 2. So -v1 and -v2 can be specified to view more + information about attributes differences. Bug#2121 (JKM 2011/3/23) - - h5dump: Added new option --enable-error-stack. This option will display + - h5dump: Added new option --enable-error-stack. This option will display error stack information in the output stream. This is useful when the "h5dump: Unable to print data" message is output. (ADB - 2011/02/24) - h5diff: Add a new flag --exclude-path. Specified path to an object will be excluded from comparing the two files or two groups. If group - is specified all the member objects will be excluded. + is specified all the member objects will be excluded. (JKM - 2010/09/16). - h5ls: Add new flag --no-dangling-links. (refer to --help for details) - (JKM - 2010/06/15) + (JKM - 2010/06/15) - h5ls: Add new flag --follow-symlinks. (refer to --help for details) (JKM - 2010/05/25) - h5diff: Add new flag --no-dangling-links. (refer to --help for details) - (JKM - 2010/02/10) + (JKM - 2010/02/10) - h5diff: Add new flag --follow-symlinks. (refer to --help for details) - (JKM - 2010/01/25) + (JKM - 2010/01/25) - h5diff: fix for displaying garbage value on LE machine for BE data. (JKM - 2009/11/20) - h5dump: subsetting now allows default for count. Also trailing ; in short form - can be omitted after last specified value. + can be omitted after last specified value. (ADB - 2009/09/04) - - h5dump/h5ls: now can display data in region references - using new -R, --region flag. + - h5dump/h5ls: now can display data in region references + using new -R, --region flag. (ADB - 2009/09/04) - h5diff: new flag, -c, --compare, list objects that are not comparable. (PVN - 2009/4/10 - 1368) - h5diff new flag, -N, --nan, avoids NaNs detection. (PVN - 2009/4/10) - h5dump correctly specifies XML dtd / schema urls (ADB - 2009/4/3 - 1519) - h5repack now handles group creation order. (PVN - 2009/4/2 - 1402) - - h5dump: added a printing of the compression ratio of uncompressed and compressed + - h5dump: added a printing of the compression ratio of uncompressed and compressed sizes for cases where compression filters are present. (PVN - 2008/05/01) - - h5dump: added an option to allow a user defined formatting string for printf + - h5dump: added an option to allow a user defined formatting string for printf regarding floating point numbers. (PVN - 2008/05/06) - - h5dump: support for external links, display the object that the external link + - h5dump: support for external links, display the object that the external link points to. (PVN - 2008/05/12) - h5repack: add a userblock to an HDF5 file during the repack. (PVN - 2008/08/26) - h5repack: add 2 options that call H5Pset_alignment in the repacked file. (PVN - 2008/08/29) @@ -394,22 +398,22 @@ New Features - h5diff: added support for long double (PVN - 2008/10/28) - h5dump: binary output defaults to NATIVE with -b optionally accepting the form of binary output (NATIVE, FILE, BE, LE). (PVN - 2008/10/30) - - h5diff: return 1 for file differences when both file graphs differ by any object. + - h5diff: return 1 for file differences when both file graphs differ by any object. Error return code was changed to 2 from -1. (PVN - 2008/10/30) - - h5import: TEXTFPE (scientific format) was deprecated. Use TEXTFP + - h5import: TEXTFPE (scientific format) was deprecated. Use TEXTFP instead (PVN - 2008/10/30) - - h5repack: When user doesn't specify a chunk size, h5repack now defines a default - chunk size as the same size of the size of the hyperslab used to read the chunks. - The size of the hyperslabs are defined as the size of each dimension or a - predefined constant, whatever is smaller. This assures that the chunk + - h5repack: When user doesn't specify a chunk size, h5repack now defines a default + chunk size as the same size of the size of the hyperslab used to read the chunks. + The size of the hyperslabs are defined as the size of each dimension or a + predefined constant, whatever is smaller. This assures that the chunk read fits in the chunk cache. (PVN - 2008/11/21) - - h5diff: h5diff treats two INFINITY values different. Fixed by checking (value==expect) - before call ABS(...) at h5diff_array.c This will make that (INF==INF) is true + - h5diff: h5diff treats two INFINITY values different. Fixed by checking (value==expect) + before call ABS(...) at h5diff_array.c This will make that (INF==INF) is true (INF is treated as an number instead of NaN) (PC -- 2009/07/28) - h5diff: add option "--use-system-epsilon" to print difference if (|a-b| > EPSILON) Change default to use strict equality (PC -- 2009/09/12) - + High-Level APIs: ------ - New public functions in Packet Table API @@ -425,12 +429,12 @@ New Features - A new API function H5DOwrite_chunk. It writes a data chunk directly into a file bypassing hyperslab selection, data conversion, and filter pipeline. The user must be careful with the function and - clearly understand the I/O process of the library. + clearly understand the I/O process of the library. (SLU - 2013/2/11) - New API: h5ltpath_valid (Fortran: h5ltpath_valid_f) which checks if a path is correct and determines if a link resolves to a valid object and checks that the link does not dangle. (MSB- 2012/3/15) - + - Added Fortran wrappers for Dimension Scale APIs. HDFFV-3797 h5dsset_scale_f h5dsattach_scale_f @@ -443,11 +447,11 @@ New Features h5dsget_num_scales_f (EIP for SB - 2011/10/13) - - Table: In version 3.0 of Table, "NROWS" (used to store number of records) was + - Table: In version 3.0 of Table, "NROWS" (used to store number of records) was deprecated (PVN - 2008/11/24) - Documentation - ------------- + Documentation + ------------- Support for new platforms, languages and compilers. ======================================= @@ -463,17 +467,17 @@ Bug Fixes since HDF5-1.8.0 release Library ------- - Incorrect usage of list in CMake COMPILE_DEFINITIONS set_property - + The CMake command, set_property with COMPILE_DEFINITIONS property needs a quoted semi-colon separated list of values. CMake will transform the list to a series of -D{value} for the compile. - + (ADB - 2014/12/09, HDFV-9041) - + - H5Z.c: H5Zfilter_avail(H5Z_filter_t id) Added else block if the call to the internal H5Z_filter_avail(id) does not fail and returns FALSE. This block calls the H5PL_load(H5PL_TYPE_FILTER, (int)id) - function to attempt to dynamically load the filter plugin. + function to attempt to dynamically load the filter plugin. (ADB - 2014/03/03 HDFFV-8629) - Added const qualifier to source buffer parameters in H5Dgather and H5D_scatter_func_t (H5Dscatter callback). (NAF - 2013/7/02) @@ -489,21 +493,21 @@ Bug Fixes since HDF5-1.8.0 release - Fixed an error that would occur when copying an object with attribute creation order tracked and indexed. (NAF - 2012/3/28 - HDFFV-7762) - Fixed a bug in H5Ocopy(): When copying an opened object, call the - object's flush class action to ensure that cached data is flushed - so that H5Ocopy will get the correct data. - (VC - 2012/3/27 - HDFFV-7853) + object's flush class action to ensure that cached data is flushed + so that H5Ocopy will get the correct data. + (VC - 2012/3/27 - HDFFV-7853) - When an application tries to write or read many small data chunks and - runs out of memory, the library had a seg fault. The fix is to + runs out of memory, the library had a seg fault. The fix is to return the error stack with proper information. (SLU - 2012/3/23. - Issue 7785) + Issue 7785) - H5Pset_data_transform had seg fault in some cases like x*-100. It works correctly now and handles other cases like 100-x or 2/x. - (SLU - 2012/3/15. Issue 7922) + (SLU - 2012/3/15. Issue 7922) - Fixed rare corruption bugs that could occur when using the new object header format. (NAF - 2012/3/15 - HDFFV-7879) - - Creating a dataset in a read-only file caused seg fault when the file + - Creating a dataset in a read-only file caused seg fault when the file is closed. It's fixed. The attemp to create a dataset will fail - with the error stack indicating the file is read-only. (SLU - + with the error stack indicating the file is read-only. (SLU - 2012/1/25. Issue 7756) - Fixed a seg fault that could occur when shrinking a dataset with chunks larger than 1 MB. (NAF - 2011/11/30 - HDFFV-7833) @@ -532,17 +536,17 @@ Bug Fixes since HDF5-1.8.0 release 3. In tools/lib/h5tools_str.c, right shifting an int value for 32 bits or more caused undefined behavior. All the problems have been corrected. (SLU - 2011/9/2) - - In v1.6 library, there was EOA for the whole MULTI file saved in the - super block. We took it out in v1.8 library because it's meaningless - for the MULTI file. v1.8 library saves the EOA for the metadata file, + - In v1.6 library, there was EOA for the whole MULTI file saved in the + super block. We took it out in v1.8 library because it's meaningless + for the MULTI file. v1.8 library saves the EOA for the metadata file, instead. But this caused some backward compatibility problem. v1.8 library couldn't open the file created with v1.6 library. We fixed the problem by checking the EOA value to detect the file - created with v1.6 library. (SLU - 2011/6/22) - - When a dataset had filters and reading data failed, the error message + created with v1.6 library. (SLU - 2011/6/22) + - When a dataset had filters and reading data failed, the error message didn't say which filter isn't registered. It's fixed now. - (SLU - 2011/6/3) - - The datatype handler created with H5Tencode/decode used to have the + (SLU - 2011/6/3) + - The datatype handler created with H5Tencode/decode used to have the reference count 0 (zero). I have fixed it. It is 1 (one) now. (SLU - 2011/2/18) - Fixed a bug that caused big endian machines to generate corrupt files @@ -550,8 +554,8 @@ Bug Fixes since HDF5-1.8.0 release fill values. Note that such datasets will no longer be readable by any machine after this patch. (NAF - 2010/02/02 - Bug 2131) - Retrieving a link's name by index in the case where the link is - external and the file that the link refers to doesn't exist will - now fail gracefully rather than cause a segmentation fault. + external and the file that the link refers to doesn't exist will + now fail gracefully rather than cause a segmentation fault. (MAM - 2010/11/17) - Modified library to always cache symbol table information. Libraries version 1.6.3 have a bug which causes them to require this @@ -571,7 +575,7 @@ Bug Fixes since HDF5-1.8.0 release certain kinds of unaligned data unreadable or corrupt them. (NAF - 2010/07/28) - valgrind reported an error of copying data to itself when a new attribute - is written (Bug #1956). I fixed it by taking out the memcpy step in + is written (Bug #1956). I fixed it by taking out the memcpy step in the attribute code. (SLU - 2010/07/28) - Fixed a bug that could cause file corruption when using non-default sizes of addresses and/or lengths. This bug could also cause @@ -594,7 +598,7 @@ Bug Fixes since HDF5-1.8.0 release by expanding and shrinking chunked datasets in certain ways. (NAF - 2010/02/16) - H5Tdetect_class said a VL string is a string type. But when it's - in a compound type, it said it's a VL type (Bug #1584). I fixed it + in a compound type, it said it's a VL type (Bug #1584). I fixed it to be consistent. It always return string type. (SLU - 2009/12/10) - Fixed a bug where writing and deleting many global heap objects (i.e. variable length data) would render the file unreadable. Previously @@ -616,7 +620,7 @@ Bug Fixes since HDF5-1.8.0 release API. (NAF - 2009/04/20 - 1533) - Fixed a problem with using data transforms with non-native types in the file. (NAF - 2009/04/20 - 1548) - - Added direct.h include file to windows section of H5private.h + - Added direct.h include file to windows section of H5private.h to fix _getcwd() warning. (ADB - 2009/04/14 - 1536) - Fixed a bug that prevented external links from working after calling H5close(). (NAF - 2009/04/10 - 1539) @@ -636,8 +640,8 @@ Bug Fixes since HDF5-1.8.0 release table messages, and correct these errors if they are found. Such files can only be successfully opened with write access. (NAF - 2009/03/23 - 1189) - - Removed the long_long #define and replaced all instances with - "long long". This caused problems with third party products. All + - Removed the long_long #define and replaced all instances with + "long long". This caused problems with third party products. All currently supported compliers support the type. (ADB - 2009/03/05) - Fixed various bugs that could prevent the fill value from being written in certain rare cases. (NAF - 2009/02/26 - 1469) @@ -658,7 +662,7 @@ Bug Fixes since HDF5-1.8.0 release - Fixed a bug where H5Tpack wouldn't remove trailing space from an otherwise packed compound type. (NAF - 2009/01/14) - Fixed up some old v2 btree assertions that get run in debug mode that - were previously failing on compilation, and removed some of the + were previously failing on compilation, and removed some of the more heavily outdated and non-rewritable ones. (MAM - 2008/12/15) - Fixed a bug that could cause problems when "automatically" unmounting multiple files. (NAF - 2008/11/17) @@ -677,7 +681,7 @@ Bug Fixes since HDF5-1.8.0 release (NAF - 2008/10/06) - Changed the return value of H5Fget_obj_count from INT to SSIZE_T. Also changed the return value of H5Fget_obj_ids from HERR_T to SSIZE_T and - the type of the parameter MAX_OBJS from INT to SIZE_T. (SLU - 2008/09/26) + the type of the parameter MAX_OBJS from INT to SIZE_T. (SLU - 2008/09/26) - Fixed an issue that could cause data to be improperly overwritten during compound type conversion. (NAF - 2008/09/19) - Fixed pointer alignment violations that could occur during vlen @@ -716,7 +720,7 @@ Bug Fixes since HDF5-1.8.0 release (QAK - 2008/03/13) - Fixed bug in H5Aget_num_attrs() routine to handle invalid location ID correctly. (QAK - 2008/03/11) - - H5Dset_extent: when shrinking dimensions, some chunks were not deleted. + - H5Dset_extent: when shrinking dimensions, some chunks were not deleted. (PVN - 2009/01/8) - Added code to maintain a min_clean_fraction in the metadata cache when in serial mode. (MAM - 2009/01/9) @@ -728,7 +732,7 @@ Bug Fixes since HDF5-1.8.0 release - CMake: When CMake commands are executed individually on the command line and the external filters are being built, the CMAKE_BUILD_TYPE define must be set to the same value as the configuration - (-DCMAKE_BUILD_TYPE:STRING=Release if using -C Release). This is needed + (-DCMAKE_BUILD_TYPE:STRING=Release if using -C Release). This is needed by the the szip and zlib filter build commands. (ADB - HDFFV-8695) - CMake: Remove use of XLATE_UTILITY program. (ADB - 2014/03/28 HDFFV-8640) - CMake: Added missing quotes in setting the CMAKE_EXE_LINKER_FLAGS for the @@ -756,26 +760,26 @@ Bug Fixes since HDF5-1.8.0 release is enabled. Shared Fortran libraries are still not supported on Mac, so configure will disable them by default, but this is overridable with the new --enable-unsupported configure option. The configure - summary has been updated to reflect the fact that the shared-ness of + summary has been updated to reflect the fact that the shared-ness of the C++/Fortran wrapper libraries may not align with the C library. (MAM - 04/11/2011 - HDFFV-4353). - Removed recognition of the parallel compilers of LAM(hcc) and ChMPIon(cmpicc) since we have no access to these two MPI implementations and cannot verify their correctness. (AKC - 2010/7/14 - Bug 1921) - Removed the following config files, as we no longer support them: - config/dec-osf*, config/hpux11.00, config/irix5.x, + config/dec-osf*, config/hpux11.00, config/irix5.x, config/powerpc-ibm-aix4.x config/rs6000-ibm-aix5.x config/unicos* MAM - 2009/10/08 - Modified configure and make process to properly preserve user's CFLAGS (and company) environment variables. Build will now properly use automake's AM_CFLAGS for any compiler flags set by the configure - process. Configure will no longer modify CFLAGS directly, nor will + process. Configure will no longer modify CFLAGS directly, nor will setting CFLAGS during make completely replace what configure has set up. MAM - 2009/10/08 - Support for TFLOPS, config/intel-osf1, is removed since the TFLOPS machine has long retired. AKC - 2009/10/06. - - Added $(EXEEXT) extension to H5detect when it's executed in the - src/Makfile to generate H5Tinit.c so it works correctly on platforms + - Added $(EXEEXT) extension to H5detect when it's executed in the + src/Makfile to generate H5Tinit.c so it works correctly on platforms that require the full extension when running executables. MAM - 2009/10/01 - BZ #1613 - Configure will now set FC and CXX to "no" when fortran and c++ @@ -790,15 +794,15 @@ Bug Fixes since HDF5-1.8.0 release the static libraries are available. MAM - 2009/08/31 - BZ #1583 - The --includedir=DIR configuration option now works as intended, and can be used to specify the location to install C header files. The default - location remains unchanged, residing at ${prefix}/include. + location remains unchanged, residing at ${prefix}/include. MAM - 2009/03/10 - BZ #1381 - Configure no longer removes the '-g' flag from CFLAGS when in production - mode if it has been explicitly set in the CFLAGS environment variable + mode if it has been explicitly set in the CFLAGS environment variable prior to configuration. MAM - 2009/03/09 - BZ #1401. - Fixed error with 'make check install' failing due to h5dump needing other tools built first. MAM - 2008/10/24. - Wpen using shared szip, it is no longer necessary to specify - the path to the shared szip libraries in LD_LIBRARY_PATH. MAM - + the path to the shared szip libraries in LD_LIBRARY_PATH. MAM - 2008/10/24. - The file libhdf5_fortran.settings is not installed since its content is included in libhdf5.settings now. AKC - 2008/10/21 @@ -806,7 +810,7 @@ Bug Fixes since HDF5-1.8.0 release (e.g., h5cc and fortran modules). Fixed. AKC - 2008/10/8. - Autotools: An export of LD_LIBRARY_PATH= was removed from configure and make installcheck was revised to run - scripts installed in share/hdf5_examples to use the installed h5cc, etc. + scripts installed in share/hdf5_examples to use the installed h5cc, etc. to compile and run example source files also installed there. Make installcheck will now fail when a shared szip or other external lib file cannot be found in the same manner that executables compiled and linked @@ -818,14 +822,14 @@ Bug Fixes since HDF5-1.8.0 release Performance ------------- - Removed program perform/benchpar from the enable-build-all list. The - program will be retired or moved to another location. HDFFV-8156 - (AKC 2012/10/01) + program will be retired or moved to another location. HDFFV-8156 + (AKC 2012/10/01) - Retired program perform/mpi-perf. Its purpose has been incorporated - into h5perf before. (AKC 2012/09/20) + into h5perf before. (AKC 2012/09/20) - ifdefs added to tests around include unistd.h and function to simulate - getlogin() on Windows. + getlogin() on Windows. (ADB - 2011/08/15) - - perf_serial test added to Windows projects and check batch file. + - perf_serial test added to Windows projects and check batch file. (ADB - 2009/06/11) Fortran -------- @@ -849,51 +853,51 @@ Bug Fixes since HDF5-1.8.0 release - h5dump subsetting fixed for dims greater then two When a dataset has more then two dimensions, subsetting would incorrectly calculate the data that needed to be displayed. - Added in block and stride calculation that account for dimensions greater - then two. NOTE: lines that have line breaks inserted because of display - length calculations, may have index info that is incorrect until the next + Added in block and stride calculation that account for dimensions greater + then two. NOTE: lines that have line breaks inserted because of display + length calculations, may have index info that is incorrect until the next dimension break. (ADB, 2016/03/04, HDFFV-9698) - - h5repack: h5repack would not attempt to remove UD filters. Added a - check to h5repack for UD filters that checks if the filter can + - h5repack: h5repack would not attempt to remove UD filters. Added a + check to h5repack for UD filters that checks if the filter can be dynamically loaded. This will require a change in the library to add the H5PL_load() to the H5Zfilter_avail(). (ADB - 2014/03/03 HDFFV-8629) - - h5repack: Fixed failure for converting a layout of small chunked dataset + - h5repack: Fixed failure for converting a layout of small chunked dataset (size < 1K) to contiguous layout. HDFFV-8214 (JKM 2013/03/18) - h5diff: Fixed to return correct exit code 1 when detect unique extra - attribute. Prior to this fix, h5diff returned exit code 0 indicating + attribute. Prior to this fix, h5diff returned exit code 0 indicating two files are identical. HDFFV-7643 (JKM 2013/02/15) - h5diff: Improved speed when comparing HDF5 files with lots of - attributes. Much slower performance was identified with release + attributes. Much slower performance was identified with release version from 1.8.7 to 1.8.10 compared to 1.8.6. (JKM 2012/10/19) - h5repack: "h5repack -f NONE file1.h5 out.h5" command failed if - source file contains chunked dataset and a chunk dim is bigger than + source file contains chunked dataset and a chunk dim is bigger than the dataset dim. Another issue is that the command changed max dims if chunk dim is smaller than the dataset dim. These issue occurred when dataset size is smaller than 64k (compact size limit) Fixed both. HDFFV-8012 (JKM 2012/09/24) - h5diff: Fixed not to accumulate attribute difference to dataset - difference in verbose mode (-v, -r), which caused incorrect - difference between dataset and group/datatype object if attribute + difference in verbose mode (-v, -r), which caused incorrect + difference between dataset and group/datatype object if attribute exist with any differences. This also lead to fix inconsistent format indicating difference between dataset and group/datatype object. HDFFV-5919 (JKM 2012/09/05) - - h5diff: Fixed the incorrect result when comparing attribute data + - h5diff: Fixed the incorrect result when comparing attribute data values and the data type has same class but different size. HDFFV-7942 (JKM 2012/08/15) - - ph5diff: Fixed intermittent hang issue on a certain operation in - parallel mode. It was detected by daily test for comparing - non-comparable objects, but it could have occurred in other + - ph5diff: Fixed intermittent hang issue on a certain operation in + parallel mode. It was detected by daily test for comparing + non-comparable objects, but it could have occurred in other operations depend on machine condition. HDFFV-8003 (JKM 2012/08/01) - - h5diff: Fixed test failure for "make check" due to failure of + - h5diff: Fixed test failure for "make check" due to failure of copying test files when performed in HDF5 source tree. Also applied to other tools. HDFFV-8107 (JKM 2012/08/01) - h5diff: Fixed the Function COPY_TESTFILES_TO_TESTDIR() of - testh5diff.sh to better report when there is an error in the file - copying. HDFFV-8105 (AKC -2012/07/22) - - h5diff: Fixed not to check and display dangling link status without - --follow-symlinks option. This also improved performance when + testh5diff.sh to better report when there is an error in the file + copying. HDFFV-8105 (AKC -2012/07/22) + - h5diff: Fixed not to check and display dangling link status without + --follow-symlinks option. This also improved performance when comparing lots of external links without the --follow-symlinks option. HDFFV-7998 (JKM 2012/04/26) - h5unjam: Fixed sefgault when used -V (show version) option. @@ -905,8 +909,8 @@ Bug Fixes since HDF5-1.8.0 release in error. After the fix, h5diff detects such case as non-comparable and display messages accordingly. HDFFV-7664 (JKM 2012/03/28) - h5diff: If unique objects exists only in one file and try to exclude - the unique objects with --exclude-path option, h5diff missed - excluding some objects. + the unique objects with --exclude-path option, h5diff missed + excluding some objects. Fixed to exclude objects correctly in such case. HDFFV-7837 (JKM 2012/03/20) - h5dump: Added tools library error stack to properly catch error @@ -915,60 +919,60 @@ Bug Fixes since HDF5-1.8.0 release - h5dump: Dangling links no longer throw error message, change process when open link fails. HDFFV-7839 (ADB 2012/03/12) - - h5diff: When two symbolic dangling links are compared with - --follow-symlinks option, the result should be same. It worked for + - h5diff: When two symbolic dangling links are compared with + --follow-symlinks option, the result should be same. It worked for comparing two files, but didn't work for comparing two objects. HDFFV-7835 (JKM 2012/03/09) - - h5dump: Refactored code to remove duplicated functions. Split XML + - h5dump: Refactored code to remove duplicated functions. Split XML functions from DDL functions. Corrected indentation and formatting errors. Also fixed subsetting counting overflow (HDFFV-5874). Verified all tools call tools_init() in main. HDFFV-7560 (ADB 2012/02/17) - - h5diff: fixed to prevent from displaying error stack message when + - h5diff: fixed to prevent from displaying error stack message when comparing the two dangling symlinks with follow-symlinks option. HDFFV-7836 (JKM 2012/01/13) - - h5repack: fixed memory leak for handling variable length string in + - h5repack: fixed memory leak for handling variable length string in attribute. HDFFV-7840 (JKM 2012/01/06) - h5ls: fixed segfault when access region reference data in an attribute. HDFFV-7838 (JKM 2011/12/29) - - h5diff: fixed segfault over non-comparable attribute with different + - h5diff: fixed segfault over non-comparable attribute with different dimention or rank, along with '-c' option to display details. HDFFV-7770 (JKM 2011/10/24) - - Fixed h5diff to display all the comparable object and attribute + - Fixed h5diff to display all the comparable object and attribute regardless of non-comparables. HDFFV-7693 (JKM 2011/09/16) - - Fixed h5repack to update values of references(object and region) of - attributes in h5repack for 1) references, 2) ARRAY of references, - 3) VLEN of references, and 4) COMPOUND of references. + - Fixed h5repack to update values of references(object and region) of + attributes in h5repack for 1) references, 2) ARRAY of references, + 3) VLEN of references, and 4) COMPOUND of references. (JIRA HDF5 5932) PC -2011/09/14 - h5diff: fixed segfault over dataset with container types - (array,lven) with multiple nested compound types. + (array,lven) with multiple nested compound types. (ex: compound->array->compound, compound->vlen->compound) HDFFV-7712 JKM (2011/09/01) - - h5repack: added macro to handle failure in H5Dread/write when memory + - h5repack: added macro to handle failure in H5Dread/write when memory allocation failed inside the library. (PC -- 2011/08/19) - - Fixed h5jam not to allow specifying an HDF5 formatted file as input - file for -u (user block file) option, because the original HDF5 file + - Fixed h5jam not to allow specifying an HDF5 formatted file as input + file for -u (user block file) option, because the original HDF5 file will not be accessible if allows. HDFFV-5941 (JKM 2011/08/15) - Revised command help pages of h5jam and h5unjam. The descriptions - were not up to date and some were missing. + were not up to date and some were missing. HDFFV-7515 (JKM 2011/08/15) - - h5repack: h5repack failed to copy dataset if the layout is changed - from chunked with unlimited dims to contiguous. HDFFV-7649 + - h5repack: h5repack failed to copy dataset if the layout is changed + from chunked with unlimited dims to contiguous. HDFFV-7649 (PC -- 2011/07/15) - - h5diff: "--delta" option considers two NaN of the same type are + - h5diff: "--delta" option considers two NaN of the same type are different, which is wrong based on h5diff description in Reference Manual. HDFFV-7656 (PC -- 2011/07/15) - Fixed h5diff to display instructive error message and exit with 1 when mutually exclusive options (-d, -p and --use-system-epsilon) are used together. HDFFV-7600 (JKM 2011/07/07) - - Fixed h5dump to display the first line of each element into correct + - Fixed h5dump to display the first line of each element into correct position for multiple dimention array type. - Before this fix, the first line of each element in array were + Before this fix, the first line of each element in array were displayed after the last line of previous element without - moving to the next line (+indentation). + moving to the next line (+indentation). Bug #HDFFV-5878 (JKM 2011/06/15) - Fixed h5dump to display correct value for H5T_STD_I8LE dataset - on a system (ppc64, linux, Big-Endian, clustering). + on a system (ppc64, linux, Big-Endian, clustering). Bug #HDFFV-7594 (ABERT & JKM 2011/05/12) - Fixed h5diff to compare file itself correctly. Previously h5diff reported either different or not compatible in certain cases even @@ -976,16 +980,16 @@ Bug Fixes since HDF5-1.8.0 release comparing same target objects through verifying the obj&file addresses before comparing the details in the objects (ex: datasets or attributes) Bug #HDFFV-5928 (XCAO & JKM 2011/05/06) - - Updated h5dump test case script to prevent entire test failure upon + - Updated h5dump test case script to prevent entire test failure upon source directory is read-only. Bug# HDFFV-4342 (JKM 2011/4/12) - Fixed h5dump displaying incorrect values for H5T_STD_I8BE type data in attribute on Big-Endian machine. H5T_STD_I8BE is unsigned 8bit type, - so h5dump is supposed to display -2 instead of 254. It worked - correctly on Little-Endian system , but not on Big-Endian system. + so h5dump is supposed to display -2 instead of 254. It worked + correctly on Little-Endian system , but not on Big-Endian system. Bug #HDFFV-4358 (JKM 2011/04/08) - - Updated to unify option name to '--enable-error-stack' for printing + - Updated to unify option name to '--enable-error-stack' for printing HDF5 error stack messages for HDF5 tools. h5ls and h5dump for now. - For h5ls, this replaces "-e/--errors" option, which is deprecated. + For h5ls, this replaces "-e/--errors" option, which is deprecated. Bug#2182 (JKM 2011/3/30) - Fix h5diff for --use-system-epsilon option: the calculation changed from ( |a - b| / b ) to ( |a - b| ). This was decided for better @@ -996,72 +1000,72 @@ Bug Fixes since HDF5-1.8.0 release ::= H5T_STD_REF_OBJECT | H5T_STD_REF_DSETREG Previously this was only displayed if the -R option was used. Bug#1725 (ADB 2011/3/28) - - Fix h5diff issues for #1: h5diff compared attributes correctly only - when two objects have the same number of attributes and attribute - names are identical, #2: didn't display useful information about + - Fix h5diff issues for #1: h5diff compared attributes correctly only + when two objects have the same number of attributes and attribute + names are identical, #2: didn't display useful information about attribute difference. Bug#2121 (JKM 2011/3/17) - - Fixed memory leak for h5diff when accessing symbolic links with + - Fixed memory leak for h5diff when accessing symbolic links with --follow-symlink option. Bug#2214 (JKM 2011/3/18) - Fixed memory leak for h5diff when access variable length string data. Bug#2216 (JKM 2011/3/18) - - Fixed and improved help page for -a option of h5ls. + - Fixed and improved help page for -a option of h5ls. Bug#1904 (JKM 2011/3/11) - - Fixed h5dump not to include attribute values in the output file when - h5dump "-y -o output_file" options were used. The problem was introduced + - Fixed h5dump not to include attribute values in the output file when + h5dump "-y -o output_file" options were used. The problem was introduced in HDF5 1.8.6 by showing data pointed by region references. (XCAO 2011/3/9) - Fixed h5copy to be able to copy any object into the same HDF5 file. Previously h5copy displayed error message when target file is same as source file. (XCAO 2011/3/8) - - Fixed h5dump for skipping some values for long array type dataset on - Windows. This issue only occurred on Windows due to the different + - Fixed h5dump for skipping some values for long array type dataset on + Windows. This issue only occurred on Windows due to the different return behavior from _vsnprintf() funtion. Bug#2161 (JKM 2011/3/3) - Fixed h5dump for skipping array indices every certain number when the array type dataset is relatively big. The certain number varies according to the size of array. Bug#2092 (JKM 2011/2/15). - Fixed h5diff for the segfault when compares compound datasets - with combination of fixed length string types and vlen string types + with combination of fixed length string types and vlen string types in certain orders. bug#2089 (JKM 2010/12/28) - - Improve h5diff performance. 1) use HDmemcmp() before comparing each + - Improve h5diff performance. 1) use HDmemcmp() before comparing each elements. 2) replace expensive H5Tequals() calls 3) retrieve datatype - information at dataset level not each element level for compound + information at dataset level not each element level for compound datasets - - Fixed h5ls to display nested compound type with curly bracket - when -S (--simple) option is used with -l (--label), so it shows - which member (in curly bracket) belong to which nested compound type + - Fixed h5ls to display nested compound type with curly bracket + when -S (--simple) option is used with -l (--label), so it shows + which member (in curly bracket) belong to which nested compound type and make the output make sense. bug#1979 (JKM 2010/11/09) - - Fixed h5diff to handle variable-length strings in a compound dataset + - Fixed h5diff to handle variable-length strings in a compound dataset correctly. (also variable-length string array in a compound dataset) - Garbage values were displayed when h5diff compared multiple - variable-length strings in a compound type dataset. + Garbage values were displayed when h5diff compared multiple + variable-length strings in a compound type dataset. Bug#1989 (JKM 2010/10/28) - Fixed h5copy to fail gracefully when copying object to non-exist group without -p option. Bug#2040 (JKM 2010/10/18) - - Fixed to compare member objects and groups recursively when two + - Fixed to compare member objects and groups recursively when two files or groups are specified to be compared. Bug#1975 (JKM 2010/9/16) - Make h5repack be able to convert a layout to COMPACT for small size dataset as default. bug#1896 (JKM 2010/09/15) - - Change h5ls not to manipulate special characters in object name or + - Change h5ls not to manipulate special characters in object name or attribute name for smart display. bug#1784 (JKM 2010/06/28) - Fixed h5ls to return exit code 1 (error) when non-existent file is specified. bug#1793. (JKM 2010/04/27) - - h5copy failed to copy dangling link when the link is specified + - h5copy failed to copy dangling link when the link is specified directly. bug#1817. (JKM 2010/04/22) - h5repack lost attributes from a dataset of reference type. bug#1726. (JKM 2010/3/25) - - h5repack sets NULL for object reference value for group or + - h5repack sets NULL for object reference value for group or named datatype. bug#1814. (JKM 2010/03/19) - h5diff: fixed incorrect behavior (hang) in parallel mode when specify invalid options (ex: -v and -q) (JKM 2010/02/17) - - h5dump/h5ls display buffer resize fixed in tools library. + - h5dump/h5ls display buffer resize fixed in tools library. (ADB - 2009/07/21 - 1520) - Fixed many problems that could occur when using h5repack with named datatypes. (NAF - 2009/4/20 - 1516/1466) - - h5dump, h5diff, h5repack were not reading (by hyperslabs) datasets - that have a datatype datum size greater than H5TOOLS_BUFSIZE, a - constant defined as 1024Kb, such as array types with large + - h5dump, h5diff, h5repack were not reading (by hyperslabs) datasets + that have a datatype datum size greater than H5TOOLS_BUFSIZE, a + constant defined as 1024Kb, such as array types with large dimensions (PVN - 2009/4/1 - 1501) - - h5import: By selecting a compression type, a big endian byte order was being + - h5import: By selecting a compression type, a big endian byte order was being selected (PVN - 2009/3/11 - 1462) - zip_perf.c had missing argument on one of the open() calls. Fixed. (AKC - 2008/12/9) @@ -1083,10 +1087,10 @@ Bug Fixes since HDF5-1.8.0 release input file. Besides that the binary file generated needs to be open with 'wb' , otherwise an end of line character is read twice. (PVN - 2008/02/19) - - Fixed bug in h5dump that caused binary output to be made only for the first + - Fixed bug in h5dump that caused binary output to be made only for the first dataset, when several datasets were requested. (PVN - 2008/04/07) - - h5dump: when doing binary output (-b), the stdout printing of attributes - was done incorrectly. Removed printing of attributes when doing binary + - h5dump: when doing binary output (-b), the stdout printing of attributes + was done incorrectly. Removed printing of attributes when doing binary output. PVN - 2008/06/05 @@ -1105,12 +1109,12 @@ Bug Fixes since HDF5-1.8.0 release - Fixed problem with H5DSget_scale_name including the NULL terminator in the size calculation returned by the function. The API does not - include the NULL terminator in the size returned (MSB- 2013/2/10) - + include the NULL terminator in the size returned (MSB- 2013/2/10) + - Fixed problem with H5TBdelete_record destroying all data following the deletion of a row. (MSB- 2012/7/26) - - Fixed H5LTget_attribute_string not closing an object identifier when an + - Fixed H5LTget_attribute_string not closing an object identifier when an error occurs. (MSB- 2012/7/21) - Fixed the H5LTdtype_to_text function. It had some memory problems when @@ -1120,48 +1124,48 @@ Bug Fixes since HDF5-1.8.0 release caused by using H5Tget_native_type function to determine the native type for reading REFERENCE_LIST attribute. The bug was exposed on Mac PPC. - (EIP - 2010/05/22 -1851) - - Fixed a bug in the H5DSdetach_scale function when 0 bytes - were allocated after the last reference to a dim. scale - was removed from the list of references in a VL element of the + (EIP - 2010/05/22 -1851) + - Fixed a bug in the H5DSdetach_scale function when 0 bytes + were allocated after the last reference to a dim. scale + was removed from the list of references in a VL element of the DIMENSION_LIST attribute; modified the function to comply - with the Spec: DIMENSION_LIST attribute is deleted now when no + with the Spec: DIMENSION_LIST attribute is deleted now when no dimension scales left attached. - (EIP - 2010/05/14 -1822) + (EIP - 2010/05/14 -1822) - Fixed a bug where the H5TB API would forget the order of fields when added out of offset order. (NAF - 2009/10/27 - 1582) - H5DSis_attached failed to account for different platform types. Added a get native type call. (ADB - 2009/9/29 - 1562) - - Dimension scales: The scale index return value in H5DSiterate_scales was not always + - Dimension scales: The scale index return value in H5DSiterate_scales was not always incremented. (PVN - 2009/4/8 - 1538) Fortran High-Level APIs: ------ - - Lite: The h5ltget_attribute_string_f used to return the C NULL character in the - returned character buffer. The returned Fortran charactor buffer now does + - Lite: The h5ltget_attribute_string_f used to return the C NULL character in the + returned character buffer. The returned Fortran charactor buffer now does not return the C NULL character. (MSB - 2012/3/23) - - Lite: The h5ltget_dataset_info_f function (gets information about a dataset) + - Lite: The h5ltget_dataset_info_f function (gets information about a dataset) was not correctly returning the dimension array. (PVN - 2009/3/23) - - Lite: the h5ltread_dataset_string_f and h5ltget_attribute_string_f functions + - Lite: the h5ltread_dataset_string_f and h5ltget_attribute_string_f functions had memory problems with the g95 fortran compiler. (PVN � 5/13/2009) 1522 - Documentation - ------------- + Documentation + ------------- F90 APIs -------- - Modified the h5open_f and h5close_f subroutines to not to call H5open and H5close correspodningly. While the H5open call just adds overhead, - the H5close call called by an Fortran application shuts down the HDF5 - library making it unaccessible to the application. + the H5close call called by an Fortran application shuts down the HDF5 + library making it unaccessible to the application. HDFFV-915 (EIP & SB - 2011/10/13) - + C++ APIs -------- @@ -1229,17 +1233,17 @@ Supported Platforms #1 SMP x86_64 GNU/Linux compilers for 64-bit applications; (koala) Version 4.1.2 20080704 (Red Hat 4.1.2-54) Version 4.8.2 - Intel(R) C, C++, Fortran Compilers for - applications running on Intel(R) 64; + Intel(R) C, C++, Fortran Compilers for + applications running on Intel(R) 64; Version 14.0.2 (Build 20140120) Linux 2.6.32-431.11.2.el6 GNU C (gcc), Fortran (gfortran), C++ (g++) #1 SMP x86_64 GNU/Linux compilers: (platypus) Version 4.4.7 20120313 Version 4.8.2 - PGI C, Fortran, C++ for 64-bit target on + PGI C, Fortran, C++ for 64-bit target on x86-64; - Version 13.7-0 + Version 13.7-0 Intel(R) C (icc), C++ (icpc), Fortran (icc) compilers: Version 14.0.2 (Build 20140120) @@ -1249,7 +1253,7 @@ Supported Platforms (ostrich) GNU Fortran (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4) IBM XL C/C++ V13.1 IBM XL Fortran V15.1 - + Linux 2.6.32-220.23.1.1chaos Intel C, C++, Fortran Compilers ch5.x86_64 GNU/Linux Version 12.1.5.339 (LLNL Aztec) @@ -1266,6 +1270,7 @@ Supported Platforms Visual Studio 2010 w/ Intel Fortran 14 (cmake) Visual Studio 2012 w/ Intel Fortran 15 (cmake) Visual Studio 2013 w/ Intel Fortran 15 (cmake) + Visual Studio 2015 (cmake) Cygwin(CYGWIN_NT-6.1 1.7.34(0.285/5/3) gcc(4.9.2) compiler and gfortran) (cmake and autotools) @@ -1273,7 +1278,8 @@ Supported Platforms Visual Studio 2010 w/ Intel Fortran 14 (cmake) Visual Studio 2012 w/ Intel Fortran 15 (cmake) Visual Studio 2013 w/ Intel Fortran 15 (cmake) - + Visual Studio 2015 (cmake) + Windows 8.1 Visual Studio 2012 w/ Intel Fortran 15 (cmake) Visual Studio 2013 w/ Intel Fortran 15 (cmake) @@ -1286,23 +1292,23 @@ Supported Platforms Mac OS X Mountain Lion 10.8.1 cc Apple clang version 4.0 from Xcode 4.5.1 (owl) c++ Apple clang version 4.0 from Xcode 4.5.1 - gcc i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 from Xcode 4.5.1 - g++ i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 from Xcode 4.5.1 - gfortran GNU Fortran (GCC) 4.6.2 + gcc i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 from Xcode 4.5.1 + g++ i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 from Xcode 4.5.1 + gfortran GNU Fortran (GCC) 4.6.2 Tested Configuration Features Summary ===================================== In the tables below - y = tested + y = tested n = not tested in this release C = Cluster W = Workstation x = not working in this release dna = does not apply ( ) = footnote appears below second table - = testing incomplete on this feature or platform + = testing incomplete on this feature or platform Platform C F90/ F90 C++ zlib SZIP parallel F2003 parallel @@ -1330,30 +1336,30 @@ CentOS 6.4 Linux 2.6.32 x86_64 PGI n y/y n y y y Linux 2.6.32-431.11.2.el6.ppc64 n y/n n y y y -Platform Shared Shared Shared Thread- - C libs F90 libs C++ libs safe -Solaris2.11 32-bit y y y y -Solaris2.11 64-bit y y y y +Platform Shared Shared Shared Thread- + C libs F90 libs C++ libs safe +Solaris2.11 32-bit y y y y +Solaris2.11 64-bit y y y y Windows 7 y y y y Windows 7 x64 y y y y Windows 7 Cygwin n n n y Windows 7 x64 Cygwin n n n y Windows 8 y y y y Windows 8 x64 y y y y -Mac OS X Lion 10.7.3 32-bit y n y y -Mac OS X Lion 10.7.3 64-bit y n y y -Mac OS X Mountain Lion 10.8.1 64-bit y n y y +Mac OS X Lion 10.7.3 32-bit y n y y +Mac OS X Lion 10.7.3 64-bit y n y y +Mac OS X Mountain Lion 10.8.1 64-bit y n y y Mac OS X Mavericks 10.9.1 64-bit y n y y -AIX 6.1 32- and 64-bit y n n y -CentOS 5.9 Linux 2.6.18-308 i686 GNU y y y y -CentOS 5.9 Linux 2.6.18-308 i686 Intel y y y n -CentOS 5.9 Linux 2.6.18-308 i686 PGI y y y n -CentOS 5.9 Linux 2.6.18 x86_64 GNU y y y y -CentOS 5.9 Linux 2.6.18 x86_64 Intel y y y n +AIX 6.1 32- and 64-bit y n n y +CentOS 5.9 Linux 2.6.18-308 i686 GNU y y y y +CentOS 5.9 Linux 2.6.18-308 i686 Intel y y y n +CentOS 5.9 Linux 2.6.18-308 i686 PGI y y y n +CentOS 5.9 Linux 2.6.18 x86_64 GNU y y y y +CentOS 5.9 Linux 2.6.18 x86_64 Intel y y y n CentOS 6.4 Linux 2.6.32 x86_64 GNU y y y n CentOS 6.4 Linux 2.6.32 x86_64 Intel y y y n -CentOS 6.4 Linux 2.6.32 x86_64 PGI y y y n -Linux 2.6.32-431.11.2.el6.ppc64 y y y n +CentOS 6.4 Linux 2.6.32 x86_64 PGI y y y n +Linux 2.6.32-431.11.2.el6.ppc64 y y y n Compiler versions for each platform are listed in the preceding "Supported Platforms" table. @@ -1369,7 +1375,7 @@ The following platforms are not supported but have been tested for this release. Linux 2.6.18-431.11.2.el6 MPICH mpich 3.1.2 compiled with #1 SMP x86_64 GNU/Linux gcc 4.9.1 and gfortran 4.9.1 - (platypus) g95 (GCC 4.0.3 (g95 0.94!) + (platypus) g95 (GCC 4.0.3 (g95 0.94!) FreeBSD 8.2-STABLE i386 gcc 4.2.1 [FreeBSD] 20070719 (loyalty) gcc 4.6.1 20110422 @@ -1420,7 +1426,7 @@ The following platforms are not supported but have been tested for this release. gcc (Ubuntu/Linaro 4.9.1-0ubuntu1) 4.9.1 GNU Fortran (Ubuntu/Linaro 4.9.1-0ubuntu1) 4.9.1 (cmake and autotools) - + Cray Linux Environment (CLE) PrgEnv-pgi/4.0.46 hopper.nersc.gov pgcc 12.5-0 64-bit target on x86-64 Linux -tp shanghai pgf90 12.5-0 64-bit target on x86-64 Linux -tp shanghai @@ -1436,20 +1442,20 @@ Known Problems * CLANG compiler with the options -fcatch-undefined-behavior and -ftrapv catches some undefined behavior in the alignment algorithm of the macro DETECT_I - in H5detect.c (Issue 8147). Since the algorithm is trying to detect the alignment - of integers, ideally the flag -fcatch-undefined-behavior shouldn't to be used for - H5detect.c. In the future, we can separate flags for H5detect.c from the rest of + in H5detect.c (Issue 8147). Since the algorithm is trying to detect the alignment + of integers, ideally the flag -fcatch-undefined-behavior shouldn't to be used for + H5detect.c. In the future, we can separate flags for H5detect.c from the rest of the library. (SLU - 2013/10/16) * The 5.9 C++ compiler on Sun failed to compile a C++ test ttypes.cpp. It complains with this message: "/home/hdf5/src/H5Vprivate.h", line 130: Error: __func__ is not defined. - + The reason is that __func__ is a predefined identifier in C99 standard. The HDF5 C library uses it in H5private.h. The test ttypes.cpp includes - H5private.h (H5Tpkg.h<-H5Fprivate.h<-H5Vprivate.h<-H5private.h). Sun's 5.9 + H5private.h (H5Tpkg.h<-H5Fprivate.h<-H5Vprivate.h<-H5private.h). Sun's 5.9 C++ compiler doesn't support __func__, thus fails to compile the C++ test. - But 5.11 C++ compiler does. To check whether your Sun C++ compiler knows this + But 5.11 C++ compiler does. To check whether your Sun C++ compiler knows this identifier, try to compile the following simple C++ program: #include @@ -1467,23 +1473,23 @@ Known Problems * The data conversion test dt_arith.c has failures (segmentation fault) from "long double" to other datatypes during hard conversion when the library - is built with the default GCC 4.2.1 on Mac Lion system. It only happens - with optimization (-O3, -O2, and -O1). Some newer versions of GCC do not + is built with the default GCC 4.2.1 on Mac Lion system. It only happens + with optimization (-O3, -O2, and -O1). Some newer versions of GCC do not have this problem. Users should disable optimization or try newer version of GCC. (Issue 8017. SLU - 2012/6/12) * The data conversion test dt_arith.c fails in "long double" to integer conversion on Ubuntu 11.10 (3.0.0.13 kernal) with GCC 4.6.1 if the library is built with optimization -O3 or -O2. The older GCC (4.5) or newer kernal - (3.2.2 on Fedora) doesn't have the problem. Users should lower down the - optimization level (-O1 or -O0) by defining CFLAGS in the command line of + (3.2.2 on Fedora) doesn't have the problem. Users should lower down the + optimization level (-O1 or -O0) by defining CFLAGS in the command line of "configure" like: CFLAGS=-O1 ./configure - It will overwrite the library's default optimization level. (Issue 7829. + It will overwrite the library's default optimization level. (Issue 7829. SLU - 2012/2/7) - + * --with-mpe configure option does not work with Mpich2. AKC - 2011/03/10) * While working on the 1.8.6 release of HDF5, a bug was discovered that can @@ -1506,7 +1512,7 @@ Known Problems cause H5Fcreate() with H5F_ACC_EXCL to fail even when the file is not existing. This is due to the MPI_File_open() call failing if the amode has the MPI_MODE_EXCL bit set. (See bug 1468 for details.) AKC - 2009/8/11 - + * Parallel tests failed with 16 processes with data inconsistency at testphdf5 / dataset_readAll. Parallel tests also failed with 32 and 64 processes with collective abort of all ranks at t_posix_compliant / allwrite_allread_blocks @@ -1515,19 +1521,19 @@ Known Problems * For SNL, spirit/liberty/thunderbird: The serial tests pass but parallel tests failed with MPI-IO file locking message. AKC - 2007/6/25. * On Intel 64 Linux cluster (RH 4, Linux 2.6.9) with Intel 10.0 compilers use - -mp -O1 compilation flags to build the libraries. Higher level of optimization - causes failures in several HDF5 library tests. + -mp -O1 compilation flags to build the libraries. Higher level of optimization + causes failures in several HDF5 library tests. * For HPUX 11.23 many tools tests failed for 64-bit version when linked to the shared libraries (tested for 1.8.0-beta2) * For SNL, Red Storm: only paralle HDF5 is supported. The serial tests pass and the parallel tests also pass with lots of non-fatal error messages. -* on SUN 5.10 C++ test fails in the "Testing Shared Datatypes with Attributes" test +* on SUN 5.10 C++ test fails in the "Testing Shared Datatypes with Attributes" test * configuring with --enable-debug=all produces compiler errors on most platforms. Users who want to run HDF5 in debug mode should use --enable-debug rather than --enable-debug=all to enable debugging information on most modules. * On Mac OS 10.4, test/dt_arith.c has some errors in conversion from long - double to (unsigned) long long and from (unsigned)long long to long double. + double to (unsigned) long long and from (unsigned)long long to long double. * On Altix SGI with Intel 9.0 testmeta.c would not compile with -O3 optimization flag. * On VAX, Scaleoffset filter isn't supported. The filter cannot be applied to @@ -1540,19 +1546,19 @@ Known Problems contribute no IO and the application asks to do IO with collective, we found that when using 4 processors, a simple collective write will be hung sometimes. This can be verified with t_mpi test under testpar. -* The dataset created or rewritten with the v1.6.3 library or after can't - be read with the v1.6.2 library or before when Fletcher32 EDC(filter) is - enabled. There was a bug in the calculating code of the Fletcher32 - checksum in the library before v1.6.3. The checksum value wasn't consistent - between big-endian and little-endian systems. This bug was fixed in - Release 1.6.3. However, after fixing the bug, the checksum value is no - longer the same as before on little-endian system. The library release +* The dataset created or rewritten with the v1.6.3 library or after can't + be read with the v1.6.2 library or before when Fletcher32 EDC(filter) is + enabled. There was a bug in the calculating code of the Fletcher32 + checksum in the library before v1.6.3. The checksum value wasn't consistent + between big-endian and little-endian systems. This bug was fixed in + Release 1.6.3. However, after fixing the bug, the checksum value is no + longer the same as before on little-endian system. The library release after 1.6.4 can still read the dataset created or rewritten with the library of v1.6.2 or before. SLU - 2005/6/30 * For the version 6(6.02 and 6.04) of Portland Group compiler on AMD Opteron processor, there's a bug in the compiler for optimization(-O2). The library - failed in several tests but all related to multi driver. The problem has - been reported to the vendor. + failed in several tests but all related to multi driver. The problem has + been reported to the vendor. * On IBM AIX systems, parallel HDF5 mode will fail some tests with error messages like "INFO: 0031-XXX ...". This is from the command poe. Set the environment variable MP_INFOLEVEL to 0 to minimize the messages @@ -1566,7 +1572,7 @@ Known Problems to provide a mean to run poe without the debug socket. * The C++ library's tests fails when compiling with PGI C++ compiler. The - workaround until the problem is correctly handled is to use the + workaround until the problem is correctly handled is to use the flag "--instantiate=local" prior to the configure and build steps, as: setenv CXX "pgCC --instantiate=local" for pgCC 5.02 and higher @@ -1580,9 +1586,9 @@ Known Problems * The --enable-static-exec configure flag will only statically link libraries if the static version of that library is present. If only the shared version of a library exists (i.e., most system libraries on Solaris, AIX, and Mac, - for example, only have shared versions), the flag should still result in a - successful compilation, but note that the installed executables will not be - fully static. Thus, the only guarantee on these systems is that the + for example, only have shared versions), the flag should still result in a + successful compilation, but note that the installed executables will not be + fully static. Thus, the only guarantee on these systems is that the executable is statically linked with just the HDF5 library. * With the gcc 2.95.2 compiler, HDF 5 uses the `-ansi' flag during @@ -1590,7 +1596,7 @@ Known Problems able to handle the `long long' datatype with the warning: warning: ANSI C does not support `long long' - + This warning is innocuous and can be safely ignored. * Certain platforms give false negatives when testing h5ls: @@ -1608,35 +1614,35 @@ Known Problems * On some platforms that use Intel and Absoft compilers to build HDF5 fortran library, compilation may fail for fortranlib_test.f90, fflush1.f90 and fflush2.f90 - complaining about exit subroutine. Comment out the line + complaining about exit subroutine. Comment out the line IF (total_error .ne. 0) CALL exit (total_error) * Information about building with PGI and Intel compilers is available in INSTALL file sections 5.7 and 5.8 * On at least one system, (SDSC DataStar), the scheduler (in this case - LoadLeveler) sends job status updates to standard error when you run + LoadLeveler) sends job status updates to standard error when you run any executable that was compiled with the parallel compilers. - This causes problems when running "make check" on parallel builds, as + This causes problems when running "make check" on parallel builds, as many of the tool tests function by saving the output from test runs, - and comparing it to an exemplar. + and comparing it to an exemplar. The best solution is to reconfigure the target system so it no longer inserts the extra text. However, this may not be practical. - In such cases, one solution is to "setenv HDF5_Make_Ignore yes" prior to - the configure and build. This will cause "make check" to continue after + In such cases, one solution is to "setenv HDF5_Make_Ignore yes" prior to + the configure and build. This will cause "make check" to continue after detecting errors in the tool tests. However, in the case of SDSC DataStar, it also leaves you with some 150 "failed" tests to examine by hand. A second solution is to write a script to run serial tests and filter out the text added by the scheduler. A sample script used on SDSC - DataStar is given below, but you will probably have to customize it - for your installation. + DataStar is given below, but you will probably have to customize it + for your installation. - Observe that the basic idea is to insert the script as the first item - on the command line which executes the the test. The script then + Observe that the basic idea is to insert the script as the first item + on the command line which executes the the test. The script then executes the test and filters out the offending text before passing it on. @@ -1658,11 +1664,11 @@ Known Problems exit $RETURN_VALUE You get the HDF make files and test scipts to execute your filter script - by setting the environment variable "RUNSERIAL" to the full path of the - script prior to running configure for parallel builds. Remember to + by setting the environment variable "RUNSERIAL" to the full path of the + script prior to running configure for parallel builds. Remember to "unsetenv RUNSERIAL" before running configure for a serial build. - Note that the RUNSERIAL environment variable exists so that we can + Note that the RUNSERIAL environment variable exists so that we can can prefix serial runs as necessary on the target system. On DataStar, no prefix is necessary. However on an MPICH system, the prefix might have to be set to something like "/usr/local/mpi/bin/mpirun -np 1" to -- cgit v0.12 From 5fabfb6079083e99709c51fce72c91fa697b70c4 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 7 Mar 2016 11:58:11 -0500 Subject: [svn-r29312] Removed -Wnonnull from the gnu C++ flags. It's not used for C++. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial w/ C++ --- config/gnu-cxxflags | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/config/gnu-cxxflags b/config/gnu-cxxflags index 8d1ca67..9d72b8f 100644 --- a/config/gnu-cxxflags +++ b/config/gnu-cxxflags @@ -437,8 +437,8 @@ case "$cxx_vendor-$cxx_version" in # Replace old -W flag with new -Wextra flag H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" - # Append more extra warning flags that only gcc 4.0+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + # Append more extra warning flags that only gcc 4.0+ knows about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" # Append more extra warning flags that only gcc 4.1+ know about H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" @@ -493,8 +493,8 @@ case "$cxx_vendor-$cxx_version" in # Replace old -W flag with new -Wextra flag H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" - # Append more extra warning flags that only gcc4.0+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + # Append more extra warning flags that only gcc4.0+ knows about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" # Append more extra warning flags that only gcc 4.1+ know about H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" @@ -546,7 +546,7 @@ case "$cxx_vendor-$cxx_version" in H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" # Append more extra warning flags that only gcc 4.0+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" # Append more extra warning flags that only gcc 4.1+ know about H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" @@ -595,7 +595,7 @@ case "$cxx_vendor-$cxx_version" in H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" # Append more extra warning flags that only gcc 4.0+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" # Append more extra warning flags that only gcc 4.1+ know about H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations -Wvolatile-register-var" @@ -641,7 +641,7 @@ case "$cxx_vendor-$cxx_version" in H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" # Append more extra warning flags that only gcc 4.0+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" # Append more extra warning flags that only gcc 4.1+ know about H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations -Wvolatile-register-var" @@ -681,7 +681,7 @@ case "$cxx_vendor-$cxx_version" in H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" # Append more extra warning flags that only gcc 4.0+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" # Append more extra warning flags that only gcc 4.1+ know about H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations -Wvolatile-register-var" @@ -718,7 +718,7 @@ case "$cxx_vendor-$cxx_version" in H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" # Append more extra warning flags that only gcc 4.0+ know about - H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" ;; g++-3.4*) -- cgit v0.12 From 53a381894e8a9852b4f8f0e4adb98ba8e04a4f05 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 7 Mar 2016 12:25:46 -0500 Subject: [svn-r29314] Add Java option --- config/cmake/HDF5_Examples.cmake.in | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in index 40e2b32..f80d992 100644 --- a/config/cmake/HDF5_Examples.cmake.in +++ b/config/cmake/HDF5_Examples.cmake.in @@ -14,6 +14,7 @@ set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY}) #CTEST_SOURCE_NAME - name of source folder; HDF4Examples #STATIC_LIBRARIES - Default is YES #FORTRAN_LIBRARIES - Default is NO +#JAVA_LIBRARIES - Default is NO ##NO_MAC_FORTRAN - set to TRUE to allow shared libs on a Mac) if(DEFINED CTEST_SCRIPT_ARG) # transform ctest script arguments of the form @@ -41,6 +42,9 @@ endif() if(NOT DEFINED FORTRAN_LIBRARIES) set(FORTRANLIBRARIES "NO") endif() +if(NOT DEFINED JAVA_LIBRARIES) + set(JAVALIBRARIES "NO") +endif() #TAR_SOURCE - name of tarfile #if(NOT DEFINED TAR_SOURCE) @@ -73,6 +77,11 @@ if(${FORTRANLIBRARIES}) else() set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") endif() +if(${JAVALIBRARIES}) + set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=ON") +else() + set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=OFF") +endif() set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_PACKAGE_NAME:STRING=@HDF5_PACKAGE@@HDF_PACKAGE_EXT@") ############################################################################################################### -- cgit v0.12 From 767520bfe207b05ad9bee7f45353b6c379a167be Mon Sep 17 00:00:00 2001 From: Frank Baker Date: Mon, 7 Mar 2016 15:57:01 -0500 Subject: [svn-r29319] Update COPYING for 2016. --- COPYING | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/COPYING b/COPYING index 8428f33..2166ced 100644 --- a/COPYING +++ b/COPYING @@ -4,7 +4,7 @@ HDF5 (Hierarchical Data Format 5) Software Library and Utilities ----------------------------------------------------------------------------- HDF5 (Hierarchical Data Format 5) Software Library and Utilities -Copyright 2006-2015 by The HDF Group. +Copyright 2006-2016 by The HDF Group. NCSA HDF5 (Hierarchical Data Format 5) Software Library and Utilities Copyright 1998-2006 by the Board of Trustees of the University of Illinois. -- cgit v0.12 From 36c46346060c867d0782043f5f67be12acfc2241 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Mon, 7 Mar 2016 16:02:17 -0500 Subject: [svn-r29322] Purpose: Remove obsoletes Description: Removed obsolete functions from the documentation. They are still in the code, however, until the next two releases, just in case. Platforms tested: Linux/32 2.6 (jam) Linux/64 (platypus) Darwin (osx1010test) --- c++/src/H5Attribute.cpp | 19 +++++++++--------- c++/src/H5CommonFG.cpp | 26 +++++++++++++++---------- c++/src/H5DataSet.cpp | 51 +++++++++++++++++++++++++++++-------------------- c++/src/H5DataSpace.cpp | 13 ++++++++----- c++/src/H5DataType.cpp | 30 +++++++++++++++++------------ c++/src/H5FaccProp.cpp | 41 +++++++++++++++++++++------------------ c++/src/H5File.cpp | 18 +++++++++-------- c++/src/H5StrType.cpp | 21 +++++++++++--------- 8 files changed, 126 insertions(+), 93 deletions(-) diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index a6a8fee..dcb424a 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -451,17 +451,18 @@ ssize_t Attribute::getName(H5std_string& attr_name, size_t len) const } //-------------------------------------------------------------------------- -// Function: Attribute::getName -///\brief This function is replaced by the previous function, which -/// provides more convenient prototype. It will be removed -/// in future release. -///\param len - IN: Desired length of the name -///\param attr_name - OUT: Buffer for the name string -///\return Actual length of the attribute name -///\exception H5::AttributeIException -// Programmer Binh-Minh Ribler - Nov, 2001 +// Function: Attribute::getName +// Purpose This function is replaced by the previous function, which +// provides more convenient prototype. It will be removed +// in future release. +// Param len - IN: Desired length of the name +// Param attr_name - OUT: Buffer for the name string +// Return Actual length of the attribute name +// Exception H5::AttributeIException +// Programmer Binh-Minh Ribler - Nov, 2001 // Modification // Modified to call its replacement. -BMR, 2014/04/16 +// Removed from documentation. -BMR, 2016/03/07 //-------------------------------------------------------------------------- ssize_t Attribute::getName( size_t len, H5std_string& attr_name ) const { diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index 8bb31c4..85a4906 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -496,14 +496,17 @@ void CommonFG::mount(const char* name, const H5File& child, const PropList& plis //-------------------------------------------------------------------------- // Function: CommonFG::mount -///\brief This is an overloaded member function, kept for backward -/// compatibility. It differs from the above function in that it -/// misses const's. This wrapper will be removed in future release. -///\param name - IN: Name of the group -///\param child - IN: File to mount -///\param plist - IN: Property list to use -///\exception H5::FileIException or H5::GroupIException +// Purpose This is an overloaded member function, kept for backward +// compatibility. It differs from the above function in that it +// misses const's. This wrapper will be removed in future release. +// Param name - IN: Name of the group +// Param child - IN: File to mount +// Param plist - IN: Property list to use +// Exception H5::FileIException or H5::GroupIException // Programmer Binh-Minh Ribler - 2000 +// Modification +// Modified to call its replacement. -BMR, 2014/04/16 +// Removed from documentation. -BMR, 2016/03/07 //-------------------------------------------------------------------------- void CommonFG::mount(const char* name, H5File& child, PropList& plist) const { @@ -523,10 +526,13 @@ void CommonFG::mount(const H5std_string& name, const H5File& child, const PropLi //-------------------------------------------------------------------------- // Function: CommonFG::mount -///\brief This is an overloaded member function, kept for backward -/// compatibility. It differs from the above function in that it -/// misses const's. This wrapper will be removed in future release. +// Purpose This is an overloaded member function, kept for backward +// compatibility. It differs from the above function in that it +// misses const's. This wrapper will be removed in future release. // Programmer Binh-Minh Ribler - 2014 +// Modification +// Modified to call its replacement. -BMR, 2014/04/16 +// Removed from documentation. -BMR, 2016/03/07 //-------------------------------------------------------------------------- void CommonFG::mount(const H5std_string& name, H5File& child, PropList& plist) const { diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 3747967..a2e5c74 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -323,12 +323,15 @@ hsize_t DataSet::getVlenBufSize(const DataType& type, const DataSpace& space ) c //-------------------------------------------------------------------------- // Function: DataSet::getVlenBufSize -///\brief This is an overloaded member function, kept for backward -/// compatibility. It differs from the above function in that it -/// misses const's. This wrapper will be removed in future release. -///\return Amount of storage -///\exception H5::DataSetIException +// Purpose This is an overloaded member function, kept for backward +// compatibility. It differs from the above function in that it +// misses const's. This wrapper will be removed in future release. +// Return Amount of storage +// Exception H5::DataSetIException // Programmer Binh-Minh Ribler - 2000 +// Modification +// Modified to call its replacement. -BMR, 2014/04/16 +// Removed from documentation. -BMR, 2016/03/07 //-------------------------------------------------------------------------- hsize_t DataSet::getVlenBufSize( DataType& type, DataSpace& space ) const { @@ -618,16 +621,19 @@ void DataSet::fillMemBuf(const void *fill, const DataType& fill_type, void *buf, //-------------------------------------------------------------------------- // Function: DataSet::fillMemBuf -///\brief This is an overloaded member function, kept for backward -/// compatibility. It differs from the above function in that it -/// misses const's. This wrapper will be removed in future release. -///\param fill - IN: Pointer to fill value to use - default NULL -///\param fill_type - IN: Datatype of the fill value -///\param buf - IN/OUT: Memory buffer to fill selection within -///\param buf_type - IN: Datatype of the elements in buffer -///\param space - IN: Dataspace describing memory buffer & containing selection to use -///\exception H5::DataSetIException +// Purpose This is an overloaded member function, kept for backward +// compatibility. It differs from the above function in that it +// misses const's. This wrapper will be removed in future release. +// Param fill - IN: Pointer to fill value to use - default NULL +// Param fill_type - IN: Datatype of the fill value +// Param buf - IN/OUT: Memory buffer to fill selection within +// Param buf_type - IN: Datatype of the elements in buffer +// Param space - IN: Dataspace describing memory buffer & containing selection to use +// Exception H5::DataSetIException // Programmer Binh-Minh Ribler - 2000 +// Modification +// Modified to call its replacement. -BMR, 2014/04/16 +// Removed from documentation. -BMR, 2016/03/07 //-------------------------------------------------------------------------- void DataSet::fillMemBuf(const void *fill, DataType& fill_type, void *buf, DataType& buf_type, DataSpace& space) { @@ -656,14 +662,17 @@ void DataSet::fillMemBuf(void *buf, const DataType& buf_type, const DataSpace& s //-------------------------------------------------------------------------- // Function: DataSet::fillMemBuf -///\brief This is an overloaded member function, kept for backward -/// compatibility. It differs from the above function in that it -/// misses const's. This wrapper will be removed in future release. -///\param buf - IN/OUT: Memory buffer to fill selection within -///\param buf_type - IN: Datatype of the elements in buffer -///\param space - IN: Dataspace describing memory buffer & containing selection to use -///\exception H5::DataSetIException +// Purpose This is an overloaded member function, kept for backward +// compatibility. It differs from the above function in that it +// misses const's. This wrapper will be removed in future release. +// Param buf - IN/OUT: Memory buffer to fill selection within +// Param buf_type - IN: Datatype of the elements in buffer +// Param space - IN: Dataspace describing memory buffer & containing selection to use +// Exception H5::DataSetIException // Programmer Binh-Minh Ribler - 2000 +// Modification +// Modified to call its replacement. -BMR, 2014/04/16 +// Removed from documentation. -BMR, 2016/03/07 //-------------------------------------------------------------------------- void DataSet::fillMemBuf(void *buf, DataType& buf_type, DataSpace& space) { diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp index 42ac4c7..8ef8791 100644 --- a/c++/src/H5DataSpace.cpp +++ b/c++/src/H5DataSpace.cpp @@ -340,12 +340,15 @@ void DataSpace::extentCopy (const DataSpace& dest_space) const //-------------------------------------------------------------------------- // Function: DataSpace::extentCopy -///\brief This is an overloaded member function, kept for backward -/// compatibility. It differs from the above function in that it -/// misses const. This wrapper will be removed in future release. -///\param dest_space - IN: Dataspace to copy from -///\exception H5::DataSpaceIException +// Purpose This is an overloaded member function, kept for backward +// compatibility. It differs from the above function in that it +// misses const. This wrapper will be removed in future release. +// Param dest_space - IN: Dataspace to copy from +// Exception H5::DataSpaceIException // Programmer Binh-Minh Ribler - 2000 +// Modification +// Modified to call its replacement. -BMR, 2014/04/16 +// Removed from documentation. -BMR, 2016/03/07 //-------------------------------------------------------------------------- void DataSpace::extentCopy( DataSpace& dest_space ) const { diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index 54df7e0..1502033 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -304,13 +304,16 @@ void DataType::commit(const H5Location& loc, const char* name) //-------------------------------------------------------------------------- // Function: DataType::commit -///\brief This is an overloaded member function, kept for backward -/// compatibility. It differs from the above function in that it -/// misses const's. This wrapper will be removed in future release. -///\param loc - IN: A location (file, dataset, datatype, or group) -///\param name - IN: Name of the datatype -///\exception H5::DataTypeIException +// Purpose This is an overloaded member function, kept for backward +// compatibility. It differs from the above function in that it +// misses const's. This wrapper will be removed in future release. +// Param loc - IN: A location (file, dataset, datatype, or group) +// Param name - IN: Name of the datatype +// Exception H5::DataTypeIException // Programmer Binh-Minh Ribler - Jan, 2007 +// Modification +// Planned for removal. -BMR, 2014/04/16 +// Removed from documentation. -BMR, 2016/03/07 //-------------------------------------------------------------------------- void DataType::commit(H5Location& loc, const char* name) { @@ -331,13 +334,16 @@ void DataType::commit(const H5Location& loc, const H5std_string& name) //-------------------------------------------------------------------------- // Function: DataType::commit -///\brief This is an overloaded member function, kept for backward -/// compatibility. It differs from the above function in that it -/// misses const's. This wrapper will be removed in future release. -///\param loc - IN: A location (file, dataset, datatype, or group) -///\param name - IN: Name of the datatype -///\exception H5::DataTypeIException +// Purpose This is an overloaded member function, kept for backward +// compatibility. It differs from the above function in that it +// misses const's. This wrapper will be removed in future release. +// Param loc - IN: A location (file, dataset, datatype, or group) +// Param name - IN: Name of the datatype +// Exception H5::DataTypeIException // Programmer Binh-Minh Ribler - Jan, 2007 +// Modification +// Planned for removal. -BMR, 2014/04/16 +// Removed from documentation. -BMR, 2016/03/07 //-------------------------------------------------------------------------- void DataType::commit(H5Location& loc, const H5std_string& name) { diff --git a/c++/src/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp index d3d7811..d8b06f2 100644 --- a/c++/src/H5FaccProp.cpp +++ b/c++/src/H5FaccProp.cpp @@ -330,16 +330,18 @@ void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccP //-------------------------------------------------------------------------- // Function: FileAccPropList::setSplit -///\brief This is an overloaded member function, kept for backward -/// compatibility. It differs from the above function in that it -/// misses const's. This wrapper will be removed in future release. -///\param meta_plist - IN: File access plist for the metadata file -///\param raw_plist - IN: File access plist for the raw data file -///\param meta_ext - IN: Metadata filename extension as \c char* -///\param raw_ext - IN: Raw data filename extension as \c char* -///\exception H5::PropListIException +// Purpose This is an overloaded member function, kept for backward +// compatibility. It differs from the above function in that it +// misses const's. This wrapper will be removed in future release. +// Param meta_plist - IN: File access plist for the metadata file +// Param raw_plist - IN: File access plist for the raw data file +// Param meta_ext - IN: Metadata filename extension as \c char* +// Param raw_ext - IN: Raw data filename extension as \c char* +// Exception H5::PropListIException // Programmer: Binh-Minh Ribler - April, 2004 -// Note: Retiring April, 2014 +// Modification +// Planned for removal. -BMR, 2014/04/16 +// Removed from documentation. -BMR, 2016/03/07 //-------------------------------------------------------------------------- void FileAccPropList::setSplit(FileAccPropList& meta_plist, FileAccPropList& raw_plist, const char* meta_ext, const char* raw_ext ) const { @@ -364,16 +366,17 @@ void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccP //-------------------------------------------------------------------------- // Function: FileAccPropList::setSplit -///\brief This is an overloaded member function, kept for backward -/// compatibility. It differs from the above function in that it -/// misses const's. This wrapper will be removed in future release. -///\param meta_plist - IN: File access plist for the metadata file -///\param raw_plist - IN: File access plist for the raw data file -///\param meta_ext - IN: Metadata filename extension as \c string -///\param raw_ext - IN: Raw data filename extension as \c string -///\exception H5::PropListIException -// Programmer: Binh-Minh Ribler - April, 2004 -// Note: Retiring April, 2014 +// Purpose This is an overloaded member function, kept for backward +// compatibility. It differs from the above function in that it +// misses const's. This wrapper will be removed in future release. +// Param meta_plist - IN: File access plist for the metadata file +// Param raw_plist - IN: File access plist for the raw data file +// Param meta_ext - IN: Metadata filename extension as \c char* +// Param raw_ext - IN: Raw data filename extension as \c char* +// Exception H5::PropListIException +// Modification +// Planned for removal. -BMR, 2014/04/16 +// Removed from documentation. -BMR, 2016/03/07 //-------------------------------------------------------------------------- void FileAccPropList::setSplit(FileAccPropList& meta_plist, FileAccPropList& raw_plist, const H5std_string& meta_ext, const H5std_string& raw_ext ) const { diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index b169472..67dda34 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -467,15 +467,17 @@ void H5File::getVFDHandle(const FileAccPropList& fapl, void **file_handle) const //-------------------------------------------------------------------------- // Function: H5File::getVFDHandle -///\brief This is an overloaded member function, kept for backward -/// compatibility. It differs from the above function in that it -/// misses const. This wrapper will be removed in future release. -///\param fapl - File access property list -///\param file_handle - Pointer to the file handle being used by -/// the low-level virtual file driver -///\exception H5::FileIException +// Purpose This is an overloaded member function, kept for backward +// compatibility. It differs from the above function in that it +// misses const's. This wrapper will be removed in future release. +// Param fapl - File access property list +// Param file_handle - Pointer to the file handle being used by +// the low-level virtual file driver +// Exception H5::FileIException // Programmer Binh-Minh Ribler - May 2004 -// Note: Retiring April, 2014 +// Modification +// Planned for removal. -BMR, 2014/04/16 +// Removed from documentation. -BMR, 2016/03/07 //-------------------------------------------------------------------------- void H5File::getVFDHandle(FileAccPropList& fapl, void **file_handle) const { diff --git a/c++/src/H5StrType.cpp b/c++/src/H5StrType.cpp index b067746..3cfa342 100644 --- a/c++/src/H5StrType.cpp +++ b/c++/src/H5StrType.cpp @@ -58,10 +58,10 @@ StrType::StrType( const PredType& pred_type ) : AtomType() //-------------------------------------------------------------------------- // Function: StrType overloaded constructor -///\brief Creates a string datatype with a specified length -///\param pred_type - IN: String predefined type to replicate. -///\param size - IN: Length of the new string type -///\exception H5::DataTypeIException +// Purpose Creates a string datatype with a specified length +// Param pred_type - IN: String predefined type to replicate. +// Param size - IN: Length of the new string type +// Exception H5::DataTypeIException // Description // The 1st argument could have been skipped, but this // constructor will collide with the one that takes an @@ -71,10 +71,13 @@ StrType::StrType( const PredType& pred_type ) : AtomType() // avoid the clashing problem, that doesn't eliminate the // the 1st argument but it's simpler for the user to type // a '0' than PredType::C_S1. - Dec 2, 2005 -///\note -/// The use of this constructor can be shortened by using -/// its overloaded below as StrType(0, size). +// Note +// The use of this constructor can be shortened by using +// its overloaded below as StrType(0, size). // Programmer Binh-Minh Ribler - 2000 +// Modification +// Planned for removal. -BMR, 2005/12/02 +// Removed from documentation. -BMR, 2016/03/07 //-------------------------------------------------------------------------- StrType::StrType( const PredType& pred_type, const size_t& size ) : AtomType() { @@ -96,8 +99,8 @@ StrType::StrType( const PredType& pred_type, const size_t& size ) : AtomType() /// previous constructor, such as: /// StrType atype(0, size) instead of /// StrType atype(PredType::C_S1, size) -///\note -/// This constructor may replace the previous one in the future. +// Note +// This constructor replaced the previous one. // Programmer Binh-Minh Ribler - Nov 28, 2005 //-------------------------------------------------------------------------- StrType::StrType( const int dummy, const size_t& size ) : AtomType() -- cgit v0.12 From b99b5d494e4aa86901d7a68d4a31de96d11c83c7 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 7 Mar 2016 16:35:51 -0500 Subject: [svn-r29325] Removed -Wmissing-declarations from the gnu C++ flags. It's not used for C++. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial w/ C++ --- config/gnu-cxxflags | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/gnu-cxxflags b/config/gnu-cxxflags index 9d72b8f..befaa32 100644 --- a/config/gnu-cxxflags +++ b/config/gnu-cxxflags @@ -94,7 +94,7 @@ case "$cxx_vendor-$cxx_version" in esac # General (copied from H5_CFLAGS) - H5_CXXFLAGS="$H5_CXXFLAGS $arch -pedantic -Wall -W -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wmissing-declarations -Wredundant-decls -Winline" + H5_CXXFLAGS="$H5_CXXFLAGS $arch -pedantic -Wall -W -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wredundant-decls -Winline" # C++-specific H5_CXXFLAGS="$H5_CXXFLAGS -Wsign-promo -Woverloaded-virtual -Wold-style-cast -Weffc++ -Wreorder -Wnon-virtual-dtor -Wctor-dtor-privacy -Wabi" -- cgit v0.12 From 2c36685010638e6bfcdd4ec74194cd200081668b Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Mon, 7 Mar 2016 17:03:57 -0500 Subject: [svn-r29326] HDFFV-9536: Changed H5check_version() to use libtool shared library version numbers instead of the library version numbers. bin/h5vers: Changed to copy the shared lib version from lt_vers.am to H5public.h (Thanks to Larry who made the changes.) config/lt_vers.am: cosmetic change, nothing material. src/H5public.h: Changed by bin/h5vers. src/H5.c: Changed H5check_version() to use shared library version for compatibility checking. test/tcheck_version.c: test/testcheck_version.sh.in: Changed to use shared library version numbers instead of the HDF5 library version numbers for testing. Tested: tested in Jam (C only), platypus and osx1010dev (enable fortran and C++). --- bin/h5vers | 60 +++++++++++++------- config/lt_vers.am | 2 +- src/H5.c | 130 +++++++++++++++++++++++++++++++++++++++++++ src/H5public.h | 15 ++++- test/tcheck_version.c | 26 ++++----- test/testcheck_version.sh.in | 57 +++++++++++-------- 6 files changed, 230 insertions(+), 60 deletions(-) diff --git a/bin/h5vers b/bin/h5vers index 7e61dc8..9a0fa59 100755 --- a/bin/h5vers +++ b/bin/h5vers @@ -105,6 +105,13 @@ sub setvers { $vers[3]?"-":"", $vers[3])/me; } +sub setltvers { + my ($contents, @vers) = @_; + $_[0] =~ s/^(\#\s*define\s+LT_VERS_INTERFACE\s+)\d+/$1$vers[0]/m; + $_[0] =~ s/^(\#\s*define\s+LT_VERS_REVISION\s+)\d+/$1$vers[1]/m; + $_[0] =~ s/^(\#\s*define\s+LT_VERS_AGE\s+)\d+/$1$vers[2]/m; +} + sub usage { my ($prog) = $0 =~ /([^\/]+)$/; print STDERR < $version_increased="true"; } +my @newltver; +# Update the libtool shared library version in src/H5public.h +if ($LT_VERS) { + open FILE, $LT_VERS or die "$LT_VERS: $!\n"; + my ($contentsy) = join "", ; + close FILE; + + local($_) = $contentsy; + + # Don't increment LT_VERS_REVISION, but instead copy LT_VERS_* values + # to H5public.h. + # my ($lt_revision) = /^LT_VERS_REVISION\s*=\s*(\d+)/m; + # my $new_lt_revision = $lt_revision+1; + # ($contentsy) =~ s/^(LT_VERS_REVISION\s*=\s*)\d+/$1$new_lt_revision/m; + + # open FILE, ">$LT_VERS" or die "$LT_VERS: $!\n"; + # print FILE $contentsy; + # close FILE; + + my ($lt_interface) = /^LT_VERS_INTERFACE\s*=\s*(\d+)/m; + my ($lt_revision) = /^LT_VERS_REVISION\s*=\s*(\d+)/m; + my ($lt_age) = /^LT_VERS_AGE\s*=\s*(\d+)/m; + + @newltver = ($lt_interface, $lt_revision, $lt_age); + +} + # Update the version number if it changed. if ($newver[0]!=$curver[0] || $newver[1]!=$curver[1] || $newver[2]!=$curver[2] || $newver[3]ne$curver[3]) { setvers $contents, @newver or die "unable to set version\n"; +} + setltvers $contents, @newltver or die "unable to set lt version\n"; rename $file, "$file~" or die "unable to save backup file\n"; open FILE, ">$file" or die "unable to open $file but backup saved!\n"; print FILE $contents; close FILE; -} - -# Update the libtool shared library version in src/Makefile.am if -# the version number has increased. -if ($LT_VERS && $version_increased) { - open FILE, $LT_VERS or die "$LT_VERS: $!\n"; - my ($contentsy) = join "", ; - close FILE; - - local($_) = $contentsy; - - my ($lt_revision) = /^LT_VERS_REVISION\s*=\s*(\d+)/m; - my $new_lt_revision = $lt_revision+1; - ($contentsy) =~ s/^(LT_VERS_REVISION\s*=\s*)\d+/$1$new_lt_revision/m; - - open FILE, ">$LT_VERS" or die "$LT_VERS: $!\n"; - print FILE $contentsy; - close FILE; -} # Update the README.txt file if ($README) { @@ -436,6 +453,9 @@ if ($verbose) { $newver[3] eq "" ? "" : "-".$newver[3]); } +# print shared lib version in the format of interface.revision.age +printf("Shared lib version %d.%d.%d\n", @newltver[0,1,2]); + exit 0; # Because the first line of this file looks like a Bourne shell script, we diff --git a/config/lt_vers.am b/config/lt_vers.am index a3b7634..c5e5112 100644 --- a/config/lt_vers.am +++ b/config/lt_vers.am @@ -19,8 +19,8 @@ # After making changes, run bin/reconfigure to update other configure related # files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 224 LT_VERS_AGE = 0 +LT_VERS_REVISION = 224 ## If the API changes *at all*, increment LT_VERS_INTERFACE and ## reset LT_VERS_REVISION to 0. diff --git a/src/H5.c b/src/H5.c index 41fb3ba..acbdecb 100644 --- a/src/H5.c +++ b/src/H5.c @@ -720,6 +720,9 @@ done: } /* end H5get_libversion() */ +/* Depreciated by H5check_interface_compatibility. Need to keep it around + * because Fortran API calls it. Will be retired later. + */ /*------------------------------------------------------------------------- * Function: H5check_version * @@ -855,6 +858,133 @@ done: /*------------------------------------------------------------------------- + * Function: H5check_interface_compatibility + * + * Purpose: Verifies that the arguments are compatible with the link library. + * This function is intended to be called from user to verify that + * the versions of header files compiled into the application + * is compatible with the version of the link hdf5 library. + * + * Return: Success: SUCCEED + * + * Failure: abort() + * The value of the environment variable, + * HDF5_DISABLE_VERSION_CHECK, could affect + * how failure is handles. See Code below. + * + * Algorithm: {provided by Mike McGreevy} + * How to determine if two libraries, given their interface, revision, + * and age, are compatible? Let's say you have: + * + * interface, revision, age --> compiled HDF5 + * INTERFACE, REVISION, AGE --> linked HDF5 library + * Then: + * if ((INTERFACE-AGE) != (interface-age)) + * not compatible + * else + * if (age <= AGE) + * compatible + * else + * not compatible + * endif + * endif + * [Note: revision/REVISION do not affect compatibility] + * + * Programmer: Albert Cheng + * Feb 21, 2016 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +#define INTERFACE_INCOMPATIBLE_WARNING \ +"Warning! ***HDF5 interface incompatibility detected***\n" \ +"The HDF5 header files used to compile this application are not compatible \n" \ +"with the HDF5 library to which this application is linked.\n" \ +"Data corruption or segmentation faults may occur if the application continues.\n" \ +"This can happen when an application was compiled by one version of HDF5 but\n" \ +"linked with a different version of static or shared HDF5 library.\n" \ +"You should recompile the application or check your shared library related\n" \ +"settings such as 'LD_LIBRARY_PATH'.\n" + +herr_t +H5check_interface_compatibility(unsigned interface, unsigned age, unsigned revision) +{ + char lib_str[256]; + static int checked = 0; /* If we've already checked the version info */ + static unsigned int disable_version_check = 0; /* Set if the version check should be disabled */ + static const char *interface_incompatible_warning = INTERFACE_INCOMPATIBLE_WARNING; + const char *s; /* Environment string for disabling version check */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT_NOERR_NOFS + H5TRACE3("e", "IuIuIu", interface, age, revision); + + assert(interface >= age); + assert(LT_VERS_INTERFACE >= LT_VERS_AGE); + + /* Optimization: Don't check again, if we already have */ + if (checked) + HGOTO_DONE(SUCCEED) + else + /* Indicate that the version check has been performed */ + checked++; + + /* check version compatibility */ + if (((LT_VERS_INTERFACE - LT_VERS_AGE) == (interface - age)) &&\ + (LT_VERS_AGE >= age)) + HGOTO_DONE(SUCCEED) + /* else NOT COMPATIBLE */ + + /* Allow different handling of not compatible */ + s = HDgetenv ("HDF5_DISABLE_VERSION_CHECK"); + if (s && HDisdigit(*s)) + disable_version_check = (unsigned int)HDstrtol (s, NULL, 0); + + /* check the version of the link library */ + switch (disable_version_check) { + case 0: + /* print a message and abort */ + HDfprintf(stderr, "%s%s", interface_incompatible_warning, + "You can, at your own risk, disable this warning by setting the environment\n" + "variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'.\n" + "Setting it to 2 or higher will suppress the warning messages totally.\n"); + /* Mention the versions we are referring to */ + HDfprintf (stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n", + (interface-age), age, revision, + ((unsigned)LT_VERS_INTERFACE-(unsigned)LT_VERS_AGE), (unsigned)LT_VERS_AGE, (unsigned)LT_VERS_REVISION); + /* Show library settings if available */ + HDfprintf (stderr, "%s", H5libhdf5_settings); + + /* Bail out now. */ + HDfputs ("Bye...\n", stderr); + HDabort (); + case 1: + /* continue with a warning */ + /* Note that the warning message is embedded in the format string.*/ + HDfprintf (stderr, + "%s'HDF5_DISABLE_VERSION_CHECK' " + "environment variable is set to %d, application will\n" + "continue at your own risk.\n", + interface_incompatible_warning, disable_version_check); + /* Mention the versions we are referring to */ + HDfprintf (stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n", + (interface-age), age, revision, + ((unsigned)LT_VERS_INTERFACE-(unsigned)LT_VERS_AGE), (unsigned)LT_VERS_AGE, (unsigned)LT_VERS_REVISION); + /* Show library settings if available */ + HDfprintf (stderr, "%s", H5libhdf5_settings); + break; + default: + /* 2 or higher: continue silently */ + break; + } /* end switch */ + +done: + FUNC_LEAVE_API_NOFS(ret_value) +} /* end H5check_version() */ + + +/*------------------------------------------------------------------------- * Function: H5open * * Purpose: Initialize the library. This is normally called diff --git a/src/H5public.h b/src/H5public.h index 554ad26..3cfe42c 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -99,8 +99,12 @@ extern "C" { /* Empty string for real releases. */ #define H5_VERS_INFO "HDF5 library version: 1.9.234" /* Full version string */ -#define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ - H5_VERS_RELEASE) +/* LT Version numbers */ +#define LT_VERS_INTERFACE 6 +#define LT_VERS_AGE 0 +#define LT_VERS_REVISION 224 + +#define H5check() H5check_interface_compatibility(LT_VERS_INTERFACE, LT_VERS_AGE, LT_VERS_REVISION) /* macros for comparing the version */ #define H5_VERSION_GE(Maj,Min,Rel) \ @@ -343,8 +347,13 @@ H5_DLL herr_t H5set_free_list_limits (int reg_global_lim, int reg_list_lim, int blk_list_lim); H5_DLL herr_t H5get_libversion(unsigned *majnum, unsigned *minnum, unsigned *relnum); +/* Deprecated by H5check_interface_compatibility. Need to keep it because + * Fortran API calls it. To be retired later. + */ H5_DLL herr_t H5check_version(unsigned majnum, unsigned minnum, - unsigned relnum); + unsigned relnum); +H5_DLL herr_t H5check_interface_compatibility(unsigned interface, unsigned age, \ + unsigned revision); H5_DLL herr_t H5is_library_threadsafe(hbool_t *is_ts); H5_DLL herr_t H5free_memory(void *mem); H5_DLL void *H5allocate_memory(size_t size, hbool_t clear); diff --git a/test/tcheck_version.c b/test/tcheck_version.c index a75d642..48d5523 100644 --- a/test/tcheck_version.c +++ b/test/tcheck_version.c @@ -39,9 +39,9 @@ void parse(int ac, char **av); void abort_intercept (int H5_ATTR_UNUSED sig); /* global variables */ -unsigned major = H5_VERS_MAJOR; -unsigned minor = H5_VERS_MINOR; -unsigned release = H5_VERS_RELEASE; +unsigned interface = LT_VERS_INTERFACE; +unsigned revision = LT_VERS_REVISION; +unsigned age = LT_VERS_AGE; void showhelp(void) @@ -50,9 +50,9 @@ showhelp(void) printf("\t-h\tShow this page and version information\n"); printf("\t-t: Test by changing (adding 1 to) the to trigger\n"); printf("\t\t the warning. can be:\n"); - printf("\t\t\tM for Major version number (%d)\n", H5_VERS_MAJOR); - printf("\t\t\tm for Minor version number (%d)\n", H5_VERS_MINOR); - printf("\t\t\tr for Release number (%d)\n", H5_VERS_RELEASE); + printf("\t\t\tI for Interface number (%d)\n", LT_VERS_INTERFACE); + printf("\t\t\tA for Age number (%d)\n", LT_VERS_AGE); + printf("\t\t\tR for Revision number (%d)\n", LT_VERS_REVISION); } @@ -70,14 +70,14 @@ parse(int ac, char **av) switch(*(++pt)) { case 't': /* option -t */ switch(*(++pt)) { - case 'M': - major++; + case 'I': + interface++; break; - case 'm': - minor++; + case 'R': + revision++; break; - case 'r': - release++; + case 'A': + age++; break; default: fprintf(stderr, "Unknown -v parameter (%s). Aborted.\n", *av); @@ -115,7 +115,7 @@ main(int ac, char **av) { parse(ac, av); HDsignal(SIGABRT, &abort_intercept); - H5check_version(major, minor, release); + H5check_interface_compatibility(interface, age, revision); HDsignal(SIGABRT, SIG_DFL); return 0; } diff --git a/test/testcheck_version.sh.in b/test/testcheck_version.sh.in index ed9845e..f696d9b 100644 --- a/test/testcheck_version.sh.in +++ b/test/testcheck_version.sh.in @@ -58,18 +58,19 @@ SKIP() { # Print warning message of version mismatch. WarnMesg(){ - echo "Warning! ***HDF5 library version mismatched error***" - echo "The HDF5 header files used to compile this application do not match" - echo "the version used by the HDF5 library to which this application is linked." + echo "Warning! ***HDF5 interface incompatibility detected***" + echo "The HDF5 header files used to compile this application are not compatible " + echo "with the HDF5 library to which this application is linked." echo "Data corruption or segmentation faults may occur if the application continues." echo "This can happen when an application was compiled by one version of HDF5 but" echo "linked with a different version of static or shared HDF5 library." echo "You should recompile the application or check your shared library related" echo "settings such as 'LD_LIBRARY_PATH'." + echo "You can, at your own risk, disable this warning by setting the environment" echo "variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'." echo "Setting it to 2 or higher will suppress the warning messages totally." - echo "Headers are $xxh5versmajor.$xxh5versminor.$xxh5versrelease, library is $h5versmajor.$h5versminor.$h5versrelease" + echo "Headers are $xxh5vers_interface_age.$xxh5vers_age.$xxh5vers_revision, library is $h5vers_interface_age.$h5vers_age.$h5vers_revision" test -n "$H5_HAVE_EMBEDDED_LIBINFO" && cat $h5libsettings echo "Bye..." } @@ -77,17 +78,18 @@ WarnMesg(){ # Print warning message2 of version mismatch. WarnMesg2(){ - echo "Warning! ***HDF5 library version mismatched error***" - echo "The HDF5 header files used to compile this application do not match" - echo "the version used by the HDF5 library to which this application is linked." + echo "Warning! ***HDF5 interface incompatibility detected***" + echo "The HDF5 header files used to compile this application are not compatible " + echo "with the HDF5 library to which this application is linked." echo "Data corruption or segmentation faults may occur if the application continues." echo "This can happen when an application was compiled by one version of HDF5 but" echo "linked with a different version of static or shared HDF5 library." echo "You should recompile the application or check your shared library related" echo "settings such as 'LD_LIBRARY_PATH'." + echo "'HDF5_DISABLE_VERSION_CHECK' environment variable is set to 1, application will" echo "continue at your own risk." - echo "Headers are $xxh5versmajor.$xxh5versminor.$xxh5versrelease, library is $h5versmajor.$h5versminor.$h5versrelease" + echo "Headers are $xxh5vers_interface_age.$xxh5vers_age.$xxh5vers_revision, library is $h5vers_interface_age.$h5vers_age.$h5vers_revision" test -n "$H5_HAVE_EMBEDDED_LIBINFO" && cat $h5libsettings } @@ -127,9 +129,10 @@ TESTING() { h5DisableVersion="$1" wrongversionnumbers="$2" - xxh5versmajor=$h5versmajor - xxh5versminor=$h5versminor - xxh5versrelease=$h5versrelease + xxh5vers_interface=$h5vers_interface + xxh5vers_age=$h5vers_age + xxh5vers_revision=$h5vers_revision + xxh5vers_interface_age=`expr $xxh5vers_interface - $xxh5vers_age` if [ "$h5DisableVersion" = unset ]; then envcmd="" # noop @@ -145,13 +148,14 @@ TESTING() { arguments=-t"$wrongversionnumbers" # calculate mismatched version numbers by listing. case $wrongversionnumbers in - "M") xxh5versmajor=`expr $h5versmajor + 1` + "I") xxh5vers_interface=`expr $h5vers_interface + 1` ;; - "m") xxh5versminor=`expr $h5versminor + 1` + "A") xxh5vers_age=`expr $h5vers_age + 1` ;; - "r") xxh5versrelease=`expr $h5versrelease + 1` + "R") xxh5vers_revision=`expr $h5vers_revision + 1` ;; esac + xxh5vers_interface_age=`expr $xxh5vers_interface - $xxh5vers_age` case "$h5DisableVersion" in 1) # W2/OK: Different Warning, exit 0. @@ -218,15 +222,22 @@ h5libsettings=../src/libhdf5.settings PURPOSE # Figure out library version numbers from the header file. -h5versmajor=`grep '#define H5_VERS_MAJOR' $srcdir/../src/H5public.h | cut -f2` -h5versminor=`grep '#define H5_VERS_MINOR' $srcdir/../src/H5public.h | cut -f2` -h5versrelease=`grep '#define H5_VERS_RELEASE' $srcdir/../src/H5public.h | cut -f2` -DEBUGPRINT $h5versmajor.$h5versminor.$h5versrelease -case "$h5versmajor$h5versminor$h5versrelease" in +h5vers_interface=`grep '#define LT_VERS_INTERFACE' ../../hdf5/src/H5public.h | sed -e s/[^0-9]//g` +#echo h5vers_interface=$h5vers_interface +h5vers_revision=`grep '#define LT_VERS_REVISION' $srcdir/../src/H5public.h | sed -e s/[^0-9]//g` +#echo h5vers_revision=$h5vers_revision +h5vers_age=`grep '#define LT_VERS_AGE' $srcdir/../src/H5public.h | sed -e s/[^0-9]//g` +#echo h5vers_age=$h5vers_age +h5vers_interface_age=`expr $h5vers_interface - $h5vers_age` +#h5vers_interface=`grep '#define LT_VERS_INTERFACE' $srcdir/../src/H5public.h | cut -f2` +#h5vers_revision=`grep '#define LT_VERS_REVISION' $srcdir/../src/H5public.h | cut -f2` +#h5vers_age=`grep '#define LT_VERS_AGE' $srcdir/../src/H5public.h | cut -f2` +DEBUGPRINT $h5vers_interface.$h5vers_revision.$h5vers_age +case "$h5vers_interface$h5vers_revision$h5vers_age" in [0-9]*) # good. noop. ;; *) - echo "Illegal library version numbers($h5versmajor.$h5versminor.$h5versrelease)" + echo "Illegal library version numbers($h5vers_interface.$h5vers_revision.$h5vers_age)" echo "Test aborted" exit 1 ;; @@ -241,13 +252,13 @@ fi # Three Categories of tests: # Normal: where the version numbers all matched (wrong_version == none). -# Mismatched version numbers (could be Major or minor version -# or release numbers or a combination of all three.) +# Mismatched version numbers (could be Interface or Age versions; +# revision makes no differences in link compatibility check.) # Test all the above with different values of the environment variable, # HDF5_DISABLE_VERSION_CHECK, as unset, "", -1, 0, 1, 2, 3 for val_disable_version_check in unset "" -1 0 1 2 3; do - for wrong_version in none M m r; do + for wrong_version in none I A; do TESTING "$val_disable_version_check" "$wrong_version" done done -- cgit v0.12 From b18aaf39f0a9c530d570acf206710d2aa158953e Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 7 Mar 2016 22:27:46 -0500 Subject: [svn-r29332] Removed -Wunreachable-code from the gnu C++ flags. This flag generates a large number of spurious warnings in our code so we've disabled it for now. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial w/ C++ --- config/gnu-cxxflags | 67 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 39 insertions(+), 28 deletions(-) diff --git a/config/gnu-cxxflags b/config/gnu-cxxflags index befaa32..52f46dd 100644 --- a/config/gnu-cxxflags +++ b/config/gnu-cxxflags @@ -175,8 +175,9 @@ case "$cxx_vendor-$cxx_version" in # in -Wall H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" - # The "unreachable code" warning appears to be reliable now... - H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + # The "unreachable code" flag generates many spurious C++ warnings. + # We'll disable it for now. + #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" # Append warning flags from gcc-3.3* case H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" @@ -243,8 +244,9 @@ case "$cxx_vendor-$cxx_version" in # in -Wall H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" - # The "unreachable code" warning appears to be reliable now... - H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + # The "unreachable code" flag generates many spurious C++ warnings. + # We'll disable it for now. + #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" # Append warning flags from gcc 3.3* case H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" @@ -306,8 +308,9 @@ case "$cxx_vendor-$cxx_version" in # in -Wall H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" - # The "unreachable code" warning appears to be reliable now... - H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + # The "unreachable code" flag generates many spurious C++ warnings. + # We'll disable it for now. + #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" # Append warning flags from gcc-3.3* case H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" @@ -365,8 +368,8 @@ case "$cxx_vendor-$cxx_version" in # in -Wall H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" - # The "unreachable code" warning appears to be reliable now... - # (this warning was removed in gcc 4.5+) + # The "unreachable code" flag generates many spurious C++ warnings. + # We'll disable it for now. #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" # Append warning flags from gcc-3.3* case @@ -424,8 +427,8 @@ case "$cxx_vendor-$cxx_version" in # in -Wall H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" - # The "unreachable code" warning appears to be reliable now... - # (this warning was removed in gcc 4.5+) + # The "unreachable code" flag generates many spurious C++ warnings. + # We'll disable it for now. #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" # Append warning flags from gcc-3.3* case @@ -480,8 +483,8 @@ case "$cxx_vendor-$cxx_version" in # in -Wall H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" - # The "unreachable code" warning appears to be reliable now... - # (this warning was removed in gcc 4.5+) + # The "unreachable code" flag generates many spurious C++ warnings. + # We'll disable it for now. #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" # Append warning flags from gcc-3.3* case @@ -533,8 +536,9 @@ case "$cxx_vendor-$cxx_version" in # in -Wall H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" - # The "unreachable code" warning appears to be reliable now... - H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + # The "unreachable code" flag generates many spurious C++ warnings. + # We'll disable it for now. + #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" # Append warning flags from gcc-3.3* case H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" @@ -582,8 +586,9 @@ case "$cxx_vendor-$cxx_version" in # in -Wall H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" - # The "unreachable code" warning appears to be reliable now... - H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + # The "unreachable code" flag generates many spurious C++ warnings. + # We'll disable it for now. + #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" # Append warning flags from gcc-3.3* case H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" @@ -628,8 +633,9 @@ case "$cxx_vendor-$cxx_version" in # in -Wall H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" - # The "unreachable code" warning does not appear to be reliable yet... - H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + # The "unreachable code" flag generates many spurious C++ warnings. + # We'll disable it for now. + #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" # Append warning flags from gcc-3.3* case H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" @@ -668,8 +674,9 @@ case "$cxx_vendor-$cxx_version" in # in -Wall H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" - # The "unreachable code" warning does not appear to be reliable yet... - H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + # The "unreachable code" flag generates many spurious C++ warnings. + # We'll disable it for now. + #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" # Append warning flags from gcc-3.3* case H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" @@ -705,8 +712,9 @@ case "$cxx_vendor-$cxx_version" in # usage in the library. #CXXFLAGS="$CXXFLAGS -Wformat=2" - # The "unreachable code" warning does not appear to be reliable yet... - #CXXFLAGS="$CXXFLAGS -Wunreachable-code" + # The "unreachable code" flag generates many spurious C++ warnings. + # We'll disable it for now. + #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" # Append warning flags from gcc-3.3* case H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" @@ -739,8 +747,9 @@ case "$cxx_vendor-$cxx_version" in # usage in the library. #CXXFLAGS="$CXXFLAGS -Wformat=2" - # The "unreachable code" warning does not appear to be reliable yet... - #CXXFLAGS="$CXXFLAGS -Wunreachable-code" + # The "unreachable code" flag generates many spurious C++ warnings. + # We'll disable it for now. + #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" # Append warning flags from gcc-3.3* case H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" @@ -770,8 +779,9 @@ case "$cxx_vendor-$cxx_version" in # usage in the library. #CXXFLAGS="$CXXFLAGS -Wformat=2" - # The "unreachable code" warning does not appear to be reliable yet... - #CXXFLAGS="$CXXFLAGS -Wunreachable-code" + # The "unreachable code" flag generates many spurious C++ warnings. + # We'll disable it for now. + #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" # Append more extra warning flags that only gcc3.3+ know about H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" @@ -795,8 +805,9 @@ case "$cxx_vendor-$cxx_version" in # usage in the library. #CXXFLAGS="$CXXFLAGS -Wformat=2" - # The "unreachable code" warning does not appear to be reliable yet... - #CXXFLAGS="$CXXFLAGS -Wunreachable-code" + # The "unreachable code" flag generates many spurious C++ warnings. + # We'll disable it for now. + #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" ;; g++-3*) -- cgit v0.12 From a1035bd80624807b3ed31a67575a68f577c0e48c Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 8 Mar 2016 01:38:33 -0500 Subject: [svn-r29336] Removed unused variables from Fortran code. Updated gnu Fortran flags. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial w/ Fortran --- config/gnu-fflags | 2 +- fortran/src/H5_buildiface.F90 | 7 ------- fortran/src/H5f90global.F90 | 1 - fortran/test/H5_test_buildiface.F90 | 31 ------------------------------- fortran/test/tH5D.F90 | 1 - fortran/test/tH5F_F03.F90 | 2 +- fortran/test/tH5P_F03.F90 | 5 +---- hl/fortran/src/H5HL_buildiface.F90 | 7 ------- 8 files changed, 3 insertions(+), 53 deletions(-) diff --git a/config/gnu-fflags b/config/gnu-fflags index 62498a9..4585735 100644 --- a/config/gnu-fflags +++ b/config/gnu-fflags @@ -76,7 +76,7 @@ if test "X-gfortran" = "X-$f9x_vendor"; then FC_BASENAME=gfortran40 F9XSUFFIXFLAG="" FSEARCH_DIRS="" - H5_FCFLAGS="$H5_FCFLAGS -pedantic -Wall -Wconversion -Wunderflow -Wimplicit-interface -W" + H5_FCFLAGS="$H5_FCFLAGS -pedantic -Wall -Wextra -Wunderflow -Wimplicit-interface -Wsurprising" # Turn off warnings for passing non-ANSI types to BIND(). # We pass a lot of hid_t, etc. types so this generates a LOT of spurious warnings. diff --git a/fortran/src/H5_buildiface.F90 b/fortran/src/H5_buildiface.F90 index d58b384..bd6ecc3 100644 --- a/fortran/src/H5_buildiface.F90 +++ b/fortran/src/H5_buildiface.F90 @@ -60,13 +60,6 @@ PROGRAM H5_buildiface H5_H5CONFIG_F_IKIND INTEGER :: i, j, k - INTEGER :: ji, jr, jd -#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE - REAL(KIND=C_LONG_DOUBLE) :: c_longdble -#endif - REAL(KIND=C_DOUBLE) :: c_dble - REAL(KIND=C_FLOAT) :: c_flt - INTEGER :: sizeof_var CHARACTER(LEN=2) :: chr2 ! subroutine rank of array being passed in CHARACTER(LEN=2), DIMENSION(1:8), PARAMETER :: chr_rank=(/"_0","_1","_2","_3","_4","_5","_6","_7"/) diff --git a/fortran/src/H5f90global.F90 b/fortran/src/H5f90global.F90 index ac59251..eb7f99f 100644 --- a/fortran/src/H5f90global.F90 +++ b/fortran/src/H5f90global.F90 @@ -1008,7 +1008,6 @@ CONTAINS IMPLICIT NONE CHARACTER(LEN=*), INTENT(IN) :: f_string CHARACTER(KIND=C_CHAR, LEN=*), INTENT(OUT) :: c_string - INTEGER(SIZE_T) :: c_len, f_len c_string = TRIM(f_string)//C_NULL_CHAR diff --git a/fortran/test/H5_test_buildiface.F90 b/fortran/test/H5_test_buildiface.F90 index e0323cc..8b27a96 100644 --- a/fortran/test/H5_test_buildiface.F90 +++ b/fortran/test/H5_test_buildiface.F90 @@ -60,38 +60,7 @@ PROGRAM H5_test_buildiface H5_H5CONFIG_F_IKIND INTEGER :: i, j, k - INTEGER :: ji, jr, jd -#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE - REAL(KIND=C_LONG_DOUBLE) :: c_longdble -#endif - REAL(KIND=C_DOUBLE) :: c_dble - REAL(KIND=C_FLOAT) :: c_flt - INTEGER :: sizeof_var CHARACTER(LEN=2) :: chr2 -! subroutine rank of array being passed in - CHARACTER(LEN=2), DIMENSION(1:8), PARAMETER :: chr_rank=(/"_0","_1","_2","_3","_4","_5","_6","_7"/) -! rank definitions - CHARACTER(LEN=70), DIMENSION(1:8), PARAMETER :: rank_dim_line=(/ & - ' ', & - ', DIMENSION(dims(1)) ', & - ', DIMENSION(dims(1),dims(2)) ', & - ', DIMENSION(dims(1),dims(2),dims(3)) ', & - ', DIMENSION(dims(1),dims(2),dims(3),dims(4)) ', & - ', DIMENSION(dims(1),dims(2),dims(3),dims(4),dims(5)) ', & - ', DIMENSION(dims(1),dims(2),dims(3),dims(4),dims(5),dims(6)) ', & - ', DIMENSION(dims(1),dims(2),dims(3),dims(4),dims(5),dims(6),dims(7))' & - /) -! pointer to the buffer - CHARACTER(LEN=37), DIMENSION(1:8), PARAMETER :: f_ptr_line=(/ & - ' f_ptr = C_LOC(buf) ', & - ' f_ptr = C_LOC(buf(1)) ', & - ' f_ptr = C_LOC(buf(1,1)) ', & - ' f_ptr = C_LOC(buf(1,1,1)) ', & - ' f_ptr = C_LOC(buf(1,1,1,1)) ', & - ' f_ptr = C_LOC(buf(1,1,1,1,1)) ', & - ' f_ptr = C_LOC(buf(1,1,1,1,1,1)) ', & - ' f_ptr = C_LOC(buf(1,1,1,1,1,1,1))' & - /) ! Generate Fortran Check routines for the tests KIND interfaces. diff --git a/fortran/test/tH5D.F90 b/fortran/test/tH5D.F90 index c9ba952..849f5eb 100644 --- a/fortran/test/tH5D.F90 +++ b/fortran/test/tH5D.F90 @@ -530,7 +530,6 @@ CONTAINS INTEGER(hid_t) :: file, fcpl, dataset, space INTEGER :: i, j, n, ios INTEGER(hsize_t), DIMENSION(1:2) :: dims - INTEGER :: f INTEGER(haddr_t) :: offset INTEGER, DIMENSION(1:dset_dim1,1:dset_dim2), TARGET :: rdata, data_in INTEGER :: error diff --git a/fortran/test/tH5F_F03.F90 b/fortran/test/tH5F_F03.F90 index 2425bba..e70c1aa 100644 --- a/fortran/test/tH5F_F03.F90 +++ b/fortran/test/tH5F_F03.F90 @@ -62,7 +62,7 @@ SUBROUTINE test_get_file_image(total_error) INTEGER(hid_t) :: dset_id = -1 ! Dataset identifier INTEGER(hid_t) :: space_id = -1 ! Dataspace identifier INTEGER(hsize_t), DIMENSION(1:2) :: dims ! Dataset dimensions - INTEGER(size_t) :: itmp_a, itmp_b ! General purpose integers + INTEGER(size_t) :: itmp_a ! General purpose integer INTEGER(size_t) :: image_size ! Size of image TYPE(C_PTR) :: f_ptr ! Pointer INTEGER(hid_t) :: fapl ! File access property diff --git a/fortran/test/tH5P_F03.F90 b/fortran/test/tH5P_F03.F90 index f64c4e3..18af36b 100644 --- a/fortran/test/tH5P_F03.F90 +++ b/fortran/test/tH5P_F03.F90 @@ -110,7 +110,6 @@ SUBROUTINE test_create(total_error) INTEGER :: error INTEGER(SIZE_T) :: h5off TYPE(C_PTR) :: f_ptr - LOGICAL :: differ1, differ2 CHARACTER(LEN=1) :: cfill INTEGER :: ifill REAL :: rfill @@ -679,14 +678,13 @@ SUBROUTINE test_vds(total_error) INTEGER(hsize_t), DIMENSION(1:2,1:3) :: vdsdims_out_correct INTEGER(hsize_t), DIMENSION(1:3) :: start_out, & !Hyperslab PARAMETER out - stride_out, count_out, count_correct, block_out + stride_out, count_out, block_out INTEGER(hsize_t), DIMENSION(1:3,1:PLANE_STRIDE) :: start_correct INTEGER :: i, j INTEGER :: layout ! Storage layout INTEGER(size_t) :: num_map ! Number of mappings INTEGER(size_t) :: len ! Length of the string also a RETURN value - CHARACTER(LEN=180) :: filename ! Different sized character buffers CHARACTER(len=LEN(SRC_FILE(1))-3) :: SRC_FILE_LEN_TINY CHARACTER(len=LEN(SRC_FILE(1))-1) :: SRC_FILE_LEN_SMALL @@ -700,7 +698,6 @@ SUBROUTINE test_vds(total_error) INTEGER :: s_type, virtual_view INTEGER :: type1, type2 - CHARACTER(LEN=180) :: dsetname INTEGER, DIMENSION(DIM0_1*DIM1*DIM2), TARGET :: wdata TYPE(C_PTR) :: f_ptr INTEGER(SIZE_T) :: nsize diff --git a/hl/fortran/src/H5HL_buildiface.F90 b/hl/fortran/src/H5HL_buildiface.F90 index 9dd879c..15897c3 100644 --- a/hl/fortran/src/H5HL_buildiface.F90 +++ b/hl/fortran/src/H5HL_buildiface.F90 @@ -60,13 +60,6 @@ PROGRAM H5HL_buildiface H5_H5CONFIG_F_IKIND INTEGER :: i, j, k - INTEGER :: ji, jr, jd -#ifdef H5_FORTRAN_HAVE_C_LONG_DOUBLE - REAL(KIND=C_LONG_DOUBLE) :: c_longdble -#endif - REAL(KIND=C_DOUBLE) :: c_dble - REAL(KIND=C_FLOAT) :: c_flt - INTEGER :: sizeof_var CHARACTER(LEN=2) :: chr2 ! subroutine rank of array being passed in CHARACTER(LEN=2), DIMENSION(1:8), PARAMETER :: chr_rank=(/"_0","_1","_2","_3","_4","_5","_6","_7"/) -- cgit v0.12 From 1b7b09b08104f05a65a0269c5c88a342dba8e972 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 8 Mar 2016 02:34:43 -0500 Subject: [svn-r29337] Cleaning warnings in Fortran code. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial w/ Fortran --- fortran/src/H5match_types.c | 4 ++-- hl/fortran/test/tstlite.F90 | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/fortran/src/H5match_types.c b/fortran/src/H5match_types.c index f995e83..98128db 100644 --- a/fortran/src/H5match_types.c +++ b/fortran/src/H5match_types.c @@ -52,7 +52,7 @@ FILE * fort_header; void writeTypedef(const char* c_typedef, const char* c_type, int size); void writeTypedefDefault(const char* c_typedef, int size); void writeToFiles(const char* c_typedef, const char* fortran_type, const char* c_type, int size, int kind); -void writeToFilesChr(const char* c_typedef, const char* fortran_type, const char* c_type, int size, char* kind); +void writeToFilesChr(const char* c_typedef, const char* fortran_type, const char* c_type, int size, const char* kind); static void initCfile(void) @@ -140,7 +140,7 @@ void writeToFiles(const char* c_typedef, const char* fortran_type, const char* c fprintf(fort_header, " INTEGER, PARAMETER :: %s = %u\n", fortran_type, kind); fprintf(c_header, "typedef c_%s_%d %s;\n", c_typedef, size, c_type); } -void writeToFilesChr(const char* c_typedef, const char* fortran_type, const char* c_type, int size, char* kind) +void writeToFilesChr(const char* c_typedef, const char* fortran_type, const char* c_type, int size, const char* kind) { fprintf(fort_header, " INTEGER, PARAMETER :: %s = %s\n", fortran_type, kind); fprintf(c_header, "typedef c_%s_%d %s;\n", c_typedef, size, c_type); diff --git a/hl/fortran/test/tstlite.F90 b/hl/fortran/test/tstlite.F90 index 0ba7815..081e61e 100644 --- a/hl/fortran/test/tstlite.F90 +++ b/hl/fortran/test/tstlite.F90 @@ -418,7 +418,6 @@ SUBROUTINE test_dataset3D() #if H5_HAVE_Fortran_INTEGER_SIZEOF_16!=0 INTEGER, PARAMETER :: int_kind_32 = SELECTED_INT_KIND(36) !should map to INTEGER*16 on most modern processors INTEGER(int_kind_32), DIMENSION(DIM1,DIM2,DIM3), TARGET :: dset_data_i32, data_out_i32 - INTEGER(HID_T) :: dset_id32 ! Dataset identifier CHARACTER(LEN=7), PARAMETER :: dsetname16a = "dset16a" ! Dataset name CHARACTER(LEN=7), PARAMETER :: dsetname16b = "dset16b" ! Dataset name CHARACTER(LEN=7), PARAMETER :: dsetname16c = "dset16c" ! Dataset name @@ -760,7 +759,6 @@ SUBROUTINE test_datasetND(rank) INTEGER :: type_class INTEGER(SIZE_T) :: type_size CHARACTER(LEN=1) :: ichr1 - CHARACTER(LEN=3) :: ichr3 TYPE(C_PTR) :: f_ptr INTEGER(HID_T) :: type_id -- cgit v0.12 From 116eed3ebd48bd96292af786a09bb67c124bb3e9 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Tue, 8 Mar 2016 07:23:54 -0500 Subject: =?UTF-8?q?[svn-r29340]=20Purpose:=20Code=20cleanup=20Description:?= =?UTF-8?q?=20=20=20=20=20-=20Removed=20many=20warnings:=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20warning:=20use=20of=20old-style=20cast=20=20=20=20=20?= =?UTF-8?q?=20=20=20=20warning:=20enumeration=20value=20=E2=80=98H5D=5FVIR?= =?UTF-8?q?TUAL=E2=80=99=20not=20handled=20in=20switch=20=20=20=20=20=20?= =?UTF-8?q?=20=20=20warning:=20comparison=20between=20signed=20and=20unsig?= =?UTF-8?q?ned=20=20=20=20=20=20=20There=20are=20others=20of=20the=20same?= =?UTF-8?q?=20warnings=20and=20they=20will=20be=20taken=20care=20of=20=20?= =?UTF-8?q?=20=20=20=20=20in=20the=20next=20release.=20=20=20=20=20-=20Mad?= =?UTF-8?q?e=20some=20code=20reuse=20between=20overloads=20Platforms=20tes?= =?UTF-8?q?ted:=20=20=20=20=20Linux/32=202.6=20(jam)=20=20=20=20=20Linux/6?= =?UTF-8?q?4=20(platypus)=20=20=20=20=20Darwin=20(osx1010test)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- c++/src/H5ArrayType.cpp | 5 +--- c++/src/H5Attribute.cpp | 2 +- c++/src/H5CommonFG.cpp | 73 +++++++++++++++++++++++++------------------------ c++/src/H5DataSet.cpp | 3 +- c++/src/H5DataSpace.cpp | 2 +- c++/src/H5DataType.cpp | 6 ++-- c++/src/H5FaccProp.cpp | 4 +-- c++/src/H5Location.cpp | 10 +++---- c++/src/H5Object.cpp | 2 +- c++/src/H5PropList.cpp | 2 +- c++/test/dsets.cpp | 56 ++++++++++++++++++------------------- c++/test/h5cpputil.cpp | 2 +- 12 files changed, 84 insertions(+), 83 deletions(-) diff --git a/c++/src/H5ArrayType.cpp b/c++/src/H5ArrayType.cpp index 5792467..9731a13 100644 --- a/c++/src/H5ArrayType.cpp +++ b/c++/src/H5ArrayType.cpp @@ -54,11 +54,8 @@ ArrayType::ArrayType( const hid_t existing_id ) : DataType( existing_id ) ///\brief Copy constructor: makes a copy of the original ArrayType object. // Programmer Binh-Minh Ribler - May 2004 //-------------------------------------------------------------------------- -ArrayType::ArrayType( const ArrayType& original ) : DataType( original ) +ArrayType::ArrayType( const ArrayType& original ) : DataType( original ), rank(original.rank) { - // Copy the rank of the original array - rank = original.rank; - // Allocate space then copy the dimensions from the original array dimensions = new hsize_t[rank]; for (int i = 0; i < rank; i++) diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index dcb424a..34489fa 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -567,7 +567,7 @@ void Attribute::p_read_fixed_len(const DataType& mem_type, H5std_string& strg) c // If there is data, allocate buffer and read it. if (attr_size > 0) { - char *strg_C = new char[(size_t)attr_size+1]; + char *strg_C = new char[attr_size+1]; herr_t ret_value = H5Aread(id, mem_type.getId(), strg_C); if( ret_value < 0 ) { diff --git a/c++/src/H5CommonFG.cpp b/c++/src/H5CommonFG.cpp index 85a4906..339af54 100644 --- a/c++/src/H5CommonFG.cpp +++ b/c++/src/H5CommonFG.cpp @@ -68,21 +68,21 @@ using namespace std; /// then a default size is chosen. // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Group CommonFG::createGroup( const char* name, size_t size_hint ) const + Group CommonFG::createGroup( const char* name, size_t size_hint ) const { - // Group creation property list for size_hint - hid_t gcpl_id = 0; - - // Set the local heap size hint - if(!(size_hint == (size_t)-1 || size_hint == 0)) { + // Group creation property list for size hint + hid_t gcpl_id = 0; + // Set the local heap size hint + if (size_hint > 0) + { // If the creation of the property list failed, throw an exception - if((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) + if ((gcpl_id = H5Pcreate(H5P_GROUP_CREATE)) < 0) throwException("createGroup", "H5Pcreate failed"); - if( H5Pset_local_heap_size_hint(gcpl_id, size_hint) < 0) { + if (H5Pset_local_heap_size_hint(gcpl_id, size_hint) < 0) { H5Pclose(gcpl_id); - throwException("createGroup", "H5Pset_local_heap_size failed"); + throwException("createGroup", "H5Pset_local_heap_size_hint failed"); } } @@ -269,6 +269,9 @@ void CommonFG::link( H5L_type_t link_type, const char* curr_name, const char* ne ret_value = H5Lcreate_soft( curr_name, getLocId(), new_name, H5P_DEFAULT, H5P_DEFAULT ); break; + case H5L_TYPE_ERROR: + case H5L_TYPE_EXTERNAL: + case H5L_TYPE_MAX: default: throwException("link", "unknown link type"); break; @@ -510,7 +513,7 @@ void CommonFG::mount(const char* name, const H5File& child, const PropList& plis //-------------------------------------------------------------------------- void CommonFG::mount(const char* name, H5File& child, PropList& plist) const { - mount(name, (const H5File)child, (const PropList)plist); + mount(name, child, plist); } //-------------------------------------------------------------------------- @@ -536,7 +539,7 @@ void CommonFG::mount(const H5std_string& name, const H5File& child, const PropLi //-------------------------------------------------------------------------- void CommonFG::mount(const H5std_string& name, H5File& child, PropList& plist) const { - mount(name.c_str(), (const H5File)child, (const PropList)plist); + mount(name.c_str(), child, plist); } //-------------------------------------------------------------------------- @@ -1040,6 +1043,8 @@ H5O_type_t CommonFG::childObjType(const char* objname) const case H5O_TYPE_NAMED_DATATYPE: objtype = objinfo.type; break; + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: default: throwException("childObjType", "Unknown type of object"); } @@ -1113,6 +1118,8 @@ H5O_type_t CommonFG::childObjType(hsize_t index, H5_index_t index_type, H5_iter_ case H5O_TYPE_NAMED_DATATYPE: objtype = objinfo.type; break; + case H5O_TYPE_UNKNOWN: + case H5O_TYPE_NTYPES: default: throwException("childObjType", "Unknown type of object"); } @@ -1201,21 +1208,13 @@ H5G_obj_t CommonFG::getObjTypeByIdx(hsize_t idx) const ///\return Object type ///\exception H5::FileIException or H5::GroupIException // Programmer Binh-Minh Ribler - May, 2010 +// Modification +// Modified to use the other function. -BMR, 2016/03/07 //-------------------------------------------------------------------------- H5G_obj_t CommonFG::getObjTypeByIdx(hsize_t idx, char* type_name) const { - H5G_obj_t obj_type = H5Gget_objtype_by_idx(getLocId(), idx); - switch (obj_type) - { - case H5G_LINK: HDstrcpy(type_name, "symbolic link"); break; - case H5G_GROUP: HDstrcpy(type_name, "group"); break; - case H5G_DATASET: HDstrcpy(type_name, "dataset"); break; - case H5G_TYPE: HDstrcpy(type_name, "datatype"); break; - case H5G_UNKNOWN: - default: - throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed"); - } - return (obj_type); + H5std_string stype_name(type_name); + return(getObjTypeByIdx(idx, stype_name)); } //-------------------------------------------------------------------------- // Function: CommonFG::getObjTypeByIdx @@ -1230,18 +1229,22 @@ H5G_obj_t CommonFG::getObjTypeByIdx(hsize_t idx, char* type_name) const //-------------------------------------------------------------------------- H5G_obj_t CommonFG::getObjTypeByIdx(hsize_t idx, H5std_string& type_name) const { - H5G_obj_t obj_type = H5Gget_objtype_by_idx(getLocId(), idx); - switch (obj_type) - { - case H5G_LINK: type_name = H5std_string("symbolic link"); break; - case H5G_GROUP: type_name = H5std_string("group"); break; - case H5G_DATASET: type_name = H5std_string("dataset"); break; - case H5G_TYPE: type_name = H5std_string("datatype"); break; - case H5G_UNKNOWN: - default: - throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed"); - } - return (obj_type); + H5G_obj_t obj_type = H5Gget_objtype_by_idx(getLocId(), idx); + switch (obj_type) + { + case H5G_LINK: type_name = H5std_string("symbolic link"); break; + case H5G_GROUP: type_name = H5std_string("group"); break; + case H5G_DATASET: type_name = H5std_string("dataset"); break; + case H5G_TYPE: type_name = H5std_string("datatype"); break; + case H5G_UNKNOWN: + case H5G_UDLINK: + case H5G_RESERVED_5: + case H5G_RESERVED_6: + case H5G_RESERVED_7: + default: + throwException("getObjTypeByIdx", "H5Gget_objtype_by_idx failed"); + } + return (obj_type); } #endif // DOXYGEN_SHOULD_SKIP_THIS diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index a2e5c74..c5ecf0a 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -335,7 +335,8 @@ hsize_t DataSet::getVlenBufSize(const DataType& type, const DataSpace& space ) c //-------------------------------------------------------------------------- hsize_t DataSet::getVlenBufSize( DataType& type, DataSpace& space ) const { - return(getVlenBufSize((const DataType)type, (const DataSpace)space)); + return(getVlenBufSize(type, space)); + //return(getVlenBufSize(static_cast(type), static_cast(space))); } //-------------------------------------------------------------------------- diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp index 8ef8791..690f328 100644 --- a/c++/src/H5DataSpace.cpp +++ b/c++/src/H5DataSpace.cpp @@ -352,7 +352,7 @@ void DataSpace::extentCopy (const DataSpace& dest_space) const //-------------------------------------------------------------------------- void DataSpace::extentCopy( DataSpace& dest_space ) const { - extentCopy((const DataSpace)dest_space); + extentCopy(dest_space); } //-------------------------------------------------------------------------- diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index 1502033..3e5ad0f 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -362,10 +362,10 @@ void DataType::commit(H5Location& loc, const H5std_string& name) bool DataType::committed() const { // Call C function to determine if a datatype is a named one - htri_t committed = H5Tcommitted( id ); - if( committed > 0 ) + htri_t is_committed = H5Tcommitted( id ); + if (is_committed > 0) return true; - else if( committed == 0 ) + else if (is_committed == 0) return false; else { diff --git a/c++/src/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp index d8b06f2..c284500 100644 --- a/c++/src/H5FaccProp.cpp +++ b/c++/src/H5FaccProp.cpp @@ -345,7 +345,7 @@ void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccP //-------------------------------------------------------------------------- void FileAccPropList::setSplit(FileAccPropList& meta_plist, FileAccPropList& raw_plist, const char* meta_ext, const char* raw_ext ) const { - setSplit((const FileAccPropList)meta_plist, (const FileAccPropList)raw_plist, meta_ext, raw_ext); + setSplit(meta_plist, raw_plist, meta_ext, raw_ext); } //-------------------------------------------------------------------------- @@ -380,7 +380,7 @@ void FileAccPropList::setSplit(const FileAccPropList& meta_plist, const FileAccP //-------------------------------------------------------------------------- void FileAccPropList::setSplit(FileAccPropList& meta_plist, FileAccPropList& raw_plist, const H5std_string& meta_ext, const H5std_string& raw_ext ) const { - setSplit((const FileAccPropList)meta_plist, (const FileAccPropList)raw_plist, meta_ext.c_str(), raw_ext.c_str() ); + setSplit(meta_plist, raw_plist, meta_ext.c_str(), raw_ext.c_str() ); } // Stream Virtual File Driver had been removed from the main library. diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index b4c88ed..337aa6f 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -190,7 +190,7 @@ Attribute H5Location::openAttribute( const H5std_string& name ) const Attribute H5Location::openAttribute( const unsigned int idx ) const { hid_t attr_id = H5Aopen_by_idx(getId(), ".", H5_INDEX_CRT_ORDER, - H5_ITER_INC, (hsize_t)idx, H5P_DEFAULT, H5P_DEFAULT); + H5_ITER_INC, static_cast(idx), H5P_DEFAULT, H5P_DEFAULT); if( attr_id > 0 ) { Attribute attr; @@ -232,7 +232,7 @@ int H5Location::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_ // call the C library routine H5Aiterate2 to iterate the attributes hsize_t idx = _idx ? (hsize_t)*_idx : 0; int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, - userAttrOpWrpr, (void *) userData); + userAttrOpWrpr, static_cast(userData)); // release memory delete userData; @@ -240,7 +240,7 @@ int H5Location::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_ if( ret_value >= 0 ) { /* Pass back update index value to calling code */ if (_idx) - *_idx = (unsigned)idx; + *_idx = static_cast(idx); return( ret_value ); } @@ -262,7 +262,7 @@ int H5Location::getNumAttrs() const if(H5Oget_info(getId(), &oinfo) < 0) throw AttributeIException(inMemFunc("getNumAttrs"), "H5Oget_info failed"); else - return( (int)oinfo.num_attrs ); + return(static_cast(oinfo.num_attrs)); } //-------------------------------------------------------------------------- @@ -517,7 +517,7 @@ ssize_t H5Location::getComment(const char* name, size_t buf_size, char* comment) } // If the comment is longer than the provided buffer size, the C library // will not null terminate it - if ((size_t)comment_len >= buf_size) + if (static_cast(comment_len) >= buf_size) comment[buf_size-1] = '\0'; // Return the actual comment length, which might be different from buf_size diff --git a/c++/src/H5Object.cpp b/c++/src/H5Object.cpp index 35e34b5..3cce9fe 100644 --- a/c++/src/H5Object.cpp +++ b/c++/src/H5Object.cpp @@ -109,7 +109,7 @@ H5std_string H5Object::getObjName() const H5std_string obj_name(""); // object name to return // Preliminary call to get the size of the object name - ssize_t name_size = H5Iget_name(getId(), NULL, (size_t)0); + ssize_t name_size = H5Iget_name(getId(), NULL, static_cast(0)); // If H5Iget_name failed, throw exception if (name_size < 0) diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index 81bb023..b954191 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -592,7 +592,7 @@ void PropList::setProperty(const char* name, void* value) const //-------------------------------------------------------------------------- void PropList::setProperty(const char* name, const char* charptr) const { - herr_t ret_value = H5Pset(id, name, (void*) charptr); + herr_t ret_value = H5Pset(id, name, (void*)charptr); if (ret_value < 0) { throw PropListIException(inMemFunc("setProperty"), "H5Pset failed"); diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index e57e50e..1837d17 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -246,10 +246,10 @@ test_simple_io( H5File& file) DataSet dataset (file.createDataSet (DSET_SIMPLE_IO_NAME, PredType::NATIVE_INT, space)); // Write the data to the dataset - dataset.write ((void*) points, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset.write (static_cast(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); // Read the dataset back - dataset.read ((void*) check, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset.read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); // Check that the values read are the same as the values written for (i = 0; i < 100; i++) @@ -395,10 +395,10 @@ test_tconv( H5File& file) DataSet dataset (file.createDataSet (DSET_TCONV_NAME, PredType::STD_I32LE, space)); // Write the data to the dataset - dataset.write ((void*) out, PredType::STD_I32LE); + dataset.write (static_cast(out), PredType::STD_I32LE); // Read data with byte order conversion - dataset.read ((void*) in, PredType::STD_I32BE); + dataset.read (static_cast(in), PredType::STD_I32BE); // Check for (int i = 0; i < 1000000; i++) { @@ -501,7 +501,7 @@ test_compression(H5File& file) for (i = n = 0; i < 100; i++) { for (j = 0; j < 200; j++) { - points[i][j] = (int)n++; + points[i][j] = static_cast(n++); } } char* tconv_buf = new char [1000]; @@ -539,15 +539,15 @@ test_compression(H5File& file) */ SUBTEST("Compression (uninitialized read)"); - dataset->read ((void*) check, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); for (i=0; i(i) << "," << + static_cast(j) << endl; throw Exception("test_compression", "Failed in uninitialized read"); } } @@ -565,11 +565,11 @@ test_compression(H5File& file) { for (j=0; j(n++); } } - dataset->write ((void*) points, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->write (static_cast(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); PASSED(); @@ -580,7 +580,7 @@ test_compression(H5File& file) SUBTEST("Compression (read)"); // Read the dataset back - dataset->read ((void*)check, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); // Check that the values read are the same as the values written for (i = 0; i < size[0]; i++) @@ -609,10 +609,10 @@ test_compression(H5File& file) points[i][j] = rand (); } } - dataset->write ((void*)points, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->write (static_cast(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); // Read the dataset back and check it - dataset->read ((void*)check, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); // Check that the values read are the same as the values written for (i = 0; i < size[0]; i++) @@ -637,7 +637,7 @@ test_compression(H5File& file) delete dataset; dataset = new DataSet (file.openDataSet (DSET_COMPRESS_NAME)); - dataset->read ((void*)check, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); // Check that the values read are the same as the values written for (i = 0; i < size[0]; i++) @@ -667,8 +667,8 @@ test_compression(H5File& file) } } space1.selectHyperslab( H5S_SELECT_SET, hs_size, hs_offset ); - dataset->write ((void*)points, PredType::NATIVE_INT, space1, space1, xfer); - dataset->read ((void*)check, PredType::NATIVE_INT, space1, space1, xfer); + dataset->write (static_cast(points), PredType::NATIVE_INT, space1, space1, xfer); + dataset->read (static_cast(check), PredType::NATIVE_INT, space1, space1, xfer); // Check that the values read are the same as the values written for (i=0; i((hs_offset[0]+i)) << + "," << static_cast((hs_offset[1]+j)) << endl; - cerr << " At original: " << (int)points[hs_offset[0]+i][hs_offset[1]+j] << endl; - cerr << " At returned: " << (int)check[hs_offset[0]+i][hs_offset[1]+j] << endl; + cerr << " At original: " << static_cast(points[hs_offset[0]+i][hs_offset[1]+j]) << endl; + cerr << " At returned: " << static_cast(check[hs_offset[0]+i][hs_offset[1]+j]) << endl; throw Exception("test_compression", "Failed in partial I/O"); } } // for j @@ -714,8 +714,8 @@ test_compression(H5File& file) DataSpace space2 (2, size, NULL); dataset = new DataSet (file.createDataSet (DSET_BOGUS_NAME, PredType::NATIVE_INT, space2, dscreatplist)); - dataset->write ((void*)points, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); - dataset->read ((void*)check, PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->write (static_cast(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); // Check that the values read are the same as the values written for (i = 0; i < size[0]; i++) @@ -812,8 +812,8 @@ test_multiopen (H5File& file) space->getSimpleExtentDims (tmp_size); if (cur_size[0]!=tmp_size[0]) { - cerr << " Got " << (int)tmp_size[0] << " instead of " - << (int)cur_size[0] << "!" << endl; + cerr << " Got " << static_cast(tmp_size[0]) << " instead of " + << static_cast(cur_size[0]) << "!" << endl; throw Exception("test_multiopen", "Failed in multi-open with extending"); } @@ -897,7 +897,7 @@ test_types(H5File& file) // Fill buffer for (i=0; i(0xff) ^ static_cast(i); // Write data from buf using all default dataspaces and property list dset->write (buf, type); @@ -926,7 +926,7 @@ test_types(H5File& file) // Fill buffer for (i=0; i(0xff) ^ static_cast(i); // Write data from buf using all default dataspaces and property // list; if writing fails, deallocate dset and return. @@ -959,7 +959,7 @@ test_types(H5File& file) // Fill buffer for (i=0; i(0xff) ^ static_cast(i); // Write data from buf using all default dataspaces and property // list; if writing fails, deallocate dset and return. @@ -992,7 +992,7 @@ test_types(H5File& file) // Fill buffer for (i=0; i(0xff) ^ static_cast(i); // Write data from buf using all default dataspaces and property // list; if writing fails, deallocate dset and return. diff --git a/c++/test/h5cpputil.cpp b/c++/test/h5cpputil.cpp index 40e81cc..9bbb183 100644 --- a/c++/test/h5cpputil.cpp +++ b/c++/test/h5cpputil.cpp @@ -195,7 +195,7 @@ void verify_val(const char* x, const char* value, const char* where, int line, c cerr << "*** UNEXPECTED VALUE from " << where << " should be " << value << ", but is " << x << " at line " << line << " in " << file_name << endl; - IncTestNumErrs(); + //IncTestNumErrs(); throw TestFailedException(where, ""); } } -- cgit v0.12 From 273a4a0ba0cb2516a197771fc7b47394243c7d00 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Tue, 8 Mar 2016 07:39:57 -0500 Subject: [svn-r29341] Correct path to source code in line 227. Tested change on emu, moohan, platypus, and quail. --- test/testcheck_version.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/testcheck_version.sh.in b/test/testcheck_version.sh.in index f696d9b..5c89c04 100644 --- a/test/testcheck_version.sh.in +++ b/test/testcheck_version.sh.in @@ -222,7 +222,7 @@ h5libsettings=../src/libhdf5.settings PURPOSE # Figure out library version numbers from the header file. -h5vers_interface=`grep '#define LT_VERS_INTERFACE' ../../hdf5/src/H5public.h | sed -e s/[^0-9]//g` +h5vers_interface=`grep '#define LT_VERS_INTERFACE' $srcdir/../src/H5public.h | sed -e s/[^0-9]//g` #echo h5vers_interface=$h5vers_interface h5vers_revision=`grep '#define LT_VERS_REVISION' $srcdir/../src/H5public.h | sed -e s/[^0-9]//g` #echo h5vers_revision=$h5vers_revision -- cgit v0.12 From 3fabbf45f05855665da16e699e420a756d024a2c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 8 Mar 2016 12:18:17 -0500 Subject: [svn-r29348] Correct script process for options --- config/cmake/HDF5_Examples.cmake.in | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/config/cmake/HDF5_Examples.cmake.in b/config/cmake/HDF5_Examples.cmake.in index f80d992..3dce88e 100644 --- a/config/cmake/HDF5_Examples.cmake.in +++ b/config/cmake/HDF5_Examples.cmake.in @@ -38,12 +38,18 @@ if(NOT DEFINED CTEST_SOURCE_NAME) endif() if(NOT DEFINED STATIC_LIBRARIES) set(STATICLIBRARIES "YES") +else(NOT DEFINED STATIC_LIBRARIES) + set(STATICLIBRARIES "NO") endif() if(NOT DEFINED FORTRAN_LIBRARIES) set(FORTRANLIBRARIES "NO") +else(NOT DEFINED FORTRAN_LIBRARIES) + set(FORTRANLIBRARIES "YES") endif() if(NOT DEFINED JAVA_LIBRARIES) set(JAVALIBRARIES "NO") +else(NOT DEFINED JAVA_LIBRARIES) + set(JAVALIBRARIES "YES") endif() #TAR_SOURCE - name of tarfile @@ -73,14 +79,14 @@ else(WIN32) set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") endif(WIN32) if(${FORTRANLIBRARIES}) - set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON") + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON") else() - set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") endif() if(${JAVALIBRARIES}) - set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=ON") + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=ON") else() - set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=OFF") + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=OFF") endif() set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_PACKAGE_NAME:STRING=@HDF5_PACKAGE@@HDF_PACKAGE_EXT@") -- cgit v0.12 From d380f20a0d4ada972da1fa667e5faa04cf6e2221 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Tue, 8 Mar 2016 12:49:38 -0500 Subject: [svn-r29350] Revert h5check_version change to check LT_VERS_XXXX numbers rather than HDF5 library version numbers. Svn revisions reverted: 29341, 29326 Branch features/h5check_version was created for further development. Files changed test/tcheck_version.c test/testcheck_version.sh.in src/H5public.h src/H5.c config/lt_vers.am bin/h5vers Tested with h5committest.new --- bin/h5vers | 60 +++++++------------- config/lt_vers.am | 2 +- src/H5.c | 130 ------------------------------------------- src/H5public.h | 15 +---- test/tcheck_version.c | 26 ++++----- test/testcheck_version.sh.in | 57 ++++++++----------- 6 files changed, 60 insertions(+), 230 deletions(-) diff --git a/bin/h5vers b/bin/h5vers index 9a0fa59..7e61dc8 100755 --- a/bin/h5vers +++ b/bin/h5vers @@ -105,13 +105,6 @@ sub setvers { $vers[3]?"-":"", $vers[3])/me; } -sub setltvers { - my ($contents, @vers) = @_; - $_[0] =~ s/^(\#\s*define\s+LT_VERS_INTERFACE\s+)\d+/$1$vers[0]/m; - $_[0] =~ s/^(\#\s*define\s+LT_VERS_REVISION\s+)\d+/$1$vers[1]/m; - $_[0] =~ s/^(\#\s*define\s+LT_VERS_AGE\s+)\d+/$1$vers[2]/m; -} - sub usage { my ($prog) = $0 =~ /([^\/]+)$/; print STDERR < $version_increased="true"; } -my @newltver; -# Update the libtool shared library version in src/H5public.h -if ($LT_VERS) { - open FILE, $LT_VERS or die "$LT_VERS: $!\n"; - my ($contentsy) = join "", ; - close FILE; - - local($_) = $contentsy; - - # Don't increment LT_VERS_REVISION, but instead copy LT_VERS_* values - # to H5public.h. - # my ($lt_revision) = /^LT_VERS_REVISION\s*=\s*(\d+)/m; - # my $new_lt_revision = $lt_revision+1; - # ($contentsy) =~ s/^(LT_VERS_REVISION\s*=\s*)\d+/$1$new_lt_revision/m; - - # open FILE, ">$LT_VERS" or die "$LT_VERS: $!\n"; - # print FILE $contentsy; - # close FILE; - - my ($lt_interface) = /^LT_VERS_INTERFACE\s*=\s*(\d+)/m; - my ($lt_revision) = /^LT_VERS_REVISION\s*=\s*(\d+)/m; - my ($lt_age) = /^LT_VERS_AGE\s*=\s*(\d+)/m; - - @newltver = ($lt_interface, $lt_revision, $lt_age); - -} - # Update the version number if it changed. if ($newver[0]!=$curver[0] || $newver[1]!=$curver[1] || $newver[2]!=$curver[2] || $newver[3]ne$curver[3]) { setvers $contents, @newver or die "unable to set version\n"; -} - setltvers $contents, @newltver or die "unable to set lt version\n"; rename $file, "$file~" or die "unable to save backup file\n"; open FILE, ">$file" or die "unable to open $file but backup saved!\n"; print FILE $contents; close FILE; +} + +# Update the libtool shared library version in src/Makefile.am if +# the version number has increased. +if ($LT_VERS && $version_increased) { + open FILE, $LT_VERS or die "$LT_VERS: $!\n"; + my ($contentsy) = join "", ; + close FILE; + + local($_) = $contentsy; + + my ($lt_revision) = /^LT_VERS_REVISION\s*=\s*(\d+)/m; + my $new_lt_revision = $lt_revision+1; + ($contentsy) =~ s/^(LT_VERS_REVISION\s*=\s*)\d+/$1$new_lt_revision/m; + + open FILE, ">$LT_VERS" or die "$LT_VERS: $!\n"; + print FILE $contentsy; + close FILE; +} # Update the README.txt file if ($README) { @@ -453,9 +436,6 @@ if ($verbose) { $newver[3] eq "" ? "" : "-".$newver[3]); } -# print shared lib version in the format of interface.revision.age -printf("Shared lib version %d.%d.%d\n", @newltver[0,1,2]); - exit 0; # Because the first line of this file looks like a Bourne shell script, we diff --git a/config/lt_vers.am b/config/lt_vers.am index c5e5112..a3b7634 100644 --- a/config/lt_vers.am +++ b/config/lt_vers.am @@ -19,8 +19,8 @@ # After making changes, run bin/reconfigure to update other configure related # files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_AGE = 0 LT_VERS_REVISION = 224 +LT_VERS_AGE = 0 ## If the API changes *at all*, increment LT_VERS_INTERFACE and ## reset LT_VERS_REVISION to 0. diff --git a/src/H5.c b/src/H5.c index acbdecb..41fb3ba 100644 --- a/src/H5.c +++ b/src/H5.c @@ -720,9 +720,6 @@ done: } /* end H5get_libversion() */ -/* Depreciated by H5check_interface_compatibility. Need to keep it around - * because Fortran API calls it. Will be retired later. - */ /*------------------------------------------------------------------------- * Function: H5check_version * @@ -858,133 +855,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5check_interface_compatibility - * - * Purpose: Verifies that the arguments are compatible with the link library. - * This function is intended to be called from user to verify that - * the versions of header files compiled into the application - * is compatible with the version of the link hdf5 library. - * - * Return: Success: SUCCEED - * - * Failure: abort() - * The value of the environment variable, - * HDF5_DISABLE_VERSION_CHECK, could affect - * how failure is handles. See Code below. - * - * Algorithm: {provided by Mike McGreevy} - * How to determine if two libraries, given their interface, revision, - * and age, are compatible? Let's say you have: - * - * interface, revision, age --> compiled HDF5 - * INTERFACE, REVISION, AGE --> linked HDF5 library - * Then: - * if ((INTERFACE-AGE) != (interface-age)) - * not compatible - * else - * if (age <= AGE) - * compatible - * else - * not compatible - * endif - * endif - * [Note: revision/REVISION do not affect compatibility] - * - * Programmer: Albert Cheng - * Feb 21, 2016 - * - * Modifications: - * - *------------------------------------------------------------------------- - */ -#define INTERFACE_INCOMPATIBLE_WARNING \ -"Warning! ***HDF5 interface incompatibility detected***\n" \ -"The HDF5 header files used to compile this application are not compatible \n" \ -"with the HDF5 library to which this application is linked.\n" \ -"Data corruption or segmentation faults may occur if the application continues.\n" \ -"This can happen when an application was compiled by one version of HDF5 but\n" \ -"linked with a different version of static or shared HDF5 library.\n" \ -"You should recompile the application or check your shared library related\n" \ -"settings such as 'LD_LIBRARY_PATH'.\n" - -herr_t -H5check_interface_compatibility(unsigned interface, unsigned age, unsigned revision) -{ - char lib_str[256]; - static int checked = 0; /* If we've already checked the version info */ - static unsigned int disable_version_check = 0; /* Set if the version check should be disabled */ - static const char *interface_incompatible_warning = INTERFACE_INCOMPATIBLE_WARNING; - const char *s; /* Environment string for disabling version check */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_API_NOINIT_NOERR_NOFS - H5TRACE3("e", "IuIuIu", interface, age, revision); - - assert(interface >= age); - assert(LT_VERS_INTERFACE >= LT_VERS_AGE); - - /* Optimization: Don't check again, if we already have */ - if (checked) - HGOTO_DONE(SUCCEED) - else - /* Indicate that the version check has been performed */ - checked++; - - /* check version compatibility */ - if (((LT_VERS_INTERFACE - LT_VERS_AGE) == (interface - age)) &&\ - (LT_VERS_AGE >= age)) - HGOTO_DONE(SUCCEED) - /* else NOT COMPATIBLE */ - - /* Allow different handling of not compatible */ - s = HDgetenv ("HDF5_DISABLE_VERSION_CHECK"); - if (s && HDisdigit(*s)) - disable_version_check = (unsigned int)HDstrtol (s, NULL, 0); - - /* check the version of the link library */ - switch (disable_version_check) { - case 0: - /* print a message and abort */ - HDfprintf(stderr, "%s%s", interface_incompatible_warning, - "You can, at your own risk, disable this warning by setting the environment\n" - "variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'.\n" - "Setting it to 2 or higher will suppress the warning messages totally.\n"); - /* Mention the versions we are referring to */ - HDfprintf (stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n", - (interface-age), age, revision, - ((unsigned)LT_VERS_INTERFACE-(unsigned)LT_VERS_AGE), (unsigned)LT_VERS_AGE, (unsigned)LT_VERS_REVISION); - /* Show library settings if available */ - HDfprintf (stderr, "%s", H5libhdf5_settings); - - /* Bail out now. */ - HDfputs ("Bye...\n", stderr); - HDabort (); - case 1: - /* continue with a warning */ - /* Note that the warning message is embedded in the format string.*/ - HDfprintf (stderr, - "%s'HDF5_DISABLE_VERSION_CHECK' " - "environment variable is set to %d, application will\n" - "continue at your own risk.\n", - interface_incompatible_warning, disable_version_check); - /* Mention the versions we are referring to */ - HDfprintf (stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n", - (interface-age), age, revision, - ((unsigned)LT_VERS_INTERFACE-(unsigned)LT_VERS_AGE), (unsigned)LT_VERS_AGE, (unsigned)LT_VERS_REVISION); - /* Show library settings if available */ - HDfprintf (stderr, "%s", H5libhdf5_settings); - break; - default: - /* 2 or higher: continue silently */ - break; - } /* end switch */ - -done: - FUNC_LEAVE_API_NOFS(ret_value) -} /* end H5check_version() */ - - -/*------------------------------------------------------------------------- * Function: H5open * * Purpose: Initialize the library. This is normally called diff --git a/src/H5public.h b/src/H5public.h index 3cfe42c..554ad26 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -99,12 +99,8 @@ extern "C" { /* Empty string for real releases. */ #define H5_VERS_INFO "HDF5 library version: 1.9.234" /* Full version string */ -/* LT Version numbers */ -#define LT_VERS_INTERFACE 6 -#define LT_VERS_AGE 0 -#define LT_VERS_REVISION 224 - -#define H5check() H5check_interface_compatibility(LT_VERS_INTERFACE, LT_VERS_AGE, LT_VERS_REVISION) +#define H5check() H5check_version(H5_VERS_MAJOR,H5_VERS_MINOR, \ + H5_VERS_RELEASE) /* macros for comparing the version */ #define H5_VERSION_GE(Maj,Min,Rel) \ @@ -347,13 +343,8 @@ H5_DLL herr_t H5set_free_list_limits (int reg_global_lim, int reg_list_lim, int blk_list_lim); H5_DLL herr_t H5get_libversion(unsigned *majnum, unsigned *minnum, unsigned *relnum); -/* Deprecated by H5check_interface_compatibility. Need to keep it because - * Fortran API calls it. To be retired later. - */ H5_DLL herr_t H5check_version(unsigned majnum, unsigned minnum, - unsigned relnum); -H5_DLL herr_t H5check_interface_compatibility(unsigned interface, unsigned age, \ - unsigned revision); + unsigned relnum); H5_DLL herr_t H5is_library_threadsafe(hbool_t *is_ts); H5_DLL herr_t H5free_memory(void *mem); H5_DLL void *H5allocate_memory(size_t size, hbool_t clear); diff --git a/test/tcheck_version.c b/test/tcheck_version.c index 48d5523..a75d642 100644 --- a/test/tcheck_version.c +++ b/test/tcheck_version.c @@ -39,9 +39,9 @@ void parse(int ac, char **av); void abort_intercept (int H5_ATTR_UNUSED sig); /* global variables */ -unsigned interface = LT_VERS_INTERFACE; -unsigned revision = LT_VERS_REVISION; -unsigned age = LT_VERS_AGE; +unsigned major = H5_VERS_MAJOR; +unsigned minor = H5_VERS_MINOR; +unsigned release = H5_VERS_RELEASE; void showhelp(void) @@ -50,9 +50,9 @@ showhelp(void) printf("\t-h\tShow this page and version information\n"); printf("\t-t: Test by changing (adding 1 to) the to trigger\n"); printf("\t\t the warning. can be:\n"); - printf("\t\t\tI for Interface number (%d)\n", LT_VERS_INTERFACE); - printf("\t\t\tA for Age number (%d)\n", LT_VERS_AGE); - printf("\t\t\tR for Revision number (%d)\n", LT_VERS_REVISION); + printf("\t\t\tM for Major version number (%d)\n", H5_VERS_MAJOR); + printf("\t\t\tm for Minor version number (%d)\n", H5_VERS_MINOR); + printf("\t\t\tr for Release number (%d)\n", H5_VERS_RELEASE); } @@ -70,14 +70,14 @@ parse(int ac, char **av) switch(*(++pt)) { case 't': /* option -t */ switch(*(++pt)) { - case 'I': - interface++; + case 'M': + major++; break; - case 'R': - revision++; + case 'm': + minor++; break; - case 'A': - age++; + case 'r': + release++; break; default: fprintf(stderr, "Unknown -v parameter (%s). Aborted.\n", *av); @@ -115,7 +115,7 @@ main(int ac, char **av) { parse(ac, av); HDsignal(SIGABRT, &abort_intercept); - H5check_interface_compatibility(interface, age, revision); + H5check_version(major, minor, release); HDsignal(SIGABRT, SIG_DFL); return 0; } diff --git a/test/testcheck_version.sh.in b/test/testcheck_version.sh.in index 5c89c04..ed9845e 100644 --- a/test/testcheck_version.sh.in +++ b/test/testcheck_version.sh.in @@ -58,19 +58,18 @@ SKIP() { # Print warning message of version mismatch. WarnMesg(){ - echo "Warning! ***HDF5 interface incompatibility detected***" - echo "The HDF5 header files used to compile this application are not compatible " - echo "with the HDF5 library to which this application is linked." + echo "Warning! ***HDF5 library version mismatched error***" + echo "The HDF5 header files used to compile this application do not match" + echo "the version used by the HDF5 library to which this application is linked." echo "Data corruption or segmentation faults may occur if the application continues." echo "This can happen when an application was compiled by one version of HDF5 but" echo "linked with a different version of static or shared HDF5 library." echo "You should recompile the application or check your shared library related" echo "settings such as 'LD_LIBRARY_PATH'." - echo "You can, at your own risk, disable this warning by setting the environment" echo "variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'." echo "Setting it to 2 or higher will suppress the warning messages totally." - echo "Headers are $xxh5vers_interface_age.$xxh5vers_age.$xxh5vers_revision, library is $h5vers_interface_age.$h5vers_age.$h5vers_revision" + echo "Headers are $xxh5versmajor.$xxh5versminor.$xxh5versrelease, library is $h5versmajor.$h5versminor.$h5versrelease" test -n "$H5_HAVE_EMBEDDED_LIBINFO" && cat $h5libsettings echo "Bye..." } @@ -78,18 +77,17 @@ WarnMesg(){ # Print warning message2 of version mismatch. WarnMesg2(){ - echo "Warning! ***HDF5 interface incompatibility detected***" - echo "The HDF5 header files used to compile this application are not compatible " - echo "with the HDF5 library to which this application is linked." + echo "Warning! ***HDF5 library version mismatched error***" + echo "The HDF5 header files used to compile this application do not match" + echo "the version used by the HDF5 library to which this application is linked." echo "Data corruption or segmentation faults may occur if the application continues." echo "This can happen when an application was compiled by one version of HDF5 but" echo "linked with a different version of static or shared HDF5 library." echo "You should recompile the application or check your shared library related" echo "settings such as 'LD_LIBRARY_PATH'." - echo "'HDF5_DISABLE_VERSION_CHECK' environment variable is set to 1, application will" echo "continue at your own risk." - echo "Headers are $xxh5vers_interface_age.$xxh5vers_age.$xxh5vers_revision, library is $h5vers_interface_age.$h5vers_age.$h5vers_revision" + echo "Headers are $xxh5versmajor.$xxh5versminor.$xxh5versrelease, library is $h5versmajor.$h5versminor.$h5versrelease" test -n "$H5_HAVE_EMBEDDED_LIBINFO" && cat $h5libsettings } @@ -129,10 +127,9 @@ TESTING() { h5DisableVersion="$1" wrongversionnumbers="$2" - xxh5vers_interface=$h5vers_interface - xxh5vers_age=$h5vers_age - xxh5vers_revision=$h5vers_revision - xxh5vers_interface_age=`expr $xxh5vers_interface - $xxh5vers_age` + xxh5versmajor=$h5versmajor + xxh5versminor=$h5versminor + xxh5versrelease=$h5versrelease if [ "$h5DisableVersion" = unset ]; then envcmd="" # noop @@ -148,14 +145,13 @@ TESTING() { arguments=-t"$wrongversionnumbers" # calculate mismatched version numbers by listing. case $wrongversionnumbers in - "I") xxh5vers_interface=`expr $h5vers_interface + 1` + "M") xxh5versmajor=`expr $h5versmajor + 1` ;; - "A") xxh5vers_age=`expr $h5vers_age + 1` + "m") xxh5versminor=`expr $h5versminor + 1` ;; - "R") xxh5vers_revision=`expr $h5vers_revision + 1` + "r") xxh5versrelease=`expr $h5versrelease + 1` ;; esac - xxh5vers_interface_age=`expr $xxh5vers_interface - $xxh5vers_age` case "$h5DisableVersion" in 1) # W2/OK: Different Warning, exit 0. @@ -222,22 +218,15 @@ h5libsettings=../src/libhdf5.settings PURPOSE # Figure out library version numbers from the header file. -h5vers_interface=`grep '#define LT_VERS_INTERFACE' $srcdir/../src/H5public.h | sed -e s/[^0-9]//g` -#echo h5vers_interface=$h5vers_interface -h5vers_revision=`grep '#define LT_VERS_REVISION' $srcdir/../src/H5public.h | sed -e s/[^0-9]//g` -#echo h5vers_revision=$h5vers_revision -h5vers_age=`grep '#define LT_VERS_AGE' $srcdir/../src/H5public.h | sed -e s/[^0-9]//g` -#echo h5vers_age=$h5vers_age -h5vers_interface_age=`expr $h5vers_interface - $h5vers_age` -#h5vers_interface=`grep '#define LT_VERS_INTERFACE' $srcdir/../src/H5public.h | cut -f2` -#h5vers_revision=`grep '#define LT_VERS_REVISION' $srcdir/../src/H5public.h | cut -f2` -#h5vers_age=`grep '#define LT_VERS_AGE' $srcdir/../src/H5public.h | cut -f2` -DEBUGPRINT $h5vers_interface.$h5vers_revision.$h5vers_age -case "$h5vers_interface$h5vers_revision$h5vers_age" in +h5versmajor=`grep '#define H5_VERS_MAJOR' $srcdir/../src/H5public.h | cut -f2` +h5versminor=`grep '#define H5_VERS_MINOR' $srcdir/../src/H5public.h | cut -f2` +h5versrelease=`grep '#define H5_VERS_RELEASE' $srcdir/../src/H5public.h | cut -f2` +DEBUGPRINT $h5versmajor.$h5versminor.$h5versrelease +case "$h5versmajor$h5versminor$h5versrelease" in [0-9]*) # good. noop. ;; *) - echo "Illegal library version numbers($h5vers_interface.$h5vers_revision.$h5vers_age)" + echo "Illegal library version numbers($h5versmajor.$h5versminor.$h5versrelease)" echo "Test aborted" exit 1 ;; @@ -252,13 +241,13 @@ fi # Three Categories of tests: # Normal: where the version numbers all matched (wrong_version == none). -# Mismatched version numbers (could be Interface or Age versions; -# revision makes no differences in link compatibility check.) +# Mismatched version numbers (could be Major or minor version +# or release numbers or a combination of all three.) # Test all the above with different values of the environment variable, # HDF5_DISABLE_VERSION_CHECK, as unset, "", -1, 0, 1, 2, 3 for val_disable_version_check in unset "" -1 0 1 2 3; do - for wrong_version in none I A; do + for wrong_version in none M m r; do TESTING "$val_disable_version_check" "$wrong_version" done done -- cgit v0.12 From 67432599a3b53496d0fa357634447356d44c81e5 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Tue, 8 Mar 2016 22:27:46 -0500 Subject: [svn-r29360] Purpose: Adding test Description: Added several tests for packet table that were missing from the previous update. Platforms tested: Linux/32 2.6 (jam) Linux/64 (platypus) Darwin (osx1010test) --- hl/test/test_packet_vlen.c | 674 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 635 insertions(+), 39 deletions(-) diff --git a/hl/test/test_packet_vlen.c b/hl/test/test_packet_vlen.c index 10051fa..b3b2fce 100644 --- a/hl/test/test_packet_vlen.c +++ b/hl/test/test_packet_vlen.c @@ -23,6 +23,7 @@ #define NRECORDS 5 #define TEST_FILE_NAME "test_packet_table_vlen.h5" +#define TESTFL_FILE_NAME "testfl_packet_table_vlen.h5" #define PT_VLEN_ATOMIC "Dataset with VL of Atomic types" #define PT_VLEN_COMP "Dataset with VL of Compound Types" #define PT_COMP_VLEN "Dataset with Compound Type of VL types" @@ -91,7 +92,7 @@ static int test_VLof_atomic(void) goto error; /* Create a packet table that uses a vlen datatype of an atomic type */ - ptable = H5PTcreate_fl(fid, PT_VLEN_ATOMIC, vltype, (hsize_t)1, 0); + ptable = H5PTcreate(fid, PT_VLEN_ATOMIC, vltype, (hsize_t)1, H5P_DEFAULT); /* Ensure that PT is created successfully */ if (ptable == H5I_INVALID_HID) @@ -222,7 +223,7 @@ static int test_VLof_comptype(void) goto error; /* Create a packet table that uses a vlen datatype of compound datatype */ - ptable = H5PTcreate_fl(fid, PT_VLEN_COMP, vltype, (hsize_t)1, 0); + ptable = H5PTcreate(fid, PT_VLEN_COMP, vltype, (hsize_t)1, H5P_DEFAULT); /* Ensure that PT is created successfully */ if (ptable == H5I_INVALID_HID) @@ -388,7 +389,7 @@ static int test_compound_VL_VLtype(void) goto error; /* Create a packet table that uses a compound datatype of vlen datatype */ - ptable = H5PTcreate_fl(fid, PT_COMP_VLEN, comp_vlvl, (hsize_t)1, 0); + ptable = H5PTcreate(fid, PT_COMP_VLEN, comp_vlvl, (hsize_t)1, H5P_DEFAULT); /* Ensure that PT is created successfully */ if (ptable == H5I_INVALID_HID) @@ -541,7 +542,7 @@ static int test_VLof_VLtype(void) goto error; /* Create a packet table that uses a vlen datatype of vlen datatype */ - ptable = H5PTcreate_fl(fid, PT_VLEN_VLEN, vlofvl, (hsize_t)1, 0); + ptable = H5PTcreate(fid, PT_VLEN_VLEN, vlofvl, (hsize_t)1, H5P_DEFAULT); /* Ensure that PT is created successfully */ if (ptable == H5I_INVALID_HID) @@ -669,7 +670,7 @@ static int test_H5PTis_varlen(void) goto error; /* Create a new table */ - ptable = H5PTcreate_fl(fid, "Fixed-length Packet Table", H5T_STD_I32BE, (hsize_t)100, -1); + ptable = H5PTcreate(fid, PT_FIXED_LEN, H5T_STD_I32BE, (hsize_t)100, H5P_DEFAULT); /* Ensure that PT is created successfully */ if (ptable == H5I_INVALID_HID) @@ -1039,59 +1040,654 @@ error: /* An error has occurred. Clean up and exit. */ return FAIL; } /* test_accessors */ +/************************************************************************** + Test set for deprecated function H5PTcreate_fl + Each test in this set is the same as the corresponding one in the + set for H5PTcreate, as of Mar 2016 + +**************************************************************************/ + /*------------------------------------------------------------------------- - * test_packet_table_with_varlen(): Invokes individual tests to ensure that - * packet tables with variable length are created and written correctly - * without the specific VL PT functionality. (HDFFV-442) + * testfl_VLof_atomic(): Test that a packet table with VL datatypes of atomic + * datatypes can be created and written correctly. (HDFFV-442) * * 2016/01/27 -BMR *------------------------------------------------------------------------- */ -int test_packet_table_with_varlen(void) +static int testfl_VLof_atomic(void) { - hid_t fid=H5I_INVALID_HID; /* File identifier */ - int status = SUCCEED; + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */ + hsize_t count; /* Number of records in the table */ + int ii, jj; /* Loop variables */ + hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ + hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ + char msg[80]; /* For error message */ + herr_t ret; /* Returned status from a callee */ - /* Create a file using default properties */ - fid = H5Fcreate(TEST_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + TESTING3(" with vlen of atomic"); + + /* Allocate and initialize VL data to write (copied from C test) */ + for (ii=0; ii 0) H5PTclose(ptable); + if (fid > 0) H5Fclose(fid); + H5PTfree_vlen_buff(ptable, NRECORDS, readBuf); + H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); + H5_FAILED(); + return FAIL; +} /* testfl_VLof_atomic */ - /* Test variable length of a simple type */ - if (test_VLof_atomic() < 0) - status = FAIL; +/*------------------------------------------------------------------------- + * testfl_VLof_comptype(): Test that a packet table with VL datatypes of + * compound datatypes can be created and written correctly. (HDFFV-442) + * + * 2016/01/27 -BMR + *------------------------------------------------------------------------- + */ +static int testfl_VLof_comptype(void) +{ + /* Struct that the VL sequences are composed of */ + typedef struct { + int i; + float f; + } VLcomp_t; + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t vltype=H5I_INVALID_HID; /* Variable length datatype */ + hid_t cmptype=H5I_INVALID_HID; /* Compound datatype */ + hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ + hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ + hsize_t count; /* Number of records in the table */ + int ii, jj; /* Loop variables */ + char msg[80]; /* For error message */ + herr_t ret; - /* Test variable length of a compound type */ - if (test_VLof_comptype() < 0) - status = FAIL; + TESTING3(" with vlen of compound datatypes"); - /* Test compound type with variable length */ - if (test_compound_VL_VLtype() < 0) - status = FAIL; + /* Allocate and initialize VL data to write (copied from C test) */ + for (ii=0; ii 0) H5PTclose(ptable); + if (fid > 0) H5Fclose(fid); + H5PTfree_vlen_buff(ptable, NRECORDS, readBuf); + H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); + H5_FAILED(); + return FAIL; +} /* testfl_VLof_comptype */ + +/*------------------------------------------------------------------------- + * testfl_compound_VL_VL(): Test that a packet table of compound datatypes + * containing VL datatypes can be created and written + * correctly. (HDFFV-442) + * + * 2016/01/27 -BMR + *------------------------------------------------------------------------- + */ +static int testfl_compound_VL_VLtype(void) +{ + /* Struct that the VL sequences are composed of */ + typedef struct { + int i; + float f; + hvl_t v; + } compVLVL_t; + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t space=H5I_INVALID_HID; /* Dataspace identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */ + hid_t vlofvl=H5I_INVALID_HID; /* Variable length datatype */ + hid_t comp_vlvl=H5I_INVALID_HID; /* ID of a compound datatype containing + a VL of VL of atomic datatype */ + hsize_t dims1[] = {NRECORDS}; + hsize_t count; /* Number of records in the table */ + compVLVL_t writeBuf[NRECORDS];/* Buffer to hold data to be written */ + compVLVL_t readBuf[NRECORDS]; /* Buffer to hold read data */ + hvl_t *t1, *t2; + int ii, jj, kk; /* Loop variables */ + char msg[80]; /* For error message */ + herr_t ret; /* Returned status from a callee */ + + TESTING3(" with compound datatype containing vlen datatype"); + + /* Allocate and initialize VL data to write (copied from C test) */ + for (ii=0; iip = HDmalloc((jj+L2_INCM)*sizeof(unsigned int)); + if (t1->p == NULL) { + fprintf(stderr, "Cannot allocate memory for VL data! ii=%d\n",ii); + goto error; + } + t1->len = jj+L2_INCM; + for (kk=0; kkp)[kk] = ii*100 + jj*10 + kk; + } + } /* end for */ + + /* Open the file */ + fid = H5Fopen(TESTFL_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); + if (fid < 0) + goto error; + + /* Create dataspace for datasets */ + space = H5Screate_simple(SPACE3_RANK, dims1, NULL); + if (space < 0) + goto error; + + /* Create a VL datatype of an atomic type */ + vlatomic = H5Tvlen_create (H5T_NATIVE_UINT); + if (vlatomic < 0) + goto error; + + /* Create a VL datatype of the VL of atomic datatype */ + vlofvl = H5Tvlen_create (vlatomic); + if (vlofvl < 0) + goto error; + + /* Create the base compound type */ + comp_vlvl = H5Tcreate(H5T_COMPOUND, sizeof(compVLVL_t)); + if (comp_vlvl < 0) + goto error; + + /* Insert fields: atomic, atomic, vlen */ + ret = H5Tinsert(comp_vlvl, "i", HOFFSET(compVLVL_t, i), H5T_NATIVE_INT); + if (ret < 0) + goto error; + ret = H5Tinsert(comp_vlvl, "f", HOFFSET(compVLVL_t, f), H5T_NATIVE_FLOAT); + if (ret < 0) + goto error; + ret = H5Tinsert(comp_vlvl, "v", HOFFSET(compVLVL_t, v), vlofvl); + if (ret < 0) + goto error; + + /* Create a packet table that uses a compound datatype of vlen datatype */ + ptable = H5PTcreate_fl(fid, PT_COMP_VLEN, comp_vlvl, (hsize_t)1, 0); + + /* Ensure that PT is created successfully */ + if (ptable == H5I_INVALID_HID) + goto error; + + /* Close the vlen datatype */ + if (H5Tclose(comp_vlvl) < 0) + goto error; + + /* Write the entire buffer to the packet table */ + ret = H5PTappend(ptable, (size_t)NRECORDS, writeBuf ); + if (ret < 0) + goto error; + + /* Get the number of packets in the packet table, should be NRECORDS. */ + ret = H5PTget_num_packets(ptable, &count); + if (ret < 0) + goto error; + + sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); + VERIFY(count == NRECORDS, msg); + + /* Read all five packets back */ + ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)NRECORDS, (void*)readBuf ); + if (ret < 0) + goto error; + + /* Compare data read in */ + for (ii = 0; ii < NRECORDS; ii++) { + if (writeBuf[ii].i != readBuf[ii].i) { + fprintf(stderr, "Integer components don't match!, writeBuf[%d].i=%d, readBuf[%d].i=%d\n",(int)ii,(int)writeBuf[ii].i,(int)ii,(int)readBuf[ii].i); + continue; + } /* end if */ + if (!H5_FLT_ABS_EQUAL(writeBuf[ii].f,readBuf[ii].f)) { + fprintf(stderr, "Float components don't match!, writeBuf[%d].f=%f, readBuf[%d].f=%f\n",(int)ii,(double)writeBuf[ii].f,(int)ii,(double)readBuf[ii].f); + continue; + } /* end if */ + + if (writeBuf[ii].v.len != readBuf[ii].v.len) { + fprintf(stderr, "%d: VL data length don't match!, writeBuf[%d].v.len=%d, readBuf[%d].v.len=%d\n",__LINE__,(int)ii,(int)writeBuf[ii].v.len,(int)ii,(int)readBuf[ii].v.len); + continue; + } /* end if */ + + for (t1=(hvl_t *)(writeBuf[ii].v.p), t2=(hvl_t *)(readBuf[ii].v.p), jj=0; (size_t)jjlen != t2->len) { + fprintf(stderr, "%d: VL data length don't match!, ii=%d, jj=%d, t1->len=%d, t2->len=%d\n",__LINE__,(int)ii,(int)jj,(int)t1->len,(int)t2->len); + continue; + } /* end if */ + for (kk=0; (size_t)kklen; kk++) { + if (((unsigned int *)t1->p)[kk] != ((unsigned int *)t2->p)[kk] ) { + fprintf(stderr, "VL data values don't match!, t1->p[%d]=%d, t2->p[%d]=%d\n",(int)kk, (int)((unsigned int *)t1->p)[kk], (int)kk, (int)((unsigned int *)t2->p)[kk]); + continue; + } /* end if */ + } /* end for */ + } /* end for */ + } /* end for */ + + /* Free the buffers */ + ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf); + if (ret < 0) + goto error; + ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); + if (ret < 0) + goto error; + + /* Close the packet table */ + ret = H5PTclose(ptable); + if (ret < 0) + goto error; + + /* Release datatypes */ + if (H5Tclose(vlatomic) < 0) + goto error; + if (H5Tclose(vlofvl) < 0) + goto error; + + /* Close the file */ + if (H5Fclose(fid) < 0) + goto error; + + PASSED(); + return SUCCEED; + +error: /* An error has occurred. Clean up and exit. */ + if (H5PTis_valid(ptable) > 0) H5PTclose(ptable); + if (fid > 0) H5Fclose(fid); + H5PTfree_vlen_buff(ptable, NRECORDS, readBuf); + H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); + H5_FAILED(); + return FAIL; +} /* testfl_compound_VL_VLtype */ + +/*------------------------------------------------------------------------- + * testfl_VLof_VLtype(): Test that a packet table of VL datatype with VL + * datatypes of atomic datatypes can be created and written + * correctly. (HDFFV-442) + * + * 2016/01/27 -BMR + *------------------------------------------------------------------------- + */ +static int testfl_VLof_VLtype(void) +{ + hid_t fid=H5I_INVALID_HID; /* Test file identifier */ + hid_t ptable=H5I_INVALID_HID; /* Packet table identifier */ + hid_t vlatomic=H5I_INVALID_HID; /* Variable length datatype */ + hid_t vlofvl=H5I_INVALID_HID; /* VL datatype of VL datatypes */ + hsize_t count; /* Number of records in the table */ + hvl_t *t1; /* pointer to advance */ + int ii, jj, kk; /* Loop variables */ + hvl_t writeBuf[NRECORDS]; /* Buffer to hold data to be written */ + hvl_t readBuf[NRECORDS]; /* Buffer to hold read data */ + char msg[80]; /* For error message */ + herr_t ret; /* Returned status from a callee */ + + TESTING3(" with vlen datatype of vlen datatype"); + + /* Allocate and initialize VL data to write (copied from C test) */ + for (ii=0; ii< NRECORDS; ii++) { + writeBuf[ii].p = HDmalloc((ii+1)*sizeof(hvl_t)); + if (writeBuf[ii].p == NULL) { + fprintf(stderr, "Cannot allocate memory for VL data! ii=%u\n",ii); + goto error; + } /* end if */ + writeBuf[ii].len = ii+1; + for (t1=(hvl_t *)(writeBuf[ii].p), jj=0; jj<(ii+1); jj++, t1++) + { + t1->p = HDmalloc((jj+1)*sizeof(unsigned int)); + if (t1->p == NULL) { + fprintf(stderr, "Cannot allocate memory for VL data! ii=%u\n",ii); + goto error; + } + t1->len = jj+1; + for (kk=0; kk<(jj+1); kk++) + ((unsigned int *)t1->p)[kk] = ii*100+jj*10+kk; + } /* end for */ + } /* end for */ + + /* Open the file */ + fid = H5Fopen(TESTFL_FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT); + if (fid < 0) + goto error; + + /* Create a VL datatype of an atomic type */ + vlatomic = H5Tvlen_create (H5T_NATIVE_UINT); + if (vlatomic < 0) + goto error; + + vlofvl = H5Tvlen_create (vlatomic); + if (vlofvl < 0) + goto error; + + /* Create a packet table that uses a vlen datatype of vlen datatype */ + ptable = H5PTcreate_fl(fid, PT_VLEN_VLEN, vlofvl, (hsize_t)1, 0); + + /* Ensure that PT is created successfully */ + if (ptable == H5I_INVALID_HID) + goto error; + + /* Close the vlen datatype */ + if (H5Tclose(vlofvl) < 0) + goto error; + + /* Write the entire buffer to the packet table */ + ret = H5PTappend(ptable, (size_t)5, writeBuf ); + if (ret < 0) + goto error; + + /* Get the number of packets in the packet table, should be NRECORDS. */ + ret = H5PTget_num_packets(ptable, &count); + if (ret < 0) + goto error; + + sprintf(msg, "The number of packets in the packet table must be %u\n", NRECORDS); + VERIFY(count == NRECORDS, msg); + + /* Read all five packets back */ + ret = H5PTread_packets(ptable, (hsize_t)0, (size_t)5, (void*)readBuf ); + if (ret < 0) + goto error; + + /* Free the buffers */ + ret = H5PTfree_vlen_buff(ptable, NRECORDS, readBuf); + if (ret < 0) + goto error; + ret = H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); + if (ret < 0) + goto error; + + /* Close the packet table */ + ret = H5PTclose(ptable); + if (ret < 0) + goto error; + + /* Close the file */ + if (H5Fclose(fid) < 0) + goto error; + + PASSED(); + return SUCCEED; + +error: /* An error has occurred. Clean up and exit. */ + if (H5PTis_valid(ptable) > 0) H5PTclose(ptable); + if (fid > 0) H5Fclose(fid); + H5PTfree_vlen_buff(ptable, NRECORDS, readBuf); + H5PTfree_vlen_buff(ptable, NRECORDS, writeBuf); + H5_FAILED(); + return FAIL; +} /* testfl_VLof_VLtype */ + +/*------------------------------------------------------------------------- + * test_packet_table_with_varlen(): Invokes individual tests to ensure that + * packet tables with variable length are created and written correctly + * without the specific VL PT functionality. (HDFFV-442) + * + * 2016/01/27 -BMR + *------------------------------------------------------------------------- + */ +int test_packet_table_with_varlen(void) +{ + hid_t fid=H5I_INVALID_HID; /* File identifier */ + int status = SUCCEED; + + /* Create a file using default properties */ + fid = H5Fcreate(TEST_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid < 0) + return FAIL; + + /* Close the file. The file will be opened by each test function below */ + if (H5Fclose(fid) < 0) + return FAIL; + + HDputs("Testing packet table with various variable-length datatypes"); + + /* If any test fails, move on to subsequent test, but status will indicate + there is a failure. */ + + /* Test variable length of a simple type */ + if (test_VLof_atomic() < 0) + status = FAIL; + + /* Test variable length of a compound type */ + if (test_VLof_comptype() < 0) + status = FAIL; + + /* Test compound type with variable length */ + if (test_compound_VL_VLtype() < 0) + status = FAIL; + + /* Test variable length of a variable length */ + if (test_VLof_VLtype() < 0) + status = FAIL; + + /* Test variable length of a variable length */ + if (test_H5PTis_varlen() < 0) + status = FAIL; + + /* Test adding attributes to packet table */ + if (test_attributes() < 0) + status = FAIL; + + /* Test accessor functions */ + if (test_accessors() < 0) + status = FAIL; + + +/************************************************************************** + Calling test functions for deprecated function H5PTcreate_fl + Mar 2016, -BMR + +**************************************************************************/ + + /* Create a file using default properties */ + fid = H5Fcreate(TESTFL_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if (fid < 0) + return FAIL; + + /* Close the file. The file will be opened by each test function below */ + if (H5Fclose(fid) < 0) + return FAIL; + + HDputs("Testing packet table with various variable-length datatypes - H5PTcreate_fl"); + + /* If any test fails, move on to subsequent test, but status will indicate + there is a failure. */ + + /* Test variable length of a simple type */ + if (testfl_VLof_atomic() < 0) + status = FAIL; + + /* Test variable length of a compound type */ + if (testfl_VLof_comptype() < 0) + status = FAIL; + + /* Test compound type with variable length */ + if (testfl_compound_VL_VLtype() < 0) + status = FAIL; + + /* Test variable length of a variable length */ + if (testfl_VLof_VLtype() < 0) status = FAIL; return(status); -- cgit v0.12 From 20bfdeb2c16ded5bfefed3a505a73dbaca6e7e60 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Tue, 8 Mar 2016 22:30:02 -0500 Subject: [svn-r29361] Purpose: Correction Description: Replaced static_cast with reinterpret_cast for "void *". Removed some commented-out old code. Platforms tested: Linux/32 2.6 (jam) Linux/64 (platypus) Darwin (osx1010test) --- c++/src/H5Location.cpp | 4 ++-- c++/test/dsets.cpp | 28 ++++++++++++++-------------- c++/test/tarray.cpp | 2 -- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/c++/src/H5Location.cpp b/c++/src/H5Location.cpp index 337aa6f..e2b68ae 100644 --- a/c++/src/H5Location.cpp +++ b/c++/src/H5Location.cpp @@ -50,7 +50,7 @@ extern "C" herr_t userAttrOpWrpr(hid_t loc_id, const char *attr_name, #ifdef NO_STATIC_CAST UserData4Aiterate* myData = (UserData4Aiterate *) op_data; #else - UserData4Aiterate* myData = static_cast (op_data); + UserData4Aiterate* myData = reinterpret_cast (op_data); #endif myData->op( *myData->location, s_attr_name, myData->opData ); return 0; @@ -232,7 +232,7 @@ int H5Location::iterateAttrs( attr_operator_t user_op, unsigned *_idx, void *op_ // call the C library routine H5Aiterate2 to iterate the attributes hsize_t idx = _idx ? (hsize_t)*_idx : 0; int ret_value = H5Aiterate2(getId(), H5_INDEX_NAME, H5_ITER_INC, &idx, - userAttrOpWrpr, static_cast(userData)); + userAttrOpWrpr, reinterpret_cast(userData)); // release memory delete userData; diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 1837d17..60e875c 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -246,10 +246,10 @@ test_simple_io( H5File& file) DataSet dataset (file.createDataSet (DSET_SIMPLE_IO_NAME, PredType::NATIVE_INT, space)); // Write the data to the dataset - dataset.write (static_cast(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset.write(reinterpret_cast(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); // Read the dataset back - dataset.read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset.read (reinterpret_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); // Check that the values read are the same as the values written for (i = 0; i < 100; i++) @@ -395,10 +395,10 @@ test_tconv( H5File& file) DataSet dataset (file.createDataSet (DSET_TCONV_NAME, PredType::STD_I32LE, space)); // Write the data to the dataset - dataset.write (static_cast(out), PredType::STD_I32LE); + dataset.write (reinterpret_cast(out), PredType::STD_I32LE); // Read data with byte order conversion - dataset.read (static_cast(in), PredType::STD_I32BE); + dataset.read (reinterpret_cast(in), PredType::STD_I32BE); // Check for (int i = 0; i < 1000000; i++) { @@ -539,7 +539,7 @@ test_compression(H5File& file) */ SUBTEST("Compression (uninitialized read)"); - dataset->read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->read (reinterpret_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); for (i=0; iwrite (static_cast(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->write (reinterpret_cast(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); PASSED(); @@ -580,7 +580,7 @@ test_compression(H5File& file) SUBTEST("Compression (read)"); // Read the dataset back - dataset->read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->read (reinterpret_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); // Check that the values read are the same as the values written for (i = 0; i < size[0]; i++) @@ -609,10 +609,10 @@ test_compression(H5File& file) points[i][j] = rand (); } } - dataset->write (static_cast(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->write (reinterpret_cast(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); // Read the dataset back and check it - dataset->read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->read (reinterpret_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); // Check that the values read are the same as the values written for (i = 0; i < size[0]; i++) @@ -637,7 +637,7 @@ test_compression(H5File& file) delete dataset; dataset = new DataSet (file.openDataSet (DSET_COMPRESS_NAME)); - dataset->read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->read (reinterpret_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); // Check that the values read are the same as the values written for (i = 0; i < size[0]; i++) @@ -667,8 +667,8 @@ test_compression(H5File& file) } } space1.selectHyperslab( H5S_SELECT_SET, hs_size, hs_offset ); - dataset->write (static_cast(points), PredType::NATIVE_INT, space1, space1, xfer); - dataset->read (static_cast(check), PredType::NATIVE_INT, space1, space1, xfer); + dataset->write (reinterpret_cast(points), PredType::NATIVE_INT, space1, space1, xfer); + dataset->read (reinterpret_cast(check), PredType::NATIVE_INT, space1, space1, xfer); // Check that the values read are the same as the values written for (i=0; iwrite (static_cast(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); - dataset->read (static_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->write (reinterpret_cast(points), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); + dataset->read (reinterpret_cast(check), PredType::NATIVE_INT, DataSpace::ALL, DataSpace::ALL, xfer); // Check that the values read are the same as the values written for (i = 0; i < size[0]; i++) diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp index e73cfd0..a6cbae4 100644 --- a/c++/test/tarray.cpp +++ b/c++/test/tarray.cpp @@ -94,9 +94,7 @@ static void test_array_compound_array() for(idxk = 0; idxk < ARRAY1_DIM1; idxk++) { float temp = idxi * 10.0 + idxj * 2.5 + idxk; - //wdata[idxi][idxj].f[idxk]=(float)(idxi * 10.0F + idxj * 2.5F + idxk); wdata[idxi][idxj].f[idxk] = temp; - //wdata[idxi][idxj].f[idxk] = static_cast(temp); } } // end for -- cgit v0.12 From ab4c2402f1c3b2835ce0c79d1b95a500247ce216 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Tue, 8 Mar 2016 22:46:24 -0500 Subject: [svn-r29362] Description: Removed another left-over commented-out line. Platforms tested: Linux/64 (platypus) - very minor --- c++/src/H5DataSet.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index c5ecf0a..7305347 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -336,7 +336,6 @@ hsize_t DataSet::getVlenBufSize(const DataType& type, const DataSpace& space ) c hsize_t DataSet::getVlenBufSize( DataType& type, DataSpace& space ) const { return(getVlenBufSize(type, space)); - //return(getVlenBufSize(static_cast(type), static_cast(space))); } //-------------------------------------------------------------------------- -- cgit v0.12 From 8222b344066b94ec3010ea408f306ac5fc03ea51 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Wed, 9 Mar 2016 01:47:27 -0500 Subject: [svn-r29364] Purpose: Improve C++ Packet Table library Description: Performed similar improvement as the C Packet Table library. - Removed the VLPT_REMOVED ifdef around class VL_PacketTable - Moved VL_PacketTable::IsVariableLength to PacketTable - Moved VL_PacketTable::FreeReadBuff to PacketTable::FreeBuff - Added overloaded constructor to FL_PacketTable that takes a property list ID and call the new C API H5PTcreate. - Added accessor wrappers to class PacketTable, per HDFFV-8623/patch 003. /* Returns the ID of the dataset associated with the packet table */ hid_t GetDataset(); /* Returns the ID of the datatype the packet table uses */ hid_t GetDatatype(); - Replaced appropriate calls in tests - Various cleanup Platforms tested: Linux/32 2.6 (jam) Linux/64 (platypus) Darwin (osx1010test) --- hl/c++/src/H5PacketTable.cpp | 204 +++++++++++++++---------------------------- hl/c++/src/H5PacketTable.h | 131 +++++++++++---------------- hl/c++/test/ptableTest.cpp | 53 +++++++---- 3 files changed, 159 insertions(+), 229 deletions(-) diff --git a/hl/c++/src/H5PacketTable.cpp b/hl/c++/src/H5PacketTable.cpp index 74b8029..50e11f6 100644 --- a/hl/c++/src/H5PacketTable.cpp +++ b/hl/c++/src/H5PacketTable.cpp @@ -34,6 +34,12 @@ * Opens an existing packet table, which can contain either fixed-length or * variable-length packets. */ + PacketTable::PacketTable(hid_t fileID, const char* name) + { + table_id = H5PTopen( fileID, name); + } + + /* "Open" Constructor - will be deprecated because of char* name */ PacketTable::PacketTable(hid_t fileID, char* name) { table_id = H5PTopen( fileID, name); @@ -60,17 +66,14 @@ return false; } -#ifdef VLPT_REMOVED /* IsVariableLength - * Return 1 if this packet table is a Variable Length packet table, - * return 0 if it is Fixed Length. Returns -1 if the table is - * invalid (not open). + * Return 1 if this packet table uses variable-length datatype, + * and 0, otherwise. Returns -1 if the table is invalid (not open). */ int PacketTable::IsVariableLength() { return H5PTis_varlen(table_id); } -#endif /* VLPT_REMOVED */ /* ResetIndex * Sets the index to point to the first packet in the packet table @@ -113,39 +116,87 @@ { hsize_t npackets; - error = H5PTget_num_packets( table_id, (hsize_t *)&npackets); + error = H5PTget_num_packets(table_id, &npackets); return npackets; } + /* GetTableId + * Returns the identifier of the packet table + */ + hid_t PacketTable::GetTableId() + { + return table_id; + } + + /* GetDatatype + * Returns the datatype identifier used by the packet table, on success, + * or FAIL, on failure. + * Note: it is best to avoid using this identifier in applications, unless + * the desired functionality cannot be performed via the packet table ID. + */ + hid_t PacketTable::GetDatatype() + { + return H5PTget_type(table_id); + } + + /* GetDataset + * Returns the dataset identifier associated with the packet table, on + * success, or FAIL, on failure. + * Note: it is best to avoid using this identifier in applications, unless + * the desired functionality cannot be performed via the packet table ID. + */ + hid_t PacketTable::GetDataset() + { + return H5PTget_dataset(table_id); + } + + /* FreeBuff + * Frees the buffers created when variable-length packets are read. + * Takes the number of hvl_t structs to be freed and a pointer to their + * location in memory. + * Returns 0 on success, negative on error. + */ + int PacketTable::FreeBuff(size_t numStructs, hvl_t * buffer) + { + return H5PTfree_vlen_buff( table_id, numStructs, buffer); + } + + /********************************/ /* Fixed-Length Packet Table */ /********************************/ /* Constructor - * Creates a packet table in which to store fixed length packets. + * Creates a packet table to store either fixed- or variable-length packets. + * Takes the ID of the file the packet table will be created in, the ID of + * the property list to specify compression, the name of the packet table, + * the ID of the datatype, and the size of a memory chunk used in chunking. + */ + FL_PacketTable::FL_PacketTable(hid_t fileID, hid_t plist_id, const char* name, hid_t dtypeID, hsize_t chunkSize) + { + table_id = H5PTcreate(fileID, name, dtypeID, chunkSize, plist_id); + } + + /* Constructor + * Creates a packet table to store either fixed- or variable-length packets. * Takes the ID of the file the packet table will be created in, the name of * the packet table, the ID of the datatype of the set, and the size * of a memory chunk used in chunking. + * Note: this overload will be deprecated in favor of the constructor above. */ FL_PacketTable::FL_PacketTable(hid_t fileID, char* name, hid_t dtypeID, hsize_t chunkSize, int compression) { - table_id = H5PTcreate_fl ( fileID, name, dtypeID, chunkSize, compression); + table_id = H5PTcreate_fl(fileID, name, dtypeID, chunkSize, compression); } /* "Open" Constructor * Opens an existing fixed-length packet table. * Fails if the packet table specified is variable-length. */ - FL_PacketTable::FL_PacketTable(hid_t fileID, char* name) : PacketTable(fileID, name) - { -#ifdef VLPT_REMOVED - if( H5PTis_varlen(table_id) != 0 ) // If this is not a fixed-length table - { - H5PTclose(table_id); - table_id = -1; - } -#endif /* VLPT_REMOVED */ - } + FL_PacketTable::FL_PacketTable(hid_t fileID, const char* name) : PacketTable(fileID, name) {} + + /* "Open" Constructor - will be deprecated because of char* name */ + FL_PacketTable::FL_PacketTable(hid_t fileID, char* name) : PacketTable(fileID, name) {} /* AppendPacket * Adds a single packet to the packet table. Takes a pointer @@ -215,119 +266,4 @@ return H5PTget_next(table_id, numPackets, data); } - -#ifdef VLPT_REMOVED - /********************************/ - /* Variable-Length Packet Table */ - /********************************/ - - /* Constructor - * Creates a packet table in which to store variable length packets. - * Takes the ID of the file the packet table will be created in, the name of - * the packet table, and the size of a memory chunk used in chunking. - */ - VL_PacketTable::VL_PacketTable(hid_t fileID, char* name, hsize_t chunkSize) - { - table_id = H5PTcreate_vl ( fileID, name, chunkSize); - } - - /* "Open" Constructor - * Opens an existing variable-length packet table. - * Fails if the packet table specified is fixed-length. - */ - VL_PacketTable::VL_PacketTable(hid_t fileID, char* name) : PacketTable(fileID, name) - { - if( H5PTis_varlen(table_id) != 1 ) // If this is not a variable-length table - { - H5PTclose(table_id); - table_id = -1; - } - } - - /* AppendPacket (variable-length) - * Adds a single variable-length packet to the packet table. - * Takes a pointer to the location of the data in memory and the length of the data - * in bytes. - * Returns 0 on success, negative on failure. - */ - int VL_PacketTable::AppendPacket(void * data, size_t length) - { - hvl_t packet; - - packet.len = length; - packet.p = data; - - return H5PTappend(table_id, 1, &packet); - } - - /* AppendPackets (multiple packets) - * Adds multiple variable-length packets to the packet table. Takes the - * number of - * packets to be added and a pointer to an array of hvl_t structs in memory. - * Returns 0 on success, negative on failure. - */ - int VL_PacketTable::AppendPackets(size_t numPackets, hvl_t * data) - { - return H5PTappend(table_id, numPackets, data); - } - - /* GetPacket (indexed) - * Gets a single variable-length packet from the packet table. Takes the - * index of the packet (with 0 being the first packet) and a pointer - * to a hvl_t struct in which to store the packet's size and location. - * Returns 0 on success, negative on failure. - */ - int VL_PacketTable::GetPacket(hsize_t index, hvl_t * data) - { - return H5PTread_packets(table_id, index, 1, data); - } - - /* GetPackets (multiple packets) - * Gets multiple variable-length packets at once, all packets between - * startIndex and endIndex inclusive. Takes a pointer to an array - * of hvl_t structs in memory in which to store pointers to the packets. - * Returns 0 on success, negative on failure. - */ - int VL_PacketTable::GetPackets(hsize_t startIndex, hsize_t endIndex, hvl_t * data) - { - // Make sure the range of indexes is valid - if (startIndex > endIndex) - return -1; - - return H5PTread_packets(table_id, startIndex, endIndex-startIndex+1, data); - } - - /* GetNextPacket (single packet) - * Gets the next packet in the packet table. Takes a pointer to - * an hvl_t struct where the packet should be stored. - * Returns 0 on success, negative on failure. Index - * is not advanced to the next packet on failure. - */ - int VL_PacketTable::GetNextPacket(hvl_t * data) - { - return H5PTget_next(table_id, 1, data); - } - - /* GetNextPackets (multiple packets) - * Gets the next numPackets packets in the packet table. Takes a - * pointer to an array of hvl_t structs where pointers to the packets - * should be stored. - * Returns 0 on success, negative on failure. Index - * is not advanced on failure. - */ - int VL_PacketTable::GetNextPackets(size_t numPackets, hvl_t * data) - { - return H5PTget_next(table_id, numPackets, data); - } - - /* FreeReadbuff - * Frees the buffers created when variable-length packets are read. - * Takes the number of hvl_t structs to be freed and a pointer to their - * location in memory. - * Returns 0 on success, negative on error. - */ - int VL_PacketTable::FreeReadbuff(size_t numStructs, hvl_t * buffer) - { - return H5PTfree_vlen_readbuff( table_id, numStructs, buffer); - } -#endif /* VLPT_REMOVED */ +/* Removed "ifdef VLPT_REMOVED" block. 03/08/2016, -BMR */ diff --git a/hl/c++/src/H5PacketTable.h b/hl/c++/src/H5PacketTable.h index 5f9a213..bdd669d 100644 --- a/hl/c++/src/H5PacketTable.h +++ b/hl/c++/src/H5PacketTable.h @@ -42,12 +42,15 @@ public: * Opens an existing packet table, which can contain either fixed-length or * variable-length packets. */ + PacketTable(hid_t fileID, const char* name); + + /* "Open" Constructor - will be deprecated because of char* name */ PacketTable(hid_t fileID, char* name); /* Destructor * Cleans up the packet table */ - ~PacketTable(); + virtual ~PacketTable(); /* IsValid * Returns true if this packet table is valid, false otherwise. @@ -56,14 +59,12 @@ public: */ bool IsValid(); -#ifdef VLPT_REMOVED /* IsVariableLength - * Return 1 if this packet table is a Variable Length packet table, + * Return 1 if this packet table uses variable-length datatype, * return 0 if it is Fixed Length. Returns -1 if the table is * invalid (not open). */ int IsVariableLength(); -#endif /* VLPT_REMOVED */ /* ResetIndex * Sets the "current packet" index to point to the first packet in the @@ -96,6 +97,35 @@ public: return GetPacketCount(ignoreError); } + /* GetTableId + * Returns the identifier of the packet table. + */ + hid_t GetTableId(); + + /* GetDatatype + * Returns the datatype identifier used by the packet table, on success, + * or FAIL, on failure. + * Note: it is best to avoid using this identifier in applications, unless + * the desired functionality cannot be performed via the packet table ID. + */ + hid_t GetDatatype(); + + /* GetDataset + * Returns the dataset identifier associated with the packet table, on + * success, or FAIL, on failure. + * Note: it is best to avoid using this identifier in applications, unless + * the desired functionality cannot be performed via the packet table ID. + */ + hid_t GetDataset(); + + /* FreeBuff + * Frees the buffers created when variable-length packets are read. + * Takes the number of hvl_t structs to be freed and a pointer to their + * location in memory. + * Returns 0 on success, negative on error. + */ + int FreeBuff(size_t numStructs, hvl_t * buffer); + protected: hid_t table_id; }; @@ -104,11 +134,20 @@ class H5_HLCPPDLL FL_PacketTable : virtual public PacketTable { public: /* Constructor + * Creates a packet table to store either fixed- or variable-length packets. + * Takes the ID of the file the packet table will be created in, the ID of + * the property list to specify compression, the name of the packet table, + * the ID of the datatype, and the size of a memory chunk used in chunking. + */ + FL_PacketTable(hid_t fileID, hid_t plist_id, const char* name, hid_t dtypeID, hsize_t chunkSize); + + /* Constructor * Creates a packet table in which to store fixed length packets. * Takes the ID of the file the packet table will be created in, the name of * the packet table, the ID of the datatype of the set, the size * of a memory chunk used in chunking, and the desired compression level * (0-9, or -1 for no compression). + * Note: this overload will be deprecated in favor of the constructor above. */ FL_PacketTable(hid_t fileID, char* name, hid_t dtypeID, hsize_t chunkSize, int compression = -1); @@ -116,8 +155,16 @@ public: * Opens an existing fixed-length packet table. * Fails if the packet table specified is variable-length. */ + FL_PacketTable(hid_t fileID, const char* name); + + /* "Open" Constructor - will be deprecated because of char* name */ FL_PacketTable(hid_t fileID, char* name); + /* Destructor + * Cleans up the packet table + */ + virtual ~FL_PacketTable() {}; + /* AppendPacket * Adds a single packet to the packet table. Takes a pointer * to the location of the data in memory. @@ -165,80 +212,6 @@ public: int GetNextPackets(size_t numPackets, void * data); }; -#ifdef VLPT_REMOVED -class H5_HLCPPDLL VL_PacketTable : virtual public PacketTable -{ -public: - /* Constructor - * Creates a packet table in which to store variable length packets. - * Takes the ID of the file the packet table will be created in, the name of - * the packet table, and the size of a memory chunk used in chunking. - */ - VL_PacketTable(hid_t fileID, char* name, hsize_t chunkSize); - - /* "Open" Constructor - * Opens an existing variable-length packet table. - * Fails if the packet table specified is fixed-length. - */ - VL_PacketTable(hid_t fileID, char* name); - - /* AppendPacket - * Adds a single packet of any length to the packet table. - * Takes a pointer to the location of the data in memory and the length of the data - * in bytes. - * Returns 0 on success, negative on failure. - */ - int AppendPacket(void * data, size_t length); - - /* AppendPackets (multiple packets) - * Adds multiple variable-length packets to the packet table. Takes the - * number of packets to be added and a pointer to an array of - * hvl_t structs in memory. - * Returns 0 on success, negative on failure. - */ - int AppendPackets(size_t numPackets, hvl_t * data); - - /* GetPacket (indexed) - * Gets a single variable-length packet from the packet table. Takes - * the index of the packet (with 0 being the first packet) and a pointer - * to a hvl_t struct in which to store the packet's size and location. - * Returns 0 on success, negative on failure. - */ - int GetPacket(hsize_t index, hvl_t * data); - - /* GetPackets (multiple packets) - * Gets multiple variable-length packets at once, all packets between - * startIndex and endIndex inclusive. Takes a pointer to an array - * of hvl_t structs in memory in which to store pointers to the packets. - * Returns 0 on success, negative on failure. - */ - int GetPackets(hsize_t startIndex, hsize_t endIndex, hvl_t * data); - - /* GetNextPacket (single packet) - * Gets the next packet in the packet table. Takes a pointer to - * an hvl_t struct where the packet should be stored. - * Returns 0 on success, negative on failure. Index - * is not advanced to the next packet on failure. - */ - int GetNextPacket(hvl_t * data); - - /* GetNextPackets (multiple packets) - * Gets the next numPackets packets in the packet table. Takes a - * pointer to an array of hvl_t structs where pointers to the packets - * should be stored. - * Returns 0 on success, negative on failure. Index - * is not advanced on failure. - */ - int GetNextPackets(size_t numPackets, hvl_t * data); - - /* FreeReadbuff - * Frees the buffers created when variable-length packets are read. - * Takes the number of hvl_t structs to be freed and a pointer to their - * location in memory. - * Returns 0 on success, negative on error. - */ - int FreeReadbuff(size_t numStructs, hvl_t * buffer); -}; -#endif /* VLPT_REMOVED */ +/* Removed "#ifdef VLPT_REMOVED" block. 03/08/2016, -BMR */ #endif /* H5PTWRAP_H */ diff --git a/hl/c++/test/ptableTest.cpp b/hl/c++/test/ptableTest.cpp index 929058d..ff99285 100644 --- a/hl/c++/test/ptableTest.cpp +++ b/hl/c++/test/ptableTest.cpp @@ -15,9 +15,11 @@ /* ptableTest.cpp */ +#include #include "ptableTest.h" using namespace H5; +using namespace std; #define TEST_FILE "packettest.h5" @@ -74,7 +76,7 @@ int main(void) return -1; } - +const char* BASICTEST_PT("/basicTest"); int BasicTest() { herr_t err; @@ -82,9 +84,9 @@ int BasicTest() hsize_t count; int error; - TESTING("basic funtionality") + TESTING("basic functionality") - FL_PacketTable wrapper(fileID, "/basicTest", H5T_NATIVE_INT, 1); + FL_PacketTable wrapper(fileID, H5P_DEFAULT, BASICTEST_PT, H5T_NATIVE_INT, 1); if(! wrapper.IsValid()) goto out; @@ -131,6 +133,7 @@ out: return 1; } +const char* CMPDTEST_PT("/compoundTest"); int TestCompoundDatatype() { hid_t dtypeID; @@ -153,8 +156,8 @@ int TestCompoundDatatype() H5Tinsert(dtypeID, "charlie", HOFFSET( compoundType, c ), H5T_NATIVE_SHORT); H5Tinsert(dtypeID, "ebert", HOFFSET( compoundType, e ), H5T_NATIVE_INT); - /* Create packet table. Explicitly specify no compression */ - FL_PacketTable wrapper(fileID, "/compoundTest", dtypeID, 1, -1); + /* Create packet table using default property list. */ + FL_PacketTable wrapper(fileID, H5P_DEFAULT, CMPDTEST_PT, dtypeID, 1); if(! wrapper.IsValid()) goto out; @@ -198,6 +201,7 @@ out: return 1; } +const char* GETNEXT_PT("/TestGetNext"); int TestGetNext() { int error; @@ -208,7 +212,7 @@ int TestGetNext() TESTING("GetNextPacket") /* Create a dataset */ - FL_PacketTable wrapper(fileID, "/TestGetNext", H5T_NATIVE_INT, 500); + FL_PacketTable wrapper(fileID, H5P_DEFAULT, GETNEXT_PT, H5T_NATIVE_INT, 500); if(! wrapper.IsValid()) goto out; @@ -260,18 +264,27 @@ out: return 1; } +const char* COMPRESS_PT("/compressTest"); int TestCompress() { - - unsigned int flags = 0; + unsigned int flags = 0; unsigned int config = 0; size_t cd_nelemts = 0; TESTING("compression") #ifdef H5_HAVE_FILTER_DEFLATE try { + /* Prepare property list to set compression, randomly use deflate */ + DSetCreatPropList dscreatplist; + dscreatplist.setDeflate(6); + /* Create packet table with compression. */ - FL_PacketTable wrapper(fileID, "/compressTest", H5T_NATIVE_CHAR, 100, 8); + FL_PacketTable wrapper(fileID, dscreatplist.getId(), COMPRESS_PT, H5T_NATIVE_CHAR, 100); + + /* Close the property list */ + dscreatplist.close(); + + /* Verify that the deflate filter is set */ /* Create an HDF5 C++ file object */ H5File file; @@ -279,11 +292,14 @@ int TestCompress() /* Make sure that the deflate filter is set by opening the packet table * as a dataset and getting its creation property list */ - DataSet dsetID = file.openDataSet("/compressTest"); + DataSet dset = file.openDataSet(COMPRESS_PT); - DSetCreatPropList dcplID = dsetID.getCreatePlist(); + DSetCreatPropList dcpl = dset.getCreatePlist(); - dcplID.getFilterById(H5Z_FILTER_DEFLATE, flags, cd_nelemts, NULL, 0, NULL, config); + char filter_name[8]; + dcpl.getFilterById(H5Z_FILTER_DEFLATE, flags, cd_nelemts, NULL, 8, filter_name, config); + if (HDstrncmp(filter_name, "deflate", 7) != 0) + H5_FAILED() } catch (Exception e) { H5_FAILED(); return 1; @@ -296,6 +312,7 @@ int TestCompress() return 0; } +const char* PT_TESTGETPT = "/TestGetPacket"; int TestGetPacket() { int record; @@ -304,7 +321,7 @@ int TestGetPacket() TESTING("GetPacket") /* Create a dataset. Explicitly specify no compression */ - FL_PacketTable wrapper(fileID, "/TestGetPacket", H5T_NATIVE_INT, 1, -1); + FL_PacketTable wrapper(fileID, H5P_DEFAULT, PT_TESTGETPT, H5T_NATIVE_INT, 1); if(! wrapper.IsValid()) goto out; @@ -334,12 +351,14 @@ out: return 1; } +const char* PT_TESTERROR = "/TestErrors"; + int TestErrors() { TESTING("error conditions") /* Create a dataset */ - FL_PacketTable wrapper(fileID, "/TestErrors", H5T_NATIVE_INT, 1); + FL_PacketTable wrapper(fileID, H5P_DEFAULT, PT_TESTERROR, H5T_NATIVE_INT, 1); if(! wrapper.IsValid()) goto out; @@ -443,6 +462,8 @@ out: return 1; } +const char* PT_SYSTEMTST1 = "/SystemTest1"; +const char* PT_SYSTEMTST2 = "/SystemTest2"; int SystemTest() { TESTING("multiple datatypes") @@ -485,8 +506,8 @@ int SystemTest() ct2[0].g.e = 3000; /* Create the packet table datasets. Make one of them compressed. */ - FL_PacketTable wrapper1(fileID, "/SystemTest1", dtypeID1, 1); - FL_PacketTable wrapper2(fileID, "/SystemTest2", dtypeID2, 1, 5); + FL_PacketTable wrapper1(fileID, H5P_DEFAULT, PT_SYSTEMTST1, dtypeID1, 1); + FL_PacketTable wrapper2(fileID, H5P_DEFAULT, PT_SYSTEMTST2, dtypeID2, 1); if(! wrapper1.IsValid()) goto out; -- cgit v0.12 From a3a0526cb8492d24488fef10ff16b4ff1cf7fd23 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Wed, 9 Mar 2016 07:54:52 -0500 Subject: [svn-r29366] Purpose: Update RELEASE.txt Description: Added note about the changes in the C++ Packet Table library --- release_docs/RELEASE.txt | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 23fc6c9..0d2f202 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -416,7 +416,7 @@ New Features High-Level APIs: ------ - - New public functions in Packet Table API + - New public functions in the C Packet Table API Two accessor functions were added per HDFFV-8623/patch 003. /* Returns the ID of the dataset associated with the packet table */ @@ -426,6 +426,28 @@ New Features hid_t H5PTget_type(hid_t table_id); (BMR, 2016/03/04, HDFFV-8623) + - New public functions in the C++ Packet Table API + + Two accessor wrappers to class PacketTable, per HDFFV-8623/patch 004. + /* Returns the ID of the dataset associated with the packet table */ + hid_t PacketTable::GetDataset() + + /* Returns the ID of the datatype the packet table uses */ + hid_t PacketTable::GetDataset() + (BMR, 2016/03/04, HDFFV-8623) + + - Member functions having "char*" as an argument + + Overloaded functions were added to provide "const char*" argument, the + existing version will be deprecated. + (BMR, 2016/03/04) + + - Commented out functions are renewed + + The old function VL_PacketTable::FreeReadBuff that had been ifdef'ed out + now became PacketTable::FreeBuff() + (BMR, 2016/03/04, HDFFV-442) + - A new API function H5DOwrite_chunk. It writes a data chunk directly into a file bypassing hyperslab selection, data conversion, and filter pipeline. The user must be careful with the function and -- cgit v0.12 From 5ced585e053ea1e7b591d0263b88fd18d0c047e5 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Wed, 9 Mar 2016 08:56:58 -0500 Subject: [svn-r29369] Description: More updates about the Packet Table improvement. --- release_docs/RELEASE.txt | 66 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 52 insertions(+), 14 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 0d2f202..bf2504b 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -415,25 +415,57 @@ New Features High-Level APIs: - ------ - - New public functions in the C Packet Table API + --------------- + + C Packet Table API + ------------------ + - Replacement of a public function + + The existing function H5PTcreate_fl limits applications to deflate + compression only. The public function H5PTcreate is added to replace + H5PTcreate_fl. H5PTcreate takes a property list ID to provide + flexibility on creation properties. + + hid_t H5PTcreate(hid_t loc_id, const char *dset_name, + hid_t dtype_id, hsize_t chunk_size, hid_t plist_id); + (BMR, 2016/03/04, HDFFV-8623) + + - New public functions Two accessor functions were added per HDFFV-8623/patch 003. - /* Returns the ID of the dataset associated with the packet table */ - hid_t H5PTget_dataset(hid_t table_id); + /* Returns the ID of the dataset associated with the packet table */ + hid_t H5PTget_dataset(hid_t table_id); - /* Returns the ID of the datatype the packet table uses */ - hid_t H5PTget_type(hid_t table_id); + /* Returns the ID of the datatype the packet table uses */ + hid_t H5PTget_type(hid_t table_id); (BMR, 2016/03/04, HDFFV-8623) - - New public functions in the C++ Packet Table API + - Regarding #ifdef VLPT_REMOVED + + The #ifdef VLPT_REMOVED blocks are removed from the PT library source + except the following cases: + + H5PTis_varlen() is made available again. + + H5PTfree_vlen_readbuff() now became H5PTfree_vlen_buff() + (BMR, 2016/03/04, HDFFV-442) + + C++ Packet Table API + -------------------- + - New constructor + + An overloaded constructor is added to FL_PacketTable and takes a property + list ID to provide flexibility on creation properties. + + FL_PacketTable(hid_t fileID, hid_t plist_id, const char* name, hid_t dtypeID, hsize_t chunkSize); + (BMR, 2016/03/08, HDFFV-8623) + + - New public functions Two accessor wrappers to class PacketTable, per HDFFV-8623/patch 004. - /* Returns the ID of the dataset associated with the packet table */ - hid_t PacketTable::GetDataset() + /* Returns the ID of the dataset associated with the packet table */ + hid_t PacketTable::GetDataset() - /* Returns the ID of the datatype the packet table uses */ - hid_t PacketTable::GetDataset() + /* Returns the ID of the datatype the packet table uses */ + hid_t PacketTable::GetDataset() (BMR, 2016/03/04, HDFFV-8623) - Member functions having "char*" as an argument @@ -442,12 +474,18 @@ New Features existing version will be deprecated. (BMR, 2016/03/04) - - Commented out functions are renewed + - Regarding #ifdef VLPT_REMOVED + + The #ifdef VLPT_REMOVED blocks are removed from the PT library source + except the following cases: + + VL_PacketTable::IsVariableLength() is moved to PacketTable + + VL_PacketTable::FreeReadBuff() now became PacketTable::FreeBuff() - The old function VL_PacketTable::FreeReadBuff that had been ifdef'ed out - now became PacketTable::FreeBuff() (BMR, 2016/03/04, HDFFV-442) + + Internal header file + -------------------- - A new API function H5DOwrite_chunk. It writes a data chunk directly into a file bypassing hyperslab selection, data conversion, and filter pipeline. The user must be careful with the function and -- cgit v0.12 From 23e97565cfb9adf329315635fb58553b14670b47 Mon Sep 17 00:00:00 2001 From: Mohamad Chaarawi Date: Wed, 9 Mar 2016 10:03:16 -0500 Subject: [svn-r29372] minor error reporting fix. --- src/H5S.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/H5S.c b/src/H5S.c index 738a7da..2fab71a 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -37,7 +37,7 @@ /* Local Macros */ /****************/ -/* Version of datatype encoding */ +/* Version of dataspace encoding */ #define H5S_ENCODE_VERSION 0 @@ -1550,7 +1550,7 @@ H5Sencode(hid_t obj_id, void *buf, size_t *nalloc) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace") if(H5S_encode(dspace, (unsigned char **)&buf, nalloc)<0) - HGOTO_ERROR(H5E_DATATYPE, H5E_CANTENCODE, FAIL, "can't encode datatype") + HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode dataspace") done: FUNC_LEAVE_API(ret_value) -- cgit v0.12 From f5234cd194837790662e0b634fd6236137177674 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Wed, 9 Mar 2016 13:55:31 -0500 Subject: [svn-r29379] Add individual LT_VERS_* variables for wrapper libraries: c++, fortran, java, hl, hl/c++, hl/fortran to so that the shared object version numbers can be incremented independently. Disabled auto-increment of shared object version numbers by h5vers. Files modified: config/lt_vers.am java/src/jni/Makefile.am hl/src/Makefile.am hl/c++/src/Makefile.am hl/fortran/src/Makefile.am c++/src/Makefile.am bin/h5vers fortran/src/Makefile.am --- bin/h5vers | 18 +++++++++++------- c++/src/Makefile.am | 2 +- config/lt_vers.am | 33 +++++++++++++++++++++++++++++---- fortran/src/Makefile.am | 2 +- hl/c++/src/Makefile.am | 2 +- hl/fortran/src/Makefile.am | 2 +- hl/src/Makefile.am | 2 +- java/src/jni/Makefile.am | 2 +- 8 files changed, 46 insertions(+), 17 deletions(-) diff --git a/bin/h5vers b/bin/h5vers index 7e61dc8..e9df387 100755 --- a/bin/h5vers +++ b/bin/h5vers @@ -277,13 +277,17 @@ if ($LT_VERS && $version_increased) { local($_) = $contentsy; - my ($lt_revision) = /^LT_VERS_REVISION\s*=\s*(\d+)/m; - my $new_lt_revision = $lt_revision+1; - ($contentsy) =~ s/^(LT_VERS_REVISION\s*=\s*)\d+/$1$new_lt_revision/m; - - open FILE, ">$LT_VERS" or die "$LT_VERS: $!\n"; - print FILE $contentsy; - close FILE; +# As of the HDF5 v1.8.16 release, h5vers should not increment +# the LT_VERS numbers, so the next 6 lines are commented out. +# A future version may copy the numbers to H5public.h, so this +# section is retained for future reference. +# my ($lt_revision) = /^LT_VERS_REVISION\s*=\s*(\d+)/m; +# my $new_lt_revision = $lt_revision+1; +# ($contentsy) =~ s/^(LT_VERS_REVISION\s*=\s*)\d+/$1$new_lt_revision/m; + +# open FILE, ">$LT_VERS" or die "$LT_VERS: $!\n"; +# print FILE $contentsy; +# close FILE; } # Update the README.txt file diff --git a/c++/src/Makefile.am b/c++/src/Makefile.am index 84af348..6cd4768 100644 --- a/c++/src/Makefile.am +++ b/c++/src/Makefile.am @@ -28,7 +28,7 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src lib_LTLIBRARIES=libhdf5_cpp.la # Add libtool numbers to the HDF5 C++ library (from config/lt_vers.am) -libhdf5_cpp_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS) +libhdf5_cpp_la_LDFLAGS= -version-info $(LT_CXX_VERS_INTERFACE):$(LT_CXX_VERS_REVISION):$(LT_CXX_VERS_AGE) $(AM_LDFLAGS) bin_SCRIPTS=h5c++ diff --git a/config/lt_vers.am b/config/lt_vers.am index a3b7634..24d24d2 100644 --- a/config/lt_vers.am +++ b/config/lt_vers.am @@ -19,8 +19,8 @@ # After making changes, run bin/reconfigure to update other configure related # files like Makefile.in. LT_VERS_INTERFACE = 6 -LT_VERS_REVISION = 224 LT_VERS_AGE = 0 +LT_VERS_REVISION = 224 ## If the API changes *at all*, increment LT_VERS_INTERFACE and ## reset LT_VERS_REVISION to 0. @@ -40,9 +40,34 @@ LT_VERS_AGE = 0 ## Note that this versioning system doesn't attempt to handle ## the effects of the H5_V1_x_COMPAT flag. ## -## Since the revision number is automatically incremented by -## bin/h5vers, don't move LT_VERS_REVISION from the fourth line -## without also editing the script! +## Version numbers for wrapper shared library files. +LT_CXX_VERS_INTERFACE = 6 +LT_CXX_VERS_REVISION = 224 +LT_CXX_VERS_AGE = 0 + +LT_F_VERS_INTERFACE = 6 +LT_F_VERS_REVISION = 224 +LT_F_VERS_AGE = 0 + +LT_HL_VERS_INTERFACE = 6 +LT_HL_VERS_REVISION = 224 +LT_HL_VERS_AGE = 0 + +LT_HL_CXX_VERS_INTERFACE = 6 +LT_HL_CXX_VERS_REVISION = 224 +LT_HL_CXX_VERS_AGE = 0 + +LT_HL_F_VERS_INTERFACE = 6 +LT_HL_F_VERS_REVISION = 224 +LT_HL_F_VERS_AGE = 0 + +LT_JAVA_VERS_INTERFACE = 6 +LT_JAVA_VERS_REVISION = 224 +LT_JAVA_VERS_AGE = 0 + +LT_TOOLS_VERS_INTERFACE = 6 +LT_TOOLS_VERS_REVISION = 224 +LT_TOOLS_VERS_AGE = 0 # Copyright by The HDF Group. diff --git a/fortran/src/Makefile.am b/fortran/src/Makefile.am index f4d192b..a271666 100644 --- a/fortran/src/Makefile.am +++ b/fortran/src/Makefile.am @@ -32,7 +32,7 @@ AM_FCLIBS=$(LIBHDF5) lib_LTLIBRARIES=libhdf5_fortran.la # Add libtool numbers to the HDF5 Fortran library (from config/lt_vers.am) -libhdf5_fortran_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS) +libhdf5_fortran_la_LDFLAGS= -version-info $(LT_F_VERS_INTERFACE):$(LT_F_VERS_REVISION):$(LT_F_VERS_AGE) $(AM_LDFLAGS) # Some Fortran compilers can't build shared libraries, so sometimes we # want to build a shared C library and a static Fortran library. If so, diff --git a/hl/c++/src/Makefile.am b/hl/c++/src/Makefile.am index b268948..c78f5fa 100644 --- a/hl/c++/src/Makefile.am +++ b/hl/c++/src/Makefile.am @@ -28,7 +28,7 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/hl/src lib_LTLIBRARIES=libhdf5_hl_cpp.la # Add libtool numbers to the HDF5 HL C++ library (from config/lt_vers.am) -libhdf5_hl_cpp_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS) +libhdf5_hl_cpp_la_LDFLAGS= -version-info $(LT_HL_CXX_VERS_INTERFACE):$(LT_HL_CXX_VERS_REVISION):$(LT_HL_CXX_VERS_AGE) $(AM_LDFLAGS) # Source files for the library # At the moment, only the H5PT Packet Table has a C++ API. diff --git a/hl/fortran/src/Makefile.am b/hl/fortran/src/Makefile.am index d190ed1..571ca45 100644 --- a/hl/fortran/src/Makefile.am +++ b/hl/fortran/src/Makefile.am @@ -30,7 +30,7 @@ AM_FCFLAGS+=-I$(top_builddir)/fortran/src $(F9XMODFLAG)$(top_builddir)/fortran/s lib_LTLIBRARIES=libhdf5hl_fortran.la # Add libtool numbers to the HDF5 HL Fortran library (from config/lt_vers.am) -libhdf5hl_fortran_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS) +libhdf5hl_fortran_la_LDFLAGS= -version-info $(LT_HL_F_VERS_INTERFACE):$(LT_HL_F_VERS_REVISION):$(LT_HL_F_VERS_AGE) $(AM_LDFLAGS) # Some Fortran compilers can't build shared libraries, so sometimes we # want to build a shared C library and a static Fortran library. If so, diff --git a/hl/src/Makefile.am b/hl/src/Makefile.am index 1e781a9..e772233 100644 --- a/hl/src/Makefile.am +++ b/hl/src/Makefile.am @@ -28,7 +28,7 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src lib_LTLIBRARIES=libhdf5_hl.la # Add libtool numbers to the HDF5 hl library (from config/lt_vers.am) -libhdf5_hl_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS) +libhdf5_hl_la_LDFLAGS= -version-info $(LT_HL_VERS_INTERFACE):$(LT_HL_VERS_REVISION):$(LT_HL_VERS_AGE) $(AM_LDFLAGS) # List sources to include in the HDF5 HL Library. libhdf5_hl_la_SOURCES=H5DO.c H5DS.c H5IM.c H5LT.c H5LTanalyze.c H5LTparse.c H5PT.c H5TB.c diff --git a/java/src/jni/Makefile.am b/java/src/jni/Makefile.am index 764fcdb..4667407 100644 --- a/java/src/jni/Makefile.am +++ b/java/src/jni/Makefile.am @@ -31,7 +31,7 @@ AM_CPPFLAGS+=-I$(top_srcdir)/src -I$(top_srcdir)/java/src/jni $(JNIFLAGS) lib_LTLIBRARIES=libhdf5_java.la # Add libtool numbers to the HDF5 Java (JNI) library (from config/lt_vers.am) -libhdf5_java_la_LDFLAGS= -version-info $(LT_VERS_INTERFACE):$(LT_VERS_REVISION):$(LT_VERS_AGE) $(AM_LDFLAGS) +libhdf5_java_la_LDFLAGS= -version-info $(LT_JAVA_VERS_INTERFACE):$(LT_JAVA_VERS_REVISION):$(LT_JAVA_VERS_AGE) $(AM_LDFLAGS) # Source files for the library libhdf5_java_la_SOURCES=exceptionImp.c h5Constants.c nativeData.c h5util.c h5Imp.c \ -- cgit v0.12 From 5938b81835746550f5adc5f76c9110ec37ed82a1 Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Wed, 9 Mar 2016 15:14:16 -0500 Subject: [svn-r29382] Change LT_VERS_* to 1000, 0, 0 for HDF5 1.10.0 release. --- config/lt_vers.am | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/config/lt_vers.am b/config/lt_vers.am index 24d24d2..eb630a7 100644 --- a/config/lt_vers.am +++ b/config/lt_vers.am @@ -18,9 +18,9 @@ # See libtool versioning documentation online. # After making changes, run bin/reconfigure to update other configure related # files like Makefile.in. -LT_VERS_INTERFACE = 6 +LT_VERS_INTERFACE = 1000 LT_VERS_AGE = 0 -LT_VERS_REVISION = 224 +LT_VERS_REVISION = 0 ## If the API changes *at all*, increment LT_VERS_INTERFACE and ## reset LT_VERS_REVISION to 0. @@ -41,32 +41,32 @@ LT_VERS_REVISION = 224 ## the effects of the H5_V1_x_COMPAT flag. ## ## Version numbers for wrapper shared library files. -LT_CXX_VERS_INTERFACE = 6 -LT_CXX_VERS_REVISION = 224 +LT_CXX_VERS_INTERFACE = 1000 +LT_CXX_VERS_REVISION = 0 LT_CXX_VERS_AGE = 0 -LT_F_VERS_INTERFACE = 6 -LT_F_VERS_REVISION = 224 +LT_F_VERS_INTERFACE = 1000 +LT_F_VERS_REVISION = 0 LT_F_VERS_AGE = 0 -LT_HL_VERS_INTERFACE = 6 -LT_HL_VERS_REVISION = 224 +LT_HL_VERS_INTERFACE = 1000 +LT_HL_VERS_REVISION = 0 LT_HL_VERS_AGE = 0 -LT_HL_CXX_VERS_INTERFACE = 6 -LT_HL_CXX_VERS_REVISION = 224 +LT_HL_CXX_VERS_INTERFACE = 1000 +LT_HL_CXX_VERS_REVISION = 0 LT_HL_CXX_VERS_AGE = 0 -LT_HL_F_VERS_INTERFACE = 6 -LT_HL_F_VERS_REVISION = 224 +LT_HL_F_VERS_INTERFACE = 1000 +LT_HL_F_VERS_REVISION = 0 LT_HL_F_VERS_AGE = 0 -LT_JAVA_VERS_INTERFACE = 6 -LT_JAVA_VERS_REVISION = 224 +LT_JAVA_VERS_INTERFACE = 1000 +LT_JAVA_VERS_REVISION = 0 LT_JAVA_VERS_AGE = 0 -LT_TOOLS_VERS_INTERFACE = 6 -LT_TOOLS_VERS_REVISION = 224 +LT_TOOLS_VERS_INTERFACE = 1000 +LT_TOOLS_VERS_REVISION = 0 LT_TOOLS_VERS_AGE = 0 -- cgit v0.12 From 8f874a501024607e617200c28d16c20757ddb29e Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sat, 12 Mar 2016 04:23:51 -0500 Subject: [svn-r29395] Corrected parentheses in floating-point compare macros. Corrected H5_EB and H5_PB macros. Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 autotools serial w/ Java, Fortran, & C++ --- src/H5private.h | 17 +++++++++-------- src/H5timer.c | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/H5private.h b/src/H5private.h index fa5a114..e0ed6ef 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -538,20 +538,21 @@ * It's the developer's responsibility not to pass in the value 0, which * may cause the equation to fail. */ -#define H5_FLT_ABS_EQUAL(X,Y) (HDfabsf(X-Y) < FLT_EPSILON) -#define H5_DBL_ABS_EQUAL(X,Y) (HDfabs (X-Y) < DBL_EPSILON) -#define H5_LDBL_ABS_EQUAL(X,Y) (HDfabsl(X-Y) < LDBL_EPSILON) +#define H5_FLT_ABS_EQUAL(X,Y) (HDfabsf((X)-(Y)) < FLT_EPSILON) +#define H5_DBL_ABS_EQUAL(X,Y) (HDfabs ((X)-(Y)) < DBL_EPSILON) +#define H5_LDBL_ABS_EQUAL(X,Y) (HDfabsl((X)-(Y)) < LDBL_EPSILON) -#define H5_FLT_REL_EQUAL(X,Y,M) (HDfabsf((Y-X) / X) < M) -#define H5_DBL_REL_EQUAL(X,Y,M) (HDfabs ((Y-X) / X) < M) -#define H5_LDBL_REL_EQUAL(X,Y,M) (HDfabsl((Y-X) / X) < M) +#define H5_FLT_REL_EQUAL(X,Y,M) (HDfabsf(((Y)-(X)) / (X)) < (M)) +#define H5_DBL_REL_EQUAL(X,Y,M) (HDfabs (((Y)-(X)) / (X)) < (M)) +#define H5_LDBL_REL_EQUAL(X,Y,M) (HDfabsl(((Y)-(X)) / (X)) < (M)) -/* KiB, MiB, GiB, TiB, EiB - Used in profiling and timing code */ +/* KiB, MiB, GiB, TiB, PiB, EiB - Used in profiling and timing code */ #define H5_KB (1024.0F) #define H5_MB (1024.0F * 1024.0F) #define H5_GB (1024.0F * 1024.0F * 1024.0F) #define H5_TB (1024.0F * 1024.0F * 1024.0F * 1024.0F) -#define H5_EB (1024.0F * 1024.0F * 1024.0F * 1024.0F * 1024.0F) +#define H5_PB (1024.0F * 1024.0F * 1024.0F * 1024.0F * 1024.0F) +#define H5_EB (1024.0F * 1024.0F * 1024.0F * 1024.0F * 1024.0F * 1024.0F) #ifndef H5_HAVE_FLOCK /* flock() operations. Used in the source so we have to define them when diff --git a/src/H5timer.c b/src/H5timer.c index 94f2883..d9be6bb 100644 --- a/src/H5timer.c +++ b/src/H5timer.c @@ -228,7 +228,7 @@ H5_bandwidth(char *buf/*out*/, double nbytes, double nseconds) } else if(bw < H5_TB) { sprintf(buf, "%05.4f", bw / H5_GB); HDstrcpy(buf+5, " GB/s"); - } else if(bw < H5_EB) { + } else if(bw < H5_PB) { sprintf(buf, "%05.4f", bw / H5_TB); HDstrcpy(buf+5, " TB/s"); } else { -- cgit v0.12 From 85711b31d83b06c2a21d0e2d39dbdc809da932f2 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 14 Mar 2016 12:51:41 -0500 Subject: [svn-r29399] HDFFV-9717: add overview section to javadocs --- MANIFEST | 1 + config/cmake/HDF518_Examples.cmake.in | 4 ++ config/cmake/UseJava.cmake | 68 +++++++++++++++++++++++-- java/src/hdf/hdf5lib/CMakeLists.txt | 1 + java/src/hdf/overview.html | 96 +++++++++++++++++++++++++++++++++++ 5 files changed, 166 insertions(+), 4 deletions(-) create mode 100644 java/src/hdf/overview.html diff --git a/MANIFEST b/MANIFEST index 7de29fb..88b68c5 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2493,6 +2493,7 @@ ./java/src/hdf/CMakeLists.txt ./java/src/hdf/hdf5lib/CMakeLists.txt +./java/src/hdf/hdf5lib/overview.html ./java/src/hdf/hdf5lib/callbacks/Callbacks.java ./java/src/hdf/hdf5lib/callbacks/H5A_iterate_cb.java diff --git a/config/cmake/HDF518_Examples.cmake.in b/config/cmake/HDF518_Examples.cmake.in index 1be5c65..135dcfc 100644 --- a/config/cmake/HDF518_Examples.cmake.in +++ b/config/cmake/HDF518_Examples.cmake.in @@ -37,9 +37,13 @@ if(NOT DEFINED CTEST_SOURCE_NAME) endif() if(NOT DEFINED STATIC_LIBRARIES) set(STATICLIBRARIES "YES") +else(NOT DEFINED STATIC_LIBRARIES) + set(STATICLIBRARIES "NO") endif() if(NOT DEFINED FORTRAN_LIBRARIES) set(FORTRANLIBRARIES "NO") +else(NOT DEFINED FORTRAN_LIBRARIES) + set(FORTRANLIBRARIES "YES") endif() #TAR_SOURCE - name of tarfile diff --git a/config/cmake/UseJava.cmake b/config/cmake/UseJava.cmake index d694517..9b2b1e0 100644 --- a/config/cmake/UseJava.cmake +++ b/config/cmake/UseJava.cmake @@ -184,7 +184,7 @@ # This is used by install_jni_symlink(). # JAR_FILE The location of the jar file so that you can include # it. -# CLASS_DIR The directory where the class files can be found. For +# CLASSDIR The directory where the class files can be found. For # example to use them with javah. # # :: @@ -444,7 +444,7 @@ function(add_jar _TARGET_NAME) if (_add_jar_MANIFEST) set(_MANIFEST_OPTION m) - set(_MANIFEST_VALUE ${_add_jar_MANIFEST}) + get_filename_component (_MANIFEST_VALUE "${_add_jar_MANIFEST}" ABSOLUTE) endif () if (LIBRARY_OUTPUT_PATH) @@ -865,6 +865,7 @@ endfunction () function(create_javadoc _target) set(_javadoc_packages) set(_javadoc_files) + set(_javadoc_overview) set(_javadoc_sourcepath) set(_javadoc_classpath) set(_javadoc_installpath "${CMAKE_INSTALL_PREFIX}/share/javadoc") @@ -884,6 +885,8 @@ function(create_javadoc _target) set(_state "files") elseif (${arg} STREQUAL "SOURCEPATH") set(_state "sourcepath") + elseif (${arg} STREQUAL "OVERVIEW") + set(_state "overview") elseif (${arg} STREQUAL "CLASSPATH") set(_state "classpath") elseif (${arg} STREQUAL "INSTALLPATH") @@ -907,6 +910,8 @@ function(create_javadoc _target) set(_state "files") elseif (${arg} STREQUAL "SOURCEPATH") set(_state "sourcepath") + elseif (${arg} STREQUAL "OVERVIEW") + set(_state "overview") elseif (${arg} STREQUAL "CLASSPATH") set(_state "classpath") elseif (${arg} STREQUAL "INSTALLPATH") @@ -929,6 +934,8 @@ function(create_javadoc _target) set(_state "packages") elseif (${arg} STREQUAL "SOURCEPATH") set(_state "sourcepath") + elseif (${arg} STREQUAL "OVERVIEW") + set(_state "overview") elseif (${arg} STREQUAL "CLASSPATH") set(_state "classpath") elseif (${arg} STREQUAL "INSTALLPATH") @@ -951,6 +958,8 @@ function(create_javadoc _target) set(_state "packages") elseif (${arg} STREQUAL "FILES") set(_state "files") + elseif (${arg} STREQUAL "OVERVIEW") + set(_state "overview") elseif (${arg} STREQUAL "CLASSPATH") set(_state "classpath") elseif (${arg} STREQUAL "INSTALLPATH") @@ -975,6 +984,8 @@ function(create_javadoc _target) set(_state "files") elseif (${arg} STREQUAL "SOURCEPATH") set(_state "sourcepath") + elseif (${arg} STREQUAL "OVERVIEW") + set(_state "overview") elseif (${arg} STREQUAL "INSTALLPATH") set(_state "installpath") elseif (${arg} STREQUAL "DOCTITLE") @@ -997,6 +1008,8 @@ function(create_javadoc _target) set(_state "files") elseif (${arg} STREQUAL "SOURCEPATH") set(_state "sourcepath") + elseif (${arg} STREQUAL "OVERVIEW") + set(_state "overview") elseif (${arg} STREQUAL "DOCTITLE") set(_state "doctitle") elseif (${arg} STREQUAL "WINDOWTITLE") @@ -1017,6 +1030,8 @@ function(create_javadoc _target) set(_state "files") elseif (${arg} STREQUAL "SOURCEPATH") set(_state "sourcepath") + elseif (${arg} STREQUAL "OVERVIEW") + set(_state "overview") elseif (${arg} STREQUAL "INSTALLPATH") set(_state "installpath") elseif (${arg} STREQUAL "CLASSPATH") @@ -1039,6 +1054,8 @@ function(create_javadoc _target) set(_state "files") elseif (${arg} STREQUAL "SOURCEPATH") set(_state "sourcepath") + elseif (${arg} STREQUAL "OVERVIEW") + set(_state "overview") elseif (${arg} STREQUAL "CLASSPATH") set(_state "classpath") elseif (${arg} STREQUAL "INSTALLPATH") @@ -1061,6 +1078,8 @@ function(create_javadoc _target) set(_state "files") elseif (${arg} STREQUAL "SOURCEPATH") set(_state "sourcepath") + elseif (${arg} STREQUAL "OVERVIEW") + set(_state "overview") elseif (${arg} STREQUAL "CLASSPATH") set(_state "classpath") elseif (${arg} STREQUAL "INSTALLPATH") @@ -1085,6 +1104,8 @@ function(create_javadoc _target) set(_state "files") elseif (${arg} STREQUAL "SOURCEPATH") set(_state "sourcepath") + elseif (${arg} STREQUAL "OVERVIEW") + set(_state "overview") elseif (${arg} STREQUAL "CLASSPATH") set(_state "classpath") elseif (${arg} STREQUAL "INSTALLPATH") @@ -1109,6 +1130,8 @@ function(create_javadoc _target) set(_state "files") elseif (${arg} STREQUAL "SOURCEPATH") set(_state "sourcepath") + elseif (${arg} STREQUAL "OVERVIEW") + set(_state "overview") elseif (${arg} STREQUAL "CLASSPATH") set(_state "classpath") elseif (${arg} STREQUAL "INSTALLPATH") @@ -1126,6 +1149,30 @@ function(create_javadoc _target) else () set(_javadoc_version ${arg}) endif () + elseif (${_state} STREQUAL "overview") + if (${arg} STREQUAL "PACKAGES") + set(_state "packages") + elseif (${arg} STREQUAL "FILES") + set(_state "files") + elseif (${arg} STREQUAL "SOURCEPATH") + set(_state "sourcepath") + elseif (${arg} STREQUAL "CLASSPATH") + set(_state "classpath") + elseif (${arg} STREQUAL "INSTALLPATH") + set(_state "installpath") + elseif (${arg} STREQUAL "DOCTITLE") + set(_state "doctitle") + elseif (${arg} STREQUAL "WINDOWTITLE") + set(_state "windowtitle") + elseif (${arg} STREQUAL "AUTHOR") + set(_state "author") + elseif (${arg} STREQUAL "USE") + set(_state "use") + elseif (${arg} STREQUAL "VERSION") + set(_state "version") + else () + list(APPEND _javadoc_overview ${arg}) + endif () endif () endforeach () @@ -1145,6 +1192,19 @@ function(create_javadoc _target) set(_javadoc_options ${_javadoc_options} -sourcepath ${_sourcepath}) endif () + if (_javadoc_overview) + set(_start TRUE) + foreach(_path ${_javadoc_overview}) + if (_start) + set(_overview ${_path}) + set(_start FALSE) + else () + set(_overview ${_overview}:${_path}) + endif () + endforeach() + set(_javadoc_options ${_javadoc_options} -overview ${_overview}) + endif () + if (_javadoc_classpath) set(_start TRUE) foreach(_path ${_javadoc_classpath}) @@ -1212,7 +1272,7 @@ function (create_javah) set (_output_files) if (WIN32 AND NOT CYGWIN AND CMAKE_HOST_SYSTEM_NAME MATCHES "Windows") - set(_classpath_sep ";") + set(_classpath_sep "$") else () set(_classpath_sep ":") endif() @@ -1242,7 +1302,7 @@ function (create_javah) endif() endforeach() string (REPLACE ";" "${_classpath_sep}" _classpath "${_classpath}") - list (APPEND _javah_options -classpath ${_classpath}) + list (APPEND _javah_options -classpath "${_classpath}") endif() if (_create_javah_OUTPUT_DIR) diff --git a/java/src/hdf/hdf5lib/CMakeLists.txt b/java/src/hdf/hdf5lib/CMakeLists.txt index 56c1e59..c2daff4 100644 --- a/java/src/hdf/hdf5lib/CMakeLists.txt +++ b/java/src/hdf/hdf5lib/CMakeLists.txt @@ -114,6 +114,7 @@ set_target_properties (${HDF5_JAVA_HDF5_LIB_TARGET} PROPERTIES FOLDER libraries/ create_javadoc(hdf5_java_doc FILES ${HDF5_JAVA_HDF_HDF5_CALLBACKS_SRCS} ${HDF5_JAVA_HDF_HDF5_EXCEPTIONS_SRCS} ${HDF5_JAVA_HDF_HDF5_STRUCTS_SRCS} ${HDF5_JAVA_HDF_HDF5_SRCS} + OVERVIEW ${HDF5_JAVA_HDF5_SRC_DIR}/overview.html CLASSPATH ${CMAKE_JAVA_INCLUDE_PATH} WINDOWTITLE "HDF5 Java" DOCTITLE "

HDF5 Java Wrapper

" diff --git a/java/src/hdf/overview.html b/java/src/hdf/overview.html new file mode 100644 index 0000000..39d75b7 --- /dev/null +++ b/java/src/hdf/overview.html @@ -0,0 +1,96 @@ + + +

Java HDF5 Interface (JHI5)

+ +

What it is

+The Java HD5 Interface (JHI5) is a Java package +(hdf.hdf5lib) +that ``wraps around'' the HDF5 library. +

There are a large number of functions in the HDF5 +library (version 1.10). Some of the functions are not supported in JHI5. Most +of the unsupported functions have C function pointers, which is not currently +implemented in JHI5. + +

+ + + +
+
Note: The JHI5 does not support HDF4 or earlier.
+
+ +

The JHI5 may be used by any Java application that needs to access HDF5 +files. It is extremely important to emphasize that this package is not +a pure Java implementation of the HDF5 library. The JHI5 calls the +same HDF5 library that is used by C or FORTRAN programs. (Note that this +product cannot be used in most network browsers because it accesses the +local disk using native code.) +

The Java HDF5 Interface consists of Java classes and a dynamically +linked native library. The Java classes declare native methods, and the +library contains C functions which implement the native methods. The C +functions call the standard HDF5 library, which is linked as part of the +same library on most platforms. +

The central part of the JHI5 is the Java class +hdf.hdf5lib.H5. +The H5 class calls the standard (i.e., `native' code) HDF5 +library, with native methods for most of the HDF5 functions. + +

+How to use it

+The JHI5 is used by Java classes to call the HDF5 library, in order to +create HDF5 files, and read and write data in existing HDF5 files. +

For example, the HDF5 library has the function H5Fopen to open +an HDF5 file. The Java interface is the class +hdf.hdf5lib.H5, +which has a method: +

static native int H5Fopen(String filename, int flags, int access );
+The native method is implemented in C using the +Java +Native Method Interface (JNI). This is written something like the following: +
JNIEXPORT jint
+JNICALL Java_hdf_hdf5lib_H5_H5Fopen
+(
+ JNIEnv *env,
+ jclass class,
+ jstring hdfFile,
+ jint flags,
+ jint access)
+ {
+
+ /* ...convert Java String to (char *) */
+
+ /* call the HDF library */
+ retVal = H5Fopen((char *)file, (unsigned)flags, (hid_t)access );
+
+ /* ... */
+}
+This C function calls the HDF5 library and returns the result appropriately. +

There is one native method for each HDF entry point (several hundred +in all), which are compiled with the HDF library into a dynamically loaded +library (libhdf5_java). Note that this library must be built for each +platform. +

To call the HDF `H5Fopen' function, a Java program would +import the package 'hdf.hdf5lib.*', and invoke the method +on the class 'H5'. The Java program would look something +like this: +

import hdf.hdf5lib.*;
+
+{
+ /* ... */
+
+ try {
+ file = H5.Hopen("myFile.hdf", flags, access );
+ } catch (HDF5Exception ex) {
+ //...
+ }
+
+ /* ... */
+}
+The H5 class automatically loads the native method implementations +and the HDF5 library. + +

+To Obtain

+The JHI5 is included with the HDF5 library. + + -- cgit v0.12 From 8d9b56a7e8065565cd434f1de57612cc62cffe84 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 14 Mar 2016 12:56:15 -0500 Subject: [svn-r29400] HDFFV-9717: add overview section to javadocs --- java/src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/src/Makefile.am b/java/src/Makefile.am index 7615973..9cd1b78 100644 --- a/java/src/Makefile.am +++ b/java/src/Makefile.am @@ -121,7 +121,7 @@ DOCTITLE = '

HDF5 Java Wrapper

' SRCDIR = '$(pkgpath)' docs: - $(JAVADOC) -sourcepath $(srcdir) -d javadoc -use -splitIndex -windowtitle $(WINDOWTITLE) -doctitle $(DOCTITLE) -J-Xmx180m -verbose -classpath $(CLASSPATH_ENV) hdf.hdf5lib + $(JAVADOC) -sourcepath $(srcdir) -d javadoc -use -splitIndex -windowtitle $(WINDOWTITLE) -doctitle $(DOCTITLE) -J-Xmx180m -verbose -overview $(srcdir)/overview.html -classpath $(CLASSPATH_ENV) hdf.hdf5lib CLEANFILES = classhdf5_java.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/callbacks/*.class $(JAVAROOT)/$(pkgpath)/exceptions/*.class $(JAVAROOT)/$(pkgpath)/structs/*.class $(JAVAROOT)/$(pkgpath)/*.class -- cgit v0.12 From 4c4cc0fa0960f0815f2333c1b98234e106b73557 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 14 Mar 2016 13:12:30 -0500 Subject: [svn-r29402] Add Java option --- config/cmake/scripts/HDF5config.cmake | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index 8bcc56b..485a2fb 100755 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -1,7 +1,7 @@ ############################################################################################# ### ${CTEST_SCRIPT_ARG} is of the form OPTION=VALUE ### ### BUILD_GENERATOR required [Unix, VS2015, VS201564, VS2013, VS201364, VS2012, VS201264] ### -### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201264 -C Release -V -O hdf519.log ### +### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201264 -C Release -V -O hdf5.log ### ############################################################################################# cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) @@ -23,20 +23,22 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) # CTEST_SOURCE_NAME - source folder # STATIC_LIBRARIES - Build/use static libraries # FORTRAN_LIBRARIES - Build/use fortran libraries +# JAVA_LIBRARIES - Build/use java libraries # NO_MAC_FORTRAN - Yes to be SHARED on a Mac ############################################################################## -set(CTEST_SOURCE_VERSION 1.9) -set(CTEST_SOURCE_VERSEXT "") +set(CTEST_SOURCE_VERSION 1.10.0) +set(CTEST_SOURCE_VERSEXT "-pre1") ############################################################################## # handle input parameters to script. #BUILD_GENERATOR - which CMake generator to use, required -#INSTALLDIR - HDF5-1.9 root folder +#INSTALLDIR - HDF5-1.10.0 root folder #CTEST_BUILD_CONFIGURATION - Release, Debug, RelWithDebInfo -#CTEST_SOURCE_NAME - name of source folder; HDF5-1.9 +#CTEST_SOURCE_NAME - name of source folder; HDF5-1.10.0 #STATIC_LIBRARIES - Default is YES #FORTRAN_LIBRARIES - Default is NO +#JAVA_LIBRARIES - Default is NO #NO_MAC_FORTRAN - set to TRUE to allow shared libs on a Mac if(DEFINED CTEST_SCRIPT_ARG) # transform ctest script arguments of the form @@ -88,9 +90,18 @@ if(NOT DEFINED CTEST_SOURCE_NAME) endif() if(NOT DEFINED STATIC_LIBRARIES) set(STATICLIBRARIES "YES") +else() + set(STATICLIBRARIES "NO") endif() if(NOT DEFINED FORTRAN_LIBRARIES) set(FORTRANLIBRARIES "NO") +else() + set(FORTRANLIBRARIES "YES") +endif() +if(NOT DEFINED JAVA_LIBRARIES) + set(JAVALIBRARIES "NO") +else() + set(JAVALIBRARIES "YES") endif() set(CTEST_BINARY_NAME "build") @@ -200,6 +211,12 @@ if(${FORTRANLIBRARIES}) else() set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") endif() +#### java #### +if(${JAVALIBRARIES}) + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=ON") +else() + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=OFF") +endif() ### disable test program builds #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_TESTING:BOOL=OFF") -- cgit v0.12 From f9dd7f1a80d4759f40fada7889cf9a1702a24492 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 14 Mar 2016 13:32:31 -0500 Subject: [svn-r29403] Correct file location and add overview to makefile --- MANIFEST | 2 +- java/src/Makefile.am | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/MANIFEST b/MANIFEST index 88b68c5..dc8cfba 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2492,8 +2492,8 @@ ./java/src/jni/h5zImp.h ./java/src/hdf/CMakeLists.txt +./java/src/hdf/overview.html ./java/src/hdf/hdf5lib/CMakeLists.txt -./java/src/hdf/hdf5lib/overview.html ./java/src/hdf/hdf5lib/callbacks/Callbacks.java ./java/src/hdf/hdf5lib/callbacks/H5A_iterate_cb.java diff --git a/java/src/Makefile.am b/java/src/Makefile.am index 9cd1b78..36a22ca 100644 --- a/java/src/Makefile.am +++ b/java/src/Makefile.am @@ -121,7 +121,7 @@ DOCTITLE = '

HDF5 Java Wrapper

' SRCDIR = '$(pkgpath)' docs: - $(JAVADOC) -sourcepath $(srcdir) -d javadoc -use -splitIndex -windowtitle $(WINDOWTITLE) -doctitle $(DOCTITLE) -J-Xmx180m -verbose -overview $(srcdir)/overview.html -classpath $(CLASSPATH_ENV) hdf.hdf5lib + $(JAVADOC) -sourcepath $(srcdir) -d javadoc -use -splitIndex -windowtitle $(WINDOWTITLE) -doctitle $(DOCTITLE) -J-Xmx180m -verbose -overview ./hdf/overview.html -classpath $(CLASSPATH_ENV) hdf.hdf5lib CLEANFILES = classhdf5_java.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/callbacks/*.class $(JAVAROOT)/$(pkgpath)/exceptions/*.class $(JAVAROOT)/$(pkgpath)/structs/*.class $(JAVAROOT)/$(pkgpath)/*.class -- cgit v0.12 From 4ed758aa3da4c3ee72e5adb552b9db6ff0a3f326 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 14 Mar 2016 13:33:12 -0500 Subject: [svn-r29404] correct filename in comment --- config/cmake/scripts/HDF5config.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index 485a2fb..cdbbbf5 100755 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) ############################################################################ # Usage: -# ctest -S HDF518config.cmake,OPTION=VALUE -C Release -VV -O test.log +# ctest -S HDF5config.cmake,OPTION=VALUE -C Release -VV -O test.log # where valid options for OPTION are: # BUILD_GENERATOR - The cmake build generator: # Unix * Unix Makefiles -- cgit v0.12 From 708227a1f9460ffb3cbe0a075d8a6cb6327983af Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 14 Mar 2016 14:10:30 -0500 Subject: [svn-r29406] Add Java and update options to CMake/Windows docs --- release_docs/INSTALL_CMake.txt | 127 +++++++++++++++++++++------------- release_docs/INSTALL_Cygwin.txt | 8 +-- release_docs/USING_CMake_Examples.txt | 2 +- release_docs/USING_HDF5_CMake.txt | 93 ++++++++++--------------- release_docs/USING_HDF5_VS.txt | 4 +- 5 files changed, 124 insertions(+), 110 deletions(-) diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 37326ed..b49b3a6 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -26,11 +26,11 @@ Obtaining HDF5 source code 2. Obtain compressed (*.tar or *.zip) HDF5 source from http://www.hdfgroup.org/ftp/HDF5/current/src/ and put it in "myhdfstuff". - Uncompress the file. There should be a hdf5-1.8."X" folder. + Uncompress the file. There should be a hdf5-1.10."X" folder. CMake version 1. We suggest you obtain the latest CMake from the Kitware web site. - The HDF5 1.8."X" product requires a minimum CMake version 3.1.0, + The HDF5 1.10."X" product requires a minimum CMake version 3.1.0, where "X" is the current HDF5 release version. Note: @@ -51,7 +51,7 @@ The following files referenced below are available at the HDF web site: http://www.hdfgroup.org/HDF5/release/cmakebuild.html Single compressed file with all the files needed, including source: - hdf5-1.8.16-CMake.zip or hdf5-1.8.16-CMake.tar.gz + hdf5-1.10.0-CMake.zip or hdf5-1.10.0-CMake.tar.gz Individual files ----------------------------------------------- @@ -84,19 +84,19 @@ To build HDF5 with the SZIP and ZLIB external libraries you will need to: following options: On 32-bit Windows with Visual Studio 2012, execute: - ctest -S HDF518config.cmake,BUILD_GENERATOR=VS2012 -C Release -VV -O hdf5.log + ctest -S HDF5config.cmake,BUILD_GENERATOR=VS2012 -C Release -VV -O hdf5.log On 64-bit Windows with Visual Studio 2012, execute: - ctest -S HDF518config.cmake,BUILD_GENERATOR=VS201264 -C Release -VV -O hdf5.log + ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201264 -C Release -VV -O hdf5.log On 32-bit Windows with Visual Studio 2013, execute: - ctest -S HDF518config.cmake,BUILD_GENERATOR=VS2013 -C Release -VV -O hdf5.log + ctest -S HDF5config.cmake,BUILD_GENERATOR=VS2013 -C Release -VV -O hdf5.log On 64-bit Windows with Visual Studio 2013, execute: - ctest -S HDF518config.cmake,BUILD_GENERATOR=VS201364 -C Release -VV -O hdf5.log + ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201364 -C Release -VV -O hdf5.log On Linux and Mac, execute: - ctest -S HDF518config.cmake,BUILD_GENERATOR=Unix -C Release -VV -O hdf5.log + ctest -S HDF5config.cmake,BUILD_GENERATOR=Unix -C Release -VV -O hdf5.log The command above will configure, build, test, and create an install package in the myhdfstuff folder. It will have the format: - HDF5-1.8.NN-. + HDF5-1.10.NN-. On Unix, will be "Linux". A similar .sh file will also be created. On Windows, will be "win64" or "win32". If you have an @@ -116,13 +116,13 @@ To build HDF5 with the SZIP and ZLIB external libraries you will need to: 6. To install, "X" is the current release version On Windows, execute: - HDF5-1.8."X"-win32.msi or HDF5-1.8."X"-win64.msi + HDF5-1.10."X"-win32.msi or HDF5-1.10."X"-win64.msi By default this program will install the hdf5 library into the "C:\Program Files" directory and will create the following directory structure: HDF_Group --HDF5 - ----1.8."X" + ----1.10."X" ------bin ------include ------lib @@ -130,35 +130,35 @@ To build HDF5 with the SZIP and ZLIB external libraries you will need to: On Linux, change to the install destination directory (create it if doesn't exist) and execute: - /myhdfstuff/HDF5-1.8."X"-Linux.sh + /myhdfstuff/HDF5-1.10."X"-Linux.sh After accepting the license, the script will prompt: By default the HDF5 will be installed in: - "/HDF5-1.8."X"-Linux" - Do you want to include the subdirectory HDF5-1.8."X"-Linux? + "/HDF5-1.10."X"-Linux" + Do you want to include the subdirectory HDF5-1.10."X"-Linux? Saying no will install in: "" [Yn]: Note that the script will create the following directory structure relative to the install point: HDF_Group --HDF5 - ----1.8."X" + ----1.10."X" ------bin ------include ------lib ------share - On Mac you will find HDF5-1.8."X"-Darwin.dmg in the myhdfstuff folder. Click + On Mac you will find HDF5-1.10."X"-Darwin.dmg in the myhdfstuff folder. Click on the dmg file to proceed with installation. After accepting the license, there will be a folder with the following structure: HDF_Group --HDF5 - ----1.8."X" + ----1.10."X" ------bin ------include ------lib ------share By default the installation will create the bin, include, lib and cmake - folders in the /HDF_Group/HDF5/1.8."X" + folders in the /HDF_Group/HDF5/1.10."X" ======================================================================== @@ -181,13 +181,13 @@ Notes: This short set of instructions is written for users who want to 5. Configure the C library, tools and tests with one of the following commands: On Windows 32 bit - cmake -G "Visual Studio 12 2013" -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTING:BOOL=ON -DHDF5_BUILD_TOOLS:BOOL=ON ..\hdf5-1.8."X" + cmake -G "Visual Studio 12 2013" -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTING:BOOL=ON -DHDF5_BUILD_TOOLS:BOOL=ON ..\hdf5-1.10."X" On Windows 64 bit - cmake -G "Visual Studio 12 2013 Win64" -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTING:BOOL=ON -DHDF5_BUILD_TOOLS:BOOL=ON ..\hdf5-1.8."X" + cmake -G "Visual Studio 12 2013 Win64" -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTING:BOOL=ON -DHDF5_BUILD_TOOLS:BOOL=ON ..\hdf5-1.10."X" On Linux and Mac - cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTING:BOOL=ON -DHDF5_BUILD_TOOLS:BOOL=ON ../hdf5-1.8."X" + cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTING:BOOL=ON -DHDF5_BUILD_TOOLS:BOOL=ON ../hdf5-1.10."X" where "X" is the current release version. @@ -202,13 +202,13 @@ Notes: This short set of instructions is written for users who want to 9. To install On Windows, execute: - HDF5-1.8."X"-win32.msi or HDF5-1.8."X"-win64.msi + HDF5-1.10."X"-win32.msi or HDF5-1.10."X"-win64.msi By default this program will install the hdf5 library into the "C:\Program Files" directory and will create the following directory structure: HDF_Group --HDF5 - ----1.8."X" + ----1.10."X" ------bin ------include ------lib @@ -216,28 +216,28 @@ Notes: This short set of instructions is written for users who want to On Linux, change to the install destination directory (create if doesn't exist) and execute: - /myhdfstuff/build/HDF5-1.8."X"-Linux.sh + /myhdfstuff/build/HDF5-1.10."X"-Linux.sh After accepting the license, the script will prompt: By default the HDF5 will be installed in: - "/HDF5-1.8."X"-Linux" - Do you want to include the subdirectory HDF5-1.8."X"-Linux? + "/HDF5-1.10."X"-Linux" + Do you want to include the subdirectory HDF5-1.10."X"-Linux? Saying no will install in: "" [Yn]: Note that the script will create the following directory structure relative to the install point: HDF_Group --HDF5 - ----1.8."X" + ----1.10."X" ------bin ------include ------lib ------share - On Mac you will find HDF5-1.8."X"-Darwin.dmg in the build folder. Click + On Mac you will find HDF5-1.10."X"-Darwin.dmg in the build folder. Click on the dmg file to proceed with installation. After accepting the license, there will be a folder with the following structure: HDF_Group --HDF5 - ----1.8."X" + ----1.10."X" ------bin ------include ------lib @@ -249,7 +249,7 @@ IV. Further considerations ======================================================================== 1. We suggest you obtain the latest CMake for windows from the Kitware - web site. The HDF5 1.8."X" product requires a minimum CMake version 3.1.0. + web site. The HDF5 1.10."X" product requires a minimum CMake version 3.1.0. 2. If you plan to use Zlib or Szip: A. Download the binary packages and install them in a central location. @@ -380,8 +380,8 @@ These five steps are described in detail below. * Visual Studio 12 2013 Win64 * Visual Studio 11 2012 * Visual Studio 11 2012 Win64 - * Visual Studio 10 2010 - * Visual Studio 10 2010 Win64 + * Visual Studio 14 2015 + * Visual Studio 14 2015 Win64 is: * SZIP_INCLUDE_DIR:PATH= @@ -570,35 +570,43 @@ BUILD_TESTING "Build HDF5 Unit Testing" ON HDF5_BUILD_CPP_LIB "Build HDF5 C++ Library" ON HDF5_BUILD_EXAMPLES "Build HDF5 Library Examples" ON HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF +HDF5_BUILD_JAVA "Build JAVA support" OFF HDF5_BUILD_HL_LIB "Build HIGH Level HDF5 Library" ON HDF5_BUILD_TOOLS "Build HDF5 Tools" ON -if (HDF5_BUILD_FORTRAN) - HDF5_ENABLE_F2003 "Enable FORTRAN 2003 Standard" ON ---------------- HDF5 Advanced Options --------------------- +ALLOW_UNSUPPORTED "Allow unsupported combinations of configure options" OFF HDF5_DISABLE_COMPILER_WARNINGS "Disable compiler warnings" OFF -HDF5_Enable_Clear_File_Buffers "Securely clear file buffers before writing to file" ON -HDF5_Enable_Instrument "Instrument The library" OFF +HDF5_ENABLE_INSTRUMENT "Instrument The library" OFF HDF5_ENABLE_CODESTACK "Enable the function stack tracing (for developer debugging)." OFF HDF5_ENABLE_COVERAGE "Enable code coverage for Libraries and Programs" OFF +HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF HDF5_ENABLE_DEPRECATED_SYMBOLS "Enable deprecated public API symbols" ON +HDF5_ENABLE_DIRECT_VFD "Build the Direct I/O Virtual File Driver" OFF HDF5_ENABLE_EMBEDDED_LIBINFO "embed library info into executables" ON HDF5_ENABLE_HSIZET "Enable datasets larger than memory" ON HDF5_ENABLE_LARGE_FILE "Enable support for large (64-bit) files on Linux." ON HDF5_ENABLE_PARALLEL "Enable parallel build (requires MPI)" OFF HDF5_ENABLE_TRACE "Enable API tracing capability" OFF HDF5_ENABLE_USING_MEMCHECKER "Indicate that a memory checker is used" OFF +HDF5_GENERATE_HEADERS "Rebuild Generated Files" OFF +HDF5_JAVA_PACK_JRE "Package a JRE installer directory" OFF HDF5_MEMORY_ALLOC_SANITY_CHECK "Indicate that internal memory allocation sanity checks are enabled" OFF HDF5_METADATA_TRACE_FILE "Enable metadata trace file collection" OFF HDF5_NO_PACKAGES "Do not include CPack Packaging" OFF +HDF5_PACK_EXAMPLES "Package the HDF5 Library Examples Compressed File" OFF +HDF5_PACK_MACOSX_FRAMEWORK "Package the HDF5 Library in a Frameworks" OFF HDF5_PACKAGE_EXTLIBS "CPACK - include external libraries" OFF HDF5_STRICT_FORMAT_CHECKS "Whether to perform strict file format checks" OFF +HDF_TEST_EXPRESS "Control testing framework (0-3)" "0" HDF5_TEST_VFD "Execute tests with different VFDs" OFF HDF5_USE_16_API_DEFAULT "Use the HDF5 1.6.x API by default" OFF +HDF5_USE_18_API_DEFAULT "Use the HDF5 1.8.x API by default" OFF HDF5_USE_FOLDERS "Enable folder grouping of projects in IDEs." OFF HDF5_WANT_DATA_ACCURACY "IF data accuracy is guaranteed during data conversions" ON HDF5_WANT_DCONV_EXCEPTION "exception handling functions is checked during data conversions" ON HDF5_ENABLE_THREADSAFE "Enable Threadsafety" OFF +SKIP_HDF5_FORTRAN_SHARED "Do not build the fortran shared libraries" OFF if (APPLE) HDF5_BUILD_WITH_INSTALL_NAME "Build with library install_name set to the installation path" OFF if (CMAKE_BUILD_TYPE MATCHES Debug) @@ -649,13 +657,13 @@ adding an option (${CTEST_SCRIPT_ARG}) to the platform configuration script. ############################################################################################# ### ${CTEST_SCRIPT_ARG} is of the form OPTION=VALUE ### ### BUILD_GENERATOR required [Unix, VS2015, VS201564, VS2013, VS201364, VS2012, VS201264] ### -### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201264 -C Release -V -O hdf519.log ### +### ctest -S HDF5config.cmake,BUILD_GENERATOR=VS201264 -C Release -V -O hdf5.log ### ############################################################################################# cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) ############################################################################ # Usage: -# ctest -S HDF518config.cmake,OPTION=VALUE -C Release -VV -O test.log +# ctest -S HDF5config.cmake,OPTION=VALUE -C Release -VV -O test.log # where valid options for OPTION are: # BUILD_GENERATOR - The cmake build generator: # Unix * Unix Makefiles @@ -671,20 +679,22 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) # CTEST_SOURCE_NAME - source folder # STATIC_LIBRARIES - Build/use static libraries # FORTRAN_LIBRARIES - Build/use fortran libraries +# JAVA_LIBRARIES - Build/use java libraries # NO_MAC_FORTRAN - Yes to be SHARED on a Mac ############################################################################## -set(CTEST_SOURCE_VERSION 1.9) -set(CTEST_SOURCE_VERSEXT "") +set(CTEST_SOURCE_VERSION 1.10.0) +set(CTEST_SOURCE_VERSEXT "-pre1") ############################################################################## # handle input parameters to script. #BUILD_GENERATOR - which CMake generator to use, required -#INSTALLDIR - HDF5-1.9 root folder +#INSTALLDIR - HDF5-1.10.0 root folder #CTEST_BUILD_CONFIGURATION - Release, Debug, RelWithDebInfo -#CTEST_SOURCE_NAME - name of source folder; HDF5-1.9 +#CTEST_SOURCE_NAME - name of source folder; HDF5-1.10.0 #STATIC_LIBRARIES - Default is YES #FORTRAN_LIBRARIES - Default is NO +#JAVA_LIBRARIES - Default is NO #NO_MAC_FORTRAN - set to TRUE to allow shared libs on a Mac if(DEFINED CTEST_SCRIPT_ARG) # transform ctest script arguments of the form @@ -722,10 +732,10 @@ else() endif() if(NOT DEFINED INSTALLDIR) - if(NOT WIN32) - set(INSTALLDIR "/usr/local/myhdf5") - else() + if(WIN32) set(INSTALLDIR "C:\\Program\ Files\\myhdf5") + else() + set(INSTALLDIR "/usr/local/myhdf5") endif() endif() if(NOT DEFINED CTEST_BUILD_CONFIGURATION) @@ -736,9 +746,18 @@ if(NOT DEFINED CTEST_SOURCE_NAME) endif() if(NOT DEFINED STATIC_LIBRARIES) set(STATICLIBRARIES "YES") +else() + set(STATICLIBRARIES "NO") endif() if(NOT DEFINED FORTRAN_LIBRARIES) set(FORTRANLIBRARIES "NO") +else() + set(FORTRANLIBRARIES "YES") +endif() +if(NOT DEFINED JAVA_LIBRARIES) + set(JAVALIBRARIES "NO") +else() + set(JAVALIBRARIES "YES") endif() set(CTEST_BINARY_NAME "build") @@ -756,7 +775,15 @@ endif() if(WIN32) set(SITE_OS_NAME "Windows") set(SITE_OS_VERSION "WIN7") - if(${BUILD_GENERATOR} STREQUAL "VS201364") + if(${BUILD_GENERATOR} STREQUAL "VS201564") + set(SITE_OS_BITS "64") + set(SITE_COMPILER_NAME "vs2015") + set(SITE_COMPILER_VERSION "14") + elseif(${BUILD_GENERATOR} STREQUAL "VS2015") + set(SITE_OS_BITS "32") + set(SITE_COMPILER_NAME "vs2015") + set(SITE_COMPILER_VERSION "14") + elseif(${BUILD_GENERATOR} STREQUAL "VS201364") set(SITE_OS_BITS "64") set(SITE_COMPILER_NAME "vs2013") set(SITE_COMPILER_VERSION "12") @@ -804,7 +831,7 @@ set(MODEL "Experimental") #set(LOCAL_UPDATE "TRUE") set(REPOSITORY_URL "http://svn.hdfgroup.uiuc.edu/hdf5/trunk") #uncomment to use a compressed source file: *.tar on linux or mac *.zip on windows -#set(CTEST_USE_TAR_SOURCE "${CTEST_SOURCE_VERSION}${CTEST_SOURCE_VERSEXT}") +#set(CTEST_USE_TAR_SOURCE "${CTEST_SOURCE_VERSION}") ################################################################### ################################################################### @@ -840,6 +867,12 @@ if(${FORTRANLIBRARIES}) else() set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_FORTRAN:BOOL=OFF") endif() +#### java #### +if(${JAVALIBRARIES}) + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=ON") +else() + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=OFF") +endif() ### disable test program builds #set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DBUILD_TESTING:BOOL=OFF") diff --git a/release_docs/INSTALL_Cygwin.txt b/release_docs/INSTALL_Cygwin.txt index 26d3cb9..ddffcf1 100644 --- a/release_docs/INSTALL_Cygwin.txt +++ b/release_docs/INSTALL_Cygwin.txt @@ -99,19 +99,19 @@ Build, Test and Install HDF5 on Cygwin The HDF5 source code is distributed in a variety of formats which can be unpacked with the following commands, each of which creates - an `hdf5-1.8.x' directory. + an `hdf5-1.10.x' directory. 2.1 Non-compressed tar archive (*.tar) - $ tar xf hdf5-1.8.x.tar + $ tar xf hdf5-1.10.x.tar 2.2 Gzip'd tar archive (*.tar.gz) - $ gunzip < hdf5-1.8.x.tar.gz | tar xf - + $ gunzip < hdf5-1.10.x.tar.gz | tar xf - 2.3 Bzip'd tar archive (*.tar.bz2) - $ bunzip2 < hdf5-1.8.x.tar.bz2 | tar xf - + $ bunzip2 < hdf5-1.10.x.tar.bz2 | tar xf - 2. Setup Environment diff --git a/release_docs/USING_CMake_Examples.txt b/release_docs/USING_CMake_Examples.txt index 12c499e..d8940a5 100644 --- a/release_docs/USING_CMake_Examples.txt +++ b/release_docs/USING_CMake_Examples.txt @@ -21,7 +21,7 @@ I. Preconditions ======================================================================== 1. We suggest you obtain the latest CMake for windows from the Kitware - web site. The HDF5 1.8.x product requires a minimum CMake version + web site. The HDF5 1.10.x product requires a minimum CMake version of 3.1.0. 2. You have installed the HDF5 library built with CMake, by executing diff --git a/release_docs/USING_HDF5_CMake.txt b/release_docs/USING_HDF5_CMake.txt index 2cdf798..64d1a2a 100644 --- a/release_docs/USING_HDF5_CMake.txt +++ b/release_docs/USING_HDF5_CMake.txt @@ -36,7 +36,7 @@ I. Preconditions ======================================================================== 1. We suggest you obtain the latest CMake for windows from the Kitware - web site. The HDF5 1.8.x product requires a minimum CMake version + web site. The HDF5 1.10.x product requires a minimum CMake version of 3.1.0. 2. You have installed the HDF5 library built with CMake, by executing @@ -47,7 +47,7 @@ I. Preconditions 3. Set the environment variable HDF5_DIR to the installed location of the config files for HDF5. On Windows: - HDF5_DIR=C:/Program Files/HDF_Group/HDF5/1.8.x/cmake + HDF5_DIR=C:/Program Files/HDF_Group/HDF5/1.10.x/cmake (Note there are no quote characters used on Windows and all platforms use forward slashes) @@ -103,8 +103,8 @@ These steps are described in more detail below. * Visual Studio 12 2013 Win64 * Visual Studio 11 2012 * Visual Studio 11 2012 Win64 - * Visual Studio 10 2010 - * Visual Studio 10 2010 Win64 + * Visual Studio 14 2015 + * Visual Studio 14 2015 Win64 is: * BUILD_TESTING:BOOL=ON @@ -132,7 +132,7 @@ These steps are described in more detail below. 2.2 Alternative command line example on Windows in c:\MyHDFstuff\hdf5\build directory: - cmake -G "Visual Studio 11" -DBUILD_TESTING:BOOL=ON .. + cmake -G "Visual Studio 12 2013" -DBUILD_TESTING:BOOL=ON .. 3. Build HDF5 Applications @@ -228,30 +228,18 @@ cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) # This script will build and run the examples from a folder # Execute from a command line: # ctest -S HDF5_Examples.cmake,OPTION=VALUE -C Release -V -O test.log -# where valid options for OPTION are: -# BUILD_GENERATOR - The cmake build generator: -# Unix * Unix Makefiles -# VS2015 * Visual Studio 14 2015 -# VS201564 * Visual Studio 14 2015 Win64 -# VS2013 * Visual Studio 12 2013 -# VS201364 * Visual Studio 12 2013 Win64 -# VS2012 * Visual Studio 11 2012 -# VS201264 * Visual Studio 11 2012 Win64 -# -# INSTALLDIR - root folder where hdf5 is installed -# CTEST_BUILD_CONFIGURATION - Release, Debug, etc -# CTEST_SOURCE_NAME - source folder -# STATIC_LIBRARIES - Build/use static libraries -# FORTRAN_LIBRARIES - Build/use fortran libraries -# NO_MAC_FORTRAN - Yes to be SHARED on a Mac -############################################################################## +############################################################################################################### + +set(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") +set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY}) + # handle input parameters to script. -#BUILD_GENERATOR - which CMake generator to use, required #INSTALLDIR - HDF5 root folder #CTEST_BUILD_CONFIGURATION - Release, Debug, RelWithDebInfo #CTEST_SOURCE_NAME - name of source folder; HDF4Examples #STATIC_LIBRARIES - Default is YES #FORTRAN_LIBRARIES - Default is NO +#JAVA_LIBRARIES - Default is NO ##NO_MAC_FORTRAN - set to TRUE to allow shared libs on a Mac) if(DEFINED CTEST_SCRIPT_ARG) # transform ctest script arguments of the form @@ -264,38 +252,8 @@ if(DEFINED CTEST_SCRIPT_ARG) endif() endforeach() endif() - -# build generator must be defined -if(NOT DEFINED BUILD_GENERATOR) - message(FATAL_ERROR "BUILD_GENERATOR must be defined - Unix, VS2015, VS201564, VS2013, VS201364, VS2012, or VS201264") -else() - if(${BUILD_GENERATOR} STREQUAL "Unix") - set(CMAKE_GENERATOR "Unix Makefiles") - elseif(${BUILD_GENERATOR} STREQUAL "VS2015") - set(CTEST_CMAKE_GENERATOR "Visual Studio 14 2015") - elseif(${BUILD_GENERATOR} STREQUAL "VS201564") - set(CTEST_CMAKE_GENERATOR "Visual Studio 14 2015 Win64") - elseif(${BUILD_GENERATOR} STREQUAL "VS2013") - set(CMAKE_GENERATOR "Visual Studio 12 2013") - elseif(${BUILD_GENERATOR} STREQUAL "VS201364") - set(CMAKE_GENERATOR "Visual Studio 12 2013 Win64") - elseif(${BUILD_GENERATOR} STREQUAL "VS2012") - set(CMAKE_GENERATOR "Visual Studio 11 2012") - elseif(${BUILD_GENERATOR} STREQUAL "VS201264") - set(CMAKE_GENERATOR "Visual Studio 11 2012 Win64") - else() - message(FATAL_ERROR "Invalid BUILD_GENERATOR must be - Unix, VS2015, VS201564, VS2013, VS201364, VS2012, or VS201264") - endif() -endif() -set(CTEST_CMAKE_GENERATOR "${CMAKE_GENERATOR}") -set(CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY}) - if(NOT DEFINED INSTALLDIR) - if(WIN32) - set(INSTALLDIR "C:\\Program\ Files\\myhdf5") - else() - set(INSTALLDIR "/usr/local/myhdf5") - endif() + set(INSTALLDIR "@CMAKE_INSTALL_PREFIX@") endif() if(NOT DEFINED CTEST_BUILD_CONFIGURATION) set(CTEST_BUILD_CONFIGURATION "Release") @@ -305,9 +263,18 @@ if(NOT DEFINED CTEST_SOURCE_NAME) endif() if(NOT DEFINED STATIC_LIBRARIES) set(STATICLIBRARIES "YES") +else(NOT DEFINED STATIC_LIBRARIES) + set(STATICLIBRARIES "NO") endif() if(NOT DEFINED FORTRAN_LIBRARIES) set(FORTRANLIBRARIES "NO") +else(NOT DEFINED FORTRAN_LIBRARIES) + set(FORTRANLIBRARIES "YES") +endif() +if(NOT DEFINED JAVA_LIBRARIES) + set(JAVALIBRARIES "NO") +else(NOT DEFINED JAVA_LIBRARIES) + set(JAVALIBRARIES "YES") endif() #TAR_SOURCE - name of tarfile @@ -337,9 +304,14 @@ else(WIN32) set(CTEST_BINARY_DIRECTORY "${CTEST_DASHBOARD_ROOT}/${CTEST_BINARY_NAME}") endif(WIN32) if(${FORTRANLIBRARIES}) - set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON") + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=ON") else() - set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_FORTRAN:BOOL=OFF") +endif() +if(${JAVALIBRARIES}) + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=ON") +else() + set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=OFF") endif() set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF5_PACKAGE_NAME:STRING=@HDF5_PACKAGE@@HDF_PACKAGE_EXT@") @@ -421,8 +393,17 @@ ctest_read_custom_files ("${CTEST_BINARY_DIRECTORY}") ## -------------------------- ctest_start (Experimental) ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}") +if(LOCAL_SUBMIT) + ctest_submit (PARTS Configure Notes) +endif() ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND) +if(LOCAL_SUBMIT) + ctest_submit (PARTS Build) +endif() ctest_test (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) +if(LOCAL_SUBMIT) + ctest_submit (PARTS Test) +endif() if(res GREATER 0) message (FATAL_ERROR "tests FAILED") endif() diff --git a/release_docs/USING_HDF5_VS.txt b/release_docs/USING_HDF5_VS.txt index 146782a..3aaa56d 100644 --- a/release_docs/USING_HDF5_VS.txt +++ b/release_docs/USING_HDF5_VS.txt @@ -54,11 +54,11 @@ Using Visual Studio 2008 with HDF5 Libraries built with Visual Studio 2008 and select "x64". 2.2 Find the box "Show directories for", choose "Include files", add the - header path (i.e. c:\Program Files\HDF_Group\HDF5\1.8.x\include) + header path (i.e. c:\Program Files\HDF_Group\HDF5\1.10.x\include) to the included directories. 2.3 Find the box "Show directories for", choose "Library files", add the - library path (i.e. c:\Program Files\HDF_Group\HDF5\1.8.x\lib) + library path (i.e. c:\Program Files\HDF_Group\HDF5\1.10.x\lib) to the library directories. 2.4 If using Fortran libraries, you will also need to setup the path -- cgit v0.12 From f56bf61b8c5f97a0e4b98fbad35fa0206554e0cb Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 14 Mar 2016 14:59:06 -0500 Subject: [svn-r29407] Correct source location --- java/src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/src/Makefile.am b/java/src/Makefile.am index 36a22ca..bb11230 100644 --- a/java/src/Makefile.am +++ b/java/src/Makefile.am @@ -121,7 +121,7 @@ DOCTITLE = '

HDF5 Java Wrapper

' SRCDIR = '$(pkgpath)' docs: - $(JAVADOC) -sourcepath $(srcdir) -d javadoc -use -splitIndex -windowtitle $(WINDOWTITLE) -doctitle $(DOCTITLE) -J-Xmx180m -verbose -overview ./hdf/overview.html -classpath $(CLASSPATH_ENV) hdf.hdf5lib + $(JAVADOC) -sourcepath $(srcdir) -d javadoc -use -splitIndex -windowtitle $(WINDOWTITLE) -doctitle $(DOCTITLE) -J-Xmx180m -verbose -overview $(top_srcdir)/java/src/hdf/overview.html -classpath $(CLASSPATH_ENV) hdf.hdf5lib CLEANFILES = classhdf5_java.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/callbacks/*.class $(JAVAROOT)/$(pkgpath)/exceptions/*.class $(JAVAROOT)/$(pkgpath)/structs/*.class $(JAVAROOT)/$(pkgpath)/*.class -- cgit v0.12 From 5a344710ba8e08bfb2fe0851d81db23d0da5b964 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 15 Mar 2016 12:13:41 -0500 Subject: [svn-r29418] Add compare to expected to script to verify correct operation of test --- java/test/junit.sh.in | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 6878b3b..9473911 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -61,8 +61,14 @@ $top_builddir/java/src/$JARFILE " LIST_DATA_FILES=" $HDFTEST_HOME/h5ex_g_iterate.hdf +$HDFTEST_HOME/JUnit-interface.txt " +expect="JUnit-interface.txt" +actual="JUnit-interface.out" +actual_err="JUnit-interface.err" +actual_ext="JUnit-interface.ext" + # # copy files from source dirs to test dir # @@ -150,6 +156,9 @@ CLEAN_DATAFILES_AND_BLDDIR() if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then $RM $BLDDIR/*.hdf $RM $BLDDIR/*.out + $RM $BLDDIR/*.err + $RM $BLDDIR/*.ext + $RM $BLDDIR/*.txt fi } @@ -218,7 +227,26 @@ esac export LD_LIBRARY_PATH echo "$JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestAll" -($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestAll) +($JAVAEXE $JAVAEXEFLAGS -Xmx1024M -Dorg.slf4j.simpleLogger.defaultLog=trace -Djava.library.path=$BLDLIBDIR -cp $CLASSPATH -ea org.junit.runner.JUnitCore test.TestAll 1>$actual_ext 2>$actual_err) + +# Extract file name, line number, version and thread IDs because they may be different +sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ + -e 's/line [0-9]*/line (number)/' \ + -e 's/Time: [0-9]*\.[0-9]*/Time: XXXX/' \ + -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ + -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ + $actual_ext > $actual +cat $actual_err >> $actual + +if $CMP $expect $actual; then + echo " PASSED" +else + echo "*FAILED*" + echo " Expected result differs from actual result" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect1 $actual |sed 's/^/ /' +fi + # Clean up temporary files/directories CLEAN_LIBFILES_AND_BLDLIBDIR -- cgit v0.12 From 0dd0ffd5c10d0af4b1e672eb105428eeb20e434d Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 15 Mar 2016 12:43:34 -0500 Subject: [svn-r29421] Fix for HDFFV-9516. Corrects a problem where H5Dget_access_plist() returns a dapl that does not contain all dapl fields. Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 autotools serial --- src/H5Dint.c | 12 +++++ test/Makefile.am | 4 +- test/external.c | 117 +++++++++++++++++++++++++++++++++++++--- test/vds.c | 160 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 4 files changed, 277 insertions(+), 16 deletions(-) diff --git a/src/H5Dint.c b/src/H5Dint.c index 733ffe7..d91693d 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -3082,6 +3082,18 @@ H5D_get_access_plist(H5D_t *dset) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set preempt read chunks") } /* end if */ + /* Set the VDS view option */ + if(H5P_set(new_plist, H5D_ACS_VDS_VIEW_NAME, &(dset->shared->layout.storage.u.virt.view)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VDS view") + + /* Set the VDS printf gap option */ + if(H5P_set(new_plist, H5D_ACS_VDS_PRINTF_GAP_NAME, &(dset->shared->layout.storage.u.virt.printf_gap)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set VDS printf gap") + + /* Set the external file prefix option */ + if(H5P_set(new_plist, H5D_ACS_EFILE_PREFIX_NAME, &(dset->shared->extfile_prefix)) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set external file prefix") + /* Set the return value */ ret_value = new_dapl_id; diff --git a/test/Makefile.am b/test/Makefile.am index c3761b7..afd84be 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -129,7 +129,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse huge_chunks.h5 chunk_cache.h5 big_chunk.h5 chunk_expand.h5 \ copy_dcpl_newfile.h5 extend.h5 istore.h5 extlinks*.h5 frspace.h5 links*.h5 \ sys_file1 tfile[1-7].h5 th5s[1-4].h5 lheap.h5 fheap.h5 ohdr.h5 \ - stab.h5 extern_[1-4].h5 extern_[1-4][rw].raw gheap[0-4].h5 \ + stab.h5 extern_[1-5].h5 extern_[1-4][rw].raw gheap[0-4].h5 \ dt_arith[1-2] links.h5 links[0-6]*.h5 extlinks[0-15].h5 tmp \ big.data big[0-9][0-9][0-9][0-9][0-9].h5 \ stdio.h5 sec2.h5 dtypes[0-9].h5 dtypes1[0].h5 dt_arith[1-2].h5 tattr.h5 \ @@ -149,7 +149,7 @@ CHECK_CLEANFILES+=accum.h5 cmpd_dset.h5 compact_dataset.h5 dataset.h5 dset_offse new_multi_file_v16-r.h5 new_multi_file_v16-s.h5 \ split_get_file_image_test-m.h5 split_get_file_image_test-r.h5 \ file_image_core_test.h5.copy unregister_filter_1.h5 unregister_filter_2.h5 \ - vds_virt.h5 vds_src_[0-1].h5 + vds_virt.h5 vds_dapl.h5 vds_src_[0-1].h5 # Sources for testhdf5 executable testhdf5_SOURCES=testhdf5.c tarray.c tattr.c tchecksum.c tconfig.c tfile.c \ diff --git a/test/external.c b/test/external.c index af38428..1865e71 100644 --- a/test/external.c +++ b/test/external.c @@ -27,6 +27,7 @@ const char *FILENAME[] = { "extern_3", "extern_4", "extern_dir/file_1", + "extern_5", NULL }; @@ -825,6 +826,7 @@ test_read_file_set(hid_t fapl) error: H5E_BEGIN_TRY { + H5Gclose(grp); H5Dclose(dset); H5Pclose(dcpl); H5Sclose(space); @@ -1407,13 +1409,110 @@ error: /*------------------------------------------------------------------------- - * Function: main + * Function: test_h5d_get_access_plist * - * Purpose: Runs external dataset tests. + * Purpose: Ensure that H5Dget_access_plist returns correct values. * - * Return: Success: exit(0) + * Return: Success: 0 + * Failure: 1 * - * Failure: exit(non-zero) + * Programmer: Dana Robinson + * March 2016 + * + *------------------------------------------------------------------------- + */ +static int +test_h5d_get_access_plist(hid_t fapl_id) +{ + hid_t fid = -1; /* file to write to */ + hid_t dcpl_id = -1; /* dataset creation properties */ + hid_t dapl_id = -1; /* dataset access properties */ + hid_t sid = -1; /* data space */ + hid_t did = -1; /* dataset */ + hsize_t dims = 0; /* dataset size */ + char *buffer = NULL; /* saved prefix name from dapl */ + char filename[1024]; /* file names */ + + TESTING("H5Dget_access_plist() returns correct prefix"); + + if(HDsetenv("HDF5_EXTFILE_PREFIX", "", 1) < 0) + TEST_ERROR + + /* Reset the raw data files */ + if(reset_raw_data_files() < 0) + TEST_ERROR + + /* Create the file */ + h5_fixname(FILENAME[5], fapl_id, filename, sizeof(filename)); + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + FAIL_STACK_ERROR + + /* Create the dcpl and set external storage */ + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR + if(H5Pset_external(dcpl_id, "extern_1r.raw", (off_t)0, (hsize_t)0) < 0) + FAIL_STACK_ERROR + + /* Create the dapl and set the prefix */ + if((dapl_id = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + FAIL_STACK_ERROR + if(H5Pset_efile_prefix(dapl_id, "someprefix") < 0) + FAIL_STACK_ERROR + + /* Create the dataset */ + if((sid = H5Screate_simple(1, &dims, NULL)) < 0) + FAIL_STACK_ERROR + if((did = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl_id, dapl_id)) < 0) + FAIL_STACK_ERROR + + /* Close the dapl */ + if(H5Pclose(dapl_id) < 0) + FAIL_STACK_ERROR + dapl_id = -1; + + /* Get a data access property list from the dataset */ + if((dapl_id = H5Dget_access_plist(did)) < 0) + FAIL_STACK_ERROR + + /* Check the value for the external prefix */ + if((buffer = (char *)HDcalloc((size_t)64, sizeof(char))) == NULL) + TEST_ERROR + if(H5Pget_efile_prefix(dapl_id, buffer, (size_t)64) < 0) + FAIL_STACK_ERROR + if(HDstrcmp(buffer, "someprefix") != 0) + FAIL_PUTS_ERROR("external file prefix from dapl incorrect"); + + /* Close everything */ + HDfree(buffer); + if(H5Sclose(sid) < 0) FAIL_STACK_ERROR + if(H5Dclose(did) < 0) FAIL_STACK_ERROR + if(H5Pclose(dcpl_id) < 0) FAIL_STACK_ERROR + if(H5Pclose(dapl_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + + PASSED(); + return 0; + + error: + if(buffer) + HDfree(buffer); + H5E_BEGIN_TRY { + H5Dclose(did); + H5Pclose(dcpl_id); + H5Pclose(dapl_id); + H5Sclose(sid); + H5Fclose(fid); + } H5E_END_TRY; + return 1; +} /* end test_h5d_get_access_plist() */ + + +/*------------------------------------------------------------------------- + * Function: main + * + * Purpose: Runs external dataset tests. + * + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Robb Matzke * Tuesday, March 3, 1998 @@ -1443,17 +1542,21 @@ main(void) if(H5Pset_libver_bounds(fapl_id_new, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) FAIL_STACK_ERROR + /* The file format doesn't matter for this test */ + nerrors += test_h5d_get_access_plist(fapl_id_new); + HDputs(""); + /* Test with old & new format groups */ for(latest_format = FALSE; latest_format <= TRUE; latest_format++) { hid_t current_fapl_id = -1; /* Set the fapl for different file formats */ if(latest_format) { - puts("\nTesting with the latest file format:"); + HDputs("\nTesting with the latest file format:"); current_fapl_id = fapl_id_new; } /* end if */ else { - puts("Testing with the default file format:"); + HDputs("Testing with the default file format:"); current_fapl_id = fapl_id_old; } /* end else */ @@ -1526,7 +1629,7 @@ error: H5Gclose(gid); } H5E_END_TRY; nerrors = MAX(1, nerrors); - printf ("%d TEST%s FAILED.\n", nerrors, 1==nerrors?"":"s"); + printf("%d TEST%s FAILED.\n", nerrors, 1 == nerrors ? "" : "s"); return EXIT_FAILURE; } /* end main() */ diff --git a/test/vds.c b/test/vds.c index eff01c1..1c3dcca 100644 --- a/test/vds.c +++ b/test/vds.c @@ -38,6 +38,7 @@ const char *FILENAME[] = { "vds_src_0", "vds_src_1", "vds%%_src", + "vds_dapl", NULL }; @@ -447,7 +448,7 @@ test_api_get_ex_dcpl(test_api_config_t config, hid_t fapl, hid_t dcpl, } /* end else */ /* Verify examination DCPL is equal to original DCPL. Do not compare the - * plist to itselt, and do not do the comparison if we reopened the file, + * plist to itself, and do not do the comparison if we reopened the file, * because in that case the extent of the source dset will not be corrent. */ if((*ex_dcpl != dcpl) && (config != TEST_API_REOPEN_FILE)) { @@ -11093,13 +11094,156 @@ error: /*------------------------------------------------------------------------- + * Function: test_dapl_values + * + * Purpose: Ensure that H5Dget_access_plist returns correct values. + * + * Return: Success: 0 + * Failure: 1 + * + * Programmer: Dana Robinson + * March 2016 + * + *------------------------------------------------------------------------- + */ +static int +test_dapl_values(hid_t fapl_id) +{ + hid_t fid = -1; /* file to write to */ + hid_t dcpl_id = -1; /* dataset creation properties */ + hid_t dapl_id1 = -1; /* dataset access properties */ + hid_t dapl_id2 = -1; /* dataset access properties */ + hid_t vds_sid = -1; /* vds data space */ + hid_t src_sid = -1; /* source data space */ + hid_t did1 = -1; /* dataset */ + hid_t did2 = -1; /* dataset */ + hsize_t start; /* hyperslab start */ + hsize_t stride; /* hyperslab count */ + hsize_t count; /* hyperslab count */ + hsize_t block; /* hyperslab count */ + hsize_t dims; /* dataset size */ + hsize_t max_dims; /* dataset max size */ + H5D_vds_view_t view; /* view from dapl */ + hsize_t gap_size; /* gap size from dapl */ + char filename[1024]; /* file names */ + + TESTING("H5Dget_access_plist() returns dapl w/ correct values"); + + /* Create the file */ + h5_fixname(FILENAME[5], fapl_id, filename, sizeof(filename)); + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id)) < 0) + FAIL_STACK_ERROR + + /* Create the dcpl and set up VDS mapping */ + if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) + FAIL_STACK_ERROR + /* source */ + dims = 42; + if((src_sid = H5Screate_simple(1, &dims, NULL)) < 0) + FAIL_STACK_ERROR + /* vds */ + dims = 0; + max_dims = H5S_UNLIMITED; + if((vds_sid = H5Screate_simple(1, &dims, &max_dims)) < 0) + FAIL_STACK_ERROR + start = 0; + stride = 42; + count = H5S_UNLIMITED; + block = 42; + if(H5Sselect_hyperslab(vds_sid, H5S_SELECT_SET, &start, &stride, &count, &block) < 0) + FAIL_STACK_ERROR + /* map */ + if(H5Pset_virtual(dcpl_id, vds_sid, "f-%b.h5", "/dset1", src_sid) < 0) + FAIL_STACK_ERROR + + /* Create the dapls and set values + * There are two of them. The reason for this is that the only way + * to set the printf gap is to use the default view and using the + * default isn't the best way to test setting and getting the view. + */ + /* dapl 1 */ + if((dapl_id1 = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + FAIL_STACK_ERROR + if(H5Pset_virtual_view(dapl_id1, H5D_VDS_FIRST_MISSING) < 0) + FAIL_STACK_ERROR + /* dapl 2 */ + if((dapl_id2 = H5Pcreate(H5P_DATASET_ACCESS)) < 0) + FAIL_STACK_ERROR + /* default but we set it explicitly to be sure */ + if(H5Pset_virtual_view(dapl_id2, H5D_VDS_LAST_AVAILABLE) < 0) + FAIL_STACK_ERROR + if(H5Pset_virtual_printf_gap(dapl_id2, 123) < 0) + FAIL_STACK_ERROR + + /* Create the datasets */ + if((did1 = H5Dcreate2(fid, "dset1", H5T_NATIVE_INT, vds_sid, H5P_DEFAULT, dcpl_id, dapl_id1)) < 0) + FAIL_STACK_ERROR + if((did2 = H5Dcreate2(fid, "dset2", H5T_NATIVE_INT, vds_sid, H5P_DEFAULT, dcpl_id, dapl_id2)) < 0) + FAIL_STACK_ERROR + + /* Close the dapls */ + if(H5Pclose(dapl_id1) < 0) + FAIL_STACK_ERROR + dapl_id1 = -1; + if(H5Pclose(dapl_id2) < 0) + FAIL_STACK_ERROR + dapl_id2 = -1; + + /* Get a data access property lists from the dataset */ + if((dapl_id1 = H5Dget_access_plist(did1)) < 0) + FAIL_STACK_ERROR + if((dapl_id2 = H5Dget_access_plist(did2)) < 0) + FAIL_STACK_ERROR + + /* Check the values from the dapls */ + /* dapl 1 */ + if(H5Pget_virtual_view(dapl_id1, &view) < 0) + FAIL_STACK_ERROR + if(H5D_VDS_FIRST_MISSING != view) + TEST_ERROR + /* dapl 2 */ + if(H5Pget_virtual_view(dapl_id2, &view) < 0) + FAIL_STACK_ERROR + if(H5D_VDS_LAST_AVAILABLE != view) + TEST_ERROR + if(H5Pget_virtual_printf_gap(dapl_id2, &gap_size) < 0) + FAIL_STACK_ERROR + if(gap_size != 123) + + /* Close everything */ + if(H5Sclose(vds_sid) < 0) FAIL_STACK_ERROR + if(H5Sclose(src_sid) < 0) FAIL_STACK_ERROR + if(H5Dclose(did1) < 0) FAIL_STACK_ERROR + if(H5Dclose(did2) < 0) FAIL_STACK_ERROR + if(H5Pclose(dapl_id1) < 0) FAIL_STACK_ERROR + if(H5Pclose(dapl_id2) < 0) FAIL_STACK_ERROR + if(H5Pclose(dcpl_id) < 0) FAIL_STACK_ERROR + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + + PASSED(); + return 0; + + error: + H5E_BEGIN_TRY { + H5Dclose(did1); + H5Dclose(did2); + H5Pclose(dapl_id1); + H5Pclose(dapl_id2); + H5Pclose(dcpl_id); + H5Sclose(vds_sid); + H5Sclose(src_sid); + H5Fclose(fid); + } H5E_END_TRY; + return 1; +} /* end test_dapl_values() */ + + +/*------------------------------------------------------------------------- * Function: main * * Purpose: Tests datasets with virtual layout * - * Return: Success: exit(0) - * - * Failure: exit(1) + * Return: EXIT_SUCCESS/EXIT_FAILURE * * Programmer: Neil Fortner * Tuesday, February 17, 2015 @@ -11119,7 +11263,7 @@ main(void) h5_reset(); fapl = h5_fileaccess(); - h5_fixname(FILENAME[0], fapl, filename, sizeof filename); + h5_fixname(FILENAME[0], fapl, filename, sizeof(filename)); for(test_api_config = (int)TEST_API_BASIC; test_api_config < (int)TEST_API_NTESTS; test_api_config++) nerrors += test_api((test_api_config_t)test_api_config, fapl); @@ -11131,6 +11275,8 @@ main(void) nerrors += test_all(bit_config, fapl); } /* end for */ + nerrors += test_dapl_values(fapl); + /* Verify symbol table messages are cached */ nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0); @@ -11139,12 +11285,12 @@ main(void) printf("All virtual dataset tests passed.\n"); h5_cleanup(FILENAME, fapl); - return 0; + return EXIT_SUCCESS; error: nerrors = MAX(1, nerrors); printf("***** %d VIRTUAL DATASET TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); - return 1; + return EXIT_FAILURE; } /* end main() */ -- cgit v0.12 From b8d2f399fda5767e8311c64725467824591376bb Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 15 Mar 2016 14:47:06 -0500 Subject: [svn-r29427] Correct name of build option in script --- config/cmake/scripts/HDF5config.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/cmake/scripts/HDF5config.cmake b/config/cmake/scripts/HDF5config.cmake index cdbbbf5..1503f6c 100755 --- a/config/cmake/scripts/HDF5config.cmake +++ b/config/cmake/scripts/HDF5config.cmake @@ -213,9 +213,9 @@ else() endif() #### java #### if(${JAVALIBRARIES}) - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=ON") + set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=ON") else() - set(BUILD_OPTIONS "${BUILD_OPTIONS} -DHDF_BUILD_JAVA:BOOL=OFF") + set(ADD_BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DHDF5_BUILD_JAVA:BOOL=OFF") endif() ### disable test program builds -- cgit v0.12 From 71aebc8eb43c062474052d95a34a634e938fd7ed Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 15 Mar 2016 15:39:21 -0500 Subject: [svn-r29435] Remove char from var name. --- java/test/junit.sh.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 9473911..c05e502 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -32,6 +32,7 @@ LS='ls' AWK='awk' nerrors=0 +verbose=yes # where the libs exist HDFLIB_HOME="$top_srcdir/java/lib" @@ -244,7 +245,7 @@ else echo "*FAILED*" echo " Expected result differs from actual result" nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect1 $actual |sed 's/^/ /' + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' fi -- cgit v0.12 From 5d342b26d448a0ec238e8277e3a6944a2451f0b2 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 15 Mar 2016 22:19:34 -0500 Subject: [svn-r29440] Minor typo fix. --- src/H5P.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5P.c b/src/H5P.c index 3d09231..f075b92 100644 --- a/src/H5P.c +++ b/src/H5P.c @@ -639,7 +639,7 @@ done: PURPOSE Routine to set a property's value in a property list. USAGE - herr_t H5P_set(plist_id, name, value) + herr_t H5Pset(plist_id, name, value) hid_t plist_id; IN: Property list to find property in const char *name; IN: Name of property to set void *value; IN: Pointer to the value for the property -- cgit v0.12 From 4573feb2a9765eba5976775f2c43cbe58e0059a0 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 16 Mar 2016 09:19:06 -0500 Subject: [svn-r29443] Fix get_access_plist test --- java/test/TestH5D.java | 62 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 57 insertions(+), 5 deletions(-) diff --git a/java/test/TestH5D.java b/java/test/TestH5D.java index 9e359e2..fa051db 100644 --- a/java/test/TestH5D.java +++ b/java/test/TestH5D.java @@ -42,6 +42,7 @@ public class TestH5D { private static final int DIM_Y = 6; private static final int RANK = 2; long H5fid = -1; + long H5faplid = -1; long H5dsid = -1; long H5dtid = -1; long H5did = -1; @@ -107,6 +108,39 @@ public class TestH5D { assertTrue("TestH5D._createPDataset.H5Dcreate: ", H5did0 >= 0); } + private final void _createChunkDataset(long fid, long dsid, String name, long dapl) { + + try { + H5dcpl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_CREATE); + } + catch (Exception err) { + err.printStackTrace(); + fail("H5.H5Pcreate: " + err); + } + assertTrue("testH5D._createChunkDataset: H5.H5Pcreate: ", H5dcpl_id >= 0); + + // Set the chunking. + long[] chunk_dim = {4, 4}; + + try { + H5.H5Pset_chunk(H5dcpl_id, RANK, chunk_dim); + } + catch (Exception e) { + e.printStackTrace(); + } + + try { + H5did = H5.H5Dcreate(fid, name, + HDF5Constants.H5T_STD_I32BE, dsid, + HDF5Constants.H5P_DEFAULT, H5dcpl_id, dapl); + } + catch (Throwable err) { + err.printStackTrace(); + fail("H5.H5Dcreate: " + err); + } + assertTrue("TestH5D._createChunkDataset.H5Dcreate: ", H5did >= 0); + } + private final void _createDataset(long fid, long dsid, String name, long dapl) { try { H5did = H5.H5Dcreate(fid, name, @@ -198,8 +232,9 @@ public class TestH5D { System.out.print(testname.getMethodName()); try { + H5faplid = H5.H5Pcreate(HDF5Constants.H5P_FILE_ACCESS); H5fid = H5.H5Fcreate(H5_FILE, HDF5Constants.H5F_ACC_TRUNC, - HDF5Constants.H5P_DEFAULT, HDF5Constants.H5P_DEFAULT); + HDF5Constants.H5P_DEFAULT, H5faplid); H5dsid = H5.H5Screate_simple(RANK, H5dims, null); } catch (Throwable err) { @@ -224,6 +259,8 @@ public class TestH5D { try {H5.H5Tclose(H5dtid);} catch (Exception ex) {} if (H5dsid > 0) try {H5.H5Sclose(H5dsid);} catch (Exception ex) {} + if (H5faplid >= 0) + try {H5.H5Pclose(H5faplid);} catch (Exception ex) {} if (H5fid > 0) try {H5.H5Fclose(H5fid);} catch (Exception ex) {} @@ -354,8 +391,15 @@ public class TestH5D { @Test public void testH5Dget_access_plist() { long dapl_id = -1; - int pequal = -1; long test_dapl_id = -1; + int[] mdc_nelmts1 = {0}; + int[] mdc_nelmts2 = {0}; + long[] rdcc_nelmts1 = {0}; + long[] rdcc_nelmts2 = {0}; + long[] rdcc_nbytes1 = {0}; + long[] rdcc_nbytes2 = {0}; + double[] rdcc_w01 = {0}; + double[] rdcc_w02 = {0}; try { test_dapl_id = H5.H5Pcreate(HDF5Constants.H5P_DATASET_ACCESS); @@ -366,12 +410,20 @@ public class TestH5D { } assertTrue("testH5Dget_access_plist: test_dapl_id: ", test_dapl_id >= 0); - _createDataset(H5fid, H5dsid, "dset", test_dapl_id); + try { + H5.H5Pget_cache(H5faplid, mdc_nelmts1, rdcc_nelmts1, rdcc_nbytes1, rdcc_w01); + } + catch (Exception err) { + err.printStackTrace(); + fail("testH5Dget_access_plist: H5.H5Pget_cache: " + err); + } + + _createChunkDataset(H5fid, H5dsid, "dset", test_dapl_id); try { dapl_id = H5.H5Dget_access_plist(H5did); assertTrue("testH5Dget_access_plist: dapl_id: ", dapl_id >= 0); - pequal = H5.H5Pequal(dapl_id, test_dapl_id); + H5.H5Pget_chunk_cache(dapl_id, rdcc_nelmts2, rdcc_nbytes2, rdcc_w02); } catch (Exception err) { err.printStackTrace(); @@ -393,7 +445,7 @@ public class TestH5D { catch (Exception err) { err.printStackTrace(); } - assertTrue("testH5Dget_access_plist: ", pequal > 0); + assertTrue("testH5Dget_access_plist: ", rdcc_nelmts2==rdcc_nelmts2 && rdcc_nbytes2==rdcc_nbytes2); } @Test -- cgit v0.12 From 0647698684f004c518d2807105db5fcaf2c22e7c Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 16 Mar 2016 11:36:48 -0500 Subject: [svn-r29446] Check if H5Pexist return value is >0 rather then ==1 --- java/test/TestH5Plist.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/java/test/TestH5Plist.java b/java/test/TestH5Plist.java index c4dee01..e87909e 100644 --- a/java/test/TestH5Plist.java +++ b/java/test/TestH5Plist.java @@ -337,7 +337,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist plist_class_id "+PROP1_NAME, status == 1); + assertTrue("H5Pexist plist_class_id "+PROP1_NAME, status > 0); // Check the size of the first property try { @@ -388,7 +388,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist plist_class_id "+PROP2_NAME, status == 1); + assertTrue("H5Pexist plist_class_id "+PROP2_NAME, status > 0); // Check the size of the second property try { @@ -429,7 +429,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist plist_class_id "+PROP3_NAME, status == 1); + assertTrue("H5Pexist plist_class_id "+PROP3_NAME, status > 0); // Check the size of the third property try { @@ -725,7 +725,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist lid1 "+PROP1_NAME, status == 1); + assertTrue("H5Pexist lid1 "+PROP1_NAME, status > 0); try { status = H5.H5Pexist(lid1, PROP2_NAME); } @@ -733,7 +733,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist lid1 "+PROP2_NAME, status == 1); + assertTrue("H5Pexist lid1 "+PROP2_NAME, status > 0); try { status = H5.H5Pexist(lid1, PROP3_NAME); } @@ -741,7 +741,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist lid1 "+PROP3_NAME, status == 1); + assertTrue("H5Pexist lid1 "+PROP3_NAME, status > 0); try { status = H5.H5Pexist(lid1, PROP4_NAME); } @@ -749,7 +749,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist lid1 "+PROP4_NAME, status == 1); + assertTrue("H5Pexist lid1 "+PROP4_NAME, status > 0); } finally { -- cgit v0.12 From 1f5286ddf2cdf6162bfb9baab18e067658fbfabf Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 16 Mar 2016 11:58:03 -0500 Subject: [svn-r29447] Correct signature of H5Pexist to return boolean --- java/src/hdf/hdf5lib/H5.java | 5 ++--- java/src/jni/h5pImp.c | 14 ++++++++------ java/src/jni/h5pImp.h | 4 ++-- java/test/TestH5Plist.java | 20 ++++++++++---------- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/java/src/hdf/hdf5lib/H5.java b/java/src/hdf/hdf5lib/H5.java index fbfc40a..b8d9147 100644 --- a/java/src/hdf/hdf5lib/H5.java +++ b/java/src/hdf/hdf5lib/H5.java @@ -4360,13 +4360,12 @@ public class H5 implements java.io.Serializable { * IN: Identifier for the property to query * @param name * IN: Name of property to check for - * @return a positive value if the property exists in the property object; zero if the property does not exist; a - * negative value if failed + * @return a true value if the property exists in the property object; false if the property does not exist; * * @exception HDF5LibraryException * - Error from the HDF-5 Library. */ - public synchronized static native int H5Pexist(long plid, String name) throws HDF5LibraryException; + public synchronized static native boolean H5Pexist(long plid, String name) throws HDF5LibraryException; /** * H5Pget_size retrieves the size of a property's value in bytes diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c index f4fee74..d542902 100644 --- a/java/src/jni/h5pImp.c +++ b/java/src/jni/h5pImp.c @@ -2162,24 +2162,26 @@ Java_hdf_hdf5lib_H5_H5Pset(JNIEnv *env, jclass clss, jlong plid, jstring name, j /* * Class: hdf_hdf5lib_H5 * Method: H5Pexist - * Signature: (JLjava/lang/String;)J + * Signature: (JLjava/lang/String;)Z */ -JNIEXPORT jlong JNICALL +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pexist(JNIEnv *env, jclass clss, jlong plid, jstring name) { - hid_t retVal = -1; + htri_t bval = JNI_FALSE; const char *cstr; PIN_JAVA_STRING(name, cstr, -1); - retVal = H5Pexist((hid_t)plid, cstr); + bval = H5Pexist((hid_t)plid, cstr); UNPIN_JAVA_STRING(name, cstr); - if (retVal < 0) + if (bval > 0) + bval = JNI_TRUE; + else if (bval < 0) h5libraryError(env); - return (jlong)retVal; + return (jboolean)bval; } /* end Java_hdf_hdf5lib_H5_H5Pexist */ /* diff --git a/java/src/jni/h5pImp.h b/java/src/jni/h5pImp.h index ea1ee52..66488c2 100644 --- a/java/src/jni/h5pImp.h +++ b/java/src/jni/h5pImp.h @@ -579,9 +579,9 @@ JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pset /* * Class: hdf_hdf5lib_H5 * Method: H5Pexist - * Signature: (JLjava/lang/String;)J + * Signature: (JLjava/lang/String;)Z */ -JNIEXPORT jlong JNICALL Java_hdf_hdf5lib_H5_H5Pexist +JNIEXPORT jboolean JNICALL Java_hdf_hdf5lib_H5_H5Pexist (JNIEnv *, jclass, jlong, jstring); /* diff --git a/java/test/TestH5Plist.java b/java/test/TestH5Plist.java index e87909e..024237a 100644 --- a/java/test/TestH5Plist.java +++ b/java/test/TestH5Plist.java @@ -284,7 +284,7 @@ public class TestH5Plist { // Test basic generic property list code. Tests adding properties to generic classes. @Test public void testH5P_genprop_basic_class_prop() { - int status = -1; + boolean status = false; long size = -1; // Generic Property size long nprops = -1; // Generic Property class number @@ -306,7 +306,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist plist_class_id "+PROP1_NAME, status == 0); + assertFalse("H5Pexist plist_class_id "+PROP1_NAME, status); // Insert first property into class (with no callbacks) try { @@ -337,7 +337,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist plist_class_id "+PROP1_NAME, status > 0); + assertTrue("H5Pexist plist_class_id "+PROP1_NAME, status); // Check the size of the first property try { @@ -388,7 +388,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist plist_class_id "+PROP2_NAME, status > 0); + assertTrue("H5Pexist plist_class_id "+PROP2_NAME, status); // Check the size of the second property try { @@ -429,7 +429,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist plist_class_id "+PROP3_NAME, status > 0); + assertTrue("H5Pexist plist_class_id "+PROP3_NAME, status); // Check the size of the third property try { @@ -635,7 +635,7 @@ public class TestH5Plist { // removing properties from them. @Test public void testH5P_genprop_basic_list_prop() { - int status = -1; + boolean status = false; long lid1 = -1; // Generic Property list ID long nprops = -1; // Number of properties in class @@ -725,7 +725,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist lid1 "+PROP1_NAME, status > 0); + assertTrue("H5Pexist lid1 "+PROP1_NAME, status); try { status = H5.H5Pexist(lid1, PROP2_NAME); } @@ -733,7 +733,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist lid1 "+PROP2_NAME, status > 0); + assertTrue("H5Pexist lid1 "+PROP2_NAME, status); try { status = H5.H5Pexist(lid1, PROP3_NAME); } @@ -741,7 +741,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist lid1 "+PROP3_NAME, status > 0); + assertTrue("H5Pexist lid1 "+PROP3_NAME, status); try { status = H5.H5Pexist(lid1, PROP4_NAME); } @@ -749,7 +749,7 @@ public class TestH5Plist { err.printStackTrace(); fail("H5Pexist plist_class_id: " + err); } - assertTrue("H5Pexist lid1 "+PROP4_NAME, status > 0); + assertTrue("H5Pexist lid1 "+PROP4_NAME, status); } finally { -- cgit v0.12 From 7f8f2feaf9097e92757bd6d5743e7e17baba5f76 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 16 Mar 2016 12:35:51 -0500 Subject: [svn-r29450] Separate error compare from output compare --- MANIFEST | 1 + config/cmake/jrunTest.cmake | 8 ++++---- java/test/CMakeLists.txt | 2 ++ java/test/JUnit-interface.ert | 2 ++ java/test/JUnit-interface.txt | 2 -- java/test/junit.sh.in | 1 - 6 files changed, 9 insertions(+), 7 deletions(-) create mode 100644 java/test/JUnit-interface.ert diff --git a/MANIFEST b/MANIFEST index dc8cfba..0e20e02 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2690,6 +2690,7 @@ ./java/test/CMakeLists.txt ./java/test/junit.sh.in ./java/test/JUnit-interface.txt +./java/test/JUnit-interface.ert ./java/test/h5ex_g_iterate.hdf ./java/test/TestH5.java ./java/test/TestH5A.java diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake index 7a92867..6c9bbdd 100644 --- a/config/cmake/jrunTest.cmake +++ b/config/cmake/jrunTest.cmake @@ -72,9 +72,9 @@ endif (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) if (TEST_MASK_ERROR) if (NOT TEST_ERRREF) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - else (NOT TEST_ERRREF) file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) + else (NOT TEST_ERRREF) + file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) endif (NOT TEST_ERRREF) string (REGEX REPLACE "Time:[^\n]+\n" "Time: XXXX\n" TEST_STREAM "${TEST_STREAM}") string (REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}") @@ -85,9 +85,9 @@ if (TEST_MASK_ERROR) string (REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") string (REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") if (NOT TEST_ERRREF) - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") - else (NOT TEST_ERRREF) file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") + else (NOT TEST_ERRREF) + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") endif (NOT TEST_ERRREF) endif (TEST_MASK_ERROR) diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index 2632b18..938a15b 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -65,6 +65,7 @@ set_target_properties (${HDF5_JAVA_TEST_LIB_TARGET} PROPERTIES FOLDER test/java) set (HDF_JAVA_TEST_FILES h5ex_g_iterate.hdf JUnit-interface.txt + JUnit-interface.ert ) foreach (h5_file ${HDF_JAVA_TEST_FILES}) @@ -105,6 +106,7 @@ add_test ( -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -D "TEST_FOLDER=${HDF5_BINARY_DIR}/java/test" -D "TEST_OUTPUT=JUnit-interface.out" + -D "TEST_ERRREF=JUnit-interface.ert" # -D "TEST_LOG_LEVEL=trace" -D "TEST_EXPECT=0" -D "TEST_MASK_ERROR=TRUE" diff --git a/java/test/JUnit-interface.ert b/java/test/JUnit-interface.ert new file mode 100644 index 0000000..5771a4f --- /dev/null +++ b/java/test/JUnit-interface.ert @@ -0,0 +1,2 @@ +[main] INFO hdf.hdf5lib.H5 - HDF5 library: hdf5_java +[main] INFO hdf.hdf5lib.H5 - successfully loaded from java.library.path diff --git a/java/test/JUnit-interface.txt b/java/test/JUnit-interface.txt index f065dd4..12e67ad 100644 --- a/java/test/JUnit-interface.txt +++ b/java/test/JUnit-interface.txt @@ -648,5 +648,3 @@ HDF5-DIAG: Error detected in HDF5 (version (number)) thread (IDs): #002: (file name) line (number) in H5P_isa_class(): not a property list major: Invalid arguments to routine minor: Inappropriate type -[main] INFO hdf.hdf5lib.H5 - HDF5 library: hdf5_java -[main] INFO hdf.hdf5lib.H5 - successfully loaded from java.library.path diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index c05e502..94b3415 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -237,7 +237,6 @@ sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/v[1-9]*\.[0-9]*\./version (number)\./' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ $actual_ext > $actual -cat $actual_err >> $actual if $CMP $expect $actual; then echo " PASSED" -- cgit v0.12 From 83acb60e39943fe7e4772194cbdf491d4d3e86d1 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 17 Mar 2016 09:29:18 -0500 Subject: [svn-r29463] qualify .classes with $(top_builddir) --- java/examples/datasets/Makefile.am | 2 +- java/examples/datatypes/Makefile.am | 2 +- java/examples/groups/Makefile.am | 2 +- java/examples/intro/Makefile.am | 2 +- java/src/Makefile.am | 2 +- java/test/Makefile.am | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/java/examples/datasets/Makefile.am b/java/examples/datasets/Makefile.am index 49888a0..8498cff 100644 --- a/java/examples/datasets/Makefile.am +++ b/java/examples/datasets/Makefile.am @@ -23,7 +23,7 @@ include $(top_srcdir)/config/commence.am # Mark this directory as part of the JNI API JAVA_API=yes -JAVAROOT = .classes +JAVAROOT = $(top_builddir)/.classes classes: $(MKDIR_P) $(@D)/$(JAVAROOT) diff --git a/java/examples/datatypes/Makefile.am b/java/examples/datatypes/Makefile.am index de2ea9d..fedfec3 100644 --- a/java/examples/datatypes/Makefile.am +++ b/java/examples/datatypes/Makefile.am @@ -23,7 +23,7 @@ include $(top_srcdir)/config/commence.am # Mark this directory as part of the JNI API JAVA_API=yes -JAVAROOT = .classes +JAVAROOT = $(top_builddir)/.classes classes: $(MKDIR_P) $(@D)/$(JAVAROOT) diff --git a/java/examples/groups/Makefile.am b/java/examples/groups/Makefile.am index 802e2b0..181d2d9 100644 --- a/java/examples/groups/Makefile.am +++ b/java/examples/groups/Makefile.am @@ -23,7 +23,7 @@ include $(top_srcdir)/config/commence.am # Mark this directory as part of the JNI API JAVA_API=yes -JAVAROOT = .classes +JAVAROOT = $(top_builddir)/.classes classes: $(MKDIR_P) $(@D)/$(JAVAROOT) diff --git a/java/examples/intro/Makefile.am b/java/examples/intro/Makefile.am index fef33d2..af4022b 100644 --- a/java/examples/intro/Makefile.am +++ b/java/examples/intro/Makefile.am @@ -23,7 +23,7 @@ include $(top_srcdir)/config/commence.am # Mark this directory as part of the JNI API JAVA_API=yes -JAVAROOT = .classes +JAVAROOT = $(top_builddir)/.classes classes: $(MKDIR_P) $(@D)/$(JAVAROOT) diff --git a/java/src/Makefile.am b/java/src/Makefile.am index bb11230..3609f20 100644 --- a/java/src/Makefile.am +++ b/java/src/Makefile.am @@ -30,7 +30,7 @@ JAVA_API=yes SUBDIRS=jni -JAVAROOT = .classes +JAVAROOT = $(top_builddir)/.classes classes: $(MKDIR_P) $(@D)/$(JAVAROOT) diff --git a/java/test/Makefile.am b/java/test/Makefile.am index 1cb41df..d294d46 100644 --- a/java/test/Makefile.am +++ b/java/test/Makefile.am @@ -23,7 +23,7 @@ include $(top_srcdir)/config/commence.am # Mark this directory as part of the JNI API JAVA_API=yes -JAVAROOT = .classes +JAVAROOT = $(top_builddir)/.classes classes: $(MKDIR_P) $(@D)/$(JAVAROOT) -- cgit v0.12 From b8e163a84563fa9d960f41a64aee785f96f40300 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 17 Mar 2016 11:47:21 -0500 Subject: [svn-r29465] Fix issue with .classes dir not getting created for java by adding mkdir .classes to configure. --- configure.ac | 7 +++++++ java/examples/datasets/Makefile.am | 6 +++--- java/examples/datatypes/Makefile.am | 6 +++--- java/examples/groups/Makefile.am | 6 +++--- java/examples/intro/Makefile.am | 6 +++--- java/src/Makefile.am | 6 +++--- java/test/Makefile.am | 6 +++--- 7 files changed, 25 insertions(+), 18 deletions(-) diff --git a/configure.ac b/configure.ac index b4492b1..e80eef6 100644 --- a/configure.ac +++ b/configure.ac @@ -3582,6 +3582,13 @@ AC_CONFIG_FILES([src/libhdf5.settings hl/fortran/examples/Makefile hl/fortran/examples/run-hlfortran-ex.sh]) +AC_CONFIG_COMMANDS([.classes], [], [$MKDIR_P java/src/.classes; + $MKDIR_P java/test/.classes; + $MKDIR_P java/examples/intro/.classes; + $MKDIR_P java/examples/datasets/.classes; + $MKDIR_P java/examples/datatypes/.classes; + $MKDIR_P java/examples/groups/.classes]) + AC_OUTPUT chmod 755 tools/misc/h5cc diff --git a/java/examples/datasets/Makefile.am b/java/examples/datasets/Makefile.am index 8498cff..41ba6d1 100644 --- a/java/examples/datasets/Makefile.am +++ b/java/examples/datasets/Makefile.am @@ -23,10 +23,10 @@ include $(top_srcdir)/config/commence.am # Mark this directory as part of the JNI API JAVA_API=yes -JAVAROOT = $(top_builddir)/.classes +JAVAROOT = .classes classes: - $(MKDIR_P) $(@D)/$(JAVAROOT) + test -d $(@D)/$(JAVAROOT) || $(MKDIR_P) $(@D)/$(JAVAROOT) pkgpath = examples/datasets hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar @@ -71,7 +71,7 @@ TEST_SCRIPT = $(check_SCRIPTS) CLEANFILES = classnoinst.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class runExample.sh clean: - rm -rf $(JAVAROOT) + rm -rf $(JAVAROOT)/* rm -f $(jarfile) rm -f classnoinst.stamp diff --git a/java/examples/datatypes/Makefile.am b/java/examples/datatypes/Makefile.am index fedfec3..7d95a56 100644 --- a/java/examples/datatypes/Makefile.am +++ b/java/examples/datatypes/Makefile.am @@ -23,10 +23,10 @@ include $(top_srcdir)/config/commence.am # Mark this directory as part of the JNI API JAVA_API=yes -JAVAROOT = $(top_builddir)/.classes +JAVAROOT = .classes classes: - $(MKDIR_P) $(@D)/$(JAVAROOT) + test -d $(@D)/$(JAVAROOT) || $(MKDIR_P) $(@D)/$(JAVAROOT) pkgpath = examples/datatypes hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar @@ -71,7 +71,7 @@ TEST_SCRIPT = $(check_SCRIPTS) CLEANFILES = classnoinst.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class runExample.sh clean: - rm -rf $(JAVAROOT) + rm -rf $(JAVAROOT)/* rm -f $(jarfile) rm -f classnoinst.stamp diff --git a/java/examples/groups/Makefile.am b/java/examples/groups/Makefile.am index 181d2d9..be15b42 100644 --- a/java/examples/groups/Makefile.am +++ b/java/examples/groups/Makefile.am @@ -23,10 +23,10 @@ include $(top_srcdir)/config/commence.am # Mark this directory as part of the JNI API JAVA_API=yes -JAVAROOT = $(top_builddir)/.classes +JAVAROOT = .classes classes: - $(MKDIR_P) $(@D)/$(JAVAROOT) + test -d $(@D)/$(JAVAROOT) || $(MKDIR_P) $(@D)/$(JAVAROOT) pkgpath = examples/groups hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar @@ -61,7 +61,7 @@ TEST_SCRIPT = $(check_SCRIPTS) CLEANFILES = classnoinst.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class runExample.sh clean: - rm -rf $(JAVAROOT) + rm -rf $(JAVAROOT)/* rm -f $(jarfile) rm -f classnoinst.stamp diff --git a/java/examples/intro/Makefile.am b/java/examples/intro/Makefile.am index af4022b..3d5757a 100644 --- a/java/examples/intro/Makefile.am +++ b/java/examples/intro/Makefile.am @@ -23,10 +23,10 @@ include $(top_srcdir)/config/commence.am # Mark this directory as part of the JNI API JAVA_API=yes -JAVAROOT = $(top_builddir)/.classes +JAVAROOT = .classes classes: - $(MKDIR_P) $(@D)/$(JAVAROOT) + test -d $(@D)/$(JAVAROOT) || $(MKDIR_P) $(@D)/$(JAVAROOT) pkgpath = examples/intro hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar @@ -60,7 +60,7 @@ TEST_SCRIPT = $(check_SCRIPTS) CLEANFILES = classnoinst.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/*.class runExample.sh clean: - rm -rf $(JAVAROOT) + rm -rf $(JAVAROOT)/* rm -f $(jarfile) rm -f classnoinst.stamp diff --git a/java/src/Makefile.am b/java/src/Makefile.am index 3609f20..f2e12a7 100644 --- a/java/src/Makefile.am +++ b/java/src/Makefile.am @@ -30,10 +30,10 @@ JAVA_API=yes SUBDIRS=jni -JAVAROOT = $(top_builddir)/.classes +JAVAROOT = .classes classes: - $(MKDIR_P) $(@D)/$(JAVAROOT) + test -d $(@D)/$(JAVAROOT) || $(MKDIR_P) $(@D)/$(JAVAROOT) jarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar hdf5_javadir = $(libdir) @@ -126,7 +126,7 @@ docs: CLEANFILES = classhdf5_java.stamp $(jarfile) $(JAVAROOT)/$(pkgpath)/callbacks/*.class $(JAVAROOT)/$(pkgpath)/exceptions/*.class $(JAVAROOT)/$(pkgpath)/structs/*.class $(JAVAROOT)/$(pkgpath)/*.class clean: - rm -rf $(JAVAROOT) + rm -rf $(JAVAROOT)/* rm -f $(jarfile) rm -f classhdf5_java.stamp diff --git a/java/test/Makefile.am b/java/test/Makefile.am index d294d46..9f29f1c 100644 --- a/java/test/Makefile.am +++ b/java/test/Makefile.am @@ -23,10 +23,10 @@ include $(top_srcdir)/config/commence.am # Mark this directory as part of the JNI API JAVA_API=yes -JAVAROOT = $(top_builddir)/.classes +JAVAROOT = .classes classes: - $(MKDIR_P) $(@D)/$(JAVAROOT) + test -d $(@D)/$(JAVAROOT) || $(MKDIR_P) $(@D)/$(JAVAROOT) pkgpath = test hdfjarfile = jar$(PACKAGE_TARNAME)-$(PACKAGE_VERSION).jar @@ -96,7 +96,7 @@ AllJunitTests : chmod +x $@ clean: - rm -rf $(JAVAROOT) + rm -rf $(JAVAROOT)/* rm -f $(jarfile) rm -f classnoinst.stamp -- cgit v0.12 From 775f0cabad69f4098cda881252922a5cadca01c4 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 18 Mar 2016 14:54:26 -0500 Subject: [svn-r29474] Removed prototype enclosed in #ifdef OUT in H5Oprivate.h. This is unused and causes problems for a user who has OUT #defined. Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 autotools serial --- src/H5Oprivate.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 77b2b51..e117b8a 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -708,11 +708,6 @@ typedef struct H5O_fsinfo_t { typedef herr_t (*H5O_operator_t)(const void *mesg/*in*/, unsigned idx, void *operator_data/*in,out*/); -#ifdef OUT -/* Typedef for "internal library" iteration operations */ -typedef herr_t (*H5O_lib_operator_t)(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, - unsigned sequence, hbool_t *oh_modified/*out*/, void *operator_data/*in,out*/); -#endif /* Typedef for "internal library" iteration operations */ typedef herr_t (*H5O_lib_operator_t)(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, unsigned *oh_modified/*out*/, void *operator_data/*in,out*/); -- cgit v0.12 From 9c570c7b4227fce7fdfbb2dba20fb8e9290b5e26 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 21 Mar 2016 11:06:52 -0500 Subject: [svn-r29480] Correct copy functions to test the directory --- java/examples/datasets/runExample.sh.in | 8 ++++---- java/examples/datatypes/runExample.sh.in | 8 ++++---- java/examples/groups/runExample.sh.in | 12 ++++++------ java/examples/intro/runExample.sh.in | 8 ++++---- java/test/junit.sh.in | 8 ++++---- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/java/examples/datasets/runExample.sh.in b/java/examples/datasets/runExample.sh.in index 8ac28a7..dc63626 100644 --- a/java/examples/datasets/runExample.sh.in +++ b/java/examples/datasets/runExample.sh.in @@ -100,7 +100,7 @@ COPY_LIBFILES_TO_BLDLIBDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then $CP -f $tstfile $BLDLIBDIR if [ $? -ne 0 ]; then @@ -121,7 +121,7 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then $RM $BLDLIBDIR fi @@ -143,7 +143,7 @@ COPY_DATAFILES_TO_BLDDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then $CP -f $tstfile $BLDDIR if [ $? -ne 0 ]; then @@ -164,7 +164,7 @@ CLEAN_DATAFILES_AND_BLDDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then $RM $BLDDIR/*.txt $RM $BLDDIR/*.out diff --git a/java/examples/datatypes/runExample.sh.in b/java/examples/datatypes/runExample.sh.in index 9ed3954..e92abf1 100644 --- a/java/examples/datatypes/runExample.sh.in +++ b/java/examples/datatypes/runExample.sh.in @@ -97,7 +97,7 @@ COPY_LIBFILES_TO_BLDLIBDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then $CP -f $tstfile $BLDLIBDIR if [ $? -ne 0 ]; then @@ -118,7 +118,7 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then $RM $BLDLIBDIR fi @@ -140,7 +140,7 @@ COPY_DATAFILES_TO_BLDDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then $CP -f $tstfile $BLDDIR if [ $? -ne 0 ]; then @@ -161,7 +161,7 @@ CLEAN_DATAFILES_AND_BLDDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then $RM $BLDDIR/*.txt $RM $BLDDIR/*.out diff --git a/java/examples/groups/runExample.sh.in b/java/examples/groups/runExample.sh.in index a59a894..1ba81fd 100644 --- a/java/examples/groups/runExample.sh.in +++ b/java/examples/groups/runExample.sh.in @@ -92,7 +92,7 @@ COPY_LIBFILES_TO_BLDLIBDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then $CP -f $tstfile $BLDLIBDIR if [ $? -ne 0 ]; then @@ -113,7 +113,7 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then $RM $BLDLIBDIR fi @@ -135,7 +135,7 @@ COPY_DATAFILES_TO_BLDDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then $CP -f $tstfile $BLDDIR if [ $? -ne 0 ]; then @@ -156,7 +156,7 @@ CLEAN_DATAFILES_AND_BLDDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then $RM $BLDDIR/*.txt $RM $BLDDIR/*.out @@ -179,7 +179,7 @@ COPY_REFFILES_TO_BLDREFDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDREFDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then $CP -f $tstfile $BLDREFDIR if [ $? -ne 0 ]; then @@ -200,7 +200,7 @@ CLEAN_REFFILES_AND_BLDREFDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDREFDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then $RM $BLDREFDIR fi diff --git a/java/examples/intro/runExample.sh.in b/java/examples/intro/runExample.sh.in index ecc51ca..5b8c978 100644 --- a/java/examples/intro/runExample.sh.in +++ b/java/examples/intro/runExample.sh.in @@ -86,7 +86,7 @@ COPY_LIBFILES_TO_BLDLIBDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then $CP -f $tstfile $BLDLIBDIR if [ $? -ne 0 ]; then @@ -107,7 +107,7 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then $RM $BLDLIBDIR fi @@ -129,7 +129,7 @@ COPY_DATAFILES_TO_BLDDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then $CP -f $tstfile $BLDDIR if [ $? -ne 0 ]; then @@ -150,7 +150,7 @@ CLEAN_DATAFILES_AND_BLDDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then $RM $BLDDIR/*.txt $RM $BLDDIR/*.out diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 94b3415..6ea3473 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -89,7 +89,7 @@ COPY_LIBFILES_TO_BLDLIBDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then $CP -f $tstfile $BLDLIBDIR if [ $? -ne 0 ]; then @@ -110,7 +110,7 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then $RM $BLDLIBDIR fi @@ -132,7 +132,7 @@ COPY_DATAFILES_TO_BLDDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then $CP -f $tstfile $BLDDIR if [ $? -ne 0 ]; then @@ -153,7 +153,7 @@ CLEAN_DATAFILES_AND_BLDDIR() # make cp fail SDIR=`$DIRNAME $tstfile` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` + INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then $RM $BLDDIR/*.hdf $RM $BLDDIR/*.out -- cgit v0.12 From 7f641b520d13fa0dfd14baa067d165af0bd8d463 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 21 Mar 2016 11:36:23 -0500 Subject: [svn-r29482] Switched a few Visual Studio #ifdefs to Win32 Tested on 64-bit Win10 w/ VS 2015 Pro --- src/H5system.c | 4 ++-- src/H5win32defs.h | 4 ++-- tools/perform/sio_standalone.h | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/H5system.c b/src/H5system.c index eb09b15..e6ca5d4 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -728,7 +728,7 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5_make_time() */ -#ifdef H5_HAVE_VISUAL_STUDIO +#ifdef H5_HAVE_WIN32_API /* Offset between 1/1/1601 and 1/1/1970 in 100 nanosecond units */ #define _W32_FT_OFFSET (116444736000000000ULL) @@ -912,7 +912,7 @@ Wflock(int fd, int operation) { return 0; } /* end Wflock() */ -#endif /* H5_HAVE_VISUAL_STUDIO */ +#endif /* H5_HAVE_WIN32_API */ /*------------------------------------------------------------------------- diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 2a0f22d..a757832 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -65,6 +65,8 @@ typedef __int64 h5_stat_size_t; */ #define HDmemset(X,C,Z) memset((void*)(X),C,Z) +#endif /* H5_HAVE_VISUAL_STUDIO */ + struct timezone { int tz_minuteswest; int tz_dsttime; @@ -90,8 +92,6 @@ extern "C" { #define HDsnprintf c99_snprintf /*varargs*/ #define HDvsnprintf c99_vsnprintf /*varargs*/ -#endif /* H5_HAVE_VISUAL_STUDIO */ - /* Non-POSIX functions */ /* Don't use actual pthread_self on Windows because the return diff --git a/tools/perform/sio_standalone.h b/tools/perform/sio_standalone.h index 547a9ee..258eafb 100644 --- a/tools/perform/sio_standalone.h +++ b/tools/perform/sio_standalone.h @@ -210,11 +210,11 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #define HDgetgrgid(G) getgrgid(G) #define HDgetgrnam(S) getgrnam(S) #define HDgetgroups(Z,G) getgroups(Z,G) -#ifdef H5_HAVE_VISUAL_STUDIO +#ifdef H5_HAVE_WIN32_API #define HDgetlogin() Wgetlogin() -#else /* H5_HAVE_VISUAL_STUDIO */ +#else /* H5_HAVE_WIN32_API */ #define HDgetlogin() getlogin() -#endif /* H5_HAVE_VISUAL_STUDIO */ +#endif /* H5_HAVE_WIN32_API */ #define HDgetpgrp() getpgrp() #define HDgetpid() getpid() #define HDgetppid() getppid() @@ -222,12 +222,12 @@ H5_DLL int HDfprintf (FILE *stream, const char *fmt, ...); #define HDgetpwuid(U) getpwuid(U) #define HDgetrusage(X,S) getrusage(X,S) #define HDgets(S) gets(S) -#ifdef H5_HAVE_VISUAL_STUDIO +#ifdef H5_HAVE_WIN32_API H5_DLL int Wgettimeofday(struct timeval *tv, struct timezone *tz); #define HDgettimeofday(V,Z) Wgettimeofday(V,Z) -#else /* H5_HAVE_VISUAL_STUDIO */ +#else /* H5_HAVE_WIN32_API */ #define HDgettimeofday(S,P) gettimeofday(S,P) -#endif /* H5_HAVE_VISUAL_STUDIO */ +#endif /* H5_HAVE_WIN32_API */ #define HDgetuid() getuid() #define HDgmtime(T) gmtime(T) #define HDisalnum(C) isalnum((int)(C)) /*cast for solaris warning*/ -- cgit v0.12 From 6668fe8c839ca1b01e63e410cee15e2d4180ef88 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 22 Mar 2016 02:22:52 -0500 Subject: [svn-r29499] Minor prettification of Java configure code and library settings file. Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 autotools serial w/Java --- configure.ac | 6 +++--- src/libhdf5.settings.in | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index e80eef6..59157b2 100644 --- a/configure.ac +++ b/configure.ac @@ -855,10 +855,10 @@ esac ## Check if they would like the Java native interface (JNI) compiled ## -## This needs to be exposed for the library info file even if JAVA is disabled. +## This needs to be exposed for the library info file even if Java is disabled. AC_SUBST([HDF_JAVA]) -## Default is no JAVA +## Default is no Java HDF_JAVA=no AC_SUBST([H5_CLASSPATH]) H5_CLASSPATH="" @@ -3174,7 +3174,7 @@ fi java_version_info=`$JAVA -version 2>&1 |\ grep 'version' | sed -e 's/version "//' | sed -e 's/"//'` if test -n "$java_version_info"; then - JAVA_VERSION="$JAVA_VERSION ( $java_version_info)" + JAVA_VERSION="$JAVA_VERSION ($java_version_info)" fi ## ---------------------------------------------------------------------- diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index b54257f..8017594 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -60,8 +60,9 @@ Languages: @BUILD_CXX_CONDITIONAL_TRUE@ Shared C++ Library: @enable_shared@ @BUILD_CXX_CONDITIONAL_TRUE@ Static C++ Library: @enable_static@ - JAVA: @HDF_JAVA@ -@BUILD_JAVA_CONDITIONAL_TRUE@ JAVA Compiler: @JAVA_VERSION@ + Java: @HDF_JAVA@ +@BUILD_JAVA_CONDITIONAL_TRUE@ Java Compiler: @JAVA_VERSION@ + Features: --------- -- cgit v0.12 From 2280524115cf03b0aa2cb38406b19be32efb585d Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 22 Mar 2016 02:28:14 -0500 Subject: [svn-r29500] Made CMake header generation a normal (not advanced) option since users will need to set this if they check out source. Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 CMake serial (CMake 3.2.2) --- src/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f013148..1e0061f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -780,7 +780,6 @@ set (H5_GENERATED_HEADERS ) option (HDF5_GENERATE_HEADERS "Rebuild Generated Files" OFF) -mark_as_advanced (HDF5_GENERATE_HEADERS) if (HDF5_GENERATE_HEADERS) set_source_files_properties(${H5_GENERATED_HEADERS} PROPERTIES GENERATED TRUE) find_package (Perl) -- cgit v0.12 From 9c3568819f3e15d95a47e544fc13e00995e54f0e Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 22 Mar 2016 02:37:07 -0500 Subject: [svn-r29501] - POSIX compliance changes to autogen.sh - autogen.sh now exits on unknown arguments Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 autotools serial --- autogen.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/autogen.sh b/autogen.sh index 3c0ad7b..f3bd774 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,4 +1,4 @@ -#! /bin/bash +#!/bin/sh # # Copyright by The HDF Group. # All rights reserved. @@ -110,8 +110,10 @@ while getopts "$optspec" optchar; do verbose=true ;; *) - if [ "$OPTERR" != 1 ] || [ "${optspec:0:1}" = ":" ]; then - echo "Non-option argument: '-${OPTARG}'" >&2 + if [ "$OPTERR" != 1 ] || case $optspec in :*) ;; *) false; esac; then + echo "ERROR: non-option argument: '-${OPTARG}'" >&2 + echo "Quitting" + exit 1 fi ;; esac -- cgit v0.12 From 7255d1a1b8e0b12cc652bf6d1becbe46bc328c6e Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 22 Mar 2016 02:59:28 -0500 Subject: [svn-r29502] The thread-safety and enable Java options have been marked as "unsupported" in the autotools. Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 autotools serial w/ Java --- configure.ac | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 59157b2..272f5cd 100644 --- a/configure.ac +++ b/configure.ac @@ -1575,7 +1575,7 @@ AC_ARG_ENABLE([threadsafe], [default=no]])], [THREADSAFE=$enableval]) -## The high-level, C++, and Fortran interfaces are not compatible +## The high-level, C++, Fortran and Java interfaces are not compatible ## with the thread-safety option because the lock is not hoisted ## into the higher-level API calls. @@ -1607,6 +1607,14 @@ if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then fi fi +## --enable-threadsafe is also incompatible with --enable-java unless +## --enable-unsupported has been specified on the configure line. +if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then + if test "X${HDF_JAVA}" = "Xyes" -a "X${enable_threadsafe}" = "Xyes"; then + AC_MSG_ERROR([--enable-java and --enable-threadsafe flags are incompatible. Use --enable-unsupported to override this error.]) + fi +fi + case "X-$THREADSAFE" in X-|X-no) -- cgit v0.12 From 5309de6c548bd0af26bde85df20d8fd6ca518838 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 22 Mar 2016 03:03:50 -0500 Subject: [svn-r29503] The parallel and enable Java options have been marked as "unsupported" in the autotools. Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 autotools parallel w/ Java --- configure.ac | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/configure.ac b/configure.ac index 272f5cd..e552366 100644 --- a/configure.ac +++ b/configure.ac @@ -2437,6 +2437,15 @@ if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then fi fi +## The --enable-parallel flag is not compatible with --enable-java. +## If the user tried to specify both flags, throw an error, unless +## they also provided the --enable-unsupported flag. +if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then + if test "X${HDF_JAVA}" = "Xyes" -a "X${enable_parallel}" = "Xyes"; then + AC_MSG_ERROR([--enable-java and --enable-parallel flags are incompatible. Use --enable-unsupported to override this error.]) + fi +fi + ## --enable-parallel is also incompatible with --enable-threadsafe, unless ## --enable-unsupported has been specified on the configure line. if test "X${ALLOW_UNSUPPORTED}" != "Xyes"; then -- cgit v0.12 From 98e315ffffdd4df59ad37259531bcef205d60d0e Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 22 Mar 2016 10:15:44 -0500 Subject: [svn-r29507] Add actual file name to delete functions to prevent accidental deletion of source files. (HDFFV-9730 created for tools scripts, which is the basis for the java scripts) --- java/examples/datasets/runExample.sh.in | 4 ++-- java/examples/datatypes/runExample.sh.in | 4 ++-- java/examples/groups/runExample.sh.in | 6 +++--- java/examples/intro/runExample.sh.in | 4 ++-- java/test/junit.sh.in | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/java/examples/datasets/runExample.sh.in b/java/examples/datasets/runExample.sh.in index dc63626..8d906db 100644 --- a/java/examples/datasets/runExample.sh.in +++ b/java/examples/datasets/runExample.sh.in @@ -119,7 +119,7 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $tstfile` + SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.5.jar` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then @@ -162,7 +162,7 @@ CLEAN_DATAFILES_AND_BLDDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $tstfile` + SDIR=`$DIRNAME $HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Alloc.txt` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then diff --git a/java/examples/datatypes/runExample.sh.in b/java/examples/datatypes/runExample.sh.in index e92abf1..adfcea0 100644 --- a/java/examples/datatypes/runExample.sh.in +++ b/java/examples/datatypes/runExample.sh.in @@ -116,7 +116,7 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $tstfile` + SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.5.jar` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then @@ -159,7 +159,7 @@ CLEAN_DATAFILES_AND_BLDDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $tstfile` + SDIR=`$DIRNAME $HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_Array.txt` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then diff --git a/java/examples/groups/runExample.sh.in b/java/examples/groups/runExample.sh.in index 1ba81fd..ebc6edd 100644 --- a/java/examples/groups/runExample.sh.in +++ b/java/examples/groups/runExample.sh.in @@ -111,7 +111,7 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $tstfile` + SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.5.jar` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then @@ -154,7 +154,7 @@ CLEAN_DATAFILES_AND_BLDDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $tstfile` + SDIR=`$DIRNAME $HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Create.txt` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then @@ -198,7 +198,7 @@ CLEAN_REFFILES_AND_BLDREFDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $tstfile` + SDIR=`$DIRNAME $HDFTEST_HOME/h5ex_g_iterate.h5` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDREFDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then diff --git a/java/examples/intro/runExample.sh.in b/java/examples/intro/runExample.sh.in index 5b8c978..5d13fa6 100644 --- a/java/examples/intro/runExample.sh.in +++ b/java/examples/intro/runExample.sh.in @@ -105,7 +105,7 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $tstfile` + SDIR=`$DIRNAME $HDFLIB_HOME/slf4j-api-1.7.5.jar` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then @@ -148,7 +148,7 @@ CLEAN_DATAFILES_AND_BLDDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $tstfile` + SDIR=`$DIRNAME $HDFTEST_HOME/../testfiles/examples.intro.H5_CreateDataset.txt` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 6ea3473..8de07e3 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -108,7 +108,7 @@ CLEAN_LIBFILES_AND_BLDLIBDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $tstfile` + SDIR=`$DIRNAME $HDFLIB_HOME/junit.jar` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDLIBDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then @@ -151,7 +151,7 @@ CLEAN_DATAFILES_AND_BLDDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $tstfile` + SDIR=`$DIRNAME $HDFTEST_HOME/h5ex_g_iterate.hdf` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then -- cgit v0.12 From 07b2f7350694daf989eb9da39970c8a9600603c3 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 22 Mar 2016 12:55:45 -0500 Subject: [svn-r29513] Only delete the copied and generated test files. --- java/examples/datasets/runExample.sh.in | 12 ++---------- java/examples/datatypes/runExample.sh.in | 12 ++---------- java/examples/groups/runExample.sh.in | 12 ++---------- java/examples/intro/runExample.sh.in | 12 ++---------- 4 files changed, 8 insertions(+), 40 deletions(-) diff --git a/java/examples/datasets/runExample.sh.in b/java/examples/datasets/runExample.sh.in index 8d906db..83b06ec 100644 --- a/java/examples/datasets/runExample.sh.in +++ b/java/examples/datasets/runExample.sh.in @@ -159,16 +159,8 @@ COPY_DATAFILES_TO_BLDDIR() CLEAN_DATAFILES_AND_BLDDIR() { - # skip rm if srcdir is same as destdir - # this occurs when build/test performed in source dir and - # make cp fail - SDIR=`$DIRNAME $HDFTEST_HOME/../testfiles/examples.datasets.H5Ex_D_Alloc.txt` - INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` - if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $RM $BLDDIR/*.txt - $RM $BLDDIR/*.out - fi + $RM $BLDDIR/examples.datasets.H5Ex_D_*.txt + $RM $BLDDIR/H5Ex_D_*.out } # Print a line-line message left justified in a field of 70 characters diff --git a/java/examples/datatypes/runExample.sh.in b/java/examples/datatypes/runExample.sh.in index adfcea0..f80450e 100644 --- a/java/examples/datatypes/runExample.sh.in +++ b/java/examples/datatypes/runExample.sh.in @@ -156,16 +156,8 @@ COPY_DATAFILES_TO_BLDDIR() CLEAN_DATAFILES_AND_BLDDIR() { - # skip rm if srcdir is same as destdir - # this occurs when build/test performed in source dir and - # make cp fail - SDIR=`$DIRNAME $HDFTEST_HOME/../testfiles/examples.datatypes.H5Ex_T_Array.txt` - INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` - if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $RM $BLDDIR/*.txt - $RM $BLDDIR/*.out - fi + $RM $BLDDIR/examples.datatypes.H5Ex_T_*.txt + $RM $BLDDIR/H5Ex_T_*.out } # Print a line-line message left justified in a field of 70 characters diff --git a/java/examples/groups/runExample.sh.in b/java/examples/groups/runExample.sh.in index ebc6edd..7dddc6d 100644 --- a/java/examples/groups/runExample.sh.in +++ b/java/examples/groups/runExample.sh.in @@ -151,16 +151,8 @@ COPY_DATAFILES_TO_BLDDIR() CLEAN_DATAFILES_AND_BLDDIR() { - # skip rm if srcdir is same as destdir - # this occurs when build/test performed in source dir and - # make cp fail - SDIR=`$DIRNAME $HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Create.txt` - INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` - if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $RM $BLDDIR/*.txt - $RM $BLDDIR/*.out - fi + $RM $BLDDIR/examples.groups.H5Ex_G_*.txt + $RM $BLDDIR/H5Ex_G_*.out } COPY_REFFILES="$LIST_REF_FILES" diff --git a/java/examples/intro/runExample.sh.in b/java/examples/intro/runExample.sh.in index 5d13fa6..60ea765 100644 --- a/java/examples/intro/runExample.sh.in +++ b/java/examples/intro/runExample.sh.in @@ -145,16 +145,8 @@ COPY_DATAFILES_TO_BLDDIR() CLEAN_DATAFILES_AND_BLDDIR() { - # skip rm if srcdir is same as destdir - # this occurs when build/test performed in source dir and - # make cp fail - SDIR=`$DIRNAME $HDFTEST_HOME/../testfiles/examples.intro.H5_CreateDataset.txt` - INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` - if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $RM $BLDDIR/*.txt - $RM $BLDDIR/*.out - fi + $RM $BLDDIR/examples.intro.H5_*.txt + $RM $BLDDIR/H5_*.out } # Print a line-line message left justified in a field of 70 characters -- cgit v0.12 From bb80d618be9c43fe442091df2b16dcb3fc75b8ed Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 22 Mar 2016 14:58:35 -0500 Subject: [svn-r29519] rename java test file because test modifies original file. --- MANIFEST | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MANIFEST b/MANIFEST index 0e20e02..2619a32 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2691,7 +2691,7 @@ ./java/test/junit.sh.in ./java/test/JUnit-interface.txt ./java/test/JUnit-interface.ert -./java/test/h5ex_g_iterate.hdf +./java/test/h5ex_g_iterate.orig ./java/test/TestH5.java ./java/test/TestH5A.java ./java/test/TestH5Dparams.java -- cgit v0.12 From a4ec4e3eb18581a29241d92de0a73052a285ae60 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 22 Mar 2016 15:02:33 -0500 Subject: [svn-r29520] rename java test file because test modifies original file. Delete copy when test is finished. --- java/test/CMakeLists.txt | 16 +++++++++++++++- java/test/h5ex_g_iterate.hdf | Bin 2928 -> 0 bytes java/test/h5ex_g_iterate.orig | Bin 0 -> 2928 bytes java/test/junit.sh.in | 21 +++++++-------------- 4 files changed, 22 insertions(+), 15 deletions(-) delete mode 100644 java/test/h5ex_g_iterate.hdf create mode 100644 java/test/h5ex_g_iterate.orig diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index 938a15b..291284c 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -63,7 +63,6 @@ add_dependencies (${HDF5_JAVA_TEST_LIB_TARGET} ${HDF5_JAVA_HDF5_LIB_TARGET}) set_target_properties (${HDF5_JAVA_TEST_LIB_TARGET} PROPERTIES FOLDER test/java) set (HDF_JAVA_TEST_FILES - h5ex_g_iterate.hdf JUnit-interface.txt JUnit-interface.ert ) @@ -79,6 +78,13 @@ foreach (h5_file ${HDF_JAVA_TEST_FILES}) ) endforeach (h5_file ${HDF_JAVA_TEST_FILES}) +add_custom_command ( + TARGET ${HDF5_JAVA_TEST_LIB_TARGET} + POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS -E copy_if_different ${PROJECT_SOURCE_DIR}/h5ex_g_iterate.orig ${PROJECT_BINARY_DIR}/h5ex_g_iterate.hdf +) + if (WIN32) set (CMAKE_JAVA_INCLUDE_FLAG_SEP ";") else (WIN32) @@ -97,6 +103,14 @@ if (CMAKE_BUILD_TYPE MATCHES Debug) endif(CMAKE_BUILD_TYPE MATCHES Debug) add_test ( + NAME JJUnit-interface-clearall-objects + COMMAND ${CMAKE_COMMAND} + -E remove + JUnit-interface.out + JUnit-interface.out.err +) + +add_test ( NAME JUnit-interface COMMAND "${CMAKE_COMMAND}" -D "TEST_TESTER=${CMAKE_Java_RUNTIME};${CMAKE_Java_RUNTIME_FLAGS}" diff --git a/java/test/h5ex_g_iterate.hdf b/java/test/h5ex_g_iterate.hdf deleted file mode 100644 index e462703..0000000 Binary files a/java/test/h5ex_g_iterate.hdf and /dev/null differ diff --git a/java/test/h5ex_g_iterate.orig b/java/test/h5ex_g_iterate.orig new file mode 100644 index 0000000..e462703 Binary files /dev/null and b/java/test/h5ex_g_iterate.orig differ diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 8de07e3..698dc5d 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -61,8 +61,8 @@ $top_builddir/java/src/jni/.libs/libhdf5_java.* $top_builddir/java/src/$JARFILE " LIST_DATA_FILES=" -$HDFTEST_HOME/h5ex_g_iterate.hdf $HDFTEST_HOME/JUnit-interface.txt +$HDFTEST_HOME/JUnit-interface.ert " expect="JUnit-interface.txt" @@ -144,23 +144,16 @@ COPY_DATAFILES_TO_BLDDIR() fi fi done + $CP -f $HDFTEST_HOME/h5ex_g_iterate.orig $BLDDIR/h5ex_g_iterate.hdf } CLEAN_DATAFILES_AND_BLDDIR() { - # skip rm if srcdir is same as destdir - # this occurs when build/test performed in source dir and - # make cp fail - SDIR=`$DIRNAME $HDFTEST_HOME/h5ex_g_iterate.hdf` - INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` - INODE_DDIR=`$LS -i -d $BLDDIR | $AWK -F' ' '{print $1}'` - if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $RM $BLDDIR/*.hdf - $RM $BLDDIR/*.out - $RM $BLDDIR/*.err - $RM $BLDDIR/*.ext - $RM $BLDDIR/*.txt - fi + $RM $BLDDIR/h5ex_g_iterate.hdf + $RM $BLDDIR/JUnit-interface.out + $RM $BLDDIR/JUnit-interface.err + $RM $BLDDIR/JUnit-interface.ext + $RM $BLDDIR/JUnit-interface.txt } # Print a line-line message left justified in a field of 70 characters -- cgit v0.12 From e3183aab0d348882fb3769c084c77498700b253b Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 22 Mar 2016 15:12:07 -0500 Subject: [svn-r29523] Add test dependency --- java/test/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index 291284c..a675177 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -128,3 +128,4 @@ add_test ( -D "TEST_REFERENCE=JUnit-interface.txt" -P "${HDF_RESOURCES_DIR}/jrunTest.cmake" ) +set_tests_properties (JUnit-interface PROPERTIES DEPENDS "JUnit-interface-clearall-objects") -- cgit v0.12 From 0e8941b0881e5b39dbf87f2456c40eeb148dc79b Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 22 Mar 2016 15:12:39 -0500 Subject: [svn-r29524] Fix typo in test name --- java/test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index a675177..4e20d89 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -103,7 +103,7 @@ if (CMAKE_BUILD_TYPE MATCHES Debug) endif(CMAKE_BUILD_TYPE MATCHES Debug) add_test ( - NAME JJUnit-interface-clearall-objects + NAME JUnit-interface-clearall-objects COMMAND ${CMAKE_COMMAND} -E remove JUnit-interface.out -- cgit v0.12 From 710d1caf54cc4edb47ef83280b6d5a1af445b9d1 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 23 Mar 2016 11:50:42 -0500 Subject: [svn-r29531] Normalization w/ revise_chunks in preparation for big merge. hl and bin directories Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 autotools serial w/ Java, Fortran, & C++ --- bin/cmakehdf5 | 2 +- hl/src/H5DOpublic.h | 10 +++------- hl/src/H5TB.c | 2 +- hl/test/Makefile.am | 1 - hl/test/test_dset_opt.c | 2 +- 5 files changed, 6 insertions(+), 11 deletions(-) diff --git a/bin/cmakehdf5 b/bin/cmakehdf5 index ccef469..7f6453a 100755 --- a/bin/cmakehdf5 +++ b/bin/cmakehdf5 @@ -29,7 +29,7 @@ exit_code=0 # and should have invoked as "$srcdir/bin/$progname" or # "bin/$progname". So, by striping bin/$program from $0, # we can find $srcdir. -if [ $0 == bin/$progname ]; then +if [ "$0" = "bin/${progname}" ]; then srcdir="." # current directory else # $0 is $srdir/bin/$progname diff --git a/hl/src/H5DOpublic.h b/hl/src/H5DOpublic.h index 774709e..9cf6921 100644 --- a/hl/src/H5DOpublic.h +++ b/hl/src/H5DOpublic.h @@ -22,17 +22,13 @@ extern "C" { /*------------------------------------------------------------------------- * - * Direct chunk write function + * "Optimized dataset" routines. * *------------------------------------------------------------------------- */ -H5_HLDLL herr_t H5DOwrite_chunk(hid_t dset_id, - hid_t dxpl_id, - uint32_t filters, - const hsize_t *offset, - size_t data_size, - const void *buf); +H5_HLDLL herr_t H5DOwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, + const hsize_t *offset, size_t data_size, const void *buf); #ifdef __cplusplus } diff --git a/hl/src/H5TB.c b/hl/src/H5TB.c index 0f90393..bcd3339 100644 --- a/hl/src/H5TB.c +++ b/hl/src/H5TB.c @@ -3248,7 +3248,7 @@ out: * *------------------------------------------------------------------------- */ -static +H5_ATTR_PURE static hbool_t H5TB_find_field(const char *field, const char *field_list) { const char *start = field_list; diff --git a/hl/test/Makefile.am b/hl/test/Makefile.am index 32d14b6..bea760e 100644 --- a/hl/test/Makefile.am +++ b/hl/test/Makefile.am @@ -1,4 +1,3 @@ -# # Copyright by The HDF Group. # Copyright by the Board of Trustees of the University of Illinois. # All rights reserved. diff --git a/hl/test/test_dset_opt.c b/hl/test/test_dset_opt.c index a8ffa44..c1e369e 100644 --- a/hl/test/test_dset_opt.c +++ b/hl/test/test_dset_opt.c @@ -41,7 +41,7 @@ #define CHUNK_NX 4 #define CHUNK_NY 4 -#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s))*1.001F)+12) +#define DEFLATE_SIZE_ADJUST(s) (ceil(((double)(s))*(double)1.001F)+12) /* Temporary filter IDs used for testing */ #define H5Z_FILTER_BOGUS1 305 -- cgit v0.12 From 5a9a9e8f0ee8bee687c99bcc3a1b2414e10a9ba7 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 23 Mar 2016 12:42:06 -0500 Subject: [svn-r29534] Normalization w/ revise_chunks in preparation for big merge. tools directory Also fixes a minor Java test output error. Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 autotools serial w/ Java, Fortran, & C++ --- config/cmake/jrunTest.cmake | 8 ++++---- tools/Makefile.am | 2 +- tools/h5copy/h5copygentest.c | 2 +- tools/h5repack/h5repack_main.c | 2 +- tools/h5stat/h5stat_gentest.c | 8 ++++++-- tools/lib/h5tools.h | 2 +- tools/lib/h5tools_str.c | 3 +++ 7 files changed, 17 insertions(+), 10 deletions(-) diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake index 6c9bbdd..7a92867 100644 --- a/config/cmake/jrunTest.cmake +++ b/config/cmake/jrunTest.cmake @@ -72,9 +72,9 @@ endif (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) if (TEST_MASK_ERROR) if (NOT TEST_ERRREF) - file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) - else (NOT TEST_ERRREF) file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) + else (NOT TEST_ERRREF) + file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) endif (NOT TEST_ERRREF) string (REGEX REPLACE "Time:[^\n]+\n" "Time: XXXX\n" TEST_STREAM "${TEST_STREAM}") string (REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}") @@ -85,9 +85,9 @@ if (TEST_MASK_ERROR) string (REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") string (REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") if (NOT TEST_ERRREF) - file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") - else (NOT TEST_ERRREF) file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + else (NOT TEST_ERRREF) + file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") endif (NOT TEST_ERRREF) endif (TEST_MASK_ERROR) diff --git a/tools/Makefile.am b/tools/Makefile.am index 095cc30..38e853d 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -25,6 +25,6 @@ CONFIG=ordered # All subdirectories SUBDIRS=lib h5diff h5ls h5dump misc h5import h5repack h5jam h5copy h5stat \ - perform + perform include $(top_srcdir)/config/conclude.am diff --git a/tools/h5copy/h5copygentest.c b/tools/h5copy/h5copygentest.c index 49204f5..e4704ed 100644 --- a/tools/h5copy/h5copygentest.c +++ b/tools/h5copy/h5copygentest.c @@ -644,7 +644,7 @@ out: *------------------------------------------------------------------------*/ static void Test_Obj_Copy(void) { - hid_t fid=0; + hid_t fid = -1; /* File id */ /* Create source file */ fid = H5Fcreate(HDF_FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index c56e3ce..4361efe 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -360,7 +360,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) { has_i_o = 1; break; - /* -o for backward compability */ + /* -o for backward compability */ case 'o': outfile = opt_arg; has_i_o = 1; diff --git a/tools/h5stat/h5stat_gentest.c b/tools/h5stat/h5stat_gentest.c index 100f5b2..ad7d093 100644 --- a/tools/h5stat/h5stat_gentest.c +++ b/tools/h5stat/h5stat_gentest.c @@ -43,7 +43,6 @@ /* * Generate HDF5 file with latest format with * NUM_GRPS groups and NUM_ATTRS attributes for the dataset - * */ static void gen_newgrat_file(const char *fname) @@ -111,6 +110,10 @@ gen_newgrat_file(const char *fname) } /* end for */ /* Close dataset, dataspace, datatype, file */ + if(H5Pclose(fapl) < 0) + goto error; + if(H5Pclose(fcpl) < 0) + goto error; if(H5Dclose(did) < 0) goto error; if(H5Sclose(sid) < 0) @@ -122,6 +125,8 @@ gen_newgrat_file(const char *fname) error: H5E_BEGIN_TRY { + H5Pclose(fapl); + H5Pclose(fcpl); H5Aclose(attr_id); H5Dclose(did); H5Tclose(tid); @@ -129,7 +134,6 @@ error: H5Gclose(gid); H5Fclose(fid); } H5E_END_TRY; - } /* gen_newgrat_file() */ /* diff --git a/tools/lib/h5tools.h b/tools/lib/h5tools.h index d2e3ea6..cec3b9d 100644 --- a/tools/lib/h5tools.h +++ b/tools/lib/h5tools.h @@ -510,7 +510,7 @@ typedef struct h5tools_context_t { hsize_t size_last_dim; /*the size of the last dimension, *needed so we can break after each *row */ - int indent_level; /*the number of times we need some + int indent_level; /*the number of times we need some *extra indentation */ int default_indent_level; /*this is used when the indent level gets changed */ hsize_t acc[H5S_MAX_RANK]; /* accumulator position */ diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c index bdb82a4..13c6a20 100644 --- a/tools/lib/h5tools_str.c +++ b/tools/lib/h5tools_str.c @@ -267,6 +267,9 @@ h5tools_str_fmt(h5tools_str_t *str/*in,out*/, size_t start, const char *fmt) { char _temp[1024], *temp = _temp; + HDassert(str); + HDassert(fmt); + /* If the format string is simply "%s" then don't bother doing anything */ if (!HDstrcmp(fmt, "%s")) return str->s; -- cgit v0.12 From 8ed8520c19779f24d5d8018c9eb488aaad1c4d2d Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 23 Mar 2016 14:32:59 -0500 Subject: [svn-r29537] Added "latest format" tests to h5copy and h5repack from revise_chunks. Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 autotools serial cmake serial --- MANIFEST | 2 + tools/h5copy/h5copygentest.c | 42 +- tools/h5copy/testfiles/h5copytst_new.h5 | Bin 0 -> 30280 bytes tools/h5copy/testfiles/h5copytst_new.out.ls | 502 +++++++++++++++++++++ tools/h5repack/h5repack.c | 4 +- tools/h5repack/h5repack.h | 5 +- tools/h5repack/h5repack_main.c | 10 +- tools/h5repack/h5repacktst.c | 167 ++++--- .../testfiles/deflate_limit.h5repack_layout.h5.ddl | 2 +- tools/h5repack/testfiles/h5repack_attr.h5 | Bin 20056 -> 21856 bytes tools/h5repack/testfiles/h5repack_attr_refs.h5 | Bin 10112 -> 10336 bytes tools/h5repack/testfiles/h5repack_deflate.h5 | Bin 5962 -> 6336 bytes tools/h5repack/testfiles/h5repack_early.h5 | Bin 2067224 -> 3074224 bytes tools/h5repack/testfiles/h5repack_ext.h5 | Bin 1464 -> 1464 bytes tools/h5repack/testfiles/h5repack_fill.h5 | Bin 2072 -> 2168 bytes tools/h5repack/testfiles/h5repack_filters.h5 | Bin 29744 -> 27604 bytes tools/h5repack/testfiles/h5repack_fletcher.h5 | Bin 7880 -> 7232 bytes tools/h5repack/testfiles/h5repack_hlink.h5 | Bin 6576 -> 6544 bytes tools/h5repack/testfiles/h5repack_layout.h5 | Bin 27280 -> 29480 bytes .../testfiles/h5repack_layout.h5-plugin_test.ddl | 2 +- tools/h5repack/testfiles/h5repack_layout2.h5 | Bin 6808 -> 6808 bytes tools/h5repack/testfiles/h5repack_layout3.h5 | Bin 491840 -> 491840 bytes tools/h5repack/testfiles/h5repack_named_dtypes.h5 | Bin 4304 -> 4320 bytes tools/h5repack/testfiles/h5repack_nbit.h5 | Bin 13776 -> 13208 bytes tools/h5repack/testfiles/h5repack_objs.h5 | Bin 19770 -> 19738 bytes tools/h5repack/testfiles/h5repack_refs.h5 | Bin 9472 -> 10336 bytes tools/h5repack/testfiles/h5repack_shuffle.h5 | Bin 7864 -> 7216 bytes tools/h5repack/testfiles/h5repack_soffset.h5 | Bin 11052 -> 12452 bytes 28 files changed, 657 insertions(+), 79 deletions(-) create mode 100644 tools/h5copy/testfiles/h5copytst_new.h5 create mode 100644 tools/h5copy/testfiles/h5copytst_new.out.ls diff --git a/MANIFEST b/MANIFEST index 2619a32..ba15450 100644 --- a/MANIFEST +++ b/MANIFEST @@ -2263,6 +2263,8 @@ ./tools/h5copy/testfiles/h5copy_extlinks_trg.h5 ./tools/h5copy/testfiles/h5copy_extlinks_src.out.ls ./tools/h5copy/testfiles/h5copy_misc1.out +./tools/h5copy/testfiles/h5copytst_new.h5 +./tools/h5copy/testfiles/h5copytst_new.out.ls # test files for h5mkgrp ./tools/testfiles/h5mkgrp_nested_p.ls diff --git a/tools/h5copy/h5copygentest.c b/tools/h5copy/h5copygentest.c index e4704ed..93203c6 100644 --- a/tools/h5copy/h5copygentest.c +++ b/tools/h5copy/h5copygentest.c @@ -22,6 +22,7 @@ /* HDF file names */ #define HDF_FILE1 "h5copytst.h5" +#define HDF_FILE1_NEW "h5copytst_new.h5" #define HDF_FILE2 "h5copy_ref.h5" #define HDF_EXT_SRC_FILE "h5copy_extlinks_src.h5" #define HDF_EXT_TRG_FILE "h5copy_extlinks_trg.h5" @@ -645,19 +646,40 @@ out: static void Test_Obj_Copy(void) { hid_t fid = -1; /* File id */ + hid_t fapl_new = (-1); /* File access property id */ + unsigned new_format; /* New format or old format */ - /* Create source file */ - fid = H5Fcreate(HDF_FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - if (fid < 0) - { - fprintf(stderr, "Error: %s> H5Fcreate failed.\n", HDF_FILE1); + if((fapl_new = H5Pcreate(H5P_FILE_ACCESS)) < 0) { + fprintf(stderr, "Error: H5Pcreate failed.\n"); + goto out; + } + if(H5Pset_libver_bounds(fapl_new, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) { + fprintf(stderr, "Error: H5Pset_libver_bounds failed.\n"); goto out; } - gent_datasets(fid); - gent_empty_group(fid); - gent_nested_datasets(fid); - gent_nested_group(fid); + /* Test with old & new format groups */ + for(new_format = FALSE; new_format <= TRUE; new_format++) { + + /* Set the FAPL for the type of format */ + /* Create source file */ + if(new_format) + fid = H5Fcreate(HDF_FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_new); + else + fid = H5Fcreate(HDF_FILE1_NEW, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + if(fid < 0) { + fprintf(stderr, "Error: H5Fcreate failed.\n"); + goto out; + } + + gent_datasets(fid); + gent_empty_group(fid); + gent_nested_datasets(fid); + gent_nested_group(fid); + + H5Fclose(fid); + fid = (-1); + } /* end for */ out: /*----------------------------------------------------------------------- @@ -665,6 +687,8 @@ out: *------------------------------------------------------------------------*/ if(fid > 0) H5Fclose(fid); + if(fapl_new > 0) + H5Pclose(fapl_new); } /*------------------------------------------------------------------------- diff --git a/tools/h5copy/testfiles/h5copytst_new.h5 b/tools/h5copy/testfiles/h5copytst_new.h5 new file mode 100644 index 0000000..222c511 Binary files /dev/null and b/tools/h5copy/testfiles/h5copytst_new.h5 differ diff --git a/tools/h5copy/testfiles/h5copytst_new.out.ls b/tools/h5copy/testfiles/h5copytst_new.out.ls new file mode 100644 index 0000000..9df6b2e --- /dev/null +++ b/tools/h5copy/testfiles/h5copytst_new.out.ls @@ -0,0 +1,502 @@ +############################# +Expected output for 'h5ls ../testfiles/h5copytst_new.out.h5' +############################# +Opened "../testfiles/h5copytst_new.out.h5" with sec2 driver. +/ Group + Location: 1:96 + Links: 1 +/A Group + Location: 1:65602 + Links: 1 +/A/B1 Group + Location: 1:66306 + Links: 1 +/A/B1/simple Dataset {6/6} + Location: 1:65509 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: 32-bit little-endian integer +/A/B2 Group + Location: 1:69807 + Links: 1 +/A/B2/simple2 Dataset {6/6} + Location: 1:69714 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: 32-bit little-endian integer +/C Group + Location: 1:72980 + Links: 1 +/C/D Group + Location: 1:73684 + Links: 1 +/C/D/simple Dataset {6/6} + Location: 1:72887 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: 32-bit little-endian integer +/E Group + Location: 1:76217 + Links: 1 +/E/F Group + Location: 1:76921 + Links: 1 +/E/F/grp_dsets Group + Location: 1:75044 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX +/E/F/grp_dsets/chunk Dataset {6/6} + Location: 1:76014 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Chunks: {2} 8 bytes + Storage:
+ Type: 32-bit little-endian integer +/E/F/grp_dsets/compact Dataset {6/6} + Location: 1:75367 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: 32-bit little-endian integer +/E/F/grp_dsets/compound Dataset {2/2} + Location: 1:75470 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: struct { + "str1" +0 20-byte null-terminated ASCII string + "str2" +20 20-byte null-terminated ASCII string + } 40 bytes +/E/F/grp_dsets/compressed Dataset {6/6} + Location: 1:75683 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Chunks: {2} 8 bytes + Storage:
+ Filter-0: deflate-1 OPT {1} + Type: 32-bit little-endian integer +/E/F/grp_dsets/named_vl Dataset {2/2} + Location: 1:75853 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: shared-1:75793 variable length of + 32-bit little-endian integer +/E/F/grp_dsets/nested_vl Dataset {2/2} + Location: 1:76108 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: variable length of + variable length of + 32-bit little-endian integer +/E/F/grp_dsets/simple Dataset {6/6} + Location: 1:75274 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: 32-bit little-endian integer +/E/F/grp_dsets/vl Type + Location: 1:75793 + Links: 2 + Modified: XXXX-XX-XX XX:XX:XX XXX + Type: shared-1:75793 variable length of + 32-bit little-endian integer +/G Group + Location: 1:85688 + Links: 1 +/G/H Group + Location: 1:86392 + Links: 1 +/G/H/grp_nested Group + Location: 1:84436 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX +/G/H/grp_nested/grp_dsets Group + Location: 1:84515 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX +/G/H/grp_nested/grp_dsets/chunk Dataset {6/6} + Location: 1:85485 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Chunks: {2} 8 bytes + Storage:
+ Type: 32-bit little-endian integer +/G/H/grp_nested/grp_dsets/compact Dataset {6/6} + Location: 1:84838 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: 32-bit little-endian integer +/G/H/grp_nested/grp_dsets/compound Dataset {2/2} + Location: 1:84941 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: struct { + "str1" +0 20-byte null-terminated ASCII string + "str2" +20 20-byte null-terminated ASCII string + } 40 bytes +/G/H/grp_nested/grp_dsets/compressed Dataset {6/6} + Location: 1:85154 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Chunks: {2} 8 bytes + Storage:
+ Filter-0: deflate-1 OPT {1} + Type: 32-bit little-endian integer +/G/H/grp_nested/grp_dsets/named_vl Dataset {2/2} + Location: 1:85324 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: shared-1:85264 variable length of + 32-bit little-endian integer +/G/H/grp_nested/grp_dsets/nested_vl Dataset {2/2} + Location: 1:85579 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: variable length of + variable length of + 32-bit little-endian integer +/G/H/grp_nested/grp_dsets/simple Dataset {6/6} + Location: 1:84745 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: 32-bit little-endian integer +/G/H/grp_nested/grp_dsets/vl Type + Location: 1:85264 + Links: 2 + Modified: XXXX-XX-XX XX:XX:XX XXX + Type: shared-1:85264 variable length of + 32-bit little-endian integer +/chunk Dataset {6/6} + Location: 1:2238 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Chunks: {2} 8 bytes + Storage:
+ Type: 32-bit little-endian integer +/compact Dataset {6/6} + Location: 1:4240 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: 32-bit little-endian integer +/compound Dataset {2/2} + Location: 1:6391 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: struct { + "str1" +0 20-byte null-terminated ASCII string + "str2" +20 20-byte null-terminated ASCII string + } 40 bytes +/compressed Dataset {6/6} + Location: 1:6604 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Chunks: {2} 8 bytes + Storage:
+ Filter-0: deflate-1 OPT {1} + Type: 32-bit little-endian integer +/grp_dsets Group + Location: 1:27748 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX +/grp_dsets/chunk Dataset {6/6} + Location: 1:28718 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Chunks: {2} 8 bytes + Storage:
+ Type: 32-bit little-endian integer +/grp_dsets/compact Dataset {6/6} + Location: 1:28071 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: 32-bit little-endian integer +/grp_dsets/compound Dataset {2/2} + Location: 1:28174 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: struct { + "str1" +0 20-byte null-terminated ASCII string + "str2" +20 20-byte null-terminated ASCII string + } 40 bytes +/grp_dsets/compressed Dataset {6/6} + Location: 1:28387 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Chunks: {2} 8 bytes + Storage:
+ Filter-0: deflate-1 OPT {1} + Type: 32-bit little-endian integer +/grp_dsets/named_vl Dataset {2/2} + Location: 1:28557 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: shared-1:28497 variable length of + 32-bit little-endian integer +/grp_dsets/nested_vl Dataset {2/2} + Location: 1:28812 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: variable length of + variable length of + 32-bit little-endian integer +/grp_dsets/simple Dataset {6/6} + Location: 1:27978 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: 32-bit little-endian integer +/grp_dsets/simple_group Dataset {6/6} + Location: 1:46180 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: 32-bit little-endian integer +/grp_dsets/vl Type + Location: 1:28497 + Links: 2 + Modified: XXXX-XX-XX XX:XX:XX XXX + Type: shared-1:28497 variable length of + 32-bit little-endian integer +/grp_empty Group + Location: 1:27693 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX +/grp_nested Group + Location: 1:35940 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX +/grp_nested/grp_dsets Group + Location: 1:36019 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX +/grp_nested/grp_dsets/chunk Dataset {6/6} + Location: 1:36989 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Chunks: {2} 8 bytes + Storage:
+ Type: 32-bit little-endian integer +/grp_nested/grp_dsets/compact Dataset {6/6} + Location: 1:36342 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: 32-bit little-endian integer +/grp_nested/grp_dsets/compound Dataset {2/2} + Location: 1:36445 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: struct { + "str1" +0 20-byte null-terminated ASCII string + "str2" +20 20-byte null-terminated ASCII string + } 40 bytes +/grp_nested/grp_dsets/compressed Dataset {6/6} + Location: 1:36658 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Chunks: {2} 8 bytes + Storage:
+ Filter-0: deflate-1 OPT {1} + Type: 32-bit little-endian integer +/grp_nested/grp_dsets/named_vl Dataset {2/2} + Location: 1:36828 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: shared-1:36768 variable length of + 32-bit little-endian integer +/grp_nested/grp_dsets/nested_vl Dataset {2/2} + Location: 1:37083 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: variable length of + variable length of + 32-bit little-endian integer +/grp_nested/grp_dsets/simple Dataset {6/6} + Location: 1:36249 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: 32-bit little-endian integer +/grp_nested/grp_dsets/vl Type + Location: 1:36768 + Links: 2 + Modified: XXXX-XX-XX XX:XX:XX XXX + Type: shared-1:36768 variable length of + 32-bit little-endian integer +/grp_rename Group + Location: 1:47077 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX +/grp_rename/chunk Dataset {6/6} + Location: 1:48047 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Chunks: {2} 8 bytes + Storage:
+ Type: 32-bit little-endian integer +/grp_rename/compact Dataset {6/6} + Location: 1:47400 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: 32-bit little-endian integer +/grp_rename/compound Dataset {2/2} + Location: 1:47503 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: struct { + "str1" +0 20-byte null-terminated ASCII string + "str2" +20 20-byte null-terminated ASCII string + } 40 bytes +/grp_rename/compressed Dataset {6/6} + Location: 1:47716 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Chunks: {2} 8 bytes + Storage:
+ Filter-0: deflate-1 OPT {1} + Type: 32-bit little-endian integer +/grp_rename/grp_dsets Group + Location: 1:55269 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX +/grp_rename/grp_dsets/chunk Dataset {6/6} + Location: 1:56239 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Chunks: {2} 8 bytes + Storage:
+ Type: 32-bit little-endian integer +/grp_rename/grp_dsets/compact Dataset {6/6} + Location: 1:55592 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: 32-bit little-endian integer +/grp_rename/grp_dsets/compound Dataset {2/2} + Location: 1:55695 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: struct { + "str1" +0 20-byte null-terminated ASCII string + "str2" +20 20-byte null-terminated ASCII string + } 40 bytes +/grp_rename/grp_dsets/compressed Dataset {6/6} + Location: 1:55908 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Chunks: {2} 8 bytes + Storage:
+ Filter-0: deflate-1 OPT {1} + Type: 32-bit little-endian integer +/grp_rename/grp_dsets/named_vl Dataset {2/2} + Location: 1:56078 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: shared-1:56018 variable length of + 32-bit little-endian integer +/grp_rename/grp_dsets/nested_vl Dataset {2/2} + Location: 1:56333 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: variable length of + variable length of + 32-bit little-endian integer +/grp_rename/grp_dsets/simple Dataset {6/6} + Location: 1:55499 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: 32-bit little-endian integer +/grp_rename/grp_dsets/vl Type + Location: 1:56018 + Links: 2 + Modified: XXXX-XX-XX XX:XX:XX XXX + Type: shared-1:56018 variable length of + 32-bit little-endian integer +/grp_rename/named_vl Dataset {2/2} + Location: 1:47886 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: shared-1:47826 variable length of + 32-bit little-endian integer +/grp_rename/nested_vl Dataset {2/2} + Location: 1:48141 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: variable length of + variable length of + 32-bit little-endian integer +/grp_rename/simple Dataset {6/6} + Location: 1:47307 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: 32-bit little-endian integer +/grp_rename/vl Type + Location: 1:47826 + Links: 2 + Modified: XXXX-XX-XX XX:XX:XX XXX + Type: shared-1:47826 variable length of + 32-bit little-endian integer +/named_vl Dataset {2/2} + Location: 1:8657 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: shared-1:8606 variable length of + 32-bit little-endian integer +/nested_vl Dataset {2/2} + Location: 1:22942 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: variable length of + variable length of + 32-bit little-endian integer +/rename Dataset {2/2} + Location: 1:27240 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: struct { + "str1" +0 20-byte null-terminated ASCII string + "str2" +20 20-byte null-terminated ASCII string + } 40 bytes +/simple Dataset {6/6} + Location: 1:800 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: 32-bit little-endian integer +/simple_top Dataset {6/6} + Location: 1:25099 + Links: 1 + Modified: XXXX-XX-XX XX:XX:XX XXX + Storage:
+ Type: 32-bit little-endian integer diff --git a/tools/h5repack/h5repack.c b/tools/h5repack/h5repack.c index c1e63f1..286d7f0 100644 --- a/tools/h5repack/h5repack.c +++ b/tools/h5repack/h5repack.c @@ -77,14 +77,14 @@ int h5repack(const char* infile, const char* outfile, pack_opt_t *options) { * *------------------------------------------------------------------------- */ - -int h5repack_init(pack_opt_t *options, int verbose, +int h5repack_init(pack_opt_t *options, int verbose, hbool_t latest, H5F_file_space_type_t strategy, hsize_t threshold) { int k, n; HDmemset(options, 0, sizeof(pack_opt_t)); options->min_comp = 0; options->verbose = verbose; + options->latest = latest; options->layout_g = H5D_LAYOUT_ERROR; for (n = 0; n < H5_REPACK_MAX_NFILTERS; n++) { diff --git a/tools/h5repack/h5repack.h b/tools/h5repack/h5repack.h index 69e36fc..329be1f 100644 --- a/tools/h5repack/h5repack.h +++ b/tools/h5repack/h5repack.h @@ -105,7 +105,7 @@ typedef struct { int verbose; /*verbose mode */ hsize_t min_comp; /*minimum size to compress, in bytes */ int use_native; /*use a native type in write */ - int latest; /*pack file with the latest file format */ + hbool_t latest; /*pack file with the latest file format */ int grp_compact; /* Set the maximum number of links to store as header messages in the group */ int grp_indexed; /* Set the minimum number of links to store in the indexed format */ int msg_size[8]; /* Minimum size of shared messages: dataspace, @@ -138,7 +138,8 @@ extern "C" { int h5repack(const char* infile, const char* outfile, pack_opt_t *options); int h5repack_addfilter(const char* str, pack_opt_t *options); int h5repack_addlayout(const char* str, pack_opt_t *options); -int h5repack_init(pack_opt_t *options, int verbose, H5F_file_space_type_t strategy, hsize_t threshold); +int h5repack_init(pack_opt_t *options, int verbose, hbool_t latest, + H5F_file_space_type_t strategy, hsize_t threshold); int h5repack_end(pack_opt_t *options); int h5repack_verify(const char *in_fname, const char *out_fname, pack_opt_t *options); int h5repack_cmp_pl(const char *fname1, const char *fname2); diff --git a/tools/h5repack/h5repack_main.c b/tools/h5repack/h5repack_main.c index 4361efe..c03b7a7 100644 --- a/tools/h5repack/h5repack_main.c +++ b/tools/h5repack/h5repack_main.c @@ -423,19 +423,19 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) { break; case 'L': - options->latest = 1; + options->latest = TRUE; break; case 'c': options->grp_compact = HDatoi( opt_arg ); if (options->grp_compact > 0) - options->latest = 1; /* must use latest format */ + options->latest = TRUE; /* must use latest format */ break; case 'd': options->grp_indexed = HDatoi( opt_arg ); if (options->grp_indexed > 0) - options->latest = 1; /* must use latest format */ + options->latest = TRUE; /* must use latest format */ break; case 's': @@ -443,7 +443,7 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) { int idx = 0; int ssize = 0; char *msgPtr = HDstrchr( opt_arg, ':'); - options->latest = 1; /* must use latest format */ + options->latest = TRUE; /* must use latest format */ if (msgPtr == NULL) { ssize = HDatoi( opt_arg ); for (idx = 0; idx < 5; idx++) @@ -579,7 +579,7 @@ int main(int argc, const char **argv) { } /* initialize options */ - h5repack_init(&options, 0, H5F_FILE_SPACE_DEFAULT, (hsize_t) 0); + h5repack_init(&options, 0, FALSE, H5F_FILE_SPACE_DEFAULT, (hsize_t) 0); if (parse_command_line(argc, argv, &options) < 0) goto done; diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index 972014d..07ea676 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -214,7 +214,7 @@ int main (void) TESTING(" copy of datasets (fill values)"); /* fs_type = 0; fs_size = 0 */ - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack(FNAME0,FNAME0OUT,&pack_options) < 0) GOERROR; @@ -234,7 +234,7 @@ int main (void) *------------------------------------------------------------------------- */ TESTING(" copy of datasets (all datatypes)"); - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack(FNAME1,FNAME1OUT,&pack_options) < 0) GOERROR; @@ -254,7 +254,7 @@ int main (void) *------------------------------------------------------------------------- */ TESTING(" copy of datasets (attributes)"); - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack(FNAME2,FNAME2OUT,&pack_options) < 0) GOERROR; @@ -273,7 +273,7 @@ int main (void) *------------------------------------------------------------------------- */ TESTING(" copy of datasets (hardlinks)"); - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack(FNAME3,FNAME3OUT,&pack_options) < 0) GOERROR; @@ -293,7 +293,7 @@ int main (void) *------------------------------------------------------------------------- */ TESTING(" copy of allocation early file"); - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack(FNAME5,FNAME5OUT,&pack_options) < 0) GOERROR; @@ -314,7 +314,7 @@ int main (void) * deflate *------------------------------------------------------------------------- */ - TESTING(" adding deflate filter"); + TESTING(" adding deflate filter (old_format)"); #ifdef H5_HAVE_FILTER_DEFLATE @@ -323,7 +323,34 @@ int main (void) *------------------------------------------------------------------------- */ - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) + GOERROR; + if (h5repack_addfilter("dset1:GZIP=9",&pack_options) < 0) + GOERROR; + if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0) + GOERROR; + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + GOERROR; + if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + GOERROR; + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options) <= 0) + GOERROR; + if (h5repack_end (&pack_options) < 0) + GOERROR; + PASSED(); +#else + SKIPPED(); +#endif + + TESTING(" adding deflate filter (new format)"); +#ifdef H5_HAVE_FILTER_DEFLATE + /*------------------------------------------------------------------------- + * test an individual object option + * For new format, "dset1" should be using Fixed Array indexing + *------------------------------------------------------------------------- + */ + + if (h5repack_init (&pack_options, 0, TRUE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addfilter("dset1:GZIP=9",&pack_options) < 0) GOERROR; @@ -351,7 +378,7 @@ int main (void) #ifdef H5_HAVE_FILTER_DEFLATE - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addfilter("GZIP=1",&pack_options) < 0) GOERROR; @@ -389,7 +416,7 @@ int main (void) */ if (szip_can_encode) { - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addfilter("dset2:SZIP=8,EC",&pack_options) < 0) GOERROR; @@ -421,7 +448,7 @@ int main (void) #if defined (H5_HAVE_FILTER_SZIP) if (szip_can_encode) { - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addfilter("SZIP=8,NN",&pack_options) < 0) GOERROR; @@ -450,7 +477,7 @@ int main (void) *------------------------------------------------------------------------- */ - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addfilter("dset1:SHUF",&pack_options) < 0) GOERROR; @@ -475,7 +502,7 @@ int main (void) TESTING(" addding shuffle filter to all"); /* fs_type = H5F_FILE_SPACE_ALL_PERSIST; fs_size = 1 */ - if (h5repack_init (&pack_options, 0, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0) GOERROR; if (h5repack_addfilter("SHUF",&pack_options) < 0) GOERROR; @@ -500,7 +527,7 @@ int main (void) *------------------------------------------------------------------------- */ - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addfilter("dset1:FLET",&pack_options) < 0) GOERROR; @@ -525,7 +552,7 @@ int main (void) TESTING(" adding checksum filter to all"); - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addfilter("FLET",&pack_options) < 0) GOERROR; @@ -550,7 +577,7 @@ int main (void) *------------------------------------------------------------------------- */ - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addlayout("dset1:CHUNK 20x10",&pack_options) < 0) GOERROR; @@ -583,14 +610,36 @@ int main (void) PASSED(); - TESTING(" adding layout chunked"); + TESTING(" adding layout chunked (old format)"); + + /*------------------------------------------------------------------------- + * test an individual object option + *------------------------------------------------------------------------- + */ + + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) + GOERROR; + if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0) + GOERROR; + if (h5repack(FNAME4,FNAME4OUT,&pack_options) < 0) + GOERROR; + if (h5diff(FNAME4,FNAME4OUT,NULL,NULL,&diff_options) >0) + GOERROR; + if (h5repack_verify(FNAME4, FNAME4OUT, &pack_options )<= 0) + GOERROR; + if (h5repack_end (&pack_options) < 0) + GOERROR; + PASSED(); + + TESTING(" adding layout chunked (new format)"); /*------------------------------------------------------------------------- * test an individual object option + * For new format, "dset1" should be using Fixed Array indexing *------------------------------------------------------------------------- */ - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, TRUE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addlayout("dset1:CHUNK=20x10",&pack_options) < 0) GOERROR; @@ -610,7 +659,7 @@ int main (void) */ TESTING(" adding layout chunked to all"); - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addlayout("CHUNK=20x10",&pack_options) < 0) GOERROR; @@ -631,7 +680,7 @@ int main (void) * test an individual object option *------------------------------------------------------------------------- */ - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addlayout("dset1:CONTI",&pack_options) < 0) GOERROR; @@ -652,7 +701,7 @@ int main (void) * test all objects option *------------------------------------------------------------------------- */ - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addlayout("CONTI",&pack_options) < 0) GOERROR; @@ -669,7 +718,7 @@ int main (void) * do the same test for a file with filters (chunked) *------------------------------------------------------------------------- */ - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addlayout("CONTI",&pack_options) < 0) GOERROR; @@ -691,7 +740,7 @@ int main (void) *------------------------------------------------------------------------- */ - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addlayout("dset1:COMPA",&pack_options) < 0) GOERROR; @@ -713,7 +762,7 @@ int main (void) */ /* fs_type = H5F_FILE_SPACE_ALL; fs_size = 2 */ - if (h5repack_init (&pack_options, 0, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0) GOERROR; if (h5repack_addlayout("COMPA",&pack_options) < 0) GOERROR; @@ -735,7 +784,7 @@ int main (void) * layout compact to contiguous conversion *------------------------------------------------------------------------- */ - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addlayout("dset_compact:CONTI",&pack_options) < 0) GOERROR; @@ -755,7 +804,7 @@ int main (void) * layout compact to chunk conversion *------------------------------------------------------------------------- */ - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addlayout("dset_compact:CHUNK=2x5",&pack_options) < 0) GOERROR; @@ -775,7 +824,7 @@ int main (void) * layout compact to compact conversion *------------------------------------------------------------------------- */ - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addlayout("dset_compact:COMPA",&pack_options) < 0) GOERROR; @@ -794,7 +843,7 @@ int main (void) * layout contiguous to compact conversion *------------------------------------------------------------------------- */ - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addlayout("dset_contiguous:COMPA",&pack_options) < 0) GOERROR; @@ -813,7 +862,7 @@ int main (void) * layout contiguous to chunk conversion *------------------------------------------------------------------------- */ - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addlayout("dset_contiguous:CHUNK=3x6",&pack_options) < 0) GOERROR; @@ -833,7 +882,7 @@ int main (void) * layout contiguous to contiguous conversion *------------------------------------------------------------------------- */ - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addlayout("dset_contiguous:CONTI",&pack_options) < 0) GOERROR; @@ -852,7 +901,7 @@ int main (void) * layout chunked to compact conversion *------------------------------------------------------------------------- */ - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addlayout("dset_chunk:COMPA",&pack_options) < 0) GOERROR; @@ -872,7 +921,7 @@ int main (void) * layout chunked to contiguous conversion *------------------------------------------------------------------------- */ - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addlayout("dset_chunk:CONTI",&pack_options) < 0) GOERROR; @@ -891,7 +940,7 @@ int main (void) * layout chunked to chunked conversion *------------------------------------------------------------------------- */ - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addlayout("dset_chunk:CHUNK=18x13",&pack_options) < 0) GOERROR; @@ -922,7 +971,7 @@ int main (void) #if defined (H5_HAVE_FILTER_SZIP) if (szip_can_encode) { /* fs_type = H5F_FILE_SPACE_AGGR_VFD; fs_size = 3 */ - if (h5repack_init (&pack_options, 0, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0) GOERROR; if (h5repack(FNAME7,FNAME7OUT,&pack_options) < 0) GOERROR; @@ -947,7 +996,7 @@ int main (void) #if defined (H5_HAVE_FILTER_SZIP) if (szip_can_encode) { - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addfilter("dset_szip:NONE",&pack_options) < 0) GOERROR; @@ -972,7 +1021,7 @@ int main (void) TESTING(" copy of deflate filter"); #ifdef H5_HAVE_FILTER_DEFLATE - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack(FNAME8,FNAME8OUT,&pack_options) < 0) GOERROR; @@ -992,7 +1041,7 @@ int main (void) TESTING(" removing deflate filter"); #ifdef H5_HAVE_FILTER_DEFLATE - if (h5repack_init (&pack_options, 0, fs_type, ++fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, ++fs_size) < 0) GOERROR; if (h5repack_addfilter("dset_deflate:NONE",&pack_options) < 0) GOERROR; @@ -1014,7 +1063,7 @@ int main (void) TESTING(" copy of shuffle filter"); - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack(FNAME9,FNAME9OUT,&pack_options) < 0) GOERROR; @@ -1030,7 +1079,7 @@ int main (void) TESTING(" removing shuffle filter"); - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addfilter("dset_shuffle:NONE",&pack_options) < 0) GOERROR; @@ -1048,7 +1097,7 @@ int main (void) TESTING(" copy of fletcher filter"); - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack(FNAME10,FNAME10OUT,&pack_options) < 0) GOERROR; @@ -1064,7 +1113,7 @@ int main (void) TESTING(" removing fletcher filter"); - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addfilter("dset_fletcher32:NONE",&pack_options) < 0) GOERROR; @@ -1082,7 +1131,7 @@ int main (void) TESTING(" copy of nbit filter"); - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack(FNAME12,FNAME12OUT,&pack_options) < 0) GOERROR; @@ -1098,7 +1147,7 @@ int main (void) TESTING(" removing nbit filter"); - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addfilter("dset_nbit:NONE",&pack_options) < 0) GOERROR; @@ -1116,7 +1165,7 @@ int main (void) TESTING(" adding nbit filter"); - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addfilter("dset_int31:NBIT",&pack_options) < 0) GOERROR; @@ -1134,7 +1183,7 @@ int main (void) TESTING(" copy of scaleoffset filter"); - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack(FNAME13,FNAME13OUT,&pack_options) < 0) GOERROR; @@ -1150,7 +1199,7 @@ int main (void) TESTING(" removing scaleoffset filter"); - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addfilter("dset_scaleoffset:NONE",&pack_options) < 0) GOERROR; @@ -1168,7 +1217,7 @@ int main (void) TESTING(" adding scaleoffset filter"); - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addfilter("dset_none:SOFF=31,IN",&pack_options) < 0) GOERROR; @@ -1201,7 +1250,7 @@ int main (void) if (szip_can_encode) { /* fs_type = H5F_FILE_SPACE_VFD; fs_size = 4 */ - if (h5repack_init (&pack_options, 0, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, H5_INC_ENUM(H5F_file_space_type_t, fs_type), ++fs_size) < 0) GOERROR; if (h5repack_addfilter("dset_deflate:SZIP=8,NN",&pack_options) < 0) GOERROR; @@ -1227,7 +1276,7 @@ int main (void) #if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE) if (szip_can_encode) { - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addfilter("dset_szip:GZIP=1",&pack_options) < 0) GOERROR; @@ -1258,7 +1307,7 @@ int main (void) #if defined (H5_HAVE_FILTER_SZIP) && defined (H5_HAVE_FILTER_DEFLATE) - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addfilter("NONE",&pack_options) < 0) GOERROR; @@ -1282,7 +1331,7 @@ int main (void) */ TESTING(" big file"); - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack(FNAME14,FNAME14OUT,&pack_options) < 0) GOERROR; @@ -1299,7 +1348,7 @@ int main (void) *------------------------------------------------------------------------- */ TESTING(" external datasets"); - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack(FNAME15,FNAME15OUT,&pack_options) < 0) GOERROR; @@ -1316,7 +1365,7 @@ int main (void) *------------------------------------------------------------------------- */ TESTING(" file with userblock"); - if(h5repack_init(&pack_options, 0, fs_type, fs_size) < 0) + if(h5repack_init(&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if(h5repack(FNAME16, FNAME16OUT, &pack_options) < 0) GOERROR; @@ -1335,7 +1384,7 @@ int main (void) *------------------------------------------------------------------------- */ TESTING(" latest file format options"); - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; pack_options.latest=1; pack_options.grp_compact=10; @@ -1365,7 +1414,7 @@ int main (void) #if defined (H5_HAVE_FILTER_DEFLATE) - if (h5repack_init (&pack_options, 0, fs_type, fs_size) < 0) + if (h5repack_init (&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if (h5repack_addfilter("GZIP=1",&pack_options) < 0) GOERROR; @@ -1394,7 +1443,7 @@ int main (void) #ifdef H5_HAVE_FILTER_DEFLATE - if(h5repack_init(&pack_options, 0, fs_type, fs_size) < 0) + if(h5repack_init(&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; /* add the options for a user block size and user block filename */ @@ -1427,7 +1476,7 @@ int main (void) #ifdef H5_HAVE_FILTER_DEFLATE - if(h5repack_init(&pack_options, 0, fs_type, fs_size) < 0) + if(h5repack_init(&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; /* add the options for aligment */ @@ -1481,7 +1530,7 @@ int main (void) */ TESTING(" file with committed datatypes"); - if(h5repack_init(&pack_options, 0, fs_type, fs_size) < 0) + if(h5repack_init(&pack_options, 0, FALSE, fs_type, fs_size) < 0) GOERROR; if(h5repack(FNAME17, FNAME17OUT, &pack_options) < 0) @@ -1508,7 +1557,7 @@ int main (void) /* First run without metadata option. No need to verify the correctness */ /* since this has been verified by earlier tests. Just record the file */ /* size of the output file. */ - if(h5repack_init(&pack_options, 0, H5F_FILE_SPACE_DEFAULT, (hsize_t)0) < 0) + if(h5repack_init(&pack_options, 0, FALSE, H5F_FILE_SPACE_DEFAULT, (hsize_t)0) < 0) GOERROR; if(h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) GOERROR; @@ -1519,7 +1568,7 @@ int main (void) GOERROR; /* run it again with metadata option */ - if(h5repack_init(&pack_options, 0, H5F_FILE_SPACE_DEFAULT, (hsize_t)0) < 0) + if(h5repack_init(&pack_options, 0, FALSE, H5F_FILE_SPACE_DEFAULT, (hsize_t)0) < 0) GOERROR; pack_options.meta_block_size = 8192; if(h5repack(FNAME4, FNAME4OUT, &pack_options) < 0) diff --git a/tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl b/tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl index 80b8a19..75f54fa 100644 --- a/tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl +++ b/tools/h5repack/testfiles/deflate_limit.h5repack_layout.h5.ddl @@ -74,7 +74,7 @@ GROUP "/" { } DATASET "dset_chunk" { DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, H5S_UNLIMITED ) } + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } STORAGE_LAYOUT { CHUNKED ( 20, 10 ) SIZE 1283 (2.494:1 COMPRESSION) diff --git a/tools/h5repack/testfiles/h5repack_attr.h5 b/tools/h5repack/testfiles/h5repack_attr.h5 index fe066db..80df0be 100644 Binary files a/tools/h5repack/testfiles/h5repack_attr.h5 and b/tools/h5repack/testfiles/h5repack_attr.h5 differ diff --git a/tools/h5repack/testfiles/h5repack_attr_refs.h5 b/tools/h5repack/testfiles/h5repack_attr_refs.h5 index 56974a3..1b0ca34 100644 Binary files a/tools/h5repack/testfiles/h5repack_attr_refs.h5 and b/tools/h5repack/testfiles/h5repack_attr_refs.h5 differ diff --git a/tools/h5repack/testfiles/h5repack_deflate.h5 b/tools/h5repack/testfiles/h5repack_deflate.h5 index 3a4b86d..4988491 100644 Binary files a/tools/h5repack/testfiles/h5repack_deflate.h5 and b/tools/h5repack/testfiles/h5repack_deflate.h5 differ diff --git a/tools/h5repack/testfiles/h5repack_early.h5 b/tools/h5repack/testfiles/h5repack_early.h5 index 9b92890..d9a7ece 100644 Binary files a/tools/h5repack/testfiles/h5repack_early.h5 and b/tools/h5repack/testfiles/h5repack_early.h5 differ diff --git a/tools/h5repack/testfiles/h5repack_ext.h5 b/tools/h5repack/testfiles/h5repack_ext.h5 index 1fe88c9..8518b5b 100644 Binary files a/tools/h5repack/testfiles/h5repack_ext.h5 and b/tools/h5repack/testfiles/h5repack_ext.h5 differ diff --git a/tools/h5repack/testfiles/h5repack_fill.h5 b/tools/h5repack/testfiles/h5repack_fill.h5 index 21516cb..ac40089 100644 Binary files a/tools/h5repack/testfiles/h5repack_fill.h5 and b/tools/h5repack/testfiles/h5repack_fill.h5 differ diff --git a/tools/h5repack/testfiles/h5repack_filters.h5 b/tools/h5repack/testfiles/h5repack_filters.h5 index 042b8db..eabade8 100644 Binary files a/tools/h5repack/testfiles/h5repack_filters.h5 and b/tools/h5repack/testfiles/h5repack_filters.h5 differ diff --git a/tools/h5repack/testfiles/h5repack_fletcher.h5 b/tools/h5repack/testfiles/h5repack_fletcher.h5 index 2f137b0..16ca4ef 100644 Binary files a/tools/h5repack/testfiles/h5repack_fletcher.h5 and b/tools/h5repack/testfiles/h5repack_fletcher.h5 differ diff --git a/tools/h5repack/testfiles/h5repack_hlink.h5 b/tools/h5repack/testfiles/h5repack_hlink.h5 index 3d22728..80c0fcc 100644 Binary files a/tools/h5repack/testfiles/h5repack_hlink.h5 and b/tools/h5repack/testfiles/h5repack_hlink.h5 differ diff --git a/tools/h5repack/testfiles/h5repack_layout.h5 b/tools/h5repack/testfiles/h5repack_layout.h5 index 2cc44b1..4e53766 100644 Binary files a/tools/h5repack/testfiles/h5repack_layout.h5 and b/tools/h5repack/testfiles/h5repack_layout.h5 differ diff --git a/tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl b/tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl index 87b133d..a8b4562 100644 --- a/tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl +++ b/tools/h5repack/testfiles/h5repack_layout.h5-plugin_test.ddl @@ -90,7 +90,7 @@ GROUP "/" { } DATASET "dset_chunk" { DATATYPE H5T_STD_I32LE - DATASPACE SIMPLE { ( 40, 20 ) / ( 40, H5S_UNLIMITED ) } + DATASPACE SIMPLE { ( 40, 20 ) / ( 40, 20 ) } STORAGE_LAYOUT { CHUNKED ( 20, 10 ) SIZE 3200 (1.000:1 COMPRESSION) diff --git a/tools/h5repack/testfiles/h5repack_layout2.h5 b/tools/h5repack/testfiles/h5repack_layout2.h5 index 6e77e41..f6821e5 100644 Binary files a/tools/h5repack/testfiles/h5repack_layout2.h5 and b/tools/h5repack/testfiles/h5repack_layout2.h5 differ diff --git a/tools/h5repack/testfiles/h5repack_layout3.h5 b/tools/h5repack/testfiles/h5repack_layout3.h5 index 7351502..6d2de41 100644 Binary files a/tools/h5repack/testfiles/h5repack_layout3.h5 and b/tools/h5repack/testfiles/h5repack_layout3.h5 differ diff --git a/tools/h5repack/testfiles/h5repack_named_dtypes.h5 b/tools/h5repack/testfiles/h5repack_named_dtypes.h5 index 108bb9f..85c1352 100644 Binary files a/tools/h5repack/testfiles/h5repack_named_dtypes.h5 and b/tools/h5repack/testfiles/h5repack_named_dtypes.h5 differ diff --git a/tools/h5repack/testfiles/h5repack_nbit.h5 b/tools/h5repack/testfiles/h5repack_nbit.h5 index 3ada112..ac71bee 100644 Binary files a/tools/h5repack/testfiles/h5repack_nbit.h5 and b/tools/h5repack/testfiles/h5repack_nbit.h5 differ diff --git a/tools/h5repack/testfiles/h5repack_objs.h5 b/tools/h5repack/testfiles/h5repack_objs.h5 index 16d55da..284b0ac 100644 Binary files a/tools/h5repack/testfiles/h5repack_objs.h5 and b/tools/h5repack/testfiles/h5repack_objs.h5 differ diff --git a/tools/h5repack/testfiles/h5repack_refs.h5 b/tools/h5repack/testfiles/h5repack_refs.h5 index 525267f..2a1ec9b 100644 Binary files a/tools/h5repack/testfiles/h5repack_refs.h5 and b/tools/h5repack/testfiles/h5repack_refs.h5 differ diff --git a/tools/h5repack/testfiles/h5repack_shuffle.h5 b/tools/h5repack/testfiles/h5repack_shuffle.h5 index d13cca7..c14e2cb 100644 Binary files a/tools/h5repack/testfiles/h5repack_shuffle.h5 and b/tools/h5repack/testfiles/h5repack_shuffle.h5 differ diff --git a/tools/h5repack/testfiles/h5repack_soffset.h5 b/tools/h5repack/testfiles/h5repack_soffset.h5 index 89ee99a..2acd867 100644 Binary files a/tools/h5repack/testfiles/h5repack_soffset.h5 and b/tools/h5repack/testfiles/h5repack_soffset.h5 differ -- cgit v0.12 From 32f21214bb0215e77c4819be9462e254c4532b85 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 23 Mar 2016 19:38:03 -0500 Subject: [svn-r29545] Minor normalization w/ trunk in preparation for big merge. Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 autotools serial autotools parallel (MPICH 3.1.4) --- test/CMakeLists.txt | 2 +- test/ohdr.c | 299 +++++++++++++-------------- test/set_extent.c | 366 +++++++++------------------------ test/tarray.c | 576 ++++++++++++++++++++++++++++++---------------------- test/tfile.c | 6 +- testpar/t_file.c | 13 +- 6 files changed, 582 insertions(+), 680 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8793fa8..338b906 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -74,7 +74,7 @@ endif (BUILD_SHARED_LIBS) file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/testdir2") #----------------------------------------------------------------------------- - # Define Test Library Sources + # Define Plugin Test Sources #----------------------------------------------------------------------------- set (TEST_PLUGIN_LIBS dynlib1 diff --git a/test/ohdr.c b/test/ohdr.c index 3b11539..8dbe05e 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -72,13 +72,15 @@ test_cont(char *filename, hid_t fapl) HDmemset(&oh_locB, 0, sizeof(oh_locB)); /* Create the file to operate on */ - if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR - if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR + if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + FAIL_STACK_ERROR + if(NULL == (f = (H5F_t *)H5I_object(file))) + FAIL_STACK_ERROR if (H5AC_ignore_tags(f) < 0) { - H5_FAILED(); - H5Eprint2(H5E_DEFAULT, stdout); - goto error; - } + H5_FAILED(); + H5Eprint2(H5E_DEFAULT, stdout); + goto error; + } /* end if */ if(H5O_create(f, H5AC_ind_read_dxpl_id, (size_t)H5O_MIN_SIZE, (size_t)0, H5P_GROUP_CREATE_DEFAULT, &oh_locA/*out*/) < 0) FAIL_STACK_ERROR @@ -89,58 +91,58 @@ test_cont(char *filename, hid_t fapl) time_new = 11111111; if(H5O_msg_create(&oh_locA, H5O_NAME_ID, 0, 0, &long_name, H5AC_ind_read_dxpl_id) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5AC_ind_read_dxpl_id) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5AC_ind_read_dxpl_id) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5AC_ind_read_dxpl_id) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5O_msg_create(&oh_locA, H5O_MTIME_NEW_ID, 0, 0, &time_new, H5AC_ind_read_dxpl_id) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5O_msg_create(&oh_locB, H5O_MTIME_ID, 0, 0, &time_new, H5AC_ind_read_dxpl_id) < 0) FAIL_STACK_ERROR if(H5O_msg_create(&oh_locA, H5O_NAME_ID, 0, 0, &short_name, H5AC_ind_read_dxpl_id) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(1 != H5O_link(&oh_locA, 1, H5AC_ind_read_dxpl_id)) FAIL_STACK_ERROR if(1 != H5O_link(&oh_locB, 1, H5AC_ind_read_dxpl_id)) FAIL_STACK_ERROR if(H5AC_flush(f, H5AC_ind_read_dxpl_id) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5O_expunge_chunks_test(&oh_locA, H5AC_ind_read_dxpl_id) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5O_get_hdr_info(&oh_locA, H5AC_ind_read_dxpl_id, &hdr_info) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR nchunks = hdr_info.nchunks; /* remove the 1st H5O_NAME_ID message */ if(H5O_msg_remove(&oh_locA, H5O_NAME_ID, 0, FALSE, H5AC_ind_read_dxpl_id) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5O_get_hdr_info(&oh_locA, H5AC_ind_read_dxpl_id, &hdr_info) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(hdr_info.nchunks >= nchunks) - TEST_ERROR + TEST_ERROR if(H5O_close(&oh_locA) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5O_close(&oh_locB) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Fclose(file) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { @@ -149,8 +151,8 @@ error: H5Fclose(file); } H5E_END_TRY; - return -1; -} /* test_cont() */ + return FAIL; +} /* end test_cont() */ /* * Verify that object headers are held in the cache until they are linked @@ -199,7 +201,7 @@ test_ohdr_cache(char *filename, hid_t fapl) if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) FAIL_STACK_ERROR if(H5Pclose(my_fapl) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR if(H5AC_ignore_tags(f) < 0) @@ -279,20 +281,20 @@ test_ohdr_cache(char *filename, hid_t fapl) FAIL_STACK_ERROR if(H5Pclose(my_dxpl) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR if(H5Fclose(file) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Fclose(file); } H5E_END_TRY; - return -1; + return FAIL; } /* test_ohdr_cache() */ /* @@ -326,34 +328,34 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl) /* Open filename */ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) - TEST_ERROR + FAIL_STACK_ERROR /* Open FILE_BOGUS */ if((fid_bogus = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) - TEST_ERROR + FAIL_STACK_ERROR /* Set up location ID depending on bogus_id */ if(bogus_id == H5O_BOGUS_INVALID_ID) { - /* Open "group" in FILE_BOGUS */ - if((gid_bogus = H5Gopen2(fid_bogus, "group", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - loc_bogus = gid_bogus; + /* Open "group" in FILE_BOGUS */ + if((gid_bogus = H5Gopen2(fid_bogus, "group", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + loc_bogus = gid_bogus; - /* Create "group" in filename */ - if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - loc = gid; + /* Create "group" in filename */ + if((gid = H5Gcreate2(fid, "group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + loc = gid; } else { /* H5O_BOGUS_VALID_ID */ - loc_bogus = fid_bogus; - loc = fid; - } + loc_bogus = fid_bogus; + loc = fid; + } /* end else */ /* Open the dataset with the unknown header message, but no extra flags */ if((did = H5Dopen2(loc_bogus, "Dataset1", H5P_DEFAULT)) < 0) - TEST_ERROR + FAIL_STACK_ERROR if(H5Dclose(did) < 0) - TEST_ERROR + FAIL_STACK_ERROR PASSED(); @@ -361,9 +363,9 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl) /* Open the dataset with the unknown header message, and "fail if unknown and open for write" flag */ if((did = H5Dopen2(loc_bogus, "Dataset2", H5P_DEFAULT)) < 0) - TEST_ERROR + FAIL_STACK_ERROR if(H5Dclose(did) < 0) - TEST_ERROR + FAIL_STACK_ERROR PASSED(); @@ -371,11 +373,11 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl) /* Attempt to open the dataset with the unknown header message, and "fail if unknown always" flag */ H5E_BEGIN_TRY { - did = H5Dopen2(loc_bogus, "Dataset3", H5P_DEFAULT); + did = H5Dopen2(loc_bogus, "Dataset3", H5P_DEFAULT); } H5E_END_TRY; if(did >= 0) { - H5Dclose(did); - TEST_ERROR + H5Dclose(did); + TEST_ERROR } /* end if */ PASSED(); @@ -384,163 +386,158 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl) /* Copy object with "mark if unknown" flag on message into file (FILENAME[0]) that can be modified */ if(H5Ocopy(loc_bogus, "Dataset4", loc, "Dataset4", H5P_DEFAULT, H5P_DEFAULT) < 0) - TEST_ERROR + FAIL_STACK_ERROR /* Closing: filename */ - if(bogus_id == H5O_BOGUS_INVALID_ID) { - if(H5Gclose(gid) < 0) - FAIL_STACK_ERROR - } + if(bogus_id == H5O_BOGUS_INVALID_ID) + if(H5Gclose(gid) < 0) + FAIL_STACK_ERROR if(H5Fclose(fid) < 0) - TEST_ERROR + FAIL_STACK_ERROR /* Re-open filename, with read-only permissions */ if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) - TEST_ERROR + FAIL_STACK_ERROR /* Set up location ID depending on bogus_id */ if(bogus_id == H5O_BOGUS_INVALID_ID) { - /* Open "group" in filename */ - if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - loc = gid; + /* Open "group" in filename */ + if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + loc = gid; } else - loc = fid; + loc = fid; /* Open the dataset with the "mark if unknown" message */ if((did = H5Dopen2(loc, "Dataset4", H5P_DEFAULT)) < 0) - TEST_ERROR + FAIL_STACK_ERROR /* Check that the "unknown" message was _NOT_ marked */ if(H5O_check_msg_marked_test(did, FALSE) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Close the dataset */ if(H5Dclose(did) < 0) - TEST_ERROR + FAIL_STACK_ERROR /* Close "group" in filename depending on bogus_id */ - if(bogus_id == H5O_BOGUS_INVALID_ID) { - if(H5Gclose(gid) < 0) - FAIL_STACK_ERROR - } + if(bogus_id == H5O_BOGUS_INVALID_ID) + if(H5Gclose(gid) < 0) + FAIL_STACK_ERROR /* Close filename (to flush change to object header) */ if(H5Fclose(fid) < 0) - TEST_ERROR + FAIL_STACK_ERROR /* Re-open filename */ if((fid = H5Fopen(filename, H5F_ACC_RDWR, fapl)) < 0) - TEST_ERROR + FAIL_STACK_ERROR /* Set up location ID depending on bogus_id */ if(bogus_id == H5O_BOGUS_INVALID_ID) { - /* Open "group" in filename */ - if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - loc = gid; + /* Open "group" in filename */ + if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + loc = gid; } else - loc = fid; + loc = fid; /* Open the dataset with the "mark if unknown" message */ if((did = H5Dopen2(loc, "Dataset4", H5P_DEFAULT)) < 0) - TEST_ERROR + FAIL_STACK_ERROR /* Create data space */ if((sid = H5Screate(H5S_SCALAR)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Create an attribute, to get the object header into write access */ if((aid = H5Acreate2(did, "Attr", H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Close dataspace */ if(H5Sclose(sid) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Close attribute */ if(H5Aclose(aid) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Close the dataset */ if(H5Dclose(did) < 0) - TEST_ERROR + FAIL_STACK_ERROR /* Close "group" in filename depending on bogus_id */ - if(bogus_id == H5O_BOGUS_INVALID_ID) { - if(H5Gclose(gid) < 0) - FAIL_STACK_ERROR - } + if(bogus_id == H5O_BOGUS_INVALID_ID) + if(H5Gclose(gid) < 0) + FAIL_STACK_ERROR /* Close filename (to flush change to object header) */ if(H5Fclose(fid) < 0) - TEST_ERROR + FAIL_STACK_ERROR /* Re-open filename */ if((fid = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) - TEST_ERROR + FAIL_STACK_ERROR /* Set up location ID depending on bogus_id */ if(bogus_id == H5O_BOGUS_INVALID_ID) { - /* Open "group" in filename */ - if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - loc = gid; + /* Open "group" in filename */ + if((gid = H5Gopen2(fid, "group", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + loc = gid; } else - loc = fid; + loc = fid; /* Re-open the dataset with the "mark if unknown" message */ if((did = H5Dopen2(loc, "Dataset4", H5P_DEFAULT)) < 0) - TEST_ERROR + FAIL_STACK_ERROR /* Check that the "unknown" message was marked */ if(H5O_check_msg_marked_test(did, TRUE) < 0) - FAIL_STACK_ERROR + FAIL_STACK_ERROR /* Close the dataset */ if(H5Dclose(did) < 0) - TEST_ERROR + FAIL_STACK_ERROR /* Closing: filename */ - if(bogus_id == H5O_BOGUS_INVALID_ID) { - if(H5Gclose(gid) < 0) - TEST_ERROR - } + if(bogus_id == H5O_BOGUS_INVALID_ID) + if(H5Gclose(gid) < 0) + FAIL_STACK_ERROR if(H5Fclose(fid) < 0) - TEST_ERROR + FAIL_STACK_ERROR PASSED(); /* Closing: FILE_BOGUS */ - if(bogus_id == H5O_BOGUS_INVALID_ID) { - if(H5Gclose(gid_bogus) < 0) - TEST_ERROR - } + if(bogus_id == H5O_BOGUS_INVALID_ID) + if(H5Gclose(gid_bogus) < 0) + FAIL_STACK_ERROR if(H5Fclose(fid_bogus) < 0) - TEST_ERROR + FAIL_STACK_ERROR TESTING("object in r/w file with unknown header message & 'fail if unknown and open for write' flag set"); /* Open FILE_BOGUS with RW intent this time */ if((fid_bogus = H5Fopen(testfile, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) - TEST_ERROR + FAIL_STACK_ERROR /* Set up location ID */ if(bogus_id == H5O_BOGUS_INVALID_ID) { - /* Open "group" in FILE_BOGUS */ - if((gid_bogus = H5Gopen2(fid_bogus, "group", H5P_DEFAULT)) < 0) - FAIL_STACK_ERROR - loc_bogus = gid_bogus; + /* Open "group" in FILE_BOGUS */ + if((gid_bogus = H5Gopen2(fid_bogus, "group", H5P_DEFAULT)) < 0) + FAIL_STACK_ERROR + loc_bogus = gid_bogus; } else - loc_bogus = fid_bogus; + loc_bogus = fid_bogus; /* Attempt to open the dataset with the unknown header message, and "fail if unknown and open for write" flag */ H5E_BEGIN_TRY { - did = H5Dopen2(loc_bogus, "Dataset2", H5P_DEFAULT); + did = H5Dopen2(loc_bogus, "Dataset2", H5P_DEFAULT); } H5E_END_TRY; if(did >= 0) { - H5Dclose(did); - TEST_ERROR + H5Dclose(did); + TEST_ERROR } /* end if */ PASSED(); @@ -549,38 +546,36 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl) /* Attempt to open the dataset with the unknown header message, and "fail if unknown always" flag */ H5E_BEGIN_TRY { - did = H5Dopen2(loc_bogus, "Dataset3", H5P_DEFAULT); + did = H5Dopen2(loc_bogus, "Dataset3", H5P_DEFAULT); } H5E_END_TRY; if(did >= 0) { - H5Dclose(did); + H5Dclose(did); TEST_ERROR } /* end if */ /* Closing: FILE_BOGUS */ - if(bogus_id == H5O_BOGUS_INVALID_ID) { - if(H5Gclose(gid_bogus) < 0) - TEST_ERROR - } + if(bogus_id == H5O_BOGUS_INVALID_ID) + if(H5Gclose(gid_bogus) < 0) + FAIL_STACK_ERROR if(H5Fclose(fid_bogus) < 0) - TEST_ERROR - + FAIL_STACK_ERROR PASSED(); - return 0; + return SUCCEED; error: H5E_BEGIN_TRY { H5Fclose(fid); - H5Gclose(gid); + H5Gclose(gid); H5Fclose(fid_bogus); - H5Gclose(gid_bogus); - H5Dclose(did); - H5Sclose(sid); - H5Aclose(aid); + H5Gclose(gid_bogus); + H5Dclose(did); + H5Sclose(sid); + H5Aclose(aid); } H5E_END_TRY; - return -1; + return FAIL; } /* test_unknown() */ @@ -629,21 +624,20 @@ main(void) if(H5Pset_libver_bounds(fapl, (b ? H5F_LIBVER_LATEST : H5F_LIBVER_EARLIEST), H5F_LIBVER_LATEST) < 0) FAIL_STACK_ERROR - /* test on object continuation block */ - if(test_cont(filename, fapl) < 0) - FAIL_STACK_ERROR + /* test on object continuation block */ + if(test_cont(filename, fapl) < 0) + TEST_ERROR /* Create the file to operate on */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) - TEST_ERROR + FAIL_STACK_ERROR if(NULL == (f = (H5F_t *)H5I_object(file))) FAIL_STACK_ERROR - if (H5AC_ignore_tags(f) < 0) { - H5_FAILED(); - H5Eprint2(H5E_DEFAULT, stdout); - goto error; - } - + if(H5AC_ignore_tags(f) < 0) { + H5_FAILED(); + H5Eprint2(H5E_DEFAULT, stdout); + goto error; + } /* end if */ /* * Test object header creation @@ -655,7 +649,6 @@ main(void) FAIL_STACK_ERROR PASSED(); - /* create a new message */ TESTING("message creation"); time_new = 11111111; @@ -673,7 +666,6 @@ main(void) TEST_ERROR PASSED(); - /* * Test modification of an existing message. */ @@ -959,27 +951,22 @@ main(void) /* Test reading datasets with undefined object header messages * and the various "fail/mark if unknown" object header message flags */ - HDputs("Accessing objects with unknown header messages: H5O_BOGUS_VALID_ID"); - { - if(test_unknown(H5O_BOGUS_VALID_ID, filename, fapl) < 0) - TEST_ERROR - } - + HDputs("Accessing objects with unknown header messages: H5O_BOGUS_VALID_ID"); + if(test_unknown(H5O_BOGUS_VALID_ID, filename, fapl) < 0) + TEST_ERROR HDputs("Accessing objects with unknown header messages: H5O_BOGUS_INVALID_ID"); - { - if(test_unknown(H5O_BOGUS_INVALID_ID, filename, fapl) < 0) - TEST_ERROR - } - - /* Test object header creation metadata cache issues */ - if(test_ohdr_cache(filename, fapl) < 0) - TEST_ERROR + if(test_unknown(H5O_BOGUS_INVALID_ID, filename, fapl) < 0) + TEST_ERROR + + /* Test object header creation metadata cache issues */ + if(test_ohdr_cache(filename, fapl) < 0) + TEST_ERROR } /* end for */ /* Verify symbol table messages are cached */ if(h5_verify_cached_stabs(FILENAME, fapl) < 0) TEST_ERROR - puts("All object header tests passed."); + HDputs("All object header tests passed."); h5_cleanup(FILENAME, fapl); return 0; diff --git a/test/set_extent.c b/test/set_extent.c index ae83ba2..acfdc5b 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -20,9 +20,6 @@ * Purpose: Tests the H5Dset_extent call */ -#include -#include -#include "hdf5.h" #include "h5test.h" /*------------------------------------------------------------------------- @@ -401,468 +398,299 @@ static int test_rank1( hid_t fapl, int comp_value; char filename[NAME_BUF_SIZE]; - if ( do_fill_value ) - { + if(do_fill_value) comp_value = FILL_VALUE; - } else - { comp_value = 0; - } - - - for( i = 0; i < DIM0; i++ ) - { + for(i = 0; i < DIM0; i++ ) buf_o[i] = 2; - } /* create a file creation property list */ - if ((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) - { + if((fcpl = H5Pcreate(H5P_FILE_CREATE)) < 0) TEST_ERROR - } - if ( set_istore_k ) - { - /* set non-default indexed storage B-tree internal 'K' value */ - if (H5Pset_istore_k(fcpl,ISTORE_IK) < 0) - { + /* set non-default indexed storage B-tree internal 'K' value */ + if(set_istore_k) + if(H5Pset_istore_k(fcpl,ISTORE_IK) < 0) TEST_ERROR - } - } /* create a new file */ h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) - { + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) TEST_ERROR - } /* close property list */ if(H5Pclose(fcpl) < 0) - { TEST_ERROR - } /* create the data space with unlimited dimensions. */ - if ((sid = H5Screate_simple(RANK1, dims_o, maxdims)) < 0) - { + if((sid = H5Screate_simple(RANK1, dims_o, maxdims)) < 0) TEST_ERROR - } /* modify dataset creation properties, i.e. enable chunking. */ - if ((my_dcpl = H5Pcopy (dcpl)) < 0) - { + if((my_dcpl = H5Pcopy (dcpl)) < 0) TEST_ERROR - } - if (H5Pset_chunk(my_dcpl, RANK1, dims_c) < 0) - { + if(H5Pset_chunk(my_dcpl, RANK1, dims_c) < 0) TEST_ERROR - } /*------------------------------------------------------------------------- - * create, write dataset - *------------------------------------------------------------------------- - */ + * create, write dataset + *------------------------------------------------------------------------- + */ /* create a dataset */ - if ((did = H5Dcreate2(fid , "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0) - { + if((did = H5Dcreate2(fid , "dset1", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0) TEST_ERROR - } /* write */ - if (H5Dwrite(did , H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0) - { + if(H5Dwrite(did , H5T_NATIVE_INT, sid, H5S_ALL, H5P_DEFAULT, buf_o) < 0) TEST_ERROR - } - #if defined (H5_SET_EXTENT_DEBUG) - printf("\n"); + printf("\n buf_o: "); for (i = 0; i < (int)dims_o[0]; i++ ) - { - printf("%d ", buf_o[i]); - - } printf("\n"); #endif - - - if (H5Sclose(sid) < 0) - { + if(H5Sclose(sid) < 0) TEST_ERROR - } /*------------------------------------------------------------------------- - * set new dimensions for the array; expand it - *------------------------------------------------------------------------- - */ + * set new dimensions for the array; expand it + *------------------------------------------------------------------------- + */ /* set new dimensions for the array. */ - if (H5Dset_extent(did , dims_e) < 0) - { + if(H5Dset_extent(did , dims_e) < 0) TEST_ERROR - } /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + if((sid = H5Dget_space(did)) < 0) TEST_ERROR - } /* get dimensions */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if(H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) TEST_ERROR - } - if (H5Sclose(sid) < 0) - { + if(H5Sclose(sid) < 0) TEST_ERROR - } - /* check dimensions */ for( i = 0; i < RANK1; i++ ) - { if (dims_r[i] != dims_e[i]) TEST_ERROR - } /* read */ if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_e) < 0) TEST_ERROR - #if defined (H5_SET_EXTENT_DEBUG) - printf("\n"); + printf("\n buf_e: "); for (i = 0; i < (int)dims_r[0]; i++ ) - { - printf("%d ", buf_e[i]); - - } printf("\n"); #endif - - - /* compare the read array with the expanded array */ for (i = 0; i < (int)dims_r[0]; i++ ) - { - - if ( i >= DIM0 ) - { - if(buf_e[i] != comp_value) - { + if(i >= DIM0) { + if(buf_e[i] != comp_value) { printf("buf_e[%d] = %d\n", i, buf_e[i]); - printf("value = %d\n", comp_value); + printf("expected = %d\n", comp_value); TEST_ERROR - } - } - else - { + } /* end if */ + } /* end if */ + else { if(buf_e[i] != buf_o[i]) TEST_ERROR - } - } - + } /* end else */ /*------------------------------------------------------------------------- - * shrink - * - *------------------------------------------------------------------------- - */ + * shrink + *------------------------------------------------------------------------- + */ /* set new dimensions for the array. */ - if (H5Dset_extent(did , dims_s) < 0) - { + if(H5Dset_extent(did , dims_s) < 0) TEST_ERROR - } /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + if((sid = H5Dget_space(did)) < 0) TEST_ERROR - } /* get dimensions */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if(H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) TEST_ERROR - } - if (H5Sclose(sid) < 0) - { + if(H5Sclose(sid) < 0) TEST_ERROR - } /* check dimensions */ for( i = 0; i < RANK1; i++ ) - { if (dims_r[i] != dims_s[i]) TEST_ERROR - } - - /* for this case we close and reopen file */ - if ( set_istore_k ) - { - - if (H5Dclose(did) < 0) - { + if(set_istore_k) { + if(H5Dclose(did) < 0) TEST_ERROR - } - if (H5Fclose(fid) < 0) - { + if(H5Fclose(fid) < 0) TEST_ERROR - } - if ((fid = H5Fopen( filename, H5F_ACC_RDWR, fapl ))<0) - { + if((fid = H5Fopen( filename, H5F_ACC_RDWR, fapl ))<0) TEST_ERROR - } - if ((did = H5Dopen2( fid , "dset1", H5P_DEFAULT ))<0) - { + if((did = H5Dopen2( fid , "dset1", H5P_DEFAULT ))<0) TEST_ERROR - } - - - - } + } /* end if */ /*------------------------------------------------------------------------- - * read - *------------------------------------------------------------------------- - */ + * read + *------------------------------------------------------------------------- + */ /* read */ - if (H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s ) < 0) - { + if(H5Dread( did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_s ) < 0) TEST_ERROR - } #if defined (H5_SET_EXTENT_DEBUG) - printf("\n"); + printf("\n dims_r: "); for (i = 0; i < (int)dims_r[0]; i++ ) - { - printf("%d ", buf_s[i]); - } printf("\n"); - #endif - - - /* compare the read array with the shrinked array */ for( i = 0; i < (int)dims_r[0]; i++ ) - { - - if ( buf_s[i] != buf_o[i] ) - { + if(buf_s[i] != buf_o[i]) { printf("buf_s[%d] = %d\n", i, buf_s[i]); printf("buf_o[%d] = %d\n", i, buf_o[i]); TEST_ERROR - } - } - + } /* end if */ /*------------------------------------------------------------------------- - * expand it back to original size - *------------------------------------------------------------------------- - */ + * expand it back to original size + *------------------------------------------------------------------------- + */ /* set new dimensions for the array */ - if (H5Dset_extent(did, dims_o) < 0) - { + if(H5Dset_extent(did, dims_o) < 0) TEST_ERROR - } /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + if((sid = H5Dget_space(did)) < 0) TEST_ERROR - } /* get dimensions. */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if(H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) TEST_ERROR - } - if (H5Sclose(sid) < 0) - { + if(H5Sclose(sid) < 0) TEST_ERROR - } - /* check dimensions */ for( i = 0; i < RANK1; i++ ) - { if (dims_r[i] != dims_o[i]) TEST_ERROR - } - /* read */ - if (H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0) + if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf_r) < 0) TEST_ERROR #if defined (H5_SET_EXTENT_DEBUG) - printf("\n"); + printf("\n dims_r: "); for (i = 0; i < (int)dims_r[0]; i++ ) - { - printf("%d ", buf_r[i]); - - } printf("\n"); #endif - - /* compare the read array with the original array */ - for (i = 0; i < (int)dims_r[0]; i++ ) - { - - if (i >= DIMS0 ) - { - if(buf_r[i] != comp_value) - { + for(i = 0; i < (int)dims_r[0]; i++ ) + if(i >= DIMS0 ) { + if(buf_r[i] != comp_value) { printf("buf_r[%d] = %d\n", i, buf_r[i] ); - printf("value = %d\n", comp_value); + printf("expected = %d\n", comp_value); TEST_ERROR - } - } - else - { + } /* end if */ + } /* end if */ + else { if(buf_r[i] != buf_o[i]) TEST_ERROR - } - } + } /* end else */ /*------------------------------------------------------------------------- - * shrink to 0 - * - *------------------------------------------------------------------------- - */ + * shrink to 0 + *------------------------------------------------------------------------- + */ dims_s[0] = 0; /* set new dimensions for the array. */ - if (H5Dset_extent(did , dims_s) < 0) - { + if(H5Dset_extent(did , dims_s) < 0) TEST_ERROR - } /* get the space */ - if ((sid = H5Dget_space(did)) < 0) - { + if((sid = H5Dget_space(did)) < 0) TEST_ERROR - } /* get dimensions */ - if (H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) - { + if(H5Sget_simple_extent_dims(sid, dims_r, NULL) < 0) TEST_ERROR - } - - if (H5Sclose(sid) < 0) - { + if(H5Sclose(sid) < 0) TEST_ERROR - } /* check dimensions */ for( i = 0; i < RANK1; i++ ) - { - if (dims_r[i] != dims_s[i]) + if(dims_r[i] != dims_s[i]) TEST_ERROR - } /*------------------------------------------------------------------------- - * close dataset - *------------------------------------------------------------------------- - */ + * close dataset + *------------------------------------------------------------------------- + */ - if (H5Dclose(did) < 0) - { + if(H5Dclose(did) < 0) TEST_ERROR - } - + /*------------------------------------------------------------------------- + * test a dataset with non initialized chunks + *------------------------------------------------------------------------- + */ - - /*------------------------------------------------------------------------- - * test a dataset with non initialized chunks - *------------------------------------------------------------------------- - */ - - - if ((sid = H5Screate_simple(RANK1, dims_o, maxdims)) < 0) - { + if((sid = H5Screate_simple(RANK1, dims_o, maxdims)) < 0) TEST_ERROR - } - if ((did = H5Dcreate2(fid , "dset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0) - { + if((did = H5Dcreate2(fid , "dset3", H5T_NATIVE_INT, sid, H5P_DEFAULT, my_dcpl, H5P_DEFAULT)) < 0) TEST_ERROR - } + /* set new dimensions for the array */ dims_o[ 0 ] = 0; - if (H5Dset_extent( did , dims_o ) < 0) - { + if(H5Dset_extent( did , dims_o ) < 0) TEST_ERROR - } - - - if (H5Dclose(did) < 0) - { + if(H5Dclose(did) < 0) TEST_ERROR - } - if (H5Sclose(sid) < 0) - { + if(H5Sclose(sid) < 0) TEST_ERROR - } - - - /*------------------------------------------------------------------------- - * close property list - *------------------------------------------------------------------------- - */ - - - if (H5Pclose(my_dcpl) < 0) - { + * close property list + *------------------------------------------------------------------------- + */ + if(H5Pclose(my_dcpl) < 0) TEST_ERROR - } - - if (H5Fclose( fid ) < 0) - { + if(H5Fclose(fid) < 0) TEST_ERROR - } - return 0; - - error: H5E_BEGIN_TRY @@ -875,7 +703,7 @@ error: } H5E_END_TRY; return -1; -} +} /* end test_rank1() */ /*------------------------------------------------------------------------- * test usage with a 2D rank diff --git a/test/tarray.c b/test/tarray.c index cb5fef9..c6e9c0d 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -34,41 +34,67 @@ #define ARRAY1_DIM1 4 /* 3-D array datatype */ -#define ARRAY2_RANK 3 -#define ARRAY2_DIM1 3 -#define ARRAY2_DIM2 4 -#define ARRAY2_DIM3 5 +#define ARRAY2_RANK 3 +#define ARRAY2_DIM1 3 +#define ARRAY2_DIM2 4 +#define ARRAY2_DIM3 5 /* 2-D array datatype */ -#define ARRAY3_RANK 2 -#define ARRAY3_DIM1 6 -#define ARRAY3_DIM2 3 +#define ARRAY3_RANK 2 +#define ARRAY3_DIM1 6 +#define ARRAY3_DIM2 3 /* 1-D dataset with fixed dimensions */ -#define SPACE1_RANK 1 -#define SPACE1_DIM1 4 +#define SPACE1_RANK 1 +#define SPACE1_DIM1 4 -/**************************************************************** -** -** test_array_atomic_1d(): Test basic array datatype code. -** Tests 1-D array of atomic datatypes -** -****************************************************************/ +/* Parameters used with the test_array_bkg() test */ +#define FIELDNAME "ArrayofStructures" +#define LENGTH 5 +#define ALEN 10 +#define RANK 1 +#define NMAX 100 + +/* Struct used with test_array_bkg() test */ +typedef struct +{ + int nsubfields; + char *name[NMAX]; + size_t offset[NMAX]; + hid_t datatype[NMAX]; + +} CmpDTSinfo; + +/* Forward declarations for custom vlen memory manager functions */ +void *test_array_alloc_custom(size_t size, void *info); +void test_array_free_custom(void *mem, void *info); + + +/*------------------------------------------------------------------------- + * Function: test_array_atomic_1d + * + * Purpose: Test basic array datatype code. + * Tests 1-D array of atomic datatypes. + * + * Return: void + * + *------------------------------------------------------------------------- + */ static void test_array_atomic_1d(void) { - int wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ - int rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1; /* Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims1[] = {ARRAY1_DIM1}; - int ndims; /* Array rank for reading */ - hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ - int i,j; /* counting variables */ - herr_t ret; /* Generic return value */ + int wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ + int rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims1[] = {ARRAY1_DIM1}; + int ndims; /* Array rank for reading */ + hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ + int i,j; /* counting variables */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing 1-D Array of Atomic Datatypes Functionality\n")); @@ -167,23 +193,28 @@ test_array_atomic_1d(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_atomic_1d() */ -/**************************************************************** -** -** test_array_funcs(): Test some type functions that are and -** aren't supposed to work with array type. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_array_funcs + * + * Purpose: Test some type functions that are and aren't supposed to + * work with array type. + * + * Return: void + * + *------------------------------------------------------------------------- + */ static void test_array_funcs(void) { - hid_t type; /* Datatype ID */ - hsize_t tdims1[] = {ARRAY1_DIM1}; - size_t size; - H5T_pad_t inpad; - H5T_norm_t norm; - H5T_cset_t cset; - H5T_str_t strpad; - herr_t ret; /* Generic return value */ + hid_t type; /* Datatype ID */ + hsize_t tdims1[] = {ARRAY1_DIM1}; + size_t size; + H5T_pad_t inpad; + H5T_norm_t norm; + H5T_cset_t cset; + H5T_str_t strpad; + herr_t ret; /* Generic return value */ /* Create a datatype to refer to */ type = H5Tarray_create2(H5T_IEEE_F32BE, ARRAY1_RANK, tdims1); @@ -223,29 +254,34 @@ test_array_funcs(void) /* Close datatype */ ret = H5Tclose(type); CHECK(ret, FAIL, "H5Tclose"); -} /* end test_array_funcs */ +} /* end test_array_funcs() */ -/**************************************************************** -** -** test_array_atomic_3d(): Test basic array datatype code. -** Tests 3-D array of atomic datatypes -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_array_atomic_3d + * + * Purpose: Test basic array datatype code. + * Tests 3-D array of atomic datatypes. + * + * Return: void + * + *------------------------------------------------------------------------- + */ static void test_array_atomic_3d(void) { int wdata[SPACE1_DIM1][ARRAY2_DIM1][ARRAY2_DIM2][ARRAY2_DIM3]; /* Information to write */ int rdata[SPACE1_DIM1][ARRAY2_DIM1][ARRAY2_DIM2][ARRAY2_DIM3]; /* Information read in */ - hid_t fid; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t tid; /* Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims2[] = {ARRAY2_DIM1,ARRAY2_DIM2,ARRAY2_DIM3}; - int ndims; /* Array rank for reading */ - hsize_t rdims2[H5S_MAX_RANK]; /* Array dimensions for reading */ - int i,j,k,l; /* counting variables */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t tid; /* Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims2[] = {ARRAY2_DIM1,ARRAY2_DIM2,ARRAY2_DIM3}; + int ndims; /* Array rank for reading */ + hsize_t rdims2[H5S_MAX_RANK]; /* Array dimensions for reading */ + int i,j,k,l; /* counting variables */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing 3-D Array of Atomic Datatypes Functionality\n")); @@ -349,31 +385,36 @@ test_array_atomic_3d(void) } /* end test_array_atomic_3d() */ -/**************************************************************** -** -** test_array_array_atomic(): Test basic array datatype code. -** Tests 1-D array 2-D arrays of atomic datatypes -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_array_array_atomic + * + * Purpose: Test basic array datatype code. + * Tests 1-D array 2-D arrays of atomic datatypes. + * + * Return: void + * + *------------------------------------------------------------------------- + */ static void test_array_array_atomic(void) { int wdata[SPACE1_DIM1][ARRAY1_DIM1][ARRAY3_DIM1][ARRAY3_DIM2]; /* Information to write */ int rdata[SPACE1_DIM1][ARRAY1_DIM1][ARRAY3_DIM1][ARRAY3_DIM2]; /* Information read in */ - hid_t fid; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid; /* Dataspace ID */ - hid_t tid1; /* 1-D array Datatype ID */ - hid_t tid2; /* 2-D array Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims1[] = {ARRAY1_DIM1}; - hsize_t tdims2[] = {ARRAY3_DIM1,ARRAY3_DIM2}; - int ndims1; /* Array rank for reading */ - int ndims2; /* Array rank for reading */ - hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ - hsize_t rdims2[H5S_MAX_RANK]; /* Array dimensions for reading */ - int i,j,k,l; /* counting variables */ - herr_t ret; /* Generic return value */ + hid_t fid; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid; /* Dataspace ID */ + hid_t tid1; /* 1-D array Datatype ID */ + hid_t tid2; /* 2-D array Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims1[] = {ARRAY1_DIM1}; + hsize_t tdims2[] = {ARRAY3_DIM1,ARRAY3_DIM2}; + int ndims1; /* Array rank for reading */ + int ndims2; /* Array rank for reading */ + hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ + hsize_t rdims2[H5S_MAX_RANK]; /* Array dimensions for reading */ + int i,j,k,l; /* counting variables */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing 1-D Array 2-D Arrays of Atomic Datatypes Functionality\n")); @@ -503,12 +544,17 @@ test_array_array_atomic(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_array_atomic() */ -/**************************************************************** -** -** test_array_compound_atomic(): Test basic array datatype code. -** Tests 1-D array of compound datatypes (with no array fields) -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_array_compound_atomic + * + * Purpose: Test basic array datatype code. + * Tests 1-D array of compound datatypes (with no array fields). + * + * Return: void + * + *------------------------------------------------------------------------- + */ static void test_array_compound_atomic(void) { @@ -516,23 +562,24 @@ test_array_compound_atomic(void) int i; float f; } s1_t; - s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ - s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1; /* Array Datatype ID */ - hid_t tid2; /* Compound Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims1[] = {ARRAY1_DIM1}; - int ndims; /* Array rank for reading */ - hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ - int nmemb; /* Number of compound members */ - char *mname; /* Name of compound field */ - size_t off; /* Offset of compound field */ - hid_t mtid; /* Datatype ID for field */ - int i,j; /* counting variables */ - herr_t ret; /* Generic return value */ + + s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ + s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Array Datatype ID */ + hid_t tid2; /* Compound Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims1[] = {ARRAY1_DIM1}; + int ndims; /* Array rank for reading */ + hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ + int nmemb; /* Number of compound members */ + char *mname; /* Name of compound field */ + size_t off; /* Offset of compound field */ + hid_t mtid; /* Datatype ID for field */ + int i,j; /* counting variables */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing 1-D Array of Compound Atomic Datatypes Functionality\n")); @@ -704,12 +751,17 @@ test_array_compound_atomic(void) CHECK(ret, FAIL, "H5Fclose"); } /* end test_array_compound_atomic() */ -/**************************************************************** -** -** test_array_compound_array(): Test basic array datatype code. -** Tests 1-D array of compound datatypes (with array fields) -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_array_compound_array + * + * Purpose: Test basic array datatype code. + * Tests 1-D array of compound datatypes (with array fields). + * + * Return: void + * + *------------------------------------------------------------------------- + */ static void test_array_compound_array(void) { @@ -717,25 +769,26 @@ test_array_compound_array(void) int i; float f[ARRAY1_DIM1]; } s1_t; - s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ - s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1; /* Array Datatype ID */ - hid_t tid2; /* Compound Datatype ID */ - hid_t tid3; /* Nested Array Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims1[] = {ARRAY1_DIM1}; - int ndims; /* Array rank for reading */ - hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ - int nmemb; /* Number of compound members */ - char *mname; /* Name of compound field */ - size_t off; /* Offset of compound field */ - hid_t mtid; /* Datatype ID for field */ - H5T_class_t mclass; /* Datatype class for field */ - int i,j,k; /* counting variables */ - herr_t ret; /* Generic return value */ + + s1_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ + s1_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Array Datatype ID */ + hid_t tid2; /* Compound Datatype ID */ + hid_t tid3; /* Nested Array Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims1[] = {ARRAY1_DIM1}; + int ndims; /* Array rank for reading */ + hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ + int nmemb; /* Number of compound members */ + char *mname; /* Name of compound field */ + size_t off; /* Offset of compound field */ + hid_t mtid; /* Datatype ID for field */ + H5T_class_t mclass; /* Datatype class for field */ + int i,j,k; /* counting variables */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing 1-D Array of Compound Array Datatypes Functionality\n")); @@ -949,9 +1002,6 @@ test_array_compound_array(void) } /* end test_array_compound_array() */ -void *test_array_alloc_custom(size_t size, void *info); -void test_array_free_custom(void *mem, void *info); - /**************************************************************** ** ** test_array_alloc_custom(): Test VL datatype custom memory @@ -960,11 +1010,29 @@ void test_array_free_custom(void *mem, void *info); ** allocated. ** ****************************************************************/ -void *test_array_alloc_custom(size_t size, void *info) + +/*------------------------------------------------------------------------- + * Function: test_array_alloc_custom + * + * Purpose: Memory allocator for testing VL datatype custom memory + * allocation routines. + * + * This routine just uses malloc to allocate the memory and + * increments the amount of memory allocated. + * + * Return: + * + * Success: A memory buffer + * Failure: NULL + * + *------------------------------------------------------------------------- + */ +void * +test_array_alloc_custom(size_t size, void *info) { - void *ret_value = NULL; /* Pointer to return */ - size_t *mem_used = (size_t *)info; /* Get the pointer to the memory used */ - size_t extra; /* Extra space needed */ + void *ret_value = NULL; /* Pointer to return */ + size_t *mem_used = (size_t *)info; /* Pointer to the memory used */ + size_t extra; /* Extra space needed */ /* * This weird contortion is required on the DEC Alpha to keep the @@ -976,23 +1044,31 @@ void *test_array_alloc_custom(size_t size, void *info) *(size_t *)ret_value = size; *mem_used += size; } /* end if */ + ret_value = ((unsigned char *)ret_value) + extra; return ret_value; -} +} /* end test_array_alloc_custom() */ -/**************************************************************** -** -** test_array_free_custom(): Test VL datatype custom memory -** allocation routines. This routine just uses free to -** release the memory and decrements the amount of memory -** allocated. -** -****************************************************************/ -void test_array_free_custom(void *_mem, void *info) + +/*------------------------------------------------------------------------- + * Function: test_array_free_custom + * + * Purpose: Memory free function for testing VL datatype custom memory + * allocation routines. + * + * This routine just uses free to free the memory and + * decrements the amount of memory allocated. + * + * Return: void + * + *------------------------------------------------------------------------- + */ +void +test_array_free_custom(void *_mem, void *info) { - unsigned char *mem = NULL; - size_t *mem_used = (size_t *)info; /* Get the pointer to the memory used */ - size_t extra; /* Extra space needed */ + unsigned char *mem = NULL; /* Pointer to mem to be freed */ + size_t *mem_used = (size_t *)info; /* Pointer to the memory used */ + size_t extra; /* Extra space needed */ /* * This weird contortion is required on the DEC Alpha to keep the @@ -1005,35 +1081,42 @@ void test_array_free_custom(void *_mem, void *info) *mem_used -= *(size_t *)mem; HDfree(mem); } /* end if */ -} -/**************************************************************** -** -** test_array_vlen_atomic(): Test basic array datatype code. -** Tests 1-D array of atomic VL datatypes -** -****************************************************************/ + return; +} /* end test_array_free_custom() */ + + +/*------------------------------------------------------------------------- + * Function: test_array_vlen_atomic + * + * Purpose: Test basic array datatype code. + * Tests 1-D array of atomic VL datatypes. + * + * Return: void + * + *------------------------------------------------------------------------- + */ static void test_array_vlen_atomic(void) { - hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ - hvl_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1; /* Array Datatype ID */ - hid_t tid2; /* VL Datatype ID */ - hid_t tid3; /* Atomic Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims1[] = {ARRAY1_DIM1}; - int ndims; /* Array rank for reading */ - hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ - H5T_class_t mclass; /* Datatype class for VL */ - hid_t xfer_pid; /* Dataset transfer property list ID */ - hsize_t size; /* Number of bytes which will be used */ - size_t mem_used=0; /* Memory used during allocation */ - int i,j,k; /* counting variables */ - herr_t ret; /* Generic return value */ + hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ + hvl_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Array Datatype ID */ + hid_t tid2; /* VL Datatype ID */ + hid_t tid3; /* Atomic Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims1[] = {ARRAY1_DIM1}; + int ndims; /* Array rank for reading */ + hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ + H5T_class_t mclass; /* Datatype class for VL */ + hid_t xfer_pid; /* Dataset transfer property list ID */ + hsize_t size; /* Number of bytes which will be used */ + size_t mem_used=0; /* Memory used during allocation */ + int i,j,k; /* counting variables */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing 1-D Array of Atomic Variable-Length Datatypes Functionality\n")); @@ -1217,34 +1300,39 @@ test_array_vlen_atomic(void) } /* end test_array_vlen_atomic() */ -/**************************************************************** -** -** test_array_vlen_array(): Test basic array datatype code. -** Tests 1-D array of 1-D array VL datatypes -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_array_vlen_array + * + * Purpose: Test basic array datatype code. + * Tests 1-D array of 1-D array VL datatypes. + * + * Return: void + * + *------------------------------------------------------------------------- + */ static void test_array_vlen_array(void) { - hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ - hvl_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t sid1; /* Dataspace ID */ - hid_t tid1; /* Array Datatype ID */ - hid_t tid2; /* VL Datatype ID */ - hid_t tid3; /* Nested Array Datatype ID */ - hid_t tid4; /* Atomic Datatype ID */ - hsize_t sdims1[] = {SPACE1_DIM1}; - hsize_t tdims1[] = {ARRAY1_DIM1}; - int ndims; /* Array rank for reading */ - hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ - H5T_class_t mclass; /* Datatype class for VL */ - hid_t xfer_pid; /* Dataset transfer property list ID */ - hsize_t size; /* Number of bytes which will be used */ - size_t mem_used=0; /* Memory used during allocation */ - int i,j,k,l; /* Index variables */ - herr_t ret; /* Generic return value */ + hvl_t wdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information to write */ + hvl_t rdata[SPACE1_DIM1][ARRAY1_DIM1]; /* Information read in */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t sid1; /* Dataspace ID */ + hid_t tid1; /* Array Datatype ID */ + hid_t tid2; /* VL Datatype ID */ + hid_t tid3; /* Nested Array Datatype ID */ + hid_t tid4; /* Atomic Datatype ID */ + hsize_t sdims1[] = {SPACE1_DIM1}; + hsize_t tdims1[] = {ARRAY1_DIM1}; + int ndims; /* Array rank for reading */ + hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ + H5T_class_t mclass; /* Datatype class for VL */ + hid_t xfer_pid; /* Dataset transfer property list ID */ + hsize_t size; /* Number of bytes which will be used */ + size_t mem_used=0; /* Memory used during allocation */ + int i,j,k,l; /* Index variables */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing 1-D Array of 1-D Array Variable-Length Datatypes Functionality\n")); @@ -1467,28 +1555,18 @@ test_array_vlen_array(void) } /* end test_array_vlen_array() */ -#define FIELDNAME "ArrayofStructures" -#define LENGTH 5 -#define ALEN 10 -#define RANK 1 -#define NMAX 100 - -typedef struct -{ - int nsubfields; - char *name[NMAX]; - size_t offset[NMAX]; - hid_t datatype[NMAX]; - -} CmpDTSinfo; - -/**************************************************************** -** -** test_array_bkg(): Test basic array datatype code. -** Tests reading compound datatype with array fields and -** writing partial fields. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_array_bkg + * + * Purpose: Test basic array datatype code. + * Tests reading compound datatype with array fields and + * writing partial fields. + * + * Return: void + * + *------------------------------------------------------------------------- + */ static void test_array_bkg(void) { @@ -1531,10 +1609,10 @@ test_array_bkg(void) CHECK(dtsinfo, NULL, "HDmalloc"); HDmemset(dtsinfo, 0, sizeof(CmpDTSinfo)); for (i = 0; i < LENGTH; i++) { - for (j = 0; j < ALEN; j++) { - cf[i].a[j] = 100 * (i + 1) + j; - cf[i].b[j] = 100.0F * ((float)i + 1.0F) + 0.01F * (float)j; - cf[i].c[j] = (double)(100.0F * ((float)i + 1.0F) + 0.02F * (float)j); + for (j = 0; j < ALEN; j++) { + cf[i].a[j] = 100 * (i + 1) + j; + cf[i].b[j] = 100.0F * ((float)i + 1.0F) + 0.01F * (float)j; + cf[i].c[j] = (double)(100.0F * ((float)i + 1.0F) + 0.02F * (float)j); } /* end for */ } /* end for */ @@ -1745,7 +1823,7 @@ test_array_bkg(void) /* Reset the data to read in */ /* ------------------------- */ - memset(cfr, 0, sizeof(CmpField)*LENGTH); + HDmemset(cfr, 0, sizeof(CmpField)*LENGTH); status = H5Dread(dataset, type, H5S_ALL, H5S_ALL, H5P_DEFAULT, cfr); CHECK(status, FAIL, "H5Dread"); @@ -2064,17 +2142,22 @@ test_compat(void) /* Close the file */ ret = H5Fclose(fid1); CHECK_I(ret, "H5Fclose"); - } + } /* end if */ else printf("***cannot open the pre-created compound datatype test file (%s)\n",testfile); } /* end test_compat() */ -/**************************************************************** -** -** test_array(): Main array datatype testing routine. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_array + * + * Purpose: Main array datatype testing routine. + * + * Return: void + * + *------------------------------------------------------------------------- + */ void test_array(void) { @@ -2082,39 +2165,38 @@ test_array(void) MESSAGE(5, ("Testing Array Datatypes\n")); /* These tests use the same file... */ - test_array_atomic_1d(); /* Test 1-D array of atomic datatypes */ - test_array_atomic_3d(); /* Test 3-D array of atomic datatypes */ - test_array_array_atomic(); /* Test 1-D array of 2-D arrays of atomic datatypes */ - test_array_compound_atomic(); /* Test 1-D array of compound datatypes (with no array fields) */ - test_array_compound_array(); /* Test 1-D array of compound datatypes (with array fields) */ - test_array_vlen_atomic(); /* Test 1-D array of atomic VL datatypes */ - test_array_vlen_array(); /* Test 1-D array of 1-D array VL datatypes */ - test_array_funcs(); /* Test type functions with array types */ + test_array_atomic_1d(); /* Test 1-D array of atomic datatypes */ + test_array_atomic_3d(); /* Test 3-D array of atomic datatypes */ + test_array_array_atomic(); /* Test 1-D array of 2-D arrays of atomic datatypes */ + test_array_compound_atomic(); /* Test 1-D array of compound datatypes (with no array fields) */ + test_array_compound_array(); /* Test 1-D array of compound datatypes (with array fields) */ + test_array_vlen_atomic(); /* Test 1-D array of atomic VL datatypes */ + test_array_vlen_array(); /* Test 1-D array of 1-D array VL datatypes */ + test_array_funcs(); /* Test type functions with array types */ - test_array_bkg(); /* Read compound datatype with array fields and background fields read */ + test_array_bkg(); /* Read compound datatype with array fields and background fields read */ /* This test uses a custom file */ - test_compat(); /* Test compatibility changes for compound datatype fields */ -} /* test_array() */ + test_compat(); /* Test compatibility changes for compound datatype fields */ + +} /* end test_array() */ /*------------------------------------------------------------------------- - * Function: cleanup_array + * Function: cleanup_array * - * Purpose: Cleanup temporary test files + * Purpose: Cleanup temporary test files * - * Return: none + * Return: void * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * June 8, 1999 * - * Modifications: - * *------------------------------------------------------------------------- */ void cleanup_array(void) { remove(FILENAME); -} +} /* end cleanup_array() */ diff --git a/test/tfile.c b/test/tfile.c index dff4128..7444698 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -3261,8 +3261,10 @@ test_filespace_compatible(void) CHECK(fd_new, FAIL, "HDopen"); /* Copy data */ - while((nread = HDread(fd_old, buf, (size_t)READ_OLD_BUFSIZE)) > 0) - HDwrite(fd_new, buf, (size_t)nread); + while((nread = HDread(fd_old, buf, (size_t)READ_OLD_BUFSIZE)) > 0) { + ssize_t write_err = HDwrite(fd_new, buf, (size_t)nread); + CHECK(write_err, -1, "HDwrite"); + } /* end while */ /* Close the files */ ret = HDclose(fd_old); diff --git a/testpar/t_file.c b/testpar/t_file.c index 45d1305..b2f1d5e 100644 --- a/testpar/t_file.c +++ b/testpar/t_file.c @@ -106,17 +106,19 @@ test_file_properties(void) int mpi_size, mpi_rank; herr_t ret; /* Generic return value */ - filename = GetTestParameters(); + filename = (const char *)GetTestParameters(); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); /* setup file access plist */ - fapl_id = H5Pcreate (H5P_FILE_ACCESS); - VRFY((fapl_id >= 0), "H5P_FILE_ACCESS"); + fapl_id = H5Pcreate(H5P_FILE_ACCESS); + VRFY((fapl_id >= 0), "H5Pcreate"); + ret = H5Pset_fapl_mpio(fapl_id, comm, info); + VRFY((ret >= 0), "H5Pset_fapl_mpio"); - /* create the file with the SEC2 driver */ + /* create the file */ fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id); VRFY((fid >= 0), "H5Fcreate succeeded"); @@ -207,4 +209,5 @@ test_file_properties(void) /* Release file-access plist */ ret = H5Pclose(fapl_id); VRFY((ret >= 0), "H5Pclose succeeded"); -} +} /* end test_file_properties() */ + -- cgit v0.12 From 9333a2e39c9a496f2a21a97d772493932c3f66d4 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 23 Mar 2016 22:58:43 -0500 Subject: [svn-r29548] Minor normalization w/ trunk in preparation for big merge. Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 autotools serial autotools parallel (MPICH 3.1.4) --- src/H5AC.c | 2 +- src/H5Apkg.h | 11 +- src/H5B2.c | 3 +- src/H5B2int.c | 14 +-- src/H5Cprivate.h | 4 +- src/H5Dio.c | 2 +- src/H5Dlayout.c | 33 +++--- src/H5Doh.c | 4 +- src/H5Dpkg.h | 2 +- src/H5EApkg.h | 60 +++++------ src/H5EAprivate.h | 16 +-- src/H5F.c | 1 - src/H5FA.c | 2 +- src/H5FAprivate.h | 2 +- src/H5Fsuper.c | 2 +- src/H5Fsuper_cache.c | 2 +- src/H5Gstab.c | 4 +- src/H5HG.c | 24 ++--- src/H5HGpkg.h | 6 +- src/H5MF.c | 2 +- src/H5Oainfo.c | 6 +- src/H5Oalloc.c | 16 +-- src/H5Ocache.c | 1 - src/H5Ochunk.c | 8 +- src/H5Olayout.c | 72 ++++++------- src/Makefile.am | 2 +- test/dsets.c | 39 ++++--- test/earray.c | 297 +-------------------------------------------------- test/gen_plist.c | 2 +- test/h5test.c | 14 +-- 30 files changed, 182 insertions(+), 471 deletions(-) diff --git a/src/H5AC.c b/src/H5AC.c index 6cd3b0e..64edc87 100644 --- a/src/H5AC.c +++ b/src/H5AC.c @@ -32,7 +32,7 @@ /****************/ #include "H5ACmodule.h" /* This source code file is part of the H5AC module */ -#define H5F_FRIEND /*suppress error about including H5Fpkg */ +#define H5F_FRIEND /* Suppress error about including H5Fpkg */ /***********/ diff --git a/src/H5Apkg.h b/src/H5Apkg.h index b392497..5858147 100644 --- a/src/H5Apkg.h +++ b/src/H5Apkg.h @@ -220,15 +220,15 @@ H5_DLL herr_t H5A_dense_iterate(H5F_t *f, hid_t dxpl_id, hid_t loc_id, const H5O_ainfo_t *ainfo, H5_index_t idx_type, H5_iter_order_t order, hsize_t skip, hsize_t *last_attr, const H5A_attr_iter_op_t *attr_op, void *op_data); -H5_DLL herr_t H5A_dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, - const char *name); -H5_DLL herr_t H5A_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, - H5_index_t idx_type, H5_iter_order_t order, hsize_t n); +H5_DLL herr_t H5A_dense_remove(H5F_t *f, hid_t dxpl_id, + const H5O_ainfo_t *ainfo, const char *name); +H5_DLL herr_t H5A_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, + const H5O_ainfo_t *ainfo, H5_index_t idx_type, H5_iter_order_t order, + hsize_t n); H5_DLL htri_t H5A_dense_exists(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, const char *name); H5_DLL herr_t H5A_dense_delete(H5F_t *f, hid_t dxpl_id, H5O_ainfo_t *ainfo); - /* Attribute table operations */ H5_DLL herr_t H5A_compact_build_table(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_index_t idx_type, H5_iter_order_t order, H5A_attr_table_t *atable); @@ -267,7 +267,6 @@ H5_DLL herr_t H5A_attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *me H5_DLL herr_t H5A_dense_post_copy_file_all(const H5O_loc_t *src_oloc, const H5O_ainfo_t * ainfo_src, H5O_loc_t *dst_oloc, H5O_ainfo_t *ainfo_dst, hid_t dxpl_id, H5O_copy_t *cpy_info); - /* Testing functions */ #ifdef H5A_TESTING H5_DLL htri_t H5A_is_shared_test(hid_t aid); diff --git a/src/H5B2.c b/src/H5B2.c index caf2395..5cbeadd 100644 --- a/src/H5B2.c +++ b/src/H5B2.c @@ -535,11 +535,10 @@ H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op, /* Unlock current node before failing */ H5AC_unprotect(hdr->f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET); HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") - } + } /* end if */ if(cmp > 0) idx++; - if(cmp != 0) { /* Get node pointer for next node to search */ next_node_ptr=internal->node_ptrs[idx]; diff --git a/src/H5B2int.c b/src/H5B2int.c index a184b4b..8bdde3e 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -148,14 +148,14 @@ H5B2__locate_record(const H5B2_class_t *type, unsigned nrec, size_t *rec_off, hi = nrec; while(lo < hi && *cmp) { - my_idx = (lo + hi) / 2; - if((type->compare)(udata, native + rec_off[my_idx], cmp) < 0) + my_idx = (lo + hi) / 2; + if((type->compare)(udata, native + rec_off[my_idx], cmp) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTCOMPARE, FAIL, "can't compare btree2 records") - if(*cmp < 0) - hi = my_idx; - else - lo = my_idx + 1; - } + if(*cmp < 0) + hi = my_idx; + else + lo = my_idx + 1; + } /* end while */ *idx = my_idx; diff --git a/src/H5Cprivate.h b/src/H5Cprivate.h index 5502e9f..a062214 100644 --- a/src/H5Cprivate.h +++ b/src/H5Cprivate.h @@ -41,8 +41,8 @@ /**************************/ /* Cache configuration settings */ -#define H5C__MAX_NUM_TYPE_IDS 28 -#define H5C__PREFIX_LEN 32 +#define H5C__MAX_NUM_TYPE_IDS 28 +#define H5C__PREFIX_LEN 32 /* This sanity checking constant was picked out of the air. Increase * or decrease it if appropriate. Its purposes is to detect corrupt diff --git a/src/H5Dio.c b/src/H5Dio.c index ae42702..7b3f553 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -760,7 +760,7 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, else full_overwrite = (hbool_t)((hsize_t)file_nelmts == nelmts ? TRUE : FALSE); - /* Allocate storage */ + /* Allocate storage */ if(H5D__alloc_storage(&io_info, H5D_ALLOC_WRITE, full_overwrite, NULL) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize storage") } /* end if */ diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index e61dae0..bbaa9c5 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -23,10 +23,10 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Dpkg.h" /* Datasets */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5HLprivate.h" /* Local heaps */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5HLprivate.h" /* Local heaps */ /****************/ @@ -61,15 +61,15 @@ /*------------------------------------------------------------------------- - * Function: H5D__layout_set_io_ops + * Function: H5D__layout_set_io_ops * - * Purpose: Set the I/O operation function pointers for a dataset, + * Purpose: Set the I/O operation function pointers for a dataset, * according to the dataset's layout * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * Thursday, March 20, 2008 + * Programmer: Quincey Koziol + * Thursday, March 20, 2008 * *------------------------------------------------------------------------- */ @@ -192,15 +192,15 @@ done: /*------------------------------------------------------------------------- - * Function: H5D__layout_oh_create + * Function: H5D__layout_oh_create * - * Purpose: Create layout/pline/efl information for dataset + * Purpose: Create layout/pline/efl information for dataset * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Success: SUCCEED + * Failure: FAIL * - * Programmer: Quincey Koziol - * Monday, July 27, 2009 + * Programmer: Quincey Koziol + * Monday, July 27, 2009 * *------------------------------------------------------------------------- */ @@ -209,7 +209,7 @@ H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset, hid_t dapl_id) { H5O_layout_t *layout; /* Dataset's layout information */ - const H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */ + const H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */ hbool_t layout_init = FALSE; /* Flag to indicate that chunk information was initialized */ herr_t ret_value = SUCCEED; /* Return value */ @@ -394,6 +394,7 @@ H5D__layout_oh_read(H5D_t *dataset, hid_t dxpl_id, hid_t dapl_id, H5P_genplist_t /* Adjust chunk dimensions to omit datatype size (in last dimension) for creation property */ if(H5D_CHUNKED == dataset->shared->layout.type) dataset->shared->layout.u.chunk.ndims--; + /* Copy layout to the DCPL */ if(H5P_set(plist, H5D_CRT_LAYOUT_NAME, &dataset->shared->layout) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout") diff --git a/src/H5Doh.c b/src/H5Doh.c index 8b70362..54f7a5e 100644 --- a/src/H5Doh.c +++ b/src/H5Doh.c @@ -465,11 +465,11 @@ H5O__dset_flush(H5G_loc_t *obj_loc, hid_t dxpl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset") if(H5D__flush_real(dset, dxpl_id) < 0) - HDONE_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to flush cached dataset info") + HDONE_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to flush cached dataset info") done: if(dset && H5D_close(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__dset_flush() */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index bc04300..2629008 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -544,8 +544,8 @@ H5_DLL herr_t H5D__check_filters(H5D_t *dataset); H5_DLL herr_t H5D__set_extent(H5D_t *dataset, const hsize_t *size, hid_t dxpl_id); H5_DLL herr_t H5D__get_dxpl_cache(hid_t dxpl_id, H5D_dxpl_cache_t **cache); H5_DLL herr_t H5D__flush_sieve_buf(H5D_t *dataset, hid_t dxpl_id); -H5_DLL herr_t H5D__mark(const H5D_t *dataset, hid_t dxpl_id, unsigned flags); H5_DLL herr_t H5D__flush_real(H5D_t *dataset, hid_t dxpl_id); +H5_DLL herr_t H5D__mark(const H5D_t *dataset, hid_t dxpl_id, unsigned flags); #ifdef H5_DEBUG_BUILD H5_DLL herr_t H5D_set_io_info_dxpls(H5D_io_info_t *io_info, hid_t dxpl_id); #endif /* H5_DEBUG_BUILD */ diff --git a/src/H5EApkg.h b/src/H5EApkg.h index 3af1b2c..2e13694 100644 --- a/src/H5EApkg.h +++ b/src/H5EApkg.h @@ -14,12 +14,12 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol - * Tuesday, June 17, 2008 + * Programmer: Quincey Koziol + * Tuesday, June 17, 2008 * - * Purpose: This file contains declarations which are visible only within - * the H5EA package. Source files outside the H5EA package should - * include H5EAprivate.h instead. + * Purpose: This file contains declarations which are visible only + * within the H5EA package. Source files outside the H5EA + * package should include H5EAprivate.h instead. */ #if !(defined(H5EA_FRIEND) | defined(H5EA_MODULE)) #error "Do not include this file outside the H5EA package!" @@ -32,7 +32,7 @@ #include "H5EAprivate.h" /* Other private headers needed by this file */ -#include "H5FLprivate.h" /* Free Lists */ +#include "H5FLprivate.h" /* Free Lists */ /**************************/ @@ -95,10 +95,10 @@ /* General metadata fields */ \ H5EA_METADATA_PREFIX_SIZE(TRUE) \ \ - /* Sanity-checking fields */ \ + /* Sanity-checking fields */ \ + (i)->hdr->sizeof_addr /* File address of array owning the block */ \ \ - /* Extensible Array Index Block specific fields */ \ + /* Extensible Array Index Block specific fields */ \ + ((size_t)(i)->hdr->cparam.idx_blk_elmts * (size_t)(i)->hdr->cparam.raw_elmt_size) /* Elements in index block */ \ + ((i)->ndblk_addrs * (i)->hdr->sizeof_addr) /* Data block addresses in index block */ \ + ((i)->nsblk_addrs * (i)->hdr->sizeof_addr) /* Super block addresses in index block */ \ @@ -109,31 +109,31 @@ /* General metadata fields */ \ H5EA_METADATA_PREFIX_SIZE(TRUE) \ \ - /* Sanity-checking fields */ \ + /* Sanity-checking fields */ \ + (s)->hdr->sizeof_addr /* File address of array owning the block */ \ + (s)->hdr->arr_off_size /* Offset of the block in the array */ \ \ - /* Extensible Array Super Block specific fields */ \ + /* Extensible Array Super Block specific fields */ \ + ((s)->ndblks * (s)->dblk_page_init_size) /* Data block 'page init' bitmasks in super block (can be 0 if no pages) */ \ + ((s)->ndblks * (s)->hdr->sizeof_addr) /* Data block addresses in super block */ \ ) /* Size of the extensible array data block prefix on disk */ -#define H5EA_DBLOCK_PREFIX_SIZE(d) ( \ +#define H5EA_DBLOCK_PREFIX_SIZE(d) ( \ /* General metadata fields */ \ H5EA_METADATA_PREFIX_SIZE(TRUE) \ \ - /* Sanity-checking fields */ \ + /* Sanity-checking fields */ \ + (d)->hdr->sizeof_addr /* File address of array owning the block */ \ + (d)->hdr->arr_off_size /* Offset of the block in the array */ \ ) /* Size of the extensible array data block on disk */ -#define H5EA_DBLOCK_SIZE(d) ( \ +#define H5EA_DBLOCK_SIZE(d) ( \ /* Data block prefix size */ \ H5EA_DBLOCK_PREFIX_SIZE(d) \ \ - /* Extensible Array Data Block specific fields */ \ + /* Extensible Array Data Block specific fields */ \ + ((d)->nelmts * (size_t)(d)->hdr->cparam.raw_elmt_size) /* Elements in data block */ \ + ((d)->npages * H5EA_SIZEOF_CHKSUM) /* Checksum for each page */ \ ) @@ -219,9 +219,9 @@ typedef struct H5EA_iblock_t { haddr_t *sblk_addrs; /* Buffer for addresses of super blocks in index block */ /* Internal array information (not stored) */ - H5EA_hdr_t *hdr; /* Shared array header info */ - haddr_t addr; /* Address of this index block on disk */ - size_t size; /* Size of index block on disk */ + H5EA_hdr_t *hdr; /* Shared array header info */ + haddr_t addr; /* Address of this index block on disk */ + size_t size; /* Size of index block on disk */ /* Computed/cached values (not stored) */ size_t nsblks; /* # of super blocks whose data block addresses are in index block */ @@ -240,10 +240,10 @@ typedef struct H5EA_sblock_t { uint8_t *page_init; /* Bitmap of whether a data block page is initialized */ /* Internal array information (not stored) */ - H5EA_hdr_t *hdr; /* Shared array header info */ - H5EA_iblock_t *parent; /* Parent object for super block (index block) */ - haddr_t addr; /* Address of this index block on disk */ - size_t size; /* Size of index block on disk */ + H5EA_hdr_t *hdr; /* Shared array header info */ + H5EA_iblock_t *parent; /* Parent object for super block (index block) */ + haddr_t addr; /* Address of this index block on disk */ + size_t size; /* Size of index block on disk */ /* Computed/cached values (not stored) */ unsigned idx; /* Super block index within the extensible array */ @@ -264,10 +264,10 @@ typedef struct H5EA_dblock_t { void *elmts; /* Buffer for elements stored in data block */ /* Internal array information (not stored) */ - H5EA_hdr_t *hdr; /* Shared array header info */ - void *parent; /* Parent object for data block (index or super block) */ - haddr_t addr; /* Address of this data block on disk */ - size_t size; /* Size of data block on disk */ + H5EA_hdr_t *hdr; /* Shared array header info */ + void *parent; /* Parent object for data block (index or super block) */ + haddr_t addr; /* Address of this data block on disk */ + size_t size; /* Size of data block on disk */ /* Computed/cached values (not stored) */ size_t nelmts; /* Number of elements in block */ @@ -283,10 +283,10 @@ typedef struct H5EA_dbk_page_t { void *elmts; /* Buffer for elements stored in data block page */ /* Internal array information (not stored) */ - H5EA_hdr_t *hdr; /* Shared array header info */ - H5EA_sblock_t *parent; /* Parent object for data block page (super block) */ - haddr_t addr; /* Address of this data block page on disk */ - size_t size; /* Size of data block page on disk */ + H5EA_hdr_t *hdr; /* Shared array header info */ + H5EA_sblock_t *parent; /* Parent object for data block page (super block) */ + haddr_t addr; /* Address of this data block page on disk */ + size_t size; /* Size of data block page on disk */ /* Computed/cached values (not stored) */ /* */ @@ -360,7 +360,7 @@ H5_DLLVAR const H5AC_class_t H5AC_EARRAY_DBLK_PAGE[1]; H5_DLLVAR const H5EA_class_t H5EA_CLS_TEST[1]; /* Array of extensible array client ID -> client class mappings */ -extern const H5EA_class_t *const H5EA_client_class_g[H5EA_NUM_CLS_ID]; +H5_DLLVAR const H5EA_class_t *const H5EA_client_class_g[H5EA_NUM_CLS_ID]; /******************************/ diff --git a/src/H5EAprivate.h b/src/H5EAprivate.h index 6ce3062..33b4553 100644 --- a/src/H5EAprivate.h +++ b/src/H5EAprivate.h @@ -15,12 +15,12 @@ /*------------------------------------------------------------------------- * - * Created: H5EAprivate.h - * Jun 17 2008 - * Quincey Koziol + * Created: H5EAprivate.h + * Jun 17 2008 + * Quincey Koziol * - * Purpose: Private header for library accessible extensible - * array routines. + * Purpose: Private header for library accessible extensible + * array routines. * *------------------------------------------------------------------------- */ @@ -34,8 +34,8 @@ #endif /* NOT_YET */ /* Private headers needed by this file */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5Fprivate.h" /* File access */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5Fprivate.h" /* File access */ /**************************/ @@ -51,7 +51,7 @@ typedef enum H5EA_cls_id_t { /* Start real class IDs at 0 -QAK */ /* (keep these last) */ - H5EA_CLS_TEST_ID, /* Extensible array is for testing (do not use for actual data) */ + H5EA_CLS_TEST_ID, /* Extensible array is for testing (do not use for actual data) */ H5EA_NUM_CLS_ID /* Number of Extensible Array class IDs (must be last) */ } H5EA_cls_id_t; diff --git a/src/H5F.c b/src/H5F.c index 95d87fc..bf57daf 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -58,7 +58,6 @@ /********************/ - /*********************/ /* Package Variables */ /*********************/ diff --git a/src/H5FA.c b/src/H5FA.c index 1be3f2e..3e502c0 100644 --- a/src/H5FA.c +++ b/src/H5FA.c @@ -79,7 +79,7 @@ hbool_t H5_PKG_INIT_VAR = FALSE; * client class.. */ const H5FA_class_t *const H5FA_client_class_g[] = { - H5FA_CLS_TEST, /* ? - H5FA_CLS_TEST_ID */ + H5FA_CLS_TEST, /* ? - H5FA_CLS_TEST_ID */ }; diff --git a/src/H5FAprivate.h b/src/H5FAprivate.h index aa88003..dfc73f5 100644 --- a/src/H5FAprivate.h +++ b/src/H5FAprivate.h @@ -32,7 +32,7 @@ #endif /* NOT_YET */ /* Private headers needed by this file */ -#include "H5Fprivate.h" /* File access */ +#include "H5Fprivate.h" /* File access */ /**************************/ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 6b4613d..70d1a49 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -115,7 +115,7 @@ H5F_super_ext_create(H5F_t *f, hid_t dxpl_id, H5O_loc_t *ext_ptr) * extension. */ H5O_loc_reset(ext_ptr); - if(H5O_create(f, dxpl_id, 0, (size_t)1, H5P_GROUP_CREATE_DEFAULT, ext_ptr) < 0) + if(H5O_create(f, dxpl_id, (size_t)0, (size_t)1, H5P_GROUP_CREATE_DEFAULT, ext_ptr) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create superblock extension") /* Record the address of the superblock extension */ diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 1e9e4dd..f445303 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -195,7 +195,7 @@ H5F__cache_superblock_deserialize(const void *_image, size_t len, void *_udata, H5F_super_t *sblock = NULL; /* File's superblock */ H5F_superblock_cache_ud_t *udata = (H5F_superblock_cache_ud_t *)_udata; /* User data */ const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ - size_t variable_size; /* Sariable size of superblock */ + size_t variable_size; /* Variable size of superblock */ unsigned super_vers; /* Superblock version */ uint8_t sizeof_addr; /* Size of offsets in the file (in bytes) */ uint8_t sizeof_size; /* Size of lengths in the file (in bytes) */ diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 3a7cd9e..ed3dd84 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -153,10 +153,10 @@ H5G__stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint, hid_t /* Create the B-tree */ if(H5B_create(f, dxpl_id, H5B_SNODE, NULL, &(stab->btree_addr)/*out*/) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create B-tree") + HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create B-tree") /* Create symbol table private heap */ - if(FAIL == H5HL_create(f, dxpl_id, size_hint, &(stab->heap_addr)/*out*/)) + if(H5HL_create(f, dxpl_id, size_hint, &(stab->heap_addr)/*out*/) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't create heap") /* Pin the heap down in memory */ diff --git a/src/H5HG.c b/src/H5HG.c index de25bc6..f95b607 100644 --- a/src/H5HG.c +++ b/src/H5HG.c @@ -297,9 +297,9 @@ done: static size_t H5HG_alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) { - size_t idx; - uint8_t *p; - size_t need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size); + size_t idx; + uint8_t *p; + size_t need = H5HG_SIZEOF_OBJHDR(f) + H5HG_ALIGN(size); size_t ret_value = 0; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -358,11 +358,11 @@ H5HG_alloc(H5F_t *f, H5HG_heap_t *heap, size_t size, unsigned *heap_flags_ptr) /* Fix the free space object */ if(need == heap->obj[0].size) { - /* - * All free space has been exhausted from this collection. - */ - heap->obj[0].size = 0; - heap->obj[0].begin = NULL; + /* + * All free space has been exhausted from this collection. + */ + heap->obj[0].size = 0; + heap->obj[0].begin = NULL; } /* end if */ else if(heap->obj[0].size-need >= H5HG_SIZEOF_OBJHDR (f)) { /* @@ -785,10 +785,10 @@ done: herr_t H5HG_remove (H5F_t *f, hid_t dxpl_id, H5HG_t *hobj) { - H5HG_heap_t *heap = NULL; - uint8_t *p = NULL, *obj_start = NULL; - size_t need; - unsigned u; + H5HG_heap_t *heap = NULL; + uint8_t *p = NULL, *obj_start = NULL; + size_t need; + unsigned u; unsigned flags = H5AC__NO_FLAGS_SET;/* Whether the heap gets deleted */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5HGpkg.h b/src/H5HGpkg.h index ffbf7c6..e566ece 100644 --- a/src/H5HGpkg.h +++ b/src/H5HGpkg.h @@ -116,9 +116,9 @@ H5FL_BLK_EXTERN(gheap_chunk); /****************************/ typedef struct H5HG_obj_t { - int nrefs; /*reference count */ - size_t size; /*total size of object */ - uint8_t *begin; /*ptr to object into heap->chunk*/ + int nrefs; /* reference count */ + size_t size; /* total size of object */ + uint8_t *begin; /* ptr to object into heap->chunk */ } H5HG_obj_t; /* Forward declarations for fields */ diff --git a/src/H5MF.c b/src/H5MF.c index 00a1ed8..15e7a96 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -1032,7 +1032,7 @@ H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, hid_t dxpl_id, haddr_t addr, H5MF_sect_ud_t udata; /* User data for callback */ H5P_genplist_t *dxpl = NULL; /* DXPL for setting ring */ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - htri_t ret_value = FAIL; /* Return value */ + htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_NOAPI(FAIL) #ifdef H5MF_ALLOC_DEBUG diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index c5f692d..ab26c17 100644 --- a/src/H5Oainfo.c +++ b/src/H5Oainfo.c @@ -346,9 +346,11 @@ H5O_ainfo_delete(H5F_t *f, hid_t dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh, void *_ HDassert(ainfo); /* If the object is using "dense" attribute storage, delete it */ - if(H5F_addr_defined(ainfo->fheap_addr)) + if(H5F_addr_defined(ainfo->fheap_addr)) { + /* Delete the attribute */ if(H5A_dense_delete(f, dxpl_id, ainfo) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFREE, FAIL, "unable to free dense attribute storage") + } /* end if */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -428,7 +430,7 @@ H5O_ainfo_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, *ainfo_dst = *ainfo_src; if(H5F_addr_defined(ainfo_src->fheap_addr)) { - /* copy dense attribute */ + /* Prepare to copy dense attributes - actual copy in post_copy */ /* Set copied metadata tag */ H5_BEGIN_TAG(dxpl_id, H5AC__COPIED_TAG, NULL); diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index 3d930f0..99f1322 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -921,7 +921,7 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size, size_t *new oh->chunk = x; } /* end if */ - chunkno = oh->nchunks++; + chunkno = (unsigned)oh->nchunks++; oh->chunk[chunkno].addr = new_chunk_addr; oh->chunk[chunkno].size = size; oh->chunk[chunkno].gap = 0; @@ -966,6 +966,8 @@ H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size, size_t *new oh->nmesgs--; } /* end if */ else { + HDassert(curr_msg->type->id != H5O_CONT_ID); + /* Copy the raw data */ HDmemcpy(p, curr_msg->raw - (size_t)H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh)); @@ -1544,13 +1546,13 @@ H5O_move_msgs_forward(H5F_t *f, hid_t dxpl_id, H5O_t *oh) if(H5O_CONT_ID == curr_msg->type->id) { htri_t status; /* Status from moving messages */ - if((status = H5O_move_cont(f, dxpl_id, oh, u)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "Error in moving messages into cont message") - else if(status > 0) { /* Message(s) got moved into "continuation" message */ + if((status = H5O_move_cont(f, dxpl_id, oh, u)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "Error in moving messages into cont message") + else if(status > 0) { /* Message(s) got moved into "continuation" message */ packed_msg = TRUE; - break; - } /* end else-if */ - } /* end if */ + break; + } /* end else-if */ + } /* end if */ /* Don't let locked messages be moved into earlier chunk */ if(!curr_msg->locked) { diff --git a/src/H5Ocache.c b/src/H5Ocache.c index f74966e..e085242 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -158,7 +158,6 @@ H5FL_SEQ_DEFINE(H5O_cont_t); /* Local Variables */ /*******************/ - /*------------------------------------------------------------------------- * Function: H5O__cache_get_load_size() diff --git a/src/H5Ochunk.c b/src/H5Ochunk.c index 8abe660..18561b3 100644 --- a/src/H5Ochunk.c +++ b/src/H5Ochunk.c @@ -95,7 +95,7 @@ H5FL_DEFINE(H5O_chunk_proxy_t); herr_t H5O_chunk_add(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx) { - H5O_chunk_proxy_t *chk_proxy = NULL; /* Proxy for chunk, to mark it dirty in the cache */ + H5O_chunk_proxy_t *chk_proxy = NULL; /* Proxy for chunk, to mark it dirty in the cache */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, oh->cache_info.addr, FAIL) @@ -121,6 +121,7 @@ H5O_chunk_add(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx) /* Insert the chunk proxy into the cache */ if(H5AC_insert_entry(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, chk_proxy, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header chunk") + chk_proxy = NULL; done: @@ -372,6 +373,7 @@ H5O_chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx) { H5O_chunk_proxy_t *chk_proxy; /* Proxy for chunk, to mark it dirty in the cache */ H5O_chk_cache_ud_t chk_udata; /* User data for loading chunk */ + unsigned cache_flags = H5AC__DELETED_FLAG; /* Flags for unprotecting proxy */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_TAG(dxpl_id, oh->cache_info.addr, FAIL) @@ -397,8 +399,10 @@ H5O_chunk_delete(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx) HDassert(chk_proxy->oh == oh); HDassert(chk_proxy->chunkno == idx); + cache_flags |= H5AC__DIRTIED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; + /* Release the chunk proxy from the cache, marking it deleted */ - if(H5AC_unprotect(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, chk_proxy, (H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG)) < 0) + if(H5AC_unprotect(f, dxpl_id, H5AC_OHDR_CHK, oh->chunk[idx].addr, chk_proxy, cache_flags) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header chunk") done: diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 4e8aafb..31ddb88 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -19,18 +19,18 @@ * Purpose: Messages related to data layout. */ -#define H5D_FRIEND /*suppress error about including H5Dpkg */ +#define H5D_FRIEND /*suppress error about including H5Dpkg */ #include "H5Omodule.h" /* This source code file is part of the H5O module */ -#include "H5private.h" /* Generic Functions */ -#include "H5Dpkg.h" /* Dataset functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ -#include "H5MFprivate.h" /* File space management */ -#include "H5MMprivate.h" /* Memory management */ -#include "H5Opkg.h" /* Object headers */ -#include "H5Pprivate.h" /* Property lists */ +#include "H5private.h" /* Generic Functions */ +#include "H5Dpkg.h" /* Dataset functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5MFprivate.h" /* File space management */ +#include "H5MMprivate.h" /* Memory management */ +#include "H5Opkg.h" /* Object headers */ +#include "H5Pprivate.h" /* Property lists */ /* Local macros */ @@ -52,31 +52,31 @@ static herr_t H5O__layout_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, static void *H5O__layout_copy_file(H5F_t *file_src, void *mesg_src, H5F_t *file_dst, hbool_t *recompute_size, unsigned *mesg_flags, H5O_copy_t *cpy_info, void *udata, hid_t dxpl_id); -static herr_t H5O__layout_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, - int indent, int fwidth); +static herr_t H5O__layout_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, + FILE * stream, int indent, int fwidth); /* This message derives from H5O message class */ const H5O_msg_class_t H5O_MSG_LAYOUT[1] = {{ - H5O_LAYOUT_ID, /*message id number */ - "layout", /*message name for debugging */ - sizeof(H5O_layout_t), /*native message size */ - 0, /* messages are sharable? */ - H5O__layout_decode, /*decode message */ - H5O__layout_encode, /*encode message */ - H5O__layout_copy, /*copy the native value */ - H5O__layout_size, /*size of message on disk */ - H5O__layout_reset, /*reset method */ - H5O__layout_free, /*free the struct */ - H5O__layout_delete, /* file delete method */ - NULL, /* link method */ - NULL, /*set share method */ - NULL, /*can share method */ - NULL, /* pre copy native value to file */ - H5O__layout_copy_file, /* copy native value to file */ - NULL, /* post copy native value to file */ - NULL, /* get creation index */ - NULL, /* set creation index */ - H5O__layout_debug /*debug the message */ + H5O_LAYOUT_ID, /* message id number */ + "layout", /* message name for debugging */ + sizeof(H5O_layout_t), /* native message size */ + 0, /* messages are sharable? */ + H5O__layout_decode, /* decode message */ + H5O__layout_encode, /* encode message */ + H5O__layout_copy, /* copy the native value */ + H5O__layout_size, /* size of message on disk */ + H5O__layout_reset, /* reset method */ + H5O__layout_free, /* free the struct */ + H5O__layout_delete, /* file delete method */ + NULL, /* link method */ + NULL, /* set share method */ + NULL, /* can share method */ + NULL, /* pre copy native value to file */ + H5O__layout_copy_file, /* copy native value to file */ + NULL, /* post copy native value to file */ + NULL, /* get creation index */ + NULL, /* set creation index */ + H5O__layout_debug /* debug the message */ }}; @@ -740,14 +740,14 @@ H5O__layout_size(const H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, const vo /*------------------------------------------------------------------------- - * Function: H5O__layout_reset + * Function: H5O__layout_reset * - * Purpose: Frees resources within a data type message, but doesn't free - * the message itself. + * Purpose: Frees resources within a data type message, but doesn't free + * the message itself. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Friday, September 13, 2002 * *------------------------------------------------------------------------- diff --git a/src/Makefile.am b/src/Makefile.am index d6a5909..9f748bf 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -126,7 +126,7 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers H5Cpublic.h H5Dpublic.h \ H5Epubgen.h H5Epublic.h H5Fpublic.h \ H5FDpublic.h H5FDcore.h H5FDdirect.h \ - H5FDfamily.h H5FDlog.h H5FDmpi.h H5FDmpio.h \ + H5FDfamily.h H5FDlog.h H5FDmpi.h H5FDmpio.h \ H5FDmulti.h H5FDsec2.h H5FDstdio.h \ H5Gpublic.h H5Ipublic.h H5Lpublic.h \ H5MMpublic.h H5Opublic.h H5Ppublic.h \ diff --git a/test/dsets.c b/test/dsets.c index a9cda93..2cb51d3 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -20,37 +20,34 @@ * Purpose: Tests the dataset interface (H5D) */ -#include -#include - -/* - * This file needs to access private information from the H5Z package. - */ -#define H5Z_FRIEND +#define H5D_FRIEND /*suppress error about including H5Dpkg */ +#define H5D_TESTING +#define H5Z_FRIEND /*suppress error about including H5Zpkg */ #include "h5test.h" #include "H5srcdir.h" +#include "H5Dpkg.h" #include "H5Zpkg.h" #ifdef H5_HAVE_SZLIB_H # include "szlib.h" #endif const char *FILENAME[] = { - "dataset", - "compact_dataset", - "dset_offset", - "max_compact_dataset", - "simple", - "set_local", - "random_chunks", - "huge_chunks", - "chunk_cache", - "big_chunk", - "chunk_expand", - "copy_dcpl_newfile", - "layout_extend", - "zero_chunk", + "dataset", /* 0 */ + "compact_dataset", /* 1 */ + "dset_offset", /* 2 */ + "max_compact_dataset", /* 3 */ + "simple", /* 4 */ + "set_local", /* 5 */ + "random_chunks", /* 6 */ + "huge_chunks", /* 7 */ + "chunk_cache", /* 8 */ + "big_chunk", /* 9 */ + "chunk_expand", /* 10 */ + "copy_dcpl_newfile",/* 11 */ + "layout_extend", /* 12 */ + "zero_chunk", /* 13 */ NULL }; #define FILENAME_BUF_SIZE 1024 diff --git a/test/earray.c b/test/earray.c index 46f2712..c3c7d3d 100644 --- a/test/earray.c +++ b/test/earray.c @@ -1529,296 +1529,6 @@ error: return 1; } /* test_delete_open() */ - -/*------------------------------------------------------------------------- - * Function: test_flush_depend_cb - * - * Purpose: Callback for flush dependency 'depend'/'undepend' and - * 'support'/'unsupport' routines - * - * Return: Success: 0 - * Failure: 1 - * - * Programmer: Quincey Koziol - * Tuesday, May 26, 2009 - * - *------------------------------------------------------------------------- - */ -static herr_t -test_flush_depend_cb(const void *_elmt, size_t nelmts, void *udata) -{ - earray_flush_depend_ctx_t *ctx = (earray_flush_depend_ctx_t *)udata; - const uint64_t *elmt = (const uint64_t *)_elmt; /* Convenience pointer to native elements */ - - /* Check for out of order flush */ - if(ctx->base_obj) - return(FAIL); - - /* Look for magic values */ - while(nelmts > 0) { - /* Check for elements of interest */ - if((uint64_t)0 == *elmt) { - /* Check for out-of-order flush */ - if(!ctx->idx0_obj) - return(FAIL); - - /* Indicate that the element was flushed */ - ctx->idx0_elem = TRUE; - } /* end if */ - else if((uint64_t)1 == *elmt) { - /* Check for out-of-order flush */ - if(!ctx->idx1_obj) - return(FAIL); - - /* Indicate that the element was flushed */ - ctx->idx1_elem = TRUE; - } /* end if */ - else if((uint64_t)10000 == *elmt) { - /* Check for out-of-order flush */ - if(!ctx->idx10000_obj) - return(FAIL); - - /* Indicate that the element was flushed */ - ctx->idx10000_elem = TRUE; - } /* end if */ - - /* Decrement elements left to inspect */ - nelmts--; - elmt++; - } /* end while */ - - return(SUCCEED); -} /* end test_flush_depend_cb() */ - - -/*------------------------------------------------------------------------- - * Function: test_flush_depend - * - * Purpose: Exercise flush dependency 'depend'/'undepend' routines - * - * Return: Success: 0 - * Failure: 1 - * - * Programmer: Quincey Koziol - * Thursday, May 21, 2009 - * - *------------------------------------------------------------------------- - */ -static unsigned -test_flush_depend(hid_t fapl, H5EA_create_t *cparam, earray_test_param_t H5_ATTR_UNUSED *tparam) -{ - hid_t file = -1; /* File ID */ - H5F_t *f = NULL; /* Internal file object pointer */ - H5EA_t *ea = NULL; /* Extensible array wrapper */ - haddr_t ea_addr = HADDR_UNDEF; /* Array address in file */ - H5EA__ctx_cb_t cb; /* Extensible array context action info */ - earray_flush_depend_ctx_t fd_info; /* Context information for flush depend test */ - haddr_t base_addr; /* Base test entry address */ - earray_test_t *base_entry; /* Pointer to base test entry */ - haddr_t addr1; /* Test entry #1 address */ - earray_test_t *entry1; /* Pointer to test entry #1 */ - haddr_t addr2; /* Test entry #2 address */ - earray_test_t *entry2; /* Pointer to test entry #2 */ - haddr_t addr3; /* Test entry #3 address */ - earray_test_t *entry3; /* Pointer to test entry #3 */ - uint64_t welmt; /* Element to write */ - hsize_t idx; /* Index value of element */ - - /* Create file & retrieve pointer to internal file object */ - if(create_file(H5F_ACC_TRUNC, fapl, &file, &f) < 0) - TEST_ERROR - - /* - * Display testing message - */ - TESTING("flush dependencies on array metadata"); - - /* Create array */ - cb.encode = test_flush_depend_cb; - HDmemset(&fd_info, 0, sizeof(earray_flush_depend_ctx_t)); - cb.udata = &fd_info; - if(create_array(f, H5AC_ind_read_dxpl_id, cparam, &ea, &ea_addr, &cb) < 0) - TEST_ERROR - - /* Verify the creation parameters */ - if(verify_cparam(ea, cparam) < 0) - TEST_ERROR - - /* Create base entry to insert */ - if(NULL == (base_entry = (earray_test_t *)HDmalloc(sizeof(earray_test_t)))) - TEST_ERROR - HDmemset(base_entry, 0, sizeof(earray_test_t)); - base_entry->idx = (uint64_t)-1; - base_entry->fd_info = &fd_info; - - /* Insert test entry into cache */ - base_addr = HADDR_MAX; - if(H5AC_insert_entry(f, H5AC_ind_read_dxpl_id, H5AC_EARRAY_TEST, base_addr, base_entry, H5AC__PIN_ENTRY_FLAG) < 0) - TEST_ERROR - - /* Set the base entry as a flush dependency for the array */ - if(H5EA_depend((H5AC_info_t *)base_entry, ea) < 0) - TEST_ERROR - - /* Create entry #1 to insert */ - if(NULL == (entry1 = (earray_test_t *)HDmalloc(sizeof(earray_test_t)))) - TEST_ERROR - HDmemset(entry1, 0, sizeof(earray_test_t)); - entry1->fd_info = &fd_info; - - /* Insert test entry into cache */ - addr1 = HADDR_MAX - 1; - if(H5AC_insert_entry(f, H5AC_ind_read_dxpl_id, H5AC_EARRAY_TEST, addr1, entry1, H5AC__PIN_ENTRY_FLAG) < 0) - TEST_ERROR - - /* Set the test entry as a flush dependency for 0th index in the array */ - if(H5EA_support(ea, H5AC_ind_read_dxpl_id, (hsize_t)0, (H5AC_info_t *)entry1) < 0) - TEST_ERROR - - /* Set element of array */ - welmt = (uint64_t)0; - idx = 0; - if(H5EA_set(ea, H5AC_ind_read_dxpl_id, idx, &welmt) < 0) - FAIL_STACK_ERROR - - /* Create entry #2 to insert */ - if(NULL == (entry2 = (earray_test_t *)HDmalloc(sizeof(earray_test_t)))) - TEST_ERROR - HDmemset(entry2, 0, sizeof(earray_test_t)); - entry2->idx = (uint64_t)1; - entry2->fd_info = &fd_info; - - /* Insert test entry into cache */ - addr2 = HADDR_MAX - 2; - if(H5AC_insert_entry(f, H5AC_ind_read_dxpl_id, H5AC_EARRAY_TEST, addr2, entry2, H5AC__PIN_ENTRY_FLAG) < 0) - TEST_ERROR - - /* Set the test entry as a flush dependency for 1st index in the array */ - if(H5EA_support(ea, H5AC_ind_read_dxpl_id, (hsize_t)1, (H5AC_info_t *)entry2) < 0) - TEST_ERROR - - /* Set element of array */ - welmt = (uint64_t)1; - idx = 1; - if(H5EA_set(ea, H5AC_ind_read_dxpl_id, idx, &welmt) < 0) - FAIL_STACK_ERROR - - /* Create entry #3 to insert */ - if(NULL == (entry3 = (earray_test_t *)HDmalloc(sizeof(earray_test_t)))) - TEST_ERROR - HDmemset(entry3, 0, sizeof(earray_test_t)); - entry3->idx = (uint64_t)10000; - entry3->fd_info = &fd_info; - - /* Insert test entry into cache */ - addr3 = HADDR_MAX - 3; - if(H5AC_insert_entry(f, H5AC_ind_read_dxpl_id, H5AC_EARRAY_TEST, addr3, entry3, H5AC__PIN_ENTRY_FLAG) < 0) - TEST_ERROR - - /* Set the test entry as a flush dependency for 10,000th index in the array */ - if(H5EA_support(ea, H5AC_ind_read_dxpl_id, (hsize_t)10000, (H5AC_info_t *)entry3) < 0) - TEST_ERROR - - /* Set element of array */ - welmt = (uint64_t)10000; - idx = 10000; - if(H5EA_set(ea, H5AC_ind_read_dxpl_id, idx, &welmt) < 0) - FAIL_STACK_ERROR - - - /* Flush the cache */ - if(H5Fflush(file, H5F_SCOPE_GLOBAL) < 0) - TEST_ERROR - - /* Check that all callback flags have been set */ - if(!fd_info.base_obj) - TEST_ERROR - if(!fd_info.idx0_obj) - TEST_ERROR - if(!fd_info.idx0_elem) - TEST_ERROR - if(!fd_info.idx1_obj) - TEST_ERROR - if(!fd_info.idx1_elem) - TEST_ERROR - if(!fd_info.idx10000_obj) - TEST_ERROR - if(!fd_info.idx10000_elem) - TEST_ERROR - - - /* Remove the base entry as a flush dependency for the array */ - if(H5EA_undepend((H5AC_info_t *)base_entry, ea) < 0) - TEST_ERROR - - /* Protect the base entry */ - if(NULL == (base_entry = (earray_test_t *)H5AC_protect(f, H5AC_ind_read_dxpl_id, H5AC_EARRAY_TEST, base_addr, NULL, H5AC__NO_FLAGS_SET))) - TEST_ERROR - - /* Unprotect & unpin the base entry */ - if(H5AC_unprotect(f, H5AC_ind_read_dxpl_id, H5AC_EARRAY_TEST, base_addr, base_entry, (H5AC__UNPIN_ENTRY_FLAG | H5AC__DELETED_FLAG)) < 0) - TEST_ERROR - - /* Remove the test entry as a flush dependency for 0th index in the array */ - if(H5EA_unsupport(ea, H5AC_ind_read_dxpl_id, (hsize_t)0, (H5AC_info_t *)entry1) < 0) - TEST_ERROR - - /* Protect the test entry */ - if(NULL == (entry1 = (earray_test_t *)H5AC_protect(f, H5AC_ind_read_dxpl_id, H5AC_EARRAY_TEST, addr1, NULL, H5AC__NO_FLAGS_SET))) - TEST_ERROR - - /* Unprotect & unpin the test entry */ - if(H5AC_unprotect(f, H5AC_ind_read_dxpl_id, H5AC_EARRAY_TEST, addr1, entry1, (H5AC__UNPIN_ENTRY_FLAG | H5AC__DELETED_FLAG)) < 0) - TEST_ERROR - - /* Remove the test entry as a flush dependency for 1st index in the array */ - if(H5EA_unsupport(ea, H5AC_ind_read_dxpl_id, (hsize_t)1, (H5AC_info_t *)entry2) < 0) - TEST_ERROR - - /* Protect the test entry */ - if(NULL == (entry2 = (earray_test_t *)H5AC_protect(f, H5AC_ind_read_dxpl_id, H5AC_EARRAY_TEST, addr2, NULL, H5AC__NO_FLAGS_SET))) - TEST_ERROR - - /* Unprotect & unpin the test entry */ - if(H5AC_unprotect(f, H5AC_ind_read_dxpl_id, H5AC_EARRAY_TEST, addr2, entry2, (H5AC__UNPIN_ENTRY_FLAG | H5AC__DELETED_FLAG)) < 0) - TEST_ERROR - - /* Remove the test entry as a flush dependency for 10,000th index in the array */ - if(H5EA_unsupport(ea, H5AC_ind_read_dxpl_id, (hsize_t)10000, (H5AC_info_t *)entry3) < 0) - TEST_ERROR - - /* Protect the test entry */ - if(NULL == (entry3 = (earray_test_t *)H5AC_protect(f, H5AC_ind_read_dxpl_id, H5AC_EARRAY_TEST, addr3, NULL, H5AC__NO_FLAGS_SET))) - TEST_ERROR - - /* Unprotect & unpin the test entry */ - if(H5AC_unprotect(f, H5AC_ind_read_dxpl_id, H5AC_EARRAY_TEST, addr3, entry3, (H5AC__UNPIN_ENTRY_FLAG | H5AC__DELETED_FLAG)) < 0) - TEST_ERROR - - /* Close the extensible array */ - if(H5EA_close(ea, H5AC_ind_read_dxpl_id) < 0) - FAIL_STACK_ERROR - ea = NULL; - - /* Close the file */ - if(H5Fclose(file) < 0) - FAIL_STACK_ERROR - - /* All tests passed */ - PASSED() - - return 0; - -error: - H5E_BEGIN_TRY { - if(ea) - H5EA_close(ea, H5AC_ind_read_dxpl_id); - H5Fclose(file); - } H5E_END_TRY; - - return 1; -} /* test_flush_depend() */ - /* Extensible array iterator info for forward iteration */ typedef struct eiter_fw_t { hsize_t idx; /* Index of next array location */ @@ -3066,7 +2776,6 @@ main(void) nerrors += test_open_twice(fapl, &cparam, &tparam); nerrors += test_open_twice_diff(fapl, &cparam, &tparam); nerrors += test_delete_open(fapl, &cparam, &tparam); - nerrors += test_flush_depend(fapl, &cparam, &tparam); /* Iterate over the type of capacity tests */ for(curr_iter = EARRAY_ITER_FW; curr_iter < EARRAY_ITER_NITERS; H5_INC_ENUM(earray_iter_type_t, curr_iter)) { @@ -3160,7 +2869,7 @@ main(void) if(nerrors) goto error; - puts("All extensible array tests passed."); + HDputs("All extensible array tests passed."); /* Clean up file used */ h5_cleanup(FILENAME, fapl); @@ -3168,10 +2877,10 @@ main(void) return 0; error: - puts("*** TESTS FAILED ***"); + HDputs("*** TESTS FAILED ***"); H5E_BEGIN_TRY { - H5Pclose(fapl); + H5Pclose(fapl); } H5E_END_TRY; return 1; diff --git a/test/gen_plist.c b/test/gen_plist.c index f071733..b45eeeb 100644 --- a/test/gen_plist.c +++ b/test/gen_plist.c @@ -34,7 +34,7 @@ main(void) hid_t dapl1; /* dataset access prop. list */ hid_t dxpl1; /* dataset xfer prop. list */ hid_t gcpl1; /* group create prop. list */ - hid_t ocpypl1; /* object copy prop. list */ + hid_t ocpypl1; /* object copy prop. list */ hid_t ocpl1; /* object create prop. list */ hid_t lcpl1; /* link create prop. list */ hid_t lapl1; /* link access prop. list */ diff --git a/test/h5test.c b/test/h5test.c index c010adc..8285043 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -1557,8 +1557,6 @@ getenv_all(MPI_Comm comm, int root, const char* name) * Programmer: Larry Knox * Monday, October 13, 2009 * - * Modifications: - * *------------------------------------------------------------------------- */ int @@ -1570,20 +1568,22 @@ h5_make_local_copy(const char *origfilename, const char *local_copy_name) const char *filename = H5_get_srcdir_filename(origfilename);; /* Get the test file name to copy */ /* Copy old file into temporary file */ - if((fd_old = HDopen(filename, O_RDONLY, 0666)) < 0) return -1; - if((fd_new = HDopen(local_copy_name, O_RDWR|O_CREAT|O_TRUNC, 0666)) - < 0) return -1; + if((fd_old = HDopen(filename, O_RDONLY, 0666)) < 0) + return -1; + if((fd_new = HDopen(local_copy_name, O_RDWR|O_CREAT|O_TRUNC, 0666)) < 0) + return -1; /* Copy data */ while((nread = HDread(fd_old, buf, (size_t)READ_BUF_SIZE)) > 0) - HDwrite(fd_new, buf, (size_t)nread); + if(HDwrite(fd_new, buf, (size_t)nread) < 0) + return -1; /* Close files */ if(HDclose(fd_old) < 0) return -1; if(HDclose(fd_new) < 0) return -1; return 0; -} +} /* end h5_make_local_copy() */ /*------------------------------------------------------------------------- -- cgit v0.12 From caf3b0db1486e35d237181ae50b189d6fca5f417 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 23 Mar 2016 23:27:14 -0500 Subject: [svn-r29549] Minor normalization w/ revise_chunks in preparation for big merge. Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 autotools serial autotools parallel (MPICH 3.1.4) --- src/H5Dchunk.c | 2 +- src/H5Dcontig.c | 2 +- src/H5Dpkg.h | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index a17e035..d8e8eb5 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -4316,7 +4316,7 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) * Note that we only need to set scaled once, as the array's address * will never change. */ chk_store.chunk.scaled = scaled; - H5D_BUILD_IO_INFO_RD(&chk_io_info, dset, dxpl_cache, dxpl_id, &chk_store, NULL); + H5D_BUILD_IO_INFO_RD(&chk_io_info, dset, dxpl_cache, dxpl_id, H5AC_rawdata_dxpl_id, &chk_store, NULL); chk_io_info.raw_dxpl_id = H5AC_rawdata_dxpl_id; /* Compose chunked index info struct */ diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index c75ae43..a24abe6 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -270,7 +270,7 @@ H5D__contig_fill(const H5D_io_info_t *io_info) offset = 0; /* Simple setup for dataset I/O info struct */ - H5D_BUILD_IO_INFO_WRT(&ioinfo, dset, dxpl_cache, raw_dxpl_id, &store, fb_info.fill_buf); + H5D_BUILD_IO_INFO_WRT(&ioinfo, dset, dxpl_cache, H5AC_ind_read_dxpl_id, raw_dxpl_id, &store, fb_info.fill_buf); /* * Fill the entire current extent with the fill value. We can do diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 2629008..eabefc4 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -46,19 +46,19 @@ #define H5D_MINHDR_SIZE 256 /* [Simple] Macro to construct a H5D_io_info_t from it's components */ -#define H5D_BUILD_IO_INFO_WRT(io_info, ds, dxpl_c, dxpl_i, str, buf) \ +#define H5D_BUILD_IO_INFO_WRT(io_info, ds, dxpl_c, dxpl_m, dxpl_r, str, buf) \ (io_info)->dset = ds; \ (io_info)->dxpl_cache = dxpl_c; \ - (io_info)->raw_dxpl_id = dxpl_i; \ - (io_info)->md_dxpl_id = dxpl_i; \ + (io_info)->raw_dxpl_id = dxpl_r; \ + (io_info)->md_dxpl_id = dxpl_m; \ (io_info)->store = str; \ (io_info)->op_type = H5D_IO_OP_WRITE; \ (io_info)->u.wbuf = buf -#define H5D_BUILD_IO_INFO_RD(io_info, ds, dxpl_c, dxpl_i, str, buf) \ +#define H5D_BUILD_IO_INFO_RD(io_info, ds, dxpl_c, dxpl_m, dxpl_r, str, buf) \ (io_info)->dset = ds; \ (io_info)->dxpl_cache = dxpl_c; \ - (io_info)->raw_dxpl_id = dxpl_i; \ - (io_info)->md_dxpl_id = dxpl_i; \ + (io_info)->raw_dxpl_id = dxpl_r; \ + (io_info)->md_dxpl_id = dxpl_m; \ (io_info)->store = str; \ (io_info)->op_type = H5D_IO_OP_READ; \ (io_info)->u.rbuf = buf -- cgit v0.12 From 53a286f7dad9343ee174bc83d8e39bb0e107daa7 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 24 Mar 2016 00:19:52 -0500 Subject: [svn-r29552] Normalization with revise_chunks in preparation for big merge. Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 autotools serial --- src/H5Oainfo.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/H5Oainfo.c b/src/H5Oainfo.c index ab26c17..44c6611 100644 --- a/src/H5Oainfo.c +++ b/src/H5Oainfo.c @@ -324,7 +324,9 @@ H5O_ainfo_free(void *mesg) /*------------------------------------------------------------------------- * Function: H5O_ainfo_delete * - * Purpose: Free file space referenced by message + * Purpose: Free file space referenced by message. Note that open_oh + * *must* be non-NULL - this means that calls to + * H5O_msg_delete must include an oh if the type is ainfo. * * Return: Non-negative on success/Negative on failure * @@ -334,7 +336,7 @@ H5O_ainfo_free(void *mesg) *------------------------------------------------------------------------- */ static herr_t -H5O_ainfo_delete(H5F_t *f, hid_t dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh, void *_mesg) +H5O_ainfo_delete(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg) { H5O_ainfo_t *ainfo = (H5O_ainfo_t *)_mesg; herr_t ret_value = SUCCEED; /* Return value */ @@ -344,6 +346,7 @@ H5O_ainfo_delete(H5F_t *f, hid_t dxpl_id, H5O_t H5_ATTR_UNUSED *open_oh, void *_ /* check args */ HDassert(f); HDassert(ainfo); + HDassert(open_oh); /* If the object is using "dense" attribute storage, delete it */ if(H5F_addr_defined(ainfo->fheap_addr)) { -- cgit v0.12 From eb66e7537cbca257e1c3c5bbfe137a979601ae32 Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Thu, 24 Mar 2016 10:01:41 -0500 Subject: [svn-r29554] Description: Removed an extra line in the Copyright block. No need to test. --- hl/test/test_packet_vlen.c | 1 - 1 file changed, 1 deletion(-) diff --git a/hl/test/test_packet_vlen.c b/hl/test/test_packet_vlen.c index b3b2fce..82c8d1c 100644 --- a/hl/test/test_packet_vlen.c +++ b/hl/test/test_packet_vlen.c @@ -1,6 +1,5 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * * This file is part of HDF5. The full HDF5 copyright notice, including * -- cgit v0.12 From d9ab44fe466197b8dd89aa4dcf4dbdd00ea4b8c2 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 24 Mar 2016 10:59:00 -0500 Subject: [svn-r29557] Add comments to CMake macros and do append error file revise_chunks rev 29556 --- config/cmake/jrunTest.cmake | 48 +++++++++++++++++++++++--------------- config/cmake_ext_mod/runTest.cmake | 28 +++++++++++++++------- java/test/CMakeLists.txt | 2 +- 3 files changed, 50 insertions(+), 28 deletions(-) diff --git a/config/cmake/jrunTest.cmake b/config/cmake/jrunTest.cmake index 7a92867..59f4c7b 100644 --- a/config/cmake/jrunTest.cmake +++ b/config/cmake/jrunTest.cmake @@ -26,7 +26,10 @@ if (NOT TEST_REFERENCE) endif (NOT TEST_REFERENCE) if (NOT TEST_ERRREF) - set (ERROR_APPEND 1) + if (NOT SKIP_APPEND) + # append error file since skip was not defined + set (ERROR_APPEND 1) + endif(NOT SKIP_APPEND) endif (NOT TEST_ERRREF) if (NOT TEST_LOG_LEVEL) @@ -60,30 +63,35 @@ message (STATUS "COMMAND Result: ${TEST_RESULT}") if (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) if (TEST_MASK_FILE) - STRING(REGEX REPLACE "CurrentDir is [^\n]+\n" "CurrentDir is (dir name)\n" TEST_STREAM "${TEST_STREAM}") + STRING(REGEX REPLACE "CurrentDir is [^\n]+\n" "CurrentDir is (dir name)\n" TEST_STREAM "${TEST_STREAM}") endif (TEST_MASK_FILE) - if (ERROR_APPEND) - file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") - else (ERROR_APPEND) + if (NOT ERROR_APPEND) + # append error output to the stdout output file file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT}.err "${TEST_STREAM}") - endif (ERROR_APPEND) + else (NOT ERROR_APPEND) + # write back to original .err file + file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") + endif (NOT ERROR_APPEND) endif (EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) if (TEST_MASK_ERROR) if (NOT TEST_ERRREF) + # the error stack has been appended to the output file file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) else (NOT TEST_ERRREF) + # the error stack remains in the .err file file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) endif (NOT TEST_ERRREF) - string (REGEX REPLACE "Time:[^\n]+\n" "Time: XXXX\n" TEST_STREAM "${TEST_STREAM}") - string (REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}") - string (REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}") - string (REGEX REPLACE " line [0-9]*" " line (number)" TEST_STREAM "${TEST_STREAM}") - #string (REGEX REPLACE "v[1-9]*[.][0-9]*[.]" "version (number)." TEST_STREAM "${TEST_STREAM}") - string (REGEX REPLACE "HDF5 .[1-9]*[.][0-9]*[.][0-9]*[^)]*" "HDF5 (version (number)" TEST_STREAM "${TEST_STREAM}") - string (REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") - string (REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "Time:[^\n]+\n" "Time: XXXX\n" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE " line [0-9]*" " line (number)" TEST_STREAM "${TEST_STREAM}") + #string (REGEX REPLACE "v[1-9]*[.][0-9]*[.]" "version (number)." TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "HDF5 .[1-9]*[.][0-9]*[.][0-9]*[^)]*" "HDF5 (version (number)" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") + # write back the changes to the original files if (NOT TEST_ERRREF) file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") else (NOT TEST_ERRREF) @@ -99,6 +107,7 @@ endif (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) message (STATUS "COMMAND Error: ${TEST_ERROR}") +# compare output files to references unless this must be skipped if (NOT TEST_SKIP_COMPARE) if (WIN32 AND NOT MINGW) file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) @@ -140,7 +149,8 @@ if (NOT TEST_SKIP_COMPARE) if (NOT ${TEST_RESULT} STREQUAL 0) message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") endif (NOT ${TEST_RESULT} STREQUAL 0) - + + # now compare the .err file with the error reference, if supplied if (TEST_ERRREF) if (WIN32 AND NOT MINGW) file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) @@ -191,16 +201,16 @@ if (TEST_GREP_COMPARE) file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) # TEST_REFERENCE should always be matched - string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM}) - string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT) + string (REGEX MATCH "${TEST_REFERENCE}" TEST_MATCH ${TEST_STREAM}) + string (COMPARE EQUAL "${TEST_REFERENCE}" "${TEST_MATCH}" TEST_RESULT) if (${TEST_RESULT} STREQUAL "0") message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did not contain ${TEST_REFERENCE}") endif (${TEST_RESULT} STREQUAL "0") - string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) + string (REGEX MATCH "${TEST_FILTER}" TEST_MATCH ${TEST_STREAM}) if (${TEST_EXPECT} STREQUAL "1") # TEST_EXPECT (1) interperts TEST_FILTER as NOT to match - string (LENGTH "${TEST_MATCH}" TEST_RESULT) + string (LENGTH "${TEST_MATCH}" TEST_RESULT) if (NOT ${TEST_RESULT} STREQUAL "0") message (FATAL_ERROR "Failed: The output of ${TEST_PROGRAM} did contain ${TEST_FILTER}") endif (NOT ${TEST_RESULT} STREQUAL "0") diff --git a/config/cmake_ext_mod/runTest.cmake b/config/cmake_ext_mod/runTest.cmake index 3b7d949..21a65e6 100644 --- a/config/cmake_ext_mod/runTest.cmake +++ b/config/cmake_ext_mod/runTest.cmake @@ -25,6 +25,7 @@ if (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE) message (FATAL_ERROR "Require TEST_REFERENCE to be defined") endif (NOT TEST_SKIP_COMPARE AND NOT TEST_REFERENCE) +# if there is not an error reference file add the error output to the stdout file if (NOT TEST_ERRREF) set (ERROR_APPEND 1) endif (NOT TEST_ERRREF) @@ -62,11 +63,13 @@ endif (NOT TEST_INPUT) message (STATUS "COMMAND Result: ${TEST_RESULT}") +# if the .err file exists and ERRROR_APPEND is enabled if (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") endif (ERROR_APPEND AND EXISTS ${TEST_FOLDER}/${TEST_OUTPUT}.err) +# append the test result status with a predefined text if (TEST_APPEND) file (APPEND ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_APPEND} ${TEST_RESULT}\n") endif (TEST_APPEND) @@ -78,31 +81,37 @@ endif (NOT ${TEST_RESULT} STREQUAL ${TEST_EXPECT}) message (STATUS "COMMAND Error: ${TEST_ERROR}") +# if the output file needs Storage text removed if (TEST_MASK) file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) string (REGEX REPLACE "Storage:[^\n]+\n" "Storage:
\n" TEST_STREAM "${TEST_STREAM}") file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") endif (TEST_MASK) +# if the output file needs Modified text removed if (TEST_MASK_MOD) file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) string (REGEX REPLACE "Modified:[^\n]+\n" "Modified: XXXX-XX-XX XX:XX:XX XXX\n" TEST_STREAM "${TEST_STREAM}") file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") endif (TEST_MASK_MOD) +# if the output file or the .err file needs to mask out error stack info if (TEST_MASK_ERROR) if (NOT TEST_ERRREF) + # the error stack has been appended to the output file file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) else () + # the error stack remains in the .err file file (READ ${TEST_FOLDER}/${TEST_OUTPUT}.err TEST_STREAM) endif () - string (REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}") - string (REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}") - string (REGEX REPLACE " line [0-9]*" " line (number)" TEST_STREAM "${TEST_STREAM}") - string (REGEX REPLACE "v[1-9]*[.][0-9]*[.]" "version (number)." TEST_STREAM "${TEST_STREAM}") - string (REGEX REPLACE "[1-9]*[.][0-9]*[.][0-9]*[^)]*" "version (number)" TEST_STREAM "${TEST_STREAM}") - string (REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") - string (REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "thread [0-9]*:" "thread (IDs):" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE ": ([^\n]*)[.]c " ": (file name) " TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE " line [0-9]*" " line (number)" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "v[1-9]*[.][0-9]*[.]" "version (number)." TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "[1-9]*[.][0-9]*[.][0-9]*[^)]*" "version (number)" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "H5Eget_auto[1-2]*" "H5Eget_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "H5Eset_auto[1-2]*" "H5Eset_auto(1 or 2)" TEST_STREAM "${TEST_STREAM}") + # write back the changes to the original files if (NOT TEST_ERRREF) file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") else () @@ -110,12 +119,14 @@ if (TEST_MASK_ERROR) endif () endif (TEST_MASK_ERROR) +# remove text from the output file if (TEST_FILTER) file (READ ${TEST_FOLDER}/${TEST_OUTPUT} TEST_STREAM) - string (REGEX REPLACE "${TEST_FILTER}" "" TEST_STREAM "${TEST_STREAM}") + string (REGEX REPLACE "${TEST_FILTER}" "" TEST_STREAM "${TEST_STREAM}") file (WRITE ${TEST_FOLDER}/${TEST_OUTPUT} "${TEST_STREAM}") endif (TEST_FILTER) +# compare output files to references unless this must be skipped if (NOT TEST_SKIP_COMPARE) if (WIN32 AND NOT MINGW) file (READ ${TEST_FOLDER}/${TEST_REFERENCE} TEST_STREAM) @@ -158,6 +169,7 @@ if (NOT TEST_SKIP_COMPARE) message (FATAL_ERROR "Failed: The output of ${TEST_OUTPUT} did not match ${TEST_REFERENCE}") endif (NOT ${TEST_RESULT} STREQUAL 0) + # now compare the .err file with the error reference, if supplied if (TEST_ERRREF) if (WIN32 AND NOT MINGW) file (READ ${TEST_FOLDER}/${TEST_ERRREF} TEST_STREAM) diff --git a/java/test/CMakeLists.txt b/java/test/CMakeLists.txt index 4e20d89..4ee059d 100644 --- a/java/test/CMakeLists.txt +++ b/java/test/CMakeLists.txt @@ -120,9 +120,9 @@ add_test ( -D "TEST_LIBRARY_DIRECTORY=${CMAKE_TEST_OUTPUT_DIRECTORY}" -D "TEST_FOLDER=${HDF5_BINARY_DIR}/java/test" -D "TEST_OUTPUT=JUnit-interface.out" - -D "TEST_ERRREF=JUnit-interface.ert" # -D "TEST_LOG_LEVEL=trace" -D "TEST_EXPECT=0" + -D "SKIP_APPEND=1" -D "TEST_MASK_ERROR=TRUE" -D "TEST_FILTER:STRING=${testfilter}" -D "TEST_REFERENCE=JUnit-interface.txt" -- cgit v0.12 From 261f8c83611db7b19f3a697720926d825b375a1d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 24 Mar 2016 12:21:04 -0500 Subject: [svn-r29560] Remove list and check of flags, defer to library function for checking, which will return an error. That error then produces a HDF5FunctionArgument exception instead of IllegalArgument exception. --- java/src/jni/h5pImp.c | 14 ++++---------- java/test/TestH5P.java | 5 +++-- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/java/src/jni/h5pImp.c b/java/src/jni/h5pImp.c index d542902..ab39739 100644 --- a/java/src/jni/h5pImp.c +++ b/java/src/jni/h5pImp.c @@ -2965,16 +2965,10 @@ Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags(JNIEnv *env, jclass clss, jlong la { herr_t retVal = -1; - if (((unsigned) flags != H5F_ACC_RDWR) && - ((unsigned) flags != H5F_ACC_RDONLY) && - ((unsigned) flags != H5F_ACC_DEFAULT)) { - h5badArgument(env, "H5Pset_elink_acc_flags: invalid flags value"); - } /* end if */ - else { - retVal = H5Pset_elink_acc_flags((hid_t)lapl_id, (unsigned)flags); - if (retVal < 0) - h5libraryError(env); - } /* end else */ + retVal = H5Pset_elink_acc_flags((hid_t)lapl_id, (unsigned)flags); + if (retVal < 0) + h5libraryError(env); + return (jint) retVal; } /* end Java_hdf_hdf5lib_H5_H5Pset_1elink_1acc_1flags */ diff --git a/java/test/TestH5P.java b/java/test/TestH5P.java index 2a0fc34..b8a4376 100644 --- a/java/test/TestH5P.java +++ b/java/test/TestH5P.java @@ -25,6 +25,7 @@ import java.io.File; import hdf.hdf5lib.H5; import hdf.hdf5lib.HDF5Constants; import hdf.hdf5lib.exceptions.HDF5Exception; +import hdf.hdf5lib.exceptions.HDF5FunctionArgumentException; import hdf.hdf5lib.exceptions.HDF5LibraryException; import org.junit.After; @@ -496,12 +497,12 @@ public class TestH5P { assertEquals(HDF5Constants.H5F_ACC_RDWR, get_flags); } - @Test(expected = IllegalArgumentException.class) + @Test(expected = HDF5FunctionArgumentException.class) public void testH5Pset_elink_acc_flags_InvalidFlag1() throws Throwable { H5.H5Pset_elink_acc_flags(lapl_id, HDF5Constants.H5F_ACC_TRUNC); } - @Test(expected = IllegalArgumentException.class) + @Test(expected = HDF5FunctionArgumentException.class) public void testH5Pset_elink_acc_flags_InvalidFlag2() throws Throwable { H5.H5Pset_elink_acc_flags(lapl_id, -1); } -- cgit v0.12 From 6b21276650e7ffb00c516bafb53e7b646df29c83 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Tue, 29 Mar 2016 09:46:58 -0500 Subject: [svn-r29591] Changed buf variable in h5awrite_f from INOUT to IN --- fortran/src/H5_buildiface.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fortran/src/H5_buildiface.F90 b/fortran/src/H5_buildiface.F90 index bd6ecc3..4b00d80 100644 --- a/fortran/src/H5_buildiface.F90 +++ b/fortran/src/H5_buildiface.F90 @@ -397,7 +397,7 @@ PROGRAM H5_buildiface WRITE(11,'(A)') ' INTEGER(HID_T) , INTENT(IN) :: attr_id' WRITE(11,'(A)') ' INTEGER(HID_T) , INTENT(IN) :: memtype_id' WRITE(11,'(A)') ' INTEGER(HSIZE_T) , INTENT(IN), DIMENSION(*) :: dims' - WRITE(11,'(A)') ' INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(INOUT)'//TRIM(rank_dim_line(j))//', TARGET :: buf' + WRITE(11,'(A)') ' INTEGER(KIND='//TRIM(ADJUSTL(chr2))//'),INTENT(IN)'//TRIM(rank_dim_line(j))//', TARGET :: buf' WRITE(11,'(A)') ' INTEGER , INTENT(OUT) :: hdferr' WRITE(11,'(A)') ' TYPE(C_PTR) :: f_ptr' -- cgit v0.12 From 018f92063e4b736819a1b11db0bdfcb684bcc2f4 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Wed, 30 Mar 2016 14:11:41 -0500 Subject: [svn-r29599] added comments to source --- hl/fortran/src/H5LTff.F90 | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/hl/fortran/src/H5LTff.F90 b/hl/fortran/src/H5LTff.F90 index d36d92c..18c36f0 100644 --- a/hl/fortran/src/H5LTff.F90 +++ b/hl/fortran/src/H5LTff.F90 @@ -110,7 +110,7 @@ MODULE H5LT_CONST CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: dtype ! flag indicating the datatype of the ! the buffer: ! R=Real, D=DOUBLE, I=Interger - INTEGER(size_t) :: SizeOf_buf ! Sizeof the buf datatype + INTEGER(size_t), INTENT(in) :: SizeOf_buf ! Sizeof the buf data type END FUNCTION h5ltget_attribute_c END INTERFACE @@ -1059,14 +1059,16 @@ CONTAINS CHARACTER(LEN=*), INTENT(in) :: dset_name ! name of the dataset CHARACTER(LEN=*), INTENT(in) :: attr_name ! name of the attribute TYPE(C_PTR) :: buf ! data buffer - CHARACTER(LEN=*), INTENT(in) :: buf_type ! + CHARACTER(LEN=*), INTENT(in) :: buf_type ! valid data types are: + ! CHARACTER, INTEGER or REAL + ! NOTE: only the first character matters and is case insensitive INTEGER(size_t), INTENT(in) :: size ! size of attribute array - INTEGER :: errcode ! error code - INTEGER(size_t) :: namelen ! name length - INTEGER(size_t) :: attrlen ! name length + INTEGER(size_t), INTENT(in) :: SizeOf_buf_type ! size of buf's data type + INTEGER, INTENT(out) :: errcode ! error code - CHARACTER(KIND=C_CHAR) :: buf_type_uppercase - INTEGER(size_t) :: SizeOf_buf_type + INTEGER(size_t) :: namelen ! name length + INTEGER(size_t) :: attrlen ! name length + CHARACTER(KIND=C_CHAR) :: buf_type_uppercase namelen = LEN(dset_name) attrlen = LEN(attr_name) @@ -1316,13 +1318,15 @@ CONTAINS INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier CHARACTER(LEN=*), INTENT(in) :: dset_name ! name of the dataset CHARACTER(LEN=*), INTENT(in) :: attr_name ! name of the attribute - INTEGER, INTENT(out) :: errcode ! error code - CHARACTER(LEN=*), INTENT(in) :: buf_type - TYPE(C_PTR) :: buf! data buffer + TYPE(C_PTR) :: buf ! data buffer + CHARACTER(LEN=*), INTENT(in) :: buf_type ! valid data types are: + ! CHARACTER, INTEGER or REAL + ! NOTE: only the first character matters and is case insensitive + INTEGER(size_t), INTENT(in) :: SizeOf_buf_type ! size of buf's data type + INTEGER, INTENT(out) :: errcode ! error code INTEGER(size_t) :: namelen ! name length - INTEGER(size_t) :: attrlen ! name length + INTEGER(size_t) :: attrlen ! attr length CHARACTER(KIND=C_CHAR) :: buf_type_uppercase - INTEGER(size_t) :: SizeOf_buf_type namelen = LEN(dset_name) attrlen = LEN(attr_name) -- cgit v0.12 From 8e41b14811129b60914b0db51c34e76e1fb0b7e7 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 31 Mar 2016 09:02:24 -0500 Subject: [svn-r29601] Cleanup case of CMake commands in tools. Update CTestCustom file for new tests. Add connection from HDF5_ENABLE_USING_MEMCHECKER cmake option to library define USING_MEMCHECKER. --- CMakeInstallation.cmake | 1 + config/cmake/CTestCustom.cmake | 1 + config/cmake/ConfigureChecks.cmake | 5 ++++- java/test/junit.sh.in | 20 ++++++++++++++------ tools/h5copy/CMakeTests.cmake | 2 +- tools/h5diff/CMakeTests.cmake | 6 ++++-- tools/h5dump/CMakeTests.cmake | 5 +++-- tools/h5dump/CMakeTestsPBITS.cmake | 6 +++--- tools/h5dump/CMakeTestsVDS.cmake | 10 +++++----- tools/h5dump/CMakeTestsXML.cmake | 4 ++-- tools/h5ls/CMakeTests.cmake | 2 +- tools/h5ls/CMakeTestsVDS.cmake | 2 +- tools/h5repack/CMakeTests.cmake | 2 +- 13 files changed, 41 insertions(+), 25 deletions(-) diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index bb5f046..8dcaf85 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -530,6 +530,7 @@ The HDF5 data model, file format, API, library, and tools are open and distribut ) cpack_add_component (configinstall DISPLAY_NAME "HDF5 CMake files" + HIDDEN DEPENDS libraries GROUP Development INSTALL_TYPES Full Developer User diff --git a/config/cmake/CTestCustom.cmake b/config/cmake/CTestCustom.cmake index 41cb488..85f7d27 100644 --- a/config/cmake/CTestCustom.cmake +++ b/config/cmake/CTestCustom.cmake @@ -46,6 +46,7 @@ set (CTEST_CUSTOM_MEMCHECK_IGNORE H5DUMP-clearall-objects H5DUMP_PACKED_BITS-clearall-objects H5DUMP-XML-clearall-objects + H5DUMP_VDS-clearall-objects ######### tools/h5import ######### H5IMPORT-clear-objects ######### tools/h5jam ######### diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 49e9a05..ec0aecf 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -3,7 +3,10 @@ #----------------------------------------------------------------------------- set (HDF_PREFIX "H5") include (${HDF_RESOURCES_EXT_DIR}/ConfigureChecks.cmake) -include (${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake) + +if (HDF5_ENABLE_USING_MEMCHECKER) + set (H5_USING_MEMCHECKER 1) +endif (HDF5_ENABLE_USING_MEMCHECKER) #----------------------------------------------------------------------------- # Option for --enable-strict-format-checks diff --git a/java/test/junit.sh.in b/java/test/junit.sh.in index 698dc5d..f37703a 100644 --- a/java/test/junit.sh.in +++ b/java/test/junit.sh.in @@ -34,6 +34,9 @@ AWK='awk' nerrors=0 verbose=yes +# setup my machine information. +myos=`uname -s` + # where the libs exist HDFLIB_HOME="$top_srcdir/java/lib" BLDLIBDIR="$top_builddir/java/lib" @@ -231,13 +234,18 @@ sed -e 's/thread [0-9]*/thread (IDs)/' -e 's/: .*\.c /: (file name) /' \ -e 's/[1-9]*\.[0-9]*\.[0-9]*[^)]*/version (number)/' \ $actual_ext > $actual -if $CMP $expect $actual; then - echo " PASSED" +# SunOS does not support this. Skip it. +if [ $myos = SunOS ]; then + echo " SKIPPED" else - echo "*FAILED*" - echo " Expected result differs from actual result" - nerrors="`expr $nerrors + 1`" - test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + if $CMP $expect $actual; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result differs from actual result" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $expect $actual |sed 's/^/ /' + fi fi diff --git a/tools/h5copy/CMakeTests.cmake b/tools/h5copy/CMakeTests.cmake index 9002e5a..4ef49ee 100644 --- a/tools/h5copy/CMakeTests.cmake +++ b/tools/h5copy/CMakeTests.cmake @@ -22,7 +22,7 @@ file (MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") foreach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) - GET_FILENAME_COMPONENT(fname "${listfiles}" NAME) + get_filename_component(fname "${listfiles}" NAME) set (dest "${PROJECT_BINARY_DIR}/testfiles/${fname}") #message (STATUS " Copying ${listfiles}") add_custom_command ( diff --git a/tools/h5diff/CMakeTests.cmake b/tools/h5diff/CMakeTests.cmake index 0595edd..c815325 100644 --- a/tools/h5diff/CMakeTests.cmake +++ b/tools/h5diff/CMakeTests.cmake @@ -267,7 +267,7 @@ # copy test files from source to build dir # foreach (h5_tstfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) - GET_FILENAME_COMPONENT(fname "${h5_tstfiles}" NAME) + get_filename_component(fname "${h5_tstfiles}" NAME) set (dest "${PROJECT_BINARY_DIR}/testfiles/${fname}") #message (STATUS " Copying ${fname}") add_custom_command ( @@ -1115,8 +1115,10 @@ ADD_H5_TEST (h5diff_90 0 -v ${FILE2} ${FILE2}) ADD_H5_TEST (h5diff_100 1 -v ${FILE9} ${FILE10}) # 11. floating point comparison +# double value ADD_H5_TEST (h5diff_101 1 -v ${FILE1} ${FILE1} g1/d1 g1/d2) +# float value ADD_H5_TEST (h5diff_102 1 -v ${FILE1} ${FILE1} g1/fp1 g1/fp2) # with --use-system-epsilon for double value. expect less differences @@ -1361,7 +1363,7 @@ ADD_H5_TEST (h5diff_517 1 -v ${GRP_RECURSE1_EXT} ${GRP_RECURSE2_EXT1} /g1) ADD_H5_TEST (h5diff_518 0 -v --follow-symlinks ${GRP_RECURSE1_EXT} ${GRP_RECURSE2_EXT1} /g1) # ############################################################################## -# # Exclude path (--exclude-path) +# # Exclude objects (--exclude-path) # ############################################################################## # # Same structure, same names and different value. diff --git a/tools/h5dump/CMakeTests.cmake b/tools/h5dump/CMakeTests.cmake index 9f7e2b0..7897311 100644 --- a/tools/h5dump/CMakeTests.cmake +++ b/tools/h5dump/CMakeTests.cmake @@ -1141,10 +1141,10 @@ ADD_H5_TEST_N (tattr-2 0 --enable-error-stack -N /\\\\/attr1 --any_path /attr4 --any_path=/attr5 tattr.h5) # test for header and error messages ADD_H5ERR_MASK_TEST (tattr-3 1 --enable-error-stack --header -a /attr2 --attribute=/attr tattr.h5) - # test for displaying attributes in shared datatype (also in group and dataset) - ADD_H5_TEST (tnamed_dtype_attr 0 --enable-error-stack tnamed_dtype_attr.h5) # test for displaying at least 9 attributes on root from a be machine ADD_H5_TEST (tattr-4_be 0 --enable-error-stack tattr4_be.h5) + # test for displaying attributes in shared datatype (also in group and dataset) + ADD_H5_TEST (tnamed_dtype_attr 0 --enable-error-stack tnamed_dtype_attr.h5) # test for displaying soft links and user-defined links ADD_H5_TEST (tslink-1 0 --enable-error-stack tslink.h5) @@ -1423,6 +1423,7 @@ # test for dataset region references ADD_H5_TEST (tdatareg 0 --enable-error-stack tdatareg.h5) ADD_H5ERR_MASK_TEST (tdataregR 0 --enable-error-stack -R tdatareg.h5) + ADD_H5_TEST (tattrreg 0 --enable-error-stack tattrreg.h5) ADD_H5ERR_MASK_TEST (tattrregR 0 -R --enable-error-stack tattrreg.h5) ADD_H5_EXPORT_TEST (tbinregR tdatareg.h5 0 --enable-error-stack -d /Dataset1 -s 0 -R -y -o) diff --git a/tools/h5dump/CMakeTestsPBITS.cmake b/tools/h5dump/CMakeTestsPBITS.cmake index e76fa0e..745d5b1 100644 --- a/tools/h5dump/CMakeTestsPBITS.cmake +++ b/tools/h5dump/CMakeTestsPBITS.cmake @@ -86,7 +86,7 @@ ) foreach (pbits_h5_file ${HDF5_REFERENCE_TEST_PBITS}) - GET_FILENAME_COMPONENT(fname "${pbits_h5_file}" NAME) + get_filename_component(fname "${pbits_h5_file}" NAME) set (dest "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}") #message (STATUS " Copying ${pbits_h5_file}") add_custom_command ( @@ -99,7 +99,7 @@ foreach (ddl_pbits ${HDF5_REFERENCE_PBITS}) - GET_FILENAME_COMPONENT(fname "${ddl_pbits}" NAME) + get_filename_component(fname "${ddl_pbits}" NAME) set (ddldest "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}") #message (STATUS " Copying ${ddl_pbits}") add_custom_command ( @@ -111,7 +111,7 @@ endforeach (ddl_pbits ${HDF5_REFERENCE_PBITS}) foreach (ddl_pbits ${HDF5_ERROR_REFERENCE_PBITS}) - GET_FILENAME_COMPONENT(fname "${ddl_pbits}" NAME) + get_filename_component(fname "${ddl_pbits}" NAME) set (ddldest "${PROJECT_BINARY_DIR}/testfiles/pbits/${fname}") #message (STATUS " Copying ${ddl_pbits}") add_custom_command ( diff --git a/tools/h5dump/CMakeTestsVDS.cmake b/tools/h5dump/CMakeTestsVDS.cmake index cc68896..dcb90e0 100644 --- a/tools/h5dump/CMakeTestsVDS.cmake +++ b/tools/h5dump/CMakeTestsVDS.cmake @@ -65,7 +65,7 @@ ) foreach (vds_h5_file ${HDF5_REFERENCE_TEST_VDS}) - GET_FILENAME_COMPONENT(fname "${vds_h5_file}" NAME) + get_filename_component(fname "${vds_h5_file}" NAME) set (dest "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}") #message (STATUS " Copying ${vds_h5_file}") add_custom_command ( @@ -78,7 +78,7 @@ foreach (ddl_vds ${HDF5_REFERENCE_VDS}) - GET_FILENAME_COMPONENT(fname "${ddl_vds}" NAME) + get_filename_component(fname "${ddl_vds}" NAME) set (ddldest "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}") #message (STATUS " Copying ${ddl_vds}") add_custom_command ( @@ -90,7 +90,7 @@ endforeach (ddl_vds ${HDF5_REFERENCE_VDS}) foreach (ddl_vds ${HDF5_ERROR_REFERENCE_VDS}) - GET_FILENAME_COMPONENT(fname "${ddl_vds}" NAME) + get_filename_component(fname "${ddl_vds}" NAME) set (ddldest "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}") #message (STATUS " Copying ${ddl_vds}") add_custom_command ( @@ -111,7 +111,7 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $ ${ARGN}) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfilesvds") + set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") if (NOT ${resultcode} STREQUAL "0") set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif (NOT ${resultcode} STREQUAL "0") @@ -144,7 +144,7 @@ # If using memchecker add tests without using scripts if (HDF5_ENABLE_USING_MEMCHECKER) add_test (NAME H5DUMP-${resultfile} COMMAND $ -p ${ARGN}) - set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfilesvds") + set_tests_properties (H5DUMP-${resultfile} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles/vds") if (NOT ${resultcode} STREQUAL "0") set_tests_properties (H5DUMP-${resultfile} PROPERTIES WILL_FAIL "true") endif (NOT ${resultcode} STREQUAL "0") diff --git a/tools/h5dump/CMakeTestsXML.cmake b/tools/h5dump/CMakeTestsXML.cmake index 0a667c4..fc6cae7 100644 --- a/tools/h5dump/CMakeTestsXML.cmake +++ b/tools/h5dump/CMakeTestsXML.cmake @@ -128,7 +128,7 @@ ) foreach (tst_xml_h5_file ${HDF5_XML_REFERENCE_TEST_FILES}) - GET_FILENAME_COMPONENT(fname "${tst_xml_h5_file}" NAME) + get_filename_component(fname "${tst_xml_h5_file}" NAME) set (dest "${PROJECT_BINARY_DIR}/testfiles/xml/${fname}") #message (STATUS " Copying ${tst_xml_h5_file}") add_custom_command ( @@ -140,7 +140,7 @@ endforeach (tst_xml_h5_file ${HDF5_XML_REFERENCE_TEST_FILES}) foreach (tst_xml_other_file ${HDF5_XML_REFERENCE_FILES}) - GET_FILENAME_COMPONENT(fname "${tst_xml_other_file}" NAME) + get_filename_component(fname "${tst_xml_other_file}" NAME) set (dest "${PROJECT_BINARY_DIR}/testfiles/xml/${fname}") #message (STATUS " Copying ${tst_xml_other_file}") add_custom_command ( diff --git a/tools/h5ls/CMakeTests.cmake b/tools/h5ls/CMakeTests.cmake index a42fa17..c5aff21 100644 --- a/tools/h5ls/CMakeTests.cmake +++ b/tools/h5ls/CMakeTests.cmake @@ -96,7 +96,7 @@ # copy the list of test files foreach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) - GET_FILENAME_COMPONENT(fname "${listfiles}" NAME) + get_filename_component(fname "${listfiles}" NAME) set (dest "${PROJECT_BINARY_DIR}/testfiles/${fname}") #message (STATUS " Copying ${listfiles} to ${dest}") add_custom_command ( diff --git a/tools/h5ls/CMakeTestsVDS.cmake b/tools/h5ls/CMakeTestsVDS.cmake index 1ef3f20..3e85803 100644 --- a/tools/h5ls/CMakeTestsVDS.cmake +++ b/tools/h5ls/CMakeTestsVDS.cmake @@ -47,7 +47,7 @@ # copy the list of test files foreach (listfiles ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) - GET_FILENAME_COMPONENT(fname "${listfiles}" NAME) + get_filename_component(fname "${listfiles}" NAME) set (dest "${PROJECT_BINARY_DIR}/testfiles/vds/${fname}") #message (STATUS " Copying ${listfiles} to ${dest}") add_custom_command ( diff --git a/tools/h5repack/CMakeTests.cmake b/tools/h5repack/CMakeTests.cmake index 8aee98f..07c3f9c 100644 --- a/tools/h5repack/CMakeTests.cmake +++ b/tools/h5repack/CMakeTests.cmake @@ -118,7 +118,7 @@ ) foreach (h5_file ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) - GET_FILENAME_COMPONENT(fname "${h5_file}" NAME) + get_filename_component(fname "${h5_file}" NAME) set (dest "${PROJECT_BINARY_DIR}/testfiles/${fname}") #message (STATUS " Copying ${h5_file}") add_custom_command ( -- cgit v0.12 From e45885dea912a18b9fd6b1450d3ff196dcb749eb Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Fri, 1 Apr 2016 16:30:24 -0500 Subject: [svn-r29603] HDFFV-9746 Add test for "/" for H5LTpath_valid Tested: jam (gnu) --- hl/test/test_lite.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index f3258d6..6cadd95 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -2066,6 +2066,15 @@ static int test_valid_path(void) /************************************** * CHECK ABSOLUTE PATHS **************************************/ + + if( (path_valid = H5LTpath_valid(file_id, "/", TRUE)) != TRUE) { + goto out; + } + + if( (path_valid = H5LTpath_valid(file_id, "/", FALSE)) != TRUE) { + goto out; + } + if( (path_valid = H5LTpath_valid(file_id, "/G1", TRUE)) != TRUE) { goto out; } @@ -2112,6 +2121,20 @@ static int test_valid_path(void) * CHECK RELATIVE PATHS ***************************************/ + if( (group = H5Gopen2(file_id, "/", H5P_DEFAULT)) < 0) + goto out; + + if( (path_valid = H5LTpath_valid(group, "/", TRUE)) != TRUE) { + goto out; + } + + if( (path_valid = H5LTpath_valid(group, "/", FALSE)) != TRUE) { + goto out; + } + + if(H5Gclose(group)<0) + goto out; + if( (group = H5Gopen2(file_id, "/G1", H5P_DEFAULT)) < 0) goto out; -- cgit v0.12 From 9d2178ab886ae957cfe11b6fe09f9e7f0e9ce369 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 2 Apr 2016 04:39:32 -0500 Subject: [svn-r29607] Description: Bring "don't filter partial edge chunks" capability from revise_chunks to trunk. Tested on: MacOSX/64 10.11.4 (amazon) w/debug, production & parallel (h5committest forthcoming) --- src/H5Dchunk.c | 651 ++++++++++++++++++++++++++++++++++++++++++++---- src/H5Dint.c | 18 +- src/H5Dlayout.c | 34 ++- src/H5Dpkg.h | 3 + src/H5Dpublic.h | 3 + src/H5Olayout.c | 128 +++++++--- src/H5Oprivate.h | 7 + src/H5Pdcpl.c | 123 ++++++++- src/H5Ppublic.h | 2 + test/dsets.c | 227 +++++++++++++++-- test/objcopy.c | 141 +++++++++++ test/set_extent.c | 54 +++- testpar/t_dset.c | 206 ++++++++------- testpar/t_filter_read.c | 116 +++++---- 14 files changed, 1452 insertions(+), 261 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index d8e8eb5..309c7a8 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -103,6 +103,11 @@ /*#define H5D_CHUNK_DEBUG */ +/* Flags for the "edge_chunk_state" field below */ +#define H5D_RDCC_DISABLE_FILTERS 0x01u /* Disable filters on this chunk */ +#define H5D_RDCC_NEWLY_DISABLED_FILTERS 0x02u /* Filters have been disabled since + * the last flush */ + /******************/ /* Local Typedefs */ @@ -113,6 +118,7 @@ typedef struct H5D_rdcc_ent_t { hbool_t locked; /*entry is locked in cache */ hbool_t dirty; /*needs to be written to disk? */ hbool_t deleted; /*chunk about to be deleted */ + unsigned edge_chunk_state; /*states related to edge chunks (see above) */ hsize_t scaled[H5O_LAYOUT_NDIMS]; /*scaled chunk 'name' (coordinates) */ uint32_t rd_count; /*bytes remaining to be read */ uint32_t wr_count; /*bytes remaining to be written */ @@ -174,6 +180,8 @@ typedef struct H5D_chunk_it_ud3_t { /* needed for compressed variable-length data */ const H5O_pline_t *pline; /* Filter pipeline */ + unsigned dset_ndims; /* Number of dimensions in dataset */ + const hsize_t *dset_dims; /* Dataset dimensions */ /* needed for copy object pointed by refs */ H5O_copy_t *cpy_info; /* Copy options */ @@ -264,17 +272,18 @@ static herr_t H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t *dxpl_cache, H5D_rdcc_ent_t *ent, hbool_t reset); static herr_t H5D__chunk_cache_evict(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t *dxpl_cache, H5D_rdcc_ent_t *ent, hbool_t flush); +static hbool_t H5D__chunk_is_partial_edge_chunk(unsigned dset_ndims, + const uint32_t *chunk_dims, const hsize_t *chunk_scaled, const hsize_t *dset_dims); static void *H5D__chunk_lock(const H5D_io_info_t *io_info, - H5D_chunk_ud_t *udata, hbool_t relax); + H5D_chunk_ud_t *udata, hbool_t relax, hbool_t prev_unfilt_chunk); static herr_t H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, hbool_t dirty, void *chunk, uint32_t naccessed); static herr_t H5D__chunk_cache_prune(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t *dxpl_cache, size_t size); -static herr_t H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata); +static herr_t H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk); static herr_t H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, - const H5F_block_t *old_chunk, H5F_block_t *new_chunk, hbool_t *need_insert, - hsize_t scaled[]); + const H5F_block_t *old_chunk, H5F_block_t *new_chunk, hbool_t *need_insert); #ifdef H5_HAVE_PARALLEL static herr_t H5D__chunk_collective_fill(const H5D_t *dset, hid_t dxpl_id, H5D_chunk_coll_info_t *chunk_info, size_t chunk_size, const void *fill_buf); @@ -420,7 +429,7 @@ H5D__chunk_direct_write(const H5D_t *dset, hid_t dxpl_id, uint32_t filters, /* Create the chunk it if it doesn't exist, or reallocate the chunk * if its size changed. */ - if(H5D__chunk_file_alloc(&idx_info, &old_chunk, &udata.chunk_block, &need_insert, scaled) < 0) + if(H5D__chunk_file_alloc(&idx_info, &old_chunk, &udata.chunk_block, &need_insert) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "unable to allocate chunk") /* Make sure the address of the chunk is returned. */ @@ -1786,6 +1795,7 @@ htri_t H5D__chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr, hbool_t write_op) { const H5D_t *dataset = io_info->dset; /* Local pointer to dataset info */ + hbool_t has_filters = FALSE; /* Whether there are filters on the chunk or not */ htri_t ret_value = FAIL; /* Return value */ FUNC_ENTER_PACKAGE @@ -1794,8 +1804,23 @@ H5D__chunk_cacheable(const H5D_io_info_t *io_info, haddr_t caddr, hbool_t write_ HDassert(io_info); HDassert(dataset); - /* Must bring the whole chunk in if there are any filters */ - if(dataset->shared->dcpl_cache.pline.nused > 0) + /* Must bring the whole chunk in if there are any filters on the chunk. + * Make sure to check if filters are on the dataset but disabled for the + * chunk because it is a partial edge chunk. */ + if(dataset->shared->dcpl_cache.pline.nused > 0) { + if(dataset->shared->layout.u.chunk.flags + & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) { + has_filters = !H5D__chunk_is_partial_edge_chunk( + io_info->dset->shared->ndims, + io_info->dset->shared->layout.u.chunk.dim, + io_info->store->chunk.scaled, + io_info->dset->shared->curr_dims); + } /* end if */ + else + has_filters = TRUE; + } /* end if */ + + if(has_filters) ret_value = TRUE; else { #ifdef H5_HAVE_PARALLEL @@ -1957,7 +1982,7 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, src_accessed_bytes = chunk_info->chunk_points * (uint32_t)type_info->src_type_size; /* Lock the chunk into the cache */ - if(NULL == (chunk = H5D__chunk_lock(io_info, &udata, FALSE))) + if(NULL == (chunk = H5D__chunk_lock(io_info, &udata, FALSE, FALSE))) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk") /* Set up the storage buffer information for this chunk */ @@ -2091,7 +2116,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, entire_chunk = FALSE; /* Lock the chunk into the cache */ - if(NULL == (chunk = H5D__chunk_lock(io_info, &udata, entire_chunk))) + if(NULL == (chunk = H5D__chunk_lock(io_info, &udata, entire_chunk, FALSE))) HGOTO_ERROR(H5E_IO, H5E_READERROR, FAIL, "unable to read raw data chunk") /* Set up the storage buffer information for this chunk */ @@ -2114,7 +2139,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, udata.chunk_block.length = io_info->dset->shared->layout.u.chunk.size; /* Allocate the chunk */ - if(H5D__chunk_file_alloc(&idx_info, NULL, &udata.chunk_block, &need_insert, chunk_info->scaled) < 0) + if(H5D__chunk_file_alloc(&idx_info, NULL, &udata.chunk_block, &need_insert) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level") /* Make sure the address of the chunk is returned. */ @@ -2614,6 +2639,7 @@ H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, udata->chunk_block.offset = HADDR_UNDEF; udata->chunk_block.length = 0; udata->filter_mask = 0; + udata->new_unfilt_chunk = FALSE; /* Check for chunk in cache */ if(dset->shared->cache.chunk.nslots > 0) { @@ -2742,7 +2768,8 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t udata.chunk_idx = ent->chunk_idx; /* Should the chunk be filtered before writing it to disk? */ - if(dset->shared->dcpl_cache.pline.nused) { + if(dset->shared->dcpl_cache.pline.nused + && !(ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS)) { size_t alloc = udata.chunk_block.length; /* Bytes allocated for BUF */ size_t nbytes; /* Chunk size (in bytes) */ @@ -2781,10 +2808,27 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t /* Indicate that the chunk must be allocated */ must_alloc = TRUE; } /* end if */ - else if(!H5F_addr_defined(udata.chunk_block.offset)) + else if(!H5F_addr_defined(udata.chunk_block.offset)) { /* Indicate that the chunk must be allocated */ must_alloc = TRUE; + /* This flag could be set for this chunk, just remove and ignore it + */ + ent->edge_chunk_state &= ~H5D_RDCC_NEWLY_DISABLED_FILTERS; + } /* end else */ + else if(ent->edge_chunk_state & H5D_RDCC_NEWLY_DISABLED_FILTERS) { + /* Chunk on disk is still filtered, must insert to allocate correct + * size */ + must_alloc = TRUE; + + /* Set the disable filters field back to the standard disable + * filters setting, as it no longer needs to be inserted with every + * flush */ + ent->edge_chunk_state &= ~H5D_RDCC_NEWLY_DISABLED_FILTERS; + } /* end else */ + + HDassert(!(ent->edge_chunk_state & H5D_RDCC_NEWLY_DISABLED_FILTERS)); + /* Check if the chunk needs to be allocated (it also could exist already * and the chunk alloc operation could resize it) */ @@ -2799,7 +2843,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t /* Create the chunk it if it doesn't exist, or reallocate the chunk * if its size changed. */ - if(H5D__chunk_file_alloc(&idx_info, &(ent->chunk_block), &udata.chunk_block, &need_insert, ent->scaled) < 0) + if(H5D__chunk_file_alloc(&idx_info, &(ent->chunk_block), &udata.chunk_block, &need_insert) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level") /* Update the chunk entry's info, in case it was allocated or relocated */ @@ -2834,7 +2878,9 @@ H5D__chunk_flush_entry(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t if(buf == ent->chunk) buf = NULL; if(ent->chunk != NULL) - ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, &(dset->shared->dcpl_cache.pline)); + ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, + ((ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS) ? NULL + : &(dset->shared->dcpl_cache.pline))); } /* end if */ done: @@ -2850,7 +2896,9 @@ done: */ if(ret_value < 0 && point_of_no_return) if(ent->chunk) - ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, &(dset->shared->dcpl_cache.pline)); + ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, + ((ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS) ? NULL + : &(dset->shared->dcpl_cache.pline))); FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5D__chunk_flush_entry() */ @@ -2892,7 +2940,9 @@ H5D__chunk_cache_evict(const H5D_t *dset, hid_t dxpl_id, const H5D_dxpl_cache_t else { /* Don't flush, just free chunk */ if(ent->chunk != NULL) - ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, &(dset->shared->dcpl_cache.pline)); + ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, + ((ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS) ? NULL + : &(dset->shared->dcpl_cache.pline))); } /* end else */ /* Unlink from list */ @@ -3071,10 +3121,11 @@ done: */ static void * H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, - hbool_t relax) + hbool_t relax, hbool_t prev_unfilt_chunk) { const H5D_t *dset = io_info->dset; /* Local pointer to the dataset info */ const H5O_pline_t *pline = &(dset->shared->dcpl_cache.pline); /* I/O pipeline info - always equal to the pline passed to H5D__chunk_mem_alloc */ + const H5O_pline_t *old_pline = pline; /* Old pipeline, i.e. pipeline used to read the chunk */ const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */ const H5O_fill_t *fill = &(dset->shared->dcpl_cache.fill); /* Fill value info */ H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */ @@ -3082,6 +3133,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, H5D_rdcc_t *rdcc = &(dset->shared->cache.chunk); /*raw data chunk cache*/ H5D_rdcc_ent_t *ent; /*cache entry */ size_t chunk_size; /*size of a chunk */ + hbool_t disable_filters = FALSE; /* Whether to disable filters (when adding to cache) */ void *chunk = NULL; /*the file chunk */ void *ret_value = NULL; /* Return value */ @@ -3094,6 +3146,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, HDassert(dset); HDassert(TRUE == H5P_isa_class(io_info->md_dxpl_id, H5P_DATASET_XFER)); HDassert(TRUE == H5P_isa_class(io_info->raw_dxpl_id, H5P_DATASET_XFER)); + HDassert(!(udata->new_unfilt_chunk && prev_unfilt_chunk)); HDassert(!rdcc->tmp_head); /* Get the chunk's size */ @@ -3124,6 +3177,66 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, */ rdcc->stats.nhits++; + /* Make adjustments if the edge chunk status changed recently */ + if(pline->nused) { + /* If the chunk recently became an unfiltered partial edge chunk + * while in cache, we must make some changes to the entry */ + if(udata->new_unfilt_chunk) { + /* If this flag is set then partial chunk filters must be + * disabled, and the chunk must not have previously been a + * partial chunk (with disabled filters) */ + HDassert(layout->u.chunk.flags + & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS); + HDassert(!(ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS)); + HDassert(old_pline->nused); + + /* Disable filters. Set pline to NULL instead of just the + * default pipeline to make a quick failure more likely if the + * code is changed in an inappropriate/incomplete way. */ + pline = NULL; + + /* Reallocate the chunk so H5D__chunk_mem_xfree doesn't get confused + */ + if(NULL == (chunk = H5D__chunk_mem_alloc(chunk_size, pline))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk") + HDmemcpy(chunk, ent->chunk, chunk_size); + ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, old_pline); + ent->chunk = (uint8_t *)chunk; + chunk = NULL; + + /* Mark the chunk as having filters disabled as well as "newly + * disabled" so it is inserted on flush */ + ent->edge_chunk_state |= H5D_RDCC_DISABLE_FILTERS; + ent->edge_chunk_state |= H5D_RDCC_NEWLY_DISABLED_FILTERS; + } /* end if */ + else if(prev_unfilt_chunk) { + /* If this flag is set then partial chunk filters must be + * disabled, and the chunk must have previously been a partial + * chunk (with disabled filters) */ + HDassert(layout->u.chunk.flags + & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS); + HDassert((ent->edge_chunk_state & H5D_RDCC_DISABLE_FILTERS)); + HDassert(pline->nused); + + /* Mark the old pipeline as having been disabled */ + old_pline = NULL; + + /* Reallocate the chunk so H5D__chunk_mem_xfree doesn't get confused + */ + if(NULL == (chunk = H5D__chunk_mem_alloc(chunk_size, pline))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk") + HDmemcpy(chunk, ent->chunk, chunk_size); + + ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, old_pline); + ent->chunk = (uint8_t *)chunk; + chunk = NULL; + + /* Mark the chunk as having filters enabled */ + ent->edge_chunk_state &= ~(H5D_RDCC_DISABLE_FILTERS + | H5D_RDCC_NEWLY_DISABLED_FILTERS); + } /* end else */ + } /* end if */ + /* * If the chunk is not at the beginning of the cache; move it backward * by one slot. This is how we implement the LRU preemption @@ -3152,6 +3265,39 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, chunk_addr = udata->chunk_block.offset; chunk_alloc = udata->chunk_block.length; + /* Check if we should disable filters on this chunk */ + if(pline->nused) { + if(udata->new_unfilt_chunk) { + HDassert(layout->u.chunk.flags + & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS); + + /* Disable the filters for writing */ + disable_filters = TRUE; + pline = NULL; + } /* end if */ + else if(prev_unfilt_chunk) { + HDassert(layout->u.chunk.flags + & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS); + + /* Mark the filters as having been previously disabled (for the + * chunk as currently on disk) - disable the filters for reading + */ + old_pline = NULL; + } /* end if */ + else if(layout->u.chunk.flags + & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) { + /* Check if this is an edge chunk */ + if(H5D__chunk_is_partial_edge_chunk(io_info->dset->shared->ndims, + layout->u.chunk.dim, io_info->store->chunk.scaled, + io_info->dset->shared->curr_dims)) { + /* Disable the filters for both writing and reading */ + disable_filters = TRUE; + old_pline = NULL; + pline = NULL; + } /* end if */ + } /* end if */ + } /* end if */ + if(relax) { /* * Not in the cache, but we're about to overwrite the whole thing @@ -3181,16 +3327,32 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, /* Chunk size on disk isn't [likely] the same size as the final chunk * size in memory, so allocate memory big enough. */ - if(NULL == (chunk = H5D__chunk_mem_alloc(my_chunk_alloc, pline))) + if(NULL == (chunk = H5D__chunk_mem_alloc(my_chunk_alloc, (udata->new_unfilt_chunk ? old_pline : pline)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk") if(H5F_block_read(dset->oloc.file, H5FD_MEM_DRAW, chunk_addr, my_chunk_alloc, io_info->raw_dxpl_id, chunk) < 0) HGOTO_ERROR(H5E_IO, H5E_READERROR, NULL, "unable to read raw data chunk") - if(pline->nused) - if(H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &(udata->filter_mask), io_info->dxpl_cache->err_detect, - io_info->dxpl_cache->filter_cb, &my_chunk_alloc, &buf_alloc, &chunk) < 0) + if(old_pline && old_pline->nused) { + if(H5Z_pipeline(old_pline, H5Z_FLAG_REVERSE, + &(udata->filter_mask), + io_info->dxpl_cache->err_detect, + io_info->dxpl_cache->filter_cb, + &my_chunk_alloc, &buf_alloc, &chunk) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, NULL, "data pipeline read failed") + /* Reallocate chunk if necessary */ + if(udata->new_unfilt_chunk) { + void *tmp_chunk = chunk; + + if(NULL == (chunk = H5D__chunk_mem_alloc(my_chunk_alloc, pline))) { + (void)H5D__chunk_mem_xfree(tmp_chunk, old_pline); + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk") + } /* end if */ + HDmemcpy(chunk, tmp_chunk, chunk_size); + (void)H5D__chunk_mem_xfree(tmp_chunk, old_pline); + } /* end if */ + } /* end if */ + /* Increment # of cache misses */ rdcc->stats.nmisses++; } /* end if */ @@ -3259,6 +3421,10 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, if(NULL == (ent = H5FL_CALLOC(H5D_rdcc_ent_t))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate raw data chunk entry") + ent->edge_chunk_state = disable_filters ? H5D_RDCC_DISABLE_FILTERS : 0; + if(udata->new_unfilt_chunk) + ent->edge_chunk_state |= H5D_RDCC_NEWLY_DISABLED_FILTERS; + /* Initialize the new entry */ ent->chunk_block.offset = chunk_addr; ent->chunk_block.length = chunk_alloc; @@ -3367,12 +3533,30 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, * It's not in the cache, probably because it's too big. If it's * dirty then flush it to disk. In any case, free the chunk. */ + hbool_t is_unfiltered_edge_chunk = FALSE; /* Whether the chunk is an unfiltered edge chunk */ + + /* Check if we should disable filters on this chunk */ + if(udata->new_unfilt_chunk) { + HDassert(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS); + + is_unfiltered_edge_chunk = TRUE; + } /* end if */ + else if(layout->u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) { + /* Check if the chunk is an edge chunk, and disable filters if so */ + is_unfiltered_edge_chunk = H5D__chunk_is_partial_edge_chunk( + io_info->dset->shared->ndims, layout->u.chunk.dim, + io_info->store->chunk.scaled, io_info->dset->shared->curr_dims); + } /* end if */ + if(dirty) { H5D_rdcc_ent_t fake_ent; /* "fake" chunk cache entry */ HDmemset(&fake_ent, 0, sizeof(fake_ent)); fake_ent.dirty = TRUE; - HDmemcpy(fake_ent.scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims); + if(is_unfiltered_edge_chunk) + fake_ent.edge_chunk_state = H5D_RDCC_DISABLE_FILTERS; + if(udata->new_unfilt_chunk) + fake_ent.edge_chunk_state |= H5D_RDCC_NEWLY_DISABLED_FILTERS; HDmemcpy(fake_ent.scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims); HDassert(layout->u.chunk.size > 0); fake_ent.chunk_idx = udata->chunk_idx; @@ -3385,7 +3569,8 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, } /* end if */ else { if(chunk) - chunk = H5D__chunk_mem_xfree(chunk, &(io_info->dset->shared->dcpl_cache.pline)); + chunk = H5D__chunk_mem_xfree(chunk, (is_unfiltered_edge_chunk ? NULL + : &(io_info->dset->shared->dcpl_cache.pline))); } /* end else */ } /* end if */ else { @@ -3531,9 +3716,12 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ unsigned filter_mask = 0; /* Filter mask for chunks that have them */ const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */ const H5O_pline_t *pline = &(dset->shared->dcpl_cache.pline); /* I/O pipeline info */ + const H5O_pline_t def_pline = H5O_CRT_PIPELINE_DEF; /* Default pipeline */ const H5O_fill_t *fill = &(dset->shared->dcpl_cache.fill); /* Fill value info */ H5D_fill_value_t fill_status; /* The fill value status */ hbool_t should_fill = FALSE; /* Whether fill values should be written */ + void *unfilt_fill_buf = NULL; /* Unfiltered fill value buffer */ + void **fill_buf = NULL; /* Pointer to the fill buffer to use for a chunk */ H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */ H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */ #ifdef H5_HAVE_PARALLEL @@ -3550,6 +3738,10 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ unsigned op_dim; /* Current operating dimension */ H5D_fill_buf_info_t fb_info; /* Dataset's fill buffer info */ hbool_t fb_info_init = FALSE; /* Whether the fill value buffer has been initialized */ + hbool_t has_unfilt_edge_chunks = FALSE; /* Whether there are partial edge chunks with disabled filters */ + hbool_t unfilt_edge_chunk_dim[H5O_LAYOUT_NDIMS]; /* Whether there are unfiltered edge chunks at the edge of each dimension */ + hsize_t edge_chunk_scaled[H5O_LAYOUT_NDIMS]; /* Offset of the unfiltered edge chunks at the edge of each dimension */ + unsigned nunfilt_edge_chunk_dims = 0; /* Number of dimensions on an edge */ const H5O_storage_chunk_t *sc = &(layout->storage.u.chunk); herr_t ret_value = SUCCEED; /* Return value */ @@ -3594,6 +3786,29 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ if(H5D__get_dxpl_cache(raw_dxpl_id, &dxpl_cache) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") + /* Calculate the minimum and maximum chunk offsets in each dimension, and + * determine if there are any unfiltered partial edge chunks. Note that we + * assume here that all elements of space_dim are > 0. This is checked at + * the top of this function. */ + for(op_dim=0; op_dimu.chunk.flags + & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) + && pline->nused > 0 + && space_dim[op_dim] % chunk_dim[op_dim] != 0) { + has_unfilt_edge_chunks = TRUE; + unfilt_edge_chunk_dim[op_dim] = TRUE; + edge_chunk_scaled[op_dim] = max_unalloc[op_dim]; + } /* end if */ + else + unfilt_edge_chunk_dim[op_dim] = FALSE; + } /* end for */ + /* Get original chunk size */ H5_CHECKED_ASSIGN(orig_chunk_size, size_t, layout->u.chunk.size, uint32_t); @@ -3625,6 +3840,11 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info") fb_info_init = TRUE; + /* Initialize the fill_buf pointer to the buffer in fb_info. If edge + * chunk filters are disabled, we will switch the buffer as appropriate + * for each chunk. */ + fill_buf = &fb_info.fill_buf; + /* Check if there are filters which need to be applied to the chunk */ /* (only do this in advance when the chunk info can be re-used (i.e. * it doesn't contain any non-default VL datatype fill values) @@ -3632,6 +3852,14 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ if(!fb_info.has_vlen_fill_type && pline->nused > 0) { size_t buf_size = orig_chunk_size; + /* If the dataset has disabled partial chunk filters, create a copy + * of the unfiltered fill_buf to use for partial chunks */ + if(has_unfilt_edge_chunks) { + if(NULL == (unfilt_fill_buf = H5D__chunk_mem_alloc(orig_chunk_size, &def_pline))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for raw data chunk") + HDmemcpy(unfilt_fill_buf, fb_info.fill_buf, orig_chunk_size); + } /* end if */ + /* Push the chunk through the filters */ if(H5Z_pipeline(pline, 0, &filter_mask, dxpl_cache->err_detect, dxpl_cache->filter_cb, &orig_chunk_size, &buf_size, &fb_info.fill_buf) < 0) HGOTO_ERROR(H5E_PLINE, H5E_WRITEERROR, FAIL, "output pipeline failed") @@ -3650,14 +3878,6 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ idx_info.layout = &dset->shared->layout.u.chunk; idx_info.storage = &dset->shared->layout.storage.u.chunk; - /* Calculate the minimum and maximum chunk offsets in each dimension. Note - * that we assume here that all elements of space_dim are > 0. This is - * checked at the top of this function. */ - for(op_dim = 0; op_dim < (unsigned)space_ndims; op_dim++) { - min_unalloc[op_dim] = (old_dim[op_dim] + chunk_dim[op_dim] - 1) / chunk_dim[op_dim]; - max_unalloc[op_dim] = (space_dim[op_dim] - 1) / chunk_dim[op_dim]; - } /* end for */ - /* Loop over all chunks */ /* The algorithm is: * For each dimension: @@ -3682,6 +3902,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ chunk_size = orig_chunk_size; for(op_dim = 0; op_dim < space_ndims; op_dim++) { H5D_chunk_ud_t udata; /* User data for querying chunk info */ + unsigned u; /* Local index variable */ int i; /* Local index variable */ /* Check if allocation along this dimension is really necessary */ @@ -3692,6 +3913,29 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ HDmemset(scaled, 0, (space_ndims * sizeof(scaled[0]))); scaled[op_dim] = min_unalloc[op_dim]; + if(has_unfilt_edge_chunks) { + /* Initialize nunfilt_edge_chunk_dims */ + nunfilt_edge_chunk_dims = 0; + for(u = 0; u < space_ndims; u++) + if(unfilt_edge_chunk_dim[u] && scaled[u] + == edge_chunk_scaled[u]) + nunfilt_edge_chunk_dims++; + + /* Initialize chunk_size and fill_buf */ + if(should_fill && !fb_info.has_vlen_fill_type) { + HDassert(fb_info_init); + HDassert(unfilt_fill_buf); + if(nunfilt_edge_chunk_dims) { + fill_buf = &unfilt_fill_buf; + chunk_size = layout->u.chunk.size; + } /* end if */ + else { + fill_buf = &fb_info.fill_buf; + chunk_size = orig_chunk_size; + } /* end else */ + } /* end if */ + } /* end if */ + carry = FALSE; } /* end else */ @@ -3707,12 +3951,12 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ /* Make sure the chunk is really in the dataset and outside the * original dimensions */ { - unsigned u; /* Local index variable */ + unsigned v; /* Local index variable */ hbool_t outside_orig = FALSE; - for(u = 0; u < space_ndims; u++) { - HDassert((scaled[u] * chunk_dim[u]) < space_dim[u]); - if((scaled[u] * chunk_dim[u]) >= old_dim[u]) + for(v = 0; v < space_ndims; v++) { + HDassert((scaled[v] * chunk_dim[v]) < space_dim[v]); + if((scaled[v] * chunk_dim[v]) >= old_dim[v]) outside_orig = TRUE; } /* end for */ HDassert(outside_orig); @@ -3723,6 +3967,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ if(fb_info_init && fb_info.has_vlen_fill_type) { /* Sanity check */ HDassert(should_fill); + HDassert(!unfilt_fill_buf); #ifdef H5_HAVE_PARALLEL HDassert(!using_mpi); /* Can't write VL datatypes in parallel currently */ #endif @@ -3741,7 +3986,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "can't refill fill value buffer") /* Check if there are filters which need to be applied to the chunk */ - if(pline->nused > 0) { + if((pline->nused > 0) && !nunfilt_edge_chunk_dims) { size_t nbytes = orig_chunk_size; /* Push the chunk through the filters */ @@ -3759,6 +4004,8 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ } /* end if */ else chunk_size = layout->u.chunk.size; + + HDassert(*fill_buf == fb_info.fill_buf); } /* end if */ /* Initialize the chunk information */ @@ -3770,7 +4017,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ udata.filter_mask = filter_mask; /* Allocate the chunk (with all processes) */ - if(H5D__chunk_file_alloc(&idx_info, NULL, &udata.chunk_block, &need_insert, scaled) < 0) + if(H5D__chunk_file_alloc(&idx_info, NULL, &udata.chunk_block, &need_insert) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level") HDassert(H5F_addr_defined(udata.chunk_block.offset)); @@ -3786,6 +4033,9 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ /* collect all chunk addresses to be written to write collectively at the end */ /* allocate/resize address array if no more space left */ + /* Note that if we add support for parallel filters we must + * also store an array of chunk sizes and pass it to the + * apporpriate collective write function */ if(0 == chunk_info.num_io % 1024) if(NULL == (chunk_info.addr = (haddr_t *)H5MM_realloc(chunk_info.addr, (chunk_info.num_io + 1024) * sizeof(haddr_t)))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed for chunk addresses") @@ -3799,7 +4049,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ } /* end if */ else { #endif /* H5_HAVE_PARALLEL */ - if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, chunk_size, raw_dxpl_id, fb_info.fill_buf) < 0) + if(H5F_block_write(dset->oloc.file, H5FD_MEM_DRAW, udata.chunk_block.offset, chunk_size, raw_dxpl_id, *fill_buf) < 0) HGOTO_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to write raw data to file") #ifdef H5_HAVE_PARALLEL } /* end else */ @@ -3820,8 +4070,31 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ scaled[i] = min_unalloc[i]; else scaled[i] = 0; - } /* end if */ + + /* Check if we just left the edge in this dimension */ + if(unfilt_edge_chunk_dim[i] + && edge_chunk_scaled[i] == max_unalloc[i] + && scaled[i] < edge_chunk_scaled[i]) { + nunfilt_edge_chunk_dims--; + if(should_fill && nunfilt_edge_chunk_dims == 0 && !fb_info.has_vlen_fill_type) { + HDassert(!H5D__chunk_is_partial_edge_chunk(space_ndims, chunk_dim, scaled, space_dim)); + fill_buf = &fb_info.fill_buf; + chunk_size = orig_chunk_size; + } /* end if */ + } /* end if */ + } /* end if */ else { + /* Check if we just entered the edge in this dimension */ + if(unfilt_edge_chunk_dim[i] && scaled[i] == edge_chunk_scaled[i]) { + HDassert(edge_chunk_scaled[i] == max_unalloc[i]); + nunfilt_edge_chunk_dims++; + if(should_fill && nunfilt_edge_chunk_dims == 1 && !fb_info.has_vlen_fill_type) { + HDassert(H5D__chunk_is_partial_edge_chunk(space_ndims, chunk_dim, scaled, space_dim)); + fill_buf = &unfilt_fill_buf; + chunk_size = layout->u.chunk.size; + } /* end if */ + } /* end if */ + carry = FALSE; break; } /* end else */ @@ -3852,6 +4125,9 @@ done: if(fb_info_init && H5D__fill_term(&fb_info) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release fill buffer info") + /* Free the unfiltered fill value buffer */ + unfilt_fill_buf = H5D__chunk_mem_xfree(unfilt_fill_buf, &def_pline); + #ifdef H5_HAVE_PARALLEL if(using_mpi && chunk_info.addr) H5MM_free(chunk_info.addr); @@ -3860,6 +4136,185 @@ done: FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL) } /* end H5D__chunk_allocate() */ + +/*------------------------------------------------------------------------- + * Function: H5D__chunk_update_old_edge_chunks + * + * Purpose: Update all chunks which were previously partial edge + * chunks and are now complete. Determines exactly which + * chunks need to be updated and locks each into cache using + * the 'prev_unfilt_chunk' flag, then unlocks it, causing + * filters to be applied as necessary. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Neil Fortner + * April 14, 2010 + * + *------------------------------------------------------------------------- + */ +herr_t +H5D__chunk_update_old_edge_chunks(H5D_t *dset, hid_t dxpl_id, hsize_t old_dim[]) +{ + hsize_t old_edge_chunk_sc[H5O_LAYOUT_NDIMS]; /* Offset of first previously incomplete chunk in each dimension */ + hsize_t max_edge_chunk_sc[H5O_LAYOUT_NDIMS]; /* largest offset of chunks that might need to be modified in each dimension */ + hbool_t new_full_dim[H5O_LAYOUT_NDIMS]; /* Whether the plane of chunks in this dimension needs to be modified */ + const H5O_layout_t *layout = &(dset->shared->layout); /* Dataset layout */ + const H5O_pline_t *pline = &(dset->shared->dcpl_cache.pline); /* I/O pipeline info */ + hsize_t chunk_sc[H5O_LAYOUT_NDIMS]; /* Offset of current chunk */ + const uint32_t *chunk_dim = layout->u.chunk.dim; /* Convenience pointer to chunk dimensions */ + unsigned space_ndims; /* Dataset's space rank */ + const hsize_t *space_dim; /* Dataset's dataspace dimensions */ + unsigned op_dim; /* Current operationg dimension */ + H5D_io_info_t chk_io_info; /* Chunked I/O info object */ + H5D_chunk_ud_t chk_udata; /* User data for locking chunk */ + H5D_storage_t chk_store; /* Chunk storage information */ + H5D_dxpl_cache_t _dxpl_cache; /* Data transfer property cache buffer */ + H5D_dxpl_cache_t *dxpl_cache = &_dxpl_cache; /* Data transfer property cache */ + void *chunk; /* The file chunk */ + hbool_t carry; /* Flag to indicate that chunk increment carrys to higher dimension (sorta) */ + const H5O_storage_chunk_t *sc = &(layout->storage.u.chunk); + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Check args */ + HDassert(dset && H5D_CHUNKED == layout->type); + HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS); + H5D_CHUNK_STORAGE_INDEX_CHK(sc); + HDassert(TRUE == H5P_isa_class(dxpl_id, H5P_DATASET_XFER)); + HDassert(pline->nused > 0); + HDassert(layout->u.chunk.flags + & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS); + + /* Retrieve the dataset dimensions */ + space_dim = dset->shared->curr_dims; + space_ndims = dset->shared->ndims; + + /* The last dimension in chunk_offset is always 0 */ + chunk_sc[space_ndims] = (hsize_t)0; + + /* Check if any current dimensions are smaller than the chunk size, or if + * any old dimensions are 0. If so we do not have to do anything. */ + for(op_dim=0; op_dimshared->cache.chunk.last); + HGOTO_DONE(SUCCEED) + } /* end if */ + + /* + * Initialize structures needed to lock chunks into cache + */ + /* Fill the DXPL cache values for later use */ + if(H5D__get_dxpl_cache(dxpl_id, &dxpl_cache) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't fill dxpl cache") + + /* Set up chunked I/O info object, for operations on chunks (in callback). + * Note that we only need to set chunk_offset once, as the array's address + * will never change. */ + chk_store.chunk.scaled = chunk_sc; + H5D_BUILD_IO_INFO_RD(&chk_io_info, dset, dxpl_cache, dxpl_id, H5AC_rawdata_dxpl_id, &chk_store, NULL); + + /* + * Determine the edges of the dataset which need to be modified + */ + for(op_dim=0; op_dim= (old_edge_chunk_sc[op_dim] + 1)) + new_full_dim[op_dim] = TRUE; + } /* end for */ + + /* Main loop: fix old edge chunks */ + for(op_dim=0; op_dim= 0; --i) { + if((unsigned)i != op_dim) { + ++chunk_sc[i]; + if(chunk_sc[i] > (hsize_t) max_edge_chunk_sc[i]) + chunk_sc[i] = 0; + else { + carry = FALSE; + break; + } /* end else */ + } /* end if */ + } /* end for */ + } /* end while(!carry) */ + + /* Adjust max_edge_chunk_sc so we don't modify the same chunk twice. + * Also check if this dimension started from 0 (and hence modified all + * of the old edge chunks. */ + if(old_edge_chunk_sc[op_dim] == 0) + break; + else + --max_edge_chunk_sc[op_dim]; + } /* end for(op_dim=0...) */ + + /* Reset any cached chunk info for this dataset */ + H5D__chunk_cinfo_cache_reset(&dset->shared->cache.chunk.last); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__chunk_update_old_edge_chunks() */ + #ifdef H5_HAVE_PARALLEL /*------------------------------------------------------------------------- @@ -4030,7 +4485,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata) +H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata, hbool_t new_unfilt_chunk) { const H5D_io_info_t *io_info = udata->io_info; /* Local pointer to I/O info */ const H5D_t *dset = io_info->dset; /* Local pointer to the dataset info */ @@ -4057,6 +4512,7 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata) /* Get the info for the chunk in the file */ if(H5D__chunk_lookup(dset, io_info->md_dxpl_id, scaled, &chk_udata) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "error looking up chunk address") + chk_udata.new_unfilt_chunk = new_unfilt_chunk; /* If this chunk does not exist in cache or on disk, no need to do anything */ if(!H5F_addr_defined(chk_udata.chunk_block.offset) && UINT_MAX == chk_udata.idx_hint) @@ -4088,7 +4544,7 @@ H5D__chunk_prune_fill(H5D_chunk_it_ud1_t *udata) HGOTO_ERROR(H5E_DATASET, H5E_CANTSELECT, FAIL, "unable to select hyperslab") /* Lock the chunk into the cache, to get a pointer to the chunk buffer */ - if(NULL == (chunk = (void *)H5D__chunk_lock(io_info, &chk_udata, FALSE))) + if(NULL == (chunk = (void *)H5D__chunk_lock(io_info, &chk_udata, FALSE, FALSE))) HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "unable to lock raw data chunk") @@ -4242,6 +4698,8 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) hsize_t max_mod_chunk_sc[H5O_LAYOUT_NDIMS]; /* Scaled offset of last chunk to modify in each dimension */ hssize_t max_fill_chunk_sc[H5O_LAYOUT_NDIMS]; /* Scaled offset of last chunk that might be filled in each dimension */ hbool_t fill_dim[H5O_LAYOUT_NDIMS]; /* Whether the plane of edge chunks in this dimension needs to be filled */ + hsize_t min_partial_chunk_sc[H5O_LAYOUT_NDIMS]; /* Offset of first partial (or empty) chunk in each dimension */ + hbool_t new_unfilt_dim[H5O_LAYOUT_NDIMS]; /* Whether the plane of edge chunks in this dimension are newly unfiltered */ H5D_chk_idx_info_t idx_info; /* Chunked index info */ H5D_io_info_t chk_io_info; /* Chunked I/O info object */ H5D_storage_t chk_store; /* Chunk storage information */ @@ -4261,6 +4719,8 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) hsize_t scaled[H5O_LAYOUT_NDIMS]; /* Scaled offset of current chunk */ hsize_t hyper_start[H5O_LAYOUT_NDIMS]; /* Starting location of hyperslab */ uint32_t elmts_per_chunk; /* Elements in chunk */ + hbool_t disable_edge_filters = FALSE; /* Whether to disable filters on partial edge chunks */ + hbool_t new_unfilt_chunk = FALSE; /* Whether the chunk is newly unfiltered */ unsigned u; /* Local index variable */ const H5O_storage_chunk_t *sc = &(layout->storage.u.chunk); herr_t ret_value = SUCCEED; /* Return value */ @@ -4344,6 +4804,11 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) idx_udata.layout = &layout->u.chunk; idx_udata.storage = &layout->storage.u.chunk; + /* Determine if partial edge chunk filters are disabled */ + disable_edge_filters = (layout->u.chunk.flags + & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) + && (idx_info.pline->nused > 0); + /* * Determine the chunks which need to be filled or removed */ @@ -4370,13 +4835,31 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) min_mod_chunk_sc[op_dim] = space_dim[op_dim] / chunk_dim[op_dim]; /* Determine if we need to fill chunks in this dimension */ - if((hssize_t)min_mod_chunk_sc[op_dim] == max_fill_chunk_sc[op_dim]) + if((hssize_t)min_mod_chunk_sc[op_dim] == max_fill_chunk_sc[op_dim]) { fill_dim[op_dim] = TRUE; - else + + /* If necessary, check if chunks in this dimension that need to + * be filled are new partial edge chunks */ + if(disable_edge_filters && old_dim[op_dim] >= (min_mod_chunk_sc[op_dim] + 1)) + new_unfilt_dim[op_dim] = TRUE; + else + new_unfilt_dim[op_dim] = FALSE; + } /* end if */ + else { fill_dim[op_dim] = FALSE; + new_unfilt_dim[op_dim] = FALSE; + } /* end else */ } /* end if */ - else + else { fill_dim[op_dim] = FALSE; + new_unfilt_dim[op_dim] = FALSE; + } /* end else */ + + /* If necessary, calculate the smallest offset of non-previously full + * chunks in this dimension, so we know these chunks were previously + * unfiltered */ + if(disable_edge_filters) + min_partial_chunk_sc[op_dim] = old_dim[op_dim] / chunk_dim[op_dim]; } /* end for */ /* Main loop: fill or remove chunks */ @@ -4416,8 +4899,27 @@ H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim) HDassert(fill_dim[op_dim]); HDassert(scaled[op_dim] == min_mod_chunk_sc[op_dim]); + /* Make sure this is an edge chunk */ + HDassert(H5D__chunk_is_partial_edge_chunk(space_ndims, layout->u.chunk.dim, scaled, space_dim)); + + /* Determine if the chunk just became an unfiltered chunk */ + if(new_unfilt_dim[op_dim]) { + new_unfilt_chunk = TRUE; + for(u = 0; u < space_ndims; u++) + if(scaled[u] == min_partial_chunk_sc[u]) { + new_unfilt_chunk = FALSE; + break; + } /* end if */ + } /* end if */ + + /* Make sure that, if we think this is a new unfiltered chunk, + * it was previously not an edge chunk */ + HDassert(!new_unfilt_dim[op_dim] || (!new_unfilt_chunk != + !H5D__chunk_is_partial_edge_chunk(space_ndims, layout->u.chunk.dim, scaled, old_dim))); + HDassert(!new_unfilt_chunk || new_unfilt_dim[op_dim]); + /* Fill the unused parts of the chunk */ - if(H5D__chunk_prune_fill(&udata) < 0) + if(H5D__chunk_prune_fill(&udata, new_unfilt_chunk) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write fill value") } /* end if */ else { @@ -4854,8 +5356,15 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) /* Check for filtered chunks */ if((is_vlen || fix_ref) && pline && pline->nused) { - must_filter = TRUE; - cb_struct.func = NULL; /* no callback function when failed */ + /* Check if we should disable filters on this chunk */ + if(udata->common.layout->flags + & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) { + /* Check if the chunk is an edge chunk, and disable filters if so */ + if(!H5D__chunk_is_partial_edge_chunk(udata->dset_ndims, udata->common.layout->dim, chunk_rec->scaled, udata->dset_dims)) + must_filter = TRUE; + } /* end if */ + else + must_filter = TRUE; } /* end if */ /* Resize the buf if it is too small to hold the data */ @@ -4888,6 +5397,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) if(must_filter) { unsigned filter_mask = chunk_rec->filter_mask; + cb_struct.func = NULL; /* no callback function when failed */ if(H5Z_pipeline(pline, H5Z_FLAG_REVERSE, &filter_mask, H5Z_NO_EDC, cb_struct, &nbytes, &buf_size, &buf) < 0) HGOTO_ERROR(H5E_PLINE, H5E_CANTFILTER, H5_ITER_ERROR, "data pipeline read failed") } /* end if */ @@ -4966,7 +5476,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) udata_dst.common.layout->down_chunks, udata_dst.common.scaled); /* Allocate chunk in the file */ - if(H5D__chunk_file_alloc(udata->idx_info_dst, NULL, &udata_dst.chunk_block, &need_insert, udata_dst.common.scaled) < 0) + if(H5D__chunk_file_alloc(udata->idx_info_dst, NULL, &udata_dst.chunk_block, &need_insert) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert/resize chunk on chunk level") /* Write chunk data to destination file */ @@ -5603,6 +6113,45 @@ done: /*------------------------------------------------------------------------- + * Function: H5D__chunk_is_partial_edge_chunk + * + * Purpose: Checks to see if the chunk is a partial edge chunk. + * Either dset or (dset_dims and dset_ndims) must be + * provided. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Neil Fortner + * 19 Nov 2009 + * + *------------------------------------------------------------------------- + */ +static hbool_t +H5D__chunk_is_partial_edge_chunk(unsigned dset_ndims, const uint32_t *chunk_dims, + const hsize_t scaled[], const hsize_t *dset_dims) +{ + unsigned u; /* Local index variable */ + hbool_t ret_value = FALSE; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Check args */ + HDassert(scaled); + HDassert(dset_ndims > 0); + HDassert(dset_dims); + HDassert(chunk_dims); + + /* check if this is a partial edge chunk */ + for(u = 0; u < dset_ndims; u++) + if(((scaled[u] + 1) * chunk_dims[u]) > dset_dims[u]) + HGOTO_DONE(TRUE); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__chunk_is_partial_edge_chunk() */ + + +/*------------------------------------------------------------------------- * Function: H5D__chunk_file_alloc() * * Purpose: Chunk allocation: @@ -5618,7 +6167,7 @@ done: */ static herr_t H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old_chunk, - H5F_block_t *new_chunk, hbool_t *need_insert, hsize_t scaled[]) + H5F_block_t *new_chunk, hbool_t *need_insert) { hbool_t alloc_chunk = FALSE; /* Whether to allocate chunk */ herr_t ret_value = SUCCEED; /* Return value */ @@ -5635,6 +6184,8 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old HDassert(new_chunk); HDassert(need_insert); + *need_insert = FALSE; + /* Check for filters on chunks */ if(idx_info->pline->nused > 0) { /* Sanity/error checking block */ @@ -5696,7 +6247,7 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old new_chunk->offset = H5MF_alloc(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, (hsize_t)new_chunk->length); if(!H5F_addr_defined(new_chunk->offset)) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "file allocation failed") - *need_insert = TRUE; + *need_insert = TRUE; break; case H5D_CHUNK_IDX_NTYPES: diff --git a/src/H5Dint.c b/src/H5Dint.c index d91693d..570ee99 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -2624,11 +2624,19 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size, hid_t dxpl_id) * and if the chunks are written *------------------------------------------------------------------------- */ - if(shrink && H5D_CHUNKED == dset->shared->layout.type && - (*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage)) - /* Remove excess chunks */ - if(H5D__chunk_prune_by_extent(dset, dxpl_id, curr_dims) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to remove chunks") + if(H5D_CHUNKED == dset->shared->layout.type) { + if(shrink && (*dset->shared->layout.ops->is_space_alloc)(&dset->shared->layout.storage)) + /* Remove excess chunks */ + if(H5D__chunk_prune_by_extent(dset, dxpl_id, curr_dims) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to remove chunks") + + /* Update chunks that are no longer edge chunks as a result of + * expansion */ + if(expand && (dset->shared->layout.u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) + && (dset->shared->dcpl_cache.pline.nused > 0)) + if(H5D__chunk_update_old_edge_chunks(dset, dxpl_id, curr_dims) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to do update old edge chunks") + } /* end if */ /* Mark the dataspace as dirty, for later writing to the file */ if(H5D__mark(dset, dxpl_id, H5D_MARK_SPACE) < 0) diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index bbaa9c5..19b1c95 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -164,15 +164,35 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ break; case H5D_CHUNKED: - /* Number of dimensions (1 byte) */ - HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS); - ret_value++; + if(layout->version < H5O_LAYOUT_VERSION_4) { + /* Number of dimensions (1 byte) */ + HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS); + ret_value++; - /* Dimension sizes */ - ret_value += layout->u.chunk.ndims * 4; + /* B-tree address */ + ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */ - /* B-tree address */ - ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */ + /* Dimension sizes */ + ret_value += layout->u.chunk.ndims * 4; + } /* end if */ + else { + /* Chunked layout feature flags */ + ret_value++; + + /* Number of dimensions (1 byte) */ + HDassert(layout->u.chunk.ndims > 0 && layout->u.chunk.ndims <= H5O_LAYOUT_NDIMS); + ret_value++; + + /* Encoded # of bytes for each chunk dimension */ + HDassert(layout->u.chunk.enc_bytes_per_dim > 0 && layout->u.chunk.enc_bytes_per_dim <= 8); + ret_value++; + + /* Dimension sizes */ + ret_value += layout->u.chunk.ndims * layout->u.chunk.enc_bytes_per_dim; + + /* B-tree address */ + ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */ + } /* end else */ break; case H5D_VIRTUAL: diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index eabefc4..e208f8e 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -267,6 +267,7 @@ typedef struct H5D_chunk_ud_t { unsigned idx_hint; /* Index of chunk in cache, if present */ H5F_block_t chunk_block; /* Offset/length of chunk in file */ unsigned filter_mask; /* Excluded filters */ + hbool_t new_unfilt_chunk; /* Whether the chunk just became unfiltered */ hsize_t chunk_idx; /* Chunk index for EA, FA indexing */ } H5D_chunk_ud_t; @@ -615,6 +616,8 @@ H5_DLL herr_t H5D__chunk_lookup(const H5D_t *dset, hid_t dxpl_id, const hsize_t *scaled, H5D_chunk_ud_t *udata); H5_DLL herr_t H5D__chunk_allocated(H5D_t *dset, hid_t dxpl_id, hsize_t *nbytes); H5_DLL herr_t H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_t old_dim[]); +H5_DLL herr_t H5D__chunk_update_old_edge_chunks(H5D_t *dset, hid_t dxpl_id, + hsize_t old_dim[]); H5_DLL herr_t H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim); #ifdef H5_HAVE_PARALLEL diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index a1f87e3..39e6aa7 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -34,6 +34,9 @@ #define H5D_CHUNK_CACHE_NBYTES_DEFAULT ((size_t) -1) #define H5D_CHUNK_CACHE_W0_DEFAULT (-1.0f) +/* Bit flags for the H5Pset_chunk_opts() and H5Pget_chunk_opts() */ +#define H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS (0x0002u) + /* Property names for H5LTDdirect_chunk_write */ #define H5D_XFER_DIRECT_CHUNK_WRITE_FLAG_NAME "direct_chunk_flag" #define H5D_XFER_DIRECT_CHUNK_WRITE_FILTERS_NAME "direct_chunk_filters" diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 31ddb88..f2af8ef 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -124,7 +124,7 @@ H5O__layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "bad version number for layout message") if(mesg->version < H5O_LAYOUT_VERSION_3) { - unsigned ndims; /* Num dimensions in chunk */ + unsigned ndims; /* Num dimensions in chunk */ /* Dimensionality */ ndims = *p++; @@ -233,26 +233,67 @@ H5O__layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED break; case H5D_CHUNKED: - /* Dimensionality */ - mesg->u.chunk.ndims = *p++; - if(mesg->u.chunk.ndims > H5O_LAYOUT_NDIMS) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "dimensionality is too large") - - /* B-tree address */ - H5F_addr_decode(f, &p, &(mesg->storage.u.chunk.idx_addr)); - - /* Chunk dimensions */ - for(u = 0; u < mesg->u.chunk.ndims; u++) - UINT32DECODE(p, mesg->u.chunk.dim[u]); - - /* Compute chunk size */ - for(u = 1, mesg->u.chunk.size = mesg->u.chunk.dim[0]; u < mesg->u.chunk.ndims; u++) - mesg->u.chunk.size *= mesg->u.chunk.dim[u]; - - /* Set the chunk operations */ - /* (Only "btree" indexing type supported with v3 of message format) */ - mesg->storage.u.chunk.idx_type = H5D_CHUNK_IDX_BTREE; - mesg->storage.u.chunk.ops = H5D_COPS_BTREE; + if(mesg->version < H5O_LAYOUT_VERSION_4) { + /* Set the chunked layout flags */ + mesg->u.chunk.flags = (uint8_t)0; + + /* Dimensionality */ + mesg->u.chunk.ndims = *p++; + if(mesg->u.chunk.ndims > H5O_LAYOUT_NDIMS) + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "dimensionality is too large") + + /* B-tree address */ + H5F_addr_decode(f, &p, &(mesg->storage.u.chunk.idx_addr)); + + /* Chunk dimensions */ + for(u = 0; u < mesg->u.chunk.ndims; u++) + UINT32DECODE(p, mesg->u.chunk.dim[u]); + + /* Compute chunk size */ + for(u = 1, mesg->u.chunk.size = mesg->u.chunk.dim[0]; u < mesg->u.chunk.ndims; u++) + mesg->u.chunk.size *= mesg->u.chunk.dim[u]; + + /* Set the chunk operations */ + /* (Only "btree" indexing type supported with v3 of message format) */ + mesg->storage.u.chunk.idx_type = H5D_CHUNK_IDX_BTREE; + mesg->storage.u.chunk.ops = H5D_COPS_BTREE; + } /* end if */ + else { + /* Get the chunked layout flags */ + mesg->u.chunk.flags = *p++; + + /* Check for valid flags */ + /* (Currently issues an error for all non-zero values, + * until features are added for the flags) + */ + if(mesg->u.chunk.flags & ~H5O_LAYOUT_ALL_CHUNK_FLAGS) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "bad flag value for message") + + /* Dimensionality */ + mesg->u.chunk.ndims = *p++; + if(mesg->u.chunk.ndims > H5O_LAYOUT_NDIMS) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "dimensionality is too large") + + /* Encoded # of bytes for each chunk dimension */ + mesg->u.chunk.enc_bytes_per_dim = *p++; + if(mesg->u.chunk.enc_bytes_per_dim == 0 || mesg->u.chunk.enc_bytes_per_dim > 8) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "encoded chunk dimension size is too large") + + /* Chunk dimensions */ + for(u = 0; u < mesg->u.chunk.ndims; u++) + UINT64DECODE_VAR(p, mesg->u.chunk.dim[u], mesg->u.chunk.enc_bytes_per_dim); + + /* Compute chunk size */ + for(u = 1, mesg->u.chunk.size = mesg->u.chunk.dim[0]; u < mesg->u.chunk.ndims; u++) + mesg->u.chunk.size *= mesg->u.chunk.dim[u]; + + /* Set the chunk operations */ + mesg->storage.u.chunk.idx_type = H5D_CHUNK_IDX_BTREE; + mesg->storage.u.chunk.ops = H5D_COPS_BTREE; + + /* Chunk index address */ + H5F_addr_decode(f, &p, &(mesg->storage.u.chunk.idx_addr)); + } /* end else */ /* Set the layout operations */ mesg->ops = H5D_LOPS_CHUNK; @@ -457,8 +498,8 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, HDassert(p); /* Message version */ - *p++ = mesg->type == H5D_VIRTUAL ? (uint8_t)H5O_LAYOUT_VERSION_4 - : (uint8_t)H5O_LAYOUT_VERSION_3; + *p++ = (uint8_t)((mesg->version < H5O_LAYOUT_VERSION_3) ? + H5O_LAYOUT_VERSION_3 : mesg->version); /* Layout class */ *p++ = mesg->type; @@ -488,16 +529,41 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, break; case H5D_CHUNKED: - /* Number of dimensions */ - HDassert(mesg->u.chunk.ndims > 0 && mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS); - *p++ = (uint8_t)mesg->u.chunk.ndims; + if(mesg->version < H5O_LAYOUT_VERSION_4) { + /* Number of dimensions */ + HDassert(mesg->u.chunk.ndims > 0 && mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS); + *p++ = (uint8_t)mesg->u.chunk.ndims; - /* B-tree address */ - H5F_addr_encode(f, &p, mesg->storage.u.chunk.idx_addr); + /* B-tree address */ + H5F_addr_encode(f, &p, mesg->storage.u.chunk.idx_addr); - /* Dimension sizes */ - for(u = 0; u < mesg->u.chunk.ndims; u++) - UINT32ENCODE(p, mesg->u.chunk.dim[u]); + /* Dimension sizes */ + for(u = 0; u < mesg->u.chunk.ndims; u++) + UINT32ENCODE(p, mesg->u.chunk.dim[u]); + } /* end if */ + else { + /* Chunk feature flags */ + *p++ = mesg->u.chunk.flags; + + /* Number of dimensions */ + HDassert(mesg->u.chunk.ndims > 0 && mesg->u.chunk.ndims <= H5O_LAYOUT_NDIMS); + *p++ = (uint8_t)mesg->u.chunk.ndims; + + /* Encoded # of bytes for each chunk dimension */ + HDassert(mesg->u.chunk.enc_bytes_per_dim > 0 && mesg->u.chunk.enc_bytes_per_dim <= 8); + *p++ = (uint8_t)mesg->u.chunk.enc_bytes_per_dim; + + /* Dimension sizes */ + for(u = 0; u < mesg->u.chunk.ndims; u++) + UINT64ENCODE_VAR(p, mesg->u.chunk.dim[u], mesg->u.chunk.enc_bytes_per_dim); + + /* + * Implicit index: Address of the chunks + * Single chunk index: address of the single chunk + * Other indexes: chunk index address + */ + H5F_addr_encode(f, &p, mesg->storage.u.chunk.idx_addr); + } /* end else */ break; case H5D_VIRTUAL: diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index e117b8a..8175bd8 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -367,6 +367,12 @@ typedef struct H5O_efl_t { */ #define H5O_LAYOUT_NDIMS (H5S_MAX_RANK+1) +/* Flags for chunked layout feature encoding */ +#define H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS 0x01 +#define H5O_LAYOUT_ALL_CHUNK_FLAGS ( \ + H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS \ + ) + /* Initial version of the layout information. Used when space is allocated */ #define H5O_LAYOUT_VERSION_1 1 @@ -511,6 +517,7 @@ typedef struct H5O_storage_t { } H5O_storage_t; typedef struct H5O_layout_chunk_t { + uint8_t flags; /* Chunk layout flags */ unsigned ndims; /* Num dimensions in chunk */ uint32_t dim[H5O_LAYOUT_NDIMS]; /* Size of chunk in elements */ unsigned enc_bytes_per_dim; /* Encoded # of bytes for storing each chunk dimension */ diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index df88bee..8c9f792 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -57,7 +57,7 @@ #define H5D_DEF_STORAGE_COMPACT_INIT {(hbool_t)FALSE, (size_t)0, NULL} #define H5D_DEF_STORAGE_CONTIG_INIT {HADDR_UNDEF, (hsize_t)0} #define H5D_DEF_STORAGE_CHUNK_INIT {H5D_CHUNK_IDX_BTREE, HADDR_UNDEF, H5D_COPS_BTREE, {{HADDR_UNDEF, NULL}}} -#define H5D_DEF_LAYOUT_CHUNK_INIT {(unsigned)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, (unsigned)0, (uint32_t)0, (hsize_t)0, (hsize_t)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}} +#define H5D_DEF_LAYOUT_CHUNK_INIT {(uint8_t)0, (unsigned)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, (unsigned)0, (uint32_t)0, (hsize_t)0, (hsize_t)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}} #define H5D_DEF_STORAGE_VIRTUAL_INIT {{HADDR_UNDEF, 0}, 0, NULL, 0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, H5D_VDS_ERROR, HSIZE_UNDEF, -1, -1, FALSE} #ifdef H5_HAVE_C99_DESIGNATED_INITIALIZER #define H5D_DEF_STORAGE_COMPACT {H5D_COMPACT, { .compact = H5D_DEF_STORAGE_COMPACT_INIT }} @@ -2631,6 +2631,127 @@ done: /*------------------------------------------------------------------------- + * Function: H5Pset_chunk_opts + * + * Purpose: Sets the options related to chunked storage for a dataset. + * The storage must already be set to chunked. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Neil Fortner + * Thursday, January 21, 2010 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_chunk_opts(hid_t plist_id, unsigned options) +{ + H5P_genplist_t *plist; /* Property list pointer */ + H5O_layout_t layout; /* Layout information for setting chunk info */ + uint8_t layout_flags = 0; /* "options" translated into layout message flags format */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "iIu", plist_id, options); + + /* Check arguments */ + if(options & ~(H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS)) + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "unknown chunk options") + +#ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER + /* If the compiler doesn't support C99 designated initializers, check if + * the default layout structs have been initialized yet or not. *ick* -QAK + */ + if(!H5P_dcrt_def_layout_init_g) + if(H5P__init_def_layout() < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't initialize default layout info") +#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */ + + /* Get the plist structure */ + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Retrieve the layout property */ + if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout") + if(H5D_CHUNKED != layout.type) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a chunked storage layout") + + /* Translate options into flags that can be used with the layout message */ + if(options & H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS) + layout_flags |= H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS; + + /* Update the layout message, including the version (if necessary) */ + /* This probably isn't the right way to do this, and should be changed once + * this branch gets the "real" way to set the layout version */ + layout.u.chunk.flags = layout_flags; + if(layout.version < H5O_LAYOUT_VERSION_4) + layout.version = H5O_LAYOUT_VERSION_4; + + /* Set layout value */ + if(H5P_poke(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set layout") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_chunk_opts() */ + + +/*------------------------------------------------------------------------- + * Function: H5Pget_chunk_opts + * + * Purpose: Gets the options related to chunked storage for a dataset. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Neil Fortner + * Friday, January 22, 2010 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_chunk_opts(hid_t plist_id, unsigned *options) +{ + H5P_genplist_t *plist; /* Property list pointer */ + H5O_layout_t layout; /* Layout information for setting chunk info */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "i*Iu", plist_id, options); + +#ifndef H5_HAVE_C99_DESIGNATED_INITIALIZER + /* If the compiler doesn't support C99 designated initializers, check if + * the default layout structs have been initialized yet or not. *ick* -QAK + */ + if(!H5P_dcrt_def_layout_init_g) + if(H5P__init_def_layout() < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't initialize default layout info") +#endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */ + + /* Get the plist structure */ + if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") + + /* Retrieve the layout property */ + if(H5P_peek(plist, H5D_CRT_LAYOUT_NAME, &layout) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "can't get layout") + if(H5D_CHUNKED != layout.type) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a chunked storage layout") + + if(options) { + /* Translate options from flags that can be used with the layout message + * to those known to the public */ + *options = 0; + if(layout.u.chunk.flags & H5O_LAYOUT_CHUNK_DONT_FILTER_PARTIAL_BOUND_CHUNKS) + *options |= H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS; + } /* end if */ + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_chunk_opts() */ + + +/*------------------------------------------------------------------------- * Function: H5Pset_external * * Purpose: Adds an external file to the list of external files. PLIST_ID diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 894fc2c..5fdb8b8 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -374,6 +374,8 @@ H5_DLL ssize_t H5Pget_virtual_dsetname(hid_t dcpl_id, size_t index, char *name/*out*/, size_t size); H5_DLL herr_t H5Pset_external(hid_t plist_id, const char *name, off_t offset, hsize_t size); +H5_DLL herr_t H5Pset_chunk_opts(hid_t plist_id, unsigned opts); +H5_DLL herr_t H5Pget_chunk_opts(hid_t plist_id, unsigned *opts); H5_DLL int H5Pget_external_count(hid_t plist_id); H5_DLL herr_t H5Pget_external(hid_t plist_id, unsigned idx, size_t name_size, char *name/*out*/, off_t *offset/*out*/, diff --git a/test/dsets.c b/test/dsets.c index 2cb51d3..b3f11b8 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -44,10 +44,13 @@ const char *FILENAME[] = { "huge_chunks", /* 7 */ "chunk_cache", /* 8 */ "big_chunk", /* 9 */ - "chunk_expand", /* 10 */ - "copy_dcpl_newfile",/* 11 */ - "layout_extend", /* 12 */ - "zero_chunk", /* 13 */ + "chunk_fast", /* 10 */ + "chunk_expand", /* 11 */ + "chunk_fixed", /* 12 */ + "copy_dcpl_newfile",/* 13 */ + "partial_chunks", /* 14 */ + "layout_extend", /* 15 */ + "zero_chunk", /* 16 */ NULL }; #define FILENAME_BUF_SIZE 1024 @@ -125,6 +128,7 @@ const char *FILENAME[] = { #define H5Z_FILTER_DEPREC 309 #define H5Z_FILTER_EXPAND 310 #define H5Z_FILTER_CAN_APPLY_TEST2 311 +#define H5Z_FILTER_COUNT 312 /* Flags for testing filters */ #define DISABLE_FLETCHER32 0 @@ -198,6 +202,8 @@ const char *FILENAME[] = { #define DSET_DIM2 200 int points[DSET_DIM1][DSET_DIM2], check[DSET_DIM1][DSET_DIM2]; double points_dbl[DSET_DIM1][DSET_DIM2], check_dbl[DSET_DIM1][DSET_DIM2]; +size_t count_nbytes_read = 0; +size_t count_nbytes_written = 0; /* Local prototypes for filter functions */ static size_t filter_bogus(unsigned int flags, size_t cd_nelmts, @@ -212,6 +218,49 @@ static size_t filter_corrupt(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); static size_t filter_expand(unsigned int flags, size_t cd_nelmts, const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); +static size_t filter_count(unsigned int flags, size_t cd_nelmts, + const unsigned int *cd_values, size_t nbytes, size_t *buf_size, void **buf); + +/* This message derives from H5Z */ +const H5Z_class2_t H5Z_COUNT[1] = {{ + H5Z_CLASS_T_VERS, /* H5Z_class_t version */ + H5Z_FILTER_COUNT, /* Filter id number */ + 1, 1, /* Encoding and decoding enabled */ + "count", /* Filter name for debugging */ + NULL, /* The "can apply" callback */ + NULL, /* The "set local" callback */ + filter_count, /* The actual filter function */ +}}; + + +/*------------------------------------------------------------------------- + * Function: filter_count + * + * Purpose: This filter counts the number of bytes read and written, + * incrementing count_nbytes_read or count_nbytes_written as + * appropriate. + * + * Return: Success: Data chunk size + * + * Failure: 0 + * + * Programmer: Neil Fortner + * Wednesday, March 17, 2010 + * + *------------------------------------------------------------------------- + */ +static size_t +filter_count(unsigned int flags, size_t H5_ATTR_UNUSED cd_nelmts, + const unsigned int H5_ATTR_UNUSED *cd_values, size_t nbytes, + size_t H5_ATTR_UNUSED *buf_size, void H5_ATTR_UNUSED **buf) +{ + if(flags & H5Z_FLAG_REVERSE) + count_nbytes_read += nbytes; + else + count_nbytes_written += nbytes; + + return nbytes; +} /*------------------------------------------------------------------------- @@ -905,7 +954,7 @@ test_layout_extend(hid_t fapl) TESTING("extendible dataset with various layout"); /* Create a file */ - h5_fixname(FILENAME[12], fapl, filename, sizeof filename); + h5_fixname(FILENAME[15], fapl, filename, sizeof filename); if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -2798,7 +2847,7 @@ test_nbit_int(hid_t file) mask = ~((unsigned)~0 << (precision + offset)) & ((unsigned)~0 << offset); for(i=0; i<(size_t)size[0]; i++) { for(j=0; j<(size_t)size[1]; j++) { - if((new_data[i][j] & mask) != (orig_data[i][j] & mask)) { + if(((unsigned)new_data[i][j] & mask) != ((unsigned)orig_data[i][j] & mask)) { H5_FAILED(); printf(" Read different values than written.\n"); printf(" At index %lu,%lu\n", (unsigned long)i, (unsigned long)j); @@ -3337,9 +3386,9 @@ test_nbit_compound(hid_t file) s_mask = ~((unsigned)~0 << (precision[2] + offset[2])) & ((unsigned)~0 << offset[2]); for(i=0; i 0), "H5Fcreate succeeded"); - - /* Create property list for chunking and compression */ - dcpl = H5Pcreate(H5P_DATASET_CREATE); - VRFY((dcpl > 0), "H5Pcreate succeeded"); - - ret = H5Pset_layout(dcpl, H5D_CHUNKED); - VRFY((ret >= 0), "H5Pset_layout succeeded"); - - /* Use eight chunks */ - chunk_dim = dim / 8; - ret = H5Pset_chunk(dcpl, rank, &chunk_dim); - VRFY((ret >= 0), "H5Pset_chunk succeeded"); + /* Run test both with and without filters disabled on partial chunks */ + for(disable_partial_chunk_filters = 0; disable_partial_chunk_filters <= 1; + disable_partial_chunk_filters++) { + /* Process zero creates the file with a compressed, chunked dataset */ + if(mpi_rank==0) { + hsize_t chunk_dim; /* Chunk dimensions */ + + /* Create the file */ + fid = H5Fcreate(h5_rmprefix(filename), H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + VRFY((fid > 0), "H5Fcreate succeeded"); + + /* Create property list for chunking and compression */ + dcpl = H5Pcreate(H5P_DATASET_CREATE); + VRFY((dcpl > 0), "H5Pcreate succeeded"); + + ret = H5Pset_layout(dcpl, H5D_CHUNKED); + VRFY((ret >= 0), "H5Pset_layout succeeded"); + + /* Use eight chunks */ + chunk_dim = dim / 8; + ret = H5Pset_chunk(dcpl, rank, &chunk_dim); + VRFY((ret >= 0), "H5Pset_chunk succeeded"); + + /* Set chunk options appropriately */ + if(disable_partial_chunk_filters) { + ret = H5Pget_chunk_opts(dcpl, &chunk_opts); + VRFY((ret>=0),"H5Pget_chunk_opts succeeded"); + + chunk_opts |= H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS; + + ret = H5Pset_chunk_opts(dcpl, chunk_opts); + VRFY((ret>=0),"H5Pset_chunk_opts succeeded"); + } /* end if */ + + ret = H5Pset_deflate(dcpl, 9); + VRFY((ret >= 0), "H5Pset_deflate succeeded"); + + /* Create dataspace */ + dataspace = H5Screate_simple(rank, &dim, NULL); + VRFY((dataspace > 0), "H5Screate_simple succeeded"); + + /* Create dataset */ + dataset = H5Dcreate2(fid, "compressed_data", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, dcpl, H5P_DEFAULT); + VRFY((dataset > 0), "H5Dcreate2 succeeded"); + + /* Write compressed data */ + ret = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_orig); + VRFY((ret >= 0), "H5Dwrite succeeded"); + + /* Close objects */ + ret = H5Pclose(dcpl); + VRFY((ret >= 0), "H5Pclose succeeded"); + ret = H5Sclose(dataspace); + VRFY((ret >= 0), "H5Sclose succeeded"); + ret = H5Dclose(dataset); + VRFY((ret >= 0), "H5Dclose succeeded"); + ret = H5Fclose(fid); + VRFY((ret >= 0), "H5Fclose succeeded"); + } - ret = H5Pset_deflate(dcpl, 9); - VRFY((ret >= 0), "H5Pset_deflate succeeded"); + /* Wait for file to be created */ + MPI_Barrier(comm); - /* Create dataspace */ - dataspace = H5Screate_simple(rank, &dim, NULL); - VRFY((dataspace > 0), "H5Screate_simple succeeded"); + /* ------------------- + * OPEN AN HDF5 FILE + * -------------------*/ - /* Create dataset */ - dataset = H5Dcreate2(fid, "compressed_data", H5T_NATIVE_INT, dataspace, H5P_DEFAULT, dcpl, H5P_DEFAULT); - VRFY((dataset > 0), "H5Dcreate2 succeeded"); + /* setup file access template */ + acc_tpl = create_faccess_plist(comm, info, facc_type); + VRFY((acc_tpl >= 0), ""); - /* Write compressed data */ - ret = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_orig); - VRFY((ret >= 0), "H5Dwrite succeeded"); + /* open the file collectively */ + fid=H5Fopen(filename,H5F_ACC_RDWR,acc_tpl); + VRFY((fid > 0), "H5Fopen succeeded"); - /* Close objects */ - ret = H5Pclose(dcpl); + /* Release file-access template */ + ret = H5Pclose(acc_tpl); VRFY((ret >= 0), "H5Pclose succeeded"); - ret = H5Sclose(dataspace); - VRFY((ret >= 0), "H5Sclose succeeded"); - ret = H5Dclose(dataset); - VRFY((ret >= 0), "H5Dclose succeeded"); - ret = H5Fclose(fid); - VRFY((ret >= 0), "H5Fclose succeeded"); - } - /* Wait for file to be created */ - MPI_Barrier(comm); - - /* ------------------- - * OPEN AN HDF5 FILE - * -------------------*/ - /* setup file access template */ - acc_tpl = create_faccess_plist(comm, info, facc_type); - VRFY((acc_tpl >= 0), ""); + /* Open dataset with compressed chunks */ + dataset = H5Dopen2(fid, "compressed_data", H5P_DEFAULT); + VRFY((dataset > 0), "H5Dopen2 succeeded"); - /* open the file collectively */ - fid=H5Fopen(filename,H5F_ACC_RDWR,acc_tpl); - VRFY((fid > 0), "H5Fopen succeeded"); + /* Try reading & writing data */ + if(dataset>0) { + /* Create dataset transfer property list */ + xfer_plist = H5Pcreate(H5P_DATASET_XFER); + VRFY((xfer_plist > 0), "H5Pcreate succeeded"); - /* Release file-access template */ - ret = H5Pclose(acc_tpl); - VRFY((ret >= 0), "H5Pclose succeeded"); - - - /* Open dataset with compressed chunks */ - dataset = H5Dopen2(fid, "compressed_data", H5P_DEFAULT); - VRFY((dataset > 0), "H5Dopen2 succeeded"); - - /* Try reading & writing data */ - if(dataset>0) { - /* Create dataset transfer property list */ - xfer_plist = H5Pcreate(H5P_DATASET_XFER); - VRFY((xfer_plist > 0), "H5Pcreate succeeded"); - - ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - if(dxfer_coll_type == DXFER_INDEPENDENT_IO) { - ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO); - VRFY((ret>= 0),"set independent IO collectively succeeded"); - } + ret = H5Pset_dxpl_mpio(xfer_plist, H5FD_MPIO_COLLECTIVE); + VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); + if(dxfer_coll_type == DXFER_INDEPENDENT_IO) { + ret = H5Pset_dxpl_mpio_collective_opt(xfer_plist,H5FD_MPIO_INDIVIDUAL_IO); + VRFY((ret>= 0),"set independent IO collectively succeeded"); + } - /* Try reading the data */ - ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer_plist, data_read); - VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); + /* Try reading the data */ + ret = H5Dread(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, xfer_plist, data_read); + VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); - /* Verify data read */ - for(u=0; u= 0), "H5Pclose succeeded"); - ret = H5Dclose(dataset); - VRFY((ret >= 0), "H5Dclose succeeded"); - } /* end if */ + ret = H5Pclose(xfer_plist); + VRFY((ret >= 0), "H5Pclose succeeded"); + ret = H5Dclose(dataset); + VRFY((ret >= 0), "H5Dclose succeeded"); + } /* end if */ - ret = H5Fclose(fid); - VRFY((ret >= 0), "H5Fclose succeeded"); + /* Close file */ + ret = H5Fclose(fid); + VRFY((ret >= 0), "H5Fclose succeeded"); + } /* end for */ /* release data buffers */ if(data_read) HDfree(data_read); diff --git a/testpar/t_filter_read.c b/testpar/t_filter_read.c index 5e1cd04..44f3f11 100644 --- a/testpar/t_filter_read.c +++ b/testpar/t_filter_read.c @@ -213,6 +213,8 @@ test_filter_read(void) hid_t dc; /* HDF5 IDs */ const hsize_t chunk_size[2] = {CHUNK_DIM1, CHUNK_DIM2}; /* Chunk dimensions */ hsize_t null_size; /* Size of dataset without filters */ + unsigned chunk_opts; /* Chunk options */ + unsigned disable_partial_chunk_filters; /* Whether filters are disabled on partial chunks */ herr_t hrc; const char *filename; hsize_t fletcher32_size; /* Size of dataset with Fletcher32 checksum */ @@ -254,74 +256,104 @@ test_filter_read(void) hrc = H5Pclose (dc); VRFY(hrc>=0,"H5Pclose"); - /*---------------------------------------------------------- - * STEP 1: Test Fletcher32 Checksum by itself. - *---------------------------------------------------------- - */ - - dc = H5Pcreate(H5P_DATASET_CREATE); - VRFY(dc>=0,"H5Pset_filter"); + /* Run steps 1-3 both with and without filters disabled on partial chunks */ + for(disable_partial_chunk_filters = 0; disable_partial_chunk_filters <= 1; + disable_partial_chunk_filters++) { + /* Set chunk options appropriately */ + dc = H5Pcreate(H5P_DATASET_CREATE); + VRFY(dc>=0,"H5Pcreate"); - hrc = H5Pset_chunk (dc, 2, chunk_size); - VRFY(hrc>=0,"H5Pset_filter"); + hrc = H5Pset_chunk (dc, 2, chunk_size); + VRFY(hrc>=0,"H5Pset_filter"); - hrc = H5Pset_filter (dc,H5Z_FILTER_FLETCHER32,0,0,NULL); - VRFY(hrc>=0,"H5Pset_filter"); + hrc = H5Pget_chunk_opts(dc, &chunk_opts); + VRFY(hrc>=0,"H5Pget_chunk_opts"); - filter_read_internal(filename,dc,&fletcher32_size); - VRFY(fletcher32_size > null_size,"Size after checksumming is incorrect."); + if(disable_partial_chunk_filters) + chunk_opts |= H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS; - /* Clean up objects used for this test */ - hrc = H5Pclose (dc); - VRFY(hrc>=0, "H5Pclose"); + hrc = H5Pclose (dc); + VRFY(hrc>=0,"H5Pclose"); + /*---------------------------------------------------------- + * STEP 1: Test Fletcher32 Checksum by itself. + *---------------------------------------------------------- + */ +#ifdef H5_HAVE_FILTER_FLETCHER32 - /*---------------------------------------------------------- - * STEP 2: Test deflation by itself. - *---------------------------------------------------------- - */ -#ifdef H5_HAVE_FILTER_DEFLATE + dc = H5Pcreate(H5P_DATASET_CREATE); + VRFY(dc>=0,"H5Pset_filter"); - dc = H5Pcreate(H5P_DATASET_CREATE); - VRFY(dc>=0, "H5Pcreate"); + hrc = H5Pset_chunk (dc, 2, chunk_size); + VRFY(hrc>=0,"H5Pset_filter"); - hrc = H5Pset_chunk (dc, 2, chunk_size); - VRFY(hrc>=0, "H5Pset_chunk"); + hrc = H5Pset_chunk_opts (dc, chunk_opts); + VRFY(hrc>=0,"H5Pset_chunk_opts"); - hrc = H5Pset_deflate (dc, 6); - VRFY(hrc>=0, "H5Pset_deflate"); + hrc = H5Pset_filter (dc,H5Z_FILTER_FLETCHER32,0,0,NULL); + VRFY(hrc>=0,"H5Pset_filter"); - filter_read_internal(filename,dc,&deflate_size); + filter_read_internal(filename,dc,&fletcher32_size); + VRFY(fletcher32_size > null_size,"Size after checksumming is incorrect."); - /* Clean up objects used for this test */ - hrc = H5Pclose (dc); - VRFY(hrc>=0, "H5Pclose"); + /* Clean up objects used for this test */ + hrc = H5Pclose (dc); + VRFY(hrc>=0, "H5Pclose"); -#endif /* H5_HAVE_FILTER_DEFLATE */ +#endif /* H5_HAVE_FILTER_FLETCHER32 */ + /*---------------------------------------------------------- + * STEP 2: Test deflation by itself. + *---------------------------------------------------------- + */ +#ifdef H5_HAVE_FILTER_DEFLATE - /*---------------------------------------------------------- - * STEP 3: Test szip compression by itself. - *---------------------------------------------------------- - */ -#ifdef H5_HAVE_FILTER_SZIP - if(h5_szip_can_encode() == 1) { dc = H5Pcreate(H5P_DATASET_CREATE); VRFY(dc>=0, "H5Pcreate"); hrc = H5Pset_chunk (dc, 2, chunk_size); VRFY(hrc>=0, "H5Pset_chunk"); - hrc = H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block); - VRFY(hrc>=0, "H5Pset_szip"); + hrc = H5Pset_chunk_opts (dc, chunk_opts); + VRFY(hrc>=0,"H5Pset_chunk_opts"); + + hrc = H5Pset_deflate (dc, 6); + VRFY(hrc>=0, "H5Pset_deflate"); - filter_read_internal(filename,dc,&szip_size); + filter_read_internal(filename,dc,&deflate_size); /* Clean up objects used for this test */ hrc = H5Pclose (dc); VRFY(hrc>=0, "H5Pclose"); - } + +#endif /* H5_HAVE_FILTER_DEFLATE */ + + /*---------------------------------------------------------- + * STEP 3: Test szip compression by itself. + *---------------------------------------------------------- + */ +#ifdef H5_HAVE_FILTER_SZIP + if(h5_szip_can_encode() == 1) { + dc = H5Pcreate(H5P_DATASET_CREATE); + VRFY(dc>=0, "H5Pcreate"); + + hrc = H5Pset_chunk (dc, 2, chunk_size); + VRFY(hrc>=0, "H5Pset_chunk"); + + hrc = H5Pset_chunk_opts (dc, chunk_opts); + VRFY(hrc>=0,"H5Pset_chunk_opts"); + + hrc = H5Pset_szip(dc, szip_options_mask, szip_pixels_per_block); + VRFY(hrc>=0, "H5Pset_szip"); + + filter_read_internal(filename,dc,&szip_size); + + /* Clean up objects used for this test */ + hrc = H5Pclose (dc); + VRFY(hrc>=0, "H5Pclose"); + } #endif /* H5_HAVE_FILTER_SZIP */ + } /* end for */ /*---------------------------------------------------------- -- cgit v0.12 From 3cd705e56e6ef13c3423df68bb12704d483409ae Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sun, 3 Apr 2016 03:48:50 -0500 Subject: [svn-r29612] Description: Bring updated layout and EFL property comparisons and new "latest format" flags from revise_chunks branch. Tested on: MacOSX/64 10.11.4 (amazon) w/serial, parallel & production (h5committest forthcoming) --- src/H5Aint.c | 13 ++++++------- src/H5Dint.c | 47 ++++++++++++++++++++++++++--------------------- src/H5Dlayout.c | 35 +++++++++++++++++++++++++++++++++++ src/H5Dpkg.h | 2 ++ src/H5Fint.c | 11 +++++++++-- src/H5Fpkg.h | 2 +- src/H5Fprivate.h | 22 +++++++++++++++++++--- src/H5Fquery.c | 17 ++++++++--------- src/H5Fsuper.c | 4 ++-- src/H5Gobj.c | 2 +- src/H5HFhdr.c | 2 +- src/H5O.c | 2 +- src/H5Opkg.h | 4 ++-- src/H5Pdcpl.c | 14 -------------- src/H5Ppkg.h | 1 - src/H5Ptest.c | 46 ---------------------------------------------- src/H5Tcommit.c | 2 +- test/objcopy.c | 39 +-------------------------------------- 18 files changed, 115 insertions(+), 150 deletions(-) diff --git a/src/H5Aint.c b/src/H5Aint.c index 1736dc0..ffb8667 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -207,7 +207,7 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "invalid datatype location") /* Set the latest format for datatype, if requested */ - if(H5F_USE_LATEST_FORMAT(loc->oloc->file)) + if(H5F_USE_LATEST_FLAGS(loc->oloc->file, H5F_LATEST_DATATYPE)) if(H5T_set_latest_version(attr->shared->dt) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of datatype") @@ -215,7 +215,7 @@ H5A_create(const H5G_loc_t *loc, const char *name, const H5T_t *type, attr->shared->ds = H5S_copy(space, FALSE, TRUE); /* Set the latest format for dataspace, if requested */ - if(H5F_USE_LATEST_FORMAT(loc->oloc->file)) + if(H5F_USE_LATEST_FLAGS(loc->oloc->file, H5F_LATEST_DATASPACE)) if(H5S_set_latest_version(attr->shared->ds) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of dataspace") @@ -1853,7 +1853,7 @@ herr_t H5A_set_version(const H5F_t *f, H5A_t *attr) { hbool_t type_shared, space_shared; /* Flags to indicate that shared messages are used for this attribute */ - hbool_t use_latest_format; /* Flag indicating the newest file format should be used */ + hbool_t use_latest_format; /* Flag indicating the latest attribute version support is enabled */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1862,8 +1862,8 @@ H5A_set_version(const H5F_t *f, H5A_t *attr) HDassert(f); HDassert(attr); - /* Get the file's 'use the latest version of the format' flag */ - use_latest_format = H5F_USE_LATEST_FORMAT(f); + /* Get the file's 'use the latest attribute version support' flag */ + use_latest_format = H5F_USE_LATEST_FLAGS(f, H5F_LATEST_ATTRIBUTE); /* Check whether datatype and dataspace are shared */ if(H5O_msg_is_shared(H5O_DTYPE_ID, attr->shared->dt) > 0) @@ -2354,8 +2354,7 @@ H5A_dense_post_copy_file_all(const H5O_loc_t *src_oloc, const H5O_ainfo_t *ainfo attr_op.op_type = H5A_ATTR_OP_LIB; attr_op.u.lib_op = H5A__dense_post_copy_file_cb; - - if(H5A_dense_iterate(src_oloc->file, dxpl_id, (hid_t)0, ainfo_src, H5_INDEX_NAME, + if(H5A_dense_iterate(src_oloc->file, dxpl_id, (hid_t)0, ainfo_src, H5_INDEX_NAME, H5_ITER_NATIVE, (hsize_t)0, NULL, &attr_op, &udata) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "error building attribute table") diff --git a/src/H5Dint.c b/src/H5Dint.c index 570ee99..6c1f24a 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -648,7 +648,7 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) { htri_t relocatable; /* Flag whether the type is relocatable */ htri_t immutable; /* Flag whether the type is immutable */ - hbool_t use_latest_format; /* Flag indicating the newest file format should be used */ + hbool_t use_latest_format; /* Flag indicating the 'latest datatype version support' is enabled */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -666,8 +666,8 @@ H5D__init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type) if((immutable = H5T_is_immutable(type)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't check datatype?") - /* Get the file's 'use the latest version of the format' flag */ - use_latest_format = H5F_USE_LATEST_FORMAT(file); + /* Get the file's 'use the latest datatype version support' flag */ + use_latest_format = H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DATATYPE); /* Copy the datatype if it's a custom datatype or if it'll change when it's location is changed */ if(!immutable || relocatable || use_latest_format) { @@ -759,7 +759,7 @@ done: static herr_t H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space) { - hbool_t use_latest_format; /* Flag indicating the newest file format should be used */ + hbool_t use_latest_format; /* Flag indicating the 'latest dataspace version support' is enabled */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC @@ -769,8 +769,8 @@ H5D__init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space) HDassert(dset); HDassert(space); - /* Get the file's 'use the latest version of the format' flag */ - use_latest_format = H5F_USE_LATEST_FORMAT(file); + /* Get the file's 'use the latest dataspace version support' flag */ + use_latest_format = H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DATASPACE); /* Copy dataspace for dataset */ if(NULL == (dset->shared->space = H5S_copy(space, FALSE, TRUE))) @@ -815,7 +815,6 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id) H5O_loc_t *oloc = NULL; /* Dataset's object location */ H5O_layout_t *layout; /* Dataset's layout information */ H5T_t *type; /* Dataset's datatype */ - hbool_t use_latest_format; /* Flag indicating the newest file format should be used */ H5O_fill_t *fill_prop; /* Pointer to dataset's fill value information */ H5D_fill_value_t fill_status; /* Fill value status */ hbool_t fill_changed = FALSE; /* Flag indicating the fill value was changed */ @@ -834,9 +833,6 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id) type = dset->shared->type; fill_prop = &dset->shared->dcpl_cache.fill; - /* Get the file's 'use the latest version of the format' flag */ - use_latest_format = H5F_USE_LATEST_FORMAT(file); - /* Retrieve "defined" status of fill value */ if(H5P_is_fill_value_defined(fill_prop, &fill_status) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't tell if fill value defined") @@ -913,8 +909,8 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update new fill value header message") /* If there is valid information for the old fill value struct, add it */ - /* (only if we aren't trying to write the latest version of the file format) */ - if(fill_prop->buf && !use_latest_format) { + /* (only if we aren't trying to write the 'latest fill message version support') */ + if(fill_prop->buf && !(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_FILL_MSG))) { H5O_fill_t old_fill_prop; /* Copy of fill value property, for writing as "old" fill value */ /* Shallow copy the fill value property */ @@ -966,10 +962,10 @@ H5D__update_oh_info(H5F_t *file, hid_t dxpl_id, H5D_t *dset, hid_t dapl_id) #endif /* H5O_ENABLE_BOGUS */ /* Add a modification time message, if using older format. */ - /* (If using the latest format, the modification time is part of the object + /* (If using the latest 'no modification time message' version support, the modification time is part of the object * header and doesn't use a separate message -QAK) */ - if(!use_latest_format) + if(!(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_NO_MOD_TIME_MSG))) if(H5O_touch_oh(file, dxpl_id, oh, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to update modification time message") @@ -1208,14 +1204,23 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, } /* end if */ /* Set the latest version of the layout, pline & fill messages, if requested */ - if(H5F_USE_LATEST_FORMAT(file)) { + if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DSET_MSG_FLAGS)) { /* Set the latest version for the I/O pipeline message */ - if(H5O_pline_set_latest_version(&new_dset->shared->dcpl_cache.pline) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of I/O filter pipeline") - - /* Set the latest version for the fill value message */ - if(H5O_fill_set_latest_version(&new_dset->shared->dcpl_cache.fill) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of fill value") + if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_PLINE_MSG)) + if(H5O_pline_set_latest_version(&new_dset->shared->dcpl_cache.pline) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of I/O filter pipeline") + + /* Set the latest version for the fill message */ + if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_FILL_MSG)) + /* Set the latest version for the fill value message */ + if(H5O_fill_set_latest_version(&new_dset->shared->dcpl_cache.fill) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of fill value") + + /* Set the latest version for the layout message */ + if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_LAYOUT_MSG)) + /* Set the latest version for the layout message */ + if(H5D__layout_set_latest_version(&new_dset->shared->layout, new_dset->shared->space, &new_dset->shared->dcpl_cache) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of layout") } /* end if */ /* Check if this dataset is going into a parallel file and set space allocation time */ diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index 19b1c95..2b444e4 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -212,6 +212,41 @@ done: /*------------------------------------------------------------------------- + * Function: H5D__layout_set_latest_version + * + * Purpose: Set the encoding for a layout to the latest version. + * Part of the coding in this routine is moved to + * H5D__layout_set_latest_indexing(). + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, January 15, 2009 + * + *------------------------------------------------------------------------- + */ +herr_t +H5D__layout_set_latest_version(H5O_layout_t *layout, const H5S_t *space, + const H5D_dcpl_cache_t *dcpl_cache) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity check */ + HDassert(layout); + HDassert(space); + HDassert(dcpl_cache); + + /* Set encoding of layout to latest version */ + layout->version = H5O_LAYOUT_VERSION_LATEST; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__layout_set_latest_version() */ + + +/*------------------------------------------------------------------------- * Function: H5D__layout_oh_create * * Purpose: Create layout/pline/efl information for dataset diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index e208f8e..66c4773 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -582,6 +582,8 @@ H5_DLL herr_t H5D__scatgath_write(const H5D_io_info_t *io_info, H5_DLL herr_t H5D__layout_set_io_ops(const H5D_t *dataset); H5_DLL size_t H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t include_compact_data); +H5_DLL herr_t H5D__layout_set_latest_version(H5O_layout_t *layout, + const H5S_t *space, const H5D_dcpl_cache_t *dcpl_cache); H5_DLL herr_t H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset, hid_t dapl_id); H5_DLL herr_t H5D__layout_oh_read(H5D_t *dset, hid_t dxpl_id, hid_t dapl_id, diff --git a/src/H5Fint.c b/src/H5Fint.c index 1c29fee..4da382b 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -130,6 +130,7 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) H5FD_driver_prop_t driver_prop; /* Property for driver ID & info */ hbool_t driver_prop_copied = FALSE; /* Whether the driver property has been set up */ unsigned efc_size = 0; + hbool_t latest_format = FALSE; /* Always use the latest format? */ hid_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -166,7 +167,9 @@ H5F_get_access_plist(H5F_t *f, hbool_t app_ref) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't sieve buffer size") if(H5P_set(new_plist, H5F_ACS_SDATA_BLOCK_SIZE_NAME, &(f->shared->sdata_aggr.alloc_size)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'small data' cache size") - if(H5P_set(new_plist, H5F_ACS_LATEST_FORMAT_NAME, &(f->shared->latest_format)) < 0) + if(f->shared->latest_flags > 0) + latest_format = TRUE; + if(H5P_set(new_plist, H5F_ACS_LATEST_FORMAT_NAME, &latest_format) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set 'latest format' flag") if(f->shared->efc) efc_size = H5F_efc_max_nfiles(f->shared->efc); @@ -575,6 +578,7 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t else { H5P_genplist_t *plist; /* Property list */ unsigned efc_size; /* External file cache size */ + hbool_t latest_format; /* Always use the latest format? */ size_t u; /* Local index variable */ HDassert(lf != NULL); @@ -630,8 +634,11 @@ H5F_new(H5F_file_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get garbage collect reference") if(H5P_get(plist, H5F_ACS_SIEVE_BUF_SIZE_NAME, &(f->shared->sieve_buf_size)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get sieve buffer size") - if(H5P_get(plist, H5F_ACS_LATEST_FORMAT_NAME, &(f->shared->latest_format)) < 0) + if(H5P_get(plist, H5F_ACS_LATEST_FORMAT_NAME, &latest_format) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get 'latest format' flag") + /* For latest format, activate all latest version support */ + if(latest_format) + f->shared->latest_flags |= H5F_LATEST_ALL_FLAGS; if(H5P_get(plist, H5F_ACS_META_BLOCK_SIZE_NAME, &(f->shared->meta_aggr.alloc_size)) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get metadata cache size") f->shared->meta_aggr.feature_flag = H5FD_FEAT_AGGREGATE_METADATA; diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index ab2ef9e..06f0207 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -268,7 +268,7 @@ struct H5F_file_t { hsize_t threshold; /* Threshold for alignment */ hsize_t alignment; /* Alignment */ unsigned gc_ref; /* Garbage-collect references? */ - hbool_t latest_format; /* Always use the latest format? */ + unsigned latest_flags; /* The latest version support */ hbool_t store_msg_crt_idx; /* Store creation index for object header messages? */ unsigned ncwfs; /* Num entries on cwfs list */ struct H5HG_heap_t **cwfs; /* Global heap cache */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 52649e5..3a92538 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -308,7 +308,7 @@ #define H5F_RDCC_W0(F) ((F)->shared->rdcc_w0) #define H5F_SIEVE_BUF_SIZE(F) ((F)->shared->sieve_buf_size) #define H5F_GC_REF(F) ((F)->shared->gc_ref) -#define H5F_USE_LATEST_FORMAT(F) ((F)->shared->latest_format) +#define H5F_USE_LATEST_FLAGS(F,FL) ((F)->shared->latest_flags & (FL)) #define H5F_STORE_MSG_CRT_IDX(F) ((F)->shared->store_msg_crt_idx) #define H5F_SET_STORE_MSG_CRT_IDX(F, FL) ((F)->shared->store_msg_crt_idx = (FL)) #define H5F_GRP_BTREE_SHARED(F) ((F)->shared->grp_btree_shared) @@ -353,7 +353,7 @@ #define H5F_RDCC_W0(F) (H5F_rdcc_w0(F)) #define H5F_SIEVE_BUF_SIZE(F) (H5F_sieve_buf_size(F)) #define H5F_GC_REF(F) (H5F_gc_ref(F)) -#define H5F_USE_LATEST_FORMAT(F) (H5F_use_latest_format(F)) +#define H5F_USE_LATEST_FLAGS(F,FL) (H5F_use_latest_flags(F,FL)) #define H5F_STORE_MSG_CRT_IDX(F) (H5F_store_msg_crt_idx(F)) #define H5F_SET_STORE_MSG_CRT_IDX(F, FL) (H5F_set_store_msg_crt_idx((F), (FL))) #define H5F_GRP_BTREE_SHARED(F) (H5F_grp_btree_shared(F)) @@ -555,6 +555,22 @@ #define H5SM_LIST_MAGIC "SMLI" /* Shared Message List */ +/* Latest format will activate the following latest version support */ +/* "latest_flags" in H5F_file_t */ +#define H5F_LATEST_DATATYPE 0x0001 +#define H5F_LATEST_DATASPACE 0x0002 +#define H5F_LATEST_ATTRIBUTE 0x0004 +#define H5F_LATEST_FILL_MSG 0x0008 +#define H5F_LATEST_PLINE_MSG 0x0010 +#define H5F_LATEST_LAYOUT_MSG 0x0020 +#define H5F_LATEST_NO_MOD_TIME_MSG 0x0040 +#define H5F_LATEST_STYLE_GROUP 0x0080 +#define H5F_LATEST_OBJ_HEADER 0x0100 +#define H5F_LATEST_SUPERBLOCK 0x0200 +#define H5F_LATEST_ALL_FLAGS (H5F_LATEST_DATATYPE | H5F_LATEST_DATASPACE | H5F_LATEST_ATTRIBUTE | H5F_LATEST_FILL_MSG | H5F_LATEST_PLINE_MSG | H5F_LATEST_LAYOUT_MSG | H5F_LATEST_NO_MOD_TIME_MSG | H5F_LATEST_STYLE_GROUP | H5F_LATEST_OBJ_HEADER | H5F_LATEST_SUPERBLOCK) + +#define H5F_LATEST_DSET_MSG_FLAGS (H5F_LATEST_FILL_MSG | H5F_LATEST_PLINE_MSG | H5F_LATEST_LAYOUT_MSG) + /****************************/ /* Library Private Typedefs */ /****************************/ @@ -641,7 +657,7 @@ H5_DLL size_t H5F_rdcc_nslots(const H5F_t *f); H5_DLL double H5F_rdcc_w0(const H5F_t *f); H5_DLL size_t H5F_sieve_buf_size(const H5F_t *f); H5_DLL unsigned H5F_gc_ref(const H5F_t *f); -H5_DLL hbool_t H5F_use_latest_format(const H5F_t *f); +H5_DLL unsigned H5F_use_latest_flags(const H5F_t *f, unsigned fl); H5_DLL hbool_t H5F_store_msg_crt_idx(const H5F_t *f); H5_DLL herr_t H5F_set_store_msg_crt_idx(H5F_t *f, hbool_t flag); H5_DLL struct H5UC_t *H5F_grp_btree_shared(const H5F_t *f); diff --git a/src/H5Fquery.c b/src/H5Fquery.c index e9af300..dd6e8e3 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -779,23 +779,22 @@ H5F_gc_ref(const H5F_t *f) /*------------------------------------------------------------------------- - * Function: H5F_use_latest_format + * Function: H5F_use_latest_flags * - * Purpose: Retrieve the 'use the latest version of the format' flag for - * the file. + * Purpose: Retrieve the 'latest version support' for the file. * - * Return: Success: Non-negative, the 'use the latest format' flag + * Return: Success: Non-negative, the requested 'version support' * * Failure: (can't happen) * * Programmer: Quincey Koziol * koziol@hdfgroup.org - * Oct 2 2006 + * Mar 5 2007 * *------------------------------------------------------------------------- */ -hbool_t -H5F_use_latest_format(const H5F_t *f) +unsigned +H5F_use_latest_flags(const H5F_t *f, unsigned fl) { /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -803,8 +802,8 @@ H5F_use_latest_format(const H5F_t *f) HDassert(f); HDassert(f->shared); - FUNC_LEAVE_NOAPI(f->shared->latest_format) -} /* end H5F_use_latest_format() */ + FUNC_LEAVE_NOAPI(f->shared->latest_flags & (fl)) +} /* end H5F_use_latest_flags() */ /*------------------------------------------------------------------------- diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 70d1a49..4aca221 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -744,8 +744,8 @@ H5F__super_init(H5F_t *f, hid_t dxpl_id) if(H5P_get(plist, H5F_CRT_BTREE_RANK_NAME, &sblock->btree_k[0]) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get rank for btree internal nodes") - /* Bump superblock version if we are to use the latest version of the format */ - if(f->shared->latest_format) + /* Bump superblock version if latest superblock version support is enabled */ + if(H5F_USE_LATEST_FLAGS(f, H5F_LATEST_SUPERBLOCK)) super_vers = HDF5_SUPERBLOCK_VERSION_LATEST; /* Bump superblock version to create superblock extension for SOHM info */ else if(f->shared->sohm_nindexes > 0) diff --git a/src/H5Gobj.c b/src/H5Gobj.c index f7782a6..92ad0af 100644 --- a/src/H5Gobj.c +++ b/src/H5Gobj.c @@ -208,7 +208,7 @@ H5G__obj_create_real(H5F_t *f, hid_t dxpl_id, const H5O_ginfo_t *ginfo, /* Check for using the latest version of the group format */ /* (add more checks for creating "new format" groups when needed) */ - if(H5F_USE_LATEST_FORMAT(f) || linfo->track_corder + if(H5F_USE_LATEST_FLAGS(f, H5F_LATEST_STYLE_GROUP) || linfo->track_corder || (pline && pline->nused)) use_latest_format = TRUE; else diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index 19ea14a..42857c0 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -427,7 +427,7 @@ H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOPY, HADDR_UNDEF, "can't copy I/O filter pipeline") /* Pay attention to the latest version flag for the file */ - if(H5F_USE_LATEST_FORMAT(hdr->f)) + if(H5F_USE_LATEST_FLAGS(hdr->f, H5F_LATEST_PLINE_MSG)) /* Set the latest version for the I/O pipeline message */ if(H5O_pline_set_latest_version(&(hdr->pline)) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTSET, HADDR_UNDEF, "can't set latest version of I/O filter pipeline") diff --git a/src/H5O.c b/src/H5O.c index 1937483..e881817 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -1161,7 +1161,7 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, size_t initial_rc, /* Initialize file-specific information for object header */ store_msg_crt_idx = H5F_STORE_MSG_CRT_IDX(f); - if(H5F_USE_LATEST_FORMAT(f) || store_msg_crt_idx || (oh_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED)) + if(H5F_USE_LATEST_FLAGS(f, H5F_LATEST_OBJ_HEADER) || store_msg_crt_idx || (oh_flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED)) oh->version = H5O_VERSION_LATEST; else oh->version = H5O_VERSION_1; diff --git a/src/H5Opkg.h b/src/H5Opkg.h index cc1b289..5bce19e 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -66,7 +66,7 @@ #define H5O_ALIGN_OH(O, X) \ H5O_ALIGN_VERS((O)->version, X) #define H5O_ALIGN_F(F, X) \ - H5O_ALIGN_VERS((H5F_USE_LATEST_FORMAT(F) ? H5O_VERSION_LATEST : H5O_VERSION_1), X) + H5O_ALIGN_VERS((H5F_USE_LATEST_FLAGS(F, H5F_LATEST_OBJ_HEADER) ? H5O_VERSION_LATEST : H5O_VERSION_1), X) /* Size of checksum (on disk) */ #define H5O_SIZEOF_CHKSUM 4 @@ -138,7 +138,7 @@ #define H5O_SIZEOF_MSGHDR_OH(O) \ H5O_SIZEOF_MSGHDR_VERS((O)->version, (O)->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) #define H5O_SIZEOF_MSGHDR_F(F, C) \ - H5O_SIZEOF_MSGHDR_VERS((H5F_USE_LATEST_FORMAT(F) || H5F_STORE_MSG_CRT_IDX(F)) ? H5O_VERSION_LATEST : H5O_VERSION_1, (C)) + H5O_SIZEOF_MSGHDR_VERS((H5F_USE_LATEST_FLAGS(F, H5F_LATEST_OBJ_HEADER) || H5F_STORE_MSG_CRT_IDX(F)) ? H5O_VERSION_LATEST : H5O_VERSION_1, (C)) /* * Size of chunk "header" for each chunk diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 8c9f792..0346f89 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -774,12 +774,6 @@ H5P__dcrt_layout_cmp(const void *_layout1, const void *_layout2, if(layout1->type > layout2->type) HGOTO_DONE(1) - /* Check for different layout version */ - if(layout1->version < layout2->version) - HGOTO_DONE(-1) - if(layout1->version > layout2->version) - HGOTO_DONE(1) - /* Compare non-dataset-specific fields in layout info */ switch(layout1->type) { case H5D_COMPACT: @@ -1651,14 +1645,6 @@ H5P__dcrt_ext_file_list_cmp(const void *_efl1, const void *_efl2, HDassert(efl2); HDassert(size == sizeof(H5O_efl_t)); - /* Check the heap address of external file lists */ - if(H5F_addr_defined(efl1->heap_addr) || H5F_addr_defined(efl2->heap_addr)) { - if(!H5F_addr_defined(efl1->heap_addr) && H5F_addr_defined(efl2->heap_addr)) HGOTO_DONE(-1); - if(H5F_addr_defined(efl1->heap_addr) && !H5F_addr_defined(efl2->heap_addr)) HGOTO_DONE(1); - if((cmp_value = H5F_addr_cmp(efl1->heap_addr, efl2->heap_addr)) != 0) - HGOTO_DONE(cmp_value); - } /* end if */ - /* Check the number of allocated efl entries */ if(efl1->nalloc < efl2->nalloc) HGOTO_DONE(-1); if(efl1->nalloc > efl2->nalloc) HGOTO_DONE(1); diff --git a/src/H5Ppkg.h b/src/H5Ppkg.h index 3662cf9..7d29f3d 100644 --- a/src/H5Ppkg.h +++ b/src/H5Ppkg.h @@ -204,7 +204,6 @@ H5_DLL herr_t H5P_get_filter(const struct H5Z_filter_info_t *filter, #ifdef H5P_TESTING H5_DLL char *H5P_get_class_path_test(hid_t pclass_id); H5_DLL hid_t H5P_open_class_path_test(const char *path); -H5_DLL herr_t H5P_reset_external_file_test(hid_t dcpl_id); #endif /* H5P_TESTING */ #endif /* _H5Ppkg_H */ diff --git a/src/H5Ptest.c b/src/H5Ptest.c index 8240f6a..f6cc97e 100644 --- a/src/H5Ptest.c +++ b/src/H5Ptest.c @@ -125,49 +125,3 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5P_open_class_path_test() */ - -/*-------------------------------------------------------------------------- - NAME - H5P_reset_external_file_test - PURPOSE - Routine to reset external file list - USAGE - herr_t H5P_reset_external_file_test(plist) - hid_t dcpl_id; IN: the property list - - RETURNS - Non-negative on success/Negative on failure - - PROGRAMMER - Peter Cao - April 30, 2007 ---------------------------------------------------------------------------*/ -herr_t -H5P_reset_external_file_test(hid_t dcpl_id) -{ - H5O_efl_t efl; /* External file list */ - H5P_genplist_t *plist; /* Property list */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(FAIL) - - /* Check arguments */ - if(NULL == (plist = (H5P_genplist_t *)H5I_object(dcpl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset creation property list") - - /* get external file list */ - if(H5P_peek(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get external file list") - - /* Clean up any values set for the external file-list */ - if(H5O_msg_reset(H5O_EFL_ID, &efl) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release external file list info") - - /* set external file list */ - if(H5P_poke(plist, H5D_CRT_EXT_FILE_LIST_NAME, &efl) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set external file list") - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* H5P_reset_external_file_test() */ - diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index 8511ff5..07fe371 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -351,7 +351,7 @@ H5T__commit(H5F_t *file, H5T_t *type, hid_t tcpl_id, hid_t dxpl_id) loc_init = TRUE; /* Set the latest format, if requested */ - if(H5F_USE_LATEST_FORMAT(file)) + if(H5F_USE_LATEST_FLAGS(file, H5F_LATEST_DATATYPE)) if(H5T_set_latest_version(type) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest version of datatype") diff --git a/test/objcopy.c b/test/objcopy.c index a9791d5..e435dd1 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -1219,47 +1219,10 @@ compare_datasets(hid_t did, hid_t did2, hid_t pid, const void *wbuf) /* Open the dataset creation property list for the destination dataset */ if((dcpl2 = H5Dget_create_plist(did2)) < 0) TEST_ERROR - /* If external file storage is being used, the value stored in the - * dcpl will be a heap ID, which is not guaranteed to be the same in - * source and destination files. - * Instead, compare the actual external file values and then - * delete this property from the dcpls before comparing them. - */ - if((ext_count = H5Pget_external_count(dcpl)) < 0) TEST_ERROR - - if(ext_count > 0) - { - unsigned x; /* Counter varaible */ - char name1[NAME_BUF_SIZE]; - char name2[NAME_BUF_SIZE]; - off_t offset1=0; - off_t offset2=0; - hsize_t size1=0; - hsize_t size2=0; - - if(H5Pget_external_count(dcpl2) != ext_count) TEST_ERROR - - /* Ensure that all external file information is the same */ - for(x=0; x < (unsigned) ext_count; ++x) - { - if(H5Pget_external(dcpl, x, (size_t)NAME_BUF_SIZE, name1, &offset1, &size1) < 0) TEST_ERROR - if(H5Pget_external(dcpl2, x, (size_t)NAME_BUF_SIZE, name2, &offset2, &size2) < 0) TEST_ERROR - - if(offset1 != offset2) TEST_ERROR - if(size1 != size2) TEST_ERROR - if(HDstrcmp(name1, name2) != 0) TEST_ERROR - } - - /* Reset external file information from the dcpls */ - /* (Directly removing default property causes memory leak) */ - if (H5P_reset_external_file_test(dcpl) < 0) TEST_ERROR - if (H5P_reset_external_file_test(dcpl2) < 0) TEST_ERROR - } - /* Compare the rest of the dataset creation property lists */ if(H5Pequal(dcpl, dcpl2) != TRUE) TEST_ERROR - /* Get the number of filters on dataset */ + /* Get the number of filters on dataset (for later) */ if((nfilters = H5Pget_nfilters(dcpl)) < 0) TEST_ERROR /* close the source dataset creation property list */ -- cgit v0.12 From 86f401d7407e3070cfa04359d4d04335addb83c7 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sun, 3 Apr 2016 04:18:25 -0500 Subject: [svn-r29614] Description: Bring updated code for setting chunk size information from revise_chunks branch. Tested on: MacOSX/64 10.11.4 (amazon) w/serial, parallel & production (h5committest forthcoming) --- src/H5Dchunk.c | 88 ++++++++++++++++++++++++++++++++++++++++++--------------- src/H5Dlayout.c | 7 +++-- src/H5Dpkg.h | 1 + src/H5Pdcpl.c | 13 --------- 4 files changed, 71 insertions(+), 38 deletions(-) diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 309c7a8..4d0e2c3 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -557,6 +557,69 @@ done: /*------------------------------------------------------------------------- + * Function: H5D__chunk_set_sizes + * + * Purpose: Sets chunk and type sizes. + * + * Return: SUCCEED/FAIL + * + * Programmer: Dana Robinson + * December 2015 + * + *------------------------------------------------------------------------- + */ +herr_t +H5D__chunk_set_sizes(H5D_t *dset) +{ + uint64_t chunk_size; /* Size of chunk in bytes */ + unsigned max_enc_bytes_per_dim; /* Max. number of bytes required to encode this dimension */ + unsigned u; /* Iterator */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity checks */ + HDassert(dset); + + /* Increment # of chunk dimensions, to account for datatype size as last element */ + dset->shared->layout.u.chunk.ndims++; + + /* Set the last dimension of the chunk size to the size of the datatype */ + dset->shared->layout.u.chunk.dim[dset->shared->layout.u.chunk.ndims - 1] = (uint32_t)H5T_GET_SIZE(dset->shared->type); + + /* Compute number of bytes to use for encoding chunk dimensions */ + max_enc_bytes_per_dim = 0; + for(u = 0; u < (unsigned)dset->shared->layout.u.chunk.ndims; u++) { + unsigned enc_bytes_per_dim; /* Number of bytes required to encode this dimension */ + + /* Get encoded size of dim, in bytes */ + enc_bytes_per_dim = (H5VM_log2_gen(dset->shared->layout.u.chunk.dim[u]) + 8) / 8; + + /* Check if this is the largest value so far */ + if(enc_bytes_per_dim > max_enc_bytes_per_dim) + max_enc_bytes_per_dim = enc_bytes_per_dim; + } /* end for */ + HDassert(max_enc_bytes_per_dim > 0 && max_enc_bytes_per_dim <= 8); + dset->shared->layout.u.chunk.enc_bytes_per_dim = max_enc_bytes_per_dim; + + /* Compute and store the total size of a chunk */ + /* (Use 64-bit value to ensure that we can detect >4GB chunks) */ + for(u = 1, chunk_size = (uint64_t)dset->shared->layout.u.chunk.dim[0]; u < dset->shared->layout.u.chunk.ndims; u++) + chunk_size *= (uint64_t)dset->shared->layout.u.chunk.dim[u]; + + /* Check for chunk larger than can be represented in 32-bits */ + /* (Chunk size is encoded in 32-bit value in v1 B-tree records) */ + if(chunk_size > (uint64_t)0xffffffff) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "chunk size must be < 4GB") + + H5_CHECKED_ASSIGN(dset->shared->layout.u.chunk.size, uint32_t, chunk_size, uint64_t); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__chunk_set_sizes */ + + +/*------------------------------------------------------------------------- * Function: H5D__chunk_construct * * Purpose: Constructs new chunked layout information for dataset @@ -571,8 +634,6 @@ done: static herr_t H5D__chunk_construct(H5F_t H5_ATTR_UNUSED *f, H5D_t *dset) { - const H5T_t *type = dset->shared->type; /* Convenience pointer to dataset's datatype */ - uint64_t chunk_size; /* Size of chunk in bytes */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -585,22 +646,18 @@ H5D__chunk_construct(H5F_t H5_ATTR_UNUSED *f, H5D_t *dset) /* Check for invalid chunk dimension rank */ if(0 == dset->shared->layout.u.chunk.ndims) HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "no chunk information set?") - - /* Set up layout information */ if(dset->shared->layout.u.chunk.ndims != dset->shared->ndims) HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "dimensionality of chunks doesn't match the dataspace") - /* Increment # of chunk dimensions, to account for datatype size as last element */ - dset->shared->layout.u.chunk.ndims++; + /* Set chunk sizes */ + if(H5D__chunk_set_sizes(dset) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to set chunk sizes") HDassert((unsigned)(dset->shared->layout.u.chunk.ndims) <= NELMTS(dset->shared->layout.u.chunk.dim)); /* Chunked storage is not compatible with external storage (currently) */ if(dset->shared->dcpl_cache.efl.nused > 0) HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "external storage not supported with chunked layout") - /* Set the last dimension of the chunk size to the size of the datatype */ - dset->shared->layout.u.chunk.dim[dset->shared->layout.u.chunk.ndims - 1] = (uint32_t)H5T_GET_SIZE(type); - /* Sanity check dimensions */ for(u = 0; u < dset->shared->layout.u.chunk.ndims - 1; u++) { /* Don't allow zero-sized chunk dimensions */ @@ -616,19 +673,6 @@ H5D__chunk_construct(H5F_t H5_ATTR_UNUSED *f, H5D_t *dset) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "chunk size must be <= maximum dimension size for fixed-sized dimensions") } /* end for */ - /* Compute the total size of a chunk */ - /* (Use 64-bit value to ensure that we can detect >4GB chunks) */ - for(u = 1, chunk_size = (uint64_t)dset->shared->layout.u.chunk.dim[0]; u < dset->shared->layout.u.chunk.ndims; u++) - chunk_size *= (uint64_t)dset->shared->layout.u.chunk.dim[u]; - - /* Check for chunk larger than can be represented in 32-bits */ - /* (Chunk size is encoded in 32-bit value in v1 B-tree records) */ - if(chunk_size > (uint64_t)0xffffffff) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "chunk size must be < 4GB") - - /* Retain computed chunk size */ - H5_CHECKED_ASSIGN(dset->shared->layout.u.chunk.size, uint32_t, chunk_size, uint64_t); - /* Reset address and pointer of the array struct for the chunked storage index */ if(H5D_chunk_idx_reset(&dset->shared->layout.storage.u.chunk, TRUE) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to reset chunked storage index") diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index 2b444e4..7801632 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -453,9 +453,10 @@ H5D__layout_oh_read(H5D_t *dataset, hid_t dxpl_id, hid_t dapl_id, H5P_genplist_t /* Copy layout to the DCPL */ if(H5P_set(plist, H5D_CRT_LAYOUT_NAME, &dataset->shared->layout) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set layout") - /* Adjust chunk dimensions back again (*sigh*) */ - if(H5D_CHUNKED == dataset->shared->layout.type) - dataset->shared->layout.u.chunk.ndims++; + + /* Set chunk sizes */ + if(H5D__chunk_set_sizes(dataset) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "unable to set chunk sizes") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 66c4773..8fc5cac 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -622,6 +622,7 @@ H5_DLL herr_t H5D__chunk_update_old_edge_chunks(H5D_t *dset, hid_t dxpl_id, hsize_t old_dim[]); H5_DLL herr_t H5D__chunk_prune_by_extent(H5D_t *dset, hid_t dxpl_id, const hsize_t *old_dim); +H5_DLL herr_t H5D__chunk_set_sizes(H5D_t *dset); #ifdef H5_HAVE_PARALLEL H5_DLL herr_t H5D__chunk_addrmap(const H5D_io_info_t *io_info, haddr_t chunk_addr[]); #endif /* H5_HAVE_PARALLEL */ diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 0346f89..dbbed5b 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -1984,7 +1984,6 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/]) H5P_genplist_t *plist; /* Property list pointer */ H5O_layout_t chunk_layout; /* Layout information for setting chunk info */ uint64_t chunk_nelmts; /* Number of elements in chunk */ - unsigned max_enc_bytes_per_dim; /* Max. number of bytes required to encode this dimension */ unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2012,10 +2011,7 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/]) HDmemcpy(&chunk_layout, &H5D_def_layout_chunk_g, sizeof(H5D_def_layout_chunk_g)); HDmemset(&chunk_layout.u.chunk.dim, 0, sizeof(chunk_layout.u.chunk.dim)); chunk_nelmts = 1; - max_enc_bytes_per_dim = 0; for(u = 0; u < (unsigned)ndims; u++) { - unsigned enc_bytes_per_dim; /* Number of bytes required to encode this dimension */ - if(dim[u] == 0) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "all chunk dimensions must be positive") if(dim[u] != (dim[u] & 0xffffffff)) @@ -2024,16 +2020,7 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/]) if(chunk_nelmts > (uint64_t)0xffffffff) HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "number of elements in chunk must be < 4GB") chunk_layout.u.chunk.dim[u] = (uint32_t)dim[u]; /* Store user's chunk dimensions */ - - /* Get encoded size of dim, in bytes */ - enc_bytes_per_dim = (H5VM_log2_gen(dim[u]) + 8) / 8; - - /* Check if this is the largest value so far */ - if(enc_bytes_per_dim > max_enc_bytes_per_dim) - max_enc_bytes_per_dim = enc_bytes_per_dim; } /* end for */ - HDassert(max_enc_bytes_per_dim > 0 && max_enc_bytes_per_dim <= 8); - chunk_layout.u.chunk.enc_bytes_per_dim = max_enc_bytes_per_dim; /* Get the plist structure */ if(NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_CREATE))) -- cgit v0.12 From 0024745638833c1b6b55ee1e81dab57161e21c5d Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Mon, 4 Apr 2016 16:01:45 -0500 Subject: [svn-r29620] Merge of r29619 from revise_chunks. Minor H5Fpublic.h comment update. Tested on: 64-bit Ubuntu 15.10 (build only, no code changes) --- src/H5Fpublic.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index 122f711..eba9b12 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -48,9 +48,6 @@ * which are compatible with the library to which the application is linked. * We're assuming that these constants are used rather early in the hdf5 * session. - * - * Note that H5F_ACC_DEBUG is deprecated (nonfuncational) but retained as a - * symbol for backward compatibility. */ #define H5F_ACC_RDONLY (H5CHECK H5OPEN 0x0000u) /*absence of rdwr => rd-only */ #define H5F_ACC_RDWR (H5CHECK H5OPEN 0x0001u) /*open for read and write */ -- cgit v0.12 From 2221a9a96e1fc06290ba0bf2e68f9489f071483e Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 4 Apr 2016 17:14:54 -0500 Subject: [svn-r29625] Description: Removed unused routines Tested on: MacOSX/64 10.11.4 (amazon) w/serial & parallel (h5committest forthcoming) --- src/H5EA.c | 110 ------------------------------------------------------ src/H5EAprivate.h | 5 --- 2 files changed, 115 deletions(-) diff --git a/src/H5EA.c b/src/H5EA.c index be60301..34173e4 100644 --- a/src/H5EA.c +++ b/src/H5EA.c @@ -877,116 +877,6 @@ END_FUNC(PRIV) /* end H5EA_undepend() */ /*------------------------------------------------------------------------- - * Function: H5EA_support - * - * Purpose: Create a child flush dependency on the array metadata that - * contains the element for an array index. - * - * Return: SUCCEED/FAIL - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * May 21 2009 - * - *------------------------------------------------------------------------- - */ -BEGIN_FUNC(PRIV, ERR, -herr_t, SUCCEED, FAIL, -H5EA_support(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, H5AC_info_t *child_entry)) - - /* Local variables */ - void *thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */ - uint8_t *thing_elmt_buf; /* Pointer to the element buffer for the array metadata */ - hsize_t thing_elmt_idx; /* Index of the element in the element buffer for the array metadata */ - H5EA__unprotect_func_t thing_unprot_func; /* Function pointer for unprotecting the array metadata */ - -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx); -#endif /* QAK */ - - /* - * Check arguments. - */ - HDassert(ea); - - /* Look up the array metadata containing the element we want to set */ - if(H5EA__lookup_elmt(ea, dxpl_id, idx, H5AC__NO_FLAGS_SET, &thing, &thing_elmt_buf, &thing_elmt_idx, &thing_unprot_func) < 0) - H5E_THROW(H5E_CANTPROTECT, "unable to protect array metadata") - - /* Sanity check */ - HDassert(thing); - HDassert(thing_elmt_buf); - HDassert(thing_unprot_func); - - /* Set up flush dependency between child_entry and metadata array 'thing' */ - if(H5EA__create_flush_depend((H5AC_info_t *)thing, child_entry) < 0) - H5E_THROW(H5E_CANTDEPEND, "unable to create flush dependency on array metadata") - -CATCH - /* Release resources */ - if(thing && (thing_unprot_func)(thing, dxpl_id, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array metadata") - -END_FUNC(PRIV) /* end H5EA_support() */ - - -/*------------------------------------------------------------------------- - * Function: H5EA_unsupport - * - * Purpose: Remove a flush dependency on the array metadata that contains - * the element for an array index. - * - * Return: SUCCEED/FAIL - * - * Programmer: Quincey Koziol - * koziol@hdfgroup.org - * May 21 2009 - * - *------------------------------------------------------------------------- - */ -BEGIN_FUNC(PRIV, ERR, -herr_t, SUCCEED, FAIL, -H5EA_unsupport(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, H5AC_info_t *child_entry)) - - /* Local variables */ - void *thing = NULL; /* Pointer to the array metadata containing the array index we are interested in */ - uint8_t *thing_elmt_buf; /* Pointer to the element buffer for the array metadata */ - hsize_t thing_elmt_idx; /* Index of the element in the element buffer for the array metadata */ - H5EA__unprotect_func_t thing_unprot_func; /* Function pointer for unprotecting the array metadata */ - -#ifdef QAK -HDfprintf(stderr, "%s: Called\n", FUNC); -HDfprintf(stderr, "%s: Index %Hu\n", FUNC, idx); -#endif /* QAK */ - - /* - * Check arguments. - */ - HDassert(ea); - - /* Look up the array metadata containing the element we want to set */ - if(H5EA__lookup_elmt(ea, dxpl_id, idx, H5AC__READ_ONLY_FLAG, &thing, &thing_elmt_buf, &thing_elmt_idx, &thing_unprot_func) < 0) - H5E_THROW(H5E_CANTPROTECT, "unable to protect array metadata") - - /* Sanity check */ - HDassert(thing); - HDassert(thing_elmt_buf); - HDassert(thing_unprot_func); - - /* Remove flush dependency between child_entry and metadata array 'thing' */ - if(H5EA__destroy_flush_depend((H5AC_info_t *)thing, child_entry) < 0) - H5E_THROW(H5E_CANTUNDEPEND, "unable to destroy flush dependency on array metadata") - -CATCH - /* Release resources */ - if(thing && (thing_unprot_func)(thing, dxpl_id, H5AC__NO_FLAGS_SET) < 0) - H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array metadata") - -END_FUNC(PRIV) /* end H5EA_unsupport() */ - - -/*------------------------------------------------------------------------- * Function: H5EA_close * * Purpose: Close an extensible array diff --git a/src/H5EAprivate.h b/src/H5EAprivate.h index 33b4553..9147f39 100644 --- a/src/H5EAprivate.h +++ b/src/H5EAprivate.h @@ -131,11 +131,6 @@ H5_DLL herr_t H5EA_get_addr(const H5EA_t *ea, haddr_t *addr); H5_DLL herr_t H5EA_set(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, const void *elmt); H5_DLL herr_t H5EA_get(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, void *elmt); H5_DLL herr_t H5EA_depend(H5AC_info_t *parent_entry, H5EA_t *ea); -H5_DLL herr_t H5EA_undepend(H5AC_info_t *parent_entry, H5EA_t *ea); -H5_DLL herr_t H5EA_support(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, - H5AC_info_t *child_entry); -H5_DLL herr_t H5EA_unsupport(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, - H5AC_info_t *child_entry); H5_DLL herr_t H5EA_close(H5EA_t *ea, hid_t dxpl_id); H5_DLL herr_t H5EA_delete(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, void *ctx_udata); -- cgit v0.12 From c7d495163419f785a2fe5237991c4ab6e6286091 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 4 Apr 2016 17:22:56 -0500 Subject: [svn-r29626] Description: Revise method of invoking object flush callback. Tested on: MacOSX/64 10.11.4 (amazon) w/serial & parallel (h5committest forthcoming) --- src/H5Doh.c | 18 ++++++------------ src/H5Ocopy.c | 19 ++++++++++++++++--- src/H5Opkg.h | 3 +-- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/H5Doh.c b/src/H5Doh.c index 54f7a5e..5cdf4bc 100644 --- a/src/H5Doh.c +++ b/src/H5Doh.c @@ -55,7 +55,7 @@ static void *H5O__dset_create(H5F_t *f, void *_crt_info, H5G_loc_t *obj_loc, static H5O_loc_t *H5O__dset_get_oloc(hid_t obj_id); static herr_t H5O__dset_bh_info(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info); -static herr_t H5O__dset_flush(H5G_loc_t *obj_loc, hid_t dxpl_id); +static herr_t H5O__dset_flush(void *_obj_ptr, hid_t dxpl_id); /*********************/ @@ -443,33 +443,27 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5O__dset_flush(H5G_loc_t *obj_loc, hid_t dxpl_id) +H5O__dset_flush(void *_obj_ptr, hid_t dxpl_id) { - H5D_t *dset = NULL; /* Dataset opened */ + H5D_t *dset = (H5D_t *)_obj_ptr; /* Pointer to dataset object */ H5O_type_t obj_type; /* Type of object at location */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC - HDassert(obj_loc); - HDassert(obj_loc->oloc); + HDassert(dset); + HDassert(&dset->oloc); /* Check that the object found is the correct type */ - if(H5O_obj_type(obj_loc->oloc, &obj_type, dxpl_id) < 0) + if(H5O_obj_type(&dset->oloc, &obj_type, dxpl_id) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get object type") if(obj_type != H5O_TYPE_DATASET) HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataset") - /* Open the dataset */ - if(NULL == (dset = H5D_open(obj_loc, H5P_DATASET_ACCESS_DEFAULT, dxpl_id))) - HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "unable to open dataset") - if(H5D__flush_real(dset, dxpl_id) < 0) HDONE_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to flush cached dataset info") done: - if(dset && H5D_close(dset) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataset") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O__dset_flush() */ diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 936c8b8..0ee8cfd 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -354,17 +354,30 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, H5G_loc_t tmp_loc; /* Location of object */ H5O_loc_t tmp_oloc; /* Location of object */ H5G_name_t tmp_path; /* Object's path */ + void *obj_ptr = NULL; /* Object pointer */ + hid_t tmp_id = -1; /* Object ID */ tmp_loc.oloc = &tmp_oloc; tmp_loc.path = &tmp_path; tmp_oloc.file = oloc_src->file; tmp_oloc.addr = oloc_src->addr; - tmp_oloc.holding_file = oloc_src->holding_file; + tmp_oloc.holding_file = FALSE; H5G_name_reset(tmp_loc.path); - /* Flush the object of this class */ - if(obj_class->flush && obj_class->flush(&tmp_loc, dxpl_id) < 0) + /* Get a temporary ID */ + if((tmp_id = obj_class->open(&tmp_loc, H5P_DEFAULT, dxpl_id, FALSE)) < 0) + HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to open object") + + /* Get object pointer */ + obj_ptr = H5I_object(tmp_id); + + /* Flush the object */ + if(obj_class->flush && obj_class->flush(obj_ptr, dxpl_id) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object") + + /* Release the temporary ID */ + if(tmp_id != -1 && H5I_dec_app_ref(tmp_id)) + HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "unable to close temporary ID") } /* end if */ /* Get source object header */ diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 5bce19e..14bb342 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -325,7 +325,7 @@ typedef struct H5O_obj_class_t { void *(*create)(H5F_t *, void *, H5G_loc_t *, hid_t ); /*create an object of this class */ H5O_loc_t *(*get_oloc)(hid_t ); /*get the object header location for an object */ herr_t (*bh_info)(const H5O_loc_t *loc, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info); /*get the index & heap info for an object */ - herr_t (*flush)(H5G_loc_t *loc, hid_t dxpl_id); /*flush an opened object of this class */ + herr_t (*flush)(void *obj_ptr, hid_t dxpl_id); /*flush an opened object of this class */ } H5O_obj_class_t; /* Node in skip list to map addresses from one file to another during object header copy */ @@ -606,7 +606,6 @@ H5_DLL herr_t H5O_attr_link(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, void *_mesg H5_DLL herr_t H5O_attr_count_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, hsize_t *nattrs); - /* These functions operate on object locations */ H5_DLL H5O_loc_t *H5O_get_loc(hid_t id); -- cgit v0.12 From 4282c5f01fb6eb152cd4e6b18ecb6419934760e5 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 4 Apr 2016 22:45:38 -0500 Subject: [svn-r29630] Description: Minor style cleanups, from revise_chunks branch Tested on: MacOSX/64 10.11.4 (amazon) w/serial, parallel and production (too minor to require h5committest) --- test/tarray.c | 56 +++++++++++++++++++++++++++++++------------------------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/test/tarray.c b/test/tarray.c index c6e9c0d..4a87981 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -1639,9 +1639,9 @@ test_array_bkg(void) for (i = 0; i < dtsinfo->nsubfields; i++) dtsinfo->name[i] = (char *)HDcalloc((size_t)20, sizeof(char)); - strcpy(dtsinfo->name[0], "One"); - strcpy(dtsinfo->name[1], "Two"); - strcpy(dtsinfo->name[2], "Three"); + HDstrcpy(dtsinfo->name[0], "One"); + HDstrcpy(dtsinfo->name[1], "Two"); + HDstrcpy(dtsinfo->name[2], "Three"); /* Create file */ @@ -1859,32 +1859,38 @@ test_array_bkg(void) HDfree(dtsinfo); } /* end test_array_bkg() */ -/**************************************************************** -** -** test_compat(): Test array datatype compatibility code. -** Reads file containing old version of datatype object header -** messages for compound datatypes and verifies reading the older -** version of the is working correctly. -** -****************************************************************/ + +/*------------------------------------------------------------------------- + * Function: test_compat + * + * Purpose: Test array datatype compatibility code. + * + * Reads file containing old version of datatype object header + * messages for compound datatypes and verifies reading the older + * version of the is working correctly. + * + * Return: void + * + *------------------------------------------------------------------------- + */ static void test_compat(void) { const char *testfile = H5_get_srcdir_filename(TESTFILE); /* Corrected test file name */ - hid_t fid1; /* HDF5 File IDs */ - hid_t dataset; /* Dataset ID */ - hid_t tid1; /* Array Datatype ID */ - hid_t tid2; /* Datatype ID */ - hsize_t tdims1[] = {ARRAY1_DIM1}; - int ndims; /* Array rank for reading */ - hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ - H5T_class_t mclass; /* Datatype class for VL */ - int nmemb; /* Number of compound members */ - char *mname; /* Name of compound field */ - size_t off; /* Offset of compound field */ - hid_t mtid; /* Datatype ID for field */ - int i; /* Index variables */ - herr_t ret; /* Generic return value */ + hid_t fid1; /* HDF5 File IDs */ + hid_t dataset; /* Dataset ID */ + hid_t tid1; /* Array Datatype ID */ + hid_t tid2; /* Datatype ID */ + hsize_t tdims1[] = {ARRAY1_DIM1}; + int ndims; /* Array rank for reading */ + hsize_t rdims1[H5S_MAX_RANK]; /* Array dimensions for reading */ + H5T_class_t mclass; /* Datatype class for VL */ + int nmemb; /* Number of compound members */ + char *mname; /* Name of compound field */ + size_t off; /* Offset of compound field */ + hid_t mtid; /* Datatype ID for field */ + int i; /* Index variables */ + herr_t ret; /* Generic return value */ /* Output message about test being performed */ MESSAGE(5, ("Testing Array Datatypes Compatibility Functionality\n")); -- cgit v0.12 From a816d031089f0afd2f2a2261a4e0d6277491e8b5 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Mon, 4 Apr 2016 23:11:54 -0500 Subject: [svn-r29632] Description: Align w/revise_chunks branch Tested on: MacOSX/64 10.11.4 (amazon) w/parallel (h5committest forthcoming) --- testpar/t_dset.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/testpar/t_dset.c b/testpar/t_dset.c index b7f2fc0..ceacb3a 100644 --- a/testpar/t_dset.c +++ b/testpar/t_dset.c @@ -3308,7 +3308,7 @@ test_actual_io_mode(int selection_mode) { "reading and writing are the same for actual_chunk_opt_mode"); /* Test values */ - if(actual_chunk_opt_mode_expected != (unsigned) -1 && actual_io_mode_expected != (unsigned) -1) { + if(actual_chunk_opt_mode_expected != (H5D_mpio_actual_chunk_opt_mode_t) -1 && actual_io_mode_expected != (H5D_mpio_actual_io_mode_t) -1) { sprintf(message, "Actual Chunk Opt Mode has the correct value for %s.\n",test_name); VRFY((actual_chunk_opt_mode_write == actual_chunk_opt_mode_expected), message); sprintf(message, "Actual IO Mode has the correct value for %s.\n",test_name); @@ -4152,16 +4152,20 @@ dataset_atomicity(void) MPI_Barrier (comm); /* make sure setting atomicity fails on a serial file ID */ - /* open the file collectively */ - fid=H5Fopen(filename,H5F_ACC_RDWR,H5P_DEFAULT); - VRFY((fid >= 0), "H5Fopen succeeed"); + /* file locking allows only one file open (serial) for writing */ + if(MAINPROCESS){ + fid=H5Fopen(filename,H5F_ACC_RDWR,H5P_DEFAULT); + VRFY((fid >= 0), "H5Fopen succeeed"); + } /* should fail */ ret = H5Fset_mpi_atomicity (fid , TRUE); VRFY((ret == FAIL), "H5Fset_mpi_atomicity failed"); - ret = H5Fclose(fid); - VRFY((ret >= 0), "H5Fclose succeeded"); + if(MAINPROCESS){ + ret = H5Fclose(fid); + VRFY((ret >= 0), "H5Fclose succeeded"); + } MPI_Barrier (comm); -- cgit v0.12 From 5d46ad9b3984dcddffaf369a92a8ef95339f8547 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 5 Apr 2016 02:12:56 -0500 Subject: [svn-r29635] Description: Bring support for earray and v2 B-trees from revise_chunks branch to trunk. Tested on: MacOSX/64 10.11.4 (amazon) w/serial, parallel & production (h5committest forthcoming) --- MANIFEST | 2 + src/CMakeLists.txt | 2 + src/H5B2.c | 36 +- src/H5B2private.h | 3 + src/H5Dbtree2.c | 1491 ++++++++++++++++++++++++++++++++++++++++++++ src/H5Dchunk.c | 6 +- src/H5Dearray.c | 1740 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/H5Dint.c | 5 + src/H5Dlayout.c | 140 ++++- src/H5Dpkg.h | 27 + src/H5Dpublic.h | 4 +- src/H5Dtest.c | 41 ++ src/H5EA.c | 88 +++ src/H5EAprivate.h | 14 + src/H5Olayout.c | 97 ++- src/H5Oprivate.h | 47 ++ src/H5VMprivate.h | 16 + src/Makefile.am | 10 +- test/dsets.c | 25 +- 19 files changed, 3773 insertions(+), 21 deletions(-) create mode 100644 src/H5Dbtree2.c create mode 100644 src/H5Dearray.c diff --git a/MANIFEST b/MANIFEST index ba15450..e02f5fb 100644 --- a/MANIFEST +++ b/MANIFEST @@ -498,11 +498,13 @@ ./src/H5CSprivate.h ./src/H5D.c ./src/H5Dbtree.c +./src/H5Dbtree2.c ./src/H5Dchunk.c ./src/H5Dcompact.c ./src/H5Dcontig.c ./src/H5Ddbg.c ./src/H5Ddeprec.c +./src/H5Dearray.c ./src/H5Defl.c ./src/H5Dfill.c ./src/H5Dint.c diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1e0061f..f65c77f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -103,11 +103,13 @@ IDE_GENERATED_PROPERTIES ("H5CS" "${H5CS_HDRS}" "${H5CS_SRCS}" ) set (H5D_SRCS ${HDF5_SRC_DIR}/H5D.c ${HDF5_SRC_DIR}/H5Dbtree.c + ${HDF5_SRC_DIR}/H5Dbtree2.c ${HDF5_SRC_DIR}/H5Dchunk.c ${HDF5_SRC_DIR}/H5Dcompact.c ${HDF5_SRC_DIR}/H5Dcontig.c ${HDF5_SRC_DIR}/H5Ddbg.c ${HDF5_SRC_DIR}/H5Ddeprec.c + ${HDF5_SRC_DIR}/H5Dearray.c ${HDF5_SRC_DIR}/H5Defl.c ${HDF5_SRC_DIR}/H5Dfill.c ${HDF5_SRC_DIR}/H5Dint.c diff --git a/src/H5B2.c b/src/H5B2.c index 5cbeadd..bce6a9f 100644 --- a/src/H5B2.c +++ b/src/H5B2.c @@ -87,6 +87,8 @@ extern const H5B2_class_t H5G_BT2_CORDER[1]; extern const H5B2_class_t H5SM_INDEX[1]; extern const H5B2_class_t H5A_BT2_NAME[1]; extern const H5B2_class_t H5A_BT2_CORDER[1]; +extern const H5B2_class_t H5D_BT2[1]; +extern const H5B2_class_t H5D_BT2_FILT[1]; extern const H5B2_class_t H5B2_TEST2[1]; const H5B2_class_t *const H5B2_client_class_g[] = { @@ -100,7 +102,9 @@ const H5B2_class_t *const H5B2_client_class_g[] = { H5SM_INDEX, /* 7 - H5B2_SOHM_INDEX_ID */ H5A_BT2_NAME, /* 8 - H5B2_ATTR_DENSE_NAME_ID */ H5A_BT2_CORDER, /* 9 - H5B2_ATTR_DENSE_CORDER_ID */ - H5B2_TEST2, /* 10 - H5B2_TEST_ID */ + H5D_BT2, /* 10 - H5B2_CDSET_ID */ + H5D_BT2_FILT, /* 11 - H5B2_CDSET_FILT_ID */ + H5B2_TEST2 /* 12 - H5B2_TEST_ID */ }; @@ -1445,3 +1449,33 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* H5B2_delete() */ + +/*------------------------------------------------------------------------- + * Function: H5B2_patch_file + * + * Purpose: Patch the top-level file pointer contained in bt2 + * to point to idx_info->f if they are different. + * This is possible because the file pointer in bt2 can be + * closed out if bt2 remains open. + * + * Return: SUCCEED + * + *------------------------------------------------------------------------- + */ +herr_t +H5B2_patch_file(H5B2_t *bt2, H5F_t *f) +{ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* + * Check arguments. + */ + HDassert(bt2); + HDassert(f); + + if(bt2->f != f || bt2->hdr->f != f) + bt2->f = bt2->hdr->f = f; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5B2_patch_file() */ + diff --git a/src/H5B2private.h b/src/H5B2private.h index b509869..3caf41f 100644 --- a/src/H5B2private.h +++ b/src/H5B2private.h @@ -54,6 +54,8 @@ typedef enum H5B2_subid_t { H5B2_SOHM_INDEX_ID, /* B-tree is an index for shared object header messages */ H5B2_ATTR_DENSE_NAME_ID, /* B-tree is for indexing 'name' field for "dense" attribute storage on objects */ H5B2_ATTR_DENSE_CORDER_ID, /* B-tree is for indexing 'creation order' field for "dense" attribute storage on objects */ + H5B2_CDSET_ID, /* B-tree is for non-filtered chunked dataset storage w/ >1 unlim dims */ + H5B2_CDSET_FILT_ID, /* B-tree is for filtered chunked dataset storage w/ >1 unlim dims */ H5B2_TEST2_ID, /* Another B-tree is for testing (do not use for actual data) */ H5B2_NUM_BTREE_ID /* Number of B-tree IDs (must be last) */ } H5B2_subid_t; @@ -151,6 +153,7 @@ H5_DLL herr_t H5B2_size(H5B2_t *bt2, hid_t dxpl_id, H5_DLL herr_t H5B2_close(H5B2_t *bt2, hid_t dxpl_id); H5_DLL herr_t H5B2_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *ctx_udata, H5B2_remove_t op, void *op_data); +H5_DLL herr_t H5B2_patch_file(H5B2_t *fa, H5F_t *f); /* Statistics routines */ H5_DLL herr_t H5B2_stat_info(H5B2_t *bt2, H5B2_stat_t *info); diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c new file mode 100644 index 0000000..9de609f --- /dev/null +++ b/src/H5Dbtree2.c @@ -0,0 +1,1491 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * + * Purpose: v2 B-tree indexing for chunked datasets with > 1 unlimited dimensions. + * Each dataset chunk in the b-tree is identified by its dimensional offset. + * + */ + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5MFprivate.h" /* File space management */ +#include "H5VMprivate.h" /* Vector and array functions */ + + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ +/* User data for creating callback context */ +typedef struct H5D_bt2_ctx_ud_t { + const H5F_t *f; /* Pointer to file info */ + uint32_t chunk_size; /* Size of chunk (bytes; for filtered object) */ + unsigned ndims; /* Number of dimensions */ + uint32_t *dim; /* Size of chunk in elements */ +} H5D_bt2_ctx_ud_t; + +/* The callback context */ +typedef struct H5D_bt2_ctx_t { + uint32_t chunk_size; /* Size of chunk (bytes; constant for unfiltered object) */ + size_t sizeof_addr; /* Size of file addresses in the file (bytes) */ + size_t chunk_size_len; /* Size of chunk sizes in the file (bytes) */ + unsigned ndims; /* Number of dimensions in chunk */ + uint32_t *dim; /* Size of chunk in elements */ +} H5D_bt2_ctx_t; + +/* User data for the chunk's removal callback routine */ +typedef struct H5D_bt2_remove_ud_t { + H5F_t *f; /* File pointer for operation */ + hid_t dxpl_id; /* DXPL ID for operation */ +} H5D_bt2_remove_ud_t; + +/* Callback info for iteration over chunks in v2 B-tree */ +typedef struct H5D_bt2_it_ud_t { + H5D_chunk_cb_func_t cb; /* Callback routine for the chunk */ + void *udata; /* User data for the chunk's callback routine */ +} H5D_bt2_it_ud_t; + +/* User data for compare callback */ +typedef struct H5D_bt2_ud_t { + H5D_chunk_rec_t rec; /* The record to search for */ + unsigned ndims; /* Number of dimensions for the chunked dataset */ +} H5D_bt2_ud_t; + + +/********************/ +/* Local Prototypes */ +/********************/ + +/* Shared v2 B-tree methods for indexing filtered and non-filtered chunked datasets */ +static void *H5D__bt2_crt_context(void *udata); +static herr_t H5D__bt2_dst_context(void *ctx); +static herr_t H5D__bt2_store(void *native, const void *udata); +static herr_t H5D__bt2_compare(const void *rec1, const void *rec2, int *result); + +/* v2 B-tree class for indexing non-filtered chunked datasets */ +static herr_t H5D__bt2_unfilt_encode(uint8_t *raw, const void *native, void *ctx); +static herr_t H5D__bt2_unfilt_decode(const uint8_t *raw, void *native, void *ctx); +static herr_t H5D__bt2_unfilt_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *u_ctx); + +/* v2 B-tree class for indexing filtered chunked datasets */ +static herr_t H5D__bt2_filt_encode(uint8_t *raw, const void *native, void *ctx); +static herr_t H5D__bt2_filt_decode(const uint8_t *raw, void *native, void *ctx); +static herr_t H5D__bt2_filt_debug(FILE *stream, int indent, int fwidth, + const void *record, const void *u_ctx); + +/* Helper routine */ +static herr_t H5D__bt2_idx_open(const H5D_chk_idx_info_t *idx_info); + +/* Callback for H5B2_iterate() which is called in H5D__bt2_idx_iterate() */ +static int H5D__bt2_idx_iterate_cb(const void *_record, void *_udata); + +/* Callback for H5B2_find() which is called in H5D__bt2_idx_get_addr() */ +static herr_t H5D__bt2_found_cb(const void *nrecord, void *op_data); + +/* + * Callback for H5B2_remove() and H5B2_delete() which is called + * in H5D__bt2_idx_remove() and H5D__bt2_idx_delete(). + */ +static herr_t H5D__bt2_remove_cb(const void *nrecord, void *_udata); + +/* Callback for H5B2_modify() which is called in H5D__bt2_idx_insert() */ +static herr_t H5D__bt2_mod_cb(void *_record, void *_op_data, hbool_t *changed); + +/* Chunked layout indexing callbacks for v2 B-tree indexing */ +static herr_t H5D__bt2_idx_init(const H5D_chk_idx_info_t *idx_info, + const H5S_t *space, haddr_t dset_ohdr_addr); +static herr_t H5D__bt2_idx_create(const H5D_chk_idx_info_t *idx_info); +static hbool_t H5D__bt2_idx_is_space_alloc(const H5O_storage_chunk_t *storage); +static herr_t H5D__bt2_idx_insert(const H5D_chk_idx_info_t *idx_info, + H5D_chunk_ud_t *udata, const H5D_t *dset); +static herr_t H5D__bt2_idx_get_addr(const H5D_chk_idx_info_t *idx_info, + H5D_chunk_ud_t *udata); +static int H5D__bt2_idx_iterate(const H5D_chk_idx_info_t *idx_info, + H5D_chunk_cb_func_t chunk_cb, void *chunk_udata); +static herr_t H5D__bt2_idx_remove(const H5D_chk_idx_info_t *idx_info, + H5D_chunk_common_ud_t *udata); +static herr_t H5D__bt2_idx_delete(const H5D_chk_idx_info_t *idx_info); +static herr_t H5D__bt2_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, + const H5D_chk_idx_info_t *idx_info_dst); +static herr_t H5D__bt2_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, + H5O_storage_chunk_t *storage_dst, hid_t dxpl_id); +static herr_t H5D__bt2_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *size); +static herr_t H5D__bt2_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr); +static herr_t H5D__bt2_idx_dump(const H5O_storage_chunk_t *storage, + FILE *stream); +static herr_t H5D__bt2_idx_dest(const H5D_chk_idx_info_t *idx_info); + + +/*********************/ +/* Package Variables */ +/*********************/ + +/* Chunked dataset I/O ops for v2 B-tree indexing */ +const H5D_chunk_ops_t H5D_COPS_BT2[1] = {{ + H5D__bt2_idx_init, /* init */ + H5D__bt2_idx_create, /* create */ + H5D__bt2_idx_is_space_alloc, /* is_space_alloc */ + H5D__bt2_idx_insert, /* insert */ + H5D__bt2_idx_get_addr, /* get_addr */ + NULL, /* resize */ + H5D__bt2_idx_iterate, /* iterate */ + H5D__bt2_idx_remove, /* remove */ + H5D__bt2_idx_delete, /* delete */ + H5D__bt2_idx_copy_setup, /* copy_setup */ + H5D__bt2_idx_copy_shutdown, /* copy_shutdown */ + H5D__bt2_idx_size, /* size */ + H5D__bt2_idx_reset, /* reset */ + H5D__bt2_idx_dump, /* dump */ + H5D__bt2_idx_dest /* destroy */ +}}; + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/* v2 B-tree class for indexing non-filtered chunked datasets */ +const H5B2_class_t H5D_BT2[1] = {{ /* B-tree class information */ + H5B2_CDSET_ID, /* Type of B-tree */ + "H5B2_CDSET_ID", /* Name of B-tree class */ + sizeof(H5D_chunk_rec_t), /* Size of native record */ + H5D__bt2_crt_context, /* Create client callback context */ + H5D__bt2_dst_context, /* Destroy client callback context */ + H5D__bt2_store, /* Record storage callback */ + H5D__bt2_compare, /* Record comparison callback */ + H5D__bt2_unfilt_encode, /* Record encoding callback */ + H5D__bt2_unfilt_decode, /* Record decoding callback */ + H5D__bt2_unfilt_debug /* Record debugging callback */ +}}; + +/* v2 B-tree class for indexing filtered chunked datasets */ +const H5B2_class_t H5D_BT2_FILT[1] = {{ /* B-tree class information */ + H5B2_CDSET_FILT_ID, /* Type of B-tree */ + "H5B2_CDSET_FILT_ID", /* Name of B-tree class */ + sizeof(H5D_chunk_rec_t), /* Size of native record */ + H5D__bt2_crt_context, /* Create client callback context */ + H5D__bt2_dst_context, /* Destroy client callback context */ + H5D__bt2_store, /* Record storage callback */ + H5D__bt2_compare, /* Record comparison callback */ + H5D__bt2_filt_encode, /* Record encoding callback */ + H5D__bt2_filt_decode, /* Record decoding callback */ + H5D__bt2_filt_debug /* Record debugging callback */ +}}; + + +/*******************/ +/* Local Variables */ +/*******************/ + +/* Declare a free list to manage the H5D_bt2_ctx_t struct */ +H5FL_DEFINE_STATIC(H5D_bt2_ctx_t); +/* Declare a free list to manage the page elements */ +H5FL_BLK_DEFINE(chunk_dim); + + + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_crt_context + * + * Purpose: Create client callback context + * + * Return: Success: non-NULL + * Failure: NULL + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static void * +H5D__bt2_crt_context(void *_udata) +{ + H5D_bt2_ctx_ud_t *udata = (H5D_bt2_ctx_ud_t *)_udata; /* User data for building callback context */ + H5D_bt2_ctx_t *ctx; /* Callback context structure */ + uint32_t *my_dim = NULL; /* Pointer to copy of chunk dimension size */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(udata); + HDassert(udata->f); + HDassert(udata->ndims > 0 && udata->ndims < H5O_LAYOUT_NDIMS); + + /* Allocate callback context */ + if(NULL == (ctx = H5FL_MALLOC(H5D_bt2_ctx_t))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate callback context") + + /* Determine the size of addresses and set the chunk size and # of dimensions for the dataset */ + ctx->sizeof_addr = H5F_SIZEOF_ADDR(udata->f); + ctx->chunk_size = udata->chunk_size; + ctx->ndims = udata->ndims; + + /* Set up the "local" information for this dataset's chunk dimension sizes */ + if(NULL == (my_dim = (uint32_t *)H5FL_BLK_MALLOC(chunk_dim, H5O_LAYOUT_NDIMS * sizeof(uint32_t)))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate chunk dims") + HDmemcpy(my_dim, udata->dim, H5O_LAYOUT_NDIMS * sizeof(uint32_t)); + ctx->dim = my_dim; + + /* + * Compute the size required for encoding the size of a chunk, + * allowing for an extra byte, in case the filter makes the chunk larger. + */ + ctx->chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)udata->chunk_size) + 8) / 8); + if(ctx->chunk_size_len > 8) + ctx->chunk_size_len = 8; + + /* Set return value */ + ret_value = ctx; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__bt2_crt_context() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_dst_context + * + * Purpose: Destroy client callback context + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__bt2_dst_context(void *_ctx) +{ + H5D_bt2_ctx_t *ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(ctx); + + /* Free array for chunk dimension sizes */ + if(ctx->dim) + (void)H5FL_BLK_FREE(chunk_dim, ctx->dim); + /* Release callback context */ + ctx = H5FL_FREE(H5D_bt2_ctx_t, ctx); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5D__bt2_dst_context() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_store + * + * Purpose: Store native information into record for v2 B-tree + * (non-filtered) + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__bt2_store(void *record, const void *_udata) +{ + const H5D_bt2_ud_t *udata = (const H5D_bt2_ud_t *)_udata; /* User data */ + + FUNC_ENTER_STATIC_NOERR + + *(H5D_chunk_rec_t *)record = udata->rec; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5D__bt2_store() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_compare + * + * Purpose: Compare two native information records, according to some key + * (non-filtered) + * + * Return: <0 if rec1 < rec2 + * =0 if rec1 == rec2 + * >0 if rec1 > rec2 + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__bt2_compare(const void *_udata, const void *_rec2, int *result) +{ + const H5D_bt2_ud_t *udata = (const H5D_bt2_ud_t *)_udata; /* User data */ + const H5D_chunk_rec_t *rec1 = &(udata->rec); /* The search record */ + const H5D_chunk_rec_t *rec2 = (const H5D_chunk_rec_t *)_rec2; /* The native record */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(rec1); + HDassert(rec2); + + /* Compare the offsets but ignore the other fields */ + *result = H5VM_vector_cmp_u(udata->ndims, rec1->scaled, rec2->scaled); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__bt2_compare() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_unfilt_encode + * + * Purpose: Encode native information into raw form for storing on disk + * (non-filtered) + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__bt2_unfilt_encode(uint8_t *raw, const void *_record, void *_ctx) +{ + H5D_bt2_ctx_t *ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */ + const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */ + unsigned u; /* Local index varible */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(ctx); + + /* Encode the record's fields */ + H5F_addr_encode_len(ctx->sizeof_addr, &raw, record->chunk_addr); + /* (Don't encode the chunk size & filter mask for non-filtered B-tree records) */ + for(u = 0; u < ctx->ndims; u++) + UINT64ENCODE(raw, record->scaled[u]); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5D__bt2_unfilt_encode() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_unfilt_decode + * + * Purpose: Decode raw disk form of record into native form + * (non-filtered) + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__bt2_unfilt_decode(const uint8_t *raw, void *_record, void *_ctx) +{ + H5D_bt2_ctx_t *ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */ + H5D_chunk_rec_t *record = (H5D_chunk_rec_t *)_record; /* The native record */ + unsigned u; /* Local index variable */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(ctx); + + /* Decode the record's fields */ + H5F_addr_decode_len(ctx->sizeof_addr, &raw, &record->chunk_addr); + record->nbytes = ctx->chunk_size; + record->filter_mask = 0; + for(u = 0; u < ctx->ndims; u++) + UINT64DECODE(raw, record->scaled[u]); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5D__bt2_unfilt_decode() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_unfilt_debug + * + * Purpose: Debug native form of record (non-filtered) + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__bt2_unfilt_debug(FILE *stream, int indent, int fwidth, + const void *_record, const void *_ctx) +{ + const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */ + const H5D_bt2_ctx_t *ctx = (const H5D_bt2_ctx_t *)_ctx; /* Callback context */ + unsigned u; /* Local index variable */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(record); + HDassert(ctx->chunk_size == record->nbytes); + HDassert(0 == record->filter_mask); + + HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Chunk address:", record->chunk_addr); + + HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:"); + for(u = 0; u < ctx->ndims; u++) + HDfprintf(stream, "%s%Hd", u?", ":"", record->scaled[u] * ctx->dim[u]); + HDfputs("}\n", stream); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5D__bt2_unfilt_debug() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_filt_encode + * + * Purpose: Encode native information into raw form for storing on disk + * (filtered) + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__bt2_filt_encode(uint8_t *raw, const void *_record, void *_ctx) +{ + H5D_bt2_ctx_t *ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */ + const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */ + unsigned u; /* Local index variable */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(ctx); + HDassert(record); + HDassert(H5F_addr_defined(record->chunk_addr)); + HDassert(0 != record->nbytes); + + /* Encode the record's fields */ + H5F_addr_encode_len(ctx->sizeof_addr, &raw, record->chunk_addr); + UINT64ENCODE_VAR(raw, record->nbytes, ctx->chunk_size_len); + UINT32ENCODE(raw, record->filter_mask); + for(u = 0; u < ctx->ndims; u++) + UINT64ENCODE(raw, record->scaled[u]); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5D__bt2_filt_encode() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_filt_decode + * + * Purpose: Decode raw disk form of record into native form + * (filtered) + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__bt2_filt_decode(const uint8_t *raw, void *_record, void *_ctx) +{ + H5D_bt2_ctx_t *ctx = (H5D_bt2_ctx_t *)_ctx; /* Callback context structure */ + H5D_chunk_rec_t *record = (H5D_chunk_rec_t *)_record; /* The native record */ + unsigned u; /* Local index variable */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(ctx); + HDassert(record); + + /* Decode the record's fields */ + H5F_addr_decode_len(ctx->sizeof_addr, &raw, &record->chunk_addr); + UINT64DECODE_VAR(raw, record->nbytes, ctx->chunk_size_len); + UINT32DECODE(raw, record->filter_mask); + for(u = 0; u < ctx->ndims; u++) + UINT64DECODE(raw, record->scaled[u]); + + /* Sanity checks */ + HDassert(H5F_addr_defined(record->chunk_addr)); + HDassert(0 != record->nbytes); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5D__bt2_filt_decode() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_filt_debug + * + * Purpose: Debug native form of record (filtered) + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__bt2_filt_debug(FILE *stream, int indent, int fwidth, + const void *_record, const void *_ctx) +{ + const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */ + const H5D_bt2_ctx_t *ctx = (const H5D_bt2_ctx_t *)_ctx; /* Callback context */ + unsigned u; /* Local index variable */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(record); + HDassert(H5F_addr_defined(record->chunk_addr)); + HDassert(0 != record->nbytes); + + HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Chunk address:", record->chunk_addr); + HDfprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth, "Chunk size:", (unsigned)record->nbytes); + HDfprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, "Filter mask:", record->filter_mask); + + HDfprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:"); + for(u = 0; u < ctx->ndims; u++) + HDfprintf(stream, "%s%Hd", u?", ":"", record->scaled[u] * ctx->dim[u]); + HDfputs("}\n", stream); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5D__bt2_filt_debug() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_idx_init + * + * Purpose: Initialize the indexing information for a dataset. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Neil Fortner + * Wednesday, May 23, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__bt2_idx_init(const H5D_chk_idx_info_t H5_ATTR_UNUSED *idx_info, + const H5S_t H5_ATTR_UNUSED *space, haddr_t dset_ohdr_addr) +{ + FUNC_ENTER_STATIC_NOERR + + /* Check args */ + HDassert(H5F_addr_defined(dset_ohdr_addr)); + + idx_info->storage->u.btree2.dset_ohdr_addr = dset_ohdr_addr; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__bt2_idx_init() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_idx_open() + * + * Purpose: Opens an existing v2 B-tree. + * + * Note: This information is passively initialized from each index + * operation callback because those abstract chunk index operations + * are designed to work with the v2 B-tree chunk indices also, + * which don't require an 'open' for the data structure. + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__bt2_idx_open(const H5D_chk_idx_info_t *idx_info) +{ + H5D_bt2_ctx_ud_t u_ctx; /* user data for creating context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check args */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(H5D_CHUNK_IDX_BT2 == idx_info->layout->idx_type); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(NULL == idx_info->storage->u.btree2.bt2); + + /* Set up the user data */ + u_ctx.f = idx_info->f; + u_ctx.ndims = idx_info->layout->ndims - 1; + u_ctx.chunk_size = idx_info->layout->size; + u_ctx.dim = idx_info->layout->dim; + + /* Open v2 B-tree for the chunk index */ + if(NULL == (idx_info->storage->u.btree2.bt2 = H5B2_open(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, &u_ctx))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open v2 B-tree for tracking chunked dataset") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__bt2_idx_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_idx_create + * + * Purpose: Create the v2 B-tree for tracking dataset chunks + * + * Return: SUCCEED/FAIL + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__bt2_idx_create(const H5D_chk_idx_info_t *idx_info) +{ + H5B2_create_t bt2_cparam; /* v2 B-tree creation parameters */ + H5D_bt2_ctx_ud_t u_ctx; /* data for context call */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check args */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(idx_info->storage); + HDassert(!H5F_addr_defined(idx_info->storage->idx_addr)); + + bt2_cparam.rrec_size = H5F_SIZEOF_ADDR(idx_info->f) /* Address of chunk */ + + (idx_info->layout->ndims - 1) * 8; /* # of dimensions x 64-bit chunk offsets */ + + /* General parameters */ + if(idx_info->pline->nused > 0) { + unsigned chunk_size_len; /* Size of encoded chunk size */ + + /* + * Compute the size required for encoding the size of a chunk, + * allowing for an extra byte, in case the filter makes the chunk larger. + */ + chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)idx_info->layout->size) + 8) / 8); + if(chunk_size_len > 8) + chunk_size_len = 8; + + bt2_cparam.rrec_size += chunk_size_len + 4; /* Size of encoded chunk size & filter mask */ + bt2_cparam.cls = H5D_BT2_FILT; + } /* end if */ + else + bt2_cparam.cls = H5D_BT2; + + bt2_cparam.node_size = idx_info->layout->u.btree2.cparam.node_size; + bt2_cparam.split_percent = idx_info->layout->u.btree2.cparam.split_percent; + bt2_cparam.merge_percent = idx_info->layout->u.btree2.cparam.merge_percent; + + u_ctx.f = idx_info->f; + u_ctx.ndims = idx_info->layout->ndims - 1; + u_ctx.chunk_size = idx_info->layout->size; + u_ctx.dim = idx_info->layout->dim; + + /* Create the v2 B-tree for the chunked dataset */ + if(NULL == (idx_info->storage->u.btree2.bt2 = H5B2_create(idx_info->f, idx_info->dxpl_id, &bt2_cparam, &u_ctx))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCREATE, FAIL, "can't create v2 B-tree for tracking chunked dataset") + + /* Retrieve the v2 B-tree's address in the file */ + if(H5B2_get_addr(idx_info->storage->u.btree2.bt2, &(idx_info->storage->idx_addr)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get v2 B-tree address for tracking chunked dataset") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__bt2_idx_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_idx_is_space_alloc + * + * Purpose: Query if space is allocated for index method + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static hbool_t +H5D__bt2_idx_is_space_alloc(const H5O_storage_chunk_t *storage) +{ + FUNC_ENTER_STATIC_NOERR + + /* Check args */ + HDassert(storage); + + FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr)) +} /* end H5D__bt2_idx_is_space_alloc() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_mod_cb + * + * Purpose: Modify record for dataset chunk when it is found in a v2 B-tree. + * This is the callback for H5B2_modify() which is called in + * H5D__bt2_idx_insert(). + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__bt2_mod_cb(void *_record, void *_op_data, hbool_t *changed) +{ + H5D_bt2_ud_t *op_data = (H5D_bt2_ud_t *)_op_data; /* User data for v2 B-tree calls */ + H5D_chunk_rec_t *record = (H5D_chunk_rec_t *)_record; /* Chunk record */ + + FUNC_ENTER_STATIC_NOERR + +/* Sanity check */ +#ifndef NDEBUG +{ + unsigned u; /* Local index variable */ + + for(u = 0; u < op_data->ndims; u++) + HDassert(record->scaled[u] == op_data->rec.scaled[u]); +} +#endif /* NDEBUG */ + + /* Modify record */ + *record = op_data->rec; + + /* Note that the record changed */ + *changed = TRUE; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__bt2_mod_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_idx_insert + * + * Purpose: Insert chunk address into the indexing structure. + * A non-filtered chunk: + * Should not exist + * Allocate the chunk and pass chunk address back up + * A filtered chunk: + * If it was not found, create the chunk and pass chunk address back up + * If it was found but its size changed, reallocate the chunk and pass chunk address back up + * If it was found but its size was the same, pass chunk address back up + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__bt2_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata, + const H5D_t H5_ATTR_UNUSED *dset) +{ + H5B2_t *bt2; /* v2 B-tree handle for indexing chunks */ + H5D_bt2_ud_t bt2_udata; /* User data for v2 B-tree calls */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(udata); + HDassert(H5F_addr_defined(udata->chunk_block.offset)); + + /* Check if the v2 B-tree is open yet */ + if(NULL == idx_info->storage->u.btree2.bt2) { + /* Open existing v2 B-tree */ + if(H5D__bt2_idx_open(idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree") + } /* end if */ + else /* Patch the top level file pointer contained in bt2 if needed */ + if(H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer") + + /* Set convenience pointer to v2 B-tree structure */ + bt2 = idx_info->storage->u.btree2.bt2; + + /* Set up callback info */ + bt2_udata.ndims = idx_info->layout->ndims - 1; + bt2_udata.rec.chunk_addr = udata->chunk_block.offset; + if(idx_info->pline->nused > 0) { /* filtered chunk */ + H5_CHECKED_ASSIGN(bt2_udata.rec.nbytes, uint32_t, udata->chunk_block.length, hsize_t); + bt2_udata.rec.filter_mask = udata->filter_mask; + } /* end if */ + else { /* non-filtered chunk */ + bt2_udata.rec.nbytes = idx_info->layout->size; + bt2_udata.rec.filter_mask = 0; + } /* end else */ + for(u = 0; u < (idx_info->layout->ndims - 1); u++) + bt2_udata.rec.scaled[u] = udata->common.scaled[u]; + + /* Update record for v2 B-tree (could be insert or modify) */ + if(H5B2_update(bt2, idx_info->dxpl_id, &bt2_udata, H5D__bt2_mod_cb, &bt2_udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTUPDATE, FAIL, "unable to update record in v2 B-tree") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__bt2_idx_insert() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_found_cb + * + * Purpose: Retrieve record for dataset chunk when it is found in a v2 B-tree. + * This is the callback for H5B2_find() which is called in + * H5D__bt2_idx_get_addr() and H5D__bt2_idx_insert(). + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__bt2_found_cb(const void *nrecord, void *op_data) +{ + FUNC_ENTER_STATIC_NOERR + + *(H5D_chunk_rec_t *)op_data = *(const H5D_chunk_rec_t *)nrecord; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5D__bt2_found_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_idx_get_addr + * + * Purpose: Get the file address of a chunk if file space has been + * assigned. Save the retrieved information in the udata + * supplied. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__bt2_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) +{ + H5B2_t *bt2; /* v2 B-tree handle for indexing chunks */ + H5D_bt2_ud_t bt2_udata; /* User data for v2 B-tree calls */ + H5D_chunk_rec_t found_rec; /* Record found from searching for object */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(idx_info->layout->ndims > 0); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(udata); + + /* Check if the v2 B-tree is open yet */ + if(NULL == idx_info->storage->u.btree2.bt2) { + /* Open existing v2 B-tree */ + if(H5D__bt2_idx_open(idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree") + } /* end if */ + else /* Patch the top level file pointer contained in bt2 if needed */ + if(H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer") + + /* Set convenience pointer to v2 B-tree structure */ + bt2 = idx_info->storage->u.btree2.bt2; + + /* Clear the found record */ + found_rec.chunk_addr = HADDR_UNDEF; + found_rec.nbytes = 0; + found_rec.filter_mask = 0; + + /* Prepare user data for compare callback */ + bt2_udata.rec.chunk_addr = HADDR_UNDEF; + bt2_udata.ndims = idx_info->layout->ndims - 1; + + /* Set the chunk offset to be searched for */ + for(u = 0; u < (idx_info->layout->ndims - 1); u++) + bt2_udata.rec.scaled[u] = udata->common.scaled[u]; + + /* Go get chunk information from v2 B-tree */ + if(H5B2_find(bt2, idx_info->dxpl_id, &bt2_udata, H5D__bt2_found_cb, &found_rec) < 0) + HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in v2 B-tree") + + /* Set common info for the chunk */ + udata->chunk_block.offset = found_rec.chunk_addr; + + /* Check for setting other info */ + if(H5F_addr_defined(udata->chunk_block.offset)) { + /* Sanity check */ + HDassert(0 != found_rec.nbytes); + + /* Set other info for the chunk */ + if(idx_info->pline->nused > 0) { /* filtered chunk */ + udata->chunk_block.length = found_rec.nbytes; + udata->filter_mask = found_rec.filter_mask; + } /* end if */ + else { /* non-filtered chunk */ + udata->chunk_block.length = idx_info->layout->size; + udata->filter_mask = 0; + } /* end else */ + } /* end if */ + else { + udata->chunk_block.length = 0; + udata->filter_mask = 0; + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__bt2_idx_get_addr() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_idx_iterate_cb + * + * Purpose: Translate the B-tree specific chunk record into a generic + * form and make the callback to the generic chunk callback + * routine. + * This is the callback for H5B2_iterate() which is called in + * H5D__bt2_idx_iterate(). + * + * Return: Success: Non-negative + * Failure: Negative + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static int +H5D__bt2_idx_iterate_cb(const void *_record, void *_udata) +{ + H5D_bt2_it_ud_t *udata = (H5D_bt2_it_ud_t *)_udata; /* User data */ + const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* Native record */ + int ret_value = -1; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Make "generic chunk" callback */ + if((ret_value = (udata->cb)(record, udata->udata)) < 0) + HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback"); + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__bt2_idx_iterate_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_idx_iterate + * + * Purpose: Iterate over the chunks in an index, making a callback + * for each one. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static int +H5D__bt2_idx_iterate(const H5D_chk_idx_info_t *idx_info, + H5D_chunk_cb_func_t chunk_cb, void *chunk_udata) +{ + H5B2_t *bt2; /* v2 B-tree handle for indexing chunks */ + H5D_bt2_it_ud_t udata; /* User data for B-tree iterator callback */ + int ret_value = FAIL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(chunk_cb); + HDassert(chunk_udata); + + /* Check if the v2 B-tree is open yet */ + if(NULL == idx_info->storage->u.btree2.bt2) { + /* Open existing v2 B-tree */ + if(H5D__bt2_idx_open(idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree") + } /* end if */ + else /* Patch the top level file pointer contained in bt2 if needed */ + if(H5B2_patch_file(idx_info->storage->u.btree2.bt2, idx_info->f) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't patch v2 B-tree file pointer") + + /* Set convenience pointer to v2 B-tree structure */ + bt2 = idx_info->storage->u.btree2.bt2; + + /* Prepare user data for iterate callback */ + udata.cb = chunk_cb; + udata.udata = chunk_udata; + + /* Iterate over the records in the v2 B-tree */ + if((ret_value = H5B2_iterate(bt2, idx_info->dxpl_id, H5D__bt2_idx_iterate_cb, &udata)) < 0) + HERROR(H5E_DATASET, H5E_BADITER, "unable to iterate over chunk v2 B-tree"); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__bt2_idx_iterate() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_remove_cb() + * + * Purpose: Free space for 'dataset chunk' object as v2 B-tree + * is being deleted or v2 B-tree node is removed. + * This is the callback for H5B2_remove() and H5B2_delete() which + * which are called in H5D__bt2_idx_remove() and H5D__bt2_idx_delete(). + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__bt2_remove_cb(const void *_record, void *_udata) +{ + const H5D_chunk_rec_t *record = (const H5D_chunk_rec_t *)_record; /* The native record */ + H5D_bt2_remove_ud_t *udata = (H5D_bt2_remove_ud_t *)_udata; /* User data for removal callback */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(udata); + HDassert(udata->f); + + /* Free the space in the file for the object being removed */ + H5_CHECK_OVERFLOW(record->nbytes, uint32_t, hsize_t); + if(H5MF_xfree(udata->f, H5FD_MEM_DRAW, udata->dxpl_id, record->chunk_addr, (hsize_t)record->nbytes) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__bt2_remove_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_idx_remove + * + * Purpose: Remove chunk from index. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__bt2_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata) +{ + H5B2_t *bt2; /* v2 B-tree handle for indexing chunks */ + H5D_bt2_remove_ud_t remove_udata; /* User data for removal callback */ + H5D_bt2_ud_t bt2_udata; /* User data for v2 B-tree find call */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(udata); + + /* Check if the v2 B-tree is open yet */ + if(NULL == idx_info->storage->u.btree2.bt2) + /* Open existing v2 B-tree */ + if(H5D__bt2_idx_open(idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree") + + /* Set convenience pointer to v2 B-tree structure */ + bt2 = idx_info->storage->u.btree2.bt2; + + /* Initialize user data for removal callback */ + remove_udata.f = idx_info->f; + remove_udata.dxpl_id = idx_info->dxpl_id; + + /* Prepare user data for compare callback */ + bt2_udata.ndims = idx_info->layout->ndims - 1; + + /* Initialize the record to search for */ + for(u = 0; u < (idx_info->layout->ndims - 1); u++) + bt2_udata.rec.scaled[u] = udata->scaled[u]; + + /* Remove the record for the "dataset chunk" object from the v2 B-tree */ + /* (space in the file for the object is freed in the 'remove' callback) */ + if(H5B2_remove(bt2, idx_info->dxpl_id, &bt2_udata, H5D__bt2_remove_cb, &remove_udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__bt2_idx_remove() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_idx_delete + * + * Purpose: Delete index and raw data storage for entire dataset + * (i.e. all chunks) + * + * Return: Success: Non-negative + * Failure: negative + * + * Programmer: Vailin Choi; June 2010 + * + * Modifications: + * Vailin Choi; March 2011 + * Initialize size of an unfiltered chunk. + * This is a fix for for the assertion failure in: + * [src/H5FSsection.c:968: H5FS_sect_link_size: Assertion `bin < sinfo->nbins' failed.] + * which is uncovered by test_unlink_chunked_dataset() in test/unlink.c + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__bt2_idx_delete(const H5D_chk_idx_info_t *idx_info) +{ + H5D_bt2_remove_ud_t remove_udata; /* User data for removal callback */ + H5B2_remove_t remove_op; /* The removal callback */ + H5D_bt2_ctx_ud_t u_ctx; /* data for context call */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(idx_info->storage); + + /* Check if the index data structure has been allocated */ + if(H5F_addr_defined(idx_info->storage->idx_addr)) { + /* Set up user data for creating context */ + u_ctx.f = idx_info->f; + u_ctx.ndims = idx_info->layout->ndims - 1; + u_ctx.chunk_size = idx_info->layout->size; + u_ctx.dim = idx_info->layout->dim; + + /* Initialize user data for removal callback */ + remove_udata.f = idx_info->f; + remove_udata.dxpl_id = idx_info->dxpl_id; + + /* Set remove operation. */ + remove_op = H5D__bt2_remove_cb; + + /* Delete the v2 B-tree */ + /*(space in the file for each object is freed in the 'remove' callback) */ + if(H5B2_delete(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, &u_ctx, remove_op, &remove_udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "can't delete v2 B-tree") + + idx_info->storage->idx_addr = HADDR_UNDEF; + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__bt2_idx_delete() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_idx_copy_setup + * + * Purpose: Set up any necessary information for copying chunks + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__bt2_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, + const H5D_chk_idx_info_t *idx_info_dst) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Source file */ + HDassert(idx_info_src); + HDassert(idx_info_src->f); + HDassert(idx_info_src->pline); + HDassert(idx_info_src->layout); + HDassert(idx_info_src->storage); + + /* Destination file */ + HDassert(idx_info_dst); + HDassert(idx_info_dst->f); + HDassert(idx_info_dst->pline); + HDassert(idx_info_dst->layout); + HDassert(idx_info_dst->storage); + HDassert(!H5F_addr_defined(idx_info_dst->storage->idx_addr)); + + /* Check if the source v2 B-tree is open yet */ + if(NULL == idx_info_src->storage->u.btree2.bt2) + if(H5D__bt2_idx_open(idx_info_src) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree") + + /* Set copied metadata tag */ + H5_BEGIN_TAG(idx_info_dst->dxpl_id, H5AC__COPIED_TAG, FAIL); + + /* Create v2 B-tree that describes the chunked dataset in the destination file */ + if(H5D__bt2_idx_create(idx_info_dst) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage") + HDassert(H5F_addr_defined(idx_info_dst->storage->idx_addr)); + + /* Reset metadata tag */ + H5_END_TAG(FAIL); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__bt2_idx_copy_setup() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_idx_copy_shutdown + * + * Purpose: Shutdown any information from copying chunks + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__bt2_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, + H5O_storage_chunk_t *storage_dst, hid_t H5_ATTR_UNUSED dxpl_id) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check args */ + HDassert(storage_src); + HDassert(storage_src->u.btree2.bt2); + HDassert(storage_dst); + HDassert(storage_dst->u.btree2.bt2); + + /* Close v2 B-tree for source file */ + if(H5B2_close(storage_src->u.btree2.bt2, dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close v2 B-tree") + storage_src->u.btree2.bt2 = NULL; + + /* Close v2 B-tree for destination file */ + if(H5B2_close(storage_dst->u.btree2.bt2, dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close v2 B-tree") + storage_dst->u.btree2.bt2 = NULL; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__bt2_idx_copy_shutdown() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_idx_size + * + * Purpose: Retrieve the amount of index storage for chunked dataset + * + * Return: Success: Non-negative + * Failure: negative + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__bt2_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) +{ + H5B2_t *bt2_cdset = NULL; /* Pointer to v2 B-tree structure */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check args */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(index_size); + + /* Open v2 B-tree */ + if(H5D__bt2_idx_open(idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open v2 B-tree") + + /* Set convenience pointer to v2 B-tree structure */ + bt2_cdset = idx_info->storage->u.btree2.bt2; + + /* Get v2 B-tree size for indexing chunked dataset */ + if(H5B2_size(bt2_cdset, idx_info->dxpl_id, index_size) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve v2 B-tree storage info for chunked dataset") + +done: + /* Close v2 B-tree index */ + if(bt2_cdset && H5B2_close(bt2_cdset, idx_info->dxpl_id) < 0) + HDONE_ERROR(H5E_SYM, H5E_CLOSEERROR, FAIL, "can't close v2 B-tree for tracking chunked dataset") + idx_info->storage->u.btree2.bt2 = NULL; + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__bt2_idx_size() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_idx_reset + * + * Purpose: Reset indexing information. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__bt2_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) +{ + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(storage); + + /* Reset index info */ + if(reset_addr) + storage->idx_addr = HADDR_UNDEF; + storage->u.btree2.bt2 = NULL; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__bt2_idx_reset() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_idx_dump + * + * Purpose: Dump indexing information to a stream. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__bt2_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) +{ + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(storage); + HDassert(stream); + + HDfprintf(stream, " Address: %a\n", storage->idx_addr); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__bt2_idx_dump() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__bt2_idx_dest + * + * Purpose: Release indexing information in memory. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi; June 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__bt2_idx_dest(const H5D_chk_idx_info_t *idx_info) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check args */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->storage); + + /* Check if the v2-btree is open */ + if(idx_info->storage->u.btree2.bt2) { + /* Close v2 B-tree */ + if(H5B2_close(idx_info->storage->u.btree2.bt2, idx_info->dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree") + idx_info->storage->u.btree2.bt2 = NULL; + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__bt2_idx_dest() */ + diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 4d0e2c3..4df493d 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -75,7 +75,9 @@ /* Sanity check on chunk index types: commonly used by a lot of routines in this file */ #define H5D_CHUNK_STORAGE_INDEX_CHK(storage) \ - HDassert((H5D_CHUNK_IDX_BTREE == storage->idx_type && H5D_COPS_BTREE == storage->ops)); + HDassert((H5D_CHUNK_IDX_EARRAY == storage->idx_type && H5D_COPS_EARRAY == storage->ops) || \ + (H5D_CHUNK_IDX_BT2 == storage->idx_type && H5D_COPS_BT2 == storage->ops) || \ + (H5D_CHUNK_IDX_BTREE == storage->idx_type && H5D_COPS_BTREE == storage->ops)); /* * Feature: If this constant is defined then every cache preemption and load @@ -6285,6 +6287,8 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old /* Actually allocate space for the chunk in the file */ if(alloc_chunk) { switch(idx_info->storage->idx_type) { + case H5D_CHUNK_IDX_EARRAY: + case H5D_CHUNK_IDX_BT2: case H5D_CHUNK_IDX_BTREE: HDassert(new_chunk->length > 0); H5_CHECK_OVERFLOW(new_chunk->length, /*From: */uint32_t, /*To: */hsize_t); diff --git a/src/H5Dearray.c b/src/H5Dearray.c new file mode 100644 index 0000000..f24c69a --- /dev/null +++ b/src/H5Dearray.c @@ -0,0 +1,1740 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Programmer: Quincey Koziol + * Tuesday, January 27, 2009 + * + * Purpose: Extensible array indexed (chunked) I/O functions. The chunks + * are given a single-dimensional index which is used as the + * offset in an extensible array that maps a chunk coordinate to + * a disk address. + * + */ + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5EAprivate.h" /* Extensible arrays */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5MFprivate.h" /* File space management */ +#include "H5VMprivate.h" /* Vector functions */ + + +/****************/ +/* Local Macros */ +/****************/ + +/* Value to fill unset array elements with */ +#define H5D_EARRAY_FILL HADDR_UNDEF +#define H5D_EARRAY_FILT_FILL {HADDR_UNDEF, 0, 0} + + +/******************/ +/* Local Typedefs */ +/******************/ + +/* Extensible array create/open user data */ +typedef struct H5D_earray_ctx_ud_t { + const H5F_t *f; /* Pointer to file info */ + uint32_t chunk_size; /* Size of chunk (bytes) */ +} H5D_earray_ctx_ud_t; + +/* Extensible array callback context */ +typedef struct H5D_earray_ctx_t { + size_t file_addr_len; /* Size of addresses in the file (bytes) */ + size_t chunk_size_len; /* Size of chunk sizes in the file (bytes) */ +} H5D_earray_ctx_t; + +/* User data for chunk callbacks */ +typedef struct H5D_earray_ud_t { + H5F_t *f; /* File pointer for operation */ + hid_t dxpl_id; /* DXPL ID for operation */ +} H5D_earray_ud_t; + +/* Extensible Array callback info for iteration over chunks */ +typedef struct H5D_earray_it_ud_t { + H5D_chunk_common_ud_t common; /* Common info for Fixed Array user data (must be first) */ + H5D_chunk_rec_t chunk_rec; /* Generic chunk record for callback */ + hbool_t filtered; /* Whether the chunks are filtered */ + H5D_chunk_cb_func_t cb; /* Chunk callback routine */ + void *udata; /* User data for chunk callback routine */ +} H5D_earray_it_ud_t; + +/* Native extensible array element for chunks w/filters */ +typedef struct H5D_earray_filt_elmt_t { + haddr_t addr; /* Address of chunk */ + uint32_t nbytes; /* Size of chunk (in file) */ + uint32_t filter_mask; /* Excluded filters for chunk */ +} H5D_earray_filt_elmt_t; + + +/********************/ +/* Local Prototypes */ +/********************/ +/* Extensible array iterator callbacks */ +static int H5D__earray_idx_iterate_cb(hsize_t idx, const void *_elmt, void *_udata); +static int H5D__earray_idx_delete_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata); + +/* Extensible array class callbacks for chunks w/o filters */ +static void *H5D__earray_crt_context(void *udata); +static herr_t H5D__earray_dst_context(void *ctx); +static herr_t H5D__earray_fill(void *nat_blk, size_t nelmts); +static herr_t H5D__earray_encode(void *raw, const void *elmt, size_t nelmts, + void *ctx); +static herr_t H5D__earray_decode(const void *raw, void *elmt, size_t nelmts, + void *ctx); +static herr_t H5D__earray_debug(FILE *stream, int indent, int fwidth, + hsize_t idx, const void *elmt); +static void *H5D__earray_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t obj_addr); +static herr_t H5D__earray_dst_dbg_context(void *dbg_ctx); + +/* Extensible array class callbacks for chunks w/filters */ +/* (some shared with callbacks for chunks w/o filters) */ +static herr_t H5D__earray_filt_fill(void *nat_blk, size_t nelmts); +static herr_t H5D__earray_filt_encode(void *raw, const void *elmt, size_t nelmts, + void *ctx); +static herr_t H5D__earray_filt_decode(const void *raw, void *elmt, size_t nelmts, + void *ctx); +static herr_t H5D__earray_filt_debug(FILE *stream, int indent, int fwidth, + hsize_t idx, const void *elmt); + +/* Chunked layout indexing callbacks */ +static herr_t H5D__earray_idx_init(const H5D_chk_idx_info_t *idx_info, + const H5S_t *space, haddr_t dset_ohdr_addr); +static herr_t H5D__earray_idx_create(const H5D_chk_idx_info_t *idx_info); +static hbool_t H5D__earray_idx_is_space_alloc(const H5O_storage_chunk_t *storage); +static herr_t H5D__earray_idx_insert(const H5D_chk_idx_info_t *idx_info, + H5D_chunk_ud_t *udata, const H5D_t *dset); +static herr_t H5D__earray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, + H5D_chunk_ud_t *udata); +static herr_t H5D__earray_idx_resize(H5O_layout_chunk_t *layout); +static int H5D__earray_idx_iterate(const H5D_chk_idx_info_t *idx_info, + H5D_chunk_cb_func_t chunk_cb, void *chunk_udata); +static herr_t H5D__earray_idx_remove(const H5D_chk_idx_info_t *idx_info, + H5D_chunk_common_ud_t *udata); +static herr_t H5D__earray_idx_delete(const H5D_chk_idx_info_t *idx_info); +static herr_t H5D__earray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, + const H5D_chk_idx_info_t *idx_info_dst); +static herr_t H5D__earray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, + H5O_storage_chunk_t *storage_dst, hid_t dxpl_id); +static herr_t H5D__earray_idx_size(const H5D_chk_idx_info_t *idx_info, + hsize_t *size); +static herr_t H5D__earray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr); +static herr_t H5D__earray_idx_dump(const H5O_storage_chunk_t *storage, + FILE *stream); +static herr_t H5D__earray_idx_dest(const H5D_chk_idx_info_t *idx_info); + +/* Generic extensible array routines */ +static herr_t H5D__earray_idx_open(const H5D_chk_idx_info_t *idx_info); + + +/*********************/ +/* Package Variables */ +/*********************/ + +/* Extensible array indexed chunk I/O ops */ +const H5D_chunk_ops_t H5D_COPS_EARRAY[1] = {{ + H5D__earray_idx_init, /* init */ + H5D__earray_idx_create, /* create */ + H5D__earray_idx_is_space_alloc, /* is_space_alloc */ + H5D__earray_idx_insert, /* insert */ + H5D__earray_idx_get_addr, /* get_addr */ + H5D__earray_idx_resize, /* resize */ + H5D__earray_idx_iterate, /* iterate */ + H5D__earray_idx_remove, /* remove */ + H5D__earray_idx_delete, /* delete */ + H5D__earray_idx_copy_setup, /* copy_setup */ + H5D__earray_idx_copy_shutdown, /* copy_shutdown */ + H5D__earray_idx_size, /* size */ + H5D__earray_idx_reset, /* reset */ + H5D__earray_idx_dump, /* dump */ + H5D__earray_idx_dest /* destroy */ +}}; + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + +/* Extensible array class callbacks for dataset chunks w/o filters */ +const H5EA_class_t H5EA_CLS_CHUNK[1]={{ + H5EA_CLS_CHUNK_ID, /* Type of extensible array */ + "Chunk w/o filters", /* Name of extensible array class */ + sizeof(haddr_t), /* Size of native element */ + H5D__earray_crt_context, /* Create context */ + H5D__earray_dst_context, /* Destroy context */ + H5D__earray_fill, /* Fill block of missing elements callback */ + H5D__earray_encode, /* Element encoding callback */ + H5D__earray_decode, /* Element decoding callback */ + H5D__earray_debug, /* Element debugging callback */ + H5D__earray_crt_dbg_context, /* Create debugging context */ + H5D__earray_dst_dbg_context /* Destroy debugging context */ +}}; + +/* Extensible array class callbacks for dataset chunks w/filters */ +const H5EA_class_t H5EA_CLS_FILT_CHUNK[1]={{ + H5EA_CLS_FILT_CHUNK_ID, /* Type of extensible array */ + "Chunk w/filters", /* Name of extensible array class */ + sizeof(H5D_earray_filt_elmt_t), /* Size of native element */ + H5D__earray_crt_context, /* Create context */ + H5D__earray_dst_context, /* Destroy context */ + H5D__earray_filt_fill, /* Fill block of missing elements callback */ + H5D__earray_filt_encode, /* Element encoding callback */ + H5D__earray_filt_decode, /* Element decoding callback */ + H5D__earray_filt_debug, /* Element debugging callback */ + H5D__earray_crt_dbg_context, /* Create debugging context */ + H5D__earray_dst_dbg_context /* Destroy debugging context */ +}}; + + +/*******************/ +/* Local Variables */ +/*******************/ + +/* Declare a free list to manage the H5D_earray_ctx_t struct */ +/* Declare a free list to manage the H5D_earray_ctx_ud_t struct */ +H5FL_DEFINE_STATIC(H5D_earray_ctx_t); +H5FL_DEFINE_STATIC(H5D_earray_ctx_ud_t); + + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_crt_context + * + * Purpose: Create context for callbacks + * + * Return: Success: non-NULL + * Failure: NULL + * + * Programmer: Quincey Koziol + * Thursday, January 29, 2009 + * + *------------------------------------------------------------------------- + */ +static void * +H5D__earray_crt_context(void *_udata) +{ + H5D_earray_ctx_t *ctx; /* Extensible array callback context */ + H5D_earray_ctx_ud_t *udata = (H5D_earray_ctx_ud_t *)_udata; /* User data for extensible array context */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(udata); + HDassert(udata->f); + HDassert(udata->chunk_size > 0); + + /* Allocate new context structure */ + if(NULL == (ctx = H5FL_MALLOC(H5D_earray_ctx_t))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate extensible array client callback context") + + /* Initialize the context */ + ctx->file_addr_len = H5F_SIZEOF_ADDR(udata->f); + + /* Compute the size required for encoding the size of a chunk, allowing + * for an extra byte, in case the filter makes the chunk larger. + */ + ctx->chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)udata->chunk_size) + 8) / 8); + if(ctx->chunk_size_len > 8) + ctx->chunk_size_len = 8; + + /* Set return value */ + ret_value = ctx; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__earray_crt_context() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_dst_context + * + * Purpose: Destroy context for callbacks + * + * Return: Success: non-NULL + * Failure: NULL + * + * Programmer: Quincey Koziol + * Thursday, January 29, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__earray_dst_context(void *_ctx) +{ + H5D_earray_ctx_t *ctx = (H5D_earray_ctx_t *)_ctx; /* Extensible array callback context */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(ctx); + + /* Release context structure */ + ctx = H5FL_FREE(H5D_earray_ctx_t, ctx); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__earray_dst_context() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_fill + * + * Purpose: Fill "missing elements" in block of elements + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Tuesday, January 27, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__earray_fill(void *nat_blk, size_t nelmts) +{ + haddr_t fill_val = H5D_EARRAY_FILL; /* Value to fill elements with */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(nat_blk); + HDassert(nelmts); + + H5VM_array_fill(nat_blk, &fill_val, H5EA_CLS_CHUNK->nat_elmt_size, nelmts); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__earray_fill() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_encode + * + * Purpose: Encode an element from "native" to "raw" form + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Tuesday, January 27, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__earray_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx) +{ + H5D_earray_ctx_t *ctx = (H5D_earray_ctx_t *)_ctx; /* Extensible array callback context */ + const haddr_t *elmt = (const haddr_t *)_elmt; /* Convenience pointer to native elements */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(raw); + HDassert(elmt); + HDassert(nelmts); + HDassert(ctx); + + /* Encode native elements into raw elements */ + while(nelmts) { + /* Encode element */ + /* (advances 'raw' pointer) */ + H5F_addr_encode_len(ctx->file_addr_len, (uint8_t **)&raw, *elmt); + + /* Advance native element pointer */ + elmt++; + + /* Decrement # of elements to encode */ + nelmts--; + } /* end while */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__earray_encode() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_decode + * + * Purpose: Decode an element from "raw" to "native" form + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Thursday, January 29, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__earray_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx) +{ + H5D_earray_ctx_t *ctx = (H5D_earray_ctx_t *)_ctx; /* Extensible array callback context */ + haddr_t *elmt = (haddr_t *)_elmt; /* Convenience pointer to native elements */ + const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(raw); + HDassert(elmt); + HDassert(nelmts); + + /* Decode raw elements into native elements */ + while(nelmts) { + /* Decode element */ + /* (advances 'raw' pointer) */ + H5F_addr_decode_len(ctx->file_addr_len, &raw, elmt); + + /* Advance native element pointer */ + elmt++; + + /* Decrement # of elements to decode */ + nelmts--; + } /* end while */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__earray_decode() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_debug + * + * Purpose: Display an element for debugging + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Thursday, January 29, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__earray_debug(FILE *stream, int indent, int fwidth, hsize_t idx, + const void *elmt) +{ + char temp_str[128]; /* Temporary string, for formatting */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(stream); + HDassert(elmt); + + /* Print element */ + sprintf(temp_str, "Element #%llu:", (unsigned long long)idx); + HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, temp_str, + *(const haddr_t *)elmt); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__earray_debug() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_filt_fill + * + * Purpose: Fill "missing elements" in block of elements + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Saturday, January 31, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__earray_filt_fill(void *nat_blk, size_t nelmts) +{ + H5D_earray_filt_elmt_t fill_val = H5D_EARRAY_FILT_FILL; /* Value to fill elements with */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(nat_blk); + HDassert(nelmts); + HDassert(sizeof(fill_val) == H5EA_CLS_FILT_CHUNK->nat_elmt_size); + + H5VM_array_fill(nat_blk, &fill_val, H5EA_CLS_FILT_CHUNK->nat_elmt_size, nelmts); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__earray_filt_fill() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_filt_encode + * + * Purpose: Encode an element from "native" to "raw" form + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Saturday, January 31, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__earray_filt_encode(void *_raw, const void *_elmt, size_t nelmts, void *_ctx) +{ + H5D_earray_ctx_t *ctx = (H5D_earray_ctx_t *)_ctx; /* Extensible array callback context */ + uint8_t *raw = (uint8_t *)_raw; /* Convenience pointer to raw elements */ + const H5D_earray_filt_elmt_t *elmt = (const H5D_earray_filt_elmt_t *)_elmt; /* Convenience pointer to native elements */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(raw); + HDassert(elmt); + HDassert(nelmts); + HDassert(ctx); + + /* Encode native elements into raw elements */ + while(nelmts) { + /* Encode element */ + /* (advances 'raw' pointer) */ + H5F_addr_encode_len(ctx->file_addr_len, &raw, elmt->addr); + UINT64ENCODE_VAR(raw, elmt->nbytes, ctx->chunk_size_len); + UINT32ENCODE(raw, elmt->filter_mask); + + /* Advance native element pointer */ + elmt++; + + /* Decrement # of elements to encode */ + nelmts--; + } /* end while */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__earray_filt_encode() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_filt_decode + * + * Purpose: Decode an element from "raw" to "native" form + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Saturday, January 31, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__earray_filt_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx) +{ + H5D_earray_ctx_t *ctx = (H5D_earray_ctx_t *)_ctx; /* Extensible array callback context */ + H5D_earray_filt_elmt_t *elmt = (H5D_earray_filt_elmt_t *)_elmt; /* Convenience pointer to native elements */ + const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(raw); + HDassert(elmt); + HDassert(nelmts); + + /* Decode raw elements into native elements */ + while(nelmts) { + /* Decode element */ + /* (advances 'raw' pointer) */ + H5F_addr_decode_len(ctx->file_addr_len, &raw, &elmt->addr); + UINT64DECODE_VAR(raw, elmt->nbytes, ctx->chunk_size_len); + UINT32DECODE(raw, elmt->filter_mask); + + /* Advance native element pointer */ + elmt++; + + /* Decrement # of elements to decode */ + nelmts--; + } /* end while */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__earray_filt_decode() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_filt_debug + * + * Purpose: Display an element for debugging + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Saturday, January 31, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__earray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, + const void *_elmt) +{ + const H5D_earray_filt_elmt_t *elmt = (const H5D_earray_filt_elmt_t *)_elmt; /* Convenience pointer to native elements */ + char temp_str[128]; /* Temporary string, for formatting */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(stream); + HDassert(elmt); + + /* Print element */ + sprintf(temp_str, "Element #%llu:", (unsigned long long)idx); + HDfprintf(stream, "%*s%-*s {%a, %u, %0x}\n", indent, "", fwidth, temp_str, + elmt->addr, elmt->nbytes, elmt->filter_mask); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__earray_filt_debug() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_crt_dbg_context + * + * Purpose: Create context for debugging callback + * (get the layout message in the specified object header) + * + * Return: Success: non-NULL + * Failure: NULL + * + * Programmer: Vailin Choi; July 2010 + * + *------------------------------------------------------------------------- + */ +static void * +H5D__earray_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t obj_addr) +{ + H5D_earray_ctx_ud_t *dbg_ctx = NULL; /* Context for fixed array callback */ + H5O_loc_t obj_loc; /* Pointer to an object's location */ + hbool_t obj_opened = FALSE; /* Flag to indicate that the object header was opened */ + H5O_layout_t layout; /* Layout message */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(f); + HDassert(H5F_addr_defined(obj_addr)); + + /* Allocate context for debugging callback */ + if(NULL == (dbg_ctx = H5FL_MALLOC(H5D_earray_ctx_ud_t))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate extensible array client callback context") + + /* Set up the object header location info */ + H5O_loc_reset(&obj_loc); + obj_loc.file = f; + obj_loc.addr = obj_addr; + + /* Open the object header where the layout message resides */ + if(H5O_open(&obj_loc) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "can't open object header") + obj_opened = TRUE; + + /* Read the layout message */ + if(NULL == H5O_msg_read(&obj_loc, H5O_LAYOUT_ID, &layout, dxpl_id)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get layout info") + + /* close the object header */ + if(H5O_close(&obj_loc) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, NULL, "can't close object header") + + /* Create user data */ + dbg_ctx->f = f; + dbg_ctx->chunk_size = layout.u.chunk.size; + + /* Set return value */ + ret_value = dbg_ctx; + +done: + /* Cleanup on error */ + if(ret_value == NULL) { + /* Release context structure */ + if(dbg_ctx) + dbg_ctx = H5FL_FREE(H5D_earray_ctx_ud_t, dbg_ctx); + + /* Close object header */ + if(obj_opened) { + if(H5O_close(&obj_loc) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, NULL, "can't close object header") + } /* end if */ + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__earray_crt_dbg_context() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_dst_dbg_context + * + * Purpose: Destroy context for debugging callback + * (free the layout message from the specified object header) + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Vailin Choi; July 2010 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__earray_dst_dbg_context(void *_dbg_ctx) +{ + H5D_earray_ctx_ud_t *dbg_ctx = (H5D_earray_ctx_ud_t *)_dbg_ctx; /* Context for extensible array callback */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(dbg_ctx); + + /* Release context structure */ + dbg_ctx = H5FL_FREE(H5D_earray_ctx_ud_t, dbg_ctx); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__earray_dst_dbg_context() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_idx_open + * + * Purpose: Opens an existing extensible array. + * + * Note: This information is passively initialized from each index + * operation callback because those abstract chunk index operations + * are designed to work with the v1 B-tree chunk indices also, + * which don't require an 'open' for the data structure. + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Thursday, January 29, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__earray_idx_open(const H5D_chk_idx_info_t *idx_info) +{ + H5D_earray_ctx_ud_t udata; /* User data for extensible array open call */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check args */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(H5D_CHUNK_IDX_EARRAY == idx_info->layout->idx_type); + HDassert(idx_info->storage); + HDassert(H5D_CHUNK_IDX_EARRAY == idx_info->storage->idx_type); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(NULL == idx_info->storage->u.earray.ea); + + /* Set up the user data */ + udata.f = idx_info->f; + udata.chunk_size = idx_info->layout->size; + + /* Open the extensible array for the chunk index */ + if(NULL == (idx_info->storage->u.earray.ea = H5EA_open(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, &udata))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open extensible array") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__earray_idx_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_idx_init + * + * Purpose: Initialize the indexing information for a dataset. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Wednesday, May 27, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__earray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t *space, + haddr_t dset_ohdr_addr) +{ + hsize_t max_dims[H5O_LAYOUT_NDIMS]; /* Max. size of dataset dimensions */ + int unlim_dim; /* Rank of the dataset's unlimited dimension */ + int sndims; /* Rank of dataspace */ + unsigned ndims; /* Rank of dataspace */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check args */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(idx_info->storage); + HDassert(space); + HDassert(H5F_addr_defined(dset_ohdr_addr)); + + /* Get the dim info for dataset */ + if((sndims = H5S_get_simple_extent_dims(space, NULL, max_dims)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace dimensions") + H5_CHECKED_ASSIGN(ndims, unsigned, sndims, int); + + /* Find the rank of the unlimited dimension */ + unlim_dim = (-1); + for(u = 0; u < ndims; u++) { + /* Check for unlimited dimension */ + if(H5S_UNLIMITED == max_dims[u]) { + /* Check if we've already found an unlimited dimension */ + if(unlim_dim >= 0) + HGOTO_ERROR(H5E_DATASET, H5E_ALREADYINIT, FAIL, "already found unlimited dimension") + + /* Set the unlimited dimension */ + unlim_dim = (int)u; + } /* end if */ + } /* end for */ + + /* Check if we didn't find an unlimited dimension */ + if(unlim_dim < 0) + HGOTO_ERROR(H5E_DATASET, H5E_UNINITIALIZED, FAIL, "didn't find unlimited dimension") + + /* Set the unlimited dimension for the layout's future use */ + idx_info->layout->u.earray.unlim_dim = (unsigned)unlim_dim; + + /* Store the dataset's object header address for later */ + idx_info->storage->u.earray.dset_ohdr_addr = dset_ohdr_addr; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__earray_idx_init() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_idx_create + * + * Purpose: Creates a new indexed-storage extensible array and initializes + * the layout struct with information about the storage. The + * struct should be immediately written to the object header. + * + * This function must be called before passing LAYOUT to any of + * the other indexed storage functions! + * + * Return: Non-negative on success (with the LAYOUT argument initialized + * and ready to write to an object header). Negative on failure. + * + * Programmer: Quincey Koziol + * Tuesday, January 27, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__earray_idx_create(const H5D_chk_idx_info_t *idx_info) +{ + H5EA_create_t cparam; /* Extensible array creation parameters */ + H5D_earray_ctx_ud_t udata; /* User data for extensible array create call */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check args */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(idx_info->storage); + HDassert(!H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(NULL == idx_info->storage->u.earray.ea); + + /* General parameters */ + if(idx_info->pline->nused > 0) { + unsigned chunk_size_len; /* Size of encoded chunk size */ + + /* Compute the size required for encoding the size of a chunk, allowing + * for an extra byte, in case the filter makes the chunk larger. + */ + chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)idx_info->layout->size) + 8) / 8); + if(chunk_size_len > 8) + chunk_size_len = 8; + + cparam.cls = H5EA_CLS_FILT_CHUNK; + cparam.raw_elmt_size = (uint8_t)(H5F_SIZEOF_ADDR(idx_info->f) + chunk_size_len + 4); + } /* end if */ + else { + cparam.cls = H5EA_CLS_CHUNK; + cparam.raw_elmt_size = (uint8_t)H5F_SIZEOF_ADDR(idx_info->f); + } /* end else */ + cparam.max_nelmts_bits = idx_info->layout->u.earray.cparam.max_nelmts_bits; + HDassert(cparam.max_nelmts_bits > 0); + cparam.idx_blk_elmts = idx_info->layout->u.earray.cparam.idx_blk_elmts; + HDassert(cparam.idx_blk_elmts > 0); + cparam.sup_blk_min_data_ptrs = idx_info->layout->u.earray.cparam.sup_blk_min_data_ptrs; + HDassert(cparam.sup_blk_min_data_ptrs > 0); + cparam.data_blk_min_elmts = idx_info->layout->u.earray.cparam.data_blk_min_elmts; + HDassert(cparam.data_blk_min_elmts > 0); + cparam.max_dblk_page_nelmts_bits = idx_info->layout->u.earray.cparam.max_dblk_page_nelmts_bits; + HDassert(cparam.max_dblk_page_nelmts_bits > 0); + + /* Set up the user data */ + udata.f = idx_info->f; + udata.chunk_size = idx_info->layout->size; + + /* Create the extensible array for the chunk index */ + if(NULL == (idx_info->storage->u.earray.ea = H5EA_create(idx_info->f, idx_info->dxpl_id, &cparam, &udata))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create extensible array") + + /* Get the address of the extensible array in file */ + if(H5EA_get_addr(idx_info->storage->u.earray.ea, &(idx_info->storage->idx_addr)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query extensible array address") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__earray_idx_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_idx_is_space_alloc + * + * Purpose: Query if space is allocated for index method + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, January 29, 2009 + * + *------------------------------------------------------------------------- + */ +static hbool_t +H5D__earray_idx_is_space_alloc(const H5O_storage_chunk_t *storage) +{ + FUNC_ENTER_STATIC_NOERR + + /* Check args */ + HDassert(storage); + + FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr)) +} /* end H5D__earray_idx_is_space_alloc() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_idx_insert + * + * Purpose: Insert chunk address into the indexing structure. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi; May 2014 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__earray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata, + const H5D_t H5_ATTR_UNUSED *dset) +{ + H5EA_t *ea; /* Pointer to extensible array structure */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(udata); + + /* Check if the extensible array is open yet */ + if(NULL == idx_info->storage->u.earray.ea) { + /* Open the extensible array in file */ + if(H5D__earray_idx_open(idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") + } else /* Patch the top level file pointer contained in ea if needed */ + H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f); + + /* Set convenience pointer to extensible array structure */ + ea = idx_info->storage->u.earray.ea; + + if(!H5F_addr_defined(udata->chunk_block.offset)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "The chunk should have allocated already") + if(udata->chunk_idx != (udata->chunk_idx & 0xffffffff)) /* negative value */ + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk index must be less than 2^32") + + /* Check for filters on chunks */ + if(idx_info->pline->nused > 0) { + H5D_earray_filt_elmt_t elmt; /* Extensible array element */ + + elmt.addr = udata->chunk_block.offset; + H5_CHECKED_ASSIGN(elmt.nbytes, uint32_t, udata->chunk_block.length, hsize_t); + elmt.filter_mask = udata->filter_mask; + + /* Set the info for the chunk */ + if(H5EA_set(ea, idx_info->dxpl_id, udata->chunk_idx, &elmt) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk info") + } /* end if */ + else { + /* Set the address for the chunk */ + if(H5EA_set(ea, idx_info->dxpl_id, udata->chunk_idx, &udata->chunk_block.offset) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk address") + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__earray_idx_insert() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_idx_get_addr + * + * Purpose: Get the file address of a chunk if file space has been + * assigned. Save the retrieved information in the udata + * supplied. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, January 29, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__earray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) +{ + H5EA_t *ea; /* Pointer to extensible array structure */ + hsize_t idx; /* Array index of chunk */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(udata); + + /* Check if the extensible array is open yet */ + if(NULL == idx_info->storage->u.earray.ea) { + /* Open the extensible array in file */ + if(H5D__earray_idx_open(idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") + } else /* Patch the top level file pointer contained in ea if needed */ + H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f); + + /* Set convenience pointer to extensible array structure */ + ea = idx_info->storage->u.earray.ea; + + /* Check for unlimited dim. not being the slowest-changing dim. */ + if(idx_info->layout->u.earray.unlim_dim > 0) { + hsize_t swizzled_coords[H5O_LAYOUT_NDIMS]; /* swizzled chunk coordinates */ + unsigned ndims = (idx_info->layout->ndims - 1); /* Number of dimensions */ + unsigned u; + + /* Compute coordinate offset from scaled offset */ + for(u = 0; u < ndims; u++) + swizzled_coords[u] = udata->common.scaled[u] * idx_info->layout->dim[u]; + + H5VM_swizzle_coords(hsize_t, swizzled_coords, idx_info->layout->u.earray.unlim_dim); + + /* Calculate the index of this chunk */ + idx = H5VM_chunk_index(ndims, swizzled_coords, idx_info->layout->u.earray.swizzled_dim, idx_info->layout->u.earray.swizzled_down_chunks); + } /* end if */ + else { + /* Calculate the index of this chunk */ + idx = H5VM_array_offset_pre((idx_info->layout->ndims - 1), idx_info->layout->down_chunks, udata->common.scaled); + } /* end else */ + + udata->chunk_idx = idx; + + /* Check for filters on chunks */ + if(idx_info->pline->nused > 0) { + H5D_earray_filt_elmt_t elmt; /* Extensible array element */ + + /* Get the information for the chunk */ + if(H5EA_get(ea, idx_info->dxpl_id, idx, &elmt) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info") + + /* Set the info for the chunk */ + udata->chunk_block.offset = elmt.addr; + udata->chunk_block.length = elmt.nbytes; + udata->filter_mask = elmt.filter_mask; + } /* end if */ + else { + /* Get the address for the chunk */ + if(H5EA_get(ea, idx_info->dxpl_id, idx, &udata->chunk_block.offset) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address") + + /* Update the other (constant) information for the chunk */ + udata->chunk_block.length = idx_info->layout->size; + udata->filter_mask = 0; + } /* end else */ + + if(!H5F_addr_defined(udata->chunk_block.offset)) + udata->chunk_block.length = 0; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__earray_idx_get_addr() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_idx_resize + * + * Purpose: Calculate/setup the swizzled down chunk array, used for chunk + * index calculations. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, July 23, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__earray_idx_resize(H5O_layout_chunk_t *layout) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check args */ + HDassert(layout); + + /* "Swizzle" constant dimensions for this dataset */ + if(layout->u.earray.unlim_dim > 0) { + hsize_t swizzled_chunks[H5O_LAYOUT_NDIMS]; /* Swizzled form of # of chunks in each dimension */ + + /* Get the swizzled chunk dimensions */ + HDmemcpy(layout->u.earray.swizzled_dim, layout->dim, (layout->ndims - 1) * sizeof(layout->dim[0])); + H5VM_swizzle_coords(uint32_t, layout->u.earray.swizzled_dim, layout->u.earray.unlim_dim); + + /* Get the swizzled number of chunks in each dimension */ + HDmemcpy(swizzled_chunks, layout->chunks, (layout->ndims - 1) * sizeof(swizzled_chunks[0])); + H5VM_swizzle_coords(hsize_t, swizzled_chunks, layout->u.earray.unlim_dim); + + /* Get the swizzled "down" sizes for each dimension */ + if(H5VM_array_down((layout->ndims - 1), swizzled_chunks, layout->u.earray.swizzled_down_chunks) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute swizzled 'down' chunk size value") + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__earray_idx_resize() */ + +/*------------------------------------------------------------------------- + * Function: H5D__earray_idx_iterate_cb + * + * Purpose: Callback routine for extensible array element iteration. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi; Feb 2015 + * + *------------------------------------------------------------------------- + */ +static int +H5D__earray_idx_iterate_cb(hsize_t H5_ATTR_UNUSED idx, const void *_elmt, void *_udata) +{ + H5D_earray_it_ud_t *udata = (H5D_earray_it_ud_t *)_udata; /* User data */ + unsigned ndims; /* Rank of chunk */ + int curr_dim; /* Current dimension */ + int ret_value = H5_ITER_CONT; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Compose generic chunk record for callback */ + if(udata->filtered) { + const H5D_earray_filt_elmt_t *filt_elmt = (const H5D_earray_filt_elmt_t *)_elmt; + + udata->chunk_rec.chunk_addr = filt_elmt->addr; + udata->chunk_rec.nbytes = filt_elmt->nbytes; + udata->chunk_rec.filter_mask = filt_elmt->filter_mask; + } /* end if */ + else + udata->chunk_rec.chunk_addr = *(const haddr_t *)_elmt; + + /* Make "generic chunk" callback */ + if(H5F_addr_defined(udata->chunk_rec.chunk_addr)) + if((ret_value = (udata->cb)(&udata->chunk_rec, udata->udata)) < 0) + HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback"); + + /* Update coordinates of chunk in dataset */ + ndims = udata->common.layout->ndims - 1; + HDassert(ndims > 0); + curr_dim = (int)(ndims - 1); + while(curr_dim >= 0) { + /* Increment coordinate in current dimension */ + udata->chunk_rec.scaled[curr_dim]++; + + /* Check if we went off the end of the current dimension */ + if(udata->chunk_rec.scaled[curr_dim] >= udata->common.layout->chunks[curr_dim]) { + /* Reset coordinate & move to next faster dimension */ + udata->chunk_rec.scaled[curr_dim] = 0; + curr_dim--; + } /* end if */ + else + break; + } /* end while */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__earray_idx_iterate_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_idx_iterate + * + * Purpose: Iterate over the chunks in an index, making a callback + * for each one. + * + * Note: This implementation is slow, particularly for sparse + * extensible arrays, replace it with call to H5EA_iterate() + * when that's available. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, January 29, 2009 + * + *------------------------------------------------------------------------- + */ +static int +H5D__earray_idx_iterate(const H5D_chk_idx_info_t *idx_info, + H5D_chunk_cb_func_t chunk_cb, void *chunk_udata) +{ + H5EA_t *ea; /* Pointer to extensible array structure */ + H5EA_stat_t ea_stat; /* Extensible array statistics */ + int ret_value = H5_ITER_CONT; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(chunk_cb); + HDassert(chunk_udata); + + /* Check if the extensible array is open yet */ + if(NULL == idx_info->storage->u.earray.ea) { + /* Open the extensible array in file */ + if(H5D__earray_idx_open(idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") + } else /* Patch the top level file pointer contained in ea if needed */ + H5EA_patch_file(idx_info->storage->u.earray.ea, idx_info->f); + + /* Set convenience pointer to extensible array structure */ + ea = idx_info->storage->u.earray.ea; + + /* Get the extensible array statistics */ + if(H5EA_get_stats(ea, &ea_stat) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query extensible array statistics") + + if(ea_stat.stored.max_idx_set > 0) { + H5D_earray_it_ud_t udata; /* User data for iteration callback */ + + /* Initialize userdata */ + HDmemset(&udata, 0, sizeof udata); + udata.common.layout = idx_info->layout; + udata.common.storage = idx_info->storage; + HDmemset(&udata.chunk_rec, 0, sizeof(udata.chunk_rec)); + udata.filtered = (idx_info->pline->nused > 0); + if(!udata.filtered) { + udata.chunk_rec.nbytes = idx_info->layout->size; + udata.chunk_rec.filter_mask = 0; + } /* end if */ + udata.cb = chunk_cb; + udata.udata = chunk_udata; + + /* Iterate over the extensible array elements */ + if((ret_value = H5EA_iterate(ea, idx_info->dxpl_id, H5D__earray_idx_iterate_cb, &udata)) < 0) + HERROR(H5E_DATASET, H5E_BADITER, "unable to iterate over fixed array chunk index"); + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__earray_idx_iterate() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_idx_remove + * + * Purpose: Remove chunk from index. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, January 29, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__earray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata) +{ + H5EA_t *ea; /* Pointer to extensible array structure */ + hsize_t idx; /* Array index of chunk */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(udata); + + /* Check if the extensible array is open yet */ + if(NULL == idx_info->storage->u.earray.ea) + /* Open the extensible array in file */ + if(H5D__earray_idx_open(idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") + + /* Set convenience pointer to extensible array structure */ + ea = idx_info->storage->u.earray.ea; + + /* Check for unlimited dim. not being the slowest-changing dim. */ + if(idx_info->layout->u.earray.unlim_dim > 0) { + hsize_t swizzled_coords[H5O_LAYOUT_NDIMS]; /* swizzled chunk coordinates */ + unsigned ndims = (idx_info->layout->ndims - 1); /* Number of dimensions */ + unsigned u; + + /* Compute coordinate offset from scaled offset */ + for(u = 0; u < ndims; u++) + swizzled_coords[u] = udata->scaled[u] * idx_info->layout->dim[u]; + + H5VM_swizzle_coords(hsize_t, swizzled_coords, idx_info->layout->u.earray.unlim_dim); + + /* Calculate the index of this chunk */ + idx = H5VM_chunk_index(ndims, swizzled_coords, idx_info->layout->u.earray.swizzled_dim, idx_info->layout->u.earray.swizzled_down_chunks); + } /* end if */ + else { + /* Calculate the index of this chunk */ + idx = H5VM_array_offset_pre((idx_info->layout->ndims - 1), idx_info->layout->down_chunks, udata->scaled); + } /* end else */ + + /* Check for filters on chunks */ + if(idx_info->pline->nused > 0) { + H5D_earray_filt_elmt_t elmt; /* Extensible array element */ + + /* Get the info about the chunk for the index */ + if(H5EA_get(ea, idx_info->dxpl_id, idx, &elmt) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info") + + /* Remove raw data chunk from file */ + HDassert(H5F_addr_defined(elmt.addr)); + H5_CHECK_OVERFLOW(elmt.nbytes, /*From: */uint32_t, /*To: */hsize_t); + if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, elmt.addr, (hsize_t)elmt.nbytes) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk") + + /* Reset the info about the chunk for the index */ + elmt.addr = HADDR_UNDEF; + elmt.nbytes = 0; + elmt.filter_mask = 0; + if(H5EA_set(ea, idx_info->dxpl_id, idx, &elmt) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to reset chunk info") + } /* end if */ + else { + haddr_t addr = HADDR_UNDEF; /* Chunk address */ + + /* Get the address of the chunk for the index */ + if(H5EA_get(ea, idx_info->dxpl_id, idx, &addr) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address") + + /* Remove raw data chunk from file */ + HDassert(H5F_addr_defined(addr)); + H5_CHECK_OVERFLOW(idx_info->layout->size, /*From: */uint32_t, /*To: */hsize_t); + if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, addr, (hsize_t)idx_info->layout->size) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk") + + /* Reset the address of the chunk for the index */ + addr = HADDR_UNDEF; + if(H5EA_set(ea, idx_info->dxpl_id, idx, &addr) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to reset chunk address") + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__earray_idx_remove() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_idx_delete_cb + * + * Purpose: Delete space for chunk in file + * + * Return: Success: Non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Saturday, January 31, 2009 + * + *------------------------------------------------------------------------- + */ +static int +H5D__earray_idx_delete_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) +{ + H5D_earray_ud_t *udata = (H5D_earray_ud_t *)_udata; /* User data for callback */ + int ret_value = H5_ITER_CONT; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(chunk_rec); + HDassert(H5F_addr_defined(chunk_rec->chunk_addr)); + HDassert(chunk_rec->nbytes > 0); + HDassert(udata); + HDassert(udata->f); + + /* Remove raw data chunk from file */ + H5_CHECK_OVERFLOW(chunk_rec->nbytes, /*From: */uint32_t, /*To: */hsize_t); + if(H5MF_xfree(udata->f, H5FD_MEM_DRAW, udata->dxpl_id, chunk_rec->chunk_addr, (hsize_t)chunk_rec->nbytes) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, H5_ITER_ERROR, "unable to free chunk") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__earray_idx_delete_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_idx_delete + * + * Purpose: Delete index and raw data storage for entire dataset + * (i.e. all chunks) + * + * Note: This implementation is slow, particularly for sparse + * extensible arrays, replace it with call to H5EA_iterate() + * when that's available. + * + * Return: Success: Non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Thursday, January 29, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__earray_idx_delete(const H5D_chk_idx_info_t *idx_info) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(idx_info->storage); + + /* Check if the index data structure has been allocated */ + if(H5F_addr_defined(idx_info->storage->idx_addr)) { + H5D_earray_ud_t udata; /* User data for callback */ + H5D_earray_ctx_ud_t ctx_udata; /* User data for extensible array open call */ + + /* Initialize user data for callback */ + udata.f = idx_info->f; + udata.dxpl_id = idx_info->dxpl_id; + + /* Iterate over the chunk addresses in the extensible array, deleting each chunk */ + if(H5D__earray_idx_iterate(idx_info, H5D__earray_idx_delete_cb, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk addresses") + + /* Close extensible array */ + if(H5EA_close(idx_info->storage->u.earray.ea, idx_info->dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array") + idx_info->storage->u.earray.ea = NULL; + + /* Set up the context user data */ + ctx_udata.f = idx_info->f; + ctx_udata.chunk_size = idx_info->layout->size; + + /* Delete extensible array */ + if(H5EA_delete(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, &ctx_udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk extensible array") + idx_info->storage->idx_addr = HADDR_UNDEF; + } /* end if */ + else + HDassert(NULL == idx_info->storage->u.earray.ea); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__earray_idx_delete() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_idx_copy_setup + * + * Purpose: Set up any necessary information for copying chunks + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Saturday, January 31, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__earray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, + const H5D_chk_idx_info_t *idx_info_dst) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check args */ + HDassert(idx_info_src); + HDassert(idx_info_src->f); + HDassert(idx_info_src->pline); + HDassert(idx_info_src->layout); + HDassert(idx_info_src->storage); + HDassert(idx_info_dst); + HDassert(idx_info_dst->f); + HDassert(idx_info_dst->pline); + HDassert(idx_info_dst->layout); + HDassert(idx_info_dst->storage); + HDassert(!H5F_addr_defined(idx_info_dst->storage->idx_addr)); + + /* Check if the source extensible array is open yet */ + if(NULL == idx_info_src->storage->u.earray.ea) + /* Open the extensible array in file */ + if(H5D__earray_idx_open(idx_info_src) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") + + /* Set copied metadata tag */ + H5_BEGIN_TAG(idx_info_dst->dxpl_id, H5AC__COPIED_TAG, FAIL); + + /* Create the extensible array that describes chunked storage in the dest. file */ + if(H5D__earray_idx_create(idx_info_dst) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage") + HDassert(H5F_addr_defined(idx_info_dst->storage->idx_addr)); + + /* Reset metadata tag */ + H5_END_TAG(FAIL); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__earray_idx_copy_setup() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_idx_copy_shutdown + * + * Purpose: Shutdown any information from copying chunks + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Saturday, January 31, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__earray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, + H5O_storage_chunk_t *storage_dst, hid_t dxpl_id) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check args */ + HDassert(storage_src); + HDassert(storage_src->u.earray.ea); + HDassert(storage_dst); + HDassert(storage_dst->u.earray.ea); + + /* Close extensible arrays */ + if(H5EA_close(storage_src->u.earray.ea, dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array") + storage_src->u.earray.ea = NULL; + if(H5EA_close(storage_dst->u.earray.ea, dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array") + storage_dst->u.earray.ea = NULL; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__earray_idx_copy_shutdown() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_idx_size + * + * Purpose: Retrieve the amount of index storage for chunked dataset + * + * Return: Success: Non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Saturday, January 31, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__earray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) +{ + H5EA_t *ea; /* Pointer to extensible array structure */ + H5EA_stat_t ea_stat; /* Extensible array statistics */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check args */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(index_size); + + /* Open the extensible array in file */ + if(H5D__earray_idx_open(idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open extensible array") + + /* Set convenience pointer to extensible array structure */ + ea = idx_info->storage->u.earray.ea; + + /* Get the extensible array statistics */ + if(H5EA_get_stats(ea, &ea_stat) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query extensible array statistics") + + /* Set the size of the extensible array */ + *index_size = ea_stat.computed.hdr_size + ea_stat.computed.index_blk_size + + ea_stat.stored.super_blk_size + ea_stat.stored.data_blk_size; + +done: + if(idx_info->storage->u.earray.ea) { + if(H5EA_close(idx_info->storage->u.earray.ea, idx_info->dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array") + idx_info->storage->u.earray.ea = NULL; + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__earray_idx_size() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_idx_reset + * + * Purpose: Reset indexing information. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Saturday, January 31, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__earray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) +{ + FUNC_ENTER_STATIC_NOERR + + /* Check args */ + HDassert(storage); + + /* Reset index info */ + if(reset_addr) { + storage->idx_addr = HADDR_UNDEF; + storage->u.earray.dset_ohdr_addr = HADDR_UNDEF; + } /* end if */ + storage->u.earray.ea = NULL; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__earray_idx_reset() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_idx_dump + * + * Purpose: Dump indexing information to a stream. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Saturday, January 31, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__earray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) +{ + FUNC_ENTER_STATIC_NOERR + + /* Check args */ + HDassert(storage); + HDassert(stream); + + HDfprintf(stream, " Address: %a\n", storage->idx_addr); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__earray_idx_dump() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__earray_idx_dest + * + * Purpose: Release indexing information in memory. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Saturday, January 31, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__earray_idx_dest(const H5D_chk_idx_info_t *idx_info) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check args */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->storage); + + /* Check if the extensible array is open */ + if(idx_info->storage->u.earray.ea) { + /* Close extensible array */ + if(H5EA_close(idx_info->storage->u.earray.ea, idx_info->dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close extensible array") + idx_info->storage->u.earray.ea = NULL; + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__earray_idx_dest() */ + diff --git a/src/H5Dint.c b/src/H5Dint.c index 6c1f24a..0355656 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1222,6 +1222,11 @@ H5D__create(H5F_t *file, hid_t type_id, const H5S_t *space, hid_t dcpl_id, if(H5D__layout_set_latest_version(&new_dset->shared->layout, new_dset->shared->space, &new_dset->shared->dcpl_cache) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest version of layout") } /* end if */ + else if(new_dset->shared->layout.version >= H5O_LAYOUT_VERSION_4) { + /* Use latest indexing type for layout message version >= 4 */ + if(H5D__layout_set_latest_indexing(&new_dset->shared->layout, new_dset->shared->space, &new_dset->shared->dcpl_cache) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, NULL, "can't set latest indexing") + } /* end if */ /* Check if this dataset is going into a parallel file and set space allocation time */ if(H5F_HAS_FEATURE(file, H5FD_FEAT_ALLOCATE_EARLY)) diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index 7801632..c213140 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -96,8 +96,24 @@ H5D__layout_set_io_ops(const H5D_t *dataset) dataset->shared->layout.ops = H5D_LOPS_CHUNK; /* Set the chunk operations */ - /* (Only "B-tree" indexing type currently supported) */ - dataset->shared->layout.storage.u.chunk.ops = H5D_COPS_BTREE; + switch(dataset->shared->layout.u.chunk.idx_type) { + case H5D_CHUNK_IDX_BTREE: + dataset->shared->layout.storage.u.chunk.ops = H5D_COPS_BTREE; + break; + + case H5D_CHUNK_IDX_EARRAY: + dataset->shared->layout.storage.u.chunk.ops = H5D_COPS_EARRAY; + break; + + case H5D_CHUNK_IDX_BT2: + dataset->shared->layout.storage.u.chunk.ops = H5D_COPS_BT2; + break; + + case H5D_CHUNK_IDX_NTYPES: + default: + HDassert(0 && "Unknown chunk index method!"); + HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unknown chunk index method") + } /* end switch */ break; case H5D_COMPACT: @@ -190,8 +206,30 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ /* Dimension sizes */ ret_value += layout->u.chunk.ndims * layout->u.chunk.enc_bytes_per_dim; - /* B-tree address */ - ret_value += H5F_SIZEOF_ADDR(f); /* Address of data */ + /* Type of chunk index */ + ret_value++; + + switch(layout->u.chunk.idx_type) { + case H5D_CHUNK_IDX_BTREE: + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, 0, "v1 B-tree index type found for layout message >v3") + + case H5D_CHUNK_IDX_EARRAY: + /* Extensible array creation parameters */ + ret_value += H5D_EARRAY_CREATE_PARAM_SIZE; + break; + + case H5D_CHUNK_IDX_BT2: + /* v2 B-tree creation parameters */ + ret_value += H5D_BT2_CREATE_PARAM_SIZE; + break; + + case H5D_CHUNK_IDX_NTYPES: + default: + HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, 0, "Invalid chunk index type") + } /* end switch */ + + /* Chunk index address */ + ret_value += H5F_SIZEOF_ADDR(f); } /* end else */ break; @@ -241,12 +279,106 @@ H5D__layout_set_latest_version(H5O_layout_t *layout, const H5S_t *space, /* Set encoding of layout to latest version */ layout->version = H5O_LAYOUT_VERSION_LATEST; + /* Set the latest indexing type for the layout message */ + if(H5D__layout_set_latest_indexing(layout, space, dcpl_cache) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set latest indexing type") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5D__layout_set_latest_version() */ /*------------------------------------------------------------------------- + * Function: H5D__layout_set_latest_indexing + * + * Purpose: Set the latest indexing type for a layout message + * This is moved from H5D_layout_set_latest_version(). + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Thursday, January 15, 2009 + * + *------------------------------------------------------------------------- + */ +herr_t +H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space, + const H5D_dcpl_cache_t *dcpl_cache) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity check */ + HDassert(layout); + HDassert(space); + HDassert(dcpl_cache); + + /* The indexing methods only apply to chunked datasets (currently) */ + if(layout->type == H5D_CHUNKED) { + int sndims; /* Rank of dataspace */ + unsigned ndims; /* Rank of dataspace */ + + /* Query the dimensionality of the dataspace */ + if((sndims = H5S_GET_EXTENT_NDIMS(space)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "invalid dataspace rank") + ndims = (unsigned)sndims; + + /* Avoid scalar/null dataspace */ + if(ndims > 0) { + hsize_t max_dims[H5O_LAYOUT_NDIMS]; /* Maximum dimension sizes */ + hsize_t cur_dims[H5O_LAYOUT_NDIMS]; /* Current dimension sizes */ + unsigned unlim_count = 0; /* Count of unlimited max. dimensions */ + unsigned u; /* Local index variable */ + + /* Query the dataspace's dimensions */ + if(H5S_get_simple_extent_dims(space, cur_dims, max_dims) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace max. dimensions") + + /* Spin through the max. dimensions, looking for unlimited dimensions */ + for(u = 0; u < ndims; u++) + if(max_dims[u] == H5S_UNLIMITED) + unlim_count++; + + if(1 == unlim_count) { /* Chunked dataset with only 1 unlimited dimension */ + /* Set the chunk index type to an extensible array */ + layout->u.chunk.idx_type = H5D_CHUNK_IDX_EARRAY; + layout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_EARRAY; + layout->storage.u.chunk.ops = H5D_COPS_EARRAY; + + /* Set the extensible array creation parameters */ + /* (use hard-coded defaults for now, until we give applications + * control over this with a property list - QAK) + */ + layout->u.chunk.u.earray.cparam.max_nelmts_bits = H5D_EARRAY_MAX_NELMTS_BITS; + layout->u.chunk.u.earray.cparam.idx_blk_elmts = H5D_EARRAY_IDX_BLK_ELMTS; + layout->u.chunk.u.earray.cparam.sup_blk_min_data_ptrs = H5D_EARRAY_SUP_BLK_MIN_DATA_PTRS; + layout->u.chunk.u.earray.cparam.data_blk_min_elmts = H5D_EARRAY_DATA_BLK_MIN_ELMTS; + layout->u.chunk.u.earray.cparam.max_dblk_page_nelmts_bits = H5D_EARRAY_MAX_DBLOCK_PAGE_NELMTS_BITS; + } /* end if */ + else { + /* Set the chunk index type to v2 B-tree */ + layout->u.chunk.idx_type = H5D_CHUNK_IDX_BT2; + layout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_BT2; + layout->storage.u.chunk.ops = H5D_COPS_BT2; + + /* Set the v2 B-tree creation parameters */ + /* (use hard-coded defaults for now, until we give applications + * control over this with a property list - QAK) + */ + layout->u.chunk.u.btree2.cparam.node_size = H5D_BT2_NODE_SIZE; + layout->u.chunk.u.btree2.cparam.split_percent = H5D_BT2_SPLIT_PERC; + layout->u.chunk.u.btree2.cparam.merge_percent = H5D_BT2_MERGE_PERC; + } /* end else */ + } /* end if */ + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__layout_set_latest_indexing() */ + + +/*------------------------------------------------------------------------- * Function: H5D__layout_oh_create * * Purpose: Create layout/pline/efl information for dataset diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index 8fc5cac..bfd0601 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -33,6 +33,7 @@ /* Other private headers needed by this file */ #include "H5ACprivate.h" /* Metadata cache */ +#include "H5B2private.h" /* v2 B-trees */ #include "H5Fprivate.h" /* File access */ #include "H5Gprivate.h" /* Groups */ #include "H5SLprivate.h" /* Skip lists */ @@ -67,6 +68,23 @@ #define H5D_MARK_SPACE 0x01 #define H5D_MARK_LAYOUT 0x02 +/* Default creation parameters for chunk index data structures */ +/* See H5O_layout_chunk_t */ + +/* Extensible array creation values */ +#define H5D_EARRAY_CREATE_PARAM_SIZE 5 /* Size of the creation parameters in bytes */ +#define H5D_EARRAY_MAX_NELMTS_BITS 32 /* i.e. 4 giga-elements */ +#define H5D_EARRAY_IDX_BLK_ELMTS 4 +#define H5D_EARRAY_SUP_BLK_MIN_DATA_PTRS 4 +#define H5D_EARRAY_DATA_BLK_MIN_ELMTS 16 +#define H5D_EARRAY_MAX_DBLOCK_PAGE_NELMTS_BITS 10 /* i.e. 1024 elements per data block page */ + +/* v2 B-tree creation values for raw meta_size */ +#define H5D_BT2_CREATE_PARAM_SIZE 6 /* Size of the creation parameters in bytes */ +#define H5D_BT2_NODE_SIZE 2048 +#define H5D_BT2_SPLIT_PERC 100 +#define H5D_BT2_MERGE_PERC 40 + /****************************/ /* Package Private Typedefs */ @@ -519,6 +537,12 @@ H5_DLLVAR const H5D_layout_ops_t H5D_LOPS_VIRTUAL[1]; /* Chunked layout operations */ H5_DLLVAR const H5D_chunk_ops_t H5D_COPS_BTREE[1]; +H5_DLLVAR const H5D_chunk_ops_t H5D_COPS_EARRAY[1]; +H5_DLLVAR const H5D_chunk_ops_t H5D_COPS_BT2[1]; + +/* The v2 B-tree class for indexing chunked datasets with >1 unlimited dimensions */ +H5_DLLVAR const H5B2_class_t H5D_BT2[1]; +H5_DLLVAR const H5B2_class_t H5D_BT2_FILT[1]; /******************************/ @@ -584,6 +608,8 @@ H5_DLL size_t H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t include_compact_data); H5_DLL herr_t H5D__layout_set_latest_version(H5O_layout_t *layout, const H5S_t *space, const H5D_dcpl_cache_t *dcpl_cache); +H5_DLL herr_t H5D__layout_set_latest_indexing(H5O_layout_t *layout, + const H5S_t *space, const H5D_dcpl_cache_t *dcpl_cache); H5_DLL herr_t H5D__layout_oh_create(H5F_t *file, hid_t dxpl_id, H5O_t *oh, H5D_t *dset, hid_t dapl_id); H5_DLL herr_t H5D__layout_oh_read(H5D_t *dset, hid_t dxpl_id, hid_t dapl_id, @@ -721,6 +747,7 @@ H5_DLL htri_t H5D__mpio_opt_possible(const H5D_io_info_t *io_info, #ifdef H5D_TESTING H5_DLL herr_t H5D__layout_version_test(hid_t did, unsigned *version); H5_DLL herr_t H5D__layout_contig_size_test(hid_t did, hsize_t *size); +H5_DLL herr_t H5D__layout_idx_type_test(hid_t did, H5D_chunk_index_t *idx_type); H5_DLL herr_t H5D__current_cache_size_test(hid_t did, size_t *nbytes_used, int *nused); #endif /* H5D_TESTING */ diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index 39e6aa7..a7bd981 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -61,7 +61,9 @@ typedef enum H5D_layout_t { /* Types of chunk index data structures */ typedef enum H5D_chunk_index_t { H5D_CHUNK_IDX_BTREE = 0, /* v1 B-tree index */ - H5D_CHUNK_IDX_NTYPES /* this one must be last! */ + H5D_CHUNK_IDX_EARRAY = 4, /* Extensible array (for 1 unlimited dim) */ + H5D_CHUNK_IDX_BT2 = 5, /* v2 B-tree index (for >1 unlimited dims) */ + H5D_CHUNK_IDX_NTYPES /*this one must be last! */ } H5D_chunk_index_t; /* Values for the space allocation time property */ diff --git a/src/H5Dtest.c b/src/H5Dtest.c index fd8ff71..c3b0b19 100644 --- a/src/H5Dtest.c +++ b/src/H5Dtest.c @@ -144,6 +144,47 @@ done: /*-------------------------------------------------------------------------- NAME + H5D__layout_idx_type_test + PURPOSE + Determine the storage layout index type for a dataset's layout information + USAGE + herr_t H5D__layout_idx_type_test(did, idx_type) + hid_t did; IN: Dataset to query + H5D_chunk_index_t *idx_type; OUT: Pointer to location to place index type info + RETURNS + Non-negative on success, negative on failure + DESCRIPTION + Checks the index type of the storage layout information for a dataset. + GLOBAL VARIABLES + COMMENTS, BUGS, ASSUMPTIONS + DO NOT USE THIS FUNCTION FOR ANYTHING EXCEPT TESTING + EXAMPLES + REVISION LOG +--------------------------------------------------------------------------*/ +herr_t +H5D__layout_idx_type_test(hid_t did, H5D_chunk_index_t *idx_type) +{ + H5D_t *dset; /* Pointer to dataset to query */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_PACKAGE + + /* Check args */ + if(NULL == (dset = (H5D_t *)H5I_object_verify(did, H5I_DATASET))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset") + if(dset->shared->layout.type != H5D_CHUNKED) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dataset is not chunked") + + if(idx_type) + *idx_type = dset->shared->layout.u.chunk.idx_type; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__layout_idx_type_test() */ + + +/*-------------------------------------------------------------------------- + NAME H5D__current_cache_size_test PURPOSE Determine current the size of the dataset's chunk cache diff --git a/src/H5EA.c b/src/H5EA.c index 34173e4..756eb93 100644 --- a/src/H5EA.c +++ b/src/H5EA.c @@ -88,6 +88,8 @@ hbool_t H5_PKG_INIT_VAR = FALSE; * client class.. */ const H5EA_class_t *const H5EA_client_class_g[] = { + H5EA_CLS_CHUNK, /* 0 - H5EA_CLS_CHUNK_ID */ + H5EA_CLS_FILT_CHUNK, /* 1 - H5EA_CLS_FILT_CHUNK_ID */ H5EA_CLS_TEST, /* ? - H5EA_CLS_TEST_ID */ }; @@ -104,6 +106,8 @@ const H5EA_class_t *const H5EA_client_class_g[] = { /* Declare a free list to manage the H5EA_t struct */ H5FL_DEFINE_STATIC(H5EA_t); +/* Declare a PQ free list to manage the element */ +H5FL_BLK_DEFINE(ea_native_elmt); /*------------------------------------------------------------------------- @@ -1032,3 +1036,87 @@ CATCH END_FUNC(PRIV) /* end H5EA_delete() */ + +/*------------------------------------------------------------------------- + * Function: H5EA_iterate + * + * Purpose: Iterate over the elements of an extensible array + * (copied and modified from FA_iterate() in H5FA.c) + * + * Return: SUCCEED/FAIL + * + * Programmer: Vailin Choi; Feb 2015 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PRIV, ERR, +herr_t, SUCCEED, FAIL, +H5EA_iterate(H5EA_t *ea, hid_t dxpl_id, H5EA_operator_t op, void *udata)) + + /* Local variables */ + uint8_t *elmt = NULL; + hsize_t u; + + /* + * Check arguments. + */ + HDassert(ea); + HDassert(op); + HDassert(udata); + + /* Allocate space for a native array element */ + if(NULL == (elmt = H5FL_BLK_MALLOC(ea_native_elmt, ea->hdr->cparam.cls->nat_elmt_size))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array element") + + /* Iterate over all elements in array */ + for(u = 0; u < ea->hdr->stats.stored.max_idx_set; u++) { + int cb_ret; /* Return value from callback */ + + /* Get array element */ + if(H5EA_get(ea, dxpl_id, u, elmt) < 0) + H5E_THROW(H5E_CANTGET, "unable to delete fixed array") + + /* Make callback */ + if((cb_ret = (*op)(u, elmt, udata)) < 0) { + H5E_PRINTF(H5E_BADITER, "iterator function failed"); + H5_LEAVE(cb_ret) + } /* end if */ + } /* end for */ + +CATCH + + if(elmt) + elmt = H5FL_BLK_FREE(ea_native_elmt, elmt); + +END_FUNC(PRIV) /* end H5EA_iterate() */ + + +/*------------------------------------------------------------------------- + * Function: H5EA_patch_file + * + * Purpose: Patch the top-level file pointer contained in ea + * to point to idx_info->f if they are different. + * This is possible because the file pointer in ea can be + * closed out if ea remains open. + * + * Return: SUCCEED + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PRIV, NOERR, +herr_t, SUCCEED, -, +H5EA_patch_file(H5EA_t *ea, H5F_t *f)) + + /* Local variables */ + + /* + * Check arguments. + */ + HDassert(ea); + HDassert(f); + + if(ea->f != f || ea->hdr->f != f) + ea->f = ea->hdr->f = f; + +END_FUNC(PRIV) /* end H5EA_patch_file() */ + diff --git a/src/H5EAprivate.h b/src/H5EAprivate.h index 9147f39..0a1b945 100644 --- a/src/H5EAprivate.h +++ b/src/H5EAprivate.h @@ -49,6 +49,9 @@ /* Extensible array class IDs */ typedef enum H5EA_cls_id_t { + H5EA_CLS_CHUNK_ID = 0, /* Extensible array is for indexing dataset chunks w/o filters */ + H5EA_CLS_FILT_CHUNK_ID, /* Extensible array is for indexing dataset chunks w/filters */ + /* Start real class IDs at 0 -QAK */ /* (keep these last) */ H5EA_CLS_TEST_ID, /* Extensible array is for testing (do not use for actual data) */ @@ -112,11 +115,20 @@ typedef struct H5EA_stat_t { /* Extensible array info (forward decl - defined in H5EApkg.h) */ typedef struct H5EA_t H5EA_t; +/* Define the operator callback function pointer for H5EA_iterate() */ +typedef int (*H5EA_operator_t)(hsize_t idx, const void *_elmt, void *_udata); + /*****************************/ /* Library-private Variables */ /*****************************/ +/* The Extensible Array class for dataset chunks w/o filters*/ +H5_DLLVAR const H5EA_class_t H5EA_CLS_CHUNK[1]; + +/* The Extensible Array class for dataset chunks w/ filters*/ +H5_DLLVAR const H5EA_class_t H5EA_CLS_FILT_CHUNK[1]; + /***************************************/ /* Library-private Function Prototypes */ @@ -131,8 +143,10 @@ H5_DLL herr_t H5EA_get_addr(const H5EA_t *ea, haddr_t *addr); H5_DLL herr_t H5EA_set(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, const void *elmt); H5_DLL herr_t H5EA_get(const H5EA_t *ea, hid_t dxpl_id, hsize_t idx, void *elmt); H5_DLL herr_t H5EA_depend(H5AC_info_t *parent_entry, H5EA_t *ea); +H5_DLL herr_t H5EA_iterate(H5EA_t *fa, hid_t dxpl_id, H5EA_operator_t op, void *udata); H5_DLL herr_t H5EA_close(H5EA_t *ea, hid_t dxpl_id); H5_DLL herr_t H5EA_delete(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr, void *ctx_udata); +H5_DLL herr_t H5EA_patch_file(H5EA_t *fa, H5F_t *f); /* Statistics routines */ H5_DLL herr_t H5EA_get_stats(const H5EA_t *ea, H5EA_stat_t *stats); diff --git a/src/H5Olayout.c b/src/H5Olayout.c index f2af8ef..c19bbfc 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -287,9 +287,52 @@ H5O__layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED for(u = 1, mesg->u.chunk.size = mesg->u.chunk.dim[0]; u < mesg->u.chunk.ndims; u++) mesg->u.chunk.size *= mesg->u.chunk.dim[u]; - /* Set the chunk operations */ - mesg->storage.u.chunk.idx_type = H5D_CHUNK_IDX_BTREE; - mesg->storage.u.chunk.ops = H5D_COPS_BTREE; + /* Chunk index type */ + mesg->u.chunk.idx_type = (H5D_chunk_index_t)*p++; + if(mesg->u.chunk.idx_type >= H5D_CHUNK_IDX_NTYPES) + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "unknown chunk index type") + mesg->storage.u.chunk.idx_type = mesg->u.chunk.idx_type; + + switch(mesg->u.chunk.idx_type) { + case H5D_CHUNK_IDX_BTREE: + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "v1 B-tree index type should never be in a v4 layout message") + break; + + case H5D_CHUNK_IDX_EARRAY: + /* Extensible array creation parameters */ + mesg->u.chunk.u.earray.cparam.max_nelmts_bits = *p++; + if(0 == mesg->u.chunk.u.earray.cparam.max_nelmts_bits) + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid extensible array creation parameter") + mesg->u.chunk.u.earray.cparam.idx_blk_elmts = *p++; + if(0 == mesg->u.chunk.u.earray.cparam.idx_blk_elmts) + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid extensible array creation parameter") + mesg->u.chunk.u.earray.cparam.sup_blk_min_data_ptrs = *p++; + if(0 == mesg->u.chunk.u.earray.cparam.sup_blk_min_data_ptrs) + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid extensible array creation parameter") + mesg->u.chunk.u.earray.cparam.data_blk_min_elmts = *p++; + if(0 == mesg->u.chunk.u.earray.cparam.data_blk_min_elmts) + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid extensible array creation parameter") + mesg->u.chunk.u.earray.cparam.max_dblk_page_nelmts_bits = *p++; + if(0 == mesg->u.chunk.u.earray.cparam.max_dblk_page_nelmts_bits) + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid extensible array creation parameter") + + /* Set the chunk operations */ + mesg->storage.u.chunk.ops = H5D_COPS_EARRAY; + break; + + case H5D_CHUNK_IDX_BT2: /* v2 B-tree index */ + UINT32DECODE(p, mesg->u.chunk.u.btree2.cparam.node_size); + mesg->u.chunk.u.btree2.cparam.split_percent = *p++; + mesg->u.chunk.u.btree2.cparam.merge_percent = *p++; + + /* Set the chunk operations */ + mesg->storage.u.chunk.ops = H5D_COPS_BT2; + break; + + case H5D_CHUNK_IDX_NTYPES: + default: + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "Invalid chunk index type") + } /* end switch */ /* Chunk index address */ H5F_addr_decode(f, &p, &(mesg->storage.u.chunk.idx_addr)); @@ -557,6 +600,34 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, for(u = 0; u < mesg->u.chunk.ndims; u++) UINT64ENCODE_VAR(p, mesg->u.chunk.dim[u], mesg->u.chunk.enc_bytes_per_dim); + /* Chunk index type */ + *p++ = (uint8_t)mesg->u.chunk.idx_type; + + switch(mesg->u.chunk.idx_type) { + case H5D_CHUNK_IDX_BTREE: + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "v1 B-tree index type should never be in a v4 layout message") + break; + + case H5D_CHUNK_IDX_EARRAY: + /* Extensible array creation parameters */ + *p++ = mesg->u.chunk.u.earray.cparam.max_nelmts_bits; + *p++ = mesg->u.chunk.u.earray.cparam.idx_blk_elmts; + *p++ = mesg->u.chunk.u.earray.cparam.sup_blk_min_data_ptrs; + *p++ = mesg->u.chunk.u.earray.cparam.data_blk_min_elmts; + *p++ = mesg->u.chunk.u.earray.cparam.max_dblk_page_nelmts_bits; + break; + + case H5D_CHUNK_IDX_BT2: /* v2 B-tree index */ + UINT32ENCODE(p, mesg->u.chunk.u.btree2.cparam.node_size); + *p++ = mesg->u.chunk.u.btree2.cparam.split_percent; + *p++ = mesg->u.chunk.u.btree2.cparam.merge_percent; + break; + + case H5D_CHUNK_IDX_NTYPES: + default: + HGOTO_ERROR(H5E_OHDR, H5E_CANTENCODE, FAIL, "Invalid chunk index type") + } /* end switch */ + /* * Implicit index: Address of the chunks * Single chunk index: address of the single chunk @@ -1082,20 +1153,32 @@ H5O__layout_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const v HDfprintf(stream, "}\n"); /* Index information */ - switch(mesg->storage.u.chunk.idx_type) { + switch(mesg->u.chunk.idx_type) { case H5D_CHUNK_IDX_BTREE: HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Index Type:", "v1 B-tree"); - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, - "B-tree address:", mesg->storage.u.chunk.idx_addr); + break; + + case H5D_CHUNK_IDX_EARRAY: + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Index Type:", "Extensible Array"); + /* (Should print the extensible array creation parameters) */ + break; + + case H5D_CHUNK_IDX_BT2: + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Index Type:", "v2 B-tree"); + /* (Should print the v2-Btree creation parameters) */ break; case H5D_CHUNK_IDX_NTYPES: default: HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth, - "Index Type:", "Unknown", (unsigned)mesg->storage.u.chunk.idx_type); + "Index Type:", "Unknown", (unsigned)mesg->u.chunk.idx_type); break; } /* end switch */ + HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, + "Index address:", mesg->storage.u.chunk.idx_addr); break; case H5D_CONTIGUOUS: diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index 8175bd8..a5f07b2 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -416,12 +416,30 @@ typedef struct H5O_storage_chunk_btree_t { H5UC_t *shared; /* Ref-counted shared info for B-tree nodes */ } H5O_storage_chunk_btree_t; +/* Forward declaration of structs used below */ +struct H5EA_t; /* Defined in H5EAprivate.h */ + +typedef struct H5O_storage_chunk_earray_t { + haddr_t dset_ohdr_addr; /* File address dataset's object header */ + struct H5EA_t *ea; /* Pointer to extensible index array struct */ +} H5O_storage_chunk_earray_t; + +/* Forward declaration of structs used below */ +struct H5B2_t; /* Defined in H5B2pkg.h */ + +typedef struct H5O_storage_chunk_bt2_t { + haddr_t dset_ohdr_addr; /* File address dataset's object header */ + struct H5B2_t *bt2; /* Pointer to b-tree 2 struct */ +} H5O_storage_chunk_bt2_t; + typedef struct H5O_storage_chunk_t { H5D_chunk_index_t idx_type; /* Type of chunk index */ haddr_t idx_addr; /* File address of chunk index */ const struct H5D_chunk_ops_t *ops; /* Pointer to chunked storage operations */ union { H5O_storage_chunk_btree_t btree; /* Information for v1 B-tree index */ + H5O_storage_chunk_bt2_t btree2; /* Information for v2 B-tree index */ + H5O_storage_chunk_earray_t earray; /* Information for extensible array index */ } u; } H5O_storage_chunk_t; @@ -516,7 +534,32 @@ typedef struct H5O_storage_t { } u; } H5O_storage_t; +typedef struct H5O_layout_chunk_earray_t { + /* Creation parameters for extensible array data structure */ + struct { + uint8_t max_nelmts_bits; /* Log2(Max. # of elements in array) - i.e. # of bits needed to store max. # of elements */ + uint8_t idx_blk_elmts; /* # of elements to store in index block */ + uint8_t data_blk_min_elmts; /* Min. # of elements per data block */ + uint8_t sup_blk_min_data_ptrs; /* Min. # of data block pointers for a super block */ + uint8_t max_dblk_page_nelmts_bits; /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of elements in data block page */ + } cparam; + + unsigned unlim_dim; /* Rank of unlimited dimension for dataset */ + uint32_t swizzled_dim[H5O_LAYOUT_NDIMS]; /* swizzled chunk dimensions */ + hsize_t swizzled_down_chunks[H5O_LAYOUT_NDIMS]; /* swizzled "down" size of number of chunks in each dimension */ +} H5O_layout_chunk_earray_t; + +typedef struct H5O_layout_chunk_bt2_t { + /* Creation parameters for v2 B-tree data structure */ + struct { + uint32_t node_size; /* Size of each node (in bytes) */ + uint8_t split_percent; /* % full to split nodes */ + uint8_t merge_percent; /* % full to merge nodes */ + } cparam; +} H5O_layout_chunk_bt2_t; + typedef struct H5O_layout_chunk_t { + H5D_chunk_index_t idx_type; /* Type of chunk index */ uint8_t flags; /* Chunk layout flags */ unsigned ndims; /* Num dimensions in chunk */ uint32_t dim[H5O_LAYOUT_NDIMS]; /* Size of chunk in elements */ @@ -528,6 +571,10 @@ typedef struct H5O_layout_chunk_t { hsize_t max_chunks[H5O_LAYOUT_NDIMS]; /* # of chunks in each dataset's max. dimension */ hsize_t down_chunks[H5O_LAYOUT_NDIMS]; /* "down" size of number of chunks in each dimension */ hsize_t max_down_chunks[H5O_LAYOUT_NDIMS]; /* "down" size of number of chunks in each max dim */ + union { + H5O_layout_chunk_earray_t earray; /* Information for extensible array index */ + H5O_layout_chunk_bt2_t btree2; /* Information for v2 B-tree index */ + } u; } H5O_layout_chunk_t; typedef struct H5O_layout_t { diff --git a/src/H5VMprivate.h b/src/H5VMprivate.h index 7d3361b..f402b36 100644 --- a/src/H5VMprivate.h +++ b/src/H5VMprivate.h @@ -49,6 +49,22 @@ typedef herr_t (*H5VM_opvv_func_t)(hsize_t dst_off, hsize_t src_off, #define H5VM_vector_zero(N,DST) HDmemset(DST,0,(N)*sizeof(*(DST))) +/* Given a coordinate offset array (COORDS) of type TYPE, move the unlimited + * dimension (UNLIM_DIM) value to offset 0, sliding any intermediate values down + * one position. */ +#define H5VM_swizzle_coords(TYPE,COORDS,UNLIM_DIM) { \ + /* COORDS must be an array of type TYPE */ \ + HDassert(sizeof(COORDS[0]) == sizeof(TYPE)); \ + \ + /* Nothing to do when unlimited dimension is at position 0 */ \ + if(0 != (UNLIM_DIM)) { \ + TYPE _tmp = (COORDS)[UNLIM_DIM]; \ + \ + HDmemmove(&(COORDS)[1], &(COORDS)[0], sizeof(TYPE) * (UNLIM_DIM)); \ + (COORDS)[0] = _tmp; \ + } /* end if */ \ +} + /* A null pointer is equivalent to a zero vector */ #define H5VM_ZERO NULL diff --git a/src/Makefile.am b/src/Makefile.am index 9f748bf..ca9c4c3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -47,8 +47,8 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5B2.c H5B2cache.c H5B2dbg.c H5B2hdr.c H5B2int.c H5B2stat.c H5B2test.c \ H5C.c \ H5CS.c \ - H5D.c H5Dbtree.c H5Dchunk.c H5Dcompact.c H5Dcontig.c H5Ddbg.c \ - H5Ddeprec.c H5Defl.c H5Dfill.c H5Dint.c \ + H5D.c H5Dbtree.c H5Dbtree2.c H5Dchunk.c H5Dcompact.c H5Dcontig.c H5Ddbg.c \ + H5Ddeprec.c H5Dearray.c H5Defl.c H5Dfill.c H5Dint.c \ H5Dio.c H5Dlayout.c \ H5Doh.c H5Dscatgath.c H5Dselect.c H5Dtest.c H5Dvirtual.c \ H5E.c H5Edeprec.c H5Eint.c \ @@ -84,8 +84,10 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5Olayout.c \ H5Olinfo.c H5Olink.c H5Omessage.c H5Omtime.c \ H5Oname.c H5Onull.c H5Opline.c H5Orefcount.c \ - H5Osdspace.c H5Oshared.c H5Ostab.c \ - H5Oshmesg.c H5Otest.c H5Ounknown.c \ + H5Osdspace.c H5Oshared.c \ + H5Oshmesg.c \ + H5Ostab.c \ + H5Otest.c H5Ounknown.c \ H5P.c H5Pacpl.c H5Pdapl.c H5Pdcpl.c \ H5Pdeprec.c H5Pdxpl.c H5Pencdec.c \ H5Pfapl.c H5Pfcpl.c H5Pfmpl.c \ diff --git a/test/dsets.c b/test/dsets.c index b3f11b8..5e92a6e 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -6462,15 +6462,24 @@ static herr_t test_zero_dims(hid_t file) { hid_t s = -1, d = -1, dcpl = -1; - hsize_t dsize = 0, dmax = H5S_UNLIMITED, csize = 5; + hsize_t dzero = 0, dmax = H5S_UNLIMITED, csize = 5; + hid_t fapl; /* File access property list */ + H5D_chunk_index_t idx_type; /* Dataset chunk index type */ + H5F_libver_t low; /* File format low bound */ herr_t ret; TESTING("I/O on datasets with zero-sized dims"); + /* Get the file's file access property list */ + if((fapl = H5Fget_access_plist(file)) < 0) FAIL_STACK_ERROR + + /* Get library format */ + if(H5Pget_libver_bounds(fapl, &low, NULL) < 0) FAIL_STACK_ERROR + /* * One-dimensional dataset */ - if((s = H5Screate_simple(1, &dsize, &dmax)) < 0) FAIL_STACK_ERROR + if((s = H5Screate_simple(1, &dzero, &dmax)) < 0) FAIL_STACK_ERROR /* Try creating chunked dataset with undefined chunk dimensions */ if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR @@ -6486,7 +6495,7 @@ test_zero_dims(hid_t file) /* Try creating chunked dataset with zero-sized chunk dimensions */ H5E_BEGIN_TRY { - ret = H5Pset_chunk(dcpl, 1, &dsize); + ret = H5Pset_chunk(dcpl, 1, &dzero); } H5E_END_TRY; if(ret > 0) FAIL_PUTS_ERROR("set zero-sized chunk dimensions") @@ -6498,6 +6507,16 @@ test_zero_dims(hid_t file) if(H5Pset_chunk(dcpl, 1, &csize) < 0) FAIL_STACK_ERROR if((d = H5Dcreate2(file, ZERODIM_DATASET, H5T_NATIVE_INT, s, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) FAIL_STACK_ERROR + /* Get the chunk index type */ + if(H5D__layout_idx_type_test(d, &idx_type) < 0) FAIL_STACK_ERROR + + /* Verify index type */ + if(low == H5F_LIBVER_LATEST) { + if(idx_type != H5D_CHUNK_IDX_EARRAY) + FAIL_PUTS_ERROR("should be using extensible array as index"); + } else if(idx_type != H5D_CHUNK_IDX_BTREE) + FAIL_PUTS_ERROR("should be using v1 B-tree as index"); + /* Various no-op writes */ if(H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, (void*)911) < 0) FAIL_STACK_ERROR if(H5Dwrite(d, H5T_NATIVE_INT, s, s, H5P_DEFAULT, NULL) < 0) FAIL_STACK_ERROR -- cgit v0.12 From 939da8a35e7a900d57fbbc3ce722ab941cf6d463 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 5 Apr 2016 09:49:50 -0500 Subject: [svn-r29638] Added new chunk index types to trace code. Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 autotools serial --- src/H5trace.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/H5trace.c b/src/H5trace.c index 2fd75ac..296e2a1 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -495,6 +495,40 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end else */ break; + case 'k': + if(ptr) { + if(vp) + fprintf(out, "0x%lx", (unsigned long)vp); + else + fprintf(out, "NULL"); + } /* end if */ + else { + H5D_chunk_index_t idx = (H5D_chunk_index_t)va_arg(ap, int); + + switch(idx) { + case H5D_CHUNK_IDX_BTREE: + fprintf(out, "H5D_CHUNK_IDX_BTREE"); + break; + + case H5D_CHUNK_IDX_EARRAY: + fprintf(out, "H5D_CHUNK_IDX_EARRAY"); + break; + + case H5D_CHUNK_IDX_BT2: + fprintf(out, "H5D_CHUNK_IDX_BT2"); + break; + + case H5D_CHUNK_IDX_NTYPES: + fprintf(out, "ERROR: H5D_CHUNK_IDX_NTYPES (invalid value)"); + break; + + default: + fprintf(out, "UNKNOWN VALUE: %ld", (long)idx); + break; + } /* end switch */ + } /* end else */ + break; + case 'l': if(ptr) { if(vp) -- cgit v0.12 From c622ca83f5876ecf4bdab901319c12bdf185d1ca Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 5 Apr 2016 11:52:38 -0500 Subject: [svn-r29640] Description: Add missing inializer from revise_chunks branch. Tested on: MacOSX/64 10.11.4 (amazon) w/serial (Too minor to require h5committest) --- src/H5Pdcpl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index dbbed5b..1237bfc 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -57,7 +57,7 @@ #define H5D_DEF_STORAGE_COMPACT_INIT {(hbool_t)FALSE, (size_t)0, NULL} #define H5D_DEF_STORAGE_CONTIG_INIT {HADDR_UNDEF, (hsize_t)0} #define H5D_DEF_STORAGE_CHUNK_INIT {H5D_CHUNK_IDX_BTREE, HADDR_UNDEF, H5D_COPS_BTREE, {{HADDR_UNDEF, NULL}}} -#define H5D_DEF_LAYOUT_CHUNK_INIT {(uint8_t)0, (unsigned)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, (unsigned)0, (uint32_t)0, (hsize_t)0, (hsize_t)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}} +#define H5D_DEF_LAYOUT_CHUNK_INIT {H5D_CHUNK_IDX_BTREE, (uint8_t)0, (unsigned)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, (unsigned)0, (uint32_t)0, (hsize_t)0, (hsize_t)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {{{(uint8_t)0}}}} #define H5D_DEF_STORAGE_VIRTUAL_INIT {{HADDR_UNDEF, 0}, 0, NULL, 0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, H5D_VDS_ERROR, HSIZE_UNDEF, -1, -1, FALSE} #ifdef H5_HAVE_C99_DESIGNATED_INITIALIZER #define H5D_DEF_STORAGE_COMPACT {H5D_COMPACT, { .compact = H5D_DEF_STORAGE_COMPACT_INIT }} -- cgit v0.12 From b84fc4585705bc7dc38d433f8492236d83308530 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 5 Apr 2016 23:18:54 -0500 Subject: [svn-r29644] Description: Finish correcting initializer for chunked layouts. Tested on: MacOSX/64 10.11.4 (amazon) w/serial, parallel & production (to minor to require h5committest) --- src/H5Pdcpl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 1237bfc..7981baf 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -57,7 +57,7 @@ #define H5D_DEF_STORAGE_COMPACT_INIT {(hbool_t)FALSE, (size_t)0, NULL} #define H5D_DEF_STORAGE_CONTIG_INIT {HADDR_UNDEF, (hsize_t)0} #define H5D_DEF_STORAGE_CHUNK_INIT {H5D_CHUNK_IDX_BTREE, HADDR_UNDEF, H5D_COPS_BTREE, {{HADDR_UNDEF, NULL}}} -#define H5D_DEF_LAYOUT_CHUNK_INIT {H5D_CHUNK_IDX_BTREE, (uint8_t)0, (unsigned)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, (unsigned)0, (uint32_t)0, (hsize_t)0, (hsize_t)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {{{(uint8_t)0}}}} +#define H5D_DEF_LAYOUT_CHUNK_INIT {H5D_CHUNK_IDX_BTREE, (uint8_t)0, (unsigned)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, (unsigned)0, (uint32_t)0, (hsize_t)0, (hsize_t)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {{{(uint8_t)0, (uint8_t)0, (uint8_t)0, (uint8_t)0, (uint8_t)0}, 0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}}} #define H5D_DEF_STORAGE_VIRTUAL_INIT {{HADDR_UNDEF, 0}, 0, NULL, 0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, H5D_VDS_ERROR, HSIZE_UNDEF, -1, -1, FALSE} #ifdef H5_HAVE_C99_DESIGNATED_INITIALIZER #define H5D_DEF_STORAGE_COMPACT {H5D_COMPACT, { .compact = H5D_DEF_STORAGE_COMPACT_INIT }} -- cgit v0.12 From 54d598aa44c2bbdc8d575faaec80a1348e19ce88 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Wed, 6 Apr 2016 10:17:02 -0500 Subject: [svn-r29646] FIX: HDFFV-9522 Add support for variable length datatypes in the High Level H5LT Fortran APIs Tested: platypus (gnu) --- hl/fortran/test/tstlite.F90 | 76 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 71 insertions(+), 5 deletions(-) diff --git a/hl/fortran/test/tstlite.F90 b/hl/fortran/test/tstlite.F90 index 081e61e..3937c3c 100644 --- a/hl/fortran/test/tstlite.F90 +++ b/hl/fortran/test/tstlite.F90 @@ -1300,11 +1300,14 @@ SUBROUTINE test_datasets() INTEGER(HID_T) :: file_id ! File identifier INTEGER :: errcode ! Error flag INTEGER, PARAMETER :: DIM1 = 10 ! Dimension of array + INTEGER, PARAMETER :: LEN0 = 3 + INTEGER, PARAMETER :: LEN1 = 12 CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name CHARACTER(LEN=5), PARAMETER :: dsetname2 = "dset2" ! Dataset name CHARACTER(LEN=5), PARAMETER :: dsetname3 = "dset3" ! Dataset name CHARACTER(LEN=5), PARAMETER :: dsetname4 = "dset4" ! Dataset name CHARACTER(LEN=5), PARAMETER :: dsetname5 = "dset5" ! Dataset name + CHARACTER(LEN=5), PARAMETER :: dsetname6 = "dset6" ! Dataset name INTEGER(HSIZE_T), DIMENSION(1) :: dims = (/DIM1/) ! Dataset dimensions INTEGER(HSIZE_T), DIMENSION(1) :: dimsr ! Dataset dimensions INTEGER :: rank = 1 ! Dataset rank @@ -1317,7 +1320,7 @@ SUBROUTINE test_datasets() REAL, DIMENSION(DIM1) , TARGET :: bufr3 ! Data buffer DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: buf4 ! Data buffer DOUBLE PRECISION, DIMENSION(DIM1), TARGET :: bufr4 ! Data buffer - INTEGER :: i, n ! general purpose integer + INTEGER :: i, j, n ! general purpose integer INTEGER :: has ! general purpose integer INTEGER :: type_class INTEGER(SIZE_T) :: type_size @@ -1326,6 +1329,17 @@ SUBROUTINE test_datasets() CHARACTER(LEN=8) :: chr_lg TYPE(C_PTR) :: f_ptr + ! vl data + TYPE vl + INTEGER, DIMENSION(:), POINTER :: DATA + END TYPE vl + TYPE(vl), DIMENSION(:), ALLOCATABLE, TARGET :: ptr + TYPE(hvl_t), DIMENSION(1:2), TARGET :: wdata ! Array of vlen structures + TYPE(hvl_t), DIMENSION(1:2), TARGET :: rdata ! Pointer to vlen structures + INTEGER(hsize_t), DIMENSION(1:1) :: dims_vl = (/2/) + INTEGER, DIMENSION(:), POINTER :: ptr_r + INTEGER(HID_T) :: type_id + ! ! Initialize FORTRAN predefined datatypes. ! @@ -1347,6 +1361,28 @@ SUBROUTINE test_datasets() n = n + 1 END DO + ! + ! Initialize variable-length data. wdata(1) is a countdown of + ! length LEN0, wdata(2) is a Fibonacci sequence of length LEN1. + ! + wdata(1)%len = LEN0 + wdata(2)%len = LEN1 + + ALLOCATE( ptr(1:2) ) + ALLOCATE( ptr(1)%data(1:wdata(1)%len) ) + ALLOCATE( ptr(2)%data(1:wdata(2)%len) ) + + DO i=1, wdata(1)%len + ptr(1)%data(i) = wdata(1)%len - i + 1 ! 3 2 1 + ENDDO + wdata(1)%p = C_LOC(ptr(1)%data(1)) + + ptr(2)%data(1:2) = 1 + DO i = 3, wdata(2)%len + ptr(2)%data(i) = ptr(2)%data(i-1) + ptr(2)%data(i-2) ! (1 1 2 3 5 8 etc.) + ENDDO + wdata(2)%p = C_LOC(ptr(2)%data(1)) + !------------------------------------------------------------------------- ! int !------------------------------------------------------------------------- @@ -1430,7 +1466,6 @@ SUBROUTINE test_datasets() !CALL h5ltread_dataset_f(file_id, dsetname4, H5T_NATIVE_DOUBLE, f_ptr, errcode) CALL h5ltread_dataset_double_f(file_id, dsetname4, bufr4, dims, errcode) - ! ! compare read and write buffers. ! @@ -1473,6 +1508,38 @@ SUBROUTINE test_datasets() CALL passed() + + !------------------------------------------------------------------------- + ! variable-length dataset + !------------------------------------------------------------------------- + CALL test_begin(' Make/Read datasets (vl) ') + ! + ! Create variable-length datatype. + ! + CALL H5Tvlen_create_f(H5T_NATIVE_INTEGER, type_id, errcode) + + f_ptr = C_LOC(wdata(1)) + CALL h5ltmake_dataset_f(file_id, dsetname6, 1, dims_vl, type_id, f_ptr, errcode) + + ! Read the variable-length datatype + f_ptr = C_LOC(rdata(1)) + CALL h5ltread_dataset_f(file_id, dsetname6, type_id, f_ptr, errcode) + + DO i = 1, INT(dims_vl(1)) + CALL c_f_pointer(rdata(i)%p, ptr_r, [rdata(i)%len] ) + DO j = 1, rdata(i)%len + IF(ptr_r(j).NE.ptr(i)%data(j))THEN + PRINT *, 'Writing/Reading variable-length dataset failed' + STOP + ENDIF + ENDDO + ENDDO + + CALL H5Tclose_f(type_id, errcode) + DEALLOCATE(ptr) + + CALL passed() + CALL test_begin(' Test h5ltpath_valid_f ') ! ! test function h5ltpath_valid_f @@ -1528,7 +1595,6 @@ SUBROUTINE test_datasets() CALL passed() - CALL test_begin(' Get dataset dimensions/info ') !------------------------------------------------------------------------- @@ -1573,6 +1639,8 @@ SUBROUTINE test_datasets() STOP ENDIF + CALL passed() + ! ! Close the file. ! @@ -1582,14 +1650,12 @@ SUBROUTINE test_datasets() ! CALL h5close_f(errcode) - CALL passed() ! ! end function. ! END SUBROUTINE test_datasets - !------------------------------------------------------------------------- ! test_attributes !------------------------------------------------------------------------- -- cgit v0.12 From 01f479abb49d378b44648e1c0f353839b18b548c Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Wed, 6 Apr 2016 13:07:17 -0500 Subject: [svn-r29648] FIX: HDFFV-8486 h5tbmake_table_f is missing the fill_data parameter (which is in the C counterpart) ADDED NEW API: h5tbread_table_f Tested: platypus, ostrich --- hl/fortran/src/H5LTf90proto.h | 32 ++++ hl/fortran/src/H5TBfc.c | 276 ++++++++++++++++++++++--------- hl/fortran/src/H5TBff.F90 | 187 ++++++++++++++++++--- hl/fortran/src/hdf5_hl_fortrandll.def.in | 4 +- hl/fortran/test/Makefile.am | 2 +- hl/fortran/test/tsttable.F90 | 242 ++++++++++++++++++++++++--- 6 files changed, 621 insertions(+), 122 deletions(-) diff --git a/hl/fortran/src/H5LTf90proto.h b/hl/fortran/src/H5LTf90proto.h index 20d043e..77f941e 100644 --- a/hl/fortran/src/H5LTf90proto.h +++ b/hl/fortran/src/H5LTf90proto.h @@ -311,6 +311,38 @@ h5tbmake_table_c(size_t_f *namelen1, HDF5_HL_F90CSTUBDLL int_f +h5tbread_table_c(hid_t_f *loc_id, + _fcd name, + size_t_f *namelen, + hsize_t_f *nfields, + size_t_f *dst_size, + size_t_f *dst_offset, + size_t_f *dst_sizes, + void *dst_buf); + + +HDF5_HL_F90CSTUBDLL +int_f +h5tbmake_table_ptr_c(size_t_f *namelen1, + _fcd name1, + hid_t_f *loc_id, + size_t_f *namelen, + _fcd name, + hsize_t_f *nfields, + hsize_t_f *nrecords, + size_t_f *type_size, + size_t_f *field_offset, + hid_t_f *field_types, + hsize_t_f *chunk_size, + void *fill_data, + int_f *compress, + size_t_f *char_len_field_names, /* field_names lenghts */ + size_t_f *max_char_size_field_names, /* char len of fields */ + char *field_names, /* field_names */ + void *data); + +HDF5_HL_F90CSTUBDLL +int_f h5tbwrite_field_name_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, diff --git a/hl/fortran/src/H5TBfc.c b/hl/fortran/src/H5TBfc.c index 99a7800..2bb7c3b 100644 --- a/hl/fortran/src/H5TBfc.c +++ b/hl/fortran/src/H5TBfc.c @@ -37,21 +37,12 @@ *------------------------------------------------------------------------- */ int_f -h5tbmake_table_c(size_t_f *namelen1, - _fcd name1, - hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - hsize_t_f *nfields, - hsize_t_f *nrecords, - size_t_f *type_size, - size_t_f *field_offset, - hid_t_f *field_types, - hsize_t_f *chunk_size, - int_f *compress, - size_t_f *char_len_field_names, /* field_names lenghts */ - size_t_f *max_char_size_field_names, /* char len of fields */ - char *field_names) /* field_names */ +h5tbmake_table_c(size_t_f *namelen1, _fcd name1, hid_t_f *loc_id, size_t_f *namelen, _fcd name, + hsize_t_f *nfields, hsize_t_f *nrecords, size_t_f *type_size, size_t_f *field_offset, + hid_t_f *field_types, hsize_t_f *chunk_size, int_f *compress, + size_t_f *char_len_field_names, /* field_names lenghts */ + size_t_f *max_char_size_field_names, /* char len of fields */ + char *field_names) /* field_names */ { char *c_name = NULL; char *c_name1 = NULL; @@ -101,7 +92,6 @@ h5tbmake_table_c(size_t_f *namelen1, HGOTO_DONE(FAIL) HDmemcpy(c_field_names[i], tmp_p, (size_t)char_len_field_names[i]); c_field_names[i][char_len_field_names[i]] = '\0'; - tmp_p = tmp_p + *max_char_size_field_names; } /* end for */ @@ -136,6 +126,177 @@ done: } /* end h5tbmake_table_c() */ /*------------------------------------------------------------------------- +* Function: h5tbmake_table_ptr_c +* +* Purpose: Call H5TBmake_table using F2003 features +* +* Return: Success: 0, Failure: -1 +* +* Programmer: M. Scot Breitenfeld +* +* Date: Sept. 10, 2015 +* +* Comments: +* +*------------------------------------------------------------------------- +*/ +int_f +h5tbmake_table_ptr_c(size_t_f *namelen1, _fcd name1, hid_t_f *loc_id, size_t_f *namelen, + _fcd name, hsize_t_f *nfields, hsize_t_f *nrecords, size_t_f *type_size, + size_t_f *field_offset, hid_t_f *field_types, hsize_t_f *chunk_size, + void *fill_data, int_f *compress, + size_t_f *char_len_field_names, /* field_names lenghts */ + size_t_f *max_char_size_field_names, /* char len of fields */ + char *field_names, + void *data) /* field_names */ +{ + char *c_name = NULL; + char *c_name1 = NULL; + hsize_t num_elem; + hsize_t i; + hsize_t c_nfields = (hsize_t)*nfields; + size_t *c_field_offset = NULL; + hid_t *c_field_types = NULL; + char **c_field_names = NULL; + char *tmp = NULL, *tmp_p; + int_f ret_value = 0; + + num_elem = (hsize_t)*nfields; + + /* + * convert FORTRAN name to C name + */ + if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + HGOTO_DONE(FAIL) + if(NULL == (c_name1 = (char *)HD5f2cstring(name1, (size_t)*namelen1))) + HGOTO_DONE(FAIL) + if(NULL == (c_field_offset = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields))) + HGOTO_DONE(FAIL) + if(NULL == (c_field_types = (hid_t *)HDmalloc(sizeof(hid_t) * (size_t)c_nfields))) + HGOTO_DONE(FAIL) + + for(i = 0; i < num_elem; i++) { + c_field_offset[i] = (size_t)field_offset[i]; + c_field_types[i] = field_types[i]; + } /* end for */ + + /* + * allocate array of character pointers + */ + if(NULL == (c_field_names = (char **)HDcalloc((size_t)num_elem, sizeof(char *)))) + HGOTO_DONE(FAIL) + + /* copy data to long C string */ + if(NULL == (tmp = (char *)HD5f2cstring(field_names, (size_t)*(max_char_size_field_names)*(size_t)num_elem))) + HGOTO_DONE(FAIL) + /* + * move data from temorary buffer + */ + tmp_p = tmp; + for(i = 0; i < num_elem; i++) { + if(NULL == (c_field_names[i] = (char *)HDmalloc((size_t)char_len_field_names[i] + 1))) + HGOTO_DONE(FAIL) + HDmemcpy(c_field_names[i], tmp_p, (size_t)char_len_field_names[i]); + c_field_names[i][char_len_field_names[i]] = '\0'; + tmp_p = tmp_p + *max_char_size_field_names; + } /* end for */ + + /* + * call H5TBmake_table function. + */ + if(H5TBmake_table(c_name1, (hid_t)*loc_id, c_name, c_nfields, (hsize_t)*nrecords, + (size_t)*type_size, (const char **)c_field_names, c_field_offset, c_field_types, + (hsize_t)*chunk_size, fill_data, *compress, data) < 0) + HGOTO_DONE(FAIL) + +done: + if(c_name) + HDfree(c_name); + if(c_name1) + HDfree(c_name1); + if(c_field_names) { + for(i = 0; i < num_elem; i++) { + if(c_field_names[i]) + HDfree(c_field_names[i]); + } /* end for */ + HDfree(c_field_names); + } /* end if */ + if(tmp) + HDfree(tmp); + if(c_field_offset) + HDfree(c_field_offset); + if(c_field_types) + HDfree(c_field_types); + + return ret_value; +} /* end h5tbmake_table_c() */ + + +/*------------------------------------------------------------------------- +* Function: h5tbread_table_c +* +* Purpose: Call H5TBread_table using F2003 features +* +* Return: Success: 0, Failure: -1 +* +* Programmer: M. Scot Breitenfeld +* +* Date: Sept. 14, 2015 +* +* Comments: +* +*------------------------------------------------------------------------- +*/ +int_f +h5tbread_table_c(hid_t_f *loc_id, _fcd name, size_t_f *namelen, hsize_t_f *nfields, + size_t_f *dst_size, size_t_f *dst_offset, size_t_f *dst_sizes, void *dst_buf) +{ + char *c_name = NULL; + size_t *c_dst_offset = NULL; + size_t *c_dst_sizes = NULL; + hsize_t c_nfields = (hsize_t)*nfields; + int_f ret_value = 0; + hsize_t i; + + /* + * convert FORTRAN name to C name + */ + if(NULL == (c_name = (char *)HD5f2cstring(name, (size_t)*namelen))) + HGOTO_DONE(FAIL) + + if(NULL == (c_dst_offset = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields))) + HGOTO_DONE(FAIL) + if(NULL == (c_dst_sizes = (size_t *)HDmalloc(sizeof(size_t) * (size_t)c_nfields))) + HGOTO_DONE(FAIL) + + for(i = 0; i < c_nfields; i++) { + c_dst_offset[i] = (size_t)dst_offset[i]; + c_dst_sizes[i] = (size_t)dst_sizes[i]; + } /* end for */ + + /* + * call H5TBread_table function. + */ + if(H5TBread_table( (hid_t)*loc_id, c_name, (size_t)*dst_size, c_dst_offset, + c_dst_sizes, dst_buf) < 0) + HGOTO_DONE(FAIL) + +done: + if(c_name) + HDfree(c_name); + + if(c_dst_offset) + HDfree(c_dst_offset); + if(c_dst_sizes) + HDfree(c_dst_sizes); + + return ret_value; +} /* end h5tbmake_table_c() */ + + + + +/*------------------------------------------------------------------------- * Function: h5tbwrite_field_name_c * * Purpose: Call H5TBwrite_fields_name @@ -151,15 +312,8 @@ done: *------------------------------------------------------------------------- */ int_f -h5tbwrite_field_name_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - size_t_f *namelen1, - _fcd field_name, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) +h5tbwrite_field_name_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *namelen1, _fcd field_name, + hsize_t_f *start, hsize_t_f *nrecords, size_t_f *type_size, void *buf) { char *c_name = NULL; char *c_name1 = NULL; @@ -207,15 +361,8 @@ done: *------------------------------------------------------------------------- */ int_f -h5tbread_field_name_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - size_t_f *namelen1, - _fcd field_name, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) +h5tbread_field_name_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *namelen1, _fcd field_name, + hsize_t_f *start, hsize_t_f *nrecords, size_t_f *type_size, void *buf) { char *c_name = NULL; char *c_name1 = NULL; @@ -262,14 +409,8 @@ done: *------------------------------------------------------------------------- */ int_f -h5tbwrite_field_index_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - int_f *field_index, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) +h5tbwrite_field_index_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *field_index, hsize_t_f *start, + hsize_t_f *nrecords, size_t_f *type_size, void *buf) { char *c_name = NULL; size_t c_type_size = *type_size; @@ -313,14 +454,8 @@ done: *------------------------------------------------------------------------- */ int_f -h5tbread_field_index_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - int_f *field_index, - hsize_t_f *start, - hsize_t_f *nrecords, - size_t_f *type_size, - void *buf) +h5tbread_field_index_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, int_f *field_index, hsize_t_f *start, + hsize_t_f *nrecords, size_t_f *type_size, void *buf) { char *c_name = NULL; size_t c_type_size = *type_size; @@ -363,14 +498,8 @@ done: *------------------------------------------------------------------------- */ int_f -h5tbinsert_field_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - size_t_f *namelen1, - _fcd field_name, - hid_t_f *field_type, - int_f *position, - void *buf) +h5tbinsert_field_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, size_t_f *namelen1, + _fcd field_name, hid_t_f *field_type, int_f *position, void *buf) { char *c_name = NULL; char *c_name1 = NULL; @@ -416,11 +545,8 @@ done: *------------------------------------------------------------------------- */ int_f -h5tbdelete_field_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - size_t_f *namelen1, - _fcd field_name) +h5tbdelete_field_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, + size_t_f *namelen1, _fcd field_name) { char *c_name = NULL; char *c_name1 = NULL; @@ -465,11 +591,8 @@ done: *------------------------------------------------------------------------- */ int_f -h5tbget_table_info_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - hsize_t_f *nfields, - hsize_t_f *nrecords) +h5tbget_table_info_c(hid_t_f *loc_id, size_t_f *namelen, + _fcd name, hsize_t_f *nfields, hsize_t_f *nrecords) { char *c_name = NULL; hsize_t c_nfields; @@ -515,17 +638,12 @@ done: *------------------------------------------------------------------------- */ int_f -h5tbget_field_info_c(hid_t_f *loc_id, - size_t_f *namelen, - _fcd name, - hsize_t_f *nfields, - size_t_f *field_sizes, - size_t_f *field_offsets, - size_t_f *type_size, - size_t_f *namelen2, /* field_names lenghts */ - size_t_f *lenmax, /* character len max */ - _fcd field_names, /* field_names */ - size_t_f *maxlen_out) +h5tbget_field_info_c(hid_t_f *loc_id, size_t_f *namelen, _fcd name, hsize_t_f *nfields, + size_t_f *field_sizes, size_t_f *field_offsets, size_t_f *type_size, + size_t_f *namelen2, /* field_names lenghts */ + size_t_f *lenmax, /* character len max */ + _fcd field_names, /* field_names */ + size_t_f *maxlen_out) { char *c_name = NULL; diff --git a/hl/fortran/src/H5TBff.F90 b/hl/fortran/src/H5TBff.F90 index 448d607..0e2c3dd 100644 --- a/hl/fortran/src/H5TBff.F90 +++ b/hl/fortran/src/H5TBff.F90 @@ -63,6 +63,11 @@ MODULE h5tb_CONST MODULE PROCEDURE h5tbinsert_field_f_string END INTERFACE + INTERFACE h5tbmake_table_f + MODULE PROCEDURE h5tbmake_table_f90 + MODULE PROCEDURE h5tbmake_table_ptr_f + END INTERFACE + INTERFACE INTEGER FUNCTION h5tbwrite_field_name_c(loc_id,namelen,dset_name,namelen1,field_name,& start,nrecords,type_size,buf) & @@ -163,7 +168,7 @@ MODULE h5tb_CONST CONTAINS !------------------------------------------------------------------------- -! Function: h5tbmake_table_f +! Function: h5tbmake_table_f90 ! ! Purpose: Make a table ! @@ -179,7 +184,7 @@ CONTAINS ! !------------------------------------------------------------------------- - SUBROUTINE h5tbmake_table_f(table_title,& + SUBROUTINE h5tbmake_table_f90(table_title,& loc_id,& dset_name,& nfields,& @@ -259,23 +264,167 @@ CONTAINS max_char_size_field_names = LEN(field_names(1)) - errcode = h5tbmake_table_c(namelen1,& - table_title,& - loc_id,& - namelen,& - dset_name,& - nfields,& - nrecords,& - type_size,& - field_offset,& - field_types,& - chunk_size,& - compress,& - char_len_field_names, & - max_char_size_field_names, & - field_names) - - END SUBROUTINE h5tbmake_table_f + errcode = h5tbmake_table_c(namelen1, table_title, loc_id, namelen, dset_name, nfields, nrecords,& + type_size, field_offset, field_types, chunk_size, compress, char_len_field_names, & + max_char_size_field_names, field_names) + + END SUBROUTINE h5tbmake_table_f90 + + SUBROUTINE h5tbmake_table_ptr_f(table_title,& + loc_id,& + dset_name,& + nfields,& + nrecords,& + type_size,& + field_names,& + field_offset,& + field_types,& + chunk_size,& + fill_data,& + compress,& + data,& + errcode ) + + USE ISO_C_BINDING + IMPLICIT NONE + CHARACTER(LEN=*), INTENT(in) :: table_title ! name of the dataset + INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier + CHARACTER(LEN=*), INTENT(in) :: dset_name ! name of the dataset + INTEGER(hsize_t), INTENT(in) :: nfields ! fields + INTEGER(hsize_t), INTENT(in) :: nrecords ! records + INTEGER(size_t), INTENT(in) :: type_size ! type size + CHARACTER(LEN=*), DIMENSION(1:nfields), INTENT(in) :: field_names ! field names + INTEGER(size_t), DIMENSION(1:nfields), INTENT(in) :: field_offset ! field offset + INTEGER(hid_t), DIMENSION(1:nfields), INTENT(in) :: field_types ! field types + INTEGER(hsize_t), INTENT(in) :: chunk_size ! chunk size + TYPE(C_PTR), INTENT(in) :: fill_data ! Fill values data + INTEGER, INTENT(in) :: compress ! compress + TYPE(C_PTR), INTENT(in) :: data ! Buffer with data to be written to the table + INTEGER(size_t) :: namelen ! name length + INTEGER(size_t) :: namelen1 ! name length + INTEGER :: errcode ! error code + INTEGER(size_t), DIMENSION(1:nfields) :: char_len_field_names ! field name lengths + INTEGER(size_t) :: max_char_size_field_names ! character len of field names + INTEGER(hsize_t) :: i ! general purpose integer + + INTERFACE + INTEGER FUNCTION h5tbmake_table_ptr_c(namelen1,& + table_title,& + loc_id,& + namelen,& + dset_name,& + nfields,& + nrecords,& + type_size,& + field_offset,& + field_types,& + chunk_size,& + fill_data,& + compress,& + char_len_field_names,& + max_char_size_field_names,& + field_names,& + data) & + BIND(C,NAME='h5tbmake_table_ptr_c') + IMPORT :: C_CHAR, C_PTR + IMPORT :: HID_T, SIZE_T, HSIZE_T + IMPLICIT NONE + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: table_title ! name of the dataset + INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier + CHARACTER(KIND=C_CHAR), DIMENSION(*), INTENT(in) :: dset_name ! name of the dataset + INTEGER(hsize_t), INTENT(in) :: nfields ! fields + INTEGER(hsize_t), INTENT(in) :: nrecords ! records + INTEGER(size_t), INTENT(in) :: type_size ! type size + CHARACTER(KIND=C_CHAR), DIMENSION(nfields), INTENT(in) :: field_names ! field names + INTEGER(size_t), DIMENSION(nfields), INTENT(in) :: field_offset ! field offset + INTEGER(hid_t), DIMENSION(nfields), INTENT(in) :: field_types ! field types + INTEGER(hsize_t), INTENT(in) :: chunk_size ! chunk size + TYPE(C_PTR), INTENT(in), VALUE :: fill_data ! Fill values data + INTEGER, INTENT(in) :: compress ! compress + INTEGER(size_t) :: namelen ! name length + INTEGER(size_t) :: namelen1 ! name length + INTEGER(size_t), DIMENSION(nfields) :: char_len_field_names ! field name's lengths + INTEGER(size_t) :: max_char_size_field_names ! character len of field names + TYPE(C_PTR), INTENT(in), VALUE :: data + END FUNCTION h5tbmake_table_ptr_c + END INTERFACE + + namelen = LEN(dset_name) + namelen1 = LEN(table_title) + + ! Find the size of each character string in the array + DO i = 1, nfields + char_len_field_names(i) = LEN_TRIM(field_names(i)) + END DO + + max_char_size_field_names = LEN(field_names(1)) + + errcode = h5tbmake_table_ptr_c(namelen1, table_title, loc_id, namelen, dset_name, nfields, nrecords,& + type_size, field_offset, field_types, chunk_size, fill_data, compress, char_len_field_names, & + max_char_size_field_names, field_names, data) + + END SUBROUTINE h5tbmake_table_ptr_f + + SUBROUTINE h5tbread_table_f(loc_id,& + table_name,& + nfields,& + dst_size,& + dst_offset, & + dst_sizes, & + dst_buf, & + errcode) + + USE ISO_C_BINDING + IMPLICIT NONE + INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier + CHARACTER(LEN=*), INTENT(in) :: table_name ! name of the dataset + INTEGER(hsize_t), INTENT(in) :: nfields ! fields + INTEGER(size_t), INTENT(in) :: dst_size ! type size + INTEGER(size_t), DIMENSION(1:nfields), INTENT(in) :: dst_offset ! An array containing the sizes of the fields + INTEGER(size_t), DIMENSION(1:nfields), INTENT(in) :: dst_sizes ! An array containing the sizes of the fields + TYPE(C_PTR), INTENT(OUT) :: dst_buf + INTEGER :: errcode ! error code + INTEGER(size_t) :: namelen ! name length + INTEGER(hsize_t) :: i ! general purpose integer + + INTERFACE + INTEGER FUNCTION h5tbread_table_c(loc_id,& + table_name,& + namelen,& + nfields,& + dst_size,& + dst_offset, & + dst_sizes, & + dst_buf) & + BIND(C,NAME='h5tbread_table_c') + IMPORT :: C_PTR + IMPORT :: HID_T, SIZE_T, HSIZE_T + IMPLICIT NONE + INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier + CHARACTER(LEN=1), INTENT(in) :: table_name ! name of the dataset + INTEGER(hsize_t), INTENT(in) :: nfields + INTEGER(size_t), INTENT(in) :: dst_size ! type size + INTEGER(size_t), DIMENSION(1:nfields), INTENT(in) :: dst_offset ! An array containing the sizes of the fields + INTEGER(size_t), DIMENSION(1:nfields), INTENT(in) :: dst_sizes ! An array containing the sizes of the fields + INTEGER(size_t) :: namelen ! name length + TYPE(C_PTR), VALUE :: dst_buf + + END FUNCTION h5tbread_table_c + END INTERFACE + + namelen = LEN(table_name) + + errcode = h5tbread_table_c(loc_id,& + table_name,& + namelen, & + nfields, & + dst_size,& + dst_offset, & + dst_sizes, & + dst_buf) + + + END SUBROUTINE h5tbread_table_f !------------------------------------------------------------------------- ! Function: h5tbwrite_field_name_f_int diff --git a/hl/fortran/src/hdf5_hl_fortrandll.def.in b/hl/fortran/src/hdf5_hl_fortrandll.def.in index 9a1231a..b48cae3 100644 --- a/hl/fortran/src/hdf5_hl_fortrandll.def.in +++ b/hl/fortran/src/hdf5_hl_fortrandll.def.in @@ -72,7 +72,9 @@ H5LT_CONST_mp_H5LTGET_ATTRIBUTE_NDIMS_F H5LT_CONST_mp_H5LTGET_ATTRIBUTE_INFO_F H5LT_CONST_mp_H5LTPATH_VALID_F ; H5TB -H5TB_CONST_mp_H5TBMAKE_TABLE_F +H5TB_CONST_mp_H5TBREAD_TABLE_F +H5TB_CONST_mp_H5TBMAKE_TABLE_F90 +H5TB_CONST_mp_H5TBMAKE_TABLE_PTR_F H5TB_CONST_mp_H5TBWRITE_FIELD_NAME_F_INT H5TB_CONST_mp_H5TBWRITE_FIELD_NAME_F_STRING H5TB_CONST_mp_H5TBREAD_FIELD_NAME_F_INT diff --git a/hl/fortran/test/Makefile.am b/hl/fortran/test/Makefile.am index ca49817..32d367c 100644 --- a/hl/fortran/test/Makefile.am +++ b/hl/fortran/test/Makefile.am @@ -45,7 +45,7 @@ tstimage_SOURCES=tstimage.F90 tsttable_SOURCES=tsttable.F90 # Temporary files. -CHECK_CLEANFILES+=dsetf[1-5].h5 f1img.h5 f1tab.h5 tstds.h5 +CHECK_CLEANFILES+=dsetf[1-5].h5 f1img.h5 f[1-2]tab.h5 tstds.h5 # Mark this directory as part of the Fortran API (this affects output # from tests in conclude.am) diff --git a/hl/fortran/test/tsttable.F90 b/hl/fortran/test/tsttable.F90 index 74029a5..a87f783 100644 --- a/hl/fortran/test/tsttable.F90 +++ b/hl/fortran/test/tsttable.F90 @@ -20,7 +20,24 @@ PROGRAM table_test + USE H5TB ! module of H5TB + USE HDF5 ! module of HDF5 library + + IMPLICIT NONE + INTEGER :: errcode = 0 + + ! + ! Initialize FORTRAN predefined datatypes. + ! + CALL h5open_f(errcode) + CALL test_table1() + CALL test_table2() + + ! + ! Close FORTRAN predefined datatypes. + ! + CALL h5close_f(errcode) END PROGRAM table_test @@ -35,13 +52,13 @@ SUBROUTINE test_table1() USE HDF5 ! module of HDF5 library IMPLICIT NONE - + CHARACTER(len=8), PARAMETER :: filename = "f1tab.h5" ! File name CHARACTER(LEN=5), PARAMETER :: dsetname1 = "dset1" ! Dataset name INTEGER(HID_T) :: file_id ! File identifier INTEGER(HSIZE_T), PARAMETER :: nfields = 4 ! nfields INTEGER(HSIZE_T), PARAMETER :: nrecords = 5 ! nrecords - CHARACTER(LEN=10),DIMENSION(1:nfields) :: field_names ! field names + CHARACTER(LEN=9),DIMENSION(1:nfields) :: field_names ! field names INTEGER(SIZE_T), DIMENSION(1:nfields) :: field_offset ! field offset INTEGER(HID_T), DIMENSION(1:nfields) :: field_types ! field types INTEGER(HSIZE_T), PARAMETER :: chunk_size = 5 ! chunk size @@ -74,6 +91,7 @@ SUBROUTINE test_table1() INTEGER :: Cs_sizeof_double = H5_SIZEOF_DOUBLE ! C's sizeof double INTEGER :: SIZEOF_X LOGICAL :: Exclude_double + CHARACTER(LEN=62) :: test_txt ! Find size of DOUBLE PRECISION #ifdef H5_FORTRAN_HAVE_STORAGE_SIZE @@ -100,11 +118,6 @@ SUBROUTINE test_table1() END DO ! - ! Initialize FORTRAN predefined datatypes. - ! - CALL h5open_f(errcode) - - ! ! Create a new file using default properties. ! CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, errcode) @@ -164,7 +177,8 @@ SUBROUTINE test_table1() ! make table !------------------------------------------------------------------------- - CALL test_begin(' Make table ') + test_txt = " Make table" + CALL test_begin(test_txt) CALL h5tbmake_table_f(dsetname1,& file_id,& @@ -186,7 +200,8 @@ SUBROUTINE test_table1() ! write field !------------------------------------------------------------------------- - CALL test_begin(' Read/Write field by name ') + test_txt = "Read/Write field by name" + CALL test_begin(test_txt) CALL h5tbwrite_field_name_f(file_id,dsetname1,field_names(1),start,nrecords,type_sizec,& bufs,errcode) @@ -309,7 +324,8 @@ SUBROUTINE test_table1() ! write field !------------------------------------------------------------------------- - CALL test_begin(' Read/Write field by index ') + test_txt = "Read/Write field by index" + CALL test_begin(test_txt) CALL h5tbwrite_field_index_f(file_id,dsetname1,1,start,nrecords,type_sizec,& bufs,errcode) @@ -413,8 +429,8 @@ SUBROUTINE test_table1() ! Insert field ! we insert a field callsed "field5" with the same type and buffer as field 4 (Real) !------------------------------------------------------------------------- - - CALL test_begin(' Insert field ') + test_txt = "Insert field" + CALL test_begin(test_txt) CALL h5tbinsert_field_f(file_id,dsetname1,"field5",field_types(4),4,bufr,errcode) CALL h5tbread_field_index_f(file_id,dsetname1,5,start,nrecords,type_sizer,& @@ -437,7 +453,8 @@ SUBROUTINE test_table1() ! Delete field !------------------------------------------------------------------------- - CALL test_begin(' Delete field ') + test_txt = "Delete field" + CALL test_begin(test_txt) CALL h5tbdelete_field_f(file_id,dsetname1,"field4abc",errcode) @@ -448,7 +465,8 @@ SUBROUTINE test_table1() ! Gets the number of records and fields !------------------------------------------------------------------------- - CALL test_begin(' Get table info ') + test_txt = "Get table info" + CALL test_begin(test_txt) CALL h5tbget_table_info_f(file_id,dsetname1,nfieldsr,nrecordsr,errcode ) @@ -463,7 +481,8 @@ SUBROUTINE test_table1() ! Get information about fields !------------------------------------------------------------------------- - CALL test_begin(' Get fields info ') + test_txt = "Get fields info" + CALL test_begin(test_txt) CALL h5tbget_field_info_f(file_id, dsetname1, nfields, field_namesr, field_sizesr,& field_offsetr, type_sizeout, errcode, maxlen ) @@ -502,16 +521,196 @@ SUBROUTINE test_table1() ! CALL h5fclose_f(file_id, errcode) - ! - ! Close FORTRAN predefined datatypes. - ! - CALL h5close_f(errcode) ! ! end function. ! END SUBROUTINE test_table1 +!------------------------------------------------------------------------- +! test_table2 +! Tests F2003 versions of H5TBread_table_f and H5TBmake_table_f +!------------------------------------------------------------------------- + +SUBROUTINE test_table2() + + USE H5TB ! module of H5TB + USE HDF5 ! module of HDF5 library + + IMPLICIT NONE + + INTEGER, PARAMETER :: int_kind_8 = SELECTED_INT_KIND(9) !should map to INTEGER*4 on most modern processors + INTEGER, PARAMETER :: int_kind_16 = SELECTED_INT_KIND(9) ! (18) !should map to INTEGER*8 on most modern processors + INTEGER, PARAMETER :: sp = SELECTED_REAL_KIND(5) ! This should map to REAL*4 on most modern processors + INTEGER, PARAMETER :: dp = SELECTED_REAL_KIND(10) ! This should map to REAL*8 on most modern processors + + TYPE particle_t + CHARACTER(LEN=11) :: name + INTEGER(KIND=int_kind_8) :: lati + INTEGER(KIND=int_kind_16) :: long + REAL(KIND=sp) :: pressure + REAL(KIND=dp) :: temperature + END TYPE particle_t + + INTEGER(HSIZE_T), PARAMETER :: nfields = 5 ! nfields + INTEGER(HSIZE_T), PARAMETER :: nrecords = 8 ! nrecords + + CHARACTER(len=8), PARAMETER :: filename = "f2tab.h5" ! File name + CHARACTER(LEN=5), PARAMETER :: table_name = "tabel" ! table name + CHARACTER(LEN=10), PARAMETER :: table_name_fill = "tabel_fill" ! table name + + ! Define field information + CHARACTER(LEN=11), DIMENSION(1:NFIELDS), PARAMETER :: field_names = (/& + "Name ", & + "Latitude ", & + "Longitude ", & + "Pressure ", & + "Temperature" & + /) + + INTEGER(hid_t), DIMENSION(1:nfields) :: field_type + INTEGER(hid_t) :: string_type + INTEGER(hid_t) :: file_id + INTEGER(hsize_t), PARAMETER :: chunk_size = 10 + TYPE(particle_t), DIMENSION(1:nrecords), TARGET :: fill_data + INTEGER :: compress + INTEGER :: status + INTEGER :: i + INTEGER(SIZE_T) :: dst_size + TYPE(particle_t), DIMENSION(1:nrecords), TARGET :: dst_buf + INTEGER(SIZE_T), DIMENSION(1:nfields) :: dst_offset + INTEGER(SIZE_T), DIMENSION(1:nfields) :: dst_sizes + TYPE(particle_t), DIMENSION(1:nrecords), TARGET :: p_data + TYPE(particle_t), DIMENSION(1:nrecords), TARGET :: r_data + + TYPE(C_PTR) :: f_ptr1, f_ptr2, f_ptr3 + + INTEGER :: errcode + CHARACTER(LEN=62) :: test_txt + + test_txt = "Testing H5TBread_table_f and H5TBmake_table_f (F2003)" + CALL test_begin(test_txt) + + ! Define an array of Particles + p_data(1:nrecords) = (/ & + particle_t("zero ",0_int_kind_8,0_int_kind_16,0.0_sp,0.0_dp), & + particle_t("one ",10_int_kind_8,10_int_kind_16,10.0_sp,10.0_dp), & + particle_t("two ",20_int_kind_8,20_int_kind_16,20.0_sp,20.0_dp), & + particle_t("three ",30_int_kind_8,30_int_kind_16,30.0_sp,30.0_dp),& + particle_t("four ",40_int_kind_8,40_int_kind_16,40.0_sp,40.0_dp), & + particle_t("five ",50_int_kind_8,50_int_kind_16,50.0_sp,50.0_dp), & + particle_t("six ",60_int_kind_8,60_int_kind_16,60.0_sp,60.0_dp), & + particle_t("seven ",70_int_kind_8,70_int_kind_16,70.0_sp,70.0_dp) & + /) + + fill_data(1:nrecords) = particle_t("no data",-1_int_kind_8, -2_int_kind_16, -99.0_sp, -100.0_dp) + + compress = 0 + + dst_size = H5OFFSETOF(C_LOC(dst_buf(1)), C_LOC(dst_buf(2))) + +#ifdef H5_FORTRAN_HAVE_STORAGE_SIZE + dst_sizes(1:nfields) = (/ & + storage_size(dst_buf(1)%name)/storage_size(c_char_'a'), & + storage_size(dst_buf(1)%lati)/storage_size(c_char_'a'), & + storage_size(dst_buf(1)%long)/storage_size(c_char_'a'), & + storage_size(dst_buf(1)%pressure)/storage_size(c_char_'a'), & + storage_size(dst_buf(1)%temperature)/storage_size(c_char_'a') & + /) +#else + dst_sizes(1:nfields) = (/ & + sizeof(dst_buf(1)%name), & + sizeof(dst_buf(1)%lati), & + sizeof(dst_buf(1)%long), & + sizeof(dst_buf(1)%pressure), & + sizeof(dst_buf(1)%temperature) & + /) +#endif + + dst_offset(1:nfields) = (/ & + H5OFFSETOF(C_LOC(dst_buf(1)), C_LOC(dst_buf(1)%name)), & + H5OFFSETOF(C_LOC(dst_buf(1)), C_LOC(dst_buf(1)%lati)), & + H5OFFSETOF(C_LOC(dst_buf(1)), C_LOC(dst_buf(1)%long)), & + H5OFFSETOF(C_LOC(dst_buf(1)), C_LOC(dst_buf(1)%pressure)), & + H5OFFSETOF(C_LOC(dst_buf(1)), C_LOC(dst_buf(1)%temperature)) & + /) + + ! Initialize field_type + CALL H5Tcopy_f(H5T_FORTRAN_S1, string_type, errcode) + CALL H5Tset_size_f(string_type, INT(11,size_t), errcode) + + field_type(1:5) = (/ & + string_type,& + h5kind_to_type(KIND(dst_buf(1)%lati), H5_INTEGER_KIND),& + h5kind_to_type(KIND(dst_buf(1)%long), H5_INTEGER_KIND),& + h5kind_to_type(KIND(dst_buf(1)%pressure), H5_REAL_KIND),& + h5kind_to_type(KIND(dst_buf(1)%temperature), H5_REAL_KIND) & + /) + + ! + ! Create a new file using default properties. + ! + CALL h5fcreate_f(filename, H5F_ACC_TRUNC_F, file_id, errcode) + + ! Check setting the fill values + + f_ptr1 = C_NULL_PTR + f_ptr2 = C_LOC(fill_data(1)%name(1:1)) + + CALL h5tbmake_table_f("Table Title Fill", file_id, table_name_fill, nfields, nrecords, & + dst_size, field_names, dst_offset, field_type, & + chunk_size, f_ptr2, compress, f_ptr1, errcode ) + + f_ptr3 = C_LOC(r_data(1)%name(1:1)) + CALL h5tbread_table_f(file_id, table_name_fill, nfields, dst_size, dst_offset, dst_sizes, f_ptr3, errcode) + + DO i = 1, nfields + IF(r_data(i)%name.NE.fill_data(i)%name.OR. & + r_data(i)%lati.NE.fill_data(i)%lati.OR. & + r_data(i)%long.NE.fill_data(i)%long.OR. & + r_data(i)%pressure.NE.fill_data(i)%pressure.OR. & + r_data(i)%temperature.NE.fill_data(i)%temperature)THEN + PRINT*,'H5TBmake/read_table_f --filled-- FAILED' + STOP + ENDIF + ENDDO + + ! Check setting the table values + + f_ptr1 = C_LOC(p_data(1)%name(1:1)) + f_ptr2 = C_NULL_PTR + + CALL h5tbmake_table_f("Table Title",file_id, table_name, nfields, nrecords, & + dst_size, field_names, dst_offset, field_type, & + chunk_size, f_ptr2, compress, f_ptr1, errcode ) + + f_ptr3 = C_LOC(r_data(1)%name(1:1)) + CALL h5tbread_table_f(file_id, table_name, nfields, dst_size, dst_offset, dst_sizes, f_ptr3, errcode) + + DO i = 1, nfields + IF(r_data(i)%name.NE.p_data(i)%name.OR. & + r_data(i)%lati.NE.p_data(i)%lati.OR. & + r_data(i)%long.NE.p_data(i)%long.OR. & + r_data(i)%pressure.NE.p_data(i)%pressure.OR. & + r_data(i)%temperature.NE.p_data(i)%temperature)THEN + PRINT*,'H5TBmake/read_table_f FAILED' + STOP + ENDIF + ENDDO + + CALL passed() + + !------------------------------------------------------------------------- + ! end + !------------------------------------------------------------------------- + + ! + ! Close the file. + ! + CALL h5fclose_f(file_id, errcode) + +END SUBROUTINE test_table2 + !------------------------------------------------------------------------- ! test_begin @@ -519,8 +718,7 @@ END SUBROUTINE test_table1 SUBROUTINE test_begin(string) CHARACTER(LEN=*), INTENT(IN) :: string - WRITE(*, fmt = '(14a)', advance = 'no') string - WRITE(*, fmt = '(40x,a)', advance = 'no') ' ' + WRITE(*, fmt = '(A)', ADVANCE = 'no') string END SUBROUTINE test_begin !------------------------------------------------------------------------- @@ -528,7 +726,7 @@ END SUBROUTINE test_begin !------------------------------------------------------------------------- SUBROUTINE passed() - WRITE(*, fmt = '(6a)') 'PASSED' + WRITE(*, fmt = '(T12,A6)') 'PASSED' END SUBROUTINE passed -- cgit v0.12 From 02a07cb0cfc2af288b62c1370c422fb72b93e751 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Wed, 6 Apr 2016 13:30:16 -0500 Subject: [svn-r29649] changed indentation format, updated comments --- hl/fortran/src/H5TBff.F90 | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/hl/fortran/src/H5TBff.F90 b/hl/fortran/src/H5TBff.F90 index 0e2c3dd..266f74a 100644 --- a/hl/fortran/src/H5TBff.F90 +++ b/hl/fortran/src/H5TBff.F90 @@ -365,27 +365,22 @@ CONTAINS END SUBROUTINE h5tbmake_table_ptr_f - SUBROUTINE h5tbread_table_f(loc_id,& - table_name,& - nfields,& - dst_size,& - dst_offset, & - dst_sizes, & - dst_buf, & - errcode) + SUBROUTINE h5tbread_table_f(loc_id, table_name, nfields, dst_size, dst_offset, & + dst_sizes, dst_buf, errcode) USE ISO_C_BINDING IMPLICIT NONE - INTEGER(hid_t), INTENT(in) :: loc_id ! file or group identifier - CHARACTER(LEN=*), INTENT(in) :: table_name ! name of the dataset - INTEGER(hsize_t), INTENT(in) :: nfields ! fields - INTEGER(size_t), INTENT(in) :: dst_size ! type size - INTEGER(size_t), DIMENSION(1:nfields), INTENT(in) :: dst_offset ! An array containing the sizes of the fields + INTEGER(hid_t), INTENT(in) :: loc_id ! An array containing the sizes of the fields + CHARACTER(LEN=*), INTENT(in) :: table_name ! The name of the dataset to read + INTEGER(hsize_t), INTENT(in) :: nfields ! number of fields + INTEGER(size_t), INTENT(in) :: dst_size ! The size of the structure type + INTEGER(size_t), DIMENSION(1:nfields), INTENT(in) :: dst_offset ! An array containing the offsets of the fields INTEGER(size_t), DIMENSION(1:nfields), INTENT(in) :: dst_sizes ! An array containing the sizes of the fields - TYPE(C_PTR), INTENT(OUT) :: dst_buf - INTEGER :: errcode ! error code - INTEGER(size_t) :: namelen ! name length - INTEGER(hsize_t) :: i ! general purpose integer + TYPE(C_PTR), INTENT(OUT) :: dst_buf ! Buffer with data + INTEGER :: errcode ! error code + + INTEGER(size_t) :: namelen ! name length + INTEGER(hsize_t) :: i ! general purpose integer INTERFACE INTEGER FUNCTION h5tbread_table_c(loc_id,& -- cgit v0.12 From 77a806591d0aeefc2a6bceb2032e1e98edb40217 Mon Sep 17 00:00:00 2001 From: Scot Breitenfeld Date: Thu, 7 Apr 2016 08:54:48 -0500 Subject: [svn-r29653] fixed A variable that is specified as an argument to the intrinsic procedure C_LOC must either have type and type parameters that are interoperable with a C type, or be a nonpolymorphic, scalar variable with no length type parameters. --- hl/fortran/test/tsttable.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hl/fortran/test/tsttable.F90 b/hl/fortran/test/tsttable.F90 index a87f783..5c55a66 100644 --- a/hl/fortran/test/tsttable.F90 +++ b/hl/fortran/test/tsttable.F90 @@ -628,7 +628,7 @@ SUBROUTINE test_table2() #endif dst_offset(1:nfields) = (/ & - H5OFFSETOF(C_LOC(dst_buf(1)), C_LOC(dst_buf(1)%name)), & + H5OFFSETOF(C_LOC(dst_buf(1)), C_LOC(dst_buf(1)%name(1:1))), & H5OFFSETOF(C_LOC(dst_buf(1)), C_LOC(dst_buf(1)%lati)), & H5OFFSETOF(C_LOC(dst_buf(1)), C_LOC(dst_buf(1)%long)), & H5OFFSETOF(C_LOC(dst_buf(1)), C_LOC(dst_buf(1)%pressure)), & -- cgit v0.12 From f2c3407eb6b429346b623276ed0833e3a5cec1c8 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 7 Apr 2016 09:50:44 -0500 Subject: [svn-r29655] Added H5D_CHUNK_BTREE to the deprecated section of H5Dpublic.h. Tested on: 64-bit Ubuntu 15.10 (build only, not used in existing code) --- src/H5Dpublic.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index a7bd981..7024e15 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -167,6 +167,7 @@ H5_DLL herr_t H5Ddebug(hid_t dset_id); #ifndef H5_NO_DEPRECATED_SYMBOLS /* Macros */ +#define H5D_CHUNK_BTREE H5D_CHUNK_IDX_BTREE /* Typedefs */ -- cgit v0.12 From e5c94192d730bb6cb23e4960c8f0c3165d8518ec Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 7 Apr 2016 13:21:47 -0500 Subject: [svn-r29659] Added fixed array chunk indexing from revise_chunks. Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 Autotools serial w/ Java, Fortran, & C++ --- MANIFEST | 1 + src/H5Dchunk.c | 28 +- src/H5Dfarray.c | 1638 +++++++++++++++++++++++++++++++++++++++++++++++++++++ src/H5Dlayout.c | 29 +- src/H5Dpkg.h | 5 + src/H5Dpublic.h | 9 +- src/H5FA.c | 35 ++ src/H5FAprivate.h | 10 + src/H5Olayout.c | 21 + src/H5Oprivate.h | 21 +- src/H5Pdcpl.c | 2 +- src/H5trace.c | 4 + src/Makefile.am | 2 +- test/dsets.c | 406 +++++++++++++ 14 files changed, 2189 insertions(+), 22 deletions(-) create mode 100644 src/H5Dfarray.c diff --git a/MANIFEST b/MANIFEST index e02f5fb..a8ea13f 100644 --- a/MANIFEST +++ b/MANIFEST @@ -506,6 +506,7 @@ ./src/H5Ddeprec.c ./src/H5Dearray.c ./src/H5Defl.c +./src/H5Dfarray.c ./src/H5Dfill.c ./src/H5Dint.c ./src/H5Dio.c diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 4df493d..c3a3d9d 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -76,6 +76,7 @@ /* Sanity check on chunk index types: commonly used by a lot of routines in this file */ #define H5D_CHUNK_STORAGE_INDEX_CHK(storage) \ HDassert((H5D_CHUNK_IDX_EARRAY == storage->idx_type && H5D_COPS_EARRAY == storage->ops) || \ + (H5D_CHUNK_IDX_FARRAY == storage->idx_type && H5D_COPS_FARRAY == storage->ops) || \ (H5D_CHUNK_IDX_BT2 == storage->idx_type && H5D_COPS_BT2 == storage->ops) || \ (H5D_CHUNK_IDX_BTREE == storage->idx_type && H5D_COPS_BTREE == storage->ops)); @@ -6286,23 +6287,24 @@ H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old /* Actually allocate space for the chunk in the file */ if(alloc_chunk) { - switch(idx_info->storage->idx_type) { - case H5D_CHUNK_IDX_EARRAY: + switch(idx_info->storage->idx_type) { + case H5D_CHUNK_IDX_EARRAY: + case H5D_CHUNK_IDX_FARRAY: case H5D_CHUNK_IDX_BT2: - case H5D_CHUNK_IDX_BTREE: + case H5D_CHUNK_IDX_BTREE: HDassert(new_chunk->length > 0); - H5_CHECK_OVERFLOW(new_chunk->length, /*From: */uint32_t, /*To: */hsize_t); - new_chunk->offset = H5MF_alloc(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, (hsize_t)new_chunk->length); - if(!H5F_addr_defined(new_chunk->offset)) - HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "file allocation failed") + H5_CHECK_OVERFLOW(new_chunk->length, /*From: */uint32_t, /*To: */hsize_t); + new_chunk->offset = H5MF_alloc(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, (hsize_t)new_chunk->length); + if(!H5F_addr_defined(new_chunk->offset)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "file allocation failed") *need_insert = TRUE; - break; + break; - case H5D_CHUNK_IDX_NTYPES: - default: - HDassert(0 && "This should never be executed!"); - break; - } /* end switch */ + case H5D_CHUNK_IDX_NTYPES: + default: + HDassert(0 && "This should never be executed!"); + break; + } /* end switch */ } /* end if */ HDassert(H5F_addr_defined(new_chunk->offset)); diff --git a/src/H5Dfarray.c b/src/H5Dfarray.c new file mode 100644 index 0000000..af60bb1 --- /dev/null +++ b/src/H5Dfarray.c @@ -0,0 +1,1638 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * Copyright by the Board of Trustees of the University of Illinois. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the files COPYING and Copyright.html. COPYING can be found at the root * + * of the source code distribution tree; Copyright.html can be found at the * + * root level of an installed copy of the electronic HDF5 document set and * + * is linked from the top-level documents page. It can also be found at * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + * Purpose: Fixed array indexed (chunked) I/O functions. + * The chunk coordinate is mapped as an index into an array of + * disk addresses for the chunks. + * + */ + +/****************/ +/* Module Setup */ +/****************/ + +#include "H5Dmodule.h" /* This source code file is part of the H5D module */ + + +/***********/ +/* Headers */ +/***********/ +#include "H5private.h" /* Generic Functions */ +#include "H5Dpkg.h" /* Datasets */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FAprivate.h" /* Fixed arrays */ +#include "H5FLprivate.h" /* Free Lists */ +#include "H5MFprivate.h" /* File space management */ +#include "H5VMprivate.h" /* Vector functions */ + + +/****************/ +/* Local Macros */ +/****************/ + +/* Value to fill unset array elements with */ +#define H5D_FARRAY_FILL HADDR_UNDEF +#define H5D_FARRAY_FILT_FILL {HADDR_UNDEF, 0, 0} + + +/******************/ +/* Local Typedefs */ +/******************/ + +/* Fixed array create/open user data */ +typedef struct H5D_farray_ctx_ud_t { + const H5F_t *f; /* Pointer to file info */ + uint32_t chunk_size; /* Size of chunk (bytes) */ +} H5D_farray_ctx_ud_t; + +/* Fixed array callback context */ +typedef struct H5D_farray_ctx_t { + size_t file_addr_len; /* Size of addresses in the file (bytes) */ + size_t chunk_size_len; /* Size of chunk sizes in the file (bytes) */ +} H5D_farray_ctx_t; + +/* User data for chunk deletion callback */ +typedef struct H5D_farray_del_ud_t { + H5F_t *f; /* File pointer for operation */ + hid_t dxpl_id; /* DXPL ID for operation */ + hbool_t filtered; /* Whether the chunks are filtered */ + uint32_t unfilt_size; /* Size of unfiltered chunk in bytes */ +} H5D_farray_del_ud_t; + +/* Fixed Array callback info for iteration over chunks */ +typedef struct H5D_farray_it_ud_t { + H5D_chunk_common_ud_t common; /* Common info for Fixed Array user data (must be first) */ + H5D_chunk_rec_t chunk_rec; /* Generic chunk record for callback */ + hbool_t filtered; /* Whether the chunks are filtered */ + H5D_chunk_cb_func_t cb; /* Chunk callback routine */ + void *udata; /* User data for chunk callback routine */ +} H5D_farray_it_ud_t; + +/* Native fixed array element for chunks w/filters */ +typedef struct H5D_farray_filt_elmt_t { + haddr_t addr; /* Address of chunk */ + uint32_t nbytes; /* Size of chunk (in file) */ + uint32_t filter_mask; /* Excluded filters for chunk */ +} H5D_farray_filt_elmt_t; + + +/********************/ +/* Local Prototypes */ +/********************/ + +/* Fixed Array iterator callbacks */ +static int H5D__farray_idx_iterate_cb(hsize_t idx, const void *_elmt, void *_udata); +static int H5D__farray_idx_delete_cb(hsize_t idx, const void *_elmt, void *_udata); + +/* Fixed array class callbacks for chunks w/o filters */ +static void *H5D__farray_crt_context(void *udata); +static herr_t H5D__farray_dst_context(void *ctx); +static herr_t H5D__farray_fill(void *nat_blk, size_t nelmts); +static herr_t H5D__farray_encode(void *raw, const void *elmt, size_t nelmts, + void *ctx); +static herr_t H5D__farray_decode(const void *raw, void *elmt, size_t nelmts, + void *ctx); +static herr_t H5D__farray_debug(FILE *stream, int indent, int fwidth, + hsize_t idx, const void *elmt); +static void *H5D__farray_crt_dbg_context(H5F_t *f, hid_t dxpl_id, + haddr_t obj_addr); +static herr_t H5D__farray_dst_dbg_context(void *dbg_ctx); + +/* Fixed array class callbacks for chunks w/filters */ +/* (some shared with callbacks for chunks w/o filters) */ +static herr_t H5D__farray_filt_fill(void *nat_blk, size_t nelmts); +static herr_t H5D__farray_filt_encode(void *raw, const void *elmt, size_t nelmts, + void *ctx); +static herr_t H5D__farray_filt_decode(const void *raw, void *elmt, size_t nelmts, + void *ctx); +static herr_t H5D__farray_filt_debug(FILE *stream, int indent, int fwidth, + hsize_t idx, const void *elmt); + +/* Chunked layout indexing callbacks */ +static herr_t H5D__farray_idx_init(const H5D_chk_idx_info_t *idx_info, + const H5S_t *space, haddr_t dset_ohdr_addr); +static herr_t H5D__farray_idx_create(const H5D_chk_idx_info_t *idx_info); +static hbool_t H5D__farray_idx_is_space_alloc(const H5O_storage_chunk_t *storage); +static herr_t H5D__farray_idx_insert(const H5D_chk_idx_info_t *idx_info, + H5D_chunk_ud_t *udata, const H5D_t *dset); +static herr_t H5D__farray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, + H5D_chunk_ud_t *udata); +static int H5D__farray_idx_iterate(const H5D_chk_idx_info_t *idx_info, + H5D_chunk_cb_func_t chunk_cb, void *chunk_udata); +static herr_t H5D__farray_idx_remove(const H5D_chk_idx_info_t *idx_info, + H5D_chunk_common_ud_t *udata); +static herr_t H5D__farray_idx_delete(const H5D_chk_idx_info_t *idx_info); +static herr_t H5D__farray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, + const H5D_chk_idx_info_t *idx_info_dst); +static herr_t H5D__farray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, + H5O_storage_chunk_t *storage_dst, hid_t dxpl_id); +static herr_t H5D__farray_idx_size(const H5D_chk_idx_info_t *idx_info, + hsize_t *size); +static herr_t H5D__farray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr); +static herr_t H5D__farray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream); +static herr_t H5D__farray_idx_dest(const H5D_chk_idx_info_t *idx_info); + +/* Generic extensible array routines */ +static herr_t H5D__farray_idx_open(const H5D_chk_idx_info_t *idx_info); + +/*********************/ +/* Package Variables */ +/*********************/ + +/* Fixed array indexed chunk I/O ops */ +const H5D_chunk_ops_t H5D_COPS_FARRAY[1] = {{ + H5D__farray_idx_init, /* init */ + H5D__farray_idx_create, /* create */ + H5D__farray_idx_is_space_alloc, /* is_space_alloc */ + H5D__farray_idx_insert, /* insert */ + H5D__farray_idx_get_addr, /* get_addr */ + NULL, /* resize */ + H5D__farray_idx_iterate, /* iterate */ + H5D__farray_idx_remove, /* remove */ + H5D__farray_idx_delete, /* delete */ + H5D__farray_idx_copy_setup, /* copy_setup */ + H5D__farray_idx_copy_shutdown, /* copy_shutdown */ + H5D__farray_idx_size, /* size */ + H5D__farray_idx_reset, /* reset */ + H5D__farray_idx_dump, /* dump */ + H5D__farray_idx_dest /* destroy */ +}}; + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + +/* Fixed array class callbacks for dataset chunks w/o filters */ +const H5FA_class_t H5FA_CLS_CHUNK[1]={{ + H5FA_CLS_CHUNK_ID, /* Type of fixed array */ + "Chunk w/o filters", /* Name of fixed array class */ + sizeof(haddr_t), /* Size of native element */ + H5D__farray_crt_context, /* Create context */ + H5D__farray_dst_context, /* Destroy context */ + H5D__farray_fill, /* Fill block of missing elements callback */ + H5D__farray_encode, /* Element encoding callback */ + H5D__farray_decode, /* Element decoding callback */ + H5D__farray_debug, /* Element debugging callback */ + H5D__farray_crt_dbg_context, /* Create debugging context */ + H5D__farray_dst_dbg_context /* Destroy debugging context */ +}}; + +/* Fixed array class callbacks for dataset chunks w/filters */ +const H5FA_class_t H5FA_CLS_FILT_CHUNK[1]={{ + H5FA_CLS_FILT_CHUNK_ID, /* Type of fixed array */ + "Chunk w/filters", /* Name of fixed array class */ + sizeof(H5D_farray_filt_elmt_t), /* Size of native element */ + H5D__farray_crt_context, /* Create context */ + H5D__farray_dst_context, /* Destroy context */ + H5D__farray_filt_fill, /* Fill block of missing elements callback */ + H5D__farray_filt_encode, /* Element encoding callback */ + H5D__farray_filt_decode, /* Element decoding callback */ + H5D__farray_filt_debug, /* Element debugging callback */ + H5D__farray_crt_dbg_context, /* Create debugging context */ + H5D__farray_dst_dbg_context /* Destroy debugging context */ +}}; + +/* Declare a free list to manage the H5D_farray_ctx_t struct */ +H5FL_DEFINE_STATIC(H5D_farray_ctx_t); + +/* Declare a free list to manage the H5D_farray_ctx_ud_t struct */ +H5FL_DEFINE_STATIC(H5D_farray_ctx_ud_t); + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_crt_context + * + * Purpose: Create context for callbacks + * + * Return: Success: non-NULL + * Failure: NULL + * + * Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + *------------------------------------------------------------------------- + */ +static void * +H5D__farray_crt_context(void *_udata) +{ + H5D_farray_ctx_t *ctx; /* Fixed array callback context */ + H5D_farray_ctx_ud_t *udata = (H5D_farray_ctx_ud_t *)_udata; /* User data for fixed array context */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(udata); + HDassert(udata->f); + HDassert(udata->chunk_size > 0); + + /* Allocate new context structure */ + if(NULL == (ctx = H5FL_MALLOC(H5D_farray_ctx_t))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate fixed array client callback context") + + /* Initialize the context */ + ctx->file_addr_len = H5F_SIZEOF_ADDR(udata->f); + + /* Compute the size required for encoding the size of a chunk, allowing + * for an extra byte, in case the filter makes the chunk larger. + */ + ctx->chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)udata->chunk_size) + 8) / 8); + if(ctx->chunk_size_len > 8) + ctx->chunk_size_len = 8; + + /* Set return value */ + ret_value = ctx; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__farray_crt_context() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_dst_context + * + * Purpose: Destroy context for callbacks + * + * Return: Success: non-NULL + * Failure: NULL + * + * Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__farray_dst_context(void *_ctx) +{ + H5D_farray_ctx_t *ctx = (H5D_farray_ctx_t *)_ctx; /* Fixed array callback context */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(ctx); + + /* Release context structure */ + ctx = H5FL_FREE(H5D_farray_ctx_t, ctx); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__farray_dst_context() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_fill + * + * Purpose: Fill "missing elements" in block of elements + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__farray_fill(void *nat_blk, size_t nelmts) +{ + haddr_t fill_val = H5D_FARRAY_FILL; /* Value to fill elements with */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(nat_blk); + HDassert(nelmts); + + H5VM_array_fill(nat_blk, &fill_val, H5FA_CLS_CHUNK->nat_elmt_size, nelmts); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__farray_fill() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_encode + * + * Purpose: Encode an element from "native" to "raw" form + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__farray_encode(void *raw, const void *_elmt, size_t nelmts, void *_ctx) +{ + H5D_farray_ctx_t *ctx = (H5D_farray_ctx_t *)_ctx; /* Fixed array callback context */ + const haddr_t *elmt = (const haddr_t *)_elmt; /* Convenience pointer to native elements */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(raw); + HDassert(elmt); + HDassert(nelmts); + HDassert(ctx); + + /* Encode native elements into raw elements */ + while(nelmts) { + /* Encode element */ + /* (advances 'raw' pointer) */ + H5F_addr_encode_len(ctx->file_addr_len, (uint8_t **)&raw, *elmt); + + /* Advance native element pointer */ + elmt++; + + /* Decrement # of elements to encode */ + nelmts--; + } /* end while */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__farray_encode() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_decode + * + * Purpose: Decode an element from "raw" to "native" form + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__farray_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx) +{ + H5D_farray_ctx_t *ctx = (H5D_farray_ctx_t *)_ctx; /* Fixed array callback context */ + haddr_t *elmt = (haddr_t *)_elmt; /* Convenience pointer to native elements */ + const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(raw); + HDassert(elmt); + HDassert(nelmts); + + /* Decode raw elements into native elements */ + while(nelmts) { + /* Decode element */ + /* (advances 'raw' pointer) */ + H5F_addr_decode_len(ctx->file_addr_len, &raw, elmt); + + /* Advance native element pointer */ + elmt++; + + /* Decrement # of elements to decode */ + nelmts--; + } /* end while */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__farray_decode() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_debug + * + * Purpose: Display an element for debugging + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__farray_debug(FILE *stream, int indent, int fwidth, hsize_t idx, + const void *elmt) +{ + char temp_str[128]; /* Temporary string, for formatting */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(stream); + HDassert(elmt); + + /* Print element */ + sprintf(temp_str, "Element #%llu:", (unsigned long long)idx); + HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, temp_str, + *(const haddr_t *)elmt); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__farray_debug() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_crt_dbg_context + * + * Purpose: Create context for debugging callback + * (get the layout message in the specified object header) + * + * Return: Success: non-NULL + * Failure: NULL + * + * Programmer: Vailin Choi + * 5th August, 2009 + * + *------------------------------------------------------------------------- + */ +static void * +H5D__farray_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t obj_addr) +{ + H5D_farray_ctx_ud_t *dbg_ctx = NULL; /* Context for fixed array callback */ + H5O_loc_t obj_loc; /* Pointer to an object's location */ + hbool_t obj_opened = FALSE; /* Flag to indicate that the object header was opened */ + H5O_layout_t layout; /* Layout message */ + void *ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(f); + HDassert(H5F_addr_defined(obj_addr)); + + /* Allocate context for debugging callback */ + if(NULL == (dbg_ctx = H5FL_MALLOC(H5D_farray_ctx_ud_t))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate fixed array client callback context") + + /* Set up the object header location info */ + H5O_loc_reset(&obj_loc); + obj_loc.file = f; + obj_loc.addr = obj_addr; + + /* Open the object header where the layout message resides */ + if(H5O_open(&obj_loc) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, NULL, "can't open object header") + obj_opened = TRUE; + + /* Read the layout message */ + if(NULL == H5O_msg_read(&obj_loc, H5O_LAYOUT_ID, &layout, dxpl_id)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, NULL, "can't get layout info") + + /* close the object header */ + if(H5O_close(&obj_loc) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, NULL, "can't close object header") + + /* Create user data */ + dbg_ctx->f = f; + dbg_ctx->chunk_size = layout.u.chunk.size; + + /* Set return value */ + ret_value = dbg_ctx; + +done: + /* Cleanup on error */ + if(ret_value == NULL) { + /* Release context structure */ + if(dbg_ctx) + dbg_ctx = H5FL_FREE(H5D_farray_ctx_ud_t, dbg_ctx); + + /* Close object header */ + if(obj_opened) { + if(H5O_close(&obj_loc) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, NULL, "can't close object header") + } /* end if */ + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__farray_crt_dbg_context() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_dst_dbg_context + * + * Purpose: Destroy context for debugging callback + * (free the layout message from the specified object header) + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * 24th September, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__farray_dst_dbg_context(void *_dbg_ctx) +{ + H5D_farray_ctx_ud_t *dbg_ctx = (H5D_farray_ctx_ud_t *)_dbg_ctx; /* Context for fixed array callback */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(dbg_ctx); + + /* Release context structure */ + dbg_ctx = H5FL_FREE(H5D_farray_ctx_ud_t, dbg_ctx); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__farray_dst_dbg_context() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_filt_fill + * + * Purpose: Fill "missing elements" in block of elements + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__farray_filt_fill(void *nat_blk, size_t nelmts) +{ + H5D_farray_filt_elmt_t fill_val = H5D_FARRAY_FILT_FILL; /* Value to fill elements with */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(nat_blk); + HDassert(nelmts); + HDassert(sizeof(fill_val) == H5FA_CLS_FILT_CHUNK->nat_elmt_size); + + H5VM_array_fill(nat_blk, &fill_val, H5FA_CLS_FILT_CHUNK->nat_elmt_size, nelmts); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__farray_filt_fill() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_filt_encode + * + * Purpose: Encode an element from "native" to "raw" form + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__farray_filt_encode(void *_raw, const void *_elmt, size_t nelmts, void *_ctx) +{ + H5D_farray_ctx_t *ctx = (H5D_farray_ctx_t *)_ctx; /* Fixed array callback context */ + uint8_t *raw = (uint8_t *)_raw; /* Convenience pointer to raw elements */ + const H5D_farray_filt_elmt_t *elmt = (const H5D_farray_filt_elmt_t *)_elmt; /* Convenience pointer to native elements */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(raw); + HDassert(elmt); + HDassert(nelmts); + HDassert(ctx); + + /* Encode native elements into raw elements */ + while(nelmts) { + /* Encode element */ + /* (advances 'raw' pointer) */ + H5F_addr_encode_len(ctx->file_addr_len, &raw, elmt->addr); + UINT64ENCODE_VAR(raw, elmt->nbytes, ctx->chunk_size_len); + UINT32ENCODE(raw, elmt->filter_mask); + + /* Advance native element pointer */ + elmt++; + + /* Decrement # of elements to encode */ + nelmts--; + } /* end while */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__farray_filt_encode() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_filt_decode + * + * Purpose: Decode an element from "raw" to "native" form + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__farray_filt_decode(const void *_raw, void *_elmt, size_t nelmts, void *_ctx) +{ + H5D_farray_ctx_t *ctx = (H5D_farray_ctx_t *)_ctx; /* Fixed array callback context */ + H5D_farray_filt_elmt_t *elmt = (H5D_farray_filt_elmt_t *)_elmt; /* Convenience pointer to native elements */ + const uint8_t *raw = (const uint8_t *)_raw; /* Convenience pointer to raw elements */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(raw); + HDassert(elmt); + HDassert(nelmts); + + /* Decode raw elements into native elements */ + while(nelmts) { + /* Decode element */ + /* (advances 'raw' pointer) */ + H5F_addr_decode_len(ctx->file_addr_len, &raw, &elmt->addr); + UINT64DECODE_VAR(raw, elmt->nbytes, ctx->chunk_size_len); + UINT32DECODE(raw, elmt->filter_mask); + + /* Advance native element pointer */ + elmt++; + + /* Decrement # of elements to decode */ + nelmts--; + } /* end while */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__farray_filt_decode() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_filt_debug + * + * Purpose: Display an element for debugging + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__farray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, + const void *_elmt) +{ + const H5D_farray_filt_elmt_t *elmt = (const H5D_farray_filt_elmt_t *)_elmt; /* Convenience pointer to native elements */ + char temp_str[128]; /* Temporary string, for formatting */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity checks */ + HDassert(stream); + HDassert(elmt); + + /* Print element */ + sprintf(temp_str, "Element #%llu:", (unsigned long long)idx); + HDfprintf(stream, "%*s%-*s {%a, %u, %0x}\n", indent, "", fwidth, temp_str, + elmt->addr, elmt->nbytes, elmt->filter_mask); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__farray_filt_debug() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_idx_init + * + * Purpose: Initialize the indexing information for a dataset. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Neil Fortner + * Wednensday, May 23, 2012 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__farray_idx_init(const H5D_chk_idx_info_t *idx_info, const H5S_t H5_ATTR_UNUSED *space, haddr_t dset_ohdr_addr) +{ + FUNC_ENTER_STATIC_NOERR + + /* Check args */ + HDassert(idx_info); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(dset_ohdr_addr)); + + idx_info->storage->u.farray.dset_ohdr_addr = dset_ohdr_addr; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__farray_idx_init() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_idx_open + * + * Purpose: Opens an existing fixed array and initializes + * the layout struct with information about the storage. + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__farray_idx_open(const H5D_chk_idx_info_t *idx_info) +{ + H5D_farray_ctx_ud_t udata; /* User data for fixed array open call */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check args */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(H5D_CHUNK_IDX_FARRAY == idx_info->layout->idx_type); + HDassert(idx_info->storage); + HDassert(H5D_CHUNK_IDX_FARRAY == idx_info->storage->idx_type); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(NULL == idx_info->storage->u.farray.fa); + + /* Set up the user data */ + udata.f = idx_info->f; + udata.chunk_size = idx_info->layout->size; + + /* Open the fixed array for the chunk index */ + if(NULL == (idx_info->storage->u.farray.fa = H5FA_open(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, &udata))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't open fixed array") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__farray_idx_open() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_idx_create + * + * Purpose: Creates a new indexed-storage fixed array and initializes + * the layout struct with information about the storage. The + * struct should be immediately written to the object header. + * + * This function must be called before passing LAYOUT to any of + * the other indexed storage functions! + * + * Return: Non-negative on success (with the LAYOUT argument initialized + * and ready to write to an object header). Negative on failure. + * + * Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__farray_idx_create(const H5D_chk_idx_info_t *idx_info) +{ + H5FA_create_t cparam; /* Fixed array creation parameters */ + H5D_farray_ctx_ud_t udata; /* User data for fixed array create call */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check args */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(idx_info->storage); + HDassert(!H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(NULL == idx_info->storage->u.farray.fa); + HDassert(idx_info->layout->nchunks); + + /* General parameters */ + if(idx_info->pline->nused > 0) { + unsigned chunk_size_len; /* Size of encoded chunk size */ + + /* Compute the size required for encoding the size of a chunk, allowing + * for an extra byte, in case the filter makes the chunk larger. + */ + chunk_size_len = 1 + ((H5VM_log2_gen((uint64_t)idx_info->layout->size) + 8) / 8); + if(chunk_size_len > 8) + chunk_size_len = 8; + + cparam.cls = H5FA_CLS_FILT_CHUNK; + cparam.raw_elmt_size = (uint8_t)(H5F_SIZEOF_ADDR(idx_info->f) + chunk_size_len + 4); + } /* end if */ + else { + cparam.cls = H5FA_CLS_CHUNK; + cparam.raw_elmt_size = (uint8_t)H5F_SIZEOF_ADDR(idx_info->f); + } /* end else */ + cparam.max_dblk_page_nelmts_bits = idx_info->layout->u.farray.cparam.max_dblk_page_nelmts_bits; + HDassert(cparam.max_dblk_page_nelmts_bits > 0); + cparam.nelmts = idx_info->layout->max_nchunks; + + /* Set up the user data */ + udata.f = idx_info->f; + udata.chunk_size = idx_info->layout->size; + + /* Create the fixed array for the chunk index */ + if(NULL == (idx_info->storage->u.farray.fa = H5FA_create(idx_info->f, idx_info->dxpl_id, &cparam, &udata))) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't create fixed array") + + /* Get the address of the fixed array in file */ + if(H5FA_get_addr(idx_info->storage->u.farray.fa, &(idx_info->storage->idx_addr)) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query fixed array address") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__farray_idx_create() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_idx_is_space_alloc + * + * Purpose: Query if space is allocated for index method + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + *------------------------------------------------------------------------- + */ +static hbool_t +H5D__farray_idx_is_space_alloc(const H5O_storage_chunk_t *storage) +{ + FUNC_ENTER_STATIC_NOERR + + /* Check args */ + HDassert(storage); + + FUNC_LEAVE_NOAPI((hbool_t)H5F_addr_defined(storage->idx_addr)) +} /* end H5D__farray_idx_is_space_alloc() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_idx_insert + * + * Purpose: Insert chunk address into the indexing structure. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi; 5 May 2014 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__farray_idx_insert(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata, + const H5D_t H5_ATTR_UNUSED *dset) +{ + H5FA_t *fa; /* Pointer to fixed array structure */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(udata); + + /* Check if the fixed array is open yet */ + if(NULL == idx_info->storage->u.farray.fa) { + /* Open the fixed array in file */ + if(H5D__farray_idx_open(idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") + } else /* Patch the top level file pointer contained in fa if needed */ + H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f); + + /* Set convenience pointer to fixed array structure */ + fa = idx_info->storage->u.farray.fa; + + if(!H5F_addr_defined(udata->chunk_block.offset)) + HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "The chunk should have allocated already") + if(udata->chunk_idx != (udata->chunk_idx & 0xffffffff)) /* negative value */ + HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "chunk index must be less than 2^32") + + /* Check for filters on chunks */ + if(idx_info->pline->nused > 0) { + H5D_farray_filt_elmt_t elmt; /* Fixed array element */ + + elmt.addr = udata->chunk_block.offset; + H5_CHECKED_ASSIGN(elmt.nbytes, uint32_t, udata->chunk_block.length, hsize_t); + elmt.filter_mask = udata->filter_mask; + + /* Set the info for the chunk */ + if(H5FA_set(fa, idx_info->dxpl_id, udata->chunk_idx, &elmt) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk info") + } /* end if */ + else { + /* Set the address for the chunk */ + if(H5FA_set(fa, idx_info->dxpl_id, udata->chunk_idx, &udata->chunk_block.offset) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set chunk address") + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__farray_idx_insert() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_idx_get_addr + * + * Purpose: Get the file address of a chunk if file space has been + * assigned. Save the retrieved information in the udata + * supplied. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__farray_idx_get_addr(const H5D_chk_idx_info_t *idx_info, H5D_chunk_ud_t *udata) +{ + H5FA_t *fa; /* Pointer to fixed array structure */ + hsize_t idx; /* Array index of chunk */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(udata); + + /* Check if the fixed array is open yet */ + if(NULL == idx_info->storage->u.farray.fa) { + /* Open the fixed array in file */ + if(H5D__farray_idx_open(idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") + } else /* Patch the top level file pointer contained in fa if needed */ + H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f); + + /* Set convenience pointer to fixed array structure */ + fa = idx_info->storage->u.farray.fa; + + /* Calculate the index of this chunk */ + idx = H5VM_array_offset_pre((idx_info->layout->ndims - 1), idx_info->layout->max_down_chunks, udata->common.scaled); + + udata->chunk_idx = idx; + + /* Check for filters on chunks */ + if(idx_info->pline->nused > 0) { + H5D_farray_filt_elmt_t elmt; /* Fixed array element */ + + /* Get the information for the chunk */ + if(H5FA_get(fa, idx_info->dxpl_id, idx, &elmt) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info") + + /* Set the info for the chunk */ + udata->chunk_block.offset = elmt.addr; + udata->chunk_block.length = elmt.nbytes; + udata->filter_mask = elmt.filter_mask; + } /* end if */ + else { + /* Get the address for the chunk */ + if(H5FA_get(fa, idx_info->dxpl_id, idx, &udata->chunk_block.offset) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address") + + /* Update the other (constant) information for the chunk */ + udata->chunk_block.length = idx_info->layout->size; + udata->filter_mask = 0; + } /* end else */ + + if(!H5F_addr_defined(udata->chunk_block.offset)) + udata->chunk_block.length = 0; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__farray_idx_get_addr() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_idx_iterate_cb + * + * Purpose: Callback routine for fixed array element iteration. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + *------------------------------------------------------------------------- + */ +static int +H5D__farray_idx_iterate_cb(hsize_t H5_ATTR_UNUSED idx, const void *_elmt, void *_udata) +{ + H5D_farray_it_ud_t *udata = (H5D_farray_it_ud_t *)_udata; /* User data */ + unsigned ndims; /* Rank of chunk */ + int curr_dim; /* Current dimension */ + int ret_value = H5_ITER_CONT; /* Return value */ + + FUNC_ENTER_STATIC_NOERR + + /* Compose generic chunk record for callback */ + if(udata->filtered) { + const H5D_farray_filt_elmt_t *filt_elmt = (const H5D_farray_filt_elmt_t *)_elmt; + + udata->chunk_rec.chunk_addr = filt_elmt->addr; + udata->chunk_rec.nbytes = filt_elmt->nbytes; + udata->chunk_rec.filter_mask = filt_elmt->filter_mask; + } /* end if */ + else + udata->chunk_rec.chunk_addr = *(const haddr_t *)_elmt; + + /* Make "generic chunk" callback */ + if(H5F_addr_defined(udata->chunk_rec.chunk_addr)) + if((ret_value = (udata->cb)(&udata->chunk_rec, udata->udata)) < 0) + HERROR(H5E_DATASET, H5E_CALLBACK, "failure in generic chunk iterator callback"); + + /* Update coordinates of chunk in dataset */ + ndims = udata->common.layout->ndims - 1; + HDassert(ndims > 0); + curr_dim = (int)(ndims - 1); + while(curr_dim >= 0) { + /* Increment coordinate in current dimension */ + udata->chunk_rec.scaled[curr_dim]++; + + /* Check if we went off the end of the current dimension */ + if(udata->chunk_rec.scaled[curr_dim] >= udata->common.layout->chunks[curr_dim]) { + /* Reset coordinate & move to next faster dimension */ + udata->chunk_rec.scaled[curr_dim] = 0; + curr_dim--; + } /* end if */ + else + break; + } /* end while */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__farray_idx_iterate_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_idx_iterate + * + * Purpose: Iterate over the chunks in an index, making a callback + * for each one. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + *------------------------------------------------------------------------- + */ +static int +H5D__farray_idx_iterate(const H5D_chk_idx_info_t *idx_info, + H5D_chunk_cb_func_t chunk_cb, void *chunk_udata) +{ + H5FA_t *fa; /* Pointer to fixed array structure */ + H5FA_stat_t fa_stat; /* Fixed array statistics */ + int ret_value = FAIL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(chunk_cb); + HDassert(chunk_udata); + + /* Check if the fixed array is open yet */ + if(NULL == idx_info->storage->u.farray.fa) { + /* Open the fixed array in file */ + if(H5D__farray_idx_open(idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") + } else /* Patch the top level file pointer contained in fa if needed */ + H5FA_patch_file(idx_info->storage->u.farray.fa, idx_info->f); + + /* Set convenience pointer to fixed array structure */ + fa = idx_info->storage->u.farray.fa; + + /* Get the fixed array statistics */ + if(H5FA_get_stats(fa, &fa_stat) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query fixed array statistics") + + /* Check if there are any array elements */ + if(fa_stat.nelmts > 0) { + H5D_farray_it_ud_t udata; /* User data for iteration callback */ + + /* Initialize userdata */ + HDmemset(&udata, 0, sizeof udata); + udata.common.layout = idx_info->layout; + udata.common.storage = idx_info->storage; + HDmemset(&udata.chunk_rec, 0, sizeof(udata.chunk_rec)); + udata.filtered = (idx_info->pline->nused > 0); + if(!udata.filtered) { + udata.chunk_rec.nbytes = idx_info->layout->size; + udata.chunk_rec.filter_mask = 0; + } /* end if */ + udata.cb = chunk_cb; + udata.udata = chunk_udata; + + /* Iterate over the fixed array elements */ + if((ret_value = H5FA_iterate(fa, idx_info->dxpl_id, H5D__farray_idx_iterate_cb, &udata)) < 0) + HERROR(H5E_DATASET, H5E_BADITER, "unable to iterate over fixed array chunk index"); + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__farray_idx_iterate() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_idx_remove + * + * Purpose: Remove chunk from index. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__farray_idx_remove(const H5D_chk_idx_info_t *idx_info, H5D_chunk_common_ud_t *udata) +{ + H5FA_t *fa; /* Pointer to fixed array structure */ + hsize_t idx; /* Array index of chunk */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(udata); + + /* Check if the fixed array is open yet */ + if(NULL == idx_info->storage->u.farray.fa) + /* Open the fixed array in file */ + if(H5D__farray_idx_open(idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") + + /* Set convenience pointer to fixed array structure */ + fa = idx_info->storage->u.farray.fa; + + /* Calculate the index of this chunk */ + idx = H5VM_array_offset_pre((idx_info->layout->ndims - 1), idx_info->layout->max_down_chunks, udata->scaled); + + /* Check for filters on chunks */ + if(idx_info->pline->nused > 0) { + H5D_farray_filt_elmt_t elmt; /* Fixed array element */ + + /* Get the info about the chunk for the index */ + if(H5FA_get(fa, idx_info->dxpl_id, idx, &elmt) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info") + + /* Remove raw data chunk from file */ + HDassert(H5F_addr_defined(elmt.addr)); + H5_CHECK_OVERFLOW(elmt.nbytes, /*From: */uint32_t, /*To: */hsize_t); + if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, elmt.addr, (hsize_t)elmt.nbytes) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk") + + /* Reset the info about the chunk for the index */ + elmt.addr = HADDR_UNDEF; + elmt.nbytes = 0; + elmt.filter_mask = 0; + if(H5FA_set(fa, idx_info->dxpl_id, idx, &elmt) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to reset chunk info") + } /* end if */ + else { + haddr_t addr = HADDR_UNDEF; /* Chunk address */ + + /* Get the address of the chunk for the index */ + if(H5FA_get(fa, idx_info->dxpl_id, idx, &addr) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk address") + + /* Remove raw data chunk from file */ + HDassert(H5F_addr_defined(addr)); + H5_CHECK_OVERFLOW(idx_info->layout->size, /*From: */uint32_t, /*To: */hsize_t); + if(H5MF_xfree(idx_info->f, H5FD_MEM_DRAW, idx_info->dxpl_id, addr, (hsize_t)idx_info->layout->size) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to free chunk") + + /* Reset the address of the chunk for the index */ + addr = HADDR_UNDEF; + if(H5FA_set(fa, idx_info->dxpl_id, idx, &addr) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to reset chunk address") + } /* end else */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* H5D__farray_idx_remove() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_idx_delete_cb + * + * Purpose: Delete space for chunk in file + * + * Return: Success: Non-negative + * Failure: negative + * + * Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + *------------------------------------------------------------------------- + */ +static int +H5D__farray_idx_delete_cb(hsize_t H5_ATTR_UNUSED idx, const void *_elmt, void *_udata) +{ + H5D_farray_del_ud_t *udata = (H5D_farray_del_ud_t *)_udata; /* User data for callback */ + haddr_t chunk_addr; /* Address of chunk */ + uint32_t nbytes; /* Size of chunk */ + int ret_value = H5_ITER_CONT; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(_elmt); + HDassert(udata); + HDassert(udata->f); + + /* Check for filtered elements */ + if(udata->filtered) { + const H5D_farray_filt_elmt_t *filt_elmt = (const H5D_farray_filt_elmt_t *)_elmt; + + chunk_addr = filt_elmt->addr; + nbytes = filt_elmt->nbytes; + } /* end if */ + else { + chunk_addr = *(const haddr_t *)_elmt; + nbytes = udata->unfilt_size; + } /* end else */ + + /* Remove raw data chunk from file */ + H5_CHECK_OVERFLOW(nbytes, /*From: */uint32_t, /*To: */hsize_t); + if(H5MF_xfree(udata->f, H5FD_MEM_DRAW, udata->dxpl_id, chunk_addr, (hsize_t)nbytes) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, H5_ITER_ERROR, "unable to free chunk") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__farray_idx_delete_cb() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_idx_delete + * + * Purpose: Delete index and raw data storage for entire dataset + * (i.e. all chunks) + * + * Return: Success: Non-negative + * Failure: negative + * + * Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__farray_idx_delete(const H5D_chk_idx_info_t *idx_info) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(idx_info->storage); + + /* Check if the index data structure has been allocated */ + if(H5F_addr_defined(idx_info->storage->idx_addr)) { + H5FA_t *fa; /* Pointer to fixed array structure */ + H5FA_stat_t fa_stat; /* Fixed array statistics */ + H5D_farray_ctx_ud_t ctx_udata; /* User data for fixed array open call */ + + /* Check if the fixed array is open yet */ + if(NULL == idx_info->storage->u.farray.fa) + /* Open the fixed array in file */ + if(H5D__farray_idx_open(idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") + + /* Set convenience pointer to fixed array structure */ + fa = idx_info->storage->u.farray.fa; + + /* Get the fixed array statistics */ + if(H5FA_get_stats(fa, &fa_stat) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query fixed array statistics") + + /* Check if there are any array elements */ + if(fa_stat.nelmts > 0) { + H5D_farray_del_ud_t udata; /* User data for callback */ + + /* Initialize user data for callback */ + udata.f = idx_info->f; + udata.dxpl_id = idx_info->dxpl_id; + udata.filtered = (idx_info->pline->nused > 0); + udata.unfilt_size = idx_info->layout->size; + + /* Iterate over the chunk addresses in the fixed array, deleting each chunk */ + if(H5FA_iterate(fa, idx_info->dxpl_id, H5D__farray_idx_delete_cb, &udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to iterate over chunk addresses") + } /* end if */ + + /* Close fixed array */ + if(H5FA_close(idx_info->storage->u.farray.fa, idx_info->dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array") + idx_info->storage->u.farray.fa = NULL; + + /* Set up the user data */ + ctx_udata.f = idx_info->f; + ctx_udata.chunk_size = idx_info->layout->size; + + /* Delete fixed array */ + if(H5FA_delete(idx_info->f, idx_info->dxpl_id, idx_info->storage->idx_addr, &ctx_udata) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTDELETE, FAIL, "unable to delete chunk fixed array") + idx_info->storage->idx_addr = HADDR_UNDEF; + } /* end if */ + else + HDassert(NULL == idx_info->storage->u.farray.fa); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__farray_idx_delete() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_idx_copy_setup + * + * Purpose: Set up any necessary information for copying chunks + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__farray_idx_copy_setup(const H5D_chk_idx_info_t *idx_info_src, + const H5D_chk_idx_info_t *idx_info_dst) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check args */ + HDassert(idx_info_src); + HDassert(idx_info_src->f); + HDassert(idx_info_src->pline); + HDassert(idx_info_src->layout); + HDassert(idx_info_src->storage); + HDassert(idx_info_dst); + HDassert(idx_info_dst->f); + HDassert(idx_info_dst->pline); + HDassert(idx_info_dst->layout); + HDassert(idx_info_dst->storage); + HDassert(!H5F_addr_defined(idx_info_dst->storage->idx_addr)); + + /* Check if the source fixed array is open yet */ + if(NULL == idx_info_src->storage->u.farray.fa) + /* Open the fixed array in file */ + if(H5D__farray_idx_open(idx_info_src) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") + + /* Set copied metadata tag */ + H5_BEGIN_TAG(idx_info_dst->dxpl_id, H5AC__COPIED_TAG, FAIL); + + /* Create the fixed array that describes chunked storage in the dest. file */ + if(H5D__farray_idx_create(idx_info_dst) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to initialize chunked storage") + HDassert(H5F_addr_defined(idx_info_dst->storage->idx_addr)); + + /* Reset metadata tag */ + H5_END_TAG(FAIL); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__farray_idx_copy_setup() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_idx_copy_shutdown + * + * Purpose: Shutdown any information from copying chunks + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__farray_idx_copy_shutdown(H5O_storage_chunk_t *storage_src, + H5O_storage_chunk_t *storage_dst, hid_t dxpl_id) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check args */ + HDassert(storage_src); + HDassert(storage_src->u.farray.fa); + HDassert(storage_dst); + HDassert(storage_dst->u.farray.fa); + + /* Close fixed arrays */ + if(H5FA_close(storage_src->u.farray.fa, dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array") + storage_src->u.farray.fa = NULL; + if(H5FA_close(storage_dst->u.farray.fa, dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array") + storage_dst->u.farray.fa = NULL; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__farray_idx_copy_shutdown() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_idx_size + * + * Purpose: Retrieve the amount of index storage for chunked dataset + * + * Return: Success: Non-negative + * Failure: negative + * + * Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__farray_idx_size(const H5D_chk_idx_info_t *idx_info, hsize_t *index_size) +{ + H5FA_t *fa; /* Pointer to fixed array structure */ + H5FA_stat_t fa_stat; /* Fixed array statistics */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check args */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->pline); + HDassert(idx_info->layout); + HDassert(idx_info->storage); + HDassert(H5F_addr_defined(idx_info->storage->idx_addr)); + HDassert(index_size); + + /* Open the fixed array in file */ + if(H5D__farray_idx_open(idx_info) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTOPENOBJ, FAIL, "can't open fixed array") + + /* Set convenience pointer to fixed array structure */ + fa = idx_info->storage->u.farray.fa; + + /* Get the fixed array statistics */ + if(H5FA_get_stats(fa, &fa_stat) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't query fixed array statistics") + + *index_size = fa_stat.hdr_size; + *index_size += fa_stat.dblk_size; + +done: + if(idx_info->storage->u.farray.fa) { + if(H5FA_close(idx_info->storage->u.farray.fa, idx_info->dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array") + idx_info->storage->u.farray.fa = NULL; + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__farray_idx_size() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_idx_reset + * + * Purpose: Reset indexing information. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__farray_idx_reset(H5O_storage_chunk_t *storage, hbool_t reset_addr) +{ + FUNC_ENTER_STATIC_NOERR + + /* Check args */ + HDassert(storage); + + /* Reset index info */ + if(reset_addr) + storage->idx_addr = HADDR_UNDEF; + storage->u.farray.fa = NULL; + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__farray_idx_reset() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_idx_dump + * + * Purpose: Dump indexing information to a stream. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__farray_idx_dump(const H5O_storage_chunk_t *storage, FILE *stream) +{ + FUNC_ENTER_STATIC_NOERR + + /* Check args */ + HDassert(storage); + HDassert(stream); + + HDfprintf(stream, " Address: %a\n", storage->idx_addr); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5D__farray_idx_dump() */ + + +/*------------------------------------------------------------------------- + * Function: H5D__farray_idx_dest + * + * Purpose: Release indexing information in memory. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Vailin Choi + * Thursday, April 30, 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +H5D__farray_idx_dest(const H5D_chk_idx_info_t *idx_info) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check args */ + HDassert(idx_info); + HDassert(idx_info->f); + HDassert(idx_info->storage); + + /* Check if the fixed array is open */ + if(idx_info->storage->u.farray.fa) { + /* Close fixed array */ + if(H5FA_close(idx_info->storage->u.farray.fa, idx_info->dxpl_id) < 0) + HGOTO_ERROR(H5E_DATASET, H5E_CANTCLOSEOBJ, FAIL, "unable to close fixed array") + idx_info->storage->u.farray.fa = NULL; + } /* end if */ + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5D__farray_idx_dest() */ + diff --git a/src/H5Dlayout.c b/src/H5Dlayout.c index c213140..bf99b9d 100644 --- a/src/H5Dlayout.c +++ b/src/H5Dlayout.c @@ -101,6 +101,10 @@ H5D__layout_set_io_ops(const H5D_t *dataset) dataset->shared->layout.storage.u.chunk.ops = H5D_COPS_BTREE; break; + case H5D_CHUNK_IDX_FARRAY: + dataset->shared->layout.storage.u.chunk.ops = H5D_COPS_FARRAY; + break; + case H5D_CHUNK_IDX_EARRAY: dataset->shared->layout.storage.u.chunk.ops = H5D_COPS_EARRAY; break; @@ -213,6 +217,11 @@ H5D__layout_meta_size(const H5F_t *f, const H5O_layout_t *layout, hbool_t includ case H5D_CHUNK_IDX_BTREE: HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, 0, "v1 B-tree index type found for layout message >v3") + case H5D_CHUNK_IDX_FARRAY: + /* Fixed array creation parameters */ + ret_value += H5D_FARRAY_CREATE_PARAM_SIZE; + break; + case H5D_CHUNK_IDX_EARRAY: /* Extensible array creation parameters */ ret_value += H5D_EARRAY_CREATE_PARAM_SIZE; @@ -336,10 +345,13 @@ H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space, HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get dataspace max. dimensions") /* Spin through the max. dimensions, looking for unlimited dimensions */ - for(u = 0; u < ndims; u++) + for(u = 0; u < ndims; u++) { if(max_dims[u] == H5S_UNLIMITED) unlim_count++; + } /* end for */ + /* Chunked datasets with unlimited dimension(s) */ + if(unlim_count) { /* dataset with unlimited dimension(s) must be chunked */ if(1 == unlim_count) { /* Chunked dataset with only 1 unlimited dimension */ /* Set the chunk index type to an extensible array */ layout->u.chunk.idx_type = H5D_CHUNK_IDX_EARRAY; @@ -356,7 +368,7 @@ H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space, layout->u.chunk.u.earray.cparam.data_blk_min_elmts = H5D_EARRAY_DATA_BLK_MIN_ELMTS; layout->u.chunk.u.earray.cparam.max_dblk_page_nelmts_bits = H5D_EARRAY_MAX_DBLOCK_PAGE_NELMTS_BITS; } /* end if */ - else { + else { /* Chunked dataset with > 1 unlimited dimensions */ /* Set the chunk index type to v2 B-tree */ layout->u.chunk.idx_type = H5D_CHUNK_IDX_BT2; layout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_BT2; @@ -370,6 +382,19 @@ H5D__layout_set_latest_indexing(H5O_layout_t *layout, const H5S_t *space, layout->u.chunk.u.btree2.cparam.split_percent = H5D_BT2_SPLIT_PERC; layout->u.chunk.u.btree2.cparam.merge_percent = H5D_BT2_MERGE_PERC; } /* end else */ + } /* end if */ + else { + /* Set the chunk index type to Fixed Array */ + layout->u.chunk.idx_type = H5D_CHUNK_IDX_FARRAY; + layout->storage.u.chunk.idx_type = H5D_CHUNK_IDX_FARRAY; + layout->storage.u.chunk.ops = H5D_COPS_FARRAY; + + /* Set the fixed array creation parameters */ + /* (use hard-coded defaults for now, until we give applications + * control over this with a property list - QAK) + */ + layout->u.chunk.u.farray.cparam.max_dblk_page_nelmts_bits = H5D_FARRAY_MAX_DBLK_PAGE_NELMTS_BITS; + } /* end else */ } /* end if */ } /* end if */ diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h index bfd0601..2609412 100644 --- a/src/H5Dpkg.h +++ b/src/H5Dpkg.h @@ -71,6 +71,10 @@ /* Default creation parameters for chunk index data structures */ /* See H5O_layout_chunk_t */ +/* Fixed array creation values */ +#define H5D_FARRAY_CREATE_PARAM_SIZE 1 /* Size of the creation parameters in bytes */ +#define H5D_FARRAY_MAX_DBLK_PAGE_NELMTS_BITS 10 /* i.e. 1024 elements per data block page */ + /* Extensible array creation values */ #define H5D_EARRAY_CREATE_PARAM_SIZE 5 /* Size of the creation parameters in bytes */ #define H5D_EARRAY_MAX_NELMTS_BITS 32 /* i.e. 4 giga-elements */ @@ -538,6 +542,7 @@ H5_DLLVAR const H5D_layout_ops_t H5D_LOPS_VIRTUAL[1]; /* Chunked layout operations */ H5_DLLVAR const H5D_chunk_ops_t H5D_COPS_BTREE[1]; H5_DLLVAR const H5D_chunk_ops_t H5D_COPS_EARRAY[1]; +H5_DLLVAR const H5D_chunk_ops_t H5D_COPS_FARRAY[1]; H5_DLLVAR const H5D_chunk_ops_t H5D_COPS_BT2[1]; /* The v2 B-tree class for indexing chunked datasets with >1 unlimited dimensions */ diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h index 7024e15..07f8dbe 100644 --- a/src/H5Dpublic.h +++ b/src/H5Dpublic.h @@ -60,10 +60,11 @@ typedef enum H5D_layout_t { /* Types of chunk index data structures */ typedef enum H5D_chunk_index_t { - H5D_CHUNK_IDX_BTREE = 0, /* v1 B-tree index */ - H5D_CHUNK_IDX_EARRAY = 4, /* Extensible array (for 1 unlimited dim) */ - H5D_CHUNK_IDX_BT2 = 5, /* v2 B-tree index (for >1 unlimited dims) */ - H5D_CHUNK_IDX_NTYPES /*this one must be last! */ + H5D_CHUNK_IDX_BTREE = 0, /* v1 B-tree index (default) */ + H5D_CHUNK_IDX_FARRAY = 3, /* Fixed array (for 0 unlimited dims) */ + H5D_CHUNK_IDX_EARRAY = 4, /* Extensible array (for 1 unlimited dim) */ + H5D_CHUNK_IDX_BT2 = 5, /* v2 B-tree index (for >1 unlimited dims) */ + H5D_CHUNK_IDX_NTYPES /* This one must be last! */ } H5D_chunk_index_t; /* Values for the space allocation time property */ diff --git a/src/H5FA.c b/src/H5FA.c index 3e502c0..9678f45 100644 --- a/src/H5FA.c +++ b/src/H5FA.c @@ -79,6 +79,8 @@ hbool_t H5_PKG_INIT_VAR = FALSE; * client class.. */ const H5FA_class_t *const H5FA_client_class_g[] = { + H5FA_CLS_CHUNK, /* 0 - H5FA_CLS_CHUNK_ID */ + H5FA_CLS_FILT_CHUNK, /* 1 - H5FA_CLS_FILT_CHUNK_ID */ H5FA_CLS_TEST, /* ? - H5FA_CLS_TEST_ID */ }; @@ -739,3 +741,36 @@ CATCH END_FUNC(PRIV) /* end H5FA_iterate() */ + +/*------------------------------------------------------------------------- + * Function: H5FA_patch_file + * + * Purpose: Patch the top-level file pointer contained in fa + * to point to idx_info->f if they are different. + * This is possible because the file pointer in fa can be + * closed out if fa remains open. + * + * Return: SUCCEED + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PRIV, NOERR, +herr_t, SUCCEED, -, +H5FA_patch_file(H5FA_t *fa, H5F_t *f)) + + /* Local variables */ + +#ifdef H5FA_DEBUG +HDfprintf(stderr, "%s: Called\n", FUNC); +#endif /* H5FA_DEBUG */ + + /* + * Check arguments. + */ + HDassert(fa); + HDassert(f); + + if(fa->f != f || fa->hdr->f != f) + fa->f = fa->hdr->f = f; + +END_FUNC(PRIV) /* end H5FA_patch_file() */ diff --git a/src/H5FAprivate.h b/src/H5FAprivate.h index dfc73f5..1e76468 100644 --- a/src/H5FAprivate.h +++ b/src/H5FAprivate.h @@ -46,6 +46,9 @@ /* Fixed Array class IDs */ typedef enum H5FA_cls_id_t { + H5FA_CLS_CHUNK_ID = 0, /* Fixed array is for indexing dataset chunks w/o filters */ + H5FA_CLS_FILT_CHUNK_ID, /* Fixed array is for indexing dataset chunks w/filters */ + /* Start real class IDs at 0 -QAK */ /* (keep these last) */ H5FA_CLS_TEST_ID, /* Fixed array is for testing (do not use for actual data) */ @@ -104,6 +107,12 @@ typedef int (*H5FA_operator_t)(hsize_t idx, const void *_elmt, void *_udata); /* Library-private Variables */ /*****************************/ +/* The Fixed Array class for dataset chunks w/o filters*/ +H5_DLLVAR const H5FA_class_t H5FA_CLS_CHUNK[1]; + +/* The Fixed Array class for dataset chunks w/ filters*/ +H5_DLLVAR const H5FA_class_t H5FA_CLS_FILT_CHUNK[1]; + /***************************************/ /* Library-private Function Prototypes */ @@ -120,6 +129,7 @@ H5_DLL herr_t H5FA_get(const H5FA_t *fa, hid_t dxpl_id, hsize_t idx, void *elmt) H5_DLL herr_t H5FA_iterate(H5FA_t *fa, hid_t dxpl_id, H5FA_operator_t op, void *udata); H5_DLL herr_t H5FA_close(H5FA_t *fa, hid_t dxpl_id); H5_DLL herr_t H5FA_delete(H5F_t *f, hid_t dxpl_id, haddr_t fa_addr, void *ctx_udata); +H5_DLL herr_t H5FA_patch_file(H5FA_t *fa, H5F_t *f); /* Statistics routines */ H5_DLL herr_t H5FA_get_stats(const H5FA_t *ea, H5FA_stat_t *stats); diff --git a/src/H5Olayout.c b/src/H5Olayout.c index c19bbfc..bc1ebc6 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -298,6 +298,16 @@ H5O__layout_decode(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, H5O_t H5_ATTR_UNUSED HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "v1 B-tree index type should never be in a v4 layout message") break; + case H5D_CHUNK_IDX_FARRAY: + /* Fixed array creation parameters */ + mesg->u.chunk.u.farray.cparam.max_dblk_page_nelmts_bits = *p++; + if(0 == mesg->u.chunk.u.farray.cparam.max_dblk_page_nelmts_bits) + HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid fixed array creation parameter") + + /* Set the chunk operations */ + mesg->storage.u.chunk.ops = H5D_COPS_FARRAY; + break; + case H5D_CHUNK_IDX_EARRAY: /* Extensible array creation parameters */ mesg->u.chunk.u.earray.cparam.max_nelmts_bits = *p++; @@ -608,6 +618,11 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, FAIL, "v1 B-tree index type should never be in a v4 layout message") break; + case H5D_CHUNK_IDX_FARRAY: + /* Fixed array creation parameters */ + *p++ = mesg->u.chunk.u.farray.cparam.max_dblk_page_nelmts_bits; + break; + case H5D_CHUNK_IDX_EARRAY: /* Extensible array creation parameters */ *p++ = mesg->u.chunk.u.earray.cparam.max_nelmts_bits; @@ -1159,6 +1174,12 @@ H5O__layout_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const v "Index Type:", "v1 B-tree"); break; + case H5D_CHUNK_IDX_FARRAY: + HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, + "Index Type:", "Fixed Array"); + /* (Should print the fixed array creation parameters) */ + break; + case H5D_CHUNK_IDX_EARRAY: HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Index Type:", "Extensible Array"); diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h index a5f07b2..46845a3 100644 --- a/src/H5Oprivate.h +++ b/src/H5Oprivate.h @@ -417,6 +417,14 @@ typedef struct H5O_storage_chunk_btree_t { } H5O_storage_chunk_btree_t; /* Forward declaration of structs used below */ +struct H5FA_t; /* Defined in H5FAprivate.h */ + +typedef struct H5O_storage_chunk_farray_t { + haddr_t dset_ohdr_addr; /* File address dataset's object header */ + struct H5FA_t *fa; /* Pointer to fixed index array struct */ +} H5O_storage_chunk_farray_t; + +/* Forward declaration of structs used below */ struct H5EA_t; /* Defined in H5EAprivate.h */ typedef struct H5O_storage_chunk_earray_t { @@ -438,8 +446,9 @@ typedef struct H5O_storage_chunk_t { const struct H5D_chunk_ops_t *ops; /* Pointer to chunked storage operations */ union { H5O_storage_chunk_btree_t btree; /* Information for v1 B-tree index */ - H5O_storage_chunk_bt2_t btree2; /* Information for v2 B-tree index */ + H5O_storage_chunk_bt2_t btree2; /* Information for v2 B-tree index */ H5O_storage_chunk_earray_t earray; /* Information for extensible array index */ + H5O_storage_chunk_farray_t farray; /* Information for fixed array index */ } u; } H5O_storage_chunk_t; @@ -534,6 +543,15 @@ typedef struct H5O_storage_t { } u; } H5O_storage_t; +typedef struct H5O_layout_chunk_farray_t { + /* Creation parameters for fixed array data structure */ + struct { + uint8_t max_dblk_page_nelmts_bits; /* Log2(Max. # of elements in a data block page) - + i.e. # of bits needed to store max. # of elements + in a data block page */ + } cparam; +} H5O_layout_chunk_farray_t; + typedef struct H5O_layout_chunk_earray_t { /* Creation parameters for extensible array data structure */ struct { @@ -572,6 +590,7 @@ typedef struct H5O_layout_chunk_t { hsize_t down_chunks[H5O_LAYOUT_NDIMS]; /* "down" size of number of chunks in each dimension */ hsize_t max_down_chunks[H5O_LAYOUT_NDIMS]; /* "down" size of number of chunks in each max dim */ union { + H5O_layout_chunk_farray_t farray; /* Information for fixed array index */ H5O_layout_chunk_earray_t earray; /* Information for extensible array index */ H5O_layout_chunk_bt2_t btree2; /* Information for v2 B-tree index */ } u; diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 7981baf..1237bfc 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -57,7 +57,7 @@ #define H5D_DEF_STORAGE_COMPACT_INIT {(hbool_t)FALSE, (size_t)0, NULL} #define H5D_DEF_STORAGE_CONTIG_INIT {HADDR_UNDEF, (hsize_t)0} #define H5D_DEF_STORAGE_CHUNK_INIT {H5D_CHUNK_IDX_BTREE, HADDR_UNDEF, H5D_COPS_BTREE, {{HADDR_UNDEF, NULL}}} -#define H5D_DEF_LAYOUT_CHUNK_INIT {H5D_CHUNK_IDX_BTREE, (uint8_t)0, (unsigned)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, (unsigned)0, (uint32_t)0, (hsize_t)0, (hsize_t)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {{{(uint8_t)0, (uint8_t)0, (uint8_t)0, (uint8_t)0, (uint8_t)0}, 0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}}} +#define H5D_DEF_LAYOUT_CHUNK_INIT {H5D_CHUNK_IDX_BTREE, (uint8_t)0, (unsigned)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, (unsigned)0, (uint32_t)0, (hsize_t)0, (hsize_t)0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {{{(uint8_t)0}}}} #define H5D_DEF_STORAGE_VIRTUAL_INIT {{HADDR_UNDEF, 0}, 0, NULL, 0, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, H5D_VDS_ERROR, HSIZE_UNDEF, -1, -1, FALSE} #ifdef H5_HAVE_C99_DESIGNATED_INITIALIZER #define H5D_DEF_STORAGE_COMPACT {H5D_COMPACT, { .compact = H5D_DEF_STORAGE_COMPACT_INIT }} diff --git a/src/H5trace.c b/src/H5trace.c index 296e2a1..a2ca7e2 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -510,6 +510,10 @@ H5_trace(const double *returning, const char *func, const char *type, ...) fprintf(out, "H5D_CHUNK_IDX_BTREE"); break; + case H5D_CHUNK_IDX_FARRAY: + fprintf(out, "H5D_CHUNK_IDX_FARRAY"); + break; + case H5D_CHUNK_IDX_EARRAY: fprintf(out, "H5D_CHUNK_IDX_EARRAY"); break; diff --git a/src/Makefile.am b/src/Makefile.am index ca9c4c3..ec8c007 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -48,7 +48,7 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5system.c H5timer.c H5trace.c \ H5C.c \ H5CS.c \ H5D.c H5Dbtree.c H5Dbtree2.c H5Dchunk.c H5Dcompact.c H5Dcontig.c H5Ddbg.c \ - H5Ddeprec.c H5Dearray.c H5Defl.c H5Dfill.c H5Dint.c \ + H5Ddeprec.c H5Dearray.c H5Defl.c H5Dfarray.c H5Dfill.c H5Dint.c \ H5Dio.c H5Dlayout.c \ H5Doh.c H5Dscatgath.c H5Dselect.c H5Dtest.c H5Dvirtual.c \ H5E.c H5Edeprec.c H5Eint.c \ diff --git a/test/dsets.c b/test/dsets.c index 5e92a6e..05ff491 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -117,6 +117,13 @@ const char *FILENAME[] = { #define DSET_DEPREC_NAME_COMPACT "deprecated_compact" #define DSET_DEPREC_NAME_FILTER "deprecated_filter" +/* Dataset names for testing Fixed Array Indexing */ +#define DSET_FIXED_MAX "DSET_FIXED_MAX" +#define DSET_FIXED_NOMAX "DSET_FIXED_NOMAX" +#define DSET_FIXED_BIG "DSET_FIXED_BIG" +#define POINTS 72 +#define POINTS_BIG 2500 + #define USER_BLOCK 1024 #define SIXTY_FOUR_KB 65536 @@ -7917,6 +7924,404 @@ error: /*------------------------------------------------------------------------- + * Function: test_fixed_array + * + * Purpose: Tests support for Fixed Array and Implicit Indexing + * + * Create the following 3 datasets: + * 1) extendible chunked dataset with fixed max. dims + * 2) extendible chunked dataset with NULL max. dims + * 3) extendible chunked dataset with same max. dims + * (Note that the third dataset is created with bigger size for curr & max. dims + * so that Fixed Array Indexing with paging is exercised) + * + * Repeat the following test with/without compression filter + * Repeat the following test with H5D_ALLOC_TIME_EARLY/H5D_ALLOC_TIME_LATE/H5D_ALLOC_TIME_INCR + * For the old format, + * verify that v1 btree indexing type is used for + * all 3 datasets with all settings + * For the new format: + * Verify that Implicit Index type is used for + * #1, #2, #3 datasets when ALLOC_TIME_EARLY and compression are true + * Verify Fixed Array indexing type is used for + * #1, #2, #3 datasets with all other settings + * + * Return: Success: 0 + * Failure: -1 + * + * Programmer: Vailin Choi; 2009 + * + *------------------------------------------------------------------------- + */ +static herr_t +test_fixed_array(hid_t fapl) +{ + char filename[FILENAME_BUF_SIZE]; /* File name */ + hid_t fid = -1; /* File ID */ + hid_t dcpl = -1; /* Dataset creation property list ID */ + + hid_t sid = -1; /* Dataspace ID for dataset with fixed dimensions */ + hid_t sid_big = -1; /* Dataspate ID for big dataset */ + hid_t sid_max = -1; /* Dataspace ID for dataset with maximum dimensions set */ + + hid_t dsid = -1; /* Dataset ID for dataset with fixed dimensions */ + hid_t dsid_big = -1; /* Dataset ID for big dataset with fixed dimensions */ + hid_t dsid_max = -1; /* Dataset ID for dataset with maximum dimensions set */ + + hsize_t dim2[2] = {48, 18}; /* Dataset dimensions */ + hsize_t dim2_big[2] = {500, 60}; /* Big dataset dimensions */ + hsize_t dim2_max[2] = {120, 50}; /* Maximum dataset dimensions */ + + hid_t mem_id; /* Memory space ID */ + hid_t big_mem_id; /* Memory space ID for big dataset */ + + hsize_t msize[1] = {POINTS}; /* Size of memory space */ + hsize_t msize_big[1] = {POINTS_BIG}; /* Size of memory space for big dataset */ + + int wbuf[POINTS]; /* write buffer */ + int wbuf_big[POINTS_BIG]; /* write buffer for big dataset */ + int rbuf[POINTS]; /* read buffer */ + int rbuf_big[POINTS_BIG]; /* read buffer for big dataset */ + + hsize_t chunk_dim2[2] = {4, 3}; /* Chunk dimensions */ + int chunks[12][6]; /* # of chunks for dataset dimensions */ + int chunks_big[125][20]; /* # of chunks for big dataset dimensions */ + int chunk_row; /* chunk row index */ + int chunk_col; /* chunk column index */ + + hsize_t coord[POINTS][2]; /* datdaset coordinates */ + hsize_t coord_big[POINTS_BIG][2]; /* big dataset coordinates */ + + H5D_chunk_index_t idx_type; /* Dataset chunk index type */ + H5F_libver_t low, high; /* File format bounds */ + H5D_alloc_time_t alloc_time; /* Storage allocation time */ + +#ifdef H5_HAVE_FILTER_DEFLATE + unsigned compress; /* Whether chunks should be compressed */ +#endif /* H5_HAVE_FILTER_DEFLATE */ + + h5_stat_size_t empty_size; /* Size of an empty file */ + h5_stat_size_t file_size; /* Size of each file created */ + + size_t i, j; /* local index variables */ + herr_t ret; /* Generic return value */ + + TESTING("datasets w/fixed array as chunk index"); + + h5_fixname(FILENAME[12], fapl, filename, sizeof filename); + + /* Check if we are using the latest version of the format */ + if(H5Pget_libver_bounds(fapl, &low, &high) < 0) FAIL_STACK_ERROR + + /* Create and close the file to get the file size */ + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) + STACK_ERROR + if(H5Fclose(fid) < 0) + STACK_ERROR + + /* Get the size of the empty file */ + if((empty_size = h5_get_file_size(filename, fapl)) < 0) + TEST_ERROR + +#ifdef H5_HAVE_FILTER_DEFLATE + /* Loop over compressing chunks */ + for(compress = FALSE; compress <= TRUE; compress++) { +#endif /* H5_HAVE_FILTER_DEFLATE */ + + /* Loop over storage allocation time */ + for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) { + /* Create file */ + if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR + + /* Create dataset creation property list */ + if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) FAIL_STACK_ERROR + + /* Set chunking */ + if((ret = H5Pset_chunk(dcpl, 2, chunk_dim2)) < 0) + FAIL_PUTS_ERROR(" Problem with setting chunk.") + +#ifdef H5_HAVE_FILTER_DEFLATE + /* Check if we should compress the chunks */ + if(compress) + if(H5Pset_deflate(dcpl, 9) < 0) FAIL_STACK_ERROR +#endif /* H5_HAVE_FILTER_DEFLATE */ + + /* Set fill time */ + if(H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0) FAIL_STACK_ERROR + + /* Set allocation time */ + if(H5Pset_alloc_time(dcpl, alloc_time) < 0) FAIL_STACK_ERROR + + /* Initialization of chunk array for repeated coordinates */ + for(i = 0; i < dim2[0]/chunk_dim2[0]; i++) + for(j = 0; j < dim2[1]/chunk_dim2[1]; j++) + chunks[i][j] = 0; + + /* Generate random point coordinates. Only one point is selected per chunk */ + for(i = 0; i < POINTS; i++){ + do { + chunk_row = (int)HDrandom () % (int)(dim2[0]/chunk_dim2[0]); + chunk_col = (int)HDrandom () % (int)(dim2[1]/chunk_dim2[1]); + } while (chunks[chunk_row][chunk_col]); + + wbuf[i] = chunks[chunk_row][chunk_col] = chunk_row+chunk_col+1; + coord[i][0] = (hsize_t)chunk_row * chunk_dim2[0]; + coord[i][1] = (hsize_t)chunk_col * chunk_dim2[1]; + } /* end for */ + + /* Create first dataset with cur and max dimensions */ + if((sid_max = H5Screate_simple(2, dim2, dim2_max)) < 0) FAIL_STACK_ERROR + dsid_max = H5Dcreate2(fid, DSET_FIXED_MAX, H5T_NATIVE_INT, sid_max, H5P_DEFAULT, dcpl, H5P_DEFAULT); + if(dsid_max < 0) + FAIL_PUTS_ERROR(" Creating Chunked Dataset with maximum dimensions.") + + /* Get the chunk index type */ + if(H5D__layout_idx_type_test(dsid_max, &idx_type) < 0) FAIL_STACK_ERROR + + /* Chunk index type depends on whether we are using the latest version of the format */ + if(low == H5F_LIBVER_LATEST) { + if(alloc_time == H5D_ALLOC_TIME_EARLY +#ifdef H5_HAVE_FILTER_DEFLATE + && !compress +#endif /* H5_HAVE_FILTER_DEFLATE */ + ) { + } else if (idx_type != H5D_CHUNK_IDX_FARRAY) + FAIL_PUTS_ERROR("should be using Fixed Array as index"); + } /* end if */ + else { + if(idx_type != H5D_CHUNK_IDX_BTREE) + FAIL_PUTS_ERROR("should be using v1 B-tree as index"); + } /* end else */ + + /* Create dataspace for write buffer */ + if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR; + + /* Select the random points for writing */ + if(H5Sselect_elements(sid_max, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0) + TEST_ERROR; + + /* Write into dataset */ + if(H5Dwrite(dsid_max, H5T_NATIVE_INT, mem_id, sid_max, H5P_DEFAULT, wbuf) < 0) TEST_ERROR; + + /* Closing */ + if(H5Dclose(dsid_max) < 0) FAIL_STACK_ERROR + if(H5Sclose(sid_max) < 0) FAIL_STACK_ERROR + if(H5Sclose(mem_id) < 0) FAIL_STACK_ERROR + + + /* Create second dataset with curr dim but NULL max dim */ + if((sid = H5Screate_simple(2, dim2, NULL)) < 0) FAIL_STACK_ERROR + dsid = H5Dcreate2(fid, DSET_FIXED_NOMAX, H5T_NATIVE_INT, sid, H5P_DEFAULT, dcpl, H5P_DEFAULT); + if(dsid < 0) + FAIL_PUTS_ERROR(" Creating Chunked Dataset.") + + /* Get the chunk index type */ + if(H5D__layout_idx_type_test(dsid, &idx_type) < 0) FAIL_STACK_ERROR + + /* Chunk index type depends on whether we are using the latest version of the format */ + if(low == H5F_LIBVER_LATEST) { + if(alloc_time == H5D_ALLOC_TIME_EARLY +#ifdef H5_HAVE_FILTER_DEFLATE + && !compress +#endif /* H5_HAVE_FILTER_DEFLATE */ + ) { + } else if(idx_type != H5D_CHUNK_IDX_FARRAY) + FAIL_PUTS_ERROR("should be using Fixed Array as index"); + } else { + if(idx_type != H5D_CHUNK_IDX_BTREE) + FAIL_PUTS_ERROR("should be using v1 B-tree as index"); + } /* end else */ + + /* Create dataspace for write buffer */ + if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR; + + /* Select the random points for writing */ + if(H5Sselect_elements(sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0) + TEST_ERROR; + + /* Write into dataset */ + if(H5Dwrite(dsid, H5T_NATIVE_INT, mem_id, sid, H5P_DEFAULT, wbuf) < 0) TEST_ERROR; + + /* Closing */ + if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR + if(H5Sclose(sid) < 0) FAIL_STACK_ERROR + if(H5Sclose(mem_id) < 0) FAIL_STACK_ERROR + + /* Create the third dataset with bigger size and both curr & max dimensions are the same */ + if((sid_big = H5Screate_simple(2, dim2_big, dim2_big)) < 0) FAIL_STACK_ERROR + dsid_big = H5Dcreate2(fid, DSET_FIXED_BIG, H5T_NATIVE_INT, sid_big, H5P_DEFAULT, dcpl, H5P_DEFAULT); + if(dsid_big < 0) + FAIL_PUTS_ERROR(" Creating Big Chunked Dataset.") + + /* Get the chunk index type */ + if(H5D__layout_idx_type_test(dsid_big, &idx_type) < 0) FAIL_STACK_ERROR + + /* Chunk index type depends on whether we are using the latest version of the format */ + if(low == H5F_LIBVER_LATEST) { + if(alloc_time == H5D_ALLOC_TIME_EARLY +#ifdef H5_HAVE_FILTER_DEFLATE + && !compress +#endif /* H5_HAVE_FILTER_DEFLATE */ + ) { + } else if(idx_type != H5D_CHUNK_IDX_FARRAY) + FAIL_PUTS_ERROR("should be using Fixed Array as index"); + } /* end if */ + else { + if(idx_type != H5D_CHUNK_IDX_BTREE) + FAIL_PUTS_ERROR("should be using v1 B-tree as index"); + } /* end else */ + + /* Initialization of chunk array for repeated coordinates */ + for(i = 0; i < dim2_big[0]/chunk_dim2[0]; i++) + for(j = 0; j < dim2_big[1]/chunk_dim2[1]; j++) + chunks_big[i][j] = 0; + + /* Generate random point coordinates. Only one point is selected per chunk */ + for(i = 0; i < POINTS_BIG; i++){ + do { + chunk_row = (int)HDrandom () % (int)(dim2_big[0]/chunk_dim2[0]); + chunk_col = (int)HDrandom () % (int)(dim2_big[1]/chunk_dim2[1]); + } while (chunks_big[chunk_row][chunk_col]); + + wbuf_big[i] = chunks_big[chunk_row][chunk_col] = chunk_row+chunk_col+1; + coord_big[i][0] = (hsize_t)chunk_row * chunk_dim2[0]; + coord_big[i][1] = (hsize_t)chunk_col * chunk_dim2[1]; + } /* end for */ + + /* Create dataspace for write buffer */ + if((big_mem_id = H5Screate_simple(1, msize_big, NULL)) < 0) TEST_ERROR; + + /* Select the random points for writing */ + if(H5Sselect_elements(sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big) < 0) + TEST_ERROR; + + /* Write into dataset */ + if(H5Dwrite(dsid_big, H5T_NATIVE_INT, big_mem_id, sid_big, H5P_DEFAULT, wbuf_big) < 0) TEST_ERROR; + + /* Closing */ + if(H5Dclose(dsid_big) < 0) FAIL_STACK_ERROR + if(H5Sclose(sid_big) < 0) FAIL_STACK_ERROR + if(H5Sclose(big_mem_id) < 0) FAIL_STACK_ERROR + if(H5Pclose(dcpl) < 0) FAIL_STACK_ERROR + + /* Open the first dataset */ + if((dsid = H5Dopen2(fid, DSET_FIXED_MAX, H5P_DEFAULT)) < 0) TEST_ERROR; + + /* Get dataset dataspace */ + if((sid = H5Dget_space(dsid)) < 0) TEST_ERROR; + + /* Create dataspace for read buffer */ + if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR; + + /* Select the random points for reading */ + if(H5Sselect_elements (sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0) TEST_ERROR; + + /* Read from dataset */ + if(H5Dread(dsid, H5T_NATIVE_INT, mem_id, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR; + + /* Verify that written and read data are the same */ + for(i = 0; i < POINTS; i++) + if(rbuf[i] != wbuf[i]){ + printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", + __LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); + TEST_ERROR; + } /* end if */ + + /* Closing */ + if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR + if(H5Sclose(sid) < 0) FAIL_STACK_ERROR + if(H5Sclose(mem_id) < 0) FAIL_STACK_ERROR + + /* Open the second dataset */ + if((dsid = H5Dopen2(fid, DSET_FIXED_NOMAX, H5P_DEFAULT)) < 0) TEST_ERROR; + + /* Get dataset dataspace */ + if((sid = H5Dget_space(dsid)) < 0) TEST_ERROR; + + /* Create dataspace for read buffer */ + if((mem_id = H5Screate_simple(1, msize, NULL)) < 0) TEST_ERROR; + + /* Select the random points for reading */ + if(H5Sselect_elements (sid, H5S_SELECT_SET, POINTS, (const hsize_t *)coord) < 0) TEST_ERROR; + + /* Read from dataset */ + if(H5Dread(dsid, H5T_NATIVE_INT, mem_id, sid, H5P_DEFAULT, rbuf) < 0) TEST_ERROR; + + /* Verify that written and read data are the same */ + for(i = 0; i < POINTS; i++) + if(rbuf[i] != wbuf[i]){ + printf(" Line %d: Incorrect value, wbuf[%u]=%d, rbuf[%u]=%d\n", + __LINE__,(unsigned)i,wbuf[i],(unsigned)i,rbuf[i]); + TEST_ERROR; + } /* end if */ + + /* Closing */ + if(H5Dclose(dsid) < 0) FAIL_STACK_ERROR + if(H5Sclose(sid) < 0) FAIL_STACK_ERROR + if(H5Sclose(mem_id) < 0) FAIL_STACK_ERROR + + /* Open the third dataset */ + if((dsid_big = H5Dopen2(fid, DSET_FIXED_BIG, H5P_DEFAULT)) < 0) TEST_ERROR; + /* Get dataset dataspace */ + if((sid_big = H5Dget_space(dsid_big)) < 0) TEST_ERROR; + + /* Create dataspace for read buffer */ + if((big_mem_id = H5Screate_simple(1, msize_big, NULL)) < 0) TEST_ERROR; + + /* Select the random points for reading */ + if(H5Sselect_elements (sid_big, H5S_SELECT_SET, POINTS_BIG, (const hsize_t *)coord_big) < 0) TEST_ERROR; + /* Read from dataset */ + if(H5Dread(dsid_big, H5T_NATIVE_INT, big_mem_id, sid_big, H5P_DEFAULT, rbuf_big) < 0) TEST_ERROR; + + /* Verify that written and read data are the same */ + for(i = 0; i < POINTS_BIG; i++) + if(rbuf_big[i] != wbuf_big[i]){ + printf(" Line %d: Incorrect value, wbuf_bif[%u]=%d, rbuf_big[%u]=%d\n", + __LINE__,(unsigned)i,wbuf_big[i],(unsigned)i,rbuf_big[i]); + TEST_ERROR; + } /* end if */ + + /* Closing */ + if(H5Dclose(dsid_big) < 0) FAIL_STACK_ERROR + if(H5Sclose(sid_big) < 0) FAIL_STACK_ERROR + if(H5Sclose(big_mem_id) < 0) FAIL_STACK_ERROR + + /* Delete datasets */ + if(H5Ldelete(fid, DSET_FIXED_BIG, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, DSET_FIXED_NOMAX, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + if(H5Ldelete(fid, DSET_FIXED_MAX, H5P_DEFAULT) < 0) FAIL_STACK_ERROR + + /* Close everything */ + if(H5Fclose(fid) < 0) FAIL_STACK_ERROR + + /* Get the size of the file */ + if((file_size = h5_get_file_size(filename, fapl)) < 0) + TEST_ERROR + + /* Verify the file is correct size */ + if(file_size != empty_size) + TEST_ERROR + + } /* end for */ +#ifdef H5_HAVE_FILTER_DEFLATE + } /* end for */ +#endif /* H5_HAVE_FILTER_DEFLATE */ + + PASSED(); + return 0; + +error: + H5E_BEGIN_TRY { + H5Pclose(dcpl); + H5Dclose(dsid); + H5Sclose(sid); + H5Sclose(mem_id); + H5Fclose(fid); + } H5E_END_TRY; + return -1; +} /* end test_fixed_array() */ + +/*------------------------------------------------------------------------- * * test_unfiltered_edge_chunks(): * Tests that partial edge chunks aren't filtered when the @@ -9394,6 +9799,7 @@ main(void) nerrors += (test_big_chunks_bypass_cache(my_fapl) < 0 ? 1 : 0); nerrors += (test_chunk_expand(my_fapl) < 0 ? 1 : 0); nerrors += (test_layout_extend(my_fapl) < 0 ? 1 : 0); + nerrors += (test_fixed_array(my_fapl) < 0 ? 1 : 0); nerrors += (test_unfiltered_edge_chunks(my_fapl) < 0 ? 1 : 0); nerrors += (test_large_chunk_shrink(my_fapl) < 0 ? 1 : 0); nerrors += (test_zero_dim_dset(my_fapl) < 0 ? 1 : 0); -- cgit v0.12 From 305d218725529270e8ff9e4a442d0c27a72d8805 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 7 Apr 2016 15:31:17 -0500 Subject: [svn-r29665] Added new chunk index types to h5debug. Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 Autotools serial --- tools/misc/h5debug.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c index cd1fdca..4df501a 100644 --- a/tools/misc/h5debug.c +++ b/tools/misc/h5debug.c @@ -121,6 +121,14 @@ get_H5B2_class(const uint8_t *sig) cls = H5A_BT2_CORDER; break; + case H5B2_CDSET_ID: + cls = H5D_BT2; + break; + + case H5B2_CDSET_FILT_ID: + cls = H5D_BT2_FILT; + break; + case H5B2_TEST2_ID: cls = H5B2_TEST2; break; @@ -161,6 +169,14 @@ get_H5EA_class(const uint8_t *sig) cls = H5EA_CLS_TEST; break; + case H5EA_CLS_CHUNK_ID: + cls = H5EA_CLS_CHUNK; + break; + + case H5EA_CLS_FILT_CHUNK_ID: + cls = H5EA_CLS_FILT_CHUNK; + break; + case H5EA_NUM_CLS_ID: default: HDfprintf(stderr, "Unknown extensible array class %u\n", (unsigned)(clsid)); @@ -197,6 +213,14 @@ get_H5FA_class(const uint8_t *sig) cls = H5FA_CLS_TEST; break; + case H5FA_CLS_CHUNK_ID: + cls = H5FA_CLS_CHUNK; + break; + + case H5FA_CLS_FILT_CHUNK_ID: + cls = H5FA_CLS_FILT_CHUNK; + break; + case H5FA_NUM_CLS_ID: default: HDfprintf(stderr, "Unknown fixed array class %u\n", (unsigned)(clsid)); @@ -402,6 +426,13 @@ main(int argc, char *argv[]) const H5B2_class_t *cls = get_H5B2_class(sig); HDassert(cls); + if((cls == H5D_BT2 || cls == H5D_BT2_FILT) && extra == 0) { + HDfprintf(stderr, "ERROR: Need v2 B-tree header address and object header address containing the layout message in order to dump header\n"); + HDfprintf(stderr, "v2 B-tree hdr usage:\n"); + HDfprintf(stderr, "\th5debug \n"); + HDexit(4); + } /* end if */ + status = H5B2__hdr_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, (haddr_t)extra); } else if(!HDmemcmp(sig, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { @@ -412,7 +443,16 @@ main(int argc, char *argv[]) HDassert(cls); /* Check for enough valid parameters */ - if(extra == 0 || extra2 == 0 || extra3 == 0) { + if((cls == H5D_BT2 || cls == H5D_BT2_FILT) && + (extra == 0 || extra2 == 0 || extra3 == 0 || extra4 == 0)) { + + fprintf(stderr, "ERROR: Need v2 B-tree header address, the node's number of records, depth, and object header address containing the layout message in order to dump internal node\n"); + fprintf(stderr, "NOTE: Leaf nodes are depth 0, the internal nodes above them are depth 1, etc.\n"); + fprintf(stderr, "v2 B-tree internal node usage:\n"); + fprintf(stderr, "\th5debug \n"); + HDexit(4); + + } else if(extra == 0 || extra2 == 0 || extra3 == 0) { HDfprintf(stderr, "ERROR: Need v2 B-tree header address and the node's number of records and depth in order to dump internal node\n"); HDfprintf(stderr, "NOTE: Leaf nodes are depth 0, the internal nodes above them are depth 1, etc.\n"); HDfprintf(stderr, "v2 B-tree internal node usage:\n"); @@ -430,7 +470,15 @@ main(int argc, char *argv[]) HDassert(cls); /* Check for enough valid parameters */ - if(extra == 0 || extra2 == 0) { + if((cls == H5D_BT2 || cls == H5D_BT2_FILT) && + (extra == 0 || extra2 == 0 || extra3 == 0 )) { + + fprintf(stderr, "ERROR: Need v2 B-tree header address, number of records, and object header address containing the layout message in order to dump leaf node\n"); + fprintf(stderr, "v2 B-tree leaf node usage:\n"); + fprintf(stderr, "\th5debug \n"); + HDexit(4); + + } else if(extra == 0 || extra2 == 0) { HDfprintf(stderr, "ERROR: Need v2 B-tree header address and number of records in order to dump leaf node\n"); HDfprintf(stderr, "v2 B-tree leaf node usage:\n"); HDfprintf(stderr, "\th5debug \n"); -- cgit v0.12 From c575abdeff8d70335e0621e0959565e3083d9cc2 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 7 Apr 2016 20:06:17 -0500 Subject: [svn-r29668] Added H5Dfarray.c to CMake. Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 CMake serial --- src/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f65c77f..ebb7f89 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -111,6 +111,7 @@ set (H5D_SRCS ${HDF5_SRC_DIR}/H5Ddeprec.c ${HDF5_SRC_DIR}/H5Dearray.c ${HDF5_SRC_DIR}/H5Defl.c + ${HDF5_SRC_DIR}/H5Dfarray.c ${HDF5_SRC_DIR}/H5Dfill.c ${HDF5_SRC_DIR}/H5Dint.c ${HDF5_SRC_DIR}/H5Dio.c -- cgit v0.12 From 1a5ee65d50787b8c363b0e54c47847361e1f62b6 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 8 Apr 2016 12:43:59 -0500 Subject: [svn-r29672] HDFFV-1956: h5diff will warn if a dataset is virtual instead of failing. h5diff does not consider the layout type when comparing datasets. --- tools/h5diff/testfiles/h5diff_v1.txt | 2 +- tools/h5diff/testfiles/h5diff_v3.txt | 2 +- tools/lib/h5diff_dset.c | 41 +++++++++++++++++++++++++++++------- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/tools/h5diff/testfiles/h5diff_v1.txt b/tools/h5diff/testfiles/h5diff_v1.txt index 31a3eae..8210cf9 100644 --- a/tools/h5diff/testfiles/h5diff_v1.txt +++ b/tools/h5diff/testfiles/h5diff_v1.txt @@ -7,7 +7,7 @@ file1 file2 group : and 0 differences found dataset: and -Not comparable: or is an empty dataset +Warning: or is a virtual dataset Not comparable: has rank 3, dimensions [5x18x8], max dimensions [18446744073709551615x18x8] and has rank 3, dimensions [6x8x14], max dimensions [18446744073709551615x8x14] 0 differences found diff --git a/tools/h5diff/testfiles/h5diff_v3.txt b/tools/h5diff/testfiles/h5diff_v3.txt index 8c5d2a2..57af303 100644 --- a/tools/h5diff/testfiles/h5diff_v3.txt +++ b/tools/h5diff/testfiles/h5diff_v3.txt @@ -1,4 +1,4 @@ -Not comparable: or is an empty dataset +Warning: or is a virtual dataset Not comparable: has rank 3, dimensions [5x18x8], max dimensions [18446744073709551615x18x8] and has rank 3, dimensions [6x8x14], max dimensions [18446744073709551615x8x14] EXIT CODE: 0 diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index b8dd0e8..63f1483 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -71,9 +71,7 @@ hsize_t diff_dataset( hid_t file1_id, if((dcpl1 = H5Dget_create_plist(did1)) < 0) goto error; if((dcpl2 = H5Dget_create_plist(did2)) < 0) - { goto error; - } /*------------------------------------------------------------------------- * check if the dataset creation property list has filters that @@ -191,6 +189,10 @@ hsize_t diff_datasetid( hid_t did1, hid_t f_tid2=-1; hid_t m_tid1=-1; hid_t m_tid2=-1; + hid_t dcpl1 = -1; + hid_t dcpl2 = -1; + H5D_layout_t stl1 = -1; + H5D_layout_t stl2 = -1; size_t m_size1; size_t m_size2; H5T_sign_t sign1; @@ -260,6 +262,21 @@ hsize_t diff_datasetid( hid_t did1, goto error; } + + /*------------------------------------------------------------------------- + * get the storage layout type + *------------------------------------------------------------------------- + */ + if((dcpl1 = H5Dget_create_plist(did1)) < 0) + goto error; + if((dcpl2 = H5Dget_create_plist(did2)) < 0) + goto error; + + if((stl1 = H5Pget_layout(dcpl1)) < 0) + goto error; + if((stl2 = H5Pget_layout(dcpl2)) < 0) + goto error; + /*------------------------------------------------------------------------- * check for empty datasets *------------------------------------------------------------------------- @@ -271,10 +288,18 @@ hsize_t diff_datasetid( hid_t did1, if (storage_size1==0 || storage_size2==0) { - if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) - parallel_print("Not comparable: <%s> or <%s> is an empty dataset\n", obj1_name, obj2_name); - can_compare=0; - options->not_cmp=1; + if (stl1==H5D_VIRTUAL || stl2==H5D_VIRTUAL) + { + if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) + parallel_print("Warning: <%s> or <%s> is a virtual dataset\n", obj1_name, obj2_name); + } + else + { + if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) + parallel_print("Not comparable: <%s> or <%s> is an empty dataset\n", obj1_name, obj2_name); + can_compare=0; + options->not_cmp=1; + } } /*------------------------------------------------------------------------- @@ -329,7 +354,7 @@ hsize_t diff_datasetid( hid_t did1, parallel_print("Not comparable: <%s> has sign %s ", obj1_name, get_sign(sign1)); parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2)); } - + can_compare=0; options->not_cmp=1; } @@ -369,7 +394,7 @@ hsize_t diff_datasetid( hid_t did1, h5difftrace("upgrade the smaller memory size?\n"); if (FAIL == match_up_memsize (f_tid1, f_tid2, - &m_tid1, &m_tid2, + &m_tid1, &m_tid2, &m_size1, &m_size2)) goto error; -- cgit v0.12 From 1335631f3d5b7d6b10525383697c42a4f47d238b Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Fri, 8 Apr 2016 12:44:36 -0500 Subject: [svn-r29673] Fix typo of var name --- java/src/hdf/hdf5lib/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/src/hdf/hdf5lib/CMakeLists.txt b/java/src/hdf/hdf5lib/CMakeLists.txt index c2daff4..47aa05b 100644 --- a/java/src/hdf/hdf5lib/CMakeLists.txt +++ b/java/src/hdf/hdf5lib/CMakeLists.txt @@ -11,7 +11,7 @@ INCLUDE_DIRECTORIES ( ) SET_GLOBAL_VARIABLE (HDF5_JAVA_SOURCE_PACKAGES - "${HDFJAVA_SOURCE_PACKAGES};hdf.hdf5lib.callbacks;hdf.hdf5lib.exceptions;hdf.hdf5lib.structs;hdf.hdf5lib" + "${HDF5_JAVA_SOURCE_PACKAGES};hdf.hdf5lib.callbacks;hdf.hdf5lib.exceptions;hdf.hdf5lib.structs;hdf.hdf5lib" ) set (HDF5_JAVA_HDF_HDF5_CALLBACKS_SRCS -- cgit v0.12 From 921b68afa7c8198c55fe524b56f4be9119e2077c Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Sat, 9 Apr 2016 13:48:43 -0500 Subject: [svn-r29678] Revert r29672 changes to h5diff. Tested h5committest.new --- tools/h5diff/testfiles/h5diff_v1.txt | 2 +- tools/h5diff/testfiles/h5diff_v3.txt | 2 +- tools/lib/h5diff_dset.c | 41 +++++++----------------------------- 3 files changed, 10 insertions(+), 35 deletions(-) diff --git a/tools/h5diff/testfiles/h5diff_v1.txt b/tools/h5diff/testfiles/h5diff_v1.txt index 8210cf9..31a3eae 100644 --- a/tools/h5diff/testfiles/h5diff_v1.txt +++ b/tools/h5diff/testfiles/h5diff_v1.txt @@ -7,7 +7,7 @@ file1 file2 group : and 0 differences found dataset: and -Warning: or is a virtual dataset +Not comparable: or is an empty dataset Not comparable: has rank 3, dimensions [5x18x8], max dimensions [18446744073709551615x18x8] and has rank 3, dimensions [6x8x14], max dimensions [18446744073709551615x8x14] 0 differences found diff --git a/tools/h5diff/testfiles/h5diff_v3.txt b/tools/h5diff/testfiles/h5diff_v3.txt index 57af303..8c5d2a2 100644 --- a/tools/h5diff/testfiles/h5diff_v3.txt +++ b/tools/h5diff/testfiles/h5diff_v3.txt @@ -1,4 +1,4 @@ -Warning: or is a virtual dataset +Not comparable: or is an empty dataset Not comparable: has rank 3, dimensions [5x18x8], max dimensions [18446744073709551615x18x8] and has rank 3, dimensions [6x8x14], max dimensions [18446744073709551615x8x14] EXIT CODE: 0 diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index 63f1483..b8dd0e8 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -71,7 +71,9 @@ hsize_t diff_dataset( hid_t file1_id, if((dcpl1 = H5Dget_create_plist(did1)) < 0) goto error; if((dcpl2 = H5Dget_create_plist(did2)) < 0) + { goto error; + } /*------------------------------------------------------------------------- * check if the dataset creation property list has filters that @@ -189,10 +191,6 @@ hsize_t diff_datasetid( hid_t did1, hid_t f_tid2=-1; hid_t m_tid1=-1; hid_t m_tid2=-1; - hid_t dcpl1 = -1; - hid_t dcpl2 = -1; - H5D_layout_t stl1 = -1; - H5D_layout_t stl2 = -1; size_t m_size1; size_t m_size2; H5T_sign_t sign1; @@ -262,21 +260,6 @@ hsize_t diff_datasetid( hid_t did1, goto error; } - - /*------------------------------------------------------------------------- - * get the storage layout type - *------------------------------------------------------------------------- - */ - if((dcpl1 = H5Dget_create_plist(did1)) < 0) - goto error; - if((dcpl2 = H5Dget_create_plist(did2)) < 0) - goto error; - - if((stl1 = H5Pget_layout(dcpl1)) < 0) - goto error; - if((stl2 = H5Pget_layout(dcpl2)) < 0) - goto error; - /*------------------------------------------------------------------------- * check for empty datasets *------------------------------------------------------------------------- @@ -288,18 +271,10 @@ hsize_t diff_datasetid( hid_t did1, if (storage_size1==0 || storage_size2==0) { - if (stl1==H5D_VIRTUAL || stl2==H5D_VIRTUAL) - { - if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) - parallel_print("Warning: <%s> or <%s> is a virtual dataset\n", obj1_name, obj2_name); - } - else - { - if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) - parallel_print("Not comparable: <%s> or <%s> is an empty dataset\n", obj1_name, obj2_name); - can_compare=0; - options->not_cmp=1; - } + if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) + parallel_print("Not comparable: <%s> or <%s> is an empty dataset\n", obj1_name, obj2_name); + can_compare=0; + options->not_cmp=1; } /*------------------------------------------------------------------------- @@ -354,7 +329,7 @@ hsize_t diff_datasetid( hid_t did1, parallel_print("Not comparable: <%s> has sign %s ", obj1_name, get_sign(sign1)); parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2)); } - + can_compare=0; options->not_cmp=1; } @@ -394,7 +369,7 @@ hsize_t diff_datasetid( hid_t did1, h5difftrace("upgrade the smaller memory size?\n"); if (FAIL == match_up_memsize (f_tid1, f_tid2, - &m_tid1, &m_tid2, + &m_tid1, &m_tid2, &m_size1, &m_size2)) goto error; -- cgit v0.12 From 7fe0324fc43bbe94e48e2cb412bd02870036e0fc Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 11 Apr 2016 08:45:33 -0500 Subject: [svn-r29680] HDFFV-1956: h5diff will warn if a dataset is virtual instead of failing. h5diff does not consider the layout type when comparing datasets. SKIP h5repack VDS tests until h5repack is fixed. --- tools/h5diff/testfiles/h5diff_v1.txt | 2 +- tools/h5diff/testfiles/h5diff_v3.txt | 2 +- tools/h5repack/CMakeTests.cmake | 67 ++++++++++++++--- tools/h5repack/h5repack.sh.in | 135 ++++++++++++++++++++++++++++------- tools/lib/h5diff_dset.c | 41 ++++++++--- 5 files changed, 203 insertions(+), 44 deletions(-) diff --git a/tools/h5diff/testfiles/h5diff_v1.txt b/tools/h5diff/testfiles/h5diff_v1.txt index 31a3eae..8210cf9 100644 --- a/tools/h5diff/testfiles/h5diff_v1.txt +++ b/tools/h5diff/testfiles/h5diff_v1.txt @@ -7,7 +7,7 @@ file1 file2 group : and 0 differences found dataset: and -Not comparable: or is an empty dataset +Warning: or is a virtual dataset Not comparable: has rank 3, dimensions [5x18x8], max dimensions [18446744073709551615x18x8] and has rank 3, dimensions [6x8x14], max dimensions [18446744073709551615x8x14] 0 differences found diff --git a/tools/h5diff/testfiles/h5diff_v3.txt b/tools/h5diff/testfiles/h5diff_v3.txt index 8c5d2a2..57af303 100644 --- a/tools/h5diff/testfiles/h5diff_v3.txt +++ b/tools/h5diff/testfiles/h5diff_v3.txt @@ -1,4 +1,4 @@ -Not comparable: or is an empty dataset +Warning: or is a virtual dataset Not comparable: has rank 3, dimensions [5x18x8], max dimensions [18446744073709551615x18x8] and has rank 3, dimensions [6x8x14], max dimensions [18446744073709551615x8x14] EXIT CODE: 0 diff --git a/tools/h5repack/CMakeTests.cmake b/tools/h5repack/CMakeTests.cmake index 07c3f9c..158e5d2 100644 --- a/tools/h5repack/CMakeTests.cmake +++ b/tools/h5repack/CMakeTests.cmake @@ -115,6 +115,16 @@ ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/plugin_test.h5repack_layout.h5.tst ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.UD.h5-plugin_none.ddl ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/plugin_none.h5repack_layout.UD.h5.tst + ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/1_vds.h5-vds_dset_compa-v.ddl + ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/1_vds.h5-vds_dset_conti-v.ddl + ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/2_vds.h5-vds_null_compa-v.ddl + ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/2_vds.h5-vds_null_conti-v.ddl + ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_compa_compa-v.ddl + ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_compa_conti-v.ddl + ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_compa-v.ddl + ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_conti_compa-v.ddl + ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_conti_conti-v.ddl + ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_conti-v.ddl ) foreach (h5_file ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) @@ -345,6 +355,41 @@ endif ("${testtype}" STREQUAL "SKIP") ENDMACRO (ADD_H5_VERIFY_TEST) + MACRO (ADD_H5_VERIFY_VDS testname testtype resultcode testfile testdset testfilter) + if ("${testtype}" STREQUAL "SKIP") + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5REPACK_VERIFY_LAYOUT-${testname}-SKIPPED + COMMAND ${CMAKE_COMMAND} -E echo "SKIP -d ${testdset} -pH ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${resultfile}" + ) + endif (NOT HDF5_ENABLE_USING_MEMCHECKER) + else ("${testtype}" STREQUAL "SKIP") + if (NOT HDF5_ENABLE_USING_MEMCHECKER) + add_test ( + NAME H5REPACK_VERIFY_LAYOUT-${testname} + COMMAND $ ${ARGN} ${PROJECT_BINARY_DIR}/testfiles/${testfile} ${PROJECT_BINARY_DIR}/testfiles/out-${testname}.${testfile} + ) + set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname} PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + if (NOT "${last_test}" STREQUAL "") + set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname} PROPERTIES DEPENDS ${last_test}) + endif (NOT "${last_test}" STREQUAL "") + add_test ( + NAME H5REPACK_VERIFY_LAYOUT-${testname}_DMP + COMMAND "${CMAKE_COMMAND}" + -D "TEST_PROGRAM=$" + -D "TEST_ARGS:STRING=-d;${testdset};-p;out-${testname}.${testfile}" + -D "TEST_FOLDER=${PROJECT_BINARY_DIR}/testfiles" + -D "TEST_OUTPUT=${testfile}-${testname}-v.out" + -D "TEST_EXPECT=${resultcode}" + -D "TEST_REFERENCE=${testfile}-${testname}-v.ddl" + -P "${HDF_RESOURCES_EXT_DIR}/runTest.cmake" + ) + set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DMP PROPERTIES WORKING_DIRECTORY "${PROJECT_BINARY_DIR}/testfiles") + set_tests_properties (H5REPACK_VERIFY_LAYOUT-${testname}_DMP PROPERTIES DEPENDS H5REPACK_VERIFY_LAYOUT-${testname}) + endif (NOT HDF5_ENABLE_USING_MEMCHECKER) + endif ("${testtype}" STREQUAL "SKIP") + ENDMACRO (ADD_H5_VERIFY_VDS) + MACRO (ADD_H5_TEST_META testname testfile) add_test ( NAME H5REPACK_META-${testname}_N @@ -1053,20 +1098,22 @@ ######################################################### # layout options ######################################################### - ADD_H5_VERIFY_TEST (vds_dset_conti "TEST" 0 ${FILEV1} vds_dset CONTIGUOUS -l vds_dset:CONTI) - ADD_H5_VERIFY_TEST (vds_null_conti "TEST" 1 ${FILEV2} null CONTIGUOUS -l CONTI) - ADD_H5_VERIFY_TEST (vds_dset_compa "TEST" 0 ${FILEV1} vds_dset COMPACT -l vds_dset:COMPA) - ADD_H5_VERIFY_TEST (vds_null_compa "TEST" 1 ${FILEV2} null COMPACT -l COMPA) +# skip tests because of HDFFV-9756 + ADD_H5_VERIFY_VDS (vds_dset_conti "SKIP" 0 ${FILEV1} vds_dset CONTIGUOUS -l vds_dset:CONTI) + ADD_H5_VERIFY_VDS (vds_null_conti "SKIP" 1 ${FILEV2} null CONTIGUOUS -l CONTI) + ADD_H5_VERIFY_VDS (vds_dset_compa "SKIP" 0 ${FILEV1} vds_dset COMPACT -l vds_dset:COMPA) + ADD_H5_VERIFY_VDS (vds_null_compa "SKIP" 1 ${FILEV2} null COMPACT -l COMPA) ################################################################ # layout conversions ############################################################### - ADD_H5_VERIFY_TEST (vds_compa_conti "TEST" 0 ${FILEV4} vds_dset CONTIGUOUS -l vds_dset:CONTI) - ADD_H5_VERIFY_TEST (vds_compa_compa "TEST" 0 ${FILEV4} vds_dset COMPACT -l vds_dset:COMPA) - ADD_H5_VERIFY_TEST (vds_conti_compa "TEST" 0 ${FILEV4} vds_dset COMPACT -l vds_dset:COMPA) - ADD_H5_VERIFY_TEST (vds_conti_conti "TEST" 0 ${FILEV4} vds_dset CONTIGUOUS -l vds_dset:CONTI) - ADD_H5_VERIFY_TEST (vds_compa "TEST" 0 ${FILEV4} vds_dset COMPACT -l vds_dset:COMPA) - ADD_H5_VERIFY_TEST (vds_conti "TEST" 0 ${FILEV4} vds_dset CONTIGUOUS -l vds_dset:CONTI) +# skip tests because of HDFFV-9756 + ADD_H5_VERIFY_VDS (vds_compa_conti "SKIP" 0 ${FILEV4} vds_dset CONTIGUOUS -l vds_dset:CONTI) + ADD_H5_VERIFY_VDS (vds_compa_compa "SKIP" 0 ${FILEV4} vds_dset COMPACT -l vds_dset:COMPA) + ADD_H5_VERIFY_VDS (vds_conti_compa "SKIP" 0 ${FILEV4} vds_dset COMPACT -l vds_dset:COMPA) + ADD_H5_VERIFY_VDS (vds_conti_conti "SKIP" 0 ${FILEV4} vds_dset CONTIGUOUS -l vds_dset:CONTI) + ADD_H5_VERIFY_VDS (vds_compa "SKIP" 0 ${FILEV4} vds_dset COMPACT -l vds_dset:COMPA) + ADD_H5_VERIFY_VDS (vds_conti "SKIP" 0 ${FILEV4} vds_dset CONTIGUOUS -l vds_dset:CONTI) ############################################################################## ### P L U G I N T E S T S diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in index 24298d0..d3faee7 100644 --- a/tools/h5repack/h5repack.sh.in +++ b/tools/h5repack/h5repack.sh.in @@ -39,6 +39,8 @@ H5DUMP=../h5dump/h5dump # The h5dump tool name H5DUMP_BIN=`pwd`/$H5DUMP # The path of the h5dump tool binary RM='rm -rf' +CMP='cmp' +DIFF='diff -c' GREP='grep' CP='cp' DIRNAME='dirname' @@ -148,6 +150,16 @@ $SRC_H5REPACK_TESTFILES/h5repack_layout.h5.ddl $SRC_H5REPACK_TESTFILES/h5repack_filters.h5.tst $SRC_H5REPACK_TESTFILES/h5repack_layout.h5-plugin_test.ddl $SRC_H5REPACK_TESTFILES/plugin_test.h5repack_layout.h5.tst +$SRC_H5REPACK_TESTFILES/1_vds.h5-vds_dset_compa-v.ddl +$SRC_H5REPACK_TESTFILES/1_vds.h5-vds_dset_conti-v.ddl +$SRC_H5REPACK_TESTFILES/2_vds.h5-vds_null_compa-v.ddl +$SRC_H5REPACK_TESTFILES/2_vds.h5-vds_null_conti-v.ddl +$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_compa_compa-v.ddl +$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_compa_conti-v.ddl +$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_compa-v.ddl +$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_conti_compa-v.ddl +$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_conti_conti-v.ddl +$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_conti-v.ddl " # @@ -171,7 +183,7 @@ COPY_TESTFILES_TO_TESTDIR() INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then - $CP -f $tstfile $TESTDIR + $CP -f $tstfile $TESTDIR if [ $? -ne 0 ]; then echo "Error: FAILED to copy $tstfile ." @@ -188,7 +200,7 @@ CLEAN_TESTFILES_AND_TESTDIR() # skip rm if srcdir is same as destdir # this occurs when build/test performed in source dir and # make cp fail - SDIR=`$DIRNAME $tstfile` + SDIR=`$DIRNAME $SRC_H5REPACK_TESTFILES/h5repack-help.txt` INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'` INODE_DDIR=`$LS -i -d $TESTDIR | $AWK -F' ' '{print $1}'` if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then @@ -321,6 +333,70 @@ VERIFY_LAYOUT_DSET() rm -f $layoutfile } +#------------------------------------------ +# Verifying layouts of a dataset +VERIFY_LAYOUT_VDS() +{ + layoutfile=layout-$1.$2 + dset=$3 + expectlayout=$4 + infile=$2 + outfile=out-$1.$2 + + expect="$TESTDIR/$2-$1-v.ddl" + actual="$TESTDIR/$2-$1-v.out" + actual_err="$TESTDIR/$2-$1-v.err" + + shift + shift + shift + shift + + TESTING $H5REPACK $@ + ( + cd $TESTDIR + $RUNSERIAL $H5REPACK_BIN "$@" $infile $outfile + ) + RET=$? + if [ $RET != 0 ] ; then + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" + else + echo " PASSED" + fi + + #--------------------------------- + # check the layout from a dataset + VERIFY "a dataset layout" + ( + cd $TESTDIR + $RUNSERIAL $H5DUMP_BIN -d $dset -p $outfile + ) >$actual 2>$actual_err + + cat $actual_err >> $actual + + if [ ! -f $expect ]; then + # Create the expect file if it doesn't yet exist. + echo " CREATED" + cp $actual $expect + elif $CMP $expect $actual > /dev/null 2>&1 ; then + echo " PASSED" + else + echo "*FAILED*" + echo " Expected result (*.ddl) differs from actual result (*.out)" + nerrors="`expr $nerrors + 1`" + test yes = "$verbose" && $DIFF $caseless $expect $actual |sed 's/^/ /' + fi + + # Clean up output file + if test -z "$HDF5_NOCLEANUP"; then + rm -f $actual $actual_err + fi + + # clean up tmp files + rm -f $outfile +} + #---------------------------------------- # Verifying layouts from entire file VERIFY_LAYOUT_ALL() @@ -469,11 +545,11 @@ TOOLTEST1() ) RET=$? if [ $RET != 0 ] ; then - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" else - echo " PASSED" - DIFFTEST $infile $outfile + echo " PASSED" + DIFFTEST $infile $outfile fi rm -f $outfile } @@ -500,11 +576,11 @@ TOOLTESTV() ) >$actual 2>$actual_err RET=$? if [ $RET != 0 ] ; then - echo "*FAILED*" - nerrors="`expr $nerrors + 1`" + echo "*FAILED*" + nerrors="`expr $nerrors + 1`" else - echo " PASSED" - DIFFTEST $infile $outfile + echo " PASSED" + DIFFTEST $infile $outfile fi # display output compare @@ -634,11 +710,11 @@ TOOLTEST_META() # verify sizes. MESSAGE "Verify the sizes of both output files ($size1 vs $size2)" if [ $size1 -lt $size2 ]; then - # pass - echo " PASSED" + # pass + echo " PASSED" else - #fail - echo "*FAILED*" + #fail + echo "*FAILED*" nerrors="`expr $nerrors + 1`" fi @@ -711,7 +787,7 @@ USE_FILTER_SZIP_ENCODER=`$RUNSERIAL $H5DETECTSZIP_BIN` fi ############################################################################## -### T H E T E S T S +### T H E T E S T S ############################################################################## # prepare for test COPY_TESTFILES_TO_TESTDIR @@ -1057,7 +1133,7 @@ TOOLTEST add_alignment $arg # Check repacking file with old version of layout message (should get upgraded # to new version and be readable, etc.) -TOOLTEST pgrade_layout h5repack_layouto.h5 +TOOLTEST upgrade_layout h5repack_layouto.h5 # test for datum size > H5TOOLS_MALLOCSIZE TOOLTEST gt_mallocsize h5repack_objs.h5 -f GZIP=1 @@ -1091,20 +1167,31 @@ TOOLTEST_META meta_long h5repack_layout.h5 --metadata_block_size=8192 ######################################################### # layout options ######################################################### -VERIFY_LAYOUT_DSET vds_dset_conti 1_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI +# skip test because of HDFFV-9756 +#VERIFY_LAYOUT_VDS vds_dset_conti 1_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI +SKIP vds_dset_conti 1_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI VERIFY_LAYOUT_ALL vds_null_conti 2_vds.h5 CONTIGUOUS -l CONTI -VERIFY_LAYOUT_DSET vds_dset_compa 1_vds.h5 vds_dset COMPACT -l vds_dset:COMPA +# skip test because of HDFFV-9756 +#VERIFY_LAYOUT_VDS vds_dset_compa 1_vds.h5 vds_dset COMPACT -l vds_dset:COMPA +SKIP vds_dset_compa 1_vds.h5 vds_dset COMPACT -l vds_dset:COMPA VERIFY_LAYOUT_ALL vds_null_compa 2_vds.h5 COMPACT -l COMPA ################################################################ # layout conversions ############################################################### -VERIFY_LAYOUT_DSET vds_compa_conti 4_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI -VERIFY_LAYOUT_DSET vds_compa_compa 4_vds.h5 vds_dset COMPACT -l vds_dset:COMPA -VERIFY_LAYOUT_DSET vds_conti_compa 4_vds.h5 vds_dset COMPACT -l vds_dset:COMPA -VERIFY_LAYOUT_DSET vds_conti_conti 4_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI -VERIFY_LAYOUT_DSET vds_compa 4_vds.h5 vds_dset COMPACT -l vds_dset:COMPA -VERIFY_LAYOUT_DSET vds_conti 4_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI +# skip tests because of HDFFV-9756 +#VERIFY_LAYOUT_VDS vds_compa_conti 4_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI +#VERIFY_LAYOUT_VDS vds_compa_compa 4_vds.h5 vds_dset COMPACT -l vds_dset:COMPA +#VERIFY_LAYOUT_VDS vds_conti_compa 4_vds.h5 vds_dset COMPACT -l vds_dset:COMPA +#VERIFY_LAYOUT_VDS vds_conti_conti 4_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI +#VERIFY_LAYOUT_VDS vds_compa 4_vds.h5 vds_dset COMPACT -l vds_dset:COMPA +#VERIFY_LAYOUT_VDS vds_conti 4_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI +SKIP vds_compa_conti 4_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI +SKIP vds_compa_compa 4_vds.h5 vds_dset COMPACT -l vds_dset:COMPA +SKIP vds_conti_compa 4_vds.h5 vds_dset COMPACT -l vds_dset:COMPA +SKIP vds_conti_conti 4_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI +SKIP vds_compa 4_vds.h5 vds_dset COMPACT -l vds_dset:COMPA +SKIP vds_conti 4_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI # Clean up temporary files/directories CLEAN_TESTFILES_AND_TESTDIR diff --git a/tools/lib/h5diff_dset.c b/tools/lib/h5diff_dset.c index b8dd0e8..63f1483 100644 --- a/tools/lib/h5diff_dset.c +++ b/tools/lib/h5diff_dset.c @@ -71,9 +71,7 @@ hsize_t diff_dataset( hid_t file1_id, if((dcpl1 = H5Dget_create_plist(did1)) < 0) goto error; if((dcpl2 = H5Dget_create_plist(did2)) < 0) - { goto error; - } /*------------------------------------------------------------------------- * check if the dataset creation property list has filters that @@ -191,6 +189,10 @@ hsize_t diff_datasetid( hid_t did1, hid_t f_tid2=-1; hid_t m_tid1=-1; hid_t m_tid2=-1; + hid_t dcpl1 = -1; + hid_t dcpl2 = -1; + H5D_layout_t stl1 = -1; + H5D_layout_t stl2 = -1; size_t m_size1; size_t m_size2; H5T_sign_t sign1; @@ -260,6 +262,21 @@ hsize_t diff_datasetid( hid_t did1, goto error; } + + /*------------------------------------------------------------------------- + * get the storage layout type + *------------------------------------------------------------------------- + */ + if((dcpl1 = H5Dget_create_plist(did1)) < 0) + goto error; + if((dcpl2 = H5Dget_create_plist(did2)) < 0) + goto error; + + if((stl1 = H5Pget_layout(dcpl1)) < 0) + goto error; + if((stl2 = H5Pget_layout(dcpl2)) < 0) + goto error; + /*------------------------------------------------------------------------- * check for empty datasets *------------------------------------------------------------------------- @@ -271,10 +288,18 @@ hsize_t diff_datasetid( hid_t did1, if (storage_size1==0 || storage_size2==0) { - if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) - parallel_print("Not comparable: <%s> or <%s> is an empty dataset\n", obj1_name, obj2_name); - can_compare=0; - options->not_cmp=1; + if (stl1==H5D_VIRTUAL || stl2==H5D_VIRTUAL) + { + if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) + parallel_print("Warning: <%s> or <%s> is a virtual dataset\n", obj1_name, obj2_name); + } + else + { + if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name) + parallel_print("Not comparable: <%s> or <%s> is an empty dataset\n", obj1_name, obj2_name); + can_compare=0; + options->not_cmp=1; + } } /*------------------------------------------------------------------------- @@ -329,7 +354,7 @@ hsize_t diff_datasetid( hid_t did1, parallel_print("Not comparable: <%s> has sign %s ", obj1_name, get_sign(sign1)); parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2)); } - + can_compare=0; options->not_cmp=1; } @@ -369,7 +394,7 @@ hsize_t diff_datasetid( hid_t did1, h5difftrace("upgrade the smaller memory size?\n"); if (FAIL == match_up_memsize (f_tid1, f_tid2, - &m_tid1, &m_tid2, + &m_tid1, &m_tid2, &m_size1, &m_size2)) goto error; -- cgit v0.12 From 0ff3a85a48a6fec8659e2fd290571fd253f79a5d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 11 Apr 2016 08:53:55 -0500 Subject: [svn-r29681] HDFFV-1956: h5diff will warn if a dataset is virtual instead of failing. h5diff does not consider the layout type when comparing datasets. SKIP h5repack VDS tests until h5repack is fixed. Additional tests to be skipped --- tools/h5repack/h5repack.sh.in | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in index d3faee7..1af8017 100644 --- a/tools/h5repack/h5repack.sh.in +++ b/tools/h5repack/h5repack.sh.in @@ -1167,14 +1167,16 @@ TOOLTEST_META meta_long h5repack_layout.h5 --metadata_block_size=8192 ######################################################### # layout options ######################################################### -# skip test because of HDFFV-9756 +# skip tests because of HDFFV-9756 #VERIFY_LAYOUT_VDS vds_dset_conti 1_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI -SKIP vds_dset_conti 1_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI -VERIFY_LAYOUT_ALL vds_null_conti 2_vds.h5 CONTIGUOUS -l CONTI +#VERIFY_LAYOUT_ALL vds_null_conti 2_vds.h5 CONTIGUOUS -l CONTI # skip test because of HDFFV-9756 #VERIFY_LAYOUT_VDS vds_dset_compa 1_vds.h5 vds_dset COMPACT -l vds_dset:COMPA +#VERIFY_LAYOUT_ALL vds_null_compa 2_vds.h5 COMPACT -l COMPA +SKIP vds_dset_conti 1_vds.h5 vds_dset CONTIGUOUS -l vds_dset:CONTI +SKIP vds_null_conti 2_vds.h5 CONTIGUOUS -l CONTI SKIP vds_dset_compa 1_vds.h5 vds_dset COMPACT -l vds_dset:COMPA -VERIFY_LAYOUT_ALL vds_null_compa 2_vds.h5 COMPACT -l COMPA +SKIP vds_null_compa 2_vds.h5 COMPACT -l COMPA ################################################################ # layout conversions -- cgit v0.12 From 18e360b9fa7fdce30a25d62a7139b9e69c56bf01 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 11 Apr 2016 09:21:37 -0500 Subject: [svn-r29683] HDFFV-1956: h5diff will warn if a dataset is virtual instead of failing. h5diff does not consider the layout type when comparing datasets. SKIP h5repack VDS tests until h5repack is fixed. remove h5repack fix ddl files needed when h5repack VDS fix is implemented. --- tools/h5repack/CMakeTests.cmake | 10 ---------- tools/h5repack/h5repack.sh.in | 10 ---------- 2 files changed, 20 deletions(-) diff --git a/tools/h5repack/CMakeTests.cmake b/tools/h5repack/CMakeTests.cmake index 158e5d2..ba59bd2 100644 --- a/tools/h5repack/CMakeTests.cmake +++ b/tools/h5repack/CMakeTests.cmake @@ -115,16 +115,6 @@ ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/plugin_test.h5repack_layout.h5.tst ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/h5repack_layout.UD.h5-plugin_none.ddl ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/plugin_none.h5repack_layout.UD.h5.tst - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/1_vds.h5-vds_dset_compa-v.ddl - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/1_vds.h5-vds_dset_conti-v.ddl - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/2_vds.h5-vds_null_compa-v.ddl - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/2_vds.h5-vds_null_conti-v.ddl - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_compa_compa-v.ddl - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_compa_conti-v.ddl - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_compa-v.ddl - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_conti_compa-v.ddl - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_conti_conti-v.ddl - ${HDF5_TOOLS_H5REPACK_SOURCE_DIR}/testfiles/4_vds.h5-vds_conti-v.ddl ) foreach (h5_file ${LIST_HDF5_TEST_FILES} ${LIST_OTHER_TEST_FILES}) diff --git a/tools/h5repack/h5repack.sh.in b/tools/h5repack/h5repack.sh.in index 1af8017..74da4c0 100644 --- a/tools/h5repack/h5repack.sh.in +++ b/tools/h5repack/h5repack.sh.in @@ -150,16 +150,6 @@ $SRC_H5REPACK_TESTFILES/h5repack_layout.h5.ddl $SRC_H5REPACK_TESTFILES/h5repack_filters.h5.tst $SRC_H5REPACK_TESTFILES/h5repack_layout.h5-plugin_test.ddl $SRC_H5REPACK_TESTFILES/plugin_test.h5repack_layout.h5.tst -$SRC_H5REPACK_TESTFILES/1_vds.h5-vds_dset_compa-v.ddl -$SRC_H5REPACK_TESTFILES/1_vds.h5-vds_dset_conti-v.ddl -$SRC_H5REPACK_TESTFILES/2_vds.h5-vds_null_compa-v.ddl -$SRC_H5REPACK_TESTFILES/2_vds.h5-vds_null_conti-v.ddl -$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_compa_compa-v.ddl -$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_compa_conti-v.ddl -$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_compa-v.ddl -$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_conti_compa-v.ddl -$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_conti_conti-v.ddl -$SRC_H5REPACK_TESTFILES/4_vds.h5-vds_conti-v.ddl " # -- cgit v0.12 From e2c8d94ac1ccc6b7d7c16b4c53e9f55f14f41abd Mon Sep 17 00:00:00 2001 From: Larry Knox Date: Thu, 14 Apr 2016 15:18:02 -0500 Subject: [svn-r29696] Applied fix for HDFFV-9439 to mpicc config as well as mpif90 in config/linux-gnulibc1. Tested with h5committest.new on kituo, ostrich, osx1010dev and platypus. --- config/linux-gnulibc1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/linux-gnulibc1 b/config/linux-gnulibc1 index 5bea816..967cb4e 100644 --- a/config/linux-gnulibc1 +++ b/config/linux-gnulibc1 @@ -171,6 +171,7 @@ case $CC in *mpicc*) cc_version_info=`$CC $CCFLAGS $H5_CCFLAGS -v 2>&1 | grep 'version' |\ sed 's/^[a-z0-9]* for //' |\ + sed 's/\"/\\\"/g' |\ sed 's/^\([a-z]* \)/ built with \1/1'` cc_version_info=`echo $cc_version_info` ;; @@ -199,7 +200,6 @@ case $FC in *mpif90*) fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS -v 2>&1 | grep 'version' |\ sed 's/^[a-z0-9]* for //' |\ - sed 's/\"/\\\"/g' |\ sed 's/^\([a-z]* \)/ built with \1/1'` fc_version_info=`echo $fc_version_info` ;; -- cgit v0.12 From 57b7130acf69256ddaee7c6295a65c6ba16e3096 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 14 Apr 2016 16:26:41 -0500 Subject: [svn-r29698] Switched true and false to TRUE and FALSE in a function in test/external.c. Tested on: 64-bit Ubuntu 15.10 w/ gcc 5.2.1 autotools serial (external test only) --- test/external.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/external.c b/test/external.c index 1865e71..35207bd 100644 --- a/test/external.c +++ b/test/external.c @@ -59,7 +59,7 @@ files_have_same_contents(const char *name1, const char *name2) int fd1 = 0, fd2 = 0; ssize_t n1, n2; char buf1[1024], buf2[1024]; - hbool_t ret = false; /* not equal until proven otherwise */ + hbool_t ret = FALSE; /* not equal until proven otherwise */ if((fd1 = HDopen(name1, O_RDONLY, 0666)) < 0) goto out; @@ -82,7 +82,7 @@ files_have_same_contents(const char *name1, const char *name2) break; if(n1 == 0 && n2 == 0) { - ret = true; + ret = TRUE; break; } -- cgit v0.12