diff options
| author | Jakub Kicinski <[email protected]> | 2025-05-05 16:52:07 +0000 |
|---|---|---|
| committer | Jakub Kicinski <[email protected]> | 2025-05-08 01:21:26 +0000 |
| commit | d307b9feb833f3f413db36dcec01dcad749a763f (patch) | |
| tree | f5f5f8ec4c5e2cf656fc1069c1f9e7897ea52ac6 /tools/net/ynl/samples/devlink.c | |
| parent | tools: ynl-gen: split presence metadata (diff) | |
| download | kernel-d307b9feb833f3f413db36dcec01dcad749a763f.tar.gz kernel-d307b9feb833f3f413db36dcec01dcad749a763f.zip | |
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/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
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); |
