[+] IAsyncTransaction::SetBaseOffset

This commit is contained in:
Reece Wilson 2023-08-09 00:02:35 +01:00
parent aaeca44fb0
commit df6f29bf38
9 changed files with 49 additions and 6 deletions

View File

@ -71,6 +71,8 @@ namespace Aurora::IO
*/
virtual void Reset() = 0;
virtual void SetBaseOffset(AuUInt64 uBaseOffset) = 0;
AURT_ADD_USR_DATA;
};
}

View File

@ -249,6 +249,11 @@ namespace Aurora::IO::FS
return bool(this->loopSource_);
}
void LinuxAsyncFileTransaction::SetBaseOffset(AuUInt64 uBaseOffset)
{
this->uBaseOffset = uBaseOffset;
}
bool LinuxAsyncFileTransaction::StartRead(AuUInt64 offset, const AuSPtr<AuMemoryViewWrite> &memoryView)
{
if (HasState())
@ -296,6 +301,8 @@ namespace Aurora::IO::FS
return true;
}
}
offset += this->uBaseOffset;
if (!UNIX::LinuxOverlappedSubmitRead(fd, offset, this, this->loopSource_.get(), bool(this->handle_->pIPCPipe)))
{
@ -351,6 +358,8 @@ namespace Aurora::IO::FS
LIOS_Init(AuSharedFromThis());
SetMemory(memoryView);
offset += this->uBaseOffset;
if (!UNIX::LinuxOverlappedSubmitWrite(fd, offset, this, this->loopSource_.get()))
{
LIOS_SendProcess(0, true, errno);

View File

@ -77,11 +77,15 @@ namespace Aurora::IO::FS
void DispatchCb();
AuSPtr<FileHandle> GetFileHandle();
void SetBaseOffset(AuUInt64 uBaseOffset) override;
virtual void LIOS_Process(AuUInt32 read, bool failure, int err, bool mark) override;
private:
AuSPtr<FileHandle> handle_;
AuUInt32 lastAbstractOffset_ {}, lastFinishedStat_{};
AuUInt64 lastAbstractOffset_ {};
AuUInt32 lastFinishedStat_ {};
AuUInt64 uBaseOffset {};
bool latch_ {};
bool bTxFinished_ {};
AuSPtr<IAsyncFinishedSubscriber> sub_;

View File

@ -345,10 +345,13 @@ namespace Aurora::IO::FS
this->bHasFailed = false;
this->dwLastAbstractStat = memoryView->length;
this->dwLastAbstractOffset = offset;
this->qwLastAbstractOffset = offset;
this->dwLastBytes = 0;
this->ResetAIO();
offset += this->uBaseOffset;
this->overlap.Offset = AuBitsToLower(offset);
this->overlap.OffsetHigh = AuBitsToHigher(offset);
@ -398,9 +401,12 @@ namespace Aurora::IO::FS
this->pMemoryHold = memoryView;
this->dwLastBytes = 0;
this->dwLastAbstractStat = memoryView->length;
this->dwLastAbstractOffset = offset;
this->qwLastAbstractOffset = offset;
this->ResetAIO();
offset += this->uBaseOffset;
this->overlap.Offset = AuBitsToLower(offset);
this->overlap.OffsetHigh = AuBitsToHigher(offset);
auto ret = ::WriteFileEx((HANDLE)optWrite.value(), memoryView->ptr, memoryView->length, &this->overlap, FileOperationCompletion);
@ -421,7 +427,7 @@ namespace Aurora::IO::FS
if (this->pSub_)
{
this->pSub_->OnAsyncFileOpFinished(this->dwLastAbstractOffset, read);
this->pSub_->OnAsyncFileOpFinished(this->qwLastAbstractOffset, read);
}
}
@ -543,6 +549,11 @@ namespace Aurora::IO::FS
this->pSub_ = sub;
}
void NtAsyncFileTransaction::SetBaseOffset(AuUInt64 uBaseOffset)
{
this->uBaseOffset = uBaseOffset;
}
bool NtAsyncFileTransaction::Wait(AuUInt32 timeout)
{
if (this->bLatch)

View File

@ -54,6 +54,8 @@ namespace Aurora::IO::FS
void SetCallback(const AuSPtr<IAsyncFinishedSubscriber> &sub) override;
void SetBaseOffset(AuUInt64 uBaseOffset) override;
bool Wait(AuUInt32 timeout) override;
AuSPtr<AuLoop::ILoopSource> NewLoopSource() override;
@ -68,12 +70,13 @@ namespace Aurora::IO::FS
OVERLAPPED overlap {};
HANDLE event = INVALID_HANDLE_VALUE;
AuSPtr<NtAsyncFileTransaction> pPin;
AuUInt32 dwLastAbstractStat {},
dwLastAbstractOffset {};
AuUInt32 dwLastAbstractStat {};
AuUInt64 qwLastAbstractOffset {};
bool bLatch {};
AuUInt32 dwLastBytes {};
AuUInt32 dwOsErrorCode {};
bool bHasFailed {};
AuUInt64 uBaseOffset {};
AuWPtr<Aurora::IO::IPC::IPCPipeImpl> pNtIpcPipeImpl;
AuSPtr<void> pMemoryHold;

View File

@ -206,6 +206,11 @@ namespace Aurora::IO::Net
return false;
}
void LinuxAsyncNetworkTransaction::SetBaseOffset(AuUInt64 uBaseOffset)
{
}
bool LinuxAsyncNetworkTransaction::Complete()
{
return this->bLatch;

View File

@ -42,6 +42,8 @@ namespace Aurora::IO::Net
void Reset() override;
void SetBaseOffset(AuUInt64 uBaseOffset) override;
virtual void LIOS_Process(AuUInt32 read, bool failure, int err, bool mark) override;
void MakeSyncable();

View File

@ -387,6 +387,11 @@ namespace Aurora::IO::Net
return this->pWaitable;
}
void NtAsyncNetworkTransaction::SetBaseOffset(AuUInt64 uBaseOffset)
{
}
void NtAsyncNetworkTransaction::Reset()
{
if (this->dwLastAbstractStat)

View File

@ -39,6 +39,8 @@ namespace Aurora::IO::Net
bool Wait(AuUInt32 timeout) override;
AuSPtr<AuLoop::ILoopSource> NewLoopSource() override;
void SetBaseOffset(AuUInt64 uBaseOffset) override;
void Reset();
void MakeSyncable();