summaryrefslogtreecommitdiffstats
path: root/src/H5F.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-10-07 13:32:32 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-10-07 13:32:32 (GMT)
commitf766b32d07fae4562e95b9166255c35c8f3e467a (patch)
tree59aa2706ca5c91e1ac4c314a9de9b48f8979dc40 /src/H5F.c
parent259247fc328fa17b705fc16ab8e004d8c5814ea8 (diff)
downloadhdf5-f766b32d07fae4562e95b9166255c35c8f3e467a.zip
hdf5-f766b32d07fae4562e95b9166255c35c8f3e467a.tar.gz
hdf5-f766b32d07fae4562e95b9166255c35c8f3e467a.tar.bz2
[svn-r7559] 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 a3feb92..4148f62 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -4498,3 +4498,42 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5F_sieve_overlap_clear() */
+
+/*-------------------------------------------------------------------------
+ * 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() */
+