提交 13de8fe6 编写于 作者: F Far

fix: 恢复了FATFS设置卷标的功能

Liteos_a FATFS需要提供格式化时设置卷标的功能,该功能在当前系统中缺失。
为了适配VFS层重构的逻辑,重新封装部分函数。

Close #I3Y5G8
Signed-off-by: NFar <yesiyuan2@huawei.com>
上级 688caa96
......@@ -5095,13 +5095,10 @@ FRESULT f_getlabel (
/* Set Volume Label */
/*-----------------------------------------------------------------------*/
FRESULT f_setlabel (
const TCHAR* label /* Volume label to set with heading logical drive number */
)
FRESULT set_volumn_label(FATFS *fs, const TCHAR *label)
{
FRESULT res;
DIR dj;
FATFS *fs;
BYTE dirvn[22];
UINT di;
WCHAR wc;
......@@ -5109,13 +5106,7 @@ FRESULT f_setlabel (
#if FF_USE_LFN
DWORD dc;
#endif
/* Get logical drive */
res = find_volume(&label, &fs, FA_WRITE);
if (res != FR_OK) LEAVE_FF(fs, res);
/* On the FAT/FAT32 volume */
/* On the FAT/FAT32 volume */
mem_set(dirvn, ' ', 11);
di = 0;
while ((UINT)*label >= ' ') { /* Create volume label */
......@@ -5171,6 +5162,22 @@ FRESULT f_setlabel (
}
}
return res;
}
FRESULT f_setlabel (
const TCHAR* label /* Volume label to set with heading logical drive number */
)
{
FRESULT res;
FATFS *fs;
/* Get logical drive */
res = find_volume(&label, &fs, FA_WRITE);
if (res != FR_OK) LEAVE_FF(fs, res);
res = set_volumn_label(fs, label);
LEAVE_FF(fs, res);
}
......
......@@ -484,6 +484,7 @@ FRESULT remove_chain (FFOBJID* obj, DWORD clst, DWORD pclst);
void mem_set (void* dst, int val, UINT cnt);
void mem_cpy (void* dst, const void* src, UINT cnt);
int fatfs_get_vol (FATFS *fat);
FRESULT set_volumn_label(FATFS *fs, const TCHAR *label);
#define f_eof(fp) ((int)((fp)->fptr == (fp)->obj.objsize))
#define f_error(fp) ((fp)->err)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册