|
@@ -1545,7 +1545,7 @@ IFileIO *_createIFileIO(const void *buffer, unsigned sz, bool readOnly)
|
|
|
memcpy((byte *)buffer+pos, data, len);
|
|
|
return len;
|
|
|
}
|
|
|
-
|
|
|
+ virtual void flush() {}
|
|
|
virtual void setSize(offset_t size)
|
|
|
{
|
|
|
if (size > mb.length())
|
|
@@ -1697,7 +1697,6 @@ extern jlib_decl IFileIO *createIFileIO(HANDLE handle)
|
|
|
return new CFileIO(handle,IFSHfull);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
offset_t CFileIO::appendFile(IFile *file,offset_t pos,offset_t len)
|
|
|
{
|
|
|
if (!file)
|
|
@@ -1742,6 +1741,12 @@ CFileIO::~CFileIO()
|
|
|
file = NULLFILE;
|
|
|
}
|
|
|
|
|
|
+void CFileIO::flush()
|
|
|
+{
|
|
|
+ if (!FlushFileBuffers(file))
|
|
|
+ throw MakeOsException(GetLastError(),"CFileIO::flush");
|
|
|
+}
|
|
|
+
|
|
|
offset_t CFileIO::size()
|
|
|
{
|
|
|
LARGE_INTEGER pos;
|
|
@@ -1813,10 +1818,17 @@ CFileIO::~CFileIO()
|
|
|
if (file != NULLFILE) {
|
|
|
close(file);
|
|
|
file=NULLFILE;
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+void CFileIO::flush()
|
|
|
+{
|
|
|
+ CriticalBlock procedure(cs);
|
|
|
+ if (fdatasync(file) != 0)
|
|
|
+ throw MakeOsException(DISK_FULL_EXCEPTION_CODE,"CFileIO::flush");
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
offset_t CFileIO::size()
|
|
|
{
|
|
|
CriticalBlock procedure(cs);
|
|
@@ -1894,6 +1906,25 @@ size32_t CFileRangeIO::write(offset_t pos, size32_t len, const void * data)
|
|
|
|
|
|
//--------------------------------------------------------------------------
|
|
|
|
|
|
+void CFileAsyncIO::flush()
|
|
|
+{
|
|
|
+ //This could wait until all pending results are done.
|
|
|
+ loop
|
|
|
+ {
|
|
|
+ Owned<IFileAsyncResult> next;
|
|
|
+ {
|
|
|
+ CriticalBlock block(cs);
|
|
|
+ if (results.ordinality())
|
|
|
+ next.set(&results.tos());
|
|
|
+ }
|
|
|
+ if (!next)
|
|
|
+ return;
|
|
|
+
|
|
|
+ size32_t value;
|
|
|
+ next->getResult(value, true);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
offset_t CFileAsyncIO::appendFile(IFile *file,offset_t pos,offset_t len)
|
|
|
{
|
|
|
// will implemented if needed
|
|
@@ -6101,6 +6132,12 @@ public:
|
|
|
Owned<IFileIO> io = open();
|
|
|
return io->write(pos,len,data);
|
|
|
}
|
|
|
+ virtual void flush()
|
|
|
+ {
|
|
|
+ CriticalBlock block(sect);
|
|
|
+ if (cachedio)
|
|
|
+ cachedio->flush();
|
|
|
+ }
|
|
|
offset_t appendFile(IFile *file,offset_t pos,offset_t len)
|
|
|
{
|
|
|
CriticalBlock block(sect);
|