diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-04-02 05:35:17 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-04-02 05:35:17 (GMT) |
commit | b24165b4d6229f81f68bd151862ae329ccfb1772 (patch) | |
tree | 896d25aadd74560b60195299f9ff6ffa94ccc990 | |
parent | 2b551d282f88e7e33baf11702016535f28a2ceab (diff) | |
download | hdf5-b24165b4d6229f81f68bd151862ae329ccfb1772.zip hdf5-b24165b4d6229f81f68bd151862ae329ccfb1772.tar.gz hdf5-b24165b4d6229f81f68bd151862ae329ccfb1772.tar.bz2 |
[svn-r18506] Description:
Bring r18505 from trunk to 1.8 branch:
Move code to free superblock data structure into separate routine, in
preparation for upcoming metadata journaling -> trunk merging.
Tested on:
FreeBD/32 6.3 (duty) w/debug
(h5committested on trunk)
-rw-r--r-- | src/H5Fpkg.h | 1 | ||||
-rw-r--r-- | src/H5Fsuper.c | 34 | ||||
-rw-r--r-- | src/H5Fsuper_cache.c | 15 |
3 files changed, 42 insertions, 8 deletions
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index 9318afe..09babd2 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -299,6 +299,7 @@ H5_DLL herr_t H5F_super_init(H5F_t *f, hid_t dxpl_id); H5_DLL herr_t H5F_super_read(H5F_t *f, hid_t dxpl_id); H5_DLL herr_t H5F_super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_info); +H5_DLL herr_t H5F_super_free(H5F_super_t *sblock); /* Superblock extension related routines */ H5_DLL herr_t H5F_super_ext_open(H5F_t *f, haddr_t ext_addr, H5O_loc_t *ext_ptr); diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 4373fa3..bb5ef3e 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -594,7 +594,8 @@ done: } /* end if */ else /* Free superblock */ - sblock = (H5F_super_t *)H5FL_FREE(H5F_super_t, sblock); + if(H5F_super_free(sblock) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "unable to destroy superblock") /* Reset variables in file structure */ f->shared->sblock = NULL; @@ -640,6 +641,37 @@ done: /*------------------------------------------------------------------------- + * Function: H5F_super_free + * + * Purpose: Destroyer the file's superblock + * + * Return: Success: non-negative on success + * Failure: Negative + * + * Programmer: Quincey Koziol + * April 1, 2010 + * + *------------------------------------------------------------------------- + */ +herr_t +H5F_super_free(H5F_super_t *sblock) +{ + FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_super_free) + + /* Sanity check */ + HDassert(sblock); + + /* Free root group symbol table entry, if any */ + sblock->root_ent = (H5G_entry_t *)H5MM_xfree(sblock->root_ent); + + /* Free superblock */ + sblock = (H5F_super_t *)H5FL_FREE(H5F_super_t, sblock); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* H5F_super_free() */ + + +/*------------------------------------------------------------------------- * Function: H5F_super_size * * Purpose: Get storage size of the superblock and superblock extension diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 91ca76d..1f19311 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -576,7 +576,7 @@ H5F_sblock_load(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, const void UNUSED done: /* Release the [possibly partially initialized] superblock on errors */ if(!ret_value && sblock) - if(H5F_sblock_dest(f, sblock) < 0) + if(H5F_super_free(sblock) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTFREE, NULL, "unable to destroy superblock data") FUNC_LEAVE_NOAPI(ret_value) @@ -803,18 +803,19 @@ done: static herr_t H5F_sblock_dest(H5F_t UNUSED *f, H5F_super_t* sblock) { - FUNC_ENTER_NOAPI_NOINIT_NOFUNC(H5F_sblock_dest) + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI_NOINIT(H5F_sblock_dest) /* Sanity check */ HDassert(sblock); - /* Free root group symbol table entry, if any */ - sblock->root_ent = (H5G_entry_t *)H5MM_xfree(sblock->root_ent); - /* Free superblock */ - sblock = (H5F_super_t *)H5FL_FREE(H5F_super_t, sblock); + if(H5F_super_free(sblock) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTFREE, FAIL, "unable to destroy superblock") - FUNC_LEAVE_NOAPI(SUCCEED) +done: + FUNC_LEAVE_NOAPI(ret_value) } /* end H5F_sblock_dest() */ |