[+] IAsyncTransaction::SetBaseOffset
This commit is contained in:
parent
aaeca44fb0
commit
df6f29bf38
@ -71,6 +71,8 @@ namespace Aurora::IO
|
||||
*/
|
||||
virtual void Reset() = 0;
|
||||
|
||||
virtual void SetBaseOffset(AuUInt64 uBaseOffset) = 0;
|
||||
|
||||
AURT_ADD_USR_DATA;
|
||||
};
|
||||
}
|
@ -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);
|
||||
|
@ -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_;
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -206,6 +206,11 @@ namespace Aurora::IO::Net
|
||||
return false;
|
||||
}
|
||||
|
||||
void LinuxAsyncNetworkTransaction::SetBaseOffset(AuUInt64 uBaseOffset)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool LinuxAsyncNetworkTransaction::Complete()
|
||||
{
|
||||
return this->bLatch;
|
||||
|
@ -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();
|
||||
|
@ -387,6 +387,11 @@ namespace Aurora::IO::Net
|
||||
return this->pWaitable;
|
||||
}
|
||||
|
||||
void NtAsyncNetworkTransaction::SetBaseOffset(AuUInt64 uBaseOffset)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void NtAsyncNetworkTransaction::Reset()
|
||||
{
|
||||
if (this->dwLastAbstractStat)
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user