From 1f7e6fa76fae872776cfb33a3060cf1a6a1541a7 Mon Sep 17 00:00:00 2001 From: wangchen <253227059@qq.com> Date: Tue, 31 May 2022 08:57:16 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20FatFs=E5=8D=87=E7=BA=A7r0.14a=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=90=8C=E6=AD=A53.0=E5=88=86=E6=94=AF=20=E3=80=90?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E3=80=91FatFs=E5=8D=87=E7=BA=A7r0.14a?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=90=8C=E6=AD=A53.0=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【修改方案】 将三方库FatFs升级至r0.14a版本 主要修改点为: 适配_mkfs、find_volume接口更新 【影响】 对现有的产品编译不会有影响。 re #I5A7AS Signed-off-by: wangchen Change-Id: I428fcb930fa0ead43ea033d14898fc0a00445933 --- fs/fat/os_adapt/fatfs.c | 5 ++++- fs/fat/os_adapt/fatfs.h | 2 +- fs/fat/virpart/src/virpartff.c | 6 +++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/fs/fat/os_adapt/fatfs.c b/fs/fat/os_adapt/fatfs.c index f638803f..c1af6fc3 100644 --- a/fs/fat/os_adapt/fatfs.c +++ b/fs/fat/os_adapt/fatfs.c @@ -1849,6 +1849,7 @@ int fatfs_mkfs (struct Vnode *device, int sectors, int option) BYTE *work_buff = NULL; los_part *part = NULL; FRESULT result; + MKFS_PARM opt = {0}; int ret; part = los_part_find(device); @@ -1873,7 +1874,9 @@ int fatfs_mkfs (struct Vnode *device, int sectors, int option) return -ENOMEM; } - result = _mkfs(part, sectors, option, work_buff, FF_MAX_SS); + opt.n_sect = sectors; + opt.fmt = (BYTE)option; + result = _mkfs(part, &opt, work_buff, FF_MAX_SS); free(work_buff); if (result != FR_OK) { return -fatfs_2_vfs(result); diff --git a/fs/fat/os_adapt/fatfs.h b/fs/fat/os_adapt/fatfs.h index 734cf948..5fe1a905 100644 --- a/fs/fat/os_adapt/fatfs.h +++ b/fs/fat/os_adapt/fatfs.h @@ -146,7 +146,7 @@ int fatfs_fscheck(struct Vnode* vnode, struct fs_dirent_s *dir); FRESULT find_fat_partition(FATFS *fs, los_part *part, BYTE *format, QWORD *start_sector); FRESULT init_fatobj(FATFS *fs, BYTE fmt, QWORD start_sector); -FRESULT _mkfs(los_part *partition, int sector, int opt, BYTE *work, UINT len); +FRESULT _mkfs(los_part *partition, const MKFS_PARM *opt, BYTE *work, UINT len); #ifdef __cplusplus #if __cplusplus diff --git a/fs/fat/virpart/src/virpartff.c b/fs/fat/virpart/src/virpartff.c index f6ac5bfd..066ba2e7 100644 --- a/fs/fat/virpart/src/virpartff.c +++ b/fs/fat/virpart/src/virpartff.c @@ -525,7 +525,7 @@ FRESULT f_checkvirpart(FATFS *fs, const TCHAR *path, BYTE vol) } /* Lock the filesystem object */ - res = find_volume(&path, &fs, FA_WRITE); /* Update the filesystem info to the parent fs */ + res = mount_volume(&path, &fs, FA_WRITE); /* Update the filesystem info to the parent fs */ if (res != FR_OK) { LEAVE_FF(fs, res); } @@ -683,7 +683,7 @@ FRESULT f_makevirpart(FATFS *fs, const TCHAR *path, BYTE vol) } /* Lock the filesystem object */ - res = find_volume(&path, &fs, FA_WRITE); /* Update the filesystem info to the parent fs */ + res = mount_volume(&path, &fs, FA_WRITE); /* Update the filesystem info to the parent fs */ if (res != FR_OK) { LEAVE_FF(fs, res); } @@ -774,7 +774,7 @@ FRESULT f_getvirfree(const TCHAR *path, DWORD *nclst, DWORD *cclst) DIR dj; /* Find volume to Update the global FSINFO */ - res = find_volume(&path, &fs, 0); + res = mount_volume(&path, &fs, 0); if (res != FR_OK) { LEAVE_FF(fs, res); } -- GitLab