WIP Added files to dir list and squished the lists together

Now with better tracking of changes to long lasting metadata pairs
This commit is contained in:
Christopher Haster
2018-08-01 10:24:59 -05:00
parent 67cf4e10f4
commit 597249eea0
2 changed files with 472 additions and 456 deletions

883
lfs.c

File diff suppressed because it is too large Load Diff

45
lfs.h
View File

@@ -280,6 +280,12 @@ typedef struct lfs_mattr {
const struct lfs_mattr *next; const struct lfs_mattr *next;
} lfs_mattr_t; } lfs_mattr_t;
typedef struct lfs_cache {
lfs_block_t block;
lfs_off_t off;
uint8_t *buffer;
} lfs_cache_t;
typedef union lfs_global { typedef union lfs_global {
uint16_t u16[5]; uint16_t u16[5];
} lfs_global_t; } lfs_global_t;
@@ -288,24 +294,37 @@ typedef struct lfs_mdir {
lfs_block_t pair[2]; lfs_block_t pair[2];
lfs_block_t tail[2]; lfs_block_t tail[2];
uint32_t rev; uint32_t rev;
lfs_off_t off;
uint32_t etag; uint32_t etag;
lfs_off_t off;
uint16_t count; uint16_t count;
bool erased; bool erased;
bool split; bool split;
lfs_global_t locals; lfs_global_t locals;
} lfs_mdir_t; } lfs_mdir_t;
typedef struct lfs_cache { typedef struct lfs_mlist {
lfs_block_t block; struct lfs_mlist *next;
lfs_off_t off; uint16_t id;
uint8_t *buffer; uint8_t type;
} lfs_cache_t; lfs_mdir_t m;
} lfs_mlist_t;
typedef struct lfs_dir {
struct lfs_dir *next;
uint16_t id;
uint8_t type;
lfs_mdir_t m;
lfs_off_t pos;
lfs_block_t head[2];
} lfs_dir_t;
typedef struct lfs_file { typedef struct lfs_file {
struct lfs_file *next; struct lfs_file *next;
uint16_t id; uint16_t id;
lfs_block_t pair[2]; uint8_t type;
lfs_mdir_t m;
struct lfs_ctz { struct lfs_ctz {
lfs_block_t head; lfs_block_t head;
lfs_size_t size; lfs_size_t size;
@@ -320,15 +339,6 @@ typedef struct lfs_file {
const struct lfs_file_config *cfg; const struct lfs_file_config *cfg;
} lfs_file_t; } lfs_file_t;
typedef struct lfs_dir {
struct lfs_dir *next;
uint16_t id;
struct lfs_mdir m;
lfs_block_t head[2];
lfs_off_t pos;
} lfs_dir_t;
typedef struct lfs_superblock { typedef struct lfs_superblock {
char magic[8]; char magic[8];
uint32_t version; uint32_t version;
@@ -355,8 +365,7 @@ typedef struct lfs {
lfs_cache_t pcache; lfs_cache_t pcache;
lfs_block_t root[2]; lfs_block_t root[2];
lfs_file_t *files; lfs_mlist_t *mlist;
lfs_dir_t *dirs;
lfs_global_t globals; lfs_global_t globals;
lfs_global_t locals; lfs_global_t locals;