diff options
Diffstat (limited to 'src/H5FAhdr.c')
-rw-r--r-- | src/H5FAhdr.c | 68 |
1 files changed, 66 insertions, 2 deletions
diff --git a/src/H5FAhdr.c b/src/H5FAhdr.c index 23a554a..23c20bc 100644 --- a/src/H5FAhdr.c +++ b/src/H5FAhdr.c @@ -148,7 +148,7 @@ H5FA__hdr_init(H5FA_hdr_t *hdr, void *ctx_udata)) HDassert(hdr); /* Set size of header on disk (locally and in statistics) */ - hdr->stats.hdr_size = hdr->size = H5FA_HEADER_SIZE(hdr); + hdr->stats.hdr_size = hdr->size = H5FA_HEADER_SIZE_HDR(hdr); /* Set number of elements for Fixed Array in statistics */ hdr->stats.nelmts = hdr->cparam.nelmts; @@ -393,6 +393,70 @@ END_FUNC(PKG) /* end H5FA__hdr_modified() */ /*------------------------------------------------------------------------- + * Function: H5FA__hdr_protect + * + * Purpose: Convenience wrapper around protecting fixed array header + * + * Return: Non-NULL pointer to index block on success/NULL on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 12 2013 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PKG, ERR, +H5FA_hdr_t *, NULL, NULL, +H5FA__hdr_protect(H5F_t *f, hid_t dxpl_id, haddr_t fa_addr, void *ctx_udata, + H5AC_protect_t rw)) + + /* Local variables */ + + /* Sanity check */ + HDassert(f); + HDassert(H5F_addr_defined(fa_addr)); + + /* Protect the header */ + if(NULL == (ret_value = (H5FA_hdr_t *)H5AC_protect(f, dxpl_id, H5AC_FARRAY_HDR, fa_addr, ctx_udata, rw))) + H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array header, address = %llu", (unsigned long long)fa_addr) + +CATCH + +END_FUNC(PKG) /* end H5FA__hdr_protect() */ + + +/*------------------------------------------------------------------------- + * Function: H5FA__hdr_unprotect + * + * Purpose: Convenience wrapper around unprotecting fixed array header + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * koziol@hdfgroup.org + * Aug 12 2013 + * + *------------------------------------------------------------------------- + */ +BEGIN_FUNC(PKG, ERR, +herr_t, SUCCEED, FAIL, +H5FA__hdr_unprotect(H5FA_hdr_t *hdr, hid_t dxpl_id, unsigned cache_flags)) + + /* Local variables */ + + /* Sanity check */ + HDassert(hdr); + + /* Unprotect the header */ + if(H5AC_unprotect(hdr->f, dxpl_id, H5AC_FARRAY_HDR, hdr->addr, hdr, cache_flags) < 0) + H5E_THROW(H5E_CANTUNPROTECT, "unable to unprotect fixed array hdr, address = %llu", (unsigned long long)hdr->addr) + +CATCH + +END_FUNC(PKG) /* end H5EA__hdr_unprotect() */ + + +/*------------------------------------------------------------------------- * Function: H5FA__hdr_delete * * Purpose: Delete a fixed array, starting with the header @@ -436,7 +500,7 @@ HDfprintf(stderr, "%s: hdr->dblk_addr = %a\n", FUNC, hdr->dblk_addr); #endif /* H5FA_DEBUG */ /* Delete Fixed Array Data block */ - if(H5FA__dblock_delete(hdr, dxpl_id, hdr->dblk_addr, hdr->cparam.nelmts) < 0) + if(H5FA__dblock_delete(hdr, dxpl_id, hdr->dblk_addr) < 0) H5E_THROW(H5E_CANTDELETE, "unable to delete fixed array data block") } /* end if */ |