summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRaymond Lu <songyulu@hdfgroup.org>2004-06-24 22:20:08 (GMT)
committerRaymond Lu <songyulu@hdfgroup.org>2004-06-24 22:20:08 (GMT)
commita89057a2cd6e1f939a0021244832fa4f635790bb (patch)
treea9f91881bb59ec76945b6fac50910e999ea3bea5 /src
parent705900b05cf7fc35de51991cd904629e53c983e9 (diff)
downloadhdf5-a89057a2cd6e1f939a0021244832fa4f635790bb.zip
hdf5-a89057a2cd6e1f939a0021244832fa4f635790bb.tar.gz
hdf5-a89057a2cd6e1f939a0021244832fa4f635790bb.tar.bz2
[svn-r8741] *** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/H5F.c39
-rw-r--r--src/H5Fpublic.h1
2 files changed, 40 insertions, 0 deletions
diff --git a/src/H5F.c b/src/H5F.c
index fca616d..a8f3f43 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -4704,3 +4704,42 @@ done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fget_freespace() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5Fget_filesize
+ *
+ * Purpose: Retrieves the file size of the HDF5 file. This function
+ * is called after an existing file is opened in order
+ * to learn the true size of the underlying file.
+ *
+ * Return: Success: File size
+ * Failure: Negative
+ *
+ * Programmer: David Pitt
+ * david.pitt@bigpond.com
+ * Apr 27, 2004
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+haddr_t
+H5Fget_filesize(hid_t file_id)
+{
+ H5F_t *file=NULL; /* File object for file ID */
+ haddr_t ret_value; /* Return value */
+
+ FUNC_ENTER_API(H5Fget_filesize, FAIL)
+ H5TRACE1("a","i",file_id);
+
+ /* 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 file size */
+ if((ret_value = H5FDget_eof(file->shared->lf))<0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Fget_filesize() */
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index 431f9bc..911bdff 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -113,6 +113,7 @@ H5_DLL herr_t H5Fget_vfd_handle(hid_t file_id, hid_t fapl, void** file_handle);
H5_DLL herr_t H5Fmount(hid_t loc, const char *name, hid_t child, hid_t plist);
H5_DLL herr_t H5Funmount(hid_t loc, const char *name);
H5_DLL hssize_t H5Fget_freespace(hid_t file_id);
+H5_DLL haddr_t H5Fget_filesize(hid_t file_id);
#ifdef __cplusplus
}