On Mon, Nov 21, 2022 at 9:31 AM Xiaoming Ni <nixiaom...@huawei.com> wrote:
> > Also, it is unclear why there is the need to clone the loopinfo buffer.
> >
> >  >                 /* Old kernel, does not support LO_FLAGS_AUTOCLEAR? */
> >  >                 /* (this code path is not tested) */
> >  > -               loopinfo.lo_flags -= BB_LO_FLAGS_AUTOCLEAR;
> >  > -               rc = ioctl(lfd, BB_LOOP_SET_STATUS, &loopinfo);
> >  > +               loopinfo2.lo_flags -= BB_LO_FLAGS_AUTOCLEAR;
> >  > +               rc = ioctl(lfd, BB_LOOP_SET_STATUS, &loopinfo2);
> >  >         }
> >  >         if (rc == 0) {
> >  >                 return lfd;
> ...
>

Pardon for my ignorance, but does the LOOP_SET_STATUS64 ioctl modify
the `loopinfo` object internally?
If the answer is yes, then it might not be a good idea to pass the
`loopinfo` structure to set_loop_configure().
I think it might be better to create the object on the fly (i.e. drop
this patch).
Otherwise, let set_loop_configure pass in a `const bb_loop_info *`
object, when we are sure it would never be modified internally.
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to