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().

Part of kde-linux/kde-linux#668

Edited by Nate Graham

Merge request reports

Loading