Am 20.02.2013 19:14, schrieb Paolo Bonzini: > Il 20/02/2013 19:04, David Woodhouse ha scritto: >>>> PCII440FXState *d = I440FX_PCI_WHATEVER_CAST_MACRO_NAME(dev); >> Yeah, that's the easy bit. The bit that I'm vaguely confused by would be >> something like >> >> #define I440FX_PCI_WHATEVER_CAST_MACRO_NAME(obj) \ >> OBJECT_CHECK(PCII440FXState, (obj), "i440FX") >> >> Where that "i440FX" should probably be turned into a macro of its own? > > Yes, TYPE_PCI_I440FX_STATE.
We don't use _STATE names and it's not a PCI version of i440fx, as template compare Raven PHB: http://git.qemu.org/?p=qemu.git;a=blob;f=hw/prep_pci.c;h=52ee5d94019c880bd8915fe64f72922e0921f342;hb=HEAD I'd suggest: #define TYPE_I440FX_PCI_DEVICE "i440FX" #define I440FX_PCI_DEVICE(obj) \ OBJECT_CHECK(PCII440FXState, (obj), "i440FX") foo(Object *obj)... PCII440FXState *s = I440FX_PCI_DEVICE(obj); TypeInfo ... .name = TYPE_I440FX_PCI_DEVICE, Note: Not in VMState though in case that matches textually. Andreas > >> And then all the *existing* uses of DO_UPCAST should be fixed to use it >> too? Such as in i440fx_write_config() ? > > Yes, that would be helpful. But I would not block your patch for the > casts, since i440FX is not yet converted. > > Paolo > -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
