| 771 | } |
| 772 | |
| 773 | SC::Result SC::AsyncFileSystemOperation::write(AsyncEventLoop& eventLoop, FileDescriptor::Handle handle, |
| 774 | Span<const char> buffer, uint64_t offset) |
| 775 | { |
| 776 | SC_TRY(checkState()); |
| 777 | operation = Operation::Write; |
| 778 | new (&writeData, PlacementNew()) WriteData({handle, buffer, offset}); |
| 779 | if (not eventLoop.needsThreadPoolForFileOperations() and threadPoolMode != AsyncThreadPoolMode::ForceThreadPool) |
| 780 | { |
| 781 | return eventLoop.start(*this); |
| 782 | } |
| 783 | |
| 784 | loopWork.work = [&]() |
| 785 | { |
| 786 | FileDescriptor fd(writeData.handle); |
| 787 | SC::Result writeResult = fd.write(writeData.buffer, writeData.offset); |
| 788 | fd.detach(); |
| 789 | SC_TRY(writeResult); |
| 790 | completionData.numBytes = writeData.buffer.sizeInBytes(); |
| 791 | return SC::Result(true); |
| 792 | }; |
| 793 | loopWork.callback.bind<AsyncFileSystemOperation, &AsyncFileSystemOperation::onOperationCompleted>(*this); |
| 794 | return eventLoop.start(loopWork); |
| 795 | } |
| 796 | |
| 797 | SC::Result SC::AsyncFileSystemOperation::copyFile(AsyncEventLoop& eventLoop, StringSpan path, |
| 798 | StringSpan destinationPath, FileSystemCopyFlags copyFlags) |
no test coverage detected