| 795 | } |
| 796 | |
| 797 | SC::Result SC::AsyncFileSystemOperation::copyFile(AsyncEventLoop& eventLoop, StringSpan path, |
| 798 | StringSpan destinationPath, FileSystemCopyFlags copyFlags) |
| 799 | { |
| 800 | SC_TRY(checkState()); |
| 801 | operation = Operation::CopyFile; |
| 802 | new (©FileData, PlacementNew()) CopyFileData({path, destinationPath, copyFlags}); |
| 803 | // TODO: Implement this on io_uring using two splice submissions with IOSQE_IO_LINK |
| 804 | loopWork.work = [&]() |
| 805 | { |
| 806 | SC_TRY( |
| 807 | FileSystem::Operations::copyFile(copyFileData.path, copyFileData.destinationPath, copyFileData.copyFlags)); |
| 808 | return SC::Result(true); |
| 809 | }; |
| 810 | loopWork.callback.bind<AsyncFileSystemOperation, &AsyncFileSystemOperation::onOperationCompleted>(*this); |
| 811 | return eventLoop.start(loopWork); |
| 812 | } |
| 813 | |
| 814 | SC::Result SC::AsyncFileSystemOperation::rename(AsyncEventLoop& eventLoop, StringSpan path, StringSpan newPath) |
| 815 | { |