From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LVCpU-00010d-As for qemu-devel@nongnu.org; Thu, 05 Feb 2009 17:36:16 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LVCpT-0000ya-7l for qemu-devel@nongnu.org; Thu, 05 Feb 2009 17:36:15 -0500 Received: from [199.232.76.173] (port=44146 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LVCpS-0000xd-T2 for qemu-devel@nongnu.org; Thu, 05 Feb 2009 17:36:14 -0500 Received: from savannah.gnu.org ([199.232.41.3]:56500 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LVCpS-0005q4-CA for qemu-devel@nongnu.org; Thu, 05 Feb 2009 17:36:14 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1LVCpR-0000Rg-5O for qemu-devel@nongnu.org; Thu, 05 Feb 2009 22:36:13 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1LVCpQ-0000Rc-Qa for qemu-devel@nongnu.org; Thu, 05 Feb 2009 22:36:12 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Thu, 05 Feb 2009 22:36:12 +0000 Subject: [Qemu-devel] [6535] qemu:virtio-net: Define ETH_ALEN for use when manipulating MAC addresses (Alex Williamson) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 6535 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6535 Author: aliguori Date: 2009-02-05 22:36:12 +0000 (Thu, 05 Feb 2009) Log Message: ----------- qemu:virtio-net: Define ETH_ALEN for use when manipulating MAC addresses (Alex Williamson) Makes it much easier to search too. Signed-off-by: Alex Williamson Signed-off-by: Anthony Liguori Modified Paths: -------------- trunk/hw/virtio-net.c trunk/hw/virtio-net.h Modified: trunk/hw/virtio-net.c =================================================================== --- trunk/hw/virtio-net.c 2009-02-05 22:36:08 UTC (rev 6534) +++ trunk/hw/virtio-net.c 2009-02-05 22:36:12 UTC (rev 6535) @@ -21,7 +21,7 @@ typedef struct VirtIONet { VirtIODevice vdev; - uint8_t mac[6]; + uint8_t mac[ETH_ALEN]; uint16_t status; VirtQueue *rx_vq; VirtQueue *tx_vq; @@ -46,7 +46,7 @@ struct virtio_net_config netcfg; netcfg.status = n->status; - memcpy(netcfg.mac, n->mac, 6); + memcpy(netcfg.mac, n->mac, ETH_ALEN); memcpy(config, &netcfg, sizeof(netcfg)); } @@ -57,8 +57,8 @@ memcpy(&netcfg, config, sizeof(netcfg)); - if (memcmp(netcfg.mac, n->mac, 6)) { - memcpy(n->mac, netcfg.mac, 6); + if (memcmp(netcfg.mac, n->mac, ETH_ALEN)) { + memcpy(n->mac, netcfg.mac, ETH_ALEN); qemu_format_nic_info_str(n->vc, n->mac); } } @@ -304,7 +304,7 @@ virtio_save(&n->vdev, f); - qemu_put_buffer(f, n->mac, 6); + qemu_put_buffer(f, n->mac, ETH_ALEN); qemu_put_be32(f, n->tx_timer_active); qemu_put_be32(f, n->mergeable_rx_bufs); qemu_put_be16(f, n->status); @@ -319,7 +319,7 @@ virtio_load(&n->vdev, f); - qemu_get_buffer(f, n->mac, 6); + qemu_get_buffer(f, n->mac, ETH_ALEN); n->tx_timer_active = qemu_get_be32(f); n->mergeable_rx_bufs = qemu_get_be32(f); @@ -356,7 +356,7 @@ n->vdev.set_features = virtio_net_set_features; n->rx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_rx); n->tx_vq = virtio_add_queue(&n->vdev, 256, virtio_net_handle_tx); - memcpy(n->mac, nd->macaddr, 6); + memcpy(n->mac, nd->macaddr, ETH_ALEN); n->status = VIRTIO_NET_S_LINK_UP; n->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, virtio_net_receive, virtio_net_can_receive, n); Modified: trunk/hw/virtio-net.h =================================================================== --- trunk/hw/virtio-net.h 2009-02-05 22:36:08 UTC (rev 6534) +++ trunk/hw/virtio-net.h 2009-02-05 22:36:12 UTC (rev 6535) @@ -18,6 +18,8 @@ #include "net.h" #include "pci.h" +#define ETH_ALEN 6 + /* from Linux's virtio_net.h */ /* The ID for virtio_net */