Thread (14 messages) 14 messages, 2 authors, 2023-03-25

Re: [PATCH net-next v4 6/7] docs: netlink: document struct support for genetlink-legacy

From: Jakub Kicinski <kuba@kernel.org>
Date: 2023-03-25 03:52:30
Also in: linux-doc

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!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help