[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230324205224.18f31f14@kernel.org>
Date: Fri, 24 Mar 2023 20:52:24 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Donald Hunter <donald.hunter@...il.com>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Paolo Abeni <pabeni@...hat.com>,
Jonathan Corbet <corbet@....net>, linux-doc@...r.kernel.org,
donald.hunter@...hat.com
Subject: Re: [PATCH net-next v4 6/7] docs: netlink: document struct support
for genetlink-legacy
On Fri, 24 Mar 2023 19:18:59 +0000 Donald Hunter wrote:
> Legacy families can define C structures both to be used as the contents
> -of an attribute and as a fixed message header. The plan is to define
> -the structs in ``definitions`` and link the appropriate attrs.
> +of an attribute and as a fixed message header. Structs are defined
> +in ``definitions`` and referenced in operations or attributes.
We should call out that the structs in YAML are implicitly "packed"
(in the C sense of the word), so struct { u8 a; u16 b; u8 c; } is
4 bytes not 6 bytes.
Any padding must be explicitly, C-like languages should infer the need
for explicit packing from whether the members are naturally aligned.
> +.. code-block:: yaml
> +
> + definitions:
> + -
> + name: message-header
> + type: struct
> + members:
> + -
> + name: a
> + type: u32
> + -
> + name: b
> + type: string
Maybe not the most fortunate example :) cause I think that for
string/binary we'll need an explicit length. Maybe not for
last one if it's a flexible array... but that's rare in NL.
The rest LGTM, thanks!
Powered by blists - more mailing lists