mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00

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>
61 lines
1.4 KiB
C
61 lines
1.4 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
#include <ynl.h>
|
|
|
|
#include "devlink-user.h"
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
struct devlink_get_list *devs;
|
|
struct ynl_sock *ys;
|
|
|
|
ys = ynl_sock_create(&ynl_devlink_family, NULL);
|
|
if (!ys)
|
|
return 1;
|
|
|
|
devs = devlink_get_dump(ys);
|
|
if (!devs)
|
|
goto err_close;
|
|
|
|
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);
|
|
|
|
info_req = devlink_info_get_req_alloc();
|
|
devlink_info_get_req_set_bus_name(info_req, d->bus_name);
|
|
devlink_info_get_req_set_dev_name(info_req, d->dev_name);
|
|
|
|
info_rsp = devlink_info_get(ys, info_req);
|
|
devlink_info_get_req_free(info_req);
|
|
if (!info_rsp)
|
|
goto err_free_devs;
|
|
|
|
if (info_rsp->_len.info_driver_name)
|
|
printf(" driver: %s\n", info_rsp->info_driver_name);
|
|
if (info_rsp->_count.info_version_running)
|
|
printf(" running fw:\n");
|
|
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);
|
|
printf(" ...\n");
|
|
devlink_info_get_rsp_free(info_rsp);
|
|
}
|
|
devlink_get_list_free(devs);
|
|
|
|
ynl_sock_destroy(ys);
|
|
|
|
return 0;
|
|
|
|
err_free_devs:
|
|
devlink_get_list_free(devs);
|
|
err_close:
|
|
fprintf(stderr, "YNL: %s\n", ys->err.msg);
|
|
ynl_sock_destroy(ys);
|
|
return 2;
|
|
}
|