parent
1919c2a712
commit
1b98974f07
@ -55,6 +55,10 @@
|
|||||||
#include <QFutureWatcher>
|
#include <QFutureWatcher>
|
||||||
#include <QtConcurrent/QtConcurrent>
|
#include <QtConcurrent/QtConcurrent>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Does the given @p device contain the root filesystem? This is true if
|
||||||
|
* the device contains a partition which is currently mounted at / .
|
||||||
|
*/
|
||||||
static bool
|
static bool
|
||||||
hasRootPartition( Device* device )
|
hasRootPartition( Device* device )
|
||||||
{
|
{
|
||||||
@ -64,6 +68,19 @@ hasRootPartition( Device* device )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
isMounted( Device* device )
|
||||||
|
{
|
||||||
|
cDebug() << "Checking for mounted partitions in" << device->deviceNode();
|
||||||
|
for ( auto it = PartitionIterator::begin( device ); it != PartitionIterator::end( device ); ++it )
|
||||||
|
{
|
||||||
|
cDebug() << " .." << ( *it )->partitionPath() << "mount" << ( *it )->mountPoint();
|
||||||
|
if ( ! ( *it )->mountPoint().isEmpty() )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
isIso9660( const Device* device )
|
isIso9660( const Device* device )
|
||||||
{
|
{
|
||||||
@ -162,9 +179,12 @@ PartitionCoreModule::doInit()
|
|||||||
|
|
||||||
// Remove the device which contains / from the list
|
// Remove the device which contains / from the list
|
||||||
for ( DeviceList::iterator it = devices.begin(); it != devices.end(); )
|
for ( DeviceList::iterator it = devices.begin(); it != devices.end(); )
|
||||||
if ( ! ( *it ) || hasRootPartition( *it ) ||
|
if ( ! ( *it ) ||
|
||||||
( *it )->deviceNode().startsWith( "/dev/zram" ) ||
|
hasRootPartition( *it ) ||
|
||||||
isIso9660( *it ) )
|
isIso9660( *it ) ||
|
||||||
|
isMounted( *it ) ||
|
||||||
|
( *it )->deviceNode().startsWith( "/dev/zram" )
|
||||||
|
)
|
||||||
{
|
{
|
||||||
cDebug() << " .. Winnowing" << ( ( *it ) ? ( *it )->deviceNode() : QString( "<null device>" ) );
|
cDebug() << " .. Winnowing" << ( ( *it ) ? ( *it )->deviceNode() : QString( "<null device>" ) );
|
||||||
it = devices.erase( it );
|
it = devices.erase( it );
|
||||||
|
Loading…
Reference in New Issue
Block a user