|
|
|
@ -92,6 +92,19 @@ isIso9660( const Device* device )
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
isZRam( const Device* device )
|
|
|
|
|
{
|
|
|
|
|
const QString path = device->deviceNode();
|
|
|
|
|
return path.startsWith( "/dev/zram" );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
isFloppyDrive( const Device* device )
|
|
|
|
|
{
|
|
|
|
|
const QString path = device->deviceNode();
|
|
|
|
|
return path.startsWith( "/dev/fd" ) || path.startsWith( "/dev/floppy" );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static inline QDebug&
|
|
|
|
|
operator<<( QDebug& s, QList< Device* >::iterator& it )
|
|
|
|
@ -112,7 +125,7 @@ erase( DeviceList& l, DeviceList::iterator& it )
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QList< Device* >
|
|
|
|
|
getDevices( DeviceType which, qint64 minimumSize )
|
|
|
|
|
getDevices( DeviceType which )
|
|
|
|
|
{
|
|
|
|
|
bool writableOnly = ( which == DeviceType::WritableOnly );
|
|
|
|
|
|
|
|
|
@ -138,11 +151,16 @@ getDevices( DeviceType which, qint64 minimumSize )
|
|
|
|
|
cDebug() << Logger::SubEntry << "Skipping nullptr device";
|
|
|
|
|
it = erase( devices, it );
|
|
|
|
|
}
|
|
|
|
|
else if ( ( *it )->deviceNode().startsWith( "/dev/zram" ) )
|
|
|
|
|
else if ( isZRam( *it ) )
|
|
|
|
|
{
|
|
|
|
|
cDebug() << Logger::SubEntry << "Removing zram" << it;
|
|
|
|
|
it = erase( devices, it );
|
|
|
|
|
}
|
|
|
|
|
else if ( isFloppyDrive( ( *it ) ) )
|
|
|
|
|
{
|
|
|
|
|
cDebug() << Logger::SubEntry << "Removing floppy disk" << it;
|
|
|
|
|
it = erase( devices, it );
|
|
|
|
|
}
|
|
|
|
|
else if ( writableOnly && hasRootPartition( *it ) )
|
|
|
|
|
{
|
|
|
|
|
cDebug() << Logger::SubEntry << "Removing device with root filesystem (/) on it" << it;
|
|
|
|
@ -153,11 +171,6 @@ getDevices( DeviceType which, qint64 minimumSize )
|
|
|
|
|
cDebug() << Logger::SubEntry << "Removing device with iso9660 filesystem (probably a CD) on it" << it;
|
|
|
|
|
it = erase( devices, it );
|
|
|
|
|
}
|
|
|
|
|
else if ( ( minimumSize >= 0 ) && !( ( *it )->capacity() > minimumSize ) )
|
|
|
|
|
{
|
|
|
|
|
cDebug() << Logger::SubEntry << "Removing too-small" << it;
|
|
|
|
|
it = erase( devices, it );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
++it;
|
|
|
|
|