[*] Update IAsyncFileStream::NewTransaction
This commit is contained in:
parent
a9fd9221b7
commit
9a846a6d2f
@ -139,7 +139,9 @@ namespace Aurora::IO::FS
|
|||||||
|
|
||||||
AuSPtr<IAsyncTransaction> LinuxAsyncFileStream::NewTransaction()
|
AuSPtr<IAsyncTransaction> LinuxAsyncFileStream::NewTransaction()
|
||||||
{
|
{
|
||||||
if (!AuStaticCast<AuIO::AFileHandle>(this->pHandle_)->bDirectIO)
|
if (!this->pProcessBlock_ &&
|
||||||
|
!AuStaticCast<AuIO::AFileHandle>(this->pHandle_)->bDirectIO &&
|
||||||
|
!AuStaticCast<AuIO::AFileHandle>(this->pHandle_)->pIPCPipe)
|
||||||
{
|
{
|
||||||
auto &pFSReader = this->pCache_;
|
auto &pFSReader = this->pCache_;
|
||||||
|
|
||||||
|
@ -78,10 +78,31 @@ namespace Aurora::IO::FS
|
|||||||
|
|
||||||
AuSPtr<IAsyncTransaction> NtAsyncFileStream::NewTransaction()
|
AuSPtr<IAsyncTransaction> NtAsyncFileStream::NewTransaction()
|
||||||
{
|
{
|
||||||
|
if (!this->pHandle_->IsAsync())
|
||||||
|
{
|
||||||
|
auto &pFSReader = this->pCache_;
|
||||||
|
|
||||||
|
if (!pFSReader)
|
||||||
|
{
|
||||||
|
pFSReader = AuFS::OpenBlockingFileStreamFromHandle(this->pHandle_);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pFSReader)
|
||||||
|
{
|
||||||
|
SysPushErrorNested();
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
auto pStreamReader = AuSharedPointerFromShared(pFSReader->ToStreamSeekingReader(), pFSReader);
|
||||||
|
auto pStreamWriter = AuSharedPointerFromShared(pFSReader->ToStreamSeekingWriter(), pFSReader);
|
||||||
|
return Adapters::NewAsyncTransactionFromStreamSeekingPair(pStreamReader, pStreamWriter, {});
|
||||||
|
}
|
||||||
|
|
||||||
auto shared = AuMakeShared<NtAsyncFileTransaction>();
|
auto shared = AuMakeShared<NtAsyncFileTransaction>();
|
||||||
SysCheckNotNullMemory(shared, {});
|
SysCheckNotNullMemory(shared, {});
|
||||||
|
|
||||||
if (!shared->InitWeak(this->pHandle_))
|
//if (!shared->InitWeak(this->pHandle_))
|
||||||
|
if (!shared->Init(this->pHandle_))
|
||||||
{
|
{
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ namespace Aurora::IO::FS
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
AuSPtr<IIOHandle> pHandle_;
|
AuSPtr<IIOHandle> pHandle_;
|
||||||
|
AuSPtr<IFileStream> pCache_;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct NtAsyncFileTransaction :
|
struct NtAsyncFileTransaction :
|
||||||
|
Loading…
Reference in New Issue
Block a user