Refactored the updates of in-flight files/dirs

Updated to account for changes as a result of commits/compacts. And
changed instances of iteration over both files and dirs to use a single
nested loop.

This does rely implicitly on the structure layout of dirs/files and
their location in lfs_t, which isn't great. But it gets the job done
with less code duplication.
This commit is contained in:
Christopher Haster
2018-07-28 09:47:57 -05:00
parent d9a24d0a2b
commit 392b2ac79f
2 changed files with 16 additions and 21 deletions

4
lfs.h
View File

@@ -295,8 +295,8 @@ typedef struct lfs_cache {
typedef struct lfs_file {
struct lfs_file *next;
lfs_block_t pair[2];
uint16_t id;
lfs_block_t pair[2];
struct lfs_ctz {
lfs_block_t head;
lfs_size_t size;
@@ -313,10 +313,10 @@ typedef struct lfs_file {
typedef struct lfs_dir {
struct lfs_dir *next;
uint16_t id;
struct lfs_mdir m;
lfs_block_t head[2];
uint16_t id;
lfs_off_t pos;
} lfs_dir_t;