From: Gildas <gildas.ml@gmail.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] rename vlan to vnet and mark vlan as deprecated
Date: Tue, 9 Dec 2008 16:01:53 +0100 [thread overview]
Message-ID: <b2ace7f20812090701u51ed8472hb122213c607493fc@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 667 bytes --]
Hi all,
As I agree with the thread "vlan option is misleading, what about vnet
?" and I found sending a patch would be more constructive than a "+1",
here it is.
--
This patch renames occurences of vlan/VLAN that are not related to IEE
802.1q vlans to vnet/VNET respectively.
Usage of vlan= in the -net options is still allowed but will produce
an error message on stderr indicating that the option is now
deprecated and will be removed in the future.
Compiled on a x86_64 linux host with ./configure && make, then tested
with a x86_64 linux VM using -net user with different nics and
vnet/vlan combinaisons.
Signed-off-by: Gildas Le Nadan <3ntr0p13@gmail.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: vlan_to_vnet.diff --]
[-- Type: text/x-patch; name=vlan_to_vnet.diff, Size: 50763 bytes --]
diff -Naur trunk/hw/e1000.c local/hw/e1000.c
--- trunk/hw/e1000.c 2008-12-09 13:23:07.000000000 +0100
+++ local/hw/e1000.c 2008-12-09 15:21:44.000000000 +0100
@@ -74,7 +74,7 @@
typedef struct E1000State_st {
PCIDevice dev;
- VLANClientState *vc;
+ VNETClientState *vc;
NICInfo *nd;
int mmio_index;
@@ -1059,7 +1059,7 @@
d->rxbuf_min_shift = 1;
memset(&d->tx, 0, sizeof d->tx);
- d->vc = qemu_new_vlan_client(nd->vlan, e1000_receive,
+ d->vc = qemu_new_vnet_client(nd->vnet, e1000_receive,
e1000_can_receive, d);
snprintf(d->vc->info_str, sizeof(d->vc->info_str),
diff -Naur trunk/hw/eepro100.c local/hw/eepro100.c
--- trunk/hw/eepro100.c 2008-12-09 13:23:07.000000000 +0100
+++ local/hw/eepro100.c 2008-12-09 13:33:59.000000000 +0100
@@ -226,7 +226,7 @@
uint8_t mult[8]; /* multicast mask array */
int mmio_index;
PCIDevice *pci_dev;
- VLANClientState *vc;
+ VNETClientState *vc;
#endif
uint8_t scb_stat; /* SCB stat/ack byte */
uint8_t int_stat; /* PCI interrupt status */
@@ -1776,7 +1776,7 @@
nic_reset(s);
- s->vc = qemu_new_vlan_client(nd->vlan, nic_receive, nic_can_receive, s);
+ s->vc = qemu_new_vnet_client(nd->vnet, nic_receive, nic_can_receive, s);
snprintf(s->vc->info_str, sizeof(s->vc->info_str),
"eepro100 pci macaddr=%02x:%02x:%02x:%02x:%02x:%02x",
diff -Naur trunk/hw/etraxfs_eth.c local/hw/etraxfs_eth.c
--- trunk/hw/etraxfs_eth.c 2008-12-09 13:23:07.000000000 +0100
+++ local/hw/etraxfs_eth.c 2008-12-09 13:33:59.000000000 +0100
@@ -314,7 +314,7 @@
{
CPUState *env;
qemu_irq *irq;
- VLANClientState *vc;
+ VNETClientState *vc;
int ethregs;
/* Two addrs in the filter. */
@@ -596,7 +596,7 @@
eth->ethregs = cpu_register_io_memory(0, eth_read, eth_write, eth);
cpu_register_physical_memory (base, 0x5c, eth->ethregs);
- eth->vc = qemu_new_vlan_client(nd->vlan,
+ eth->vc = qemu_new_vnet_client(nd->vnet,
eth_receive, eth_can_receive, eth);
return dma;
diff -Naur trunk/hw/integratorcp.c local/hw/integratorcp.c
--- trunk/hw/integratorcp.c 2008-12-09 13:23:07.000000000 +0100
+++ local/hw/integratorcp.c 2008-12-09 13:32:19.000000000 +0100
@@ -497,7 +497,7 @@
exit(1);
}
pl181_init(0x1c000000, drives_table[sd].bdrv, pic[23], pic[24]);
- if (nd_table[0].vlan) {
+ if (nd_table[0].vnet) {
if (nd_table[0].model == NULL
|| strcmp(nd_table[0].model, "smc91c111") == 0) {
smc91c111_init(&nd_table[0], 0xc8000000, pic[27]);
diff -Naur trunk/hw/mcf5208.c local/hw/mcf5208.c
--- trunk/hw/mcf5208.c 2008-12-09 13:23:07.000000000 +0100
+++ local/hw/mcf5208.c 2008-12-09 13:32:19.000000000 +0100
@@ -241,7 +241,7 @@
fprintf(stderr, "Too many NICs\n");
exit(1);
}
- if (nd_table[0].vlan) {
+ if (nd_table[0].vnet) {
if (nd_table[0].model == NULL
|| strcmp(nd_table[0].model, "mcf_fec") == 0) {
mcf_fec_init(&nd_table[0], 0xfc030000, pic + 36);
diff -Naur trunk/hw/mcf_fec.c local/hw/mcf_fec.c
--- trunk/hw/mcf_fec.c 2008-12-09 13:23:07.000000000 +0100
+++ local/hw/mcf_fec.c 2008-12-09 13:33:59.000000000 +0100
@@ -24,7 +24,7 @@
typedef struct {
qemu_irq *irq;
- VLANClientState *vc;
+ VNETClientState *vc;
uint32_t irq_state;
uint32_t eir;
uint32_t eimr;
@@ -452,7 +452,7 @@
mcf_fec_writefn, s);
cpu_register_physical_memory(base, 0x400, iomemtype);
- s->vc = qemu_new_vlan_client(nd->vlan, mcf_fec_receive,
+ s->vc = qemu_new_vnet_client(nd->vnet, mcf_fec_receive,
mcf_fec_can_receive, s);
memcpy(s->macaddr, nd->macaddr, 6);
}
diff -Naur trunk/hw/mips_mipssim.c local/hw/mips_mipssim.c
--- trunk/hw/mips_mipssim.c 2008-12-09 13:23:07.000000000 +0100
+++ local/hw/mips_mipssim.c 2008-12-09 13:32:19.000000000 +0100
@@ -175,7 +175,7 @@
if (serial_hds[0])
serial_init(0x3f8, env->irq[4], 115200, serial_hds[0]);
- if (nd_table[0].vlan) {
+ if (nd_table[0].vnet) {
if (nd_table[0].model == NULL
|| strcmp(nd_table[0].model, "mipsnet") == 0) {
/* MIPSnet uses the MIPS CPU INT0, which is interrupt 2. */
diff -Naur trunk/hw/mipsnet.c local/hw/mipsnet.c
--- trunk/hw/mipsnet.c 2008-12-09 13:23:08.000000000 +0100
+++ local/hw/mipsnet.c 2008-12-09 13:33:59.000000000 +0100
@@ -34,7 +34,7 @@
uint8_t rx_buffer[MAX_ETH_FRAME_SIZE];
uint8_t tx_buffer[MAX_ETH_FRAME_SIZE];
qemu_irq irq;
- VLANClientState *vc;
+ VNETClientState *vc;
NICInfo *nd;
} MIPSnetState;
@@ -249,8 +249,8 @@
s->irq = irq;
s->nd = nd;
- if (nd && nd->vlan) {
- s->vc = qemu_new_vlan_client(nd->vlan, mipsnet_receive,
+ if (nd && nd->vnet) {
+ s->vc = qemu_new_vnet_client(nd->vnet, mipsnet_receive,
mipsnet_can_receive, s);
} else {
s->vc = NULL;
diff -Naur trunk/hw/mips_r4k.c local/hw/mips_r4k.c
--- trunk/hw/mips_r4k.c 2008-12-09 13:23:08.000000000 +0100
+++ local/hw/mips_r4k.c 2008-12-09 13:32:19.000000000 +0100
@@ -247,7 +247,7 @@
isa_vga_init(ds, phys_ram_base + ram_size, ram_size,
vga_ram_size);
- if (nd_table[0].vlan) {
+ if (nd_table[0].vnet) {
if (nd_table[0].model == NULL
|| strcmp(nd_table[0].model, "ne2k_isa") == 0) {
isa_ne2000_init(0x300, i8259[9], &nd_table[0]);
diff -Naur trunk/hw/musicpal.c local/hw/musicpal.c
--- trunk/hw/musicpal.c 2008-12-09 13:23:08.000000000 +0100
+++ local/hw/musicpal.c 2008-12-09 14:45:28.000000000 +0100
@@ -554,7 +554,7 @@
mv88w8618_rx_desc *rx_queue[4];
mv88w8618_rx_desc *frx_queue[4];
mv88w8618_rx_desc *cur_rx[4];
- VLANClientState *vc;
+ VNETClientState *vc;
} mv88w8618_eth_state;
static int eth_can_receive(void *opaque)
@@ -718,7 +718,7 @@
if (!s)
return;
s->irq = irq;
- s->vc = qemu_new_vlan_client(nd->vlan, eth_receive, eth_can_receive, s);
+ s->vc = qemu_new_vnet_client(nd->vnet, eth_receive, eth_can_receive, s);
iomemtype = cpu_register_io_memory(0, mv88w8618_eth_readfn,
mv88w8618_eth_writefn, s);
cpu_register_physical_memory(base, MP_ETH_SIZE, iomemtype);
diff -Naur trunk/hw/ne2000.c local/hw/ne2000.c
--- trunk/hw/ne2000.c 2008-12-09 13:23:07.000000000 +0100
+++ local/hw/ne2000.c 2008-12-09 13:33:59.000000000 +0100
@@ -141,7 +141,7 @@
uint8_t mult[8]; /* multicast mask array */
qemu_irq irq;
PCIDevice *pci_dev;
- VLANClientState *vc;
+ VNETClientState *vc;
uint8_t macaddr[6];
uint8_t mem[NE2000_MEM_SIZE];
} NE2000State;
@@ -741,7 +741,7 @@
ne2000_reset(s);
- s->vc = qemu_new_vlan_client(nd->vlan, ne2000_receive,
+ s->vc = qemu_new_vnet_client(nd->vnet, ne2000_receive,
ne2000_can_receive, s);
snprintf(s->vc->info_str, sizeof(s->vc->info_str),
@@ -811,7 +811,7 @@
s->pci_dev = (PCIDevice *)d;
memcpy(s->macaddr, nd->macaddr, 6);
ne2000_reset(s);
- s->vc = qemu_new_vlan_client(nd->vlan, ne2000_receive,
+ s->vc = qemu_new_vnet_client(nd->vnet, ne2000_receive,
ne2000_can_receive, s);
snprintf(s->vc->info_str, sizeof(s->vc->info_str),
diff -Naur trunk/hw/pcnet.c local/hw/pcnet.c
--- trunk/hw/pcnet.c 2008-12-09 13:23:07.000000000 +0100
+++ local/hw/pcnet.c 2008-12-09 15:11:24.000000000 +0100
@@ -62,7 +62,7 @@
struct PCNetState_st {
PCIDevice dev;
PCIDevice *pci_dev;
- VLANClientState *vc;
+ VNETClientState *vc;
NICInfo *nd;
QEMUTimer *poll_timer;
int mmio_index, rap, isr, lnkst;
@@ -1935,8 +1935,8 @@
d->nd = nd;
- if (nd && nd->vlan) {
- d->vc = qemu_new_vlan_client(nd->vlan, pcnet_receive,
+ if (nd && nd->vnet) {
+ d->vc = qemu_new_vnet_client(nd->vnet, pcnet_receive,
pcnet_can_receive, d);
snprintf(d->vc->info_str, sizeof(d->vc->info_str),
diff -Naur trunk/hw/rtl8139.c local/hw/rtl8139.c
--- trunk/hw/rtl8139.c 2008-12-09 13:23:07.000000000 +0100
+++ local/hw/rtl8139.c 2008-12-09 14:55:43.000000000 +0100
@@ -464,7 +464,7 @@
uint8_t TxThresh;
PCIDevice *pci_dev;
- VLANClientState *vc;
+ VNETClientState *vc;
uint8_t macaddr[6];
int rtl8139_mmio_io_addr;
@@ -3438,7 +3438,7 @@
s->pci_dev = (PCIDevice *)d;
memcpy(s->macaddr, nd->macaddr, 6);
rtl8139_reset(s);
- s->vc = qemu_new_vlan_client(nd->vlan, rtl8139_receive,
+ s->vc = qemu_new_vnet_client(nd->vnet, rtl8139_receive,
rtl8139_can_receive, s);
snprintf(s->vc->info_str, sizeof(s->vc->info_str),
diff -Naur trunk/hw/smc91c111.c local/hw/smc91c111.c
--- trunk/hw/smc91c111.c 2008-12-09 13:23:08.000000000 +0100
+++ local/hw/smc91c111.c 2008-12-09 13:33:59.000000000 +0100
@@ -17,7 +17,7 @@
#define NUM_PACKETS 4
typedef struct {
- VLANClientState *vc;
+ VNETClientState *vc;
uint16_t tcr;
uint16_t rcr;
uint16_t cr;
@@ -704,7 +704,7 @@
smc91c111_reset(s);
- s->vc = qemu_new_vlan_client(nd->vlan, smc91c111_receive,
+ s->vc = qemu_new_vnet_client(nd->vnet, smc91c111_receive,
smc91c111_can_receive, s);
/* ??? Save/restore. */
}
diff -Naur trunk/hw/stellaris_enet.c local/hw/stellaris_enet.c
--- trunk/hw/stellaris_enet.c 2008-12-09 13:23:07.000000000 +0100
+++ local/hw/stellaris_enet.c 2008-12-09 13:33:59.000000000 +0100
@@ -66,7 +66,7 @@
uint8_t *rx_fifo;
int rx_fifo_len;
int next_packet;
- VLANClientState *vc;
+ VNETClientState *vc;
qemu_irq irq;
uint8_t macaddr[6];
} stellaris_enet_state;
@@ -396,8 +396,8 @@
s->irq = irq;
memcpy(s->macaddr, nd->macaddr, 6);
- if (nd->vlan)
- s->vc = qemu_new_vlan_client(nd->vlan, stellaris_enet_receive,
+ if (nd->vnet)
+ s->vc = qemu_new_vnet_client(nd->vnet, stellaris_enet_receive,
stellaris_enet_can_receive, s);
stellaris_enet_reset(s);
diff -Naur trunk/hw/usb-net.c local/hw/usb-net.c
--- trunk/hw/usb-net.c 2008-12-09 13:23:07.000000000 +0100
+++ local/hw/usb-net.c 2008-12-09 14:50:04.000000000 +0100
@@ -620,7 +620,7 @@
uint8_t in_buf[2048];
char usbstring_mac[13];
- VLANClientState *vc;
+ VNETClientState *vc;
TAILQ_HEAD(rndis_resp_head, rndis_response) rndis_resp;
} USBNetState;
@@ -1421,7 +1421,7 @@
USBNetState *s = (USBNetState *) dev;
/* TODO: remove the nd_table[] entry */
- qemu_del_vlan_client(s->vc);
+ qemu_del_vnet_client(s->vc);
rndis_clear_responsequeue(s);
qemu_free(s);
}
@@ -1454,7 +1454,7 @@
pstrcpy(s->dev.devname, sizeof(s->dev.devname),
"QEMU USB Network Interface");
- s->vc = qemu_new_vlan_client(nd->vlan,
+ s->vc = qemu_new_vnet_client(nd->vnet,
usbnet_receive, usbnet_can_receive, s);
snprintf(s->usbstring_mac, sizeof(s->usbstring_mac),
diff -Naur trunk/net.c local/net.c
--- trunk/net.c 2008-12-09 13:23:15.000000000 +0100
+++ local/net.c 2008-12-09 14:21:37.000000000 +0100
@@ -128,7 +128,7 @@
#define SMBD_COMMAND "/usr/sbin/smbd"
#endif
-static VLANState *first_vlan;
+static VNETState *first_vnet;
/***********************************************************/
/* network device redirectors */
@@ -304,31 +304,31 @@
}
#endif
-VLANClientState *qemu_new_vlan_client(VLANState *vlan,
+VNETClientState *qemu_new_vnet_client(VNETState *vnet,
IOReadHandler *fd_read,
IOCanRWHandler *fd_can_read,
void *opaque)
{
- VLANClientState *vc, **pvc;
- vc = qemu_mallocz(sizeof(VLANClientState));
+ VNETClientState *vc, **pvc;
+ vc = qemu_mallocz(sizeof(VNETClientState));
if (!vc)
return NULL;
vc->fd_read = fd_read;
vc->fd_can_read = fd_can_read;
vc->opaque = opaque;
- vc->vlan = vlan;
+ vc->vnet = vnet;
vc->next = NULL;
- pvc = &vlan->first_client;
+ pvc = &vnet->first_client;
while (*pvc != NULL)
pvc = &(*pvc)->next;
*pvc = vc;
return vc;
}
-void qemu_del_vlan_client(VLANClientState *vc)
+void qemu_del_vnet_client(VNETClientState *vc)
{
- VLANClientState **pvc = &vc->vlan->first_client;
+ VNETClientState **pvc = &vc->vnet->first_client;
while (*pvc != NULL)
if (*pvc == vc) {
@@ -339,12 +339,12 @@
pvc = &(*pvc)->next;
}
-int qemu_can_send_packet(VLANClientState *vc1)
+int qemu_can_send_packet(VNETClientState *vc1)
{
- VLANState *vlan = vc1->vlan;
- VLANClientState *vc;
+ VNETState *vnet = vc1->vnet;
+ VNETClientState *vc;
- for(vc = vlan->first_client; vc != NULL; vc = vc->next) {
+ for(vc = vnet->first_client; vc != NULL; vc = vc->next) {
if (vc != vc1) {
if (vc->fd_can_read && vc->fd_can_read(vc->opaque))
return 1;
@@ -353,16 +353,16 @@
return 0;
}
-void qemu_send_packet(VLANClientState *vc1, const uint8_t *buf, int size)
+void qemu_send_packet(VNETClientState *vc1, const uint8_t *buf, int size)
{
- VLANState *vlan = vc1->vlan;
- VLANClientState *vc;
+ VNETState *vnet = vc1->vnet;
+ VNETClientState *vc;
#ifdef DEBUG_NET
- printf("vlan %d send:\n", vlan->id);
+ printf("vnet %d send:\n", vnet->id);
hex_dump(stdout, buf, size);
#endif
- for(vc = vlan->first_client; vc != NULL; vc = vc->next) {
+ for(vc = vnet->first_client; vc != NULL; vc = vc->next) {
if (vc != vc1) {
vc->fd_read(vc->opaque, buf, size);
}
@@ -374,7 +374,7 @@
/* slirp network adapter */
static int slirp_inited;
-static VLANClientState *slirp_vc;
+static VNETClientState *slirp_vc;
int slirp_can_output(void)
{
@@ -406,13 +406,13 @@
slirp_input(buf, size);
}
-static int net_slirp_init(VLANState *vlan)
+static int net_slirp_init(VNETState *vnet)
{
if (!slirp_inited) {
slirp_inited = 1;
slirp_init();
}
- slirp_vc = qemu_new_vlan_client(vlan,
+ slirp_vc = qemu_new_vnet_client(vnet,
slirp_receive, NULL, NULL);
snprintf(slirp_vc->info_str, sizeof(slirp_vc->info_str), "user redirector");
return 0;
@@ -571,7 +571,7 @@
#if !defined(_WIN32)
typedef struct TAPState {
- VLANClientState *vc;
+ VNETClientState *vc;
int fd;
char down_script[1024];
} TAPState;
@@ -611,7 +611,7 @@
/* fd support */
-static TAPState *net_tap_fd_init(VLANState *vlan, int fd)
+static TAPState *net_tap_fd_init(VNETState *vnet, int fd)
{
TAPState *s;
@@ -619,7 +619,7 @@
if (!s)
return NULL;
s->fd = fd;
- s->vc = qemu_new_vlan_client(vlan, tap_receive, NULL, s);
+ s->vc = qemu_new_vnet_client(vnet, tap_receive, NULL, s);
qemu_set_fd_handler(s->fd, tap_send, NULL, s);
snprintf(s->vc->info_str, sizeof(s->vc->info_str), "tap: fd=%d", fd);
return s;
@@ -851,7 +851,7 @@
return 0;
}
-static int net_tap_init(VLANState *vlan, const char *ifname1,
+static int net_tap_init(VNETState *vnet, const char *ifname1,
const char *setup_script, const char *down_script)
{
TAPState *s;
@@ -872,7 +872,7 @@
if (launch_script(setup_script, ifname, fd))
return -1;
}
- s = net_tap_fd_init(vlan, fd);
+ s = net_tap_fd_init(vnet, fd);
if (!s)
return -1;
snprintf(s->vc->info_str, sizeof(s->vc->info_str),
@@ -886,7 +886,7 @@
#if defined(CONFIG_VDE)
typedef struct VDEState {
- VLANClientState *vc;
+ VNETClientState *vc;
VDECONN *vde;
} VDEState;
@@ -915,7 +915,7 @@
}
}
-static int net_vde_init(VLANState *vlan, const char *sock, int port,
+static int net_vde_init(VNETState *vnet, const char *sock, int port,
const char *group, int mode)
{
VDEState *s;
@@ -936,7 +936,7 @@
free(s);
return -1;
}
- s->vc = qemu_new_vlan_client(vlan, vde_from_qemu, NULL, s);
+ s->vc = qemu_new_vnet_client(vnet, vde_from_qemu, NULL, s);
qemu_set_fd_handler(vde_datafd(s->vde), vde_to_qemu, NULL, s);
snprintf(s->vc->info_str, sizeof(s->vc->info_str), "vde: sock=%s fd=%d",
sock, vde_datafd(s->vde));
@@ -946,7 +946,7 @@
/* network connection */
typedef struct NetSocketState {
- VLANClientState *vc;
+ VNETClientState *vc;
int fd;
int state; /* 0 = getting length, 1 = getting data */
int index;
@@ -956,7 +956,7 @@
} NetSocketState;
typedef struct NetSocketListenState {
- VLANState *vlan;
+ VNETState *vnet;
int fd;
} NetSocketListenState;
@@ -1110,7 +1110,7 @@
return -1;
}
-static NetSocketState *net_socket_fd_init_dgram(VLANState *vlan, int fd,
+static NetSocketState *net_socket_fd_init_dgram(VNETState *vnet, int fd,
int is_connected)
{
struct sockaddr_in saddr;
@@ -1154,7 +1154,7 @@
return NULL;
s->fd = fd;
- s->vc = qemu_new_vlan_client(vlan, net_socket_receive_dgram, NULL, s);
+ s->vc = qemu_new_vnet_client(vnet, net_socket_receive_dgram, NULL, s);
qemu_set_fd_handler(s->fd, net_socket_send_dgram, NULL, s);
/* mcast: save bound address as dst */
@@ -1173,7 +1173,7 @@
qemu_set_fd_handler(s->fd, net_socket_send, NULL, s);
}
-static NetSocketState *net_socket_fd_init_stream(VLANState *vlan, int fd,
+static NetSocketState *net_socket_fd_init_stream(VNETState *vnet, int fd,
int is_connected)
{
NetSocketState *s;
@@ -1181,7 +1181,7 @@
if (!s)
return NULL;
s->fd = fd;
- s->vc = qemu_new_vlan_client(vlan,
+ s->vc = qemu_new_vnet_client(vnet,
net_socket_receive, NULL, s);
snprintf(s->vc->info_str, sizeof(s->vc->info_str),
"socket: fd=%d", fd);
@@ -1193,7 +1193,7 @@
return s;
}
-static NetSocketState *net_socket_fd_init(VLANState *vlan, int fd,
+static NetSocketState *net_socket_fd_init(VNETState *vnet, int fd,
int is_connected)
{
int so_type=-1, optlen=sizeof(so_type);
@@ -1205,13 +1205,13 @@
}
switch(so_type) {
case SOCK_DGRAM:
- return net_socket_fd_init_dgram(vlan, fd, is_connected);
+ return net_socket_fd_init_dgram(vnet, fd, is_connected);
case SOCK_STREAM:
- return net_socket_fd_init_stream(vlan, fd, is_connected);
+ return net_socket_fd_init_stream(vnet, fd, is_connected);
default:
/* who knows ... this could be a eg. a pty, do warn and continue as stream */
fprintf(stderr, "qemu: warning: socket type=%d for fd=%d is not SOCK_DGRAM or SOCK_STREAM\n", so_type, fd);
- return net_socket_fd_init_stream(vlan, fd, is_connected);
+ return net_socket_fd_init_stream(vnet, fd, is_connected);
}
return NULL;
}
@@ -1233,7 +1233,7 @@
break;
}
}
- s1 = net_socket_fd_init(s->vlan, fd, 1);
+ s1 = net_socket_fd_init(s->vnet, fd, 1);
if (!s1) {
closesocket(fd);
} else {
@@ -1243,7 +1243,7 @@
}
}
-static int net_socket_listen_init(VLANState *vlan, const char *host_str)
+static int net_socket_listen_init(VNETState *vnet, const char *host_str)
{
NetSocketListenState *s;
int fd, val, ret;
@@ -1277,13 +1277,13 @@
perror("listen");
return -1;
}
- s->vlan = vlan;
+ s->vnet = vnet;
s->fd = fd;
qemu_set_fd_handler(fd, net_socket_accept, NULL, s);
return 0;
}
-static int net_socket_connect_init(VLANState *vlan, const char *host_str)
+static int net_socket_connect_init(VNETState *vnet, const char *host_str)
{
NetSocketState *s;
int fd, connected, ret, err;
@@ -1321,7 +1321,7 @@
break;
}
}
- s = net_socket_fd_init(vlan, fd, connected);
+ s = net_socket_fd_init(vnet, fd, connected);
if (!s)
return -1;
snprintf(s->vc->info_str, sizeof(s->vc->info_str),
@@ -1330,7 +1330,7 @@
return 0;
}
-static int net_socket_mcast_init(VLANState *vlan, const char *host_str)
+static int net_socket_mcast_init(VNETState *vnet, const char *host_str)
{
NetSocketState *s;
int fd;
@@ -1344,7 +1344,7 @@
if (fd < 0)
return -1;
- s = net_socket_fd_init(vlan, fd, 0);
+ s = net_socket_fd_init(vnet, fd, 0);
if (!s)
return -1;
@@ -1357,39 +1357,48 @@
}
-/* find or alloc a new VLAN */
-VLANState *qemu_find_vlan(int id)
+/* find or alloc a new VNET */
+VNETState *qemu_find_vnet(int id)
{
- VLANState **pvlan, *vlan;
- for(vlan = first_vlan; vlan != NULL; vlan = vlan->next) {
- if (vlan->id == id)
- return vlan;
+ VNETState **pvnet, *vnet;
+ for(vnet = first_vnet; vnet != NULL; vnet = vnet->next) {
+ if (vnet->id == id)
+ return vnet;
}
- vlan = qemu_mallocz(sizeof(VLANState));
- if (!vlan)
+ vnet = qemu_mallocz(sizeof(VNETState));
+ if (!vnet)
return NULL;
- vlan->id = id;
- vlan->next = NULL;
- pvlan = &first_vlan;
- while (*pvlan != NULL)
- pvlan = &(*pvlan)->next;
- *pvlan = vlan;
- return vlan;
+ vnet->id = id;
+ vnet->next = NULL;
+ pvnet = &first_vnet;
+ while (*pvnet != NULL)
+ pvnet = &(*pvnet)->next;
+ *pvnet = vnet;
+ return vnet;
}
int net_client_init(const char *device, const char *p)
{
char buf[1024];
- int vlan_id, ret;
- VLANState *vlan;
+ int vnet_id, ret;
+ VNETState *vnet;
- vlan_id = 0;
- if (get_param_value(buf, sizeof(buf), "vlan", p)) {
- vlan_id = strtol(buf, NULL, 0);
+ vnet_id = 0;
+ if (get_param_value(buf, sizeof(buf), "vnet", p)) {
+ vnet_id = strtol(buf, NULL, 0);
}
- vlan = qemu_find_vlan(vlan_id);
- if (!vlan) {
- fprintf(stderr, "Could not create vlan %d\n", vlan_id);
+ /* support for deprecated keyword "vlan" */
+ if (get_param_value(buf, sizeof(buf), "vlan", p)) {
+ fprintf(stderr,
+ "Use of keyword 'vlan' is deprecated and will be removed.");
+ fprintf(stderr,
+ " Use the keyword 'vnet' instead\n");
+ vnet_id = strtol(buf, NULL, 0);
+ }
+ /* end support section for deprecated keyword "vlan" */
+ vnet = qemu_find_vnet(vnet_id);
+ if (!vnet) {
+ fprintf(stderr, "Could not create vnet %d\n", vnet_id);
return -1;
}
if (!strcmp(device, "nic")) {
@@ -1418,9 +1427,9 @@
if (get_param_value(buf, sizeof(buf), "model", p)) {
nd->model = strdup(buf);
}
- nd->vlan = vlan;
+ nd->vnet = vnet;
nb_nics++;
- vlan->nb_guest_devs++;
+ vnet->nb_guest_devs++;
ret = 0;
} else
if (!strcmp(device, "none")) {
@@ -1433,8 +1442,8 @@
if (get_param_value(buf, sizeof(buf), "hostname", p)) {
pstrcpy(slirp_hostname, sizeof(slirp_hostname), buf);
}
- vlan->nb_host_devs++;
- ret = net_slirp_init(vlan);
+ vnet->nb_host_devs++;
+ ret = net_slirp_init(vnet);
} else
#endif
#ifdef _WIN32
@@ -1444,8 +1453,8 @@
fprintf(stderr, "tap: no interface name\n");
return -1;
}
- vlan->nb_host_devs++;
- ret = tap_win32_init(vlan, ifname);
+ vnet->nb_host_devs++;
+ ret = tap_win32_init(vnet, ifname);
} else
#elif defined (_AIX)
#else
@@ -1453,12 +1462,12 @@
char ifname[64];
char setup_script[1024], down_script[1024];
int fd;
- vlan->nb_host_devs++;
+ vnet->nb_host_devs++;
if (get_param_value(buf, sizeof(buf), "fd", p) > 0) {
fd = strtol(buf, NULL, 0);
fcntl(fd, F_SETFL, O_NONBLOCK);
ret = -1;
- if (net_tap_fd_init(vlan, fd))
+ if (net_tap_fd_init(vnet, fd))
ret = 0;
} else {
if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) {
@@ -1470,7 +1479,7 @@
if (get_param_value(down_script, sizeof(down_script), "downscript", p) == 0) {
pstrcpy(down_script, sizeof(down_script), DEFAULT_NETWORK_DOWN_SCRIPT);
}
- ret = net_tap_init(vlan, ifname, setup_script, down_script);
+ ret = net_tap_init(vnet, ifname, setup_script, down_script);
}
} else
#endif
@@ -1479,25 +1488,25 @@
int fd;
fd = strtol(buf, NULL, 0);
ret = -1;
- if (net_socket_fd_init(vlan, fd, 1))
+ if (net_socket_fd_init(vnet, fd, 1))
ret = 0;
} else if (get_param_value(buf, sizeof(buf), "listen", p) > 0) {
- ret = net_socket_listen_init(vlan, buf);
+ ret = net_socket_listen_init(vnet, buf);
} else if (get_param_value(buf, sizeof(buf), "connect", p) > 0) {
- ret = net_socket_connect_init(vlan, buf);
+ ret = net_socket_connect_init(vnet, buf);
} else if (get_param_value(buf, sizeof(buf), "mcast", p) > 0) {
- ret = net_socket_mcast_init(vlan, buf);
+ ret = net_socket_mcast_init(vnet, buf);
} else {
fprintf(stderr, "Unknown socket options: %s\n", p);
return -1;
}
- vlan->nb_host_devs++;
+ vnet->nb_host_devs++;
} else
#ifdef CONFIG_VDE
if (!strcmp(device, "vde")) {
char vde_sock[1024], vde_group[512];
int vde_port, vde_mode;
- vlan->nb_host_devs++;
+ vnet->nb_host_devs++;
if (get_param_value(vde_sock, sizeof(vde_sock), "sock", p) <= 0) {
vde_sock[0] = '\0';
}
@@ -1514,7 +1523,7 @@
} else {
vde_mode = 0700;
}
- ret = net_vde_init(vlan, vde_sock, vde_port, vde_group, vde_mode);
+ ret = net_vde_init(vnet, vde_sock, vde_port, vde_group, vde_mode);
} else
#endif
{
@@ -1550,26 +1559,26 @@
void do_info_network(void)
{
- VLANState *vlan;
- VLANClientState *vc;
+ VNETState *vnet;
+ VNETClientState *vc;
- for(vlan = first_vlan; vlan != NULL; vlan = vlan->next) {
- term_printf("VLAN %d devices:\n", vlan->id);
- for(vc = vlan->first_client; vc != NULL; vc = vc->next)
+ for(vnet = first_vnet; vnet != NULL; vnet = vnet->next) {
+ term_printf("VNET %d devices:\n", vnet->id);
+ for(vc = vnet->first_client; vc != NULL; vc = vc->next)
term_printf(" %s\n", vc->info_str);
}
}
void net_cleanup(void)
{
- VLANState *vlan;
+ VNETState *vnet;
#if !defined(_WIN32)
/* close network clients */
- for(vlan = first_vlan; vlan != NULL; vlan = vlan->next) {
- VLANClientState *vc;
+ for(vnet = first_vnet; vnet != NULL; vnet = vnet->next) {
+ VNETClientState *vc;
- for(vc = vlan->first_client; vc != NULL; vc = vc->next) {
+ for(vc = vnet->first_client; vc != NULL; vc = vc->next) {
if (vc->fd_read == tap_receive) {
char ifname[64];
TAPState *s = vc->opaque;
@@ -1591,16 +1600,16 @@
void net_client_check(void)
{
- VLANState *vlan;
+ VNETState *vnet;
- for(vlan = first_vlan; vlan != NULL; vlan = vlan->next) {
- if (vlan->nb_guest_devs == 0 && vlan->nb_host_devs == 0)
+ for(vnet = first_vnet; vnet != NULL; vnet = vnet->next) {
+ if (vnet->nb_guest_devs == 0 && vnet->nb_host_devs == 0)
continue;
- if (vlan->nb_guest_devs == 0)
- fprintf(stderr, "Warning: vlan %d with no nics\n", vlan->id);
- if (vlan->nb_host_devs == 0)
+ if (vnet->nb_guest_devs == 0)
+ fprintf(stderr, "Warning: vnet %d with no nics\n", vnet->id);
+ if (vnet->nb_host_devs == 0)
fprintf(stderr,
- "Warning: vlan %d is not connected to host network\n",
- vlan->id);
+ "Warning: vnet %d is not connected to host network\n",
+ vnet->id);
}
}
diff -Naur trunk/net.h local/net.h
--- trunk/net.h 2008-12-09 13:23:15.000000000 +0100
+++ local/net.h 2008-12-09 13:34:06.000000000 +0100
@@ -1,36 +1,36 @@
#ifndef QEMU_NET_H
#define QEMU_NET_H
-/* VLANs support */
+/* VNETs support */
-typedef struct VLANClientState VLANClientState;
+typedef struct VNETClientState VNETClientState;
-struct VLANClientState {
+struct VNETClientState {
IOReadHandler *fd_read;
/* Packets may still be sent if this returns zero. It's used to
rate-limit the slirp code. */
IOCanRWHandler *fd_can_read;
void *opaque;
- struct VLANClientState *next;
- struct VLANState *vlan;
+ struct VNETClientState *next;
+ struct VNETState *vnet;
char info_str[256];
};
-struct VLANState {
+struct VNETState {
int id;
- VLANClientState *first_client;
- struct VLANState *next;
+ VNETClientState *first_client;
+ struct VNETState *next;
unsigned int nb_guest_devs, nb_host_devs;
};
-VLANState *qemu_find_vlan(int id);
-VLANClientState *qemu_new_vlan_client(VLANState *vlan,
+VNETState *qemu_find_vnet(int id);
+VNETClientState *qemu_new_vnet_client(VNETState *vnet,
IOReadHandler *fd_read,
IOCanRWHandler *fd_can_read,
void *opaque);
-void qemu_del_vlan_client(VLANClientState *vc);
-int qemu_can_send_packet(VLANClientState *vc);
-void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size);
+void qemu_del_vnet_client(VNETClientState *vc);
+int qemu_can_send_packet(VNETClientState *vc);
+void qemu_send_packet(VNETClientState *vc, const uint8_t *buf, int size);
void qemu_handler_true(void *opaque);
void do_info_network(void);
@@ -42,7 +42,7 @@
struct NICInfo {
uint8_t macaddr[6];
const char *model;
- VLANState *vlan;
+ VNETState *vnet;
};
extern int nb_nics;
diff -Naur trunk/qemu-common.h local/qemu-common.h
--- trunk/qemu-common.h 2008-12-09 13:23:15.000000000 +0100
+++ local/qemu-common.h 2008-12-09 13:34:06.000000000 +0100
@@ -160,7 +160,7 @@
typedef struct TextConsole TextConsole;
typedef TextConsole QEMUConsole;
typedef struct CharDriverState CharDriverState;
-typedef struct VLANState VLANState;
+typedef struct VNETState VNETState;
typedef struct QEMUFile QEMUFile;
typedef struct i2c_bus i2c_bus;
typedef struct i2c_slave i2c_slave;
diff -Naur trunk/qemu-doc.texi local/qemu-doc.texi
--- trunk/qemu-doc.texi 2008-12-09 13:23:15.000000000 +0100
+++ local/qemu-doc.texi 2008-12-09 13:38:00.000000000 +0100
@@ -604,8 +604,8 @@
@table @option
-@item -net nic[,vlan=@var{n}][,macaddr=@var{addr}][,model=@var{type}]
-Create a new Network Interface Card and connect it to VLAN @var{n} (@var{n}
+@item -net nic[,vnet=@var{n}][,macaddr=@var{addr}][,model=@var{type}]
+Create a new Network Interface Card and connect it to VNET @var{n} (@var{n}
= 0 is the default). The NIC is an ne2k_pci by default on the PC
target. Optionally, the MAC address can be changed. If no
@option{-net} option is specified, a single NIC is created.
@@ -617,13 +617,13 @@
Not all devices are supported on all targets. Use -net nic,model=?
for a list of available devices for your target.
-@item -net user[,vlan=@var{n}][,hostname=@var{name}]
+@item -net user[,vnet=@var{n}][,hostname=@var{name}]
Use the user mode network stack which requires no administrator
privilege to run. @option{hostname=name} can be used to specify the client
hostname reported by the builtin DHCP server.
-@item -net tap[,vlan=@var{n}][,fd=@var{h}][,ifname=@var{name}][,script=@var{file}][,downscript=@var{dfile}]
-Connect the host TAP network interface @var{name} to VLAN @var{n}, use
+@item -net tap[,vnet=@var{n}][,fd=@var{h}][,ifname=@var{name}][,script=@var{file}][,downscript=@var{dfile}]
+Connect the host TAP network interface @var{name} to VNET @var{n}, use
the network script @var{file} to configure it and the network script
@var{dfile} to deconfigure it. If @var{name} is not provided, the OS
automatically provides one. @option{fd}=@var{h} can be used to specify
@@ -638,14 +638,14 @@
More complicated example (two NICs, each one connected to a TAP device)
@example
-qemu linux.img -net nic,vlan=0 -net tap,vlan=0,ifname=tap0 \
- -net nic,vlan=1 -net tap,vlan=1,ifname=tap1
+qemu linux.img -net nic,vnet=0 -net tap,vnet=0,ifname=tap0 \
+ -net nic,vnet=1 -net tap,vnet=1,ifname=tap1
@end example
-@item -net socket[,vlan=@var{n}][,fd=@var{h}][,listen=[@var{host}]:@var{port}][,connect=@var{host}:@var{port}]
+@item -net socket[,vnet=@var{n}][,fd=@var{h}][,listen=[@var{host}]:@var{port}][,connect=@var{host}:@var{port}]
-Connect the VLAN @var{n} to a remote VLAN in another QEMU virtual
+Connect the VNET @var{n} to a remote VNET in another QEMU virtual
machine using a TCP socket connection. If @option{listen} is
specified, QEMU waits for incoming connections on @var{port}
(@var{host} is optional). @option{connect} is used to connect to
@@ -657,15 +657,15 @@
# launch a first QEMU instance
qemu linux.img -net nic,macaddr=52:54:00:12:34:56 \
-net socket,listen=:1234
-# connect the VLAN 0 of this instance to the VLAN 0
+# connect the VNET 0 of this instance to the VNET 0
# of the first instance
qemu linux.img -net nic,macaddr=52:54:00:12:34:57 \
-net socket,connect=127.0.0.1:1234
@end example
-@item -net socket[,vlan=@var{n}][,fd=@var{h}][,mcast=@var{maddr}:@var{port}]
+@item -net socket[,vnet=@var{n}][,fd=@var{h}][,mcast=@var{maddr}:@var{port}]
-Create a VLAN @var{n} shared with another QEMU virtual
+Create a VNET @var{n} shared with another QEMU virtual
machines using a UDP multicast socket, effectively making a bus for
every QEMU with same multicast address @var{maddr} and @var{port}.
NOTES:
@@ -703,8 +703,8 @@
/path/to/linux ubd0=/path/to/root_fs eth0=mcast
@end example
-@item -net vde[,vlan=@var{n}][,sock=@var{socketpath}][,port=@var{n}][,group=@var{groupname}][,mode=@var{octalmode}]
-Connect VLAN @var{n} to PORT @var{n} of a vde switch running on host and
+@item -net vde[,vnet=@var{n}][,sock=@var{socketpath}][,port=@var{n}][,group=@var{groupname}][,mode=@var{octalmode}]
+Connect VNET @var{n} to PORT @var{n} of a vde switch running on host and
listening for incoming connections on @var{socketpath}. Use GROUP @var{groupname}
and MODE @var{octalmode} to change default ownership and permissions for
communication port. This option is available only if QEMU has been compiled
@@ -816,14 +816,14 @@
@code{hci0}) on the computer running QEMU. Only available on @code{bluez}
capable systems like Linux.
-@item -bt hci[,vlan=@var{n}]
+@item -bt hci[,vnet=@var{n}]
Add a virtual, standard HCI that will participate in the Bluetooth
scatternet @var{n} (default @code{0}). Similarly to @option{-net}
-VLANs, devices inside a bluetooth network @var{n} can only communicate
+VNETs, devices inside a bluetooth network @var{n} can only communicate
with other devices in the same network (scatternet).
@end table
-@item -bt vhci[,vlan=@var{n}]
+@item -bt vhci[,vnet=@var{n}]
(Linux-host only) Create a HCI in scatternet @var{n} (default 0) attached
to the host bluetooth stack instead of to the emulated target. This
allows the host and target machines to participate in a common scatternet
@@ -831,10 +831,10 @@
be used as following:
@example
-qemu [...OPTIONS...] -bt hci,vlan=5 -bt vhci,vlan=5
+qemu [...OPTIONS...] -bt hci,vnet=5 -bt vhci,vnet=5
@end example
-@item -bt device:@var{dev}[,vlan=@var{n}]
+@item -bt device:@var{dev}[,vnet=@var{n}]
Emulate a bluetooth device @var{dev} and place it in network @var{n}
(default @code{0}). QEMU can only emulate one type of bluetooth devices
currently:
@@ -1194,7 +1194,7 @@
@table @option
@item info network
-show the various VLANs and the associated devices
+show the various VNETs and the associated devices
@item info block
show the block devices
@item info registers
@@ -1658,16 +1658,16 @@
@section Network emulation
QEMU can simulate several network cards (PCI or ISA cards on the PC
-target) and can connect them to an arbitrary number of Virtual Local
-Area Networks (VLANs). Host TAP devices can be connected to any QEMU
-VLAN. VLAN can be connected between separate instances of QEMU to
+target) and can connect them to an arbitrary number of Virtual
+Networks (VNETs). Host TAP devices can be connected to any QEMU
+VNET. VNET can be connected between separate instances of QEMU to
simulate large networks. For simpler usage, a non privileged user mode
network stack can replace the TAP device to have a basic network
connection.
-@subsection VLANs
+@subsection VNETs
-QEMU simulates several VLANs. A VLAN can be symbolised as a virtual
+QEMU simulates several VNETs. A VNET can be symbolised as a virtual
connection between several network devices. These devices can be for
example QEMU virtual Ethernet cards or virtual Host ethernet devices
(TAP devices).
@@ -1706,7 +1706,7 @@
@example
- QEMU VLAN <------> Firewall/DHCP server <-----> Internet
+ QEMU VNET <------> Firewall/DHCP server <-----> Internet
| (10.0.2.2)
|
----> DNS server (10.0.2.3)
@@ -1734,9 +1734,9 @@
redirected from the host to the guest. It allows for example to
redirect X11, telnet or SSH connections.
-@subsection Connecting VLANs between QEMU instances
+@subsection Connecting VNETs between QEMU instances
-Using the @option{-net socket} option, it is possible to make VLANs
+Using the @option{-net socket} option, it is possible to make VNETs
that span several QEMU instances. See @ref{sec_invocation} to have a
basic example.
@@ -1828,17 +1828,17 @@
specifies NIC options as with @code{-net nic,}@var{options} (see description).
For instance, user-mode networking can be used with
@example
-qemu [...OPTIONS...] -net user,vlan=0 -usbdevice net:vlan=0
+qemu [...OPTIONS...] -net user,vnet=0 -usbdevice net:vnet=0
@end example
Currently this cannot be used in machines that support PCI NICs.
@item bt[:@var{hci-type}]
Bluetooth dongle whose type is specified in the same format as with
the @option{-bt hci} option, @pxref{bt-hcis,,allowed HCI types}. If
-no type is given, the HCI logic corresponds to @code{-bt hci,vlan=0}.
+no type is given, the HCI logic corresponds to @code{-bt hci,vnet=0}.
This USB device implements the USB Transport Layer of HCI. Example
usage:
@example
-qemu [...OPTIONS...] -usbdevice bt:hci,vlan=3 -bt device:keyboard,vlan=3
+qemu [...OPTIONS...] -usbdevice bt:hci,vnet=3 -bt device:keyboard,vnet=3
@end example
@end table
diff -Naur trunk/savevm.c local/savevm.c
--- trunk/savevm.c 2008-12-09 13:23:15.000000000 +0100
+++ local/savevm.c 2008-12-09 13:33:59.000000000 +0100
@@ -114,14 +114,14 @@
void qemu_announce_self(void)
{
int i, j, len;
- VLANState *vlan;
- VLANClientState *vc;
+ VNETState *vnet;
+ VNETClientState *vc;
uint8_t buf[256];
for (i = 0; i < nb_nics; i++) {
len = announce_self_create(buf, nd_table[i].macaddr);
- vlan = nd_table[i].vlan;
- for(vc = vlan->first_client; vc != NULL; vc = vc->next) {
+ vnet = nd_table[i].vnet;
+ for(vc = vnet->first_client; vc != NULL; vc = vc->next) {
for (j=0; j < SELF_ANNOUNCE_ROUNDS; j++)
vc->fd_read(vc->opaque, buf, len);
}
diff -Naur trunk/sysemu.h local/sysemu.h
--- trunk/sysemu.h 2008-12-09 13:23:15.000000000 +0100
+++ local/sysemu.h 2008-12-09 13:32:19.000000000 +0100
@@ -75,7 +75,7 @@
#endif
/* TAP win32 */
-int tap_win32_init(VLANState *vlan, const char *ifname);
+int tap_win32_init(VNETState *vnet, const char *ifname);
/* SLIRP */
void do_info_slirp(void);
diff -Naur trunk/tap-win32.c local/tap-win32.c
--- trunk/tap-win32.c 2008-12-09 13:23:15.000000000 +0100
+++ local/tap-win32.c 2008-12-09 13:33:59.000000000 +0100
@@ -635,7 +635,7 @@
/********************************************/
typedef struct TAPState {
- VLANClientState *vc;
+ VNETClientState *vc;
tap_win32_overlapped_t *handle;
} TAPState;
@@ -660,7 +660,7 @@
}
}
-int tap_win32_init(VLANState *vlan, const char *ifname)
+int tap_win32_init(VNETState *vnet, const char *ifname)
{
TAPState *s;
@@ -672,7 +672,7 @@
return -1;
}
- s->vc = qemu_new_vlan_client(vlan, tap_receive, NULL, s);
+ s->vc = qemu_new_vnet_client(vnet, tap_receive, NULL, s);
snprintf(s->vc->info_str, sizeof(s->vc->info_str),
"tap: ifname=%s", ifname);
diff -Naur trunk/vl.c local/vl.c
--- trunk/vl.c 2008-12-09 13:23:15.000000000 +0100
+++ local/vl.c 2008-12-09 13:33:59.000000000 +0100
@@ -1956,27 +1956,27 @@
static int cur_hci;
static struct HCIInfo *hci_table[MAX_NICS];
-static struct bt_vlan_s {
+static struct bt_vnet_s {
struct bt_scatternet_s net;
int id;
- struct bt_vlan_s *next;
-} *first_bt_vlan;
+ struct bt_vnet_s *next;
+} *first_bt_vnet;
-/* find or alloc a new bluetooth "VLAN" */
-static struct bt_scatternet_s *qemu_find_bt_vlan(int id)
+/* find or alloc a new bluetooth "VNET" */
+static struct bt_scatternet_s *qemu_find_bt_vnet(int id)
{
- struct bt_vlan_s **pvlan, *vlan;
- for (vlan = first_bt_vlan; vlan != NULL; vlan = vlan->next) {
- if (vlan->id == id)
- return &vlan->net;
- }
- vlan = qemu_mallocz(sizeof(struct bt_vlan_s));
- vlan->id = id;
- pvlan = &first_bt_vlan;
- while (*pvlan != NULL)
- pvlan = &(*pvlan)->next;
- *pvlan = vlan;
- return &vlan->net;
+ struct bt_vnet_s **pvnet, *vnet;
+ for (vnet = first_bt_vnet; vnet != NULL; vnet = vnet->next) {
+ if (vnet->id == id)
+ return &vnet->net;
+ }
+ vnet = qemu_mallocz(sizeof(struct bt_vnet_s));
+ vnet->id = id;
+ pvnet = &first_bt_vnet;
+ while (*pvnet != NULL)
+ pvnet = &(*pvnet)->next;
+ *pvnet = vnet;
+ return &vnet->net;
}
static void null_hci_send(struct HCIInfo *hci, const uint8_t *data, int len)
@@ -2006,7 +2006,7 @@
static struct HCIInfo *hci_init(const char *str)
{
char *endp;
- struct bt_scatternet_s *vlan = 0;
+ struct bt_scatternet_s *vnet = 0;
if (!strcmp(str, "null"))
/* null */
@@ -2015,17 +2015,17 @@
/* host[:hciN] */
return bt_host_hci(str[4] ? str + 5 : "hci0");
else if (!strncmp(str, "hci", 3)) {
- /* hci[,vlan=n] */
+ /* hci[,vnet=n] */
if (str[3]) {
- if (!strncmp(str + 3, ",vlan=", 6)) {
- vlan = qemu_find_bt_vlan(strtol(str + 9, &endp, 0));
+ if (!strncmp(str + 3, ",vnet=", 6)) {
+ vnet = qemu_find_bt_vnet(strtol(str + 9, &endp, 0));
if (*endp)
- vlan = 0;
+ vnet = 0;
}
} else
- vlan = qemu_find_bt_vlan(0);
- if (vlan)
- return bt_new_hci(vlan);
+ vnet = qemu_find_bt_vnet(0);
+ if (vnet)
+ return bt_new_hci(vnet);
}
fprintf(stderr, "qemu: Unknown bluetooth HCI `%s'.\n", str);
@@ -2060,43 +2060,43 @@
return 0;
}
-static void bt_vhci_add(int vlan_id)
+static void bt_vhci_add(int vnet_id)
{
- struct bt_scatternet_s *vlan = qemu_find_bt_vlan(vlan_id);
+ struct bt_scatternet_s *vnet = qemu_find_bt_vnet(vnet_id);
- if (!vlan->slave)
+ if (!vnet->slave)
fprintf(stderr, "qemu: warning: adding a VHCI to "
- "an empty scatternet %i\n", vlan_id);
+ "an empty scatternet %i\n", vnet_id);
- bt_vhci_init(bt_new_hci(vlan));
+ bt_vhci_init(bt_new_hci(vnet));
}
static struct bt_device_s *bt_device_add(const char *opt)
{
- struct bt_scatternet_s *vlan;
- int vlan_id = 0;
- char *endp = strstr(opt, ",vlan=");
+ struct bt_scatternet_s *vnet;
+ int vnet_id = 0;
+ char *endp = strstr(opt, ",vnet=");
int len = (endp ? endp - opt : strlen(opt)) + 1;
char devname[10];
pstrcpy(devname, MIN(sizeof(devname), len), opt);
if (endp) {
- vlan_id = strtol(endp + 6, &endp, 0);
+ vnet_id = strtol(endp + 6, &endp, 0);
if (*endp) {
- fprintf(stderr, "qemu: unrecognised bluetooth vlan Id\n");
+ fprintf(stderr, "qemu: unrecognised bluetooth vnet Id\n");
return 0;
}
}
- vlan = qemu_find_bt_vlan(vlan_id);
+ vnet = qemu_find_bt_vnet(vnet_id);
- if (!vlan->slave)
+ if (!vnet->slave)
fprintf(stderr, "qemu: warning: adding a slave device to "
- "an empty scatternet %i\n", vlan_id);
+ "an empty scatternet %i\n", vnet_id);
if (!strcmp(devname, "keyboard"))
- return bt_keyboard_init(vlan);
+ return bt_keyboard_init(vnet);
fprintf(stderr, "qemu: unsupported bluetooth device `%s'\n", devname);
return 0;
@@ -2105,12 +2105,12 @@
static int bt_parse(const char *opt)
{
const char *endp, *p;
- int vlan;
+ int vnet;
if (strstart(opt, "hci", &endp)) {
if (!*endp || *endp == ',') {
if (*endp)
- if (!strstart(endp, ",vlan=", 0))
+ if (!strstart(endp, ",vnet=", 0))
opt = endp + 1;
return bt_hci_parse(opt);
@@ -2118,8 +2118,8 @@
} else if (strstart(opt, "vhci", &endp)) {
if (!*endp || *endp == ',') {
if (*endp) {
- if (strstart(endp, ",vlan=", &p)) {
- vlan = strtol(p, (char **) &endp, 0);
+ if (strstart(endp, ",vnet=", &p)) {
+ vnet = strtol(p, (char **) &endp, 0);
if (*endp) {
fprintf(stderr, "qemu: bad scatternet '%s'\n", p);
return 1;
@@ -2129,9 +2129,9 @@
return 1;
}
} else
- vlan = 0;
+ vnet = 0;
- bt_vhci_add(vlan);
+ bt_vhci_add(vnet);
return 0;
}
} else if (strstart(opt, "device:", &endp))
@@ -2605,7 +2605,7 @@
dev = usb_net_init(&nd_table[nic]);
} else if (!strcmp(devname, "bt") || strstart(devname, "bt:", &p)) {
dev = usb_bt_init(devname[2] ? hci_init(p) :
- bt_new_hci(qemu_find_bt_vlan(0)));
+ bt_new_hci(qemu_find_bt_vnet(0)));
} else {
return -1;
}
@@ -3877,31 +3877,31 @@
"-uuid %%08x-%%04x-%%04x-%%04x-%%012x specify machine UUID\n"
"\n"
"Network options:\n"
- "-net nic[,vlan=n][,macaddr=addr][,model=type]\n"
- " create a new Network Interface Card and connect it to VLAN 'n'\n"
+ "-net nic[,vnet=n][,macaddr=addr][,model=type]\n"
+ " create a new Network Interface Card and connect it to VNET 'n'\n"
#ifdef CONFIG_SLIRP
- "-net user[,vlan=n][,hostname=host]\n"
- " connect the user mode network stack to VLAN 'n' and send\n"
+ "-net user[,vnet=n][,hostname=host]\n"
+ " connect the user mode network stack to VNET 'n' and send\n"
" hostname 'host' to DHCP clients\n"
#endif
#ifdef _WIN32
- "-net tap[,vlan=n],ifname=name\n"
- " connect the host TAP network interface to VLAN 'n'\n"
+ "-net tap[,vnet=n],ifname=name\n"
+ " connect the host TAP network interface to VNET 'n'\n"
#else
- "-net tap[,vlan=n][,fd=h][,ifname=name][,script=file][,downscript=dfile]\n"
- " connect the host TAP network interface to VLAN 'n' and use the\n"
+ "-net tap[,vnet=n][,fd=h][,ifname=name][,script=file][,downscript=dfile]\n"
+ " connect the host TAP network interface to VNET 'n' and use the\n"
" network scripts 'file' (default=%s)\n"
" and 'dfile' (default=%s);\n"
" use '[down]script=no' to disable script execution;\n"
" use 'fd=h' to connect to an already opened TAP interface\n"
#endif
- "-net socket[,vlan=n][,fd=h][,listen=[host]:port][,connect=host:port]\n"
- " connect the vlan 'n' to another VLAN using a socket connection\n"
- "-net socket[,vlan=n][,fd=h][,mcast=maddr:port]\n"
- " connect the vlan 'n' to multicast maddr and port\n"
+ "-net socket[,vnet=n][,fd=h][,listen=[host]:port][,connect=host:port]\n"
+ " connect the vnet 'n' to another VNET using a socket connection\n"
+ "-net socket[,vnet=n][,fd=h][,mcast=maddr:port]\n"
+ " connect the vnet 'n' to multicast maddr and port\n"
#ifdef CONFIG_VDE
- "-net vde[,vlan=n][,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]\n"
- " connect the vlan 'n' to port 'n' of a vde switch running\n"
+ "-net vde[,vnet=n][,sock=socketpath][,port=n][,group=groupname][,mode=octalmode]\n"
+ " connect the vnet 'n' to port 'n' of a vde switch running\n"
" on host and listening for incoming connections on 'socketpath'.\n"
" Use group 'groupname' and mode 'octalmode' to change default\n"
" ownership and permissions for communication port.\n"
@@ -3912,11 +3912,11 @@
"-bt hci,null Dumb bluetooth HCI - doesn't respond to commands\n"
"-bt hci,host[:id]\n"
" Use host's HCI with the given name\n"
- "-bt hci[,vlan=n]\n"
+ "-bt hci[,vnet=n]\n"
" Emulate a standard HCI in virtual scatternet 'n'\n"
- "-bt vhci[,vlan=n]\n"
+ "-bt vhci[,vnet=n]\n"
" Add host computer to virtual scatternet 'n' using VHCI\n"
- "-bt device:dev[,vlan=n]\n"
+ "-bt device:dev[,vnet=n]\n"
" Emulate a bluetooth device 'dev' in scatternet 'n'\n"
"\n"
#ifdef CONFIG_SLIRP
next reply other threads:[~2008-12-09 15:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-12-09 15:01 Gildas [this message]
2008-12-09 15:29 ` [Qemu-devel] [PATCH] rename vlan to vnet and mark vlan as deprecated Anthony Liguori
2008-12-09 17:20 ` Kristoffer Ericson
2008-12-09 16:40 ` Anthony Liguori
2008-12-09 16:51 ` Daniel P. Berrange
2008-12-09 17:14 ` Paul Brook
2008-12-09 15:37 ` Daniel P. Berrange
2008-12-09 15:46 ` Anthony Liguori
2008-12-09 15:58 ` Gildas
2008-12-09 16:06 ` Anthony Liguori
2008-12-09 16:30 ` Gildas
2008-12-09 21:36 ` Luca Bigliardi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b2ace7f20812090701u51ed8472hb122213c607493fc@mail.gmail.com \
--to=gildas.ml@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).