Skip to content

Commit

Permalink
fs/fat/fs_fat32.[c|h]: fix fseek bug when file size is multiple of cl…
Browse files Browse the repository at this point in the history
…uster size

Unbinding `ff_currentcluster` and `f_pos`:
1. Added `ff_pos` in `struct fat_file_s`.
2. Added function `fat_zero_cluster` for doing zeroing for gap
   between EOF and new position beyond EOF.
3. Added function `fat_get_sectors` for getting the sector where
   `f_pos` is located, allocting new cluster when `f_pos` is beyond
   EOF.
4. Modify function `fat_read`, and `fat_write` with above functions.
5. Remove redundant logics in `fat_seek` since now new cluster is
   allocated when writing instead of seeking.

Signed-off-by: Yinzhe Wu <[email protected]>
Reviewed-by: Yuezhang Mo <[email protected]>
Reviewed-by: Jacky Cao <[email protected]>
Tested-by: Yinzhe Wu <[email protected]>
  • Loading branch information
Windrow14 authored and xiaoxiang781216 committed Jul 6, 2024
1 parent cef9add commit 479c393
Show file tree
Hide file tree
Showing 2 changed files with 296 additions and 255 deletions.
Loading

0 comments on commit 479c393

Please sign in to comment.