Restructured directory code

After quite a bit of prototyping, settled on the following functions:
- lfs_dir_alloc  - create a new dir
- lfs_dir_fetch  - load and check a dir pair from disk
- lfs_dir_commit - save a dir pair to disk
- lfs_dir_shift  - shrink a dir pair to disk
- lfs_dir_append - add a dir entry, creating dirs if needed
- lfs_dir_remove - remove a dir entry, dropping dirs if needed

Additionally, followed through with a few other tweaks
This commit is contained in:
Christopher Haster
2017-04-17 22:27:06 -05:00
parent bd817abb00
commit 3b9d6630c8
6 changed files with 441 additions and 598 deletions

View File

@@ -11,12 +11,16 @@ TEST
echo "--- Invalid superblocks ---"
ln -f -s /dev/null blocks/0
ln -f -s /dev/null blocks/1
tests/test.py << TEST
lfs_format(&lfs, &config) => LFS_ERROR_CORRUPT;
TEST
rm blocks/0
rm blocks/0 blocks/1
echo "--- Basic mounting ---"
tests/test.py << TEST
lfs_format(&lfs, &config) => 0;
TEST
tests/test.py << TEST
lfs_mount(&lfs, &config) => 0;
lfs_unmount(&lfs) => 0;