本文整理汇总了C++中DeviceList::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ DeviceList::erase方法的具体用法?C++ DeviceList::erase怎么用?C++ DeviceList::erase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DeviceList
的用法示例。
在下文中一共展示了DeviceList::erase方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cDebug
void
PartitionCoreModule::doInit()
{
FileSystemFactory::init();
using DeviceList = QList< Device* >;
CoreBackend* backend = CoreBackendManager::self()->backend();
DeviceList devices = backend->scanDevices( true );
cDebug() << "Winnowing" << devices.count() << "devices.";
// Remove the device which contains / from the list
for ( DeviceList::iterator it = devices.begin(); it != devices.end(); )
if ( ! (*it) || hasRootPartition( *it ) ||
(*it)->deviceNode().startsWith( "/dev/zram") ||
isIso9660( *it ) )
{
cDebug() << " .. Winnowing" << ( (*it) ? (*it)->deviceNode() : QString( "<null device>" ) );
it = devices.erase( it );
}
else
++it;
cDebug() << "LIST OF DETECTED DEVICES:";
cDebug() << "node\tcapacity\tname\tprettyName";
for ( auto device : devices )
{
auto deviceInfo = new DeviceInfo( device );
m_deviceInfos << deviceInfo;
cDebug() << device->deviceNode() << device->capacity() << device->name() << device->prettyName();
}
cDebug() << ".." << devices.count() << "devices detected.";
m_deviceModel->init( devices );
// The following PartUtils::runOsprober call in turn calls PartUtils::canBeResized,
// which relies on a working DeviceModel.
m_osproberLines = PartUtils::runOsprober( this );
// We perform a best effort of filling out filesystem UUIDs in m_osproberLines
// because we will need them later on in PartitionModel if partition paths
// change.
// It is a known fact that /dev/sda1-style device paths aren't persistent
// across reboots (and this doesn't affect us), but partition numbers can also
// change at runtime against our will just for shits and giggles.
// But why would that ever happen? What system could possibly be so poorly
// designed that it requires a partition path rearrangement at runtime?
// Logical partitions on an MSDOS disklabel of course.
// See DeletePartitionJob::updatePreview.
for ( auto deviceInfo : m_deviceInfos )
{
for ( auto it = PartitionIterator::begin( deviceInfo->device.data() );
it != PartitionIterator::end( deviceInfo->device.data() ); ++it )
{
Partition* partition = *it;
for ( auto jt = m_osproberLines.begin();
jt != m_osproberLines.end(); ++jt )
{
if ( jt->path == partition->partitionPath() &&
partition->fileSystem().supportGetUUID() != FileSystem::cmdSupportNone &&
!partition->fileSystem().uuid().isEmpty() )
{
jt->uuid = partition->fileSystem().uuid();
}
}
}
}
for ( auto deviceInfo : m_deviceInfos )
{
deviceInfo->partitionModel->init( deviceInfo->device.data(), m_osproberLines );
}
m_bootLoaderModel->init( devices );
if ( QDir( "/sys/firmware/efi/efivars" ).exists() )
scanForEfiSystemPartitions(); //FIXME: this should be removed in favor of
// proper KPM support for EFI
}