From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45096) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ui6m8-000263-CF for qemu-devel@nongnu.org; Thu, 30 May 2013 13:36:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ui6m1-0002EY-R1 for qemu-devel@nongnu.org; Thu, 30 May 2013 13:36:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:7921) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ui6m1-0002EK-IV for qemu-devel@nongnu.org; Thu, 30 May 2013 13:36:25 -0400 Date: Thu, 30 May 2013 20:36:47 +0300 From: "Michael S. Tsirkin" Message-ID: <20130530173647.GA29091@redhat.com> References: <1369920427-18274-1-git-send-email-mst@redhat.com> <1369920427-18274-2-git-send-email-mst@redhat.com> <51A76ACF.9050800@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51A76ACF.9050800@redhat.com> Subject: Re: [Qemu-devel] [PATCH 1/3] pvpanic: use FWCfgState explicitly List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Laszlo Ersek Cc: Paolo Bonzini , qemu-devel@nongnu.org, Hu Tao On Thu, May 30, 2013 at 05:05:51PM +0200, Laszlo Ersek wrote: > On 05/30/13 15:27, Michael S. Tsirkin wrote: > > Use the type-safe FWCfgState structure instead > > of the unsafe void *. > > > > Signed-off-by: Michael S. Tsirkin > > --- > > hw/misc/pvpanic.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c > > index 31e1b1d..1483f27 100644 > > --- a/hw/misc/pvpanic.c > > +++ b/hw/misc/pvpanic.c > > @@ -90,7 +90,7 @@ static int pvpanic_isa_initfn(ISADevice *dev) > > { > > PVPanicState *s = ISA_PVPANIC_DEVICE(dev); > > static bool port_configured; > > - void *fw_cfg; > > + FWCfgState *fw_cfg; > > > > memory_region_init_io(&s->io, &pvpanic_ops, s, "pvpanic", 1); > > isa_register_ioport(dev, &s->io, s->ioport); > > > > Doesn't this break your build? Lower down in the function there's > > fw_cfg = object_resolve_path("/machine/fw_cfg", NULL); > > and object_resolve_path() returns a pointer-to-Object, not > pointer-to-FWCfgState. I see, I think I should reorder the patches. > But for starters I'm quite confused about how the unpatched function > works. What it does amounts to: > > fw_cfg_add_file(object_resolve_path(...), ...); > > But, again object_resolve_path() returns pointer-to-Object. I'm checking > "struct Object" in "include/qom/object.h", and it suggests that derived > structs should embed Object as first member. However FWCfgState is *not* > such a derived member. What's going on here? > > http://thread.gmane.org/gmane.comp.emulators.qemu/201544/focus=201564 > http://thread.gmane.org/gmane.comp.emulators.qemu/204452/focus=204450 > > Laszlo