Exclude ISO9660 volumes.

This commit is contained in:
Teo Mrnjavac 2016-09-02 15:12:48 +02:00
parent ad219e1b8e
commit 6c928e0404

View File

@ -63,6 +63,36 @@ hasRootPartition( Device* device )
return false; return false;
} }
static bool
isIso9660( const Device* device )
{
QString path = device->deviceNode();
if ( path.isEmpty() )
return false;
QProcess blkid;
blkid.start( "blkid", { path } );
blkid.waitForFinished();
QString output = QString::fromLocal8Bit( blkid.readAllStandardOutput() );
if ( output.contains( "iso9660" ) )
return true;
if ( device->partitionTable() &&
!device->partitionTable()->children().isEmpty() )
{
for ( const Partition* partition : device->partitionTable()->children() )
{
path = partition->partitionPath();
blkid.start( "blkid", { path } );
blkid.waitForFinished();
QString output = QString::fromLocal8Bit( blkid.readAllStandardOutput() );
if ( output.contains( "iso9660" ) )
return true;
}
}
return false;
}
//- DeviceInfo --------------------------------------------- //- DeviceInfo ---------------------------------------------
PartitionCoreModule::DeviceInfo::DeviceInfo( Device* _device ) PartitionCoreModule::DeviceInfo::DeviceInfo( Device* _device )
: device( _device ) : device( _device )
@ -128,9 +158,7 @@ PartitionCoreModule::doInit()
for ( QList< Device* >::iterator it = devices.begin(); it != devices.end(); ) for ( QList< Device* >::iterator it = devices.begin(); it != devices.end(); )
if ( hasRootPartition( *it ) || if ( hasRootPartition( *it ) ||
(*it)->deviceNode().startsWith( "/dev/zram") || (*it)->deviceNode().startsWith( "/dev/zram") ||
( (*it)->partitionTable() && isIso9660( *it ) )
(*it)->partitionTable()->type() == PartitionTable::loop &&
(*it)->partitionTable()->isChildMounted() ) )
it = devices.erase( it ); it = devices.erase( it );
else else
++it; ++it;