summaryrefslogtreecommitdiffstats
path: root/src/H5F.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-03-24 23:18:34 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-03-24 23:18:34 (GMT)
commite987de2c42628f94e713111c5cbb09bbd3db4a68 (patch)
tree4baf097e2a0480c9cf24e2ce28749f969afb8fd8 /src/H5F.c
parent2ed9aa69f74cc2002fb9a03c8893056a1daea1db (diff)
downloadhdf5-e987de2c42628f94e713111c5cbb09bbd3db4a68.zip
hdf5-e987de2c42628f94e713111c5cbb09bbd3db4a68.tar.gz
hdf5-e987de2c42628f94e713111c5cbb09bbd3db4a68.tar.bz2
[svn-r329] Changes since 19980324
---------------------- ./src/H5D.c Zero element requests for H5Dread() and H5Dwrite() succeed. ./src/H5F.c ./src/H5Fprivate.h All files will have a root group. This greatly simplifies the library at the expense of ~1k extra bytes in files that have only one object. ./src/H5D.c ./src/H5Dprivate.h ./html/Groups.html Functions that used to take a file ID and an object name can now take a group ID instead of a file ID. This doesn't change the API, only it's documentation. ./src/H5G.c ./src/H5Gprivate.h ./src/H5O.c ./src/H5Oprivate.h Removed extra file arguments from some internal functions since the file pointer can be found from the group pointer or a symbol table entry (ent->file or H5G_fileof(group)). Besides, when we eventually implement mounting one file on another, H5G_namei() might return a different file than what you gave it, and that file is part of the returned symbol table entry. ./src/H5G.c Fixed bug with `.' appearing in a name. It used to hang the library. ./src/Makefile.in ./src/h5ls.c [NEW] ./MANIFEST Added `h5ls' a simple program that takes a file name and a directory and lists the contents of that directory using H5Giterate(). ./test/istore.c Changed an argument to H5G_create(). ./test/tstab.c Removed test_1 which was testing that files with a single object don't have a root group. This no longer applies.
Diffstat (limited to 'src/H5F.c')
-rw-r--r--src/H5F.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/H5F.c b/src/H5F.c
index 553bbeb..6acdf81 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -538,8 +538,8 @@ H5F_dest(H5F_t *f)
if (f) {
if (0 == --(f->shared->nrefs)) {
+ /* Do not close the root group since we didn't count it */
H5AC_dest(f);
- f->shared->root_ent = H5MM_xfree(f->shared->root_ent);
f->shared = H5MM_xfree(f->shared);
}
f->name = H5MM_xfree(f->name);
@@ -834,7 +834,7 @@ H5F_open(const char *name, uintn flags,
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL,
"can't write file boot block");
}
-
+
} else if (1 == f->shared->nrefs) {
/* For existing files we must read the boot block. */
if (H5F_locate_signature(f->shared->lf,
@@ -940,11 +940,11 @@ H5F_open(const char *name, uintn flags,
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL,
"can't read root symbol entry");
}
- if (H5F_addr_defined(&(root_ent.header))) {
- f->shared->root_ent = H5MM_xmalloc(sizeof(H5G_entry_t));
- *(f->shared->root_ent) = root_ent;
+ if (H5G_mkroot (f, &root_ent)<0) {
+ HGOTO_ERROR (H5E_FILE, H5E_CANTOPENFILE, NULL,
+ "unable to read root group");
}
-
+
/*
* The userdefined data is the area of the file before the base
* address.
@@ -984,6 +984,12 @@ H5F_open(const char *name, uintn flags,
#endif
H5F_low_seteof(f->shared->lf, &addr2);
}
+
+ /* Create and/or open the root group if we haven't already done so */
+ if (H5G_mkroot (f, NULL)<0) {
+ HGOTO_ERROR (H5E_FILE, H5E_CANTINIT, NULL,
+ "unable to create/open root group");
+ }
/* Success! */
ret_value = f;
@@ -1268,7 +1274,7 @@ H5F_flush(H5F_t *f, hbool_t invalidate)
H5F_addr_encode(f, &p, &(f->shared->smallobj_addr));
H5F_addr_encode(f, &p, &(f->shared->freespace_addr));
H5F_addr_encode(f, &p, &(f->shared->hdf5_eof));
- H5G_ent_encode(f, &p, f->shared->root_ent);
+ H5G_ent_encode(f, &p, H5G_entof(f->shared->root_grp));
/* update file length if necessary */
if (!H5F_addr_defined(&(f->shared->hdf5_eof))) {
@@ -1312,8 +1318,8 @@ H5F_close(H5F_t *f)
FUNC_ENTER(H5F_close, FAIL);
/* Close all current working groups */
- while (H5G_pop(f) >= 0) /*void*/;
-
+ while (H5G_pop(f)>=0) /*void*/;
+
/* Flush the boot block and caches */
if (H5F_flush(f, TRUE) < 0) {
HRETURN_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "can't flush cache");
@@ -1324,7 +1330,7 @@ H5F_close(H5F_t *f)
* they have all been closed. The file is in a consistent state now, so
* forgetting to close everything is not a major problem.
*/
- if (f->nopen > 0) {
+ if (f->nopen>0) {
#ifndef NDEBUG
fprintf(stderr, "HDF5-DIAG: H5F_close: %u object header%s still "
"open (file close will complete when %s closed)\n",
@@ -1610,10 +1616,10 @@ H5F_debug(H5F_t *f, const haddr_t *addr, FILE * stream, intn indent,
(unsigned) (f->shared->create_parms.sharedheader_ver));
fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
- "Root symbol table entry:",
- f->shared->root_ent ? "" : "(none)");
- if (f->shared->root_ent) {
- H5G_ent_debug(f, f->shared->root_ent, stream,
+ "Root group symbol table entry:",
+ f->shared->root_grp ? "" : "(none)");
+ if (f->shared->root_grp) {
+ H5G_ent_debug(f, H5G_entof (f->shared->root_grp), stream,
indent + 3, MAX(0, fwidth - 3));
}
FUNC_LEAVE(SUCCEED);