All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: "Andreas Färber" <afaerber@suse.de>
Cc: Kevin Wolf <kwolf@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/3] ide: add drive-id property
Date: Thu, 02 May 2013 07:59:19 -0500	[thread overview]
Message-ID: <87ehdp4jx4.fsf@codemonkey.ws> (raw)
In-Reply-To: <51823A77.7090809@suse.de>

Andreas Färber <afaerber@suse.de> writes:

> Am 26.04.2013 21:43, schrieb Anthony Liguori:
>> This returns a string similar to what the guest would display in
>> something like Linux's /dev/disk/by-id/ path.
>> 
>> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
>> ---
>>  hw/ide/qdev.c | 15 +++++++++++++++
>>  1 file changed, 15 insertions(+)
>> 
>> diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
>> index 8a9a891..94b1664 100644
>> --- a/hw/ide/qdev.c
>> +++ b/hw/ide/qdev.c
>> @@ -270,6 +270,20 @@ static const TypeInfo ide_drive_info = {
>>      .class_init    = ide_drive_class_init,
>>  };
>>  
>> +static char *ide_device_get_model(Object *obj, Error **errp)
>> +{
>> +    IDEDevice *dev = IDE_DEVICE(obj);
>> +    IDEBus *bus = DO_UPCAST(IDEBus, qbus, dev->qdev.parent_bus);
>
> IDEBus *bus = IDE_BUS(qdev_get_parent_bus(DEVICE(obj)));
>
> You're breaking your own rules. :)

Yeah, I copy/pasted, I'll clean up.

>
>> +    IDEState *s = bus->ifs + dev->unit;
>> +
>> +    return g_strdup_printf("%s %s", s->drive_model_str, s->drive_serial_str);
>> +}
>> +
>> +static void ide_device_initfn(Object *obj)
>> +{
>> +    object_property_add_str(obj, "drive-id", ide_device_get_model, NULL, NULL);
>> +}
>> +
>>  static void ide_device_class_init(ObjectClass *klass, void *data)
>>  {
>>      DeviceClass *k = DEVICE_CLASS(klass);
>> @@ -285,6 +299,7 @@ static const TypeInfo ide_device_type_info = {
>>      .abstract = true,
>>      .class_size = sizeof(IDEDeviceClass),
>>      .class_init = ide_device_class_init,
>> +    .instance_init = ide_device_initfn,
>
> You recently said ..._initfn was only a workaround for avoiding ..._init
> vs. ..._initfn name conflicts. I've therefore started changing new code
> to that pattern. There is no conflicting ide_device_init here.
>
> I don't really care which suffix we choose, but consistency is good.

I'm happy with using initfn consistently but I really don't care that
much.

Regards,

Anthony Liguori

>
>>  };
>>  
>>  static void ide_register_types(void)
>
> 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	other threads:[~2013-05-02 12:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-26 19:43 [Qemu-devel] [PATCH 0/3] gtk: add Devices menu Anthony Liguori
2013-04-26 19:43 ` [Qemu-devel] [PATCH 1/3] ide: add drive-id property Anthony Liguori
2013-05-02 10:05   ` Andreas Färber
2013-05-02 12:59     ` Anthony Liguori [this message]
2013-04-26 19:43 ` [Qemu-devel] [PATCH 2/3] monitor: add notifier list for monitor events Anthony Liguori
2013-04-26 19:43 ` [Qemu-devel] [PATCH 3/3] gtk: add devices menu to allow changing removable block devices Anthony Liguori
2013-05-02  8:49   ` Kevin Wolf
2013-05-02 13:41     ` Anthony Liguori
2013-05-02 13:53       ` Luiz Capitulino
2013-05-02 14:06       ` Kevin Wolf
2013-05-02 15:29         ` Markus Armbruster
2013-05-02 15:40         ` Anthony Liguori
2013-05-03 12:31           ` [Qemu-devel] [libvirt] " Daniel P. Berrange
2013-05-03 13:52             ` Anthony Liguori
2013-05-03 13:57               ` Daniel P. Berrange
2013-05-02 15:47         ` [Qemu-devel] " Anthony Liguori

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=87ehdp4jx4.fsf@codemonkey.ws \
    --to=aliguori@us.ibm.com \
    --cc=afaerber@suse.de \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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.