solid: workaround label-like devices in geom backend

note to self: if this is still needed by the time 4.21 is about to be
released just ditch the geom backend

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2021-11-13 07:38:32 +02:00
parent 8faf3f1a0a
commit 7658db79c5
2 changed files with 9 additions and 2 deletions

View file

@ -42,8 +42,6 @@ GeomDevice::GeomDevice(const QString &device)
, m_minor(0)
{
m_realdevice = m_device.right(m_device.size() - qstrlen(GEOM_UDI_PREFIX) - 1).toLatin1();
// devices which are named like path should not be listed by manager, e.g.
// gpt/swapfs or gptid/9d7008c3-990e-11eb-bf4c-002590ec5bf2
Q_ASSERT(!m_realdevice.contains('/'));
int datapos = 0;
int majornumberpos = 0;

View file

@ -108,6 +108,15 @@ QStringList GeomManager::allDevices()
LIST_FOREACH(geomgeom, &geomclass->lg_geom, lg_geom) {
LIST_FOREACH(geomprovider, &geomgeom->lg_provider, lg_provider) {
// qDebug() << geomclass->lg_name << geomgeom->lg_name << geomprovider->lg_name;
// devices which are named like path should not be listed by manager, e.g.
// gpt/swapfs or gptid/9d7008c3-990e-11eb-bf4c-002590ec5bf2. some of these are
// label-like anyway (e.g. CD-ROM providers, they do not even have UUID) so filter
// them the hard way
if (::strchr(geomprovider->lg_name, '/') != NULL) {
continue;
}
const QString devudi = QString::fromLatin1("%1/%2").arg(GEOM_UDI_PREFIX, geomprovider->lg_name);
result << devudi;
}