]> git.proxmox.com Git - mirror_qemu.git/commitdiff
net: pass VLANClientState* as first arg to receive handlers
authorMark McLoughlin <markmc@redhat.com>
Mon, 18 May 2009 12:33:03 +0000 (13:33 +0100)
committerMark McLoughlin <markmc@redhat.com>
Tue, 9 Jun 2009 10:38:49 +0000 (11:38 +0100)
Give static type checking a chance to catch errors.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
19 files changed:
hw/dp8393x.c
hw/e1000.c
hw/eepro100.c
hw/etraxfs_eth.c
hw/mcf_fec.c
hw/mipsnet.c
hw/musicpal.c
hw/ne2000.c
hw/pcnet.c
hw/rtl8139.c
hw/smc91c111.c
hw/stellaris_enet.c
hw/usb-net.c
hw/virtio-net.c
hw/xen_nic.c
net.c
net.h
savevm.c
tap-win32.c

index 1b48d9684e070ea422a903c04625ecc1a8f405cf..de399837b9018f446c301bb673e98fdbe2d0cc3b 100644 (file)
@@ -407,9 +407,9 @@ static void do_transmit_packets(dp8393xState *s)
         if (s->regs[SONIC_RCR] & (SONIC_RCR_LB1 | SONIC_RCR_LB0)) {
             /* Loopback */
             s->regs[SONIC_TCR] |= SONIC_TCR_CRSL;
-            if (s->vc->fd_can_read(s)) {
+            if (s->vc->can_receive(s->vc)) {
                 s->loopback_packet = 1;
-                s->vc->receive(s, s->tx_buffer, tx_len);
+                s->vc->receive(s->vc, s->tx_buffer, tx_len);
             }
         } else {
             /* Transmit packet */
@@ -676,9 +676,9 @@ static CPUWriteMemoryFunc *dp8393x_write[3] = {
     dp8393x_writel,
 };
 
-static int nic_can_receive(void *opaque)
+static int nic_can_receive(VLANClientState *vc)
 {
-    dp8393xState *s = opaque;
+    dp8393xState *s = vc->opaque;
 
     if (!(s->regs[SONIC_CR] & SONIC_CR_RXEN))
         return 0;
@@ -725,10 +725,10 @@ static int receive_filter(dp8393xState *s, const uint8_t * buf, int size)
     return -1;
 }
 
-static void nic_receive(void *opaque, const uint8_t * buf, size_t size)
+static void nic_receive(VLANClientState *vc, const uint8_t * buf, size_t size)
 {
     uint16_t data[10];
-    dp8393xState *s = opaque;
+    dp8393xState *s = vc->opaque;
     int packet_type;
     uint32_t available, address;
     int width, rx_len = size;
index 20544d29436e46133461e29557d293e6de8b8cef..6d3eb313ecdb8fd2ddd85badbae2607a9faaa135 100644 (file)
@@ -592,17 +592,17 @@ e1000_set_link_status(VLANClientState *vc)
 }
 
 static int
-e1000_can_receive(void *opaque)
+e1000_can_receive(VLANClientState *vc)
 {
-    E1000State *s = opaque;
+    E1000State *s = vc->opaque;
 
     return (s->mac_reg[RCTL] & E1000_RCTL_EN);
 }
 
 static void
-e1000_receive(void *opaque, const uint8_t *buf, size_t size)
+e1000_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
 {
-    E1000State *s = opaque;
+    E1000State *s = vc->opaque;
     struct e1000_rx_desc desc;
     target_phys_addr_t base;
     unsigned int n, rdt;
index 39e8fccfbc196e4d0503edc23ccc2e1e3b35c90a..3300fbe9eaafa7d5cb2d6e45eb1d00d5aa51a9dd 100644 (file)
@@ -1433,21 +1433,21 @@ static void pci_mmio_map(PCIDevice * pci_dev, int region_num,
     }
 }
 
-static int nic_can_receive(void *opaque)
+static int nic_can_receive(VLANClientState *vc)
 {
-    EEPRO100State *s = opaque;
+    EEPRO100State *s = vc->opaque;
     logout("%p\n", s);
     return get_ru_state(s) == ru_ready;
     //~ return !eepro100_buffer_full(s);
 }
 
-static void nic_receive(void *opaque, const uint8_t * buf, size_t size)
+static void nic_receive(VLANClientState *vc, const uint8_t * buf, size_t size)
 {
     /* TODO:
      * - Magic packets should set bit 30 in power management driver register.
      * - Interesting packets should set bit 29 in power management driver register.
      */
-    EEPRO100State *s = opaque;
+    EEPRO100State *s = vc->opaque;
     uint16_t rfd_status = 0xa000;
     static const uint8_t broadcast_macaddr[6] =
         { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
index 2446f0dcb9e89fdb5c24efa24f556b7cef9b6d2c..78af76b9bb035efb0624582c34e1d7afbd4d8a11 100644 (file)
@@ -496,15 +496,15 @@ static int eth_match_groupaddr(struct fs_eth *eth, const unsigned char *sa)
        return match;
 }
 
-static int eth_can_receive(void *opaque)
+static int eth_can_receive(VLANClientState *vc)
 {
        return 1;
 }
 
-static void eth_receive(void *opaque, const uint8_t *buf, size_t size)
+static void eth_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
 {
        unsigned char sa_bcast[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-       struct fs_eth *eth = opaque;
+       struct fs_eth *eth = vc->opaque;
        int use_ma0 = eth->regs[RW_REC_CTRL] & 1;
        int use_ma1 = eth->regs[RW_REC_CTRL] & 2;
        int r_bcast = eth->regs[RW_REC_CTRL] & 8;
index 0b0f17ade65136058c2542b46cd10c2190de983b..d2534d05fbc6fe4b97336ba71612f1bb357458be 100644 (file)
@@ -347,15 +347,15 @@ static void mcf_fec_write(void *opaque, target_phys_addr_t addr, uint32_t value)
     mcf_fec_update(s);
 }
 
-static int mcf_fec_can_receive(void *opaque)
+static int mcf_fec_can_receive(VLANClientState *vc)
 {
-    mcf_fec_state *s = (mcf_fec_state *)opaque;
+    mcf_fec_state *s = vc->opaque;
     return s->rx_enabled;
 }
 
-static void mcf_fec_receive(void *opaque, const uint8_t *buf, size_t size)
+static void mcf_fec_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
 {
-    mcf_fec_state *s = (mcf_fec_state *)opaque;
+    mcf_fec_state *s = vc->opaque;
     mcf_fec_bd bd;
     uint32_t flags = 0;
     uint32_t addr;
index a22f49aabc4ba72c0ef9bc12a054555973b01852..e9128cbb34248452536203ca38d2cc20fdabee24 100644 (file)
@@ -66,23 +66,23 @@ static int mipsnet_buffer_full(MIPSnetState *s)
     return 0;
 }
 
-static int mipsnet_can_receive(void *opaque)
+static int mipsnet_can_receive(VLANClientState *vc)
 {
-    MIPSnetState *s = opaque;
+    MIPSnetState *s = vc->opaque;
 
     if (s->busy)
         return 0;
     return !mipsnet_buffer_full(s);
 }
 
-static void mipsnet_receive(void *opaque, const uint8_t *buf, size_t size)
+static void mipsnet_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
 {
-    MIPSnetState *s = opaque;
+    MIPSnetState *s = vc->opaque;
 
 #ifdef DEBUG_MIPSNET_RECEIVE
     printf("mipsnet: receiving len=%d\n", size);
 #endif
-    if (!mipsnet_can_receive(opaque))
+    if (!mipsnet_can_receive(vc))
         return;
 
     s->busy = 1;
index b7810ca7be322035e8bea2fe9f64575395b3f073..844edb8f37da817be399b6c0223cd4039b21c636 100644 (file)
@@ -557,14 +557,14 @@ static void eth_rx_desc_get(uint32_t addr, mv88w8618_rx_desc *desc)
     le32_to_cpus(&desc->next);
 }
 
-static int eth_can_receive(void *opaque)
+static int eth_can_receive(VLANClientState *vc)
 {
     return 1;
 }
 
-static void eth_receive(void *opaque, const uint8_t *buf, size_t size)
+static void eth_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
 {
-    mv88w8618_eth_state *s = opaque;
+    mv88w8618_eth_state *s = vc->opaque;
     uint32_t desc_addr;
     mv88w8618_rx_desc desc;
     int i;
index 502c8ae6645414b2eb94aedb6073723775966d59..c0fc34c4b2dc2deeac086eceffe1a2388415711c 100644 (file)
@@ -213,9 +213,9 @@ static int ne2000_buffer_full(NE2000State *s)
     return 0;
 }
 
-static int ne2000_can_receive(void *opaque)
+static int ne2000_can_receive(VLANClientState *vc)
 {
-    NE2000State *s = opaque;
+    NE2000State *s = vc->opaque;
 
     if (s->cmd & E8390_STOP)
         return 1;
@@ -224,9 +224,9 @@ static int ne2000_can_receive(void *opaque)
 
 #define MIN_BUF_SIZE 60
 
-static void ne2000_receive(void *opaque, const uint8_t *buf, size_t size)
+static void ne2000_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
 {
-    NE2000State *s = opaque;
+    NE2000State *s = vc->opaque;
     uint8_t *p;
     unsigned int total_len, next, avail, len, index, mcast_idx;
     uint8_t buf1[60];
index 4defc437b3c4cec7f0f7e5ab0d675d20c47edc4b..a8297df2afd4793e88a5b1aca3df7cfd08954b01 100644 (file)
@@ -1062,9 +1062,9 @@ static int pcnet_tdte_poll(PCNetState *s)
     return !!(CSR_CXST(s) & 0x8000);
 }
 
-static int pcnet_can_receive(void *opaque)
+static int pcnet_can_receive(VLANClientState *vc)
 {
-    PCNetState *s = opaque;
+    PCNetState *s = vc->opaque;
     if (CSR_STOP(s) || CSR_SPND(s))
         return 0;
 
@@ -1076,9 +1076,9 @@ static int pcnet_can_receive(void *opaque)
 
 #define MIN_BUF_SIZE 60
 
-static void pcnet_receive(void *opaque, const uint8_t *buf, size_t size)
+static void pcnet_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
 {
-    PCNetState *s = opaque;
+    PCNetState *s = vc->opaque;
     int is_padr = 0, is_bcast = 0, is_ladr = 0;
     uint8_t buf1[60];
     int remaining;
@@ -1302,7 +1302,7 @@ static void pcnet_transmit(PCNetState *s)
                 if (BCR_SWSTYLE(s) == 1)
                     add_crc = !GET_FIELD(tmd.status, TMDS, NOFCS);
                 s->looptest = add_crc ? PCNET_LOOPTEST_CRC : PCNET_LOOPTEST_NOCRC;
-                pcnet_receive(s, s->buffer, s->xmit_pos);
+                pcnet_receive(s->vc, s->buffer, s->xmit_pos);
                 s->looptest = 0;
             } else
                 if (s->vc)
index 14119d476e30a374ccd03b3e3909cfeef30d5bb1..8626d5e6b827719d30d59e409c6d77e7004923a6 100644 (file)
@@ -790,9 +790,9 @@ static inline target_phys_addr_t rtl8139_addr64(uint32_t low, uint32_t high)
 #endif
 }
 
-static int rtl8139_can_receive(void *opaque)
+static int rtl8139_can_receive(VLANClientState *vc)
 {
-    RTL8139State *s = opaque;
+    RTL8139State *s = vc->opaque;
     int avail;
 
     /* Receive (drop) packets if card is disabled.  */
@@ -812,9 +812,9 @@ static int rtl8139_can_receive(void *opaque)
     }
 }
 
-static void rtl8139_do_receive(void *opaque, const uint8_t *buf, int size, int do_interrupt)
+static void rtl8139_do_receive(VLANClientState *vc, const uint8_t *buf, int size, int do_interrupt)
 {
-    RTL8139State *s = opaque;
+    RTL8139State *s = vc->opaque;
 
     uint32_t packet_header = 0;
 
@@ -1158,9 +1158,9 @@ static void rtl8139_do_receive(void *opaque, const uint8_t *buf, int size, int d
     }
 }
 
-static void rtl8139_receive(void *opaque, const uint8_t *buf, size_t size)
+static void rtl8139_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
 {
-    rtl8139_do_receive(opaque, buf, size, 1);
+    rtl8139_do_receive(vc, buf, size, 1);
 }
 
 static void rtl8139_reset_rxring(RTL8139State *s, uint32_t bufferSize)
@@ -1757,7 +1757,7 @@ static void rtl8139_transfer_frame(RTL8139State *s, const uint8_t *buf, int size
     if (TxLoopBack == (s->TxConfig & TxLoopBack))
     {
         DEBUG_PRINT(("RTL8139: +++ transmit loopback mode\n"));
-        rtl8139_do_receive(s, buf, size, do_interrupt);
+        rtl8139_do_receive(s->vc, buf, size, do_interrupt);
     }
     else
     {
index 6d1fbb32c219d3d318421a70e2833565f87653ae..383f0b7daa106522ef75d4306da26136b46f7872 100644 (file)
@@ -591,9 +591,9 @@ static uint32_t smc91c111_readl(void *opaque, target_phys_addr_t offset)
     return val;
 }
 
-static int smc91c111_can_receive(void *opaque)
+static int smc91c111_can_receive(VLANClientState *vc)
 {
-    smc91c111_state *s = (smc91c111_state *)opaque;
+    smc91c111_state *s = vc->opaque;
 
     if ((s->rcr & RCR_RXEN) == 0 || (s->rcr & RCR_SOFT_RST))
         return 1;
@@ -602,9 +602,9 @@ static int smc91c111_can_receive(void *opaque)
     return 1;
 }
 
-static void smc91c111_receive(void *opaque, const uint8_t *buf, size_t size)
+static void smc91c111_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
 {
-    smc91c111_state *s = (smc91c111_state *)opaque;
+    smc91c111_state *s = vc->opaque;
     int status;
     int packetsize;
     uint32_t crc;
index 3ee9a8832cd6aab5f66c2550957fdbc4d58b8cee..7f308290da6f707f73f63922c71dd4ea1a9201cc 100644 (file)
@@ -78,9 +78,9 @@ static void stellaris_enet_update(stellaris_enet_state *s)
 }
 
 /* TODO: Implement MAC address filtering.  */
-static void stellaris_enet_receive(void *opaque, const uint8_t *buf, size_t size)
+static void stellaris_enet_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
 {
-    stellaris_enet_state *s = (stellaris_enet_state *)opaque;
+    stellaris_enet_state *s = vc->opaque;
     int n;
     uint8_t *p;
     uint32_t crc;
@@ -118,9 +118,9 @@ static void stellaris_enet_receive(void *opaque, const uint8_t *buf, size_t size
     stellaris_enet_update(s);
 }
 
-static int stellaris_enet_can_receive(void *opaque)
+static int stellaris_enet_can_receive(VLANClientState *vc)
 {
-    stellaris_enet_state *s = (stellaris_enet_state *)opaque;
+    stellaris_enet_state *s = vc->opaque;
 
     if ((s->rctl & SE_RCTL_RXEN) == 0)
         return 1;
@@ -128,9 +128,9 @@ static int stellaris_enet_can_receive(void *opaque)
     return (s->np < 31);
 }
 
-static uint32_t stellaris_enet_read(void *opaque, target_phys_addr_t offset)
+static uint32_t stellaris_enet_read(VLANClientState *vc, target_phys_addr_t offset)
 {
-    stellaris_enet_state *s = (stellaris_enet_state *)opaque;
+    stellaris_enet_state *s = vc->opaque;
     uint32_t val;
 
     switch (offset) {
index 693e9767d2cb5fe8605aaa1c35f1b2a6aee75c6c..d8d5e773f56cba384f4ba1604da9a0a2d8142313 100644 (file)
@@ -1369,9 +1369,9 @@ static int usb_net_handle_data(USBDevice *dev, USBPacket *p)
     return ret;
 }
 
-static void usbnet_receive(void *opaque, const uint8_t *buf, size_t size)
+static void usbnet_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
 {
-    USBNetState *s = opaque;
+    USBNetState *s = vc->opaque;
     struct rndis_packet_msg_type *msg;
 
     if (s->rndis) {
@@ -1405,9 +1405,9 @@ static void usbnet_receive(void *opaque, const uint8_t *buf, size_t size)
     s->in_ptr = 0;
 }
 
-static int usbnet_can_receive(void *opaque)
+static int usbnet_can_receive(VLANClientState *vc)
 {
-    USBNetState *s = opaque;
+    USBNetState *s = vc->opaque;
 
     if (s->rndis && !s->rndis_state == RNDIS_DATA_INITIALIZED)
         return 1;
index 3ca93f5872cc6ac295030a49a4037b975be2cfbd..1ffebac222b2c1079d47bfc25e8463fa6cd154aa 100644 (file)
@@ -288,9 +288,9 @@ static int do_virtio_net_can_receive(VirtIONet *n, int bufsize)
     return 1;
 }
 
-static int virtio_net_can_receive(void *opaque)
+static int virtio_net_can_receive(VLANClientState *vc)
 {
-    VirtIONet *n = opaque;
+    VirtIONet *n = vc->opaque;
 
     return do_virtio_net_can_receive(n, VIRTIO_NET_MAX_BUFSIZE);
 }
@@ -361,9 +361,9 @@ static int receive_filter(VirtIONet *n, const uint8_t *buf, int size)
     return 0;
 }
 
-static void virtio_net_receive(void *opaque, const uint8_t *buf, size_t size)
+static void virtio_net_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
 {
-    VirtIONet *n = opaque;
+    VirtIONet *n = vc->opaque;
     struct virtio_net_hdr_mrg_rxbuf *mhdr = NULL;
     size_t hdr_len, offset, i;
 
index 0643e5787759dabacd4f7410f5860ebd676c810d..173e87a8ff4b5653d2e2206b02d6a05448b2727a 100644 (file)
@@ -223,9 +223,9 @@ static void net_rx_response(struct XenNetDev *netdev,
 
 #define NET_IP_ALIGN 2
 
-static int net_rx_ok(void *opaque)
+static int net_rx_ok(VLANClientState *vc)
 {
-    struct XenNetDev *netdev = opaque;
+    struct XenNetDev *netdev = vc->opaque;
     RING_IDX rc, rp;
 
     if (netdev->xendev.be_state != XenbusStateConnected)
@@ -243,9 +243,9 @@ static int net_rx_ok(void *opaque)
     return 1;
 }
 
-static void net_rx_packet(void *opaque, const uint8_t *buf, size_t size)
+static void net_rx_packet(VLANClientState *vc, const uint8_t *buf, size_t size)
 {
-    struct XenNetDev *netdev = opaque;
+    struct XenNetDev *netdev = vc->opaque;
     netif_rx_request_t rxreq;
     RING_IDX rc, rp;
     void *page;
diff --git a/net.c b/net.c
index 515745d83a1b9a44e3126affd6987356680094ba..da79d99a125b53d97c3354f28abfb55f8043a9ce 100644 (file)
--- a/net.c
+++ b/net.c
@@ -402,7 +402,7 @@ int qemu_can_send_packet(VLANClientState *sender)
         }
 
         /* no can_receive() handler, they can always receive */
-        if (!vc->can_receive || vc->can_receive(vc->opaque)) {
+        if (!vc->can_receive || vc->can_receive(vc)) {
             return 1;
         }
     }
@@ -416,7 +416,7 @@ qemu_deliver_packet(VLANClientState *sender, const uint8_t *buf, int size)
 
     for (vc = sender->vlan->first_client; vc != NULL; vc = vc->next) {
         if (vc != sender && !vc->link_down) {
-            vc->receive(vc->opaque, buf, size);
+            vc->receive(vc, buf, size);
         }
     }
 }
@@ -467,7 +467,7 @@ static ssize_t vc_sendv_compat(VLANClientState *vc, const struct iovec *iov,
         offset += len;
     }
 
-    vc->receive(vc->opaque, buffer, offset);
+    vc->receive(vc, buffer, offset);
 
     return offset;
 }
@@ -520,7 +520,7 @@ ssize_t qemu_sendv_packet(VLANClientState *sender, const struct iovec *iov,
             if (vc->link_down) {
                 len = calc_iov_length(iov, iovcnt);
             } else if (vc->receive_iov) {
-                len = vc->receive_iov(vc->opaque, iov, iovcnt);
+                len = vc->receive_iov(vc, iov, iovcnt);
             } else if (vc->receive) {
                 len = vc_sendv_compat(vc, iov, iovcnt);
             }
@@ -593,7 +593,7 @@ int slirp_is_inited(void)
     return slirp_inited;
 }
 
-static void slirp_receive(void *opaque, const uint8_t *buf, size_t size)
+static void slirp_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
 {
 #ifdef DEBUG_SLIRP
     printf("slirp input:\n");
@@ -932,10 +932,10 @@ typedef struct TAPState {
 
 static int launch_script(const char *setup_script, const char *ifname, int fd);
 
-static ssize_t tap_receive_iov(void *opaque, const struct iovec *iov,
+static ssize_t tap_receive_iov(VLANClientState *vc, const struct iovec *iov,
                                int iovcnt)
 {
-    TAPState *s = opaque;
+    TAPState *s = vc->opaque;
     ssize_t len;
 
     do {
@@ -945,9 +945,9 @@ static ssize_t tap_receive_iov(void *opaque, const struct iovec *iov,
     return len;
 }
 
-static void tap_receive(void *opaque, const uint8_t *buf, size_t size)
+static void tap_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
 {
-    TAPState *s = opaque;
+    TAPState *s = vc->opaque;
     int ret;
     for(;;) {
         ret = write(s->fd, buf, size);
@@ -1311,9 +1311,9 @@ static void vde_to_qemu(void *opaque)
     }
 }
 
-static void vde_from_qemu(void *opaque, const uint8_t *buf, int size)
+static void vde_receive(VLANClientState *vc, const uint8_t *buf, int size)
 {
-    VDEState *s = opaque;
+    VDEState *s = vc->opaque;
     int ret;
     for(;;) {
         ret = vde_send(s->vde, (const char *)buf, size, 0);
@@ -1352,7 +1352,7 @@ static int net_vde_init(VLANState *vlan, const char *model,
         free(s);
         return -1;
     }
-    s->vc = qemu_new_vlan_client(vlan, model, name, NULL, vde_from_qemu,
+    s->vc = qemu_new_vlan_client(vlan, model, name, NULL, vde_receive,
                                  NULL, vde_cleanup, s);
     qemu_set_fd_handler(vde_datafd(s->vde), vde_to_qemu, NULL, s);
     snprintf(s->vc->info_str, sizeof(s->vc->info_str), "sock=%s,fd=%d",
@@ -1380,9 +1380,9 @@ typedef struct NetSocketListenState {
 } NetSocketListenState;
 
 /* XXX: we consider we can send the whole packet without blocking */
-static void net_socket_receive(void *opaque, const uint8_t *buf, size_t size)
+static void net_socket_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
 {
-    NetSocketState *s = opaque;
+    NetSocketState *s = vc->opaque;
     uint32_t len;
     len = htonl(size);
 
@@ -1390,9 +1390,9 @@ static void net_socket_receive(void *opaque, const uint8_t *buf, size_t size)
     send_all(s->fd, buf, size);
 }
 
-static void net_socket_receive_dgram(void *opaque, const uint8_t *buf, size_t size)
+static void net_socket_receive_dgram(VLANClientState *vc, const uint8_t *buf, size_t size)
 {
-    NetSocketState *s = opaque;
+    NetSocketState *s = vc->opaque;
     sendto(s->fd, buf, size, 0,
            (struct sockaddr *)&s->dgram_dst, sizeof(s->dgram_dst));
 }
@@ -1831,9 +1831,9 @@ struct pcap_sf_pkthdr {
     uint32_t len;
 };
 
-static void dump_receive(void *opaque, const uint8_t *buf, size_t size)
+static void dump_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
 {
-    DumpState *s = opaque;
+    DumpState *s = vc->opaque;
     struct pcap_sf_pkthdr hdr;
     int64_t ts;
     int caplen;
diff --git a/net.h b/net.h
index 4d204e06e6a808414d8d73f9be4c9261f09b0b2b..a28827c4a731a0677b9ead47c4a2557baacdb5fe 100644 (file)
--- a/net.h
+++ b/net.h
@@ -7,9 +7,9 @@
 
 typedef struct VLANClientState VLANClientState;
 
-typedef int (NetCanReceive)(void *);
-typedef void (NetReceive)(void *, const uint8_t *, size_t);
-typedef ssize_t (NetReceiveIOV)(void *, const struct iovec *, int);
+typedef int (NetCanReceive)(VLANClientState *);
+typedef void (NetReceive)(VLANClientState *, const uint8_t *, size_t);
+typedef ssize_t (NetReceiveIOV)(VLANClientState *, const struct iovec *, int);
 typedef void (NetCleanup) (VLANClientState *);
 typedef void (LinkStatusChanged)(VLANClientState *);
 
index 6da5e73a9661600b604aed3c9578bedc1171c60e..cae711762d7e925b3b29cad03b5ecaf6194fb285 100644 (file)
--- a/savevm.c
+++ b/savevm.c
@@ -131,7 +131,7 @@ static void qemu_announce_self_once(void *opaque)
         len = announce_self_create(buf, nd_table[i].macaddr);
         vlan = nd_table[i].vlan;
        for(vc = vlan->first_client; vc != NULL; vc = vc->next) {
-            vc->receive(vc->opaque, buf, len);
+            vc->receive(vc, buf, len);
         }
     }
     if (count--) {
index ccf7e45e55b51fb4778c4b9311219d7bc74d50bf..ff1e1ed5f43c261b1cd99f2521daabff4f0620ee 100644 (file)
@@ -650,7 +650,7 @@ static void tap_cleanup(VLANClientState *vc)
     qemu_free(s);
 }
 
-static void tap_receive(void *opaque, const uint8_t *buf, size_t size)
+static void tap_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
 {
     TAPState *s = opaque;