Merge pull request #4562 from geky/fat-init-bd

fatfs: Fixed initialization of block device in mount/unmount functions
pull/4592/head
Jimmy Brisson 2017-06-19 11:02:52 -05:00 committed by GitHub
commit e4bdedc7c2
2 changed files with 4 additions and 11 deletions

View File

@ -247,10 +247,10 @@ FATFileSystem::~FATFileSystem()
int FATFileSystem::mount(BlockDevice *bd) {
// requires duplicate definition to allow virtual overload to work
return mount(bd, false);
return mount(bd, true);
}
int FATFileSystem::mount(BlockDevice *bd, bool force) {
int FATFileSystem::mount(BlockDevice *bd, bool mount) {
lock();
if (_id != -1) {
unlock();
@ -265,7 +265,7 @@ int FATFileSystem::mount(BlockDevice *bd, bool force) {
_fsid[1] = ':';
_fsid[2] = '\0';
debug_if(FFS_DBG, "Mounting [%s] on ffs drive [%s]\n", getName(), _fsid);
FRESULT res = f_mount(&_fs, _fsid, force);
FRESULT res = f_mount(&_fs, _fsid, mount);
unlock();
return fat_error_remap(res);
}

View File

@ -69,14 +69,6 @@ public:
*/
virtual int mount(BlockDevice *bd);
/** Mounts a filesystem to a block device
*
* @param bd BlockDevice to mount to
* @param force Flag to force the underlying filesystem to force mounting the filesystem
* @return 0 on success, negative error code on failure
*/
virtual int mount(BlockDevice *bd, bool force);
/** Unmounts a filesystem from the underlying block device
*
* @return 0 on success, negative error code on failure
@ -235,6 +227,7 @@ private:
protected:
virtual void lock();
virtual void unlock();
virtual int mount(BlockDevice *bd, bool mount);
};
#endif