[svn-r27549] Description:

Update the file format debugging routines to match the recent changes to
the metadata cache, along with a few other cleanups and miscellaneous
enhancements.

Tested on:
    MacOSX/64 10.10.5 (amazon)
    (h5committest forthcoming)
This commit is contained in:
Quincey Koziol 2015-08-21 22:08:43 -05:00
parent ab7d724ffd
commit de324a50f8
19 changed files with 392 additions and 300 deletions

View File

@ -85,8 +85,7 @@ static herr_t H5A__dense_btree2_corder_encode(uint8_t *raw, const void *native,
void *ctx);
static herr_t H5A__dense_btree2_corder_decode(const uint8_t *raw, void *native,
void *ctx);
static herr_t H5A__dense_btree2_corder_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
int indent, int fwidth, const void *record, const void *_udata);
static herr_t H5A__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *record);
/* v2 B-tree driver callbacks for 'name' index */
static herr_t H5A__dense_btree2_name_store(void *native, const void *udata);
@ -95,8 +94,7 @@ static herr_t H5A__dense_btree2_name_encode(uint8_t *raw, const void *native,
void *ctx);
static herr_t H5A__dense_btree2_name_decode(const uint8_t *raw, void *native,
void *ctx);
static herr_t H5A__dense_btree2_name_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
int indent, int fwidth, const void *record, const void *_udata);
static herr_t H5A__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *record);
/* Fractal heap function callbacks */
static herr_t H5A__dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_data);
@ -116,9 +114,7 @@ const H5B2_class_t H5A_BT2_NAME[1]={{ /* B-tree class information */
H5A__dense_btree2_name_compare, /* Record comparison callback */
H5A__dense_btree2_name_encode, /* Record encoding callback */
H5A__dense_btree2_name_decode, /* Record decoding callback */
H5A__dense_btree2_name_debug, /* Record debugging callback */
NULL, /* Create debugging context */
NULL /* Destroy debugging context */
H5A__dense_btree2_name_debug /* Record debugging callback */
}};
/* v2 B-tree class for indexing 'creation order' field of attributes */
@ -132,9 +128,7 @@ const H5B2_class_t H5A_BT2_CORDER[1]={{ /* B-tree class information */
H5A__dense_btree2_corder_compare, /* Record comparison callback */
H5A__dense_btree2_corder_encode, /* Record encoding callback */
H5A__dense_btree2_corder_decode, /* Record decoding callback */
H5A__dense_btree2_corder_debug, /* Record debugging callback */
NULL, /* Create debugging context */
NULL /* Destroy debugging context */
H5A__dense_btree2_corder_debug /* Record debugging callback */
}};
@ -381,8 +375,7 @@ H5A__dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_U
*-------------------------------------------------------------------------
*/
static herr_t
H5A__dense_btree2_name_debug(FILE *stream, const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id,
int indent, int fwidth, const void *_nrecord, const void H5_ATTR_UNUSED *_udata)
H5A__dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *_nrecord)
{
const H5A_dense_bt2_name_rec_t *nrecord = (const H5A_dense_bt2_name_rec_t *)_nrecord;
@ -539,8 +532,7 @@ H5A__dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR
*-------------------------------------------------------------------------
*/
static herr_t
H5A__dense_btree2_corder_debug(FILE *stream, const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id,
int indent, int fwidth, const void *_nrecord, const void H5_ATTR_UNUSED *_udata)
H5A__dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *_nrecord)
{
const H5A_dense_bt2_corder_rec_t *nrecord = (const H5A_dense_bt2_corder_rec_t *)_nrecord;

View File

@ -91,7 +91,6 @@ 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,22 +108,13 @@ 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 = dbg_ctx;
cache_udata.ctx_udata = f;
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")
@ -139,12 +129,12 @@ H5B2__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
*/
HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth,
"Tree type ID:", hdr->cls->name, (unsigned)hdr->cls->id);
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Size of node:",
hdr->node_size);
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
(unsigned)hdr->node_size);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Size of raw (disk) record:",
hdr->rrec_size);
(unsigned)hdr->rrec_size);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Dirty flag:",
hdr->cache_info.is_dirty ? "True" : "False");
@ -177,8 +167,6 @@ 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)
@ -208,7 +196,6 @@ 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 */
@ -225,25 +212,16 @@ 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 = dbg_ctx;
cache_udata.ctx_udata = f;
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")
@ -259,22 +237,19 @@ H5B2__int_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, FAIL, "unable to load B-tree internal node")
/* Print opening message */
if(internal->depth == 1)
HDfprintf(stream, "%*sv2 B-tree Internal 'Leaf' Node...\n", indent, "");
else
HDfprintf(stream, "%*sv2 B-tree Internal 'Branch' Node...\n", indent, "");
HDfprintf(stream, "%*sv2 B-tree Internal Node...\n", indent, "");
/*
* Print the values.
*/
HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth,
"Tree type ID:", hdr->cls->name, (unsigned)hdr->cls->id);
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Size of node:",
hdr->node_size);
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
(unsigned)hdr->node_size);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Size of raw (disk) record:",
hdr->rrec_size);
(unsigned)hdr->rrec_size);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Dirty flag:",
internal->cache_info.is_dirty ? "True" : "False");
@ -297,8 +272,8 @@ 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, f, dxpl_id, indent + 6, MAX (0, fwidth-6),
H5B2_INT_NREC(internal, hdr, u), dbg_ctx);
(void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6),
H5B2_INT_NREC(internal, hdr, u));
} /* end for */
/* Print final node pointer */
@ -310,8 +285,6 @@ 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)
@ -344,7 +317,6 @@ 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 */
@ -360,25 +332,16 @@ 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 = dbg_ctx;
cache_udata.ctx_udata = f;
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")
@ -400,12 +363,12 @@ H5B2__leaf_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent
*/
HDfprintf(stream, "%*s%-*s %s (%u)\n", indent, "", fwidth,
"Tree type ID:", hdr->cls->name, (unsigned)hdr->cls->id);
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Size of node:",
hdr->node_size);
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
(unsigned)hdr->node_size);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Size of raw (disk) record:",
hdr->rrec_size);
(unsigned)hdr->rrec_size);
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Dirty flag:",
leaf->cache_info.is_dirty ? "True" : "False");
@ -420,13 +383,11 @@ 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, f, dxpl_id, indent + 6, MAX (0, fwidth-6),
H5B2_LEAF_NREC(leaf, hdr, u), dbg_ctx);
(void)(type->debug)(stream, indent + 6, MAX (0, fwidth-6),
H5B2_LEAF_NREC(leaf, hdr, u));
} /* 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)

View File

@ -92,10 +92,8 @@ struct H5B2_class_t {
herr_t (*compare)(const void *rec1, const void *rec2); /* Compare two native records */
herr_t (*encode)(uint8_t *raw, const void *record, void *ctx); /* Encode record from native form to disk storage form */
herr_t (*decode)(const uint8_t *raw, void *record, void *ctx); /* Decode record from disk storage form to native form */
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 *ctx);
void *(*crt_dbg_ctx)(H5F_t *f, hid_t dxpl_id, haddr_t obj_addr); /* Create debugging context */
herr_t (*dst_dbg_ctx)(void *dbg_ctx); /* Destroy debugging context */
herr_t (*debug)(FILE *stream, int indent, int fwidth, /* Print a record for debugging */
const void *record);
};
/* v2 B-tree creation parameters */

View File

@ -67,9 +67,7 @@ static herr_t H5B2__test_store(void *nrecord, const void *udata);
static herr_t H5B2__test_compare(const void *rec1, const void *rec2);
static herr_t H5B2__test_encode(uint8_t *raw, const void *nrecord, void *ctx);
static herr_t H5B2__test_decode(const uint8_t *raw, void *nrecord, void *ctx);
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);
static void *H5B2__test_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr);
static herr_t H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record);
/*********************/
@ -86,9 +84,7 @@ const H5B2_class_t H5B2_TEST[1]={{ /* B-tree class information */
H5B2__test_compare, /* Record comparison callback */
H5B2__test_encode, /* Record encoding callback */
H5B2__test_decode, /* Record decoding callback */
H5B2__test_debug, /* Record debugging callback */
H5B2__test_crt_dbg_context, /* Create debugging context */
H5B2__test_dst_context /* Destroy debugging context */
H5B2__test_debug /* Record debugging callback */
}};
@ -295,13 +291,11 @@ H5B2__test_decode(const uint8_t *raw, void *nrecord, void *_ctx)
*-------------------------------------------------------------------------
*/
static herr_t
H5B2__test_debug(FILE *stream, const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id,
int indent, int fwidth, const void *record,
const void H5_ATTR_UNUSED *_udata)
H5B2__test_debug(FILE *stream, int indent, int fwidth, const void *record)
{
FUNC_ENTER_STATIC_NOERR
HDassert (record);
HDassert(record);
HDfprintf(stream, "%*s%-*s %Hu\n", indent, "", fwidth, "Record:",
*(const hsize_t *)record);
@ -309,45 +303,6 @@ H5B2__test_debug(FILE *stream, const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUS
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5B2__test_debug() */
/*-------------------------------------------------------------------------
* Function: H5B2__test_crt_dbg_context
*
* Purpose: Create context for debugging callback
*
* Return: Success: non-NULL
* Failure: NULL
*
* Programmer: Quincey Koziol
* Tuesday, December 1, 2009
*
*-------------------------------------------------------------------------
*/
static void *
H5B2__test_crt_dbg_context(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr)
{
H5B2_test_ctx_t *ctx; /* Callback context structure */
void *ret_value; /* Return value */
FUNC_ENTER_STATIC
/* Sanity check */
HDassert(f);
/* Allocate callback context */
if(NULL == (ctx = H5FL_MALLOC(H5B2_test_ctx_t)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "can't allocate callback context")
/* Determine the size of addresses & lengths in the file */
ctx->sizeof_size = H5F_SIZEOF_SIZE(f);
/* Set return value */
ret_value = ctx;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5B2__test_crt_dbg_context() */
/*-------------------------------------------------------------------------
* Function: H5B2_get_root_addr_test

View File

@ -104,6 +104,8 @@ H5F_debug(H5F_t *f, FILE *stream, int indent, int fwidth)
"Symbol table leaf node 1/2 rank:", f->shared->sblock->sym_leaf_k);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Symbol table internal node 1/2 rank:", f->shared->sblock->btree_k[H5B_SNODE_ID]);
HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
"Indexed storage internal node 1/2 rank:", f->shared->sblock->btree_k[H5B_CHUNK_ID]);
HDfprintf(stream, "%*s%-*s 0x%02x\n", indent, "", fwidth,
"File status flags:", (unsigned)(f->shared->sblock->status_flags));
HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth,

View File

@ -83,8 +83,7 @@ static herr_t H5G_dense_btree2_corder_encode(uint8_t *raw, const void *native,
void *ctx);
static herr_t H5G_dense_btree2_corder_decode(const uint8_t *raw, void *native,
void *ctx);
static herr_t H5G_dense_btree2_corder_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
int indent, int fwidth, const void *record, const void *_udata);
static herr_t H5G_dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *record);
/* v2 B-tree driver callbacks for 'name' index */
static herr_t H5G_dense_btree2_name_store(void *native, const void *udata);
@ -93,8 +92,7 @@ static herr_t H5G_dense_btree2_name_encode(uint8_t *raw, const void *native,
void *ctx);
static herr_t H5G_dense_btree2_name_decode(const uint8_t *raw, void *native,
void *ctx);
static herr_t H5G_dense_btree2_name_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
int indent, int fwidth, const void *record, const void *_udata);
static herr_t H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *record);
/* Fractal heap function callbacks */
static herr_t H5G_dense_fh_name_cmp(const void *obj, size_t obj_len, void *op_data);
@ -114,9 +112,7 @@ const H5B2_class_t H5G_BT2_NAME[1]={{ /* B-tree class information */
H5G_dense_btree2_name_compare, /* Record comparison callback */
H5G_dense_btree2_name_encode, /* Record encoding callback */
H5G_dense_btree2_name_decode, /* Record decoding callback */
H5G_dense_btree2_name_debug, /* Record debugging callback */
NULL, /* Create debugging context */
NULL /* Destroy debugging context */
H5G_dense_btree2_name_debug /* Record debugging callback */
}};
/* v2 B-tree class for indexing 'creation order' field of links */
@ -130,9 +126,7 @@ const H5B2_class_t H5G_BT2_CORDER[1]={{ /* B-tree class information */
H5G_dense_btree2_corder_compare, /* Record comparison callback */
H5G_dense_btree2_corder_encode, /* Record encoding callback */
H5G_dense_btree2_corder_decode, /* Record decoding callback */
H5G_dense_btree2_corder_debug, /* Record debugging callback */
NULL, /* Create debugging context */
NULL /* Destroy debugging context */
H5G_dense_btree2_corder_debug /* Record debugging callback */
}};
/*****************************/
@ -362,9 +356,7 @@ H5G_dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_UN
*-------------------------------------------------------------------------
*/
static herr_t
H5G_dense_btree2_name_debug(FILE *stream, const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id,
int indent, int fwidth, const void *_nrecord,
const void H5_ATTR_UNUSED *_udata)
H5G_dense_btree2_name_debug(FILE *stream, int indent, int fwidth, const void *_nrecord)
{
const H5G_dense_bt2_name_rec_t *nrecord = (const H5G_dense_bt2_name_rec_t *)_nrecord;
unsigned u; /* Local index variable */
@ -528,9 +520,7 @@ H5G_dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_
*-------------------------------------------------------------------------
*/
static herr_t
H5G_dense_btree2_corder_debug(FILE *stream, const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id,
int indent, int fwidth, const void *_nrecord,
const void H5_ATTR_UNUSED *_udata)
H5G_dense_btree2_corder_debug(FILE *stream, int indent, int fwidth, const void *_nrecord)
{
const H5G_dense_bt2_corder_rec_t *nrecord = (const H5G_dense_bt2_corder_rec_t *)_nrecord;
unsigned u; /* Local index variable */

View File

@ -451,14 +451,76 @@ H5HF_get_obj_len(H5HF_t *fh, hid_t dxpl_id, const void *_id, size_t *obj_len_p)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'tiny' object's length")
} /* end if */
else {
HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC);
HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet")
HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC);
HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet")
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_get_obj_len() */
/*-------------------------------------------------------------------------
* Function: H5HF_get_obj_off
*
* Purpose: Get the offset of an entry in a fractal heap
*
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
* Aug 20 2015
*
*-------------------------------------------------------------------------
*/
herr_t
H5HF_get_obj_off(H5HF_t *fh, hid_t dxpl_id, const void *_id, hsize_t *obj_off_p)
{
const uint8_t *id = (const uint8_t *)_id; /* Object ID */
uint8_t id_flags; /* Heap ID flag bits */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/*
* Check arguments.
*/
HDassert(fh);
HDassert(id);
HDassert(obj_off_p);
/* Get the ID flags */
id_flags = *id;
/* Check for correct heap ID version */
if((id_flags & H5HF_ID_VERS_MASK) != H5HF_ID_VERS_CURR)
HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "incorrect heap ID version")
/* Set the shared heap header's file context for this operation */
fh->hdr->f = fh->f;
/* Check type of object in heap */
if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_MAN) {
H5HF__man_get_obj_off(fh->hdr, id, obj_off_p);
} /* end if */
else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_HUGE) {
/* Huge objects are located directly in the file */
if(H5HF__huge_get_obj_off(fh->hdr, dxpl_id, id, obj_off_p) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'huge' object's offset")
} /* end if */
else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_TINY) {
/* Tiny objects are not stored in the heap */
*obj_off_p = (hsize_t)0;
} /* end if */
else {
HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC);
HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet")
} /* end else */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_get_obj_off() */
/*-------------------------------------------------------------------------
* Function: H5HF_read

View File

@ -70,7 +70,6 @@ typedef struct H5HF_huge_bt2_ctx_t {
static void *H5HF_huge_bt2_crt_context(void *udata);
static herr_t H5HF_huge_bt2_dst_context(void *ctx);
static void *H5HF_huge_bt2_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr);
static herr_t H5HF_huge_bt2_indir_store(void *native, const void *udata);
static herr_t H5HF_huge_bt2_indir_compare(const void *rec1, const void *rec2);
@ -78,8 +77,7 @@ static herr_t H5HF_huge_bt2_indir_encode(uint8_t *raw, const void *native,
void *ctx);
static herr_t H5HF_huge_bt2_indir_decode(const uint8_t *raw, void *native,
void *ctx);
static herr_t H5HF_huge_bt2_indir_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
int indent, int fwidth, const void *record, const void *_udata);
static herr_t H5HF_huge_bt2_indir_debug(FILE *stream, int indent, int fwidth, const void *record);
static herr_t H5HF_huge_bt2_filt_indir_store(void *native, const void *udata);
static herr_t H5HF_huge_bt2_filt_indir_compare(const void *rec1, const void *rec2);
@ -87,8 +85,7 @@ static herr_t H5HF_huge_bt2_filt_indir_encode(uint8_t *raw, const void *native,
void *ctx);
static herr_t H5HF_huge_bt2_filt_indir_decode(const uint8_t *raw, void *native,
void *ctx);
static herr_t H5HF_huge_bt2_filt_indir_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
int indent, int fwidth, const void *record, const void *_udata);
static herr_t H5HF_huge_bt2_filt_indir_debug(FILE *stream, int indent, int fwidth, const void *record);
static herr_t H5HF_huge_bt2_dir_store(void *native, const void *udata);
static herr_t H5HF_huge_bt2_dir_compare(const void *rec1, const void *rec2);
@ -96,8 +93,7 @@ static herr_t H5HF_huge_bt2_dir_encode(uint8_t *raw, const void *native,
void *ctx);
static herr_t H5HF_huge_bt2_dir_decode(const uint8_t *raw, void *native,
void *ctx);
static herr_t H5HF_huge_bt2_dir_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
int indent, int fwidth, const void *record, const void *_udata);
static herr_t H5HF_huge_bt2_dir_debug(FILE *stream, int indent, int fwidth, const void *record);
static herr_t H5HF_huge_bt2_filt_dir_store(void *native, const void *udata);
static herr_t H5HF_huge_bt2_filt_dir_compare(const void *rec1, const void *rec2);
@ -105,8 +101,7 @@ static herr_t H5HF_huge_bt2_filt_dir_encode(uint8_t *raw, const void *native,
void *ctx);
static herr_t H5HF_huge_bt2_filt_dir_decode(const uint8_t *raw, void *native,
void *ctx);
static herr_t H5HF_huge_bt2_filt_dir_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
int indent, int fwidth, const void *record, const void *_udata);
static herr_t H5HF_huge_bt2_filt_dir_debug(FILE *stream, int indent, int fwidth, const void *record);
/*********************/
/* Package Variables */
@ -122,9 +117,7 @@ const H5B2_class_t H5HF_HUGE_BT2_INDIR[1]={{ /* B-tree class information */
H5HF_huge_bt2_indir_compare, /* Record comparison callback */
H5HF_huge_bt2_indir_encode, /* Record encoding callback */
H5HF_huge_bt2_indir_decode, /* Record decoding callback */
H5HF_huge_bt2_indir_debug, /* Record debugging callback */
H5HF_huge_bt2_crt_dbg_context, /* Create debugging context */
H5HF_huge_bt2_dst_context /* Destroy debugging context */
H5HF_huge_bt2_indir_debug /* Record debugging callback */
}};
/* v2 B-tree class for indirectly accessed, filtered 'huge' objects */
@ -138,9 +131,7 @@ const H5B2_class_t H5HF_HUGE_BT2_FILT_INDIR[1]={{ /* B-tree class information */
H5HF_huge_bt2_filt_indir_compare, /* Record comparison callback */
H5HF_huge_bt2_filt_indir_encode, /* Record encoding callback */
H5HF_huge_bt2_filt_indir_decode, /* Record decoding callback */
H5HF_huge_bt2_filt_indir_debug, /* Record debugging callback */
H5HF_huge_bt2_crt_dbg_context, /* Create debugging context */
H5HF_huge_bt2_dst_context /* Destroy debugging context */
H5HF_huge_bt2_filt_indir_debug /* Record debugging callback */
}};
/* v2 B-tree class for directly accessed 'huge' objects */
@ -154,9 +145,7 @@ const H5B2_class_t H5HF_HUGE_BT2_DIR[1]={{ /* B-tree class information */
H5HF_huge_bt2_dir_compare, /* Record comparison callback */
H5HF_huge_bt2_dir_encode, /* Record encoding callback */
H5HF_huge_bt2_dir_decode, /* Record decoding callback */
H5HF_huge_bt2_dir_debug, /* Record debugging callback */
H5HF_huge_bt2_crt_dbg_context, /* Create debugging context */
H5HF_huge_bt2_dst_context /* Destroy debugging context */
H5HF_huge_bt2_dir_debug /* Record debugging callback */
}};
/* v2 B-tree class for directly accessed, filtered 'huge' objects */
@ -170,9 +159,7 @@ const H5B2_class_t H5HF_HUGE_BT2_FILT_DIR[1]={{ /* B-tree class information */
H5HF_huge_bt2_filt_dir_compare, /* Record comparison callback */
H5HF_huge_bt2_filt_dir_encode, /* Record encoding callback */
H5HF_huge_bt2_filt_dir_decode, /* Record decoding callback */
H5HF_huge_bt2_filt_dir_debug, /* Record debugging callback */
H5HF_huge_bt2_crt_dbg_context, /* Create debugging context */
H5HF_huge_bt2_dst_context /* Destroy debugging context */
H5HF_huge_bt2_filt_dir_debug /* Record debugging callback */
}};
/*****************************/
@ -263,46 +250,6 @@ H5HF_huge_bt2_dst_context(void *_ctx)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5HF_huge_bt2_dst_context() */
/*-------------------------------------------------------------------------
* Function: H5HF_huge_bt2_crt_dbg_context
*
* Purpose: Create context for debugging callback
*
* Return: Success: non-NULL
* Failure: NULL
*
* Programmer: Quincey Koziol
* Tuesday, December 1, 2009
*
*-------------------------------------------------------------------------
*/
static void *
H5HF_huge_bt2_crt_dbg_context(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr)
{
H5HF_huge_bt2_ctx_t *ctx; /* Callback context structure */
void *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity check */
HDassert(f);
/* Allocate callback context */
if(NULL == (ctx = H5FL_MALLOC(H5HF_huge_bt2_ctx_t)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate callback context")
/* Determine the size of addresses & lengths in the file */
ctx->sizeof_addr = H5F_SIZEOF_ADDR(f);
ctx->sizeof_size = H5F_SIZEOF_SIZE(f);
/* Set return value */
ret_value = ctx;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5HF_huge_bt2_crt_dbg_context() */
/*-------------------------------------------------------------------------
* Function: H5HF_huge_bt2_indir_found
@ -505,9 +452,7 @@ H5HF_huge_bt2_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx)
*-------------------------------------------------------------------------
*/
static herr_t
H5HF_huge_bt2_indir_debug(FILE *stream, const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id,
int indent, int fwidth, const void *_nrecord,
const void H5_ATTR_UNUSED *_udata)
H5HF_huge_bt2_indir_debug(FILE *stream, int indent, int fwidth, const void *_nrecord)
{
const H5HF_huge_bt2_indir_rec_t *nrecord = (const H5HF_huge_bt2_indir_rec_t *)_nrecord;
@ -727,9 +672,7 @@ H5HF_huge_bt2_filt_indir_decode(const uint8_t *raw, void *_nrecord, void *_ctx)
*-------------------------------------------------------------------------
*/
static herr_t
H5HF_huge_bt2_filt_indir_debug(FILE *stream, const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id,
int indent, int fwidth, const void *_nrecord,
const void H5_ATTR_UNUSED *_udata)
H5HF_huge_bt2_filt_indir_debug(FILE *stream, int indent, int fwidth, const void *_nrecord)
{
const H5HF_huge_bt2_filt_indir_rec_t *nrecord = (const H5HF_huge_bt2_filt_indir_rec_t *)_nrecord;
@ -920,9 +863,7 @@ H5HF_huge_bt2_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx)
*-------------------------------------------------------------------------
*/
static herr_t
H5HF_huge_bt2_dir_debug(FILE *stream, const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id,
int indent, int fwidth, const void *_nrecord,
const void H5_ATTR_UNUSED *_udata)
H5HF_huge_bt2_dir_debug(FILE *stream, int indent, int fwidth, const void *_nrecord)
{
const H5HF_huge_bt2_dir_rec_t *nrecord = (const H5HF_huge_bt2_dir_rec_t *)_nrecord;
@ -1149,8 +1090,7 @@ H5HF_huge_bt2_filt_dir_decode(const uint8_t *raw, void *_nrecord, void *_ctx)
*-------------------------------------------------------------------------
*/
static herr_t
H5HF_huge_bt2_filt_dir_debug(FILE *stream, const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id,
int indent, int fwidth, const void *_nrecord, const void H5_ATTR_UNUSED *_udata)
H5HF_huge_bt2_filt_dir_debug(FILE *stream, int indent, int fwidth, const void *_nrecord)
{
const H5HF_huge_bt2_filt_dir_rec_t *nrecord = (const H5HF_huge_bt2_filt_dir_rec_t *)_nrecord;

View File

@ -98,6 +98,80 @@ static herr_t H5HF_dtable_debug(const H5HF_dtable_t *dtable, FILE *stream,
/* Local Variables */
/*******************/
/*-------------------------------------------------------------------------
* Function: H5HF_id_print
*
* Purpose: Prints a fractal heap ID.
*
* Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
* Aug 20 2015
*
*-------------------------------------------------------------------------
*/
herr_t
H5HF_id_print(H5HF_t *fh, hid_t dxpl_id, const void *_id, FILE *stream, int indent, int fwidth)
{
const uint8_t *id = (const uint8_t *)_id; /* Object ID */
uint8_t id_flags; /* Heap ID flag bits */
hsize_t obj_off; /* Offset of object */
size_t obj_len; /* Length of object */
char id_type; /* Character for the type of heap ID */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/*
* Check arguments.
*/
HDassert(fh);
HDassert(id);
HDassert(stream);
HDassert(indent >= 0);
HDassert(fwidth >= 0);
/* Get the ID flags */
id_flags = *id;
/* Check for correct heap ID version */
if((id_flags & H5HF_ID_VERS_MASK) != H5HF_ID_VERS_CURR)
HGOTO_ERROR(H5E_HEAP, H5E_VERSION, FAIL, "incorrect heap ID version")
/* Check type of object in heap */
if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_MAN) {
id_type = 'M';
} /* end if */
else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_HUGE) {
id_type = 'H';
} /* end if */
else if((id_flags & H5HF_ID_TYPE_MASK) == H5HF_ID_TYPE_TINY) {
id_type = 'T';
} /* end if */
else {
HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC);
HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet")
} /* end else */
/* Get the length of the heap object */
if(H5HF_get_obj_len(fh, dxpl_id, id, &obj_len) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve heap ID length")
/* Get the offset of the heap object */
if(H5HF_get_obj_off(fh, dxpl_id, id, &obj_off) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't retrieve heap ID length")
/* Display the heap ID */
HDfprintf(stream, "%*s%-*s (%c, %Hu, %Zu)\n", indent, "", fwidth,
"Heap ID info: (type, offset, length)",
id_type, obj_off, obj_len);
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_id_print() */
/*-------------------------------------------------------------------------
* Function: H5HF_dtable_debug

View File

@ -583,6 +583,93 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF_huge_get_obj_len() */
/*-------------------------------------------------------------------------
* Function: H5HF__huge_get_obj_off
*
* Purpose: Get the offset of a 'huge' object in a fractal heap
*
* Return: SUCCEED/FAIL
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
* Aug 8 2006
*
*-------------------------------------------------------------------------
*/
herr_t
H5HF__huge_get_obj_off(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
hsize_t *obj_off_p)
{
haddr_t obj_addr; /* Object's address in the file */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/*
* Check arguments.
*/
HDassert(hdr);
HDassert(H5F_addr_defined(hdr->huge_bt2_addr));
HDassert(id);
HDassert(obj_off_p);
/* Skip over the flag byte */
id++;
/* Check if 'huge' object ID encodes address & length directly */
if(hdr->huge_ids_direct) {
/* Retrieve the object's address (common) */
H5F_addr_decode(hdr->f, &id, &obj_addr);
} /* end if */
else {
/* Sanity check */
HDassert(H5F_addr_defined(hdr->huge_bt2_addr));
/* Check if v2 B-tree is open yet */
if(NULL == hdr->huge_bt2) {
/* Open existing v2 B-tree */
if(NULL == (hdr->huge_bt2 = H5B2_open(hdr->f, dxpl_id, hdr->huge_bt2_addr, hdr->f)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTOPENOBJ, FAIL, "unable to open v2 B-tree for tracking 'huge' heap objects")
} /* end if */
if(hdr->filter_len > 0) {
H5HF_huge_bt2_filt_indir_rec_t found_rec; /* Record found from tracking object */
H5HF_huge_bt2_filt_indir_rec_t search_rec; /* Record for searching for object */
/* Get ID for looking up 'huge' object in v2 B-tree */
UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size)
/* Look up object in v2 B-tree */
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 */
obj_addr = found_rec.addr;
} /* end if */
else {
H5HF_huge_bt2_indir_rec_t found_rec; /* Record found from tracking object */
H5HF_huge_bt2_indir_rec_t search_rec; /* Record for searching for object */
/* Get ID for looking up 'huge' object in v2 B-tree */
UINT64DECODE_VAR(id, search_rec.id, hdr->huge_id_size)
/* Look up object in v2 B-tree */
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 */
obj_addr = found_rec.addr;
} /* end else */
} /* end else */
/* Set the value to return */
*obj_off_p = (hsize_t)obj_addr;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5HF__huge_get_obj_off() */
/*-------------------------------------------------------------------------
* Function: H5HF_huge_op_real

View File

@ -254,6 +254,41 @@ H5HF_man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id, size_t *obj_len_p)
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HF_man_get_obj_len() */
/*-------------------------------------------------------------------------
* Function: H5HF__man_get_obj_off
*
* Purpose: Get the offset of a managed heap object
*
* Return: SUCCEED (Can't fail)
*
* Programmer: Quincey Koziol
* koziol@hdfgroup.org
* Aug 20 2015
*
*-------------------------------------------------------------------------
*/
void
H5HF__man_get_obj_off(const H5HF_hdr_t *hdr, const uint8_t *id, hsize_t *obj_off_p)
{
FUNC_ENTER_PACKAGE_NOERR
/*
* Check arguments.
*/
HDassert(hdr);
HDassert(id);
HDassert(obj_off_p);
/* Skip over the flag byte */
id++;
/* Skip over object offset */
UINT64DECODE_VAR(id, *obj_off_p, hdr->heap_off_size);
FUNC_LEAVE_NOAPI_VOID
} /* end H5HF__man_get_obj_off() */
/*-------------------------------------------------------------------------
* Function: H5HF_man_op_real

View File

@ -702,6 +702,8 @@ H5_DLL herr_t H5HF_man_insert(H5HF_hdr_t *fh, hid_t dxpl_id, size_t obj_size,
const void *obj, void *id);
H5_DLL herr_t H5HF_man_get_obj_len(H5HF_hdr_t *hdr, const uint8_t *id,
size_t *obj_len_p);
H5_DLL void H5HF__man_get_obj_off(const H5HF_hdr_t *hdr, const uint8_t *id,
hsize_t *obj_off_p);
H5_DLL herr_t H5HF_man_read(H5HF_hdr_t *fh, hid_t dxpl_id, const uint8_t *id,
void *obj);
H5_DLL herr_t H5HF_man_write(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
@ -716,6 +718,8 @@ H5_DLL herr_t H5HF_huge_insert(H5HF_hdr_t *hdr, hid_t dxpl_id, size_t obj_size,
void *obj, void *id);
H5_DLL herr_t H5HF_huge_get_obj_len(H5HF_hdr_t *hdr, hid_t dxpl_id,
const uint8_t *id, size_t *obj_len_p);
H5_DLL herr_t H5HF__huge_get_obj_off(H5HF_hdr_t *hdr, hid_t dxpl_id,
const uint8_t *id, hsize_t *obj_off_p);
H5_DLL herr_t H5HF_huge_read(H5HF_hdr_t *fh, hid_t dxpl_id, const uint8_t *id,
void *obj);
H5_DLL herr_t H5HF_huge_write(H5HF_hdr_t *hdr, hid_t dxpl_id, const uint8_t *id,
@ -748,7 +752,7 @@ H5_DLL herr_t H5HF_tiny_remove(H5HF_hdr_t *fh, const uint8_t *id);
/* Debugging routines for dumping file structures */
H5_DLL void H5HF_hdr_print(const H5HF_hdr_t *hdr, hid_t dxpl_id,
hbool_t dump_internal, FILE *stream, int indent, int fwidth);
hbool_t dump_internal, FILE *stream, int indent, int fwidth);
H5_DLL herr_t H5HF_hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
FILE *stream, int indent, int fwidth);
H5_DLL herr_t H5HF_dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,

View File

@ -116,6 +116,8 @@ H5_DLL herr_t H5HF_insert(H5HF_t *fh, hid_t dxpl_id, size_t size,
const void *obj, void *id/*out*/);
H5_DLL herr_t H5HF_get_obj_len(H5HF_t *fh, hid_t dxpl_id, const void *id,
size_t *obj_len_p/*out*/);
H5_DLL herr_t H5HF_get_obj_off(H5HF_t *fh, hid_t dxpl_id, const void *_id,
hsize_t *obj_off_p/*out*/);
H5_DLL herr_t H5HF_read(H5HF_t *fh, hid_t dxpl_id, const void *id,
void *obj/*out*/);
H5_DLL herr_t H5HF_write(H5HF_t *fh, hid_t dxpl_id, void *id, hbool_t *id_changed,
@ -131,6 +133,8 @@ H5_DLL herr_t H5HF_stat_info(const H5HF_t *fh, H5HF_stat_t *stats);
H5_DLL herr_t H5HF_size(const H5HF_t *fh, hid_t dxpl_id, hsize_t *heap_size/*out*/);
/* Debugging routines */
H5_DLL herr_t H5HF_id_print(H5HF_t *fh, hid_t dxpl_id,
const void *id, FILE *stream, int indent, int fwidth);
#ifdef H5HF_DEBUGGING
H5_DLL herr_t H5HF_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
FILE *stream, int indent, int fwidth);

View File

@ -454,20 +454,23 @@ H5O_debug_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, haddr_t addr, FILE *stream, i
if(oh->mesg[i].flags) {
hbool_t flag_printed = FALSE;
if(oh->mesg[i].flags & H5O_MSG_FLAG_SHARED) {
HDfprintf(stream, "<S");
flag_printed = TRUE;
} /* end if */
/* Sanity check that all flags in format are covered below */
HDcompile_assert(H5O_MSG_FLAG_BITS == (H5O_MSG_FLAG_CONSTANT|H5O_MSG_FLAG_SHARED|H5O_MSG_FLAG_DONTSHARE|H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE|H5O_MSG_FLAG_MARK_IF_UNKNOWN|H5O_MSG_FLAG_WAS_UNKNOWN|H5O_MSG_FLAG_SHAREABLE|H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS));
if(oh->mesg[i].flags & H5O_MSG_FLAG_CONSTANT) {
HDfprintf(stream, "%sC", (flag_printed ? ", " : "<"));
flag_printed = TRUE;
} /* end if */
if(oh->mesg[i].flags & H5O_MSG_FLAG_SHARED) {
HDfprintf(stream, "%sS", (flag_printed ? ", " : "<"));
flag_printed = TRUE;
} /* end if */
if(oh->mesg[i].flags & H5O_MSG_FLAG_DONTSHARE) {
HDfprintf(stream, "%sDS", (flag_printed ? ", " : "<"));
flag_printed = TRUE;
} /* end if */
if(oh->mesg[i].flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_AND_OPEN_FOR_WRITE) {
HDfprintf(stream, "%sFIU", (flag_printed ? ", " : "<"));
HDfprintf(stream, "%sFIUW", (flag_printed ? ", " : "<"));
flag_printed = TRUE;
} /* end if */
if(oh->mesg[i].flags & H5O_MSG_FLAG_MARK_IF_UNKNOWN) {
@ -479,6 +482,14 @@ H5O_debug_real(H5F_t *f, hid_t dxpl_id, H5O_t *oh, haddr_t addr, FILE *stream, i
HDfprintf(stream, "%sWU", (flag_printed ? ", " : "<"));
flag_printed = TRUE;
} /* end if */
if(oh->mesg[i].flags & H5O_MSG_FLAG_SHAREABLE) {
HDfprintf(stream, "%sSA", (flag_printed ? ", " : "<"));
flag_printed = TRUE;
} /* end if */
if(oh->mesg[i].flags & H5O_MSG_FLAG_FAIL_IF_UNKNOWN_ALWAYS) {
HDfprintf(stream, "%sFIUA", (flag_printed ? ", " : "<"));
flag_printed = TRUE;
} /* end if */
if(!flag_printed)
HDfprintf(stream, "-");
HDfprintf(stream, ">\n");

View File

@ -834,7 +834,7 @@ H5O_link_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const void
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
"Link Name Character Set:", (lnk->cset == H5T_CSET_ASCII ?
"ASCII" : (lnk->cset == H5T_CSET_UTF8 ? "UTF-8" : "Unknown")));
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
HDfprintf(stream, "%*s%-*s '%s'\n", indent, "", fwidth,
"Link Name:", lnk->name);
/* Display link-specific information */
@ -845,7 +845,7 @@ H5O_link_debug(H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id, const void
break;
case H5L_TYPE_SOFT:
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
HDfprintf(stream, "%*s%-*s '%s'\n", indent, "", fwidth,
"Link Value:", lnk->u.soft.name);
break;

View File

@ -2580,14 +2580,15 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
H5SM_list_debug(H5F_t *f, hid_t dxpl_id, haddr_t list_addr,
FILE *stream, int indent, int fwidth,
unsigned table_vers, size_t num_messages)
H5SM_list_debug(H5F_t *f, hid_t dxpl_id, haddr_t list_addr, FILE *stream,
int indent, int fwidth, haddr_t table_addr)
{
H5SM_master_table_t *table = NULL; /* SOHM master table */
H5SM_list_t *list = NULL; /* SOHM index list for message type (if in list form) */
H5SM_index_header_t header; /* A "false" header used to read the list */
H5SM_list_cache_ud_t cache_udata; /* User-data for metadata cache callback */
H5SM_list_cache_ud_t lst_cache_udata; /* List user-data for metadata cache callback */
H5SM_table_cache_ud_t tbl_cache_udata; /* Table user-data for metadata cache callback */
H5HF_t *fh = NULL; /* Fractal heap for SOHM messages */
unsigned index_num; /* Index of list, within master table */
unsigned x; /* Counter variable */
herr_t ret_value = SUCCEED; /* Return value */
@ -2599,36 +2600,51 @@ H5SM_list_debug(H5F_t *f, hid_t dxpl_id, haddr_t list_addr,
HDassert(indent >= 0);
HDassert(fwidth >= 0);
/* Check arguments. Version must be 0, the only version implemented so far */
if(table_vers > H5SM_LIST_VERSION)
HGOTO_ERROR(H5E_SOHM, H5E_BADVALUE, FAIL, "unknown shared message list version")
if(num_messages == 0 || num_messages > H5O_SHMESG_MAX_LIST_SIZE)
HGOTO_ERROR(H5E_SOHM, H5E_BADVALUE, FAIL, "number of indexes must be between 1 and H5O_SHMESG_MAX_NINDEXES")
/* Set up user data for callback */
tbl_cache_udata.f = f;
/* Create a temporary header using the arguments. The cache needs this to load the list. */
HDmemset(&header, 0, sizeof(H5SM_index_header_t));
header.list_max = header.num_messages = num_messages;
header.index_type = H5SM_LIST;
header.index_addr = list_addr;
/* Look up the master SOHM table */
if(NULL == (table = (H5SM_master_table_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_TABLE, table_addr, &tbl_cache_udata, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM master table")
/* Determine which index the list is part of */
index_num = table->num_indexes;
for(x = 0; x < table->num_indexes; x++) {
if(H5F_addr_eq(table->indexes[x].index_addr, list_addr)) {
index_num = x;
break;
} /* end if */
} /* end for */
if(x == table->num_indexes)
HGOTO_ERROR(H5E_SOHM, H5E_BADVALUE, FAIL, "list address doesn't match address for any indices in table")
/* Set up user data for metadata cache callback */
cache_udata.f = f;
cache_udata.header = &header;
lst_cache_udata.f = f;
lst_cache_udata.header = &(table->indexes[index_num]);
/* Get the list from the cache */
if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, list_addr, &cache_udata, H5AC__READ_ONLY_FLAG)))
if(NULL == (list = (H5SM_list_t *)H5AC_protect(f, dxpl_id, H5AC_SOHM_LIST, list_addr, &lst_cache_udata, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTPROTECT, FAIL, "unable to load SOHM index")
/* Open the heap, if one exists */
if(H5F_addr_defined(table->indexes[index_num].heap_addr))
if(NULL == (fh = H5HF_open(f, dxpl_id, table->indexes[index_num].heap_addr)))
HGOTO_ERROR(H5E_SOHM, H5E_CANTOPENOBJ, FAIL, "unable to open SOHM heap")
HDfprintf(stream, "%*sShared Message List Index...\n", indent, "");
for(x = 0; x < num_messages; ++x) {
for(x = 0; x < table->indexes[index_num].num_messages; ++x) {
HDfprintf(stream, "%*sShared Object Header Message %d...\n", indent, "", x);
HDfprintf(stream, "%*s%-*s %08lu\n", indent + 3, "", fwidth,
"Hash value:", (unsigned long)list->messages[x].hash);
if(list->messages[x].location == H5SM_IN_HEAP) {
HDassert(fh);
HDfprintf(stream, "%*s%-*s %s\n", indent + 3, "", fwidth,
"Location:", "in heap");
HDfprintf(stream, "%*s%-*s %Zu\n", indent + 3, "", fwidth,
HDfprintf(stream, "%*s%-*s 0x%Zx\n", indent + 3, "", fwidth,
"Heap ID:", list->messages[x].u.heap_loc.fheap_id);
H5HF_id_print(fh, dxpl_id,
&(list->messages[x].u.heap_loc.fheap_id), stream, indent + 6, (fwidth - 3));
HDfprintf(stream, "%*s%-*s %u\n", indent + 3, "", fwidth,
"Reference count:", list->messages[x].u.heap_loc.ref_count);
} /* end if */
@ -2648,8 +2664,12 @@ H5SM_list_debug(H5F_t *f, hid_t dxpl_id, haddr_t list_addr,
} /* end for */
done:
if(fh && H5HF_close(fh, dxpl_id) < 0)
HDONE_ERROR(H5E_SOHM, H5E_CANTCLOSEOBJ, FAIL, "unable to close SOHM heap")
if(list && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_LIST, list_addr, list, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM index")
if(table && H5AC_unprotect(f, dxpl_id, H5AC_SOHM_TABLE, table_addr, table, H5AC__NO_FLAGS_SET) < 0)
HDONE_ERROR(H5E_SOHM, H5E_CANTUNPROTECT, FAIL, "unable to close SOHM master table")
FUNC_LEAVE_NOAPI_TAG(ret_value, FAIL)
} /* end H5SM_list_debug() */

View File

@ -48,9 +48,8 @@
static void *H5SM_bt2_crt_context(void *udata);
static herr_t H5SM_bt2_dst_context(void *ctx);
static herr_t H5SM_bt2_store(void *native, const void *udata);
static herr_t H5SM_bt2_debug(FILE *stream, const H5F_t *f, hid_t dxpl_id,
int indent, int fwidth, const void *record, const void *_udata);
static void *H5SM_bt2_crt_dbg_context(H5F_t *f, hid_t dxpl_id, haddr_t addr);
static herr_t H5SM_bt2_debug(FILE *stream, int indent, int fwidth,
const void *record);
/*****************************/
@ -67,9 +66,7 @@ const H5B2_class_t H5SM_INDEX[1]={{ /* B-tree class information */
H5SM_message_compare, /* Record comparison callback */
H5SM_message_encode, /* Record encoding callback */
H5SM_message_decode, /* Record decoding callback */
H5SM_bt2_debug, /* Record debugging callback */
H5SM_bt2_crt_dbg_context, /* Create debugging context */
H5SM_bt2_dst_context /* Destroy debugging context */
H5SM_bt2_debug /* Record debugging callback */
}};
@ -195,8 +192,7 @@ H5SM_bt2_store(void *native, const void *udata)
*-------------------------------------------------------------------------
*/
static herr_t
H5SM_bt2_debug(FILE *stream, const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED dxpl_id,
int indent, int fwidth, const void *record, const void H5_ATTR_UNUSED *_udata)
H5SM_bt2_debug(FILE *stream, int indent, int fwidth, const void *record)
{
const H5SM_sohm_t *sohm = (const H5SM_sohm_t *)record;
@ -216,45 +212,6 @@ H5SM_bt2_debug(FILE *stream, const H5F_t H5_ATTR_UNUSED *f, hid_t H5_ATTR_UNUSED
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5SM_bt2_debug */
/*-------------------------------------------------------------------------
* Function: H5SM_bt2_crt_dbg_context
*
* Purpose: Create context for debugging callback
*
* Return: Success: non-NULL
* Failure: NULL
*
* Programmer: Quincey Koziol
* Tuesday, December 1, 2009
*
*-------------------------------------------------------------------------
*/
static void *
H5SM_bt2_crt_dbg_context(H5F_t *f, hid_t H5_ATTR_UNUSED dxpl_id, haddr_t H5_ATTR_UNUSED addr)
{
H5SM_bt2_ctx_t *ctx; /* Callback context structure */
void *ret_value; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity check */
HDassert(f);
/* Allocate callback context */
if(NULL == (ctx = H5FL_MALLOC(H5SM_bt2_ctx_t)))
HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate callback context")
/* Determine the size of addresses & lengths in the file */
ctx->sizeof_addr = H5F_SIZEOF_ADDR(f);
/* Set return value */
ret_value = ctx;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5SM_bt2_crt_dbg_context() */
/*-------------------------------------------------------------------------
* Function: H5SM_bt2_convert_to_list_op

View File

@ -74,7 +74,7 @@ H5_DLL herr_t H5SM_table_debug(H5F_t *f, hid_t dxpl_id, haddr_t table_addr,
FILE *stream, int indent, int fwidth, unsigned table_vers,
unsigned num_indexes);
H5_DLL herr_t H5SM_list_debug(H5F_t *f, hid_t dxpl_id, haddr_t list_addr,
FILE *stream, int indent, int fwidth, unsigned list_vers, size_t num_messages);
FILE *stream, int indent, int fwidth, haddr_t table_addr);
#endif /*_H5SMprivate_H*/

View File

@ -355,11 +355,11 @@ main(int argc, char *argv[])
/* Build array of chunk dimensions */
ndims = (unsigned)extra;
dim[0] = extra2;
dim[0] = (uint32_t)extra2;
if(ndims > 1)
dim[1] = extra3;
dim[1] = (uint32_t)extra3;
if(ndims > 2)
dim[2] = extra4;
dim[2] = (uint32_t)extra4;
/* Check for dimension error */
if(ndims > 3) {
@ -502,14 +502,14 @@ main(int argc, char *argv[])
*/
/* Check for enough valid parameters */
if(extra2 == 0) {
HDfprintf(stderr, "ERROR: Need list format version and number of messages in order to shared message list\n");
if(extra == 0) {
HDfprintf(stderr, "ERROR: Need shared message header address in order to shared message list\n");
HDfprintf(stderr, "Shared message list usage:\n");
HDfprintf(stderr, "\th5debug <filename> <shared message list address> <list format version> <number of mesages in list>\n");
HDfprintf(stderr, "\th5debug <filename> <shared message list address> <shared message header address>\n");
HDexit(4);
} /* end if */
status = H5SM_list_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, (unsigned) extra, (size_t) extra2);
status = H5SM_list_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, (haddr_t)extra);
} else if(!HDmemcmp(sig, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*