diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2009-08-15 06:26:08 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2009-08-15 06:26:08 (GMT) |
commit | 173083e1a5c9696be01bd983dd8c9bb87eb5a433 (patch) | |
tree | c8c4aa2dd961d18b48d0c734da3e16ea107e6c6f /src/H5Gent.c | |
parent | ec7ca0dea2fba8071ce57e4f61d685c3e4d0d111 (diff) | |
download | hdf5-173083e1a5c9696be01bd983dd8c9bb87eb5a433.zip hdf5-173083e1a5c9696be01bd983dd8c9bb87eb5a433.tar.gz hdf5-173083e1a5c9696be01bd983dd8c9bb87eb5a433.tar.bz2 |
[svn-r17365] Description:
Final merge of changes from sblock_mdc branch back to trunk. The superblock is now managed by the metadata cache.
Tested on:
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
Mac OS X/32 10.5.8 (amazon) in debug mode
Mac OS X/32 10.5.8 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'src/H5Gent.c')
-rw-r--r-- | src/H5Gent.c | 133 |
1 files changed, 55 insertions, 78 deletions
diff --git a/src/H5Gent.c b/src/H5Gent.c index 7a9e9e5..65f302c 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -28,15 +28,10 @@ #include "H5FLprivate.h" /* Free Lists */ #include "H5Gpkg.h" /* Groups */ #include "H5HLprivate.h" /* Local Heaps */ -#include "H5Iprivate.h" /* IDs */ -#include "H5MMprivate.h" /* Memory Management */ /* Private macros */ /* Private prototypes */ -static herr_t H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent); -static herr_t H5G_ent_decode(H5F_t *f, const uint8_t **pp, - H5G_entry_t *ent/*out*/); /* Declare extern the PQ free list for the wrapped strings */ H5FL_BLK_EXTERN(str_buf); @@ -48,9 +43,6 @@ H5FL_BLK_EXTERN(str_buf); * Purpose: Same as H5G_ent_decode() except it does it for an array of * symbol table entries. * - * Errors: - * SYM CANTDECODE Can't decode. - * * Return: Success: Non-negative, with *pp pointing to the first byte * after the last symbol. * @@ -60,31 +52,29 @@ H5FL_BLK_EXTERN(str_buf); * matzke@llnl.gov * Jul 18 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t H5G_ent_decode_vec(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent, unsigned n) { - unsigned u; - herr_t ret_value=SUCCEED; /* Return value */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5G_ent_decode_vec, FAIL); + FUNC_ENTER_NOAPI(H5G_ent_decode_vec, FAIL) /* check arguments */ - assert(f); - assert(pp); - assert(ent); + HDassert(f); + HDassert(pp); + HDassert(ent); /* decode entries */ - for (u = 0; u < n; u++) - if (H5G_ent_decode(f, pp, ent + u) < 0) + for(u = 0; u < n; u++) + if(H5G_ent_decode(f, pp, ent + u) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode") done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_ent_decode_vec() */ /*------------------------------------------------------------------------- @@ -92,8 +82,6 @@ done: * * Purpose: Decodes a symbol table entry pointed to by `*pp'. * - * Errors: - * * Return: Success: Non-negative with *pp pointing to the first byte * following the symbol table entry. * @@ -103,25 +91,23 @@ done: * matzke@llnl.gov * Jul 18 1997 * - * Modifications: - * Robb Matzke, 17 Jul 1998 - * Added a 4-byte padding field for alignment and future expansion. - * *------------------------------------------------------------------------- */ -static herr_t +herr_t H5G_ent_decode(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent) { const uint8_t *p_ret = *pp; uint32_t tmp; + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_ent_decode) + FUNC_ENTER_NOAPI(H5G_ent_decode, FAIL) /* check arguments */ HDassert(f); HDassert(pp); HDassert(ent); + /* Set the entry's file pointer */ ent->file = f; /* decode header */ @@ -129,31 +115,31 @@ H5G_ent_decode(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent) H5F_addr_decode(f, pp, &(ent->header)); UINT32DECODE(*pp, tmp); *pp += 4; /*reserved*/ - ent->type=(H5G_cache_type_t)tmp; + ent->type = (H5G_cache_type_t)tmp; /* decode scratch-pad */ - switch (ent->type) { + switch(ent->type) { case H5G_NOTHING_CACHED: break; case H5G_CACHED_STAB: - assert(2 * H5F_SIZEOF_ADDR(f) <= H5G_SIZEOF_SCRATCH); + HDassert(2 * H5F_SIZEOF_ADDR(f) <= H5G_SIZEOF_SCRATCH); H5F_addr_decode(f, pp, &(ent->cache.stab.btree_addr)); H5F_addr_decode(f, pp, &(ent->cache.stab.heap_addr)); break; case H5G_CACHED_SLINK: - UINT32DECODE (*pp, ent->cache.slink.lval_offset); + UINT32DECODE(*pp, ent->cache.slink.lval_offset); break; default: - /* Error or unknown type. Bail out. */ - return -1; - } + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unknown symbol table entry cache type") + } /* end switch */ *pp = p_ret + H5G_SIZEOF_ENTRY(f); - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5G_ent_decode() */ @@ -163,9 +149,6 @@ H5G_ent_decode(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent) * Purpose: Same as H5G_ent_encode() except it does it for an array of * symbol table entries. * - * Errors: - * SYM CANTENCODE Can't encode. - * * Return: Success: Non-negative, with *pp pointing to the first byte * after the last symbol. * @@ -175,31 +158,29 @@ H5G_ent_decode(H5F_t *f, const uint8_t **pp, H5G_entry_t *ent) * matzke@llnl.gov * Jul 18 1997 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t H5G_ent_encode_vec(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent, unsigned n) { - unsigned u; - herr_t ret_value=SUCCEED; /* Return value */ + unsigned u; /* Local index variable */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI(H5G_ent_encode_vec, FAIL); + FUNC_ENTER_NOAPI(H5G_ent_encode_vec, FAIL) /* check arguments */ - assert(f); - assert(pp); - assert(ent); + HDassert(f); + HDassert(pp); + HDassert(ent); /* encode entries */ - for (u = 0; u < n; u++) - if (H5G_ent_encode(f, pp, ent + u) < 0) - HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't encode"); + for(u = 0; u < n; u++) + if(H5G_ent_encode(f, pp, ent + u) < 0) + HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't encode") done: - FUNC_LEAVE_NOAPI(ret_value); -} + FUNC_LEAVE_NOAPI(ret_value) +} /* H5G_ent_encode_vec() */ /*------------------------------------------------------------------------- @@ -208,8 +189,6 @@ done: * Purpose: Encodes the specified symbol table entry into the buffer * pointed to by *pp. * - * Errors: - * * Return: Success: Non-negative, with *pp pointing to the first byte * after the symbol table entry. * @@ -219,26 +198,22 @@ done: * matzke@llnl.gov * Jul 18 1997 * - * Modifications: - * - * Robb Matzke, 8 Aug 1997 - * Writes zeros for the bytes that aren't used so the file doesn't - * contain junk. - * *------------------------------------------------------------------------- */ -static herr_t -H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent) +herr_t +H5G_ent_encode(const H5F_t *f, uint8_t **pp, const H5G_entry_t *ent) { - uint8_t *p_ret = *pp + H5G_SIZEOF_ENTRY(f); + uint8_t *p_ret = *pp + H5G_SIZEOF_ENTRY(f); + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5G_ent_encode); + FUNC_ENTER_NOAPI(H5G_ent_encode, FAIL) /* check arguments */ - assert(f); - assert(pp); + HDassert(f); + HDassert(pp); - if (ent) { + /* Check for actual entry to encode */ + if(ent) { /* encode header */ H5F_ENCODE_LENGTH(f, *pp, ent->name_off); H5F_addr_encode(f, pp, ent->header); @@ -246,37 +221,39 @@ H5G_ent_encode(H5F_t *f, uint8_t **pp, const H5G_entry_t *ent) UINT32ENCODE(*pp, 0); /*reserved*/ /* encode scratch-pad */ - switch (ent->type) { + switch(ent->type) { case H5G_NOTHING_CACHED: break; case H5G_CACHED_STAB: - assert(2 * H5F_SIZEOF_ADDR(f) <= H5G_SIZEOF_SCRATCH); + HDassert(2 * H5F_SIZEOF_ADDR(f) <= H5G_SIZEOF_SCRATCH); H5F_addr_encode(f, pp, ent->cache.stab.btree_addr); H5F_addr_encode(f, pp, ent->cache.stab.heap_addr); break; case H5G_CACHED_SLINK: - UINT32ENCODE (*pp, ent->cache.slink.lval_offset); + UINT32ENCODE(*pp, ent->cache.slink.lval_offset); break; default: - /* Unknown cached type. Bail out. */ - return -1; - } - } else { + HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "unknown symbol table entry cache type") + } /* end switch */ + } /* end if */ + else { H5F_ENCODE_LENGTH(f, *pp, 0); H5F_addr_encode(f, pp, HADDR_UNDEF); UINT32ENCODE(*pp, H5G_NOTHING_CACHED); UINT32ENCODE(*pp, 0); /*reserved*/ - } + } /* end else */ /* fill with zero */ - while (*pp < p_ret) *(*pp)++ = 0; + while(*pp < p_ret) + *(*pp)++ = 0; *pp = p_ret; - FUNC_LEAVE_NOAPI(SUCCEED); -} +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5G_ent_encode() */ /*------------------------------------------------------------------------- |