summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5F.c27
-rw-r--r--src/H5FD.c12
-rw-r--r--src/H5FDcore.c6
-rw-r--r--src/H5FDfamily.c6
-rw-r--r--src/H5FDlog.c6
-rw-r--r--src/H5FDmpio.c41
-rw-r--r--src/H5FDmpio.h1
-rw-r--r--src/H5FDmulti.c8
-rw-r--r--src/H5FDprivate.h2
-rw-r--r--src/H5FDpublic.h4
-rw-r--r--src/H5FDsec2.c6
-rw-r--r--src/H5FDsrb.c4
-rw-r--r--src/H5FDstdio.c12
-rw-r--r--src/H5FDstream.c6
14 files changed, 54 insertions, 87 deletions
diff --git a/src/H5F.c b/src/H5F.c
index 7943b5e..5695a8b 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -65,7 +65,7 @@ typedef struct H5F_olist_t {
static H5F_t *H5F_new(H5F_file_t *shared, hid_t fcpl_id, hid_t fapl_id);
static herr_t H5F_dest(H5F_t *f);
static herr_t H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate,
- hbool_t alloc_only);
+ hbool_t alloc_only, hbool_t closing);
static haddr_t H5F_locate_signature(H5FD_t *file);
static int H5F_flush_all_cb(H5F_t *f, hid_t fid, const void *_invalidate);
static herr_t H5F_get_obj_count(H5F_t *f, unsigned types,
@@ -631,7 +631,7 @@ static int
H5F_flush_all_cb(H5F_t *f, hid_t UNUSED fid, const void *_invalidate)
{
hbool_t invalidate = *((const hbool_t*)_invalidate);
- H5F_flush(f, H5F_SCOPE_LOCAL, invalidate, FALSE);
+ H5F_flush(f, H5F_SCOPE_LOCAL, invalidate, FALSE, FALSE);
return 0;
}
@@ -1747,7 +1747,7 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
shared->boot_addr = userblock_size;
shared->base_addr = shared->boot_addr;
shared->consist_flags = 0x03;
- if (H5F_flush(file, H5F_SCOPE_LOCAL, FALSE, TRUE)<0)
+ if (H5F_flush(file, H5F_SCOPE_LOCAL, FALSE, TRUE,FALSE)<0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "unable to write file superblock");
/* Create and open the root group */
@@ -2222,7 +2222,7 @@ H5Fflush(hid_t object_id, H5F_scope_t scope)
}
/* Flush the file */
- if (H5F_flush(f, scope, FALSE, FALSE)<0) {
+ if (H5F_flush(f, scope, FALSE, FALSE, FALSE)<0) {
HRETURN_ERROR(H5E_FILE, H5E_CANTINIT, FAIL,
"flush failed");
}
@@ -2267,12 +2267,15 @@ H5Fflush(hid_t object_id, H5F_scope_t scope)
*
* Raymond Lu, 2001-10-14
* Changed to new generic property list.
+ *
+ * Quincey Koziol, 2002-05-20
+ * Added 'closing' parameter
*
*-------------------------------------------------------------------------
*/
static herr_t
H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate,
- hbool_t alloc_only)
+ hbool_t alloc_only, hbool_t closing)
{
uint8_t sbuf[2048], dbuf[2048], *p=NULL;
unsigned nerrors=0, i;
@@ -2303,7 +2306,7 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate,
}
if (H5F_SCOPE_DOWN==scope) {
for (i=0; i<f->mtab.nmounts; i++) {
- if (H5F_flush(f->mtab.child[i].file, scope, invalidate, FALSE)<0)
+ if (H5F_flush(f->mtab.child[i].file, scope, invalidate, FALSE, closing)<0)
nerrors++;
}
}
@@ -2431,7 +2434,7 @@ H5F_flush(H5F_t *f, H5F_scope_t scope, hbool_t invalidate,
} /* end else */
/* Flush file buffers to disk */
- if (!alloc_only && H5FD_flush(f->shared->lf)<0)
+ if (!alloc_only && H5FD_flush(f->shared->lf,closing)<0)
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "low level flush failed");
/* Check flush errors for children - errors are already on the stack */
@@ -2489,7 +2492,7 @@ H5F_close(H5F_t *f)
/*
* If this file is referenced more than once then just decrement the
- * count, flush the file, and return.
+ * count and return.
*/
if (f->nrefs>1) {
/* Decrement reference counts */
@@ -2622,14 +2625,8 @@ H5F_close(H5F_t *f)
H5AC_debug(f);
H5F_istore_stats(f, FALSE);
-#ifdef H5_HAVE_PARALLEL
- if(IS_H5FD_MPIO(f)) {
- if (SUCCEED!= H5FD_mpio_closing(f->shared->lf))
- HRETURN_ERROR (H5E_IO, H5E_CANTFLUSH, FAIL, "unable to set 'closing' flag");
- } /* end if */
-#endif /* H5_HAVE_PARALLEL */
/* Flush and destroy all caches */
- if (H5F_flush(f, H5F_SCOPE_LOCAL, TRUE, FALSE)<0)
+ if (H5F_flush(f, H5F_SCOPE_LOCAL, TRUE, FALSE, TRUE)<0)
HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache");
} /* end if */
diff --git a/src/H5FD.c b/src/H5FD.c
index 8f33140..b43b84d 100644
--- a/src/H5FD.c
+++ b/src/H5FD.c
@@ -2472,11 +2472,13 @@ H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t si
* Thursday, July 29, 1999
*
* Modifications:
+ * Quincey Koziol, May 20, 2002
+ * Added 'closing' parameter
*
*-------------------------------------------------------------------------
*/
herr_t
-H5FDflush(H5FD_t *file)
+H5FDflush(H5FD_t *file, unsigned closing)
{
FUNC_ENTER(H5FDflush, FAIL);
H5TRACE1("e","x",file);
@@ -2487,7 +2489,7 @@ H5FDflush(H5FD_t *file)
}
/* Do the real work */
- if (H5FD_flush(file)<0) {
+ if (H5FD_flush(file,closing)<0) {
HRETURN_ERROR(H5E_VFL, H5E_CANTINIT, FAIL,
"file flush request failed");
}
@@ -2509,11 +2511,13 @@ H5FDflush(H5FD_t *file)
* Wednesday, August 4, 1999
*
* Modifications:
+ * Quincey Koziol, May 20, 2002
+ * Added 'closing' parameter
*
*-------------------------------------------------------------------------
*/
herr_t
-H5FD_flush(H5FD_t *file)
+H5FD_flush(H5FD_t *file, unsigned closing)
{
FUNC_ENTER(H5FD_flush, FAIL);
assert(file && file->cls);
@@ -2529,7 +2533,7 @@ H5FD_flush(H5FD_t *file)
file->accum_dirty=FALSE;
} /* end if */
- if (file->cls->flush && (file->cls->flush)(file)<0)
+ if (file->cls->flush && (file->cls->flush)(file,closing)<0)
HRETURN_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "driver flush request failed");
FUNC_LEAVE(SUCCEED);
diff --git a/src/H5FDcore.c b/src/H5FDcore.c
index 13a4a01..16f3192 100644
--- a/src/H5FDcore.c
+++ b/src/H5FDcore.c
@@ -78,7 +78,7 @@ typedef struct H5FD_core_fapl_t {
static void *H5FD_core_fapl_get(H5FD_t *_file);
static H5FD_t *H5FD_core_open(const char *name, unsigned flags, hid_t fapl_id,
haddr_t maxaddr);
-static herr_t H5FD_core_flush(H5FD_t *_file);
+static herr_t H5FD_core_flush(H5FD_t *_file, unsigned closing);
static herr_t H5FD_core_close(H5FD_t *_file);
static int H5FD_core_cmp(const H5FD_t *_f1, const H5FD_t *_f2);
static haddr_t H5FD_core_get_eoa(H5FD_t *_file);
@@ -365,7 +365,7 @@ H5FD_core_open(const char *name, unsigned UNUSED flags, hid_t fapl_id,
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_core_flush(H5FD_t *_file)
+H5FD_core_flush(H5FD_t *_file, unsigned UNUSED closing)
{
H5FD_core_t *file = (H5FD_core_t*)_file;
@@ -425,7 +425,7 @@ H5FD_core_close(H5FD_t *_file)
FUNC_ENTER(H5FD_core_close, FAIL);
/* Flush */
- if (H5FD_core_flush(_file)<0)
+ if (H5FD_core_flush(_file,TRUE)<0)
HRETURN_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file");
/* Release resources */
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index 7c1bfab..f29ba7a 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -81,7 +81,7 @@ static herr_t H5FD_family_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, ha
size_t size, void *_buf/*out*/);
static herr_t H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
size_t size, const void *_buf);
-static herr_t H5FD_family_flush(H5FD_t *_file);
+static herr_t H5FD_family_flush(H5FD_t *_file,unsigned closing);
/* The class struct */
static const H5FD_class_t H5FD_family_g = {
@@ -1009,7 +1009,7 @@ H5FD_family_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, s
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_family_flush(H5FD_t *_file)
+H5FD_family_flush(H5FD_t *_file, unsigned closing)
{
H5FD_family_t *file = (H5FD_family_t*)_file;
int i, nerrors=0;
@@ -1017,7 +1017,7 @@ H5FD_family_flush(H5FD_t *_file)
FUNC_ENTER(H5FD_family_flush, FAIL);
for (i=0; i<file->nmembs; i++)
- if (file->memb[i] && H5FDflush(file->memb[i])<0)
+ if (file->memb[i] && H5FDflush(file->memb[i],closing)<0)
nerrors++;
if (nerrors)
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index 244a56a..c7279cb 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -174,7 +174,7 @@ static herr_t H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr
size_t size, void *buf);
static herr_t H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr,
size_t size, const void *buf);
-static herr_t H5FD_log_flush(H5FD_t *_file);
+static herr_t H5FD_log_flush(H5FD_t *_file, unsigned closing);
/*
* The free list map which causes each request type to use no free lists
@@ -580,7 +580,7 @@ H5FD_log_close(H5FD_t *_file)
FUNC_ENTER(H5FD_log_close, FAIL);
- if (H5FD_log_flush(_file)<0)
+ if (H5FD_log_flush(_file,TRUE)<0)
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to flush file");
#ifdef H5_HAVE_GETTIMEOFDAY
@@ -1211,7 +1211,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t UNUSED dxpl_id, haddr_t add
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_log_flush(H5FD_t *_file)
+H5FD_log_flush(H5FD_t *_file, unsigned UNUSED closing)
{
H5FD_log_t *file = (H5FD_log_t*)_file;
diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c
index 3572390..e2d0764 100644
--- a/src/H5FDmpio.c
+++ b/src/H5FDmpio.c
@@ -53,7 +53,6 @@ typedef struct H5FD_mpio_t {
int mpi_rank; /* This process's rank */
int mpi_size; /* Total number of processes */
int mpi_round; /* Current round robin process (for metadata I/O) */
- unsigned closing; /* Indicate that the file is closing immediately after call to flush */
haddr_t eof; /*end-of-file marker */
haddr_t eoa; /*end-of-address marker */
haddr_t last_eoa; /* Last known end-of-address marker */
@@ -83,7 +82,7 @@ static herr_t H5FD_mpio_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, hadd
size_t size, void *buf);
static herr_t H5FD_mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr,
size_t size, const void *buf);
-static herr_t H5FD_mpio_flush(H5FD_t *_file);
+static herr_t H5FD_mpio_flush(H5FD_t *_file, unsigned closing);
/* MPIO-specific file access properties */
typedef struct H5FD_mpio_fapl_t {
@@ -635,37 +634,6 @@ H5FD_mpio_signal_right_neighbor(H5FD_t *_file)
/*-------------------------------------------------------------------------
- * Function: H5FD_mpio_closing
- *
- * Purpose: Indicate that next flush call is immediately prior to a
- * close on the file.
- *
- * Return: Success: non-negative
- * Failure: negative
- *
- * Programmer: Quincey Koziol, May 13, 2002
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5FD_mpio_closing(H5FD_t *_file)
-{
- H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
-
- FUNC_ENTER(H5FD_mpio_closing, FAIL);
- assert(file);
- assert(H5FD_MPIO==file->pub.driver_id);
-
- /* Set the 'closing' flag for this file */
- file->closing=TRUE;
-
- FUNC_LEAVE(SUCCEED);
-}
-
-
-/*-------------------------------------------------------------------------
* Function: H5FD_mpio_fapl_get
*
* Purpose: Returns a file access property list which could be used to
@@ -1638,7 +1606,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_mpio_flush(H5FD_t *_file)
+H5FD_mpio_flush(H5FD_t *_file, unsigned closing)
{
H5FD_mpio_t *file = (H5FD_mpio_t*)_file;
int mpi_code; /* mpi return code */
@@ -1693,14 +1661,11 @@ H5FD_mpio_flush(H5FD_t *_file)
} /* end if */
/* Only sync the file if we are not going to immediately close it */
- if(!file->closing) {
+ if(!closing) {
if (MPI_SUCCESS != (mpi_code=MPI_File_sync(file->f)))
HMPI_GOTO_ERROR(FAIL, "MPI_File_sync failed", mpi_code);
} /* end if */
- /* Reset 'closing' flag now */
- file->closing=FALSE;
-
done:
#ifdef H5FDmpio_DEBUG
if (H5FD_mpio_Debug[(int)'t'])
diff --git a/src/H5FDmpio.h b/src/H5FDmpio.h
index 4750ef2..45e6069 100644
--- a/src/H5FDmpio.h
+++ b/src/H5FDmpio.h
@@ -61,7 +61,6 @@ __DLL__ herr_t H5FD_mpio_setup(H5FD_t *_file, MPI_Datatype btype, MPI_Datatype f
haddr_t disp, hbool_t use_types);
__DLL__ herr_t H5FD_mpio_wait_for_left_neighbor(H5FD_t *file);
__DLL__ herr_t H5FD_mpio_signal_right_neighbor(H5FD_t *file);
-__DLL__ herr_t H5FD_mpio_closing(H5FD_t *file);
__DLL__ int H5FD_mpio_mpi_rank(H5FD_t *_file);
__DLL__ int H5FD_mpio_mpi_size(H5FD_t *_file);
#ifdef __cplusplus
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c
index 901e379..ea09b90 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -129,7 +129,7 @@ static herr_t H5FD_multi_read(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, had
size_t size, void *_buf/*out*/);
static herr_t H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
size_t size, const void *_buf);
-static herr_t H5FD_multi_flush(H5FD_t *_file);
+static herr_t H5FD_multi_flush(H5FD_t *_file, unsigned closing);
/* The class struct */
static const H5FD_class_t H5FD_multi_g = {
@@ -1254,7 +1254,7 @@ H5FD_multi_close(H5FD_t *_file)
H5Eclear();
/* Flush our own data */
- if (H5FD_multi_flush(_file)<0)
+ if (H5FD_multi_flush(_file,TRUE)<0)
nerrors++;
/* Close as many members as possible */
@@ -1712,7 +1712,7 @@ H5FD_multi_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, si
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_multi_flush(H5FD_t *_file)
+H5FD_multi_flush(H5FD_t *_file, unsigned closing)
{
H5FD_multi_t *file = (H5FD_multi_t*)_file;
H5FD_mem_t mt;
@@ -1758,7 +1758,7 @@ H5FD_multi_flush(H5FD_t *_file)
for (mt=H5FD_MEM_SUPER; mt<H5FD_MEM_NTYPES; mt=mt+1) {
if (file->memb[mt]) {
H5E_BEGIN_TRY {
- if (H5FDflush(file->memb[mt])<0) nerrors++;
+ if (H5FDflush(file->memb[mt],closing)<0) nerrors++;
} H5E_END_TRY;
}
}
diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h
index 6e0c919..19dd6b1 100644
--- a/src/H5FDprivate.h
+++ b/src/H5FDprivate.h
@@ -38,7 +38,7 @@ __DLL__ herr_t H5FD_read(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t a
void *buf/*out*/);
__DLL__ herr_t H5FD_write(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size,
const void *buf);
-__DLL__ herr_t H5FD_flush(H5FD_t *file);
+__DLL__ herr_t H5FD_flush(H5FD_t *file, unsigned closing);
__DLL__ herr_t H5FD_get_fileno(const H5FD_t *file, unsigned long *filenum);
#endif /* !_H5FDprivate_H */
diff --git a/src/H5FDpublic.h b/src/H5FDpublic.h
index 81a63f5..67256b5 100644
--- a/src/H5FDpublic.h
+++ b/src/H5FDpublic.h
@@ -135,7 +135,7 @@ typedef struct H5FD_class_t {
void *buffer);
herr_t (*write)(H5FD_t *file, H5FD_mem_t type, hid_t dxpl, haddr_t addr, size_t size,
const void *buffer);
- herr_t (*flush)(H5FD_t *file);
+ herr_t (*flush)(H5FD_t *file, unsigned closing);
H5FD_mem_t fl_map[H5FD_MEM_NTYPES];
} H5FD_class_t;
@@ -199,7 +199,7 @@ __DLL__ herr_t H5FDread(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t ad
void *buf/*out*/);
__DLL__ herr_t H5FDwrite(H5FD_t *file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, size_t size,
const void *buf);
-__DLL__ herr_t H5FDflush(H5FD_t *file);
+__DLL__ herr_t H5FDflush(H5FD_t *file, unsigned closing);
#ifdef __cplusplus
}
diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c
index 4598fa2..8ecae4a 100644
--- a/src/H5FDsec2.c
+++ b/src/H5FDsec2.c
@@ -143,7 +143,7 @@ static herr_t H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, hadd
size_t size, void *buf);
static herr_t H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr,
size_t size, const void *buf);
-static herr_t H5FD_sec2_flush(H5FD_t *_file);
+static herr_t H5FD_sec2_flush(H5FD_t *_file,unsigned closing);
static const H5FD_class_t H5FD_sec2_g = {
"sec2", /*name */
@@ -346,7 +346,7 @@ H5FD_sec2_close(H5FD_t *_file)
FUNC_ENTER(H5FD_sec2_close, FAIL);
- if (H5FD_sec2_flush(_file)<0)
+ if (H5FD_sec2_flush(_file,TRUE)<0)
HRETURN_ERROR(H5E_IO, H5E_WRITEERROR, FAIL, "unable to flush file");
if (close(file->fd)<0)
HRETURN_ERROR(H5E_IO, H5E_CANTCLOSEFILE, FAIL, "unable to close file");
@@ -716,7 +716,7 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, had
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_sec2_flush(H5FD_t *_file)
+H5FD_sec2_flush(H5FD_t *_file, unsigned UNUSED closing)
{
H5FD_sec2_t *file = (H5FD_sec2_t*)_file;
diff --git a/src/H5FDsrb.c b/src/H5FDsrb.c
index db8de8d..314bed8 100644
--- a/src/H5FDsrb.c
+++ b/src/H5FDsrb.c
@@ -89,7 +89,7 @@ static herr_t H5FD_srb_read(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, hadd
size_t size, void *buf);
static herr_t H5FD_srb_write(H5FD_t *_file, H5FD_mem_t type, hid_t fapl_id, haddr_t addr,
size_t size, const void *buf);
-static herr_t H5FD_srb_flush(H5FD_t *_file);
+static herr_t H5FD_srb_flush(H5FD_t *_file, unsigned closing);
/* The description of a file belonging to this driver. */
typedef struct H5FD_srb_t {
@@ -661,7 +661,7 @@ H5FD_srb_write(H5FD_t *_file, H5FD_mem_t UNUSED type, hid_t UNUSED dxpl_id, hadd
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_srb_flush(H5FD_t *_file)
+H5FD_srb_flush(H5FD_t *_file, unsigned UNUSED closing)
{
H5FD_srb_t *file = (H5FD_srb_t*)_file;
diff --git a/src/H5FDstdio.c b/src/H5FDstdio.c
index 1689b4f..387d736 100644
--- a/src/H5FDstdio.c
+++ b/src/H5FDstdio.c
@@ -141,7 +141,7 @@ static herr_t H5FD_stdio_read(H5FD_t *lf, H5FD_mem_t type, hid_t fapl_id, haddr_
size_t size, void *buf);
static herr_t H5FD_stdio_write(H5FD_t *lf, H5FD_mem_t type, hid_t fapl_id, haddr_t addr,
size_t size, const void *buf);
-static herr_t H5FD_stdio_flush(H5FD_t *_file);
+static herr_t H5FD_stdio_flush(H5FD_t *_file, unsigned closing);
static const H5FD_class_t H5FD_stdio_g = {
"stdio", /*name */
@@ -376,7 +376,7 @@ H5FD_stdio_close(H5FD_t *_file)
/* Clear the error stack */
H5Eclear();
- if (H5FD_stdio_flush(_file)<0)
+ if (H5FD_stdio_flush(_file,1)<0)
H5Epush_ret(func, H5E_IO, H5E_WRITEERROR, "flush failed", -1);
if (fclose(file->fp) < 0)
H5Epush_ret(func, H5E_IO, H5E_CLOSEERROR, "fclose failed", -1);
@@ -797,7 +797,7 @@ H5FD_stdio_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr,
*-------------------------------------------------------------------------
*/
static herr_t
-H5FD_stdio_flush(H5FD_t *_file)
+H5FD_stdio_flush(H5FD_t *_file, unsigned closing)
{
H5FD_stdio_t *file = (H5FD_stdio_t*)_file;
static const char *func="H5FD_stdio_flush"; /* Function Name for error reporting */
@@ -827,8 +827,10 @@ H5FD_stdio_flush(H5FD_t *_file)
/*
* Flush
*/
- if (fflush(file->fp) < 0)
- H5Epush_ret(func, H5E_IO, H5E_WRITEERROR, "fflush failed", -1);
+ if(!closing) {
+ if (fflush(file->fp) < 0)
+ H5Epush_ret(func, H5E_IO, H5E_WRITEERROR, "fflush failed", -1);
+ } /* end if */
} /* end if */
else {
/* Double-check for problems */
diff --git a/src/H5FDstream.c b/src/H5FDstream.c
index ed7035e..97617ca 100644
--- a/src/H5FDstream.c
+++ b/src/H5FDstream.c
@@ -153,7 +153,7 @@ static const H5FD_stream_fapl_t default_fapl =
static void *H5FD_stream_fapl_get (H5FD_t *_stream);
static H5FD_t *H5FD_stream_open (const char *name, unsigned flags,
hid_t fapl_id, haddr_t maxaddr);
-static herr_t H5FD_stream_flush (H5FD_t *_stream);
+static herr_t H5FD_stream_flush (H5FD_t *_stream, unsigned closing);
static herr_t H5FD_stream_close (H5FD_t *_stream);
static herr_t H5FD_stream_query(const H5FD_t *_f1, unsigned long *flags);
static haddr_t H5FD_stream_get_eoa (H5FD_t *_stream);
@@ -813,7 +813,7 @@ static H5FD_t *H5FD_stream_open (const char *filename,
*
*-------------------------------------------------------------------------
*/
-static herr_t H5FD_stream_flush (H5FD_t *_stream)
+static herr_t H5FD_stream_flush (H5FD_t *_stream, unsigned UNUSED closing)
{
H5FD_stream_t *stream = (H5FD_stream_t *) _stream;
size_t size;
@@ -898,7 +898,7 @@ static herr_t H5FD_stream_close (H5FD_t *_stream)
FUNC_ENTER (H5FD_stream_close, FAIL);
/* Flush */
- if (H5FD_stream_flush (_stream) != SUCCEED)
+ if (H5FD_stream_flush (_stream,TRUE) != SUCCEED)
{
HRETURN_ERROR (H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file");
}