summaryrefslogtreecommitdiffstats
path: root/src/H5Fsuper.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-08-12 01:39:05 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-08-12 01:39:05 (GMT)
commit7dc66a568566bd47d09a47f8e77c716d8dd792e1 (patch)
tree735ba719918fd411995ee7e3e0eba54e161a16f6 /src/H5Fsuper.c
parent1f34be9bba199eab8a21b14db0f5d8a7f7cc9ea8 (diff)
downloadhdf5-7dc66a568566bd47d09a47f8e77c716d8dd792e1.zip
hdf5-7dc66a568566bd47d09a47f8e77c716d8dd792e1.tar.gz
hdf5-7dc66a568566bd47d09a47f8e77c716d8dd792e1.tar.bz2
[svn-r17336] Description:
Bring more changes from the file_free_space branch into the trunk. 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 Linux/64-amd64 2.6 (abe) 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/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() */
/*-------------------------------------------------------------------------