Add VfsFat.label property · losingrose/circuitpython@fe7f405 · GitHub
Skip to content

Commit fe7f405

Browse files
committed
Add VfsFat.label property
These allow accessing the filesystem label. For instance, in boot.py, you can set the label on the built-in storage with: storage.remount('/', False) storage.getmount('/').label = "NEWLABEL" storage.remount('/', True) Users with multiple CIRCUITPY boards may find it desirable to choose a different label for each board they own.
1 parent c08f5a3 commit fe7f405

4 files changed

Lines changed: 38 additions & 0 deletions

File tree

extmod/vfs_fat.c

Lines changed: 34 additions & 0 deletions

ports/unix/mpconfigport_coverage.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,5 @@
4343
#define MICROPY_PY_IO_BUFFEREDWRITER (1)
4444
#undef MICROPY_VFS_FAT
4545
#define MICROPY_VFS_FAT (1)
46+
#define MICROPY_FATFS_USE_LABEL (1)
4647
#define MICROPY_PY_FRAMEBUF (1)

tests/extmod/vfs_fat_ramdisk.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ def ioctl(self, op, arg):
5454
vfs = uos.VfsFat(bdev)
5555
uos.mount(vfs, "/ramdisk")
5656

57+
vfs.label = 'label test'
58+
print("label:", vfs.label)
5759
print("statvfs:", vfs.statvfs("/ramdisk"))
5860
print("getcwd:", vfs.getcwd())
5961

tests/extmod/vfs_fat_ramdisk.py.exp

Lines changed: 1 addition & 0 deletions

0 commit comments

Comments
 (0)