RageFileManager::Remount
This commit is contained in:
@@ -23,6 +23,9 @@ public:
|
||||
virtual void FlushDirCache( const CString &sPath );
|
||||
virtual bool Remove( const CString &sPath ) { return false; }
|
||||
|
||||
/* Optional: Move to a different place, as if reconstructed with a different path. */
|
||||
virtual bool Remount( const CString &sPath ) { return false; }
|
||||
|
||||
/* Possible error returns from Open, in addition to standard errno.h values: */
|
||||
enum { ERROR_WRITING_NOT_SUPPORTED = -1 };
|
||||
// protected:
|
||||
|
||||
@@ -54,14 +54,9 @@ public:
|
||||
|
||||
|
||||
RageFileDriverDirect::RageFileDriverDirect( CString root_ ):
|
||||
RageFileDriver( new DirectFilenameDB(root_) ),
|
||||
root(root_)
|
||||
RageFileDriver( new DirectFilenameDB(root_) )
|
||||
{
|
||||
if( root.Right(1) != "/" )
|
||||
root += '/';
|
||||
|
||||
/* If the root path doesn't exist, create it. */
|
||||
CreateDirectories( root );
|
||||
Remount( root_ );
|
||||
}
|
||||
|
||||
|
||||
@@ -176,6 +171,18 @@ bool RageFileDriverDirect::Ready()
|
||||
return PathReady( root );
|
||||
}
|
||||
|
||||
bool RageFileDriverDirect::Remount( const CString &sPath )
|
||||
{
|
||||
root = sPath;
|
||||
if( root.Right(1) != "/" )
|
||||
root += '/';
|
||||
|
||||
/* If the root path doesn't exist, create it. */
|
||||
CreateDirectories( root );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static const unsigned int BUFSIZE = 1024*64;
|
||||
RageFileObjDirect::RageFileObjDirect( const CString &path_, int fd_, int mode_ )
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@ public:
|
||||
RageFileBasic *Open( const CString &path, int mode, int &err );
|
||||
bool Remove( const CString &sPath );
|
||||
bool Ready();
|
||||
bool Remount( const CString &sPath );
|
||||
|
||||
private:
|
||||
CString root;
|
||||
|
||||
@@ -498,6 +498,22 @@ void RageFileManager::Unmount( CString Type, CString Root, CString MountPoint )
|
||||
}
|
||||
}
|
||||
|
||||
void RageFileManager::Remount( CString sMountpoint, CString sPath )
|
||||
{
|
||||
RageFileDriver *pDriver = FILEMAN->GetFileDriver( sMountpoint );
|
||||
if( pDriver == NULL )
|
||||
{
|
||||
LOG->Warn( "Remount(%s,%s): mountpoint not found",
|
||||
sMountpoint.c_str(), sPath.c_str() );
|
||||
return;
|
||||
}
|
||||
|
||||
if( !pDriver->Remount(sPath) )
|
||||
LOG->Warn( "Remount(%s,%s): remount failed (does the driver support remounting?)" );
|
||||
|
||||
FILEMAN->ReleaseFileDriver( pDriver );
|
||||
}
|
||||
|
||||
bool RageFileManager::IsMounted( CString MountPoint )
|
||||
{
|
||||
LockMut( *g_Mutex );
|
||||
|
||||
@@ -34,6 +34,11 @@ public:
|
||||
|
||||
void Mount( CString Type, CString RealPath, CString MountPoint );
|
||||
void Unmount( CString Type, CString Root, CString MountPoint );
|
||||
|
||||
/* Change the root of a filesystem. Only a couple drivers support this; it's
|
||||
* used to change memory card mountpoints without having to actually unmount
|
||||
* the driver. */
|
||||
static void Remount( CString sMountpoint, CString sPath );
|
||||
bool IsMounted( CString MountPoint );
|
||||
bool MountpointIsReady( CString MountPoint );
|
||||
struct DriverLocation
|
||||
|
||||
Reference in New Issue
Block a user