[Toybox] mount option to show what a loopback mount is backed by?

Rob Landley rob at landley.net
Tue Mar 19 09:21:53 PDT 2024


On 3/18/24 20:16, enh via Toybox wrote:
> mount currently shows something like:
> 
> /dev/block/loop86 on /apex/com.android.hardware.tetheroffload at 1 type ext4
> (ro,dirsync,seclabel,nodev,noatime)
> 
> but often the user wants to know what "loop86" refers to. and it's unlikely they
> know to look in /sys/block/loop*/loop/backing_file.

Toybox doesn't implement "losetup -l" yet, but it does losetup -s on specific
loop devices. I'm assuming the /sys interface is so A) you don't need to be
root, B) it returns more than 64 bytes.

Requiring the loop device to be mounted rather than associated to get info on it
is limiting, but mount providing a convenience function is reasonable...

> afaik, though, there's no coreutils option to show this, so it would involve
> making up a new command-line option as well as some new output...

Or just always hallucinating it into a file=/path/to/blah argument in the
parenthetical, maybe? (With appropriate kernel-style %20 escapes for space and
parentheses and comma and such, I forget which characters the kernel already
escapes...)

Let's see... https://www.kernel.org/doc/Documentation/admin-guide/devices.txt
says block devices with major 7 are loop devices, doesn't limit the minor range...

Ok, first attempt (commit c1fb95a3d859) doesn't have escape logic if the path
has weird characters in it, but it should be obvious where to add that if it
comes up. Look reasonable?

Rob


More information about the Toybox mailing list