qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Selecting device variant types based on bdrv size
@ 2013-05-27  7:50 Peter Crosthwaite
  2013-05-27 13:40 ` Andreas Färber
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Crosthwaite @ 2013-05-27  7:50 UTC (permalink / raw)
  To: Andreas Färber, Anthony Liguori,
	qemu-devel@nongnu.org Developers
  Cc: Stefan Hajnoczi, Edgar E. Iglesias, Jan Kiszka

Hi All,

I have a bit of a chicken and egg problem trying to refactor Jans AT24
I2C EEPROM model. I'm trying to migrate static class properties up to
the class level rather than down on the device property level (as we
did for EHCI in the sysbusification a while back). Problem is the
device model has part autodetection logic based on the size of the
backing image - you can instantiate the "abstract" class and selection
of what part it is depends on the backing file size. And so if we go
for one class for each separate part, we don't actually know what
concrete class to instantiate until we have a handle on the bdrv at
realize time which is way to late. Any Ideas?

Can you safely change a devices type at realize time?

realize() {
   ...
   OBJECT(dev)->class = the_now_known_correct_child_class;
   ...
}

Obviously this would need an API call in QOM to sanity check it.

Regards,
Peter

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

end of thread, other threads:[~2013-05-27 22:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-27  7:50 [Qemu-devel] Selecting device variant types based on bdrv size Peter Crosthwaite
2013-05-27 13:40 ` Andreas Färber
2013-05-27 22:48   ` Peter Crosthwaite

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