Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/littlefs-project/littlefs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lfs.h
diff options
context:
space:
mode:
authorChristopher Haster <chaster@utexas.edu>2017-04-23 05:42:22 +0300
committerChristopher Haster <chaster@utexas.edu>2017-04-23 05:42:22 +0300
commita1d8a76b36890506bf1a49056e25443f06ccd13c (patch)
treec1a617303b974a27b39856dbaf71332cfe20eed3 /lfs.h
parenta4e9132d7fd3022972bc15d18d6d07c5a40422ba (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.h9
1 files changed, 3 insertions, 6 deletions
diff --git a/lfs.h b/lfs.h
index 1138057..db81e31 100644
--- a/lfs.h
+++ b/lfs.h
@@ -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,