提交 ac0899fa 编写于 作者: O openharmony_ci 提交者: Gitee

!17 修复了FATFS设置卷标的功能

Merge pull request !17 from Far/master
......@@ -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.
先完成此消息的编辑!
想要评论请 注册