diff options
Diffstat (limited to 'src/H5Gtraverse.c')
-rw-r--r-- | src/H5Gtraverse.c | 40 |
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: |