summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/H5Adense.c28
-rw-r--r--src/H5Aint.c4
-rw-r--r--src/H5B2.c641
-rw-r--r--src/H5B2cache.c18
-rw-r--r--src/H5B2dbg.c2
-rw-r--r--src/H5B2hdr.c10
-rw-r--r--src/H5B2int.c60
-rw-r--r--src/H5B2pkg.h69
-rw-r--r--src/H5B2private.h59
-rw-r--r--src/H5B2stat.c64
-rw-r--r--src/H5B2test.c228
-rw-r--r--src/H5Gdense.c24
-rw-r--r--src/H5Gobj.c2
-rw-r--r--src/H5Goh.c4
-rw-r--r--src/H5Gtest.c4
-rw-r--r--src/H5HFhuge.c26
-rw-r--r--src/H5HFstat.c2
-rw-r--r--src/H5Oattribute.c4
-rw-r--r--src/H5Otest.c8
-rwxr-xr-xsrc/H5SM.c18
20 files changed, 232 insertions, 1043 deletions
diff --git a/src/H5Adense.c b/src/H5Adense.c
index 7ff8a97..c9da207 100644
--- a/src/H5Adense.c
+++ b/src/H5Adense.c
@@ -246,7 +246,7 @@ HDfprintf(stderr, "%s: fheap_id_len = %Zu\n", FUNC, fheap_id_len);
H5O_FHEAP_ID_LEN; /* Fractal heap ID */
bt2_cparam.split_percent = H5A_NAME_BT2_SPLIT_PERC;
bt2_cparam.merge_percent = H5A_NAME_BT2_MERGE_PERC;
- if(NULL == (bt2_name = H5B2_create_2(f, dxpl_id, &bt2_cparam)))
+ if(NULL == (bt2_name = H5B2_create(f, dxpl_id, &bt2_cparam)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for name index")
/* Retrieve the v2 B-tree's address in the file */
@@ -267,7 +267,7 @@ HDfprintf(stderr, "%s: ainfo->name_bt2_addr = %a\n", FUNC, ainfo->name_bt2_addr)
H5O_FHEAP_ID_LEN; /* Fractal heap ID */
bt2_cparam.split_percent = H5A_CORDER_BT2_SPLIT_PERC;
bt2_cparam.merge_percent = H5A_CORDER_BT2_MERGE_PERC;
- if(NULL == (bt2_corder = H5B2_create_2(f, dxpl_id, &bt2_cparam)))
+ if(NULL == (bt2_corder = H5B2_create(f, dxpl_id, &bt2_cparam)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for creation order index")
/* Retrieve the v2 B-tree's address in the file */
@@ -399,7 +399,7 @@ H5A_dense_open(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, const char *na
udata.found_op_data = &ret_value;
/* Find & copy the attribute in the 'name' index */
- if((attr_exists = H5B2_find_2(bt2_name, dxpl_id, &udata, NULL, NULL)) < 0)
+ if((attr_exists = H5B2_find(bt2_name, dxpl_id, &udata, NULL, NULL)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "can't search for attribute in name index")
else if(attr_exists == FALSE)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, NULL, "can't locate attribute in name index")
@@ -545,7 +545,7 @@ H5A_dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, H5A_t *attr)
/* udata.id already set */
/* Insert attribute into 'name' tracking v2 B-tree */
- if(H5B2_insert_2(bt2_name, dxpl_id, &udata) < 0)
+ if(H5B2_insert(bt2_name, dxpl_id, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to insert record into v2 B-tree")
/* Check if we should create a creation order index v2 B-tree record */
@@ -556,7 +556,7 @@ H5A_dense_insert(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, H5A_t *attr)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index")
/* Insert the record into the creation order index v2 B-tree */
- if(H5B2_insert_2(bt2_corder, dxpl_id, &udata) < 0)
+ if(H5B2_insert(bt2_corder, dxpl_id, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to insert record into v2 B-tree")
} /* end if */
@@ -676,7 +676,7 @@ H5A_dense_write_bt2_cb(void *_record, void *_op_data, hbool_t *changed)
udata.found_op_data = NULL;
/* Modify record for creation order index */
- if(H5B2_modify_2(bt2_corder, op_data->dxpl_id, &udata, H5A_dense_write_bt2_cb2, &op_data->attr->sh_loc.u.heap_id) < 0)
+ if(H5B2_modify(bt2_corder, op_data->dxpl_id, &udata, H5A_dense_write_bt2_cb2, &op_data->attr->sh_loc.u.heap_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to modify record in v2 B-tree")
} /* end if */
@@ -814,7 +814,7 @@ H5A_dense_write(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, H5A_t *attr)
op_data.corder_bt2_addr = ainfo->corder_bt2_addr;
/* Modify attribute through 'name' tracking v2 B-tree */
- if(H5B2_modify_2(bt2_name, dxpl_id, &udata, H5A_dense_write_bt2_cb, &op_data) < 0)
+ if(H5B2_modify(bt2_name, dxpl_id, &udata, H5A_dense_write_bt2_cb, &op_data) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "unable to modify record in v2 B-tree")
done:
@@ -952,7 +952,7 @@ H5A_dense_rename(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, const char *
udata.found_op_data = &attr_copy;
/* Get copy of attribute through 'name' tracking v2 B-tree */
- if((attr_exists = H5B2_find_2(bt2_name, dxpl_id, &udata, NULL, NULL)) < 0)
+ if((attr_exists = H5B2_find(bt2_name, dxpl_id, &udata, NULL, NULL)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't search for attribute in name index")
else if(attr_exists == FALSE)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't locate attribute in name index")
@@ -1231,7 +1231,7 @@ H5A_dense_iterate(H5F_t *f, hid_t dxpl_id, hid_t loc_id, const H5O_ainfo_t *ainf
/* Iterate over the records in the v2 B-tree's "native" order */
/* (by hash of name) */
- if((ret_value = H5B2_iterate_2(bt2, dxpl_id, H5A_dense_iterate_bt2_cb, &udata)) < 0)
+ if((ret_value = H5B2_iterate(bt2, dxpl_id, H5A_dense_iterate_bt2_cb, &udata)) < 0)
HERROR(H5E_ATTR, H5E_BADITER, "attribute iteration failed");
/* Update the last attribute examined, if requested */
@@ -1298,7 +1298,7 @@ H5A_dense_remove_bt2_cb(const void *_record, void *_udata)
udata->common.corder = attr->shared->crt_idx;
/* Remove the record from the creation order index v2 B-tree */
- if(H5B2_remove_2(bt2_corder, udata->common.dxpl_id, udata, NULL, NULL) < 0)
+ if(H5B2_remove(bt2_corder, udata->common.dxpl_id, udata, NULL, NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove attribute from creation order index v2 B-tree")
} /* end if */
@@ -1401,7 +1401,7 @@ H5A_dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, const char *
udata.corder_bt2_addr = ainfo->corder_bt2_addr;
/* Remove the record from the name index v2 B-tree */
- if(H5B2_remove_2(bt2_name, dxpl_id, &udata, H5A_dense_remove_bt2_cb, &udata) < 0)
+ if(H5B2_remove(bt2_name, dxpl_id, &udata, H5A_dense_remove_bt2_cb, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove attribute from name index v2 B-tree")
done:
@@ -1506,7 +1506,7 @@ H5A_dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata)
/* Set the common information for the v2 B-tree remove operation */
/* Remove the record from the "other" index v2 B-tree */
- if(H5B2_remove_2(bt2, bt2_udata->dxpl_id, &other_bt2_udata, NULL, NULL) < 0)
+ if(H5B2_remove(bt2, bt2_udata->dxpl_id, &other_bt2_udata, NULL, NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove record from 'other' index v2 B-tree")
} /* end if */
@@ -1644,7 +1644,7 @@ H5A_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo,
udata.other_bt2_addr = idx_type == H5_INDEX_NAME ? ainfo->corder_bt2_addr : ainfo->name_bt2_addr;
/* Remove the record from the name index v2 B-tree */
- if(H5B2_remove_by_idx_2(bt2, dxpl_id, order, n, H5A_dense_remove_by_idx_bt2_cb, &udata) < 0)
+ if(H5B2_remove_by_idx(bt2, dxpl_id, order, n, H5A_dense_remove_by_idx_bt2_cb, &udata) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTREMOVE, FAIL, "unable to remove attribute from v2 B-tree index")
} /* end if */
else {
@@ -1751,7 +1751,7 @@ H5A_dense_exists(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo, const char *
udata.found_op_data = NULL;
/* Find the attribute in the 'name' index */
- if((ret_value = H5B2_find_2(bt2_name, dxpl_id, &udata, NULL, NULL)) < 0)
+ if((ret_value = H5B2_find(bt2_name, dxpl_id, &udata, NULL, NULL)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_NOTFOUND, FAIL, "can't search for attribute in name index")
done:
diff --git a/src/H5Aint.c b/src/H5Aint.c
index 7115b52..ab1d32c 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -333,7 +333,7 @@ H5A_dense_build_table(H5F_t *f, hid_t dxpl_id, const H5O_ainfo_t *ainfo,
/* Retrieve # of records in "name" B-tree */
/* (should be same # of records in all indices) */
- if(H5B2_get_nrec_2(bt2_name, &nrec) < 0)
+ if(H5B2_get_nrec(bt2_name, &nrec) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve # of records in index")
/* Set size of table */
@@ -729,7 +729,7 @@ H5A_get_ainfo(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5O_ainfo_t *ainfo)
/* Retrieve # of records in "name" B-tree */
/* (should be same # of records in all indices) */
- if(H5B2_get_nrec_2(bt2_name, &ainfo->nattrs) < 0)
+ if(H5B2_get_nrec(bt2_name, &ainfo->nattrs) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve # of records in index")
} /* end if */
else
diff --git a/src/H5B2.c b/src/H5B2.c
index 7c613bf..b6e8392 100644
--- a/src/H5B2.c
+++ b/src/H5B2.c
@@ -112,7 +112,7 @@ H5FL_DEFINE_STATIC(H5B2_t);
/*-------------------------------------------------------------------------
- * Function: H5B2_create_2
+ * Function: H5B2_create
*
* Purpose: Creates a new empty B-tree in the file.
*
@@ -126,14 +126,14 @@ H5FL_DEFINE_STATIC(H5B2_t);
*-------------------------------------------------------------------------
*/
H5B2_t *
-H5B2_create_2(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam)
+H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam)
{
H5B2_t *bt2 = NULL; /* Pointer to the B-tree */
H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */
haddr_t hdr_addr; /* B-tree header address */
H5B2_t *ret_value; /* Return value */
- FUNC_ENTER_NOAPI(H5B2_create_2, NULL)
+ FUNC_ENTER_NOAPI(H5B2_create, NULL)
/*
* Check arguments.
@@ -179,48 +179,6 @@ done:
HDONE_ERROR(H5E_BTREE, H5E_CANTCLOSEOBJ, NULL, "unable to close v2 B-tree")
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5B2_create_2() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5B2_create
- *
- * Purpose: Creates a new empty B-tree in the file.
- *
- * Return: Non-negative on success (with address of new B-tree
- * filled in), negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Jan 31 2005
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam,
- haddr_t *addr_p)
-{
- haddr_t hdr_addr; /* The new v2 B-tree header address */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5B2_create, FAIL)
-
- /*
- * Check arguments.
- */
- HDassert(f);
- HDassert(cparam);
- HDassert(addr_p);
-
- /* Create shared v2 B-tree header */
- if(HADDR_UNDEF == (hdr_addr = H5B2_hdr_create(f, dxpl_id, cparam)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't create v2 B-tree header")
-
- /* Set the B-tree's address to return */
- *addr_p = hdr_addr;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B2_create() */
@@ -290,7 +248,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5B2_insert_2
+ * Function: H5B2_insert
*
* Purpose: Adds a new record to the B-tree.
*
@@ -303,12 +261,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_insert_2(H5B2_t *bt2, hid_t dxpl_id, void *udata)
+H5B2_insert(H5B2_t *bt2, hid_t dxpl_id, void *udata)
{
H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5B2_insert_2, FAIL)
+ FUNC_ENTER_NOAPI(H5B2_insert, FAIL)
/* Check arguments. */
HDassert(bt2);
@@ -349,50 +307,6 @@ H5B2_insert_2(H5B2_t *bt2, hid_t dxpl_id, void *udata)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5B2_insert_2() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5B2_insert
- *
- * Purpose: Adds a new record to the B-tree.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Feb 2 2005
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls, haddr_t addr,
- void *udata)
-{
- H5B2_t *bt2 = NULL; /* Pointer to the B-tree */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5B2_insert, FAIL)
-
- /* Check arguments. */
- HDassert(f);
- HDassert(cls);
- HDassert(H5F_addr_defined(addr));
-
- /* Open the B-tree */
- if(NULL == (bt2 = H5B2_open(f, dxpl_id, addr)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTOPENOBJ, FAIL, "unable to open B-tree")
-
- /* Insert the new record */
- if(H5B2_insert_2(bt2, dxpl_id, udata) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, FAIL, "unable to insert record into B-tree")
-
-done:
- /* Close the B-tree */
- if(bt2 && H5B2_close(bt2, dxpl_id) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTCLOSEOBJ, FAIL, "unable to close B-tree")
-
- FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_insert() */
@@ -428,7 +342,7 @@ H5B2_get_addr(const H5B2_t *bt2, haddr_t *addr_p)
/*-------------------------------------------------------------------------
- * Function: H5B2_iterate_2
+ * Function: H5B2_iterate
*
* Purpose: Iterate over all the records in the B-tree, in "in-order"
* order, making a callback for each record.
@@ -445,12 +359,12 @@ H5B2_get_addr(const H5B2_t *bt2, haddr_t *addr_p)
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_iterate_2(H5B2_t *bt2, hid_t dxpl_id, H5B2_operator_t op, void *op_data)
+H5B2_iterate(H5B2_t *bt2, hid_t dxpl_id, H5B2_operator_t op, void *op_data)
{
H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOERR(H5B2_iterate_2, -)
+ FUNC_ENTER_NOAPI_NOERR(H5B2_iterate, -)
/* Check arguments. */
HDassert(bt2);
@@ -470,60 +384,11 @@ H5B2_iterate_2(H5B2_t *bt2, hid_t dxpl_id, H5B2_operator_t op, void *op_data)
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5B2_iterate_2() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5B2_iterate
- *
- * Purpose: Iterate over all the records in the B-tree, in "in-order"
- * order, making a callback for each record.
- *
- * If the callback returns non-zero, the iteration breaks out
- * without finishing all the records.
- *
- * Return: Value from callback: non-negative on success, negative on error
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Feb 11 2005
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5B2_iterate(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls, haddr_t addr,
- H5B2_operator_t op, void *op_data)
-{
- H5B2_t *bt2 = NULL; /* Pointer to the B-tree */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5B2_iterate, FAIL)
-
- /* Check arguments. */
- HDassert(f);
- HDassert(cls);
- HDassert(H5F_addr_defined(addr));
- HDassert(op);
-
- /* Open the B-tree */
- if(NULL == (bt2 = H5B2_open(f, dxpl_id, addr)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTOPENOBJ, FAIL, "unable to open B-tree")
-
- /* Iterate through records */
- if((ret_value = H5B2_iterate_2(bt2, dxpl_id, op, op_data)) < 0)
- HERROR(H5E_BTREE, H5E_CANTLIST, "B-tree iteration failed");
-
-done:
- /* Close the B-tree */
- if(bt2 && H5B2_close(bt2, dxpl_id) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTCLOSEOBJ, FAIL, "unable to close B-tree")
-
- FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_iterate() */
/*-------------------------------------------------------------------------
- * Function: H5B2_find_2
+ * Function: H5B2_find
*
* Purpose: Locate the specified information in a B-tree and return
* that information by calling the provided 'OP' routine with an
@@ -546,7 +411,7 @@ done:
*-------------------------------------------------------------------------
*/
htri_t
-H5B2_find_2(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op,
+H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op,
void *op_data)
{
H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
@@ -556,7 +421,7 @@ H5B2_find_2(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op,
unsigned idx; /* Location of record which matches key */
htri_t ret_value = TRUE; /* Return value */
- FUNC_ENTER_NOAPI(H5B2_find_2, FAIL)
+ FUNC_ENTER_NOAPI(H5B2_find, FAIL)
/* Check arguments. */
HDassert(bt2);
@@ -661,65 +526,11 @@ H5B2_find_2(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_found_t op,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5B2_find_2() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5B2_find
- *
- * Purpose: Locate the specified information in a B-tree and return
- * that information by calling the provided 'OP' routine with an
- * OP_DATA pointer. The UDATA parameter points to data passed
- * to the key comparison function.
- *
- * The 'OP' routine is called with the record found and the
- * OP_DATA pointer, to allow caller to return information about
- * the record.
- *
- * If 'OP' is NULL, then this routine just returns "TRUE" when
- * a record is present in the B-tree.
- *
- * Return: Non-negative (TRUE/FALSE) on success, negative on failure.
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Feb 23 2005
- *
- *-------------------------------------------------------------------------
- */
-htri_t
-H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls, haddr_t addr,
- void *udata, H5B2_found_t op, void *op_data)
-{
- H5B2_t *bt2 = NULL; /* Pointer to the B-tree */
- htri_t ret_value; /* Return value */
-
- FUNC_ENTER_NOAPI(H5B2_find, FAIL)
-
- /* Check arguments. */
- HDassert(f);
- HDassert(cls);
- HDassert(H5F_addr_defined(addr));
-
- /* Open the B-tree */
- if(NULL == (bt2 = H5B2_open(f, dxpl_id, addr)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTOPENOBJ, FAIL, "unable to open B-tree")
-
- /* Operate on record */
- if((ret_value = H5B2_find_2(bt2, dxpl_id, udata, op, op_data)) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree find operation failed")
-
-done:
- /* Close the B-tree */
- if(bt2 && H5B2_close(bt2, dxpl_id) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTCLOSEOBJ, FAIL, "unable to close B-tree")
-
- FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_find() */
/*-------------------------------------------------------------------------
- * Function: H5B2_index_2
+ * Function: H5B2_index
*
* Purpose: Locate the IDX'th record in a B-tree according to the
* ordering used by the B-tree. The IDX values are 0-based.
@@ -737,7 +548,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_index_2(H5B2_t *bt2, hid_t dxpl_id, H5_iter_order_t order, hsize_t idx,
+H5B2_index(H5B2_t *bt2, hid_t dxpl_id, H5_iter_order_t order, hsize_t idx,
H5B2_found_t op, void *op_data)
{
H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
@@ -745,7 +556,7 @@ H5B2_index_2(H5B2_t *bt2, hid_t dxpl_id, H5_iter_order_t order, hsize_t idx,
unsigned depth; /* Current depth of the tree */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5B2_index_2, FAIL)
+ FUNC_ENTER_NOAPI(H5B2_index, FAIL)
/* Check arguments. */
HDassert(bt2);
@@ -876,61 +687,11 @@ H5B2_index_2(H5B2_t *bt2, hid_t dxpl_id, H5_iter_order_t order, hsize_t idx,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5B2_index_2() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5B2_index
- *
- * Purpose: Locate the IDX'th record in a B-tree according to the
- * ordering used by the B-tree. The IDX values are 0-based.
- *
- * The 'OP' routine is called with the record found and the
- * OP_DATA pointer, to allow caller to return information about
- * the record.
- *
- * Return: Non-negative on success, negative on failure.
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Feb 23 2005
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls, haddr_t addr,
- H5_iter_order_t order, hsize_t idx, H5B2_found_t op, void *op_data)
-{
- H5B2_t *bt2 = NULL; /* Pointer to the B-tree */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5B2_index, FAIL)
-
- /* Check arguments. */
- HDassert(f);
- HDassert(cls);
- HDassert(H5F_addr_defined(addr));
- HDassert(op);
-
- /* Open the B-tree */
- if(NULL == (bt2 = H5B2_open(f, dxpl_id, addr)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTOPENOBJ, FAIL, "unable to open B-tree")
-
- /* Locate and operate on record */
- if(H5B2_index_2(bt2, dxpl_id, order, idx, op, op_data) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "B-tree index operation failed")
-
-done:
- /* Close the B-tree */
- if(bt2 && H5B2_close(bt2, dxpl_id) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTCLOSEOBJ, FAIL, "unable to close B-tree")
-
- FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_index() */
/*-------------------------------------------------------------------------
- * Function: H5B2_remove_2
+ * Function: H5B2_remove
*
* Purpose: Removes a record from a B-tree.
*
@@ -943,13 +704,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_remove_2(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_remove_t op,
+H5B2_remove(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_remove_t op,
void *op_data)
{
H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5B2_remove_2, FAIL)
+ FUNC_ENTER_NOAPI(H5B2_remove, FAIL)
/* Check arguments. */
HDassert(bt2);
@@ -982,7 +743,7 @@ H5B2_remove_2(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_remove_t op,
if(H5FL_fac_term(hdr->node_info[hdr->depth].node_ptr_fac) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't destroy node's node pointer block factory")
- hdr->depth -= depth_decreased;
+ hdr->depth -= (uint16_t)depth_decreased;
} /* end for */
} /* end if */
else {
@@ -999,55 +760,11 @@ H5B2_remove_2(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_remove_t op,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5B2_remove_2() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5B2_remove
- *
- * Purpose: Removes a record from a B-tree.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Feb 25 2005
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5B2_remove(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls, haddr_t addr,
- void *udata, H5B2_remove_t op, void *op_data)
-{
- H5B2_t *bt2 = NULL; /* Pointer to the B-tree */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5B2_remove, FAIL)
-
- /* Check arguments. */
- HDassert(f);
- HDassert(cls);
- HDassert(H5F_addr_defined(addr));
-
- /* Open the B-tree */
- if(NULL == (bt2 = H5B2_open(f, dxpl_id, addr)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTOPENOBJ, FAIL, "unable to open B-tree")
-
- /* Attempt to remove record from B-tree */
- if(H5B2_remove_2(bt2, dxpl_id, udata, op, op_data) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree")
-
-done:
- /* Close the B-tree */
- if(bt2 && H5B2_close(bt2, dxpl_id) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTCLOSEOBJ, FAIL, "unable to close B-tree")
-
- FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_remove() */
/*-------------------------------------------------------------------------
- * Function: H5B2_remove_by_idx_2
+ * Function: H5B2_remove_by_idx
*
* Purpose: Removes the n'th record from a B-tree.
*
@@ -1060,13 +777,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_remove_by_idx_2(H5B2_t *bt2, hid_t dxpl_id, H5_iter_order_t order,
+H5B2_remove_by_idx(H5B2_t *bt2, hid_t dxpl_id, H5_iter_order_t order,
hsize_t idx, H5B2_remove_t op, void *op_data)
{
H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5B2_remove_by_idx_2, FAIL)
+ FUNC_ENTER_NOAPI(H5B2_remove_by_idx, FAIL)
/* Check arguments. */
HDassert(bt2);
@@ -1107,7 +824,7 @@ H5B2_remove_by_idx_2(H5B2_t *bt2, hid_t dxpl_id, H5_iter_order_t order,
if(H5FL_fac_term(hdr->node_info[hdr->depth].node_ptr_fac) < 0)
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't destroy node's node pointer block factory")
- hdr->depth -= depth_decreased;
+ hdr->depth -= (uint16_t)depth_decreased;
} /* end for */
} /* end if */
else {
@@ -1124,56 +841,11 @@ H5B2_remove_by_idx_2(H5B2_t *bt2, hid_t dxpl_id, H5_iter_order_t order,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5B2_remove_by_idx_2() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5B2_remove_by_idx
- *
- * Purpose: Removes the n'th record from a B-tree.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@hdfgroup.org
- * Nov 14 2006
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5B2_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls,
- haddr_t addr, H5_iter_order_t order, hsize_t idx, H5B2_remove_t op,
- void *op_data)
-{
- H5B2_t *bt2 = NULL; /* Pointer to the B-tree */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5B2_remove_by_idx, FAIL)
-
- /* Check arguments. */
- HDassert(f);
- HDassert(cls);
- HDassert(H5F_addr_defined(addr));
-
- /* Open the B-tree */
- if(NULL == (bt2 = H5B2_open(f, dxpl_id, addr)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTOPENOBJ, FAIL, "unable to open B-tree")
-
- /* Attempt to remove record from B-tree */
- if(H5B2_remove_by_idx_2(bt2, dxpl_id, order, idx, op, op_data) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTDELETE, FAIL, "unable to remove record from B-tree")
-
-done:
- /* Close the B-tree */
- if(bt2 && H5B2_close(bt2, dxpl_id) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTCLOSEOBJ, FAIL, "unable to close B-tree")
-
- FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_remove_by_idx() */
/*-------------------------------------------------------------------------
- * Function: H5B2_get_nrec_2
+ * Function: H5B2_get_nrec
*
* Purpose: Retrieves the number of records in a B-tree
*
@@ -1186,9 +858,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_get_nrec_2(const H5B2_t *bt2, hsize_t *nrec)
+H5B2_get_nrec(const H5B2_t *bt2, hsize_t *nrec)
{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_get_nrec_2)
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_get_nrec)
/* Check arguments. */
HDassert(bt2);
@@ -1198,56 +870,11 @@ H5B2_get_nrec_2(const H5B2_t *bt2, hsize_t *nrec)
*nrec = bt2->hdr->root.all_nrec;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5B2_get_nrec_2() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5B2_get_nrec
- *
- * Purpose: Retrieves the number of records in a B-tree
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Feb 25 2005
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5B2_get_nrec(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls, haddr_t addr,
- hsize_t *nrec)
-{
- H5B2_t *bt2 = NULL; /* Pointer to the B-tree */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5B2_get_nrec, FAIL)
-
- /* Check arguments. */
- HDassert(f);
- HDassert(cls);
- HDassert(H5F_addr_defined(addr));
- HDassert(nrec);
-
- /* Open the B-tree */
- if(NULL == (bt2 = H5B2_open(f, dxpl_id, addr)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTOPENOBJ, FAIL, "unable to open B-tree")
-
- /* Get the number of records in the B-tree */
- if(H5B2_get_nrec_2(bt2, nrec) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to get # of records in B-tree")
-
-done:
- /* Close the B-tree */
- if(bt2 && H5B2_close(bt2, dxpl_id) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTCLOSEOBJ, FAIL, "unable to close B-tree")
-
- FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_get_nrec() */
/*-------------------------------------------------------------------------
- * Function: H5B2_neighbor_2
+ * Function: H5B2_neighbor
*
* Purpose: Locate a record relative to the specified information in a
* B-tree and return that information by filling in fields of the
@@ -1272,13 +899,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_neighbor_2(H5B2_t *bt2, hid_t dxpl_id, H5B2_compare_t range, void *udata,
+H5B2_neighbor(H5B2_t *bt2, hid_t dxpl_id, H5B2_compare_t range, void *udata,
H5B2_found_t op, void *op_data)
{
H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5B2_neighbor_2, FAIL)
+ FUNC_ENTER_NOAPI(H5B2_neighbor, FAIL)
/* Check arguments. */
HDassert(bt2);
@@ -1306,68 +933,11 @@ H5B2_neighbor_2(H5B2_t *bt2, hid_t dxpl_id, H5B2_compare_t range, void *udata,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5B2_neighbor_2() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5B2_neighbor
- *
- * Purpose: Locate a record relative to the specified information in a
- * B-tree and return that information by filling in fields of the
- * caller-supplied UDATA pointer depending on the type of leaf node
- * requested. The UDATA can point to additional data passed
- * to the key comparison function.
- *
- * The 'OP' routine is called with the record found and the
- * OP_DATA pointer, to allow caller to return information about
- * the record.
- *
- * The RANGE indicates whether to search for records less than or
- * equal to, or greater than or equal to the information passed
- * in with UDATA.
- *
- * Return: Non-negative on success, negative on failure.
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 8 2005
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5B2_neighbor(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls, haddr_t addr,
- H5B2_compare_t range, void *udata, H5B2_found_t op, void *op_data)
-{
- H5B2_t *bt2 = NULL; /* Pointer to the B-tree */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5B2_neighbor, FAIL)
-
- /* Check arguments. */
- HDassert(f);
- HDassert(cls);
- HDassert(H5F_addr_defined(addr));
- HDassert(op);
-
- /* Open the B-tree */
- if(NULL == (bt2 = H5B2_open(f, dxpl_id, addr)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTOPENOBJ, FAIL, "unable to open B-tree")
-
- /* Attempt to find neighbor record in B-tree */
- if(H5B2_neighbor_2(bt2, dxpl_id, range, udata, op, op_data) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_NOTFOUND, FAIL, "unable to find neighbor record in B-tree")
-
-done:
- /* Close the B-tree */
- if(bt2 && H5B2_close(bt2, dxpl_id) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTCLOSEOBJ, FAIL, "unable to close B-tree")
-
- FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_neighbor() */
/*-------------------------------------------------------------------------
- * Function: H5B2_modify_2
+ * Function: H5B2_modify
*
* Purpose: Locate the specified information in a B-tree and modify it.
* The UDATA points to additional data passed
@@ -1387,7 +957,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_modify_2(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op,
+H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op,
void *op_data)
{
H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
@@ -1397,7 +967,7 @@ H5B2_modify_2(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op,
unsigned idx; /* Location of record which matches key */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5B2_modify_2, FAIL)
+ FUNC_ENTER_NOAPI(H5B2_modify, FAIL)
/* Check arguments. */
HDassert(bt2);
@@ -1526,157 +1096,10 @@ H5B2_modify_2(H5B2_t *bt2, hid_t dxpl_id, void *udata, H5B2_modify_t op,
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5B2_modify_2() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5B2_modify
- *
- * Purpose: Locate the specified information in a B-tree and modify it.
- * The UDATA points to additional data passed
- * to the key comparison function for locating the record to
- * modify.
- *
- * The 'OP' routine is called with the record found and the
- * OP_DATA pointer, to allow caller to modify information about
- * the record.
- *
- * Return: Non-negative on success, negative on failure.
- *
- * Programmer: Quincey Koziol
- * koziol@ncsa.uiuc.edu
- * Mar 10 2005
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls, haddr_t addr,
- void *udata, H5B2_modify_t op, void *op_data)
-{
- H5B2_t *bt2 = NULL; /* Pointer to the B-tree */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5B2_modify, FAIL)
-
- /* Check arguments. */
- HDassert(f);
- HDassert(cls);
- HDassert(H5F_addr_defined(addr));
- HDassert(op);
-
- /* Open the B-tree */
- if(NULL == (bt2 = H5B2_open(f, dxpl_id, addr)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTOPENOBJ, FAIL, "unable to open B-tree")
-
- /* Locate & modify record */
- if(H5B2_modify_2(bt2, dxpl_id, udata, op, op_data) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTMODIFY, FAIL, "'modify' callback failed for B-tree")
-
-done:
- /* Close the B-tree */
- if(bt2 && H5B2_close(bt2, dxpl_id) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTCLOSEOBJ, FAIL, "unable to close B-tree")
-
- FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_modify() */
/*-------------------------------------------------------------------------
- * Function: H5B2_iterate_size_2
- *
- * Purpose: Iterate over all the records in the B-tree, collecting
- * storage info.
- *
- * Return: non-negative on success, negative on error
- *
- * Programmer: Vailin Choi
- * June 19 2007
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5B2_iterate_size_2(H5B2_t *bt2, hid_t dxpl_id, hsize_t *btree_size)
-{
- H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5B2_iterate_size_2, FAIL)
-
- /* Check arguments. */
- HDassert(bt2);
- HDassert(btree_size);
-
- /* Set the shared v2 B-tree header's file context for this operation */
- bt2->hdr->f = bt2->f;
-
- /* Get the v2 B-tree header */
- hdr = bt2->hdr;
-
- /* Add size of header to B-tree metadata total */
- *btree_size += H5B2_HEADER_SIZE(hdr->f);
-
- /* Iterate through records */
- if(hdr->root.node_nrec > 0) {
- /* Check for root node being a leaf */
- if(hdr->depth == 0)
- *btree_size += hdr->node_size;
- else
- /* Iterate through nodes */
- if(H5B2_iterate_size_node(hdr, dxpl_id, hdr->depth, &hdr->root, btree_size) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node iteration failed")
- } /* end if */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5B2_iterate_size_2() */
-
-
-/*-------------------------------------------------------------------------
- * Function: H5B2_iterate_size
- *
- * Purpose: Iterate over all the records in the B-tree, collecting
- * storage info.
- *
- * Return: non-negative on success, negative on error
- *
- * Programmer: Vailin Choi
- * June 19 2007
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5B2_iterate_size(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *cls,
- haddr_t addr, hsize_t *btree_size)
-{
- H5B2_t *bt2 = NULL; /* Pointer to the B-tree */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5B2_iterate_size, FAIL)
-
- /* Check arguments. */
- HDassert(f);
- HDassert(cls);
- HDassert(H5F_addr_defined(addr));
- HDassert(btree_size);
-
- /* Open the B-tree */
- if(NULL == (bt2 = H5B2_open(f, dxpl_id, addr)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTOPENOBJ, FAIL, "unable to open B-tree")
-
- /* Iterate through B-tree, collective size info */
- if(H5B2_iterate_size_2(bt2, dxpl_id, btree_size) < 0)
- HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "can't get size information for B-tree")
-
-done:
- /* Close the B-tree */
- if(bt2 && H5B2_close(bt2, dxpl_id) < 0)
- HDONE_ERROR(H5E_BTREE, H5E_CANTCLOSEOBJ, FAIL, "unable to close B-tree")
-
- FUNC_LEAVE_NOAPI(ret_value)
-} /* H5B2_iterate_size() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5B2_close
*
* Purpose: Close a v2 B-tree
diff --git a/src/H5B2cache.c b/src/H5B2cache.c
index 31c28af..6737076 100644
--- a/src/H5B2cache.c
+++ b/src/H5B2cache.c
@@ -151,7 +151,7 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *ud
{
H5B2_create_t cparam; /* B-tree creation parameters */
H5B2_subid_t id; /* ID of B-tree class, as found in file */
- unsigned depth; /* Depth of B-tree */
+ uint16_t depth; /* Depth of B-tree */
H5B2_hdr_t *hdr = NULL; /* B-tree header */
size_t size; /* Header size */
uint32_t stored_chksum; /* Stored metadata checksum value */
@@ -177,7 +177,7 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *ud
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, NULL, "can't wrap buffer")
/* Compute the size of the serialized B-tree header on disk */
- size = H5B2_HEADER_SIZE(f);
+ size = H5B2_HEADER_SIZE(hdr);
/* Get a pointer to a buffer that's large enough for header */
if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size)))
@@ -300,7 +300,7 @@ H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't wrap buffer")
/* Compute the size of the serialized B-tree header on disk */
- size = H5B2_HEADER_SIZE(f);
+ size = H5B2_HEADER_SIZE(hdr);
/* Get a pointer to a buffer that's large enough for header */
if(NULL == (buf = (uint8_t *)H5WB_actual(wb, size)))
@@ -399,7 +399,7 @@ H5B2_cache_hdr_dest(H5F_t *f, H5B2_hdr_t *hdr)
if(hdr->cache_info.free_file_space_on_destroy) {
/* Release the space on disk */
/* (XXX: Nasty usage of internal DXPL value! -QAK) */
- if(H5MF_xfree(f, H5FD_MEM_BTREE, H5AC_dxpl_id, hdr->cache_info.addr, (hsize_t)H5B2_HEADER_SIZE(f)) < 0)
+ if(H5MF_xfree(f, H5FD_MEM_BTREE, H5AC_dxpl_id, hdr->cache_info.addr, (hsize_t)H5B2_HEADER_SIZE(hdr)) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to free v2 B-tree header")
} /* end if */
@@ -465,7 +465,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_cache_hdr_size(const H5F_t *f, const H5B2_hdr_t UNUSED *hdr, size_t *size_ptr)
+H5B2_cache_hdr_size(const H5F_t UNUSED *f, const H5B2_hdr_t *hdr, size_t *size_ptr)
{
FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_cache_hdr_size)
@@ -474,7 +474,7 @@ H5B2_cache_hdr_size(const H5F_t *f, const H5B2_hdr_t UNUSED *hdr, size_t *size_p
HDassert(size_ptr);
/* Set size value */
- *size_ptr = H5B2_HEADER_SIZE(f);
+ *size_ptr = H5B2_HEADER_SIZE(hdr);
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2_cache_hdr_size() */
@@ -574,7 +574,7 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_uda
/* Deserialize node pointers for internal node */
int_node_ptr = internal->node_ptrs;
- for(u = 0; u < internal->nrec + 1; u++) {
+ for(u = 0; u < (unsigned)(internal->nrec + 1); u++) {
/* Decode node pointer */
H5F_addr_decode(f, (const uint8_t **)&p, &(int_node_ptr->addr));
UINT64DECODE_VAR(p, int_node_ptr->node_nrec, udata->hdr->max_nrec_size);
@@ -673,7 +673,7 @@ H5B2_cache_internal_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr
/* Serialize node pointers for internal node */
int_node_ptr = internal->node_ptrs;
- for(u = 0; u < internal->nrec + 1; u++) {
+ for(u = 0; u < (unsigned)(internal->nrec + 1); u++) {
/* Encode node pointer */
H5F_addr_encode(f, &p, int_node_ptr->addr);
UINT64ENCODE_VAR(p, int_node_ptr->node_nrec, internal->hdr->max_nrec_size);
@@ -854,7 +854,7 @@ H5B2_cache_internal_size(const H5F_t UNUSED *f, const H5B2_internal_t *internal,
static H5B2_leaf_t *
H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, void *_hdr)
{
- const unsigned *nrec = (const unsigned *)_nrec;
+ 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 */
diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c
index db469f2..17a64cd 100644
--- a/src/H5B2dbg.c
+++ b/src/H5B2dbg.c
@@ -154,7 +154,7 @@ H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
/* Print relevant node info */
HDfprintf(stream, "%*sNode Info: (max_nrec/split_nrec/merge_nrec)\n", indent, "");
- for(u = 0; u < (hdr->depth + 1); u++) {
+ for(u = 0; u < (unsigned)(hdr->depth + 1); u++) {
sprintf(temp_str, "Depth %u:", u);
HDfprintf(stream, "%*s%-*s (%u/%u/%u)\n", indent + 3, "", MAX(0, fwidth - 3),
temp_str,
diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c
index 31e1674..ec46729 100644
--- a/src/H5B2hdr.c
+++ b/src/H5B2hdr.c
@@ -108,7 +108,7 @@ H5FL_SEQ_DEFINE(H5B2_node_info_t);
*/
herr_t
H5B2_hdr_init(H5F_t *f, H5B2_hdr_t *hdr, const H5B2_create_t *cparam,
- unsigned depth)
+ uint16_t depth)
{
size_t sz_max_nrec; /* Temporary variable for range checking */
unsigned u_max_nrec_size; /* Temporary variable for range checking */
@@ -187,7 +187,7 @@ HDmemset(hdr->page, 0, hdr->node_size);
/* Initialize internal node info */
if(depth > 0) {
- for(u = 1; u < (depth + 1); u++) {
+ for(u = 1; u < (unsigned)(depth + 1); u++) {
sz_max_nrec = H5B2_NUM_INT_REC(hdr, u);
H5_ASSIGN_OVERFLOW(/* To: */ hdr->node_info[u].max_nrec, /* From: */ sz_max_nrec, /* From: */ size_t, /* To: */ unsigned)
HDassert(hdr->node_info[u].max_nrec <= hdr->node_info[u - 1].max_nrec);
@@ -296,11 +296,11 @@ H5B2_hdr_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam)
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, HADDR_UNDEF, "allocation failed for B-tree header")
/* Initialize shared B-tree info */
- if(H5B2_hdr_init(f, hdr, cparam, 0) < 0)
+ if(H5B2_hdr_init(f, hdr, cparam, (uint16_t)0) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, HADDR_UNDEF, "can't create shared B-tree info")
/* Allocate space for the header on disk */
- if(HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)H5B2_HEADER_SIZE(f))))
+ if(HADDR_UNDEF == (hdr->addr = H5MF_alloc(f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)H5B2_HEADER_SIZE(hdr))))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, HADDR_UNDEF, "file allocation failed for B-tree header")
/* Cache the new B-tree node */
@@ -520,7 +520,7 @@ H5B2_hdr_free(H5B2_hdr_t *hdr)
unsigned u; /* Local index variable */
/* Destroy free list factories */
- for(u = 0; u < (hdr->depth + 1); u++) {
+ for(u = 0; u < (unsigned)(hdr->depth + 1); u++) {
if(hdr->node_info[u].nat_rec_fac)
if(H5FL_fac_term(hdr->node_info[u].nat_rec_fac) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "can't destroy node's native record block factory")
diff --git a/src/H5B2int.c b/src/H5B2int.c
index 3d37949..f7312a5 100644
--- a/src/H5B2int.c
+++ b/src/H5B2int.c
@@ -179,11 +179,11 @@ H5B2_split1(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *cur
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
void *left_child, *right_child; /* Pointers to child nodes */
- unsigned *left_nrec, *right_nrec; /* Pointers to child # of records */
+ uint16_t *left_nrec, *right_nrec; /* Pointers to child # of records */
uint8_t *left_native, *right_native;/* Pointers to childs' native records */
H5B2_node_ptr_t *left_node_ptrs = NULL, *right_node_ptrs = NULL;/* Pointers to childs' node pointer info */
- unsigned mid_record; /* Index of "middle" record in current node */
- unsigned old_node_nrec; /* Number of records in internal node split */
+ uint16_t mid_record; /* Index of "middle" record in current node */
+ uint16_t old_node_nrec; /* Number of records in internal node split */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_split1)
@@ -265,12 +265,12 @@ H5B2_split1(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *cur
/* Copy "upper half" of records to new child */
HDmemcpy(H5B2_NAT_NREC(right_native, hdr, 0),
- H5B2_NAT_NREC(left_native, hdr, mid_record + 1),
- hdr->cls->nrec_size * (old_node_nrec - (mid_record + 1)));
+ H5B2_NAT_NREC(left_native, hdr, mid_record + (unsigned)1),
+ hdr->cls->nrec_size * (old_node_nrec - (mid_record + (unsigned)1)));
/* Copy "upper half" of node pointers, if the node is an internal node */
if(depth > 1)
- HDmemcpy(&(right_node_ptrs[0]), &(left_node_ptrs[mid_record + 1]),
+ HDmemcpy(&(right_node_ptrs[0]), &(left_node_ptrs[mid_record + (unsigned)1]),
sizeof(H5B2_node_ptr_t) * (old_node_nrec - mid_record));
/* Copy "middle" record to internal node */
@@ -278,7 +278,7 @@ H5B2_split1(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *cur
/* Update record counts in child nodes */
internal->node_ptrs[idx].node_nrec = *left_nrec = mid_record;
- internal->node_ptrs[idx + 1].node_nrec = *right_nrec = old_node_nrec - (mid_record + 1);
+ internal->node_ptrs[idx + 1].node_nrec = *right_nrec = old_node_nrec - (mid_record + (unsigned)1);
/* Determine total number of records in new child nodes */
if(depth > 1) {
@@ -288,11 +288,11 @@ H5B2_split1(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth, H5B2_node_ptr_t *cur
/* Compute total of all records in each child node */
new_left_all_nrec = internal->node_ptrs[idx].node_nrec;
- for(u = 0; u < (*left_nrec + 1); u++)
+ for(u = 0; u < (*left_nrec + (unsigned)1); u++)
new_left_all_nrec += left_node_ptrs[u].all_nrec;
new_right_all_nrec = internal->node_ptrs[idx + 1].node_nrec;
- for(u = 0; u < (*right_nrec + 1); u++)
+ for(u = 0; u < (*right_nrec + (unsigned)1); u++)
new_right_all_nrec += right_node_ptrs[u].all_nrec;
internal->node_ptrs[idx].all_nrec = new_left_all_nrec;
@@ -438,7 +438,7 @@ H5B2_redistribute2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
void *left_child, *right_child; /* Pointers to child nodes */
- unsigned *left_nrec, *right_nrec; /* Pointers to child # of records */
+ uint16_t *left_nrec, *right_nrec; /* Pointers to child # of records */
uint8_t *left_native, *right_native; /* Pointers to childs' native records */
H5B2_node_ptr_t *left_node_ptrs = NULL, *right_node_ptrs = NULL;/* Pointers to childs' node pointer info */
hssize_t left_moved_nrec = 0, right_moved_nrec = 0; /* Number of records moved, for internal redistrib */
@@ -516,8 +516,8 @@ H5B2_redistribute2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
if(*left_nrec < *right_nrec) {
/* Moving record from right node to left */
- unsigned new_right_nrec = (*left_nrec + *right_nrec) / 2; /* New number of records for right child */
- unsigned move_nrec = *right_nrec - new_right_nrec; /* Number of records to move from right node to left */
+ uint16_t new_right_nrec = (*left_nrec + *right_nrec) / 2; /* New number of records for right child */
+ uint16_t move_nrec = *right_nrec - new_right_nrec; /* Number of records to move from right node to left */
/* Copy record from parent node down into left child */
HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size);
@@ -547,7 +547,7 @@ H5B2_redistribute2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
HDmemcpy(&(left_node_ptrs[*left_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * move_nrec);
/* Slide node pointers in right node down */
- HDmemmove(&(right_node_ptrs[0]), &(right_node_ptrs[move_nrec]), sizeof(H5B2_node_ptr_t) * (new_right_nrec + 1));
+ HDmemmove(&(right_node_ptrs[0]), &(right_node_ptrs[move_nrec]), sizeof(H5B2_node_ptr_t) * (new_right_nrec + (unsigned)1));
} /* end if */
/* Update number of records in child nodes */
@@ -557,8 +557,8 @@ H5B2_redistribute2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
else {
/* Moving record from left node to right */
- unsigned new_left_nrec = (*left_nrec + *right_nrec) / 2; /* New number of records for left child */
- unsigned move_nrec = *left_nrec - new_left_nrec; /* Number of records to move from left node to right */
+ uint16_t new_left_nrec = (*left_nrec + *right_nrec) / 2; /* New number of records for left child */
+ uint16_t move_nrec = *left_nrec - new_left_nrec; /* Number of records to move from left node to right */
/* Slide records in right node up */
HDmemmove(H5B2_NAT_NREC(right_native, hdr, move_nrec),
@@ -658,8 +658,8 @@ H5B2_redistribute3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
haddr_t middle_addr; /* Address of middle child node */
void *left_child, *right_child; /* Pointers to child nodes */
void *middle_child; /* Pointers to middle child node */
- unsigned *left_nrec, *right_nrec; /* Pointers to child # of records */
- unsigned *middle_nrec; /* Pointers to middle child # of records */
+ uint16_t *left_nrec, *right_nrec; /* Pointers to child # of records */
+ uint16_t *middle_nrec; /* Pointers to middle child # of records */
uint8_t *left_native, *right_native; /* Pointers to childs' native records */
uint8_t *middle_native; /* Pointers to middle child's native records */
H5B2_node_ptr_t *left_node_ptrs = NULL, *right_node_ptrs = NULL; /* Pointers to childs' node pointer info */
@@ -744,10 +744,10 @@ H5B2_redistribute3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
{
/* Compute new # of records in each node */
unsigned total_nrec = *left_nrec + *middle_nrec + *right_nrec + 2;
- unsigned new_middle_nrec = (total_nrec - 2) / 3;
- unsigned new_left_nrec = ((total_nrec - 2) - new_middle_nrec) / 2;
- unsigned new_right_nrec = (total_nrec - 2) - (new_left_nrec + new_middle_nrec);
- unsigned curr_middle_nrec = *middle_nrec;
+ uint16_t new_middle_nrec = (total_nrec - 2) / 3;
+ uint16_t new_left_nrec = ((total_nrec - 2) - new_middle_nrec) / 2;
+ uint16_t new_right_nrec = (total_nrec - 2) - (new_left_nrec + new_middle_nrec);
+ uint16_t curr_middle_nrec = *middle_nrec;
/* Sanity check rounding */
HDassert(new_middle_nrec <= new_left_nrec);
@@ -755,7 +755,7 @@ H5B2_redistribute3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
/* Move records into left node */
if(new_left_nrec > *left_nrec) {
- unsigned moved_middle_nrec = 0; /* Number of records moved into left node */
+ uint16_t moved_middle_nrec = 0; /* Number of records moved into left node */
/* Move left parent record down to left node */
HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size);
@@ -1027,7 +1027,7 @@ H5B2_merge2(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
const H5AC_class_t *child_class; /* Pointer to child node's class info */
haddr_t left_addr, right_addr; /* Addresses of left & right child nodes */
void *left_child, *right_child; /* Pointers to left & right child nodes */
- unsigned *left_nrec, *right_nrec; /* Pointers to left & right child # of records */
+ uint16_t *left_nrec, *right_nrec; /* Pointers to left & right child # of records */
uint8_t *left_native, *right_native; /* Pointers to left & right children's native records */
H5B2_node_ptr_t *left_node_ptrs = NULL, *right_node_ptrs = NULL;/* Pointers to childs' node pointer info */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1177,8 +1177,8 @@ H5B2_merge3(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
haddr_t middle_addr; /* Address of middle child node */
void *left_child, *right_child; /* Pointers to left & right child nodes */
void *middle_child; /* Pointer to middle child node */
- unsigned *left_nrec, *right_nrec; /* Pointers to left & right child # of records */
- unsigned *middle_nrec; /* Pointer to middle child # of records */
+ uint16_t *left_nrec, *right_nrec; /* Pointers to left & right child # of records */
+ uint16_t *middle_nrec; /* Pointer to middle child # of records */
uint8_t *left_native, *right_native; /* Pointers to left & right children's native records */
uint8_t *middle_native; /* Pointer to middle child's native records */
H5B2_node_ptr_t *left_node_ptrs = NULL, *right_node_ptrs = NULL;/* Pointers to childs' node pointer info */
@@ -2837,7 +2837,7 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5B2_iterate_size_node
+ * Function: H5B2_node_size
*
* Purpose: Iterate over all the records from a B-tree node, collecting
* btree storage info.
@@ -2850,13 +2850,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_iterate_size_node(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
+H5B2_node_size(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
const H5B2_node_ptr_t *curr_node, hsize_t *btree_size)
{
H5B2_internal_t *internal = NULL; /* Pointer to internal node */
herr_t ret_value = SUCCEED; /* Iterator return value */
- FUNC_ENTER_NOAPI(H5B2_iterate_size_node, FAIL)
+ FUNC_ENTER_NOAPI(H5B2_node_size, FAIL)
/* Check arguments. */
HDassert(hdr);
@@ -2874,7 +2874,7 @@ H5B2_iterate_size_node(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
/* Descend into children */
for(u = 0; u < internal->nrec + 1; u++)
- if(H5B2_iterate_size_node(hdr, dxpl_id, (depth - 1), &(internal->node_ptrs[u]), btree_size) < 0)
+ if(H5B2_node_size(hdr, dxpl_id, (depth - 1), &(internal->node_ptrs[u]), btree_size) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node iteration failed")
} /* end if */
else /* depth is 1: count all the leaf nodes from this node */
@@ -2888,7 +2888,7 @@ done:
HGOTO_ERROR(H5E_BTREE, H5E_CANTUNPROTECT, FAIL, "unable to release B-tree node")
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5B2_iterate_size_node() */
+} /* H5B2_node_size() */
#ifdef H5B2_DEBUG
diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h
index 71e3ac5..8b68d1e 100644
--- a/src/H5B2pkg.h
+++ b/src/H5B2pkg.h
@@ -41,11 +41,15 @@
/**************************/
/* Size of storage for number of records per node (on disk) */
-#define H5B2_SIZEOF_RECORDS_PER_NODE 2
+#define H5B2_SIZEOF_RECORDS_PER_NODE (unsigned)2
/* Size of a "tree pointer" (on disk) */
/* (essentially, the largest internal pointer allowed) */
-#define H5B2_TREE_POINTER_SIZE(f) (H5F_SIZEOF_ADDR(f)+H5B2_SIZEOF_RECORDS_PER_NODE+H5F_SIZEOF_SIZE(f))
+#define H5B2_TREE_POINTER_SIZE(h) ( \
+ (h)->sizeof_addr + \
+ H5B2_SIZEOF_RECORDS_PER_NODE + \
+ (h)->sizeof_size \
+ )
/* Size of a internal node pointer (on disk) */
#define H5B2_INT_POINTER_SIZE(h, d) ( \
@@ -59,24 +63,24 @@
/* Format overhead for all v2 B-tree metadata in the file */
#define H5B2_METADATA_PREFIX_SIZE ( \
- H5_SIZEOF_MAGIC /* Signature */ \
- + 1 /* Version */ \
- + 1 /* Tree type */ \
- + H5B2_SIZEOF_CHKSUM /* Metadata checksum */ \
+ (unsigned)H5_SIZEOF_MAGIC /* Signature */ \
+ + (unsigned)1 /* Version */ \
+ + (unsigned)1 /* Tree type */ \
+ + (unsigned)H5B2_SIZEOF_CHKSUM /* Metadata checksum */ \
)
/* Size of the v2 B-tree header on disk */
-#define H5B2_HEADER_SIZE(f) ( \
+#define H5B2_HEADER_SIZE(h) ( \
/* General metadata fields */ \
H5B2_METADATA_PREFIX_SIZE \
\
/* Header specific fields */ \
- + 4 /* Node size, in bytes */ \
- + 2 /* Record size, in bytes */ \
- + 2 /* Depth of tree */ \
- + 1 /* Split % of full (as integer, ie. "98" means 98%) */ \
- + 1 /* Merge % of full (as integer, ie. "98" means 98%) */ \
- + H5B2_TREE_POINTER_SIZE(f) /* Node pointer to root node in tree */ \
+ + (unsigned)4 /* Node size, in bytes */ \
+ + (unsigned)2 /* Record size, in bytes */ \
+ + (unsigned)2 /* Depth of tree */ \
+ + (unsigned)1 /* Split % of full (as integer, ie. "98" means 98%) */ \
+ + (unsigned)1 /* Merge % of full (as integer, ie. "98" means 98%) */ \
+ + H5B2_TREE_POINTER_SIZE(h) /* Node pointer to root node in tree */ \
)
/* Size of the v2 B-tree internal node prefix */
@@ -119,7 +123,7 @@
/* A "node pointer" to another B-tree node */
typedef struct {
haddr_t addr; /* Address of other node */
- unsigned node_nrec; /* Number of records used in node pointed to */
+ uint16_t node_nrec; /* Number of records used in node pointed to */
hsize_t all_nrec; /* Number of records in node pointed to and all it's children */
} H5B2_node_ptr_t;
@@ -143,13 +147,13 @@ typedef struct H5B2_hdr_t {
H5B2_node_ptr_t root; /* Node pointer to root node in B-tree */
/* Information set by user (stored) */
- unsigned split_percent; /* Percent full at which to split the node, when inserting */
- unsigned merge_percent; /* Percent full at which to merge the node, when deleting */
- size_t node_size; /* Size of B-tree nodes, in bytes */
- size_t rrec_size; /* Size of "raw" (on disk) record, in bytes */
+ uint8_t split_percent; /* Percent full at which to split the node, when inserting */
+ uint8_t merge_percent; /* Percent full at which to merge the node, when deleting */
+ uint32_t node_size; /* Size of B-tree nodes, in bytes */
+ uint32_t rrec_size; /* Size of "raw" (on disk) record, in bytes */
/* Dynamic information (stored) */
- unsigned depth; /* B-tree's overall depth */
+ uint16_t depth; /* B-tree's overall depth */
/* Derived information from user's information (not stored) */
uint8_t max_nrec_size; /* Size to store max. # of records in any node (in bytes) */
@@ -178,7 +182,7 @@ typedef struct H5B2_leaf_t {
/* Internal B-tree information */
H5B2_hdr_t *hdr; /* Pointer to the [pinned] v2 B-tree header */
uint8_t *leaf_native; /* Pointer to native records */
- unsigned nrec; /* Number of records in node */
+ uint16_t nrec; /* Number of records in node */
} H5B2_leaf_t;
/* B-tree internal node information */
@@ -190,8 +194,8 @@ typedef struct H5B2_internal_t {
H5B2_hdr_t *hdr; /* Pointer to the [pinned] v2 B-tree header */
uint8_t *int_native; /* Pointer to native records */
H5B2_node_ptr_t *node_ptrs; /* Pointer to node pointers */
- unsigned nrec; /* Number of records in node */
- unsigned depth; /* Depth of this node in the B-tree */
+ uint16_t nrec; /* Number of records in node */
+ uint16_t depth; /* Depth of this node in the B-tree */
} H5B2_internal_t;
/* v2 B-tree */
@@ -203,8 +207,8 @@ struct H5B2_t {
/* User data for metadata cache 'load' callback */
typedef struct {
H5B2_hdr_t *hdr; /* Pointer to the [pinned] v2 B-tree header */
- unsigned nrec; /* Number of records in node to load */
- unsigned depth; /* Depth of node to load */
+ uint16_t nrec; /* Number of records in node to load */
+ uint16_t depth; /* Depth of node to load */
} H5B2_int_load_ud1_t;
#ifdef H5B2_TESTING
@@ -253,7 +257,7 @@ H5_DLL H5B2_hdr_t *H5B2_hdr_alloc(H5F_t *f);
H5_DLL haddr_t H5B2_hdr_create(H5F_t *f, hid_t dxpl_id,
const H5B2_create_t *cparam);
H5_DLL herr_t H5B2_hdr_init(H5F_t *f, H5B2_hdr_t *hdr,
- const H5B2_create_t *cparam, unsigned depth);
+ const H5B2_create_t *cparam, uint16_t depth);
H5_DLL herr_t H5B2_hdr_incr(H5B2_hdr_t *hdr);
H5_DLL herr_t H5B2_hdr_decr(H5B2_hdr_t *hdr);
H5_DLL herr_t H5B2_hdr_fuse_incr(H5B2_hdr_t *hdr);
@@ -281,7 +285,7 @@ H5_DLL herr_t H5B2_insert_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id,
/* Routines for iterating over nodes/records */
H5_DLL herr_t H5B2_iterate_node(H5B2_hdr_t *hdr, hid_t dxpl_id, unsigned depth,
const H5B2_node_ptr_t *curr_node, H5B2_operator_t op, void *op_data);
-H5_DLL herr_t H5B2_iterate_size_node(H5B2_hdr_t *hdr, hid_t dxpl_id,
+H5_DLL herr_t H5B2_node_size(H5B2_hdr_t *hdr, hid_t dxpl_id,
unsigned depth, const H5B2_node_ptr_t *curr_node, hsize_t *op_data);
/* Routines for locating records */
@@ -331,16 +335,9 @@ H5_DLL herr_t H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
/* Testing routines */
#ifdef H5B2_TESTING
-H5_DLL herr_t H5B2_get_root_addr_test(H5F_t *f, hid_t dxpl_id,
- const H5B2_class_t *type, haddr_t addr, haddr_t *root_addr);
-H5_DLL herr_t H5B2_get_root_addr_test_2(H5B2_t *bt2, haddr_t *root_addr);
-H5_DLL int H5B2_get_node_depth_test(H5F_t *f, hid_t dxpl_id,
- const H5B2_class_t *type, haddr_t addr, void *udata);
-H5_DLL int H5B2_get_node_depth_test_2(H5B2_t *bt2, hid_t dxpl_id, void *udata);
-H5_DLL herr_t H5B2_get_node_info_test(H5F_t *f, hid_t dxpl_id,
- const H5B2_class_t *type, haddr_t addr, void *udata,
- H5B2_node_info_test_t *ninfo);
-H5_DLL herr_t H5B2_get_node_info_test_2(H5B2_t *bt2, hid_t dxpl_id,
+H5_DLL herr_t H5B2_get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr);
+H5_DLL int H5B2_get_node_depth_test(H5B2_t *bt2, hid_t dxpl_id, void *udata);
+H5_DLL herr_t H5B2_get_node_info_test(H5B2_t *bt2, hid_t dxpl_id,
void *udata, H5B2_node_info_test_t *ninfo);
#endif /* H5B2_TESTING */
diff --git a/src/H5B2private.h b/src/H5B2private.h
index ed3447b..cfdf868 100644
--- a/src/H5B2private.h
+++ b/src/H5B2private.h
@@ -104,10 +104,10 @@ struct H5B2_class_t {
/* v2 B-tree creation parameters */
typedef struct H5B2_create_t {
const H5B2_class_t *cls; /* v2 B-tree client class */
- size_t node_size; /* Size of each node (in bytes) */
- size_t rrec_size; /* Size of raw record (in bytes) */
- unsigned split_percent; /* % full to split nodes */
- unsigned merge_percent; /* % full to merge nodes */
+ uint32_t node_size; /* Size of each node (in bytes) */
+ uint32_t rrec_size; /* Size of raw record (in bytes) */
+ uint8_t split_percent; /* % full to split nodes */
+ uint8_t merge_percent; /* % full to merge nodes */
} H5B2_create_t;
/* v2 B-tree metadata statistics info */
@@ -128,60 +128,33 @@ typedef struct H5B2_t H5B2_t;
/***************************************/
/* Library-private Function Prototypes */
/***************************************/
-H5_DLL herr_t H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam,
- haddr_t *addr_p);
-H5_DLL H5B2_t *H5B2_create_2(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam);
+H5_DLL H5B2_t *H5B2_create(H5F_t *f, hid_t dxpl_id, const H5B2_create_t *cparam);
H5_DLL H5B2_t *H5B2_open(H5F_t *f, hid_t dxpl_id, haddr_t addr);
H5_DLL herr_t H5B2_get_addr(const H5B2_t *bt2, haddr_t *addr/*out*/);
-H5_DLL herr_t H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, void *udata);
-H5_DLL herr_t H5B2_insert_2(H5B2_t *bt2, hid_t dxpl_id, void *udata);
-H5_DLL herr_t H5B2_iterate(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, H5B2_operator_t op, void *op_data);
-H5_DLL herr_t H5B2_iterate_2(H5B2_t *bt2, hid_t dxpl_id, H5B2_operator_t op,
+H5_DLL herr_t H5B2_insert(H5B2_t *bt2, hid_t dxpl_id, void *udata);
+H5_DLL herr_t H5B2_iterate(H5B2_t *bt2, hid_t dxpl_id, H5B2_operator_t op,
void *op_data);
-H5_DLL htri_t H5B2_find(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, void *udata, H5B2_found_t op, void *op_data);
-H5_DLL htri_t H5B2_find_2(H5B2_t *bt2, hid_t dxpl_id, void *udata,
+H5_DLL htri_t H5B2_find(H5B2_t *bt2, hid_t dxpl_id, void *udata,
H5B2_found_t op, void *op_data);
-H5_DLL herr_t H5B2_index(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, H5_iter_order_t order, hsize_t idx, H5B2_found_t op,
- void *op_data);
-H5_DLL herr_t H5B2_index_2(H5B2_t *bt2, hid_t dxpl_id, H5_iter_order_t order,
+H5_DLL herr_t H5B2_index(H5B2_t *bt2, hid_t dxpl_id, H5_iter_order_t order,
hsize_t idx, H5B2_found_t op, void *op_data);
-H5_DLL herr_t H5B2_neighbor(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, H5B2_compare_t comp, void *udata, H5B2_found_t op,
- void *op_data);
-H5_DLL herr_t H5B2_neighbor_2(H5B2_t *bt2, hid_t dxpl_id, H5B2_compare_t range,
+H5_DLL herr_t H5B2_neighbor(H5B2_t *bt2, hid_t dxpl_id, H5B2_compare_t range,
void *udata, H5B2_found_t op, void *op_data);
-H5_DLL herr_t H5B2_modify(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, void *udata, H5B2_modify_t op, void *op_data);
-H5_DLL herr_t H5B2_modify_2(H5B2_t *bt2, hid_t dxpl_id, void *udata,
+H5_DLL herr_t H5B2_modify(H5B2_t *bt2, hid_t dxpl_id, void *udata,
H5B2_modify_t op, void *op_data);
-H5_DLL herr_t H5B2_remove(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, void *udata, H5B2_remove_t op, void *op_data);
-H5_DLL herr_t H5B2_remove_2(H5B2_t *b2, hid_t dxpl_id, void *udata,
+H5_DLL herr_t H5B2_remove(H5B2_t *b2, hid_t dxpl_id, void *udata,
H5B2_remove_t op, void *op_data);
-H5_DLL herr_t H5B2_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, H5_iter_order_t order, hsize_t idx, H5B2_remove_t op,
- void *op_data);
-H5_DLL herr_t H5B2_remove_by_idx_2(H5B2_t *bt2, hid_t dxpl_id,
+H5_DLL herr_t H5B2_remove_by_idx(H5B2_t *bt2, hid_t dxpl_id,
H5_iter_order_t order, hsize_t idx, H5B2_remove_t op, void *op_data);
-H5_DLL herr_t H5B2_get_nrec(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, hsize_t *nrec);
-H5_DLL herr_t H5B2_get_nrec_2(const H5B2_t *bt2, hsize_t *nrec);
-H5_DLL herr_t H5B2_iterate_size(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
- haddr_t addr, hsize_t *op_data);
-H5_DLL herr_t H5B2_iterate_size_2(H5B2_t *bt2, hid_t dxpl_id,
+H5_DLL herr_t H5B2_get_nrec(const H5B2_t *bt2, hsize_t *nrec);
+H5_DLL herr_t H5B2_size(H5B2_t *bt2, hid_t dxpl_id,
hsize_t *btree_size);
H5_DLL herr_t H5B2_close(H5B2_t *bt2, hid_t dxpl_id);
H5_DLL herr_t H5B2_delete(H5F_t *f, hid_t dxpl_id, haddr_t addr,
H5B2_remove_t op, void *op_data);
/* Statistics routines */
-H5_DLL herr_t H5B2_stat_info(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- H5B2_stat_t *info);
-H5_DLL herr_t H5B2_stat_info_2(H5B2_t *bt2, hid_t dxpl_id, H5B2_stat_t *info);
+H5_DLL herr_t H5B2_stat_info(H5B2_t *bt2, H5B2_stat_t *info);
#endif /* _H5B2private_H */
diff --git a/src/H5B2stat.c b/src/H5B2stat.c
index 391d96d..0ee404e 100644
--- a/src/H5B2stat.c
+++ b/src/H5B2stat.c
@@ -71,7 +71,7 @@
/*-------------------------------------------------------------------------
- * Function: H5B2_stat_info_2
+ * Function: H5B2_stat_info
*
* Purpose: Retrieve metadata statistics for a v2 B-tree
*
@@ -84,11 +84,11 @@
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_stat_info_2(H5B2_t *bt2, hid_t dxpl_id, H5B2_stat_t *info)
+H5B2_stat_info(H5B2_t *bt2, H5B2_stat_t *info)
{
H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_stat_info_2)
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_stat_info)
/* Check arguments. */
HDassert(info);
@@ -104,49 +104,55 @@ H5B2_stat_info_2(H5B2_t *bt2, hid_t dxpl_id, H5B2_stat_t *info)
info->nrecords = hdr->root.all_nrec;
FUNC_LEAVE_NOAPI(SUCCEED)
-} /* H5B2_stat_info_2() */
+} /* H5B2_stat_info() */
/*-------------------------------------------------------------------------
- * Function: H5B2_stat_info
+ * Function: H5B2_size
*
- * Purpose: Retrieve metadata statistics for a v2 B-tree
+ * Purpose: Iterate over all the records in the B-tree, collecting
+ * storage info.
*
- * Return: Success: non-negative
+ * Return: non-negative on success, negative on error
*
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Monday, March 6, 2006
+ * Programmer: Vailin Choi
+ * June 19 2007
*
*-------------------------------------------------------------------------
*/
herr_t
-H5B2_stat_info(H5F_t *f, hid_t dxpl_id, haddr_t addr, H5B2_stat_t *info)
+H5B2_size(H5B2_t *bt2, hid_t dxpl_id, hsize_t *btree_size)
{
- H5B2_hdr_t *hdr = NULL; /* Pointer to the B-tree header */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5B2_hdr_t *hdr; /* Pointer to the B-tree header */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_NOINIT(H5B2_stat_info)
+ FUNC_ENTER_NOAPI(H5B2_size, FAIL)
/* Check arguments. */
- HDassert(f);
- HDassert(H5F_addr_defined(addr));
- HDassert(info);
+ HDassert(bt2);
+ HDassert(btree_size);
- /* Look up the B-tree header */
- if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, NULL, NULL, H5AC_READ)))
- HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to load B-tree header")
+ /* Set the shared v2 B-tree header's file context for this operation */
+ bt2->hdr->f = bt2->f;
- /* Get information about the B-tree */
- info->depth = hdr->depth;
- info->nrecords = hdr->root.all_nrec;
+ /* Get the v2 B-tree header */
+ hdr = bt2->hdr;
-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")
+ /* Add size of header to B-tree metadata total */
+ *btree_size += H5B2_HEADER_SIZE(hdr);
+
+ /* Iterate through records */
+ if(hdr->root.node_nrec > 0) {
+ /* Check for root node being a leaf */
+ if(hdr->depth == 0)
+ *btree_size += hdr->node_size;
+ else
+ /* Iterate through nodes */
+ if(H5B2_node_size(hdr, dxpl_id, hdr->depth, &hdr->root, btree_size) < 0)
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTLIST, FAIL, "node iteration failed")
+ } /* end if */
+done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5B2_stat_info() */
+} /* H5B2_size() */
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 */
diff --git a/src/H5Gdense.c b/src/H5Gdense.c
index 7dea804..f935a74 100644
--- a/src/H5Gdense.c
+++ b/src/H5Gdense.c
@@ -326,7 +326,7 @@ HDfprintf(stderr, "%s: fheap_id_len = %Zu\n", FUNC, fheap_id_len);
fheap_id_len; /* Fractal heap ID */
bt2_cparam.split_percent = H5G_NAME_BT2_SPLIT_PERC;
bt2_cparam.merge_percent = H5G_NAME_BT2_MERGE_PERC;
- if(NULL == (bt2_name = H5B2_create_2(f, dxpl_id, &bt2_cparam)))
+ if(NULL == (bt2_name = H5B2_create(f, dxpl_id, &bt2_cparam)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for name index")
/* Retrieve the v2 B-tree's address in the file */
@@ -346,7 +346,7 @@ HDfprintf(stderr, "%s: linfo->name_bt2_addr = %a\n", FUNC, linfo->name_bt2_addr)
fheap_id_len; /* Fractal heap ID */
bt2_cparam.split_percent = H5G_CORDER_BT2_SPLIT_PERC;
bt2_cparam.merge_percent = H5G_CORDER_BT2_MERGE_PERC;
- if(NULL == (bt2_corder = H5B2_create_2(f, dxpl_id, &bt2_cparam)))
+ if(NULL == (bt2_corder = H5B2_create(f, dxpl_id, &bt2_cparam)))
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create v2 B-tree for creation order index")
/* Retrieve the v2 B-tree's address in the file */
@@ -453,7 +453,7 @@ HDfprintf(stderr, "%s: HDstrlen(lnk->name) = %Zu, link_size = %Zu\n", FUNC, HDst
/* udata.id already set in H5HF_insert() call */
/* Insert link into 'name' tracking v2 B-tree */
- if(H5B2_insert_2(bt2_name, dxpl_id, &udata) < 0)
+ if(H5B2_insert(bt2_name, dxpl_id, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert record into v2 B-tree")
/* Check if we should create a creation order index v2 B-tree record */
@@ -464,7 +464,7 @@ HDfprintf(stderr, "%s: HDstrlen(lnk->name) = %Zu, link_size = %Zu\n", FUNC, HDst
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index")
/* Insert the record into the creation order index v2 B-tree */
- if(H5B2_insert_2(bt2_corder, dxpl_id, &udata) < 0)
+ if(H5B2_insert(bt2_corder, dxpl_id, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert record into v2 B-tree")
} /* end if */
@@ -570,7 +570,7 @@ H5G_dense_lookup(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
udata.found_op_data = lnk;
/* Find & copy the named link in the 'name' index */
- if((ret_value = H5B2_find_2(bt2_name, dxpl_id, &udata, NULL, NULL)) < 0)
+ if((ret_value = H5B2_find(bt2_name, dxpl_id, &udata, NULL, NULL)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to locate link in name index")
done:
@@ -743,7 +743,7 @@ H5G_dense_lookup_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
udata.lnk = lnk;
/* Find & copy the link in the appropriate index */
- if(H5B2_index_2(bt2, dxpl_id, order, n, H5G_dense_lookup_by_idx_bt2_cb, &udata) < 0)
+ if(H5B2_index(bt2, dxpl_id, order, n, H5G_dense_lookup_by_idx_bt2_cb, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to locate link in index")
} /* end if */
else { /* Otherwise, we need to build a table of the links and sort it */
@@ -1056,7 +1056,7 @@ H5G_dense_iterate(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
/* Iterate over the records in the v2 B-tree's "native" order */
/* (by hash of name) */
- if((ret_value = H5B2_iterate_2(bt2, dxpl_id, H5G_dense_iterate_bt2_cb, &udata)) < 0)
+ if((ret_value = H5B2_iterate(bt2, dxpl_id, H5G_dense_iterate_bt2_cb, &udata)) < 0)
HERROR(H5E_SYM, H5E_BADITER, "link iteration failed");
/* Update the last link examined, if requested */
@@ -1255,7 +1255,7 @@ H5G_dense_get_name_by_idx(H5F_t *f, hid_t dxpl_id, H5O_linfo_t *linfo,
udata.name_size = size;
/* Retrieve the name according to the v2 B-tree's index order */
- if(H5B2_index_2(bt2, dxpl_id, order, n, H5G_dense_get_name_by_idx_bt2_cb, &udata) < 0)
+ if(H5B2_index(bt2, dxpl_id, order, n, H5G_dense_get_name_by_idx_bt2_cb, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTLIST, FAIL, "can't locate object in v2 B-tree")
/* Set return value */
@@ -1334,7 +1334,7 @@ H5G_dense_remove_fh_cb(const void *obj, size_t UNUSED obj_len, void *_udata)
bt2_udata.corder = lnk->corder;
/* Remove the record from the name index v2 B-tree */
- if(H5B2_remove_2(bt2, udata->dxpl_id, &bt2_udata, NULL, NULL) < 0)
+ if(H5B2_remove(bt2, udata->dxpl_id, &bt2_udata, NULL, NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from creation order index v2 B-tree")
} /* end if */
@@ -1457,7 +1457,7 @@ H5G_dense_remove(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
udata.replace_names = TRUE;
/* Remove the record from the name index v2 B-tree */
- if(H5B2_remove_2(bt2, dxpl_id, &udata, H5G_dense_remove_bt2_cb, &udata) < 0)
+ if(H5B2_remove(bt2, dxpl_id, &udata, H5G_dense_remove_bt2_cb, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from name index v2 B-tree")
done:
@@ -1583,7 +1583,7 @@ H5G_dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata)
/* Set the common information for the v2 B-tree remove operation */
/* Remove the record from the name index v2 B-tree */
- if(H5B2_remove_2(bt2, bt2_udata->dxpl_id, &other_bt2_udata, NULL, NULL) < 0)
+ if(H5B2_remove(bt2, bt2_udata->dxpl_id, &other_bt2_udata, NULL, NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, H5_ITER_ERROR, "unable to remove link from 'other' index v2 B-tree")
} /* end if */
@@ -1694,7 +1694,7 @@ H5G_dense_remove_by_idx(H5F_t *f, hid_t dxpl_id, const H5O_linfo_t *linfo,
udata.grp_full_path_r = grp_full_path_r;
/* Remove the record from the name index v2 B-tree */
- if(H5B2_remove_by_idx_2(bt2, dxpl_id, order, n, H5G_dense_remove_by_idx_bt2_cb, &udata) < 0)
+ if(H5B2_remove_by_idx(bt2, dxpl_id, order, n, H5G_dense_remove_by_idx_bt2_cb, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTREMOVE, FAIL, "unable to remove link from indexed v2 B-tree")
} /* end if */
else { /* Otherwise, we need to build a table of the links and sort it */
diff --git a/src/H5Gobj.c b/src/H5Gobj.c
index fe85d18..4281ac0 100644
--- a/src/H5Gobj.c
+++ b/src/H5Gobj.c
@@ -336,7 +336,7 @@ H5G_obj_get_linfo(const H5O_loc_t *grp_oloc, H5O_linfo_t *linfo, hid_t dxpl_id)
/* Retrieve # of records in "name" B-tree */
/* (should be same # of records in all indices) */
- if(H5B2_get_nrec_2(bt2_name, &linfo->nlinks) < 0)
+ if(H5B2_get_nrec(bt2_name, &linfo->nlinks) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve # of records in index")
} /* end if */
else {
diff --git a/src/H5Goh.c b/src/H5Goh.c
index fcba5bf..2494838 100644
--- a/src/H5Goh.c
+++ b/src/H5Goh.c
@@ -364,7 +364,7 @@ H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
/* Get name index B-tree size */
- if(H5B2_iterate_size_2(bt2_name, dxpl_id, &bh_info->index_size) < 0)
+ if(H5B2_size(bt2_name, dxpl_id, &bh_info->index_size) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info for name index")
} /* end if */
@@ -375,7 +375,7 @@ H5O_group_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index")
/* Get creation order index B-tree size */
- if(H5B2_iterate_size_2(bt2_corder, dxpl_id, &bh_info->index_size) < 0)
+ if(H5B2_size(bt2_corder, dxpl_id, &bh_info->index_size) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info for creation order index")
} /* end if */
diff --git a/src/H5Gtest.c b/src/H5Gtest.c
index 1cfcdb6..791c13a 100644
--- a/src/H5Gtest.c
+++ b/src/H5Gtest.c
@@ -409,7 +409,7 @@ H5G_new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count)
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
/* Retrieve # of records in name index */
- if(H5B2_get_nrec_2(bt2_name, name_count) < 0)
+ if(H5B2_get_nrec(bt2_name, name_count) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from name index")
/* Check if there is a creation order index */
@@ -419,7 +419,7 @@ H5G_new_dense_info_test(hid_t gid, hsize_t *name_count, hsize_t *corder_count)
HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index")
/* Retrieve # of records in creation order index */
- if(H5B2_get_nrec_2(bt2_corder, corder_count) < 0)
+ if(H5B2_get_nrec(bt2_corder, corder_count) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from creation order index")
} /* end if */
else
diff --git a/src/H5HFhuge.c b/src/H5HFhuge.c
index b8d0057..353ceb3 100644
--- a/src/H5HFhuge.c
+++ b/src/H5HFhuge.c
@@ -157,7 +157,7 @@ H5HF_huge_bt2_create(H5HF_hdr_t *hdr, hid_t dxpl_id)
bt2_cparam.merge_percent = H5HF_HUGE_BT2_MERGE_PERC;
/* Create v2 B-tree for tracking 'huge' objects */
- if(NULL == (hdr->huge_bt2 = H5B2_create_2(hdr->f, dxpl_id, &bt2_cparam)))
+ if(NULL == (hdr->huge_bt2 = H5B2_create(hdr->f, dxpl_id, &bt2_cparam)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTCREATE, FAIL, "can't create v2 B-tree for tracking 'huge' heap objects")
/* Retrieve the v2 B-tree's address in the file */
@@ -403,7 +403,7 @@ HDfprintf(stderr, "%s: obj_rec = {%a, %Hu, %x, %Hu}\n", FUNC, obj_rec.addr, obj_
#endif /* QAK */
/* Insert record for object in v2 B-tree */
- if(H5B2_insert_2(hdr->huge_bt2, dxpl_id, &obj_rec) < 0)
+ if(H5B2_insert(hdr->huge_bt2, dxpl_id, &obj_rec) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "couldn't insert object tracking record in v2 B-tree")
/* Encode ID for user */
@@ -424,7 +424,7 @@ HDfprintf(stderr, "%s: obj_rec = {%a, %Hu}\n", FUNC, obj_rec.addr, obj_rec.len);
#endif /* QAK */
/* Insert record for object in v2 B-tree */
- if(H5B2_insert_2(hdr->huge_bt2, dxpl_id, &obj_rec) < 0)
+ if(H5B2_insert(hdr->huge_bt2, dxpl_id, &obj_rec) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "couldn't insert object tracking record in v2 B-tree")
/* Encode ID for user */
@@ -471,7 +471,7 @@ HDfprintf(stderr, "%s: indir_rec = {%a, %Hu, %Hu}\n", FUNC, indir_rec.addr, indi
} /* end else */
/* Insert record for tracking object in v2 B-tree */
- if(H5B2_insert_2(hdr->huge_bt2, dxpl_id, ins_rec) < 0)
+ if(H5B2_insert(hdr->huge_bt2, dxpl_id, ins_rec) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "couldn't insert object tracking record in v2 B-tree")
/* Encode ID for user */
@@ -557,7 +557,7 @@ H5HF_huge_get_obj_len(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size)
/* Look up object in v2 B-tree */
- if(H5B2_find_2(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_indir_found, &found_rec) != TRUE)
+ if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_indir_found, &found_rec) != TRUE)
HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree")
/* Retrieve the object's length */
@@ -571,7 +571,7 @@ H5HF_huge_get_obj_len(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size)
/* Look up object in v2 B-tree */
- if(H5B2_find_2(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE)
+ if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE)
HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree")
/* Retrieve the object's length */
@@ -648,7 +648,7 @@ H5HF_huge_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size)
/* Look up object in v2 B-tree */
- if(H5B2_find_2(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_indir_found, &found_rec) != TRUE)
+ if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_indir_found, &found_rec) != TRUE)
HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree")
/* Retrieve the object's address & length */
@@ -664,7 +664,7 @@ H5HF_huge_op_real(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size)
/* Look up object in v2 B-tree */
- if(H5B2_find_2(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE)
+ if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE)
HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree")
/* Retrieve the object's address & length */
@@ -792,7 +792,7 @@ H5HF_huge_write(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size)
/* Look up object in v2 B-tree */
- if(H5B2_find_2(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE)
+ if(H5B2_find(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_found, &found_rec) != TRUE)
HGOTO_ERROR(H5E_HEAP, H5E_NOTFOUND, FAIL, "can't find object in B-tree")
/* Retrieve the object's address & length */
@@ -937,7 +937,7 @@ H5HF_huge_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id)
/* Remove the record for tracking the 'huge' object from the v2 B-tree */
/* (space in the file for the object is freed in the 'remove' callback) */
- if(H5B2_remove_2(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_dir_remove, &udata) < 0)
+ if(H5B2_remove(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_dir_remove, &udata) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree")
} /* end if */
else {
@@ -950,7 +950,7 @@ H5HF_huge_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id)
/* Remove the record for tracking the 'huge' object from the v2 B-tree */
/* (space in the file for the object is freed in the 'remove' callback) */
- if(H5B2_remove_2(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_dir_remove, &udata) < 0)
+ if(H5B2_remove(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_dir_remove, &udata) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree")
} /* end else */
} /* end if */
@@ -963,7 +963,7 @@ H5HF_huge_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id)
/* Remove the record for tracking the 'huge' object from the v2 B-tree */
/* (space in the file for the object is freed in the 'remove' callback) */
- if(H5B2_remove_2(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_indir_remove, &udata) < 0)
+ if(H5B2_remove(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_filt_indir_remove, &udata) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree")
} /* end if */
else {
@@ -974,7 +974,7 @@ H5HF_huge_remove(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id)
/* Remove the record for tracking the 'huge' object from the v2 B-tree */
/* (space in the file for the object is freed in the 'remove' callback) */
- if(H5B2_remove_2(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_remove, &udata) < 0)
+ if(H5B2_remove(hdr->huge_bt2, dxpl_id, &search_rec, H5HF_huge_bt2_indir_remove, &udata) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove object from B-tree")
} /* end else */
} /* end else */
diff --git a/src/H5HFstat.c b/src/H5HFstat.c
index 5b07e05..fb535b9 100644
--- a/src/H5HFstat.c
+++ b/src/H5HFstat.c
@@ -159,7 +159,7 @@ H5HF_size(const H5HF_t *fh, hid_t dxpl_id, hsize_t *heap_size)
HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for tracking 'huge' objects")
/* Get the B-tree storage */
- if(H5B2_iterate_size_2(bt2, dxpl_id, heap_size) < 0)
+ if(H5B2_size(bt2, dxpl_id, heap_size) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
} /* end if */
diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c
index 88b15b3..c624ee1 100644
--- a/src/H5Oattribute.c
+++ b/src/H5Oattribute.c
@@ -1885,7 +1885,7 @@ H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
/* Get name index B-tree size */
- if(H5B2_iterate_size_2(bt2_name, dxpl_id, &(bh_info->index_size)) < 0)
+ if(H5B2_size(bt2_name, dxpl_id, &(bh_info->index_size)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
} /* end if */
@@ -1896,7 +1896,7 @@ H5O_attr_bh_info(H5F_t *f, hid_t dxpl_id, H5O_t *oh, H5_ih_info_t *bh_info)
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index")
/* Get creation order index B-tree size */
- if(H5B2_iterate_size_2(bt2_corder, dxpl_id, &(bh_info->index_size)) < 0)
+ if(H5B2_size(bt2_corder, dxpl_id, &(bh_info->index_size)) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
} /* end if */
diff --git a/src/H5Otest.c b/src/H5Otest.c
index 31bcc86..45ade3a 100644
--- a/src/H5Otest.c
+++ b/src/H5Otest.c
@@ -198,7 +198,7 @@ H5O_is_attr_empty_test(hid_t oid)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
/* Retrieve # of records in name index */
- if(H5B2_get_nrec_2(bt2_name, &nattrs) < 0)
+ if(H5B2_get_nrec(bt2_name, &nattrs) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from name index")
} /* end if */
@@ -285,7 +285,7 @@ H5O_num_attrs_test(hid_t oid, hsize_t *nattrs)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
/* Retrieve # of records in name index */
- if(H5B2_get_nrec_2(bt2_name, &obj_nattrs) < 0)
+ if(H5B2_get_nrec(bt2_name, &obj_nattrs) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from name index")
} /* end if */
@@ -367,7 +367,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for name index")
/* Retrieve # of records in name index */
- if(H5B2_get_nrec_2(bt2_name, name_count) < 0)
+ if(H5B2_get_nrec(bt2_name, name_count) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from name index")
/* Check if there is a creation order index */
@@ -377,7 +377,7 @@ H5O_attr_dense_info_test(hid_t oid, hsize_t *name_count, hsize_t *corder_count)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for creation order index")
/* Retrieve # of records in creation order index */
- if(H5B2_get_nrec_2(bt2_corder, corder_count) < 0)
+ if(H5B2_get_nrec(bt2_corder, corder_count) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCOUNT, FAIL, "unable to retrieve # of records from creation order index")
} /* end if */
else
diff --git a/src/H5SM.c b/src/H5SM.c
index a2e46d5..7a678cb 100755
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -475,7 +475,7 @@ H5SM_create_index(H5F_t *f, H5SM_index_header_t *header, hid_t dxpl_id)
bt2_cparam.rrec_size = (size_t)H5SM_SOHM_ENTRY_SIZE(f);
bt2_cparam.split_percent = H5SM_B2_SPLIT_PERCENT;
bt2_cparam.merge_percent = H5SM_B2_MERGE_PERCENT;
- if(NULL == (bt2 = H5B2_create_2(f, dxpl_id, &bt2_cparam)))
+ if(NULL == (bt2 = H5B2_create(f, dxpl_id, &bt2_cparam)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTCREATE, FAIL, "B-tree creation failed for SOHM index")
/* Retrieve the v2 B-tree's address in the file */
@@ -721,7 +721,7 @@ H5SM_convert_list_to_btree(H5F_t *f, H5SM_index_header_t *header,
bt2_cparam.rrec_size = (size_t)H5SM_SOHM_ENTRY_SIZE(f);
bt2_cparam.split_percent = H5SM_B2_SPLIT_PERCENT;
bt2_cparam.merge_percent = H5SM_B2_MERGE_PERCENT;
- if(NULL == (bt2 = H5B2_create_2(f, dxpl_id, &bt2_cparam)))
+ if(NULL == (bt2 = H5B2_create(f, dxpl_id, &bt2_cparam)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTCREATE, FAIL, "B-tree creation failed for SOHM index")
/* Retrieve the v2 B-tree's address in the file */
@@ -750,7 +750,7 @@ H5SM_convert_list_to_btree(H5F_t *f, H5SM_index_header_t *header,
key.encoding = encoding_buf;
/* Insert the message into the B-tree */
- if(H5B2_insert_2(bt2, dxpl_id, &key) < 0)
+ if(H5B2_insert(bt2, dxpl_id, &key) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "couldn't add SOHM to B-tree")
/* Free buffer from H5SM_read_mesg */
@@ -1262,7 +1262,7 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
* return a heap ID, since a message with a reference count greater
* than 1 is always shared in the heap.
*/
- if(H5B2_modify_2(bt2, dxpl_id, &key, H5SM_incr_ref, &op_data) >= 0) {
+ if(H5B2_modify(bt2, dxpl_id, &key, H5SM_incr_ref, &op_data) >= 0) {
shared.u.heap_id = op_data.fheap_id;
found = TRUE;
} /* end if */
@@ -1348,7 +1348,7 @@ H5SM_write_mesg(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index")
} /* end if */
- if(H5B2_insert_2(bt2, dxpl_id, &key) < 0)
+ if(H5B2_insert(bt2, dxpl_id, &key) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTINSERT, FAIL, "couldn't add SOHM to B-tree")
} /* end else */
@@ -1709,7 +1709,7 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
/* If this returns failure, it means that the message wasn't found.
* If it succeeds, a copy of the modified message will be returned.
*/
- if(H5B2_modify_2(bt2, dxpl_id, &key, H5SM_decr_ref, &message) <0)
+ if(H5B2_modify(bt2, dxpl_id, &key, H5SM_decr_ref, &message) <0)
HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index")
/* Point to the message */
@@ -1737,7 +1737,7 @@ H5SM_delete_from_index(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh,
HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index")
} /* end if */
- if(H5B2_remove_2(bt2, dxpl_id, &key, NULL, NULL) < 0)
+ if(H5B2_remove(bt2, dxpl_id, &key, NULL, NULL) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTREMOVE, FAIL, "unable to delete message from index")
} /* end else */
@@ -2144,7 +2144,7 @@ H5SM_get_refcount(H5F_t *f, hid_t dxpl_id, unsigned type_id,
HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index")
/* Look up the message in the v2 B-tree */
- if((msg_exists = H5B2_find_2(bt2, dxpl_id, &key, H5SM_get_refcount_bt2_cb, &message)) < 0)
+ if((msg_exists = H5B2_find(bt2, dxpl_id, &key, H5SM_get_refcount_bt2_cb, &message)) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "error finding message in index")
if(!msg_exists)
HGOTO_ERROR(H5E_SOHM, H5E_NOTFOUND, FAIL, "message not in index")
@@ -2589,7 +2589,7 @@ H5SM_ih_size(H5F_t *f, hid_t dxpl_id, hsize_t *hdr_size, H5_ih_info_t *ih_info)
if(NULL == (bt2 = H5B2_open(f, dxpl_id, table->indexes[u].index_addr)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for SOHM index")
- if(H5B2_iterate_size_2(bt2, dxpl_id, &(ih_info->index_size)) < 0)
+ if(H5B2_size(bt2, dxpl_id, &(ih_info->index_size)) < 0)
HGOTO_ERROR(H5E_SOHM, H5E_CANTGET, FAIL, "can't retrieve B-tree storage info")
/* Close the v2 B-tree */