diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2012-03-21 15:10:17 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2012-03-21 15:10:17 (GMT) |
commit | eb89d7b53ab95623ab454186a602e1cafc7391f0 (patch) | |
tree | ceafe458b3011e38853e765352d3c7e59bbecce1 /src/H5Gtraverse.c | |
parent | 3e468e6ff65d540a439e99ea568a6bff7add7cea (diff) | |
download | hdf5-eb89d7b53ab95623ab454186a602e1cafc7391f0.zip hdf5-eb89d7b53ab95623ab454186a602e1cafc7391f0.tar.gz hdf5-eb89d7b53ab95623ab454186a602e1cafc7391f0.tar.bz2 |
[svn-r22105] Description:
Bring r20557:22085 from trunk to this branch, also fixing some other
issues/failures in the branch simultaneously. The h5repack tests are still
failing, but Neil will be checking into those, so the branch can be fully
functional again.
Tested on:
Mac OSX/64 10.7.3 (amazon) w/debug
Diffstat (limited to 'src/H5Gtraverse.c')
-rw-r--r-- | src/H5Gtraverse.c | 174 |
1 files changed, 65 insertions, 109 deletions
diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 4397d1c..291734e 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -23,15 +23,21 @@ * *------------------------------------------------------------------------- */ -#define H5F_PACKAGE /*suppress error about including H5Fpkg */ + +/****************/ +/* Module Setup */ +/****************/ + #define H5G_PACKAGE /*suppress error about including H5Gpkg */ -/* Packages needed by this file... */ +/***********/ +/* Headers */ +/***********/ #include "H5private.h" /* Generic Functions */ #include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ -#include "H5Fpkg.h" /* File access */ +#include "H5Fprivate.h" /* File access */ #include "H5Gpkg.h" /* Groups */ #include "H5HLprivate.h" /* Local Heaps */ #include "H5Iprivate.h" /* IDs */ @@ -40,7 +46,15 @@ #include "H5Ppublic.h" /* Property Lists */ #include "H5WBprivate.h" /* Wrapped Buffers */ -/* Private typedefs */ + +/****************/ +/* Local Macros */ +/****************/ + + +/******************/ +/* Local Typedefs */ +/******************/ /* User data for path traversal routine */ typedef struct { @@ -52,11 +66,15 @@ typedef struct { hbool_t exists; /* Indicate if object exists */ } H5G_trav_slink_t; -/* Private macros */ -/* Local variables */ +/********************/ +/* Package Typedefs */ +/********************/ -/* PRIVATE PROTOTYPES */ + +/********************/ +/* Local Prototypes */ +/********************/ static herr_t H5G_traverse_slink_cb(H5G_loc_t *grp_loc, const char *name, const H5O_link_t *lnk, H5G_loc_t *obj_loc, void *_udata/*in,out*/, H5G_own_loc_t *own_loc/*out*/); @@ -66,11 +84,26 @@ static herr_t H5G_traverse_ud(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, static herr_t H5G_traverse_slink(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, H5G_loc_t *obj_loc/*in,out*/, unsigned target, size_t *nlinks/*in,out*/, hbool_t *obj_exists, hid_t lapl_id, hid_t dxpl_id); -static herr_t H5G_traverse_mount(H5G_loc_t *loc/*in,out*/); static herr_t H5G_traverse_real(const H5G_loc_t *loc, const char *name, unsigned target, size_t *nlinks, H5G_traverse_t op, void *op_data, hid_t lapl_id, hid_t dxpl_id); + +/*********************/ +/* Package Variables */ +/*********************/ + + +/*****************************/ +/* Library Private Variables */ +/*****************************/ + + +/*******************/ +/* Local Variables */ +/*******************/ + + /*------------------------------------------------------------------------- * Function: H5G_traverse_slink_cb @@ -93,7 +126,7 @@ H5G_traverse_slink_cb(H5G_loc_t UNUSED *grp_loc, const char UNUSED *name, H5G_trav_slink_t *udata = (H5G_trav_slink_t *)_udata; /* User data passed in */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5G_traverse_slink_cb) + FUNC_ENTER_NOAPI_NOINIT /* Check for dangling soft link */ if(obj_loc == NULL) { @@ -149,7 +182,7 @@ H5G_traverse_ud(const H5G_loc_t *grp_loc/*in,out*/, const H5O_link_t *lnk, hid_t cur_grp = (-1); herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5G_traverse_ud) + FUNC_ENTER_NOAPI_NOINIT /* Sanity check */ HDassert(grp_loc); @@ -291,7 +324,7 @@ H5G_traverse_slink(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, hbool_t tmp_grp_loc_set = FALSE; /* Flag to indicate that tmp group location is initialized */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5G_traverse_slink) + FUNC_ENTER_NOAPI_NOINIT /* Sanity check */ HDassert(grp_loc); @@ -347,87 +380,7 @@ done: /*------------------------------------------------------------------------- - * Function: H5G_traverse_mount - * - * Purpose: If LNK is a mount point then copy the entry for the root - * group of the mounted file into LNK. - * - * Return: Non-negative on success/Negative on failure - * - * Programmer: Robb Matzke - * Tuesday, October 6, 1998 - * - *------------------------------------------------------------------------- - */ -static herr_t -H5G_traverse_mount(H5G_loc_t *obj_loc/*in,out*/) -{ - 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 */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_NOAPI(H5G_traverse_mount, FAIL) - - /* Sanity check */ - HDassert(obj_loc); - - /* - * The loop is necessary because we might have file1 mounted at the root - * of file2, which is mounted somewhere in file3. - */ - do { - /* - * Use a binary search to find the potential mount point in the mount - * table for the parent - */ - lt = 0; - rt = parent->shared->mtab.nmounts; - cmp = -1; - while(lt < rt && cmp) { - md = (lt + rt) / 2; - oloc = H5G_oloc(parent->shared->mtab.child[md].group); - cmp = H5F_addr_cmp(obj_loc->oloc->addr, oloc->addr); - if(cmp < 0) - rt = md; - else - lt = md + 1; - } /* end while */ - - /* Copy root info over to ENT */ - 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: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_traverse_mount() */ - - -/*------------------------------------------------------------------------- - * Function: H5G_traverse_special + * Function: H5G__traverse_special * * Purpose: Handle traversing special link situations * @@ -440,13 +393,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5G_traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, +H5G__traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, unsigned target, size_t *nlinks, hbool_t last_comp, H5G_loc_t *obj_loc, hbool_t *obj_exists, hid_t lapl_id, hid_t dxpl_id) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5G_traverse_special, FAIL) + FUNC_ENTER_PACKAGE /* Sanity check */ HDassert(grp_loc); @@ -493,7 +446,7 @@ H5G_traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, */ if(H5F_addr_defined(obj_loc->oloc->addr) && (0 == (target & H5G_TARGET_MOUNT) || !last_comp)) { - if(H5G_traverse_mount(obj_loc/*in,out*/) < 0) + if(H5F_traverse_mount(obj_loc->oloc/*in,out*/) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "mount point traversal failed") } /* end if */ @@ -507,7 +460,7 @@ H5G_traverse_special(const H5G_loc_t *grp_loc, const H5O_link_t *lnk, done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5G_traverse_special() */ +} /* end H5G__traverse_special() */ /*------------------------------------------------------------------------- @@ -549,7 +502,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, hbool_t last_comp = FALSE; /* Flag to indicate that a component is the last component in the name */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT(H5G_traverse_real) + FUNC_ENTER_NOAPI_NOINIT /* Check parameters */ HDassert(_loc); @@ -608,7 +561,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't get actual buffer") /* Traverse the path */ - while((name = H5G_component(name, &nchars)) && *name) { + while((name = H5G__component(name, &nchars)) && *name) { const char *s; /* Temporary string pointer */ htri_t lookup_status; /* Status from object lookup */ hbool_t obj_exists; /* Whether the object exists */ @@ -629,7 +582,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, } /* end if */ /* Check if this is the last component of the name */ - if(!((s = H5G_component(name + nchars, NULL)) && *s)) + if(!((s = H5G__component(name + nchars, NULL)) && *s)) last_comp = TRUE; /* If there's valid information in the link, reset it */ @@ -639,7 +592,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, } /* end if */ /* Get information for object in current group */ - if((lookup_status = H5G_obj_lookup(grp_loc.oloc, comp, &lnk/*out*/, dxpl_id)) < 0) + if((lookup_status = H5G__obj_lookup(grp_loc.oloc, comp, &lnk/*out*/, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't look up component") obj_exists = FALSE; @@ -651,7 +604,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, link_valid = TRUE; /* Build object location from the link */ - if(H5G_link_to_loc(&grp_loc, &lnk, &obj_loc) < 0) + if(H5G__link_to_loc(&grp_loc, &lnk, &obj_loc) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "cannot initialize object location") obj_loc_valid = TRUE; @@ -660,7 +613,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, /* Perform any special traversals that the link needs */ /* (soft links, user-defined links, file mounting, etc.) */ - if(H5G_traverse_special(&grp_loc, &lnk, target, nlinks, last_comp, &obj_loc, &obj_exists, lapl_id, dxpl_id) < 0) + if(H5G__traverse_special(&grp_loc, &lnk, target, nlinks, last_comp, &obj_loc, &obj_exists, lapl_id, dxpl_id) < 0) HGOTO_ERROR(H5E_LINK, H5E_TRAVERSE, FAIL, "special link traversal failed") } /* end if */ @@ -726,7 +679,7 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, /* Check for the parent group having a link info message */ /* (OK if not found) */ /* Get the link info for parent group */ - if((exists = H5G_obj_get_linfo(grp_loc.oloc, &par_linfo, dxpl_id)) < 0) + if((exists = H5G__obj_get_linfo(grp_loc.oloc, &par_linfo, dxpl_id)) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to read object header") if(exists) { /* Only keep the creation order information from the parent @@ -762,11 +715,11 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, gcrt_info.gcpl_id = H5P_GROUP_CREATE_DEFAULT; gcrt_info.cache_type = H5G_NOTHING_CACHED; HDmemset(&gcrt_info.cache, 0, sizeof(gcrt_info.cache)); - if(H5G_obj_create_real(grp_oloc.file, dxpl_id, ginfo, linfo, pline, &gcrt_info, obj_loc.oloc/*out*/) < 0) + if(H5G__obj_create_real(grp_oloc.file, dxpl_id, ginfo, linfo, pline, &gcrt_info, obj_loc.oloc/*out*/) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create group entry") /* Insert new group into current group's symbol table */ - if(H5G_loc_insert(&grp_loc, comp, &obj_loc, H5O_TYPE_GROUP, &gcrt_info, dxpl_id) < 0) + if(H5G__loc_insert(&grp_loc, comp, &obj_loc, H5O_TYPE_GROUP, &gcrt_info, dxpl_id) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert intermediate group") /* Decrement refcount on intermediate group's object header in memory */ @@ -786,13 +739,16 @@ H5G_traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, /* Reset any non-default object header messages */ if(ginfo != &def_ginfo) - if(H5O_msg_reset(H5O_GINFO_ID, ginfo) < 0) + /* (Casting away const OK - QAK) */ + if(H5O_msg_reset(H5O_GINFO_ID, (void *)ginfo) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset group info message") if(linfo != &def_linfo) - if(H5O_msg_reset(H5O_LINFO_ID, linfo) < 0) + /* (Casting away const OK - QAK) */ + if(H5O_msg_reset(H5O_LINFO_ID, (void *)linfo) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset link info message") if(pline != &def_pline) - if(H5O_msg_reset(H5O_PLINE_ID, pline) < 0) + /* (Casting away const OK - QAK) */ + if(H5O_msg_reset(H5O_PLINE_ID, (void *)pline) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTRELEASE, FAIL, "unable to reset I/O pipeline message") } /* end if */ else @@ -879,7 +835,7 @@ H5G_traverse(const H5G_loc_t *loc, const char *name, unsigned target, H5G_traver H5P_genplist_t *lapl; /* Property list with value for nlinks */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5G_traverse, FAIL) + FUNC_ENTER_NOAPI(FAIL) /* Check args */ if(!name || !*name) |