summaryrefslogtreecommitdiffstats
path: root/src/H5F.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-10-07 13:57:18 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-10-07 13:57:18 (GMT)
commita5d1c5c576a7a26ef78dfb4715c2b1f2cbcced3a (patch)
treed7b9efd00dc6a81b4312d75a64e09ba13e93d052 /src/H5F.c
parent4ee4926dbde7184de260f507cc42afb4738c0f82 (diff)
downloadhdf5-a5d1c5c576a7a26ef78dfb4715c2b1f2cbcced3a.zip
hdf5-a5d1c5c576a7a26ef78dfb4715c2b1f2cbcced3a.tar.gz
hdf5-a5d1c5c576a7a26ef78dfb4715c2b1f2cbcced3a.tar.bz2
[svn-r7560] Purpose:
Add feature Description: Add H5Fget_freespace() routine, to check the amount of free space in a file. This information is only valid until the file is closed currently, however (until we start recording the free space information in the file itself). Platforms tested: FreeBSD 4.9 (sleipnir) h5committest
Diffstat (limited to 'src/H5F.c')
-rw-r--r--src/H5F.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/H5F.c b/src/H5F.c
index 44e56fb..279ff19 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -4302,6 +4302,45 @@ done:
/*-------------------------------------------------------------------------
+ * Function: H5Fget_freespace
+ *
+ * Purpose: Retrieves the amount of free space (of a given type) in the
+ * file. If TYPE is 'H5FD_MEM_DEFAULT', then the amount of free
+ * space for all types is returned.
+ *
+ * Return: Success: Amount of free space for type
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Oct 6, 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+hssize_t
+H5Fget_freespace(hid_t file_id)
+{
+ H5F_t *file=NULL; /* File object for file ID */
+ hssize_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(H5Fget_freespace, FAIL)
+
+ /* Check args */
+ if(NULL==(file=H5I_object_verify(file_id, H5I_FILE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
+
+ /* Go get the actual amount of free space in the file */
+ if((ret_value = H5FD_get_freespace(file->shared->lf))<0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Fget_freespace() */
+
+
+/*-------------------------------------------------------------------------
* Function: H5F_debug
*
* Purpose: Prints a file header to the specified stream. Each line