Skip to content

subject: fs: fat: extend FAT write operations

AKASHI Takahiro u-boot 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest23 patches 0 repliesNew
  2. v10 of 17 patches 0 repliesSuperseded

Changes in v2 from the cover letter

* guard the whole content of fat.h with CONFIG_FS_FAT agaisnt a compiler warning
* determine total_sect in struct fsdata correctly, depending on fat type (12/16 or 32)
* explicitly revert "fs: fat: cannot write to subdirectories"
* add test scripts with pytest, mostly the same as RFC, but removing "sudo" for ext4 case

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/23fs: fat: guard the content of include/fat.hinclude/fat.h+3 -02 replies
1/23fs: fat: guard the content of include/fat.h+0 -00 replies
1/23fs: fat: guard the content of include/fat.h+0 -01 reply
2/23fs: fat: extend get_fs_info() for write usefs/fat/fat.c include/fat.h+9 -00 replies
3/23fs: fat: handle "." and ".." of root dir correctly with fat_itr_resolve()fs/fat/fat.c+21 -00 replies
4/23fs: fat: make directory iterator global for write usefs/fat/fat.c include/fat.h+38 -333 replies
4/23fs: fat: make directory iterator global for write use+0 -01 reply
4/23fs: fat: make directory iterator global for write use+0 -00 replies
5/23fs: fat: assure iterator's ->dent belongs to ->clustfs/fat/fat.c include/fat.h+17 -80 replies
6/23Revert "fs: fat: cannot write to subdirectories"fs/fat/fat_write.c+1 -150 replies
7/23fs: fat: check and normailze file namefs/fat/fat_write.c+44 -80 replies
8/23fs: fat: write returns error code instead of -1fs/fat/fat_write.c+15 -40 replies
9/23fs: fat: support write with sub-directory pathfs/fat/fat.c fs/fat/fat_write.c+155 -3210 replies
10/23fs: fat: refactor write interface for a file offsetfs/fat/fat_write.c+65 -1140 replies
11/23fs: fat: support write with non-zero offsetfs/fat/fat_write.c+273 -150 replies
12/23cmd: fat: add offset parameter to fatwritecmd/fat.c+6 -30 replies
13/23fs: add mkdir interfacefs/fs.c include/fs.h+55 -00 replies
14/23fs: fat: remember the starting cluster number of directoryfs/fat/fat.c include/fat.h+3 -00 replies
15/23fs: fat: support mkdirfs/fat/fat_write.c fs/fs.c include/fat.h+139 -10 replies
16/23cmd: fat: add fatmkdir commandcmd/fat.c+13 -00 replies
17/23efi_loader: file: support creating a directorylib/efi_loader/efi_file.c+10 -40 replies
18/23efi_loader: implement a pseudo "file delete"lib/efi_loader/efi_file.c+9 -11 reply
18/23efi_loader: implement a pseudo "file delete"+0 -01 reply
18/23efi_loader: implement a pseudo "file delete"+0 -01 reply
19/23fs-test: fix false positive error at Test Case 12test/fs/fs-test.sh+1 -10 replies
20/23fs-test: update the test result as of v2018.09test/fs/fs-test.sh+12 -100 replies
21/23test/py: convert fs-test.sh to pytesttest/py/tests/test_fs/conftest.py test/py/tests/test_fs/fstest_defs.py test/py/tests/test_fs/test_basic.py+513 -01 reply
21/23test/py: convert fs-test.sh to pytest+0 -00 replies
22/23test/py: fs: add extended write operation testtest/py/tests/test_fs/conftest.py test/py/tests/test_fs/fstest_defs.py test/py/tests/test_fs/test_ext.py+311 -00 replies
23/23test/py: fs: add fstest/mkdir testtest/py/tests/test_fs/conftest.py test/py/tests/test_fs/test_mkdir.py+143 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [U-Boot] [PATCH v2 00/23] subject: fs: fat: extend FAT write operations

This patch series[1] is an attempt to address FAT write related issues in an effort of running UEFI SCT (Self-Certification Test) to verify UEFI support on u-boot.

SCT is a test platform as well as an extentisive collection of test cases for UEFI specification. It can run all the tests automatically and save test results to dedicated log files.

AFAIK, what's missing in the current fat file system to safely run SCT without errors (I don't mean test case failures) are:
* write a file located under sub-directories
* write a file with non-zero offset
* delete a file
* create a directory

This patch series addresses all of them and what's more, it contains a file system test; "basic" test is directly derived from test/test-fs.sh. The others, "ext" and "mkdir," are soly for newly added functionality in this patch series.

Patch#1 to patch#8 are some sort of preparatory ones. Patch#9 implements write with sub-directories path. Patch#10 to patch#12 implement write with non-zero offset. Patch#13 to patch#17 are related to creating a directory. Patch#18 provides delete, but it doesn't actually delete a file but instead return 0 with purging a file content, which is good enough to run SCT for now.
Patch#19 fixes a minor bug in fs-test.sh.
Patch#20 updates a test result summary.
Patch#21 to patch#23 add a file system test in U-boot pytest suite.

I applied this patch series on top of v2018.09-rc along with a couple of yet-to--be-upstreamed UEFI-related patches, and could successfully run unmodified SCT[2] on qemu-arm(arm64).

=== future TODO list ===
1. set creation (,access and modifcation) time
2. debug() vs. printf()
3. open()'s parameter checks
4. precisely detect and prevent write() beyond out-of-space
5. create an unique short name from a long file name
6. fat32's fsInfo support
7. remove "sudo" in pytest, if possible, for fat* case

Without (5) or (6), fsck may issue warnings.

[1] https://git.linaro.org/people/takahiro.akashi/u-boot.git fat_write
[2] http://uefi.org/testtools

Changes in v2 (Sep 4, 2018)
* guard the whole content of fat.h with CONFIG_FS_FAT agaisnt a compiler warning
* determine total_sect in struct fsdata correctly, depending on fat type (12/16 or 32)
* explicitly revert "fs: fat: cannot write to subdirectories"
* add test scripts with pytest, mostly the same as RFC, but removing "sudo" for ext4 case

AKASHI Takahiro (23):
fs: fat: guard the content of include/fat.h
fs: fat: extend get_fs_info() for write use
fs: fat: handle "." and ".." of root dir correctly with
fat_itr_resolve()
fs: fat: make directory iterator global for write use
fs: fat: assure iterator's ->dent belongs to ->clust Revert "fs: fat: cannot write to subdirectories"
fs: fat: check and normailze file name
fs: fat: write returns error code instead of -1
fs: fat: support write with sub-directory path
fs: fat: refactor write interface for a file offset
fs: fat: support write with non-zero offset
cmd: fat: add offset parameter to fatwrite
fs: add mkdir interface
fs: fat: remember the starting cluster number of directory
fs: fat: support mkdir
cmd: fat: add fatmkdir command
efi_loader: file: support creating a directory
efi_loader: implement a pseudo "file delete"
fs-test: fix false positive error at Test Case 12
fs-test: update the test result as of v2018.09 test/py: convert fs-test.sh to pytest
test/py: fs: add extended write operation test test/py: fs: add fstest/mkdir test

 cmd/fat.c                            |   22 +-
 fs/fat/fat.c                         |  102 +--
 fs/fat/fat_write.c                   | 1063 ++++++++++++++++----------
 fs/fs.c                              |   46 ++
 include/fat.h                        |   40 +
 include/fs.h                         |   10 +
 lib/efi_loader/efi_file.c            |   24 +-
 test/fs/fs-test.sh                   |   24 +-
 test/py/tests/test_fs/conftest.py    |  331 ++++++++
 test/py/tests/test_fs/fstest_defs.py |   13 +
 test/py/tests/test_fs/test_basic.py  |  287 +++++++
 test/py/tests/test_fs/test_ext.py    |  224 ++++++
 test/py/tests/test_fs/test_mkdir.py  |  112 +++
 13 files changed, 1808 insertions(+), 490 deletions(-)
 create mode 100644 test/py/tests/test_fs/conftest.py
 create mode 100644 test/py/tests/test_fs/fstest_defs.py
 create mode 100644 test/py/tests/test_fs/test_basic.py
 create mode 100644 test/py/tests/test_fs/test_ext.py
 create mode 100644 test/py/tests/test_fs/test_mkdir.py
Signature · 1 line
2.18.0