[Toybox] Recursive bind mounts.

enh enh at google.com
Thu Jul 28 08:09:53 PDT 2022


+Yi-yo Chiang <yochiang at google.com> who might have an opinion from the
Android side...

On Thu, Jul 28, 2022 at 5:11 AM Rob Landley <rob at landley.net> wrote:

> Toybox mount is autodetecting --bind based on the types of source and dest
> (mounting a file on a file or a directory on a directory is a bind mount),
> but
> there's also --rbind which _recursively_ bind mounts. I.E. the bind mounts
> under
> this directory are also bind mounted into the destination.
>
> I THINK what I want to do is just:
>
> @@ -184,7 +188,7 @@ static void mount_filesystem(char *dev, char *dir,
> char *type,
>          && ((S_ISREG(stdev.st_mode) && S_ISREG(stdir.st_mode))
>              || (S_ISDIR(stdev.st_mode) && S_ISDIR(stdir.st_mode))))
>      {
> -      flags |= MS_BIND;
> +      flags |= MS_BIND|MS_REC;
>      } else fp = xfopen("/proc/filesystems", "r");
>    } else if (!strcmp(type, "ignore")) return;
>    else if (!strcmp(type, "swap"))
>
> I.E. have the existing bind mount behavior automatically be recursive. But
> I
> wanted to ask for a second opinion here. (I could also implement --rbind
> and
> have it be different than --bind but nobody's come to me with this use
> case,
> it's just me digging through container nonsense coming up with edge
> cases...)
>
> 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/20220728/f7969345/attachment.htm>


More information about the Toybox mailing list