summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MANIFEST1
-rw-r--r--src/H5B2.c44
-rw-r--r--src/H5B2cache.c43
-rw-r--r--src/H5B2dbg.c214
-rw-r--r--src/H5B2pkg.h16
-rw-r--r--src/H5B2private.h9
-rw-r--r--src/H5B2test.c187
-rwxr-xr-xsrc/Makefile.am3
-rw-r--r--src/Makefile.in19
-rw-r--r--test/Makefile.am3
-rw-r--r--test/Makefile.in78
-rw-r--r--test/btree2.c139
-rw-r--r--tools/misc/h5debug.c76
13 files changed, 610 insertions, 222 deletions
diff --git a/MANIFEST b/MANIFEST
index 946a797..aef0036 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -780,6 +780,7 @@
./src/H5B2pkg.h
./src/H5B2private.h
./src/H5B2public.h
+./src/H5B2test.c
./src/H5C.c
./src/H5Cpkg.h
./src/H5Cprivate.h
diff --git a/src/H5B2.c b/src/H5B2.c
index e1550a1..05d8f54 100644
--- a/src/H5B2.c
+++ b/src/H5B2.c
@@ -47,10 +47,6 @@
/* Number of records that fit into leaf node */
#define H5B2_NUM_LEAF_REC(n,r) (((n)-H5B2_OVERHEAD_SIZE)/(r))
-/* Macro to retrieve pointer to i'th native key for leaf node */
-#define H5B2_INT_NKEY(i,shared,idx) ((i)->int_native+(shared)->nat_off[(idx)])
-#define H5B2_LEAF_NKEY(l,shared,idx) ((l)->leaf_native+(shared)->nat_off[(idx)])
-
/* Local typedefs */
@@ -62,7 +58,7 @@ static int H5B2_locate_record(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
unsigned nrec, size_t *rec_off, const uint8_t *native,
const void *udata);
static herr_t H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2,
- const H5B2_shared_t *shared);
+ H5RC_t *bt2_shared);
static herr_t H5B2_create_internal(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2,
H5B2_node_ptr_t *node_ptr);
@@ -363,14 +359,19 @@ H5B2_locate_record(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type,
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, const H5B2_shared_t *shared)
+H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, H5RC_t *bt2_shared)
{
+ H5B2_shared_t *shared; /* B-tree's shared info */
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT(H5B2_split_root)
HDassert(f);
HDassert(bt2);
+ HDassert(bt2_shared);
+
+ /* Get the pointer to the shared B-tree info */
+ shared=H5RC_GET_OBJ(bt2_shared);
HDassert(shared);
if(bt2->depth==0) {
@@ -393,13 +394,13 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, const H5B2_shared_t *share
old_leaf_ptr = bt2->root;
/* Protect both leafs */
- if (NULL == (old_leaf = H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, old_leaf_ptr.addr, shared->type, &old_leaf_ptr, H5AC_WRITE)))
+ if (NULL == (old_leaf = H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, old_leaf_ptr.addr, &(old_leaf_ptr.node_nrec), bt2_shared, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree leaf node")
- if (NULL == (new_leaf = H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, new_leaf_ptr.addr, shared->type, &new_leaf_ptr, H5AC_WRITE)))
+ if (NULL == (new_leaf = H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, new_leaf_ptr.addr, &(new_leaf_ptr.node_nrec), bt2_shared, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree leaf node")
/* Copy "upper half" of records to new leaf */
- HDmemcpy(new_leaf->leaf_native,H5B2_LEAF_NKEY(old_leaf,shared,mid_record+1),shared->type->nkey_size*(shared->split_leaf_nrec-(mid_record+1)));
+ HDmemcpy(new_leaf->leaf_native,H5B2_LEAF_NREC(old_leaf,shared,mid_record+1),shared->type->nkey_size*(shared->split_leaf_nrec-(mid_record+1)));
/* Create new internal node */
new_int_ptr.all_nrec=new_int_ptr.node_nrec=0;
@@ -407,11 +408,11 @@ H5B2_split_root(H5F_t *f, hid_t dxpl_id, H5B2_t *bt2, const H5B2_shared_t *share
HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "unable to create new internal node")
/* Protect new internal node */
- if (NULL == (new_int = H5AC_protect(f, dxpl_id, H5AC_BT2_INT, new_int_ptr.addr, shared->type, &new_int_ptr, H5AC_WRITE)))
+ if (NULL == (new_int = H5AC_protect(f, dxpl_id, H5AC_BT2_INT, new_int_ptr.addr, &(new_int_ptr.node_nrec), bt2_shared, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree internal node")
/* Copy "middle" record to new internal node */
- HDmemcpy(new_int->int_native,H5B2_LEAF_NKEY(old_leaf,shared,mid_record),shared->type->nkey_size);
+ HDmemcpy(new_int->int_native,H5B2_LEAF_NREC(old_leaf,shared,mid_record),shared->type->nkey_size);
/* Update record counts in leaf nodes */
old_leaf_ptr.all_nrec = old_leaf_ptr.node_nrec = old_leaf->nrec = mid_record;
@@ -481,6 +482,8 @@ H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
void *udata)
{
H5B2_t *bt2=NULL; /* Pointer to the B-tree header */
+ H5RC_t *bt2_shared=NULL; /* Pointer to ref-counter for shared B-tree info */
+ hbool_t incr_rc=FALSE; /* Flag to indicate that we've incremented the B-tree's shared info reference count */
H5B2_shared_t *shared; /* Pointer to B-tree's shared information */
H5B2_node_ptr_t leaf_ptr; /* Node pointer info for leaf node */
H5B2_leaf_t *leaf=NULL; /* Pointer to leaf node */
@@ -502,6 +505,11 @@ H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
shared=H5RC_GET_OBJ(bt2->shared);
HDassert(shared);
+ /* Safely grab pointer to reference counted shared B-tree info, so we can release the B-tree header if necessary */
+ bt2_shared=bt2->shared;
+ H5RC_INC(bt2_shared);
+ incr_rc=TRUE;
+
/* Check if the root node is allocated yet */
if(!H5F_addr_defined(bt2->root.addr)) {
/* Create root node as leaf node in B-tree */
@@ -515,7 +523,7 @@ H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
else if((bt2->depth==0 && bt2->root.node_nrec==shared->split_leaf_nrec) ||
(bt2->depth>0 && bt2->root.node_nrec==shared->split_int_nrec)) {
/* Split root node */
- if(H5B2_split_root(f, dxpl_id, bt2, shared)<0)
+ if(H5B2_split_root(f, dxpl_id, bt2, bt2_shared)<0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split root node")
} /* end if */
@@ -546,7 +554,7 @@ H5B2_insert(H5F_t *f, hid_t dxpl_id, const H5B2_class_t *type, haddr_t addr,
/* Find correct leaf to insert node into */
while(depth>0) {
/* Lock B-tree current node */
- if (NULL == (internal = H5AC_protect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, shared->type, curr_node_ptr, H5AC_WRITE)))
+ if (NULL == (internal = H5AC_protect(f, dxpl_id, H5AC_BT2_INT, curr_node_ptr->addr, &(curr_node_ptr->node_nrec), bt2_shared, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree internal node")
/* Set information for current (root) node */
@@ -631,7 +639,7 @@ HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node")
HDassert((leaf_ptr.node_nrec-1)<shared->split_leaf_nrec); /* node pointer to leaf has already been incremented */
/* Look up the B-tree leaf node */
- if (NULL == (leaf = H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, leaf_ptr.addr, shared->type, &leaf_ptr, H5AC_WRITE)))
+ if (NULL == (leaf = H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, leaf_ptr.addr, &(leaf_ptr.node_nrec), bt2_shared, H5AC_WRITE)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree leaf node")
/* Sanity check number of records */
@@ -656,11 +664,11 @@ HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node")
/* Make room for new record */
if((unsigned)idx<leaf->nrec)
- HDmemmove(H5B2_LEAF_NKEY(leaf,shared,idx+1),H5B2_LEAF_NKEY(leaf,shared,idx),shared->type->nkey_size*(leaf->nrec-idx));
+ HDmemmove(H5B2_LEAF_NREC(leaf,shared,idx+1),H5B2_LEAF_NREC(leaf,shared,idx),shared->type->nkey_size*(leaf->nrec-idx));
} /* end else */
/* Make callback to store record in native form */
- if((shared->type->store)(f,dxpl_id,udata,H5B2_LEAF_NKEY(leaf,shared,idx))<0) {
+ if((shared->type->store)(f,dxpl_id,udata,H5B2_LEAF_NREC(leaf,shared,idx))<0) {
/* Release the B-tree leaf node */
if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, leaf_ptr.addr, leaf, H5AC__NO_FLAGS_SET) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree leaf node")
@@ -679,6 +687,10 @@ HGOTO_ERROR(H5E_BTREE, H5E_CANTSPLIT, FAIL, "unable to split child node")
HGOTO_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree leaf node")
done:
+ /* Check if we need to decrement the reference count for the B-tree's shared info */
+ if(incr_rc)
+ H5RC_DEC(bt2_shared);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2_insert() */
diff --git a/src/H5B2cache.c b/src/H5B2cache.c
index fa9538d..aaa72f9 100644
--- a/src/H5B2cache.c
+++ b/src/H5B2cache.c
@@ -14,16 +14,11 @@
/*-------------------------------------------------------------------------
*
- * Created: H5B2.c
+ * Created: H5B2cache.c
* Jan 31 2005
* Quincey Koziol <koziol@ncsa.uiuc.edu>
*
- * Purpose: Implements a B-tree, with several modifications from
- * the "standard" methods.
- *
- * Please see the documentation in:
- * doc/html/TechNotes/Btrees.html for a full description
- * of how they work, etc.
+ * Purpose: Implement v2 B-tree metadata cache methods.
*
*-------------------------------------------------------------------------
*/
@@ -52,11 +47,11 @@ static H5B2_t *H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const
static herr_t H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B2_t *b);
static herr_t H5B2_cache_hdr_clear(H5F_t *f, H5B2_t *b, hbool_t destroy);
static herr_t H5B2_cache_hdr_size(const H5F_t *f, const H5B2_t *bt, size_t *size_ptr);
-static H5B2_leaf_t *H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata);
+static H5B2_leaf_t *H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, void *_shared);
static herr_t H5B2_cache_leaf_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B2_leaf_t *l);
static herr_t H5B2_cache_leaf_clear(H5F_t *f, H5B2_leaf_t *l, hbool_t destroy);
static herr_t H5B2_cache_leaf_size(const H5F_t *f, const H5B2_leaf_t *l, size_t *size_ptr);
-static H5B2_internal_t *H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata);
+static H5B2_internal_t *H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, void *_shared);
static herr_t H5B2_cache_internal_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B2_internal_t *i);
static herr_t H5B2_cache_internal_clear(H5F_t *f, H5B2_internal_t *i, hbool_t destroy);
static herr_t H5B2_cache_internal_size(const H5F_t *f, const H5B2_internal_t *i, size_t *size_ptr);
@@ -407,12 +402,12 @@ H5B2_cache_hdr_size(const H5F_t *f, const H5B2_t UNUSED *bt2, size_t *size_ptr)
*-------------------------------------------------------------------------
*/
static H5B2_leaf_t *
-H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_bt2, void *_node_ptr)
+H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, void *_bt2_shared)
{
- const H5B2_t *bt2 = (const H5B2_t *)_bt2;
- H5B2_node_ptr_t *node_ptr = (H5B2_node_ptr_t *)_node_ptr;
- H5B2_leaf_t *leaf = NULL;
+ const unsigned *nrec = (const unsigned *)_nrec;
+ H5RC_t *bt2_shared=(H5RC_t *)_bt2_shared; /* Shared B-tree information */
H5B2_shared_t *shared; /* Shared B-tree information */
+ H5B2_leaf_t *leaf = NULL;
uint8_t *p; /* Pointer into raw data buffer */
uint8_t *native; /* Pointer to native keys */
unsigned u; /* Local index variable */
@@ -423,14 +418,14 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_bt2, vo
/* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
- HDassert(bt2);
+ HDassert(bt2_shared);
if (NULL==(leaf = H5FL_MALLOC(H5B2_leaf_t)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDmemset(&leaf->cache_info,0,sizeof(H5AC_info_t));
/* Share common B-tree information */
- leaf->shared = bt2->shared;
+ leaf->shared = bt2_shared;
H5RC_INC(leaf->shared);
/* Get the pointer to the shared B-tree info */
@@ -461,7 +456,7 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_bt2, vo
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree leaf native keys")
/* Set the number of records in the leaf */
- leaf->nrec = node_ptr->node_nrec;
+ leaf->nrec = *nrec;
/* Deserialize records for leaf node */
native=leaf->leaf_native;
@@ -695,12 +690,12 @@ H5B2_cache_leaf_size(const H5F_t UNUSED *f, const H5B2_leaf_t *leaf, size_t *siz
*-------------------------------------------------------------------------
*/
static H5B2_internal_t *
-H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_bt2, void *_node_ptr)
+H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, void *_bt2_shared)
{
- const H5B2_t *bt2 = (const H5B2_t *)_bt2;
- H5B2_node_ptr_t *node_ptr = (H5B2_node_ptr_t *)_node_ptr;
- H5B2_internal_t *internal = NULL;
+ const unsigned *nrec = (const unsigned *)_nrec;
+ H5RC_t *bt2_shared = (H5RC_t *)_bt2_shared; /* Ref counter for shared B-tree info */
H5B2_shared_t *shared; /* Shared B-tree information */
+ H5B2_internal_t *internal = NULL;
uint8_t *p; /* Pointer into raw data buffer */
uint8_t *native; /* Pointer to native record info */
H5B2_node_ptr_t *int_node_ptr; /* Pointer to node pointer info */
@@ -712,14 +707,14 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_bt2
/* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
- HDassert(bt2);
+ HDassert(bt2_shared);
if (NULL==(internal = H5FL_MALLOC(H5B2_internal_t)))
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
HDmemset(&internal->cache_info,0,sizeof(H5AC_info_t));
/* Share common B-tree information */
- internal->shared = bt2->shared;
+ internal->shared = bt2_shared;
H5RC_INC(internal->shared);
/* Get the pointer to the shared B-tree info */
@@ -754,7 +749,7 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_bt2
HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for B-tree internal node pointers")
/* Set the number of records in the leaf */
- internal->nrec = node_ptr->node_nrec;
+ internal->nrec = *nrec;
/* Deserialize records for internal node */
native=internal->int_native;
@@ -768,7 +763,7 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_bt2
native += shared->type->nkey_size;
} /* end for */
- /* Serialize node pointers for internal node */
+ /* Deserialize node pointers for internal node */
int_node_ptr=internal->node_ptrs;
for(u=0; u<internal->nrec+1; u++) {
/* Decode node pointer */
diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c
index bd18582..f0e3060 100644
--- a/src/H5B2dbg.c
+++ b/src/H5B2dbg.c
@@ -79,12 +79,14 @@ H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
*/
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Tree type ID:",
- ((shared->type->id)==H5B2_GRP_NAME_ID ? "H5B2_GRP_NAME_ID" : "Unknown!"));
+ ((shared->type->id)==H5B2_TEST_ID ? "H5B2_TEST_ID" :
+ ((shared->type->id)==H5B2_GRP_NAME_ID ? "H5B2_GRP_NAME_ID" :
+ "Unknown!")));
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"Size of node:",
shared->node_size);
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
- "Size of raw (disk) key:",
+ "Size of raw (disk) record:",
shared->rkey_size);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Dirty flag:",
@@ -133,3 +135,211 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
}
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2_int_debug
+ *
+ * Purpose: Prints debugging info about a B-tree internal node
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Feb 4 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth,
+ const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec)
+{
+ H5B2_t *bt2 = NULL;
+ H5B2_internal_t *internal = NULL;
+ H5B2_shared_t *shared; /* Shared B-tree information */
+ unsigned u; /* Local index variable */
+ char temp_str[128]; /* Temporary string, for formatting */
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5B2_int_debug, FAIL)
+
+ /*
+ * Check arguments.
+ */
+ assert(f);
+ assert(H5F_addr_defined(addr));
+ assert(stream);
+ assert(indent >= 0);
+ assert(fwidth >= 0);
+
+ /*
+ * Load the B-tree header.
+ */
+ if (NULL == (bt2 = H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, type, NULL, H5AC_READ)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header")
+
+ /* Get the pointer to the shared B-tree info */
+ shared=H5RC_GET_OBJ(bt2->shared);
+ assert(shared);
+
+ /*
+ * Load the B-tree internal node
+ */
+ if (NULL == (internal = H5AC_protect(f, dxpl_id, H5AC_BT2_INT, addr, &nrec, bt2->shared, H5AC_READ)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree internal node")
+
+ /* Release the B-tree header */
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, bt2, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header")
+ bt2 = NULL;
+
+ /*
+ * Print the values.
+ */
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "Tree type ID:",
+ ((shared->type->id)==H5B2_TEST_ID ? "H5B2_TEST_ID" :
+ ((shared->type->id)==H5B2_GRP_NAME_ID ? "H5B2_GRP_NAME_ID" :
+ "Unknown!")));
+ HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ "Size of node:",
+ shared->node_size);
+ HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ "Size of raw (disk) record:",
+ shared->rkey_size);
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "Dirty flag:",
+ internal->cache_info.is_dirty ? "True" : "False");
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Number of records in node:",
+ internal->nrec);
+
+ /* Print all node pointers and records */
+ for(u=0; u<internal->nrec; u++) {
+ /* Print node pointer */
+ sprintf(temp_str,"Node pointer #%u: (all/node/addr)",u);
+ HDfprintf(stream, "%*s%-*s (%Hu/%u/%a)\n", indent + 3, "", MAX(0, fwidth - 3),
+ temp_str,
+ internal->node_ptrs[u].all_nrec,
+ internal->node_ptrs[u].node_nrec,
+ internal->node_ptrs[u].addr);
+
+ /* Print record */
+ sprintf(temp_str,"Record #%u:",u);
+ HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
+ temp_str);
+ assert(H5B2_INT_NREC(internal,shared,u));
+ (void)(type->debug)(stream, f, dxpl_id, indent+6, MAX (0, fwidth-6),
+ H5B2_INT_NREC(internal,shared,u), NULL);
+ } /* end for */
+
+ /* Print final node pointer */
+ sprintf(temp_str,"Node pointer #%u: (all/node/addr)",u);
+ HDfprintf(stream, "%*s%-*s (%Hu/%u/%a)\n", indent + 3, "", MAX(0, fwidth - 3),
+ temp_str,
+ internal->node_ptrs[u].all_nrec,
+ internal->node_ptrs[u].node_nrec,
+ internal->node_ptrs[u].addr);
+
+done:
+ if (internal && H5AC_unprotect(f, dxpl_id, H5AC_BT2_INT, addr, internal, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree internal node")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2_leaf_debug
+ *
+ * Purpose: Prints debugging info about a B-tree leaf node
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Feb 7 2005
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int fwidth,
+ const H5B2_class_t *type, haddr_t hdr_addr, unsigned nrec)
+{
+ H5B2_t *bt2 = NULL;
+ H5B2_leaf_t *leaf = NULL;
+ H5B2_shared_t *shared; /* Shared B-tree information */
+ unsigned u; /* Local index variable */
+ char temp_str[128]; /* Temporary string, for formatting */
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5B2_leaf_debug, FAIL)
+
+ /*
+ * Check arguments.
+ */
+ assert(f);
+ assert(H5F_addr_defined(addr));
+ assert(stream);
+ assert(indent >= 0);
+ assert(fwidth >= 0);
+
+ /*
+ * Load the B-tree header.
+ */
+ if (NULL == (bt2 = H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, type, NULL, H5AC_READ)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header")
+
+ /* Get the pointer to the shared B-tree info */
+ shared=H5RC_GET_OBJ(bt2->shared);
+ assert(shared);
+
+ /*
+ * Load the B-tree leaf node
+ */
+ if (NULL == (leaf = H5AC_protect(f, dxpl_id, H5AC_BT2_LEAF, addr, &nrec, bt2->shared, H5AC_READ)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree leaf node")
+
+ /* Release the B-tree header */
+ if (H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, bt2, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree header")
+ bt2 = NULL;
+
+ /*
+ * Print the values.
+ */
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "Tree type ID:",
+ ((shared->type->id)==H5B2_TEST_ID ? "H5B2_TEST_ID" :
+ ((shared->type->id)==H5B2_GRP_NAME_ID ? "H5B2_GRP_NAME_ID" :
+ "Unknown!")));
+ HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ "Size of node:",
+ shared->node_size);
+ HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
+ "Size of raw (disk) record:",
+ shared->rkey_size);
+ HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
+ "Dirty flag:",
+ leaf->cache_info.is_dirty ? "True" : "False");
+ HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Number of records in node:",
+ leaf->nrec);
+
+ /* Print all node pointers and records */
+ for(u=0; u<leaf->nrec; u++) {
+ /* Print record */
+ sprintf(temp_str,"Record #%u:",u);
+ HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
+ temp_str);
+ assert(H5B2_LEAF_NREC(leaf,shared,u));
+ (void)(type->debug)(stream, f, dxpl_id, indent+6, MAX (0, fwidth-6),
+ H5B2_LEAF_NREC(leaf,shared,u), NULL);
+ } /* end for */
+
+done:
+ if (leaf && H5AC_unprotect(f, dxpl_id, H5AC_BT2_LEAF, addr, leaf, H5AC__NO_FLAGS_SET) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_PROTECT, FAIL, "unable to release B-tree leaf node")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+}
+
diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h
index 001d0ca..b6aa65c 100644
--- a/src/H5B2pkg.h
+++ b/src/H5B2pkg.h
@@ -65,6 +65,11 @@
2 + /* Merge % of full (as integer, ie. "98" means 98%) */ \
H5B2_NODE_POINTER_SIZE(f)) /* Node pointer to root node in tree */
+/* Macro to retrieve pointer to i'th native key for leaf node */
+#define H5B2_INT_NREC(i,shared,idx) ((i)->int_native+(shared)->nat_off[(idx)])
+#define H5B2_LEAF_NREC(l,shared,idx) ((l)->leaf_native+(shared)->nat_off[(idx)])
+
+
/****************************/
/* Package Private Typedefs */
/****************************/
@@ -160,6 +165,11 @@ H5FL_EXTERN(H5B2_internal_t);
/* Declare a free list to manage the H5B2_leaf_t struct */
H5FL_EXTERN(H5B2_leaf_t);
+/* Internal v2 B-tree testing class */
+#ifdef H5B2_TESTING
+H5_DLLVAR const H5B2_class_t H5B2_TEST[1];
+#endif /* H5B2_TESTING */
+
/******************************/
/* Package Private Prototypes */
@@ -172,6 +182,12 @@ H5_DLL herr_t H5B2_cache_leaf_dest(H5F_t *f, H5B2_leaf_t *l);
H5_DLL herr_t H5B2_cache_internal_dest(H5F_t *f, H5B2_internal_t *i);
H5_DLL herr_t H5B2_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
FILE *stream, int indent, int fwidth, const H5B2_class_t *type);
+H5_DLL herr_t H5B2_int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
+ FILE *stream, int indent, int fwidth, const H5B2_class_t *type,
+ haddr_t hdr_addr, unsigned nrec);
+H5_DLL herr_t H5B2_leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
+ FILE *stream, int indent, int fwidth, const H5B2_class_t *type,
+ haddr_t hdr_addr, unsigned nrec);
#endif /* _H5B2pkg_H */
diff --git a/src/H5B2private.h b/src/H5B2private.h
index bd1515a..2635cae 100644
--- a/src/H5B2private.h
+++ b/src/H5B2private.h
@@ -49,12 +49,9 @@
/****************************/
/* B-tree IDs for various internal things. */
-/* Not really a "public" symbol, but that should be OK -QAK */
-/* Note - if more of these are added, any 'K' values (for internal or leaf
- * nodes) they use will need to be stored in the file somewhere. -QAK
- */
typedef enum H5B2_subid_t {
- H5B2_GRP_NAME_ID = 0, /* B-tree is for group links, ordered by name */
+ H5B2_TEST_ID = 0, /* B-tree is for testing (do not use for actual data) */
+ H5B2_GRP_NAME_ID, /* B-tree is for group links, ordered by name */
H5B2_NUM_BTREE_ID /* Number of B-tree key IDs (must be last) */
} H5B2_subid_t;
@@ -77,6 +74,8 @@ typedef struct H5B2_class_t {
herr_t (*decode)(const H5F_t *f, const uint8_t *raw, void *record); /* Decode record from disk storage form to native form */
/* Debug record values */
+ herr_t (*debug) (FILE *stream, const H5F_t *f, hid_t dxpl_id, /* Print a record for debugging */
+ int indent, int fwidth, const void *record, const void *udata);
} H5B2_class_t;
diff --git a/src/H5B2test.c b/src/H5B2test.c
new file mode 100644
index 0000000..99690fc
--- /dev/null
+++ b/src/H5B2test.c
@@ -0,0 +1,187 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* Programmer: Quincey Koziol <koziol@ncsa.uiuc.edu>
+ * Saturday, May 31, 2003
+ *
+ * Purpose: v2 B-tree testing functions.
+ */
+
+#define H5B2_PACKAGE /*suppress error about including H5B2pkg */
+#define H5B2_TESTING /*suppress warning about H5B2 testing funcs*/
+
+/* Private headers */
+#include "H5private.h" /* Generic Functions */
+#include "H5B2pkg.h" /* B-trees */
+
+/* Static Prototypes */
+static herr_t H5B2_test_store(const H5F_t *f, hid_t dxpl_id, const void *udata,
+ void *nrecord);
+static herr_t H5B2_test_compare(const H5F_t *f, hid_t dxpl_id, const void *rec1,
+ const void *rec2);
+static herr_t H5B2_test_encode(const H5F_t *f, uint8_t *raw,
+ const void *nrecord);
+static herr_t H5B2_test_decode(const H5F_t *f, const uint8_t *raw,
+ void *nrecord);
+static herr_t H5B2_test_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
+ int indent, int fwidth, const void *record, const void *_udata);
+
+/* Package variables */
+const H5B2_class_t H5B2_TEST[1]={{ /* B-tree class information */
+ H5B2_TEST_ID, /* Type of B-tree */
+ sizeof(hsize_t), /* Size of native key */
+ H5B2_test_store, /* Record storage callback */
+ H5B2_test_compare, /* Record comparison callback */
+ H5B2_test_encode, /* Record encoding callback */
+ H5B2_test_decode, /* Record decoding callback */
+ H5B2_test_debug /* Record debugging callback */
+}};
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2_test_store
+ *
+ * Purpose: Store native information into record for B-tree
+ *
+ * Return: Success: non-negative
+ *
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, February 3, 2005
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5B2_test_store(const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *udata, void *nrecord)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_test_store)
+
+ *(hsize_t *)nrecord=*(const hsize_t *)udata;
+
+ FUNC_LEAVE_NOAPI(SUCCEED);
+} /* H5B2_test_store() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2_test_compare
+ *
+ * Purpose: Compare two native information records, according to some key
+ *
+ * Return: <0 if rec1 < rec2
+ * =0 if rec1 == rec2
+ * >0 if rec1 > rec2
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, February 3, 2005
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5B2_test_compare(const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *rec1, const void *rec2)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_test_compare)
+
+ FUNC_LEAVE_NOAPI(*(const hssize_t *)rec1-*(const hssize_t *)rec2);
+} /* H5B2_test_compare() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2_test_encode
+ *
+ * Purpose: Encode native information into raw form for storing on disk
+ *
+ * Return: Success: non-negative
+ *
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, February 3, 2005
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5B2_test_encode(const H5F_t *f, uint8_t *raw, const void *nrecord)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_test_encode)
+
+ H5F_ENCODE_LENGTH(f, raw, *(const hsize_t *)nrecord);
+
+ FUNC_LEAVE_NOAPI(SUCCEED);
+} /* H5B2_test_encode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2_test_decode
+ *
+ * Purpose: Decode raw disk form of record into native form
+ *
+ * Return: Success: non-negative
+ *
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, February 4, 2005
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5B2_test_decode(const H5F_t *f, const uint8_t *raw, void *nrecord)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_test_decode)
+
+ H5F_DECODE_LENGTH(f, raw, *(hsize_t *)nrecord);
+
+ FUNC_LEAVE_NOAPI(SUCCEED);
+} /* H5B2_test_decode() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5B2_test_debug
+ *
+ * Purpose: Debug native form of record
+ *
+ * Return: Success: non-negative
+ *
+ * Failure: negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, February 4, 2005
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5B2_test_debug(FILE *stream, const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int indent, int fwidth,
+ const void *record, const void UNUSED *_udata)
+{
+ FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5B2_test_debug)
+
+ HDassert (record);
+
+ HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Record:",
+ *(const hsize_t *)record);
+
+ FUNC_LEAVE_NOAPI(SUCCEED);
+} /* H5B2_test_debug() */
+
diff --git a/src/Makefile.am b/src/Makefile.am
index d3a9fba..3aaf85a 100755
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -39,7 +39,8 @@ MOSTLYCLEANFILES=H5detect.o H5detect.lo H5detect H5Tinit.o H5Tinit.lo H5Tinit.c
DISTCLEAN=libhdf5.settings
# library sources
-libhdf5_la_SOURCES= H5.c H5A.c H5AC.c H5B.c H5B2.c H5B2cache.c H5B2dbg.c H5C.c \
+libhdf5_la_SOURCES= H5.c H5A.c H5AC.c H5B.c H5B2.c H5B2cache.c H5B2dbg.c \
+ H5B2test.c H5C.c \
H5D.c \
H5Dcontig.c \
H5Dcompact.c \
diff --git a/src/Makefile.in b/src/Makefile.in
index 3299112..af2efc9 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -219,7 +219,8 @@ MOSTLYCLEANFILES = H5detect.o H5detect.lo H5detect H5Tinit.o H5Tinit.lo H5Tinit.
DISTCLEAN = libhdf5.settings
# library sources
-libhdf5_la_SOURCES = H5.c H5A.c H5AC.c H5B.c H5B2.c H5B2cache.c H5B2dbg.c H5C.c \
+libhdf5_la_SOURCES = H5.c H5A.c H5AC.c H5B.c H5B2.c H5B2cache.c H5B2dbg.c \
+ H5B2test.c H5C.c \
H5D.c \
H5Dcontig.c \
H5Dcompact.c \
@@ -290,11 +291,11 @@ LTLIBRARIES = $(lib_LTLIBRARIES)
libhdf5_la_LDFLAGS =
libhdf5_la_LIBADD =
am_libhdf5_la_OBJECTS = H5.lo H5A.lo H5AC.lo H5B.lo H5B2.lo H5B2cache.lo \
- H5B2dbg.lo H5C.lo H5D.lo H5Dcontig.lo H5Dcompact.lo H5Defl.lo \
- H5Dio.lo H5Distore.lo H5Dmpio.lo H5Dselect.lo H5Dtest.lo H5E.lo \
- H5F.lo H5Fdbg.lo H5FD.lo H5FDcore.lo H5FDfamily.lo \
- H5FDfphdf5.lo H5FDgass.lo H5FDlog.lo H5FDmpi.lo H5FDmpio.lo \
- H5FDmpiposix.lo H5FDmulti.lo H5FDsec2.lo H5FDsrb.lo \
+ H5B2dbg.lo H5B2test.lo H5C.lo H5D.lo H5Dcontig.lo H5Dcompact.lo \
+ H5Defl.lo H5Dio.lo H5Distore.lo H5Dmpio.lo H5Dselect.lo \
+ H5Dtest.lo H5E.lo H5F.lo H5Fdbg.lo H5FD.lo H5FDcore.lo \
+ H5FDfamily.lo H5FDfphdf5.lo H5FDgass.lo H5FDlog.lo H5FDmpi.lo \
+ H5FDmpio.lo H5FDmpiposix.lo H5FDmulti.lo H5FDsec2.lo H5FDsrb.lo \
H5FDstdio.lo H5FDstream.lo H5FL.lo H5FO.lo H5FP.lo \
H5FPclient.lo H5FPserver.lo H5FS.lo H5G.lo H5Gent.lo H5Gnode.lo \
H5Gstab.lo H5HG.lo H5HGdbg.lo H5HL.lo H5HLdbg.lo H5HP.lo H5I.lo \
@@ -329,8 +330,9 @@ am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/H5.Plo ./$(DEPDIR)/H5A.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/H5AC.Plo ./$(DEPDIR)/H5B.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/H5B2.Plo ./$(DEPDIR)/H5B2cache.Plo \
-@AMDEP_TRUE@ ./$(DEPDIR)/H5B2dbg.Plo ./$(DEPDIR)/H5C.Plo \
-@AMDEP_TRUE@ ./$(DEPDIR)/H5D.Plo ./$(DEPDIR)/H5Dcompact.Plo \
+@AMDEP_TRUE@ ./$(DEPDIR)/H5B2dbg.Plo ./$(DEPDIR)/H5B2test.Plo \
+@AMDEP_TRUE@ ./$(DEPDIR)/H5C.Plo ./$(DEPDIR)/H5D.Plo \
+@AMDEP_TRUE@ ./$(DEPDIR)/H5Dcompact.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/H5Dcontig.Plo ./$(DEPDIR)/H5Defl.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/H5Dio.Plo ./$(DEPDIR)/H5Distore.Plo \
@AMDEP_TRUE@ ./$(DEPDIR)/H5Dmpio.Plo ./$(DEPDIR)/H5Dselect.Plo \
@@ -487,6 +489,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2cache.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2dbg.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5B2test.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5C.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5D.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/H5Dcompact.Plo@am__quote@
diff --git a/test/Makefile.am b/test/Makefile.am
index bfd7b30..06dc69e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -32,7 +32,8 @@ TEST_PROG=testhdf5 lheap ohdr stab gheap cache hyperslab istore bittests \
dtypes dsets cmpd_dset extend external links unlink big mtime \
fillval mount flush1 flush2 enum gass_write gass_read gass_append \
set_extent srb_write srb_append srb_read ttsafe stream_test \
- getname file_handle ntypes dangle dtransform filename reserved
+ getname file_handle ntypes dangle dtransform filename reserved \
+ btree2
# List programs to be built when testing here. error_test and err_compat are
# built at the same time as the other tests, but executed by testerror.sh.
diff --git a/test/Makefile.in b/test/Makefile.in
index 4debd14..243ed00 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -212,7 +212,8 @@ TEST_PROG = testhdf5 lheap ohdr stab gheap cache hyperslab istore bittests \
dtypes dsets cmpd_dset extend external links unlink big mtime \
fillval mount flush1 flush2 enum gass_write gass_read gass_append \
set_extent srb_write srb_append srb_read ttsafe stream_test \
- getname file_handle ntypes dangle dtransform filename reserved
+ getname file_handle ntypes dangle dtransform filename reserved \
+ btree2
# List programs to be built when testing here. error_test and err_compat are
@@ -298,7 +299,8 @@ check_PROGRAMS = testhdf5$(EXEEXT) lheap$(EXEEXT) ohdr$(EXEEXT) \
ttsafe$(EXEEXT) stream_test$(EXEEXT) getname$(EXEEXT) \
file_handle$(EXEEXT) ntypes$(EXEEXT) dangle$(EXEEXT) \
dtransform$(EXEEXT) filename$(EXEEXT) reserved$(EXEEXT) \
- error_test$(EXEEXT) err_compat$(EXEEXT) testmeta$(EXEEXT)
+ btree2$(EXEEXT) error_test$(EXEEXT) err_compat$(EXEEXT) \
+ testmeta$(EXEEXT)
big_SOURCES = big.c
big_OBJECTS = big.$(OBJEXT)
big_LDADD = $(LDADD)
@@ -309,6 +311,11 @@ bittests_OBJECTS = bittests.$(OBJEXT)
bittests_LDADD = $(LDADD)
bittests_DEPENDENCIES = libh5test.la $(top_builddir)/src/libhdf5.la
bittests_LDFLAGS =
+btree2_SOURCES = btree2.c
+btree2_OBJECTS = btree2.$(OBJEXT)
+btree2_LDADD = $(LDADD)
+btree2_DEPENDENCIES = libh5test.la $(top_builddir)/src/libhdf5.la
+btree2_LDFLAGS =
cache_SOURCES = cache.c
cache_OBJECTS = cache.$(OBJEXT)
cache_LDADD = $(LDADD)
@@ -525,35 +532,36 @@ LIBS = @LIBS@
depcomp = $(SHELL) $(top_srcdir)/bin/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/big.Po ./$(DEPDIR)/bittests.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/cache.Po ./$(DEPDIR)/cmpd_dset.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/dangle.Po ./$(DEPDIR)/dsets.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/dtransform.Po ./$(DEPDIR)/dtypes.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/enum.Po ./$(DEPDIR)/err_compat.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/error_test.Po ./$(DEPDIR)/extend.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/external.Po ./$(DEPDIR)/file_handle.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/filename.Po ./$(DEPDIR)/fillval.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/flush1.Po ./$(DEPDIR)/flush2.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/gass_append.Po ./$(DEPDIR)/gass_read.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/gass_write.Po ./$(DEPDIR)/getname.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/gheap.Po ./$(DEPDIR)/h5test.Plo \
-@AMDEP_TRUE@ ./$(DEPDIR)/hyperslab.Po ./$(DEPDIR)/istore.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/lheap.Po ./$(DEPDIR)/links.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/mount.Po ./$(DEPDIR)/mtime.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/ntypes.Po ./$(DEPDIR)/ohdr.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/reserved.Po ./$(DEPDIR)/set_extent.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/srb_append.Po ./$(DEPDIR)/srb_read.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/srb_write.Po ./$(DEPDIR)/stab.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/stream_test.Po ./$(DEPDIR)/tarray.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/tattr.Po ./$(DEPDIR)/tconfig.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/testframe.Plo ./$(DEPDIR)/testhdf5.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/testmeta.Po ./$(DEPDIR)/tfile.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/tgenprop.Po ./$(DEPDIR)/th5s.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/theap.Po ./$(DEPDIR)/tid.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/titerate.Po ./$(DEPDIR)/tmeta.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/tmisc.Po ./$(DEPDIR)/trefer.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/trefstr.Po ./$(DEPDIR)/tselect.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/tskiplist.Po ./$(DEPDIR)/ttime.Po \
-@AMDEP_TRUE@ ./$(DEPDIR)/ttsafe.Po ./$(DEPDIR)/ttsafe_acreate.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/btree2.Po ./$(DEPDIR)/cache.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/cmpd_dset.Po ./$(DEPDIR)/dangle.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/dsets.Po ./$(DEPDIR)/dtransform.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/dtypes.Po ./$(DEPDIR)/enum.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/err_compat.Po ./$(DEPDIR)/error_test.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/extend.Po ./$(DEPDIR)/external.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/file_handle.Po ./$(DEPDIR)/filename.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/fillval.Po ./$(DEPDIR)/flush1.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/flush2.Po ./$(DEPDIR)/gass_append.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/gass_read.Po ./$(DEPDIR)/gass_write.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/getname.Po ./$(DEPDIR)/gheap.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/h5test.Plo ./$(DEPDIR)/hyperslab.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/istore.Po ./$(DEPDIR)/lheap.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/links.Po ./$(DEPDIR)/mount.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/mtime.Po ./$(DEPDIR)/ntypes.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/ohdr.Po ./$(DEPDIR)/reserved.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/set_extent.Po ./$(DEPDIR)/srb_append.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/srb_read.Po ./$(DEPDIR)/srb_write.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/stab.Po ./$(DEPDIR)/stream_test.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/tarray.Po ./$(DEPDIR)/tattr.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/tconfig.Po ./$(DEPDIR)/testframe.Plo \
+@AMDEP_TRUE@ ./$(DEPDIR)/testhdf5.Po ./$(DEPDIR)/testmeta.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/tfile.Po ./$(DEPDIR)/tgenprop.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/th5s.Po ./$(DEPDIR)/theap.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/tid.Po ./$(DEPDIR)/titerate.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/tmeta.Po ./$(DEPDIR)/tmisc.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/trefer.Po ./$(DEPDIR)/trefstr.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/tselect.Po ./$(DEPDIR)/tskiplist.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/ttime.Po ./$(DEPDIR)/ttsafe.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/ttsafe_acreate.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/ttsafe_cancel.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/ttsafe_dcreate.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/ttsafe_error.Po ./$(DEPDIR)/ttst.Po \
@@ -567,7 +575,7 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
CFLAGS = @CFLAGS@
-DIST_SOURCES = $(libh5test_la_SOURCES) big.c bittests.c cache.c \
+DIST_SOURCES = $(libh5test_la_SOURCES) big.c bittests.c btree2.c cache.c \
cmpd_dset.c dangle.c dsets.c dtransform.c dtypes.c enum.c \
err_compat.c error_test.c extend.c external.c file_handle.c \
filename.c fillval.c flush1.c flush2.c gass_append.c \
@@ -577,7 +585,7 @@ DIST_SOURCES = $(libh5test_la_SOURCES) big.c bittests.c cache.c \
stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) \
unlink.c
DIST_COMMON = Makefile.am Makefile.in
-SOURCES = $(libh5test_la_SOURCES) big.c bittests.c cache.c cmpd_dset.c dangle.c dsets.c dtransform.c dtypes.c enum.c err_compat.c error_test.c extend.c external.c file_handle.c filename.c fillval.c flush1.c flush2.c gass_append.c gass_read.c gass_write.c getname.c gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c ntypes.c ohdr.c reserved.c set_extent.c srb_append.c srb_read.c srb_write.c stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c
+SOURCES = $(libh5test_la_SOURCES) big.c bittests.c btree2.c cache.c cmpd_dset.c dangle.c dsets.c dtransform.c dtypes.c enum.c err_compat.c error_test.c extend.c external.c file_handle.c filename.c fillval.c flush1.c flush2.c gass_append.c gass_read.c gass_write.c getname.c gheap.c hyperslab.c istore.c lheap.c links.c mount.c mtime.c ntypes.c ohdr.c reserved.c set_extent.c srb_append.c srb_read.c srb_write.c stab.c stream_test.c $(testhdf5_SOURCES) testmeta.c $(ttsafe_SOURCES) unlink.c
all: all-am
@@ -612,6 +620,9 @@ big$(EXEEXT): $(big_OBJECTS) $(big_DEPENDENCIES)
bittests$(EXEEXT): $(bittests_OBJECTS) $(bittests_DEPENDENCIES)
@rm -f bittests$(EXEEXT)
$(LINK) $(bittests_LDFLAGS) $(bittests_OBJECTS) $(bittests_LDADD) $(LIBS)
+btree2$(EXEEXT): $(btree2_OBJECTS) $(btree2_DEPENDENCIES)
+ @rm -f btree2$(EXEEXT)
+ $(LINK) $(btree2_LDFLAGS) $(btree2_OBJECTS) $(btree2_LDADD) $(LIBS)
cache$(EXEEXT): $(cache_OBJECTS) $(cache_DEPENDENCIES)
@rm -f cache$(EXEEXT)
$(LINK) $(cache_LDFLAGS) $(cache_OBJECTS) $(cache_LDADD) $(LIBS)
@@ -741,6 +752,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/big.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bittests.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/btree2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cmpd_dset.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dangle.Po@am__quote@
diff --git a/test/btree2.c b/test/btree2.c
index 312f149..f0d13b1 100644
--- a/test/btree2.c
+++ b/test/btree2.c
@@ -19,8 +19,10 @@
/*
* This file needs to access private datatypes from the H5B2 package.
+ * This file also needs to access the v2 B-tree testing code.
*/
#define H5B2_PACKAGE
+#define H5B2_TESTING
#include "H5B2pkg.h"
/* Other private headers that this test requires */
@@ -35,125 +37,6 @@ const char *FILENAME[] = {
/*-------------------------------------------------------------------------
- * Function: store
- *
- * Purpose: Store native information into record for B-tree
- *
- * Return: Success: non-negative
- *
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Thursday, February 3, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-store(const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *udata, void *nrecord)
-{
- *(hsize_t *)nrecord=*(const hsize_t *)udata;
-
-#ifdef QAK
-HDfprintf(stderr,"store: udata=%Hu\n",*(const hsize_t *)udata);
-#endif /* QAK */
- return(SUCCEED);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: compare
- *
- * Purpose: Compare two native information records, according to some key
- *
- * Return: <0 if rec1 < rec2
- * =0 if rec1 == rec2
- * >0 if rec1 > rec2
- *
- * Programmer: Quincey Koziol
- * Thursday, February 3, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-compare(const H5F_t UNUSED *f, hid_t UNUSED dxpl_id, const void *rec1, const void *rec2)
-{
-#ifdef QAK
-HDfprintf(stderr,"compare: *rec1=%Hu, *rec2=%Hu\n",*(const hsize_t *)rec1,*(const hsize_t *)rec2);
-#endif /* QAK */
- return(*(const hssize_t *)rec1-*(const hssize_t *)rec2);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: encode
- *
- * Purpose: Encode native information into raw form for storing on disk
- *
- * Return: Success: non-negative
- *
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Thursday, February 3, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-encode(const H5F_t *f, uint8_t *raw, const void *nrecord)
-{
- H5F_ENCODE_LENGTH(f, raw, *(const hsize_t *)nrecord);
-
-#ifdef QAK
-HDfprintf(stderr,"encode: data=%Hu\n",*(const hsize_t *)nrecord);
-#endif /* QAK */
- return(SUCCEED);
-}
-
-
-/*-------------------------------------------------------------------------
- * Function: decode
- *
- * Purpose: Decode raw disk form of record into native form
- *
- * Return: Success: non-negative
- *
- * Failure: negative
- *
- * Programmer: Quincey Koziol
- * Friday, February 4, 2005
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-decode(const H5F_t *f, const uint8_t *raw, void *nrecord)
-{
- H5F_DECODE_LENGTH(f, raw, *(hsize_t *)nrecord);
-
-#ifdef QAK
-HDfprintf(stderr,"encode: data=%Hu\n",*(const hsize_t *)nrecord);
-#endif /* QAK */
- return(SUCCEED);
-}
-
-H5B2_class_t type={ /* B-tree class information */
- 0, /* Type of B-tree */
- sizeof(hsize_t), /* Size of native key */
- store, /* Record storage callback */
- compare, /* Record comparison callback */
- encode, /* Record encoding callback */
- decode /* Record decoding callback */
-};
-
-
-/*-------------------------------------------------------------------------
* Function: test_insert_basic
*
* Purpose: Basic tests for the B-tree v2 code
@@ -193,7 +76,7 @@ test_insert_basic(hid_t fapl)
* Test v2 B-tree creation
*/
TESTING("B-tree creation");
- if (H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &type, 512, 8, 100, 40, &bt2_addr/*out*/)<0) {
+ if (H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
@@ -205,7 +88,7 @@ test_insert_basic(hid_t fapl)
*/
TESTING("B-tree insert");
record=42;
- if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, &type, bt2_addr, &record)<0) {
+ if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
@@ -215,7 +98,7 @@ test_insert_basic(hid_t fapl)
* Test inserting second record into v2 B-tree, before all other records
*/
record=34;
- if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, &type, bt2_addr, &record)<0) {
+ if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
@@ -225,7 +108,7 @@ test_insert_basic(hid_t fapl)
* Test inserting third record into v2 B-tree, after all other records
*/
record=56;
- if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, &type, bt2_addr, &record)<0) {
+ if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
@@ -235,7 +118,7 @@ test_insert_basic(hid_t fapl)
* Test inserting fourth record into v2 B-tree, in the middle of other records
*/
record=38;
- if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, &type, bt2_addr, &record)<0) {
+ if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
@@ -297,7 +180,7 @@ test_insert_split_root(hid_t fapl)
/*
* Test v2 B-tree creation
*/
- if (H5B2_create(f, H5P_DATASET_XFER_DEFAULT, &type, 512, 8, 100, 40, &bt2_addr/*out*/)<0) {
+ if (H5B2_create(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, 512, 8, 100, 40, &bt2_addr/*out*/)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
@@ -310,20 +193,20 @@ test_insert_split_root(hid_t fapl)
for(u=0; u<INSERT_SPLIT_ROOT_NREC; u++) {
record=u+10;
- if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, &type, bt2_addr, &record)<0) {
+ if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
}
}
record=0;
- if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, &type, bt2_addr, &record)<0) {
+ if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
}
record=1;
- if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, &type, bt2_addr, &record)<0) {
+ if (H5B2_insert(f, H5P_DATASET_XFER_DEFAULT, H5B2_TEST, bt2_addr, &record)<0) {
H5_FAILED();
H5Eprint_stack(H5E_DEFAULT, stdout);
goto error;
diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c
index 88dc861..04e2b22 100644
--- a/tools/misc/h5debug.c
+++ b/tools/misc/h5debug.c
@@ -27,6 +27,7 @@
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
#define H5O_PACKAGE /*suppress error about including H5Opkg */
#define H5B2_PACKAGE /*suppress error about including H5B2pkg */
+#define H5B2_TESTING /*suppress warning about H5B2 testing funcs*/
#include "H5private.h" /* Generic Functions */
#include "H5Bprivate.h"
@@ -69,10 +70,9 @@ main(int argc, char *argv[])
{
hid_t fid, fapl, dxpl;
H5F_t *f;
- haddr_t addr=0, extra=0;
+ haddr_t addr=0, extra=0, extra2=0;
uint8_t sig[16];
int i;
- unsigned ndims;
herr_t status = SUCCEED;
if (argc == 1) {
@@ -120,6 +120,9 @@ main(int argc, char *argv[])
if (argc > 3) {
extra = HDstrtoll(argv[3], NULL, 0);
}
+ if (argc > 4) {
+ extra2 = HDstrtoll(argv[4], NULL, 0);
+ }
/*
* Read the signature at the specified file position.
*/
@@ -159,6 +162,7 @@ main(int argc, char *argv[])
* after the B-tree signature.
*/
H5B_subid_t subtype = (H5B_subid_t)sig[H5B_SIZEOF_MAGIC];
+ unsigned ndims;
switch (subtype) {
case H5B_SNODE_ID:
@@ -184,6 +188,8 @@ main(int argc, char *argv[])
H5B2_subid_t subtype = (H5B_subid_t)sig[H5B2_SIZEOF_MAGIC+1];
#ifdef NOT_YET
+ unsigned ndims;
+
switch (subtype) {
case H5B_SNODE_ID:
status = H5G_node_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra);
@@ -199,10 +205,72 @@ main(int argc, char *argv[])
HDexit(4);
}
#else /* NOT_YET */
-H5B2_class_t type={0,sizeof(hsize_t),NULL,NULL,NULL}; /* B-tree class information */
+fprintf(stderr,"B-tree subtype=%u\n",(unsigned)subtype);
+ status = H5B2_hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5B2_TEST);
+#endif /* NOT_YET */
+
+ } else if (!HDmemcmp(sig, H5B2_INT_MAGIC, H5B2_SIZEOF_MAGIC)) {
+ /*
+ * Debug a v2 B-tree. B-trees are debugged through the B-tree
+ * subclass. The subclass identifier is two bytes after the
+ * B-tree signature.
+ */
+ H5B2_subid_t subtype = (H5B_subid_t)sig[H5B2_SIZEOF_MAGIC+1];
+ unsigned nrecs;
+
+#ifdef NOT_YET
+ unsigned ndims;
+
+ switch (subtype) {
+ case H5B_SNODE_ID:
+ status = H5G_node_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra);
+ break;
+
+ case H5B_ISTORE_ID:
+ ndims = (unsigned)extra;
+ status = H5D_istore_debug (f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, ndims);
+ break;
+ default:
+ fprintf(stderr, "Unknown B-tree subtype %u\n", (unsigned)(subtype));
+ HDexit(4);
+ }
+#else /* NOT_YET */
+fprintf(stderr,"B-tree subtype=%u\n",(unsigned)subtype);
+ nrecs = (unsigned)extra2;
+ status = H5B2_int_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5B2_TEST, extra, nrecs);
+#endif /* NOT_YET */
+
+ } else if (!HDmemcmp(sig, H5B2_LEAF_MAGIC, H5B2_SIZEOF_MAGIC)) {
+ /*
+ * Debug a v2 B-tree. B-trees are debugged through the B-tree
+ * subclass. The subclass identifier is two bytes after the
+ * B-tree signature.
+ */
+ H5B2_subid_t subtype = (H5B_subid_t)sig[H5B2_SIZEOF_MAGIC+1];
+ unsigned nrecs;
+
+#ifdef NOT_YET
+ unsigned ndims;
+
+ switch (subtype) {
+ case H5B_SNODE_ID:
+ status = H5G_node_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra);
+ break;
+
+ case H5B_ISTORE_ID:
+ ndims = (unsigned)extra;
+ status = H5D_istore_debug (f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, ndims);
+ break;
+
+ default:
+ fprintf(stderr, "Unknown B-tree subtype %u\n", (unsigned)(subtype));
+ HDexit(4);
+ }
+#else /* NOT_YET */
fprintf(stderr,"B-tree subtype=%u\n",(unsigned)subtype);
- status = H5B2_hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, &type);
+ nrecs = (unsigned)extra2;
+ status = H5B2_leaf_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5B2_TEST, extra, nrecs);
#endif /* NOT_YET */
} else if (sig[0] == H5O_VERSION) {