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]
Date:   Thu, 27 Aug 2020 20:07:55 +0200
From:   Rasmus Villemoes <linux@...musvillemoes.dk>
To:     Allen Pais <allen.lkml@...il.com>, torvalds@...ux-foundation.org
Cc:     akpm@...ux-foundation.org, keescook@...omium.org,
        tglx@...utronix.de, linux-kernel@...r.kernel.org,
        "James E . J . Bottomley" <James.Bottomley@...senPartnership.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Jens Axboe <axboe@...nel.dk>
Subject: Re: [PATCH] linux/kernel.h: add container_from()

On 27/08/2020 03.36, Allen Pais wrote:
> Introduce container_from() as a generic helper instead of
> sub-systems defining a private from_* API
> (Eg: from_tasklets recently introduced in
> 12cc923f1ccc: Tasklet: Introduce new initialization API)
> 
> The helper is similar to container_of() in argument order
> with the difference of naming the containing structure instead
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

> of having to specify its type.
> 

> +/**
> + * container_from - cast a member of a structure out to the containing structure
> + * @ptr:	the pointer to the member.
> + * @container:	the type of the container struct.
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This seems to have been copy-pasted from container_of? Shouldn't
@container be the (local) value we're storing into? As in foo =
container_from(..., foo, ...)? Or am I misunderstanding the purpose of this?

[And I think it would read nicer if the bikeshed was called
to_container(), but don't care deeply.]

Rasmus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ