Skip to content

Commit 390390e

Browse files
tstenvolddpgeorge
authored andcommitted
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.
1 parent 444d7ba commit 390390e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

extmod/vfs_fat.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ static mp_obj_t fat_vfs_mkfs(mp_obj_t bdev_in) {
114114
mp_raise_OSError(fresult_to_errno_table[res]);
115115
}
116116

117+
// set the filesystem label if it's configured
118+
#ifdef MICROPY_HW_FLASH_FS_LABEL
119+
f_setlabel(&vfs->fatfs, MICROPY_HW_FLASH_FS_LABEL);
120+
#endif
121+
117122
return mp_const_none;
118123
}
119124
static MP_DEFINE_CONST_FUN_OBJ_1(fat_vfs_mkfs_fun_obj, fat_vfs_mkfs);

0 commit comments

Comments
 (0)