In pci_nic_init(): pci_dev = pci_create(bus, devfn, pci_nic_names[i]); dev = &pci_dev->qdev; if (nd->name) dev->id = qemu_strdup(nd->name);
Blatant violation of the DeviceState abstraction. Which even carries a comment advising against this: /* This structure should not be accessed directly. We declare it here so that it can be embedded in individual device state structures. */ struct DeviceState { Do we still need this? Anybody wanting ID can use -device. History: it was added in commit eb54b6dc Author: Gerd Hoffmann <kra...@redhat.com> Date: Wed Jul 15 13:43:35 2009 +0200 qdev: add id= support for pci nics. and modified to use existing name instead of new id in commit dea7b3b9 Author: Mark McLoughlin <mar...@redhat.com> Date: Thu Oct 8 19:58:22 2009 +0100 net: remove id field from NICInfo Just use the name field instead since we now use the id paramater as the name, if supplied. Only implication with this change is that if id is not supplied, the value of the name paramater is used as an id.