lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOMdWSLyacdeoqnZBuLu6z1B6cY-WbtUJQm6+8=WHyE49tVaEg@mail.gmail.com>
Date:   Thu, 27 Aug 2020 07:07:47 +0530
From:   Allen <allen.lkml@...il.com>
To:     Kees Cook <keescook@...omium.org>
Cc:     Dan Carpenter <dan.carpenter@...cle.com>,
        Allen Pais <allen.cryptic@...il.com>,
        James Bottomley <James.Bottomley@...senpartnership.com>,
        Ulf Hansson <ulf.hansson@...aro.org>,
        linux-atm-general@...ts.sourceforge.net, manohar.vanga@...il.com,
        airlied@...ux.ie, linux-hyperv@...r.kernel.org,
        dri-devel@...ts.freedesktop.org, sre@...nel.org,
        anton.ivanov@...bridgegreys.com, devel@...verdev.osuosl.org,
        linux-s390@...r.kernel.org, linux1394-devel@...ts.sourceforge.net,
        maximlevitsky@...il.com, richard@....at, deller@....de,
        jassisinghbrar@...il.com, linux-spi@...r.kernel.org,
        3chas3@...il.com, intel-gfx@...ts.freedesktop.org,
        Jakub Kicinski <kuba@...nel.org>, mporter@...nel.crashing.org,
        jdike@...toit.com, oakad@...oo.com, s.hauer@...gutronix.de,
        linux-input@...r.kernel.org, linux-um@...ts.infradead.org,
        linux-block@...r.kernel.org, Mark Brown <broonie@...nel.org>,
        openipmi-developer@...ts.sourceforge.net, mitch@...oth.com,
        linux-arm-kernel@...ts.infradead.org, Jens Axboe <axboe@...nel.dk>,
        linux-parisc@...r.kernel.org, netdev@...r.kernel.org,
        martyn@...chs.me.uk, dmitry.torokhov@...il.com,
        linux-mmc@...r.kernel.org, linux-kernel@...r.kernel.org,
        alex.bou9@...il.com, stefanr@...6.in-berlin.de,
        Daniel Vetter <daniel@...ll.ch>, linux-ntb@...glegroups.com,
        Romain Perier <romain.perier@...il.com>, shawnguo@...nel.org,
        David Miller <davem@...emloft.net>
Subject: Re: [PATCH] block: convert tasklets to use new tasklet_setup() API

On Wed, Aug 26, 2020 at 8:43 PM Kees Cook <keescook@...omium.org> wrote:
>
> On Wed, Aug 26, 2020 at 12:55:28PM +0300, Dan Carpenter wrote:
> > On Wed, Aug 26, 2020 at 07:21:35AM +0530, Allen Pais wrote:
> > > On Thu, Aug 20, 2020 at 3:09 AM James Bottomley
> > > <James.Bottomley@...senpartnership.com> wrote:
> > > >
> > > > On Wed, 2020-08-19 at 21:54 +0530, Allen wrote:
> > > > > > [...]
> > > > > > > > Since both threads seem to have petered out, let me suggest in
> > > > > > > > kernel.h:
> > > > > > > >
> > > > > > > > #define cast_out(ptr, container, member) \
> > > > > > > >     container_of(ptr, typeof(*container), member)
> > > > > > > >
> > > > > > > > It does what you want, the argument order is the same as
> > > > > > > > container_of with the only difference being you name the
> > > > > > > > containing structure instead of having to specify its type.
> > > > > > >
> > > > > > > Not to incessantly bike shed on the naming, but I don't like
> > > > > > > cast_out, it's not very descriptive. And it has connotations of
> > > > > > > getting rid of something, which isn't really true.
> > > > > >
> > > > > > Um, I thought it was exactly descriptive: you're casting to the
> > > > > > outer container.  I thought about following the C++ dynamic casting
> > > > > > style, so out_cast(), but that seemed a bit pejorative.  What about
> > > > > > outer_cast()?
> > > > > >
> > > > > > > FWIW, I like the from_ part of the original naming, as it has
> > > > > > > some clues as to what is being done here. Why not just
> > > > > > > from_container()? That should immediately tell people what it
> > > > > > > does without having to look up the implementation, even before
> > > > > > > this becomes a part of the accepted coding norm.
> > > > > >
> > > > > > I'm not opposed to container_from() but it seems a little less
> > > > > > descriptive than outer_cast() but I don't really care.  I always
> > > > > > have to look up container_of() when I'm using it so this would just
> > > > > > be another macro of that type ...
> > > > > >
> > > > >
> > > > >  So far we have a few which have been suggested as replacement
> > > > > for from_tasklet()
> > > > >
> > > > > - out_cast() or outer_cast()
> > > > > - from_member().
> > > > > - container_from() or from_container()
> > > > >
> > > > > from_container() sounds fine, would trimming it a bit work? like
> > > > > from_cont().
> > > >
> > > > I'm fine with container_from().  It's the same form as container_of()
> > > > and I think we need urgent agreement to not stall everything else so
> > > > the most innocuous name is likely to get the widest acceptance.
> > >
> > > Kees,
> > >
> > >   Will you be  sending the newly proposed API to Linus? I have V2
> > > which uses container_from()
> > > ready to be sent out.
> >
> > I liked that James swapped the first two arguments so that it matches
> > container_of().  Plus it's nice that when you have:
> >
> >       struct whatever *foo = container_from(ptr, foo, member);
> >
> > Then it means that "ptr == &foo->member".
>
> I'm a bit stalled right now -- the merge window was keeping me busy, and
> this week is the Linux Plumbers Conference. This is on my list, but I
> haven't gotten back around to it. If you want, feel free to send the
> container_from() patch; you might be able to unblock this faster than me
> right now. :)
>

Sure, Thanks.



-- 
       - Allen

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ