]> www.infradead.org Git - users/jedix/linux-maple.git/commit
tools: ynl-gen: support sub-type for binary attributes
authorJakub Kicinski <kuba@kernel.org>
Fri, 9 May 2025 15:42:11 +0000 (08:42 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 13 May 2025 11:22:32 +0000 (13:22 +0200)
commit02a562bb2b0846f44bb4226b7ee7ef9821c3780e
tree2467faefa96baf08280ceda0ba4a93acb4f6ed7e
parentac4d1baf97fdaa6ef789273f0fd485c0d0d6f100
tools: ynl-gen: support sub-type for binary attributes

Sub-type annotation on binary attributes may indicate that the attribute
carries an array of simple types (also referred to as "C array" in docs).
Support rendering them as such in the C user code. For example for u32,
instead of:

  struct {
    u32 arr;
  } _len;

  void *arr;

render:

  struct {
    u32 arr;
  } _count;

  __u32 *arr;

Note that count is the number of elements while len was the length in bytes.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Donald Hunter <donald.hunter@gmail.com>
Link: https://patch.msgid.link/20250509154213.1747885-2-kuba@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
tools/net/ynl/pyynl/ynl_gen_c.py