[PATCH v2 0/5] fs/fat: fix handling of full disk

Heinrich Schuchardt
2022-07-31T11:59:03Z

Currently we have two functions with redundant coding to find an empty
cluster:

* find_empty_cluster() seeks from the beginning of the FAT table
* determine_fatent() seeks after a given entry

Both do not detect the end of the FAT table correctly and return an invalid
cluster number if no empty entry if found.

Correctly determine empty FAT entries and full disk correctly.

Carve out a function for creating directory entries to avoid code
duplication.

Provide a unit test checking that a full FAT16 root directory is
recognized. For other file systems testing is too time consuming.
FAT32 allows 65536 entries per directory.

v2:
Handle errors returned by fat_create_dir_entry()
Add unit test

Heinrich Schuchardt (5):
fs: fat: finding an empty FAT cluster
fs: fat: determine_fatent() error handling
fs: fat: carve out fat_create_dir_entry()
test: let fs_obj_mkdir() provide full file system type
test: add test for full FAT16 directory

fs/fat/fat_write.c | 161 ++++++++++++++--------------
test/py/tests/test_fs/conftest.py | 6 +-
test/py/tests/test_fs/test_mkdir.py | 72 ++++++++-----
3 files changed, 131 insertions(+), 108 deletions(-)

--
2.36.1