Re: [PATCH RFC 12/20] ctlv: Add device and operation dispatch
From: Jiri Pirko
Date: Tue Oct 27 2026 - 09:49:05 EST
Mon, Oct 26, 2026 at 03:07:54PM +0100, jgg@xxxxxxxxxx wrote:
>> [ ... 125 lines skipped ... ]
>> +struct ctlv_priv_container {
>> + struct ctlv_priv_container *parent;
>> + struct ctlv_priv_container *child;
>> + u8 priv[] __aligned(CTLV_PRIV_ALIGN);
>> +};
>
>This scheme with priv is very clever, but..
>
>The usage in the tdx driver ends up having both the
>ctlv_priv_parent() and ctlv_priv_child() calls, but there isn't any
>type safety and it just seems worse off than using the normal
>container_of approach.
>
>I think it is a nice thing to have for someday if we get to a place
>that needs more than two things, but for attestation subsystem I think
>it would be clearer to have the normal container_of relationship and
>some reliable way to get the 'struct attestation'
Yeah, will do.
>
>At the very least the parent/priv functions should take in the family
>ID they are trying to seek too, for an assertin, and many cases are
>probably better off with just a simple:
> ctlv_priv_get(ctx, family);
>That is slower but always gives the right thing..
>
>--
>Jason