summaryrefslogtreecommitdiffstats
path: root/src/H5G.c
diff options
context:
space:
mode:
authorBill Wendling <wendling@ncsa.uiuc.edu>2003-09-18 19:27:27 (GMT)
committerBill Wendling <wendling@ncsa.uiuc.edu>2003-09-18 19:27:27 (GMT)
commitfec0297f869e1f34bd4bb4fc0cb91ac403b73ccb (patch)
treee56930c56bd7f8ad7058bf5438dbe8b8da36c00e /src/H5G.c
parent2e3693aa8be42bfd1d30adda1dd3b278c9d450ec (diff)
downloadhdf5-fec0297f869e1f34bd4bb4fc0cb91ac403b73ccb.zip
hdf5-fec0297f869e1f34bd4bb4fc0cb91ac403b73ccb.tar.gz
hdf5-fec0297f869e1f34bd4bb4fc0cb91ac403b73ccb.tar.bz2
[svn-r7489] Purpose:
Update Description: A lot of modifications for the FPHDF5 stuff: H5AC.c H5ACprivate.h - Removed AC_find (it's replaced with AC_protect and AC_unprotect). Added flushing if it's an FPHDF5 driver and we're doing an AC_set or AC_unprotect with the dirty flag set. H5B.c - Split up the B_flush function into different functions since the one function was doing serialization which is better left as a separate entity. H5D.c - Removed some FPHDF5 code that was incorrect H5F.c - Split up the F_flush function so that it no longer allocates file space. Created new functions (F_init_superblock, F_read_superblock, and F_write_superblock) for greater modularity and so that the FPHDF5 non-captain processes can read the superblock after the captain process writes it. H5FD.c - Error message correction. H5FDfphdf5.c - Removed MPI barrier call that wasn't needed. H5FPclient.c H5FPserver.c - Modified so that if a process requests data that isn't exactly aligned, we can return it if we have the block that contains the requested address. H5G.c H5Gent.c H5Gnode.c H5HL.c H5HLpkg.h H5HLprivate.h H5Oefl.c - Removed the H5HL_peek function since it was doing a (now unsafe) holding of the information in the cache. Replaced with protect and unprotect calls. H5TB.c - Error fix. The TB_dless function wasn't working properly. H5Gstab.c - Format change. H5err.txt H5Edefin.h H5Einit.h H5Epubgen.h H5Eterm.h - Added new error code. Platforms tested: Modi4 (paralle, Fortran) Sol (Fortran) Linux (C++, Fortran) Copper (Parallel, Fortran) Misc. update:
Diffstat (limited to 'src/H5G.c')
-rw-r--r--src/H5G.c50
1 files changed, 37 insertions, 13 deletions
diff --git a/src/H5G.c b/src/H5G.c
index cf38421..4c79db8 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -102,6 +102,8 @@
#include "H5MMprivate.h" /* Memory management */
#include "H5Oprivate.h" /* Object headers */
+#include "H5FPprivate.h" /*FPHDF5 */
+
/* Local macros */
#define H5G_INIT_HEAP 8192
#define H5G_RESERVED_ATOMS 0
@@ -1521,7 +1523,6 @@ done:
/* If we started with a NULL grp_ent and we copied something into it, free the entry information */
if(null_grp && group_copy)
H5G_free_ent_name(grp_ent);
-
FUNC_LEAVE_NOAPI(ret_value);
}
@@ -1559,6 +1560,7 @@ H5G_traverse_slink (H5G_entry_t *grp_ent/*in,out*/,
char *linkval = NULL; /*the copied link value */
H5G_entry_t tmp_grp_ent; /* Temporary copy of group entry */
H5RS_str_t *tmp_user_path_r=NULL, *tmp_canon_path_r=NULL; /* Temporary pointer to object's user path & canonical path */
+ H5HL_t *heap;
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_traverse_slink, FAIL);
@@ -1569,10 +1571,17 @@ H5G_traverse_slink (H5G_entry_t *grp_ent/*in,out*/,
/* Get the link value */
if (NULL==H5O_read (grp_ent, H5O_STAB_ID, 0, &stab_mesg, dxpl_id))
HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "unable to determine local heap address");
- if (NULL==(clv=H5HL_peek (grp_ent->file, dxpl_id, stab_mesg.heap_addr,
- obj_ent->cache.slink.lval_offset)))
- HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read symbolic link value");
+
+ if (NULL == (heap = H5HL_protect(grp_ent->file, dxpl_id, stab_mesg.heap_addr)))
+ HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read protect link value")
+
+ clv = H5HL_offset_into(grp_ent->file, heap, obj_ent->cache.slink.lval_offset);
+
linkval = H5MM_xstrdup (clv);
+ assert(linkval);
+
+ if (H5HL_unprotect(grp_ent->file, dxpl_id, heap, stab_mesg.heap_addr) < 0)
+ HGOTO_ERROR (H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read unprotect link value")
/* Hold the entry's name (& old_name) to restore later */
tmp_user_path_r=obj_ent->user_path_r;
@@ -2508,17 +2517,26 @@ H5G_get_objinfo (H5G_entry_t *loc, const char *name, hbool_t follow_link,
*/
if (statbuf) {
if (H5G_CACHED_SLINK==obj_ent.type) {
+ H5HL_t *heap;
+
/* Named object is a symbolic link */
- if (NULL==H5O_read (&grp_ent, H5O_STAB_ID, 0, &stab_mesg, dxpl_id) ||
- NULL==(s=H5HL_peek (grp_ent.file, dxpl_id, stab_mesg.heap_addr,
- obj_ent.cache.slink.lval_offset)))
- HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "unable to read symbolic link value");
- statbuf->linklen = HDstrlen(s)+1; /*count the null terminator*/
+ if (NULL == H5O_read(&grp_ent, H5O_STAB_ID, 0, &stab_mesg, dxpl_id))
+ HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to read symbolic link value")
+
+ if (NULL == (heap = H5HL_protect(grp_ent.file, dxpl_id, stab_mesg.heap_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read protect link value")
+
+ s = H5HL_offset_into(grp_ent.file, heap, obj_ent.cache.slink.lval_offset);
+
+ statbuf->linklen = HDstrlen(s) + 1; /*count the null terminator*/
+
+ if (H5HL_unprotect(grp_ent.file, dxpl_id, heap, stab_mesg.heap_addr) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read unprotect link value")
+
statbuf->objno = 0;
statbuf->nlink = 0;
statbuf->type = H5G_LINK;
statbuf->mtime = 0;
-
} else {
/* Some other type of object */
statbuf->objno = obj_ent.header;
@@ -2725,6 +2743,7 @@ H5G_linkval (H5G_entry_t *loc, const char *name, size_t size, char *buf/*out*/,
const char *s = NULL;
H5G_entry_t grp_ent, obj_ent;
H5O_stab_t stab_mesg;
+ H5HL_t *heap;
herr_t ret_value=SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(H5G_linkval, FAIL);
@@ -2745,14 +2764,19 @@ H5G_linkval (H5G_entry_t *loc, const char *name, size_t size, char *buf/*out*/,
*/
if (NULL==H5O_read (&grp_ent, H5O_STAB_ID, 0, &stab_mesg, dxpl_id))
HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "unable to determine local heap address");
- if (NULL==(s=H5HL_peek (grp_ent.file, dxpl_id, stab_mesg.heap_addr,
- obj_ent.cache.slink.lval_offset)))
- HGOTO_ERROR (H5E_SYM, H5E_CANTINIT, FAIL, "unable to read symbolic link value");
+
+ if (NULL == (heap = H5HL_protect(grp_ent.file, dxpl_id, stab_mesg.heap_addr)))
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read protect link value")
+ s = H5HL_offset_into(grp_ent.file, heap, obj_ent.cache.slink.lval_offset);
+
/* Copy to output buffer */
if (size>0 && buf)
HDstrncpy (buf, s, size);
+ if (H5HL_unprotect(grp_ent.file, dxpl_id, heap, stab_mesg.heap_addr) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read unprotect link value")
+
done:
/* Free the ID to name buffers */
H5G_free_ent_name(&grp_ent);