summaryrefslogtreecommitdiffstats
path: root/src/H5G.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1997-08-29 22:23:04 (GMT)
committerRobb Matzke <matzke@llnl.gov>1997-08-29 22:23:04 (GMT)
commitcbf1f8dbb5bebca21959d0eb8bb93100648b8c95 (patch)
tree79a007eca9740ad7b013e5eb168bfb9bb90f6870 /src/H5G.c
parent3ea316ff54d76b866325794d84e4a9c060a4b2b8 (diff)
downloadhdf5-cbf1f8dbb5bebca21959d0eb8bb93100648b8c95.zip
hdf5-cbf1f8dbb5bebca21959d0eb8bb93100648b8c95.tar.gz
hdf5-cbf1f8dbb5bebca21959d0eb8bb93100648b8c95.tar.bz2
[svn-r55] ./src/H5F.c
Added H5Fflush() and H5F_flush() which flush (and optionally invalidate the cache) and flush the file boot block. H5Fcreate() calls H5F_flush() to output the boot block. H5Fclose() calls H5F_flush() to update the boot block. H5F_debug() prints the root symbol table entry. ./src/H5Fpublic.h Added H5Fflush() prototype. ./src/H5G.c The name message is removed when an object moves from the root object position into a directory. Added H5G_debug() to print a symbol table entry. Most of the code was just moved from H5G_node_debug(). ./src/H5Gnode.c Moved some debugging code into H5G_debug(). ./src/H5Gprivate.c Added H5G_debug() prototype. ./src/H5O.c Implemented H5O_remove(). Added identifiers for H5O_SIM_DIM and H5O_SIM_DTYPE so they can be read from files. H5O_load() combines adjacent null messages for better memory management. ./src/H5Oprivate.h Changed minimum header data block size from 16 to 32 bytes. Changed prototype for H5O_remove()
Diffstat (limited to 'src/H5G.c')
-rw-r--r--src/H5G.c90
1 files changed, 87 insertions, 3 deletions
diff --git a/src/H5G.c b/src/H5G.c
index b1441c6..3e756b5 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -327,12 +327,17 @@ H5G_mkroot (hdf5_file_t *f, size_t size_hint)
if (H5O_read (f, f->root_sym->header, f->root_sym, H5O_STAB, 0, &stab)) {
/* root directory already exists */
HRETURN_ERROR (H5E_DIRECTORY, H5E_EXISTS, FAIL);
+
} else if (H5O_read (f, f->root_sym->header, f->root_sym, H5O_NAME,
0, &name)) {
- root = *(f->root_sym);
- root_name = name.s; /*dont reset name until root_name is done*/
+ /*dont reset name until root_name is done*/
+ root_name = name.s;
reset = TRUE;
- H5O_remove (f, f->root_sym->header, f->root_sym, H5O_NAME, H5O_ALL);
+
+ /* remove all name messages -- don't care if it fails */
+ root = *(f->root_sym);
+ H5O_remove (f, root.header, &root, NULL, H5O_NAME, H5O_ALL);
+
} else {
root = *(f->root_sym);
root_name = "Root Object";
@@ -1260,4 +1265,83 @@ H5G_encode (hdf5_file_t *f, uint8 **pp, H5G_entry_t *ent)
FUNC_LEAVE (SUCCEED);
}
+
+/*-------------------------------------------------------------------------
+ * Function: H5G_debug
+ *
+ * Purpose: Prints debugging information about a symbol table entry.
+ *
+ * Return: Success: SUCCEED
+ *
+ * Failure: FAIL
+ *
+ * Programmer: Robb Matzke
+ * robb@maya.nuance.com
+ * Aug 29 1997
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5G_debug (hdf5_file_t *f, H5G_entry_t *ent, FILE *stream, intn indent,
+ intn fwidth)
+{
+ int i;
+ char buf[64];
+
+ FUNC_ENTER (H5G_debug, NULL, FAIL);
+
+ fprintf (stream, "%*s%-*s %lu\n", indent, "", fwidth,
+ "Name offset into private heap:",
+ (unsigned long)(ent->name_off));
+ fprintf (stream, "%*s%-*s %lu\n", indent, "", fwidth,
+ "Object header address:",
+ (unsigned long)(ent->header));
+
+ fprintf (stream, "%*s%-*s ", indent, "", fwidth,
+ "Symbol type:");
+ switch (ent->type) {
+ case H5G_NOTHING_CACHED:
+ fprintf (stream, "Nothing Cached\n");
+ break;
+
+ case H5G_CACHED_SDATA:
+ fprintf (stream, "S-data\n");
+ fprintf (stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Number type length:",
+ (unsigned)(ent->cache.sdata.nt.length));
+ fprintf (stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Number type architecture:",
+ (unsigned)(ent->cache.sdata.nt.arch));
+ fprintf (stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Number type type:",
+ (unsigned)(ent->cache.sdata.nt.type));
+ fprintf (stream, "%*s%-*s %u\n", indent, "", fwidth,
+ "Dimensionality:",
+ (unsigned)(ent->cache.sdata.ndim));
+ for (i=0; i<ent->cache.sdata.ndim && i<4; i++) {
+ sprintf (buf, "Dimension %d", i);
+ fprintf (stream, "%*s%-*s %u\n", indent, "", fwidth,
+ buf,
+ (unsigned)(ent->cache.sdata.dim[i]));
+ }
+ break;
+
+ case H5G_CACHED_STAB:
+ fprintf (stream, "Symbol Table\n");
+ fprintf (stream, "%*s%-*s %lu\n", indent, "", fwidth,
+ "B-tree address:",
+ (unsigned long)(ent->cache.stab.btree));
+ fprintf (stream, "%*s%-*s %lu\n", indent, "", fwidth,
+ "Heap address:",
+ (unsigned long)(ent->cache.stab.heap));
+ break;
+
+ default:
+ fprintf (stream, "*** Unknown symbol type %d\n", ent->type);
+ break;
+ }
+ FUNC_LEAVE (SUCCEED);
+}