summaryrefslogtreecommitdiffstats
path: root/src/H5B2test.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-11-15 03:38:58 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-11-15 03:38:58 (GMT)
commit6d5d4ed1d10498bf776b5a4d41cf2384b4d8fe28 (patch)
treeb629ca68479fa0b8ae9127176975458b77745200 /src/H5B2test.c
parent699a5ddec49aad9ee30201a0d89c902a34c7597f (diff)
downloadhdf5-6d5d4ed1d10498bf776b5a4d41cf2384b4d8fe28.zip
hdf5-6d5d4ed1d10498bf776b5a4d41cf2384b4d8fe28.tar.gz
hdf5-6d5d4ed1d10498bf776b5a4d41cf2384b4d8fe28.tar.bz2
[svn-r17893] Descrption:
Remove old shim H5B2 routines from refactoring, rename new routines to old routine names and switch all users of the H5B2 interface back to the old routine names now that the switch to using the more current open -> <operation> -> pattern is used for all the H5B2 code. This is the final change before adding a context to the H5B2 client encode/decode callbacks. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.6.2 (amazon) in debug mode Mac OS X/32 10.6.2 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'src/H5B2test.c')
-rw-r--r--src/H5B2test.c228
1 files changed, 9 insertions, 219 deletions
diff --git a/src/H5B2test.c b/src/H5B2test.c
index 28f6dc2..863c886 100644
--- a/src/H5B2test.c
+++ b/src/H5B2test.c
@@ -222,7 +222,7 @@ H5B2_test_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id,
/*-------------------------------------------------------------------------
- * Function: H5B2_get_root_addr_test_2
+ * Function: H5B2_get_root_addr_test
*
* Purpose: Retrieve the root node's address
*
@@ -235,9 +235,9 @@ H5B2_test_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id,
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_get_root_addr_test_2(H5B2_t *bt2, haddr_t *root_addr)
+H5B2_get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_get_root_addr_test_2)
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_get_root_addr_test)
/* Check arguments. */
HDassert(bt2);
@@ -247,56 +247,11 @@ H5B2_get_root_addr_test_2(H5B2_t *bt2, haddr_t *root_addr)
*root_addr = bt2->hdr->root.addr;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5B2_get_root_addr_test_2() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5B2_get_root_addr_test
- *
- * Purpose: Retrieve the root node's address
- *
- * Return: Success: non-negative
- *
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Saturday, February 26, 2005
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5B2_get_root_addr_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls,
- haddr_t addr, haddr_t *root_addr)
-{
- H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI_NOINIT(H5B2_get_root_addr_test)
-
- /* Check arguments. */
- HDassert(f);
- HDassert(cls);
- HDassert(H5F_addr_defined(addr));
- HDassert(root_addr);
-
- /* Look up the B-tree header */
- if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, cls, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
-
- /* Get B-tree root addr */
- *root_addr = hdr->root.addr;
-
-done:
- /* Release B-tree header node */
- if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, hdr, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
-
- FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_get_root_addr_test() */
/*-------------------------------------------------------------------------
- * Function: H5B2_get_node_info_test_2
+ * Function: H5B2_get_node_info_test
*
* Purpose: Determine information about a node holding a record in the B-tree
*
@@ -309,7 +264,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_get_node_info_test_2(H5B2_t *bt2, hid_t dxpl_id, void *udata,
+H5B2_get_node_info_test(H5B2_t *bt2, hid_t dxpl_id, void *udata,
H5B2_node_info_test_t *ninfo)
{
H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
@@ -319,7 +274,7 @@ H5B2_get_node_info_test_2(H5B2_t *bt2, hid_t dxpl_id, void *udata,
unsigned idx; /* Location of record which matches key */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5B2_get_node_info_test_2, FAIL)
+ FUNC_ENTER_NOAPI(H5B2_get_node_info_test, FAIL)
/* Check arguments. */
HDassert(bt2);
@@ -408,172 +363,10 @@ H5B2_get_node_info_test_2(H5B2_t *bt2, hid_t dxpl_id, void *udata,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5B2_get_node_info_test_2() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5B2_get_node_info_test
- *
- * Purpose: Determine information about a node holding a record in the B-tree
- *
- * Return: Success: non-negative
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Thursday, August 31, 2006
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5B2_get_node_info_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls,
- haddr_t addr, void *udata, H5B2_node_info_test_t *ninfo)
-{
- H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */
- H5B2_node_ptr_t curr_node_ptr; /* Node pointer info for current node */
- unsigned depth; /* Current depth of the tree */
- int cmp; /* Comparison value of records */
- unsigned idx; /* Location of record which matches key */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5B2_get_node_info_test, FAIL)
-
- /* Check arguments. */
- HDassert(f);
- HDassert(cls);
- HDassert(H5F_addr_defined(addr));
-
- /* Look up the B-tree header */
- if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, cls, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
-
- /* Set file pointer for this B-tree operation */
- hdr->f = f;
-
- /* Make copy of the root node pointer to start search with */
- curr_node_ptr = hdr->root;
-
- /* Current depth of the tree */
- depth = hdr->depth;
-
- /* Check for empty tree */
- if(0 == curr_node_ptr.node_nrec)
- HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree has no records")
-
- /* Walk down B-tree to find record or leaf node where record is located */
- cmp = -1;
- while(depth > 0 && cmp != 0) {
- H5B2_internal_t *internal; /* Pointer to internal node in B-tree */
- H5B2_node_ptr_t next_node_ptr; /* Node pointer info for next node */
-
- /* Lock B-tree current node */
- if(NULL == (internal = H5B2_protect_internal(hdr, dxpl_id, curr_node_ptr.addr, curr_node_ptr.node_nrec, depth, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
-
- /* Locate node pointer for child */
- cmp = H5B2_locate_record(hdr->cls, internal->nrec, hdr->nat_off, internal->int_native, udata, &idx);
- if(cmp > 0)
- idx++;
-
- if(cmp != 0) {
- /* Get node pointer for next node to search */
- next_node_ptr = internal->node_ptrs[idx];
-
- /* Unlock current node */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
-
- /* Set pointer to next node to load */
- curr_node_ptr = next_node_ptr;
- } /* end if */
- else {
- /* Unlock current node */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr.addr, internal, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
-
- /* Fill in information about the node */
- ninfo->depth = depth;
- ninfo->nrec = curr_node_ptr.node_nrec;
-
- /* Indicate success */
- HGOTO_DONE(SUCCEED)
- } /* end else */
-
- /* Decrement depth we're at in B-tree */
- depth--;
- } /* end while */
-
- {
- H5B2_leaf_t *leaf; /* Pointer to leaf node in B-tree */
-
- /* Lock B-tree leaf node */
- if(NULL == (leaf = (H5B2_leaf_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, &(curr_node_ptr.node_nrec), hdr, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree internal node")
-
- /* Locate record */
- cmp = H5B2_locate_record(hdr->cls, leaf->nrec, hdr->nat_off, leaf->leaf_native, udata, &idx);
-
- /* Unlock current node */
- if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, curr_node_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
-
- /* Indicate the depth that the record was found */
- if(cmp != 0)
- HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "record not in B-tree")
- } /* end block */
-
- /* Fill in information about the leaf node */
- ninfo->depth = depth;
- ninfo->nrec = curr_node_ptr.node_nrec;
-
-done:
- /* Release header */
- if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, hdr, H5AC__NO_FLAGS_SET) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree header info")
-
- FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_get_node_info_test() */
/*-------------------------------------------------------------------------
- * Function: H5B2_get_node_depth_test_2
- *
- * Purpose: Determine the depth of a node holding a record in the B-tree
- *
- * Note: Just a simple wrapper around the H5B2_get_node_info_test() routine
- *
- * Return: Success: non-negative depth of the node where the record
- * was found
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Saturday, August 26, 2006
- *
- *-------------------------------------------------------------------------
- */
-int
-H5B2_get_node_depth_test_2(H5B2_t *bt2, hid_t dxpl_id, void *udata)
-{
- H5B2_node_info_test_t ninfo; /* Node information */
- int ret_value; /* Return information */
-
- FUNC_ENTER_NOAPI(H5B2_get_node_depth_test_2, FAIL)
-
- /* Check arguments. */
- HDassert(bt2);
-
- /* Get information abou the node */
- if(H5B2_get_node_info_test_2(bt2, dxpl_id, udata, &ninfo) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "error looking up node info")
-
- /* Set return value */
- ret_value = (int)ninfo.depth;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5B2_get_node_depth_test_2() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5B2_get_node_depth_test
*
* Purpose: Determine the depth of a node holding a record in the B-tree
@@ -590,8 +383,7 @@ done:
*-------------------------------------------------------------------------
*/
int
-H5B2_get_node_depth_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls, haddr_t addr,
- void *udata)
+H5B2_get_node_depth_test(H5B2_t *bt2, hid_t dxpl_id, void *udata)
{
H5B2_node_info_test_t ninfo; /* Node information */
int ret_value; /* Return information */
@@ -599,12 +391,10 @@ H5B2_get_node_depth_test(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls, haddr
FUNC_ENTER_NOAPI(H5B2_get_node_depth_test, FAIL)
/* Check arguments. */
- HDassert(f);
- HDassert(cls);
- HDassert(H5F_addr_defined(addr));
+ HDassert(bt2);
/* Get information abou the node */
- if(H5B2_get_node_info_test(f, dxpl_id, cls, addr, udata, &ninfo) < 0)
+ if(H5B2_get_node_info_test(bt2, dxpl_id, udata, &ninfo) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "error looking up node info")
/* Set return value */