summaryrefslogtreecommitdiff
path: root/hw/qdev.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2009-10-21 15:25:26 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2009-10-27 12:28:38 -0500
commit41df41c2d1658c502406a1bfa86fe2553b373f8b (patch)
tree019408b4c2286cab3f6720394666b64f9cde2fb2 /hw/qdev.c
parent9f5fbfbd4ab0d3335c511d88b99eedd4cb956fdc (diff)
downloadqemu-41df41c2d1658c502406a1bfa86fe2553b373f8b.tar.gz
qemu-41df41c2d1658c502406a1bfa86fe2553b373f8b.tar.bz2
qemu-41df41c2d1658c502406a1bfa86fe2553b373f8b.zip
qdev/net: common nic property bits
Add a new type for properties common to all nics. Add helper functions and macros to deal with it. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/qdev.c')
-rw-r--r--hw/qdev.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/qdev.c b/hw/qdev.c
index 20f931c1c6..b32dbfc1fa 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -383,6 +383,15 @@ void qdev_get_macaddr(DeviceState *dev, uint8_t *macaddr)
memcpy(macaddr, dev->nd->macaddr, 6);
}
+void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd)
+{
+ qdev_prop_set_macaddr(dev, "mac", nd->macaddr);
+ if (nd->vlan)
+ qdev_prop_set_vlan(dev, "vlan", nd->vlan);
+ if (nd->netdev)
+ qdev_prop_set_netdev(dev, "netdev", nd->netdev);
+}
+
static int next_block_unit[IF_COUNT];
/* Get a block device. This should only be used for single-drive devices