mirror of https://github.com/xemu-project/xemu.git
net: Drop vlan argument to qemu_new_net_client()
Since hubs are now used to implement the 'vlan' feature and the vlan argument is always NULL, remove the argument entirely and update all net clients that use qemu_new_net_client(). Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
This commit is contained in:
parent
81017645e4
commit
ab5f3f84c4
9
net.c
9
net.c
|
@ -197,7 +197,6 @@ static ssize_t qemu_deliver_packet_iov(VLANClientState *sender,
|
||||||
void *opaque);
|
void *opaque);
|
||||||
|
|
||||||
VLANClientState *qemu_new_net_client(NetClientInfo *info,
|
VLANClientState *qemu_new_net_client(NetClientInfo *info,
|
||||||
VLANState *vlan,
|
|
||||||
VLANClientState *peer,
|
VLANClientState *peer,
|
||||||
const char *model,
|
const char *model,
|
||||||
const char *name)
|
const char *name)
|
||||||
|
@ -216,11 +215,6 @@ VLANClientState *qemu_new_net_client(NetClientInfo *info,
|
||||||
vc->name = assign_name(vc, model);
|
vc->name = assign_name(vc, model);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vlan) {
|
|
||||||
assert(!peer);
|
|
||||||
vc->vlan = vlan;
|
|
||||||
QTAILQ_INSERT_TAIL(&vc->vlan->clients, vc, next);
|
|
||||||
} else {
|
|
||||||
if (peer) {
|
if (peer) {
|
||||||
assert(!peer->peer);
|
assert(!peer->peer);
|
||||||
vc->peer = peer;
|
vc->peer = peer;
|
||||||
|
@ -231,7 +225,6 @@ VLANClientState *qemu_new_net_client(NetClientInfo *info,
|
||||||
vc->send_queue = qemu_new_net_queue(qemu_deliver_packet,
|
vc->send_queue = qemu_new_net_queue(qemu_deliver_packet,
|
||||||
qemu_deliver_packet_iov,
|
qemu_deliver_packet_iov,
|
||||||
vc);
|
vc);
|
||||||
}
|
|
||||||
|
|
||||||
return vc;
|
return vc;
|
||||||
}
|
}
|
||||||
|
@ -248,7 +241,7 @@ NICState *qemu_new_nic(NetClientInfo *info,
|
||||||
assert(info->type == NET_CLIENT_OPTIONS_KIND_NIC);
|
assert(info->type == NET_CLIENT_OPTIONS_KIND_NIC);
|
||||||
assert(info->size >= sizeof(NICState));
|
assert(info->size >= sizeof(NICState));
|
||||||
|
|
||||||
nc = qemu_new_net_client(info, conf->vlan, conf->peer, model, name);
|
nc = qemu_new_net_client(info, conf->peer, model, name);
|
||||||
|
|
||||||
nic = DO_UPCAST(NICState, nc, nc);
|
nic = DO_UPCAST(NICState, nc, nc);
|
||||||
nic->conf = conf;
|
nic->conf = conf;
|
||||||
|
|
1
net.h
1
net.h
|
@ -79,7 +79,6 @@ struct VLANState {
|
||||||
VLANState *qemu_find_vlan(int id, int allocate);
|
VLANState *qemu_find_vlan(int id, int allocate);
|
||||||
VLANClientState *qemu_find_netdev(const char *id);
|
VLANClientState *qemu_find_netdev(const char *id);
|
||||||
VLANClientState *qemu_new_net_client(NetClientInfo *info,
|
VLANClientState *qemu_new_net_client(NetClientInfo *info,
|
||||||
VLANState *vlan,
|
|
||||||
VLANClientState *peer,
|
VLANClientState *peer,
|
||||||
const char *model,
|
const char *model,
|
||||||
const char *name);
|
const char *name);
|
||||||
|
|
|
@ -129,7 +129,7 @@ static int net_dump_init(VLANClientState *peer, const char *device,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
nc = qemu_new_net_client(&net_dump_info, NULL, peer, device, name);
|
nc = qemu_new_net_client(&net_dump_info, peer, device, name);
|
||||||
|
|
||||||
snprintf(nc->info_str, sizeof(nc->info_str),
|
snprintf(nc->info_str, sizeof(nc->info_str),
|
||||||
"dump to %s (len=%d)", filename, len);
|
"dump to %s (len=%d)", filename, len);
|
||||||
|
|
|
@ -129,7 +129,7 @@ static NetHubPort *net_hub_port_new(NetHub *hub, const char *name)
|
||||||
name = default_name;
|
name = default_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
nc = qemu_new_net_client(&net_hub_port_info, NULL, NULL, "hub", name);
|
nc = qemu_new_net_client(&net_hub_port_info, NULL, "hub", name);
|
||||||
port = DO_UPCAST(NetHubPort, nc, nc);
|
port = DO_UPCAST(NetHubPort, nc, nc);
|
||||||
port->id = id;
|
port->id = id;
|
||||||
port->hub = hub;
|
port->hub = hub;
|
||||||
|
|
|
@ -239,7 +239,7 @@ static int net_slirp_init(VLANClientState *peer, const char *model,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nc = qemu_new_net_client(&net_slirp_info, NULL, peer, model, name);
|
nc = qemu_new_net_client(&net_slirp_info, peer, model, name);
|
||||||
|
|
||||||
snprintf(nc->info_str, sizeof(nc->info_str),
|
snprintf(nc->info_str, sizeof(nc->info_str),
|
||||||
"net=%s,restrict=%s", inet_ntoa(net),
|
"net=%s,restrict=%s", inet_ntoa(net),
|
||||||
|
|
|
@ -287,7 +287,7 @@ static NetSocketState *net_socket_fd_init_dgram(VLANClientState *peer,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nc = qemu_new_net_client(&net_dgram_socket_info, NULL, peer, model, name);
|
nc = qemu_new_net_client(&net_dgram_socket_info, peer, model, name);
|
||||||
|
|
||||||
snprintf(nc->info_str, sizeof(nc->info_str),
|
snprintf(nc->info_str, sizeof(nc->info_str),
|
||||||
"socket: fd=%d (%s mcast=%s:%d)",
|
"socket: fd=%d (%s mcast=%s:%d)",
|
||||||
|
@ -331,7 +331,7 @@ static NetSocketState *net_socket_fd_init_stream(VLANClientState *peer,
|
||||||
VLANClientState *nc;
|
VLANClientState *nc;
|
||||||
NetSocketState *s;
|
NetSocketState *s;
|
||||||
|
|
||||||
nc = qemu_new_net_client(&net_socket_info, NULL, peer, model, name);
|
nc = qemu_new_net_client(&net_socket_info, peer, model, name);
|
||||||
|
|
||||||
snprintf(nc->info_str, sizeof(nc->info_str), "socket: fd=%d", fd);
|
snprintf(nc->info_str, sizeof(nc->info_str), "socket: fd=%d", fd);
|
||||||
|
|
||||||
|
|
|
@ -685,7 +685,7 @@ static int tap_win32_init(VLANClientState *peer, const char *model,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
nc = qemu_new_net_client(&net_tap_win32_info, NULL, peer, model, name);
|
nc = qemu_new_net_client(&net_tap_win32_info, peer, model, name);
|
||||||
|
|
||||||
s = DO_UPCAST(TAPState, nc, nc);
|
s = DO_UPCAST(TAPState, nc, nc);
|
||||||
|
|
||||||
|
|
|
@ -331,7 +331,7 @@ static TAPState *net_tap_fd_init(VLANClientState *peer,
|
||||||
VLANClientState *nc;
|
VLANClientState *nc;
|
||||||
TAPState *s;
|
TAPState *s;
|
||||||
|
|
||||||
nc = qemu_new_net_client(&net_tap_info, NULL, peer, model, name);
|
nc = qemu_new_net_client(&net_tap_info, peer, model, name);
|
||||||
|
|
||||||
s = DO_UPCAST(TAPState, nc, nc);
|
s = DO_UPCAST(TAPState, nc, nc);
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ static int net_vde_init(VLANClientState *peer, const char *model,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
nc = qemu_new_net_client(&net_vde_info, NULL, peer, model, name);
|
nc = qemu_new_net_client(&net_vde_info, peer, model, name);
|
||||||
|
|
||||||
snprintf(nc->info_str, sizeof(nc->info_str), "sock=%s,fd=%d",
|
snprintf(nc->info_str, sizeof(nc->info_str), "sock=%s,fd=%d",
|
||||||
sock, vde_datafd(vde));
|
sock, vde_datafd(vde));
|
||||||
|
|
Loading…
Reference in New Issue