diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2008-08-29 20:44:11 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2008-08-29 20:44:11 (GMT) |
commit | c78dc8defa003eb2fe95dcae6fe115443cdcbffc (patch) | |
tree | d110b661509005e865690cf40bc10e07466b43b7 /src/H5EA.c | |
parent | 90e4c8770646a057dfc1efa88a64e219d65f31e0 (diff) | |
download | hdf5-c78dc8defa003eb2fe95dcae6fe115443cdcbffc.zip hdf5-c78dc8defa003eb2fe95dcae6fe115443cdcbffc.tar.gz hdf5-c78dc8defa003eb2fe95dcae6fe115443cdcbffc.tar.bz2 |
[svn-r15561] Description:
Update extensible array code with function to open an existing earray,
add more tests and avoid running the test when core/split/family/multi VFDs
are used.
Clean up fractal heap test code a bit and expand some of the tests a
little bit also.
Tested on:
Mac OS X/32 10.5.4 (amazon) in debug mode
Mac OS X/32 10.5.4 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'src/H5EA.c')
-rw-r--r-- | src/H5EA.c | 69 |
1 files changed, 69 insertions, 0 deletions
@@ -164,6 +164,75 @@ END_FUNC(PRIV) /* end H5EA_create() */ /*------------------------------------------------------------------------- + * Function: H5EA_open + * + * Purpose: Opens an existing extensible array in the file. + * + * Return: Pointer to array wrapper on success + * NULL on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 28 2008 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PRIV, ERR, +H5EA_t *, NULL, NULL, +H5EA_open(H5F_t *f, hid_t dxpl_id, haddr_t ea_addr)) + + /* Local variables */ + H5EA_t *ea = NULL; /* Pointer to new extensible array wrapper */ + H5EA_hdr_t *hdr = NULL; /* The extensible array header information */ + + /* + * Check arguments. + */ + HDassert(f); + HDassert(H5F_addr_defined(ea_addr)); + + /* Load the array header into memory */ +#ifdef QAK +HDfprintf(stderr, "%s: ea_addr = %a\n", FUNC, ea_addr); +#endif /* QAK */ + if(NULL == (hdr = (H5EA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, NULL, NULL, H5AC_READ))) + H5E_THROW(H5E_CANTPROTECT, "unable to load extensible array header, address = %llu", (unsigned long_long)ea_addr) + + /* Check for pending array deletion */ + if(hdr->pending_delete) + H5E_THROW(H5E_CANTOPENOBJ, "can't open extensible array pending deletion") + + /* Create fractal heap info */ + if(NULL == (ea = H5FL_MALLOC(H5EA_t))) + H5E_THROW(H5E_CANTALLOC, "memory allocation failed for extensible array info") + + /* Point extensible array wrapper at header */ + ea->hdr = hdr; + if(H5EA__hdr_incr(ea->hdr) < 0) + H5E_THROW(H5E_CANTINC, "can't increment reference count on shared array header") + + /* Increment # of files using this array header */ + if(H5EA__hdr_fuse_incr(ea->hdr) < 0) + H5E_THROW(H5E_CANTINC, "can't increment file reference count on shared array header") + + /* Set file pointer for this array open context */ + ea->f = f; + + /* Set the return value */ + ret_value = ea; + +CATCH + + if(hdr && H5AC_unprotect(f, dxpl_id, H5AC_EARRAY_HDR, ea_addr, hdr, H5AC__NO_FLAGS_SET) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to release extensible array header") + if(!ret_value) + if(ea && H5EA_close(ea, dxpl_id) < 0) + H5E_THROW(H5E_CLOSEERROR, "unable to close extensible array") + +END_FUNC(PRIV) /* end H5EA_open() */ + + +/*------------------------------------------------------------------------- * Function: H5EA_get_nelmts * * Purpose: Query the current number of elements in array |