mirror of
https://github.com/chenxiaolong/avbroot.git
synced 2026-07-03 14:05:11 +02:00
d874921a69
File reopening was conflating ownership of file-like types with the fact that they support parallel reads and writes at arbitrary offsets. The Reopen trait has now been replaced with ReadAt and WriteAt traits, which are implemented for types that support parallel I/O. If a type compatible with the standard Read/Write/Seek traits is needed, a new UserPosFile type can act as the bridge by storing its own userspace file offset. For the opposite bridge, there's MutexFile, which implements ReadAt/WriteAt by using locks to make the operations sequential. This is only really used in the tests though. This eliminates the need for the PSeekFile and SharedCursor types. The standard File and Cursor types can be used instead, and if shared ownership is needed, Arc can be used. Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>