[FL-2693] RW buffered streams (#1523)

* Add write methods for stream cache
* Fix logical error
* Implement write cache for buffered file streams
* Minor code refactoring
* Less ugly code
* Better read() implementation
* Intermediate implementation
* Fix logical error
* Code cleanup
* Update FFF comments
* Fix logical error
* Github: rsync with delete

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Georgii Surkov
2022-08-03 19:43:14 +03:00
committed by GitHub
parent 6499597586
commit 135fbd294b
6 changed files with 156 additions and 35 deletions

View File

@@ -19,7 +19,7 @@ Stream* buffered_file_stream_alloc(Storage* storage);
* @param path path to file
* @param access_mode access mode from FS_AccessMode
* @param open_mode open mode from FS_OpenMode
* @return success flag. You need to close the file even if the open operation failed.
* @return True on success, False on failure. You need to close the file even if the open operation failed.
*/
bool buffered_file_stream_open(
Stream* stream,
@@ -29,12 +29,18 @@ bool buffered_file_stream_open(
/**
* Closes the file.
* @param stream
* @return true
* @return false
* @param stream pointer to file stream object.
* @return True on success, False on failure.
*/
bool buffered_file_stream_close(Stream* stream);
/**
* Forces write from cache to the underlying file.
* @param stream pointer to file stream object.
* @return True on success, False on failure.
*/
bool buffered_file_stream_sync(Stream* stream);
/**
* Retrieves the error id from the file object
* @param stream pointer to stream object.