kmountpoint: tell whether a mount is on a removable device

Code that writes to a mount could not ask whether the device can be unplugged, so each caller guessed from the filesystem type.

KMountPoint::isOnRemovableDevice() reads the answer from sysfs at the first call and keeps it. It follows a device-mapper or RAID device down to the disks under it, and a partition up to its disk. Most USB disks report no removable media, so the port or the PCIe slot that the kernel marks removable counts as well, and so does an SD card. A network filesystem, and a system without sysfs, give false.

Used in !2283 (merged)

Edited by Méven Car

Merge request reports

Loading
Loading