]> www.infradead.org Git - users/jedix/linux-maple.git/commit
tools: ynl-gen: move the count into a presence struct too
authorJakub Kicinski <kuba@kernel.org>
Mon, 5 May 2025 16:52:07 +0000 (09:52 -0700)
committerJakub Kicinski <kuba@kernel.org>
Thu, 8 May 2025 01:21:26 +0000 (18:21 -0700)
commitd307b9feb833f3f413db36dcec01dcad749a763f
treef5f5f8ec4c5e2cf656fc1069c1f9e7897ea52ac6
parentb8ae9f70aaf134dc57f227fd1730b64ce89e109d
tools: ynl-gen: move the count into a presence struct too

While we reshuffle the presence members, move the counts as well.
Previously array count members would have been place directly in
the struct, so:

  struct family_op_req {
      struct {
            u32 a:1;
            u32 b:1;
      } _present;
      struct {
            u32 bin;
      } _len;

      u32 a;
      u64 b;
      const unsigned char *bin;
      u32 n_multi;                 << count
      u32 *multi;                  << objects
  };

Since len has been moved to its own presence struct move the count
as well:

  struct family_op_req {
      struct {
            u32 a:1;
            u32 b:1;
      } _present;
      struct {
            u32 bin;
      } _len;
      struct {
            u32 multi;             << count
      } _count;

      u32 a;
      u64 b;
      const unsigned char *bin;
      u32 *multi;                  << objects
  };

This improves the consistency and allows us to remove some hacks
in the codegen. Unlike for len there is no known name collision
with the existing scheme.

Link: https://patch.msgid.link/20250505165208.248049-4-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/net/ynl/pyynl/ynl_gen_c.py
tools/net/ynl/samples/devlink.c