Re: [PATCH v5 3/4] hmp: Use QMP query-netdev in hmp_info_network

2020-12-16 Thread Alexey Kirillov
16.12.2020, 08:58, "Jason Wang" : > - Original Message - >>  Jason Wang writes: >> >>  [...] >>  > One more stupid question, instead of generating the string via hard >>  > codes, is there any method (dict?) to iterate all the key/values >>  > automatically? >> >>  QAPI visitors. >> >>  

Re: [PATCH v5 3/4] hmp: Use QMP query-netdev in hmp_info_network

2020-12-15 Thread Jason Wang
- Original Message - > Jason Wang writes: > > [...] > > One more stupid question, instead of generating the string via hard > > codes, is there any method (dict?) to iterate all the key/values > > automatically? > > QAPI visitors. > > The lazy way: use the QObject output visitor to c

Re: [PATCH v5 3/4] hmp: Use QMP query-netdev in hmp_info_network

2020-12-15 Thread Markus Armbruster
Jason Wang writes: [...] > One more stupid question, instead of generating the string via hard > codes, is there any method (dict?) to iterate all the key/values > automatically? QAPI visitors. The lazy way: use the QObject output visitor to convert the QAPI type (here: NetdevInfo) to QObject,

Re: [PATCH v5 3/4] hmp: Use QMP query-netdev in hmp_info_network

2020-12-14 Thread Jason Wang
- Original Message - > Hi! > > 07.12.2020, 08:52, "Jason Wang" : > > On 2020/11/9 上午7:59, Alexey Kirillov wrote: > >>  +#ifdef CONFIG_SLIRP > >>  + case NET_BACKEND_USER: { > >>  + size_t len = strchr(ni->u.user.net, '/') - ni->u.user.net; > >>  + char *net = g_strndup(ni->u.user.net, l

Re: [PATCH v5 3/4] hmp: Use QMP query-netdev in hmp_info_network

2020-12-14 Thread Alexey Kirillov
Hi! 07.12.2020, 08:52, "Jason Wang" : > On 2020/11/9 上午7:59, Alexey Kirillov wrote: >>  +#ifdef CONFIG_SLIRP >>  + case NET_BACKEND_USER: { >>  + size_t len = strchr(ni->u.user.net, '/') - ni->u.user.net; >>  + char *net = g_strndup(ni->u.user.net, len); >>  + >>  + info_str = g_strdup_printf("net

Re: [PATCH v5 3/4] hmp: Use QMP query-netdev in hmp_info_network

2020-12-06 Thread Jason Wang
On 2020/11/9 上午7:59, Alexey Kirillov wrote: +#ifdef CONFIG_SLIRP +case NET_BACKEND_USER: { +size_t len = strchr(ni->u.user.net, '/') - ni->u.user.net; +char *net = g_strndup(ni->u.user.net, len); + +info_str = g_strdup_printf("net=%s,restrict=%s", +

[PATCH v5 3/4] hmp: Use QMP query-netdev in hmp_info_network

2020-11-08 Thread Alexey Kirillov
Replace usage of legacy field info_str of NetClientState for backend network devices with result of QMP command query-netdev. NIC and hubports still use legacy info_str field. Signed-off-by: Alexey Kirillov --- include/net/net.h | 3 +- net/clients.h | 1 + net/hub.c | 4 +- ne