summaryrefslogtreecommitdiffstats
path: root/src/H5Gtraverse.c
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2008-08-07 21:49:05 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2008-08-07 21:49:05 (GMT)
commite980307ed9ee9acc414c6166e5f76282fc44bacd (patch)
tree9c79db2c965b1df62d50bde9f0cad71456b40310 /src/H5Gtraverse.c
parenta5de140500d6655c80272b82c748a23440539273 (diff)
downloadhdf5-e980307ed9ee9acc414c6166e5f76282fc44bacd.zip
hdf5-e980307ed9ee9acc414c6166e5f76282fc44bacd.tar.gz
hdf5-e980307ed9ee9acc414c6166e5f76282fc44bacd.tar.bz2
[svn-r15451] Purpose: Fix various problems that were occurring when using mounted files.
Description: Moved mount table from top file structure to shared file structure. Moved parent out of mount table and back into top file structure. Mounted files can now be accessed from any handle of the parent file. Changes to how files are closed. Stricter cycle checking on mounted files. Removed unused function H5F_has_mount(). Tested: committest in 1.8 branch. Committing now due to the urgency of the fix. No changes here are specific to the trunk, but I will keep an eye on the daily tests.
Diffstat (limited to 'src/H5Gtraverse.c')
-rw-r--r--src/H5Gtraverse.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c
index 4fc345c..dcc77c2 100644
--- a/src/H5Gtraverse.c
+++ b/src/H5Gtraverse.c
@@ -384,7 +384,8 @@ done:
static herr_t
H5G_traverse_mount(H5G_loc_t *obj_loc/*in,out*/)
{
- H5F_t *parent = obj_loc->oloc->file; /* File of object */
+ H5F_t *parent = obj_loc->oloc->file, /* File of object */
+ *child = NULL; /* Child file */
unsigned lt, rt, md = 0; /* Binary search indices */
int cmp;
H5O_loc_t *oloc = NULL; /* Object location for mount points */
@@ -405,11 +406,11 @@ H5G_traverse_mount(H5G_loc_t *obj_loc/*in,out*/)
* table for the parent
*/
lt = 0;
- rt = parent->mtab.nmounts;
+ rt = parent->shared->mtab.nmounts;
cmp = -1;
while(lt < rt && cmp) {
md = (lt + rt) / 2;
- oloc = H5G_oloc(parent->mtab.child[md].group);
+ oloc = H5G_oloc(parent->shared->mtab.child[md].group);
cmp = H5F_addr_cmp(obj_loc->oloc->addr, oloc->addr);
if(cmp < 0)
rt = md;
@@ -418,17 +419,28 @@ H5G_traverse_mount(H5G_loc_t *obj_loc/*in,out*/)
} /* end while */
/* Copy root info over to ENT */
- if(0 == cmp) {
- /* Get the location for the root group in the child's file */
- oloc = H5G_oloc(parent->mtab.child[md].file->shared->root_grp);
-
- /* Copy the entry for the root group */
- if(H5O_loc_copy(obj_loc->oloc, oloc, H5_COPY_DEEP) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "unable to copy object location")
-
- /* Switch to child's file */
- parent = oloc->file;
- } /* end if */
+ if(0 == cmp) {
+ /* Get the child file */
+ child = parent->shared->mtab.child[md].file;
+
+ /* Get the location for the root group in the child's file */
+ oloc = H5G_oloc(child->shared->root_grp);
+
+ /* Release the mount point */
+ if(H5O_loc_free(obj_loc->oloc) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "unable to free object location")
+
+ /* Copy the entry for the root group */
+ if(H5O_loc_copy(obj_loc->oloc, oloc, H5_COPY_DEEP) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "unable to copy object location")
+
+ /* In case the shared root group info points to a different file handle
+ * than the child, modify obj_loc */
+ obj_loc->oloc->file = child;
+
+ /* Switch to child's file */
+ parent = child;
+ } /* end if */
} while(!cmp);
done: