Commit d9f6b6d1 authored by Thiago Macieira's avatar Thiago Macieira
Browse files

QStorageInfo: update the detection of pseudo filesystems


Allow tmpfs filesystems to be reported, as they're often usable by the
user, mounted in /tmp and in /run (the fs for $XDG_RUNTIME_DIR).

But disallow anything whose device is not a pathname. This catches most
of everything else that wasn't specifically tested for before, like
virtual fuse filesystems, like GVFS.

Change-Id: I3e15a26e0e424169ac2bffff1417b7cee0f8ec97
Reviewed-by: default avatarIvan Komissarov <ABBAPOH@gmail.com>
Reviewed-by: default avatarThiago Macieira <thiago.macieira@intel.com>
Showing with 8 additions and 4 deletions
......@@ -160,12 +160,15 @@ static bool isPseudoFs(const QStorageIterator &it)
QByteArray type = it.fileSystemType();
if (type == "tmpfs")
return true;
return false;
#if defined(Q_OS_LINUX)
if (type == "rootfs" || type == "rpc_pipefs")
return true;
#endif
if (!it.device().startsWith('/'))
return true;
return false;
}
......
......@@ -66,10 +66,11 @@ int main(int argc, char *argv[])
printf("Filesystem (Type) Size Available BSize Label Mounted on\n");
foreach (const QStorageInfo &info, volumes) {
const QString fsAndType = info.device() + QLatin1String(" (") +
info.fileSystemType() + QLatin1Char(')');
QByteArray fsAndType = info.device();
if (info.fileSystemType() != fsAndType)
fsAndType += " (" + info.fileSystemType() + ')';
printf("%-19s R%c ", qPrintable(fsAndType), info.isReadOnly() ? 'O' : 'W');
printf("%-19s R%c ", fsAndType.constData(), info.isReadOnly() ? 'O' : 'W');
if (fsAndType.size() > 19)
printf("\n%23s", "");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment