diff options
| author | Terence Stenvold <tstenvold@gmail.com> | 2024-07-19 12:38:44 +0200 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2024-07-23 11:39:17 +1000 |
| commit | 390390ec37d01c3f0ae0af7c489d36ac1e84fbe1 (patch) | |
| tree | 507c10f11b9f174967146659c09a8eb81716c46d | |
| parent | 444d7bacbec51321cea955802b62dff9318dcbf6 (diff) | |
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.
| -rw-r--r-- | extmod/vfs_fat.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/extmod/vfs_fat.c b/extmod/vfs_fat.c index 4f01432f5..ee1169b8c 100644 --- a/extmod/vfs_fat.c +++ b/extmod/vfs_fat.c @@ -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); |
