remove MemoryCardDriverThreaded::UnmountMountPoint; remount the fs instead (makes

the timeout FS simpler)
use timeout FS in windows memory card code for testing
This commit is contained in:
Glenn Maynard
2005-01-27 04:39:10 +00:00
parent 3b25fd6c60
commit cadbdf2bee
4 changed files with 15 additions and 26 deletions
@@ -132,25 +132,14 @@ bool MemoryCardDriverThreaded::MountAndTestWrite( UsbStorageDevice* pDevice, CSt
if( !iter->bWriteTestSucceeded )
return false;
/* Move the VFS mount to the destination. This is safe to do in the main thread. */
FILEMAN->Remount( sMountPoint, pDevice->sOsMountDir );
this->Mount( pDevice, sMountPoint );
return pDevice->bWriteTestSucceeded;
}
void MemoryCardDriverThreaded::UnmountMountPoint( const CString &sMountPoint )
{
vector<RageFileManager::DriverLocation> Mounts;
FILEMAN->GetLoadedDrivers( Mounts );
for( unsigned i = 0; i < Mounts.size(); ++i )
{
if( Mounts[i].Type.CompareNoCase( "dir" ) )
continue; // wrong type
if( Mounts[i].MountPoint.CompareNoCase( sMountPoint ) )
continue; // wrong mount point
FILEMAN->Unmount( Mounts[i].Type, Mounts[i].Root, Mounts[i].MountPoint );
}
}
/*
* (c) 2003-2004 Chris Danford
* All rights reserved.
@@ -40,9 +40,6 @@ protected:
vector<UsbStorageDevice> m_vStorageDevices;
bool m_bStorageDevicesChanged;
RageMutex m_mutexStorageDevices; // protects the above two
// placed here for use by derivitives to eliminate duplicate code
void UnmountMountPoint( const CString &sMountPoint );
};
#endif
@@ -522,8 +522,6 @@ void MemoryCardDriverThreaded_Linux::Mount( UsbStorageDevice* pDevice, CString s
{
ASSERT( !pDevice->sOsMountDir.empty() );
UnmountMountPoint( sMountPoint );
FILEMAN->Mount( "dir", pDevice->sOsMountDir, sMountPoint.c_str() );
LOG->Trace( "FILEMAN->Mount %s %s", pDevice->sOsMountDir.c_str(), sMountPoint.c_str() );
@@ -8,7 +8,8 @@
#include "Profile.h"
#include "PrefsManager.h"
const CString TEMP_MOUNT_POINT = "@mctemp/";
const CString TEMP_MOUNT_POINT_INTERNAL = "@mctemp/";
const CString TEMP_MOUNT_POINT = "@mctemptimeout/";
MemoryCardDriverThreaded_Windows::MemoryCardDriverThreaded_Windows()
@@ -104,15 +105,20 @@ void MemoryCardDriverThreaded_Windows::MountThreadDoOneUpdate()
UsbStorageDevice usbd;
usbd.SetOsMountDir( sDrive );
usbd.bWriteTestSucceeded = TestWrite( sDrive );
// read name
this->Mount( &usbd, TEMP_MOUNT_POINT );
FILEMAN->FlushDirCache( TEMP_MOUNT_POINT );
FILEMAN->Mount( "dir", usbd.sOsMountDir, TEMP_MOUNT_POINT_INTERNAL );
FILEMAN->Mount( "timeout", TEMP_MOUNT_POINT_INTERNAL, TEMP_MOUNT_POINT );
Profile profile;
CString sProfileDir = TEMP_MOUNT_POINT + PREFSMAN->m_sMemoryCardProfileSubdir + '/';
profile.LoadEditableDataFromDir( sProfileDir );
usbd.bIsNameAvailable = true;
usbd.sName = profile.GetDisplayName();
UnmountMountPoint( TEMP_MOUNT_POINT );
FILEMAN->Unmount( "timeout", TEMP_MOUNT_POINT_INTERNAL, TEMP_MOUNT_POINT );
FILEMAN->Unmount( "dir", usbd.sOsMountDir, TEMP_MOUNT_POINT_INTERNAL );
vNewStorageDevices.push_back( usbd );
}
@@ -134,10 +140,9 @@ void MemoryCardDriverThreaded_Windows::Mount( UsbStorageDevice* pDevice, CString
{
ASSERT( !pDevice->sOsMountDir.empty() );
UnmountMountPoint( sMountPoint );
FILEMAN->Mount( "dir", pDevice->sOsMountDir, sMountPoint.c_str() );
LOG->Trace( "FILEMAN->Mount %s %s", pDevice->sOsMountDir.c_str(), sMountPoint.c_str() );
// nothing to do here...
}
void MemoryCardDriverThreaded_Windows::Unmount( UsbStorageDevice* pDevice, CString sMountPoint )