summaryrefslogtreecommitdiffstats
path: root/src/H5Fsuper.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-08-14 15:42:11 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-08-14 15:42:11 (GMT)
commitd47fb4b7521f07f799221286358be99bd3bf6ffd (patch)
tree92c2481cb92a4b5bf953d40f359d575ff7f93d8c /src/H5Fsuper.c
parent92b37616d2a1ec34a2d7bd34d05c5f6466f7da53 (diff)
downloadhdf5-d47fb4b7521f07f799221286358be99bd3bf6ffd.zip
hdf5-d47fb4b7521f07f799221286358be99bd3bf6ffd.tar.gz
hdf5-d47fb4b7521f07f799221286358be99bd3bf6ffd.tar.bz2
[svn-r17359] Description:
Bring r17336 from trunk to 1.8 branch: Bring more changes from the file_free_space branch into the trunk. Tested on: FreeBSD/32 6.3 (duty) in debug mode (h5committested on trunk)
Diffstat (limited to 'src/H5Fsuper.c')
-rw-r--r--src/H5Fsuper.c58
1 files changed, 42 insertions, 16 deletions
diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c
index 72d1965..f5973e9 100644
--- a/src/H5Fsuper.c
+++ b/src/H5Fsuper.c
@@ -1134,8 +1134,9 @@ done:
/*-------------------------------------------------------------------------
- * Function: H5F_super_ext_size
- * Get storage size of the superblock extension
+ * Function: H5F_super_size
+ *
+ * Purpose: Get storage size of the superblock and superblock extension
*
* Return: Success: non-negative on success
* Failure: Negative
@@ -1145,33 +1146,58 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F_super_ext_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_ext_size)
+H5F_super_size(H5F_t *f, hid_t dxpl_id, hsize_t *super_size, hsize_t *super_ext_size)
{
- H5O_loc_t ext_loc; /* "Object location" for superblock extension */
- H5O_info_t oinfo; /* Object info for superblock extension */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(H5F_super_ext_size, FAIL)
+ FUNC_ENTER_NOAPI(H5F_super_size, FAIL)
/* Sanity check */
HDassert(f);
- HDassert(super_ext_size);
- /* Set up "fake" object location for superblock extension */
- H5O_loc_reset(&ext_loc);
- ext_loc.file = f;
- ext_loc.addr = f->shared->extension_addr;
+ /* Set the superblock size */
+ if(super_size) {
+ H5P_genplist_t *plist; /* File creation property list */
+ unsigned super_vers; /* Superblock version */
+
+ /* Get the shared file creation property list */
+ if(NULL == (plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+
+ /* Grab values from property list */
+ if(H5P_get(plist, H5F_CRT_SUPER_VERS_NAME, &super_vers) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get superblock version")
- /* Get object header info for superblock extension */
- if(H5O_get_info(&ext_loc, dxpl_id, FALSE, &oinfo) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info")
+ /* Set the superblock size */
+ *super_size = H5F_SUPERBLOCK_SIZE(super_vers, f);
+ } /* end if */
/* Set the superblock extension size */
- *super_ext_size = oinfo.hdr.space.total;
+ if(super_ext_size) {
+ if(H5F_addr_defined(f->shared->extension_addr)) {
+ H5O_loc_t ext_loc; /* "Object location" for superblock extension */
+ H5O_info_t oinfo; /* Object info for superblock extension */
+
+ /* Set up "fake" object location for superblock extension */
+ H5O_loc_reset(&ext_loc);
+ ext_loc.file = f;
+ ext_loc.addr = f->shared->extension_addr;
+
+ /* Get object header info for superblock extension */
+ if(H5O_get_info(&ext_loc, dxpl_id, FALSE, &oinfo) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve superblock extension info")
+
+ /* Set the superblock extension size */
+ *super_ext_size = oinfo.hdr.space.total;
+ } /* end if */
+ else
+ /* Set the superblock extension size to zero */
+ *super_ext_size = (hsize_t)0;
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5F_super_ext_size() */
+} /* H5F_super_size() */
/*-------------------------------------------------------------------------