summaryrefslogtreecommitdiffstats
path: root/tools/misc/h5debug.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2006-05-15 04:35:53 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2006-05-15 04:35:53 (GMT)
commit7b6db1046b044d2f433a02b2c64f9297988e8b50 (patch)
tree3fd3b9fc87d5f4534c66b4d0598a48704d0b727b /tools/misc/h5debug.c
parent84b03a51c7104f2b691c7067d0d82b28880b9086 (diff)
downloadhdf5-7b6db1046b044d2f433a02b2c64f9297988e8b50.zip
hdf5-7b6db1046b044d2f433a02b2c64f9297988e8b50.tar.gz
hdf5-7b6db1046b044d2f433a02b2c64f9297988e8b50.tar.bz2
[svn-r12349] Purpose:
Code checkpoint Description: Checkpoint fractal heap improvements, as well as move the free space manager code that it's using into a separate package. Platforms tested: FreeBSD 4.11 (sleipnir) Linux 2.4/64 (mir) w/C++ & FORTRAN Linux 2.4/32 (heping) Solaris 2.9 (shanti) AIX 5.? (copper) w/FORTRAN & parallel
Diffstat (limited to 'tools/misc/h5debug.c')
-rw-r--r--tools/misc/h5debug.c51
1 files changed, 37 insertions, 14 deletions
diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c
index 9781d42..d79089d 100644
--- a/tools/misc/h5debug.c
+++ b/tools/misc/h5debug.c
@@ -24,11 +24,12 @@
*
*-------------------------------------------------------------------------
*/
-#define H5F_PACKAGE /*suppress error about including H5Fpkg */
-#define H5O_PACKAGE /*suppress error about including H5Opkg */
#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 H5HF_PACKAGE /*suppress error about including H5HFpkg */
+#define H5O_PACKAGE /*suppress error about including H5Opkg */
#include "H5private.h" /* Generic Functions */
#include "H5Bprivate.h" /* B-trees */
@@ -36,6 +37,7 @@
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
+#include "H5FSpkg.h" /* File free space */
#include "H5Gprivate.h" /* Groups */
#include "H5HFpkg.h" /* Fractal heaps */
#include "H5HGprivate.h" /* Global Heaps */
@@ -65,8 +67,6 @@
* matzke@llnl.gov
* Jul 18 1997
*
- * Modifications:
- *
*-------------------------------------------------------------------------
*/
int
@@ -82,13 +82,13 @@ main(int argc, char *argv[])
if(argc == 1) {
fprintf(stderr, "Usage: %s filename [signature-addr [extra]]\n", argv[0]);
HDexit(1);
- }
+ } /* end if */
/* Initialize the library */
if(H5open() < 0) {
fprintf(stderr, "cannot initialize the library\n");
HDexit(1);
- }
+ } /* end if */
/*
* Open the file and get the file descriptor.
@@ -96,21 +96,21 @@ main(int argc, char *argv[])
if((dxpl = H5Pcreate (H5P_DATASET_XFER))<0) {
fprintf(stderr, "cannot create dataset transfer property list\n");
HDexit(1);
- }
+ } /* end if */
if((fapl = H5Pcreate (H5P_FILE_ACCESS))<0) {
fprintf(stderr, "cannot create file access property list\n");
HDexit(1);
- }
+ } /* end if */
if(strchr (argv[1], '%'))
H5Pset_fapl_family (fapl, (hsize_t)0, H5P_DEFAULT);
if((fid = H5Fopen(argv[1], H5F_ACC_RDONLY, fapl)) < 0) {
fprintf(stderr, "cannot open file\n");
HDexit(1);
- }
+ } /* end if */
if(NULL == (f = H5I_object(fid))) {
fprintf(stderr, "cannot obtain H5F_t pointer\n");
HDexit(2);
- }
+ } /* end if */
/*
* Parse command arguments.
@@ -301,12 +301,34 @@ main(int argc, char *argv[])
if(extra == 0 || extra2 == 0) {
fprintf(stderr, "ERROR: Need fractal heap header address and number of rows in order to dump indirect block\n");
fprintf(stderr, "Fractal heap indirect block usage:\n");
- fprintf(stderr, "\th5debug <filename> <direct block address> <heap header address> <number of rows>\n");
+ fprintf(stderr, "\th5debug <filename> <indirect block address> <heap header address> <number of rows>\n");
HDexit(4);
} /* end if */
status = H5HF_iblock_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra, (unsigned)extra2);
+ } else if(!HDmemcmp(sig, H5FS_HDR_MAGIC, H5FS_SIZEOF_MAGIC)) {
+ /*
+ * Debug a free space header.
+ */
+
+ status = H5FS_hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL);
+
+ } else if(!HDmemcmp(sig, H5FS_SECTS_MAGIC, H5FS_SIZEOF_MAGIC)) {
+ /*
+ * Debug free space serialized sections.
+ */
+
+ /* Check for enough valid parameters */
+ if(extra == 0 || extra2 == 0) {
+ fprintf(stderr, "ERROR: Need free space header address and client address in order to dump serialized sections\n");
+ fprintf(stderr, "Free space serialized sections usage:\n");
+ fprintf(stderr, "\th5debug <filename> <serialized sections address> <free space header address> <client address>\n");
+ HDexit(4);
+ } /* end if */
+
+ status = H5FS_sects_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, extra, extra2);
+
} else if(sig[0] == H5O_VERSION) {
/*
* This could be an object header. Since they don't have a signature
@@ -332,18 +354,19 @@ main(int argc, char *argv[])
fprintf(stderr, "unknown signature\n");
HDexit(4);
- }
+ } /* end else */
+ /* Check for an error when dumping information */
if(status < 0) {
fprintf(stderr, "An error occurred!\n");
H5Eprint(stderr);
HDexit(5);
- }
+ } /* end if */
H5Pclose(dxpl);
H5Pclose(fapl);
H5Fclose(fid);
return 0;
-}
+} /* main() */