mirror of https://github.com/ARMmbed/mbed-os.git
Added mount/unmount to FATFileSystem
Added virtual mount()/unmount() methods to FATFileSystem to allow users to swap removable disks.pull/421/head
parent
48daa3c4a5
commit
979bc3e2d5
|
@ -130,3 +130,15 @@ int FATFileSystem::mkdir(const char *name, mode_t mode) {
|
|||
FRESULT res = f_mkdir(name);
|
||||
return res == 0 ? 0 : -1;
|
||||
}
|
||||
|
||||
int FATFileSystem::mount() {
|
||||
FRESULT res = f_mount(_fsid, &_fs);
|
||||
return res == 0 ? 0 : -1;
|
||||
}
|
||||
|
||||
int FATFileSystem::unmount() {
|
||||
if (disk_sync())
|
||||
return -1;
|
||||
FRESULT res = f_mount(_fsid, NULL);
|
||||
return res == 0 ? 0 : -1;
|
||||
}
|
||||
|
|
|
@ -44,6 +44,8 @@ public:
|
|||
virtual int format();
|
||||
virtual DirHandle *opendir(const char *name);
|
||||
virtual int mkdir(const char *name, mode_t mode);
|
||||
virtual int mount();
|
||||
virtual int unmount();
|
||||
|
||||
virtual int disk_initialize() { return 0; }
|
||||
virtual int disk_status() { return 0; }
|
||||
|
|
Loading…
Reference in New Issue