summaryrefslogtreecommitdiffstatshomepage
path: root/extmod
diff options
context:
space:
mode:
authorTerence Stenvold <tstenvold@gmail.com>2024-07-19 12:38:44 +0200
committerDamien George <damien@micropython.org>2024-07-23 11:39:17 +1000
commit390390ec37d01c3f0ae0af7c489d36ac1e84fbe1 (patch)
tree507c10f11b9f174967146659c09a8eb81716c46d /extmod
parent444d7bacbec51321cea955802b62dff9318dcbf6 (diff)
downloadmicropython-390390ec37d01c3f0ae0af7c489d36ac1e84fbe1.tar.gz
micropython-390390ec37d01c3f0ae0af7c489d36ac1e84fbe1.zip
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.
Diffstat (limited to 'extmod')
-rw-r--r--extmod/vfs_fat.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/extmod/vfs_fat.c b/extmod/vfs_fat.c
index 4f01432f54..ee1169b8c3 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);