extmod/vfs_fat: Allow setting label of partition when creating FAT fs#15495
extmod/vfs_fat: Allow setting label of partition when creating FAT fs#15495tstenvold wants to merge 4 commits into
Conversation
|
Thanks for the contribution. This feature has actually been requested a few times, and was implemented as a separate I actually think a separate function is more useful than adding a keyword argument to If we did go with a separate |
|
This was the trade-off I was also thinking. The microcontroller rarely cares (or should) about the volume label, so it's more a quality of life for when the controller is plugged into a computer, and is likely not changed often. A separate function to set/get the label is more overhead than I think is required, and getting the label has many edge cases that for when volume labels aren't supported, but yes there isn't a straight forward solution. |
Correcting using the wrong def
|
I'm closing this PR because it's not the way forward. |
|
Code size report: |
Summary
During a factory reset, a label for the flash drive can be set via
MICROPY_HW_FLASH_FS_LABEL. However, it would be convenient to be able to set this value when usingvfs.VfsFat.mkfs(p1). This PR allows an optional label argument tovfs.VfsFat.mkfs(p1, "label")Testing
Tested on a PYBV11 for creating a new label for the mounted flash with no label and with a label
Trade-offs and Alternatives
Slight additional overhead for
mkfs(). Incompatible function call for littlefsX.An alternative, would be to add a
vfs.VfsFat.setlabel("label"), I decided against this as it would be an additional function call adding more overhead.