extmod/vfs_fat: Set default volume label on mkfs if it's defined.

Using mkfs doesn't set a volume label for FAT filesystems.  This commit
will set the volume label if `MICROPY_HW_FLASH_FS_LABEL` is defined.
This commit is contained in:
Terence Stenvold 2024-07-19 12:38:44 +02:00 committed by Damien George
parent 444d7bacbe
commit 390390ec37
1 changed files with 5 additions and 0 deletions

View File

@ -114,6 +114,11 @@ static mp_obj_t fat_vfs_mkfs(mp_obj_t bdev_in) {
mp_raise_OSError(fresult_to_errno_table[res]);
}
// set the filesystem label if it's configured
#ifdef MICROPY_HW_FLASH_FS_LABEL
f_setlabel(&vfs->fatfs, MICROPY_HW_FLASH_FS_LABEL);
#endif
return mp_const_none;
}
static MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_mkfs_fun_obj, fat_vfs_mkfs);