summaryrefslogtreecommitdiffstats
path: root/src/H5F.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-08-06 21:32:33 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-08-06 21:32:33 (GMT)
commitacd04a1aa67b182623f26979515ab8dd5b978f11 (patch)
tree7a65e24c03e9e2d7db021e6f89603f5bab458a78 /src/H5F.c
parentde875442351b3ddd204b65d371536e63de6be8ff (diff)
downloadhdf5-acd04a1aa67b182623f26979515ab8dd5b978f11.zip
hdf5-acd04a1aa67b182623f26979515ab8dd5b978f11.tar.gz
hdf5-acd04a1aa67b182623f26979515ab8dd5b978f11.tar.bz2
[svn-r579] Changes since 19980806
---------------------- ./config/solaris2.5 Hopefully set up now so it honors the CC and CFLAGS variables and understands solaris cc flags. ./test/big.c Checks to see if creating lots of large sparse files exceeds the user disk quota and skips the test. It also checks that we can actually open ~64 files at once. ./doc/html/Files.html ./src/H5A.c ./src/H5Aprivate.h ./src/H5F.c ./src/H5Fpublic.h Added the H5Fflush() function which takes any object as an argument as long as the object is in some way associated with a file. This required an H5A_entof() ./src/H5.c ./src/H5Flow.c The `%a' format of HDfprintf() now allows a field width and justification flag etc, like the other formats. The old H5F_addr_print() was recoded to call HDfprintf() instead of vice versa.
Diffstat (limited to 'src/H5F.c')
-rw-r--r--src/H5F.c103
1 files changed, 102 insertions, 1 deletions
diff --git a/src/H5F.c b/src/H5F.c
index 5bacfef..b04b162 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -38,7 +38,9 @@ static char RcsId[] = "@(#)$Revision$";
/* Packages needed by this file... */
#include <H5private.h> /*library functions */
-#include <H5Iprivate.h> /* IDs */
+#include <H5Aprivate.h> /*attributes */
+#include <H5Dprivate.h> /*datasets */
+#include <H5Iprivate.h> /*object IDs */
#include <H5ACprivate.h> /*cache */
#include <H5Eprivate.h> /*error handling */
#include <H5Gprivate.h> /*symbol tables */
@@ -1287,6 +1289,105 @@ H5Fopen (const char *filename, unsigned flags, hid_t access_id)
FUNC_LEAVE(ret_value);
}
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5Fflush
+ *
+ * Purpose: Flushes all outstanding buffers of a file to disk but does
+ * not remove them from the cache. The OBJECT_ID can be a file,
+ * dataset, group, attribute, or named data type.
+ *
+ * Return: Success: SUCCEED
+ *
+ * Failure: FAIL
+ *
+ * Programmer: Robb Matzke
+ * Thursday, August 6, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Fflush (hid_t object_id)
+{
+ H5F_t *f = NULL;
+ H5G_t *grp = NULL;
+ H5T_t *type = NULL;
+ H5D_t *dset = NULL;
+ H5A_t *attr = NULL;
+ H5G_entry_t *ent = NULL;
+
+ FUNC_ENTER(H5Fflush, FAIL);
+ H5TRACE1("e","i",object_id);
+
+ switch (H5I_group(object_id)) {
+ case H5_FILE:
+ if (NULL==(f=H5I_object(object_id))) {
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
+ "invalid file identifier");
+ }
+ break;
+
+ case H5_GROUP:
+ if (NULL==(grp=H5I_object(object_id))) {
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
+ "invalid group identifier");
+ }
+ ent = H5G_entof(grp);
+ break;
+
+ case H5_DATATYPE:
+ if (NULL==(type=H5I_object(object_id))) {
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
+ "invalid type identifier");
+ }
+ ent = H5T_entof(type);
+ break;
+
+ case H5_DATASET:
+ if (NULL==(dset=H5I_object(object_id))) {
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
+ "invalid dataset identifier");
+ }
+ ent = H5D_entof(dset);
+ break;
+
+ case H5_ATTR:
+ if (NULL==(attr=H5I_object(object_id))) {
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
+ "invalid attribute identifier");
+ }
+ ent = H5A_entof(attr);
+ break;
+
+ default:
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
+ "not a file or file object");
+ }
+
+ if (!f) {
+ if (!ent) {
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
+ "object is not assocated with a file");
+ }
+ f = ent->file;
+ }
+ if (!f) {
+ HRETURN_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
+ "object is not associated with a file");
+ }
+
+ /* Flush the file */
+ if (H5F_flush(f, FALSE)<0) {
+ HRETURN_ERROR(H5E_FILE, H5E_CANTINIT, FAIL,
+ "flush failed");
+ }
+
+ FUNC_LEAVE(SUCCEED);
+}
+
/*-------------------------------------------------------------------------
* Function: H5F_flush