summaryrefslogtreecommitdiffstats
path: root/src/H5G.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2009-04-08 21:53:31 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2009-04-08 21:53:31 (GMT)
commitc1c58f79a865a1e4bf53949e8819f6612c2cbd93 (patch)
tree156e27bc731b365284991ea0e3cf53a1cdf5c9d6 /src/H5G.c
parent659f3a77ea0f7548ed09a9624de3fe2a183f451c (diff)
downloadhdf5-c1c58f79a865a1e4bf53949e8819f6612c2cbd93.zip
hdf5-c1c58f79a865a1e4bf53949e8819f6612c2cbd93.tar.gz
hdf5-c1c58f79a865a1e4bf53949e8819f6612c2cbd93.tar.bz2
[svn-r16710] Purpose: Fix bug 1423
Description: Versions of the library between 1.3.0 and 1.6.3 have a bug which prevents them from opening any file that does not have the root group's symbol table information cached in the root group's entry in the superblock. Prior to 1.8 this was not an issue as this information was always cached. However, 1.8.0 stopped writing this information (which is not required by the file format specification), and these older versions can therefore not read files created or last written by versions 1.8.0 to 1.8.2. This fix modifies the library to once again add this information to the superblock (when using the old file format). Tested: jam, linew, smirom (h5committest)
Diffstat (limited to 'src/H5G.c')
-rw-r--r--src/H5G.c165
1 files changed, 0 insertions, 165 deletions
diff --git a/src/H5G.c b/src/H5G.c
index 56e6c6a..2afd837 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -817,141 +817,6 @@ H5G_term_interface(void)
/*-------------------------------------------------------------------------
- * Function: H5G_mkroot
- *
- * Purpose: Creates a root group in an empty file and opens it. If a
- * root group is already open then this function immediately
- * returns. If ENT is non-null then it's the symbol table
- * entry for an existing group which will be opened as the root
- * group. Otherwise a new root group is created and then
- * opened.
- *
- * Return: Non-negative on success/Negative on failure
- *
- * Programmer: Robb Matzke
- * matzke@llnl.gov
- * Aug 11 1997
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5G_mkroot(H5F_t *f, hid_t dxpl_id, H5G_loc_t *loc)
-{
- H5O_loc_t new_root_oloc; /* New root object location */
- H5G_name_t new_root_path; /* New root path */
- H5G_loc_t new_root_loc; /* New root location information */
- H5G_loc_t root_loc; /* Root location information */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(H5G_mkroot, FAIL)
-
- /* check args */
- HDassert(f);
-
- /* Check if the root group is already initialized */
- if(f->shared->root_grp)
- HGOTO_DONE(SUCCEED)
-
- /* Create information needed for group nodes */
- if(H5G_node_init(f) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group node info")
-
- /*
- * If there is no root object then create one. The root group always starts
- * with a hard link count of one since it's pointed to by the superblock.
- */
- if(loc == NULL) {
- H5P_genplist_t *fc_plist; /* File creation property list */
- H5O_ginfo_t ginfo; /* Group info parameters */
- H5O_linfo_t linfo; /* Link info parameters */
-
- /* Get the file creation property list */
- /* (Which is a sub-class of the group creation property class) */
- if(NULL == (fc_plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
-
- /* Get the group info property */
- if(H5P_get(fc_plist, H5G_CRT_GROUP_INFO_NAME, &ginfo) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get group info")
-
- /* Get the link info property */
- if(H5P_get(fc_plist, H5G_CRT_LINK_INFO_NAME, &linfo) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get link info")
-
- /* Set up group location for root group */
- new_root_loc.oloc = &new_root_oloc;
- new_root_loc.path = &new_root_path;
- H5G_loc_reset(&new_root_loc);
- loc = &new_root_loc;
-
- /* Create root group */
- if(H5G_obj_create(f, dxpl_id, &ginfo, &linfo, f->shared->fcpl_id, loc->oloc/*out*/) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group entry")
- if(1 != H5O_link(loc->oloc, 1, dxpl_id))
- HGOTO_ERROR(H5E_SYM, H5E_LINKCOUNT, FAIL, "internal error (wrong link count)")
- } /* end if */
- else {
- /*
- * Open the root object as a group.
- */
- if(H5O_open(loc->oloc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTOPENOBJ, FAIL, "unable to open root group")
-
-#ifndef H5_STRICT_FORMAT_CHECKS
- /* If symbol table information is cached, check if we should replace the
- * symbol table message with the cached symbol table information */
- if((H5F_INTENT(f) & H5F_ACC_RDWR) && f->shared->root_ent
- && (f->shared->root_ent->type == H5G_CACHED_STAB)) {
- H5O_stab_t cached_stab;
-
- /* Retrieve the cached symbol table information */
- cached_stab.btree_addr = f->shared->root_ent->cache.stab.btree_addr;
- cached_stab.heap_addr = f->shared->root_ent->cache.stab.heap_addr;
-
- /* Check if the symbol table message is valid, and replace with the
- * cached symbol table if necessary */
- if(H5G_stab_valid(loc->oloc, dxpl_id, &cached_stab) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to verify symbol table")
- } /* end if */
-#endif /* H5_STRICT_FORMAT_CHECKS */
- } /* end else */
-
- /* Create the path names for the root group's entry */
- H5G_name_init(loc->path, "/");
-
- /*
- * Create the group pointer. Also decrement the open object count so we
- * don't count the root group as an open object. The root group will
- * never be closed.
- */
- if(NULL == (f->shared->root_grp = H5FL_CALLOC(H5G_t)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- if(NULL == (f->shared->root_grp->shared = H5FL_CALLOC(H5G_shared_t))) {
- (void)H5FL_FREE(H5G_t, f->shared->root_grp);
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- } /* end if */
-
- /* Shallow copy (take ownership) of the group object info */
- root_loc.oloc = &(f->shared->root_grp->oloc);
- root_loc.path = &(f->shared->root_grp->path);
- if(H5G_loc_copy(&root_loc, loc, H5_COPY_SHALLOW) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTCOPY, FAIL, "can't copy group object location")
-
- f->shared->root_grp->shared->fo_count = 1;
- /* The only other open object should be the superblock extension, if it
- * exists. Don't count either the superblock extension or the root group
- * in the number of open objects in the file.
- */
- HDassert((1 == f->nopen_objs) ||
- (2 == f->nopen_objs && HADDR_UNDEF != f->shared->extension_addr));
- f->nopen_objs--;
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5G_mkroot() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5G_create
*
* Purpose: Creates a new empty group with the specified name. The name
@@ -1351,36 +1216,6 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5G_rootof
- *
- * Purpose: Return a pointer to the root group of the file. If the file
- * is part of a virtual file then the root group of the virtual
- * file is returned.
- *
- * Return: Success: Ptr to the root group of the file. Do not
- * free the pointer -- it points directly into
- * the file struct.
- *
- * Failure: NULL
- *
- * Programmer: Robb Matzke
- * Tuesday, October 13, 1998
- *
- *-------------------------------------------------------------------------
- */
-H5G_t *
-H5G_rootof(H5F_t *f)
-{
- FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_rootof)
-
- while(f->parent)
- f = f->parent;
-
- FUNC_LEAVE_NOAPI(f->shared->root_grp)
-} /* end H5G_rootof() */
-
-
-/*-------------------------------------------------------------------------
* Function: H5G_oloc
*
* Purpose: Returns a pointer to the object location for a group.