[Interest] Possible bug: QStorageInfo does not show private mounts (Linux)
Marian Beermann
public at enkore.de
Sat Oct 11 14:38:44 CEST 2014
QStorageInfo::mountedVolumes does not return private mounts, which are
usually located under the /run tree (e.g.
/run/media/$USERNAME/$DEVICENAME/).
Is this a bug or intended behaviour?
> QStorageInfo::mountedVolumes()
> Returns the list of QStorageInfo objects that corresponds to the list
of currently mounted filesystems.
>
> On Unix operating systems, it returns the list of all mounted
filesystems (except for pseudo filesystems).
Seems like a bug to me, since a mounted thumb drive (for example) isn't
a pseudo filesystem.
This behaviour is triggered by isPseudoFs function in qstorageinfo_unix.cpp:
-- snip --
static bool isPseudoFs(const QString &mountDir, const QByteArray &type)
{
if (mountDir.startsWith(QLatin1String("/dev"))
|| mountDir.startsWith(QLatin1String("/proc"))
|| mountDir.startsWith(QLatin1String("/run"))
|| mountDir.startsWith(QLatin1String("/sys"))
|| mountDir.startsWith(QLatin1String("/var/run"))
|| mountDir.startsWith(QLatin1String("/var/lock"))) {
return true;
}
#if defined(Q_OS_LINUX)
if (type == "rootfs")
return true;
#else
Q_UNUSED(type);
#endif
return false;
}
-- snip --
Maybe it would be better to have a blacklist of FS types. This would
work very well, especially when discarding volumes mounted under a
blacklisted FS ; e.g. when blacklisting sysfs one doesn't need to care
about all the different filesystems the kernel uses there. First few
things that come to mind when considering types for a blacklist: proc,
sysfs, devtmpfs, configfs, kernfs.
More information about the Interest
mailing list