mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-11-02 14:51:58 +00:00
The non "util-linux" versions of "losetup" don't seem to have
options like "-j" ("--associated") which lists the loop devices
associated with the file, or "--show" which displays the name
of the assigned loop device for a file.
For instance, when "-j" is used, "GetLoopDevice()" fails with:
$ losetup -j /path/to/file
losetup: unrecognized option: j
BusyBox v1.32.1 () multi-call binary.
Add a fallback option to lookup the device from "sysfs" in cases
where "losetup" fails for an invalid option. This can be done by
reading the backing file from "/sys/block/loop*/loop/backing_file"
for each of the devices listed there.
Signed-off-by: Srinidhi Kaushik <shrinidhi.kaushik@gmail.com>