summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5B.c2
-rw-r--r--src/H5B2cache.c24
-rw-r--r--src/H5B2pkg.h10
-rw-r--r--src/H5Bcache.c4
-rw-r--r--src/H5Bprivate.h3
-rw-r--r--src/H5FScache.c16
-rw-r--r--src/H5FSpkg.h15
-rw-r--r--src/H5FSprivate.h4
-rw-r--r--src/H5Fprivate.h46
-rw-r--r--src/H5Gnode.c10
-rw-r--r--src/H5Gprivate.h3
-rw-r--r--src/H5HFcache.c24
-rw-r--r--src/H5HFpkg.h12
-rw-r--r--src/H5HG.c10
-rw-r--r--src/H5HGprivate.h6
-rw-r--r--src/H5HL.c8
-rw-r--r--src/H5HLpkg.h2
-rw-r--r--src/H5HLprivate.h3
-rw-r--r--src/H5O.c2
-rw-r--r--src/H5Oalloc.c4
-rw-r--r--src/H5Ocache.c14
-rw-r--r--src/H5Ocopy.c2
-rw-r--r--src/H5Odbg.c2
-rw-r--r--src/H5Opkg.h11
-rw-r--r--src/H5SMcache.c16
-rwxr-xr-xsrc/H5SMpkg.h11
-rw-r--r--tools/misc/h5debug.c269
27 files changed, 229 insertions, 304 deletions
diff --git a/src/H5B.c b/src/H5B.c
index 2d9ca65..c442632 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -119,7 +119,7 @@
/* Local Macros */
/****************/
#define H5B_SIZEOF_HDR(F) \
- (H5B_SIZEOF_MAGIC + /*magic number */ \
+ (H5_SIZEOF_MAGIC + /*magic number */ \
4 + /*type, level, num entries */ \
2*H5F_SIZEOF_ADDR(F)) /*left and right sibling addresses */
#define H5B_NKEY(b,shared,idx) ((b)->native+(shared)->nkey[(idx)])
diff --git a/src/H5B2cache.c b/src/H5B2cache.c
index f6d95ce..1d34eb0 100644
--- a/src/H5B2cache.c
+++ b/src/H5B2cache.c
@@ -188,9 +188,9 @@ H5B2_cache_hdr_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, vo
p = hdr;
/* Magic number */
- if(HDmemcmp(p, H5B2_HDR_MAGIC, (size_t)H5B2_SIZEOF_MAGIC))
+ if(HDmemcmp(p, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree header signature")
- p += H5B2_SIZEOF_MAGIC;
+ p += H5_SIZEOF_MAGIC;
/* Version */
if(*p++ != H5B2_HDR_VERSION)
@@ -307,8 +307,8 @@ H5B2_cache_hdr_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5B
p = hdr;
/* Magic number */
- HDmemcpy(p, H5B2_HDR_MAGIC, (size_t)H5B2_SIZEOF_MAGIC);
- p += H5B2_SIZEOF_MAGIC;
+ HDmemcpy(p, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ p += H5_SIZEOF_MAGIC;
/* Version # */
*p++ = H5B2_HDR_VERSION;
@@ -522,9 +522,9 @@ H5B2_cache_internal_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_uda
p = shared->page;
/* Magic number */
- if(HDmemcmp(p, H5B2_INT_MAGIC, (size_t)H5B2_SIZEOF_MAGIC))
+ if(HDmemcmp(p, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree internal node signature")
- p += H5B2_SIZEOF_MAGIC;
+ p += H5_SIZEOF_MAGIC;
/* Version */
if(*p++ != H5B2_INT_VERSION)
@@ -641,8 +641,8 @@ H5B2_cache_internal_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr
p = shared->page;
/* Magic number */
- HDmemcpy(p, H5B2_INT_MAGIC, (size_t)H5B2_SIZEOF_MAGIC);
- p += H5B2_SIZEOF_MAGIC;
+ HDmemcpy(p, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ p += H5_SIZEOF_MAGIC;
/* Version # */
*p++ = H5B2_INT_VERSION;
@@ -877,9 +877,9 @@ H5B2_cache_leaf_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_nrec, v
p = shared->page;
/* Magic number */
- if(HDmemcmp(p, H5B2_LEAF_MAGIC, (size_t)H5B2_SIZEOF_MAGIC))
+ if(HDmemcmp(p, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree leaf node signature")
- p += H5B2_SIZEOF_MAGIC;
+ p += H5_SIZEOF_MAGIC;
/* Version */
if(*p++ != H5B2_LEAF_VERSION)
@@ -977,8 +977,8 @@ H5B2_cache_leaf_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5
p = shared->page;
/* magic number */
- HDmemcpy(p, H5B2_LEAF_MAGIC, (size_t)H5B2_SIZEOF_MAGIC);
- p += H5B2_SIZEOF_MAGIC;
+ HDmemcpy(p, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ p += H5_SIZEOF_MAGIC;
/* version # */
*p++ = H5B2_LEAF_VERSION;
diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h
index 43fab1f..d05220b 100644
--- a/src/H5B2pkg.h
+++ b/src/H5B2pkg.h
@@ -40,14 +40,6 @@
/* Package Private Macros */
/**************************/
-/* Size of signature information (on disk) */
-#define H5B2_SIZEOF_MAGIC 4
-
-/* B-tree signatures */
-#define H5B2_HDR_MAGIC "BTHD" /* Header */
-#define H5B2_INT_MAGIC "BTIN" /* Internal node */
-#define H5B2_LEAF_MAGIC "BTLF" /* Leaf node */
-
/* Size of storage for number of records per node (on disk) */
#define H5B2_SIZEOF_RECORDS_PER_NODE 2
@@ -67,7 +59,7 @@
/* Format overhead for all v2 B-tree metadata in the file */
#define H5B2_METADATA_PREFIX_SIZE ( \
- H5B2_SIZEOF_MAGIC /* Signature */ \
+ H5_SIZEOF_MAGIC /* Signature */ \
+ 1 /* Version */ \
+ 1 /* Tree type */ \
+ H5B2_SIZEOF_CHKSUM /* Metadata checksum */ \
diff --git a/src/H5Bcache.c b/src/H5Bcache.c
index e19efb4..d3b2a35 100644
--- a/src/H5Bcache.c
+++ b/src/H5Bcache.c
@@ -113,7 +113,7 @@ H5B_serialize(const H5F_t *f, const H5B_t *bt)
p = shared->page;
/* magic number */
- HDmemcpy(p, H5B_MAGIC, (size_t)H5B_SIZEOF_MAGIC);
+ HDmemcpy(p, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC);
p += 4;
/* node type and level */
@@ -202,7 +202,7 @@ H5B_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void *_type, void *udata)
p = shared->page;
/* magic number */
- if (HDmemcmp(p, H5B_MAGIC, (size_t)H5B_SIZEOF_MAGIC))
+ if (HDmemcmp(p, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_BTREE, H5E_CANTLOAD, NULL, "wrong B-tree signature")
p += 4;
diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h
index 18a2c71..dc8648e 100644
--- a/src/H5Bprivate.h
+++ b/src/H5Bprivate.h
@@ -51,8 +51,7 @@
#ifdef NDEBUG
# undef H5B_DEBUG
#endif
-#define H5B_MAGIC "TREE" /*tree node magic number */
-#define H5B_SIZEOF_MAGIC 4 /*size of magic number */
+
/****************************/
/* Library Private Typedefs */
diff --git a/src/H5FScache.c b/src/H5FScache.c
index 0af87d9..edf045a 100644
--- a/src/H5FScache.c
+++ b/src/H5FScache.c
@@ -191,9 +191,9 @@ HDfprintf(stderr, "%s: Load free space header, addr = %a\n", FUNC, addr);
p = hdr;
/* Magic number */
- if(HDmemcmp(p, H5FS_HDR_MAGIC, (size_t)H5FS_SIZEOF_MAGIC))
+ if(HDmemcmp(p, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space header signature")
- p += H5FS_SIZEOF_MAGIC;
+ p += H5_SIZEOF_MAGIC;
/* Version */
if(*p++ != H5FS_HDR_VERSION)
@@ -327,8 +327,8 @@ HDfprintf(stderr, "%s: Flushing free space header, addr = %a, destroy = %u\n", F
p = hdr;
/* Magic number */
- HDmemcpy(p, H5FS_HDR_MAGIC, (size_t)H5FS_SIZEOF_MAGIC);
- p += H5FS_SIZEOF_MAGIC;
+ HDmemcpy(p, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ p += H5_SIZEOF_MAGIC;
/* Version # */
*p++ = H5FS_HDR_VERSION;
@@ -581,9 +581,9 @@ HDfprintf(stderr, "%s: fspace->sect_size = %Hu\n", FUNC, fspace->sect_size);
p = buf;
/* Magic number */
- if(HDmemcmp(p, H5FS_SINFO_MAGIC, (size_t)H5FS_SIZEOF_MAGIC))
+ if(HDmemcmp(p, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_FSPACE, H5E_CANTLOAD, NULL, "wrong free space sections signature")
- p += H5FS_SIZEOF_MAGIC;
+ p += H5_SIZEOF_MAGIC;
/* Version */
if(*p++ != H5FS_SINFO_VERSION)
@@ -890,8 +890,8 @@ HDfprintf(stderr, "%s: Flushing free space header, addr = %a, destroy = %u\n", F
p = buf;
/* Magic number */
- HDmemcpy(p, H5FS_SINFO_MAGIC, (size_t)H5FS_SIZEOF_MAGIC);
- p += H5FS_SIZEOF_MAGIC;
+ HDmemcpy(p, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ p += H5_SIZEOF_MAGIC;
/* Version # */
*p++ = H5FS_SINFO_VERSION;
diff --git a/src/H5FSpkg.h b/src/H5FSpkg.h
index 9119902..9f3409f 100644
--- a/src/H5FSpkg.h
+++ b/src/H5FSpkg.h
@@ -42,19 +42,12 @@
/* Package Private Macros */
/**************************/
-/* Size of signature information (on disk) */
-#define H5FS_SIZEOF_MAGIC 4
-
-/* Free space signatures */
-#define H5FS_HDR_MAGIC "FSHD" /* Header */
-#define H5FS_SINFO_MAGIC "FSSE" /* Serialized sections */
-
/* Size of checksum information (on disk) */
#define H5FS_SIZEOF_CHKSUM 4
/* "Standard" size of prefix information for free space metadata */
#define H5FS_METADATA_PREFIX_SIZE ( \
- H5FS_SIZEOF_MAGIC /* Signature */ \
+ H5_SIZEOF_MAGIC /* Signature */ \
+ 1 /* Version */ \
+ H5FS_SIZEOF_CHKSUM /* Metadata checksum */ \
)
@@ -208,12 +201,6 @@ H5_DLL H5FS_t *H5FS_new(size_t nclasses, const H5FS_section_class_t *classes[],
/* Free space section routines */
H5_DLL H5FS_sinfo_t *H5FS_sinfo_new(H5F_t *f, H5FS_t *fspace);
-/* Debugging routines for dumping file structures */
-H5_DLL herr_t H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- FILE *stream, int indent, int fwidth);
-H5_DLL herr_t H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
- FILE *stream, int indent, int fwidth, haddr_t fs_addr, haddr_t client_addr);
-
/* Metadata cache callbacks */
H5_DLL herr_t H5FS_cache_hdr_dest(H5F_t *f, H5FS_t *hdr);
H5_DLL herr_t H5FS_cache_sinfo_dest(H5F_t *f, H5FS_sinfo_t *sinfo);
diff --git a/src/H5FSprivate.h b/src/H5FSprivate.h
index bf24b8a..ff8ecfd 100644
--- a/src/H5FSprivate.h
+++ b/src/H5FSprivate.h
@@ -175,6 +175,10 @@ H5_DLL herr_t H5FS_sect_change_class(H5F_t *f, hid_t dxpl_id, H5FS_t *fspace,
H5FS_section_info_t *sect, unsigned new_class);
/* Debugging routines for dumping file structures */
+H5_DLL herr_t H5FS_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
+ FILE *stream, int indent, int fwidth);
+H5_DLL herr_t H5FS_sects_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr,
+ FILE *stream, int indent, int fwidth, haddr_t fs_addr, haddr_t client_addr);
H5_DLL herr_t H5FS_sect_debug(const H5FS_t *fspace, const H5FS_section_info_t *sect,
FILE *stream, int indent, int fwidth);
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index f91ad82..b228b9d 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -408,6 +408,52 @@ typedef struct H5F_t H5F_t;
must compensate. -QAK
*/
+/* Macros to define signatures of all objects in the file */
+
+/* Size of signature information (on disk) */
+/* (all on-disk signatures should be this length) */
+#define H5_SIZEOF_MAGIC 4
+
+/* v1 B-tree node signature */
+#define H5B_MAGIC "TREE"
+
+/* v2 B-tree signatures */
+#define H5B2_HDR_MAGIC "BTHD" /* Header */
+#define H5B2_INT_MAGIC "BTIN" /* Internal node */
+#define H5B2_LEAF_MAGIC "BTLF" /* Leaf node */
+
+/* Extensible array signatures */
+#define H5EA_HDR_MAGIC "EAHD" /* Header */
+#define H5EA_IBLOCK_MAGIC "EAIB" /* Index block */
+#define H5EA_DBLOCK_MAGIC "EADB" /* Data block */
+
+/* Free space signatures */
+#define H5FS_HDR_MAGIC "FSHD" /* Header */
+#define H5FS_SINFO_MAGIC "FSSE" /* Serialized sections */
+
+/* Symbol table node signature */
+#define H5G_NODE_MAGIC "SNOD"
+
+/* Fractal heap signatures */
+#define H5HF_HDR_MAGIC "FRHP" /* Header */
+#define H5HF_IBLOCK_MAGIC "FHIB" /* Indirect block */
+#define H5HF_DBLOCK_MAGIC "FHDB" /* Direct block */
+
+/* Global heap signature */
+#define H5HG_MAGIC "GCOL"
+
+/* Local heap signature */
+#define H5HL_MAGIC "HEAP"
+
+/* Object header signatures */
+#define H5O_HDR_MAGIC "OHDR" /* Header */
+#define H5O_CHK_MAGIC "OCHK" /* Continuation chunk */
+
+/* Shared Message signatures */
+#define H5SM_TABLE_MAGIC "SMTB" /* Shared Message Table */
+#define H5SM_LIST_MAGIC "SMLI" /* Shared Message List */
+
+
/* Forward declarations for prototype arguments */
struct H5B_class_t;
struct H5RC_t;
diff --git a/src/H5Gnode.c b/src/H5Gnode.c
index a3239c2..cefed5b 100644
--- a/src/H5Gnode.c
+++ b/src/H5Gnode.c
@@ -66,7 +66,7 @@ typedef struct H5G_node_t {
/* Private macros */
#define H5G_NODE_VERS 1 /*symbol table node version number */
-#define H5G_NODE_SIZEOF_HDR(F) (H5G_NODE_SIZEOF_MAGIC + 4)
+#define H5G_NODE_SIZEOF_HDR(F) (H5_SIZEOF_MAGIC + 4)
/* Size of stack buffer for serialized nodes */
#define H5G_NODE_BUF_SIZE 512
@@ -380,9 +380,9 @@ H5G_node_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *_udata1
p = node;
/* magic */
- if(HDmemcmp(p, H5G_NODE_MAGIC, (size_t)H5G_NODE_SIZEOF_MAGIC))
+ if(HDmemcmp(p, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, NULL, "bad symbol table node signature")
- p += 4;
+ p += H5_SIZEOF_MAGIC;
/* version */
if(H5G_NODE_VERS != *p++)
@@ -559,8 +559,8 @@ H5G_node_serialize(H5F_t *f, H5G_node_t *sym, size_t size, uint8_t *buf)
p = buf;
/* magic number */
- HDmemcpy(p, H5G_NODE_MAGIC, (size_t)H5G_NODE_SIZEOF_MAGIC);
- p += 4;
+ HDmemcpy(p, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ p += H5_SIZEOF_MAGIC;
/* version number */
*p++ = H5G_NODE_VERS;
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index ab6abc1..591be6b 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -43,9 +43,6 @@
# undef H5G_DEBUG
#endif
-#define H5G_NODE_MAGIC "SNOD" /*symbol table node magic number */
-#define H5G_NODE_SIZEOF_MAGIC 4 /*sizeof symbol node magic number */
-
/*
* The disk size for a symbol table entry...
*/
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index 0e31f9d..f057c7c 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -302,9 +302,9 @@ HDfprintf(stderr, "%s: Load heap header, addr = %a\n", FUNC, addr);
p = buf;
/* Magic number */
- if(HDmemcmp(p, H5HF_HDR_MAGIC, (size_t)H5HF_SIZEOF_MAGIC))
+ if(HDmemcmp(p, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "wrong fractal heap header signature")
- p += H5HF_SIZEOF_MAGIC;
+ p += H5_SIZEOF_MAGIC;
/* Version */
if(*p++ != H5HF_HDR_VERSION)
@@ -497,8 +497,8 @@ HDfprintf(stderr, "%s: Flushing heap header, addr = %a, destroy = %u\n", FUNC, a
p = buf;
/* Magic number */
- HDmemcpy(p, H5HF_HDR_MAGIC, (size_t)H5HF_SIZEOF_MAGIC);
- p += H5HF_SIZEOF_MAGIC;
+ HDmemcpy(p, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ p += H5_SIZEOF_MAGIC;
/* Version # */
*p++ = H5HF_HDR_VERSION;
@@ -770,9 +770,9 @@ HDfprintf(stderr, "%s: Load indirect block, addr = %a\n", FUNC, addr);
p = buf;
/* Magic number */
- if(HDmemcmp(p, H5HF_IBLOCK_MAGIC, (size_t)H5HF_SIZEOF_MAGIC))
+ if(HDmemcmp(p, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "wrong fractal heap indirect block signature")
- p += H5HF_SIZEOF_MAGIC;
+ p += H5_SIZEOF_MAGIC;
/* Version */
if(*p++ != H5HF_IBLOCK_VERSION)
@@ -969,8 +969,8 @@ HDfprintf(stderr, "%s: hdr->man_dtable.cparam.width = %u\n", FUNC, hdr->man_dtab
p = buf;
/* Magic number */
- HDmemcpy(p, H5HF_IBLOCK_MAGIC, (size_t)H5HF_SIZEOF_MAGIC);
- p += H5HF_SIZEOF_MAGIC;
+ HDmemcpy(p, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ p += H5_SIZEOF_MAGIC;
/* Version # */
*p++ = H5HF_IBLOCK_VERSION;
@@ -1315,9 +1315,9 @@ HDfprintf(stderr, "%s: nbytes = %Zu, read_size = %Zu, read_buf = %p\n", FUNC, nb
p = dblock->blk;
/* Magic number */
- if(HDmemcmp(p, H5HF_DBLOCK_MAGIC, (size_t)H5HF_SIZEOF_MAGIC))
+ if(HDmemcmp(p, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "wrong fractal heap direct block signature")
- p += H5HF_SIZEOF_MAGIC;
+ p += H5_SIZEOF_MAGIC;
/* Version */
if(*p++ != H5HF_DBLOCK_VERSION)
@@ -1421,8 +1421,8 @@ H5HF_cache_dblock_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr,
p = dblock->blk;
/* Magic number */
- HDmemcpy(p, H5HF_DBLOCK_MAGIC, (size_t)H5HF_SIZEOF_MAGIC);
- p += H5HF_SIZEOF_MAGIC;
+ HDmemcpy(p, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ p += H5_SIZEOF_MAGIC;
/* Version # */
*p++ = H5HF_DBLOCK_VERSION;
diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h
index fd332e5..71691c9 100644
--- a/src/H5HFpkg.h
+++ b/src/H5HFpkg.h
@@ -35,27 +35,19 @@
#include "H5ACprivate.h" /* Metadata cache */
#include "H5B2private.h" /* v2 B-trees */
#include "H5FLprivate.h" /* Free Lists */
-#include "H5FSprivate.h" /* File free space */
+#include "H5FSprivate.h" /* Free space manager */
#include "H5SLprivate.h" /* Skip lists */
/**************************/
/* Package Private Macros */
/**************************/
-/* Size of signature information (on disk) */
-#define H5HF_SIZEOF_MAGIC 4
-
-/* Fractal heap signatures */
-#define H5HF_HDR_MAGIC "FRHP" /* Header */
-#define H5HF_IBLOCK_MAGIC "FHIB" /* Indirect block */
-#define H5HF_DBLOCK_MAGIC "FHDB" /* Direct block */
-
/* Size of checksum information (on disk) */
#define H5HF_SIZEOF_CHKSUM 4
/* "Standard" size of prefix information for fractal heap metadata */
#define H5HF_METADATA_PREFIX_SIZE(c) ( \
- H5HF_SIZEOF_MAGIC /* Signature */ \
+ H5_SIZEOF_MAGIC /* Signature */ \
+ 1 /* Version */ \
+ ((c) ? H5HF_SIZEOF_CHKSUM : 0) /* Metadata checksum */ \
)
diff --git a/src/H5HG.c b/src/H5HG.c
index 26f0ac5..f867147 100644
--- a/src/H5HG.c
+++ b/src/H5HG.c
@@ -226,8 +226,8 @@ HDmemset(heap->chunk, 0, size);
"memory allocation failed");
/* Initialize the header */
- HDmemcpy (heap->chunk, H5HG_MAGIC, (size_t)H5HG_SIZEOF_MAGIC);
- p = heap->chunk + H5HG_SIZEOF_MAGIC;
+ HDmemcpy (heap->chunk, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ p = heap->chunk + H5_SIZEOF_MAGIC;
*p++ = H5HG_VERSION;
*p++ = 0; /*reserved*/
*p++ = 0; /*reserved*/
@@ -343,9 +343,9 @@ H5HG_load (H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * udata1,
HGOTO_ERROR (H5E_HEAP, H5E_READERROR, NULL, "unable to read global heap collection");
/* Magic number */
- if(HDmemcmp(heap->chunk, H5HG_MAGIC, (size_t)H5HG_SIZEOF_MAGIC))
+ if(HDmemcmp(heap->chunk, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC))
HGOTO_ERROR (H5E_HEAP, H5E_CANTLOAD, NULL, "bad global heap collection signature");
- p = heap->chunk + H5HG_SIZEOF_MAGIC;
+ p = heap->chunk + H5_SIZEOF_MAGIC;
/* Version */
if (H5HG_VERSION!=*p++)
@@ -845,7 +845,7 @@ HDmemset(new_chunk + heap->size, 0, need);
heap->size+=need;
/* Encode the new size of the heap */
- p = new_chunk + H5HG_SIZEOF_MAGIC + 1 /* version */ + 3 /* reserved */;
+ p = new_chunk + H5_SIZEOF_MAGIC + 1 /* version */ + 3 /* reserved */;
H5F_ENCODE_LENGTH (f, p, heap->size);
/* Move the pointers to the existing objects to their new locations */
diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h
index 6e2c492..b6cdb4a 100644
--- a/src/H5HGprivate.h
+++ b/src/H5HGprivate.h
@@ -26,12 +26,6 @@
/* Private headers needed by this file. */
#include "H5Fprivate.h" /* File access */
-/*
- * Each collection has a magic number for some redundancy.
- */
-#define H5HG_MAGIC "GCOL"
-#define H5HG_SIZEOF_MAGIC 4
-
/* Information to locate object in global heap */
typedef struct H5HG_t {
haddr_t addr; /*address of collection */
diff --git a/src/H5HL.c b/src/H5HL.c
index a56a885..3b3a740 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -231,9 +231,9 @@ H5HL_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * udata1,
p = hdr;
/* Check magic number */
- if(HDmemcmp(hdr, H5HL_MAGIC, (size_t)H5HL_SIZEOF_MAGIC))
+ if(HDmemcmp(hdr, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_HEAP, H5E_CANTLOAD, NULL, "bad heap signature")
- p += H5HL_SIZEOF_MAGIC;
+ p += H5_SIZEOF_MAGIC;
/* Version */
if(H5HL_VERSION != *p++)
@@ -488,8 +488,8 @@ H5HL_serialize(H5F_t *f, H5HL_t *heap, uint8_t *buf)
/* serialize the header */
p = buf;
fl = heap->freelist;
- HDmemcpy(p, H5HL_MAGIC, (size_t)H5HL_SIZEOF_MAGIC);
- p += H5HL_SIZEOF_MAGIC;
+ HDmemcpy(p, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ p += H5_SIZEOF_MAGIC;
*p++ = H5HL_VERSION;
*p++ = 0; /*reserved*/
*p++ = 0; /*reserved*/
diff --git a/src/H5HLpkg.h b/src/H5HLpkg.h
index fe6f107..48781e3 100644
--- a/src/H5HLpkg.h
+++ b/src/H5HLpkg.h
@@ -45,7 +45,7 @@ H5_DLLVAR const H5AC_class_t H5AC_LHEAP[1];
/**************************/
#define H5HL_SIZEOF_HDR(F) \
- H5HL_ALIGN(H5HL_SIZEOF_MAGIC + /*heap signature */ \
+ H5HL_ALIGN(H5_SIZEOF_MAGIC + /*heap signature */ \
4 + /*reserved */ \
H5F_SIZEOF_SIZE (F) + /*data size */ \
H5F_SIZEOF_SIZE (F) + /*free list head */ \
diff --git a/src/H5HLprivate.h b/src/H5HLprivate.h
index d8a4b49..2a3e2df 100644
--- a/src/H5HLprivate.h
+++ b/src/H5HLprivate.h
@@ -44,9 +44,6 @@
# undef H5HL_DEBUG
#endif
-#define H5HL_MAGIC "HEAP" /*heap magic number */
-#define H5HL_SIZEOF_MAGIC 4
-
#define H5HL_ALIGN(X) (((X)+7)&(unsigned)(~0x07)) /*align on 8-byte boundary */
#define H5HL_SIZEOF_FREE(F) \
diff --git a/src/H5O.c b/src/H5O.c
index bc7a84d..a706f86 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -1163,7 +1163,7 @@ H5O_create(H5F_t *f, hid_t dxpl_id, size_t size_hint, hid_t ocpl_id,
/* Put magic # for object header in first chunk */
if(oh->version > H5O_VERSION_1)
- HDmemcpy(oh->chunk[0].image, H5O_HDR_MAGIC, (size_t)H5O_SIZEOF_MAGIC);
+ HDmemcpy(oh->chunk[0].image, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
/* Create the message list */
oh->nmesgs = 1;
diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c
index 7abc11c..f9e06ad 100644
--- a/src/H5Oalloc.c
+++ b/src/H5Oalloc.c
@@ -837,8 +837,8 @@ H5O_alloc_new_chunk(H5F_t *f,
* # at the beginning of the chunk image.
*/
if(oh->version > H5O_VERSION_1) {
- HDmemcpy(p, H5O_CHK_MAGIC, (size_t)H5O_SIZEOF_MAGIC);
- p += H5O_SIZEOF_MAGIC;
+ HDmemcpy(p, H5O_CHK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ p += H5_SIZEOF_MAGIC;
} /* end if */
/*
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index 7d1f001..35b4e07 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -167,9 +167,9 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
/* Check for magic number */
/* (indicates version 2 or later) */
- if(!HDmemcmp(p, H5O_HDR_MAGIC, (size_t)H5O_SIZEOF_MAGIC)) {
+ if(!HDmemcmp(p, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/* Magic number */
- p += H5O_SIZEOF_MAGIC;
+ p += H5_SIZEOF_MAGIC;
/* Version */
oh->version = *p++;
@@ -349,9 +349,9 @@ H5O_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED * _udata1,
/* Check for magic # on chunks > 0 in later versions of the format */
if(chunkno > 0 && oh->version > H5O_VERSION_1) {
/* Magic number */
- if(HDmemcmp(p, H5O_CHK_MAGIC, (size_t)H5O_SIZEOF_MAGIC))
+ if(HDmemcmp(p, H5O_CHK_MAGIC, (size_t)H5_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "wrong object header chunk signature")
- p += H5O_SIZEOF_MAGIC;
+ p += H5_SIZEOF_MAGIC;
} /* end if */
/* Decode messages from this chunk */
@@ -682,8 +682,8 @@ H5O_assert(oh);
uint64_t chunk0_size = oh->chunk[0].size - H5O_SIZEOF_HDR(oh); /* Size of chunk 0's data */
/* Verify magic number */
- HDassert(!HDmemcmp(p, H5O_HDR_MAGIC, H5O_SIZEOF_MAGIC));
- p += H5O_SIZEOF_MAGIC;
+ HDassert(!HDmemcmp(p, H5O_HDR_MAGIC, H5_SIZEOF_MAGIC));
+ p += H5_SIZEOF_MAGIC;
/* Version */
*p++ = oh->version;
@@ -775,7 +775,7 @@ H5O_assert(oh);
/* Sanity checks */
if(oh->version > H5O_VERSION_1)
/* Make certain the magic # is present */
- HDassert(!HDmemcmp(oh->chunk[u].image, (u == 0 ? H5O_HDR_MAGIC : H5O_CHK_MAGIC), H5O_SIZEOF_MAGIC));
+ HDassert(!HDmemcmp(oh->chunk[u].image, (u == 0 ? H5O_HDR_MAGIC : H5O_CHK_MAGIC), H5_SIZEOF_MAGIC));
else
/* Gaps should never occur in version 1 of the format */
HDassert(oh->chunk[u].gap == 0);
diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c
index 7097b66..9a905d2 100644
--- a/src/H5Ocopy.c
+++ b/src/H5Ocopy.c
@@ -592,7 +592,7 @@ H5O_copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
* header. This will be written when the header is flushed to disk.
*/
if(oh_dst->version > H5O_VERSION_1)
- HDmemcpy(current_pos, H5O_HDR_MAGIC, (size_t)H5O_SIZEOF_MAGIC);
+ HDmemcpy(current_pos, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
current_pos += H5O_SIZEOF_HDR(oh_dst) - H5O_SIZEOF_CHKSUM_OH(oh_dst);
/* Loop through destination messages, updating their "raw" info */
diff --git a/src/H5Odbg.c b/src/H5Odbg.c
index 279f328..7a49f75 100644
--- a/src/H5Odbg.c
+++ b/src/H5Odbg.c
@@ -127,7 +127,7 @@ H5O_assert(const H5O_t *oh)
/* Version specific checks */
if(oh->version > H5O_VERSION_1) {
/* Make certain that the magic number is correct for each chunk */
- HDassert(!HDmemcmp(oh->chunk[u].image, (u == 0 ? H5O_HDR_MAGIC : H5O_CHK_MAGIC), H5O_SIZEOF_MAGIC));
+ HDassert(!HDmemcmp(oh->chunk[u].image, (u == 0 ? H5O_HDR_MAGIC : H5O_CHK_MAGIC), H5_SIZEOF_MAGIC));
/* Check for valid gap size */
HDassert(oh->chunk[u].gap < (size_t)H5O_SIZEOF_MSGHDR_OH(oh));
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index c3737f5..a36ef6f 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -67,13 +67,6 @@
#define H5O_ALIGN_F(F, X) \
H5O_ALIGN_VERS((H5F_USE_LATEST_FORMAT(F) ? H5O_VERSION_LATEST : H5O_VERSION_1), X)
-/* Size of signature information (on disk) */
-#define H5O_SIZEOF_MAGIC 4
-
-/* Object header signatures */
-#define H5O_HDR_MAGIC "OHDR" /* Header */
-#define H5O_CHK_MAGIC "OCHK" /* Continuation chunk */
-
/* Size of checksum (on disk) */
#define H5O_SIZEOF_CHKSUM 4
@@ -106,7 +99,7 @@
4 + /*reference count */ \
4) /*chunk data size */ \
: \
- (H5O_SIZEOF_MAGIC + /*magic number */ \
+ (H5_SIZEOF_MAGIC + /*magic number */ \
1 + /*version number */ \
1 + /*flags */ \
(((O)->flags & H5O_HDR_STORE_TIMES) ? ( \
@@ -155,7 +148,7 @@
0 + /*no magic # */ \
0 /*no checksum */ \
: \
- H5O_SIZEOF_MAGIC + /*magic # */ \
+ H5_SIZEOF_MAGIC + /*magic # */ \
H5O_SIZEOF_CHKSUM /*checksum */ \
)
#define H5O_SIZEOF_CHKHDR_OH(O) \
diff --git a/src/H5SMcache.c b/src/H5SMcache.c
index e4af90e..021b43f 100644
--- a/src/H5SMcache.c
+++ b/src/H5SMcache.c
@@ -165,9 +165,9 @@ H5SM_table_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1
p = buf;
/* Check magic number */
- if(HDmemcmp(p, H5SM_TABLE_MAGIC, (size_t)H5SM_SIZEOF_MAGIC))
+ if(HDmemcmp(p, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "bad SOHM table signature")
- p += H5SM_SIZEOF_MAGIC;
+ p += H5_SIZEOF_MAGIC;
/* Don't count the checksum in the table size yet, since it comes after
* all of the index headers
@@ -290,8 +290,8 @@ H5SM_table_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_ma
p = buf;
/* Encode magic number */
- HDmemcpy(p, H5SM_TABLE_MAGIC, (size_t)H5SM_SIZEOF_MAGIC);
- p += H5SM_SIZEOF_MAGIC;
+ HDmemcpy(p, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ p += H5_SIZEOF_MAGIC;
/* Encode each index header */
for(x = 0; x < table->num_indexes; ++x) {
@@ -504,9 +504,9 @@ H5SM_list_load(H5F_t *f, hid_t dxpl_id, haddr_t addr, const void UNUSED *udata1,
p = buf;
/* Check magic number */
- if(HDmemcmp(p, H5SM_LIST_MAGIC, (size_t)H5SM_SIZEOF_MAGIC))
+ if(HDmemcmp(p, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC))
HGOTO_ERROR(H5E_SOHM, H5E_CANTLOAD, NULL, "bad SOHM list signature")
- p += H5SM_SIZEOF_MAGIC;
+ p += H5_SIZEOF_MAGIC;
/* Read messages into the list array */
for(x = 0; x < header->num_messages; x++) {
@@ -598,8 +598,8 @@ H5SM_list_flush(H5F_t *f, hid_t dxpl_id, hbool_t destroy, haddr_t addr, H5SM_lis
p = buf;
/* Encode magic number */
- HDmemcpy(p, H5SM_LIST_MAGIC, (size_t)H5SM_SIZEOF_MAGIC);
- p += H5SM_SIZEOF_MAGIC;
+ HDmemcpy(p, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ p += H5_SIZEOF_MAGIC;
/* Write messages from the messages array to disk */
mesgs_written = 0;
diff --git a/src/H5SMpkg.h b/src/H5SMpkg.h
index 8d987a9..dc69b2b 100755
--- a/src/H5SMpkg.h
+++ b/src/H5SMpkg.h
@@ -40,13 +40,6 @@
/* Package Macros */
/****************************/
-/* Size of signature information (on disk) */
-#define H5SM_SIZEOF_MAGIC 4
-
-/* Shared Message signatures */
-#define H5SM_TABLE_MAGIC "SMTB" /* Shared Message Table */
-#define H5SM_LIST_MAGIC "SMLI" /* Shared Message List */
-
/* Size of checksum information (on disk) */
#define H5SM_SIZEOF_CHECKSUM 4
@@ -69,7 +62,7 @@
)
#define H5SM_TABLE_SIZE(f) ( \
- H5SM_SIZEOF_MAGIC /* Signature */ \
+ H5_SIZEOF_MAGIC /* Signature */ \
+ H5SM_SIZEOF_CHECKSUM /* Checksum */ \
)
@@ -84,7 +77,7 @@
)
#define H5SM_LIST_SIZE(f, num_mesg) ( \
- H5SM_SIZEOF_MAGIC /* Signature */ \
+ H5_SIZEOF_MAGIC /* Signature */ \
+ (H5SM_SOHM_ENTRY_SIZE(f) * num_mesg) /* Message entries */ \
+ H5SM_SIZEOF_CHECKSUM /* Checksum */ \
)
diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c
index fa6d1ec..0f0e593 100644
--- a/tools/misc/h5debug.c
+++ b/tools/misc/h5debug.c
@@ -29,7 +29,6 @@
#define H5B2_PACKAGE /*suppress error about including H5B2pkg */
#define H5B2_TESTING /*suppress warning about H5B2 testing funcs*/
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
-#define H5FS_PACKAGE /*suppress error about including H5FSpkg */
#define H5G_PACKAGE /*suppress error about including H5Gpkg */
#define H5HF_PACKAGE /*suppress error about including H5HFpkg */
#define H5O_PACKAGE /*suppress error about including H5Opkg */
@@ -37,19 +36,16 @@
#include "H5private.h" /* Generic Functions */
#include "H5Apkg.h" /* Attributes */
-#include "H5Bprivate.h" /* B-trees */
#include "H5B2pkg.h" /* v2 B-trees */
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
-#include "H5FSpkg.h" /* File free space */
+#include "H5FSprivate.h" /* Free space manager */
#include "H5Gpkg.h" /* Groups */
#include "H5HFpkg.h" /* Fractal heaps */
#include "H5HGprivate.h" /* Global Heaps */
-#include "H5HLprivate.h" /* Local Heaps */
#include "H5Iprivate.h" /* IDs */
#include "H5Opkg.h" /* Object headers */
-#include "H5Pprivate.h" /* Property lists */
#include "H5SMpkg.h" /* Implicitly shared messages */
/* File drivers */
@@ -60,6 +56,77 @@
/*-------------------------------------------------------------------------
+ * Function: get_H5B2_class
+ *
+ * Purpose: Determine the v2 B-tree class from the buffer read in.
+ * B-trees are debugged through the B-tree subclass. The subclass
+ * identifier is two bytes after the B-tree signature.
+ *
+ * Return: Non-NULL on success/NULL on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 11 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+static const H5B2_class_t *
+get_H5B2_class(const uint8_t *sig)
+{
+ H5B2_subid_t subtype = (H5B2_subid_t)sig[H5_SIZEOF_MAGIC + 1];
+ const H5B2_class_t *cls;
+
+ switch(subtype) {
+ case H5B2_TEST_ID:
+ cls = H5B2_TEST;
+ break;
+
+ case H5B2_FHEAP_HUGE_INDIR_ID:
+ cls = H5HF_BT2_INDIR;
+ break;
+
+ case H5B2_FHEAP_HUGE_FILT_INDIR_ID:
+ cls = H5HF_BT2_FILT_INDIR;
+ break;
+
+ case H5B2_FHEAP_HUGE_DIR_ID:
+ cls = H5HF_BT2_DIR;
+ break;
+
+ case H5B2_FHEAP_HUGE_FILT_DIR_ID:
+ cls = H5HF_BT2_FILT_DIR;
+ break;
+
+ case H5B2_GRP_DENSE_NAME_ID:
+ cls = H5G_BT2_NAME;
+ break;
+
+ case H5B2_GRP_DENSE_CORDER_ID:
+ cls = H5G_BT2_CORDER;
+ break;
+
+ case H5B2_SOHM_INDEX_ID:
+ cls = H5SM_INDEX;
+ break;
+
+ case H5B2_ATTR_DENSE_NAME_ID:
+ cls = H5A_BT2_NAME;
+ break;
+
+ case H5B2_ATTR_DENSE_CORDER_ID:
+ cls = H5A_BT2_CORDER;
+ break;
+
+ default:
+ fprintf(stderr, "Unknown B-tree subtype %u\n", (unsigned)(subtype));
+ HDexit(4);
+ } /* end switch */
+
+ return(cls);
+} /* end get_H5B2_class() */
+
+
+/*-------------------------------------------------------------------------
* Function: main
*
* Usage: debug FILENAME [OFFSET]
@@ -143,19 +210,19 @@ main(int argc, char *argv[])
*/
status = H5F_debug(f, stdout, 0, VCOL);
- } else if(!HDmemcmp(sig, H5HL_MAGIC, (size_t)H5HL_SIZEOF_MAGIC)) {
+ } else if(!HDmemcmp(sig, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a local heap.
*/
status = H5HL_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL);
- } else if(!HDmemcmp (sig, H5HG_MAGIC, (size_t)H5HG_SIZEOF_MAGIC)) {
+ } else if(!HDmemcmp (sig, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a global heap collection.
*/
status = H5HG_debug (f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL);
- } else if(!HDmemcmp(sig, H5G_NODE_MAGIC, (size_t)H5G_NODE_SIZEOF_MAGIC)) {
+ } else if(!HDmemcmp(sig, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a symbol table node.
*/
@@ -169,13 +236,13 @@ main(int argc, char *argv[])
status = H5G_node_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra);
- } else if(!HDmemcmp(sig, H5B_MAGIC, (size_t)H5B_SIZEOF_MAGIC)) {
+ } else if(!HDmemcmp(sig, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a B-tree. B-trees are debugged through the B-tree
* subclass. The subclass identifier is the byte immediately
* after the B-tree signature.
*/
- H5B_subid_t subtype = (H5B_subid_t)sig[H5B_SIZEOF_MAGIC];
+ H5B_subid_t subtype = (H5B_subid_t)sig[H5_SIZEOF_MAGIC];
unsigned ndims;
switch(subtype) {
@@ -208,67 +275,20 @@ main(int argc, char *argv[])
HDexit(4);
}
- } else if(!HDmemcmp(sig, H5B2_HDR_MAGIC, (size_t)H5B2_SIZEOF_MAGIC)) {
+ } else if(!HDmemcmp(sig, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
- * Debug a v2 B-tree. B-trees are debugged through the B-tree
- * subclass. The subclass identifier is two bytes after the
- * B-tree signature.
+ * Debug a v2 B-tree header.
*/
- H5B2_subid_t subtype = (H5B2_subid_t)sig[H5B2_SIZEOF_MAGIC+1];
-
- switch(subtype) {
- case H5B2_TEST_ID:
- status = H5B2_hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5B2_TEST);
- break;
-
- case H5B2_FHEAP_HUGE_INDIR_ID:
- status = H5B2_hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5HF_BT2_INDIR);
- break;
-
- case H5B2_FHEAP_HUGE_FILT_INDIR_ID:
- status = H5B2_hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5HF_BT2_FILT_INDIR);
- break;
-
- case H5B2_FHEAP_HUGE_DIR_ID:
- status = H5B2_hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5HF_BT2_DIR);
- break;
-
- case H5B2_FHEAP_HUGE_FILT_DIR_ID:
- status = H5B2_hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5HF_BT2_FILT_DIR);
- break;
-
- case H5B2_GRP_DENSE_NAME_ID:
- status = H5B2_hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5G_BT2_NAME);
- break;
-
- case H5B2_GRP_DENSE_CORDER_ID:
- status = H5B2_hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5G_BT2_CORDER);
- break;
-
- case H5B2_SOHM_INDEX_ID:
- status = H5B2_hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5SM_INDEX);
- break;
-
- case H5B2_ATTR_DENSE_NAME_ID:
- status = H5B2_hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5A_BT2_NAME);
- break;
-
- case H5B2_ATTR_DENSE_CORDER_ID:
- status = H5B2_hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5A_BT2_CORDER);
- break;
-
- default:
- fprintf(stderr, "Unknown B-tree subtype %u\n", (unsigned)(subtype));
- HDexit(4);
- } /* end switch */
+ const H5B2_class_t *cls = get_H5B2_class(sig);
+ HDassert(cls);
+ status = H5B2_hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls);
- } else if(!HDmemcmp(sig, H5B2_INT_MAGIC, (size_t)H5B2_SIZEOF_MAGIC)) {
+ } else if(!HDmemcmp(sig, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
- * Debug a v2 B-tree. B-trees are debugged through the B-tree
- * subclass. The subclass identifier is the byte after the
- * B-tree signature.
+ * Debug a v2 B-tree internal node.
*/
- H5B2_subid_t subtype = (H5B2_subid_t)sig[H5B2_SIZEOF_MAGIC + 1];
+ const H5B2_class_t *cls = get_H5B2_class(sig);
+ HDassert(cls);
/* Check for enough valid parameters */
if(extra == 0 || extra2 == 0 || extra3 == 0) {
@@ -279,59 +299,14 @@ main(int argc, char *argv[])
HDexit(4);
} /* end if */
- switch(subtype) {
- case H5B2_TEST_ID:
- status = H5B2_int_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5B2_TEST, extra, (unsigned)extra2, (unsigned)extra3);
- break;
-
- case H5B2_FHEAP_HUGE_INDIR_ID:
- status = H5B2_int_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5HF_BT2_INDIR, extra, (unsigned)extra2, (unsigned)extra3);
- break;
-
- case H5B2_FHEAP_HUGE_FILT_INDIR_ID:
- status = H5B2_int_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5HF_BT2_FILT_INDIR, extra, (unsigned)extra2, (unsigned)extra3);
- break;
-
- case H5B2_FHEAP_HUGE_DIR_ID:
- status = H5B2_int_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5HF_BT2_DIR, extra, (unsigned)extra2, (unsigned)extra3);
- break;
-
- case H5B2_FHEAP_HUGE_FILT_DIR_ID:
- status = H5B2_int_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5HF_BT2_FILT_DIR, extra, (unsigned)extra2, (unsigned)extra3);
- break;
-
- case H5B2_GRP_DENSE_NAME_ID:
- status = H5B2_int_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5G_BT2_NAME, extra, (unsigned)extra2, (unsigned)extra3);
- break;
-
- case H5B2_GRP_DENSE_CORDER_ID:
- status = H5B2_int_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5G_BT2_CORDER, extra, (unsigned)extra2, (unsigned)extra3);
- break;
-
- case H5B2_SOHM_INDEX_ID:
- status = H5B2_int_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5SM_INDEX, extra, (unsigned)extra2, (unsigned)extra3);
- break;
-
- case H5B2_ATTR_DENSE_NAME_ID:
- status = H5B2_int_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5A_BT2_NAME, extra, (unsigned)extra2, (unsigned)extra3);
- break;
-
- case H5B2_ATTR_DENSE_CORDER_ID:
- status = H5B2_int_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5A_BT2_CORDER, extra, (unsigned)extra2, (unsigned)extra3);
- break;
-
- default:
- fprintf(stderr, "Unknown B-tree subtype %u\n", (unsigned)(subtype));
- HDexit(4);
- } /* end switch */
+ status = H5B2_int_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, (unsigned)extra3);
- } else if(!HDmemcmp(sig, H5B2_LEAF_MAGIC, (size_t)H5B2_SIZEOF_MAGIC)) {
+ } else if(!HDmemcmp(sig, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
- * Debug a v2 B-tree. B-trees are debugged through the B-tree
- * subclass. The subclass identifier is the byte after the
- * B-tree signature.
+ * Debug a v2 B-tree leaf node.
*/
- H5B2_subid_t subtype = (H5B2_subid_t)sig[H5B2_SIZEOF_MAGIC + 1];
+ const H5B2_class_t *cls = get_H5B2_class(sig);
+ HDassert(cls);
/* Check for enough valid parameters */
if(extra == 0 || extra2 == 0) {
@@ -341,59 +316,15 @@ main(int argc, char *argv[])
HDexit(4);
} /* end if */
- switch(subtype) {
- case H5B2_TEST_ID:
- status = H5B2_leaf_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5B2_TEST, extra, (unsigned)extra2);
- break;
-
- case H5B2_FHEAP_HUGE_INDIR_ID:
- status = H5B2_leaf_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5HF_BT2_INDIR, extra, (unsigned)extra2);
- break;
-
- case H5B2_FHEAP_HUGE_FILT_INDIR_ID:
- status = H5B2_leaf_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5HF_BT2_FILT_INDIR, extra, (unsigned)extra2);
- break;
-
- case H5B2_FHEAP_HUGE_DIR_ID:
- status = H5B2_leaf_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5HF_BT2_DIR, extra, (unsigned)extra2);
- break;
-
- case H5B2_FHEAP_HUGE_FILT_DIR_ID:
- status = H5B2_leaf_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5HF_BT2_FILT_DIR, extra, (unsigned)extra2);
- break;
-
- case H5B2_GRP_DENSE_NAME_ID:
- status = H5B2_leaf_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5G_BT2_NAME, extra, (unsigned)extra2);
- break;
-
- case H5B2_GRP_DENSE_CORDER_ID:
- status = H5B2_leaf_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5G_BT2_CORDER, extra, (unsigned)extra2);
- break;
-
- case H5B2_SOHM_INDEX_ID:
- status = H5B2_leaf_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5SM_INDEX, extra, (unsigned)extra2);
- break;
-
- case H5B2_ATTR_DENSE_NAME_ID:
- status = H5B2_leaf_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5A_BT2_NAME, extra, (unsigned)extra2);
- break;
-
- case H5B2_ATTR_DENSE_CORDER_ID:
- status = H5B2_leaf_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, H5A_BT2_CORDER, extra, (unsigned)extra2);
- break;
-
- default:
- fprintf(stderr, "Unknown B-tree subtype %u\n", (unsigned)(subtype));
- HDexit(4);
- } /* end switch */
+ status = H5B2_leaf_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2);
- } else if(!HDmemcmp(sig, H5HF_HDR_MAGIC, (size_t)H5HF_SIZEOF_MAGIC)) {
+ } else if(!HDmemcmp(sig, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a fractal heap header.
*/
status = H5HF_hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL);
- } else if(!HDmemcmp(sig, H5HF_DBLOCK_MAGIC, (size_t)H5HF_SIZEOF_MAGIC)) {
+ } else if(!HDmemcmp(sig, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a fractal heap direct block.
*/
@@ -408,7 +339,7 @@ main(int argc, char *argv[])
status = H5HF_dblock_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra, (size_t)extra2);
- } else if(!HDmemcmp(sig, H5HF_IBLOCK_MAGIC, (size_t)H5HF_SIZEOF_MAGIC)) {
+ } else if(!HDmemcmp(sig, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a fractal heap indirect block.
*/
@@ -423,14 +354,14 @@ main(int argc, char *argv[])
status = H5HF_iblock_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra, (unsigned)extra2);
- } else if(!HDmemcmp(sig, H5FS_HDR_MAGIC, (size_t)H5FS_SIZEOF_MAGIC)) {
+ } else if(!HDmemcmp(sig, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug a free space header.
*/
status = H5FS_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL);
- } else if(!HDmemcmp(sig, H5FS_SINFO_MAGIC, (size_t)H5FS_SIZEOF_MAGIC)) {
+ } else if(!HDmemcmp(sig, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug free space serialized sections.
*/
@@ -445,14 +376,14 @@ main(int argc, char *argv[])
status = H5FS_sects_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra, extra2);
- } else if(!HDmemcmp(sig, H5SM_TABLE_MAGIC, (size_t)H5SM_SIZEOF_MAGIC)) {
+ } else if(!HDmemcmp(sig, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug shared message master table.
*/
status = H5SM_table_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, (unsigned) UFAIL, (unsigned) UFAIL);
- } else if(!HDmemcmp(sig, H5SM_LIST_MAGIC, (size_t)H5SM_SIZEOF_MAGIC)) {
+ } else if(!HDmemcmp(sig, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug shared message list index.
*/
@@ -467,7 +398,7 @@ main(int argc, char *argv[])
status = H5SM_list_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, (unsigned) extra, (size_t) extra2);
- } else if(!HDmemcmp(sig, H5O_HDR_MAGIC, (size_t)H5O_SIZEOF_MAGIC)) {
+ } else if(!HDmemcmp(sig, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug v2 object header (which have signatures).
*/