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

enh enh at google.com
Tue Mar 19 17:22:52 PDT 2024


On Tue, Mar 19, 2024 at 9:13 AM Rob Landley <rob at landley.net> wrote:

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

(yeah, that was the kind of "new syntax" i meant. not _crazy_ new, but a
bit of a divergence from existing "you could have this in an fstab"
practice. but since [afaik] you can set up these kinds of mounts in fstab
anyway... seems fair enough?)


> 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?
>

to directly quote from the internal thread asking for this: "BEAUTIFUL!!!"
:-)


> Rob
> _______________________________________________
> Toybox mailing list
> Toybox at lists.landley.net
> http://lists.landley.net/listinfo.cgi/toybox-landley.net
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20240319/c0878cb2/attachment.htm>


More information about the Toybox mailing list