fn device_source_prefixes(device_name: &str) -> Vec<String>Expand description
Build the list of source-path prefixes to look for in /proc/mounts for
a given block device.
Most devices map 1-to-1: /dev/sda → ["/dev/sda"] (matches sda1, sda2 …).
Two special cases add extra prefixes:
-
Device-mapper (
dm-*):/proc/mountsuses/dev/mapper/<name>, not/dev/dm-N. The canonical name is read from/sys/block/<dev>/dm/name. -
/dev/root: some distros (Ubuntu/AWS, cloud-init images) expose the root partition under this alias in/proc/mountsinstead of the real device path. Resolution is attempted first viaread_link(covers distros that make it a symlink) and then via amajor:minorcomparison between/proc/self/mountinfoand/sys/block/<dev>/<part>/dev(covers distros where it is a plain device node). Seedev_root_is_on_device.