diff options
author | Jakub Kicinski <kuba@kernel.org> | 2025-05-05 09:52:07 -0700 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2025-05-07 18:21:26 -0700 |
commit | d307b9feb833f3f413db36dcec01dcad749a763f (patch) | |
tree | f5f5f8ec4c5e2cf656fc1069c1f9e7897ea52ac6 /tools/net/ynl/samples/devlink.c | |
parent | b8ae9f70aaf134dc57f227fd1730b64ce89e109d (diff) |
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>
Diffstat (limited to 'tools/net/ynl/samples/devlink.c')
-rw-r--r-- | tools/net/ynl/samples/devlink.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/net/ynl/samples/devlink.c b/tools/net/ynl/samples/devlink.c index 3d32a6335044..ac9dfb01f280 100644 --- a/tools/net/ynl/samples/devlink.c +++ b/tools/net/ynl/samples/devlink.c @@ -22,6 +22,7 @@ int main(int argc, char **argv) ynl_dump_foreach(devs, d) { struct devlink_info_get_req *info_req; struct devlink_info_get_rsp *info_rsp; + unsigned i; printf("%s/%s:\n", d->bus_name, d->dev_name); @@ -36,9 +37,9 @@ int main(int argc, char **argv) if (info_rsp->_len.info_driver_name) printf(" driver: %s\n", info_rsp->info_driver_name); - if (info_rsp->n_info_version_running) + if (info_rsp->_count.info_version_running) printf(" running fw:\n"); - for (unsigned i = 0; i < info_rsp->n_info_version_running; i++) + for (i = 0; i < info_rsp->_count.info_version_running; i++) printf(" %s: %s\n", info_rsp->info_version_running[i].info_version_name, info_rsp->info_version_running[i].info_version_value); |