qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Do we still need the hack to set qdev id from NICInfo.name?
@ 2010-06-08  8:57 Markus Armbruster
  2010-06-08  9:03 ` [Qemu-devel] " Gerd Hoffmann
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Armbruster @ 2010-06-08  8:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: Mark McLoughlin, Gerd Hoffmann

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 <kraxel@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 <markmc@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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Qemu-devel] Re: Do we still need the hack to set qdev id from NICInfo.name?
  2010-06-08  8:57 [Qemu-devel] Do we still need the hack to set qdev id from NICInfo.name? Markus Armbruster
@ 2010-06-08  9:03 ` Gerd Hoffmann
  0 siblings, 0 replies; 2+ messages in thread
From: Gerd Hoffmann @ 2010-06-08  9:03 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: Mark McLoughlin, qemu-devel

>      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:

> Do we still need this?  Anybody wanting ID can use -device.

I think it is only used for -net nic,...,name=something.  I think this 
predates working -device for nics.  So, yes, it shouldn't be needed any 
more ...

cheers,
   Gerd

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-08  9:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-08  8:57 [Qemu-devel] Do we still need the hack to set qdev id from NICInfo.name? Markus Armbruster
2010-06-08  9:03 ` [Qemu-devel] " Gerd Hoffmann

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).