qapi net: Elide redundant has_FOO in generated C

The has_FOO for pointer-valued FOO are redundant, except for arrays.
They are also a nuisance to work with.  Recent commit "qapi: Start to
elide redundant has_FOO in generated C" provided the means to elide
them step by step.  This is the step for qapi/net.json.

Said commit explains the transformation in more detail.  The invariant
violations mentioned there do not occur here.

Cc: Jason Wang <jasowang@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20221104160712.3005652-19-armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
[Fixes for MacOS squashed in]
This commit is contained in:
Markus Armbruster 2022-11-04 17:07:00 +01:00
parent 9492718b7c
commit 7480874a69
14 changed files with 77 additions and 82 deletions

View File

@ -457,8 +457,7 @@ static void rxfilter_notify(NetClientState *nc)
if (nc->rxfilter_notify_enabled) { if (nc->rxfilter_notify_enabled) {
char *path = object_get_canonical_path(OBJECT(n->qdev)); char *path = object_get_canonical_path(OBJECT(n->qdev));
qapi_event_send_nic_rx_filter_changed(!!n->netclient_name, qapi_event_send_nic_rx_filter_changed(n->netclient_name, path);
n->netclient_name, path);
g_free(path); g_free(path);
/* disable event notification to avoid events flooding */ /* disable event notification to avoid events flooding */

View File

@ -1104,7 +1104,6 @@ void hmp_announce_self(Monitor *mon, const QDict *qdict)
params->interfaces = strList_from_comma_list(interfaces_str); params->interfaces = strList_from_comma_list(interfaces_str);
params->has_interfaces = params->interfaces != NULL; params->has_interfaces = params->interfaces != NULL;
params->id = g_strdup(id); params->id = g_strdup(id);
params->has_id = !!params->id;
qmp_announce_self(params, NULL); qmp_announce_self(params, NULL);
qapi_free_AnnounceParameters(params); qapi_free_AnnounceParameters(params);
} }

View File

@ -46,7 +46,7 @@ void qemu_announce_timer_del(AnnounceTimer *timer, bool free_named)
} }
qapi_free_strList(timer->params.interfaces); qapi_free_strList(timer->params.interfaces);
timer->params.interfaces = NULL; timer->params.interfaces = NULL;
if (free_named && timer->params.has_id) { if (free_named && timer->params.id) {
AnnounceTimer *list_timer; AnnounceTimer *list_timer;
/* /*
* Sanity check: There should only be one timer on the list with * Sanity check: There should only be one timer on the list with
@ -157,7 +157,7 @@ static void qemu_announce_self_iter(NICState *nic, void *opaque)
skip = false; skip = false;
} }
trace_qemu_announce_self_iter(timer->params.has_id ? timer->params.id : "_", trace_qemu_announce_self_iter(timer->params.id ?: "_",
nic->ncs->name, nic->ncs->name,
qemu_ether_ntoa(&nic->conf->macaddr), skip); qemu_ether_ntoa(&nic->conf->macaddr), skip);
@ -199,9 +199,9 @@ void qemu_announce_self(AnnounceTimer *timer, AnnounceParameters *params)
void qmp_announce_self(AnnounceParameters *params, Error **errp) void qmp_announce_self(AnnounceParameters *params, Error **errp)
{ {
AnnounceTimer *named_timer; AnnounceTimer *named_timer;
if (!params->has_id) {
if (!params->id) {
params->id = g_strdup(""); params->id = g_strdup("");
params->has_id = true;
} }
named_timer = g_datalist_get_data(&named_timers, params->id); named_timer = g_datalist_get_data(&named_timers, params->id);

View File

@ -274,7 +274,7 @@ int net_init_hubport(const Netdev *netdev, const char *name,
assert(!peer); assert(!peer);
hubport = &netdev->u.hubport; hubport = &netdev->u.hubport;
if (hubport->has_netdev) { if (hubport->netdev) {
hubpeer = qemu_find_netdev(hubport->netdev); hubpeer = qemu_find_netdev(hubport->netdev);
if (!hubpeer) { if (!hubpeer) {
error_setg(errp, "netdev '%s' not found", hubport->netdev); error_setg(errp, "netdev '%s' not found", hubport->netdev);

View File

@ -578,7 +578,7 @@ int net_init_l2tpv3(const Netdev *netdev,
if (l2tpv3->has_udp && l2tpv3->udp) { if (l2tpv3->has_udp && l2tpv3->udp) {
s->udp = true; s->udp = true;
if (!(l2tpv3->has_srcport && l2tpv3->has_dstport)) { if (!(l2tpv3->srcport && l2tpv3->dstport)) {
error_setg(errp, "need both src and dst port for udp"); error_setg(errp, "need both src and dst port for udp");
goto outerr; goto outerr;
} else { } else {

View File

@ -964,7 +964,7 @@ static int net_init_nic(const Netdev *netdev, const char *name,
memset(nd, 0, sizeof(*nd)); memset(nd, 0, sizeof(*nd));
if (nic->has_netdev) { if (nic->netdev) {
nd->netdev = qemu_find_netdev(nic->netdev); nd->netdev = qemu_find_netdev(nic->netdev);
if (!nd->netdev) { if (!nd->netdev) {
error_setg(errp, "netdev '%s' not found", nic->netdev); error_setg(errp, "netdev '%s' not found", nic->netdev);
@ -975,19 +975,19 @@ static int net_init_nic(const Netdev *netdev, const char *name,
nd->netdev = peer; nd->netdev = peer;
} }
nd->name = g_strdup(name); nd->name = g_strdup(name);
if (nic->has_model) { if (nic->model) {
nd->model = g_strdup(nic->model); nd->model = g_strdup(nic->model);
} }
if (nic->has_addr) { if (nic->addr) {
nd->devaddr = g_strdup(nic->addr); nd->devaddr = g_strdup(nic->addr);
} }
if (nic->has_macaddr && if (nic->macaddr &&
net_parse_macaddr(nd->macaddr.a, nic->macaddr) < 0) { net_parse_macaddr(nd->macaddr.a, nic->macaddr) < 0) {
error_setg(errp, "invalid syntax for ethernet address"); error_setg(errp, "invalid syntax for ethernet address");
return -1; return -1;
} }
if (nic->has_macaddr && if (nic->macaddr &&
is_multicast_ether_addr(nd->macaddr.a)) { is_multicast_ether_addr(nd->macaddr.a)) {
error_setg(errp, error_setg(errp,
"NIC cannot have multicast MAC address (odd 1st byte)"); "NIC cannot have multicast MAC address (odd 1st byte)");
@ -1081,7 +1081,7 @@ static int net_client_init1(const Netdev *netdev, bool is_netdev, Error **errp)
/* Do not add to a hub if it's a nic with a netdev= parameter. */ /* Do not add to a hub if it's a nic with a netdev= parameter. */
if (netdev->type != NET_CLIENT_DRIVER_NIC || if (netdev->type != NET_CLIENT_DRIVER_NIC ||
!netdev->u.nic.has_netdev) { !netdev->u.nic.netdev) {
peer = net_hub_add_port(0, NULL, NULL); peer = net_hub_add_port(0, NULL, NULL);
} }
} }
@ -1295,8 +1295,7 @@ void print_net_client(Monitor *mon, NetClientState *nc)
} }
} }
RxFilterInfoList *qmp_query_rx_filter(bool has_name, const char *name, RxFilterInfoList *qmp_query_rx_filter(const char *name, Error **errp)
Error **errp)
{ {
NetClientState *nc; NetClientState *nc;
RxFilterInfoList *filter_list = NULL, **tail = &filter_list; RxFilterInfoList *filter_list = NULL, **tail = &filter_list;
@ -1304,13 +1303,13 @@ RxFilterInfoList *qmp_query_rx_filter(bool has_name, const char *name,
QTAILQ_FOREACH(nc, &net_clients, next) { QTAILQ_FOREACH(nc, &net_clients, next) {
RxFilterInfo *info; RxFilterInfo *info;
if (has_name && strcmp(nc->name, name) != 0) { if (name && strcmp(nc->name, name) != 0) {
continue; continue;
} }
/* only query rx-filter information of NIC */ /* only query rx-filter information of NIC */
if (nc->info->type != NET_CLIENT_DRIVER_NIC) { if (nc->info->type != NET_CLIENT_DRIVER_NIC) {
if (has_name) { if (name) {
error_setg(errp, "net client(%s) isn't a NIC", name); error_setg(errp, "net client(%s) isn't a NIC", name);
assert(!filter_list); assert(!filter_list);
return NULL; return NULL;
@ -1327,19 +1326,19 @@ RxFilterInfoList *qmp_query_rx_filter(bool has_name, const char *name,
if (nc->info->query_rx_filter) { if (nc->info->query_rx_filter) {
info = nc->info->query_rx_filter(nc); info = nc->info->query_rx_filter(nc);
QAPI_LIST_APPEND(tail, info); QAPI_LIST_APPEND(tail, info);
} else if (has_name) { } else if (name) {
error_setg(errp, "net client(%s) doesn't support" error_setg(errp, "net client(%s) doesn't support"
" rx-filter querying", name); " rx-filter querying", name);
assert(!filter_list); assert(!filter_list);
return NULL; return NULL;
} }
if (has_name) { if (name) {
break; break;
} }
} }
if (filter_list == NULL && has_name) { if (filter_list == NULL && name) {
error_setg(errp, "invalid net client name: %s", name); error_setg(errp, "invalid net client name: %s", name);
} }

View File

@ -1153,8 +1153,8 @@ int net_init_slirp(const Netdev *netdev, const char *name,
ipv6 = 0; ipv6 = 0;
} }
vnet = user->has_net ? g_strdup(user->net) : vnet = user->net ? g_strdup(user->net) :
user->has_ip ? g_strdup_printf("%s/24", user->ip) : user->ip ? g_strdup_printf("%s/24", user->ip) :
NULL; NULL;
dnssearch = slirp_dnssearch(user->dnssearch); dnssearch = slirp_dnssearch(user->dnssearch);

View File

@ -705,19 +705,19 @@ int net_init_socket(const Netdev *netdev, const char *name,
assert(netdev->type == NET_CLIENT_DRIVER_SOCKET); assert(netdev->type == NET_CLIENT_DRIVER_SOCKET);
sock = &netdev->u.socket; sock = &netdev->u.socket;
if (sock->has_fd + sock->has_listen + sock->has_connect + sock->has_mcast + if (!!sock->fd + !!sock->listen + !!sock->connect + !!sock->mcast +
sock->has_udp != 1) { !!sock->udp != 1) {
error_setg(errp, "exactly one of listen=, connect=, mcast= or udp=" error_setg(errp, "exactly one of listen=, connect=, mcast= or udp="
" is required"); " is required");
return -1; return -1;
} }
if (sock->has_localaddr && !sock->has_mcast && !sock->has_udp) { if (sock->localaddr && !sock->mcast && !sock->udp) {
error_setg(errp, "localaddr= is only valid with mcast= or udp="); error_setg(errp, "localaddr= is only valid with mcast= or udp=");
return -1; return -1;
} }
if (sock->has_fd) { if (sock->fd) {
int fd, ret; int fd, ret;
fd = monitor_fd_param(monitor_cur(), sock->fd, errp); fd = monitor_fd_param(monitor_cur(), sock->fd, errp);
@ -737,7 +737,7 @@ int net_init_socket(const Netdev *netdev, const char *name,
return 0; return 0;
} }
if (sock->has_listen) { if (sock->listen) {
if (net_socket_listen_init(peer, "socket", name, sock->listen, errp) if (net_socket_listen_init(peer, "socket", name, sock->listen, errp)
< 0) { < 0) {
return -1; return -1;
@ -745,7 +745,7 @@ int net_init_socket(const Netdev *netdev, const char *name,
return 0; return 0;
} }
if (sock->has_connect) { if (sock->connect) {
if (net_socket_connect_init(peer, "socket", name, sock->connect, errp) if (net_socket_connect_init(peer, "socket", name, sock->connect, errp)
< 0) { < 0) {
return -1; return -1;
@ -753,7 +753,7 @@ int net_init_socket(const Netdev *netdev, const char *name,
return 0; return 0;
} }
if (sock->has_mcast) { if (sock->mcast) {
/* if sock->localaddr is missing, it has been initialized to "all bits /* if sock->localaddr is missing, it has been initialized to "all bits
* zero" */ * zero" */
if (net_socket_mcast_init(peer, "socket", name, sock->mcast, if (net_socket_mcast_init(peer, "socket", name, sock->mcast,
@ -763,8 +763,8 @@ int net_init_socket(const Netdev *netdev, const char *name,
return 0; return 0;
} }
assert(sock->has_udp); assert(sock->udp);
if (!sock->has_localaddr) { if (!sock->localaddr) {
error_setg(errp, "localaddr= is mandatory with udp="); error_setg(errp, "localaddr= is mandatory with udp=");
return -1; return -1;
} }

View File

@ -807,7 +807,7 @@ int net_init_tap(const Netdev *netdev, const char *name,
assert(netdev->type == NET_CLIENT_DRIVER_TAP); assert(netdev->type == NET_CLIENT_DRIVER_TAP);
tap = &netdev->u.tap; tap = &netdev->u.tap;
if (!tap->has_ifname) { if (!tap->ifname) {
error_report("tap: no interface name"); error_report("tap: no interface name");
return -1; return -1;
} }

View File

@ -611,8 +611,8 @@ int net_init_bridge(const Netdev *netdev, const char *name,
assert(netdev->type == NET_CLIENT_DRIVER_BRIDGE); assert(netdev->type == NET_CLIENT_DRIVER_BRIDGE);
bridge = &netdev->u.bridge; bridge = &netdev->u.bridge;
helper = bridge->has_helper ? bridge->helper : NULL; helper = bridge->helper;
br = bridge->has_br ? bridge->br : DEFAULT_BRIDGE_INTERFACE; br = bridge->br ?: DEFAULT_BRIDGE_INTERFACE;
fd = net_bridge_run_helper(helper, br, errp); fd = net_bridge_run_helper(helper, br, errp);
if (fd == -1) { if (fd == -1) {
@ -688,9 +688,9 @@ static void net_init_tap_one(const NetdevTapOptions *tap, NetClientState *peer,
goto failed; goto failed;
} }
if (tap->has_fd || tap->has_fds) { if (tap->fd || tap->fds) {
qemu_set_info_str(&s->nc, "fd=%d", fd); qemu_set_info_str(&s->nc, "fd=%d", fd);
} else if (tap->has_helper) { } else if (tap->helper) {
qemu_set_info_str(&s->nc, "helper=%s", tap->helper); qemu_set_info_str(&s->nc, "helper=%s", tap->helper);
} else { } else {
qemu_set_info_str(&s->nc, "ifname=%s,script=%s,downscript=%s", ifname, qemu_set_info_str(&s->nc, "ifname=%s,script=%s,downscript=%s", ifname,
@ -812,21 +812,21 @@ int net_init_tap(const Netdev *netdev, const char *name,
assert(netdev->type == NET_CLIENT_DRIVER_TAP); assert(netdev->type == NET_CLIENT_DRIVER_TAP);
tap = &netdev->u.tap; tap = &netdev->u.tap;
queues = tap->has_queues ? tap->queues : 1; queues = tap->has_queues ? tap->queues : 1;
vhostfdname = tap->has_vhostfd ? tap->vhostfd : NULL; vhostfdname = tap->vhostfd;
script = tap->has_script ? tap->script : NULL; script = tap->script;
downscript = tap->has_downscript ? tap->downscript : NULL; downscript = tap->downscript;
/* QEMU hubs do not support multiqueue tap, in this case peer is set. /* QEMU hubs do not support multiqueue tap, in this case peer is set.
* For -netdev, peer is always NULL. */ * For -netdev, peer is always NULL. */
if (peer && (tap->has_queues || tap->has_fds || tap->has_vhostfds)) { if (peer && (tap->has_queues || tap->fds || tap->vhostfds)) {
error_setg(errp, "Multiqueue tap cannot be used with hubs"); error_setg(errp, "Multiqueue tap cannot be used with hubs");
return -1; return -1;
} }
if (tap->has_fd) { if (tap->fd) {
if (tap->has_ifname || tap->has_script || tap->has_downscript || if (tap->ifname || tap->script || tap->downscript ||
tap->has_vnet_hdr || tap->has_helper || tap->has_queues || tap->has_vnet_hdr || tap->helper || tap->has_queues ||
tap->has_fds || tap->has_vhostfds) { tap->fds || tap->vhostfds) {
error_setg(errp, "ifname=, script=, downscript=, vnet_hdr=, " error_setg(errp, "ifname=, script=, downscript=, vnet_hdr=, "
"helper=, queues=, fds=, and vhostfds= " "helper=, queues=, fds=, and vhostfds= "
"are invalid with fd="); "are invalid with fd=");
@ -859,14 +859,14 @@ int net_init_tap(const Netdev *netdev, const char *name,
close(fd); close(fd);
return -1; return -1;
} }
} else if (tap->has_fds) { } else if (tap->fds) {
char **fds; char **fds;
char **vhost_fds; char **vhost_fds;
int nfds = 0, nvhosts = 0; int nfds = 0, nvhosts = 0;
if (tap->has_ifname || tap->has_script || tap->has_downscript || if (tap->ifname || tap->script || tap->downscript ||
tap->has_vnet_hdr || tap->has_helper || tap->has_queues || tap->has_vnet_hdr || tap->helper || tap->has_queues ||
tap->has_vhostfd) { tap->vhostfd) {
error_setg(errp, "ifname=, script=, downscript=, vnet_hdr=, " error_setg(errp, "ifname=, script=, downscript=, vnet_hdr=, "
"helper=, queues=, and vhostfd= " "helper=, queues=, and vhostfd= "
"are invalid with fds="); "are invalid with fds=");
@ -877,7 +877,7 @@ int net_init_tap(const Netdev *netdev, const char *name,
vhost_fds = g_new0(char *, MAX_TAP_QUEUES); vhost_fds = g_new0(char *, MAX_TAP_QUEUES);
nfds = get_fds(tap->fds, fds, MAX_TAP_QUEUES); nfds = get_fds(tap->fds, fds, MAX_TAP_QUEUES);
if (tap->has_vhostfds) { if (tap->vhostfds) {
nvhosts = get_fds(tap->vhostfds, vhost_fds, MAX_TAP_QUEUES); nvhosts = get_fds(tap->vhostfds, vhost_fds, MAX_TAP_QUEUES);
if (nfds != nvhosts) { if (nfds != nvhosts) {
error_setg(errp, "The number of fds passed does not match " error_setg(errp, "The number of fds passed does not match "
@ -916,7 +916,7 @@ int net_init_tap(const Netdev *netdev, const char *name,
net_init_tap_one(tap, peer, "tap", name, ifname, net_init_tap_one(tap, peer, "tap", name, ifname,
script, downscript, script, downscript,
tap->has_vhostfds ? vhost_fds[i] : NULL, tap->vhostfds ? vhost_fds[i] : NULL,
vnet_hdr, fd, &err); vnet_hdr, fd, &err);
if (err) { if (err) {
error_propagate(errp, err); error_propagate(errp, err);
@ -935,17 +935,16 @@ free_fail:
g_free(fds); g_free(fds);
g_free(vhost_fds); g_free(vhost_fds);
return ret; return ret;
} else if (tap->has_helper) { } else if (tap->helper) {
if (tap->has_ifname || tap->has_script || tap->has_downscript || if (tap->ifname || tap->script || tap->downscript ||
tap->has_vnet_hdr || tap->has_queues || tap->has_vhostfds) { tap->has_vnet_hdr || tap->has_queues || tap->vhostfds) {
error_setg(errp, "ifname=, script=, downscript=, vnet_hdr=, " error_setg(errp, "ifname=, script=, downscript=, vnet_hdr=, "
"queues=, and vhostfds= are invalid with helper="); "queues=, and vhostfds= are invalid with helper=");
return -1; return -1;
} }
fd = net_bridge_run_helper(tap->helper, fd = net_bridge_run_helper(tap->helper,
tap->has_br ? tap->br ?: DEFAULT_BRIDGE_INTERFACE,
tap->br : DEFAULT_BRIDGE_INTERFACE,
errp); errp);
if (fd == -1) { if (fd == -1) {
return -1; return -1;
@ -972,7 +971,7 @@ free_fail:
} else { } else {
g_autofree char *default_script = NULL; g_autofree char *default_script = NULL;
g_autofree char *default_downscript = NULL; g_autofree char *default_downscript = NULL;
if (tap->has_vhostfds) { if (tap->vhostfds) {
error_setg(errp, "vhostfds= is invalid if fds= wasn't specified"); error_setg(errp, "vhostfds= is invalid if fds= wasn't specified");
return -1; return -1;
} }
@ -985,7 +984,7 @@ free_fail:
get_relocated_path(DEFAULT_NETWORK_DOWN_SCRIPT); get_relocated_path(DEFAULT_NETWORK_DOWN_SCRIPT);
} }
if (tap->has_ifname) { if (tap->ifname) {
pstrcpy(ifname, sizeof ifname, tap->ifname); pstrcpy(ifname, sizeof ifname, tap->ifname);
} else { } else {
ifname[0] = '\0'; ifname[0] = '\0';
@ -998,7 +997,7 @@ free_fail:
return -1; return -1;
} }
if (queues > 1 && i == 0 && !tap->has_ifname) { if (queues > 1 && i == 0 && !tap->ifname) {
if (tap_fd_get_ifname(fd, ifname)) { if (tap_fd_get_ifname(fd, ifname)) {
error_setg(errp, "Fail to get ifname"); error_setg(errp, "Fail to get ifname");
close(fd); close(fd);

View File

@ -635,19 +635,19 @@ int net_init_vhost_vdpa(const Netdev *netdev, const char *name,
assert(netdev->type == NET_CLIENT_DRIVER_VHOST_VDPA); assert(netdev->type == NET_CLIENT_DRIVER_VHOST_VDPA);
opts = &netdev->u.vhost_vdpa; opts = &netdev->u.vhost_vdpa;
if (!opts->has_vhostdev && !opts->has_vhostfd) { if (!opts->vhostdev && !opts->vhostfd) {
error_setg(errp, error_setg(errp,
"vhost-vdpa: neither vhostdev= nor vhostfd= was specified"); "vhost-vdpa: neither vhostdev= nor vhostfd= was specified");
return -1; return -1;
} }
if (opts->has_vhostdev && opts->has_vhostfd) { if (opts->vhostdev && opts->vhostfd) {
error_setg(errp, error_setg(errp,
"vhost-vdpa: vhostdev= and vhostfd= are mutually exclusive"); "vhost-vdpa: vhostdev= and vhostfd= are mutually exclusive");
return -1; return -1;
} }
if (opts->has_vhostdev) { if (opts->vhostdev) {
vdpa_device_fd = qemu_open(opts->vhostdev, O_RDWR, errp); vdpa_device_fd = qemu_open(opts->vhostdev, O_RDWR, errp);
if (vdpa_device_fd == -1) { if (vdpa_device_fd == -1) {
return -errno; return -errno;

View File

@ -26,7 +26,7 @@ static bool validate_options(const Netdev *netdev, Error **errp)
MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_VERSION_11_0 MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_VERSION_11_0
QemuUUID net_uuid; QemuUUID net_uuid;
if (options->has_net_uuid && if (options->net_uuid &&
qemu_uuid_parse(options->net_uuid, &net_uuid) < 0) { qemu_uuid_parse(options->net_uuid, &net_uuid) < 0) {
error_setg(errp, "Invalid UUID provided in 'net-uuid'"); error_setg(errp, "Invalid UUID provided in 'net-uuid'");
return false; return false;
@ -39,7 +39,7 @@ static bool validate_options(const Netdev *netdev, Error **errp)
return false; return false;
} }
if (options->has_net_uuid) { if (options->net_uuid) {
error_setg(errp, error_setg(errp,
"vmnet-host.net-uuid feature is " "vmnet-host.net-uuid feature is "
"unavailable: outdated vmnet.framework API"); "unavailable: outdated vmnet.framework API");
@ -47,12 +47,12 @@ static bool validate_options(const Netdev *netdev, Error **errp)
} }
#endif #endif
if ((options->has_start_address || if ((options->start_address ||
options->has_end_address || options->end_address ||
options->has_subnet_mask) && options->subnet_mask) &&
!(options->has_start_address && !(options->start_address &&
options->has_end_address && options->end_address &&
options->has_subnet_mask)) { options->subnet_mask)) {
error_setg(errp, error_setg(errp,
"'start-address', 'end-address', 'subnet-mask' " "'start-address', 'end-address', 'subnet-mask' "
"should be provided together"); "should be provided together");
@ -79,7 +79,7 @@ static xpc_object_t build_if_desc(const Netdev *netdev)
options->isolated); options->isolated);
QemuUUID net_uuid; QemuUUID net_uuid;
if (options->has_net_uuid) { if (options->net_uuid) {
qemu_uuid_parse(options->net_uuid, &net_uuid); qemu_uuid_parse(options->net_uuid, &net_uuid);
xpc_dictionary_set_uuid(if_desc, xpc_dictionary_set_uuid(if_desc,
vmnet_network_identifier_key, vmnet_network_identifier_key,
@ -87,7 +87,7 @@ static xpc_object_t build_if_desc(const Netdev *netdev)
} }
#endif #endif
if (options->has_start_address) { if (options->start_address) {
xpc_dictionary_set_string(if_desc, xpc_dictionary_set_string(if_desc,
vmnet_start_address_key, vmnet_start_address_key,
options->start_address); options->start_address);

View File

@ -31,12 +31,12 @@ static bool validate_options(const Netdev *netdev, Error **errp)
} }
#endif #endif
if ((options->has_start_address || if ((options->start_address ||
options->has_end_address || options->end_address ||
options->has_subnet_mask) && options->subnet_mask) &&
!(options->has_start_address && !(options->start_address &&
options->has_end_address && options->end_address &&
options->has_subnet_mask)) { options->subnet_mask)) {
error_setg(errp, error_setg(errp,
"'start-address', 'end-address', 'subnet-mask' " "'start-address', 'end-address', 'subnet-mask' "
"should be provided together" "should be provided together"
@ -58,13 +58,13 @@ static xpc_object_t build_if_desc(const Netdev *netdev)
VMNET_SHARED_MODE VMNET_SHARED_MODE
); );
if (options->has_nat66_prefix) { if (options->nat66_prefix) {
xpc_dictionary_set_string(if_desc, xpc_dictionary_set_string(if_desc,
vmnet_nat66_prefix_key, vmnet_nat66_prefix_key,
options->nat66_prefix); options->nat66_prefix);
} }
if (options->has_start_address) { if (options->start_address) {
xpc_dictionary_set_string(if_desc, xpc_dictionary_set_string(if_desc,
vmnet_start_address_key, vmnet_start_address_key,
options->start_address); options->start_address);

View File

@ -759,7 +759,6 @@ class QAPISchemaObjectTypeMember(QAPISchemaMember):
assert self.type assert self.type
# Temporary hack to support dropping the has_FOO in reviewable chunks # Temporary hack to support dropping the has_FOO in reviewable chunks
opt_out = [ opt_out = [
'qapi/net.json',
'qapi/pci.json', 'qapi/pci.json',
'qapi/qdev.json', 'qapi/qdev.json',
'qapi/qom.json', 'qapi/qom.json',