diff options
author | 2025-05-05 09:52:06 -0700 | |
---|---|---|
committer | 2025-05-07 18:21:25 -0700 | |
commit | b8ae9f70aaf134dc57f227fd1730b64ce89e109d (patch) | |
tree | f7c3b66c647c04c4657e7ccc7f7411249de8dee2 /tools/net/ynl/samples/rt-addr.c | |
parent | tools: ynl-gen: rename basic presence from 'bit' to 'present' (diff) | |
download | linux-rng-b8ae9f70aaf134dc57f227fd1730b64ce89e109d.tar.xz linux-rng-b8ae9f70aaf134dc57f227fd1730b64ce89e109d.zip |
tools: ynl-gen: split presence metadata
Each YNL struct contains the data and a sub-struct indicating which
fields are valid. Something like:
struct family_op_req {
struct {
u32 a:1;
u32 b:1;
u32 bin_len;
} _present;
u32 a;
u64 b;
const unsigned char *bin;
};
Note that the bin object 'bin' has a length stored, and that length
has a _len suffix added to the field name. This breaks if there
is a explicit field called bin_len, which is the case for some
TC actions. Move the length fields out of the _present struct,
create a new struct called _len:
struct family_op_req {
struct {
u32 a:1;
u32 b:1;
} _present;
struct {
u32 bin;
} _len;
u32 a;
u64 b;
const unsigned char *bin;
};
This should prevent name collisions and help with the packing
of the struct.
Unfortunately this is a breaking change, but hopefully the migration
isn't too painful.
Link: https://patch.msgid.link/20250505165208.248049-3-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'tools/net/ynl/samples/rt-addr.c')
-rw-r--r-- | tools/net/ynl/samples/rt-addr.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/net/ynl/samples/rt-addr.c b/tools/net/ynl/samples/rt-addr.c index 0f4851b4ec57..2edde5c36b18 100644 --- a/tools/net/ynl/samples/rt-addr.c +++ b/tools/net/ynl/samples/rt-addr.c @@ -20,7 +20,7 @@ static void rt_addr_print(struct rt_addr_getaddr_rsp *a) if (name) printf("%16s: ", name); - switch (a->_present.address_len) { + switch (a->_len.address) { case 4: addr = inet_ntop(AF_INET, a->address, addr_str, sizeof(addr_str)); @@ -36,7 +36,7 @@ static void rt_addr_print(struct rt_addr_getaddr_rsp *a) if (addr) printf("%s", addr); else - printf("[%d]", a->_present.address_len); + printf("[%d]", a->_len.address); printf("\n"); } |