summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-08-31 19:34:39 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-08-31 19:34:39 (GMT)
commitb8d1216dcac1b773f9a7f757ee4dca67547dc082 (patch)
treee9548723856027a225796d4c309b7fd70ad449d3
parentcf4e0ca807fedf1d1ce43acfc9660aa4a2f1d768 (diff)
downloadhdf5-b8d1216dcac1b773f9a7f757ee4dca67547dc082.zip
hdf5-b8d1216dcac1b773f9a7f757ee4dca67547dc082.tar.gz
hdf5-b8d1216dcac1b773f9a7f757ee4dca67547dc082.tar.bz2
[svn-r19324] Description:
Bring recent tweaks to extensible and fixed array file formats from revise_chunks branch back to trunk. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, w/threadsafe, in production mode Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode Mac OS X/32 10.6.4 (amazon) in debug mode Mac OS X/32 10.6.4 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode Mac OS X/32 10.6.4 (amazon) w/parallel, in debug mode
-rw-r--r--src/H5EA.c2
-rw-r--r--src/H5EAcache.c42
-rw-r--r--src/H5EAdbg.c78
-rw-r--r--src/H5EApkg.h15
-rw-r--r--src/H5EAprivate.h3
-rw-r--r--src/H5EAtest.c77
-rw-r--r--src/H5FA.c2
-rw-r--r--src/H5FAcache.c14
-rw-r--r--src/H5FApkg.h14
-rw-r--r--tools/misc/h5debug.c47
10 files changed, 194 insertions, 100 deletions
diff --git a/src/H5EA.c b/src/H5EA.c
index bc2c2fd..1679f89 100644
--- a/src/H5EA.c
+++ b/src/H5EA.c
@@ -84,8 +84,6 @@ typedef herr_t (*H5EA__unprotect_func_t)(void *thing, hid_t dxpl_id,
/* Remember to add client ID to H5EA_cls_id_t in H5EAprivate.h when adding a new
* client class..
*/
-extern const H5EA_class_t H5EA_CLS_TEST[1];
-
const H5EA_class_t *const H5EA_client_class_g[] = {
H5EA_CLS_TEST, /* ? - H5EA_CLS_TEST_ID */
};
diff --git a/src/H5EAcache.c b/src/H5EAcache.c
index 36d1875..a178536 100644
--- a/src/H5EAcache.c
+++ b/src/H5EAcache.c
@@ -617,15 +617,15 @@ H5EA__cache_iblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata))
if(*p++ != H5EA_IBLOCK_VERSION)
H5E_THROW(H5E_VERSION, "wrong extensible array index block version")
+ /* Extensible array type */
+ if(*p++ != (uint8_t)hdr->cparam.cls->id)
+ H5E_THROW(H5E_BADTYPE, "incorrect extensible array class")
+
/* Address of header for array that owns this block (just for file integrity checks) */
H5F_addr_decode(f, &p, &arr_addr);
if(H5F_addr_ne(arr_addr, hdr->addr))
H5E_THROW(H5E_BADVALUE, "wrong extensible array header address")
- /* Extensible array type */
- if(*p++ != (uint8_t)hdr->cparam.cls->id)
- H5E_THROW(H5E_BADTYPE, "incorrect extensible array class")
-
/* Internal information */
/* Decode elements in index block */
@@ -744,12 +744,12 @@ H5EA__cache_iblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
/* Version # */
*p++ = H5EA_IBLOCK_VERSION;
- /* Address of array header for array which owns this block */
- H5F_addr_encode(f, &p, iblock->hdr->addr);
-
/* Extensible array type */
*p++ = iblock->hdr->cparam.cls->id;
+ /* Address of array header for array which owns this block */
+ H5F_addr_encode(f, &p, iblock->hdr->addr);
+
/* Internal information */
/* Encode elements in index block */
@@ -1033,6 +1033,10 @@ H5EA__cache_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata))
if(*p++ != H5EA_SBLOCK_VERSION)
H5E_THROW(H5E_VERSION, "wrong extensible array super block version")
+ /* Extensible array type */
+ if(*p++ != (uint8_t)udata->hdr->cparam.cls->id)
+ H5E_THROW(H5E_BADTYPE, "incorrect extensible array class")
+
/* Address of header for array that owns this block (just for file integrity checks) */
H5F_addr_decode(f, &p, &arr_addr);
if(H5F_addr_ne(arr_addr, udata->hdr->addr))
@@ -1041,10 +1045,6 @@ H5EA__cache_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata))
/* Offset of block within the array's address space */
UINT64DECODE_VAR(p, sblock->block_off, udata->hdr->arr_off_size);
- /* Extensible array type */
- if(*p++ != (uint8_t)udata->hdr->cparam.cls->id)
- H5E_THROW(H5E_BADTYPE, "incorrect extensible array class")
-
/* Internal information */
/* Check for 'page init' bitmasks for this super block */
@@ -1151,15 +1151,15 @@ H5EA__cache_sblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
/* Version # */
*p++ = H5EA_SBLOCK_VERSION;
+ /* Extensible array type */
+ *p++ = sblock->hdr->cparam.cls->id;
+
/* Address of array header for array which owns this block */
H5F_addr_encode(f, &p, sblock->hdr->addr);
/* Offset of block in array */
UINT64ENCODE_VAR(p, sblock->block_off, sblock->hdr->arr_off_size);
- /* Extensible array type */
- *p++ = sblock->hdr->cparam.cls->id;
-
/* Internal information */
/* Check for 'page init' bitmasks for this super block */
@@ -1431,6 +1431,10 @@ H5EA__cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata))
if(*p++ != H5EA_DBLOCK_VERSION)
H5E_THROW(H5E_VERSION, "wrong extensible array data block version")
+ /* Extensible array type */
+ if(*p++ != (uint8_t)udata->hdr->cparam.cls->id)
+ H5E_THROW(H5E_BADTYPE, "incorrect extensible array class")
+
/* Address of header for array that owns this block (just for file integrity checks) */
H5F_addr_decode(f, &p, &arr_addr);
if(H5F_addr_ne(arr_addr, udata->hdr->addr))
@@ -1439,10 +1443,6 @@ H5EA__cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata))
/* Offset of block within the array's address space */
UINT64DECODE_VAR(p, dblock->block_off, udata->hdr->arr_off_size);
- /* Extensible array type */
- if(*p++ != (uint8_t)udata->hdr->cparam.cls->id)
- H5E_THROW(H5E_BADTYPE, "incorrect extensible array class")
-
/* Internal information */
/* Only decode elements if the data block is not paged */
@@ -1547,15 +1547,15 @@ H5EA__cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
/* Version # */
*p++ = H5EA_DBLOCK_VERSION;
+ /* Extensible array type */
+ *p++ = dblock->hdr->cparam.cls->id;
+
/* Address of array header for array which owns this block */
H5F_addr_encode(f, &p, dblock->hdr->addr);
/* Offset of block in array */
UINT64ENCODE_VAR(p, dblock->block_off, dblock->hdr->arr_off_size);
- /* Extensible array type */
- *p++ = dblock->hdr->cparam.cls->id;
-
/* Internal information */
/* Only encode elements if the data block is not paged */
diff --git a/src/H5EAdbg.c b/src/H5EAdbg.c
index 1851bd8..b9a5bad 100644
--- a/src/H5EAdbg.c
+++ b/src/H5EAdbg.c
@@ -96,21 +96,30 @@
BEGIN_FUNC(PKG, ERR,
herr_t, SUCCEED, FAIL,
H5EA__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
- int fwidth, const H5EA_class_t *cls))
+ int fwidth, const H5EA_class_t *cls, haddr_t obj_addr))
/* Local variables */
- H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */
+ H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */
+ void *dbg_ctx = NULL; /* Extensible array debugging context */
/* Check arguments */
HDassert(f);
HDassert(H5F_addr_defined(addr));
+ HDassert(H5F_addr_defined(obj_addr));
HDassert(stream);
HDassert(indent >= 0);
HDassert(fwidth >= 0);
HDassert(cls);
+ /* Check for debugging context callback available */
+ if(cls->crt_dbg_ctx) {
+ /* Create debugging context */
+ if(NULL == (dbg_ctx = cls->crt_dbg_ctx(f, dxpl_id, obj_addr)))
+ H5E_THROW(H5E_CANTGET, "unable to create fixed array debugging context")
+ } /* end if */
+
/* Load the extensible array header */
- if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, addr, NULL, H5AC_READ)))
+ if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, addr, dbg_ctx, H5AC_READ)))
H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header")
/* Print opening message */
@@ -118,9 +127,7 @@ H5EA__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
/* Print the values */
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Array class ID:",
- (hdr->cparam.cls->id == H5EA_CLS_TEST_ID ? "H5EA_CLS_TEST_ID" :
- "Unknown!"));
+ "Array class ID:", hdr->cparam.cls->name);
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"Header size:",
hdr->size);
@@ -162,6 +169,8 @@ H5EA__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
hdr->idx_blk_addr);
CATCH
+ if(dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
+ H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context")
if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_EARRAY_HDR, addr, hdr, H5AC__NO_FLAGS_SET) < 0)
H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header")
@@ -184,11 +193,12 @@ END_FUNC(PKG) /* end H5EA__hdr_debug() */
BEGIN_FUNC(PKG, ERR,
herr_t, SUCCEED, FAIL,
H5EA__iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE *stream, int indent,
- int fwidth, const H5EA_class_t *cls, haddr_t hdr_addr))
+ int fwidth, const H5EA_class_t *cls, haddr_t hdr_addr, haddr_t obj_addr))
/* Local variables */
H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */
H5EA_iblock_t *iblock = NULL; /* Extensible array index block */
+ void *dbg_ctx = NULL; /* Extensible array context */
/* Check arguments */
HDassert(f);
@@ -198,9 +208,17 @@ H5EA__iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE *stream, i
HDassert(fwidth >= 0);
HDassert(cls);
HDassert(H5F_addr_defined(hdr_addr));
+ HDassert(H5F_addr_defined(obj_addr));
+
+ /* Check for debugging context callback available */
+ if(cls->crt_dbg_ctx) {
+ /* Create debugging context */
+ if(NULL == (dbg_ctx = cls->crt_dbg_ctx(f, dxpl_id, obj_addr)))
+ H5E_THROW(H5E_CANTGET, "unable to create extensible array debugging context")
+ } /* end if */
/* Load the extensible array header */
- if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, hdr_addr, NULL, H5AC_READ)))
+ if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, hdr_addr, dbg_ctx, H5AC_READ)))
H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header")
/* Sanity check */
@@ -215,9 +233,7 @@ H5EA__iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE *stream, i
/* Print the values */
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Array class ID:",
- (hdr->cparam.cls->id == H5EA_CLS_TEST_ID ? "H5EA_CLS_TEST_ID" :
- "Unknown!"));
+ "Array class ID:", hdr->cparam.cls->name);
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"Index Block size:",
iblock->size);
@@ -276,6 +292,8 @@ H5EA__iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE *stream, i
} /* end if */
CATCH
+ if(dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
+ H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context")
if(iblock && H5EA__iblock_unprotect(iblock, dxpl_id, H5AC__NO_FLAGS_SET) < 0)
H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array index block")
if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_EARRAY_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0)
@@ -300,11 +318,12 @@ END_FUNC(PKG) /* end H5EA__iblock_debug() */
BEGIN_FUNC(PKG, ERR,
herr_t, SUCCEED, FAIL,
H5EA__sblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
- int fwidth, const H5EA_class_t *cls, haddr_t hdr_addr, unsigned sblk_idx))
+ int fwidth, const H5EA_class_t *cls, haddr_t hdr_addr, unsigned sblk_idx, haddr_t obj_addr))
/* Local variables */
H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */
H5EA_sblock_t *sblock = NULL; /* Extensible array super block */
+ void *dbg_ctx = NULL; /* Extensible array context */
/* Check arguments */
HDassert(f);
@@ -314,9 +333,17 @@ H5EA__sblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde
HDassert(fwidth >= 0);
HDassert(cls);
HDassert(H5F_addr_defined(hdr_addr));
+ HDassert(H5F_addr_defined(obj_addr));
+
+ /* Check for debugging context callback available */
+ if(cls->crt_dbg_ctx) {
+ /* Create debugging context */
+ if(NULL == (dbg_ctx = cls->crt_dbg_ctx(f, dxpl_id, obj_addr)))
+ H5E_THROW(H5E_CANTGET, "unable to create extensible array debugging context")
+ } /* end if */
/* Load the extensible array header */
- if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, hdr_addr, NULL, H5AC_READ)))
+ if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, hdr_addr, dbg_ctx, H5AC_READ)))
H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header")
/* Protect super block */
@@ -329,9 +356,7 @@ H5EA__sblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde
/* Print the values */
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Array class ID:",
- (hdr->cparam.cls->id == H5EA_CLS_TEST_ID ? "H5EA_CLS_TEST_ID" :
- "Unknown!"));
+ "Array class ID:", hdr->cparam.cls->name);
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"Super Block size:",
sblock->size);
@@ -359,6 +384,8 @@ H5EA__sblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde
} /* end if */
CATCH
+ if(dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
+ H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context")
if(sblock && H5EA__sblock_unprotect(sblock, dxpl_id, H5AC__NO_FLAGS_SET) < 0)
H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array super block")
if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_EARRAY_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0)
@@ -383,11 +410,12 @@ END_FUNC(PKG) /* end H5EA__sblock_debug() */
BEGIN_FUNC(PKG, ERR,
herr_t, SUCCEED, FAIL,
H5EA__dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent,
- int fwidth, const H5EA_class_t *cls, haddr_t hdr_addr, size_t dblk_nelmts))
+ int fwidth, const H5EA_class_t *cls, haddr_t hdr_addr, size_t dblk_nelmts, haddr_t obj_addr))
/* Local variables */
H5EA_hdr_t *hdr = NULL; /* Shared extensible array header */
H5EA_dblock_t *dblock = NULL; /* Extensible array data block */
+ void *dbg_ctx = NULL; /* Extensible array context */
size_t u; /* Local index variable */
/* Check arguments */
@@ -398,10 +426,18 @@ H5EA__dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde
HDassert(fwidth >= 0);
HDassert(cls);
HDassert(H5F_addr_defined(hdr_addr));
+ HDassert(H5F_addr_defined(obj_addr));
HDassert(dblk_nelmts > 0);
+ /* Check for debugging context callback available */
+ if(cls->crt_dbg_ctx) {
+ /* Create debugging context */
+ if(NULL == (dbg_ctx = cls->crt_dbg_ctx(f, dxpl_id, obj_addr)))
+ H5E_THROW(H5E_CANTGET, "unable to create extensible array debugging context")
+ } /* end if */
+
/* Load the extensible array header */
- if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, hdr_addr, NULL, H5AC_READ)))
+ if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, hdr_addr, dbg_ctx, H5AC_READ)))
H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header")
/* Protect data block */
@@ -414,9 +450,7 @@ H5EA__dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde
/* Print the values */
HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Array class ID:",
- (hdr->cparam.cls->id == H5EA_CLS_TEST_ID ? "H5EA_CLS_TEST_ID" :
- "Unknown!"));
+ "Array class ID:", hdr->cparam.cls->name);
HDfprintf(stream, "%*s%-*s %Zu\n", indent, "", fwidth,
"Data Block size:",
dblock->size);
@@ -433,6 +467,8 @@ H5EA__dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int inde
} /* end for */
CATCH
+ if(dbg_ctx && cls->dst_dbg_ctx(dbg_ctx) < 0)
+ H5E_THROW(H5E_CANTRELEASE, "unable to release extensible array debugging context")
if(dblock && H5EA__dblock_unprotect(dblock, dxpl_id, H5AC__NO_FLAGS_SET) < 0)
H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array data block")
if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_EARRAY_HDR, hdr_addr, hdr, H5AC__NO_FLAGS_SET) < 0)
diff --git a/src/H5EApkg.h b/src/H5EApkg.h
index f0cb080..af560b5 100644
--- a/src/H5EApkg.h
+++ b/src/H5EApkg.h
@@ -61,6 +61,7 @@
#define H5EA_METADATA_PREFIX_SIZE(c) ( \
H5_SIZEOF_MAGIC /* Signature */ \
+ 1 /* Version */ \
+ + 1 /* Array type */ \
+ ((c) ? H5EA_SIZEOF_CHKSUM : 0) /* Metadata checksum */ \
)
@@ -70,7 +71,6 @@
H5EA_METADATA_PREFIX_SIZE(TRUE) \
\
/* General array information */ \
- + 1 /* Array type */ \
+ 1 /* Element Size */ \
+ 1 /* Max. # of elements bits */ \
+ 1 /* # of elements to store in index block */ \
@@ -96,7 +96,6 @@
H5EA_METADATA_PREFIX_SIZE(TRUE) \
\
/* Sanity-checking fields */ \
- + 1 /* Array type */ \
+ (i)->hdr->sizeof_addr /* File address of array owning the block */ \
\
/* Extensible Array Index Block specific fields */ \
@@ -111,7 +110,6 @@
H5EA_METADATA_PREFIX_SIZE(TRUE) \
\
/* Sanity-checking fields */ \
- + 1 /* Array type */ \
+ (s)->hdr->sizeof_addr /* File address of array owning the block */ \
+ (s)->hdr->arr_off_size /* Offset of the block in the array */ \
\
@@ -126,7 +124,6 @@
H5EA_METADATA_PREFIX_SIZE(TRUE) \
\
/* Sanity-checking fields */ \
- + 1 /* Array type */ \
+ (d)->hdr->sizeof_addr /* File address of array owning the block */ \
+ (d)->hdr->arr_off_size /* Offset of the block in the array */ \
)
@@ -352,9 +349,7 @@ H5_DLLVAR const H5AC_class_t H5AC_EARRAY_DBLOCK[1];
H5_DLLVAR const H5AC_class_t H5AC_EARRAY_DBLK_PAGE[1];
/* Internal extensible array testing class */
-#ifdef H5EA_TESTING
H5_DLLVAR const H5EA_class_t H5EA_CLS_TEST[1];
-#endif /* H5EA_TESTING */
/* Array of extensible array client ID -> client class mappings */
extern const H5EA_class_t *const H5EA_client_class_g[H5EA_NUM_CLS_ID];
@@ -435,16 +430,16 @@ H5_DLL herr_t H5EA__dblk_page_dest(H5EA_dblk_page_t *dblk_page);
/* Debugging routines for dumping file structures */
H5_DLL herr_t H5EA__hdr_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- FILE *stream, int indent, int fwidth, const H5EA_class_t *cls);
+ FILE *stream, int indent, int fwidth, const H5EA_class_t *cls, haddr_t obj_addr);
H5_DLL herr_t H5EA__iblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
FILE *stream, int indent, int fwidth, const H5EA_class_t *cls,
- haddr_t hdr_addr);
+ haddr_t hdr_addr, haddr_t obj_addr);
H5_DLL herr_t H5EA__sblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
FILE *stream, int indent, int fwidth, const H5EA_class_t *cls,
- haddr_t hdr_addr, unsigned sblk_idx);
+ haddr_t hdr_addr, unsigned sblk_idx, haddr_t obj_addr);
H5_DLL herr_t H5EA__dblock_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
FILE *stream, int indent, int fwidth, const H5EA_class_t *cls,
- haddr_t hdr_addr, size_t dblk_nelmts);
+ haddr_t hdr_addr, size_t dblk_nelmts, haddr_t obj_addr);
/* Testing routines */
#ifdef H5EA_TESTING
diff --git a/src/H5EAprivate.h b/src/H5EAprivate.h
index db61dee..6ce3062 100644
--- a/src/H5EAprivate.h
+++ b/src/H5EAprivate.h
@@ -61,6 +61,7 @@ typedef enum H5EA_cls_id_t {
*/
typedef struct H5EA_class_t {
H5EA_cls_id_t id; /* ID of Extensible Array class, as found in file */
+ const char *name; /* Name of class (for debugging) */
size_t nat_elmt_size; /* Size of native (memory) element */
/* Extensible array client callback methods */
@@ -70,6 +71,8 @@ typedef struct H5EA_class_t {
herr_t (*encode)(void *raw, const void *elmt, size_t nelmts, void *ctx); /* Encode elements from native form to disk storage form */
herr_t (*decode)(const void *raw, void *elmt, size_t nelmts, void *ctx); /* Decode elements from disk storage form to native form */
herr_t (*debug)(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt); /* Print an element for debugging */
+ 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 */
} H5EA_class_t;
/* Extensible array creation parameters */
diff --git a/src/H5EAtest.c b/src/H5EAtest.c
index 87f9195..1b5e100 100644
--- a/src/H5EAtest.c
+++ b/src/H5EAtest.c
@@ -75,13 +75,11 @@ typedef struct H5EA__test_ctx_t {
static void *H5EA__test_crt_context(void *udata);
static herr_t H5EA__test_dst_context(void *ctx);
static herr_t H5EA__test_fill(void *nat_blk, size_t nelmts);
-static herr_t H5EA__test_encode(void *raw, const void *elmt, size_t nelmts,
- void *ctx);
-static herr_t H5EA__test_decode(const void *raw, void *elmt, size_t nelmts,
- void *ctx);
-static herr_t H5EA__test_debug(FILE *stream, int indent, int fwidth,
- hsize_t idx, const void *elmt);
-
+static herr_t H5EA__test_encode(void *raw, const void *elmt, size_t nelmts, void *ctx);
+static herr_t H5EA__test_decode(const void *raw, void *elmt, size_t nelmts, void *ctx);
+static herr_t H5EA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *elmt);
+static void *H5EA__test_crt_dbg_context(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, haddr_t UNUSED obj_addr);
+static herr_t H5EA__test_dst_dbg_context(void *_ctx);
/*********************/
/* Package Variables */
@@ -90,13 +88,16 @@ static herr_t H5EA__test_debug(FILE *stream, int indent, int fwidth,
/* Extensible array testing class information */
const H5EA_class_t H5EA_CLS_TEST[1]={{
H5EA_CLS_TEST_ID, /* Type of Extensible array */
+ "Testing", /* Name of Extensible Array class */
sizeof(uint64_t), /* Size of native element */
H5EA__test_crt_context, /* Create context */
H5EA__test_dst_context, /* Destroy context */
H5EA__test_fill, /* Fill block of missing elements callback */
H5EA__test_encode, /* Element encoding callback */
H5EA__test_decode, /* Element decoding callback */
- H5EA__test_debug /* Element debugging callback */
+ H5EA__test_debug, /* Element debugging callback */
+ H5EA__test_crt_dbg_context, /* Create debugging context */
+ H5EA__test_dst_dbg_context /* Destroy debugging context */
}};
@@ -112,6 +113,9 @@ const H5EA_class_t H5EA_CLS_TEST[1]={{
/* Declare a free list to manage the H5EA__test_ctx_t struct */
H5FL_DEFINE_STATIC(H5EA__test_ctx_t);
+/* Declare a free list to manage the H5EA__ctx_cb_t struct */
+H5FL_DEFINE_STATIC(H5EA__ctx_cb_t);
+
/*-------------------------------------------------------------------------
@@ -338,6 +342,63 @@ H5EA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx,
END_FUNC(STATIC) /* end H5EA__test_debug() */
+/*-------------------------------------------------------------------------
+ * Function: H5EA__test_crt_dbg_context
+ *
+ * Purpose: Create context for debugging callback
+ *
+ * Return: Success: non-NULL
+ * Failure: NULL
+ *
+ * Programmer: Vailin Choi; August 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+BEGIN_FUNC(STATIC, ERR,
+void *, NULL, NULL,
+H5EA__test_crt_dbg_context(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, haddr_t UNUSED obj_addr))
+
+ /* Local variables */
+ H5EA__ctx_cb_t *ctx; /* Context for callbacks */
+
+ /* Allocate new context structure */
+ if(NULL == (ctx = H5FL_MALLOC(H5EA__ctx_cb_t)))
+ H5E_THROW(H5E_CANTALLOC, "can't allocate extensible array client callback context")
+
+ /* Set return value */
+ ret_value = ctx;
+
+CATCH
+
+END_FUNC(STATIC) /* end H5EA__test_crt_dbg_context() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5EA__test_dst_dbg_context
+ *
+ * Purpose: Destroy context for callbacks
+ *
+ * Return: Success: non-negative
+ * Failure: negative
+ *
+ * Programmer: Vailin Choi; August 2010
+ *
+ *-------------------------------------------------------------------------
+ */
+BEGIN_FUNC(STATIC, NOERR,
+herr_t, SUCCEED, -,
+H5EA__test_dst_dbg_context(void *_ctx))
+
+ /* Local variables */
+ H5EA__ctx_cb_t *ctx = (H5EA__ctx_cb_t *)_ctx; /* Callback context to destroy */
+
+ HDassert(_ctx);
+
+ /* Release context structure */
+ ctx = H5FL_FREE(H5EA__ctx_cb_t, ctx);
+
+END_FUNC(STATIC) /* end H5EA__test_dst_dbg_context() */
+
/*-------------------------------------------------------------------------
* Function: H5EA_get_cparam_test
diff --git a/src/H5FA.c b/src/H5FA.c
index 039de42..2a602a1 100644
--- a/src/H5FA.c
+++ b/src/H5FA.c
@@ -75,8 +75,6 @@
/* Remember to add client ID to H5FA_cls_id_t in H5FAprivate.h when adding a new
* client class..
*/
-extern const H5FA_class_t H5FA_CLS_TEST[1];
-
const H5FA_class_t *const H5FA_client_class_g[] = {
H5FA_CLS_TEST, /* ? - H5FA_CLS_TEST_ID */
};
diff --git a/src/H5FAcache.c b/src/H5FAcache.c
index 96510b5..14df4c8 100644
--- a/src/H5FAcache.c
+++ b/src/H5FAcache.c
@@ -556,15 +556,15 @@ H5FA__cache_dblock_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, void *_udata))
if(*p++ != H5FA_DBLOCK_VERSION)
H5E_THROW(H5E_VERSION, "wrong fixed array data block version")
+ /* Fixed array type */
+ if(*p++ != (uint8_t)udata->hdr->cparam.cls->id)
+ H5E_THROW(H5E_BADTYPE, "incorrect fixed array class")
+
/* Address of header for array that owns this block (just for file integrity checks) */
H5F_addr_decode(f, &p, &arr_addr);
if(H5F_addr_ne(arr_addr, udata->hdr->addr))
H5E_THROW(H5E_BADVALUE, "wrong fixed array header address")
- /* Fixed array type */
- if(*p++ != (uint8_t)udata->hdr->cparam.cls->id)
- H5E_THROW(H5E_BADTYPE, "incorrect fixed array class")
-
/* Page initialization flags */
if(dblock->npages > 0) {
HDmemcpy(dblock->dblk_page_init, p, dblock->dblk_page_init_size);
@@ -672,12 +672,12 @@ H5FA__cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
/* Version # */
*p++ = H5FA_DBLOCK_VERSION;
- /* Address of array header for array which owns this block */
- H5F_addr_encode(f, &p, dblock->hdr->addr);
-
/* Fixed array type */
*p++ = dblock->hdr->cparam.cls->id;
+ /* Address of array header for array which owns this block */
+ H5F_addr_encode(f, &p, dblock->hdr->addr);
+
/* Page init flags */
if(dblock->npages > 0) {
/* Store the 'page init' bitmasks */
diff --git a/src/H5FApkg.h b/src/H5FApkg.h
index 674c96c..20d30c3 100644
--- a/src/H5FApkg.h
+++ b/src/H5FApkg.h
@@ -65,6 +65,7 @@
#define H5FA_METADATA_PREFIX_SIZE(c) ( \
H5_SIZEOF_MAGIC /* Signature */ \
+ 1 /* Version */ \
+ + 1 /* Array type */ \
+ ((c) ? H5FA_SIZEOF_CHKSUM : 0) /* Metadata checksum */ \
)
@@ -74,7 +75,6 @@
H5FA_METADATA_PREFIX_SIZE(TRUE) \
\
/* General array information */ \
- + 1 /* Array type */ \
+ 1 /* Element Size */ \
+ 1 /* Log2(Max. # of elements in data block page) - i.e. # of bits needed to store max. # of elements in data block page */ \
\
@@ -91,8 +91,7 @@
H5FA_METADATA_PREFIX_SIZE(TRUE) \
\
/* Sanity-checking fields */ \
- + (d)->hdr->sizeof_addr /* File address of Fixed Array header owning the data block */ \
- + 1 /* Array type */ \
+ + (d)->hdr->sizeof_addr /* File address of Fixed Array header owning the data block */ \
\
/* Fixed Array Data Block specific fields */ \
+ (d)->dblk_page_init_size /* Fixed array data block 'page init' bitmasks (can be 0 if no pages) */ \
@@ -223,17 +222,8 @@ H5_DLLVAR const H5AC_class_t H5AC_FARRAY_DBLOCK[1];
/* H5FA data block page inherits cache-like properties from H5AC */
H5_DLLVAR const H5AC_class_t H5AC_FARRAY_DBLK_PAGE[1];
-
-/* The Fixed Array class for dataset chunks w/o filters*/
-H5_DLLVAR const H5FA_class_t H5FA_CLS_CHUNK[1];
-
-/* The Fixed Array class for dataset chunks w/ filters*/
-H5_DLLVAR const H5FA_class_t H5FA_CLS_FILT_CHUNK[1];
-
/* Internal fixed array testing class */
-#ifdef H5FA_TESTING
H5_DLLVAR const H5FA_class_t H5FA_CLS_TEST[1];
-#endif /* H5FA_TESTING */
/* Array of fixed array client ID -> client class mappings */
extern const H5FA_class_t *const H5FA_client_class_g[H5FA_NUM_CLS_ID];
diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c
index b45cfce..5589d51 100644
--- a/tools/misc/h5debug.c
+++ b/tools/misc/h5debug.c
@@ -21,8 +21,6 @@
*
* Purpose: Debugs an existing HDF5 file at a low level.
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
#define H5A_PACKAGE /*suppress error about including H5Apkg */
@@ -259,6 +257,12 @@ main(int argc, char *argv[])
HDexit(2);
} /* end if */
+ /* Ignore metadata tags while using h5debug */
+ if(H5AC_ignore_tags(f) < 0) {
+ fprintf(stderr, "cannot ignore metadata tags\n");
+ HDexit(1);
+ }
+
/*
* Parse command arguments.
*/
@@ -479,7 +483,16 @@ main(int argc, char *argv[])
*/
const H5EA_class_t *cls = get_H5EA_class(sig);
HDassert(cls);
- status = H5EA__hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls);
+
+ /* Check for enough valid parameters */
+ if(extra == 0) {
+ fprintf(stderr, "ERROR: Need object header address containing the layout message in order to dump header\n");
+ fprintf(stderr, "Extensible array header block usage:\n");
+ fprintf(stderr, "\th5debug <filename> <Extensible Array header address> <object header address>\n");
+ HDexit(4);
+ } /* end if */
+
+ status = H5EA__hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra);
} else if(!HDmemcmp(sig, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
@@ -489,14 +502,14 @@ main(int argc, char *argv[])
HDassert(cls);
/* Check for enough valid parameters */
- if(extra == 0) {
- fprintf(stderr, "ERROR: Need extensible array header address in order to dump index block\n");
+ if(extra == 0 || extra2 == 0) {
+ fprintf(stderr, "ERROR: Need extensible array header address and object header address containing the layout message in order to dump index block\n");
fprintf(stderr, "Extensible array index block usage:\n");
- fprintf(stderr, "\th5debug <filename> <index block address> <array header address>\n");
+ fprintf(stderr, "\th5debug <filename> <index block address> <array header address> <object header address\n");
HDexit(4);
} /* end if */
- status = H5EA__iblock_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra);
+ status = H5EA__iblock_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra, extra2);
} else if(!HDmemcmp(sig, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
@@ -506,14 +519,14 @@ main(int argc, char *argv[])
HDassert(cls);
/* Check for enough valid parameters */
- if(extra == 0 || extra2 == 0) {
- fprintf(stderr, "ERROR: Need extensible array header address and super block index in order to dump super block\n");
+ if(extra == 0 || extra2 == 0 || extra3 == 0) {
+ fprintf(stderr, "ERROR: Need extensible array header address, super block index and object header address containing the layout message in order to dump super block\n");
fprintf(stderr, "Extensible array super block usage:\n");
- fprintf(stderr, "\th5debug <filename> <super block address> <array header address> <super block index>\n");
+ fprintf(stderr, "\th5debug <filename> <super block address> <array header address> <super block index> <object header address>\n");
HDexit(4);
} /* end if */
- status = H5EA__sblock_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2);
+ status = H5EA__sblock_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, extra3);
} else if(!HDmemcmp(sig, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
@@ -523,14 +536,14 @@ main(int argc, char *argv[])
HDassert(cls);
/* Check for enough valid parameters */
- if(extra == 0 || extra2 == 0) {
- fprintf(stderr, "ERROR: Need extensible array header address and # of elements in data block in order to dump data block\n");
+ if(extra == 0 || extra2 == 0 || extra3 == 0) {
+ fprintf(stderr, "ERROR: Need extensible array header address, # of elements in data block and object header address containing the layout message in order to dump data block\n");
fprintf(stderr, "Extensible array data block usage:\n");
- fprintf(stderr, "\th5debug <filename> <data block address> <array header address> <# of elements in data block>\n");
+ fprintf(stderr, "\th5debug <filename> <data block address> <array header address> <# of elements in data block> <object header address\n");
HDexit(4);
} /* end if */
- status = H5EA__dblock_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra, (size_t)extra2);
+ status = H5EA__dblock_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra, (size_t)extra2, extra3);
} else if(!HDmemcmp(sig, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
@@ -541,7 +554,7 @@ main(int argc, char *argv[])
/* Check for enough valid parameters */
if(extra == 0) {
- fprintf(stderr, "ERROR: Need object header address containing the layout messagein order to dump header\n");
+ fprintf(stderr, "ERROR: Need object header address containing the layout message in order to dump header\n");
fprintf(stderr, "Fixed array header block usage:\n");
fprintf(stderr, "\th5debug <filename> <Fixed Array header address> <object header address>\n");
HDexit(4);
@@ -564,7 +577,7 @@ main(int argc, char *argv[])
HDexit(4);
} /* end if */
- status = H5FA__dblock_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra, (size_t)extra2);
+ status = H5FA__dblock_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra, extra2);
} else if(!HDmemcmp(sig, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*