qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 00/12] qdev: correct reference counting


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH v2 00/12] qdev: correct reference counting
Date: Fri, 25 Jan 2013 11:33:59 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130105 Thunderbird/17.0.2

Am 25.01.2013 11:25, schrieb Paolo Bonzini:
> Il 25/01/2013 10:21, Andreas Färber ha scritto:
>>>>
>>>> Ping.
>> I believe I was still waiting for an explanation why this qbus_init()
>> function must be exposed rather than one _new() and one _initialize()
>> function... Not getting feedback on that, I was already considering
>> sending you an alternative patch for the initial two.
> 
> Because you cannot object_initialize the result of object_new.  It would
> overwrite the free callback and leak memory.

I never suggested that.

> So you need three functions: _new() (which is usually called foo_create
> for buses), _initialize() (which is usually foo_create_inplace), and a
> third which I called _init().

My question still is, *why* do we need a third one?

My suggestion is
foo_bus_initialize() -> bus_initialize() -> object_initialize()
and
foo_bus_new() -> bus_new() -> object_new().
Code sharing can be done static-qbus_realize()-style (call that
qbus_init if you like but don't expose this detail).

Regards,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



reply via email to

[Prev in Thread] Current Thread [Next in Thread]