[frameworks/solid] src/solid/devices/backends/udisks2: udisks2: StorageAccess: if '/' is a mountpoint, return that as filePath()
Bharadwaj Raju <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 13de1d863c7dd52d20ebcfad8c88943685b9e870 by Bharadwaj Raju, on behalf of Bharadwaj Raju.
Committed on 15/07/2026 at 14:26.
Pushed by bharadwaj-raju into branch 'master'.
udisks2: StorageAccess: if '/' is a mountpoint, return that as filePath()
For example, in KDE Linux, the subvolume mounted at `/system` is the "base"
mount point, i.e. `mnt_fs_get_root` is `/`. A different subvolume is actually
mounted as the FS root:
/dev/nvme0n1p3 on / type btrfs (...,subvolid=258,subvol=/@system)
/dev/nvme0n1p3 on /system type btrfs (...,subvolid=5,subvol=/)
This means that clicking on the volume in Dolphin takes the user to
`/system` instead of the actual FS root, and `Solid::Device::storageAccessFromPath`
doesn't work for reasonable queries like `/` or `/home/username`.
This change introduces a simple heuristic to get around this: if `/` is
in the list of mountpoints returned by UDisks, then just return `/` as
`StorageAccess::filePath()`.
M +4 -0 src/solid/devices/backends/udisks2/udisksstorageaccess.cpp
https://invent.kde.org/frameworks/solid/-/commit/13de1d863c7dd52d20ebcfad8c88943685b9e870
diff --git a/src/solid/devices/backends/udisks2/udisksstorageaccess.cpp b/src/solid/devices/backends/udisks2/udisksstorageaccess.cpp
index 81235343..2c4a76ec 100644
--- a/src/solid/devices/backends/udisks2/udisksstorageaccess.cpp
+++ b/src/solid/devices/backends/udisks2/udisksstorageaccess.cpp
@@ -245,6 +245,10 @@ QString StorageAccess::filePath() const
return potentialMountPoint;
}
+ if (mntPoints.contains(QByteArrayLiteral("/\x00"))) {
+ return QStringLiteral("/");
+ }
+
// Device has bind mounts?
const QString basePoint = baseMountPoint(m_device->prop(QStringLiteral("Device")).toByteArray());