[Toybox] [PATCH] Fix losetup for Android.

Rob Landley rob at landley.net
Sat Dec 2 23:15:39 PST 2017


On 11/29/2017 08:50 PM, enh wrote:
> let me know if you'd rather have the #ifdef in portability.h --- i'm
> not sure whether your aim is to have all #ifdefery in there, or
> whether something should be needed in two places first.
> 
> (the other alternative would be to always try both locations, but that
> seemed even worse.)

Trying both sounds right to me. I could see Red Hat Enterprise or
similar doing this too.

Alas there isn't a real /dev spec since the Linux Foundation absorbed
and destroyed the Linux Standards Base. There are entries in devtmpfs's
block subdir but they're all symlinks ala 7:0 -> ../loop0

Still, if you're using devtmpfs you get the top level entry, and if it's
not there looking in the subdir as a fallback works for android and
maybe elsewhere.

Sigh, looking at my losetup I have pending changes to it, of course.
Lemme check those in too... Ah right, I was adding losetup -A to set
autoclear, but that can't work because you have to open the loopback
device to call ioctls on it,and when you close the device's filehandle
the association is cleared. So mount has to do it internally and then
call mount() before closing the filehandle so it's pinned by the mount
reference. And moving loopback_setup() into lib/ requires stripping the
GLOBALS references out and turning them into function arguments...

Right, break that part _out_ and check in the rest. (git --patch is
lovely, athough it means you have to pull it to the "clean" directory
and retest after committing.)

Rob



More information about the Toybox mailing list