diff options
79 files changed, 759 insertions, 1947 deletions
diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index 020bf18..579c8ac 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -27,6 +27,7 @@ #include "H5PropList.h" #include "H5private.h" // for HDfree + #ifndef H5_NO_NAMESPACE namespace H5 { #ifndef H5_NO_STD diff --git a/hl/src/H5PT.c b/hl/src/H5PT.c index 10d2637..3d16db5 100644 --- a/hl/src/H5PT.c +++ b/hl/src/H5PT.c @@ -214,6 +214,11 @@ out: * * Modifications: * + * John Mainzer -- 4/23/08 + * Added error check on malloc of table, initialized fields + * in table to keep lower level code from choking on bogus + * data in error cases. + * *------------------------------------------------------------------------- */ hid_t H5PTopen( hid_t loc_id, @@ -232,6 +237,12 @@ hid_t H5PTopen( hid_t loc_id, table = (htbl_t *)malloc(sizeof(htbl_t)); + if ( table == NULL ) { + goto out; + } + table->dset_id = H5I_BADID; + table->type_id = H5I_BADID; + /* Open the dataset */ if((table->dset_id = H5Dopen2(loc_id, dset_name, H5P_DEFAULT)) < 0) goto out; @@ -1034,9 +1034,9 @@ done: if(dst_id >= 0) (void)H5I_dec_ref(dst_id, FALSE); if(tconv_buf && !tconv_owned) - (void)H5FL_BLK_FREE(attr_buf, tconv_buf); + tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf); if(bkg_buf) - (void)H5FL_BLK_FREE(attr_buf, bkg_buf); + bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); FUNC_LEAVE_NOAPI(ret_value) } /* H5A_write() */ @@ -1180,9 +1180,9 @@ done: if(dst_id >= 0) (void)H5I_dec_ref(dst_id, FALSE); if(tconv_buf) - (void)H5FL_BLK_FREE(attr_buf, tconv_buf); + tconv_buf = H5FL_BLK_FREE(attr_buf, tconv_buf); if(bkg_buf) - (void)H5FL_BLK_FREE(attr_buf, bkg_buf); + bkg_buf = H5FL_BLK_FREE(attr_buf, bkg_buf); FUNC_LEAVE_NOAPI(ret_value) } /* H5A_read() */ @@ -239,7 +239,7 @@ H5B_create(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, void *udata, */ if (NULL==(bt = H5FL_MALLOC(H5B_t))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree root node") - HDmemset(&bt->cache_info,0,sizeof(H5AC_info_t)); + HDmemset(&bt->cache_info, 0, sizeof(H5AC_info_t)); bt->level = 0; bt->left = HADDR_UNDEF; bt->right = HADDR_UNDEF; @@ -492,7 +492,7 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, unsigned *old_bt_flags, */ if (H5B_create(f, dxpl_id, shared->type, udata, new_addr_p/*out*/) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create B-tree") - if (NULL==(new_bt=(H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, *new_addr_p, shared->type, udata, H5AC_WRITE))) + if(NULL == (new_bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, *new_addr_p, shared->type, udata, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to protect B-tree") new_bt->level = old_bt->level; @@ -529,24 +529,22 @@ H5B_split(H5F_t *f, hid_t dxpl_id, H5B_t *old_bt, unsigned *old_bt_flags, new_bt->left = old_addr; new_bt->right = old_bt->right; - if (H5F_addr_defined(old_bt->right)) { + if(H5F_addr_defined(old_bt->right)) { H5B_t *tmp_bt; - if (NULL == (tmp_bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, old_bt->right, shared->type, udata, H5AC_WRITE))) + if(NULL == (tmp_bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, old_bt->right, shared->type, udata, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load right sibling") tmp_bt->left = *new_addr_p; - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, old_bt->right, tmp_bt, - H5AC__DIRTIED_FLAG) != SUCCEED) + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, old_bt->right, tmp_bt, H5AC__DIRTIED_FLAG) < 0) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node") - } + } /* end if */ old_bt->right = *new_addr_p; done: - if (new_bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, *new_addr_p, new_bt, - new_bt_flags) < 0) + if(new_bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, *new_addr_p, new_bt, new_bt_flags) < 0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node") FUNC_LEAVE_NOAPI(ret_value) @@ -620,10 +618,10 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to insert key") if (H5B_INS_NOOP == my_ins) HGOTO_DONE(SUCCEED) - assert(H5B_INS_RIGHT == my_ins); + HDassert(H5B_INS_RIGHT == my_ins); /* the current root */ - if (NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ))) + if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_READ))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to locate root of B-tree") shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); HDassert(shared); @@ -633,18 +631,18 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, if (!lt_key_changed) HDmemcpy(lt_key, H5B_NKEY(bt,shared,0), type->sizeof_nkey); - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) != SUCCEED) + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child") bt = NULL; /* the new node */ - if (NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child, type, udata, H5AC_READ))) + if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child, type, udata, H5AC_READ))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load new node") if (!rt_key_changed) HDmemcpy(rt_key, H5B_NKEY(bt,shared,bt->nchildren), type->sizeof_nkey); - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, child, bt, H5AC__NO_FLAGS_SET) != SUCCEED) + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, child, bt, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child") bt = NULL; @@ -658,21 +656,21 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate file space to move root") /* update the new child's left pointer */ - if (NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child, type, udata, H5AC_WRITE))) + if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, child, type, udata, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load new child") bt->left = old_root; - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, child, bt, H5AC__DIRTIED_FLAG) != SUCCEED) + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, child, bt, H5AC__DIRTIED_FLAG) < 0) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child") - bt=NULL; /* Make certain future references will be caught */ + bt = NULL; /* Make certain future references will be caught */ /* * Move the node to the new location by checking it out & checking it in * at the new location -QAK */ /* Bring the old root into the cache if it's not already */ - if (NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE))) + if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load new child") /* Make certain the old root info is marked as dirty before moving it, */ @@ -682,18 +680,18 @@ H5B_insert(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, if (NULL == (new_bt = H5B_copy(bt))) { HCOMMON_ERROR(H5E_BTREE, H5E_CANTLOAD, "unable to copy old root"); - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__DIRTIED_FLAG) != SUCCEED) + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__DIRTIED_FLAG) < 0) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child") HGOTO_DONE(FAIL) } - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__DIRTIED_FLAG) != SUCCEED) + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__DIRTIED_FLAG) < 0) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release new child") - bt=NULL; /* Make certain future references will be caught */ + bt = NULL; /* Make certain future references will be caught */ /* Move the location of the old root on the disk */ - if (H5AC_rename(f, H5AC_BT, addr, old_root) < 0) + if(H5AC_rename(f, H5AC_BT, addr, old_root) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to move B-tree root node") /* clear the old root info at the old address (we already copied it) */ @@ -902,7 +900,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * data. When the search completes IDX points to the child that * should get the new data. */ - if (NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE))) + if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load node") shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); HDassert(shared); @@ -910,8 +908,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type while (lt < rt && cmp) { idx = (lt + rt) / 2; - if ((cmp = (type->cmp3) (f, dxpl_id, H5B_NKEY(bt,shared,idx), udata, - H5B_NKEY(bt,shared,idx+1))) < 0) { + if ((cmp = (type->cmp3)(f, dxpl_id, H5B_NKEY(bt,shared,idx), udata, H5B_NKEY(bt,shared,idx+1))) < 0) { rt = idx; } else { lt = idx + 1; @@ -1105,7 +1102,7 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * The max key in the original left node must be equal to the min key * in the new node. */ - cmp = (type->cmp2) (f, dxpl_id, H5B_NKEY(bt,shared,bt->nchildren), udata, + cmp = (type->cmp2)(f, dxpl_id, H5B_NKEY(bt,shared,bt->nchildren), udata, H5B_NKEY(twin,shared,0)); assert(0 == cmp); #endif @@ -1115,10 +1112,8 @@ H5B_insert_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type done: { - herr_t e1 = (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, - bt_flags) < 0); - herr_t e2 = (twin && H5AC_unprotect(f, dxpl_id, H5AC_BT, *new_node_p, - twin, twin_flags)<0); + herr_t e1 = (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_flags) < 0); + herr_t e2 = (twin && H5AC_unprotect(f, dxpl_id, H5AC_BT, *new_node_p, twin, twin_flags) < 0); if (e1 || e2) /*use vars to prevent short-circuit of side effects */ HDONE_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node(s)") } @@ -1366,7 +1361,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type * Perform a binary search to locate the child which contains the thing * for which we're searching. */ - if (NULL==(bt=(H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE))) + if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load B-tree node") shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); HDassert(shared); @@ -1374,8 +1369,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type rt = bt->nchildren; while (lt<rt && cmp) { idx = (lt+rt)/2; - if ((cmp=(type->cmp3)(f, dxpl_id, H5B_NKEY(bt,shared,idx), udata, - H5B_NKEY(bt,shared,idx+1)))<0) { + if ((cmp=(type->cmp3)(f, dxpl_id, H5B_NKEY(bt,shared,idx), udata, H5B_NKEY(bt,shared,idx+1)))<0) { rt = idx; } else { lt = idx+1; @@ -1448,14 +1442,13 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type */ if (ret_value!=H5B_INS_REMOVE && level>0) { if (H5F_addr_defined(bt->right)) { - if (NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, type, udata, H5AC_WRITE))) + if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, type, udata, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to unlink node from tree") /* Make certain the native key for the right sibling is set up */ HDmemcpy(H5B_NKEY(sibling,shared,0), H5B_NKEY(bt,shared,idx+1), type->sizeof_nkey); - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, - H5AC__DIRTIED_FLAG) != SUCCEED) + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, H5AC__DIRTIED_FLAG) < 0) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node from tree") sibling=NULL; /* Make certain future references will be caught */ } @@ -1477,18 +1470,17 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type bt->nchildren = 0; if (level>0) { if (H5F_addr_defined(bt->left)) { - if (NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->left, type, udata, H5AC_WRITE))) + if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->left, type, udata, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to load node from tree") sibling->right = bt->right; - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->left, sibling, - H5AC__DIRTIED_FLAG) != SUCCEED) + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->left, sibling, H5AC__DIRTIED_FLAG) < 0) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node from tree") sibling=NULL; /* Make certain future references will be caught */ } if (H5F_addr_defined(bt->right)) { - if (NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, type, udata, H5AC_WRITE))) + if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, type, udata, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to unlink node from tree") /* Copy left-most key from deleted node to left-most key in it's right neighbor */ @@ -1496,8 +1488,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type sibling->left = bt->left; - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, - H5AC__DIRTIED_FLAG) != SUCCEED) + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, H5AC__DIRTIED_FLAG) < 0) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node from tree") sibling=NULL; /* Make certain future references will be caught */ } @@ -1551,13 +1542,12 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type */ if (level>0) { if (H5F_addr_defined(bt->right)) { - if (NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, type, udata, H5AC_WRITE))) + if(NULL == (sibling = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, bt->right, type, udata, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, H5B_INS_ERROR, "unable to unlink node from tree") HDmemcpy(H5B_NKEY(sibling,shared,0), H5B_NKEY(bt,shared,bt->nchildren), type->sizeof_nkey); - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, - H5AC__DIRTIED_FLAG) != SUCCEED) + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, bt->right, sibling, H5AC__DIRTIED_FLAG) < 0) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node from tree") sibling=NULL; /* Make certain future references will be caught */ } @@ -1589,7 +1579,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type } done: - if (bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_flags)<0) + if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_flags) < 0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, H5B_INS_ERROR, "unable to release node") FUNC_LEAVE_NOAPI(ret_value) @@ -1651,7 +1641,7 @@ H5B_remove(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void * If the B-tree is now empty then make sure we mark the root node as * being at level zero */ - if (NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE))) + if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree root node") if (0==bt->nchildren && 0!=bt->level) { @@ -1659,7 +1649,7 @@ H5B_remove(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void bt_flags |= H5AC__DIRTIED_FLAG; } - if (H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_flags) != SUCCEED) + if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, bt_flags) < 0) HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release node") bt=NULL; /* Make certain future references will be caught */ @@ -1694,7 +1684,7 @@ done: herr_t H5B_delete(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void *udata) { - H5B_t *bt; /* B-tree node being operated on */ + H5B_t *bt = NULL; /* B-tree node being operated on */ H5B_shared_t *shared; /* Pointer to shared B-tree info */ unsigned u; /* Local index variable */ herr_t ret_value=SUCCEED; /* Return value */ @@ -1707,7 +1697,7 @@ H5B_delete(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void assert(H5F_addr_defined(addr)); /* Lock this B-tree node into memory for now */ - if (NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE))) + if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, udata, H5AC_WRITE))) HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree node") shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); HDassert(shared); @@ -1736,7 +1726,7 @@ H5B_delete(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr, void } /* end else */ done: - if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG)<0) + if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG) < 0) HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node in cache") FUNC_LEAVE_NOAPI(ret_value) @@ -1888,6 +1878,9 @@ H5B_copy(const H5B_t *old_bt) /* Copy the main structure */ HDmemcpy(new_node, old_bt, sizeof(H5B_t)); + /* Reset cache info */ + HDmemset(&new_node->cache_info, 0, sizeof(H5AC_info_t)); + if(NULL == (new_node->native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys)) || NULL == (new_node->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree root node") @@ -1905,9 +1898,9 @@ H5B_copy(const H5B_t *old_bt) done: if(NULL == ret_value) { if(new_node) { - (void)H5FL_BLK_FREE(native_block, new_node->native); + new_node->native = H5FL_BLK_FREE(native_block, new_node->native); new_node->child = H5FL_SEQ_FREE(haddr_t, new_node->child); - (void)H5FL_FREE(H5B_t, new_node); + new_node = H5FL_FREE(H5B_t, new_node); } /* end if */ } /* end if */ @@ -2082,7 +2075,7 @@ done: htri_t H5B_valid(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr) { - H5B_t *bt; /* The btree */ + H5B_t *bt = NULL; /* The btree */ htri_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5B_valid, FAIL) @@ -2098,13 +2091,13 @@ H5B_valid(H5F_t *f, hid_t dxpl_id, const H5B_class_t *type, haddr_t addr) /* Protect the node */ if(NULL == (bt = (H5B_t *)H5AC_protect(f, dxpl_id, H5AC_BT, addr, type, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree node") + HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree node") +done: /* Release the node */ - if(H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree node") + if(bt && H5AC_unprotect(f, dxpl_id, H5AC_BT, addr, bt, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node") -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5B_valid() */ diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 15dcb26..1d795ec 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -160,10 +160,10 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *ud H5WB_t *wb = NULL; /* Wrapped buffer for header data */ uint8_t hdr_buf[H5B2_HDR_BUF_SIZE]; /* Buffer for header */ uint8_t *buf; /* Pointer to header buffer */ - uint8_t *p; /* Pointer into raw data buffer */ + const uint8_t *p; /* Pointer into raw data buffer */ H5B2_hdr_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5B2_cache_hdr_load, NULL) + FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_hdr_load) /* Check arguments */ HDassert(f); @@ -227,7 +227,7 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *ud UINT32DECODE(p, stored_chksum); /* Sanity check */ - HDassert((size_t)(p - buf) == size); + HDassert((size_t)(p - (const uint8_t *)buf) == size); /* Compute checksum on entire header */ computed_chksum = H5_checksum_metadata(buf, (size - H5B2_SIZEOF_CHKSUM), 0); @@ -280,7 +280,7 @@ H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, uint8_t hdr_buf[H5B2_HDR_BUF_SIZE]; /* Buffer for header */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5B2_cache_hdr_flush, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_hdr_flush) /* check arguments */ HDassert(f); @@ -487,7 +487,7 @@ H5B2_cache_hdr_size(const H5F_t UNUSED *f, const H5B2_hdr_t *hdr, size_t *size_p * Purpose: Loads a B-tree internal node from the disk. * * Return: Success: Pointer to a new B-tree internal node. - * Failure: NULL + * Failure: NULL * * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu @@ -500,7 +500,7 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_uda { const H5B2_int_load_ud1_t *udata = (const H5B2_int_load_ud1_t *)_udata; /* Pointer to user data */ H5B2_internal_t *internal = NULL; /* Internal node read */ - uint8_t *p; /* Pointer into raw data buffer */ + const uint8_t *p; /* Pointer into raw data buffer */ uint8_t *native; /* Pointer to native record info */ H5B2_node_ptr_t *int_node_ptr; /* Pointer to node pointer info */ uint32_t stored_chksum; /* Stored metadata checksum value */ @@ -508,7 +508,7 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_uda unsigned u; /* Local index variable */ H5B2_internal_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5B2_cache_internal_load, NULL) + FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_internal_load) /* Check arguments */ HDassert(f); @@ -589,13 +589,13 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_uda } /* end for */ /* Compute checksum on internal node */ - computed_chksum = H5_checksum_metadata(udata->hdr->page, (size_t)(p - udata->hdr->page), 0); + computed_chksum = H5_checksum_metadata(udata->hdr->page, (size_t)(p - (const uint8_t *)udata->hdr->page), 0); /* Metadata checksum */ UINT32DECODE(p, stored_chksum); /* Sanity check parsing */ - HDassert((size_t)(p - udata->hdr->page) <= udata->hdr->node_size); + HDassert((size_t)(p - (const uint8_t *)udata->hdr->page) <= udata->hdr->node_size); /* Verify checksum */ if(stored_chksum != computed_chksum) @@ -607,6 +607,7 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_uda done: if(!ret_value && internal) (void)H5B2_cache_internal_dest(f, internal); + FUNC_LEAVE_NOAPI(ret_value) } /* H5B2_cache_internal_load() */ /*lint !e818 Can't make udata a pointer to const */ @@ -629,7 +630,7 @@ H5B2_cache_internal_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5B2_cache_internal_flush, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_internal_flush) /* check arguments */ HDassert(f); @@ -858,14 +859,14 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v const uint16_t *nrec = (const uint16_t *)_nrec; H5B2_hdr_t *hdr = (H5B2_hdr_t *)_hdr; /* B-tree header information */ H5B2_leaf_t *leaf = NULL; /* Pointer to lead node loaded */ - uint8_t *p; /* Pointer into raw data buffer */ + const uint8_t *p; /* Pointer into raw data buffer */ uint8_t *native; /* Pointer to native keys */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ unsigned u; /* Local index variable */ H5B2_leaf_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5B2_cache_leaf_load, NULL) + FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_leaf_load) /* Check arguments */ HDassert(f); @@ -926,13 +927,13 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v } /* end for */ /* Compute checksum on internal node */ - computed_chksum = H5_checksum_metadata(hdr->page, (size_t)(p - hdr->page), 0); + computed_chksum = H5_checksum_metadata(hdr->page, (size_t)(p - (const uint8_t *)hdr->page), 0); /* Metadata checksum */ UINT32DECODE(p, stored_chksum); /* Sanity check parsing */ - HDassert((size_t)(p - hdr->page) <= hdr->node_size); + HDassert((size_t)(p - (const uint8_t *)hdr->page) <= hdr->node_size); /* Verify checksum */ if(stored_chksum != computed_chksum) @@ -944,6 +945,7 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v done: if(!ret_value && leaf) (void)H5B2_cache_leaf_dest(f, leaf); + FUNC_LEAVE_NOAPI(ret_value) } /* H5B2_cache_leaf_load() */ /*lint !e818 Can't make udata a pointer to const */ @@ -966,7 +968,7 @@ H5B2_cache_leaf_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5 { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5B2_cache_leaf_flush, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5B2_cache_leaf_flush) /* check arguments */ HDassert(f); diff --git a/src/H5Bcache.c b/src/H5Bcache.c index 0424134..dc60f9d 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -39,14 +39,17 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5MFprivate.h" /* File memory management */ + /****************/ /* Local Macros */ /****************/ + /******************/ /* Local Typedefs */ /******************/ + /********************/ /* Local Prototypes */ /********************/ @@ -60,6 +63,7 @@ static herr_t H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, static herr_t H5B_clear(H5F_t *f, H5B_t *b, hbool_t destroy); static herr_t H5B_compute_size(const H5F_t *f, const H5B_t *bt, size_t *size_ptr); + /*********************/ /* Package Variables */ /*********************/ @@ -79,14 +83,14 @@ const H5AC_class_t H5AC_BT[1] = {{ /* Local Variables */ /*******************/ + /*------------------------------------------------------------------------- * Function: H5B_serialize * * Purpose: Serialize the data structure for writing to disk. * - * Return: Success: SUCCEED - * Failure: FAIL + * Return: Non-negative on success/Negative on failure * * Programmer: Bill Wendling * wendling@ncsa.uiuc.edu @@ -159,7 +163,6 @@ done: * Purpose: Loads a B-tree node from the disk. * * Return: Success: Pointer to a new B-tree node. - * * Failure: NULL * * Programmer: Robb Matzke @@ -173,13 +176,13 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata) { const H5B_class_t *type = (const H5B_class_t *) _type; H5B_t *bt = NULL; - H5B_shared_t *shared; /* Pointer to shared B-tree info */ - uint8_t *p; /* Pointer into raw data buffer */ - uint8_t *native; /* Pointer to native keys */ - unsigned u; /* Local index variable */ - H5B_t *ret_value; + H5B_shared_t *shared; /* Pointer to shared B-tree info */ + const uint8_t *p; /* Pointer into raw data buffer */ + uint8_t *native; /* Pointer to native keys */ + unsigned u; /* Local index variable */ + H5B_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5B_load, NULL) + FUNC_ENTER_NOAPI_NOINIT(H5B_load) /* Check arguments */ HDassert(f); @@ -188,19 +191,24 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata) HDassert(type->get_shared); if(NULL == (bt = H5FL_MALLOC(H5B_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - HDmemset(&bt->cache_info,0,sizeof(H5AC_info_t)); - if(NULL == (bt->rc_shared=(type->get_shared)(f, udata))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't retrieve B-tree node buffer") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate B-tree struct") + HDmemset(&bt->cache_info, 0, sizeof(H5AC_info_t)); + + if(NULL == (bt->rc_shared = (type->get_shared)(f, udata))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't retrieve B-tree node buffer") shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); HDassert(shared); - if(NULL == (bt->native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys)) || - NULL == (bt->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - if(H5F_block_read(f, H5FD_MEM_BTREE, addr, shared->sizeof_rnode, dxpl_id, shared->page)<0) + /* Allocate space for the native keys and child addresses */ + if(NULL == (bt->native = H5FL_BLK_MALLOC(native_block, shared->sizeof_keys))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate buffer for native keys") + if(NULL == (bt->child = H5FL_SEQ_MALLOC(haddr_t, (size_t)shared->two_k))) + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate buffer for child addresses") + + if(H5F_block_read(f, H5FD_MEM_BTREE, addr, shared->sizeof_rnode, dxpl_id, shared->page) < 0) HGOTO_ERROR(H5E_BTREE, H5E_READERROR, NULL, "can't read B-tree node") + /* Set the pointer into the raw data buffer */ p = shared->page; /* magic number */ @@ -246,6 +254,7 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata) done: if(!ret_value && bt) (void)H5B_dest(f, bt); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5B_load() */ /*lint !e818 Can't make udata a pointer to const */ @@ -255,18 +264,12 @@ done: * * Purpose: Flushes a dirty B-tree node to disk. * - * Return: Non-negative on success/Negative on failure + * Return: Non-negative on success/Negative on failure * * Programmer: Robb Matzke * matzke@llnl.gov * Jun 23 1997 * - * Changes: JRM -- 8/21/06 - * Added the flags_ptr parameter. This parameter exists to - * allow the flush routine to report to the cache if the - * entry is resized or renamed as a result of the flush. - * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. - * *------------------------------------------------------------------------- */ static herr_t @@ -275,13 +278,13 @@ H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *bt, uns H5B_shared_t *shared; /* Pointer to shared B-tree info */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5B_flush, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5B_flush) /* check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); HDassert(bt); - shared=(H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); + shared = (H5B_shared_t *)H5RC_GET_OBJ(bt->rc_shared); HDassert(shared); HDassert(shared->type); HDassert(shared->type->encode); @@ -302,7 +305,7 @@ H5B_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B_t *bt, uns } /* end if */ if(destroy) - if(H5B_dest(f,bt) < 0) + if(H5B_dest(f, bt) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to destroy B-tree node") done: diff --git a/src/H5Bdbg.c b/src/H5Bdbg.c index c31b4c3..1549693 100644 --- a/src/H5Bdbg.c +++ b/src/H5Bdbg.c @@ -256,8 +256,8 @@ H5B_assert(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type, void tail = tmp; /* Check that the keys are monotonically increasing */ - cmp = (type->cmp2) (f, dxpl_id, H5B_NKEY(bt,shared,i), udata, - H5B_NKEY(bt,shared,i+1)); + cmp = (type->cmp2)(f, dxpl_id, H5B_NKEY(bt, shared, i), udata, + H5B_NKEY(bt, shared, i + 1)); assert(cmp < 0); } } diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index e756f3a..c12865f 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -334,7 +334,7 @@ done: /* ARGSUSED */ static int H5D_btree_cmp2(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata, - void *_rt_key) + void *_rt_key) { H5D_btree_key_t *lt_key = (H5D_btree_key_t *) _lt_key; H5D_btree_key_t *rt_key = (H5D_btree_key_t *) _rt_key; @@ -385,7 +385,7 @@ H5D_btree_cmp2(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udat /* ARGSUSED */ static int H5D_btree_cmp3(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, void *_lt_key, void *_udata, - void *_rt_key) + void *_rt_key) { H5D_btree_key_t *lt_key = (H5D_btree_key_t *) _lt_key; H5D_btree_key_t *rt_key = (H5D_btree_key_t *) _rt_key; @@ -758,8 +758,8 @@ H5D_btree_encode_key(const H5F_t UNUSED *f, const H5B_t *bt, uint8_t *raw, void */ /* ARGSUSED */ static herr_t -H5D_btree_debug_key(FILE *stream, H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int indent, int fwidth, - const void *_key, const void *_udata) +H5D_btree_debug_key(FILE *stream, H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int indent, + int fwidth, const void *_key, const void *_udata) { const H5D_btree_key_t *key = (const H5D_btree_key_t *)_key; const unsigned *ndims = (const unsigned *)_udata; diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index f90e7fa..67c6b2f 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -2920,7 +2920,6 @@ H5D_chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, { const H5O_layout_t *layout = &(io_info->dset->shared->layout); /* Dataset layout */ const H5D_rdcc_t *rdcc = &(io_info->dset->shared->cache.chunk); - H5D_rdcc_ent_t *ent = NULL; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5D_chunk_unlock) @@ -2954,6 +2953,8 @@ H5D_chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, } /* end else */ } /* end if */ else { + H5D_rdcc_ent_t *ent; /* Chunk's entry in the cache */ + /* Sanity check */ HDassert(idx_hint < rdcc->nslots); HDassert(rdcc->slot[idx_hint]); diff --git a/src/H5Defl.c b/src/H5Defl.c index 63f07a7..8b2da6a 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -32,6 +32,7 @@ #include "H5Dpkg.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* Files */ +#include "H5HLprivate.h" /* Local Heaps */ /****************/ diff --git a/src/H5Dint.c b/src/H5Dint.c index c11c7bd..5d64415 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -58,7 +58,8 @@ typedef struct { /* General stuff */ static herr_t H5D_init_storage(H5D_t *dataset, hbool_t full_overwrite, hid_t dxpl_id); static herr_t H5D_get_dxpl_cache_real(hid_t dxpl_id, H5D_dxpl_cache_t *cache); -static H5D_shared_t *H5D_new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type); +static H5D_shared_t *H5D_new(hid_t dcpl_id, hbool_t creating, + hbool_t vl_type); static herr_t H5D_init_type(H5F_t *file, const H5D_t *dset, hid_t type_id, const H5T_t *type); static herr_t H5D_init_space(H5F_t *file, const H5D_t *dset, const H5S_t *space); @@ -522,8 +523,8 @@ done: static H5D_shared_t * H5D_new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type) { - H5P_genplist_t *plist; /* Property list created */ H5D_shared_t *new_dset = NULL; /* New dataset object */ + H5P_genplist_t *plist; /* Property list created */ H5D_shared_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5D_new) @@ -540,7 +541,7 @@ H5D_new(hid_t dcpl_id, hbool_t creating, hbool_t vl_type) */ if(!vl_type && creating && dcpl_id == H5P_DATASET_CREATE_DEFAULT) { if(H5I_inc_ref(dcpl_id, FALSE) < 0) - HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "Can't increment default DCPL ID") + HGOTO_ERROR(H5E_DATASET, H5E_CANTINC, NULL, "can't increment default DCPL ID") new_dset->dcpl_id = dcpl_id; } /* end if */ else { diff --git a/src/H5Dio.c b/src/H5Dio.c index 406b5ce..5723847 100644 --- a/src/H5Dio.c +++ b/src/H5Dio.c @@ -211,7 +211,7 @@ done: */ herr_t H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, const void *buf) + hid_t file_space_id, hid_t dxpl_id, const void *buf) { H5D_t *dset = NULL; const H5S_t *mem_space = NULL; @@ -221,7 +221,7 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, FUNC_ENTER_API(H5Dwrite, FAIL) H5TRACE6("e", "iiiii*x", dset_id, mem_type_id, mem_space_id, file_space_id, - plist_id, buf); + dxpl_id, buf); /* check arguments */ if(NULL == (dset = (H5D_t *)H5I_object_verify(dset_id, H5I_DATASET))) @@ -246,10 +246,10 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, } /* end if */ /* Get the default dataset transfer property list if the user didn't provide one */ - if(H5P_DEFAULT == plist_id) - plist_id= H5P_DATASET_XFER_DEFAULT; + if(H5P_DEFAULT == dxpl_id) + dxpl_id= H5P_DATASET_XFER_DEFAULT; else - if(TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER)) + if(TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER)) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not xfer parms") if(!buf && (NULL == file_space || H5S_GET_SELECT_NPOINTS(file_space) != 0)) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no output buffer") @@ -262,7 +262,7 @@ H5Dwrite(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, buf = &fake_char; /* write raw data */ - if(H5D_write(dset, mem_type_id, mem_space, file_space, plist_id, buf) < 0) + if(H5D_write(dset, mem_type_id, mem_space, file_space, dxpl_id, buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write data") done: @@ -583,6 +583,9 @@ H5D_write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, * independent access, causing the metadata cache to get corrupted. Its been * disabled for all types of access (serial as well as parallel) to make the * modification time consistent for all programs. -QAK + * + * We should set a value in the dataset's shared information instead and flush + * it to the file when the dataset is being closed. -QAK */ /* * Update modification time. We have to do this explicitly because diff --git a/src/H5Dtest.c b/src/H5Dtest.c index a4537ae..34ef8fb 100644 --- a/src/H5Dtest.c +++ b/src/H5Dtest.c @@ -35,26 +35,32 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Iprivate.h" /* IDs */ + /****************/ /* Local Macros */ /****************/ + /******************/ /* Local Typedefs */ /******************/ + /********************/ /* Local Prototypes */ /********************/ + /*********************/ /* Package Variables */ /*********************/ + /*******************/ /* Local Variables */ /*******************/ + /*-------------------------------------------------------------------------- NAME @@ -78,8 +84,8 @@ herr_t H5D_layout_version_test(hid_t did, unsigned *version) { - H5D_t *dset; /* Pointer to dataset to query */ - herr_t ret_value = SUCCEED; /* return value */ + H5D_t *dset; /* Pointer to dataset to query */ + herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_NOAPI(H5D_layout_version_test, FAIL) @@ -118,7 +124,7 @@ herr_t H5D_layout_contig_size_test(hid_t did, hsize_t *size) { H5D_t *dset; /* Pointer to dataset to query */ - herr_t ret_value = SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_NOAPI(H5D_layout_contig_size_test, FAIL) @@ -2514,21 +2514,13 @@ done: * Programmer: John Mainzer * 3/24/05 * - * Modifications: - * - * Reworked for the addition of the config_ptr parameter. - * JRM -- 4/7/05 - * *------------------------------------------------------------------------- */ - herr_t -H5Fget_mdc_config(hid_t file_id, - H5AC_cache_config_t *config_ptr) +H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) { H5F_t *file; /* File object for file ID */ - herr_t result; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Fget_mdc_config, FAIL) H5TRACE2("e", "i*x", file_id, config_ptr); @@ -2540,18 +2532,11 @@ H5Fget_mdc_config(hid_t file_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Bad config_ptr") /* Go get the resize configuration */ - result = H5AC_get_cache_auto_resize_config(file->shared->cache, config_ptr); - - if ( result != SUCCEED ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "H5AC_get_cache_auto_resize_config() failed."); - } + if(H5AC_get_cache_auto_resize_config(file->shared->cache, config_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_auto_resize_config() failed.") done: - FUNC_LEAVE_API(ret_value) - } /* H5Fget_mdc_config() */ @@ -2568,20 +2553,13 @@ done: * Programmer: John Mainzer * 3/24/05 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ - herr_t -H5Fset_mdc_config(hid_t file_id, - H5AC_cache_config_t *config_ptr) +H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr) { H5F_t *file; /* File object for file ID */ - herr_t result; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Fset_mdc_config, FAIL) H5TRACE2("e", "i*x", file_id, config_ptr); @@ -2591,18 +2569,11 @@ H5Fset_mdc_config(hid_t file_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* set the resize configuration */ - result = H5AC_set_cache_auto_resize_config(file->shared->cache, config_ptr); - - if ( result != SUCCEED ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "H5AC_set_cache_auto_resize_config() failed."); - } + if(H5AC_set_cache_auto_resize_config(file->shared->cache, config_ptr) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "H5AC_set_cache_auto_resize_config() failed.") done: - FUNC_LEAVE_API(ret_value) - } /* H5Fset_mdc_config() */ @@ -2620,20 +2591,13 @@ done: * Programmer: John Mainzer * 3/24/05 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ - herr_t -H5Fget_mdc_hit_rate(hid_t file_id, - double *hit_rate_ptr) +H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate_ptr) { H5F_t *file; /* File object for file ID */ - herr_t result; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Fget_mdc_hit_rate, FAIL) H5TRACE2("e", "i*d", file_id, hit_rate_ptr); @@ -2646,18 +2610,11 @@ H5Fget_mdc_hit_rate(hid_t file_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL hit rate pointer") /* Go get the current hit rate */ - result = H5AC_get_cache_hit_rate(file->shared->cache, hit_rate_ptr); - - if ( result != SUCCEED ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "H5AC_get_cache_hit_rate() failed."); - } + if(H5AC_get_cache_hit_rate(file->shared->cache, hit_rate_ptr) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_hit_rate() failed.") done: - FUNC_LEAVE_API(ret_value) - } /* H5Fget_mdc_hit_rate() */ @@ -2676,24 +2633,15 @@ done: * Programmer: John Mainzer * 3/24/05 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ - herr_t -H5Fget_mdc_size(hid_t file_id, - size_t *max_size_ptr, - size_t *min_clean_size_ptr, - size_t *cur_size_ptr, - int *cur_num_entries_ptr) +H5Fget_mdc_size(hid_t file_id, size_t *max_size_ptr, size_t *min_clean_size_ptr, + size_t *cur_size_ptr, int *cur_num_entries_ptr) { H5F_t *file; /* File object for file ID */ int32_t cur_num_entries; - herr_t result; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(H5Fget_mdc_size, FAIL) H5TRACE5("e", "i*z*z*z*Is", file_id, max_size_ptr, min_clean_size_ptr, @@ -2704,26 +2652,15 @@ H5Fget_mdc_size(hid_t file_id, HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID") /* Go get the size data */ - result = H5AC_get_cache_size(file->shared->cache, - max_size_ptr, - min_clean_size_ptr, - cur_size_ptr, - &cur_num_entries); - - if ( result != SUCCEED ) { - - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, \ - "H5AC_get_cache_size() failed."); - - } else if ( cur_num_entries_ptr != NULL ) { + if(H5AC_get_cache_size(file->shared->cache, max_size_ptr, + min_clean_size_ptr, cur_size_ptr, &cur_num_entries) < 0) + HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_size() failed.") + if(cur_num_entries_ptr != NULL) *cur_num_entries_ptr = (int)cur_num_entries; - } done: - FUNC_LEAVE_API(ret_value) - } /* H5Fget_mdc_size() */ @@ -2745,10 +2682,6 @@ done: * Programmer: John Mainzer * 3/24/05 * - * Modifications: - * - * None. - * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 2d754f5..1333995 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -755,7 +755,7 @@ H5FD_core_get_handle(H5FD_t *_file, hid_t fapl, void** file_handle) /* Get property */ if(H5P_get(plist, H5F_ACS_WANT_POSIX_FD_NAME, &want_posix_fd) < 0) - HGOTO_ERROR(H5E_VFL, H5E_CANTGET, NULL, "can't get property of retrieving file descriptor") + HGOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get property of retrieving file descriptor") /* If property is set, pass back the file descriptor instead of the memory address */ if(want_posix_fd) @@ -320,7 +320,7 @@ H5FO_marked(const H5F_t *f, haddr_t addr) /* Get the object node from the container */ if(NULL != (open_obj = (H5FO_open_obj_t *)H5SL_search(f->shared->open_objs, &addr))) - ret_value = (htri_t)open_obj->deleted; + ret_value = open_obj->deleted; FUNC_LEAVE_NOAPI(ret_value) } /* end H5FO_marked() */ diff --git a/src/H5FScache.c b/src/H5FScache.c index 482b9cb..8a345fe 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -89,6 +89,7 @@ static herr_t H5FS_cache_sinfo_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, h static herr_t H5FS_cache_sinfo_clear(H5F_t *f, H5FS_sinfo_t *sinfo, hbool_t destroy); static herr_t H5FS_cache_sinfo_size(const H5F_t *f, const H5FS_sinfo_t *sinfo, size_t *size_ptr); + /*********************/ /* Package Variables */ /*********************/ @@ -135,12 +136,12 @@ H5FL_BLK_DEFINE_STATIC(sect_block); * * Purpose: Loads a free space manager header from the disk. * - * Return: Success: Pointer to a new free space header - * Failure: NULL + * Return: Success: Pointer to a new free space header + * Failure: NULL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 2 2006 + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * May 2 2006 * *------------------------------------------------------------------------- */ @@ -160,9 +161,6 @@ H5FS_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_fs_prot, H5FS_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_hdr_load) -#ifdef QAK -HDfprintf(stderr, "%s: Load free space header, addr = %a\n", FUNC, addr); -#endif /* QAK */ /* Check arguments */ HDassert(f); @@ -247,12 +245,12 @@ HDfprintf(stderr, "%s: Load free space header, addr = %a\n", FUNC, addr); H5F_DECODE_LENGTH(f, p, fspace->alloc_sect_size); /* Compute checksum on indirect block */ - computed_chksum = H5_checksum_metadata(hdr, (size_t)(p - hdr), 0); + computed_chksum = H5_checksum_metadata(hdr, (size_t)(p - (const uint8_t *)hdr), 0); /* Metadata checksum */ UINT32DECODE(p, stored_chksum); - HDassert((size_t)(p - hdr) == size); + HDassert((size_t)(p - (const uint8_t *)hdr) == size); /* Verify checksum */ if(stored_chksum != computed_chksum) @@ -279,9 +277,9 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * May 2 2006 + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * May 2 2006 * *------------------------------------------------------------------------- */ @@ -293,11 +291,6 @@ H5FS_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5F herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_hdr_flush) -#ifdef QAK -HDfprintf(stderr, "%s: Flushing free space header, addr = %a, destroy = %u\n", FUNC, addr, (unsigned)destroy); -HDfprintf(stderr, "%s: fspace->sect_addr = %a, fspace->sinfo = %p\n", FUNC, fspace->sect_addr, fspace->sinfo); -HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC, fspace->alloc_sect_size, fspace->sect_size); -#endif /* QAK */ /* check arguments */ HDassert(f); @@ -335,12 +328,6 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" HGOTO_ERROR(H5E_FSPACE, H5E_CANTFLUSH, FAIL, "unable to save free space section info to disk") } /* end if */ -#ifdef QAK -HDfprintf(stderr, "%s: Check 2.0\n", FUNC); -HDfprintf(stderr, "%s: fspace->sect_addr = %a, fspace->sinfo = %p\n", FUNC, fspace->sect_addr, fspace->sinfo); -HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC, fspace->alloc_sect_size, fspace->sect_size); -#endif /* QAK */ - /* Mark section info clean */ fspace->sinfo->dirty = FALSE; } /* end if */ @@ -416,7 +403,7 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" H5F_ENCODE_LENGTH(f, p, fspace->alloc_sect_size); /* Compute checksum */ - metadata_chksum = H5_checksum_metadata(hdr, (size_t)(p - hdr), 0); + metadata_chksum = H5_checksum_metadata(hdr, (size_t)(p - (uint8_t *)hdr), 0); /* Metadata checksum */ UINT32ENCODE(p, metadata_chksum); @@ -579,12 +566,12 @@ H5FS_cache_hdr_size(const H5F_t *f, const H5FS_t UNUSED *fspace, size_t *size_pt * * Purpose: Loads free space sections from the disk. * - * Return: Success: Pointer to a new free space section info - * Failure: NULL + * Return: Success: Pointer to a new free space section info + * Failure: NULL * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * July 31 2006 + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * July 31 2006 * *------------------------------------------------------------------------- */ @@ -602,9 +589,6 @@ H5FS_cache_sinfo_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * H5FS_sinfo_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_sinfo_load) -#ifdef QAK -HDfprintf(stderr, "%s: Load free space sections, addr = %a\n", FUNC, addr); -#endif /* QAK */ /* Check arguments */ HDassert(f); @@ -621,9 +605,6 @@ HDfprintf(stderr, "%s: Load free space sections, addr = %a\n", FUNC, addr); /* Allocate space for the buffer to serialize the sections into */ H5_ASSIGN_OVERFLOW(/* To: */ old_sect_size, /* From: */ fspace->sect_size, /* From: */ hsize_t, /* To: */ size_t); -#ifdef QAK -HDfprintf(stderr, "%s: fspace->sect_size = %Hu\n", FUNC, fspace->sect_size); -#endif /* QAK */ if(NULL == (buf = H5FL_BLK_MALLOC(sect_block, (size_t)fspace->sect_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") @@ -645,9 +626,6 @@ HDfprintf(stderr, "%s: fspace->sect_size = %Hu\n", FUNC, fspace->sect_size); /* Address of free space header for these sections */ H5F_addr_decode(f, &p, &fs_addr); -#ifdef QAK -HDfprintf(stderr, "%s: fspace->addr = %a, fs_addr = %a\n", FUNC, fspace->addr, fs_addr); -#endif /* QAK */ if(H5F_addr_ne(fs_addr, fspace->addr)) HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "incorrect header address for free space sections") @@ -661,22 +639,12 @@ HDfprintf(stderr, "%s: fspace->addr = %a, fs_addr = %a\n", FUNC, fspace->addr, f /* Compute the size of the section counts */ sect_cnt_size = H5V_limit_enc_size((uint64_t)fspace->serial_sect_count); -#ifdef QAK -HDfprintf(stderr, "%s: sect_cnt_size = %u\n", FUNC, sect_cnt_size); -HDfprintf(stderr, "%s: fspace->sect_len_size = %u\n", FUNC, fspace->sect_len_size); -#endif /* QAK */ /* Reset the section count, the "add" routine will update it */ old_tot_sect_count = fspace->tot_sect_count; old_serial_sect_count = fspace->serial_sect_count; old_ghost_sect_count = fspace->ghost_sect_count; old_tot_space = fspace->tot_space; -#ifdef QAK -HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_count); -HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", FUNC, fspace->serial_sect_count); -HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_sect_count); -HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); -#endif /* QAK */ fspace->tot_sect_count = 0; fspace->serial_sect_count = 0; fspace->ghost_sect_count = 0; @@ -690,16 +658,10 @@ HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); /* The number of sections of this node's size */ UINT64DECODE_VAR(p, node_count, sect_cnt_size); -#ifdef QAK -HDfprintf(stderr, "%s: node_count = %Zu\n", FUNC, node_count); -#endif /* QAK */ HDassert(node_count); /* The size of the sections for this node */ UINT64DECODE_VAR(p, sect_size, sinfo->sect_len_size); -#ifdef QAK -HDfprintf(stderr, "%s: sect_size = %Hu\n", FUNC, sect_size); -#endif /* QAK */ HDassert(sect_size); /* Loop over nodes of this size */ @@ -711,15 +673,9 @@ HDfprintf(stderr, "%s: sect_size = %Hu\n", FUNC, sect_size); /* The address of the section */ UINT64DECODE_VAR(p, sect_addr, sinfo->sect_off_size); -#ifdef QAK -HDfprintf(stderr, "%s: sect_addr = %a\n", FUNC, sect_addr); -#endif /* QAK */ /* The type of this section */ sect_type = *p++; -#ifdef QAK -HDfprintf(stderr, "%s: sect_type = %u\n", FUNC, sect_type); -#endif /* QAK */ /* Call 'deserialize' callback for this section */ des_flags = 0; @@ -729,9 +685,6 @@ HDfprintf(stderr, "%s: sect_type = %u\n", FUNC, sect_type); /* Update offset in serialization buffer */ p += fspace->sect_cls[sect_type].serial_size; -#ifdef QAK -HDfprintf(stderr, "%s: fspace->sect_cls[%u].serial_size = %Zu\n", FUNC, sect_type, fspace->sect_cls[sect_type].serial_size); -#endif /* QAK */ /* Insert section in free space manager, unless requested not to */ if(!(des_flags & H5FS_DESERIALIZE_NO_ADD)) @@ -750,18 +703,18 @@ HDfprintf(stderr, "%s: fspace->sect_cls[%u].serial_size = %Zu\n", FUNC, sect_typ } /* end if */ /* Compute checksum on indirect block */ - computed_chksum = H5_checksum_metadata(buf, (size_t)(p - buf), 0); + computed_chksum = H5_checksum_metadata(buf, (size_t)(p - (const uint8_t *)buf), 0); /* Metadata checksum */ UINT32DECODE(p, stored_chksum); - /* Sanity check */ - HDassert((size_t)(p - buf) == old_sect_size); - /* Verify checksum */ if(stored_chksum != computed_chksum) HGOTO_ERROR(H5E_HEAP, H5E_BADVALUE, NULL, "incorrect metadata checksum for fractal heap indirect block") + /* Sanity check */ + HDassert((size_t)(p - (const uint8_t *)buf) == old_sect_size); + /* Set return value */ ret_value = sinfo; @@ -781,8 +734,7 @@ done: * Purpose: Skip list iterator callback to serialize free space sections * of a particular size * - * Return: Success: non-negative - * Failure: negative + * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Monday, May 8, 2006 @@ -811,15 +763,9 @@ H5FS_sinfo_serialize_sect_cb(void *_item, void UNUSED *key, void *_udata) if(!(sect_cls->flags & H5FS_CLS_GHOST_OBJ)) { /* The address of the section */ UINT64ENCODE_VAR(*udata->p, sect->addr, udata->sinfo->sect_off_size); -#ifdef QAK -HDfprintf(stderr, "%s: sect->addr = %a\n", FUNC, sect->addr); -#endif /* QAK */ /* The type of this section */ *(*udata->p)++ = (uint8_t)sect->type; -#ifdef QAK -HDfprintf(stderr, "%s: sect->type = %u\n", FUNC, (unsigned)sect->type); -#endif /* QAK */ /* Call 'serialize' callback for this section */ if(sect_cls->serialize) { @@ -844,8 +790,7 @@ done: * Purpose: Skip list iterator callback to serialize free space sections * in a bin * - * Return: Success: non-negative - * Failure: negative + * Return: Non-negative on success/Negative on failure * * Programmer: Quincey Koziol * Monday, May 8, 2006 @@ -870,15 +815,9 @@ H5FS_sinfo_serialize_node_cb(void *_item, void UNUSED *key, void *_udata) if(fspace_node->serial_count > 0) { /* The number of serializable sections of this node's size */ UINT64ENCODE_VAR(*udata->p, fspace_node->serial_count, udata->sect_cnt_size); -#ifdef QAK -HDfprintf(stderr, "%s: fspace_node->serial_count = %Zu\n", FUNC, fspace_node->serial_count); -#endif /* QAK */ /* The size of the sections for this node */ UINT64ENCODE_VAR(*udata->p, fspace_node->sect_size, udata->sinfo->sect_len_size); -#ifdef QAK -HDfprintf(stderr, "%s: sect_size = %Hu\n", FUNC, fspace_node->sect_size); -#endif /* QAK */ /* Iterate through all the sections of this size */ HDassert(fspace_node->sect_list); @@ -898,15 +837,10 @@ done: * * Return: Non-negative on success/Negative on failure * - * Programmer: Quincey Koziol - * koziol@ncsa.uiuc.edu - * July 31 2006 + * Programmer: Quincey Koziol + * koziol@ncsa.uiuc.edu + * July 31 2006 * - * Changes: JRM -- 8/21/06 - * Added the flags_ptr parameter. This parameter exists to - * allow the flush routine to report to the cache if the - * entry is resized or renamed as a result of the flush. - * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. *------------------------------------------------------------------------- */ static herr_t @@ -915,9 +849,6 @@ H5FS_cache_sinfo_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_sinfo_flush) -#ifdef QAK -HDfprintf(stderr, "%s: Flushing free space header, addr = %a, destroy = %u\n", FUNC, addr, (unsigned)destroy); -#endif /* QAK */ /* check arguments */ HDassert(f); @@ -951,23 +882,14 @@ HDfprintf(stderr, "%s: Flushing free space header, addr = %a, destroy = %u\n", F *p++ = H5FS_SINFO_VERSION; /* Address of free space header for these sections */ -#ifdef QAK -HDfprintf(stderr, "%s: sinfo->fspace->addr = %a\n", FUNC, sinfo->fspace->addr); -#endif /* QAK */ H5F_addr_encode(f, &p, sinfo->fspace->addr); /* Set up user data for iterator */ udata.sinfo = sinfo; udata.p = &p; udata.sect_cnt_size = H5V_limit_enc_size((uint64_t)sinfo->fspace->serial_sect_count); -#ifdef QAK -HDfprintf(stderr, "%s: udata.sect_cnt_size = %u\n", FUNC, udata.sect_cnt_size); -#endif /* QAK */ /* Iterate over all the bins */ -#ifdef QAK -HDfprintf(stderr, "%s: Serializing section bins\n", FUNC); -#endif /* QAK */ for(bin = 0; bin < sinfo->nbins; bin++) { /* Check if there are any sections in this bin */ if(sinfo->bins[bin].bin_list) { @@ -986,10 +908,6 @@ HDfprintf(stderr, "%s: Serializing section bins\n", FUNC); /* Sanity check */ HDassert((size_t)(p - buf) == sinfo->fspace->sect_size); HDassert(sinfo->fspace->sect_size <= sinfo->fspace->alloc_sect_size); -#ifdef QAK -HDfprintf(stderr, "%s: sinfo->fspace->sect_size = %Hu\n", FUNC, sinfo->fspace->sect_size); -HDfprintf(stderr, "%s: sinfo->fspace->alloc_sect_size = %Hu\n", FUNC, sinfo->fspace->alloc_sect_size); -#endif /* QAK */ /* Write buffer to disk */ if(H5F_block_write(f, H5FD_MEM_FSPACE_SINFO, sinfo->fspace->sect_addr, (size_t)sinfo->fspace->sect_size, dxpl_id, buf) < 0) @@ -1100,9 +1018,6 @@ H5FS_cache_sinfo_dest(H5F_t *f, H5FS_sinfo_t *sinfo) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5FS_cache_sinfo_dest) -#ifdef QAK -HDfprintf(stderr, "%s: Destroying section info, sinfo->fspace->addr = %a\n", FUNC, sinfo->fspace->addr); -#endif /* QAK */ /* * Check arguments. diff --git a/src/H5Fdbg.c b/src/H5Fdbg.c index 723005e..ba55b8f 100644 --- a/src/H5Fdbg.c +++ b/src/H5Fdbg.c @@ -123,8 +123,7 @@ H5F_debug(H5F_t *f, FILE *stream, int indent, int fwidth) f->shared->root_grp ? "" : "(none)"); if(f->shared->root_grp) { if(f->shared->sblock->root_ent) /* Use real root group symbol table entry */ - H5G_ent_debug(f, f->shared->sblock->root_ent, stream, indent + 3, - MAX(0, fwidth - 3), NULL); + H5G_ent_debug(f->shared->sblock->root_ent, stream, indent + 3, MAX(0, fwidth - 3), NULL); else { H5O_loc_t *root_oloc; /* Root object location */ H5G_entry_t root_ent; /* Constructed root symbol table entry */ @@ -140,7 +139,7 @@ H5F_debug(H5F_t *f, FILE *stream, int indent, int fwidth) root_ent.file = f; /* Display root group symbol table entry info */ - H5G_ent_debug(f, &root_ent, stream, indent + 3, MAX(0, fwidth - 3), NULL); + H5G_ent_debug(&root_ent, stream, indent + 3, MAX(0, fwidth - 3), NULL); } /* end else */ } /* end if */ diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c index 46d7979..7e1136c 100644 --- a/src/H5Fdeprec.c +++ b/src/H5Fdeprec.c @@ -44,6 +44,7 @@ #include "H5Eprivate.h" /* Error handling */ #include "H5Fpkg.h" /* File access */ #include "H5Iprivate.h" /* IDs */ +#include "H5SMprivate.h" /* Shared object header messages */ /****************/ diff --git a/src/H5Ffake.c b/src/H5Ffake.c index 09e87f2..e96aedf 100644 --- a/src/H5Ffake.c +++ b/src/H5Ffake.c @@ -67,7 +67,7 @@ H5F_init_fake_interface(void) *------------------------------------------------------------------------- */ H5F_t * -H5F_fake_alloc(size_t sizeof_size) +H5F_fake_alloc(uint8_t sizeof_size) { H5F_t *f = NULL; /* Pointer to fake file struct */ H5F_t *ret_value; /* Return value */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index f7df7f7..10c2976 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -525,12 +525,10 @@ H5_DLL herr_t H5F_block_write(const H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, hid_t dxpl_id, const void *buf); /* Address-related functions */ -H5_DLL void H5F_addr_encode(const H5F_t *, uint8_t** /*in,out*/, haddr_t); -H5_DLL void H5F_addr_encode_len(size_t addr_len, uint8_t** /*in,out*/, haddr_t); -H5_DLL void H5F_addr_decode(const H5F_t *, const uint8_t** /*in,out*/, - haddr_t* /*out*/); -H5_DLL void H5F_addr_decode_len(size_t addr_len, const uint8_t** /*in,out*/, - haddr_t* /*out*/); +H5_DLL void H5F_addr_encode(const H5F_t *f, uint8_t **pp, haddr_t addr); +H5_DLL void H5F_addr_encode_len(size_t addr_len, uint8_t **pp, haddr_t addr); +H5_DLL void H5F_addr_decode(const H5F_t *f, const uint8_t **pp, haddr_t *addr_p); +H5_DLL void H5F_addr_decode_len(size_t addr_len, const uint8_t **pp, haddr_t *addr_p); /* File access property list callbacks */ H5_DLL herr_t H5P_facc_close(hid_t dxpl_id, void *close_data); @@ -539,7 +537,7 @@ H5_DLL herr_t H5P_facc_close(hid_t dxpl_id, void *close_data); H5_DLL herr_t H5F_sfile_assert_num(unsigned n); /* Routines for creating & destroying "fake" file structures */ -H5_DLL H5F_t *H5F_fake_alloc(size_t sizeof_size); +H5_DLL H5F_t *H5F_fake_alloc(uint8_t sizeof_size); H5_DLL herr_t H5F_fake_free(H5F_t *f); /* Superblock related routines */ diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h index a26c814..df66985 100644 --- a/src/H5Fpublic.h +++ b/src/H5Fpublic.h @@ -21,8 +21,8 @@ /* Public header files needed by this file */ #include "H5public.h" -#include "H5Cpublic.h" #include "H5ACpublic.h" +#include "H5Cpublic.h" #include "H5Ipublic.h" /* When this header is included from a private header, don't make calls to H5check() */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index c24cfa1..f96009c 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -74,6 +74,7 @@ H5FL_DEFINE(H5F_super_t); /* Local Variables */ /*******************/ + /*-------------------------------------------------------------------------- NAME @@ -528,7 +529,7 @@ H5F_super_init(H5F_t *f, hid_t dxpl_id) /* Create the superblock extension for "extra" superblock data, if necessary. */ if(need_ext) { - H5O_loc_t ext_loc; /* Superblock extension object location */ + H5O_loc_t ext_loc; /* Superblock extension object location */ /* The superblock extension isn't actually a group, but the * default group creation list should work fine. @@ -803,6 +804,7 @@ done: * * Programmer: Vailin Choi; Feb 2009 * + * *------------------------------------------------------------------------- */ herr_t diff --git a/src/H5Gcache.c b/src/H5Gcache.c index 6d497b6..1b352ca 100644 --- a/src/H5Gcache.c +++ b/src/H5Gcache.c @@ -119,13 +119,6 @@ H5FL_SEQ_EXTERN(H5G_entry_t); * matzke@llnl.gov * Jun 23 1997 * - * Modifications: - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. - * - * Quincey Koziol, 2002-7-180 - * Added dxpl parameter to allow more control over I/O from metadata - * cache. *------------------------------------------------------------------------- */ static H5G_node_t * @@ -223,26 +216,6 @@ done: * matzke@llnl.gov * Jun 23 1997 * - * Modifications: - * rky, 1998-08-28 - * Only p0 writes metadata to disk. - * - * Robb Matzke, 1999-07-28 - * The ADDR argument is passed by value. - * - * Quincey Koziol, 2002-7-180 - * Added dxpl parameter to allow more control over I/O from metadata - * cache. - * - * Pedro Vicente, <pvn@ncsa.uiuc.edu> 18 Sep 2002 - * Added `id to name' support. - * - * JRM -- 8/21/06 - * Added the flags_ptr parameter. This parameter exists to - * allow the flush routine to report to the cache if the - * entry is resized or renamed as a result of the flush. - * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. - * *------------------------------------------------------------------------- */ static herr_t @@ -350,8 +323,6 @@ done: * koziol@ncsa.uiuc.edu * Jan 15 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -384,7 +355,7 @@ H5G_node_dest(H5F_t *f, H5G_node_t *sym) /* Release resources */ if(sym->entry) sym->entry = (H5G_entry_t *)H5FL_SEQ_FREE(H5G_entry_t, sym->entry); - (void)H5FL_FREE(H5G_node_t, sym); + sym = H5FL_FREE(H5G_node_t, sym); done: FUNC_LEAVE_NOAPI(ret_value) @@ -402,8 +373,6 @@ done: * koziol@ncsa.uiuc.edu * Mar 20 2003 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -412,28 +381,28 @@ H5G_node_clear(H5F_t *f, H5G_node_t *sym, hbool_t destroy) unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; - FUNC_ENTER_NOAPI_NOINIT(H5G_node_clear); + FUNC_ENTER_NOAPI_NOINIT(H5G_node_clear) /* * Check arguments. */ - assert(sym); + HDassert(sym); /* Look for dirty entries and reset their dirty flag. */ for(u = 0; u < sym->nsyms; u++) - sym->entry[u].dirty=FALSE; + sym->entry[u].dirty = FALSE; sym->cache_info.is_dirty = FALSE; /* * Destroy the symbol node? This might happen if the node is being * preempted from the cache. */ - if (destroy) - if (H5G_node_dest(f, sym) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to destroy symbol table node"); + if(destroy) + if(H5G_node_dest(f, sym) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTFREE, FAIL, "unable to destroy symbol table node") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_node_clear() */ @@ -449,14 +418,12 @@ done: * Programmer: John Mainzer * 5/13/04 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t H5G_node_size(const H5F_t *f, const H5G_node_t UNUSED *sym, size_t *size_ptr) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_size); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_size) /* * Check arguments. @@ -466,6 +433,6 @@ H5G_node_size(const H5F_t *f, const H5G_node_t UNUSED *sym, size_t *size_ptr) *size_ptr = H5G_node_size_real(f); - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* H5G_node_size() */ diff --git a/src/H5Gent.c b/src/H5Gent.c index 65f302c..2b499fe 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -55,7 +55,7 @@ H5FL_BLK_EXTERN(str_buf); *------------------------------------------------------------------------- */ herr_t -H5G_ent_decode_vec(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent, unsigned n) +H5G_ent_decode_vec(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent, unsigned n) { unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -94,7 +94,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_ent_decode(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent) +H5G_ent_decode(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent) { const uint8_t *p_ret = *pp; uint32_t tmp; @@ -161,7 +161,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_ent_encode_vec(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, unsigned n) +H5G_ent_encode_vec(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, unsigned n) { unsigned u; /* Local index variable */ herr_t ret_value = SUCCEED; /* Return value */ @@ -422,8 +422,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_ent_debug(H5F_t UNUSED *f, const H5G_entry_t *ent, FILE *stream, - int indent, int fwidth, H5HL_t *heap) +H5G_ent_debug(const H5G_entry_t *ent, FILE *stream, int indent, int fwidth, + H5HL_t *heap) { const char *lval = NULL; int nested_indent, nested_fwidth; diff --git a/src/H5Gnode.c b/src/H5Gnode.c index a58c66a..ce41727 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -51,6 +51,7 @@ typedef struct H5G_node_key_t { size_t offset; /*offset into heap for name */ } H5G_node_key_t; + /* Private macros */ #define H5G_NODE_SIZEOF_HDR(F) (H5_SIZEOF_MAGIC + 4) @@ -131,16 +132,16 @@ H5G_node_get_shared(const H5F_t *f, const void UNUSED *_udata) { H5RC_t *rc; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_get_shared); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_get_shared) - assert(f); + HDassert(f); /* Increment reference count on shared B-tree node */ - rc=H5F_GRP_BTREE_SHARED(f); + rc = H5F_GRP_BTREE_SHARED(f); H5RC_INC(rc); /* Return the pointer to the ref-count object */ - FUNC_LEAVE_NOAPI(rc); + FUNC_LEAVE_NOAPI(rc) } /* end H5G_node_get_shared() */ @@ -155,8 +156,6 @@ H5G_node_get_shared(const H5F_t *f, const void UNUSED *_udata) * matzke@llnl.gov * Jul 8 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -164,16 +163,16 @@ H5G_node_decode_key(const H5F_t *f, const H5B_t UNUSED *bt, const uint8_t *raw, { H5G_node_key_t *key = (H5G_node_key_t *) _key; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_decode_key); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_decode_key) - assert(f); - assert(raw); - assert(key); + HDassert(f); + HDassert(raw); + HDassert(key); H5F_DECODE_LENGTH(f, raw, key->offset); - FUNC_LEAVE_NOAPI(SUCCEED); -} + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5G_node_decode_key() */ /*------------------------------------------------------------------------- @@ -187,8 +186,6 @@ H5G_node_decode_key(const H5F_t *f, const H5B_t UNUSED *bt, const uint8_t *raw, * matzke@llnl.gov * Jul 8 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t @@ -196,16 +193,16 @@ H5G_node_encode_key(const H5F_t *f, const H5B_t UNUSED *bt, uint8_t *raw, void * { H5G_node_key_t *key = (H5G_node_key_t *) _key; - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_encode_key); + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_encode_key) - assert(f); - assert(raw); - assert(key); + HDassert(f); + HDassert(raw); + HDassert(key); H5F_ENCODE_LENGTH(f, raw, key->offset); - FUNC_LEAVE_NOAPI(SUCCEED); -} + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5G_node_encode_key() */ /*------------------------------------------------------------------------- @@ -262,8 +259,6 @@ H5G_node_debug_key(FILE *stream, H5F_t *f, hid_t UNUSED dxpl_id, int indent, * matzke@llnl.gov * Jun 23 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ size_t @@ -273,7 +268,7 @@ H5G_node_size_real(const H5F_t *f) FUNC_LEAVE_NOAPI(H5G_NODE_SIZEOF_HDR(f) + (2 * H5F_SYM_LEAF_K(f)) * H5G_SIZEOF_ENTRY(f)); -} +} /* end H5G_node_size_real() */ /*------------------------------------------------------------------------- @@ -305,7 +300,7 @@ H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t UNUSED op, void *_lt_key, hsize_t size = 0; herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5G_node_create); + FUNC_ENTER_NOAPI_NOINIT(H5G_node_create) /* * Check arguments. @@ -316,12 +311,12 @@ H5G_node_create(H5F_t *f, hid_t dxpl_id, H5B_ins_t UNUSED op, void *_lt_key, if(NULL == (sym = H5FL_CALLOC(H5G_node_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") size = H5G_node_size_real(f); + HDassert(size); if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, size))) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to allocate file space") + if(NULL == (sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f))))) + HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, FAIL, "memory allocation failed") - sym->entry = H5FL_SEQ_CALLOC(H5G_entry_t, (size_t)(2 * H5F_SYM_LEAF_K(f))); - if(NULL == sym->entry) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") if(H5AC_set(f, dxpl_id, H5AC_SNODE, *addr_p, sym, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to cache symbol table leaf node") /* @@ -1022,7 +1017,7 @@ H5G_node_iterate(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t ad done: /* Release resources */ - if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) + if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -1066,7 +1061,7 @@ H5G_node_sumup(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr *num_objs += sn->nsyms; done: - if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) + if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -1095,7 +1090,7 @@ H5G_node_by_idx(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t add H5G_node_t *sn = NULL; int ret_value = H5_ITER_CONT; - FUNC_ENTER_NOAPI(H5G_node_by_idx, H5_ITER_ERROR); + FUNC_ENTER_NOAPI(H5G_node_by_idx, H5_ITER_ERROR) /* * Check arguments. @@ -1127,10 +1122,10 @@ H5G_node_by_idx(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t add udata->num_objs += sn->nsyms; done: - if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) + if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_node_by_idx() */ @@ -1155,7 +1150,7 @@ H5G_node_init(H5F_t *f) size_t sizeof_rkey; /* Size of raw (disk) key */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5G_node_init, FAIL); + FUNC_ENTER_NOAPI(H5G_node_init, FAIL) /* Check arguments. */ HDassert(f); @@ -1175,7 +1170,7 @@ H5G_node_init(H5F_t *f) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "can't create ref-count wrapper for shared B-tree info") done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_node_init() */ @@ -1200,13 +1195,13 @@ H5G_node_close(const H5F_t *f) FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_node_close) /* Check arguments. */ - assert(f); + HDassert(f); /* Free the raw B-tree node buffer */ - if (H5F_GRP_BTREE_SHARED(f)) + if(H5F_GRP_BTREE_SHARED(f)) H5RC_DEC(H5F_GRP_BTREE_SHARED(f)); - FUNC_LEAVE_NOAPI(SUCCEED); + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5G_node_close */ @@ -1227,13 +1222,13 @@ int H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, const void UNUSED *_rt_key, void *_udata) { - H5G_bt_it_cpy_t *udata = (H5G_bt_it_cpy_t *)_udata; - const H5O_loc_t *src_oloc = udata->src_oloc; - H5O_copy_t *cpy_info = udata->cpy_info; - H5HL_t *heap = NULL; - H5G_node_t *sn = NULL; - unsigned int i; /* Local index variable */ - int ret_value = H5_ITER_CONT; + H5G_bt_it_cpy_t *udata = (H5G_bt_it_cpy_t *)_udata; + const H5O_loc_t *src_oloc = udata->src_oloc; + H5O_copy_t *cpy_info = udata->cpy_info; + H5HL_t *heap = NULL; + H5G_node_t *sn = NULL; + unsigned int i; /* Local index variable */ + int ret_value = H5_ITER_CONT; FUNC_ENTER_NOAPI(H5G_node_copy, H5_ITER_ERROR) @@ -1333,10 +1328,10 @@ H5G_node_copy(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_t addr, } /* end of for (i=0; i<sn->nsyms; i++) */ done: - if (heap && H5HL_unprotect(f, dxpl_id, heap, udata->src_heap_addr) < 0) + if(heap && H5HL_unprotect(f, dxpl_id, heap, udata->src_heap_addr) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to unprotect symbol name") - if (sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) + if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -1411,7 +1406,7 @@ H5G_node_build_table(H5F_t *f, hid_t dxpl_id, const void UNUSED *_lt_key, haddr_ done: /* Release the locked items */ - if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) != SUCCEED) + if(sn && H5AC_unprotect(f, dxpl_id, H5AC_SNODE, addr, sn, H5AC__NO_FLAGS_SET) < 0) HDONE_ERROR(H5E_SYM, H5E_PROTECT, H5_ITER_ERROR, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) @@ -1467,10 +1462,10 @@ herr_t H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int fwidth, haddr_t heap_addr) { - H5G_node_t *sn = NULL; - H5HL_t *heap = NULL; - unsigned u; - herr_t ret_value = SUCCEED; /* Return value */ + H5G_node_t *sn = NULL; + H5HL_t *heap = NULL; + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_node_debug, FAIL) @@ -1525,7 +1520,7 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, else fprintf(stream, "%*s%-*s\n", indent, "", fwidth, "Warning: Invalid heap address given, name not displayed!"); - H5G_ent_debug(f, sn->entry + u, stream, indent, fwidth, heap); + H5G_ent_debug(sn->entry + u, stream, indent, fwidth, heap); } /* end for */ } /* end if */ diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index 80c4a7b..355b5fd 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -197,8 +197,8 @@ typedef struct H5G_bt_ins_t { */ typedef struct H5G_bt_rm_t { /* downward */ - H5G_bt_common_t common; /* Common info for B-tree user data (must be first) */ - H5RS_str_t *grp_full_path_r; /* Full path of group where link is removed */ + H5G_bt_common_t common; /* Common info for B-tree user data (must be first) */ + H5RS_str_t *grp_full_path_r; /* Full path of group where link is removed */ } H5G_bt_rm_t; /* Typedef for B-tree 'find' operation */ @@ -210,9 +210,9 @@ typedef herr_t (*H5G_bt_find_op_t)(const H5G_entry_t *ent/*in*/, void *operator_ */ typedef struct H5G_bt_lkp_t { /* downward */ - H5G_bt_common_t common; /* Common info for B-tree user data (must be first) */ - H5G_bt_find_op_t op; /* Operator to call when correct entry is found */ - void *op_data; /* Data to pass to operator */ + H5G_bt_common_t common; /* Common info for B-tree user data (must be first) */ + H5G_bt_find_op_t op; /* Operator to call when correct entry is found */ + void *op_data; /* Data to pass to operator */ /* upward */ } H5G_bt_lkp_t; @@ -254,7 +254,7 @@ typedef struct H5G_bt_it_idx_common_t { typedef struct H5G_bt_it_bt_t { /* downward */ size_t alloc_nlinks; /* Number of links allocated in table */ - H5HL_t *heap; /*symbol table heap */ + H5HL_t *heap; /* Symbol table heap */ /* upward */ H5G_link_table_t *ltable; /* Link table to add information to */ @@ -426,14 +426,14 @@ H5_DLL H5G_obj_t H5G_stab_get_type_by_idx(H5O_loc_t *oloc, hsize_t idx, H5_DLL herr_t H5G_ent_copy(H5G_entry_t *dst, const H5G_entry_t *src, H5_copy_depth_t depth); H5_DLL herr_t H5G_ent_reset(H5G_entry_t *ent); -H5_DLL herr_t H5G_ent_decode_vec(H5F_t *f, const uint8_t **pp, +H5_DLL herr_t H5G_ent_decode_vec(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent, unsigned n); -H5_DLL herr_t H5G_ent_encode_vec(H5F_t *f, uint8_t **pp, +H5_DLL herr_t H5G_ent_encode_vec(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, unsigned n); H5_DLL herr_t H5G_ent_convert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, const char *name, const H5O_link_t *lnk, H5G_entry_t *ent); -H5_DLL herr_t H5G_ent_debug(H5F_t *f, const H5G_entry_t *ent, - FILE * stream, int indent, int fwidth, H5HL_t *heap); +H5_DLL herr_t H5G_ent_debug(const H5G_entry_t *ent, FILE * stream, int indent, + int fwidth, H5HL_t *heap); /* Functions that understand symbol table nodes */ H5_DLL herr_t H5G_node_init(H5F_t *f); diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index 526fa82..dec40f3 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -184,9 +184,8 @@ H5_DLL herr_t H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream /* * These functions operate on group object locations. */ -H5_DLL herr_t H5G_ent_encode(const H5F_t *f, uint8_t **pp, - const H5G_entry_t *ent); -H5_DLL herr_t H5G_ent_decode(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent/*out*/); +H5_DLL herr_t H5G_ent_encode(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent); +H5_DLL herr_t H5G_ent_decode(const H5F_t *f, const uint8_t **pp, H5G_entry_t *ent); /* * These functions operate on group hierarchy names. diff --git a/src/H5Gstab.c b/src/H5Gstab.c index 52c9d07..ab40fad 100644 --- a/src/H5Gstab.c +++ b/src/H5Gstab.c @@ -35,7 +35,7 @@ typedef struct { /* downward */ H5F_t *file; /* Pointer to file for query */ const char *name; /* Name to search for */ - H5HL_t *heap; /* Local heap for group */ + H5HL_t *heap; /* Local heap for group */ /* upward */ H5O_link_t *lnk; /* Caller's link location */ @@ -45,7 +45,7 @@ typedef struct { typedef struct H5G_bt_it_gnbi_t { /* downward */ H5G_bt_it_idx_common_t common; /* Common information for "by index" lookup */ - H5HL_t *heap; /*symbol table heap */ + H5HL_t *heap; /*symbol table heap */ /* upward */ char *name; /*member name to be returned */ @@ -67,7 +67,7 @@ typedef struct H5G_bt_it_gtbi_t { typedef struct H5G_bt_it_lbi_t { /* downward */ H5G_bt_it_idx_common_t common; /* Common information for "by index" lookup */ - H5HL_t *heap; /*symbol table heap */ + H5HL_t *heap; /*symbol table heap */ /* upward */ H5O_link_t *lnk; /*link to be returned */ @@ -99,9 +99,9 @@ typedef struct H5G_bt_it_lbi_t { herr_t H5G_stab_create_components(H5F_t *f, H5O_stab_t *stab, size_t size_hint, hid_t dxpl_id) { - H5HL_t *heap = NULL; /* Pointer to local heap */ - size_t name_offset; /* Offset of "" name */ - herr_t ret_value = SUCCEED; /* Return value */ + H5HL_t *heap = NULL; /* Pointer to local heap */ + size_t name_offset; /* Offset of "" name */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_create_components, FAIL) @@ -223,9 +223,9 @@ herr_t H5G_stab_insert_real(H5F_t *f, H5O_stab_t *stab, const char *name, H5O_link_t *obj_lnk, hid_t dxpl_id) { - H5HL_t *heap = NULL; /* Pointer to local heap */ - H5G_bt_ins_t udata; /* Data to pass through B-tree */ - herr_t ret_value = SUCCEED; /* Return value */ + H5HL_t *heap = NULL; /* Pointer to local heap */ + H5G_bt_ins_t udata; /* Data to pass through B-tree */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_insert_real, FAIL) @@ -315,9 +315,9 @@ H5G_stab_remove(H5O_loc_t *loc, hid_t dxpl_id, H5RS_str_t *grp_full_path_r, const char *name) { H5HL_t *heap = NULL; /* Pointer to local heap */ - H5O_stab_t stab; /*symbol table message */ - H5G_bt_rm_t udata; /*data to pass through B-tree */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_stab_t stab; /*symbol table message */ + H5G_bt_rm_t udata; /*data to pass through B-tree */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_remove, FAIL) @@ -367,11 +367,11 @@ H5G_stab_remove_by_idx(H5O_loc_t *grp_oloc, hid_t dxpl_id, H5RS_str_t *grp_full_ H5_iter_order_t order, hsize_t n) { H5HL_t *heap = NULL; /* Pointer to local heap */ - H5O_stab_t stab; /* Symbol table message */ - H5G_bt_rm_t udata; /* Data to pass through B-tree */ - H5O_link_t obj_lnk; /* Object's link within group */ - hbool_t lnk_copied = FALSE; /* Whether the link was copied */ - herr_t ret_value = SUCCEED; /* Return value */ + H5O_stab_t stab; /* Symbol table message */ + H5G_bt_rm_t udata; /* Data to pass through B-tree */ + H5O_link_t obj_lnk; /* Object's link within group */ + hbool_t lnk_copied = FALSE; /* Whether the link was copied */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_remove_by_idx, FAIL) @@ -429,9 +429,9 @@ done: herr_t H5G_stab_delete(H5F_t *f, hid_t dxpl_id, const H5O_stab_t *stab) { - H5HL_t *heap = NULL; /* Pointer to local heap */ - H5G_bt_rm_t udata; /*data to pass through B-tree */ - herr_t ret_value = SUCCEED; + H5HL_t *heap = NULL; /* Pointer to local heap */ + H5G_bt_rm_t udata; /*data to pass through B-tree */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_delete, FAIL) @@ -486,10 +486,10 @@ herr_t H5G_stab_iterate(const H5O_loc_t *oloc, hid_t dxpl_id, H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op, void *op_data) { - H5HL_t *heap = NULL; /* Local heap for group */ - H5O_stab_t stab; /* Info about symbol table */ + H5HL_t *heap = NULL; /* Local heap for group */ + H5O_stab_t stab; /* Info about symbol table */ H5G_link_table_t ltable = {0, NULL}; /* Link table */ - herr_t ret_value; + herr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_iterate, FAIL) @@ -703,10 +703,10 @@ ssize_t H5G_stab_get_name_by_idx(H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n, char* name, size_t size, hid_t dxpl_id) { - H5HL_t *heap = NULL; /* Pointer to local heap */ - H5O_stab_t stab; /* Info about local heap & B-tree */ - H5G_bt_it_gnbi_t udata; /* Iteration information */ - ssize_t ret_value; /* Return value */ + H5HL_t *heap = NULL; /* Pointer to local heap */ + H5O_stab_t stab; /* Info about local heap & B-tree */ + H5G_bt_it_gnbi_t udata; /* Iteration information */ + ssize_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_get_name_by_idx, FAIL) @@ -822,10 +822,10 @@ htri_t H5G_stab_lookup(H5O_loc_t *grp_oloc, const char *name, H5O_link_t *lnk, hid_t dxpl_id) { - H5HL_t *heap = NULL; /* Pointer to local heap */ - H5G_bt_lkp_t bt_udata; /* Data to pass through B-tree */ - H5G_stab_fnd_ud_t udata; /* 'User data' to give to callback */ - H5O_stab_t stab; /* Symbol table message */ + H5HL_t *heap = NULL; /* Pointer to local heap */ + H5G_bt_lkp_t bt_udata; /* Data to pass through B-tree */ + H5G_stab_fnd_ud_t udata; /* 'User data' to give to callback */ + H5O_stab_t stab; /* Symbol table message */ htri_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_lookup, FAIL) @@ -926,10 +926,10 @@ herr_t H5G_stab_lookup_by_idx(H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_t n, H5O_link_t *lnk, hid_t dxpl_id) { - H5HL_t *heap = NULL; /* Pointer to local heap */ - H5G_bt_it_lbi_t udata; /* Iteration information */ + H5HL_t *heap = NULL; /* Pointer to local heap */ + H5G_bt_it_lbi_t udata; /* Iteration information */ H5O_stab_t stab; /* Symbol table message */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_stab_lookup_by_idx, FAIL) @@ -785,7 +785,7 @@ H5HF_close(H5HF_t *fh, hid_t dxpl_id) { hbool_t pending_delete = FALSE; /* Whether the heap is pending deletion */ haddr_t heap_addr = HADDR_UNDEF; /* Address of heap (for deletion) */ - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HF_close, FAIL) diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 6669853..57d5524 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -274,9 +274,6 @@ H5HF_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *ud H5HF_hdr_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_hdr_load) -#ifdef QAK -HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr); -#endif /* QAK */ /* Check arguments */ HDassert(f); @@ -352,7 +349,7 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr); /* Sanity check */ /* (allow for checksum not decoded yet) */ - HDassert((size_t)(p - buf) == (size - H5HF_SIZEOF_CHKSUM)); + HDassert((size_t)(p - (const uint8_t *)buf) == (size - H5HF_SIZEOF_CHKSUM)); /* Check for I/O filter information to decode */ if(hdr->filter_len > 0) { @@ -361,7 +358,7 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr); H5O_pline_t *pline; /* Pipeline information from the header on disk */ /* Compute the offset of the filter info in the header */ - filter_info_off = (size_t)(p - buf); + filter_info_off = (size_t)(p - (const uint8_t *)buf); /* Compute the size of the extra filter information */ filter_info_size = (size_t)(hdr->sizeof_size /* Size of size for filtered root direct block */ @@ -407,13 +404,13 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr); /* Compute checksum on entire header */ /* (including the filter information, if present) */ - computed_chksum = H5_checksum_metadata(buf, (size_t)(p - buf), 0); + computed_chksum = H5_checksum_metadata(buf, (size_t)(p - (const uint8_t *)buf), 0); /* Metadata checksum */ UINT32DECODE(p, stored_chksum); /* Sanity check */ - HDassert((size_t)(p - buf) == hdr->heap_size); + HDassert((size_t)(p - (const uint8_t *)buf) == hdr->heap_size); /* Verify checksum */ if(stored_chksum != computed_chksum) @@ -422,9 +419,6 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr); /* Finish initialization of heap header */ if(H5HF_hdr_finish_init(hdr) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't finish initializing shared fractal heap header") -#ifdef QAK -HDfprintf(stderr, "%s: hdr->fspace = %p\n", FUNC, hdr->fspace); -#endif /* QAK */ /* Set return value */ ret_value = hdr; @@ -451,11 +445,6 @@ done: * Programmer: Quincey Koziol * koziol@ncsa.uiuc.edu * Feb 24 2006 - * Changes: JRM -- 8/21/06 - * Added the flags_ptr parameter. This parameter exists to - * allow the flush routine to report to the cache if the - * entry is resized or renamed as a result of the flush. - * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. * *------------------------------------------------------------------------- */ @@ -467,9 +456,6 @@ H5HF_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5H herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_hdr_flush) -#ifdef QAK -HDfprintf(stderr, "%s: Flushing heap header, addr = %a, destroy = %u\n", FUNC, addr, (unsigned)destroy); -#endif /* QAK */ /* check arguments */ HDassert(f); @@ -685,7 +671,7 @@ H5HF_cache_hdr_size(const H5F_t UNUSED *f, const H5HF_hdr_t *hdr, size_t *size_p { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_cache_hdr_size) - /* check arguments */ + /* Check arguments */ HDassert(f); HDassert(hdr); HDassert(size_ptr); @@ -730,9 +716,6 @@ H5HF_cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrows H5HF_indirect_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_iblock_load) -#ifdef QAK -HDfprintf(stderr, "%s: Load indirect block, addr = %a\n", FUNC, addr); -#endif /* QAK */ /* Check arguments */ HDassert(f); @@ -858,22 +841,19 @@ HDfprintf(stderr, "%s: Load indirect block, addr = %a\n", FUNC, addr); iblock->nchildren++; iblock->max_child = u; } /* end if */ -#ifdef QAK -HDfprintf(stderr, "%s: iblock->ents[%Zu] = {%a}\n", FUNC, u, iblock->ents[u].addr); -#endif /* QAK */ } /* end for */ /* Sanity check */ HDassert(iblock->nchildren); /* indirect blocks w/no children should have been deleted */ /* Compute checksum on indirect block */ - computed_chksum = H5_checksum_metadata(buf, (size_t)(p - buf), 0); + computed_chksum = H5_checksum_metadata(buf, (size_t)(p - (const uint8_t *)buf), 0); /* Metadata checksum */ UINT32DECODE(p, stored_chksum); /* Sanity check */ - HDassert((size_t)(p - buf) == iblock->size); + HDassert((size_t)(p - (const uint8_t *)buf) == iblock->size); /* Verify checksum */ if(stored_chksum != computed_chksum) @@ -918,12 +898,6 @@ done: * koziol@ncsa.uiuc.edu * Mar 6 2006 * - * Changes: JRM -- 8/21/06 - * Added the flags_ptr parameter. This parameter exists to - * allow the flush routine to report to the cache if the - * entry is resized or renamed as a result of the flush. - * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. - * *------------------------------------------------------------------------- */ static herr_t @@ -934,9 +908,6 @@ H5HF_cache_iblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_cache_iblock_flush) -#ifdef QAK -HDfprintf(stderr, "%s: Flushing indirect block, addr = %a, destroy = %u\n", FUNC, addr, (unsigned)destroy); -#endif /* QAK */ /* check arguments */ HDassert(f); @@ -956,12 +927,6 @@ HDfprintf(stderr, "%s: Flushing indirect block, addr = %a, destroy = %u\n", FUNC /* Get the pointer to the shared heap header */ hdr = iblock->hdr; -#ifdef QAK -HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows); -HDfprintf(stderr, "%s: iblock->size = %Zu\n", FUNC, iblock->size); -HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off); -HDfprintf(stderr, "%s: hdr->man_dtable.cparam.width = %u\n", FUNC, hdr->man_dtable.cparam.width); -#endif /* QAK */ /* Set the shared heap header's file context for this operation */ hdr->f = f; @@ -992,9 +957,6 @@ HDfprintf(stderr, "%s: hdr->man_dtable.cparam.width = %u\n", FUNC, hdr->man_dtab /* Encode indirect block-specific fields */ for(u = 0; u < (iblock->nrows * hdr->man_dtable.cparam.width); u++) { -#ifdef QAK -HDfprintf(stderr, "%s: iblock->ents[%Zu] = {%a}\n", FUNC, u, iblock->ents[u].addr); -#endif /* QAK */ /* Encode child block address */ H5F_addr_encode(f, &p, iblock->ents[u].addr); @@ -1005,9 +967,6 @@ HDfprintf(stderr, "%s: iblock->ents[%Zu] = {%a}\n", FUNC, u, iblock->ents[u].add /* Encode extra information for direct blocks */ if(u < (hdr->man_dtable.max_direct_rows * hdr->man_dtable.cparam.width)) { -#ifdef QAK -HDfprintf(stderr, "%s: iblock->filt_ents[%Zu] = {%Zu, %x}\n", FUNC, u, iblock->filt_ents[u].size, iblock->filt_ents[u].filter_mask); -#endif /* QAK */ /* Sanity check */ /* (either both the address & size are defined or both are * not defined) @@ -1048,9 +1007,6 @@ HDfprintf(stderr, "%s: iblock->filt_ents[%Zu] = {%Zu, %x}\n", FUNC, u, iblock->f /* Check for needing to re-allocate indirect block from 'temp.' to 'normal' file space */ if(H5F_IS_TMP_ADDR(f, addr)) { -#ifdef QAK -HDfprintf(stderr, "%s: Re-allocating indirect block in temporary space - addr = %a\n", FUNC, addr); -#endif /* QAK */ /* Sanity check */ HDassert(H5F_addr_eq(iblock->addr, addr)); @@ -1144,9 +1100,6 @@ H5HF_cache_iblock_dest(H5F_t *f, H5HF_indirect_t *iblock) HDassert(iblock); HDassert(iblock->rc == 0); HDassert(iblock->hdr); -#ifdef QAK -HDfprintf(stderr, "%s: Destroying indirect block\n", FUNC); -#endif /* QAK */ /* If we're going to free the space on disk, the address must be valid */ HDassert(!iblock->cache_info.free_file_space_on_destroy || H5F_addr_defined(iblock->cache_info.addr)); @@ -1246,7 +1199,7 @@ H5HF_cache_iblock_size(const H5F_t UNUSED *f, const H5HF_indirect_t *iblock, siz { FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5HF_cache_iblock_size) - /* check arguments */ + /* Check arguments */ HDassert(iblock); HDassert(size_ptr); @@ -1312,7 +1265,7 @@ H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_size, /* Allocate block buffer */ /* XXX: Change to using free-list factories */ - if((dblock->blk = H5FL_BLK_MALLOC(direct_block, (size_t)dblock->size)) == NULL) + if(NULL == (dblock->blk = H5FL_BLK_MALLOC(direct_block, (size_t)dblock->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Check for I/O filters on this heap */ @@ -1325,10 +1278,6 @@ H5HF_cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_size, /* Check for root direct block */ if(par_info->iblock == NULL) { -#ifdef QAK -HDfprintf(stderr, "%s: hdr->pline_root_direct_size = %Zu, hdr->pline_root_direct_filter_mask = %x\n", FUNC, hdr->pline_root_direct_size, hdr->pline_root_direct_filter_mask); -HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a, addr = %a\n", FUNC, hdr->man_dtable.table_addr, addr); -#endif /* QAK */ /* Sanity check */ HDassert(H5F_addr_eq(hdr->man_dtable.table_addr, addr)); @@ -1337,11 +1286,6 @@ HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a, addr = %a\n", FUNC, hdr- filter_mask = hdr->pline_root_direct_filter_mask; } /* end if */ else { -#ifdef QAK -HDfprintf(stderr, "%s: par_info->iblock = %p, par_info->entry = %u\n", FUNC, par_info->iblock, par_info->entry); -HDfprintf(stderr, "%s: par_info->iblock->filt_ents[%u].size = %Zu, par_info->iblock->filt_ents[%u].filter_mask = %x\n", FUNC, par_info->entry, par_info->iblock->filt_ents[par_info->entry].size, par_info->entry, par_info->iblock->filt_ents[par_info->entry].filter_mask); -HDfprintf(stderr, "%s: par_info->iblock->ents[%u].addr = %a, addr = %a\n", FUNC, par_info->entry, par_info->iblock->ents[par_info->entry].addr, addr); -#endif /* QAK */ /* Sanity check */ HDassert(H5F_addr_eq(par_info->iblock->ents[par_info->entry].addr, addr)); @@ -1353,9 +1297,6 @@ HDfprintf(stderr, "%s: par_info->iblock->ents[%u].addr = %a, addr = %a\n", FUNC, /* Allocate buffer to perform I/O filtering on */ if(NULL == (read_buf = H5MM_malloc(read_size))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, "memory allocation failed for pipeline buffer") -#ifdef QAK -HDfprintf(stderr, "%s: read_size = %Zu, read_buf = %p\n", FUNC, read_size, read_buf); -#endif /* QAK */ /* Read filtered direct block from disk */ if(H5F_block_read(f, H5FD_MEM_FHEAP_DBLOCK, addr, read_size, dxpl_id, read_buf) < 0) @@ -1363,12 +1304,8 @@ HDfprintf(stderr, "%s: read_size = %Zu, read_buf = %p\n", FUNC, read_size, read_ /* Push direct block data through I/O filter pipeline */ nbytes = read_size; - if(H5Z_pipeline(&(hdr->pline), H5Z_FLAG_REVERSE, &filter_mask, H5Z_ENABLE_EDC, - filter_cb, &nbytes, &read_size, &read_buf) < 0) + if(H5Z_pipeline(&(hdr->pline), H5Z_FLAG_REVERSE, &filter_mask, H5Z_ENABLE_EDC, filter_cb, &nbytes, &read_size, &read_buf) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFILTER, NULL, "output pipeline failed") -#ifdef QAK -HDfprintf(stderr, "%s: nbytes = %Zu, read_size = %Zu, read_buf = %p\n", FUNC, nbytes, read_size, read_buf); -#endif /* QAK */ /* Sanity check */ HDassert(nbytes == dblock->size); @@ -1414,7 +1351,7 @@ HDfprintf(stderr, "%s: nbytes = %Zu, read_size = %Zu, read_buf = %p\n", FUNC, nb /* Offset of heap within the heap's address space */ UINT64DECODE_VAR(p, dblock->block_off, hdr->heap_off_size); - /* Encode checksum on direct block, if requested */ + /* Decode checksum on direct block, if requested */ if(hdr->checksum_dblocks) { uint32_t stored_chksum; /* Metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ @@ -1459,12 +1396,6 @@ done: * koziol@ncsa.uiuc.edu * Feb 27 2006 * - * Changes: JRM -- 8/21/06 - * Added the flags_ptr parameter. This parameter exists to - * allow the flush routine to report to the cache if the - * entry is resized or renamed as a result of the flush. - * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. - * *------------------------------------------------------------------------- */ static herr_t @@ -1539,15 +1470,8 @@ H5HF_cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, /* Push direct block data through I/O filter pipeline */ nbytes = write_size; - if(H5Z_pipeline(&(hdr->pline), 0, &filter_mask, H5Z_ENABLE_EDC, - filter_cb, &nbytes, &write_size, &write_buf) < 0) + if(H5Z_pipeline(&(hdr->pline), 0, &filter_mask, H5Z_ENABLE_EDC, filter_cb, &nbytes, &write_size, &write_buf) < 0) HGOTO_ERROR(H5E_HEAP, H5E_WRITEERROR, FAIL, "output pipeline failed") -#ifdef QAK -HDfprintf(stderr, "%s: nbytes = %Zu, write_size = %Zu, write_buf = %p\n", FUNC, nbytes, write_size, write_buf); -HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); -HDfprintf(stderr, "%s: dblock->size = %Zu, dblock->blk = %p\n", FUNC, dblock->size, dblock->blk); -HDfprintf(stderr, "%s: dblock->parent = %p, dblock->par_entry = %u\n", FUNC, dblock->parent, dblock->par_entry); -#endif /* QAK */ /* Use the compressed number of bytes as the size to write */ write_size = nbytes; @@ -1556,10 +1480,6 @@ HDfprintf(stderr, "%s: dblock->parent = %p, dblock->par_entry = %u\n", FUNC, dbl if(dblock->parent == NULL) { hbool_t hdr_changed = FALSE; /* Whether the header information changed */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->pline_root_direct_size = %Zu, hdr->pline_root_direct_filter_mask = %x\n", FUNC, hdr->pline_root_direct_size, hdr->pline_root_direct_filter_mask); -HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a, addr = %a\n", FUNC, hdr->man_dtable.table_addr, addr); -#endif /* QAK */ /* Sanity check */ HDassert(H5F_addr_eq(hdr->man_dtable.table_addr, addr)); HDassert(hdr->pline_root_direct_size > 0); @@ -1572,9 +1492,6 @@ HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a, addr = %a\n", FUNC, hdr- /* Check if we need to re-size the block on disk */ if(hdr->pline_root_direct_size != write_size || at_tmp_addr) { -#ifdef QAK -HDfprintf(stderr, "%s: Need to re-allocate root direct block!\n", FUNC); -#endif /* QAK */ /* Check if the direct block is NOT currently allocated in temp. file space */ /* (temp. file space does not need to be freed) */ if(!at_tmp_addr) { @@ -1614,10 +1531,6 @@ HDfprintf(stderr, "%s: Need to re-allocate root direct block!\n", FUNC); par_iblock = dblock->parent; par_entry = dblock->par_entry; -#ifdef QAK -HDfprintf(stderr, "%s: par_iblock->filt_ents[%u].size = %Zu, par_iblock->filt_ents[%u].filter_mask = %x\n", FUNC, par_entry, par_iblock->filt_ents[par_entry].size, par_entry, par_iblock->filt_ents[par_entry].filter_mask); -HDfprintf(stderr, "%s: par_iblock->ents[%u].addr = %a, addr = %a\n", FUNC, par_entry, par_iblock->ents[par_entry].addr, addr); -#endif /* QAK */ /* Sanity check */ HDassert(H5F_addr_eq(par_iblock->ents[par_entry].addr, addr)); HDassert(par_iblock->filt_ents[par_entry].size > 0); @@ -1630,9 +1543,6 @@ HDfprintf(stderr, "%s: par_iblock->ents[%u].addr = %a, addr = %a\n", FUNC, par_e /* Check if we need to re-size the block on disk */ if(par_iblock->filt_ents[par_entry].size != write_size || at_tmp_addr) { -#ifdef QAK -HDfprintf(stderr, "%s: Need to re-allocate non-root direct block!\n", FUNC); -#endif /* QAK */ /* Check if the direct block is NOT currently allocated in temp. file space */ /* (temp. file space does not need to be freed) */ if(!at_tmp_addr) { @@ -1670,9 +1580,6 @@ HDfprintf(stderr, "%s: Need to re-allocate non-root direct block!\n", FUNC); /* Check for needing to re-allocate direct block from 'temp.' to 'normal' file space */ if(at_tmp_addr) { -#ifdef QAK -HDfprintf(stderr, "%s: Re-allocating direct block in temporary space - addr = %a, write_size = %Zu\n", FUNC, addr, write_size); -#endif /* QAK */ /* Check for root direct block */ if(NULL == dblock->parent) { /* Sanity check */ @@ -1732,9 +1639,6 @@ HDfprintf(stderr, "%s: Re-allocating direct block in temporary space - addr = %a HDassert(!H5F_IS_TMP_ADDR(f, addr)); /* Write the direct block */ -#ifdef QAK -HDfprintf(stderr, "%s: addr = %a, write_size = %Zu\n", FUNC, addr, write_size); -#endif /* QAK */ if(H5F_block_write(f, H5FD_MEM_FHEAP_DBLOCK, addr, write_size, dxpl_id, write_buf) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFLUSH, FAIL, "unable to save fractal heap direct block to disk") @@ -1778,9 +1682,6 @@ H5HF_cache_dblock_dest(H5F_t *f, H5HF_direct_t *dblock) * Check arguments. */ HDassert(dblock); -#ifdef QAK -HDfprintf(stderr, "%s: Destroying direct block, dblock = %p\n", FUNC, dblock); -#endif /* QAK */ /* If we're going to free the space on disk, the address must be valid */ HDassert(!dblock->cache_info.free_file_space_on_destroy || H5F_addr_defined(dblock->cache_info.addr)); diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index e0a1069..c16926e 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -158,9 +158,6 @@ HDmemset(dblock->blk, 0, dblock->size); if(HADDR_UNDEF == (dblock_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_DBLOCK, dxpl_id, (hsize_t)dblock->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap direct block") } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: direct block address = %a\n", FUNC, dblock_addr); -#endif /* QAK */ /* Attach to parent indirect block, if there is one */ dblock->parent = par_iblock; @@ -231,11 +228,6 @@ H5HF_man_dblock_destroy(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_direct_t *dblock, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_destroy) -#ifdef QAK -HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); -HDfprintf(stderr, "%s: dblock->size = %Zu\n", FUNC, dblock->size); -HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr); -#endif /* QAK */ /* * Check arguments. @@ -266,9 +258,6 @@ HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr); /* Check for root direct block */ if(hdr->man_dtable.curr_root_rows == 0) { -#ifdef QAK -HDfprintf(stderr, "%s: root direct block\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(hdr->man_dtable.table_addr == dblock_addr); HDassert(hdr->man_dtable.cparam.start_block_size == dblock->size); @@ -284,25 +273,11 @@ HDfprintf(stderr, "%s: root direct block\n", FUNC); HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't make heap empty") } /* end if */ else { -#ifdef QAK -HDfprintf(stderr, "%s: root indirect block\n", FUNC); -#endif /* QAK */ - /* Adjust heap statistics */ hdr->man_alloc_size -= dblock->size; -#ifdef QAK -HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); -HDfprintf(stderr, "%s: dblock->size = %Zu\n", FUNC, dblock->size); -HDfprintf(stderr, "%s: dblock->parent->nchildren = %u\n", FUNC, dblock->parent->nchildren); -HDfprintf(stderr, "%s: dblock->par_entry = %u\n", FUNC, dblock->par_entry); -HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off); -#endif /* QAK */ /* Check for this direct block being the highest in the heap */ if((dblock->block_off + dblock->size) == hdr->man_iter_off) { -#ifdef QAK -HDfprintf(stderr, "%s: Reversing iterator\n", FUNC); -#endif /* QAK */ /* Move 'next block' iterator backwards (may shrink heap) */ if(H5HF_hdr_reverse_iter(hdr, dxpl_id, dblock_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reverse 'next block' iterator") @@ -329,10 +304,6 @@ HDfprintf(stderr, "%s: Reversing iterator\n", FUNC); dblock->par_entry = 0; } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: Before releasing direct block's space, dblock_addr = %a, dblock_size = %Hu\n", FUNC, dblock_addr, dblock_size); -#endif /* QAK */ - /* Indicate that the indirect block should be deleted & file space freed */ dblock->file_size = dblock_size; cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; @@ -369,9 +340,6 @@ H5HF_man_dblock_new(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t request, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_new) -#ifdef QAK -HDfprintf(stderr, "%s: request = %Zu\n", FUNC, request); -#endif /* QAK */ /* * Check arguments. @@ -388,15 +356,8 @@ HDfprintf(stderr, "%s: request = %Zu\n", FUNC, request); } /* end else */ /* Adjust the size of block needed to fulfill request, with overhead */ -#ifdef QAK -HDfprintf(stderr, "%s: Check 1 - min_dblock_size = %Zu\n", FUNC, min_dblock_size); -HDfprintf(stderr, "%s: H5HF_MAN_ABS_DIRECT_OVERHEAD= %u\n", FUNC, H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)); -#endif /* QAK */ if((min_dblock_size - request) < H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)) min_dblock_size *= 2; -#ifdef QAK -HDfprintf(stderr, "%s: Check 2 - min_dblock_size = %Zu\n", FUNC, min_dblock_size); -#endif /* QAK */ /* Check if this is the first block in the heap */ if(!H5F_addr_defined(hdr->man_dtable.table_addr) && @@ -405,10 +366,6 @@ HDfprintf(stderr, "%s: Check 2 - min_dblock_size = %Zu\n", FUNC, min_dblock_size if(H5HF_man_dblock_create(dxpl_id, hdr, NULL, 0, &dblock_addr, ret_sec_node) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap direct block") -#ifdef QAK -HDfprintf(stderr, "%s: root direct block, dblock_addr = %a\n", FUNC, dblock_addr); -#endif /* QAK */ - /* Point root at new direct block */ hdr->man_dtable.curr_root_rows = 0; hdr->man_dtable.table_addr = dblock_addr; @@ -428,16 +385,10 @@ HDfprintf(stderr, "%s: root direct block, dblock_addr = %a\n", FUNC, dblock_addr unsigned next_entry; /* Iterator's next block entry */ size_t next_size; /* Size of next direct block to create */ -#ifdef QAK -HDfprintf(stderr, "%s: before updating iterator, hdr->man_iter_off = %Hu, hdr->man_size = %Hu\n", FUNC, hdr->man_iter_off, hdr->man_size); -#endif /* QAK */ /* Update iterator to reflect any previous increments as well as allow for requested direct block size */ if(H5HF_hdr_update_iter(hdr, dxpl_id, min_dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUPDATE, FAIL, "unable to update block iterator") -#ifdef QAK -HDfprintf(stderr, "%s: after updating iterator, hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off); -#endif /* QAK */ /* Retrieve information about current iterator position */ if(H5HF_man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator location") @@ -454,18 +405,9 @@ HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "skipping direct block sizes not su if(H5HF_hdr_inc_iter(hdr, (hsize_t)next_size, 1) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment 'next block' iterator") -#ifdef QAK -HDfprintf(stderr, "%s: iblock = %p\n", FUNC, iblock); -HDfprintf(stderr, "%s: iblock->addr = %a\n", FUNC, iblock->addr); -HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry); -#endif /* QAK */ - /* Create new direct block at current location*/ if(H5HF_man_dblock_create(dxpl_id, hdr, iblock, next_entry, &dblock_addr, ret_sec_node) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap direct block") -#ifdef QAK -HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr); -#endif /* QAK */ } /* end else */ done: @@ -497,9 +439,6 @@ H5HF_man_dblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr, H5HF_direct_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_protect) -#ifdef QAK -HDfprintf(stderr, "%s: dblock_addr = %a, dblock_size = %Zu\n", FUNC, dblock_addr, dblock_size); -#endif /* QAK */ /* * Check arguments. @@ -551,9 +490,6 @@ H5HF_man_dblock_locate(H5HF_hdr_t *hdr, hid_t dxpl_id, hsize_t obj_off, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_locate) -#ifdef QAK -HDfprintf(stderr, "%s: obj_off = %Hu\n", FUNC, obj_off); -#endif /* QAK */ /* * Check arguments. @@ -566,15 +502,9 @@ HDfprintf(stderr, "%s: obj_off = %Hu\n", FUNC, obj_off); /* Look up row & column for object */ if(H5HF_dtable_lookup(&hdr->man_dtable, obj_off, &row, &col) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of object") -#ifdef QAK -HDfprintf(stderr, "%s: row = %u, col = %u\n", FUNC, row, col); -#endif /* QAK */ /* Set initial indirect block info */ iblock_addr = hdr->man_dtable.table_addr; -#ifdef QAK -HDfprintf(stderr, "%s: iblock_addr = %a\n", FUNC, iblock_addr); -#endif /* QAK */ /* Lock root indirect block */ if(NULL == (iblock = H5HF_man_iblock_protect(hdr, dxpl_id, iblock_addr, hdr->man_dtable.curr_root_rows, NULL, 0, FALSE, rw, &did_protect))) @@ -593,9 +523,6 @@ HDfprintf(stderr, "%s: iblock_addr = %a\n", FUNC, iblock_addr); /* Compute indirect block's entry */ entry = (row * hdr->man_dtable.cparam.width) + col; -#ifdef QAK -HDfprintf(stderr, "%s: entry = %Zu\n", FUNC, entry); -#endif /* QAK */ /* Locate child indirect block */ iblock_addr = iblock->ents[entry].addr; @@ -620,18 +547,11 @@ HDfprintf(stderr, "%s: entry = %Zu\n", FUNC, entry); /* Switch variables to use new indirect block */ iblock = new_iblock; did_protect = new_did_protect; -#ifdef QAK -HDfprintf(stderr, "%s: iblock->addr = %a\n", FUNC, iblock->addr); -HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off); -#endif /* QAK */ /* Look up row & column in new indirect block for object */ if(H5HF_dtable_lookup(&hdr->man_dtable, (obj_off - iblock->block_off), &row, &col) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of object") HDassert(row < iblock->nrows); /* child must be smaller than parent */ -#ifdef QAK -HDfprintf(stderr, "%s: row = %u, col = %u\n", FUNC, row, col); -#endif /* QAK */ } /* end while */ /* Set return parameters */ @@ -671,9 +591,6 @@ H5HF_man_dblock_delete(H5F_t *f, hid_t dxpl_id, haddr_t dblock_addr, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_dblock_delete) -#ifdef QAK -HDfprintf(stderr, "%s: dblock_addr = %a, dblock_size = %Hu\n", FUNC, dblock_addr, dblock_size); -#endif /* QAK */ /* * Check arguments. @@ -691,15 +608,9 @@ HDfprintf(stderr, "%s: dblock_addr = %a, dblock_size = %Hu\n", FUNC, dblock_addr HDassert(!(dblock_status & H5AC_ES__IS_PINNED)); HDassert(!(dblock_status & H5AC_ES__IS_PROTECTED)); -#ifdef QAK -HDfprintf(stderr, "%s: Expunging direct block from cache\n", FUNC); -#endif /* QAK */ /* Evict the direct block from the metadata cache */ if(H5AC_expunge_entry(f, dxpl_id, H5AC_FHEAP_DBLOCK, dblock_addr, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "unable to remove direct block from cache") -#ifdef QAK -HDfprintf(stderr, "%s: Done expunging direct block from cache\n", FUNC); -#endif /* QAK */ } /* end if */ /* Check if the direct block is NOT currently allocated in temp. file space */ diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index c326a59..db0093e 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -271,12 +271,6 @@ H5HF_hdr_finish_init_phase2(H5HF_hdr_t *hdr) else if(H5HF_hdr_compute_free_space(hdr, u) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't initialize direct block free space for indirect block") -#ifdef QAK -HDfprintf(stderr, "%s: row_block_size[%Zu] = %Hu\n", FUNC, u, hdr->man_dtable.row_block_size[u]); -HDfprintf(stderr, "%s: row_block_off[%Zu] = %Hu\n", FUNC, u, hdr->man_dtable.row_block_off[u]); -HDfprintf(stderr, "%s: row_tot_dblock_free[%Zu] = %Hu\n", FUNC, u, hdr->man_dtable.row_tot_dblock_free[u]); -HDfprintf(stderr, "%s: row_max_dblock_free[%Zu] = %Zu\n", FUNC, u, hdr->man_dtable.row_max_dblock_free[u]); -#endif /* QAK */ } /* end for */ /* Initialize the block iterator for searching for free space */ @@ -444,9 +438,6 @@ H5HF_hdr_create(H5F_t *f, hid_t dxpl_id, const H5HF_create_t *cparam) /* Compute the I/O filters' encoded size */ if(0 == (hdr->filter_len = H5O_msg_raw_size(hdr->f, H5O_PLINE_ID, FALSE, &(hdr->pline)))) HGOTO_ERROR(H5E_HEAP, H5E_CANTGETSIZE, HADDR_UNDEF, "can't get I/O filter pipeline size") -#ifdef QAK -HDfprintf(stderr, "%s: hdr->filter_len = %u\n", FUNC, hdr->filter_len); -#endif /* QAK */ /* Compute size of header on disk */ hdr->heap_size = H5HF_HEADER_SIZE(hdr) /* Base header size */ @@ -496,9 +487,6 @@ HDfprintf(stderr, "%s: hdr->filter_len = %u\n", FUNC, hdr->filter_len); hdr->id_len = cparam->id_len; break; } /* end switch */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->id_len = %Zu\n", FUNC, hdr->id_len); -#endif /* QAK */ /* Second phase of header final initialization */ /* (needs ID and filter lengths set up) */ @@ -682,9 +670,6 @@ H5HF_hdr_dirty(H5HF_hdr_t *hdr) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_hdr_dirty) -#ifdef QAK -HDfprintf(stderr, "%s: Marking heap header as dirty\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(hdr); @@ -717,9 +702,6 @@ H5HF_hdr_adj_free(H5HF_hdr_t *hdr, ssize_t amt) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_hdr_adj_free) -#ifdef QAK -HDfprintf(stderr, "%s: amt = %Zd\n", FUNC, amt); -#endif /* QAK */ /* * Check arguments. @@ -729,9 +711,6 @@ HDfprintf(stderr, "%s: amt = %Zd\n", FUNC, amt); /* Update heap header */ HDassert(amt > 0 || hdr->total_man_free >= (hsize_t)-amt); hdr->total_man_free += amt; -#ifdef QAK -HDfprintf(stderr, "%s: hdr->total_man_free = %Hu\n", FUNC, hdr->total_man_free); -#endif /* QAK */ /* Mark heap header as modified */ if(H5HF_hdr_dirty(hdr) < 0) @@ -766,12 +745,6 @@ H5HF_hdr_adjust_heap(H5HF_hdr_t *hdr, hsize_t new_size, hssize_t extra_free) * Check arguments. */ HDassert(hdr); -#ifdef QAK -HDfprintf(stderr, "%s; new_size = %Hu, extra_free = %Hd\n", FUNC, new_size, extra_free); -HDfprintf(stderr, "%s; hdr->total_size = %Hu\n", FUNC, hdr->total_size); -HDfprintf(stderr, "%s; hdr->man_size = %Hu\n", FUNC, hdr->man_size); -HDfprintf(stderr, "%s; hdr->total_man_free = %Hu\n", FUNC, hdr->total_man_free); -#endif /* QAK */ /* Set the total managed space in heap */ hdr->man_size = new_size; @@ -814,9 +787,6 @@ H5HF_hdr_inc_alloc(H5HF_hdr_t *hdr, size_t alloc_size) /* Update the "allocated" size within the heap */ hdr->man_alloc_size += alloc_size; -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_alloc_size = %Hu\n", "H5HF_hdr_inc_alloc", hdr->man_alloc_size); -#endif /* QAK */ FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HF_hdr_inc_alloc() */ @@ -890,9 +860,6 @@ H5HF_hdr_reset_iter(H5HF_hdr_t *hdr, hsize_t curr_off) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator") /* Set the offset of the iterator in the heap */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu, curr_off = %Hu\n", FUNC, hdr->man_iter_off, curr_off); -#endif /* QAK */ hdr->man_iter_off = curr_off; done: @@ -922,9 +889,6 @@ H5HF_hdr_skip_blocks(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_indirect_t *iblock, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_hdr_skip_blocks) -#ifdef QAK -HDfprintf(stderr, "%s: start_entry = %u, nentries = %u\n", FUNC, start_entry, nentries); -#endif /* QAK */ /* * Check arguments. @@ -937,17 +901,11 @@ HDfprintf(stderr, "%s: start_entry = %u, nentries = %u\n", FUNC, start_entry, ne row = start_entry / hdr->man_dtable.cparam.width; col = start_entry % hdr->man_dtable.cparam.width; sect_size = H5HF_dtable_span_size(&hdr->man_dtable, row, col, nentries); -#ifdef QAK -HDfprintf(stderr, "%s: Check 1.0 - hdr->man_iter_off = %Hu, sect_size = %Hu\n", FUNC, hdr->man_iter_off, sect_size); -#endif /* QAK */ HDassert(sect_size > 0); /* Advance the new block iterator */ if(H5HF_hdr_inc_iter(hdr, sect_size, nentries) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't increase allocated heap size") -#ifdef QAK -HDfprintf(stderr, "%s: Check 2.0 - hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off); -#endif /* QAK */ /* Add 'indirect' section for blocks skipped in this row */ if(H5HF_sect_indirect_add(hdr, dxpl_id, iblock, start_entry, nentries) < 0) @@ -980,9 +938,6 @@ H5HF_hdr_update_iter(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_size) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_hdr_update_iter) -#ifdef QAK -HDfprintf(stderr, "%s: min_dblock_size = %Zu\n", FUNC, min_dblock_size); -#endif /* QAK */ /* * Check arguments. @@ -992,9 +947,6 @@ HDfprintf(stderr, "%s: min_dblock_size = %Zu\n", FUNC, min_dblock_size); /* Check for creating first indirect block */ if(hdr->man_dtable.curr_root_rows == 0) { -#ifdef QAK -HDfprintf(stderr, "%s: Creating root direct block\n", FUNC); -#endif /* QAK */ if(H5HF_man_iblock_root_create(hdr, dxpl_id, min_dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "unable to create root indirect block") } /* end if */ @@ -1005,21 +957,11 @@ HDfprintf(stderr, "%s: Creating root direct block\n", FUNC); unsigned next_entry; /* Iterator's next block entry */ unsigned min_dblock_row; /* Minimum row for direct block size request */ -#ifdef QAK -HDfprintf(stderr, "%s: searching root indirect block\n", FUNC); -#endif /* QAK */ /* Compute min. row for direct block requested */ min_dblock_row = H5HF_dtable_size_to_row(&hdr->man_dtable, min_dblock_size); -#ifdef QAK -HDfprintf(stderr, "%s: min_dblock_size = %Zu, min_dblock_row = %u\n", FUNC, min_dblock_size, min_dblock_row); -HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off); -#endif /* QAK */ /* Initialize block iterator, if necessary */ if(!H5HF_man_iter_ready(&hdr->next_block)) { -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off); -#endif /* QAK */ /* Start iterator with previous offset of iterator */ if(H5HF_man_iter_start_offset(hdr, dxpl_id, &hdr->next_block, hdr->man_iter_off) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to set block iterator location") @@ -1029,14 +971,6 @@ HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off); if(H5HF_man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator location") -#ifdef QAK -HDfprintf(stderr, "%s: Check 1.0\n", FUNC); -HDfprintf(stderr, "%s: iblock = %p\n", FUNC, iblock); -HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off); -HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows); -HDfprintf(stderr, "%s: next_row = %u\n", FUNC, next_row); -HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry); -#endif /* QAK */ /* Check for skipping over blocks in the current block */ if(min_dblock_row > next_row && next_row < iblock->nrows) { unsigned min_entry; /* Min entry for direct block requested */ @@ -1048,9 +982,6 @@ HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry); skip_entries = (iblock->nrows * hdr->man_dtable.cparam.width) - next_entry; else skip_entries = min_entry - next_entry; -#ifdef QAK -HDfprintf(stderr, "%s: min_entry = %u, skip_entries = %u\n", FUNC, min_entry, skip_entries); -#endif /* QAK */ /* Add skipped direct blocks to heap's free space */ if(H5HF_hdr_skip_blocks(hdr, dxpl_id, iblock, next_entry, skip_entries) < 0) @@ -1065,33 +996,15 @@ HDfprintf(stderr, "%s: min_entry = %u, skip_entries = %u\n", FUNC, min_entry, sk /* Reset conditions for leaving loop */ walked_up = walked_down = FALSE; -#ifdef QAK -HDfprintf(stderr, "%s: Check 2.0\n", FUNC); -HDfprintf(stderr, "%s: iblock = %p\n", FUNC, iblock); -HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off); -HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows); -HDfprintf(stderr, "%s: next_row = %u\n", FUNC, next_row); -HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry); -#endif /* QAK */ - /* Check for walking off end of indirect block */ /* (walk up iterator) */ while(next_row >= iblock->nrows) { -#ifdef QAK -HDfprintf(stderr, "%s: Off the end of a block, next_row = %u, iblock->nrows = %u\n", FUNC, next_row, iblock->nrows); -#endif /* QAK */ /* Check for needing to expand root indirect block */ if(iblock->parent == NULL) { -#ifdef QAK -HDfprintf(stderr, "%s: Doubling root block\n", FUNC); -#endif /* QAK */ if(H5HF_man_iblock_root_double(hdr, dxpl_id, min_dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "unable to double root indirect block") } /* end if */ else { -#ifdef QAK -HDfprintf(stderr, "%s: Walking up a level\n", FUNC); -#endif /* QAK */ /* Move iterator up one level */ if(H5HF_man_iter_up(&hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTNEXT, FAIL, "unable to advance current block iterator location") @@ -1108,36 +1021,16 @@ HDfprintf(stderr, "%s: Walking up a level\n", FUNC); /* Indicate that we walked up */ walked_up = TRUE; } /* end while */ -#ifdef QAK -HDfprintf(stderr, "%s: Check 3.0\n", FUNC); -HDfprintf(stderr, "%s: iblock = %p\n", FUNC, iblock); -HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows); -HDfprintf(stderr, "%s: next_row = %u\n", FUNC, next_row); -HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry); -#endif /* QAK */ /* Check for walking into child indirect block */ /* (walk down iterator) */ if(next_row >= hdr->man_dtable.max_direct_rows) { unsigned child_nrows; /* Number of rows in new indirect block */ -#ifdef QAK -HDfprintf(stderr, "%s: Walking down into child indirect block\n", FUNC); -#endif /* QAK */ -#ifdef QAK -HDfprintf(stderr, "%s: Check 3.1\n", FUNC); -HDfprintf(stderr, "%s: iblock = %p\n", FUNC, iblock); -HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows); -HDfprintf(stderr, "%s: next_row = %u\n", FUNC, next_row); -HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry); -#endif /* QAK */ HDassert(!H5F_addr_defined(iblock->ents[next_entry].addr)); /* Compute # of rows in next child indirect block to use */ child_nrows = H5HF_dtable_size_to_rows(&hdr->man_dtable, hdr->man_dtable.row_block_size[next_row]); -#ifdef QAK -HDfprintf(stderr, "%s: child_nrows = %u\n", FUNC, child_nrows); -#endif /* QAK */ /* Check for skipping over indirect blocks */ /* (that don't have direct blocks large enough to hold direct block size requested) */ @@ -1145,19 +1038,12 @@ HDfprintf(stderr, "%s: child_nrows = %u\n", FUNC, child_nrows); unsigned child_rows_needed; /* Number of rows needed to hold direct block */ unsigned child_entry; /* Entry of child indirect block */ -#ifdef QAK -HDfprintf(stderr, "%s: Skipping indirect block row that is too small\n", FUNC); -#endif /* QAK */ /* Compute # of rows needed in child indirect block */ child_rows_needed = (H5V_log2_of2((uint32_t)min_dblock_size) - H5V_log2_of2((uint32_t)hdr->man_dtable.cparam.start_block_size)) + 2; HDassert(child_rows_needed > child_nrows); child_entry = (next_row + (child_rows_needed - child_nrows)) * hdr->man_dtable.cparam.width; if(child_entry > (iblock->nrows * hdr->man_dtable.cparam.width)) child_entry = iblock->nrows * hdr->man_dtable.cparam.width; -#ifdef QAK -HDfprintf(stderr, "%s: child_rows_needed = %u\n", FUNC, child_rows_needed); -HDfprintf(stderr, "%s: child_entry = %u\n", FUNC, child_entry); -#endif /* QAK */ /* Add skipped indirect blocks to heap's free space */ if(H5HF_hdr_skip_blocks(hdr, dxpl_id, iblock, next_entry, (child_entry - next_entry)) < 0) @@ -1168,9 +1054,6 @@ HDfprintf(stderr, "%s: child_entry = %u\n", FUNC, child_entry); hbool_t did_protect; /* Whether we protected the indirect block or not */ haddr_t new_iblock_addr; /* New indirect block's address */ -#ifdef QAK -HDfprintf(stderr, "%s: Allocating new child indirect block\n", FUNC); -#endif /* QAK */ /* Allocate new indirect block */ if(H5HF_man_iblock_create(hdr, dxpl_id, iblock, next_entry, child_nrows, child_nrows, &new_iblock_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap indirect block") @@ -1189,9 +1072,6 @@ HDfprintf(stderr, "%s: Allocating new child indirect block\n", FUNC); /* Compute entry for direct block size requested */ new_entry = hdr->man_dtable.cparam.width * min_dblock_row; -#ifdef QAK -HDfprintf(stderr, "%s: Skipping rows in new child indirect block - new_entry = %u\n", FUNC, new_entry); -#endif /* QAK */ /* Add skipped blocks to heap's free space */ if(H5HF_hdr_skip_blocks(hdr, dxpl_id, new_iblock, 0, new_entry) < 0) @@ -1243,9 +1123,6 @@ H5HF_hdr_inc_iter(H5HF_hdr_t *hdr, hsize_t adv_size, unsigned nentries) */ HDassert(hdr); HDassert(nentries); -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu, adv_size = %Hu\n", FUNC, hdr->man_iter_off, adv_size); -#endif /* QAK */ /* Advance the iterator for the current location within the indirect block */ if(hdr->next_block.curr) @@ -1301,11 +1178,6 @@ H5HF_hdr_reverse_iter(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t dblock_addr) /* Get information about current iterator location */ if(H5HF_man_iter_curr(&hdr->next_block, NULL, NULL, &curr_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator information") -#ifdef QAK -HDfprintf(stderr, "%s: iblock->nchildren = %u\n", FUNC, iblock->nchildren); -HDfprintf(stderr, "%s: iblock->parent = %p\n", FUNC, iblock->parent); -HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry); -#endif /* QAK */ /* Move current iterator position backwards once */ curr_entry--; @@ -1321,23 +1193,14 @@ HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry); /* Walk backwards through entries, until we find one that has a child */ /* (Skip direct block that will be deleted, if we find it) */ tmp_entry = curr_entry; -#ifdef QAK -HDfprintf(stderr, "%s: tmp_entry = %d\n", FUNC, tmp_entry); -#endif /* QAK */ while(tmp_entry >= 0 && (H5F_addr_eq(iblock->ents[tmp_entry].addr, dblock_addr) || !H5F_addr_defined(iblock->ents[tmp_entry].addr))) tmp_entry--; -#ifdef QAK -HDfprintf(stderr, "%s: check 2.0 - tmp_entry = %d\n", FUNC, tmp_entry); -#endif /* QAK */ /* Check for no earlier blocks in this indirect block */ if(tmp_entry < 0) { /* Check for parent of current indirect block */ if(iblock->parent) { -#ifdef QAK -HDfprintf(stderr, "%s: Walking up a block\n", FUNC); -#endif /* QAK */ /* Move iterator to parent of current block */ if(H5HF_man_iter_up(&hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTNEXT, FAIL, "unable to move current block iterator location up") @@ -1345,11 +1208,6 @@ HDfprintf(stderr, "%s: Walking up a block\n", FUNC); /* Get information about current iterator location */ if(H5HF_man_iter_curr(&hdr->next_block, NULL, NULL, &curr_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator information") -#ifdef QAK -HDfprintf(stderr, "%s: iblock->nchildren = %u\n", FUNC, iblock->nchildren); -HDfprintf(stderr, "%s: iblock->parent = %p\n", FUNC, iblock->parent); -HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry); -#endif /* QAK */ /* Move current iterator position backwards once */ curr_entry--; @@ -1358,9 +1216,6 @@ HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry); walked_up = TRUE; } /* end if */ else { -#ifdef QAK -HDfprintf(stderr, "%s: Heap empty\n", FUNC); -#endif /* QAK */ /* Reset iterator offset */ hdr->man_iter_off = 0; @@ -1376,14 +1231,7 @@ HDfprintf(stderr, "%s: Heap empty\n", FUNC); /* Check if entry is for a direct block */ row = curr_entry / hdr->man_dtable.cparam.width; -#ifdef QAK -HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry); -HDfprintf(stderr, "%s: row = %u\n", FUNC, row); -#endif /* QAK */ if(row < hdr->man_dtable.max_direct_rows) { -#ifdef QAK -HDfprintf(stderr, "%s: Found direct block\n", FUNC); -#endif /* QAK */ /* Increment entry to empty location */ curr_entry++; @@ -1395,19 +1243,12 @@ HDfprintf(stderr, "%s: Found direct block\n", FUNC); hdr->man_iter_off = iblock->block_off; hdr->man_iter_off += hdr->man_dtable.row_block_off[curr_entry / hdr->man_dtable.cparam.width]; hdr->man_iter_off += hdr->man_dtable.row_block_size[curr_entry / hdr->man_dtable.cparam.width] * (curr_entry % hdr->man_dtable.cparam.width); -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", FUNC, hdr->man_iter_off); -HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry); -#endif /* QAK */ } /* end if */ else { H5HF_indirect_t *child_iblock; /* Pointer to child indirect block */ hbool_t did_protect; /* Whether we protected the indirect block or not */ unsigned child_nrows; /* # of rows in child block */ -#ifdef QAK -HDfprintf(stderr, "%s: Walking down into child block\n", FUNC); -#endif /* QAK */ /* Compute # of rows in next child indirect block to use */ child_nrows = H5HF_dtable_size_to_rows(&hdr->man_dtable, hdr->man_dtable.row_block_size[row]); @@ -1426,11 +1267,6 @@ HDfprintf(stderr, "%s: Walking down into child block\n", FUNC); /* Update iterator location */ iblock = child_iblock; curr_entry = (child_iblock->nrows * hdr->man_dtable.cparam.width) - 1; -#ifdef QAK -HDfprintf(stderr, "%s: iblock->nchildren = %u\n", FUNC, iblock->nchildren); -HDfprintf(stderr, "%s: iblock->parent = %p\n", FUNC, iblock->parent); -HDfprintf(stderr, "%s: curr_entry = %u\n", FUNC, curr_entry); -#endif /* QAK */ /* Unprotect child indirect block */ if(H5HF_man_iblock_unprotect(child_iblock, dxpl_id, H5AC__NO_FLAGS_SET, did_protect) < 0) @@ -1466,18 +1302,12 @@ H5HF_hdr_empty(H5HF_hdr_t *hdr) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_hdr_empty) -#ifdef QAK -HDfprintf(stderr, "%s: Resetting heap header to empty\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(hdr); /* Reset block iterator, if necessary */ if(H5HF_man_iter_ready(&hdr->next_block)) { -#ifdef QAK -HDfprintf(stderr, "%s: 'next block' iterator is ready\n", FUNC); -#endif /* QAK */ if(H5HF_man_iter_reset(&hdr->next_block) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't reset block iterator") } /* end if */ @@ -1584,9 +1414,6 @@ H5HF_hdr_delete(H5HF_hdr_t *hdr, hid_t dxpl_id) * will get unpinned) */ if(H5F_addr_defined(hdr->fs_addr)) { -#ifdef QAK -HDfprintf(stderr, "%s: hdr->fs_addr = %a\n", FUNC, hdr->fs_addr); -#endif /* QAK */ /* Delete free space manager for heap */ if(H5HF_space_delete(hdr, dxpl_id) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release fractal heap free space manager") @@ -1594,18 +1421,12 @@ HDfprintf(stderr, "%s: hdr->fs_addr = %a\n", FUNC, hdr->fs_addr); /* Check for root direct/indirect block */ if(H5F_addr_defined(hdr->man_dtable.table_addr)) { -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_dtable.table_addr = %a\n", FUNC, hdr->man_dtable.table_addr); -#endif /* QAK */ if(hdr->man_dtable.curr_root_rows == 0) { hsize_t dblock_size; /* Size of direct block */ /* Check for I/O filters on this heap */ if(hdr->filter_len > 0) { dblock_size = (hsize_t)hdr->pline_root_direct_size; -#ifdef QAK -HDfprintf(stderr, "%s: hdr->pline_root_direct_size = %Zu\n", FUNC, hdr->pline_root_direct_size); -#endif /* QAK */ /* Reset the header's pipeline information */ hdr->pline_root_direct_size = 0; @@ -1627,9 +1448,6 @@ HDfprintf(stderr, "%s: hdr->pline_root_direct_size = %Zu\n", FUNC, hdr->pline_ro /* Check for 'huge' objects in heap */ if(H5F_addr_defined(hdr->huge_bt2_addr)) { -#ifdef QAK -HDfprintf(stderr, "%s: hdr->huge_bt2_addr = %a\n", FUNC, hdr->huge_bt2_addr); -#endif /* QAK */ /* Delete huge objects in heap and their tracker */ if(H5HF_huge_delete(hdr, dxpl_id) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to release fractal heap 'huge' objects and tracker") diff --git a/src/H5HFiblock.c b/src/H5HFiblock.c index 8969aae..c6e22cc 100644 --- a/src/H5HFiblock.c +++ b/src/H5HFiblock.c @@ -239,10 +239,6 @@ H5HF_iblock_incr(H5HF_indirect_t *iblock) /* Increment reference count on shared indirect block */ iblock->rc++; -#ifdef QAK -HDfprintf(stderr, "%s: iblock->addr = %a, iblock->rc = %Zu\n", FUNC, iblock->addr, iblock->rc); -HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off); -#endif /* QAK */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -274,23 +270,13 @@ H5HF_iblock_decr(H5HF_indirect_t *iblock) /* Decrement reference count on shared indirect block */ iblock->rc--; -#ifdef QAK -HDfprintf(stderr, "%s: iblock->addr = %a, iblock->rc = %Zu\n", FUNC, iblock->addr, iblock->rc); -HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off); -#endif /* QAK */ /* Mark block as evictable again when no child blocks depend on it */ if(iblock->rc == 0) { -#ifdef QAK -HDfprintf(stderr, "%s: indirect block ref. count at zero, iblock->addr = %a\n", FUNC, iblock->addr); -#endif /* QAK */ if(H5HF_iblock_unpin(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPIN, FAIL, "unable to unpin fractal heap indirect block") if(iblock->nchildren == 0) { -#ifdef QAK -HDfprintf(stderr, "%s: Removing indirect block from cache, iblock->addr = %a\n", FUNC, iblock->addr); -#endif /* QAK */ /* Check for deleting root indirect block (and no root direct block) */ if(iblock->block_off == 0 && iblock->hdr->man_dtable.curr_root_rows > 0) { /* Reset root pointer information */ @@ -341,9 +327,6 @@ H5HF_iblock_dirty(H5HF_indirect_t *iblock) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_iblock_dirty) -#ifdef QAK -HDfprintf(stderr, "%s: Marking indirect block as dirty\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(iblock); @@ -384,10 +367,6 @@ H5HF_man_iblock_root_create(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_si FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_root_create) -#ifdef QAK -HDfprintf(stderr, "%s: Creating root indirect block\n", FUNC); -#endif /* QAK */ - /* Check for allocating entire root indirect block initially */ if(hdr->man_dtable.cparam.start_root_rows == 0) nrows = hdr->man_dtable.max_root_rows; @@ -404,16 +383,10 @@ HDfprintf(stderr, "%s: Creating root indirect block\n", FUNC); if(nrows < rows_needed) nrows = rows_needed; } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: nrows = %u\n", FUNC, nrows); -#endif /* QAK */ /* Allocate root indirect block */ if(H5HF_man_iblock_create(hdr, dxpl_id, NULL, 0, nrows, hdr->man_dtable.max_root_rows, &iblock_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap indirect block") -#ifdef QAK -HDfprintf(stderr, "%s: iblock_addr = %a\n", FUNC, iblock_addr); -#endif /* QAK */ /* Move current direct block (used as root) into new indirect block */ @@ -423,9 +396,6 @@ HDfprintf(stderr, "%s: iblock_addr = %a\n", FUNC, iblock_addr); /* Check if there's already a direct block as root) */ have_direct_block = H5F_addr_defined(hdr->man_dtable.table_addr); -#ifdef QAK -HDfprintf(stderr, "%s: have_direct_block = %u\n", FUNC, (unsigned)have_direct_block); -#endif /* QAK */ if(have_direct_block) { H5HF_direct_t *dblock; /* Pointer to direct block to query */ @@ -527,14 +497,10 @@ H5HF_man_iblock_root_double(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t min_dblock_si unsigned new_nrows; /* New # of rows */ hbool_t skip_direct_rows = FALSE; /* Whether we are skipping direct rows */ size_t u; /* Local index variable */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_root_double) -#ifdef QAK -HDfprintf(stderr, "%s: Extending root indirect block, min_dblock_size = %Zu\n", FUNC, min_dblock_size); -#endif /* QAK */ - /* Get "new block" iterator information */ if(H5HF_man_iter_curr(&hdr->next_block, &next_row, NULL, &next_entry, &iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve current block iterator location") @@ -542,19 +508,10 @@ HDfprintf(stderr, "%s: Extending root indirect block, min_dblock_size = %Zu\n", /* Make certain the iterator is at the root indirect block */ HDassert(iblock->parent == NULL); -#ifdef QAK -HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off); -#endif /* QAK */ HDassert(iblock->block_off == 0); /* Keep this for later */ old_nrows = iblock->nrows; -#ifdef QAK -HDfprintf(stderr, "%s: old_nrows = %u\n", FUNC, old_nrows); -HDfprintf(stderr, "%s: next_entry = %u\n", FUNC, next_entry); -HDfprintf(stderr, "%s: next_row = %u\n", FUNC, next_row); -HDfprintf(stderr, "%s: next_size = %Hu\n", FUNC, next_size); -#endif /* QAK */ /* Check for skipping over direct block rows */ if(iblock->nrows < hdr->man_dtable.max_direct_rows && min_dblock_size > next_size) { @@ -573,11 +530,6 @@ HDfprintf(stderr, "%s: next_size = %Hu\n", FUNC, next_size); /* Compute new # of rows in indirect block */ new_nrows = MAX(min_nrows, MIN(2 * iblock->nrows, iblock->max_rows)); -#ifdef QAK -HDfprintf(stderr, "%s: min_nrows = %u, new_nrows = %u\n", FUNC, min_nrows, new_nrows); -HDfprintf(stderr, "%s: iblock->nrows = %u, iblock->max_rows = %u\n", FUNC, iblock->nrows, iblock->max_rows); -HDfprintf(stderr, "%s: new_next_entry = %u\n", FUNC, new_next_entry); -#endif /* QAK */ /* Check if the indirect block is NOT currently allocated in temp. file space */ /* (temp. file space does not need to be freed) */ @@ -609,9 +561,6 @@ HDfprintf(stderr, "%s: new_next_entry = %u\n", FUNC, new_next_entry); if(HADDR_UNDEF == (new_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, (hsize_t)iblock->size))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block") } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: Check 1.0 - iblock->addr = %a, new_addr = %a\n", FUNC, iblock->addr, new_addr); -#endif /* QAK */ /* Move object in cache, if it actually was relocated */ if(H5F_addr_ne(iblock->addr, new_addr)) { @@ -691,11 +640,6 @@ HDfprintf(stderr, "%s: Check 1.0 - iblock->addr = %a, new_addr = %a\n", FUNC, ib hdr->man_dtable.table_addr = new_addr; /* Extend heap to cover new root indirect block */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_dtable.row_block_off[new_nrows - 1] = %Hu\n", FUNC, hdr->man_dtable.row_block_off[new_nrows - 1]); -HDfprintf(stderr, "%s: hdr->man_dtable.row_block_off[new_nrows] = %Hu\n", FUNC, hdr->man_dtable.row_block_off[new_nrows]); -HDfprintf(stderr, "%s: acc_dblock_free = %Hu\n", FUNC, acc_dblock_free); -#endif /* QAK */ if(H5HF_hdr_adjust_heap(hdr, 2 * hdr->man_dtable.row_block_off[new_nrows - 1], (hssize_t)acc_dblock_free) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, FAIL, "can't increase space to cover root direct block") @@ -736,19 +680,11 @@ H5HF_man_iblock_root_halve(H5HF_indirect_t *iblock, hid_t dxpl_id) HDassert(iblock->parent == NULL); HDassert(hdr); -#ifdef QAK -HDfprintf(stderr, "%s: Reducing root indirect block\n", FUNC); -#endif /* QAK */ - /* Compute maximum row used by child of indirect block */ max_child_row = iblock->max_child / hdr->man_dtable.cparam.width; /* Compute new # of rows in root indirect block */ new_nrows = 1 << (1 + H5V_log2_gen((uint64_t)max_child_row)); -#ifdef QAK -HDfprintf(stderr, "%s: new_nrows = %u\n", FUNC, new_nrows); -HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows); -#endif /* QAK */ /* Check if the indirect block is NOT currently allocated in temp. file space */ /* (temp. file space does not need to be freed) */ @@ -786,9 +722,6 @@ HDfprintf(stderr, "%s: iblock->nrows = %u\n", FUNC, iblock->nrows); if(HADDR_UNDEF == (new_addr = H5MF_alloc(hdr->f, H5FD_MEM_FHEAP_IBLOCK, dxpl_id, (hsize_t)iblock->size))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "file allocation failed for fractal heap indirect block") } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: new_addr = %a\n", FUNC, new_addr); -#endif /* QAK */ /* Move object in cache, if it actually was relocated */ if(H5F_addr_ne(iblock->addr, new_addr)) { @@ -834,11 +767,6 @@ HDfprintf(stderr, "%s: new_addr = %a\n", FUNC, new_addr); hdr->man_dtable.table_addr = new_addr; /* Shrink heap to only cover new root indirect block */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_dtable.row_block_off[new_nrows - 1] = %Hu\n", FUNC, hdr->man_dtable.row_block_off[new_nrows - 1]); -HDfprintf(stderr, "%s: hdr->man_dtable.row_block_off[new_nrows] = %Hu\n", FUNC, hdr->man_dtable.row_block_off[new_nrows]); -HDfprintf(stderr, "%s: acc_dblock_free = %Hu\n", FUNC, acc_dblock_free); -#endif /* QAK */ if(H5HF_hdr_adjust_heap(hdr, 2 * hdr->man_dtable.row_block_off[new_nrows - 1], -(hssize_t)acc_dblock_free) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce space to cover root direct block") @@ -879,10 +807,6 @@ H5HF_man_iblock_root_revert(H5HF_indirect_t *root_iblock, hid_t dxpl_id) */ HDassert(root_iblock); -#ifdef QAK -HDfprintf(stderr, "%s: Reverting root indirect block\n", FUNC); -#endif /* QAK */ - /* Set up local convenience variables */ hdr = root_iblock->hdr; dblock_addr = root_iblock->ents[0].addr; @@ -972,13 +896,6 @@ H5HF_man_iblock_alloc_row(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t ** if(NULL == (iblock = H5HF_sect_row_get_iblock(old_sec_node))) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve indirect block for row section") -#ifdef QAK -HDfprintf(stderr, "%s: iblock->addr = %a\n", FUNC, iblock->addr); -HDfprintf(stderr, "%s: iblock->block_off = %Hu\n", FUNC, iblock->block_off); -HDfprintf(stderr, "%s: iblock->parent = %p\n", FUNC, iblock->parent); -HDfprintf(stderr, "%s: iblock->rc = %Zu\n", FUNC, iblock->rc); -#endif /* QAK */ - /* Hold indirect block in memory, until direct block can point to it */ if(H5HF_iblock_incr(iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared indirect block") @@ -989,9 +906,6 @@ HDfprintf(stderr, "%s: iblock->rc = %Zu\n", FUNC, iblock->rc); HGOTO_ERROR(H5E_HEAP, H5E_CANTSHRINK, FAIL, "can't reduce row section node") /* Create direct block & single section */ -#ifdef QAK -HDfprintf(stderr, "%s: Allocating direct block, dblock_entry = %u\n", FUNC, dblock_entry); -#endif /* QAK */ if(H5HF_man_dblock_create(dxpl_id, hdr, iblock, dblock_entry, NULL, sec_node) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't allocate fractal heap direct block") @@ -1049,9 +963,6 @@ H5HF_man_iblock_create(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_indirect_t *par_iblo if(H5HF_hdr_incr(hdr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINC, FAIL, "can't increment reference count on shared heap header") -#ifdef QAK -HDfprintf(stderr, "%s: nrows = %u, max_rows = %u\n", FUNC, nrows, max_rows); -#endif /* QAK */ /* Set info for direct block */ iblock->rc = 0; iblock->nrows = nrows; @@ -1074,9 +985,6 @@ HDfprintf(stderr, "%s: nrows = %u, max_rows = %u\n", FUNC, nrows, max_rows); /* Compute the number of direct rows for this indirect block */ dir_rows = MIN(iblock->nrows, hdr->man_dtable.max_direct_rows); -#ifdef QAK -HDfprintf(stderr, "%s: dir_rows = %u\n", FUNC, dir_rows); -#endif /* QAK */ /* Allocate & initialize indirect block filtered entry array */ if(NULL == (iblock->filt_ents = H5FL_SEQ_CALLOC(H5HF_indirect_filt_ent_t, (size_t)(dir_rows * hdr->man_dtable.cparam.width)))) @@ -1168,9 +1076,6 @@ H5HF_man_iblock_protect(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t iblock_addr, H5HF_indirect_t *ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_protect) -#ifdef QAK -HDfprintf(stderr, "%s: iblock_addr = %a, iblock_nrows = %u\n", FUNC, iblock_addr, iblock_nrows); -#endif /* QAK */ /* * Check arguments. @@ -1296,10 +1201,6 @@ H5HF_man_iblock_attach(H5HF_indirect_t *iblock, unsigned entry, haddr_t child_ad herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_attach) -#ifdef QAK -HDfprintf(stderr, "%s: iblock = %p, entry = %u, child_addr = %a\n", FUNC, iblock, entry, child_addr); -HDfprintf(stderr, "%s: iblock->block_off = %Hu, iblock->nchildren = %u\n", FUNC, iblock->block_off, iblock->nchildren); -#endif /* QAK */ /* * Check arguments. @@ -1365,10 +1266,6 @@ H5HF_man_iblock_detach(H5HF_indirect_t *iblock, hid_t dxpl_id, unsigned entry) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_detach) -#ifdef QAK -HDfprintf(stderr, "%s: iblock = %p, entry = %u\n", FUNC, iblock, entry); -HDfprintf(stderr, "%s: iblock->block_off = %Hu, iblock->nchildren = %u\n", FUNC, iblock->block_off, iblock->nchildren); -#endif /* QAK */ /* * Check arguments. @@ -1449,10 +1346,6 @@ HDfprintf(stderr, "%s: iblock->block_off = %Hu, iblock->nchildren = %u\n", FUNC, HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block") done: -#ifdef QAK -HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); -HDfprintf(stderr, "%s: iblock->block_off = %Hu, iblock->nchildren = %u\n", FUNC, iblock->block_off, iblock->nchildren); -#endif /* QAK */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_man_iblock_detach() */ @@ -1517,9 +1410,6 @@ H5HF_man_iblock_delete(H5HF_hdr_t *hdr, hid_t dxpl_id, haddr_t iblock_addr, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iblock_delete) -#ifdef QAK -HDfprintf(stderr, "%s: iblock_addr = %a, iblock_nrows = %u\n", FUNC, iblock_addr, iblock_nrows); -#endif /* QAK */ /* * Check arguments. diff --git a/src/H5HFiter.c b/src/H5HFiter.c index e0f7142..a3c61d7 100644 --- a/src/H5HFiter.c +++ b/src/H5HFiter.c @@ -139,9 +139,6 @@ H5HF_man_iter_start_offset(H5HF_hdr_t *hdr, hid_t dxpl_id, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_iter_start_offset) -#ifdef QAK -HDfprintf(stderr, "%s: offset = %Hu\n", FUNC, offset); -#endif /* QAK */ /* * Check arguments. @@ -185,19 +182,11 @@ HDfprintf(stderr, "%s: offset = %Hu\n", FUNC, offset); /* Compute column */ H5_CHECK_OVERFLOW((curr_offset / hdr->man_dtable.row_block_size[row]), hsize_t, unsigned); col = (unsigned)(curr_offset / hdr->man_dtable.row_block_size[row]); -#ifdef QAK -HDfprintf(stderr, "%s: row = %u, col = %u\n", FUNC, row, col); -HDfprintf(stderr, "%s: offset = %Hu\n", FUNC, offset); -HDfprintf(stderr, "%s: curr_offset = %Hu\n", FUNC, curr_offset); -#endif /* QAK */ /* Set the current level's context */ biter->curr->row = row; biter->curr->col = col; biter->curr->entry = (row * hdr->man_dtable.cparam.width) + col; -#ifdef QAK -HDfprintf(stderr, "%s: biter->curr->entry = %u\n", FUNC, biter->curr->entry); -#endif /* QAK */ /* Get the context indirect block's information */ if(root_block) { @@ -457,11 +446,6 @@ H5HF_man_iter_next(H5HF_hdr_t *hdr, H5HF_block_iter_t *biter, unsigned nentries) biter->curr->row = biter->curr->entry / hdr->man_dtable.cparam.width; biter->curr->col = biter->curr->entry % hdr->man_dtable.cparam.width; /* HDassert(biter->curr->row <= biter->curr->context->nrows); */ -#ifdef QAK -HDfprintf(stderr, "%s: biter->curr->entry = %u\n", "H5HF_man_iter_next", biter->curr->entry); -HDfprintf(stderr, "%s: biter->curr->row = %u\n", "H5HF_man_iter_next", biter->curr->row); -HDfprintf(stderr, "%s: biter->curr->col = %u\n", "H5HF_man_iter_next", biter->curr->col); -#endif /* QAK */ FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HF_man_iter_next() */ diff --git a/src/H5HFman.c b/src/H5HFman.c index 3fb0cfb..47478e6 100644 --- a/src/H5HFman.c +++ b/src/H5HFman.c @@ -117,9 +117,6 @@ H5HF_man_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size, const void *obj herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_man_insert) -#ifdef QAK -HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); -#endif /* QAK */ /* * Check arguments. @@ -135,9 +132,6 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); /* Look for free space */ if((node_found = H5HF_space_find(hdr, dxpl_id, (hsize_t)obj_size, &sec_node)) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "can't locate free space in fractal heap") -#ifdef QAK -HDfprintf(stderr, "%s: After H5HF_space_find(), node_found = %t\n", FUNC, node_found); -#endif /* QAK */ /* If we didn't find a node, go create a direct block big enough to hold the requested block */ if(!node_found) @@ -148,15 +142,6 @@ HDfprintf(stderr, "%s: After H5HF_space_find(), node_found = %t\n", FUNC, node_f /* Check for row section */ if(sec_node->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW || sec_node->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW) { -#ifdef QAK -HDfprintf(stderr, "%s: sec_node->sect_info.addr = %a\n", FUNC, sec_node->sect_info.addr); -HDfprintf(stderr, "%s: sec_node->sect_info.size = %Hu\n", FUNC, sec_node->sect_info.size); -HDfprintf(stderr, "%s: sec_node->sect_info.type = %s\n", FUNC, (sec_node->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW ? "H5HF_FSPACE_SECT_FIRST_ROW" : "H5HF_FSPACE_SECT_NORMAL_ROW")); -HDfprintf(stderr, "%s: sec_node->u.row.under = %p\n", FUNC, sec_node->u.row.under); -HDfprintf(stderr, "%s: sec_node->u.row.row = %u\n", FUNC, sec_node->u.row.row); -HDfprintf(stderr, "%s: sec_node->u.row.col = %u\n", FUNC, sec_node->u.row.col); -HDfprintf(stderr, "%s: sec_node->u.row.num_entries = %u\n", FUNC, sec_node->u.row.num_entries); -#endif /* QAK */ /* Allocate 'single' selection out of 'row' selection */ if(H5HF_man_iblock_alloc_row(hdr, dxpl_id, &sec_node) < 0) @@ -174,14 +159,6 @@ HDfprintf(stderr, "%s: sec_node->u.row.num_entries = %u\n", FUNC, sec_node->u.ro /* Retrieve direct block address from section */ if(H5HF_sect_single_dblock_info(hdr, dxpl_id, sec_node, &dblock_addr, &dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve direct block information") -#ifdef QAK -HDfprintf(stderr, "%s: sec_node->sect_info.addr = %a\n", FUNC, sec_node->sect_info.addr); -HDfprintf(stderr, "%s: sec_node->sect_info.size = %Hu\n", FUNC, sec_node->sect_info.size); -HDfprintf(stderr, "%s: sec_node->u.single.parent = %p\n", FUNC, sec_node->u.single.parent); -if(sec_node->u.single.parent) - HDfprintf(stderr, "%s: sec_node->u.single.parent->addr = %a\n", FUNC, sec_node->u.single.parent->addr); -HDfprintf(stderr, "%s: sec_node->u.single.par_entry = %u\n", FUNC, sec_node->u.single.par_entry); -#endif /* QAK */ /* Lock direct block */ if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, dblock_addr, dblock_size, sec_node->u.single.parent, sec_node->u.single.par_entry, H5AC_WRITE))) @@ -192,16 +169,8 @@ HDfprintf(stderr, "%s: sec_node->u.single.par_entry = %u\n", FUNC, sec_node->u.s /* Get the offset of the object within the block */ H5_CHECK_OVERFLOW((sec_node->sect_info.addr - dblock->block_off), hsize_t, size_t); blk_off = (size_t)(sec_node->sect_info.addr - dblock->block_off); -#ifdef QAK -HDfprintf(stderr, "%s: blk_off = %Zu\n", FUNC, blk_off); -HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); -#endif /* QAK */ /* Sanity checks */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->total_man_free = %Hu\n", FUNC, hdr->total_man_free); -HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); -#endif /* QAK */ HDassert(sec_node->sect_info.size >= obj_size); /* Reduce (& possibly re-add) single section */ @@ -224,13 +193,7 @@ HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); } /* end block */ /* Set the heap ID for the new object (heap offset & obj length) */ -#ifdef QAK -HDfprintf(stderr, "%s: dblock->block_off = %Hu\n", FUNC, dblock->block_off); -#endif /* QAK */ H5HF_MAN_ID_ENCODE(id, hdr, (dblock->block_off + blk_off), obj_size); -#ifdef QAK -HDfprintf(stderr, "%s: obj_off = %Hu, obj_len = %Zu\n", FUNC, (dblock->block_off + blk_off), obj_size); -#endif /* QAK */ /* Update statistics about heap */ hdr->man_nobjs++; @@ -303,16 +266,8 @@ H5HF_man_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id, id++; /* Decode the object offset within the heap & its length */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->heap_off_size = %u, hdr->heap_len_size = %u\n", FUNC, (unsigned)hdr->heap_off_size, (unsigned)hdr->heap_len_size); -#endif /* QAK */ UINT64DECODE_VAR(id, obj_off, hdr->heap_off_size); UINT64DECODE_VAR(id, obj_len, hdr->heap_len_size); -#ifdef QAK -HDfprintf(stderr, "%s: obj_off = %Hu, obj_len = %Zu\n", FUNC, obj_off, obj_len); -HDfprintf(stderr, "%s: hdr->man_size = %Hu, hdr->max_man_size = %u\n", FUNC, hdr->man_size, (unsigned)hdr->max_man_size); -HDfprintf(stderr, "%s: hdr->man_dtable.cparam.max_direct_size = %Zu\n", FUNC, hdr->man_dtable.cparam.max_direct_size); -#endif /* QAK */ HDassert(obj_off > 0); HDassert(obj_len > 0); @@ -342,9 +297,6 @@ HDfprintf(stderr, "%s: hdr->man_dtable.cparam.max_direct_size = %Zu\n", FUNC, hd /* Look up indirect block containing direct block */ if(H5HF_man_dblock_locate(hdr, dxpl_id, obj_off, &iblock, &entry, &did_protect, H5AC_READ) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section") -#ifdef QAK -HDfprintf(stderr, "%s: entry address = %a\n", FUNC, iblock->ents[entry].addr); -#endif /* QAK */ /* Set direct block info */ dblock_addr = iblock->ents[entry].addr; @@ -374,9 +326,6 @@ HDfprintf(stderr, "%s: entry address = %a\n", FUNC, iblock->ents[entry].addr); HGOTO_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release fractal heap indirect block") iblock = NULL; } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: dblock_addr = %a, dblock_size = %Zu\n", FUNC, dblock_addr, dblock_size); -#endif /* QAK */ /* Compute offset of object within block */ HDassert((obj_off - dblock->block_off) < (hsize_t)dblock_size); @@ -559,16 +508,8 @@ H5HF_man_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id) id++; /* Decode the object offset within the heap & it's length */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->heap_off_size = %u, hdr->heap_len_size = %u\n", FUNC, (unsigned)hdr->heap_off_size, (unsigned)hdr->heap_len_size); -#endif /* QAK */ UINT64DECODE_VAR(id, obj_off, hdr->heap_off_size); UINT64DECODE_VAR(id, obj_len, hdr->heap_len_size); -#ifdef QAK -HDfprintf(stderr, "%s: obj_off = %Hu, obj_len = %Zu\n", FUNC, obj_off, obj_len); -HDfprintf(stderr, "%s: hdr->man_size = %Hu, hdr->max_man_size = %u\n", FUNC, hdr->man_size, (unsigned)hdr->max_man_size); -HDfprintf(stderr, "%s: hdr->man_dtable.cparam.max_direct_size = %Zu\n", FUNC, hdr->man_dtable.cparam.max_direct_size); -#endif /* QAK */ HDassert(obj_off > 0); HDassert(obj_len > 0); @@ -582,24 +523,15 @@ HDfprintf(stderr, "%s: hdr->man_dtable.cparam.max_direct_size = %Zu\n", FUNC, hd /* Check for root direct block */ if(hdr->man_dtable.curr_root_rows == 0) { -#ifdef QAK -HDfprintf(stderr, "%s: direct root block\n", FUNC); -#endif /* QAK */ /* Set direct block info */ dblock_size = hdr->man_dtable.cparam.start_block_size; dblock_block_off = 0; dblock_entry = 0; } /* end if */ else { -#ifdef QAK -HDfprintf(stderr, "%s: indirect root block\n", FUNC); -#endif /* QAK */ /* Look up indirect block containing direct block */ if(H5HF_man_dblock_locate(hdr, dxpl_id, obj_off, &iblock, &dblock_entry, &did_protect, H5AC_WRITE) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section") -#ifdef QAK -HDfprintf(stderr, "%s: entry address = %a\n", FUNC, iblock->ents[dblock_entry].addr); -#endif /* QAK */ /* Check for offset of invalid direct block */ if(!H5F_addr_defined(iblock->ents[dblock_entry].addr)) @@ -615,16 +547,10 @@ HDfprintf(stderr, "%s: entry address = %a\n", FUNC, iblock->ents[dblock_entry].a dblock_block_off += hdr->man_dtable.row_block_off[dblock_entry / hdr->man_dtable.cparam.width]; dblock_block_off += hdr->man_dtable.row_block_size[dblock_entry / hdr->man_dtable.cparam.width] * (dblock_entry % hdr->man_dtable.cparam.width); } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: dblock_size = %Zu\n", FUNC, dblock_size); -#endif /* QAK */ /* Compute offset of object within block */ HDassert((obj_off - dblock_block_off) < (hsize_t)dblock_size); blk_off = (size_t)(obj_off - dblock_block_off); -#ifdef QAK -HDfprintf(stderr, "%s: blk_off = %Zu\n", FUNC, blk_off); -#endif /* QAK */ /* Check for object's offset in the direct block prefix information */ if(blk_off < H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr)) @@ -637,14 +563,6 @@ HDfprintf(stderr, "%s: blk_off = %Zu\n", FUNC, blk_off); /* Create free space section node */ if(NULL == (sec_node = H5HF_sect_single_new(obj_off, obj_len, iblock, dblock_entry))) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't create section for direct block's free space") -#ifdef QAK -HDfprintf(stderr, "%s: sec_node->sect_info.addr = %a\n", FUNC, sec_node->sect_info.addr); -HDfprintf(stderr, "%s: sec_node->sect_info.size = %Hu\n", FUNC, sec_node->sect_info.size); -HDfprintf(stderr, "%s: sec_node->u.single.parent = %p\n", FUNC, sec_node->u.single.parent); -if(sec_node->u.single.parent) - HDfprintf(stderr, "%s: sec_node->u.single.parent->addr = %a\n", FUNC, sec_node->u.single.parent->addr); -HDfprintf(stderr, "%s: sec_node->u.single.par_entry = %u\n", FUNC, sec_node->u.single.par_entry); -#endif /* QAK */ /* Unlock indirect block */ if(iblock) { diff --git a/src/H5HFsection.c b/src/H5HFsection.c index 91031be..152f15a 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -814,10 +814,6 @@ H5HF_sect_single_full_dblock(H5HF_hdr_t *hdr, hid_t dxpl_id, HDassert(sect->sect_info.state == H5FS_SECT_LIVE); HDassert(hdr); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ - /* Retrieve direct block address from section */ if(H5HF_sect_single_dblock_info(hdr, dxpl_id, sect, &dblock_addr, &dblock_size) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve direct block information") @@ -825,18 +821,10 @@ HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_ /* Check for section occupying entire direct block */ /* (and not the root direct block) */ dblock_overhead = H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr); -#ifdef QAK -HDfprintf(stderr, "%s: dblock_size = %u\n", FUNC, dblock_size); -HDfprintf(stderr, "%s: dblock_overhead = %Zu\n", FUNC, dblock_overhead); -HDfprintf(stderr, "%s: hdr->man_dtable.curr_root_rows = %u\n", FUNC, hdr->man_dtable.curr_root_rows); -#endif /* QAK */ if((dblock_size - dblock_overhead) == sect->sect_info.size && hdr->man_dtable.curr_root_rows > 0) { H5HF_direct_t *dblock; /* Pointer to direct block for section */ -#ifdef QAK -HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr); -#endif /* QAK */ if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, dblock_addr, dblock_size, sect->u.single.parent, sect->u.single.par_entry, H5AC_WRITE))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load fractal heap direct block") HDassert(H5F_addr_eq(dblock->block_off + dblock_overhead, sect->sect_info.addr)); @@ -845,11 +833,6 @@ HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr); if(H5HF_sect_row_from_single(hdr, sect, dblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCONVERT, FAIL, "can't convert single section into row section") -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect->u.row = {%p, %u, %u, %u, %t}\n", FUNC, sect->u.row.under, sect->u.row.row, sect->u.row.col, sect->u.row.num_entries, sect->u.row.checked_out); -#endif /* QAK */ - /* Destroy direct block */ if(H5HF_man_dblock_destroy(hdr, dxpl_id, dblock, dblock_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't release direct block") @@ -895,10 +878,6 @@ H5HF_sect_single_add(H5FS_section_info_t *_sect, unsigned *flags, void *_udata) HDassert(sect); HDassert(hdr); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_single_add", sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ - /* Check if single section covers entire direct block it's in */ /* (converts to row section possibly) */ if(H5HF_sect_single_full_dblock(hdr, dxpl_id, sect) < 0) @@ -988,11 +967,6 @@ H5HF_sect_single_can_merge(const H5FS_section_info_t *_sect1, HDassert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */ HDassert(H5F_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr)); -#ifdef QAK -HDfprintf(stderr, "%s: sect1->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_single_can_merge", sect1->sect_info.addr, sect1->sect_info.size, sect1->sect_info.type, (sect1->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect2->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_single_can_merge", sect2->sect_info.addr, sect2->sect_info.size, sect2->sect_info.type, (sect2->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ - /* Check if second section adjoins first section */ /* (This can only occur within a direct block, due to the direct block * overhead at the beginning of a block, so no need to check if sections @@ -1042,11 +1016,6 @@ H5HF_sect_single_merge(H5FS_section_info_t *_sect1, H5FS_section_info_t *_sect2, HDassert(sect2->sect_info.type == H5HF_FSPACE_SECT_SINGLE); HDassert(H5F_addr_eq(sect1->sect_info.addr + sect1->sect_info.size, sect2->sect_info.addr)); -#ifdef QAK -HDfprintf(stderr, "%s: sect1->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect1->sect_info.addr, sect1->sect_info.size, sect1->sect_info.type, (sect1->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect2->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect2->sect_info.addr, sect2->sect_info.size, sect2->sect_info.type, (sect2->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ - /* Add second section's size to first section */ sect1->sect_info.size += sect2->sect_info.size; @@ -1100,11 +1069,6 @@ H5HF_sect_single_can_shrink(const H5FS_section_info_t *_sect, void *_udata) /* Check arguments. */ HDassert(sect); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_single_can_shrink", sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: hdr->man_dtable.curr_root_rows = %u\n", "H5HF_sect_single_can_shrink", hdr->man_dtable.curr_root_rows); -#endif /* QAK */ - /* Check for section occupying entire root direct block */ /* (We shouldn't ever have a single section that occupies an entire * direct block, unless it's in the root direct block (because it @@ -1117,10 +1081,6 @@ HDfprintf(stderr, "%s: hdr->man_dtable.curr_root_rows = %u\n", "H5HF_sect_single dblock_size = hdr->man_dtable.cparam.start_block_size; dblock_overhead = H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr); -#ifdef QAK -HDfprintf(stderr, "%s: dblock_size = %Zu\n", "H5HF_sect_single_can_shrink", dblock_size); -HDfprintf(stderr, "%s: dblock_overhead = %Zu\n", "H5HF_sect_single_can_shrink", dblock_overhead); -#endif /* QAK */ if((dblock_size - dblock_overhead) == sect->sect_info.size) HGOTO_DONE(TRUE) } /* end if */ @@ -1170,10 +1130,6 @@ H5HF_sect_single_shrink(H5FS_section_info_t **_sect, void UNUSED *_udata) HDassert(*sect); HDassert((*sect)->sect_info.type == H5HF_FSPACE_SECT_SINGLE); -#ifdef QAK -HDfprintf(stderr, "%s: (*sect).sect_info = {%a, %Hu, %u}\n", FUNC, (*sect)->sect_info.addr, (*sect)->sect_info.size, (*sect)->sect_info.type); -#endif /* QAK */ - /* Check to see if we should revive section */ if((*sect)->sect_info.state != H5FS_SECT_LIVE) if(H5HF_sect_single_revive(hdr, dxpl_id, (*sect)) < 0) @@ -1186,9 +1142,6 @@ HDfprintf(stderr, "%s: (*sect).sect_info = {%a, %Hu, %u}\n", FUNC, (*sect)->sect /* Protect the direct block for the section */ /* (should be a root direct block) */ HDassert(dblock_addr == hdr->man_dtable.table_addr); -#ifdef QAK -HDfprintf(stderr, "%s: dblock_addr = %a\n", FUNC, dblock_addr); -#endif /* QAK */ if(NULL == (dblock = H5HF_man_dblock_protect(hdr, dxpl_id, dblock_addr, dblock_size, (*sect)->u.single.parent, (*sect)->u.single.par_entry, H5AC_WRITE))) HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load fractal heap direct block") @@ -1276,9 +1229,6 @@ H5HF_sect_single_valid(const H5FS_section_class_t UNUSED *cls, const H5FS_sectio /* Check arguments. */ HDassert(sect); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_single_valid", sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ if(sect->sect_info.state == H5FS_SECT_LIVE) { /* Check if this section is not in a direct block that is the root direct block */ /* (not enough information to check on a single section in a root direct block) */ @@ -1290,9 +1240,6 @@ HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_single unsigned dblock_status = 0; /* Direct block's status in the metadata cache */ herr_t status; /* Generic status value */ -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.single = {%p, %u, %a, %Zu}\n", "H5HF_sect_single_valid", sect->u.single.parent, sect->u.single.par_entry); -#endif /* QAK */ /* Sanity check settings for section's direct block's parent */ iblock = sect->u.single.parent; HDassert(H5F_addr_defined(iblock->ents[sect->u.single.par_entry].addr)); @@ -1419,11 +1366,6 @@ H5HF_sect_row_from_single(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, HDassert(hdr); HDassert(sect); HDassert(dblock); -#ifdef QAK -HDfprintf(stderr, "%s: sect.sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: dblock->parent = %p\n", FUNC, dblock->parent); -HDfprintf(stderr, "%s: hdr->man_dtable.curr_root_rows = %u\n", FUNC, hdr->man_dtable.curr_root_rows); -#endif /* QAK */ /* Convert 'single' section information to 'row' section info */ sect->sect_info.addr = dblock->block_off; @@ -1517,10 +1459,6 @@ H5HF_sect_row_reduce(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *sect, sect->sect_info.type == H5HF_FSPACE_SECT_NORMAL_ROW); HDassert(sect->sect_info.state == H5FS_SECT_LIVE); HDassert(entry_p); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect->u.row = {%p, %u, %u, %u, %t}\n", FUNC, sect->u.row.under, sect->u.row.row, sect->u.row.col, sect->u.row.num_entries, sect->u.row.checked_out); -#endif /* QAK */ /* Mark the row as checked out from the free space manager */ HDassert(sect->u.row.checked_out == FALSE); @@ -1538,9 +1476,6 @@ HDfprintf(stderr, "%s: sect->u.row = {%p, %u, %u, %u, %t}\n", FUNC, sect->u.row. /* Check for eliminating the section */ if(sect->u.row.num_entries == 1) { -#ifdef QAK -HDfprintf(stderr, "%s: Freeing row section\n", FUNC); -#endif /* QAK */ /* Free row section */ if(H5HF_sect_row_free((H5FS_section_info_t *)sect) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free row section node") @@ -1844,16 +1779,6 @@ H5HF_sect_row_can_merge(const H5FS_section_info_t *_sect1, HDassert(sect1->sect_info.type == sect2->sect_info.type); /* Checks "MERGE_SYM" flag */ HDassert(H5F_addr_lt(sect1->sect_info.addr, sect2->sect_info.addr)); -#ifdef QAK -HDfprintf(stderr, "%s: sect1->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_row_can_merge", sect1->sect_info.addr, sect1->sect_info.size, sect1->sect_info.type, (sect1->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect2->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_row_can_merge", sect2->sect_info.addr, sect2->sect_info.size, sect2->sect_info.type, (sect2->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ - -#ifdef QAK -HDfprintf(stderr, "%s: sect1->u.row = {%p, %u, %u, %u, %t}\n", "H5HF_sect_row_can_merge", sect1->u.row.under, sect1->u.row.row, sect1->u.row.col, sect1->u.row.num_entries, sect1->u.row.checked_out); -HDfprintf(stderr, "%s: sect2->u.row = {%p, %u, %u, %u, %t}\n", "H5HF_sect_row_can_merge", sect2->u.row.under, sect2->u.row.row, sect2->u.row.col, sect2->u.row.num_entries, sect2->u.row.checked_out); -#endif /* QAK */ - /* Get the top indirect section underlying each row */ top_indir_sect1 = H5HF_sect_indirect_top(sect1->u.row.under); HDassert(top_indir_sect1); @@ -1866,11 +1791,6 @@ HDfprintf(stderr, "%s: sect2->u.row = {%p, %u, %u, %u, %t}\n", "H5HF_sect_row_ca */ if(top_indir_sect1 != top_indir_sect2) { if(H5HF_sect_indirect_iblock_off(top_indir_sect1) == H5HF_sect_indirect_iblock_off(top_indir_sect2)) { -#ifdef QAK -HDfprintf(stderr, "%s: top_indir_sect1->sect_info.addr = %a\n", "H5HF_sect_row_can_merge", top_indir_sect1->sect_info.addr); -HDfprintf(stderr, "%s: top_indir_sect1->u.indirect.span_size = %Hu\n", "H5HF_sect_row_can_merge", top_indir_sect1->u.indirect.span_size); -HDfprintf(stderr, "%s: top_indir_sect2->sect_info.addr = %a\n", "H5HF_sect_row_can_merge", top_indir_sect2->sect_info.addr); -#endif /* QAK */ /* Check if second section adjoins first section */ if(H5F_addr_eq((top_indir_sect1->sect_info.addr + top_indir_sect1->u.indirect.span_size), top_indir_sect2->sect_info.addr)) HGOTO_DONE(TRUE) @@ -1878,9 +1798,6 @@ HDfprintf(stderr, "%s: top_indir_sect2->sect_info.addr = %a\n", "H5HF_sect_row_c } /* end if */ done: -#ifdef QAK -HDfprintf(stderr, "%s: ret_value = %t\n", "H5HF_sect_row_can_merge", ret_value); -#endif /* QAK */ FUNC_LEAVE_NOAPI(ret_value) } /* H5HF_sect_row_can_merge() */ @@ -1920,15 +1837,7 @@ H5HF_sect_row_merge(H5FS_section_info_t *_sect1, H5FS_section_info_t *_sect2, HDassert(sect2); HDassert(sect2->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); -#ifdef QAK -HDfprintf(stderr, "%s: sect1->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect1->sect_info.addr, sect1->sect_info.size, sect1->sect_info.type, (sect1->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect2->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect2->sect_info.addr, sect2->sect_info.size, sect2->sect_info.type, (sect2->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ - /* Check if second section is past end of "next block" iterator */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", "H5HF_sect_row_can_shrink", hdr->man_iter_off); -#endif /* QAK */ if(sect2->sect_info.addr >= hdr->man_iter_off) { H5HF_free_section_t *top_indir_sect; /* Top indirect section for row */ @@ -1949,10 +1858,6 @@ HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", "H5HF_sect_row_can_shrink", h if(sect2->sect_info.state != H5FS_SECT_LIVE) if(H5HF_sect_row_revive(hdr, dxpl_id, sect2) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't revive single free section") -#ifdef QAK -HDfprintf(stderr, "%s: sect1->u.row = {%p, %u, %u, %u, %t}\n", FUNC, sect1->u.row.under, sect1->u.row.row, sect1->u.row.col, sect1->u.row.num_entries, sect1->u.row.checked_out); -HDfprintf(stderr, "%s: sect2->u.row = {%p, %u, %u, %u, %t}\n", FUNC, sect2->u.row.under, sect2->u.row.row, sect2->u.row.col, sect2->u.row.num_entries, sect2->u.row.checked_out); -#endif /* QAK */ /* Merge rows' underlying indirect sections together */ if(H5HF_sect_indirect_merge_row(hdr, dxpl_id, sect1, sect2) < 0) @@ -1996,15 +1901,7 @@ H5HF_sect_row_can_shrink(const H5FS_section_info_t *_sect, void UNUSED *_udata) HDassert(sect); HDassert(sect->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_row_can_shrink", sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect->u.row = {%p, %u, %u, %u, %t}\n", "H5HF_sect_row_can_shrink", sect->u.row.under, sect->u.row.row, sect->u.row.col, sect->u.row.num_entries, sect->u.row.checked_out); -#endif /* QAK */ - /* Check if section is past end of "next block" iterator */ -#ifdef QAK -HDfprintf(stderr, "%s: hdr->man_iter_off = %Hu\n", "H5HF_sect_row_can_shrink", hdr->man_iter_off); -#endif /* QAK */ if(sect->sect_info.addr >= hdr->man_iter_off) HGOTO_DONE(TRUE) @@ -2044,11 +1941,6 @@ H5HF_sect_row_shrink(H5FS_section_info_t **_sect, void *_udata) HDassert(*sect); HDassert((*sect)->sect_info.type == H5HF_FSPACE_SECT_FIRST_ROW); -#ifdef QAK -HDfprintf(stderr, "%s: (*sect)->sect_info = {%a, %Hu, %u, %s}\n", FUNC, (*sect)->sect_info.addr, (*sect)->sect_info.size, (*sect)->sect_info.type, ((*sect)->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: (*sect)->u.row = {%p, %u, %u, %u}\n", FUNC, (*sect)->u.row.under, (*sect)->u.row.row, (*sect)->u.row.col, (*sect)->u.row.num_entries); -#endif /* QAK */ - /* Get the top indirect section underlying each row */ top_indir_sect = H5HF_sect_indirect_top((*sect)->u.row.under); @@ -2166,19 +2058,12 @@ H5HF_sect_row_valid(const H5FS_section_class_t *cls, const H5FS_section_info_t * cls_prvt = (H5HF_sect_private_t *)cls->cls_private; hdr = cls_prvt->hdr; -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_row_valid", sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect->u.row = {%p, %u, %u, %u, %t}\n", "H5HF_sect_row_valid", sect->u.row.under, sect->u.row.row, sect->u.row.col, sect->u.row.num_entries, sect->u.row.checked_out); -#endif /* QAK */ /* Sanity checking on the row */ HDassert(sect->u.row.under); HDassert(sect->u.row.num_entries); HDassert(sect->u.row.checked_out == FALSE); indir_sect = sect->u.row.under; indir_idx = sect->u.row.row - indir_sect->u.indirect.row; -#ifdef QAK -HDfprintf(stderr, "%s: indir_idx = %u\n", "H5HF_sect_row_valid", indir_idx); -#endif /* QAK */ HDassert(indir_sect->u.indirect.dir_rows[indir_idx] == sect); /* Check if the section is actually within the heap */ @@ -2277,9 +2162,6 @@ H5HF_sect_indirect_iblock_off(const H5HF_free_section_t *sect) ret_value = sect->sect_info.state == H5FS_SECT_LIVE ? sect->u.indirect.u.iblock->block_off : sect->u.indirect.u.iblock_off; -#ifdef QAK -HDfprintf(stderr, "%s: Leaving, ret_value = %Hu\n", "H5HF_sect_indirect_iblock_off", ret_value); -#endif /* QAK */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_sect_indirect_iblock_off() */ @@ -2309,17 +2191,11 @@ H5HF_sect_indirect_top(H5HF_free_section_t *sect) */ HDassert(sect); -#ifdef QAK -HDfprintf(stderr, "%s: sect1->u.indirect.parent = %p\n", "H5HF_sect_indirect_top", sect->u.indirect.parent); -#endif /* QAK */ if(sect->u.indirect.parent) ret_value = H5HF_sect_indirect_top(sect->u.indirect.parent); else ret_value = sect; -#ifdef QAK -HDfprintf(stderr, "%s: Leaving, ret_value = %p\n", "H5HF_sect_indirect_top", ret_value); -#endif /* QAK */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_sect_indirect_top() */ @@ -2504,9 +2380,6 @@ H5HF_sect_indirect_for_row(H5HF_hdr_t *hdr, H5HF_indirect_t *iblock, HDassert(iblock); HDassert(row_sect); HDassert(row_sect->u.row.row < hdr->man_dtable.max_direct_rows); -#ifdef QAK -HDfprintf(stderr, "%s: Entering\n", FUNC); -#endif /* QAK */ /* Create free space section node */ if(NULL == (sect = H5HF_sect_indirect_new(hdr, row_sect->sect_info.addr, @@ -2537,9 +2410,6 @@ done: if(H5HF_sect_indirect_free(sect) < 0) HDONE_ERROR(H5E_HEAP, H5E_CANTRELEASE, NULL, "can't free indirect section node") -#ifdef QAK -HDfprintf(stderr, "%s: Leaving\n", FUNC); -#endif /* QAK */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5HF_sect_indirect_for_row() */ @@ -2576,12 +2446,6 @@ H5HF_sect_indirect_init_rows(H5HF_hdr_t *hdr, hid_t dxpl_id, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_indirect_init_rows) -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: first_child = %t\n", FUNC, first_child); -HDfprintf(stderr, "%s: start_row = %u, start_col = %u\n", FUNC, start_row, start_col); -HDfprintf(stderr, "%s: end_row = %u, end_col = %u\n", FUNC, end_row, end_col); -#endif /* QAK */ /* * Check arguments. @@ -2671,9 +2535,6 @@ HDfprintf(stderr, "%s: end_row = %u, end_col = %u\n", FUNC, end_row, end_col); if(u < hdr->man_dtable.max_direct_rows) { H5HF_free_section_t *row_sect = NULL; /* 'Row' free space section to add */ -#ifdef QAK -HDfprintf(stderr, "%s: Creating direct row, row_col = %u, row_entries = %u\n", FUNC, row_col, row_entries); -#endif /* QAK */ /* Create 'row' free space section node */ if(NULL == (row_sect = H5HF_sect_row_create(curr_off, (hdr->man_dtable.row_block_size[u] - dblock_overhead), first_child, u, row_col, @@ -2715,11 +2576,6 @@ HDfprintf(stderr, "%s: Creating direct row, row_col = %u, row_entries = %u\n", F /* Compute info about row's indirect blocks for child section */ child_nrows = H5HF_dtable_size_to_rows(&hdr->man_dtable, hdr->man_dtable.row_block_size[u]); child_nentries = child_nrows * hdr->man_dtable.cparam.width; -#ifdef QAK -HDfprintf(stderr, "%s: child_nrows = %u\n", FUNC, child_nrows); -HDfprintf(stderr, "%s: child_nentries = %u\n", FUNC, child_nentries); -HDfprintf(stderr, "%s: row_entries = %u\n", FUNC, row_entries); -#endif /* QAK */ /* Add an indirect section for each indirect block in the row */ for(v = 0; v < row_entries; v++) { @@ -2732,9 +2588,6 @@ HDfprintf(stderr, "%s: row_entries = %u\n", FUNC, row_entries); /* Get the address of the child indirect block */ if(H5HF_man_iblock_entry_addr(sect->u.indirect.u.iblock, curr_entry, &child_iblock_addr) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to retrieve child indirect block's address") -#ifdef QAK -HDfprintf(stderr, "%s: child_iblock_addr = %a\n", FUNC, child_iblock_addr); -#endif /* QAK */ /* If the child indirect block's address is defined, protect it */ if(H5F_addr_defined(child_iblock_addr)) { @@ -2835,9 +2688,6 @@ H5HF_sect_indirect_add(H5HF_hdr_t *hdr, hid_t dxpl_id, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_indirect_add) -#ifdef QAK -HDfprintf(stderr, "%s: start_entry = %u, nentries = %u\n", FUNC, start_entry, nentries); -#endif /* QAK */ /* * Check arguments. @@ -2860,9 +2710,6 @@ HDfprintf(stderr, "%s: start_entry = %u, nentries = %u\n", FUNC, start_entry, ne for(u = 0; u < start_row; u++) sect_off += hdr->man_dtable.row_block_size[u] * hdr->man_dtable.cparam.width; sect_off += hdr->man_dtable.row_block_size[start_row] * start_col; -#ifdef QAK -HDfprintf(stderr, "%s: sect_off = %Hu\n", FUNC, sect_off); -#endif /* QAK */ /* Create free space section node */ if(NULL == (sect = H5HF_sect_indirect_new(hdr, sect_off, (hsize_t)0, iblock, @@ -2915,9 +2762,6 @@ H5HF_sect_indirect_decr(H5HF_free_section_t *sect) */ HDassert(sect); HDassert(sect->u.indirect.rc); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.rc = %u\n", FUNC, sect->u.indirect.rc); -#endif /* QAK */ /* Decrement ref. count for indirect section */ sect->u.indirect.rc--; @@ -2975,10 +2819,6 @@ H5HF_sect_indirect_revive_row(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_ HDassert(sect->sect_info.state == H5FS_SECT_SERIALIZED); /* Look up indirect block containing indirect blocks for section */ -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info.addr = %a\n", FUNC, sect->sect_info.addr); -HDfprintf(stderr, "%s: sect->u.indirect.u.iblock_off = %Hu\n", FUNC, sect->u.indirect.u.iblock_off); -#endif /* QAK */ if(H5HF_man_dblock_locate(hdr, dxpl_id, sect->sect_info.addr, &sec_iblock, NULL, &did_protect, H5AC_READ) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTCOMPUTE, FAIL, "can't compute row & column of section") @@ -3045,10 +2885,6 @@ H5HF_sect_indirect_revive(H5HF_hdr_t *hdr, hid_t dxpl_id, HDassert(sect->sect_info.state == H5FS_SECT_SERIALIZED); HDassert(sect_iblock); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info.addr = %a\n", FUNC, sect->sect_info.addr); -HDfprintf(stderr, "%s: sect->u.indirect.u.iblock_off = %Hu\n", FUNC, sect->u.indirect.u.iblock_off); -#endif /* QAK */ /* Increment reference count on indirect block that free section is in */ if(H5HF_iblock_incr(sect_iblock) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTDEC, FAIL, "can't decrement reference count on shared indirect block") @@ -3118,11 +2954,6 @@ H5HF_sect_indirect_reduce_row(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_ /* Compute starting & ending information for row section */ row_start_entry = (row_sect->u.row.row * hdr->man_dtable.cparam.width) + row_sect->u.row.col; row_end_entry = (row_start_entry + row_sect->u.row.num_entries) - 1; -#ifdef QAK -HDfprintf(stderr, "%s: row_sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, row_sect->sect_info.addr, row_sect->sect_info.size, row_sect->sect_info.type, (row_sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: row_sect->u.row.row = %u, row_sect->u.row.col = %u, row_sect->u.row.num_entries = %u\n", FUNC, row_sect->u.row.row, row_sect->u.row.col, row_sect->u.row.num_entries); -HDfprintf(stderr, "%s: row_start_entry = %u, row_end_entry = %u\n", FUNC, row_start_entry, row_end_entry); -#endif /* QAK */ /* Compute starting & ending information for indirect section */ sect = row_sect->u.row.under; @@ -3138,31 +2969,16 @@ HDfprintf(stderr, "%s: row_start_entry = %u, row_end_entry = %u\n", FUNC, row_st HDassert(sect->u.indirect.dir_nrows > 0); HDassert(sect->u.indirect.dir_rows); HDassert(sect->u.indirect.dir_rows[(row_sect->u.row.row - start_row)] == row_sect); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect->u.indirect.parent = %p, sect->u.indirect.par_entry = %u\n", FUNC, sect->u.indirect.parent, sect->u.indirect.par_entry); -HDfprintf(stderr, "%s: start_entry = %u, start_row = %u, start_col = %u\n", FUNC, start_entry, start_row, start_col); -HDfprintf(stderr, "%s: end_entry = %u, end_row = %u\n", FUNC, end_entry, end_row); -#endif /* QAK */ /* Check if we should allocate from end of indirect section */ if(row_end_entry == end_entry && start_row != end_row) { *alloc_from_start = FALSE; row_entry = row_end_entry; -#ifdef QAK -HDfprintf(stderr, "%s: Row is at end of indirect section\n", FUNC); -#endif /* QAK */ } /* end if */ else { *alloc_from_start = TRUE; row_entry = row_start_entry; -#ifdef QAK -HDfprintf(stderr, "%s: Row is NOT at end of indirect section\n", FUNC); -#endif /* QAK */ } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: row_entry = %u\n", FUNC, row_entry); -#endif /* QAK */ /* Check if we have a parent section to be detached from */ if(sect->u.indirect.parent) { @@ -3189,9 +3005,6 @@ HDfprintf(stderr, "%s: row_entry = %u\n", FUNC, row_entry); /* Check how to adjust section for allocated entry */ if(sect->u.indirect.num_entries > 1) { if(row_entry == start_entry) { -#ifdef QAK -HDfprintf(stderr, "%s: Entry is at start of indirect section\n", FUNC); -#endif /* QAK */ /* Adjust section start */ sect->sect_info.addr += hdr->man_dtable.row_block_size[sect->u.indirect.row]; @@ -3206,9 +3019,6 @@ HDfprintf(stderr, "%s: Entry is at start of indirect section\n", FUNC); /* Adjust direct row information */ sect->u.indirect.dir_nrows--; -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.dir_nrows = %u\n", FUNC, sect->u.indirect.dir_nrows); -#endif /* QAK */ /* Adjust direct row sections for indirect section */ if(sect->u.indirect.dir_nrows > 0) { @@ -3244,9 +3054,6 @@ HDfprintf(stderr, "%s: sect->u.indirect.dir_nrows = %u\n", FUNC, sect->u.indirec else if(row_entry == end_entry) { unsigned new_end_row; /* New end row for entries */ -#ifdef QAK -HDfprintf(stderr, "%s: Entry is at end of indirect section\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(sect->u.indirect.indir_nents == 0); HDassert(sect->u.indirect.indir_ents == NULL); @@ -3271,9 +3078,6 @@ HDfprintf(stderr, "%s: Entry is at end of indirect section\n", FUNC); unsigned new_start_row; /* New starting row for current indirect section */ unsigned u; /* Local index variable */ -#ifdef QAK -HDfprintf(stderr, "%s: Entry is in middle of indirect section\n", FUNC); -#endif /* QAK */ /* Sanity checks */ HDassert(row_sect->u.row.col == 0); HDassert(row_sect->u.row.row > 0); @@ -3285,10 +3089,6 @@ HDfprintf(stderr, "%s: Entry is in middle of indirect section\n", FUNC); new_start_row = row_sect->u.row.row; peer_nentries = row_entry - start_entry; peer_dir_nrows = new_start_row - start_row; -#ifdef QAK -HDfprintf(stderr, "%s: peer_nentries = %u, peer_dir_nrows = %u\n", FUNC, peer_nentries, peer_dir_nrows); -HDfprintf(stderr, "%s: new_start_row = %u\n", FUNC, new_start_row); -#endif /* QAK */ /* Get indirect block information for peer */ if(sect->sect_info.state == H5FS_SECT_LIVE) { @@ -3299,9 +3099,6 @@ HDfprintf(stderr, "%s: new_start_row = %u\n", FUNC, new_start_row); iblock = NULL; iblock_off = sect->u.indirect.u.iblock_off; } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: iblock = %p, iblock_off = %Hu\n", FUNC, iblock, iblock_off); -#endif /* QAK */ /* Create peer indirect section */ if(NULL == (peer_sect = H5HF_sect_indirect_new(hdr, sect->sect_info.addr, @@ -3409,9 +3206,6 @@ H5HF_sect_indirect_reduce(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *s HDassert(sect); HDassert(sect->u.indirect.span_size > 0); HDassert(sect->u.indirect.iblock_entries > 0); -#ifdef QAK -HDfprintf(stderr, "%s: child_entry = %u\n", FUNC, child_entry); -#endif /* QAK */ /* Compute starting & ending information for indirect section */ start_row = sect->u.indirect.row; @@ -3419,12 +3213,6 @@ HDfprintf(stderr, "%s: child_entry = %u\n", FUNC, child_entry); start_entry = (start_row * hdr->man_dtable.cparam.width) + start_col; end_entry = (start_entry + sect->u.indirect.num_entries) - 1; end_row = end_entry / hdr->man_dtable.cparam.width; -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect->u.indirect.parent = %p, sect->u.indirect.par_entry = %u\n", FUNC, sect->u.indirect.parent, sect->u.indirect.par_entry); -HDfprintf(stderr, "%s: start_entry = %u, start_row = %u, start_col = %u\n", FUNC, start_entry, start_row, start_col); -HDfprintf(stderr, "%s: end_entry = %u, end_row = %u\n", FUNC, end_entry, end_row); -#endif /* QAK */ /* Check how to adjust section for allocated entry */ if(sect->u.indirect.num_entries > 1) { @@ -3449,9 +3237,6 @@ HDfprintf(stderr, "%s: end_entry = %u, end_row = %u\n", FUNC, end_entry, end_row /* Check if we can allocate from start of indirect section */ if(child_entry == start_entry) { -#ifdef QAK -HDfprintf(stderr, "%s: Child is at start of indirect section\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(sect->u.indirect.dir_nrows == 0); HDassert(sect->u.indirect.dir_rows == NULL); @@ -3482,9 +3267,6 @@ HDfprintf(stderr, "%s: Child is at start of indirect section\n", FUNC); HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't make new 'first row' for child indirect section") } /* end if */ else if(child_entry == end_entry) { -#ifdef QAK -HDfprintf(stderr, "%s: Child is at end of indirect section\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(sect->u.indirect.indir_nents > 0); HDassert(sect->u.indirect.indir_ents); @@ -3510,9 +3292,6 @@ HDfprintf(stderr, "%s: Child is at end of indirect section\n", FUNC); unsigned new_nentries; /* New number of entries for current indirect section */ unsigned u; /* Local index variable */ -#ifdef QAK -HDfprintf(stderr, "%s: Child is in middle of indirect section\n", FUNC); -#endif /* QAK */ /* Sanity check */ HDassert(sect->u.indirect.indir_nents > 0); HDassert(sect->u.indirect.indir_ents); @@ -3523,10 +3302,6 @@ HDfprintf(stderr, "%s: Child is in middle of indirect section\n", FUNC); peer_start_col = (child_entry + 1) % hdr->man_dtable.cparam.width; child_row = child_entry / hdr->man_dtable.cparam.width; new_nentries = sect->u.indirect.num_entries - (peer_nentries + 1); -#ifdef QAK -HDfprintf(stderr, "%s: peer_nentries = %u, peer_start_row = %u, peer_start_col = %u\n", FUNC, peer_nentries, peer_start_row, peer_start_col); -HDfprintf(stderr, "%s: new_nentries = %u\n", FUNC, new_nentries); -#endif /* QAK */ HDassert(child_row >= hdr->man_dtable.max_direct_rows); /* Get indirect block information for peer */ @@ -3538,27 +3313,18 @@ HDfprintf(stderr, "%s: new_nentries = %u\n", FUNC, new_nentries); iblock = NULL; iblock_off = sect->u.indirect.u.iblock_off; } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: iblock = %p, iblock_off = %Hu\n", FUNC, iblock, iblock_off); -#endif /* QAK */ /* Update the number of entries in current section & calculate it's span size */ /* (Will use this to compute the section address for the peer section */ sect->u.indirect.num_entries = new_nentries; sect->u.indirect.span_size = H5HF_dtable_span_size(&hdr->man_dtable, sect->u.indirect.row, sect->u.indirect.col, new_nentries); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.span_size = %Hu\n", FUNC, sect->u.indirect.span_size); -#endif /* QAK */ HDassert(sect->u.indirect.span_size > 0); /* Compute address of peer indirect section */ peer_sect_addr = sect->sect_info.addr; peer_sect_addr += sect->u.indirect.span_size; peer_sect_addr += hdr->man_dtable.row_block_size[child_row]; -#ifdef QAK -HDfprintf(stderr, "%s: peer_sect_addr = %a\n", FUNC, peer_sect_addr); -#endif /* QAK */ /* Create peer indirect section */ if(NULL == (peer_sect = H5HF_sect_indirect_new(hdr, peer_sect_addr, @@ -3582,9 +3348,6 @@ HDfprintf(stderr, "%s: peer_sect_addr = %a\n", FUNC, peer_sect_addr); /* Eliminate indirect entries for this section, if appropriate */ if(sect->u.indirect.indir_nents == 0) sect->u.indirect.indir_ents = (H5HF_free_section_t **)H5MM_xfree(sect->u.indirect.indir_ents); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.indir_nents = %u\n", FUNC, sect->u.indirect.indir_nents); -#endif /* QAK */ /* Re-target transferred row sections to point to new underlying indirect section */ for(u = 0; u < peer_nentries; u++) @@ -3597,10 +3360,6 @@ HDfprintf(stderr, "%s: sect->u.indirect.indir_nents = %u\n", FUNC, sect->u.indir /* Adjust reference counts for current & peer sections */ peer_sect->u.indirect.rc = peer_nentries; sect->u.indirect.rc -= peer_nentries; -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.rc = %u\n", FUNC, sect->u.indirect.rc); -HDfprintf(stderr, "%s: peer_sect->u.indirect.rc = %u\n", FUNC, peer_sect->u.indirect.rc); -#endif /* QAK */ /* Transfer cached information about indirect block */ peer_sect->u.indirect.iblock_entries = sect->u.indirect.iblock_entries; @@ -3798,10 +3557,6 @@ H5HF_sect_indirect_merge_row(H5HF_hdr_t *hdr, hid_t dxpl_id, HDassert(sect1); sect2 = H5HF_sect_indirect_top(row_sect2->u.row.under); HDassert(sect2); -#ifdef QAK -HDfprintf(stderr, "%s: sect1->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect1->sect_info.addr, sect1->sect_info.size, sect1->sect_info.type, (sect1->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect2->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect2->sect_info.addr, sect2->sect_info.size, sect2->sect_info.type, (sect2->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ /* Sanity check some assumptions about the indirect sections */ HDassert(sect1->sect_info.state == H5FS_SECT_LIVE); @@ -3818,18 +3573,7 @@ HDfprintf(stderr, "%s: sect2->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect2->sec start_entry1 = (start_row1 * hdr->man_dtable.cparam.width) + start_col1; end_entry1 = (start_entry1 + sect1->u.indirect.num_entries) - 1; end_row1 = end_entry1 / hdr->man_dtable.cparam.width; -#ifdef QAK -HDfprintf(stderr, "%s: sect1->u.indirect.dir_nrows = %u\n", FUNC, sect1->u.indirect.dir_nrows); -HDfprintf(stderr, "%s: start_row1 = %u, start_col1 = %u, start_entry1 = %u\n", FUNC, start_row1, start_col1, start_entry1); -HDfprintf(stderr, "%s: sect1->u.indirect.num_entries = %u\n", FUNC, sect1->u.indirect.num_entries); -HDfprintf(stderr, "%s: end_row1 = %u, end_entry1 = %u\n", FUNC, end_row1, end_entry1); -#endif /* QAK */ start_row2 = sect2->u.indirect.row; -#ifdef QAK -HDfprintf(stderr, "%s: sect2->u.indirect.dir_nrows = %u\n", FUNC, sect2->u.indirect.dir_nrows); -HDfprintf(stderr, "%s: start_row2 = %u\n", FUNC, start_row2); -HDfprintf(stderr, "%s: sect2->u.indirect.num_entries = %u\n", FUNC, sect2->u.indirect.num_entries); -#endif /* QAK */ /* Check for direct sections in second section */ /* (second indirect section can be parent of indirect section for second @@ -3853,9 +3597,6 @@ HDfprintf(stderr, "%s: sect2->u.indirect.num_entries = %u\n", FUNC, sect2->u.ind if(row_sect1->u.row.under->u.indirect.u.iblock->block_off == row_sect2->u.row.under->u.indirect.u.iblock->block_off && end_row1 == start_row2) { H5HF_free_section_t *last_row_sect1; /* Last row in first indirect section */ -#ifdef QAK -HDfprintf(stderr, "%s: Sections share a row\n", FUNC); -#endif /* QAK */ /* Locate the last row section in first indirect section, if we don't already have it */ if(row_sect1->u.row.row != end_row1) @@ -3878,9 +3619,6 @@ HDfprintf(stderr, "%s: Sections share a row\n", FUNC); merged_rows = TRUE; } /* end if */ else { -#ifdef QAK -HDfprintf(stderr, "%s: Sections don't share a row\n", FUNC); -#endif /* QAK */ /* Set up parameters for transfer of rows */ src_row2 = 0; @@ -3890,11 +3628,6 @@ HDfprintf(stderr, "%s: Sections don't share a row\n", FUNC); /* Indicate that the rows were _not_ merged */ merged_rows = FALSE; } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: new_dir_nrows1 = %u\n", FUNC, new_dir_nrows1); -HDfprintf(stderr, "%s: src_row2 = %u\n", FUNC, src_row2); -HDfprintf(stderr, "%s: nrows_moved2 = %u\n", FUNC, nrows_moved2); -#endif /* QAK */ /* Check if we need to move additional rows */ if(nrows_moved2 > 0) { @@ -3980,9 +3713,6 @@ HDfprintf(stderr, "%s: nrows_moved2 = %u\n", FUNC, nrows_moved2); /* Wrap up, freeing or re-inserting second row section */ /* (want this to be after the first indirection section is consistent again) */ if(merged_rows) { -#ifdef QAK -HDfprintf(stderr, "%s: Finishing sections share a row\n", FUNC); -#endif /* QAK */ /* Release second row section */ /* (indirectly releases second indirect section, since all of it's * other dependents are gone) @@ -3992,9 +3722,6 @@ HDfprintf(stderr, "%s: Finishing sections share a row\n", FUNC); HGOTO_ERROR(H5E_HEAP, H5E_CANTRELEASE, FAIL, "can't free row section") } /* end if */ else { -#ifdef QAK -HDfprintf(stderr, "%s: Finishing sections don't share a row\n", FUNC); -#endif /* QAK */ /* Decrement ref. count on second indirect section's parent */ HDassert(sect2->u.indirect.rc == 0); if(sect2->u.indirect.parent) @@ -4009,27 +3736,14 @@ HDfprintf(stderr, "%s: Finishing sections don't share a row\n", FUNC); /* (it's already been added to first indirect section, but it's been removed * from the free space manager and needs to be re-added) */ -#ifdef QAK -HDfprintf(stderr, "%s: Re-inserting second row section\n", FUNC); -#endif /* QAK */ row_sect2->sect_info.type = H5HF_FSPACE_SECT_NORMAL_ROW; if(H5HF_space_add(hdr, dxpl_id, row_sect2, H5FS_ADD_SKIP_VALID) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "can't re-add second row section to free space") -#ifdef QAK -HDfprintf(stderr, "%s: Done re-inserting second row section\n", FUNC); -#endif /* QAK */ } /* end else */ -#ifdef QAK -HDfprintf(stderr, "%s: sect1->u.indirect.iblock_entries = %u\n", FUNC, sect1->u.indirect.iblock_entries); -HDfprintf(stderr, "%s: sect1->u.indirect.num_entries = %u\n", FUNC, sect1->u.indirect.num_entries); -#endif /* QAK */ /* Check if we can create parent indirect section for first section */ /* (i.e. merged indirect sections cover an entire indirect block) */ if(sect1->u.indirect.iblock_entries == sect1->u.indirect.num_entries) { -#ifdef QAK -HDfprintf(stderr, "%s: creating parent indirect section\n", FUNC); -#endif /* QAK */ /* Build parent section for fully populated indirect section */ HDassert(sect1->u.indirect.parent == NULL); if(H5HF_sect_indirect_build_parent(hdr, sect1) < 0) @@ -4064,9 +3778,6 @@ H5HF_sect_indirect_build_parent(H5HF_hdr_t *hdr, H5HF_free_section_t *sect) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HF_sect_indirect_build_parent) -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ /* Sanity check parameters */ HDassert(hdr); @@ -4076,18 +3787,12 @@ HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_ HDassert(sect->u.indirect.iblock_entries == sect->u.indirect.num_entries); HDassert(sect->u.indirect.u.iblock); HDassert(sect->u.indirect.parent == NULL); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect = {%p, %u, %u, %u}\n", FUNC, sect->u.indirect.u.iblock, sect->u.indirect.row, sect->u.indirect.col, sect->u.indirect.num_entries); -#endif /* QAK */ /* Get information for creating parent indirect section */ par_entry = sect->u.indirect.u.iblock->par_entry; par_row = par_entry / hdr->man_dtable.cparam.width; par_col = par_entry % hdr->man_dtable.cparam.width; HDassert(par_row >= hdr->man_dtable.max_direct_rows); -#ifdef QAK -HDfprintf(stderr, "%s: par_entry = %u, par_row = %u, par_col = %u\n", FUNC, par_entry, par_row, par_col); -#endif /* QAK */ par_iblock = sect->u.indirect.u.iblock->parent; HDassert(par_iblock); @@ -4144,12 +3849,6 @@ H5HF_sect_indirect_shrink(H5HF_hdr_t *hdr, hid_t dxpl_id, H5HF_free_section_t *s /* Sanity check some assumptions about the indirect section */ HDassert(sect->u.indirect.dir_nrows > 0 || sect->u.indirect.indir_nents > 0); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -HDfprintf(stderr, "%s: sect->u.indirect = {%p, %u, %u, %u}\n", FUNC, sect->u.indirect.u.iblock, sect->u.indirect.row, sect->u.indirect.col, sect->u.indirect.num_entries); -HDfprintf(stderr, "%s: sect->u.indirect.span_size = %Hu\n", FUNC, sect->u.indirect.span_size); -HDfprintf(stderr, "%s: sect->u.indirect.parent = %p\n", FUNC, sect->u.indirect.parent); -#endif /* QAK */ /* Walk through direct rows, freeing them */ for(u = 0; u < sect->u.indirect.dir_nrows; u++) { @@ -4205,9 +3904,6 @@ H5HF_sect_indirect_serialize(H5HF_hdr_t *hdr, const H5HF_free_section_t *sect, HDassert(hdr); HDassert(sect); HDassert(buf); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -#endif /* QAK */ /* Check if this indirect section has a parent & forward if this section is first */ if(sect->u.indirect.parent) { @@ -4220,35 +3916,18 @@ HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", FUNC, sect->sect_ if(sect->sect_info.state == H5FS_SECT_LIVE) { HDassert(sect->u.indirect.u.iblock); UINT64ENCODE_VAR(buf, sect->u.indirect.u.iblock->block_off, hdr->heap_off_size); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.u.iblock->block_off = %Hu\n", FUNC, sect->u.indirect.u.iblock->block_off); -#endif /* QAK */ } /* end if */ else -{ UINT64ENCODE_VAR(buf, sect->u.indirect.u.iblock_off, hdr->heap_off_size); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.u.iblock_off = %Hu\n", FUNC, sect->u.indirect.u.iblock_off); -#endif /* QAK */ -} /* Indirect range's row */ UINT16ENCODE(buf, sect->u.indirect.row); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.row = %u\n", FUNC, sect->u.indirect.row); -#endif /* QAK */ /* Indirect range's column */ UINT16ENCODE(buf, sect->u.indirect.col); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.col = %u\n", FUNC, sect->u.indirect.col); -#endif /* QAK */ /* Indirect range's # of entries */ UINT16ENCODE(buf, sect->u.indirect.num_entries); -#ifdef QAK -HDfprintf(stderr, "%s: sect->u.indirect.num_entries = %u\n", FUNC, sect->u.indirect.num_entries); -#endif /* QAK */ } /* end else */ done: @@ -4293,33 +3972,18 @@ H5HF_sect_indirect_deserialize(H5HF_hdr_t *hdr, hid_t dxpl_id, HDassert(buf); HDassert(H5F_addr_defined(sect_addr)); HDassert(sect_size); -#ifdef QAK -HDfprintf(stderr, "%s: sect_addr = %a, sect_size = %Hu\n", FUNC, sect_addr, sect_size); -#endif /* QAK */ /* Indirect range's indirect block's block offset */ UINT64DECODE_VAR(buf, iblock_off, hdr->heap_off_size); -#ifdef QAK -HDfprintf(stderr, "%s: iblock_off = %Hu\n", FUNC, iblock_off); -#endif /* QAK */ /* Indirect section's row */ UINT16DECODE(buf, start_row); -#ifdef QAK -HDfprintf(stderr, "%s: start_row = %u\n", FUNC, start_row); -#endif /* QAK */ /* Indirect section's column */ UINT16DECODE(buf, start_col); -#ifdef QAK -HDfprintf(stderr, "%s: start_col = %u\n", FUNC, start_col); -#endif /* QAK */ /* Indirect section's # of entries */ UINT16DECODE(buf, nentries); -#ifdef QAK -HDfprintf(stderr, "%s: nentries = %u\n", FUNC, nentries); -#endif /* QAK */ /* Create free space section node */ if(NULL == (new_sect = H5HF_sect_indirect_new(hdr, sect_addr, sect_size, @@ -4426,15 +4090,6 @@ H5HF_sect_indirect_valid(const H5HF_hdr_t *hdr, const H5HF_free_section_t *sect) HDassert(hdr); HDassert(sect); -#ifdef QAK -HDfprintf(stderr, "%s: sect->sect_info = {%a, %Hu, %u, %s}\n", "H5HF_sect_indirect_valid", sect->sect_info.addr, sect->sect_info.size, sect->sect_info.type, (sect->sect_info.state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); -if(sect->sect_info.state == H5FS_SECT_LIVE) - HDfprintf(stderr, "%s: sect->u.indirect = {%p, ", "H5HF_sect_indirect_valid", sect->u.indirect.u.iblock); -else - HDfprintf(stderr, "%s: sect->u.indirect = {%Hu, ", "H5HF_sect_indirect_valid", sect->u.indirect.u.iblock_off); -HDfprintf(stderr, "%u, %u, %u}\n", sect->u.indirect.row, sect->u.indirect.col, sect->u.indirect.num_entries); -#endif /* QAK */ - /* Compute starting entry, column & row */ start_row = sect->u.indirect.row; start_col = sect->u.indirect.col; @@ -4443,10 +4098,6 @@ HDfprintf(stderr, "%u, %u, %u}\n", sect->u.indirect.row, sect->u.indirect.col, s /* Compute ending entry, column & row */ end_entry = (start_entry + sect->u.indirect.num_entries) - 1; end_row = end_entry / hdr->man_dtable.cparam.width; -#ifdef QAK -HDfprintf(stderr, "%s: start_row = %u, start_col = %u, start_entry = %u\n", "H5HF_sect_indirect_valid", start_row, start_col, start_entry); -HDfprintf(stderr, "%s: end_row = %u, end_entry = %u\n", "H5HF_sect_indirect_valid", end_row, end_entry); -#endif /* QAK */ /* Sanity check any direct rows */ if(sect->u.indirect.dir_nrows > 0) { @@ -161,10 +161,10 @@ static haddr_t H5HG_create (H5F_t *f, hid_t dxpl_id, size_t size) { H5HG_heap_t *heap = NULL; - haddr_t ret_value = HADDR_UNDEF; uint8_t *p = NULL; haddr_t addr; size_t n; + haddr_t ret_value; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5HG_create) @@ -253,11 +253,9 @@ HDmemset(heap->chunk, 0, size); ret_value = addr; done: - if ( ! ( H5F_addr_defined(addr) ) && heap) { - if ( H5HG_dest(f,heap) < 0 ) - HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, HADDR_UNDEF, \ - "unable to destroy global heap collection"); - } + if(!(H5F_addr_defined(addr)) && heap) + if(H5HG_dest(f, heap) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, HADDR_UNDEF, "unable to destroy global heap collection") FUNC_LEAVE_NOAPI(ret_value); } /* H5HG_create() */ @@ -802,7 +800,7 @@ H5HG_link (H5F_t *f, hid_t dxpl_id, const H5HG_t *hobj, int adjust) ret_value=heap->obj[hobj->idx].nrefs; done: - if (heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, heap_flags)<0) + if(heap && H5AC_unprotect(f, dxpl_id, H5AC_GHEAP, hobj->addr, heap, heap_flags) < 0) HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value); @@ -117,10 +117,10 @@ H5FL_BLK_DEFINE(lheap_chunk); herr_t H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr_p/*out*/) { - H5HL_t *heap = NULL; - hsize_t total_size; /*total heap size on disk */ + H5HL_t *heap = NULL; /* Heap created */ + hsize_t total_size; /* Total heap size on disk */ size_t sizeof_hdr; /* Cache H5HL header size for file */ - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HL_create, FAIL) @@ -128,6 +128,7 @@ H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr_p/*out*/) HDassert(f); HDassert(addr_p); + /* Adjust size hint as necessary */ if(size_hint && size_hint < H5HL_SIZEOF_FREE(f)) size_hint = H5HL_SIZEOF_FREE(f); size_hint = H5HL_ALIGN(size_hint); @@ -135,23 +136,23 @@ H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr_p/*out*/) /* Cache this for later */ sizeof_hdr = H5HL_SIZEOF_HDR(f); - /* allocate file version */ + /* Allocate file version */ total_size = sizeof_hdr + size_hint; if(HADDR_UNDEF == (*addr_p = H5MF_alloc(f, H5FD_MEM_LHEAP, dxpl_id, total_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate file memory") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "unable to allocate file memory") /* allocate memory version */ if(NULL == (heap = H5FL_CALLOC(H5HL_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed") heap->addr = *addr_p + (hsize_t)sizeof_hdr; heap->heap_alloc = size_hint; if(NULL == (heap->chunk = H5FL_BLK_CALLOC(lheap_chunk, (sizeof_hdr + size_hint)))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed") /* free list */ if(size_hint) { if(NULL == (heap->freelist = H5FL_MALLOC(H5HL_free_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed") heap->freelist->offset = 0; heap->freelist->size = size_hint; heap->freelist->prev = heap->freelist->next = NULL; @@ -159,7 +160,7 @@ H5HL_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, haddr_t *addr_p/*out*/) else heap->freelist = NULL; - /* add to cache */ + /* Add to cache */ if(H5AC_set(f, dxpl_id, H5AC_LHEAP, *addr_p, heap, H5AC__NO_FLAGS_SET) < 0) HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, FAIL, "unable to cache heap") @@ -168,8 +169,8 @@ done: if(H5F_addr_defined(*addr_p)) H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, *addr_p, total_size); if(heap) - if(H5HL_dest(f,heap) < 0) - HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap collection") + if(H5HL_dest(f, heap) < 0) + HDONE_ERROR(H5E_HEAP, H5E_CANTFREE, FAIL, "unable to destroy local heap") } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -196,7 +197,7 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap) { size_t new_heap_size = heap->heap_alloc; /* New size of heap */ size_t sizeof_hdr; - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HL_minimize_heap_space, FAIL) @@ -255,8 +256,9 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap) /* Truncate the free block */ last_fl->size = H5HL_ALIGN(new_heap_size - last_fl->offset); new_heap_size = last_fl->offset + last_fl->size; - assert(last_fl->size >= H5HL_SIZEOF_FREE(f)); - } else { + HDassert(last_fl->size >= H5HL_SIZEOF_FREE(f)); + } /* end if */ + else { /* * Set the size of the memory buffer to the start * of the free list @@ -266,12 +268,13 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap) /* Eliminate the free block from the list */ last_fl = H5HL_remove_free(heap, last_fl); } /* end else */ - } else { + } /* end if */ + else { /* Truncate the free block */ last_fl->size = H5HL_ALIGN(new_heap_size - last_fl->offset); new_heap_size = last_fl->offset + last_fl->size; - assert(last_fl->size >= H5HL_SIZEOF_FREE(f)); - assert(last_fl->size == H5HL_ALIGN(last_fl->size)); + HDassert(last_fl->size >= H5HL_SIZEOF_FREE(f)); + HDassert(last_fl->size == H5HL_ALIGN(last_fl->size)); } /* end else */ } /* end if */ } /* end if */ @@ -289,9 +292,8 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap) HDassert(new_heap_size < heap->heap_alloc); /* Resize the memory buffer */ - heap->chunk = H5FL_BLK_REALLOC(lheap_chunk, heap->chunk, (sizeof_hdr + new_heap_size)); - if(!heap->chunk) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") + if(NULL == (heap->chunk = H5FL_BLK_REALLOC(lheap_chunk, heap->chunk, (sizeof_hdr + new_heap_size)))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed") /* Release old space on disk */ /* (Should be safe to free old heap space first, since it's shrinking -QAK) */ @@ -302,7 +304,7 @@ H5HL_minimize_heap_space(H5F_t *f, hid_t dxpl_id, H5HL_t *heap) /* Allocate new space on disk */ H5_CHECK_OVERFLOW(new_heap_size, size_t, hsize_t); if(HADDR_UNDEF == (new_addr = H5MF_alloc(f, H5FD_MEM_LHEAP, dxpl_id, (hsize_t)new_heap_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate file space for heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTRESIZE, FAIL, "reallocating data block failed") /* Update heap info*/ heap->addr = new_addr; @@ -486,7 +488,7 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void * size_t sizeof_hdr; /* Cache H5HL header size for file */ size_t ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5HL_insert, (size_t)(-1)) + FUNC_ENTER_NOAPI(H5HL_insert, UFAIL) /* check arguments */ HDassert(f); @@ -501,7 +503,7 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void * * if an error occurs -QAK) */ if(H5AC_mark_pinned_or_protected_entry_dirty(f, heap) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, (size_t)(-1), "unable to mark heap as dirty") + HGOTO_ERROR(H5E_HEAP, H5E_CANTMARKDIRTY, UFAIL, "unable to mark heap as dirty") /* Cache this for later */ sizeof_hdr = H5HL_SIZEOF_HDR(f); @@ -566,45 +568,6 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void * need_more = need_size; new_heap_alloc = heap->heap_alloc + need_more; -#if 0 /* JRM */ /* delete this once we are convinced that the general - * fix will do the job. - */ -/* - * XXX: This is a _total_ hack, a real kludge. :-/ The metadata cache currently - * responds very poorly when an object is inserted into the cache (or - * resized) that is larger than the current cache size. It waits through - * an entire 'epoch' of cache operations to resize the cache larger (getting - * _very_ poor performance), instead of immediately accommodating the large - * object by increasing the cache size. - * - * So, what we are doing here is to look at the current cache size, check - * if the new local heap will overwhelm the cache and, if so, resize the - * cache to be large enough to hold the new local heap block along with - * leaving room for other objects in the cache. - * - * John will be working on a fix inside the cache itself, so this special - * case code here can be removed when he's finished. - QAK, 2007/12/21 - */ -{ - H5AC_cache_config_t mdc_config; - - /* Retrieve the current cache information */ - mdc_config.version = H5AC__CURR_CACHE_CONFIG_VERSION; - if(H5AC_get_cache_auto_resize_config(f->shared->cache, &mdc_config) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (size_t)-1, "H5AC_get_cache_auto_resize_config() failed.") - - /* Check if the current cache will get blown out by adding this heap - * block and resize it if so. - */ - if((2 * new_heap_alloc) >= mdc_config.initial_size) { - mdc_config.set_initial_size = TRUE; - mdc_config.initial_size = 2 * new_heap_alloc; - - if(H5AC_set_cache_auto_resize_config(f->shared->cache, &mdc_config) < 0) - HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, (size_t)-1, "H5AC_set_cache_auto_resize_config() failed.") - } /* end if */ -} -#endif /* JRM */ HDassert(heap->heap_alloc < new_heap_alloc); H5_CHECK_OVERFLOW(heap->heap_alloc, size_t, hsize_t); H5_CHECK_OVERFLOW(new_heap_alloc, size_t, hsize_t); @@ -612,17 +575,17 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void * /* Extend current heap if possible */ extended = H5MF_try_extend(f, dxpl_id, H5FD_MEM_LHEAP, heap->addr, (hsize_t)(heap->heap_alloc), (hsize_t)need_more); if(extended < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, (size_t)(-1), "error trying to extend heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTEXTEND, UFAIL, "error trying to extend heap") /* If we couldn't extend the heap, release old chunk and allocate a new one */ if(extended == FALSE) { /* Release old space on disk */ if(H5MF_xfree(f, H5FD_MEM_LHEAP, dxpl_id, heap->addr, (hsize_t)heap->heap_alloc) < 0) - HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, (size_t)(-1), "unable to free local heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTFREE, UFAIL, "unable to free local heap") /* allocate new disk space for the heap */ if((heap->addr = H5MF_alloc(f, H5FD_MEM_LHEAP, dxpl_id, (hsize_t)new_heap_alloc)) == HADDR_UNDEF) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, (size_t)(-1), "unable to allocate file space for heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, UFAIL, "unable to allocate file space for heap") } /* end if */ /* If the last free list in the heap is at the end of the heap, extend it */ @@ -661,7 +624,8 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void * HDassert(fl->size == H5HL_ALIGN(fl->size)); fl->prev = NULL; fl->next = heap->freelist; - if (heap->freelist) heap->freelist->prev = fl; + if(heap->freelist) + heap->freelist->prev = fl; heap->freelist = fl; #ifdef H5HL_DEBUG } else if (H5DEBUG(HL) && need_more > need_size) { @@ -681,18 +645,15 @@ H5HL_insert(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t buf_size, const void * } #endif heap->heap_alloc = new_heap_alloc; - heap->chunk = H5FL_BLK_REALLOC(lheap_chunk, heap->chunk, (sizeof_hdr + heap->heap_alloc)); - if(NULL == heap->chunk) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, (size_t)(-1), "memory allocation failed") + if(NULL == (heap->chunk = H5FL_BLK_REALLOC(lheap_chunk, heap->chunk, (sizeof_hdr + heap->heap_alloc)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, UFAIL, "memory allocation failed") /* Clear new section so junk doesn't appear in the file */ /* (Avoid clearing section which will be overwritten with newly inserted data) */ HDmemset(heap->chunk + sizeof_hdr + offset + buf_size, 0, (new_heap_alloc - (offset + buf_size))); } /* end if */ - /* - * Copy the data into the heap - */ + /* Copy the data into the heap */ HDmemcpy(heap->chunk + sizeof_hdr + offset, buf, buf_size); /* Set return value */ @@ -767,15 +728,15 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t offset, size_t size) if((offset + size) == fl->offset) { fl->offset = offset; fl->size += size; - HDassert(fl->offset==H5HL_ALIGN (fl->offset)); - HDassert(fl->size==H5HL_ALIGN (fl->size)); + HDassert(fl->offset == H5HL_ALIGN(fl->offset)); + HDassert(fl->size == H5HL_ALIGN(fl->size)); fl2 = fl->next; while(fl2) { if((fl2->offset + fl2->size) == fl->offset) { fl->offset = fl2->offset; fl->size += fl2->size; - HDassert(fl->offset == H5HL_ALIGN (fl->offset)); - HDassert(fl->size == H5HL_ALIGN (fl->size)); + HDassert(fl->offset == H5HL_ALIGN(fl->offset)); + HDassert(fl->size == H5HL_ALIGN(fl->size)); fl2 = H5HL_remove_free(heap, fl2); if(((fl->offset + fl->size) == heap->heap_alloc ) && ((2 * fl->size) > heap->heap_alloc )) { @@ -795,28 +756,28 @@ H5HL_remove(H5F_t *f, hid_t dxpl_id, H5HL_t *heap, size_t offset, size_t size) } else if(fl->offset + fl->size == offset) { fl->size += size; fl2 = fl->next; - HDassert(fl->size==H5HL_ALIGN (fl->size)); + HDassert(fl->size == H5HL_ALIGN(fl->size)); while(fl2) { if(fl->offset + fl->size == fl2->offset) { fl->size += fl2->size; - HDassert(fl->size==H5HL_ALIGN (fl->size)); + HDassert(fl->size == H5HL_ALIGN(fl->size)); fl2 = H5HL_remove_free(heap, fl2); if(((fl->offset + fl->size) == heap->heap_alloc) && ((2 * fl->size) > heap->heap_alloc)) { if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed") - } + } /* end if */ HGOTO_DONE(SUCCEED); - } + } /* end if */ fl2 = fl2->next; - } + } /* end while */ if(((fl->offset + fl->size) == heap->heap_alloc) && ((2 * fl->size) > heap->heap_alloc)) { if(H5HL_minimize_heap_space(f, dxpl_id, heap) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTFREE, FAIL, "heap size minimization failed") - } + } /* end if */ HGOTO_DONE(SUCCEED); - } + } /* end if */ fl = fl->next; } /* end while */ @@ -889,14 +850,14 @@ H5HL_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) /* Get heap pointer */ if(NULL == (heap = (H5HL_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_WRITE))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTPROTECT, FAIL, "unable to load heap") /* Set the cache flags to delete the heap & free its file space */ cache_flags |= H5AC__DIRTIED_FLAG | H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; done: if(heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, cache_flags) < 0) - HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release local heap") + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap") FUNC_LEAVE_NOAPI(ret_value) } /* end H5HL_delete() */ @@ -919,7 +880,7 @@ herr_t H5HL_get_size(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t *size) { H5HL_t *heap = NULL; /* Heap to query */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HL_get_size, FAIL) @@ -937,7 +898,7 @@ H5HL_get_size(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t *size) done: if(heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release local heap") + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap") FUNC_LEAVE_NOAPI(ret_value) } /* end H5HL_get_size() */ @@ -961,7 +922,7 @@ H5HL_heapsize(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *heap_size) { H5HL_t *heap = NULL; /* Heap to query */ size_t local_heap_size = 0; - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5HL_heapsize, FAIL) @@ -983,7 +944,7 @@ H5HL_heapsize(H5F_t *f, hid_t dxpl_id, haddr_t addr, hsize_t *heap_size) done: if(heap && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, heap, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_HEAP, H5E_PROTECT, FAIL, "unable to release local heap") + HDONE_ERROR(H5E_HEAP, H5E_CANTUNPROTECT, FAIL, "unable to release local heap") FUNC_LEAVE_NOAPI(ret_value) } /* end H5HL_heapsize() */ diff --git a/src/H5HLdbg.c b/src/H5HLdbg.c index 1ebb14f..ab8d10a 100644 --- a/src/H5HLdbg.c +++ b/src/H5HLdbg.c @@ -59,19 +59,19 @@ H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int H5HL_free_t *freelist = NULL; uint8_t *marker = NULL; size_t amount_free = 0; - herr_t ret_value=SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5HL_debug, FAIL); + FUNC_ENTER_NOAPI(H5HL_debug, FAIL) /* check arguments */ - assert(f); - assert(H5F_addr_defined(addr)); - assert(stream); - assert(indent >= 0); - assert(fwidth >= 0); + HDassert(f); + HDassert(H5F_addr_defined(addr)); + HDassert(stream); + HDassert(indent >= 0); + HDassert(fwidth >= 0); if (NULL == (h = (H5HL_t *)H5AC_protect(f, dxpl_id, H5AC_LHEAP, addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap"); + HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, FAIL, "unable to load heap") fprintf(stream, "%*sLocal Heap...\n", indent, ""); fprintf(stream, "%*s%-*s %d\n", indent, "", fwidth, @@ -91,40 +91,38 @@ H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int * Traverse the free list and check that all free blocks fall within * the heap and that no two free blocks point to the same region of * the heap. */ - if (NULL==(marker = (uint8_t *)H5MM_calloc(h->heap_alloc))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed"); + if(NULL == (marker = (uint8_t *)H5MM_calloc(h->heap_alloc))) + HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "memory allocation failed") fprintf(stream, "%*sFree Blocks (offset, size):\n", indent, ""); - for (free_block=0, freelist = h->freelist; freelist; freelist = freelist->next, free_block++) { + for(free_block = 0, freelist = h->freelist; freelist; freelist = freelist->next, free_block++) { char temp_str[32]; sprintf(temp_str,"Block #%d:",free_block); HDfprintf(stream, "%*s%-*s %8Zu, %8Zu\n", indent+3, "", MAX(0,fwidth-9), temp_str, freelist->offset, freelist->size); - if (freelist->offset + freelist->size > h->heap_alloc) { + if(freelist->offset + freelist->size > h->heap_alloc) fprintf(stream, "***THAT FREE BLOCK IS OUT OF BOUNDS!\n"); - } else { - for (i=overlap=0; i<(int)(freelist->size); i++) { - if (marker[freelist->offset + i]) + else { + for(i = overlap = 0; i < (int)(freelist->size); i++) { + if(marker[freelist->offset + i]) overlap++; marker[freelist->offset + i] = 1; - } - if (overlap) { + } /* end for */ + if(overlap) fprintf(stream, "***THAT FREE BLOCK OVERLAPPED A PREVIOUS " "ONE!\n"); - } else { + else amount_free += freelist->size; - } - } - } + } /* end for */ + } /* end for */ - if (h->heap_alloc) { + if(h->heap_alloc) fprintf(stream, "%*s%-*s %.2f%%\n", indent, "", fwidth, "Percent of heap used:", (100.0 * (double)(h->heap_alloc - amount_free) / (double)h->heap_alloc)); - } /* * Print the data in a VMS-style octal dump. @@ -132,9 +130,10 @@ H5HL_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent, int H5_buffer_dump(stream, indent, h->chunk, marker, H5HL_SIZEOF_HDR(f), h->heap_alloc); done: - if (h && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, h, FALSE) != SUCCEED) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header"); + if(h && H5AC_unprotect(f, dxpl_id, H5AC_LHEAP, addr, h, FALSE) < 0) + HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") H5MM_xfree(marker); - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5HL_debug() */ + diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index b99012c..ad8f8e1 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -25,7 +25,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Lpkg.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ -#include "H5Opublic.h" /* File objects */ +#include "H5Opublic.h" /* File objects */ #include "H5Pprivate.h" /* Property lists */ static hid_t H5L_extern_traverse(const char UNUSED *link_name, hid_t cur_group, @@ -1447,7 +1447,7 @@ H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags) if(H5O_delete_oh(f, dxpl_id, oh) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, FAIL, "can't delete object from file") - /* Mark the object header as deleted */ + /* Mark the object header for deletion */ *oh_flags = H5AC__DELETED_FLAG | H5AC__FREE_FILE_SPACE_FLAG; } /* end else */ } /* end if */ @@ -1463,7 +1463,10 @@ H5O_link_oh(H5F_t *f, int adjust, hid_t dxpl_id, H5O_t *oh, unsigned *oh_flags) } /* end if */ } /* end if */ + /* Adjust the link count for the object header */ oh->nlink += adjust; + + /* Mark the object header for deletion */ *oh_flags |= H5AC__DIRTIED_FLAG; } /* end if */ @@ -1537,10 +1540,10 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id) HDassert(loc->file); HDassert(H5F_addr_defined(loc->addr)); - /* get header */ + /* Get header */ oh_acc = adjust ? H5AC_WRITE : H5AC_READ; if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, oh_acc))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Call the "real" link routine */ if((ret_value = H5O_link_oh(loc->file, adjust, dxpl_id, oh, &oh_flags)) < 0) @@ -1548,7 +1551,7 @@ H5O_link(const H5O_loc_t *loc, int adjust, hid_t dxpl_id) done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_link() */ @@ -1586,7 +1589,7 @@ H5O_pin(H5O_loc_t *loc, hid_t dxpl_id) /* Check for write access on the file */ if(0 == (H5F_INTENT(loc->file) & H5F_ACC_RDWR)) - HGOTO_ERROR(H5E_OHDR, H5E_WRITEERROR, NULL, "no write intent on file") + HGOTO_ERROR(H5E_OHDR, H5E_BADVALUE, NULL, "no write intent on file") /* Lock the object header into the cache */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) @@ -1758,9 +1761,9 @@ done: herr_t H5O_touch(H5O_loc_t *loc, hbool_t force, hid_t dxpl_id) { - H5O_t *oh = NULL; - unsigned oh_flags = H5AC__NO_FLAGS_SET; - herr_t ret_value = SUCCEED; /* Return value */ + H5O_t *oh = NULL; /* Object header to modify */ + unsigned oh_flags = H5AC__NO_FLAGS_SET; /* Flags for unprotecting object header */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5O_touch, FAIL) @@ -1773,18 +1776,18 @@ H5O_touch(H5O_loc_t *loc, hbool_t force, hid_t dxpl_id) /* Get the object header */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Create/Update the modification time message */ if(H5O_touch_oh(loc->file, dxpl_id, oh, force) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to update object modificaton time") + HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "unable to update object modificaton time") /* Mark object header as changed */ oh_flags |= H5AC__DIRTIED_FLAG; done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_touch() */ @@ -1874,7 +1877,7 @@ H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) H5O_t *oh = NULL; /* Object header information */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_delete,FAIL) + FUNC_ENTER_NOAPI(H5O_delete, FAIL) /* Check args */ HDassert(f); @@ -1882,7 +1885,7 @@ H5O_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr) /* Get the object header information */ if(NULL == (oh = (H5O_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR, addr, NULL, NULL, H5AC_WRITE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Delete object */ if(H5O_delete_oh(f, dxpl_id, oh) < 0) @@ -1963,15 +1966,15 @@ H5O_obj_type(const H5O_loc_t *loc, H5O_type_t *obj_type, hid_t dxpl_id) /* Load the object header */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Retrieve the type of the object */ if(H5O_obj_type_real(oh, obj_type) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type") done: - if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) != SUCCEED) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_obj_type() */ @@ -2041,15 +2044,15 @@ H5O_obj_class(const H5O_loc_t *loc, hid_t dxpl_id) /* Load the object header */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header") /* Test whether entry qualifies as a particular type of object */ if(NULL == (ret_value = H5O_obj_class_real(oh))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "unable to determine object type") + HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, NULL, "unable to determine object type") done: - if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) != SUCCEED) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, NULL, "unable to release object header") + if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, NULL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_obj_class() */ @@ -2436,7 +2439,7 @@ H5O_get_hdr_info_real(const H5O_t *oh, H5O_hdr_info_t *hdr) *------------------------------------------------------------------------- */ herr_t -H5O_get_info(const H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info, +H5O_get_info(const H5O_loc_t *loc, hid_t dxpl_id, hbool_t want_ih_info, H5O_info_t *oinfo) { const H5O_obj_class_t *obj_class; /* Class of object for header */ @@ -2446,21 +2449,21 @@ H5O_get_info(const H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info, FUNC_ENTER_NOAPI(H5O_get_info, FAIL) /* Check args */ - HDassert(oloc); + HDassert(loc); HDassert(oinfo); /* Get the object header */ - if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Reset the object info structure */ HDmemset(oinfo, 0, sizeof(*oinfo)); /* Retrieve the file's fileno */ - H5F_GET_FILENO(oloc->file, oinfo->fileno); + H5F_GET_FILENO(loc->file, oinfo->fileno); /* Set the object's address */ - oinfo->addr = oloc->addr; + oinfo->addr = loc->addr; /* Get class for object */ if(NULL == (obj_class = H5O_obj_class_real(oh))) @@ -2496,7 +2499,7 @@ H5O_get_info(const H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info, HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME message") if(exists > 0) { /* Get "old style" modification time info */ - if(NULL == H5O_msg_read_oh(oloc->file, dxpl_id, oh, H5O_MTIME_ID, &oinfo->ctime)) + if(NULL == H5O_msg_read_oh(loc->file, dxpl_id, oh, H5O_MTIME_ID, &oinfo->ctime)) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME message") } /* end if */ else { @@ -2505,7 +2508,7 @@ H5O_get_info(const H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info, HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "unable to check for MTIME_NEW message") if(exists > 0) { /* Get "new style" modification time info */ - if(NULL == H5O_msg_read_oh(oloc->file, dxpl_id, oh, H5O_MTIME_NEW_ID, &oinfo->ctime)) + if(NULL == H5O_msg_read_oh(loc->file, dxpl_id, oh, H5O_MTIME_NEW_ID, &oinfo->ctime)) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't read MTIME_NEW message") } /* end if */ else @@ -2518,7 +2521,7 @@ H5O_get_info(const H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info, HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object header info") /* Retrieve # of attributes */ - if(H5O_attr_count_real(oloc->file, dxpl_id, oh, &oinfo->num_attrs) < 0) + if(H5O_attr_count_real(loc->file, dxpl_id, oh, &oinfo->num_attrs) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute count") /* Get B-tree & heap metadata storage size, if requested */ @@ -2526,20 +2529,20 @@ H5O_get_info(const H5O_loc_t *oloc, hid_t dxpl_id, hbool_t want_ih_info, /* Check for 'bh_info' callback for this type of object */ if(obj_class->bh_info) { /* Call the object's class 'bh_info' routine */ - if((obj_class->bh_info)(oloc->file, dxpl_id, oh, &(oinfo->meta_size.obj) /* out */) < 0) + if((obj_class->bh_info)(loc->file, dxpl_id, oh, &oinfo->meta_size.obj) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object's btree & heap info") } /* end if */ /* Get B-tree & heap info for any attributes */ if(oinfo->num_attrs > 0) { - if(H5O_attr_bh_info(oloc->file, dxpl_id, oh, &oinfo->meta_size.attr/*out*/) < 0) + if(H5O_attr_bh_info(loc->file, dxpl_id, oh, &oinfo->meta_size.attr) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve attribute btree & heap info") } /* end if */ } /* end if */ done: - if(oh && H5AC_unprotect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_get_info() */ @@ -2559,7 +2562,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_get_create_plist(const H5O_loc_t *oloc, hid_t dxpl_id, H5P_genplist_t *oc_plist) +H5O_get_create_plist(const H5O_loc_t *loc, hid_t dxpl_id, H5P_genplist_t *oc_plist) { H5O_t *oh = NULL; /* Object header */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2567,12 +2570,12 @@ H5O_get_create_plist(const H5O_loc_t *oloc, hid_t dxpl_id, H5P_genplist_t *oc_pl FUNC_ENTER_NOAPI(H5O_get_create_plist, FAIL) /* Check args */ - HDassert(oloc); + HDassert(loc); HDassert(oc_plist); /* Get the object header */ - if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Set property values, if they were used for the object */ if(oh->version > H5O_VERSION_1) { @@ -2593,8 +2596,8 @@ H5O_get_create_plist(const H5O_loc_t *oloc, hid_t dxpl_id, H5P_genplist_t *oc_pl } /* end if */ done: - if(oh && H5AC_unprotect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_get_create_plist() */ @@ -2614,7 +2617,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5O_get_nlinks(const H5O_loc_t *oloc, hid_t dxpl_id, hsize_t *nlinks) +H5O_get_nlinks(const H5O_loc_t *loc, hid_t dxpl_id, hsize_t *nlinks) { H5O_t *oh = NULL; /* Object header */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2622,19 +2625,19 @@ H5O_get_nlinks(const H5O_loc_t *oloc, hid_t dxpl_id, hsize_t *nlinks) FUNC_ENTER_NOAPI(H5O_get_nlinks, FAIL) /* Check args */ - HDassert(oloc); + HDassert(loc); HDassert(nlinks); /* Get the object header */ - if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Retrieve the # of link messages seen when the object header was loaded */ *nlinks = oh->link_msgs_seen; done: - if(oh && H5AC_unprotect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_get_nlinks() */ @@ -2732,7 +2735,7 @@ H5O_get_oh_addr(const H5O_t *oh) *------------------------------------------------------------------------- */ herr_t -H5O_get_rc_and_type(const H5O_loc_t *oloc, hid_t dxpl_id, unsigned *rc, H5O_type_t *otype) +H5O_get_rc_and_type(const H5O_loc_t *loc, hid_t dxpl_id, unsigned *rc, H5O_type_t *otype) { H5O_t *oh = NULL; /* Object header */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2740,13 +2743,13 @@ H5O_get_rc_and_type(const H5O_loc_t *oloc, hid_t dxpl_id, unsigned *rc, H5O_type FUNC_ENTER_NOAPI(H5O_get_rc_and_type, FAIL) /* Check args */ - HDassert(oloc); + HDassert(loc); HDassert(rc); HDassert(otype); /* Get the object header */ - if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Set the object's reference count */ *rc = oh->nlink; @@ -2756,8 +2759,8 @@ H5O_get_rc_and_type(const H5O_loc_t *oloc, hid_t dxpl_id, unsigned *rc, H5O_type HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to determine object type") done: - if(oh && H5AC_unprotect(oloc->file, dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_get_rc_and_type() */ diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index 6c8c931..9cf50ad 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -171,7 +171,6 @@ H5O_add_gap(H5O_t *oh, unsigned chunkno, unsigned idx, /* Create new null message, with the tail of the previous null message */ null_msg = &(oh->mesg[oh->nmesgs++]); null_msg->type = H5O_MSG_NULL; - null_msg->dirty = TRUE; null_msg->native = NULL; null_msg->raw_size = new_gap_size - H5O_SIZEOF_MSGHDR_OH(oh); null_msg->raw = (oh->chunk[chunkno].image + oh->chunk[chunkno].size) @@ -182,6 +181,9 @@ H5O_add_gap(H5O_t *oh, unsigned chunkno, unsigned idx, if(null_msg->raw_size) HDmemset(null_msg->raw, 0, null_msg->raw_size); + /* Mark message as dirty */ + null_msg->dirty = TRUE; + /* Reset size of gap in chunk */ oh->chunk[chunkno].gap = 0; } /* end if */ @@ -347,12 +349,14 @@ H5O_alloc_null(H5O_t *oh, unsigned null_idx, const H5O_msg_class_t *new_type, /* Create new null message, with the tail of the previous null message */ null_msg = &(oh->mesg[oh->nmesgs++]); null_msg->type = H5O_MSG_NULL; - null_msg->dirty = TRUE; null_msg->native = NULL; null_msg->raw = alloc_msg->raw + new_mesg_size; null_msg->raw_size = alloc_msg->raw_size - new_mesg_size; null_msg->chunkno = alloc_msg->chunkno; + /* Mark the message as dirty */ + null_msg->dirty = TRUE; + /* Check for gap in new null message's chunk */ if(oh->chunk[null_msg->chunkno].gap > 0) { unsigned null_chunkno = null_msg->chunkno; /* Chunk w/gap */ @@ -374,9 +378,11 @@ H5O_alloc_null(H5O_t *oh, unsigned null_idx, const H5O_msg_class_t *new_type, /* Initialize the new message */ alloc_msg->type = new_type; - alloc_msg->dirty = TRUE; alloc_msg->native = new_native; + /* Mark the new message as dirty */ + alloc_msg->dirty = TRUE; + done: FUNC_LEAVE_NOAPI(ret_value) } /* H5O_alloc_null() */ @@ -458,12 +464,8 @@ done: *------------------------------------------------------------------------- */ static htri_t -H5O_alloc_extend_chunk(H5F_t *f, - hid_t dxpl_id, - H5O_t *oh, - unsigned chunkno, - size_t size, - unsigned * msg_idx) +H5O_alloc_extend_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned chunkno, + size_t size, unsigned * msg_idx) { size_t delta; /* Change in chunk's size */ size_t aligned_size = H5O_ALIGN_OH(oh, size); @@ -658,10 +660,7 @@ done: *------------------------------------------------------------------------- */ static unsigned -H5O_alloc_new_chunk(H5F_t *f, - hid_t dxpl_id, - H5O_t *oh, - size_t size) +H5O_alloc_new_chunk(H5F_t *f, hid_t dxpl_id, H5O_t *oh, size_t size) { /* Struct for storing information about "best" messages to allocate from */ typedef struct { @@ -917,7 +916,6 @@ H5O_alloc_new_chunk(H5F_t *f, found_null = oh->nmesgs++; null_msg = &(oh->mesg[found_null]); null_msg->type = H5O_MSG_NULL; - null_msg->dirty = TRUE; null_msg->native = NULL; null_msg->raw = oh->mesg[found_other.msgno].raw; null_msg->raw_size = oh->mesg[found_other.msgno].raw_size; @@ -964,6 +962,9 @@ H5O_alloc_new_chunk(H5F_t *f, /* Adjust message index for new NULL message */ found_null--; } /* end if */ + + /* Mark the new null message as dirty */ + null_msg->dirty = TRUE; } /* end if */ HDassert(found_null >= 0); @@ -1130,7 +1131,7 @@ H5O_release_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_mesg_t *mesg, /* Clear message flags */ mesg->flags = 0; - /* Indicate that the message was modified */ + /* Mark the message as modified */ mesg->dirty = TRUE; /* Check if chunk has a gap currently */ @@ -1452,12 +1453,14 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh, hid_t dxpl_id) /* Initialize new null message to take over non-null message's location */ oh->mesg[new_null_msg].type = H5O_MSG_NULL; - oh->mesg[new_null_msg].dirty = TRUE; oh->mesg[new_null_msg].native = NULL; oh->mesg[new_null_msg].raw = old_raw; oh->mesg[new_null_msg].raw_size = curr_msg->raw_size; oh->mesg[new_null_msg].chunkno = old_chunkno; + /* Mark new null message dirty */ + oh->mesg[new_null_msg].dirty = TRUE; + /* Check for gap in new null message's chunk */ if(oh->chunk[old_chunkno].gap > 0) { /* Eliminate the gap in the chunk */ @@ -1495,7 +1498,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh, hid_t dxpl_id) } while(packed_msg); /* Set return value */ - ret_value = did_packing; + ret_value = (htri_t)did_packing; done: FUNC_LEAVE_NOAPI(ret_value) @@ -1609,7 +1612,7 @@ H5O_merge_null(H5F_t *f, H5O_t *oh, hid_t dxpl_id) } while(merged_msg); /* Set return value */ - ret_value = did_merging; + ret_value = (htri_t)did_merging; done: FUNC_LEAVE_NOAPI(ret_value) @@ -1722,7 +1725,10 @@ H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh, hid_t dxpl_id) /* Adjust chunk # for messages in chunks after deleted chunk */ for(u = 0, curr_msg = &oh->mesg[0]; u < oh->nmesgs; u++, curr_msg++) { + /* Sanity check - there should be no messages in deleted chunk */ HDassert(curr_msg->chunkno != deleted_chunkno); + + /* Adjust chunk index for messages in later chunks */ if(curr_msg->chunkno > deleted_chunkno) curr_msg->chunkno--; @@ -1749,7 +1755,7 @@ H5O_remove_empty_chunks(H5F_t *f, H5O_t *oh, hid_t dxpl_id) } while(deleted_chunk); /* Set return value */ - ret_value = did_deleting; + ret_value = (htri_t)did_deleting; done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index 67d0a92..72f02df 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -235,7 +235,7 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr) /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check if this object already has attribute information */ if(oh->version > H5O_VERSION_1) { @@ -401,7 +401,7 @@ H5O_attr_create(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr) done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0) - HDONE_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_create() */ @@ -488,7 +488,7 @@ H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, NULL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -545,7 +545,7 @@ H5O_attr_open_by_name(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_ATTR, H5E_PROTECT, NULL, "unable to release object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, NULL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_open_by_name() */ @@ -629,7 +629,7 @@ H5O_attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, NULL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, NULL, "unable to load object header") /* Find out whether it has already been opened. If it has, close the object * and make a copy of the already opened object to share the object info. @@ -655,7 +655,7 @@ H5O_attr_open_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, done: if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_ATTR, H5E_PROTECT, NULL, "unable to release object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, NULL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_open_by_idx() */ @@ -846,7 +846,7 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, HDassert(!udata->found); /* Check for correct attribute message to modify */ - if(HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->attr->shared->name) == 0) { + if(0 == HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->attr->shared->name)) { /* Update the shared attribute in the SOHM storage */ if(mesg->flags & H5O_MSG_FLAG_SHARED) if(H5O_attr_update_shared(udata->f, udata->dxpl_id, oh, udata->attr, (H5O_shared_t *)mesg->native) < 0) @@ -898,7 +898,7 @@ H5O_attr_write(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr) /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -944,7 +944,7 @@ H5O_attr_write(const H5O_loc_t *loc, hid_t dxpl_id, H5A_t *attr) done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0) - HDONE_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_write */ @@ -1036,7 +1036,7 @@ H5O_attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, if(H5A_set_version(udata->f, ((H5A_t *)mesg->native)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5_ITER_ERROR, "unable to update attribute version") - /* Mark message as dirty */ + /* Mark the message as modified */ mesg->dirty = TRUE; /* Check for shared message */ @@ -1132,7 +1132,7 @@ H5O_attr_rename(const H5O_loc_t *loc, hid_t dxpl_id, const char *old_name, /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -1189,7 +1189,7 @@ H5O_attr_rename(const H5O_loc_t *loc, hid_t dxpl_id, const char *old_name, done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0) - HDONE_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_rename */ @@ -1227,7 +1227,7 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id, /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -1245,7 +1245,7 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id, /* Release the object header */ if(H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") oh = NULL; /* Iterate over attributes in dense storage */ @@ -1259,7 +1259,7 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id, /* Release the object header */ if(H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") oh = NULL; /* Check for skipping too many attributes */ @@ -1274,7 +1274,7 @@ H5O_attr_iterate_real(hid_t loc_id, const H5O_loc_t *loc, hid_t dxpl_id, done: /* Release resources */ if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") if(atable.attrs && H5A_attr_release_table(&atable) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table") @@ -1402,8 +1402,7 @@ H5O_attr_remove_update(const H5O_loc_t *loc, H5O_t *oh, H5O_ainfo_t *ainfo, /* Insert attribute message into object header (Will increment reference count on shared attributes) */ /* Find out whether the attribute has been opened */ - if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, - (atable.attrs[u])->shared->name)) < 0) + if((found_open_attr = H5O_attr_find_opened_attr(loc, &exist_attr, (atable.attrs[u])->shared->name)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "failed in finding opened attribute") /* If found the attribute is already opened, use the opened message to insert. @@ -1523,7 +1522,7 @@ H5O_attr_remove(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -1574,7 +1573,7 @@ H5O_attr_remove(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0) - HDONE_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_remove() */ @@ -1611,7 +1610,7 @@ H5O_attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -1670,7 +1669,7 @@ H5O_attr_remove_by_idx(const H5O_loc_t *loc, H5_index_t idx_type, done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, oh_flags) < 0) - HDONE_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") if(atable.attrs && H5A_attr_release_table(&atable) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "unable to release attribute table") @@ -1799,7 +1798,7 @@ H5O_attr_exists(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; @@ -1837,7 +1836,7 @@ H5O_attr_exists(const H5O_loc_t *loc, const char *name, hid_t dxpl_id) done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_exists */ @@ -1953,7 +1952,7 @@ H5O_attr_count(const H5O_loc_t *loc, hid_t dxpl_id) /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_ATTR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Retrieve # of attributes on object */ if(H5O_attr_count_real(loc->file, dxpl_id, oh, &nattrs) < 0) @@ -1964,7 +1963,7 @@ H5O_attr_count(const H5O_loc_t *loc, hid_t dxpl_id) done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_ATTR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_ATTR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_attr_count */ diff --git a/src/H5Ocache.c b/src/H5Ocache.c index c0c1bfa..0709e60 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -135,9 +135,9 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, haddr_t eoa; /* Relative end of file address */ H5O_t *ret_value; /* Return value */ - FUNC_ENTER_NOAPI(H5O_load, NULL) + FUNC_ENTER_NOAPI_NOINIT(H5O_load) - /* check args */ + /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); HDassert(!_udata1); @@ -155,7 +155,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, HGOTO_ERROR(H5E_OHDR, H5E_READERROR, NULL, "unable to read object header") p = read_buf; - /* allocate ohdr and init chunk list */ + /* Allocate space for the object header data structure */ if(NULL == (oh = H5FL_CALLOC(H5O_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") @@ -163,7 +163,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, oh->sizeof_size = H5F_SIZEOF_SIZE(f); oh->sizeof_addr = H5F_SIZEOF_ADDR(f); - /* Check for magic number */ + /* Check for presence of magic number */ /* (indicates version 2 or later) */ if(!HDmemcmp(p, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* Magic number */ @@ -268,12 +268,12 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, (nmesgs == 0 && chunk_size > 0)) HGOTO_ERROR(H5E_OHDR, H5E_VERSION, NULL, "bad object header chunk size") - /* Reserved, in version 1 */ + /* Reserved, in version 1 (for 8-byte alignment padding) */ p += 4; } /* end else */ /* Determine object header prefix length */ - prefix_size = (size_t)(p - read_buf); + prefix_size = (size_t)(p - (const uint8_t *)read_buf); HDassert((size_t)prefix_size == (size_t)(H5O_SIZEOF_HDR(oh) - H5O_SIZEOF_CHKSUM_OH(oh))); /* Compute first chunk address */ @@ -282,7 +282,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, /* Allocate the message array */ oh->alloc_nmesgs = (nmesgs > 0) ? nmesgs : 1; if(NULL == (oh->mesg = H5FL_SEQ_MALLOC(H5O_mesg_t, oh->alloc_nmesgs))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "memory allocation failed") /* Read each chunk from disk */ while(H5F_addr_defined(chunk_addr)) { @@ -298,7 +298,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, H5O_chunk_t *x = H5FL_SEQ_REALLOC(H5O_chunk_t, oh->chunk, (size_t)na); if(!x) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "memory allocation failed") oh->alloc_nchunks = na; oh->chunk = x; } /* end if */ @@ -317,7 +317,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, oh->chunk[chunkno].size = chunk_size; } /* end else */ if(NULL == (oh->chunk[chunkno].image = H5FL_BLK_MALLOC(chunk_image, oh->chunk[chunkno].size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "memory allocation failed") /* Handle chunk 0 as special case */ if(chunkno == 0) { @@ -401,7 +401,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, if(oh->version == H5O_VERSION_1) p += 3; /*reserved*/ else { - /* Only encode creation index if they are being tracked */ + /* Only decode creation index if they are being tracked */ if(oh->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) UINT16DECODE(p, crt_idx); } /* end else */ @@ -434,7 +434,7 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, /* Check if we need to extend message table to hold the new message */ if(oh->nmesgs >= oh->alloc_nmesgs) if(H5O_alloc_msgs(oh, (size_t)1) < 0) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate more space for messages") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "can't allocate more space for messages") /* Get index for message */ mesgno = oh->nmesgs++; @@ -455,12 +455,12 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1, /* Allocate "unknown" message info */ if(NULL == (unknown = H5FL_MALLOC(H5O_unknown_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "memory allocation failed") /* Save the original message type ID */ *unknown = id; - /* Save 'native' form of continuation message */ + /* Save 'native' form of unknown message */ oh->mesg[mesgno].native = unknown; /* Set message to "unknown" class */ @@ -646,22 +646,16 @@ done: * matzke@llnl.gov * Aug 5 1997 * - * Changes: JRM -- 8/21/06 - * Added the flags_ptr parameter. This parameter exists to - * allow the flush routine to report to the cache if the - * entry is resized or renamed as a result of the flush. - * *flags_ptr is set to H5C_CALLBACK__NO_FLAGS_SET on entry. - * *------------------------------------------------------------------------- */ static herr_t H5O_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t UNUSED addr, H5O_t *oh, unsigned UNUSED * flags_ptr) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5O_flush, FAIL) + FUNC_ENTER_NOAPI_NOINIT(H5O_flush) - /* check args */ + /* Check arguments */ HDassert(f); HDassert(H5F_addr_defined(addr)); HDassert(oh); diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 807d147..e0bc7d5 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -44,6 +44,7 @@ #include "H5Opkg.h" /* Object headers */ #include "H5Pprivate.h" /* Property lists */ + /****************/ /* Local Macros */ /****************/ @@ -316,7 +317,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, /* Get source object header */ if(NULL == (oh_src = (H5O_t *)H5AC_protect(oloc_src->file, dxpl_id, H5AC_OHDR, oloc_src->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Get pointer to object class for this object */ if(NULL == (obj_class = H5O_obj_class_real(oh_src))) @@ -451,7 +452,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, if(cpy_info->preserve_null && deleted[mesgno]) { mesg_dst->type = H5O_MSG_NULL; mesg_dst->flags = 0; - mesg_dst->dirty = 1; + mesg_dst->dirty = TRUE; } /* end if */ /* Check for message class to operate on */ @@ -720,7 +721,8 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */, /* Insert destination object header in cache */ if(H5AC_set(oloc_dst->file, dxpl_id, H5AC_OHDR, oloc_dst->addr, oh_dst, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to cache object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "unable to cache object header") + oh_dst = NULL; done: /* Free deleted array */ @@ -731,7 +733,7 @@ done: if(oh_src != NULL) { /* Unprotect the source object header */ if(H5AC_unprotect(oloc_src->file, dxpl_id, H5AC_OHDR, oloc_src->addr, oh_src, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") } /* end if */ /* Release pointer to destination object header */ diff --git a/src/H5Odbg.c b/src/H5Odbg.c index cd041e0..b731ce9 100644 --- a/src/H5Odbg.c +++ b/src/H5Odbg.c @@ -534,8 +534,8 @@ done: herr_t H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth) { - H5O_t *oh = NULL; - herr_t ret_value = SUCCEED; + H5O_t *oh = NULL; /* Object header to display */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5O_debug, FAIL) @@ -547,14 +547,14 @@ H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f HDassert(fwidth >= 0); if(NULL == (oh = (H5O_t *)H5AC_protect(f, dxpl_id, H5AC_OHDR, addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* debug */ H5O_debug_real(f, dxpl_id, oh, addr, stream, indent, fwidth); done: if(oh && H5AC_unprotect(f, dxpl_id, H5AC_OHDR, addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_debug() */ diff --git a/src/H5Ofill.c b/src/H5Ofill.c index d133a0a..f403b81 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -556,7 +556,7 @@ H5O_fill_copy(const void *_src, void *_dst) H5I_dec_ref(src_id, FALSE); H5I_dec_ref(dst_id, FALSE); if(bkg_buf) - (void)H5FL_BLK_FREE(type_conv, bkg_buf); + bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf); HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, NULL, "datatype conversion failed") } /* end if */ @@ -564,7 +564,7 @@ H5O_fill_copy(const void *_src, void *_dst) H5I_dec_ref(src_id, FALSE); H5I_dec_ref(dst_id, FALSE); if(bkg_buf) - (void)H5FL_BLK_FREE(type_conv, bkg_buf); + bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf); } /* end if */ } /* end if */ } /* end if */ diff --git a/src/H5Omessage.c b/src/H5Omessage.c index 4a9ecb5..02379e4 100644 --- a/src/H5Omessage.c +++ b/src/H5Omessage.c @@ -133,7 +133,7 @@ H5O_msg_create(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, /* Protect the object header */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Go append message to object header */ if(H5O_msg_append_oh(loc->file, dxpl_id, oh, type_id, mesg_flags, update_flags, mesg) < 0) @@ -141,7 +141,7 @@ H5O_msg_create(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_create() */ @@ -286,7 +286,7 @@ H5O_msg_write(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, /* Protect the object header */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Call the "real" modify routine */ if(H5O_msg_write_real(loc->file, dxpl_id, oh, type, mesg_flags, update_flags, mesg) < 0) @@ -294,7 +294,7 @@ H5O_msg_write(const H5O_loc_t *loc, unsigned type_id, unsigned mesg_flags, done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_write() */ @@ -485,7 +485,7 @@ H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg, /* Get the object header */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to load object header") /* Call the "real" read routine */ if(NULL == (ret_value = H5O_msg_read_oh(loc->file, dxpl_id, oh, type_id, mesg))) @@ -493,7 +493,7 @@ H5O_msg_read(const H5O_loc_t *loc, unsigned type_id, void *mesg, done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, NULL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTPROTECT, NULL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_read() */ @@ -810,14 +810,14 @@ H5O_msg_count(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) /* Load the object header */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Count the messages of the correct type */ ret_value = H5O_msg_count_real(oh, type); done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_count() */ @@ -891,7 +891,7 @@ H5O_msg_exists(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) /* Load the object header */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Call the "real" exists routine */ if((ret_value = H5O_msg_exists_oh(oh, type_id)) < 0) @@ -899,7 +899,7 @@ H5O_msg_exists(const H5O_loc_t *loc, unsigned type_id, hid_t dxpl_id) done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) != SUCCEED) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_exists() */ @@ -988,7 +988,7 @@ H5O_msg_remove(const H5O_loc_t *loc, unsigned type_id, int sequence, hbool_t adj /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Call the "real" remove routine */ if((ret_value = H5O_msg_remove_real(loc->file, oh, type, sequence, NULL, NULL, adj_link, dxpl_id)) < 0) @@ -996,7 +996,7 @@ H5O_msg_remove(const H5O_loc_t *loc, unsigned type_id, int sequence, hbool_t adj done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_remove() */ @@ -1040,7 +1040,7 @@ H5O_msg_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence, /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_WRITE))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Call the "real" remove routine */ if((ret_value = H5O_msg_remove_real(loc->file, oh, type, sequence, op, op_data, adj_link, dxpl_id)) < 0) @@ -1048,7 +1048,7 @@ H5O_msg_remove_op(const H5O_loc_t *loc, unsigned type_id, int sequence, done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_remove_op() */ @@ -1231,7 +1231,7 @@ H5O_msg_iterate(const H5O_loc_t *loc, unsigned type_id, /* Protect the object header to iterate over */ if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Call the "real" iterate routine */ if((ret_value = H5O_msg_iterate_real(loc->file, oh, type, op, op_data, dxpl_id)) < 0) @@ -1239,7 +1239,7 @@ H5O_msg_iterate(const H5O_loc_t *loc, unsigned type_id, done: if(oh && H5AC_unprotect(loc->file, dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* end H5O_msg_iterate() */ @@ -1988,8 +1988,10 @@ H5O_copy_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *oh, unsigned idx, if(NULL == (idx_msg->native = (type->copy)(mesg, idx_msg->native))) HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to copy message to object header") - /* Update the message flags and mark the message as modified */ + /* Update the message flags */ idx_msg->flags = mesg_flags; + + /* Mark the message as modified */ idx_msg->dirty = TRUE; /* Update the modification time, if requested */ diff --git a/src/H5Opkg.h b/src/H5Opkg.h index ce2c5f1..262386a 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -222,8 +222,8 @@ struct H5O_msg_class_t { const char *name; /*for debugging */ size_t native_size; /*size of native message */ unsigned share_flags; /* Message sharing settings */ - void *(*decode)(H5F_t*, hid_t, H5O_t *, unsigned, unsigned *, const uint8_t *); - herr_t (*encode)(H5F_t*, hbool_t, uint8_t*, const void *); + void *(*decode)(H5F_t *, hid_t, H5O_t *, unsigned, unsigned *, const uint8_t *); + herr_t (*encode)(H5F_t *, hbool_t, uint8_t *, const void *); void *(*copy)(const void *, void *); /*copy native value */ size_t (*raw_size)(const H5F_t *, hbool_t, const void *);/*sizeof encoded message */ herr_t (*reset)(void *); /*free nested data structs */ @@ -260,7 +260,7 @@ typedef struct H5O_chunk_t { } H5O_chunk_t; struct H5O_t { - H5AC_info_t cache_info; /* Information for H5AC cache functions, _must_ be */ + H5AC_info_t cache_info; /* Information for metadata cache functions, _must_ be */ /* first field in structure */ /* File-specific information (not stored) */ diff --git a/src/H5Otest.c b/src/H5Otest.c index c7cd8a9..5282538 100644 --- a/src/H5Otest.c +++ b/src/H5Otest.c @@ -97,24 +97,24 @@ H5O_is_attr_dense_test(hid_t oid) { H5O_t *oh = NULL; /* Object header */ H5O_ainfo_t ainfo; /* Attribute information for object */ - H5O_loc_t *oloc; /* Pointer to object's location */ + H5O_loc_t *loc; /* Pointer to object's location */ htri_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5O_is_attr_dense_test, FAIL) /* Get object location for object */ - if(NULL == (oloc = H5O_get_loc(oid))) + if(NULL == (loc = H5O_get_loc(oid))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") /* Get the object header */ - if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; if(oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ - if(H5A_get_ainfo(oloc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0) + if(H5A_get_ainfo(loc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") } /* end if */ @@ -129,8 +129,8 @@ H5O_is_attr_dense_test(hid_t oid) ret_value = FALSE; done: - if(oh && H5AC_unprotect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* H5O_is_attr_dense_test() */ @@ -161,24 +161,24 @@ H5O_is_attr_empty_test(hid_t oid) H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ H5O_ainfo_t ainfo; /* Attribute information for object */ htri_t ainfo_exists = FALSE; /* Whether the attribute info exists in the file */ - H5O_loc_t *oloc; /* Pointer to object's location */ + H5O_loc_t *loc; /* Pointer to object's location */ hsize_t nattrs; /* Number of attributes */ htri_t ret_value; /* Return value */ FUNC_ENTER_NOAPI(H5O_is_attr_empty_test, FAIL) /* Get object location for object */ - if(NULL == (oloc = H5O_get_loc(oid))) + if(NULL == (loc = H5O_get_loc(oid))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") /* Get the object header */ - if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ if(oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ - if((ainfo_exists = H5A_get_ainfo(oloc->file, H5AC_ind_dxpl_id, oh, &ainfo)) < 0) + if((ainfo_exists = H5A_get_ainfo(loc->file, H5AC_ind_dxpl_id, oh, &ainfo)) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") } /* end if */ @@ -194,7 +194,7 @@ H5O_is_attr_empty_test(hid_t oid) HDassert(nattrs == 0); /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(oloc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL))) + if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Retrieve # of records in name index */ @@ -216,8 +216,8 @@ done: /* Release resources */ if(bt2_name && H5B2_close(bt2_name, H5AC_ind_dxpl_id) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") - if(oh && H5AC_unprotect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* H5O_is_attr_empty_test() */ @@ -248,25 +248,25 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) H5O_t *oh = NULL; /* Object header */ H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ H5O_ainfo_t ainfo; /* Attribute information for object */ - H5O_loc_t *oloc; /* Pointer to object's location */ + H5O_loc_t *loc; /* Pointer to object's location */ hsize_t obj_nattrs; /* Number of attributes */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5O_num_attrs_test, FAIL) /* Get object location for object */ - if(NULL == (oloc = H5O_get_loc(oid))) + if(NULL == (loc = H5O_get_loc(oid))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") /* Get the object header */ - if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; if(oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ - if(H5A_get_ainfo(oloc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0) + if(H5A_get_ainfo(loc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") } /* end if */ @@ -281,7 +281,7 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs) HDassert(obj_nattrs == 0); /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(oloc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL))) + if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Retrieve # of records in name index */ @@ -300,8 +300,8 @@ done: /* Release resources */ if(bt2_name && H5B2_close(bt2_name, H5AC_ind_dxpl_id) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") - if(oh && H5AC_unprotect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* H5O_num_attrs_test() */ @@ -335,24 +335,24 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */ H5B2_t *bt2_corder = NULL; /* v2 B-tree handle for creation order index */ H5O_ainfo_t ainfo; /* Attribute information for object */ - H5O_loc_t *oloc; /* Pointer to object's location */ + H5O_loc_t *loc; /* Pointer to object's location */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5O_attr_dense_info_test, FAIL) /* Get object location for object */ - if(NULL == (oloc = H5O_get_loc(oid))) + if(NULL == (loc = H5O_get_loc(oid))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") /* Get the object header */ - if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Check for attribute info stored */ ainfo.fheap_addr = HADDR_UNDEF; if(oh->version > H5O_VERSION_1) { /* Check for (& retrieve if available) attribute info */ - if(H5A_get_ainfo(oloc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0) + if(H5A_get_ainfo(loc->file, H5AC_ind_dxpl_id, oh, &ainfo) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't check for attribute info message") } /* end if */ @@ -363,7 +363,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) HGOTO_DONE(FAIL) /* Open the name index v2 B-tree */ - if(NULL == (bt2_name = H5B2_open(oloc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL))) + if(NULL == (bt2_name = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.name_bt2_addr, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index") /* Retrieve # of records in name index */ @@ -373,7 +373,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count) /* Check if there is a creation order index */ if(H5F_addr_defined(ainfo.corder_bt2_addr)) { /* Open the creation order index v2 B-tree */ - if(NULL == (bt2_corder = H5B2_open(oloc->file, H5AC_ind_dxpl_id, ainfo.corder_bt2_addr, NULL))) + if(NULL == (bt2_corder = H5B2_open(loc->file, H5AC_ind_dxpl_id, ainfo.corder_bt2_addr, NULL))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index") /* Retrieve # of records in creation order index */ @@ -389,8 +389,8 @@ done: HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for name index") if(bt2_corder && H5B2_close(bt2_corder, H5AC_ind_dxpl_id) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTCLOSEOBJ, FAIL, "can't close v2 B-tree for creation order index") - if(oh && H5AC_unprotect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* H5O_attr_dense_info_test() */ @@ -421,7 +421,7 @@ herr_t H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val) { H5O_t *oh = NULL; /* Object header */ - H5O_loc_t *oloc; /* Pointer to object's location */ + H5O_loc_t *loc; /* Pointer to object's location */ H5O_mesg_t *idx_msg; /* Pointer to message */ unsigned idx; /* Index of message */ herr_t ret_value = SUCCEED; /* Return value */ @@ -429,12 +429,12 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val) FUNC_ENTER_NOAPI(H5O_check_msg_marked_test, FAIL) /* Get object location for object */ - if(NULL == (oloc = H5O_get_loc(oid))) + if(NULL == (loc = H5O_get_loc(oid))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "object not found") /* Get the object header */ - if(NULL == (oh = (H5O_t *)H5AC_protect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to load object header") + if(NULL == (oh = (H5O_t *)H5AC_protect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, NULL, NULL, H5AC_READ))) + HGOTO_ERROR(H5E_OHDR, H5E_CANTPROTECT, FAIL, "unable to load object header") /* Locate "unknown" message */ for(idx = 0, idx_msg = &oh->mesg[0]; idx < oh->nmesgs; idx++, idx_msg++) @@ -452,8 +452,8 @@ H5O_check_msg_marked_test(hid_t oid, hbool_t flag_val) HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "'unknown' message type not found") done: - if(oh && H5AC_unprotect(oloc->file, H5AC_ind_dxpl_id, H5AC_OHDR, oloc->addr, oh, H5AC__NO_FLAGS_SET) < 0) - HDONE_ERROR(H5E_OHDR, H5E_PROTECT, FAIL, "unable to release object header") + if(oh && H5AC_unprotect(loc->file, H5AC_ind_dxpl_id, H5AC_OHDR, loc->addr, oh, H5AC__NO_FLAGS_SET) < 0) + HDONE_ERROR(H5E_OHDR, H5E_CANTUNPROTECT, FAIL, "unable to release object header") FUNC_LEAVE_NOAPI(ret_value) } /* H5O_check_msg_marked_test() */ diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 84ef3d4..82053e4 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -1469,13 +1469,13 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value) /* Convert the fill value */ if(H5T_convert(tpath, type_id, type_id, (size_t)1, (size_t)0, (size_t)0, fill.buf, bkg_buf, H5AC_ind_dxpl_id) < 0) { if(bkg_buf) - (void)H5FL_BLK_FREE(type_conv, bkg_buf); + bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf); HGOTO_ERROR(H5E_DATASET, H5E_CANTCONVERT, FAIL, "datatype conversion failed") } /* end if */ /* Release the background buffer */ if(bkg_buf) - (void)H5FL_BLK_FREE(type_conv, bkg_buf); + bkg_buf = H5FL_BLK_FREE(type_conv, bkg_buf); } /* end if */ } /* end if */ else diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index 486bda3..5d73afe 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -1336,27 +1336,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5Pset_mdc_config(hid_t plist_id, - H5AC_cache_config_t *config_ptr) +H5Pset_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr) { H5P_genplist_t *plist; /* Property list pointer */ - herr_t ret_value=SUCCEED; /* return value */ + herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_API(H5Pset_mdc_config, FAIL); + FUNC_ENTER_API(H5Pset_mdc_config, FAIL) H5TRACE2("e", "i*x", plist_id, config_ptr); /* Get the plist structure */ - if( NULL == ( plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS) ) ) { - - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - } + if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* validate the new configuration */ - if ( H5AC_validate_config(config_ptr) < 0 ) { - - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, \ - "invalid metadata cache configuration"); - } + if(H5AC_validate_config(config_ptr) < 0) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid metadata cache configuration") /* set the modified config */ @@ -1364,16 +1358,11 @@ H5Pset_mdc_config(hid_t plist_id, * will have to test the version and do translation here. */ - if(H5P_set(plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, config_ptr)<0) { - - HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, \ - "can't set metadata cache initial config"); - } + if(H5P_set(plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, config_ptr) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "can't set metadata cache initial config") done: - FUNC_LEAVE_API(ret_value); - } /* H5Pset_mdc_config() */ @@ -1398,33 +1387,25 @@ done: * *------------------------------------------------------------------------- */ - herr_t -H5Pget_mdc_config(hid_t plist_id, - H5AC_cache_config_t *config_ptr) +H5Pget_mdc_config(hid_t plist_id, H5AC_cache_config_t *config_ptr) { H5P_genplist_t *plist; /* Property list pointer */ herr_t ret_value = SUCCEED; /* return value */ - FUNC_ENTER_API(H5Pget_mdc_config, FAIL); + FUNC_ENTER_API(H5Pget_mdc_config, FAIL) H5TRACE2("e", "i*x", plist_id, config_ptr); /* Get the plist structure */ - if ( NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS)) ) { - - HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID"); - } + if(NULL == (plist = H5P_object_verify(plist_id,H5P_FILE_ACCESS))) + HGOTO_ERROR(H5E_ATOM, H5E_BADATOM, FAIL, "can't find object for ID") /* validate the config_ptr */ - if ( config_ptr == NULL ) { - + if(config_ptr == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL config_ptr on entry.") - } - - if ( config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION ) { + if(config_ptr->version != H5AC__CURR_CACHE_CONFIG_VERSION) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unknown config version.") - } /* If we ever support multiple versions of H5AC_cache_config_t, we * will have to get the cannonical version here, and then translate @@ -1432,16 +1413,11 @@ H5Pget_mdc_config(hid_t plist_id, */ /* Get the current initial metadata cache resize configuration */ - if ( H5P_get(plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, config_ptr) < 0 ) { - - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, \ - "can't get metadata cache initial resize config"); - } + if(H5P_get(plist, H5F_ACS_META_CACHE_INIT_CONFIG_NAME, config_ptr) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET,FAIL, "can't get metadata cache initial resize config") done: - - FUNC_LEAVE_API(ret_value); - + FUNC_LEAVE_API(ret_value) } /* H5Pget_mdc_config() */ @@ -19,7 +19,6 @@ #define H5_INTERFACE_INIT_FUNC H5S_init_interface -#define _H5S_IN_H5S_C #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ #include "H5Fprivate.h" /* Files */ @@ -1466,7 +1465,7 @@ H5S_encode(H5S_t *obj, unsigned char *buf, size_t *nalloc) FUNC_ENTER_NOAPI_NOINIT(H5S_encode) /* Allocate "fake" file structure */ - if(NULL == (f = H5F_fake_alloc((size_t)0))) + if(NULL == (f = H5F_fake_alloc((uint8_t)0))) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct") /* Find out the size of buffer needed for extent */ @@ -1577,7 +1576,7 @@ H5S_decode(const unsigned char *buf) H5S_extent_t *extent; size_t extent_size; /* size of the extent message*/ H5F_t *f = NULL; /* Fake file structure*/ - size_t sizeof_size; /* 'Size of sizes' for file */ + uint8_t sizeof_size; /* 'Size of sizes' for file */ H5S_t *ret_value; FUNC_ENTER_NOAPI_NOINIT(H5S_decode) @@ -1858,9 +1857,9 @@ done: hbool_t H5S_has_extent(const H5S_t *ds) { - htri_t ret_value; + hbool_t ret_value; - FUNC_ENTER_NOAPI(H5S_has_extent, FAIL) + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5S_has_extent) HDassert(ds); @@ -1869,7 +1868,6 @@ H5S_has_extent(const H5S_t *ds) else ret_value = TRUE; -done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5S_has_extent() */ @@ -2248,7 +2248,7 @@ H5SM_read_mesg(H5F_t *f, const H5SM_sohm_t *mesg, H5HF_t *fheap, /* Load the object header from the cache */ if(NULL == (oh = (H5O_t *)H5AC_protect(oloc.file, dxpl_id, H5AC_OHDR, oloc.addr, NULL, NULL, H5AC_READ))) - HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, FAIL, "unable to load object header") + HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load object header") } /* end if */ else oh = open_oh; diff --git a/src/H5SMcache.c b/src/H5SMcache.c index 1380e71..070b00e 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -175,7 +175,7 @@ H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1 /* Don't count the checksum in the table size yet, since it comes after * all of the index headers */ - HDassert((size_t)(p - buf) == H5SM_TABLE_SIZE(f) - H5SM_SIZEOF_CHECKSUM); + HDassert((size_t)(p - (const uint8_t *)buf) == H5SM_TABLE_SIZE(f) - H5SM_SIZEOF_CHECKSUM); /* Allocate space for the index headers in memory*/ if(NULL == (table->indexes = (H5SM_index_header_t *)H5FL_ARR_MALLOC(H5SM_index_header_t, (size_t)table->num_indexes))) @@ -216,7 +216,7 @@ H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1 UINT32DECODE(p, stored_chksum); /* Sanity check */ - HDassert((size_t)(p - buf) == size); + HDassert((size_t)(p - (const uint8_t *)buf) == size); /* Compute checksum on entire header */ computed_chksum = H5_checksum_metadata(buf, (size - H5SM_SIZEOF_CHECKSUM), 0); @@ -257,7 +257,7 @@ H5SM_table_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_ma { H5WB_t *wb = NULL; /* Wrapped buffer for table data */ uint8_t tbl_buf[H5SM_TBL_BUF_SIZE]; /* Buffer for table */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT(H5SM_table_flush) diff --git a/src/H5Sall.c b/src/H5Sall.c index 1c086b9..714624d 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -630,7 +630,7 @@ H5S_all_bounds(const H5S_t *space, hsize_t *start, hsize_t *end) REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_all_offset(const H5S_t *space, hsize_t *offset) +H5S_all_offset(const H5S_t UNUSED *space, hsize_t *offset) { FUNC_ENTER_NOAPI_NOFUNC(H5S_all_offset) diff --git a/src/H5Snone.c b/src/H5Snone.c index fdea677..c6e8a6a 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -586,7 +586,7 @@ H5S_none_bounds(const H5S_t UNUSED *space, hsize_t UNUSED *start, hsize_t UNUSED REVISION LOG --------------------------------------------------------------------------*/ herr_t -H5S_none_offset(const H5S_t *space, hsize_t *offset) +H5S_none_offset(const H5S_t UNUSED *space, hsize_t UNUSED *offset) { FUNC_ENTER_NOAPI_NOFUNC(H5S_none_offset) diff --git a/src/H5Sprivate.h b/src/H5Sprivate.h index fac5e1e..2858ddb 100644 --- a/src/H5Sprivate.h +++ b/src/H5Sprivate.h @@ -260,11 +260,9 @@ H5_DLL herr_t H5S_select_iter_next(H5S_sel_iter_t *sel_iter, size_t nelem); H5_DLL herr_t H5S_select_iter_release(H5S_sel_iter_t *sel_iter); #ifdef H5_HAVE_PARALLEL -#ifndef _H5S_IN_H5S_C /* Global vars whose value comes from environment variable */ /* (Defined in H5S.c) */ H5_DLLVAR hbool_t H5S_mpi_opt_types_g; -#endif /* _H5S_IN_H5S_C */ H5_DLL herr_t H5S_mpio_space_type( const H5S_t *space, size_t elmt_size, @@ -2367,7 +2367,7 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, } /* end if */ H5T_close(old_path->src); H5T_close(old_path->dst); - H5FL_FREE(H5T_path_t,old_path); + old_path = H5FL_FREE(H5T_path_t, old_path); /* Release temporary atoms */ H5I_dec_ref(tmp_sid, FALSE); @@ -2380,17 +2380,17 @@ H5T_register(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, } /* end else */ done: - if (ret_value<0) { - if (new_path) { - if (new_path->src) + if(ret_value < 0) { + if(new_path) { + if(new_path->src) H5T_close(new_path->src); - if (new_path->dst) + if(new_path->dst) H5T_close(new_path->dst); - H5FL_FREE(H5T_path_t,new_path); + new_path = H5FL_FREE(H5T_path_t, new_path); } /* end if */ - if (tmp_sid>=0) + if(tmp_sid >= 0) H5I_dec_ref(tmp_sid, FALSE); - if (tmp_did>=0) + if(tmp_did >= 0) H5I_dec_ref(tmp_did, FALSE); } /* end if */ @@ -2541,7 +2541,7 @@ H5T_unregister(H5T_pers_t pers, const char *name, H5T_t *src, H5T_t *dst, } H5T_close(path->src); H5T_close(path->dst); - H5FL_FREE(H5T_path_t,path); + path = H5FL_FREE(H5T_path_t, path); H5E_clear_stack(NULL); /*ignore all shutdown errors*/ } /* end else */ } /* end for */ @@ -2862,7 +2862,7 @@ H5T_encode(H5T_t *obj, unsigned char *buf, size_t *nalloc) FUNC_ENTER_NOAPI_NOINIT(H5T_encode) /* Allocate "fake" file structure */ - if(NULL == (f = H5F_fake_alloc((size_t)0))) + if(NULL == (f = H5F_fake_alloc((uint8_t)0))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "can't allocate fake file struct") /* Find out the size of buffer needed */ @@ -2918,7 +2918,7 @@ H5T_decode(const unsigned char *buf) FUNC_ENTER_NOAPI_NOINIT(H5T_decode) /* Allocate "fake" file structure */ - if(NULL == (f = H5F_fake_alloc((size_t)0))) + if(NULL == (f = H5F_fake_alloc((uint8_t)0))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, NULL, "can't allocate fake file struct") /* Decode the type of the information */ @@ -3041,8 +3041,8 @@ H5T_create(H5T_class_t type, size_t size) done: if(NULL == ret_value) { if(dt) { - H5FL_FREE(H5T_shared_t, dt->shared); - H5FL_FREE(H5T_t,dt); + dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); + dt = H5FL_FREE(H5T_t, dt); } /* end if */ } /* end if */ @@ -3331,8 +3331,8 @@ done: if(ret_value == NULL) { if(new_dt) { if(new_dt->shared) - H5FL_FREE(H5T_shared_t, new_dt->shared); - H5FL_FREE(H5T_t, new_dt); + new_dt->shared = H5FL_FREE(H5T_shared_t, new_dt->shared); + new_dt = H5FL_FREE(H5T_t, new_dt); } /* end if */ } /* end if */ @@ -3425,8 +3425,8 @@ done: if(ret_value == NULL) if(dt) { if(dt->shared) - H5FL_FREE(H5T_shared_t, dt->shared); - H5FL_FREE(H5T_t, dt); + dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); + dt = H5FL_FREE(H5T_t, dt); } /* end if */ FUNC_LEAVE_NOAPI(ret_value) @@ -3562,7 +3562,7 @@ H5T_close(H5T_t *dt) if(H5T_free(dt) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFREE, FAIL, "unable to free datatype"); - H5FL_FREE(H5T_shared_t, dt->shared); + dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); } else { /* * If a named type is being closed then close the object header and @@ -3588,7 +3588,7 @@ H5T_close(H5T_t *dt) } /* end else */ /* Free the datatype struct */ - H5FL_FREE(H5T_t,dt); + dt = H5FL_FREE(H5T_t, dt); done: FUNC_LEAVE_NOAPI(ret_value) @@ -4482,7 +4482,7 @@ H5T_path_find(const H5T_t *src, const H5T_t *dst, const char *name, H5T_close(table->src); if(table->dst) H5T_close(table->dst); - H5FL_FREE(H5T_path_t, table); + table = H5FL_FREE(H5T_path_t, table); table = path; H5T_g.path[md] = path; } else if(path != table) { @@ -4518,7 +4518,7 @@ done: H5T_close(path->src); if(path->dst) H5T_close(path->dst); - H5FL_FREE(H5T_path_t, path); + path = H5FL_FREE(H5T_path_t, path); } /* end if */ if(src_id >= 0) H5I_dec_ref(src_id, FALSE); diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index dea6bed..46a1ac8 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -770,12 +770,12 @@ done: if(ret_value == NULL) { if(dt) { if(shared_fo == NULL) /* Need to free shared fo */ - H5FL_FREE(H5T_shared_t, dt->shared); + dt->shared = H5FL_FREE(H5T_shared_t, dt->shared); H5O_loc_free(&(dt->oloc)); H5G_name_free(&(dt->path)); - H5FL_FREE(H5T_t, dt); + dt = H5FL_FREE(H5T_t, dt); } /* end if */ if(shared_fo) diff --git a/src/H5Tconv.c b/src/H5Tconv.c index ecf93e1..bfa5d56 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -3185,13 +3185,13 @@ H5T_conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, done: /* If the conversion buffer doesn't need to be freed, reset its pointer */ if(write_to_file && noop_conv) - conv_buf=NULL; + conv_buf = NULL; /* Release the conversion buffer (always allocated, except on errors) */ - if(conv_buf!=NULL) - H5FL_BLK_FREE(vlen_seq,conv_buf); + if(conv_buf) + conv_buf = H5FL_BLK_FREE(vlen_seq, conv_buf); /* Release the background buffer, if we have one */ - if(tmp_buf!=NULL) - H5FL_BLK_FREE(vlen_seq,tmp_buf); + if(tmp_buf) + tmp_buf = H5FL_BLK_FREE(vlen_seq, tmp_buf); FUNC_LEAVE_NOAPI(ret_value) } @@ -3337,7 +3337,7 @@ H5T_conv_array(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, done: /* Release the background buffer, if we have one */ if(bkg_buf) - H5FL_BLK_FREE(array_seq, bkg_buf); + bkg_buf = H5FL_BLK_FREE(array_seq, bkg_buf); FUNC_LEAVE_NOAPI(ret_value) } /* end H5T_conv_array() */ diff --git a/src/H5Tcset.c b/src/H5Tcset.c index c938cd2..4ec58ab 100644 --- a/src/H5Tcset.c +++ b/src/H5Tcset.c @@ -75,14 +75,14 @@ H5T_init_cset_interface(void) H5T_cset_t H5Tget_cset(hid_t type_id) { - H5T_t *dt = NULL; + H5T_t *dt; H5T_cset_t ret_value; FUNC_ENTER_API(H5Tget_cset, H5T_CSET_ERROR) H5TRACE1("Tc", "i", type_id); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5T_CSET_ERROR, "not a data type") while (dt->shared->parent && !H5T_IS_STRING(dt->shared)) dt = dt->shared->parent; /*defer to parent*/ @@ -121,14 +121,14 @@ done: herr_t H5Tset_cset(hid_t type_id, H5T_cset_t cset) { - H5T_t *dt = NULL; + H5T_t *dt; herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(H5Tset_cset, FAIL) H5TRACE2("e", "iTc", type_id, cset); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a data type") if (H5T_STATE_TRANSIENT!=dt->shared->state) HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only") diff --git a/src/H5Tdeprec.c b/src/H5Tdeprec.c index 0314a38..9d9ad36 100644 --- a/src/H5Tdeprec.c +++ b/src/H5Tdeprec.c @@ -136,7 +136,7 @@ H5Tcommit1(hid_t loc_id, const char *name, hid_t type_id) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a location") if(!name || !*name) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name") - if(NULL == (type = H5I_object_verify(type_id, H5I_DATATYPE))) + if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") /* Commit the datatype to the file, using default property list values */ diff --git a/src/H5Toffset.c b/src/H5Toffset.c index 5495368..17351f4 100644 --- a/src/H5Toffset.c +++ b/src/H5Toffset.c @@ -94,7 +94,7 @@ H5Tget_offset(hid_t type_id) H5TRACE1("Is", "i", type_id); /* Check args */ - if(NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) + if(NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type") /* Get offset */ @@ -198,14 +198,14 @@ done: herr_t H5Tset_offset(hid_t type_id, size_t offset) { - H5T_t *dt = NULL; + H5T_t *dt; herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_API(H5Tset_offset, FAIL) H5TRACE2("e", "iz", type_id, offset); /* Check args */ - if (NULL == (dt = H5I_object_verify(type_id,H5I_DATATYPE))) + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id,H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an atomic data type") if (H5T_STATE_TRANSIENT!=dt->shared->state) HGOTO_ERROR(H5E_ARGS, H5E_CANTINIT, FAIL, "data type is read-only") diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index 1a6988f..6ea5b27 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -732,7 +732,7 @@ H5Z_parse_factor(H5Z_token *current, H5Z_datval_ptrs* dat_val_pointers) { H5Z_node *factor=NULL; H5Z_node *new_node; - void* ret_value; + H5Z_node *ret_value; FUNC_ENTER_NOAPI(H5Z_parse_factor, NULL); @@ -871,17 +871,17 @@ done: static H5Z_node * H5Z_new_node(H5Z_token_type type) { - H5Z_node* ret_value = NULL; + H5Z_node *ret_value; - FUNC_ENTER_NOAPI(H5Z_new_node, NULL); + FUNC_ENTER_NOAPI(H5Z_new_node, NULL) - ret_value = H5MM_calloc(sizeof(H5Z_node)); - if(ret_value == NULL) + if(NULL == (ret_value = (H5Z_node *)H5MM_calloc(sizeof(H5Z_node)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "Ran out of memory trying to allocate space for nodes in the parse tree") ret_value->type = type; + done: - FUNC_LEAVE_NOAPI(ret_value); + FUNC_LEAVE_NOAPI(ret_value) } @@ -1108,66 +1108,52 @@ H5Z_xform_find_type(const H5T_t* type) HDassert(type); /* Check for SHORT type */ - if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_SHORT,H5I_DATATYPE), FALSE)) == 0) + if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_SHORT, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_SHORT) - - /* Check for INT type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_INT,H5I_DATATYPE), FALSE)) == 0) + /* Check for INT type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_INT, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_INT) - - /* Check for LONG type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_LONG,H5I_DATATYPE), FALSE)) == 0) + /* Check for LONG type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_LONG, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_LONG) - - /* Check for LONGLONG type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_LLONG,H5I_DATATYPE), FALSE)) == 0) + /* Check for LONGLONG type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_LLONG, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_LLONG) - - /* Check for UCHAR type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_UCHAR,H5I_DATATYPE), FALSE)) == 0) + /* Check for UCHAR type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_UCHAR, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_UCHAR) - - /* Check for CHAR type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_CHAR,H5I_DATATYPE), FALSE)) == 0) + /* Check for CHAR type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_CHAR, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_CHAR) - - /* Check for SCHAR type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_SCHAR,H5I_DATATYPE), FALSE)) == 0) + /* Check for SCHAR type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_SCHAR, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_SCHAR) - - /* Check for USHORT type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_USHORT,H5I_DATATYPE), FALSE)) == 0) + /* Check for USHORT type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_USHORT, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_USHORT) - - /* Check for UINT type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_UINT,H5I_DATATYPE), FALSE)) == 0) + /* Check for UINT type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_UINT, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_UINT) - - /* Check for ULONG type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_ULONG,H5I_DATATYPE), FALSE)) == 0) + /* Check for ULONG type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_ULONG, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_ULONG) - - /* Check for ULONGLONG type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_ULLONG,H5I_DATATYPE), FALSE)) == 0) + /* Check for ULONGLONG type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_ULLONG, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_ULLONG) - - /* Check for FLOAT type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_FLOAT,H5I_DATATYPE), FALSE)) == 0) + /* Check for FLOAT type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_FLOAT, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_FLOAT) - - /* Check for DOUBLE type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_DOUBLE,H5I_DATATYPE), FALSE)) == 0) + /* Check for DOUBLE type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_DOUBLE, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_DOUBLE) - #if H5_SIZEOF_LONG_DOUBLE !=0 - /* Check for LONGDOUBLE type */ - else if((H5T_cmp(type, H5I_object_verify(H5T_NATIVE_LDOUBLE,H5I_DATATYPE), FALSE)) == 0) + /* Check for LONGDOUBLE type */ + else if((H5T_cmp(type, (const H5T_t *)H5I_object_verify(H5T_NATIVE_LDOUBLE, H5I_DATATYPE), FALSE)) == 0) HGOTO_DONE(H5T_NATIVE_LDOUBLE) #endif else HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not find matching type") - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5Z_xform_find_type() */ @@ -1356,22 +1342,20 @@ H5Z_xform_create(const char *expr) assert(expr); /* Allocate space for the data transform information */ - if((data_xform_prop = H5MM_calloc(sizeof(H5Z_data_xform_t)))==NULL) + if(NULL == (data_xform_prop = (H5Z_data_xform_t *)H5MM_calloc(sizeof(H5Z_data_xform_t)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate memory for data transform info") - if((data_xform_prop->dat_val_pointers = H5MM_malloc(sizeof(H5Z_datval_ptrs))) == NULL) + if(NULL == (data_xform_prop->dat_val_pointers = (H5Z_datval_ptrs *)H5MM_malloc(sizeof(H5Z_datval_ptrs)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate memory for data transform array storage") /* copy the user's string into the property */ - if((data_xform_prop->xform_exp = H5MM_xstrdup(expr))==NULL) + if(NULL == (data_xform_prop->xform_exp = (char *)H5MM_xstrdup(expr))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "unable to allocate memory for data transform expression") /* Find the number of times "x" is used in this equation, and allocate room for storing that many points */ - for(i=0; i<strlen(expr); i++) - { - if(isalpha(expr[i])) + for(i = 0; i < HDstrlen(expr); i++) + if(HDisalpha(expr[i])) count++; - } /* When there are no "x"'s in the equation (ie, simple transform case), * we don't need to allocate any space since no array will have to be @@ -1496,22 +1480,20 @@ H5Z_xform_copy(H5Z_data_xform_t **data_xform_prop) if(*data_xform_prop) { /* Allocate new node */ - if((new_data_xform_prop = H5MM_calloc(sizeof(H5Z_data_xform_t)))==NULL) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for data transform info") + if(NULL == (new_data_xform_prop = (H5Z_data_xform_t *)H5MM_calloc(sizeof(H5Z_data_xform_t)))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for data transform info") /* Copy string */ - if((new_data_xform_prop->xform_exp = H5MM_xstrdup((*data_xform_prop)->xform_exp))==NULL) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for data transform expression") + if(NULL == (new_data_xform_prop->xform_exp = (char *)H5MM_xstrdup((*data_xform_prop)->xform_exp))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for data transform expression") - if((new_data_xform_prop->dat_val_pointers = H5MM_malloc(sizeof(H5Z_datval_ptrs))) == NULL) + if(NULL == (new_data_xform_prop->dat_val_pointers = (H5Z_datval_ptrs *)H5MM_malloc(sizeof(H5Z_datval_ptrs)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for data transform array storage") /* Find the number of times "x" is used in this equation, and allocate room for storing that many points */ - for(i=0; i<strlen(new_data_xform_prop->xform_exp); i++) - { - if(isalpha(new_data_xform_prop->xform_exp[i])) + for(i = 0; i < HDstrlen(new_data_xform_prop->xform_exp); i++) + if(HDisalpha(new_data_xform_prop->xform_exp[i])) count++; - } if(count > 0) if((new_data_xform_prop->dat_val_pointers->ptr_dat_val = (void**) H5MM_calloc(count * sizeof(void**))) == NULL) @@ -1520,7 +1502,6 @@ H5Z_xform_copy(H5Z_data_xform_t **data_xform_prop) /* Zero out num_pointers prior to H5Z_xform_cop_tree call; that call will increment it to the right amount */ new_data_xform_prop->dat_val_pointers->num_ptrs = 0; - /* Copy parse tree */ if((new_data_xform_prop->parse_root = (H5Z_node*)H5Z_xform_copy_tree((*data_xform_prop)->parse_root, (*data_xform_prop)->dat_val_pointers, new_data_xform_prop->dat_val_pointers)) == NULL) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "error copying the parse tree") diff --git a/src/H5private.h b/src/H5private.h index 8f56db0..c0b5054 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1935,14 +1935,6 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); * * Programmer: Quincey Koziol * - * Modifications: - * - * Robb Matzke, 4 Aug 1997 - * The pablo mask comes from the constant PABLO_MASK defined on a - * per-file basis. The pablo_func_id comes from an auto variable - * defined by FUNC_ENTER. - * PABLO was deleted on January 21, 2005 EIP - * *------------------------------------------------------------------------- */ /* Threadsafety termination code for API routines */ @@ -1961,6 +1953,7 @@ static herr_t H5_INTERFACE_INIT_FUNC(void); } /*end scope from end of FUNC_ENTER*/ \ }} /*end scope from beginning of FUNC_ENTER*/ +/* Use this macro to match the FUNC_ENTER_API_NOFS macro */ #define FUNC_LEAVE_API_NOFS(ret_value) \ FINISH_MPE_LOG; \ H5TRACE_RETURN(ret_value); \ diff --git a/test/gen_bad_ohdr.c b/test/gen_bad_ohdr.c index d04996d..6d50230 100644 --- a/test/gen_bad_ohdr.c +++ b/test/gen_bad_ohdr.c @@ -28,10 +28,12 @@ #include "H5private.h" #include "H5Oprivate.h" +#ifdef H5O_ENABLE_BAD_MESG_COUNT #define FILENAME "tbad_msg_count.h5" #define GROUPNAME "Group" #define ATTRNAME1 "Attribute #1" #define ATTRNAME2 "Attribute #2" +#endif /* H5O_ENABLE_BAD_MESG_COUNT */ #ifndef TRUE #define TRUE 1 diff --git a/test/gen_bogus.c b/test/gen_bogus.c index a8b88bf..7456ae6 100644 --- a/test/gen_bogus.c +++ b/test/gen_bogus.c @@ -25,7 +25,9 @@ #include "hdf5.h" #include "H5Oprivate.h" +#ifdef H5O_ENABLE_BOGUS #define FILENAME "tbogus.h5" +#endif /* H5O_ENABLE_BOGUS */ #ifndef TRUE #define TRUE 1 diff --git a/test/gen_deflate.c b/test/gen_deflate.c index 16de92e..2d0b746 100644 --- a/test/gen_deflate.c +++ b/test/gen_deflate.c @@ -66,7 +66,7 @@ main(void) /* (Try for something easily compressible) */ for(i=0; i<SPACE_DIM1; i++) for(j=0; j<SPACE_DIM2; j++) - data[i][j]=j%5; + data[i][j] = (int)(j % 5); /* Create the file */ file = H5Fcreate(TESTFILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); diff --git a/test/gen_noencoder.c b/test/gen_noencoder.c index 3266374..46a2036 100644 --- a/test/gen_noencoder.c +++ b/test/gen_noencoder.c @@ -79,5 +79,7 @@ main(void) H5Dclose(dset_id); H5Sclose(space_id); H5Fclose(file_id); + + return(0); } diff --git a/test/lheap.c b/test/lheap.c index 537d42d..b6591ef 100644 --- a/test/lheap.c +++ b/test/lheap.c @@ -76,7 +76,7 @@ main(void) h5_fixname(FILENAME[0], fapl, filename, sizeof filename); if ((file=H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl))<0) goto error; - if(NULL == (f = H5I_object(file))) { + if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; @@ -93,16 +93,18 @@ main(void) } for(i = 0; i < NOBJS; i++) { sprintf(buf, "%03d-", i); - for (j=4; j<i; j++) buf[j] = '0' + j%10; - if (j>4) buf[j] = '\0'; + for(j = 4; j < i; j++) + buf[j] = '0' + j % 10; + if(j > 4) + buf[j] = '\0'; - if ((size_t)(-1)==(obj[i]=H5HL_insert(f, H5P_DATASET_XFER_DEFAULT, heap, strlen(buf)+1, buf))) { + if((size_t)(-1) == (obj[i] = H5HL_insert(f, H5P_DATASET_XFER_DEFAULT, heap, strlen(buf) + 1, buf))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; } } - if (H5HL_unprotect(f, H5P_DATASET_XFER_DEFAULT, heap, heap_addr) < 0) { + if(H5HL_unprotect(f, H5P_DATASET_XFER_DEFAULT, heap, heap_addr) < 0) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; @@ -116,16 +118,18 @@ main(void) TESTING("local heap read"); h5_fixname(FILENAME[0], fapl, filename, sizeof filename); - if ((file=H5Fopen(filename, H5F_ACC_RDONLY, fapl))<0) goto error; - if (NULL==(f=H5I_object(file))) { + if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) goto error; + if(NULL == (f = (H5F_t *)H5I_object(file))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; } - for (i=0; i<NOBJS; i++) { + for(i = 0; i < NOBJS; i++) { sprintf(buf, "%03d-", i); - for (j=4; j<i; j++) buf[j] = '0' + j%10; - if (j>4) buf[j] = '\0'; + for(j = 4; j < i; j++) + buf[j] = '0' + j % 10; + if(j > 4) + buf[j] = '\0'; if (NULL == (heap = H5HL_protect(f, H5P_DATASET_XFER_DEFAULT, heap_addr, H5AC_READ))) { H5_FAILED(); @@ -133,7 +137,7 @@ main(void) goto error; } - if (NULL == (s = H5HL_offset_into(f, heap, obj[i]))) { + if (NULL == (s = (const char *)H5HL_offset_into(f, heap, obj[i]))) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; @@ -147,7 +151,7 @@ main(void) goto error; } - if (H5HL_unprotect(f, H5P_DATASET_XFER_DEFAULT, heap, heap_addr) < 0) { + if(H5HL_unprotect(f, H5P_DATASET_XFER_DEFAULT, heap, heap_addr) < 0) { H5_FAILED(); H5Eprint2(H5E_DEFAULT, stdout); goto error; @@ -168,3 +172,4 @@ main(void) } H5E_END_TRY; return 1; } + diff --git a/test/ohdr.c b/test/ohdr.c index 16ffc7c..f59dace 100644 --- a/test/ohdr.c +++ b/test/ohdr.c @@ -441,6 +441,8 @@ main(void) /* Open the dataset with the "mark if unknown" message */ if((dset = H5Dopen2(file, "/Dataset3", H5P_DEFAULT)) < 0) TEST_ERROR + + /* Close the dataset */ if(H5Dclose(dset) < 0) TEST_ERROR diff --git a/test/tarray.c b/test/tarray.c index cc0a0ca..590d48c 100644 --- a/test/tarray.c +++ b/test/tarray.c @@ -44,16 +44,9 @@ #define ARRAY3_DIM2 3 /* 1-D dataset with fixed dimensions */ -#define SPACE1_NAME "Space1" #define SPACE1_RANK 1 #define SPACE1_DIM1 4 -/* 2-D dataset with fixed dimensions */ -#define SPACE2_NAME "Space2" -#define SPACE2_RANK 2 -#define SPACE2_DIM1 10 -#define SPACE2_DIM2 10 - /**************************************************************** ** ** test_array_atomic_1d(): Test basic array datatype code. diff --git a/test/tattr.c b/test/tattr.c index afe45eb..dcf13bc 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -57,7 +57,6 @@ #define CORDER_ITER_STOP 3 /* 3-D dataset with fixed dimensions */ -#define SPACE1_NAME "Space1" #define SPACE1_RANK 3 #define SPACE1_DIM1 3 #define SPACE1_DIM2 15 diff --git a/test/th5s.c b/test/th5s.c index 5bf7845..e21dee2 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -39,14 +39,12 @@ #define NULLATTR "null_attribute" /* 3-D dataset with fixed dimensions */ -#define SPACE1_NAME "Space1" #define SPACE1_RANK 3 #define SPACE1_DIM1 3 #define SPACE1_DIM2 15 #define SPACE1_DIM3 13 /* 4-D dataset with one unlimited dimension */ -#define SPACE2_NAME "Space2" #define SPACE2_RANK 4 #define SPACE2_DIM1 0 #define SPACE2_DIM2 15 @@ -58,13 +56,10 @@ #define SPACE2_MAX4 23 /* Scalar dataset with simple datatype */ -#define SPACE3_NAME "Scalar1" #define SPACE3_RANK 0 unsigned space3_data=65; /* Scalar dataset with compound datatype */ -#define SPACE4_NAME "Scalar2" -#define SPACE4_RANK 0 #define SPACE4_FIELDNAME1 "c1" #define SPACE4_FIELDNAME2 "u" #define SPACE4_FIELDNAME3 "f" diff --git a/test/trefer.c b/test/trefer.c index bf9692f..dbf12bc 100644 --- a/test/trefer.c +++ b/test/trefer.c @@ -30,18 +30,15 @@ #define FILE3 "trefer3.h5" /* 1-D dataset with fixed dimensions */ -#define SPACE1_NAME "Space1" #define SPACE1_RANK 1 #define SPACE1_DIM1 4 /* 2-D dataset with fixed dimensions */ -#define SPACE2_NAME "Space2" #define SPACE2_RANK 2 #define SPACE2_DIM1 10 #define SPACE2_DIM2 10 /* Larger 1-D dataset with fixed dimensions */ -#define SPACE3_NAME "Space3" #define SPACE3_RANK 1 #define SPACE3_DIM1 100 diff --git a/testpar/t_cache.c b/testpar/t_cache.c index 9bf3a8d..7fb7100 100644 --- a/testpar/t_cache.c +++ b/testpar/t_cache.c @@ -1428,7 +1428,7 @@ serve_read_request(struct mssg_t * mssg_ptr) success = FALSE; if ( verbose ) { HDfprintf(stdout, - "%d:%s: data[i].len = %d != mssg->len = %d.\n", + "%d:%s: data[i].len = %Zu != mssg->len = %d.\n", world_mpi_rank, fcn_name, data[target_index].len, mssg_ptr->len); } @@ -1440,7 +1440,7 @@ serve_read_request(struct mssg_t * mssg_ptr) HDfprintf(stdout, "%d:%s: proc %d read invalid entry. idx/base_addr = %d/%a.\n", world_mpi_rank, fcn_name, - mssg_ptr->src, target_index, + mssg_ptr->src, target_index, data[target_index].base_addr); } @@ -1605,7 +1605,7 @@ serve_write_request(struct mssg_t * mssg_ptr) success = FALSE; if ( verbose ) { HDfprintf(stdout, - "%d:%s: data[i].len = %d != mssg->len = %d.\n", + "%d:%s: data[i].len = %Zu != mssg->len = %d.\n", world_mpi_rank, fcn_name, data[target_index].len, mssg_ptr->len); } @@ -3553,9 +3553,11 @@ setup_rand(void) } } else { seed = (unsigned)tv.tv_usec; - HDfprintf(stdout, "%d:%s: seed = %d.\n", - world_mpi_rank, fcn_name, seed); - fflush(stdout); + if ( verbose ) { + HDfprintf(stdout, "%d:%s: seed = %d.\n", + world_mpi_rank, fcn_name, seed); + fflush(stdout); + } HDsrand(seed); } } diff --git a/testpar/t_pflush1.c b/testpar/t_pflush1.c index 0773b93..ebe5c38 100644 --- a/testpar/t_pflush1.c +++ b/testpar/t_pflush1.c @@ -157,12 +157,11 @@ main(int argc, char* argv[]) PASSED(); fflush(stdout); fflush(stderr); - } - else - { + } /* end if */ + else { SKIPPED(); puts(" Test not compatible with current Virtual File Driver"); - } + } /* end else */ /* * Some systems like Linux with mpich, if you just _exit without MPI_Finalize @@ -176,23 +175,23 @@ main(int argc, char* argv[]) */ /* close file1 */ - if(H5Fget_vfd_handle(file1, fapl, (void **)&mpifh_p) < 0){ + if(H5Fget_vfd_handle(file1, fapl, (void **)&mpifh_p) < 0) { printf("H5Fget_vfd_handle for file1 failed\n"); goto error; - } - if(MPI_File_close(mpifh_p)!=MPI_SUCCESS){ + } /* end if */ + if(MPI_File_close(mpifh_p) != MPI_SUCCESS) { printf("MPI_File_close for file1 failed\n"); goto error; - } + } /* end if */ /* close file2 */ - if(H5Fget_vfd_handle(file2, fapl, (void **)&mpifh_p) < 0){ + if(H5Fget_vfd_handle(file2, fapl, (void **)&mpifh_p) < 0) { printf("H5Fget_vfd_handle for file2 failed\n"); goto error; - } - if(MPI_File_close(mpifh_p)!=MPI_SUCCESS){ + } /* end if */ + if(MPI_File_close(mpifh_p) != MPI_SUCCESS) { printf("MPI_File_close for file2 failed\n"); goto error; - } + } /* end if */ fflush(stdout); fflush(stderr); |