diff options
author | Christopher Haster <chaster@utexas.edu> | 2017-04-23 05:42:22 +0300 |
---|---|---|
committer | Christopher Haster <chaster@utexas.edu> | 2017-04-23 05:42:22 +0300 |
commit | a1d8a76b36890506bf1a49056e25443f06ccd13c (patch) | |
tree | c1a617303b974a27b39856dbaf71332cfe20eed3 /lfs.h | |
parent | a4e9132d7fd3022972bc15d18d6d07c5a40422ba (diff) |
Added correct handling of file syncing around overwrites
Now all of the open flags are correctly handled
Even annoying cases where we can't trust the blocks that are already
on file, such as appending existing files and writing to the middle
of files.
Diffstat (limited to 'lfs.h')
-rw-r--r-- | lfs.h | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -122,8 +122,8 @@ typedef struct lfs_entry { } lfs_entry_t; typedef struct lfs_file { - lfs_block_t head; - lfs_size_t size; + struct lfs_entry entry; + int flags; lfs_off_t wpos; lfs_block_t wblock; @@ -132,10 +132,6 @@ typedef struct lfs_file { lfs_off_t rpos; lfs_block_t rblock; lfs_off_t roff; - - int flags; - - struct lfs_entry entry; } lfs_file_t; typedef struct lfs_dir { @@ -203,6 +199,7 @@ int lfs_dir_read(lfs_t *lfs, lfs_dir_t *dir, struct lfs_info *info); int lfs_file_open(lfs_t *lfs, lfs_file_t *file, const char *path, int flags); int lfs_file_close(lfs_t *lfs, lfs_file_t *file); +int lfs_file_sync(lfs_t *lfs, lfs_file_t *file); lfs_ssize_t lfs_file_write(lfs_t *lfs, lfs_file_t *file, const void *buffer, lfs_size_t size); lfs_ssize_t lfs_file_read(lfs_t *lfs, lfs_file_t *file, |