Removed a layer of indirection for index-list lookup

Files are now stored directly in the index-list, instead of being
referenced by pointers that used to live there. This somewhat reduces
the complexity around handling files, while still keeping the O(logn)
lookup cost.
This commit is contained in:
Christopher Haster
2017-04-22 19:48:31 -05:00
parent aa872657d2
commit a4e9132d7f
2 changed files with 156 additions and 220 deletions

7
lfs.h
View File

@@ -125,13 +125,16 @@ typedef struct lfs_file {
lfs_block_t head;
lfs_size_t size;
lfs_off_t wpos;
lfs_block_t wblock;
uint32_t windex;
lfs_off_t woff;
lfs_off_t rpos;
lfs_block_t rblock;
uint32_t rindex;
lfs_off_t roff;
int flags;
struct lfs_entry entry;
} lfs_file_t;