All of lore.kernel.org
 help / color / mirror / Atom feed
From: "KONRAD Frédéric" <fred.konrad@greensocs.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: aliguori@us.ibm.com, e.voevodin@samsung.com,
	mark.burton@greensocs.com, qemu-devel@nongnu.org,
	stefanha@redhat.com, cornelia.huck@de.ibm.com, afaerber@suse.de
Subject: Re: [Qemu-devel] [RFC PATCH v5 5/6] virtio-device : Refactor virtio-device.
Date: Tue, 04 Dec 2012 16:55:06 +0100	[thread overview]
Message-ID: <50BE1CDA.8020506@greensocs.com> (raw)
In-Reply-To: <CAFEAcA_NMz5DT4mO0xUH=9TgSa9+vTAvPD2rVyVt+uBLjiT+zg@mail.gmail.com>

On 04/12/2012 15:55, Peter Maydell wrote:
> On 4 December 2012 14:35,  <fred.konrad@greensocs.com> wrote:
>> From: KONRAD Frederic <fred.konrad@greensocs.com>
>>
>> Create the virtio-device which is abstract. All the virtio-device can extend
>> this class.
>>
>> Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
>> ---
>>   hw/virtio.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>>   hw/virtio.h | 29 +++++++++++++++++++++++++++++
>>   2 files changed, 85 insertions(+)
>>
>> diff --git a/hw/virtio.c b/hw/virtio.c
>> index f40a8c5..cd46af1 100644
>> --- a/hw/virtio.c
>> +++ b/hw/virtio.c
>> @@ -16,6 +16,7 @@
>>   #include "trace.h"
>>   #include "qemu-error.h"
>>   #include "virtio.h"
>> +#include "virtio-bus.h"
>>   #include "qemu-barrier.h"
>>
>>   /* The alignment to use between consumer and producer parts of vring.
>> @@ -934,6 +935,38 @@ VirtIODevice *virtio_common_init(const char *name, uint16_t device_id,
>>       return vdev;
>>   }
>>
>> +/*
>> + * The same initialization as above without allocating the structure.
>> + */
>> +void virtio_common_init_(VirtIODevice *vdev, const char *name,
>> +                         uint16_t device_id, size_t config_size,
>> +                         size_t struct_size)
> If you find yourself cut-and-pasting 25 lines of code, think again.
> In this case, just make virtio_common_init() a wrapper that does
> a malloc and calls your non-allocation init.
I didn't think about it, I'll do it.

Thanks,

Fred.

  reply	other threads:[~2012-12-04 15:55 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-04 14:35 [Qemu-devel] [RFC PATCH v5 0/6] Virtio refactoring fred.konrad
2012-12-04 14:35 ` [Qemu-devel] [RFC PATCH v5 1/6] qdev : add a maximum device allowed field for the bus fred.konrad
2012-12-04 14:35 ` [Qemu-devel] [RFC PATCH v5 2/6] virtio-bus : Introduce virtio-bus fred.konrad
2012-12-04 14:35 ` [Qemu-devel] [RFC PATCH v5 3/6] virtio-pci-bus : Introduce virtio-pci-bus fred.konrad
2012-12-04 14:35 ` [Qemu-devel] [RFC PATCH v5 4/6] virtio-pci : Refactor virtio-pci device fred.konrad
2012-12-04 14:49   ` Peter Maydell
2012-12-04 15:52     ` KONRAD Frédéric
2012-12-04 14:35 ` [Qemu-devel] [RFC PATCH v5 5/6] virtio-device : Refactor virtio-device fred.konrad
2012-12-04 14:55   ` Peter Maydell
2012-12-04 15:55     ` KONRAD Frédéric [this message]
2012-12-04 14:35 ` [Qemu-devel] [RFC PATCH v5 6/6] virtio-blk : Refactor virtio-blk fred.konrad
2012-12-05 16:25   ` Peter Maydell
2012-12-05 17:22     ` Andreas Färber
2012-12-06  9:21       ` KONRAD Frédéric
2012-12-06  9:53         ` Andreas Färber
2012-12-06 10:10           ` KONRAD Frédéric
2012-12-06 10:13           ` Peter Maydell
2012-12-06 13:58             ` KONRAD Frédéric
2012-12-06 14:21               ` Peter Maydell
2012-12-06 14:48                 ` KONRAD Frédéric
2012-12-06  9:11     ` KONRAD Frédéric
2012-12-06  9:18       ` Andreas Färber
2012-12-06  9:23         ` KONRAD Frédéric

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50BE1CDA.8020506@greensocs.com \
    --to=fred.konrad@greensocs.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=e.voevodin@samsung.com \
    --cc=mark.burton@greensocs.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.