summaryrefslogtreecommitdiffstats
path: root/src/H5B2dbg.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2015-11-20 20:24:23 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2015-11-20 20:24:23 (GMT)
commit8830acb2cbc9384978c22a3e01f4dd15276290e5 (patch)
tree3ff95fe7a8885ade286b1caeb350e57ef25b63e2 /src/H5B2dbg.c
parent5c6f1819d5033b2443a165b12b81b0343bec6456 (diff)
downloadhdf5-8830acb2cbc9384978c22a3e01f4dd15276290e5.zip
hdf5-8830acb2cbc9384978c22a3e01f4dd15276290e5.tar.gz
hdf5-8830acb2cbc9384978c22a3e01f4dd15276290e5.tar.bz2
[svn-r28422] Description:
Revert most of r27549, since revise_chunks code requires debugging contexts for v2 B-trees. Also, misc. warning cleanups and alignments w/changes on revise_chunks branch. Tested on: MacOSX/64 10.11.1 (amazon) w/serial & parallel (h5committest forthcoming)
Diffstat (limited to 'src/H5B2dbg.c')
-rw-r--r--src/H5B2dbg.c48
1 files changed, 41 insertions, 7 deletions
diff --git a/src/H5B2dbg.c b/src/H5B2dbg.c
index f723d10..ad9f970 100644
--- a/src/H5B2dbg.c
+++ b/src/H5B2dbg.c
@@ -92,6 +92,7 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
const H5B2_class_t *type, haddr_t obj_addr)
{
H5B2_hdr_t *hdr = NULL; /* B-tree header info */
+ void *dbg_ctx = NULL; /* v2 B-tree debugging context */
unsigned u; /* Local index variable */
char temp_str[128]; /* Temporary string, for formatting */
H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */
@@ -109,13 +110,22 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
HDassert(indent >= 0);
HDassert(fwidth >= 0);
HDassert(type);
+ HDassert((type->crt_dbg_ctx && type->dst_dbg_ctx) ||
+ (NULL == type->crt_dbg_ctx && NULL == type->dst_dbg_ctx));
+
+ /* Check for debugging context callback available */
+ if(type->crt_dbg_ctx) {
+ /* Create debugging context */
+ if(NULL == (dbg_ctx = (type->crt_dbg_ctx)(f, dxpl_id, obj_addr)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context")
+ } /* end if */
/*
* Load the B-tree header.
*/
cache_udata.f = f;
cache_udata.addr = addr;
- cache_udata.ctx_udata = f;
+ cache_udata.ctx_udata = dbg_ctx;
if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, addr, &cache_udata, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header")
@@ -168,6 +178,8 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
} /* end for */
done:
+ if(dbg_ctx && (type->dst_dbg_ctx)(dbg_ctx) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to release v2 B-tree debugging context")
if(hdr) {
hdr->f = NULL;
if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, addr, hdr, H5AC__NO_FLAGS_SET) < 0)
@@ -197,6 +209,7 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
{
H5B2_hdr_t *hdr = NULL; /* B-tree header */
H5B2_internal_t *internal = NULL; /* B-tree internal node */
+ void *dbg_ctx = NULL; /* v2 B-tree debugging context */
unsigned u; /* Local index variable */
char temp_str[128]; /* Temporary string, for formatting */
H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */
@@ -213,16 +226,25 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
HDassert(indent >= 0);
HDassert(fwidth >= 0);
HDassert(type);
+ HDassert((type->crt_dbg_ctx && type->dst_dbg_ctx) ||
+ (NULL == type->crt_dbg_ctx && NULL == type->dst_dbg_ctx));
HDassert(H5F_addr_defined(hdr_addr));
HDassert(H5F_addr_defined(obj_addr));
HDassert(nrec > 0);
+ /* Check for debugging context callback available */
+ if(type->crt_dbg_ctx) {
+ /* Create debugging context */
+ if(NULL == (dbg_ctx = (type->crt_dbg_ctx)(f, dxpl_id, obj_addr)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context")
+ } /* end if */
+
/*
* Load the B-tree header.
*/
cache_udata.f = f;
cache_udata.addr = hdr_addr;
- cache_udata.ctx_udata = f;
+ cache_udata.ctx_udata = dbg_ctx;
if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, &cache_udata, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree header")
@@ -273,8 +295,7 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
temp_str);
HDassert(H5B2_INT_NREC(internal, hdr, u));
- (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6),
- H5B2_INT_NREC(internal, hdr, u));
+ (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6), H5B2_INT_NREC(internal, hdr, u), dbg_ctx);
} /* end for */
/* Print final node pointer */
@@ -286,6 +307,8 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
internal->node_ptrs[u].addr);
done:
+ if(dbg_ctx && (type->dst_dbg_ctx)(dbg_ctx) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to release v2 B-tree debugging context")
if(hdr) {
hdr->f = NULL;
if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0)
@@ -318,6 +341,7 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent
H5B2_hdr_t *hdr = NULL; /* B-tree header */
H5B2_leaf_t *leaf = NULL; /* B-tree leaf node */
H5B2_hdr_cache_ud_t cache_udata; /* User-data for callback */
+ void *dbg_ctx = NULL; /* v2 B-tree debugging context */
unsigned u; /* Local index variable */
char temp_str[128]; /* Temporary string, for formatting */
herr_t ret_value = SUCCEED; /* Return value */
@@ -333,16 +357,25 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent
HDassert(indent >= 0);
HDassert(fwidth >= 0);
HDassert(type);
+ HDassert((type->crt_dbg_ctx && type->dst_dbg_ctx) ||
+ (NULL == type->crt_dbg_ctx && NULL == type->dst_dbg_ctx));
HDassert(H5F_addr_defined(hdr_addr));
HDassert(H5F_addr_defined(obj_addr));
HDassert(nrec > 0);
+ /* Check for debugging context callback available */
+ if(type->crt_dbg_ctx) {
+ /* Create debugging context */
+ if(NULL == (dbg_ctx = (type->crt_dbg_ctx)(f, dxpl_id, obj_addr)))
+ HGOTO_ERROR(H5E_BTREE, H5E_CANTGET, FAIL, "unable to create v2 B-tree debugging context")
+ } /* end if */
+
/*
* Load the B-tree header.
*/
cache_udata.f = f;
cache_udata.addr = hdr_addr;
- cache_udata.ctx_udata = f;
+ cache_udata.ctx_udata = dbg_ctx;
if(NULL == (hdr = (H5B2_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, &cache_udata, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree header")
@@ -384,11 +417,12 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent
HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3),
temp_str);
HDassert(H5B2_LEAF_NREC(leaf, hdr, u));
- (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6),
- H5B2_LEAF_NREC(leaf, hdr, u));
+ (void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6), H5B2_LEAF_NREC(leaf, hdr, u), dbg_ctx);
} /* end for */
done:
+ if(dbg_ctx && (type->dst_dbg_ctx)(dbg_ctx) < 0)
+ HDONE_ERROR(H5E_BTREE, H5E_CANTRELEASE, FAIL, "unable to release v2 B-tree debugging context")
if(hdr) {
hdr->f = NULL;
if(H5AC_unprotect(f, dxpl_id, H5AC_BT2_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0)