fix: 修复FATFS中不同内部接口不支持FAT12/FAT16 FAT表结束标志

FATFS内部接口中,仅对FAT32的FAT表结束符0x0FFFFFFF做了判断,而忽略了FAT12和FAT16的结束标志。
这会导致子在FAT12/FAT16中,部分功能异常。

Close #I409R6

Signed-off-by: Far <yesiyuan2@huawei.com>
This commit is contained in:
Far 2021-07-12 21:05:19 +08:00
parent 390159f58a
commit 33f5c70e6c
1 changed files with 6 additions and 4 deletions

View File

@ -904,11 +904,13 @@ int fatfs_fallocate64(struct file *filep, int mode, off64_t offset, off64_t len)
return -EBUSY;
}
result = f_expand(fp, (FSIZE_t)offset, (FSIZE_t)len, 1);
if (result == FR_OK && finfo->sclst == 0) {
finfo->sclst = fp->obj.sclust;
if (result == FR_OK) {
if (finfo->sclst == 0) {
finfo->sclst = fp->obj.sclust;
}
result = f_sync(fp);
}
result = f_sync(fp);
unlock_fs(fs, FR_OK);
unlock_fs(fs, result);
return -fatfs_2_vfs(result);
}