summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-03-03 20:06:29 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-03-03 20:06:29 (GMT)
commit1083071530471faf1641b4182785311aa9bac674 (patch)
treee0068035580a0b04407cea1a12947e3ea528fbf3 /src
parent5585643bb3643bbba7245b2c742e8008d8df5cfc (diff)
downloadhdf5-1083071530471faf1641b4182785311aa9bac674.zip
hdf5-1083071530471faf1641b4182785311aa9bac674.tar.gz
hdf5-1083071530471faf1641b4182785311aa9bac674.tar.bz2
[svn-r6452] Purpose:
Code cleanup Description: Add B-tree node debugging routine for symbol table nodes (i.e. groups) Platforms tested: FreeBSD 4.7 (sleipnir)
Diffstat (limited to 'src')
-rw-r--r--src/H5B.c20
-rw-r--r--src/H5Bprivate.h2
-rw-r--r--src/H5Distore.c7
-rw-r--r--src/H5Fistore.c7
-rw-r--r--src/H5Gnode.c46
5 files changed, 70 insertions, 12 deletions
diff --git a/src/H5B.c b/src/H5B.c
index 60073e4..2b4d6e0 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -800,6 +800,8 @@ H5B_decode_key(H5F_t *f, H5B_t *bt, int idx)
FUNC_ENTER_NOINIT(H5B_decode_key);
+ assert(bt->key[idx].dirty==0);
+
bt->key[idx].nkey = bt->native + idx * bt->type->sizeof_nkey;
if ((bt->type->decode) (f, bt, bt->key[idx].rkey, bt->key[idx].nkey) < 0)
HGOTO_ERROR(H5E_BTREE, H5E_CANTDECODE, FAIL, "unable to decode key");
@@ -1658,6 +1660,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
bt->cache_info.dirty = TRUE;
bt->key[idx].dirty = TRUE;
if (idx>0) {
+ /* Don't propagate change out of this B-tree node */
*lt_key_changed = FALSE;
} else {
HDmemcpy(lt_key, bt->key[idx].nkey, type->sizeof_nkey);
@@ -1667,6 +1670,7 @@ H5B_remove_helper(H5F_t *f, hid_t dxpl_id, haddr_t addr, const H5B_class_t *type
bt->cache_info.dirty = TRUE;
bt->key[idx+1].dirty = TRUE;
if (idx+1<bt->nchildren) {
+ /* Don't propagate change out of this B-tree node */
*rt_key_changed = FALSE;
} else {
HDmemcpy(rt_key, bt->key[idx+1].nkey, type->sizeof_nkey);
@@ -2102,10 +2106,20 @@ H5B_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f
HDfprintf(stream, "%*s%-*s %a\n", indent + 3, "", MAX(0, fwidth - 3),
"Address:", bt->child[i]);
- H5B_decode_key(f, bt, i);
- if (type->debug_key)
- (type->debug_key)(stream, indent+3, MAX (0, fwidth-3),
+ /* If there is a key debugging routine, use it to display the left & right keys */
+ if (type->debug_key) {
+ /* Decode the 'left' key & print it */
+ if(bt->key[i].nkey==NULL)
+ H5B_decode_key(f, bt, i);
+ (type->debug_key)(stream, f, dxpl_id, indent+3, MAX (0, fwidth-3),
bt->key[i].nkey, udata);
+
+ /* Decode the 'right' key & print it */
+ if(bt->key[i+1].nkey==NULL)
+ H5B_decode_key(f, bt, i+1);
+ (type->debug_key)(stream, f, dxpl_id, indent+3, MAX (0, fwidth-3),
+ bt->key[i+1].nkey, udata);
+ }
}
done:
diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h
index 28e3060..7b13764 100644
--- a/src/H5Bprivate.h
+++ b/src/H5Bprivate.h
@@ -105,7 +105,7 @@ typedef struct H5B_class_t {
/* encode, decode, debug key values */
herr_t (*decode)(H5F_t*, struct H5B_t*, uint8_t*, void*);
herr_t (*encode)(H5F_t*, struct H5B_t*, uint8_t*, void*);
- herr_t (*debug_key)(FILE*, int, int, const void*, const void*);
+ herr_t (*debug_key)(FILE*, H5F_t*, hid_t, int, int, const void*, const void*);
} H5B_class_t;
diff --git a/src/H5Distore.c b/src/H5Distore.c
index 3afc866..cbdd504 100644
--- a/src/H5Distore.c
+++ b/src/H5Distore.c
@@ -141,8 +141,9 @@ static herr_t H5F_istore_decode_key(H5F_t *f, H5B_t *bt, uint8_t *raw,
void *_key);
static herr_t H5F_istore_encode_key(H5F_t *f, H5B_t *bt, uint8_t *raw,
void *_key);
-static herr_t H5F_istore_debug_key(FILE *stream, int indent, int fwidth,
- const void *key, const void *udata);
+static herr_t H5F_istore_debug_key(FILE *stream, H5F_t *f, hid_t dxpl_id,
+ int indent, int fwidth, const void *key,
+ const void *udata);
static haddr_t H5F_istore_get_addr(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout,
const hssize_t offset[]);
static H5B_iterate_t H5F_istore_prune_extent(H5F_t *f, hid_t dxpl_id, void *_lt_key, haddr_t addr,
@@ -349,7 +350,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_istore_debug_key (FILE *stream, int indent, int fwidth,
+H5F_istore_debug_key (FILE *stream, H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int indent, int fwidth,
const void *_key, const void *_udata)
{
const H5F_istore_key_t *key = (const H5F_istore_key_t *)_key;
diff --git a/src/H5Fistore.c b/src/H5Fistore.c
index 3afc866..cbdd504 100644
--- a/src/H5Fistore.c
+++ b/src/H5Fistore.c
@@ -141,8 +141,9 @@ static herr_t H5F_istore_decode_key(H5F_t *f, H5B_t *bt, uint8_t *raw,
void *_key);
static herr_t H5F_istore_encode_key(H5F_t *f, H5B_t *bt, uint8_t *raw,
void *_key);
-static herr_t H5F_istore_debug_key(FILE *stream, int indent, int fwidth,
- const void *key, const void *udata);
+static herr_t H5F_istore_debug_key(FILE *stream, H5F_t *f, hid_t dxpl_id,
+ int indent, int fwidth, const void *key,
+ const void *udata);
static haddr_t H5F_istore_get_addr(H5F_t *f, hid_t dxpl_id, const H5O_layout_t *layout,
const hssize_t offset[]);
static H5B_iterate_t H5F_istore_prune_extent(H5F_t *f, hid_t dxpl_id, void *_lt_key, haddr_t addr,
@@ -349,7 +350,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5F_istore_debug_key (FILE *stream, int indent, int fwidth,
+H5F_istore_debug_key (FILE *stream, H5F_t UNUSED *f, hid_t UNUSED dxpl_id, int indent, int fwidth,
const void *_key, const void *_udata)
{
const H5F_istore_key_t *key = (const H5F_istore_key_t *)_key;
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index 4fcf758..f77b4c5 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -42,6 +42,9 @@ static herr_t H5G_node_decode_key(H5F_t *f, H5B_t *bt, uint8_t *raw,
void *_key);
static herr_t H5G_node_encode_key(H5F_t *f, H5B_t *bt, uint8_t *raw,
void *_key);
+static herr_t H5G_node_debug_key(FILE *stream, H5F_t *f, hid_t dxpl_id,
+ int indent, int fwidth, const void *key,
+ const void *udata);
static size_t H5G_node_size(H5F_t *f);
static H5G_node_t *H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_udata1,
void *_udata2);
@@ -90,7 +93,7 @@ H5B_class_t H5B_SNODE[1] = {{
H5G_node_remove, /*remove */
H5G_node_decode_key, /*decode */
H5G_node_encode_key, /*encode */
- NULL, /*debug key */
+ H5G_node_debug_key, /*debug */
}};
/* Interface initialization */
@@ -204,6 +207,42 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5G_node_debug_key
+ *
+ * Purpose: Prints a key.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ * Programmer: Quincey Koziol
+ * Friday, February 28, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5G_node_debug_key (FILE *stream, H5F_t *f, hid_t dxpl_id, int indent, int fwidth,
+ const void *_key, const void *_udata)
+{
+ const H5G_node_key_t *key = (const H5G_node_key_t *) _key;
+ const H5G_bt_ud1_t *udata = (const H5G_bt_ud1_t *) _udata;
+ const char *s;
+ herr_t ret_value=SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(H5G_node_debug_key, FAIL);
+ assert (key);
+
+ HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Name :");
+ if (NULL == (s = H5HL_peek(f, dxpl_id, udata->heap_addr, key->offset)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read symbol name");
+ HDfprintf (stream, "%s\n", s);
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value);
+}
+
+
+/*-------------------------------------------------------------------------
* Function: H5G_node_size
*
* Purpose: Returns the total size of a symbol table node.
@@ -1350,8 +1389,11 @@ H5G_node_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE * stream, int indent,
* B-tree node.
*/
if (NULL == (sn = H5AC_protect(f, dxpl_id, H5AC_SNODE, addr, NULL, NULL))) {
+ H5G_bt_ud1_t udata; /*data to pass through B-tree */
+
H5E_clear(); /*discard that error */
- if ( H5B_debug(f, dxpl_id, addr, stream, indent, fwidth, H5B_SNODE, NULL) < 0)
+ udata.heap_addr = heap;
+ if ( H5B_debug(f, dxpl_id, addr, stream, indent, fwidth, H5B_SNODE, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to debug B-tree node");
HGOTO_DONE(SUCCEED);
}