Added directory list for synchronizing in flight directories

As it was, if a user operated on a directory while at the same
time iterating over the directory, the directory objects could
fall out of sync. In the best case, files may be skipped while
removing everything in a file, in the worst case, a very poorly
timed directory relocate could be missed.

Simple fix is to add the same directory tracking that is currently
in use for files, at a small code+complexity cost.
This commit is contained in:
Christopher Haster
2017-11-21 20:53:15 -06:00
parent e169d06c57
commit bf78b09d37
3 changed files with 101 additions and 29 deletions

2
lfs.h
View File

@@ -207,6 +207,7 @@ typedef struct lfs_file {
} lfs_file_t;
typedef struct lfs_dir {
struct lfs_dir *next;
lfs_block_t pair[2];
lfs_off_t off;
@@ -249,6 +250,7 @@ typedef struct lfs {
lfs_block_t root[2];
lfs_file_t *files;
lfs_dir_t *dirs;
lfs_cache_t rcache;
lfs_cache_t pcache;