diff options
author | Vailin Choi <vchoi@hdfgroup.org> | 2018-05-31 16:50:24 (GMT) |
---|---|---|
committer | Vailin Choi <vchoi@hdfgroup.org> | 2018-05-31 16:50:24 (GMT) |
commit | 796dc16e3409b9f3746cfa4127adb6dd334ee8c9 (patch) | |
tree | 60a7bde0ea086f8a3750c5e8ce9619e813f59eeb /src | |
parent | 18fe60ae10b4b5abb6992e7b9b2ae7b22dfa9156 (diff) | |
parent | e8ece625f223032db0d26cfffafc045e4ccdf37d (diff) | |
download | hdf5-796dc16e3409b9f3746cfa4127adb6dd334ee8c9.zip hdf5-796dc16e3409b9f3746cfa4127adb6dd334ee8c9.tar.gz hdf5-796dc16e3409b9f3746cfa4127adb6dd334ee8c9.tar.bz2 |
Merging in latest from upstream (HDFFV/hdf5:refs/heads/develop)
* commit 'e8ece625f223032db0d26cfffafc045e4ccdf37d':
Normalize with vol_integration.
Diffstat (limited to 'src')
-rw-r--r-- | src/H5B.c | 8 | ||||
-rw-r--r-- | src/H5B2dbg.c | 10 | ||||
-rw-r--r-- | src/H5B2pkg.h | 2 | ||||
-rw-r--r-- | src/H5B2test.c | 33 | ||||
-rw-r--r-- | src/H5I.c | 110 | ||||
-rw-r--r-- | src/H5Ipkg.h | 2 | ||||
-rw-r--r-- | src/H5Itest.c | 42 | ||||
-rw-r--r-- | src/H5MF.c | 199 | ||||
-rw-r--r-- | src/H5MFaggr.c | 261 | ||||
-rw-r--r-- | src/H5MFdbg.c | 25 | ||||
-rw-r--r-- | src/H5MFpkg.h | 24 | ||||
-rw-r--r-- | src/H5MFsection.c | 48 | ||||
-rw-r--r-- | src/H5PB.c | 34 | ||||
-rw-r--r-- | src/H5R.c | 16 | ||||
-rw-r--r-- | src/H5Rdeprec.c | 2 | ||||
-rw-r--r-- | src/H5Rint.c | 17 | ||||
-rw-r--r-- | src/H5Rpkg.h | 5 |
17 files changed, 426 insertions, 412 deletions
@@ -245,7 +245,7 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, haddr_t *addr_p/*out* NULL == (bt->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for B-tree root node") if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, (hsize_t)shared->sizeof_rnode))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "file allocation failed for B-tree root node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "file allocation failed for B-tree root node") /* * Cache the new B-tree node. @@ -320,7 +320,7 @@ H5B_find(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) /* Get shared info for B-tree */ if(NULL == (rc_shared = (type->get_shared)(f, udata))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") + HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't retrieve B-tree's shared ref. count object") shared = (H5B_shared_t *)H5UC_GET_OBJ(rc_shared); HDassert(shared); @@ -332,7 +332,7 @@ H5B_find(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) cache_udata.type = type; cache_udata.rc_shared = rc_shared; if(NULL == (bt = (H5B_t *)H5AC_protect(f, H5AC_BT, addr, &cache_udata, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") rt = bt->nchildren; while(lt < rt && cmp) { @@ -1300,7 +1300,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, if((int)(ret_value = H5B__remove_helper(f, bt->child[idx], type, level + 1, H5B_NKEY(bt, shared, idx)/*out*/, lt_key_changed/*out*/, udata, H5B_NKEY(bt, shared, idx + 1)/*out*/, - rt_key_changed/*out*/)) < 0) + rt_key_changed/*out*/)) < 0) HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, H5B_INS_ERROR, "key not found in subtree") } else if(type->remove) { /* diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c index c4f56e5..0e3ebd5 100644 --- a/src/H5B2dbg.c +++ b/src/H5B2dbg.c @@ -109,7 +109,7 @@ H5B2__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* Load the B-tree header */ if(NULL == (hdr = H5B2__hdr_protect(f, addr, f, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header") /* Set file pointer for this B-tree operation */ hdr->f = f; @@ -208,7 +208,7 @@ H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* Load the B-tree header */ if(NULL == (hdr = H5B2__hdr_protect(f, hdr_addr, f, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load v2 B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load v2 B-tree header") /* Set file pointer for this B-tree operation */ hdr->f = f; @@ -220,7 +220,7 @@ H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, node_ptr.addr = addr; H5_CHECKED_ASSIGN(node_ptr.node_nrec, uint16_t, nrec, unsigned) if(NULL == (internal = H5B2__protect_internal(hdr, NULL, &node_ptr, (uint16_t)depth, FALSE, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree internal node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree internal node") /* Print opening message */ HDfprintf(stream, "%*sv2 B-tree Internal Node...\n", indent, ""); @@ -320,7 +320,7 @@ H5B2__leaf_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, /* Load the B-tree header */ if(NULL == (hdr = H5B2__hdr_protect(f, hdr_addr, f, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect v2 B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect v2 B-tree header") /* Set file pointer for this B-tree operation */ hdr->f = f; @@ -332,7 +332,7 @@ H5B2__leaf_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, node_ptr.addr = addr; H5_CHECKED_ASSIGN(node_ptr.node_nrec, uint16_t, nrec, unsigned) if(NULL == (leaf = H5B2__protect_leaf(hdr, NULL, &node_ptr, FALSE, H5AC__READ_ONLY_FLAG))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree leaf node") /* Print opening message */ HDfprintf(stream, "%*sv2 B-tree Leaf Node...\n", indent, ""); diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h index 552cebb..27229f1 100644 --- a/src/H5B2pkg.h +++ b/src/H5B2pkg.h @@ -467,7 +467,7 @@ H5_DLL herr_t H5B2__assert_leaf2(const H5B2_hdr_t *hdr, const H5B2_leaf_t *leaf, /* Testing routines */ #ifdef H5B2_TESTING -H5_DLL herr_t H5B2_get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr); +H5_DLL herr_t H5B2__get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr); H5_DLL int H5B2__get_node_depth_test(H5B2_t *bt2, void *udata); H5_DLL herr_t H5B2__get_node_info_test(H5B2_t *bt2, void *udata, H5B2_node_info_test_t *ninfo); diff --git a/src/H5B2test.c b/src/H5B2test.c index 49fe3af..0f4a39c 100644 --- a/src/H5B2test.c +++ b/src/H5B2test.c @@ -469,12 +469,11 @@ H5B2__test2_debug(FILE *stream, int indent, int fwidth, const void *record, /*------------------------------------------------------------------------- - * Function: H5B2_get_root_addr_test + * Function: H5B2__get_root_addr_test * - * Purpose: Retrieve the root node's address + * Purpose: Retrieve the root node's address * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Saturday, February 26, 2005 @@ -482,7 +481,7 @@ H5B2__test2_debug(FILE *stream, int indent, int fwidth, const void *record, *------------------------------------------------------------------------- */ herr_t -H5B2_get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr) +H5B2__get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr) { FUNC_ENTER_NOAPI_NOINIT_NOERR @@ -494,16 +493,15 @@ H5B2_get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr) *root_addr = bt2->hdr->root.addr; FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5B2_get_root_addr_test() */ +} /* H5B2__get_root_addr_test() */ /*------------------------------------------------------------------------- - * Function: H5B2__get_node_info_test + * Function: H5B2__get_node_info_test * - * Purpose: Determine information about a node holding a record in the B-tree + * Purpose: Determine information about a node holding a record in the B-tree * - * Return: Success: non-negative - * Failure: negative + * Return: SUCCEED/FAIL * * Programmer: Quincey Koziol * Thursday, August 31, 2006 @@ -647,15 +645,16 @@ done: /*------------------------------------------------------------------------- - * Function: H5B2__get_node_depth_test + * Function: H5B2__get_node_depth_test * - * Purpose: Determine the depth of a node holding a record in the B-tree + * Purpose: Determine the depth of a node holding a record in the B-tree * - * Note: Just a simple wrapper around the H5B2__get_node_info_test() routine + * Note: Just a simple wrapper around the H5B2__get_node_info_test() routine * - * Return: Success: non-negative depth of the node where the record - * was found - * Failure: negative + * Return: Success: Non-negative depth of the node where the record + * was found + * + * Failure: -1 * * Programmer: Quincey Koziol * Saturday, August 26, 2006 @@ -675,7 +674,7 @@ H5B2__get_node_depth_test(H5B2_t *bt2, void *udata) /* Get information abou the node */ if(H5B2__get_node_info_test(bt2, udata, &ninfo) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "error looking up node info") + HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, (-1), "error looking up node info") /* Set return value */ ret_value = (int)ninfo.depth; @@ -31,8 +31,8 @@ #include "H5private.h" /* Generic Functions */ #include "H5ACprivate.h" /* Metadata cache */ #include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5FLprivate.h" /* Free Lists */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5FLprivate.h" /* Free Lists */ #include "H5Ipkg.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Oprivate.h" /* Object headers */ @@ -738,10 +738,10 @@ H5I_register(H5I_type_t type, const void *object, hbool_t app_ref) /* Create the struct & its ID */ new_id = H5I_MAKE(type, type_ptr->nextid); - id_ptr->id = new_id; - id_ptr->count = 1; /* initial reference count */ - id_ptr->app_count = !!app_ref; - id_ptr->obj_ptr = object; + id_ptr->id = new_id; + id_ptr->count = 1; /* initial reference count */ + id_ptr->app_count = !!app_ref; + id_ptr->obj_ptr = object; /* Insert into the type */ if (H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0) @@ -784,6 +784,7 @@ H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t FUNC_ENTER_NOAPI(FAIL) /* Check arguments */ + HDassert(object); /* Make sure ID is not already in use */ if(NULL != (id_ptr = H5I__find_id(id))) @@ -808,10 +809,10 @@ H5I_register_with_id(H5I_type_t type, const void *object, hbool_t app_ref, hid_t HGOTO_ERROR(H5E_ATOM, H5E_NOSPACE, FAIL, "memory allocation failed") /* Create the struct & insert requested ID */ - id_ptr->id = id; - id_ptr->count = 1; /*initial reference count*/ - id_ptr->app_count = !!app_ref; - id_ptr->obj_ptr = object; + id_ptr->id = id; + id_ptr->count = 1; /* initial reference count*/ + id_ptr->app_count = !!app_ref; + id_ptr->obj_ptr = object; /* Insert into the type */ if(H5SL_insert(type_ptr->ids, id_ptr, &id_ptr->id) < 0) @@ -862,51 +863,45 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_object + * Function: H5I_object * - * Purpose: Find an object pointer for the specified ID. + * Purpose: Find an object pointer for the specified ID. * - * Return: Success: Non-null object pointer associated with the - * specified ID. - * Failure: NULL + * Return: Success: Non-null object pointer associated with the + * specified ID * - * Programmer: Unknown + * Failure: NULL * *------------------------------------------------------------------------- */ void * H5I_object(hid_t id) { - H5I_id_info_t *id_ptr; /*ptr to the new atom */ - void *ret_value = NULL; /*return value */ + H5I_id_info_t *id_ptr; /* Pointer to the new atom */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOERR /* General lookup of the ID */ if(NULL != (id_ptr = H5I__find_id(id))) { /* Get the object pointer to return */ - /* (Casting away const OK -QAK) */ - ret_value = (void *)id_ptr->obj_ptr; - } /* end if */ + ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */ + } FUNC_LEAVE_NOAPI(ret_value) } /* end H5I_object() */ /*------------------------------------------------------------------------- - * Function: H5Iobject_verify - * - * Purpose: Find an object pointer for the specified ID, verifying that - * its in a particular type. Public interface to - * H5I_object_verify. + * Function: H5Iobject_verify * - * Return: Success: Non-null object pointer associated with the - * specified ID. - * Failure: NULL + * Purpose: Find an object pointer for the specified ID, verifying that + * its in a particular type. Public interface to + * H5I_object_verify. * - * Programmer: Nathaniel Furrer - * James Laird - * Friday, April 23, 2004 + * Return: Success: Non-null object pointer associated with the + * specified ID. + * Failure: NULL * *------------------------------------------------------------------------- */ @@ -932,14 +927,14 @@ done: /*------------------------------------------------------------------------- - * Function: H5I_object_verify + * Function: H5I_object_verify * - * Purpose: Find an object pointer for the specified ID, verifying that - * its in a particular type. + * Purpose: Find an object pointer for the specified ID, verifying that + * its in a particular type. * - * Return: Success: Non-null object pointer associated with the - * specified ID. - * Failure: NULL + * Return: Success: Non-null object pointer associated with the + * specified ID. + * Failure: NULL * * Programmer: Quincey Koziol * Wednesday, July 31, 2002 @@ -949,8 +944,8 @@ done: void * H5I_object_verify(hid_t id, H5I_type_t id_type) { - H5I_id_info_t *id_ptr = NULL; /*ptr to the new atom */ - void *ret_value = NULL; /*return value */ + H5I_id_info_t *id_ptr = NULL; /* Pointer to the new atom */ + void *ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI_NOERR @@ -959,9 +954,8 @@ H5I_object_verify(hid_t id, H5I_type_t id_type) /* Verify that the type of the ID is correct & lookup the ID */ if(id_type == H5I_TYPE(id) && NULL != (id_ptr = H5I__find_id(id))) { /* Get the object pointer to return */ - /* (Casting away const OK -QAK) */ - ret_value = (void *)id_ptr->obj_ptr; - } /* end if */ + ret_value = (void *)id_ptr->obj_ptr; /* (Casting away const OK -QAK) */ + } FUNC_LEAVE_NOAPI(ret_value) } /* H5I_object_verify() */ @@ -1867,8 +1861,8 @@ done: * function, and then sets return value, based on the result of * that callback. * - * Return: Success: Non-negative on success - * Failure: Negative + * Return: Success: H5_ITER_CONT (0) or H5_ITER_STOP (1) + * Failure: H5_ITER_ERROR (-1) * *------------------------------------------------------------------------- */ @@ -1925,8 +1919,8 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) herr_t H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_ref) { - H5I_id_type_t *type_ptr; /*ptr to the type */ - herr_t ret_value = SUCCEED; /*return value */ + H5I_id_type_t *type_ptr; /* Pointer to the type */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -1941,9 +1935,9 @@ H5I_iterate(H5I_type_t type, H5I_search_func_t func, void *udata, hbool_t app_re herr_t iter_status; /* Iteration status */ /* Set up iterator user data */ - iter_udata.user_func = func; - iter_udata.user_udata = udata; - iter_udata.app_ref = app_ref; + iter_udata.user_func = func; + iter_udata.user_udata = udata; + iter_udata.app_ref = app_ref; /* Iterate over IDs */ if ((iter_status = H5SL_iterate(type_ptr->ids, H5I__iterate_cb, &iter_udata)) < 0) @@ -2020,16 +2014,16 @@ H5Iget_name(hid_t id, char *name/*out*/, size_t size) H5G_loc_t loc; /* Object location */ ssize_t ret_value; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE3("Zs", "ixz", id, name, size); /* Get object location */ if(H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object location") + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location") /* Call internal routine to retrieve object's name */ if((ret_value = H5I__get_name(&loc, name, size)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name") + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") done: FUNC_LEAVE_API(ret_value) @@ -2047,15 +2041,15 @@ done: * Return: Success: The length of the name * Failure: -1 * - * Programmer: Quincey Koziol - * January 9, 2018 + * Programmer: Quincey Koziol + * January 9, 2018 * *------------------------------------------------------------------------- */ static ssize_t H5I__get_name(const H5G_loc_t *loc, char *name, size_t size) { - ssize_t ret_value = FAIL; /* Return value */ + ssize_t ret_value = -1; /* Return value */ FUNC_ENTER_STATIC_VOL @@ -2064,7 +2058,7 @@ H5I__get_name(const H5G_loc_t *loc, char *name, size_t size) /* Retrieve object's name */ if((ret_value = H5G_get_name(loc, name, size, NULL)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name") + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") done: FUNC_LEAVE_NOAPI_VOL(ret_value) @@ -2086,7 +2080,7 @@ done: hid_t H5Iget_file_id(hid_t obj_id) { - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(FAIL) H5TRACE1("i", "i", obj_id); diff --git a/src/H5Ipkg.h b/src/H5Ipkg.h index 16d7d67..2c1d81f 100644 --- a/src/H5Ipkg.h +++ b/src/H5Ipkg.h @@ -67,7 +67,7 @@ /* Testing functions */ #ifdef H5I_TESTING -H5_DLL ssize_t H5I_get_name_test(hid_t id, char *name/*out*/, size_t size, +H5_DLL ssize_t H5I__get_name_test(hid_t id, char *name/*out*/, size_t size, hbool_t *cached); #endif /* H5I_TESTING */ diff --git a/src/H5Itest.c b/src/H5Itest.c index 426c026..4b54835 100644 --- a/src/H5Itest.c +++ b/src/H5Itest.c @@ -28,12 +28,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5ACprivate.h" /* Metadata cache */ -#include "H5CXprivate.h" /* API Contexts */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5Gprivate.h" /* Groups */ -#include "H5Ipkg.h" /* IDs */ +#include "H5private.h" /* Generic Functions */ +#include "H5ACprivate.h" /* Metadata cache */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Ipkg.h" /* IDs */ /****************/ @@ -63,44 +63,44 @@ /*------------------------------------------------------------------------- - * Function: H5I_get_name_test + * Function: H5I__get_name_test * - * Purpose: Testing version of H5Iget_name() + * Purpose: Testing version of H5Iget_name() * - * Return: Success: The length of name. - * Failure: -1 + * Return: Success: The length of name. + * Failure: -1 * - * Programmer: Quincey Koziol + * Programmer: Quincey Koziol * Tuesday, July 27, 2010 * *------------------------------------------------------------------------- */ ssize_t -H5I_get_name_test(hid_t id, char *name/*out*/, size_t size, hbool_t *cached) +H5I__get_name_test(hid_t id, char *name/*out*/, size_t size, hbool_t *cached) { - H5G_loc_t loc; /* Object location */ - hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ - ssize_t ret_value = -1; /* Return value */ + H5G_loc_t loc; /* Object location */ + hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ + ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* Get object location */ if(H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object location") + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object location") /* Set API context */ if(H5CX_push() < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set API context") + HGOTO_ERROR(H5E_SYM, H5E_CANTSET, (-1), "can't set API context") api_ctx_pushed = TRUE; /* Call internal group routine to retrieve object's name */ if((ret_value = H5G_get_name(&loc, name, size, cached)) < 0) - HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, FAIL, "can't retrieve object name") + HGOTO_ERROR(H5E_ATOM, H5E_CANTGET, (-1), "can't retrieve object name") done: if(api_ctx_pushed && H5CX_pop() < 0) - HDONE_ERROR(H5E_SYM, H5E_CANTRESET, FAIL, "can't reset API context") + HDONE_ERROR(H5E_SYM, H5E_CANTRESET, (-1), "can't reset API context") FUNC_LEAVE_NOAPI(ret_value) -} /* end H5I_get_name_test() */ +} /* end H5I__get_name_test() */ @@ -97,6 +97,9 @@ static herr_t H5MF__close_fstype(H5F_t *f, H5F_mem_page_t type); static herr_t H5MF__delete_fstype(H5F_t *f, H5F_mem_page_t type); static herr_t H5MF__close_delete_fstype(H5F_t *f, H5F_mem_page_t type); +/* Callbacks */ +static herr_t H5MF__sects_cb(H5FS_section_info_t *_sect, void *_udata); + /*********************/ /* Package Variables */ @@ -232,7 +235,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5MF_alloc_to_fs_type + * Function: H5MF__alloc_to_fs_type * * Purpose: Map "alloc_type" to the free-space manager type * @@ -244,9 +247,9 @@ done: *------------------------------------------------------------------------- */ void -H5MF_alloc_to_fs_type(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type) +H5MF__alloc_to_fs_type(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR HDassert(f); HDassert(fs_type); @@ -271,7 +274,7 @@ H5MF_alloc_to_fs_type(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_pag *fs_type = (H5F_mem_page_t)H5MF_ALLOC_TO_FS_AGGR_TYPE(f, alloc_type); FUNC_LEAVE_NOAPI_VOID -} /* end H5MF_alloc_to_fs_type() */ +} /* end H5MF__alloc_to_fs_type() */ /*------------------------------------------------------------------------- @@ -379,10 +382,10 @@ H5MF__create_fstype(H5F_t *f, H5F_mem_page_t type) H5MF_FSPACE_SECT_CLS_LARGE }; H5FS_create_t fs_create; /* Free space creation parameters */ hsize_t alignment; /* Alignment to use */ - hsize_t threshold; /* Threshold to use */ + hsize_t threshold; /* Threshold to use */ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5AC_ring_t fsm_ring; /* Ring of FSM */ - herr_t ret_value = SUCCEED; /* Return value */ + H5AC_ring_t fsm_ring; /* Ring of FSM */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC_TAG(H5AC__FREESPACE_TAG) @@ -509,7 +512,7 @@ static herr_t H5MF__delete_fstype(H5F_t *f, H5F_mem_page_t type) { H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5AC_ring_t fsm_ring; /* Ring of FSM */ + H5AC_ring_t fsm_ring = H5AC_RING_INV; /* Ring of FSM */ haddr_t tmp_fs_addr; /* Temporary holder for free space manager address */ herr_t ret_value = SUCCEED; /* Return value */ @@ -628,10 +631,10 @@ herr_t H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_section_t *node) { H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5AC_ring_t fsm_ring; /* Ring of FSM */ - H5MF_sect_ud_t udata; /* User data for callback */ - H5F_mem_page_t fs_type; /* Free space type (mapped from allocation type) */ - herr_t ret_value = SUCCEED; /* Return value */ + H5AC_ring_t fsm_ring = H5AC_RING_INV; /* Ring of FSM */ + H5MF_sect_ud_t udata; /* User data for callback */ + H5F_mem_page_t fs_type; /* Free space type (mapped from allocation type) */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_PACKAGE_TAG(H5AC__FREESPACE_TAG) @@ -639,7 +642,7 @@ H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_sectio HDassert(fspace); HDassert(node); - H5MF_alloc_to_fs_type(f, alloc_type, node->sect_info.size, &fs_type); + H5MF__alloc_to_fs_type(f, alloc_type, node->sect_info.size, &fs_type); /* Construct user data for callbacks */ udata.f = f; @@ -688,7 +691,7 @@ H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, haddr_t *addr) { H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5AC_ring_t fsm_ring; /* Ring of FSM */ + H5AC_ring_t fsm_ring = H5AC_RING_INV; /* Ring of FSM */ H5MF_free_section_t *node; /* Free space section pointer */ htri_t ret_value = FAIL; /* Whether an existing free list node was found */ @@ -728,7 +731,7 @@ HDfprintf(stderr, "%s: freeing node\n", FUNC); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Free section node */ - if(H5MF_sect_free((H5FS_section_info_t *)node) < 0) + if(H5MF__sect_free((H5FS_section_info_t *)node) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") } /* end if */ else { @@ -776,7 +779,7 @@ haddr_t H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) { H5AC_ring_t fsm_ring = H5AC_RING_INV; /* free space manager ring */ - H5AC_ring_t orig_ring; /* Original ring value */ + H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ H5F_mem_page_t fs_type; /* Free space type (mapped from allocation type) */ haddr_t ret_value = HADDR_UNDEF; /* Return value */ @@ -797,7 +800,7 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "tidy of self referential fsm hack failed") } /* end if */ - H5MF_alloc_to_fs_type(f, alloc_type, size, &fs_type); + H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type); #ifdef H5MF_ALLOC_DEBUG_MORE HDfprintf(stderr, "%s: Check 1.0\n", FUNC); @@ -862,7 +865,7 @@ done: HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value, size); #endif /* H5MF_ALLOC_DEBUG */ #ifdef H5MF_ALLOC_DEBUG_DUMP -H5MF_sects_dump(f, stderr); +H5MF__sects_dump(f, stderr); #endif /* H5MF_ALLOC_DEBUG_DUMP */ FUNC_LEAVE_NOAPI_TAG(ret_value) @@ -903,7 +906,7 @@ H5MF__alloc_pagefs(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_type, size); #endif /* H5MF_ALLOC_DEBUG */ - H5MF_alloc_to_fs_type(f, alloc_type, size, &ptype); + H5MF__alloc_to_fs_type(f, alloc_type, size, &ptype); switch(ptype) { case H5F_MEM_PAGE_GENERIC: @@ -936,7 +939,7 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, HADDR_UNDEF, "can't initialize file free space") /* Create free space section for the fragment */ - if(NULL == (node = H5MF_sect_new(H5MF_FSPACE_SECT_LARGE, ret_value + size, frag_size))) + if(NULL == (node = H5MF__sect_new(H5MF_FSPACE_SECT_LARGE, ret_value + size, frag_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, HADDR_UNDEF, "can't initialize free space section") /* Add the fragment to the large free-space manager */ @@ -967,7 +970,7 @@ HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_typ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, HADDR_UNDEF, "can't initialize file free space") HDassert(f->shared->fs_man[ptype]); - if(NULL == (node = H5MF_sect_new(H5MF_FSPACE_SECT_SMALL, (new_page + size), (f->shared->fs_page_size - size)))) + if(NULL == (node = H5MF__sect_new(H5MF_FSPACE_SECT_SMALL, (new_page + size), (f->shared->fs_page_size - size)))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, HADDR_UNDEF, "can't initialize free space section") /* Add the remaining space in the page to the manager */ @@ -997,12 +1000,12 @@ done: HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value, size); #endif /* H5MF_ALLOC_DEBUG */ #ifdef H5MF_ALLOC_DEBUG_DUMP -H5MF_sects_dump(f, stderr); +H5MF__sects_dump(f, stderr); #endif /* H5MF_ALLOC_DEBUG_DUMP */ /* Release section node, if allocated and not added to section list or merged */ if(node) - if(H5MF_sect_free((H5FS_section_info_t *)node) < 0) + if(H5MF__sect_free((H5FS_section_info_t *)node) < 0) HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, HADDR_UNDEF, "can't free section node") FUNC_LEAVE_NOAPI_TAG(ret_value) @@ -1110,7 +1113,7 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "tidy of self referential fsm hack failed") } /* end if */ - H5MF_alloc_to_fs_type(f, alloc_type, size, &fs_type); + H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type); /* Set the ring type in the API context */ if(H5MF__fsm_type_is_self_referential(f, fs_type)) @@ -1197,7 +1200,7 @@ HDfprintf(stderr, "%s: dropping addr = %a, size = %Hu, on the floor!\n", FUNC, a /* Create the free-space section for the freed section */ ctype = H5MF_SECT_CLASS_TYPE(f, size); - if(NULL == (node = H5MF_sect_new(ctype, addr, size))) + if(NULL == (node = H5MF__sect_new(ctype, addr, size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space section") /* If size of the freed section is larger than threshold, add it to the free space manager */ @@ -1242,14 +1245,14 @@ done: /* Release section node, if allocated and not added to section list or merged */ if(node) - if(H5MF_sect_free((H5FS_section_info_t *)node) < 0) + if(H5MF__sect_free((H5FS_section_info_t *)node) < 0) HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); #endif /* H5MF_ALLOC_DEBUG */ #ifdef H5MF_ALLOC_DEBUG_DUMP -H5MF_sects_dump(f, stderr); +H5MF__sects_dump(f, stderr); #endif /* H5MF_ALLOC_DEBUG_DUMP */ FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5MF_xfree() */ @@ -1334,7 +1337,7 @@ HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_r } /* end if */ /* Get free space type from allocation type */ - H5MF_alloc_to_fs_type(f, alloc_type, size, &fs_type); + H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type); /* Set the ring type in the API context */ if(H5MF__fsm_type_is_self_referential(f, fs_type)) @@ -1365,7 +1368,7 @@ HDfprintf(stderr, "%s: extended = %t\n", FUNC, ret_value); HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space") /* Create free space section for the fragment */ - if(NULL == (node = H5MF_sect_new(H5MF_FSPACE_SECT_LARGE, end + extra_requested, frag_size))) + if(NULL == (node = H5MF__sect_new(H5MF_FSPACE_SECT_LARGE, end + extra_requested, frag_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space section") /* Add the fragment to the large-sized free-space manager */ @@ -1436,7 +1439,7 @@ done: HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value); #endif /* H5MF_ALLOC_DEBUG */ #ifdef H5MF_ALLOC_DEBUG_DUMP -H5MF_sects_dump(f, stderr); +H5MF__sects_dump(f, stderr); #endif /* H5MF_ALLOC_DEBUG_DUMP */ FUNC_LEAVE_NOAPI_TAG(ret_value) @@ -1464,9 +1467,9 @@ H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) H5MF_sect_ud_t udata; /* User data for callback */ H5FS_section_class_t *sect_cls; /* Section class */ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5AC_ring_t fsm_ring; /* Ring of FSM */ - H5F_mem_page_t fs_type; /* Free space type */ - htri_t ret_value = FALSE; /* Return value */ + H5AC_ring_t fsm_ring = H5AC_RING_INV; /* Ring of FSM */ + H5F_mem_page_t fs_type; /* Free space type */ + htri_t ret_value = FALSE; /* Return value */ FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) #ifdef H5MF_ALLOC_DEBUG @@ -1485,7 +1488,7 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN HDassert(sect_cls); /* Get free space type from allocation type */ - H5MF_alloc_to_fs_type(f, alloc_type, size, &fs_type); + H5MF__alloc_to_fs_type(f, alloc_type, size, &fs_type); /* Set the ring type in the API context */ if(H5MF__fsm_type_is_self_referential(f, fs_type)) @@ -1495,7 +1498,7 @@ HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUN H5AC_set_ring(fsm_ring, &orig_ring); /* Create free-space section for block */ - if(NULL == (node = H5MF_sect_new(sect_cls->type, addr, size))) + if(NULL == (node = H5MF__sect_new(sect_cls->type, addr, size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize free space section") /* Construct user data for callbacks */ @@ -1522,7 +1525,7 @@ done: H5AC_set_ring(orig_ring, NULL); /* Free section node allocated */ - if(node && H5MF_sect_free((H5FS_section_info_t *)node) < 0) + if(node && H5MF__sect_free((H5FS_section_info_t *)node) < 0) HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") #ifdef H5MF_ALLOC_DEBUG @@ -1561,10 +1564,11 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); if(H5F_PAGED_AGGR(f)) { if((ret_value = H5MF__close_pagefs(f)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't close free-space managers for 'page' file space") - } /* end if */ - else + } + else { if((ret_value = H5MF__close_aggrfs(f)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "can't close free-space managers for 'aggr' file space") + } done: #ifdef H5MF_ALLOC_DEBUG @@ -1650,8 +1654,8 @@ herr_t H5MF_try_close(H5F_t *f) { H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5AC_ring_t curr_ring; /* Current ring value */ - H5AC_ring_t needed_ring; /* Ring value needed for this iteration */ + H5AC_ring_t curr_ring = H5AC_RING_INV; /* Current ring value */ + H5AC_ring_t needed_ring = H5AC_RING_INV; /* Ring value needed for this iteration */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) @@ -1689,7 +1693,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); /* Set the ring type in the API context. In most cases, we will * need H5AC_RING_RDFSM, so initialy set the ring in - * the DXPL to that value. We will alter this later if needed. + * the context to that value. We will alter this later if needed. */ H5AC_set_ring(H5AC_RING_RDFSM, &orig_ring); curr_ring = H5AC_RING_RDFSM; @@ -1706,6 +1710,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring ) { H5AC_set_ring(needed_ring, NULL); curr_ring = needed_ring; @@ -1727,6 +1732,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, NULL); curr_ring = needed_ring; @@ -1765,10 +1771,10 @@ static herr_t H5MF__close_aggrfs(H5F_t *f) { H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5AC_ring_t curr_ring; /* Current ring value */ - H5AC_ring_t needed_ring; /* Ring value needed for this iteration. */ + H5AC_ring_t curr_ring = H5AC_RING_INV; /* Current ring value */ + H5AC_ring_t needed_ring = H5AC_RING_INV; /* Ring value needed for this iteration. */ H5FD_mem_t type; /* Memory type for iteration */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC_TAG(H5AC__FREESPACE_TAG) #ifdef H5MF_ALLOC_DEBUG @@ -1783,7 +1789,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); /* Set the ring type in the API context. In most cases, we will * need H5AC_RING_RDFSM, so initialy set the ring in - * the DXPL to that value. We will alter this later if needed. + * the context to that value. We will alter this later if needed. */ H5AC_set_ring(H5AC_RING_RDFSM, &orig_ring); curr_ring = H5AC_RING_RDFSM; @@ -1842,6 +1848,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, NULL); curr_ring = needed_ring; @@ -1929,8 +1936,8 @@ static herr_t H5MF__close_pagefs(H5F_t *f) { H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5AC_ring_t curr_ring; /* Current ring value */ - H5AC_ring_t needed_ring; /* Ring value needed for this iteration. */ + H5AC_ring_t curr_ring = H5AC_RING_INV; /* Current ring value */ + H5AC_ring_t needed_ring = H5AC_RING_INV; /* Ring value needed for this iteration. */ H5F_mem_page_t ptype; /* Memory type for iteration */ H5O_fsinfo_t fsinfo; /* File space info message */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1950,7 +1957,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); /* Set the ring type in the API context. In most cases, we will * need H5AC_RING_RDFSM, so initialy set the ring in - * the DXPL to that value. We will alter this later if needed. + * the context to that value. We will alter this later if needed. */ H5AC_set_ring(H5AC_RING_RDFSM, &orig_ring); curr_ring = H5AC_RING_RDFSM; @@ -2005,6 +2012,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, NULL); curr_ring = needed_ring; @@ -2102,8 +2110,8 @@ static herr_t H5MF__close_shrink_eoa(H5F_t *f) { H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5AC_ring_t curr_ring; /* Current ring value */ - H5AC_ring_t needed_ring; /* Ring value needed for this iteration. */ + H5AC_ring_t curr_ring = H5AC_RING_INV; /* Current ring value */ + H5AC_ring_t needed_ring = H5AC_RING_INV; /* Ring value needed for this iteration. */ H5F_mem_t type; H5F_mem_page_t ptype; /* Memory type for iteration */ hbool_t eoa_shrank; /* Whether an EOA shrink occurs */ @@ -2139,6 +2147,7 @@ H5MF__close_shrink_eoa(H5F_t *f) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, NULL); curr_ring = needed_ring; @@ -2162,6 +2171,7 @@ H5MF__close_shrink_eoa(H5F_t *f) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, NULL); curr_ring = needed_ring; @@ -2222,9 +2232,9 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) htri_t fs_started[H5F_MEM_PAGE_NTYPES]; /* Indicate whether the free-space manager has been started */ haddr_t fs_eoa[H5FD_MEM_NTYPES]; /* EAO for each free-space manager */ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5AC_ring_t curr_ring; /* Current ring value */ - H5AC_ring_t needed_ring; /* Ring value needed for this iteration. */ - herr_t ret_value = SUCCEED; /* Return value */ + H5AC_ring_t curr_ring = H5AC_RING_INV; /* Current ring value */ + H5AC_ring_t needed_ring = H5AC_RING_INV; /* Ring value needed for this iteration. */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) @@ -2235,7 +2245,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) /* Set the ring type in the API context. In most cases, we will * need H5AC_RING_RDFSM, so initialy set the ring in - * the DXPL to that value. We will alter this later if needed. + * the context to that value. We will alter this later if needed. */ H5AC_set_ring(H5AC_RING_RDFSM, &orig_ring); curr_ring = H5AC_RING_RDFSM; @@ -2256,11 +2266,11 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) if(!H5F_PAGED_AGGR(f)) { /* Retrieve metadata aggregator info, if available */ - if(H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size) < 0) + if(H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats") /* Retrieve 'small data' aggregator info, if available */ - if(H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size) < 0) + if(H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query small data aggregator stats") } /* end if */ @@ -2342,7 +2352,8 @@ done: * Purpose: To retrieve free-space section information for * paged or non-paged aggregation * - * Return: SUCCEED/FAIL + * Return: Success: Number of free sections + * Failure: -1 * * Programmer: Vailin Choi; Dec 2012 * @@ -2352,15 +2363,15 @@ ssize_t H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t *sect_info) { H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5AC_ring_t curr_ring; /* Current ring value */ - H5AC_ring_t needed_ring; /* Ring value needed for this iteration. */ + H5AC_ring_t curr_ring = H5AC_RING_INV; /* Current ring value */ + H5AC_ring_t needed_ring = H5AC_RING_INV; /* Ring value needed for this iteration. */ size_t total_sects = 0; /* Total number of sections */ H5MF_sect_iter_ud_t sect_udata; /* User data for callback */ H5F_mem_page_t start_type, end_type; /* Memory types to iterate over */ H5F_mem_page_t ty; /* Memory type for iteration */ ssize_t ret_value = -1; /* Return value */ - FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) + FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, (-1)) /* check args */ HDassert(f); @@ -2382,11 +2393,11 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t if(f->shared->first_alloc_dealloc) { if(H5AC_cache_image_pending(f)) { if(H5AC_force_cache_image_load(f) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "forced cache image load failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, (-1), "forced cache image load failed") } /* end if */ else { if(H5MF_tidy_self_referential_fsm_hack(f) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "tidy of self referential fsm hack failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, (-1), "tidy of self referential fsm hack failed") } /* end else */ } /* end if */ @@ -2409,7 +2420,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t /* Set the ring type in the API context. In most cases, we will * need H5AC_RING_RDFSM, so initialy set the ring in - * the DXPL to that value. We will alter this later if needed. + * the context to that value. We will alter this later if needed. */ H5AC_set_ring(H5AC_RING_RDFSM, &orig_ring); curr_ring = H5AC_RING_RDFSM; @@ -2431,7 +2442,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t if(!f->shared->fs_man[ty] && H5F_addr_defined(f->shared->fs_addr[ty])) { if(H5MF__open_fstype(f, ty) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't open the free space manager") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, (-1), "can't open the free space manager") HDassert(f->shared->fs_man[ty]); fs_started = TRUE; } /* end if */ @@ -2439,7 +2450,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t /* Check if there's free space sections of this type */ if(f->shared->fs_man[ty]) if(H5MF__get_free_sects(f, f->shared->fs_man[ty], §_udata, &nums) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't get section info for the free space manager") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, (-1), "can't get section info for the free space manager") /* Increment total # of sections */ total_sects += nums; @@ -2447,7 +2458,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t /* Close the free space manager of this type, if we started it here */ if(fs_started) if(H5MF__close_fstype(f, ty) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCLOSEOBJ, FAIL, "can't close file free space") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCLOSEOBJ, (-1), "can't close file free space") if((H5F_PAGED_AGGR(f)) && (type != H5FD_MEM_DEFAULT)) ty = (H5F_mem_page_t)(ty + H5FD_MEM_NTYPES - 2); } /* end for */ @@ -2465,7 +2476,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5MF_sects_cb() + * Function: H5MF__sects_cb() * * Purpose: Iterator callback for each free-space section * Retrieve address and size into user data @@ -2478,12 +2489,12 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5MF_sects_cb(H5FS_section_info_t *_sect, void *_udata) +H5MF__sects_cb(H5FS_section_info_t *_sect, void *_udata) { H5MF_free_section_t *sect = (H5MF_free_section_t *)_sect; H5MF_sect_iter_ud_t *udata = (H5MF_sect_iter_ud_t *)_udata; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR if(udata->sect_idx < udata->sect_count) { udata->sects[udata->sect_idx].addr = sect->sect_info.addr; @@ -2492,7 +2503,7 @@ H5MF_sects_cb(H5FS_section_info_t *_sect, void *_udata) } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5MF_sects_cb() */ +} /* H5MF__sects_cb() */ /*------------------------------------------------------------------------- @@ -2513,7 +2524,7 @@ H5MF__get_free_sects(H5F_t *f, H5FS_t *fspace, H5MF_sect_iter_ud_t *sect_udata, hsize_t hnums = 0; /* # of sections */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_PACKAGE /* check args */ HDassert(f); @@ -2529,7 +2540,7 @@ H5MF__get_free_sects(H5F_t *f, H5FS_t *fspace, H5MF_sect_iter_ud_t *sect_udata, /* Check if we should retrieve the section info */ if(sect_udata->sects && *nums > 0) /* Iterate over all the free space sections of this type, adding them to the user's section info */ - if(H5FS_sect_iterate(f, fspace, H5MF_sects_cb, sect_udata) < 0) + if(H5FS_sect_iterate(f, fspace, H5MF__sects_cb, sect_udata) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_BADITER, FAIL, "can't iterate over sections") done: @@ -2648,8 +2659,8 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) H5O_fsinfo_t fsinfo; /* Free space manager info message */ H5FS_stat_t fs_stat; /* Information for free-space manager */ H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */ - H5AC_ring_t curr_ring; /* Current ring value */ - H5AC_ring_t needed_ring; /* Ring value needed for this iteration. */ + H5AC_ring_t curr_ring = H5AC_RING_INV; /* Current ring value */ + H5AC_ring_t needed_ring = H5AC_RING_INV; /* Ring value needed for this iteration */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) @@ -2744,7 +2755,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) break; for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5F_mem_t, mem_type)) { - H5MF_alloc_to_fs_type(f, mem_type, alloc_size, &fsm_type); + H5MF__alloc_to_fs_type(f, mem_type, alloc_size, &fsm_type); if(pass_count == 0) { /* this is the first pass */ HDassert(fsm_type > H5F_MEM_PAGE_DEFAULT); @@ -2781,6 +2792,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, NULL); curr_ring = needed_ring; @@ -2888,7 +2900,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) break; for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5F_mem_t, mem_type)) { - H5MF_alloc_to_fs_type(f, mem_type, alloc_size, &fsm_type); + H5MF__alloc_to_fs_type(f, mem_type, alloc_size, &fsm_type); if(pass_count == 0) { /* this is the first pass */ HDassert(fsm_type > H5F_MEM_PAGE_DEFAULT); @@ -2906,6 +2918,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) needed_ring = H5AC_RING_MDFSM; else needed_ring = H5AC_RING_RDFSM; + if(needed_ring != curr_ring) { H5AC_set_ring(needed_ring, NULL); curr_ring = needed_ring; @@ -3136,8 +3149,8 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) /* should only be called if file is opened R/W */ HDassert(H5F_INTENT(f) & H5F_ACC_RDWR); - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fs_type); - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fs_type); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fs_type); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fs_type); HDassert(sm_fshdr_fs_type > H5F_MEM_PAGE_DEFAULT); HDassert(sm_fshdr_fs_type < H5F_MEM_PAGE_LARGE_SUPER); @@ -3153,8 +3166,8 @@ H5MF_settle_meta_data_fsm(H5F_t *f, hbool_t *fsm_settled) sm_sinfo_fspace = f->shared->fs_man[sm_fssinfo_fs_type]; if(H5F_PAGED_AGGR(f)) { - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fs_type); - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fs_type); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fs_type); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fs_type); HDassert(lg_fshdr_fs_type >= H5F_MEM_PAGE_LARGE_SUPER); HDassert(lg_fshdr_fs_type < H5F_MEM_PAGE_NTYPES); @@ -3398,7 +3411,7 @@ H5MF__fsm_type_is_self_referential(H5F_t *f, H5F_mem_page_t fsm_type) H5F_mem_page_t lg_fssinfo_fsm; hbool_t result = FALSE; - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Sanity check */ HDassert(f); @@ -3406,12 +3419,12 @@ H5MF__fsm_type_is_self_referential(H5F_t *f, H5F_mem_page_t fsm_type) HDassert(fsm_type >= H5F_MEM_PAGE_DEFAULT); HDassert(fsm_type < H5F_MEM_PAGE_NTYPES); - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); if(H5F_PAGED_AGGR(f)) { - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm); - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm); result = (fsm_type == sm_fshdr_fsm) || (fsm_type == sm_fssinfo_fsm) || (fsm_type == lg_fshdr_fsm) || (fsm_type == lg_fssinfo_fsm); @@ -3460,15 +3473,15 @@ H5MF__fsm_is_self_referential(H5F_t *f, H5FS_t *fspace) HDassert(f->shared); HDassert(fspace); - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fsm); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fsm); if(H5F_PAGED_AGGR(f)) { H5F_mem_page_t lg_fshdr_fsm; H5F_mem_page_t lg_fssinfo_fsm; - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm); - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fsm); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fsm); result = (fspace == f->shared->fs_man[sm_fshdr_fsm]) || (fspace == f->shared->fs_man[sm_fssinfo_fsm]) || @@ -3609,8 +3622,8 @@ H5MF_tidy_self_referential_fsm_hack(H5F_t *f) * this -- we can use the regular I/O methods even if * paged aggregation and page buffering is enabled. */ - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fs_type); - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fs_type); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, (size_t)1, &sm_fshdr_fs_type); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, (size_t)1, &sm_fssinfo_fs_type); HDassert(sm_fshdr_fs_type > H5F_MEM_PAGE_DEFAULT); HDassert(sm_fshdr_fs_type < H5F_MEM_PAGE_LARGE_SUPER); @@ -3648,8 +3661,8 @@ H5MF_tidy_self_referential_fsm_hack(H5F_t *f) } /* end if */ if(H5F_PAGED_AGGR(f)) { - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fs_type); - H5MF_alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fs_type); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_HDR, f->shared->fs_page_size + 1, &lg_fshdr_fs_type); + H5MF__alloc_to_fs_type(f, H5FD_MEM_FSPACE_SINFO, f->shared->fs_page_size + 1, &lg_fssinfo_fs_type); HDassert(lg_fshdr_fs_type >= H5F_MEM_PAGE_LARGE_SUPER); HDassert(lg_fshdr_fs_type < H5F_MEM_PAGE_NTYPES); diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c index cd80a10..5ab1834 100644 --- a/src/H5MFaggr.c +++ b/src/H5MFaggr.c @@ -59,6 +59,8 @@ static herr_t H5MF__aggr_free(H5F_t *f, H5FD_mem_t type, H5F_blk_aggr_t *aggr); static haddr_t H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5FD_mem_t type, hsize_t size); +static herr_t H5MF__aggr_reset(H5F_t *f, H5F_blk_aggr_t *aggr); +static htri_t H5MF__aggr_can_shrink_eoa(H5F_t *f, H5FD_mem_t type, H5F_blk_aggr_t *aggr); /*********************/ @@ -179,7 +181,7 @@ HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size); /* * If the aggregation feature is enabled for this file and strategy is not H5F_FILE_SPACE_NONE, * allocate "generic" space and sub-allocate out of that, if possible. - * Otherwise just allocate through H5F_alloc(). + * Otherwise just allocate through H5F__alloc(). */ if((f->shared->feature_flags & aggr->feature_flag) && f->shared->fs_strategy != H5F_FSPACE_STRATEGY_NONE) { haddr_t aggr_frag_addr = HADDR_UNDEF; /* Address of aggregrator fragment */ @@ -193,18 +195,18 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz #endif /* H5MF_AGGR_DEBUG */ /* Turn off alignment if allocation < threshold */ - alignment = H5F_ALIGNMENT(f); - if(!((alignment > 1) && (size >= H5F_THRESHOLD(f)))) - alignment = 0; /* no alignment */ + alignment = H5F_ALIGNMENT(f); + if(!((alignment > 1) && (size >= H5F_THRESHOLD(f)))) + alignment = 0; /* no alignment */ /* Generate fragment if aggregator is mis-aligned */ - if(alignment && H5F_addr_gt(aggr->addr, 0) && (aggr_mis_align = (aggr->addr + H5F_BASE_ADDR(f)) % alignment)) { - aggr_frag_addr = aggr->addr; - aggr_frag_size = alignment - aggr_mis_align; - } /* end if */ + if(alignment && H5F_addr_gt(aggr->addr, 0) && (aggr_mis_align = (aggr->addr + H5F_BASE_ADDR(f)) % alignment)) { + aggr_frag_addr = aggr->addr; + aggr_frag_size = alignment - aggr_mis_align; + } /* end if */ - alloc_type = aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA ? H5FD_MEM_DEFAULT : H5FD_MEM_DRAW; - other_alloc_type = other_aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA ? H5FD_MEM_DEFAULT : H5FD_MEM_DRAW; + alloc_type = aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA ? H5FD_MEM_DEFAULT : H5FD_MEM_DRAW; + other_alloc_type = other_aggr->feature_flag == H5FD_FEAT_AGGREGATE_METADATA ? H5FD_MEM_DEFAULT : H5FD_MEM_DRAW; /* Check if the space requested is larger than the space left in the block */ if((size + aggr_frag_size) > aggr->size) { @@ -212,73 +214,74 @@ HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_siz /* Check if the block asked for is too large for 'normal' aggregator block */ if(size >= aggr->alloc_size) { - hsize_t ext_size = size + aggr_frag_size; + hsize_t ext_size = size + aggr_frag_size; /* Check for overlapping into file's temporary allocation space */ if(H5F_addr_gt((aggr->addr + aggr->size + ext_size), f->shared->tmp_addr)) HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space") - if((aggr->addr > 0) && (extended = H5F__try_extend(f, alloc_type, (aggr->addr + aggr->size), ext_size)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space") - else if (extended) { - /* aggr->size is unchanged */ - ret_value = aggr->addr + aggr_frag_size; - aggr->addr += ext_size; - aggr->tot_size += ext_size; - } else { + if((aggr->addr > 0) && (extended = H5F__try_extend(f, alloc_type, (aggr->addr + aggr->size), ext_size)) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space") + else if(extended) { + /* aggr->size is unchanged */ + ret_value = aggr->addr + aggr_frag_size; + aggr->addr += ext_size; + aggr->tot_size += ext_size; + } + else { /* Release "other" aggregator, if it exists, is at the end of the allocated space, * has allocated more than one block and the unallocated space is greater than its * allocation block size. */ - if((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) && - (other_aggr->tot_size > other_aggr->size) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) { + if((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) && + (other_aggr->tot_size > other_aggr->size) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) { if(H5MF__aggr_free(f, other_alloc_type, other_aggr) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation block") - } /* end if */ + } /* end if */ /* Allocate space from the VFD (i.e. at the end of the file) */ - if(HADDR_UNDEF == (ret_value = H5F__alloc(f, alloc_type, size, &eoa_frag_addr, &eoa_frag_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space") + if(HADDR_UNDEF == (ret_value = H5F__alloc(f, alloc_type, size, &eoa_frag_addr, &eoa_frag_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space") } /* end else */ } /* end if */ - else { - hsize_t ext_size = aggr->alloc_size; + else { + hsize_t ext_size = aggr->alloc_size; /* Allocate another block */ #ifdef H5MF_AGGR_DEBUG HDfprintf(stderr, "%s: Allocating block\n", FUNC); #endif /* H5MF_AGGR_DEBUG */ - if(aggr_frag_size > (ext_size - size)) - ext_size += (aggr_frag_size - (ext_size - size)); + if(aggr_frag_size > (ext_size - size)) + ext_size += (aggr_frag_size - (ext_size - size)); /* Check for overlapping into file's temporary allocation space */ if(H5F_addr_gt((aggr->addr + aggr->size + ext_size), f->shared->tmp_addr)) HGOTO_ERROR(H5E_RESOURCE, H5E_BADRANGE, HADDR_UNDEF, "'normal' file space allocation request will overlap into 'temporary' file space") - if((aggr->addr > 0) && (extended = H5F__try_extend(f, alloc_type, (aggr->addr + aggr->size), ext_size)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space") - else if(extended) { - aggr->addr += aggr_frag_size; - aggr->size += (ext_size - aggr_frag_size); - aggr->tot_size += ext_size; - } /* end else-if */ - else { + if((aggr->addr > 0) && (extended = H5F__try_extend(f, alloc_type, (aggr->addr + aggr->size), ext_size)) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't extending space") + else if(extended) { + aggr->addr += aggr_frag_size; + aggr->size += (ext_size - aggr_frag_size); + aggr->tot_size += ext_size; + } /* end else-if */ + else { haddr_t new_space; /* Address of new space allocated */ /* Release "other" aggregator, if it exists, is at the end of the allocated space, * has allocated more than one block and the unallocated space is greater than its * allocation block size. */ - if((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) && - (other_aggr->tot_size > other_aggr->size) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) { + if((other_aggr->size > 0) && (H5F_addr_eq((other_aggr->addr + other_aggr->size), eoa)) && + (other_aggr->tot_size > other_aggr->size) && ((other_aggr->tot_size - other_aggr->size) >= other_aggr->alloc_size)) { if(H5MF__aggr_free(f, other_alloc_type, other_aggr) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation block") - } /* end if */ + } /* end if */ /* Allocate space from the VFD (i.e. at the end of the file) */ - if(HADDR_UNDEF == (new_space = H5F__alloc(f, alloc_type, aggr->alloc_size, &eoa_frag_addr, &eoa_frag_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space") + if(HADDR_UNDEF == (new_space = H5F__alloc(f, alloc_type, aggr->alloc_size, &eoa_frag_addr, &eoa_frag_size))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space") /* Return the unused portion of the block to a free list */ if(aggr->size > 0) @@ -307,32 +310,32 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); } /* end else */ } /* end else */ - /* Allocate space out of the metadata block */ - ret_value = aggr->addr; - aggr->size -= size; - aggr->addr += size; + /* Allocate space out of the metadata block */ + ret_value = aggr->addr; + aggr->size -= size; + aggr->addr += size; } /* end else */ - /* Freeing any possible fragment due to file allocation */ - if(eoa_frag_size) - if(H5MF_xfree(f, alloc_type, eoa_frag_addr, eoa_frag_size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment") + /* Freeing any possible fragment due to file allocation */ + if(eoa_frag_size) + if(H5MF_xfree(f, alloc_type, eoa_frag_addr, eoa_frag_size) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment") - /* Freeing any possible fragment due to alignment in the block after extension */ + /* Freeing any possible fragment due to alignment in the block after extension */ if(extended && aggr_frag_size) - if(H5MF_xfree(f, alloc_type, aggr_frag_addr, aggr_frag_size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment") + if(H5MF_xfree(f, alloc_type, aggr_frag_addr, aggr_frag_size) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment") } /* end if */ else { /* Allocate space out of the block */ - ret_value = aggr->addr + aggr_frag_size; - aggr->size -= (size + aggr_frag_size); - aggr->addr += (size + aggr_frag_size); - - /* free any possible fragment */ - if(aggr_frag_size) - if(H5MF_xfree(f, alloc_type, aggr_frag_addr, aggr_frag_size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment") + ret_value = aggr->addr + aggr_frag_size; + aggr->size -= (size + aggr_frag_size); + aggr->addr += (size + aggr_frag_size); + + /* free any possible fragment */ + if(aggr_frag_size) + if(H5MF_xfree(f, alloc_type, aggr_frag_addr, aggr_frag_size) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free aggregation fragment") } /* end else */ } /* end if */ else { @@ -341,10 +344,10 @@ HDfprintf(stderr, "%s: Allocating block\n", FUNC); HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, HADDR_UNDEF, "can't allocate file space") /* Check if fragment was generated */ - if(eoa_frag_size) + if(eoa_frag_size) /* Put fragment on the free list */ - if(H5MF_xfree(f, type, eoa_frag_addr, eoa_frag_size) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment") + if(H5MF_xfree(f, type, eoa_frag_addr, eoa_frag_size) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, HADDR_UNDEF, "can't free eoa fragment") } /* end else */ /* Sanity check for overlapping into file's temporary allocation space */ @@ -403,53 +406,53 @@ H5MF__aggr_try_extend(H5F_t *f, H5F_blk_aggr_t *aggr, /* Check if this aggregator is active */ if(f->shared->feature_flags & aggr->feature_flag) { /* - * If the block being tested adjoins the beginning of the aggregator + * If the block being tested adjoins the beginning of the aggregator * block, check if the aggregator can accomodate the extension. */ if(H5F_addr_eq(blk_end, aggr->addr)) { - haddr_t eoa; /* EOA for the file */ - - /* Get the EOA for the file */ - if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, type))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "Unable to get eoa") - - /* If the aggregator is at the end of file: */ - if(H5F_addr_eq(eoa, aggr->addr + aggr->size)) { - /* If extra_requested is below percentage threshold, extend block into the aggregator. */ - if(extra_requested <= (hsize_t)(EXTEND_THRESHOLD * (float)aggr->size)) { - aggr->size -= extra_requested; - aggr->addr += extra_requested; - - /* Indicate success */ - HGOTO_DONE(TRUE); - } /* end if */ - /* - * If extra_requested is above percentage threshold: - * 1) "bubble" up the aggregator by aggr->alloc_size or extra_requested - * 2) extend the block into the aggregator - */ - else { - hsize_t extra = (extra_requested < aggr->alloc_size) ? aggr->alloc_size : extra_requested; + haddr_t eoa; /* EOA for the file */ + + /* Get the EOA for the file */ + if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, type))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "Unable to get eoa") + + /* If the aggregator is at the end of file: */ + if(H5F_addr_eq(eoa, aggr->addr + aggr->size)) { + /* If extra_requested is below percentage threshold, extend block into the aggregator. */ + if(extra_requested <= (hsize_t)(EXTEND_THRESHOLD * (float)aggr->size)) { + aggr->size -= extra_requested; + aggr->addr += extra_requested; + + /* Indicate success */ + HGOTO_DONE(TRUE); + } /* end if */ + /* + * If extra_requested is above percentage threshold: + * 1) "bubble" up the aggregator by aggr->alloc_size or extra_requested + * 2) extend the block into the aggregator + */ + else { + hsize_t extra = (extra_requested < aggr->alloc_size) ? aggr->alloc_size : extra_requested; if((ret_value = H5F__try_extend(f, type, (aggr->addr + aggr->size), extra)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending file") - else if(ret_value == TRUE) { - /* Shift the aggregator block by the extra requested */ + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending file") + else if(ret_value == TRUE) { + /* Shift the aggregator block by the extra requested */ /* (allocates the space for the extra_requested) */ - aggr->addr += extra_requested; + aggr->addr += extra_requested; - /* Add extra to the aggregator's total allocated amount */ - aggr->tot_size += extra; + /* Add extra to the aggregator's total allocated amount */ + aggr->tot_size += extra; /* Account for any space added to the aggregator */ /* (either 0 (if extra_requested > aggr->alloc_size) or * (aggr->alloc_size - extra_requested) -QAK */ - aggr->size += extra; - aggr->size -= extra_requested; - } /* end else-if */ - } /* end else */ - } /* end if */ + aggr->size += extra; + aggr->size -= extra_requested; + } /* end else-if */ + } /* end else */ + } /* end if */ else { /* The aggreator is not at end of file */ /* Check if aggregator has enough internal space to satisfy the extension. */ @@ -461,8 +464,8 @@ H5MF__aggr_try_extend(H5F_t *f, H5F_blk_aggr_t *aggr, /* Indicate success */ HGOTO_DONE(TRUE); } /* end if */ - } /* end else */ - } /* end if */ + } /* end else */ + } /* end if */ } /* end if */ done: @@ -471,7 +474,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5MF_aggr_can_absorb + * Function: H5MF__aggr_can_absorb * * Purpose: Check if a section adjoins an aggregator block and one can * absorb the other. @@ -486,12 +489,12 @@ done: *------------------------------------------------------------------------- */ htri_t -H5MF_aggr_can_absorb(const H5F_t *f, const H5F_blk_aggr_t *aggr, +H5MF__aggr_can_absorb(const H5F_t *f, const H5F_blk_aggr_t *aggr, const H5MF_free_section_t *sect, H5MF_shrink_type_t *shrink) { htri_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check args */ HDassert(f); @@ -506,7 +509,7 @@ H5MF_aggr_can_absorb(const H5F_t *f, const H5F_blk_aggr_t *aggr, if(H5F_addr_eq((sect->sect_info.addr + sect->sect_info.size), aggr->addr) || H5F_addr_eq((aggr->addr + aggr->size), sect->sect_info.addr)) { #ifdef H5MF_AGGR_DEBUG -HDfprintf(stderr, "%s: section {%a, %Hu} adjoins aggr = {%a, %Hu}\n", "H5MF_aggr_can_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, aggr->size); +HDfprintf(stderr, "%s: section {%a, %Hu} adjoins aggr = {%a, %Hu}\n", "H5MF__aggr_can_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, aggr->size); #endif /* H5MF_AGGR_DEBUG */ /* Check if aggregator would get too large and should be absorbed into section */ if((aggr->size + sect->sect_info.size) >= aggr->alloc_size) @@ -521,11 +524,11 @@ HDfprintf(stderr, "%s: section {%a, %Hu} adjoins aggr = {%a, %Hu}\n", "H5MF_aggr done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5MF_aggr_can_absorb() */ +} /* end H5MF__aggr_can_absorb() */ /*------------------------------------------------------------------------- - * Function: H5MF_aggr_absorb + * Function: H5MF__aggr_absorb * * Purpose: Absorb a free space section into an aggregator block or * vice versa. @@ -539,10 +542,10 @@ done: *------------------------------------------------------------------------- */ herr_t -H5MF_aggr_absorb(const H5F_t H5_ATTR_UNUSED *f, H5F_blk_aggr_t *aggr, H5MF_free_section_t *sect, +H5MF__aggr_absorb(const H5F_t H5_ATTR_UNUSED *f, H5F_blk_aggr_t *aggr, H5MF_free_section_t *sect, hbool_t allow_sect_absorb) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check args */ HDassert(f); @@ -556,7 +559,7 @@ H5MF_aggr_absorb(const H5F_t H5_ATTR_UNUSED *f, H5F_blk_aggr_t *aggr, H5MF_free_ /* Check if the section adjoins the beginning or end of the aggregator */ if(H5F_addr_eq((sect->sect_info.addr + sect->sect_info.size), aggr->addr)) { #ifdef H5MF_AGGR_DEBUG -HDfprintf(stderr, "%s: aggr {%a, %Hu} adjoins front of section = {%a, %Hu}\n", "H5MF_aggr_absorb", aggr->addr, aggr->size, sect->sect_info.addr, sect->sect_info.size); +HDfprintf(stderr, "%s: aggr {%a, %Hu} adjoins front of section = {%a, %Hu}\n", "H5MF__aggr_absorb", aggr->addr, aggr->size, sect->sect_info.addr, sect->sect_info.size); #endif /* H5MF_AGGR_DEBUG */ /* Absorb aggregator onto end of section */ sect->sect_info.size += aggr->size; @@ -566,7 +569,7 @@ HDfprintf(stderr, "%s: aggr {%a, %Hu} adjoins front of section = {%a, %Hu}\n", " HDassert(H5F_addr_eq((aggr->addr + aggr->size), sect->sect_info.addr)); #ifdef H5MF_AGGR_DEBUG -HDfprintf(stderr, "%s: aggr {%a, %Hu} adjoins end of section = {%a, %Hu}\n", "H5MF_aggr_absorb", aggr->addr, aggr->size, sect->sect_info.addr, sect->sect_info.size); +HDfprintf(stderr, "%s: aggr {%a, %Hu} adjoins end of section = {%a, %Hu}\n", "H5MF__aggr_absorb", aggr->addr, aggr->size, sect->sect_info.addr, sect->sect_info.size); #endif /* H5MF_AGGR_DEBUG */ /* Absorb aggregator onto beginning of section */ sect->sect_info.addr -= aggr->size; @@ -582,7 +585,7 @@ HDfprintf(stderr, "%s: aggr {%a, %Hu} adjoins end of section = {%a, %Hu}\n", "H5 /* Check if the section adjoins the beginning or end of the aggregator */ if(H5F_addr_eq((sect->sect_info.addr + sect->sect_info.size), aggr->addr)) { #ifdef H5MF_AGGR_DEBUG -HDfprintf(stderr, "%s: section {%a, %Hu} adjoins front of aggr = {%a, %Hu}\n", "H5MF_aggr_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, aggr->size); +HDfprintf(stderr, "%s: section {%a, %Hu} adjoins front of aggr = {%a, %Hu}\n", "H5MF__aggr_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, aggr->size); #endif /* H5MF_AGGR_DEBUG */ /* Absorb section onto front of aggregator */ aggr->addr -= sect->sect_info.size; @@ -598,7 +601,7 @@ HDfprintf(stderr, "%s: section {%a, %Hu} adjoins front of aggr = {%a, %Hu}\n", " HDassert(H5F_addr_eq((aggr->addr + aggr->size), sect->sect_info.addr)); #ifdef H5MF_AGGR_DEBUG -HDfprintf(stderr, "%s: section {%a, %Hu} adjoins end of aggr = {%a, %Hu}\n", "H5MF_aggr_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, aggr->size); +HDfprintf(stderr, "%s: section {%a, %Hu} adjoins end of aggr = {%a, %Hu}\n", "H5MF__aggr_absorb", sect->sect_info.addr, sect->sect_info.size, aggr->addr, aggr->size); #endif /* H5MF_AGGR_DEBUG */ /* Absorb section onto end of aggregator */ aggr->size += sect->sect_info.size; @@ -608,11 +611,11 @@ HDfprintf(stderr, "%s: section {%a, %Hu} adjoins end of aggr = {%a, %Hu}\n", "H5 } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5MF_aggr_absorb() */ +} /* end H5MF__aggr_absorb() */ /*------------------------------------------------------------------------- - * Function: H5MF_aggr_query + * Function: H5MF__aggr_query * * Purpose: Query a block aggregator's current address & size info * @@ -625,10 +628,10 @@ HDfprintf(stderr, "%s: section {%a, %Hu} adjoins end of aggr = {%a, %Hu}\n", "H5 *------------------------------------------------------------------------- */ herr_t -H5MF_aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr, haddr_t *addr, +H5MF__aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr, haddr_t *addr, hsize_t *size) { - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check args */ HDassert(f); @@ -644,7 +647,7 @@ H5MF_aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr, haddr_t *addr, } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5MF_aggr_query() */ +} /* end H5MF__aggr_query() */ /*------------------------------------------------------------------------- @@ -737,11 +740,11 @@ H5MF_free_aggrs(H5F_t *f) HDassert(f->shared->lf); /* Retrieve metadata aggregator info, if available */ - if(H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size) < 0) + if(H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats") /* Retrieve 'small data' aggregator info, if available */ - if(H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size) < 0) + if(H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query small data aggregator stats") /* Make certain we release the aggregator that's later in the file first */ @@ -774,7 +777,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5MF_aggr_can_shrink_eoa + * Function: H5MF__aggr_can_shrink_eoa * * Purpose: Check if the remaining space in the aggregator is at EOA * @@ -786,12 +789,12 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5MF_aggr_can_shrink_eoa(H5F_t *f, H5FD_mem_t type, H5F_blk_aggr_t *aggr) +H5MF__aggr_can_shrink_eoa(H5F_t *f, H5FD_mem_t type, H5F_blk_aggr_t *aggr) { haddr_t eoa = HADDR_UNDEF; /* EOA for the file */ htri_t ret_value = FALSE; /* Return value */ - FUNC_ENTER_NOAPI(FAIL) + FUNC_ENTER_STATIC /* Sanity check */ HDassert(f); @@ -808,7 +811,7 @@ H5MF_aggr_can_shrink_eoa(H5F_t *f, H5FD_mem_t type, H5F_blk_aggr_t *aggr) done: FUNC_LEAVE_NOAPI(ret_value) -} /* H5MF_aggr_can_shrink_eoa() */ +} /* H5MF__aggr_can_shrink_eoa() */ /*------------------------------------------------------------------------- @@ -882,17 +885,17 @@ H5MF_aggrs_try_shrink_eoa(H5F_t *f) HDassert(f); HDassert(f->shared); - if((ma_status = H5MF_aggr_can_shrink_eoa(f, H5FD_MEM_DEFAULT, &(f->shared->meta_aggr))) < 0) + if((ma_status = H5MF__aggr_can_shrink_eoa(f, H5FD_MEM_DEFAULT, &(f->shared->meta_aggr))) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query metadata aggregator stats") if(ma_status > 0) - if(H5MF__aggr_free(f, H5FD_MEM_DEFAULT, &(f->shared->meta_aggr)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa") + if(H5MF__aggr_free(f, H5FD_MEM_DEFAULT, &(f->shared->meta_aggr)) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa") - if((sda_status = H5MF_aggr_can_shrink_eoa(f, H5FD_MEM_DRAW, &(f->shared->sdata_aggr))) < 0) + if((sda_status = H5MF__aggr_can_shrink_eoa(f, H5FD_MEM_DRAW, &(f->shared->sdata_aggr))) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't query small data aggregator stats") if(sda_status > 0) - if(H5MF__aggr_free(f, H5FD_MEM_DRAW, &(f->shared->sdata_aggr)) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa") + if(H5MF__aggr_free(f, H5FD_MEM_DRAW, &(f->shared->sdata_aggr)) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTSHRINK, FAIL, "can't check for shrinking eoa") ret_value = (ma_status || sda_status); diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c index 592ca87..eedb72e 100644 --- a/src/H5MFdbg.c +++ b/src/H5MFdbg.c @@ -67,6 +67,7 @@ typedef struct { /* Local Prototypes */ /********************/ +static herr_t H5MF__sects_debug_cb(H5FS_section_info_t *_sect, void *_udata); /*********************/ /* Package Variables */ @@ -84,7 +85,7 @@ typedef struct { /*------------------------------------------------------------------------- - * Function: H5MF_sects_debug_cb + * Function: H5MF__sects_debug_cb * * Purpose: Prints debugging info about a free space section for a file * @@ -97,13 +98,13 @@ typedef struct { *------------------------------------------------------------------------- */ static herr_t -H5MF_sects_debug_cb(H5FS_section_info_t *_sect, void *_udata) +H5MF__sects_debug_cb(H5FS_section_info_t *_sect, void *_udata) { H5MF_free_section_t *sect = (H5MF_free_section_t *)_sect; /* Section to dump info */ H5MF_debug_iter_ud_t *udata = (H5MF_debug_iter_ud_t *)_udata; /* User data for callbacks */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* * Check arguments. @@ -136,7 +137,7 @@ H5MF_sects_debug_cb(H5FS_section_info_t *_sect, void *_udata) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5MF_sects_debug_cb() */ +} /* end H5MF__sects_debug_cb() */ /*------------------------------------------------------------------------- @@ -184,7 +185,7 @@ H5MF_sects_debug(H5F_t *f, haddr_t fs_addr, FILE *stream, int indent, int fwidth udata.fwidth = fwidth; /* Iterate over all the free space sections */ - if(H5FS_sect_iterate(f, f->shared->fs_man[type], H5MF_sects_debug_cb, &udata) < 0) + if(H5FS_sect_iterate(f, f->shared->fs_man[type], H5MF__sects_debug_cb, &udata) < 0) HGOTO_ERROR(H5E_HEAP, H5E_BADITER, FAIL, "can't iterate over heap's free space") /* Close the free space information */ @@ -201,7 +202,7 @@ done: #ifdef H5MF_ALLOC_DEBUG_DUMP /*------------------------------------------------------------------------- - * Function: H5MF_sects_dump + * Function: H5MF__sects_dump * * Purpose: Prints debugging info about free space sections for a file. * @@ -221,7 +222,7 @@ H5MF_sects_dump(H5F_t *f, FILE *stream) int fwidth = 50; /* Field width */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) + FUNC_ENTER_PACKAGE_TAG(H5AC__FREESPACE_TAG, FAIL) #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: Dumping file free space sections\n", FUNC); #endif /* H5MF_ALLOC_DEBUG */ @@ -234,7 +235,7 @@ HDfprintf(stderr, "%s: Dumping file free space sections\n", FUNC); /* Retrieve the 'eoa' for the file */ if(HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT))) - HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %a\n", FUNC, eoa); #endif /* H5MF_ALLOC_DEBUG */ @@ -276,13 +277,13 @@ HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %a\n", FUNC, eoa); hsize_t sda_size = 0; /* Size of "small data aggregator" */ /* Retrieve metadata aggregator info, if available */ - H5MF_aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); + H5MF__aggr_query(f, &(f->shared->meta_aggr), &ma_addr, &ma_size); #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: ma_addr = %a, ma_size = %Hu, end of ma = %a\n", FUNC, ma_addr, ma_size, (haddr_t)((ma_addr + ma_size) - 1)); #endif /* H5MF_ALLOC_DEBUG */ /* Retrieve 'small data' aggregator info, if available */ - H5MF_aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size); + H5MF__aggr_query(f, &(f->shared->sdata_aggr), &sda_addr, &sda_size); #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC, sda_addr, sda_size, (haddr_t)((sda_addr + sda_size) - 1)); #endif /* H5MF_ALLOC_DEBUG */ @@ -303,7 +304,7 @@ HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC, HDfprintf(stream, "%*sSections:\n", indent + 3, ""); /* If there is a free space manager for this type, iterate over them */ - if(f->shared->fs.aggr.fs_man[atype]) { + if(f->shared->fs_man[atype]) { H5MF_debug_iter_ud_t udata; /* User data for callbacks */ /* Prepare user data for section iteration callback */ @@ -327,6 +328,6 @@ HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC, done: HDfprintf(stderr, "%s: Done dumping file free space sections\n", FUNC); FUNC_LEAVE_NOAPI_TAG(ret_value) -} /* end H5MF_sects_dump() */ +} /* end H5MF__sects_dump() */ #endif /* H5MF_ALLOC_DEBUG_DUMP */ diff --git a/src/H5MFpkg.h b/src/H5MFpkg.h index fbf9ee8..ec4aab4 100644 --- a/src/H5MFpkg.h +++ b/src/H5MFpkg.h @@ -12,12 +12,12 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * Programmer: Quincey Koziol <koziol@hdfgroup.org> - * Tuesday, January 8, 2008 + * Programmer: Quincey Koziol <koziol@hdfgroup.org> + * Tuesday, January 8, 2008 * - * Purpose: This file contains declarations which are visible only within - * the H5MF package. Source files outside the H5MF package should - * include H5MFprivate.h instead. + * Purpose: This file contains declarations which are visible only within + * the H5MF package. Source files outside the H5MF package should + * include H5MFprivate.h instead. */ #if !(defined H5MF_FRIEND || defined H5MF_MODULE) #error "Do not include this file outside the H5MF package!" @@ -186,24 +186,24 @@ H5_DLL herr_t H5MF__start_fstype(H5F_t *f, H5F_mem_page_t type); H5_DLL htri_t H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, haddr_t *addr); H5_DLL herr_t H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_section_t *node); -H5_DLL herr_t H5MF_sects_dump(H5F_t *f, FILE *stream); +H5_DLL herr_t H5MF__sects_dump(H5F_t *f, FILE *stream); -H5_DLL void H5MF_alloc_to_fs_type(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type); +H5_DLL void H5MF__alloc_to_fs_type(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5F_mem_page_t *fs_type); /* 'simple/small/large' section routines */ -H5_DLL H5MF_free_section_t *H5MF_sect_new(unsigned ctype, haddr_t sect_off, +H5_DLL H5MF_free_section_t *H5MF__sect_new(unsigned ctype, haddr_t sect_off, hsize_t sect_size); -H5_DLL herr_t H5MF_sect_free(H5FS_section_info_t *sect); +H5_DLL herr_t H5MF__sect_free(H5FS_section_info_t *sect); /* Block aggregator routines */ H5_DLL htri_t H5MF__aggr_try_extend(H5F_t *f, H5F_blk_aggr_t *aggr, H5FD_mem_t type, haddr_t abs_blk_end, hsize_t extra_requested); -H5_DLL htri_t H5MF_aggr_can_absorb(const H5F_t *f, const H5F_blk_aggr_t *aggr, +H5_DLL htri_t H5MF__aggr_can_absorb(const H5F_t *f, const H5F_blk_aggr_t *aggr, const H5MF_free_section_t *sect, H5MF_shrink_type_t *shrink); -H5_DLL herr_t H5MF_aggr_absorb(const H5F_t *f, H5F_blk_aggr_t *aggr, +H5_DLL herr_t H5MF__aggr_absorb(const H5F_t *f, H5F_blk_aggr_t *aggr, H5MF_free_section_t *sect, hbool_t allow_sect_absorb); -H5_DLL herr_t H5MF_aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr, +H5_DLL herr_t H5MF__aggr_query(const H5F_t *f, const H5F_blk_aggr_t *aggr, haddr_t *addr, hsize_t *size); /* Testing routines */ diff --git a/src/H5MFsection.c b/src/H5MFsection.c index d722139..3ebc5c8 100644 --- a/src/H5MFsection.c +++ b/src/H5MFsection.c @@ -116,7 +116,7 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SIMPLE[1] = {{ H5MF__sect_simple_merge, /* Merge sections */ H5MF__sect_simple_can_shrink, /* Can section shrink container?*/ H5MF__sect_simple_shrink, /* Shrink container w/section */ - H5MF_sect_free, /* Free section */ + H5MF__sect_free, /* Free section */ H5MF__sect_valid, /* Check validity of section */ H5MF__sect_split, /* Split section node for alignment */ NULL, /* Dump debugging for section */ @@ -142,7 +142,7 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_SMALL[1] = {{ H5MF__sect_small_merge, /* Merge sections */ NULL, /* Can section shrink container?*/ NULL, /* Shrink container w/section */ - H5MF_sect_free, /* Free section */ + H5MF__sect_free, /* Free section */ H5MF__sect_valid, /* Check validity of section */ H5MF__sect_split, /* Split section node for alignment */ NULL, /* Dump debugging for section */ @@ -168,7 +168,7 @@ H5FS_section_class_t H5MF_FSPACE_SECT_CLS_LARGE[1] = {{ H5MF__sect_large_merge, /* Merge sections */ H5MF__sect_large_can_shrink, /* Can section shrink container?*/ H5MF__sect_large_shrink, /* Shrink container w/section */ - H5MF_sect_free, /* Free section */ + H5MF__sect_free, /* Free section */ H5MF__sect_valid, /* Check validity of section */ H5MF__sect_split, /* Split section node for alignment */ NULL, /* Dump debugging for section */ @@ -192,7 +192,7 @@ H5FL_DEFINE(H5MF_free_section_t); /*------------------------------------------------------------------------- - * Function: H5MF_sect_new + * Function: H5MF__sect_new * * Purpose: Create a new section of "ctype" and return it to the caller * @@ -205,12 +205,12 @@ H5FL_DEFINE(H5MF_free_section_t); *------------------------------------------------------------------------- */ H5MF_free_section_t * -H5MF_sect_new(unsigned ctype, haddr_t sect_off, hsize_t sect_size) +H5MF__sect_new(unsigned ctype, haddr_t sect_off, hsize_t sect_size) { H5MF_free_section_t *sect; /* 'Simple' free space section to add */ H5MF_free_section_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_PACKAGE /* Check arguments. */ HDassert(sect_size); @@ -232,11 +232,11 @@ H5MF_sect_new(unsigned ctype, haddr_t sect_off, hsize_t sect_size) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5MF_sect_new() */ +} /* end H5MF__sect_new() */ /*------------------------------------------------------------------------- - * Function: H5MF_sect_free + * Function: H5MF__sect_free * * Purpose: Free a 'simple/small/large' section node * @@ -249,11 +249,11 @@ done: *------------------------------------------------------------------------- */ herr_t -H5MF_sect_free(H5FS_section_info_t *_sect) +H5MF__sect_free(H5FS_section_info_t *_sect) { H5MF_free_section_t *sect = (H5MF_free_section_t *)_sect; /* File free section */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_PACKAGE_NOERR /* Check arguments. */ HDassert(sect); @@ -262,11 +262,11 @@ H5MF_sect_free(H5FS_section_info_t *_sect) sect = H5FL_FREE(H5MF_free_section_t, sect); FUNC_LEAVE_NOAPI(SUCCEED) -} /* H5MF_sect_free() */ +} /* H5MF__sect_free() */ /*------------------------------------------------------------------------- - * Function: H5MF_sect_deserialize + * Function: H5MF__sect_deserialize * * Purpose: Deserialize a buffer into a "live" section * @@ -294,7 +294,7 @@ H5MF__sect_deserialize(const H5FS_section_class_t *cls, HDassert(sect_size); /* Create free space section for block */ - if(NULL == (sect = H5MF_sect_new(cls->type, sect_addr, sect_size))) + if(NULL == (sect = H5MF__sect_new(cls->type, sect_addr, sect_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't initialize free space section") /* Set return value */ @@ -360,7 +360,7 @@ H5MF__sect_split(H5FS_section_info_t *sect, hsize_t frag_size) FUNC_ENTER_STATIC /* Allocate space for new section */ - if(NULL == (ret_value = H5MF_sect_new(sect->type, sect->addr, frag_size))) + if(NULL == (ret_value = H5MF__sect_new(sect->type, sect->addr, frag_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't initialize free space section") /* Set new section's info */ @@ -449,7 +449,7 @@ H5MF__sect_simple_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect (*sect1)->sect_info.size += sect2->sect_info.size; /* Get rid of second section */ - if(H5MF_sect_free((H5FS_section_info_t *)sect2) < 0) + if(H5MF__sect_free((H5FS_section_info_t *)sect2) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node") done: @@ -514,7 +514,7 @@ HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", FUNC, sect- htri_t status; /* Status from aggregator adjoin */ /* See if section can absorb the aggregator & vice versa */ - if((status = H5MF_aggr_can_absorb(udata->f, &(udata->f->shared->meta_aggr), sect, &(udata->shrink))) < 0) + if((status = H5MF__aggr_can_absorb(udata->f, &(udata->f->shared->meta_aggr), sect, &(udata->shrink))) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, "error merging section with aggregation block") else if(status > 0) { /* Set the aggregator to operate on */ @@ -533,7 +533,7 @@ HDfprintf(stderr, "%s: section {%a, %Hu}, adjoins metadata aggregator\n", FUNC, htri_t status; /* Status from aggregator adjoin */ /* See if section can absorb the aggregator & vice versa */ - if((status = H5MF_aggr_can_absorb(udata->f, &(udata->f->shared->sdata_aggr), sect, &(udata->shrink))) < 0) + if((status = H5MF__aggr_can_absorb(udata->f, &(udata->f->shared->sdata_aggr), sect, &(udata->shrink))) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, "error merging section with aggregation block") else if(status > 0) { /* Set the aggregator to operate on */ @@ -597,14 +597,14 @@ H5MF__sect_simple_shrink(H5FS_section_info_t **_sect, void *_udata) HDassert(udata->aggr); /* Absorb the section into the aggregator or vice versa */ - if(H5MF_aggr_absorb(udata->f, udata->aggr, *sect, udata->allow_sect_absorb) < 0) + if(H5MF__aggr_absorb(udata->f, udata->aggr, *sect, udata->allow_sect_absorb) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTMERGE, FAIL, "can't absorb section into aggregator or vice versa") } /* end else */ /* Check for freeing section */ if(udata->shrink != H5MF_SHRINK_SECT_ABSORB_AGGR) { /* Free section */ - if(H5MF_sect_free((H5FS_section_info_t *)*sect) < 0) + if(H5MF__sect_free((H5FS_section_info_t *)*sect) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") /* Mark section as freed, for free space manager */ @@ -660,7 +660,7 @@ HDfprintf(stderr, "%s: Entering, section {%a, %Hu}\n", FUNC, (*sect)->sect_info. /* Drop the section if it is at page end and its size is <= pgend threshold */ if(!rem && (*sect)->sect_info.size <= H5F_PGEND_META_THRES(udata->f) && (*flags & H5FS_ADD_RETURNED_SPACE)) { - if(H5MF_sect_free((H5FS_section_info_t *)(*sect)) < 0) + if(H5MF__sect_free((H5FS_section_info_t *)(*sect)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node") *sect = NULL; *flags &= (unsigned)~H5FS_ADD_RETURNED_SPACE; @@ -779,13 +779,13 @@ H5MF__sect_small_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2 if(H5PB_remove_entry(udata->f, (*sect1)->sect_info.addr) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "can't free merged section") - if(H5MF_sect_free((H5FS_section_info_t *)(*sect1)) < 0) + if(H5MF__sect_free((H5FS_section_info_t *)(*sect1)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node") *sect1 = NULL; } /* end if */ /* Get rid of second section */ - if(H5MF_sect_free((H5FS_section_info_t *)sect2) < 0) + if(H5MF__sect_free((H5FS_section_info_t *)sect2) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node") done: @@ -872,7 +872,7 @@ H5MF__sect_large_merge(H5FS_section_info_t **_sect1, H5FS_section_info_t *_sect2 (*sect1)->sect_info.size += sect2->sect_info.size; /* Get rid of second section */ - if(H5MF_sect_free((H5FS_section_info_t *)sect2) < 0) + if(H5MF__sect_free((H5FS_section_info_t *)sect2) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free section node") done: @@ -976,7 +976,7 @@ H5MF__sect_large_shrink(H5FS_section_info_t **_sect, void *_udata) (*sect)->sect_info.size = frag_size; else { /* Free section */ - if(H5MF_sect_free((H5FS_section_info_t *)*sect) < 0) + if(H5MF__sect_free((H5FS_section_info_t *)*sect) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") /* Mark section as freed, for free space manager */ @@ -254,23 +254,23 @@ H5PB_print_stats(const H5PB_t *page_buf) printf("PAGE BUFFER STATISTICS:\n"); - printf("******* METADATA\n"); - printf("\t Total Accesses: %u\n", page_buf->accesses[0]); - printf("\t Hits: %u\n", page_buf->hits[0]); - printf("\t Misses: %u\n", page_buf->misses[0]); - printf("\t Evictions: %u\n", page_buf->evictions[0]); - printf("\t Bypasses: %u\n", page_buf->bypasses[0]); - printf("\t Hit Rate = %f%%\n", ((double)page_buf->hits[0]/(page_buf->accesses[0] - page_buf->bypasses[0]))*100); - printf("*****************\n\n"); - - printf("******* RAWDATA\n"); - printf("\t Total Accesses: %u\n", page_buf->accesses[1]); - printf("\t Hits: %u\n", page_buf->hits[1]); - printf("\t Misses: %u\n", page_buf->misses[1]); - printf("\t Evictions: %u\n", page_buf->evictions[1]); - printf("\t Bypasses: %u\n", page_buf->bypasses[1]); - printf("\t Hit Rate = %f%%\n", ((double)page_buf->hits[1]/(page_buf->accesses[1]-page_buf->bypasses[0]))*100); - printf("*****************\n\n"); + HDprintf("******* METADATA\n"); + HDprintf("\t Total Accesses: %u\n", page_buf->accesses[0]); + HDprintf("\t Hits: %u\n", page_buf->hits[0]); + HDprintf("\t Misses: %u\n", page_buf->misses[0]); + HDprintf("\t Evictions: %u\n", page_buf->evictions[0]); + HDprintf("\t Bypasses: %u\n", page_buf->bypasses[0]); + HDprintf("\t Hit Rate = %f%%\n", ((double)page_buf->hits[0]/(page_buf->accesses[0] - page_buf->bypasses[0]))*100); + HDprintf("*****************\n\n"); + + HDprintf("******* RAWDATA\n"); + HDprintf("\t Total Accesses: %u\n", page_buf->accesses[1]); + HDprintf("\t Hits: %u\n", page_buf->hits[1]); + HDprintf("\t Misses: %u\n", page_buf->misses[1]); + HDprintf("\t Evictions: %u\n", page_buf->evictions[1]); + HDprintf("\t Bypasses: %u\n", page_buf->bypasses[1]); + HDprintf("\t Hit Rate = %f%%\n", ((double)page_buf->hits[1]/(page_buf->accesses[1]-page_buf->bypasses[0]))*100); + HDprintf("*****************\n\n"); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5PB_print_stats */ @@ -141,7 +141,7 @@ done: void *ref; IN: Reference to open. RETURNS - Valid ID on success, Negative on failure + Valid ID on success, H5I_INVALID_HID on failure DESCRIPTION Given a reference to some object, open that object and return an ID for that object. @@ -203,7 +203,7 @@ done: void *ref; IN: Reference to open. RETURNS - Valid ID on success, Negative on failure + Valid ID on success, H5I_INVALID_HID on failure DESCRIPTION Given a reference to some object, creates a copy of the dataset pointed to's dataspace and defines a selection in the copy which is the region @@ -311,7 +311,7 @@ done: when passing in the size) RETURNS - Non-negative length of the path on success, Negative on failure + Non-negative length of the path on success, -1 on failure DESCRIPTION Given a reference to some object, determine a path to the object referenced in the file. @@ -335,23 +335,23 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *_ref, char *name, H5F_t *file; /* File object */ ssize_t ret_value; /* Return value */ - FUNC_ENTER_API(FAIL) + FUNC_ENTER_API((-1)) H5TRACE5("Zs", "iRt*x*sz", id, ref_type, _ref, name, size); /* Check args */ if (H5G_loc(id, &loc) < 0) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a location") if (ref_type <= H5R_BADTYPE || ref_type >= H5R_MAXTYPE) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference type") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference type") if (_ref == NULL) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "invalid reference pointer") /* Get the file pointer from the entry */ file = loc.oloc->file; /* Get name */ if((ret_value = H5R__get_name(file, id, ref_type, _ref, name, size)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to determine object path") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to determine object path") done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index 2f41f7d..fb62430 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -141,7 +141,7 @@ done: * ref IN: Reference to open * * Return: Success: Valid HDF5 ID - * Failure: Negative + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ diff --git a/src/H5Rint.c b/src/H5Rint.c index 02f7778..761ba44 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -587,7 +587,7 @@ done: H5F_t *file; IN: File the object being dereferenced is within H5R_type_t ref_type; IN: Type of reference to query void *ref; IN: Reference to query. - H5O_type_t *obj_type; OUT: The type of the object, set on success + H5O_type_t *obj_type; OUT: The type of the object, set on success RETURNS Non-negative on success/Negative on failure @@ -678,12 +678,12 @@ done: hid_t lapl_id; IN: LAPL to use for operation hid_t id; IN: Location ID given for reference H5R_type_t ref_type; IN: Type of reference - void *ref; IN: Reference to query. + void *_ref; IN: Reference to query. char *name; OUT: Buffer to place name of object referenced size_t size; IN: Size of name buffer RETURNS - Non-negative length of the path on success, Negative on failure + Non-negative length of the path on success, -1 on failure DESCRIPTION Given a reference to some object, determine a path to the object referenced in the file. @@ -732,7 +732,7 @@ H5R__get_name(H5F_t *f, hid_t id, H5R_type_t ref_type, const void *_ref, /* Get the dataset region from the heap (allocate inside routine) */ if ((buf = (uint8_t *)H5HG_read(oloc.file, &hobjid, NULL, NULL)) == NULL) - HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, FAIL, "Unable to read dataset region information") + HGOTO_ERROR(H5E_REFERENCE, H5E_READERROR, (-1), "Unable to read dataset region information") /* Get the object oid for the dataset */ p = buf; @@ -747,22 +747,21 @@ H5R__get_name(H5F_t *f, hid_t id, H5R_type_t ref_type, const void *_ref, case H5R_BADTYPE: case H5R_MAXTYPE: default: - HDassert("unknown reference type" && 0); - HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, FAIL, "internal error (unknown reference type)") + HGOTO_ERROR(H5E_REFERENCE, H5E_UNSUPPORTED, (-1), "internal error (unknown reference type)") } /* end switch */ /* Retrieve file ID for name search */ if ((file_id = H5I_get_file_id(id, FALSE)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't retrieve file ID") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't retrieve file ID") /* Get name, length, etc. */ if ((ret_value = H5G_get_name_by_addr(file_id, &oloc, name, size)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't determine name") + HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't determine name") done: /* Close file ID used for search */ if (file_id > 0 && H5I_dec_ref(file_id) < 0) - HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, FAIL, "can't decrement ref count of temp ID") + HDONE_ERROR(H5E_REFERENCE, H5E_CANTDEC, (-1), "can't decrement ref count of temp ID") FUNC_LEAVE_NOAPI_VOL(ret_value) } /* end H5R__get_name() */ diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h index 49261eb..fbbff50 100644 --- a/src/H5Rpkg.h +++ b/src/H5Rpkg.h @@ -26,6 +26,11 @@ #include "H5Rprivate.h" /* Other private headers needed by this file */ +#include "H5Fprivate.h" /* Files */ +#include "H5Gprivate.h" /* Groups */ +#include "H5Oprivate.h" /* Object headers */ +#include "H5Sprivate.h" /* Dataspaces */ + /**************************/ /* Package Private Macros */ |