All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: kwolf@redhat.com, qemu-devel@nongnu.org, hch@lst.de
Subject: Re: [Qemu-devel] [PATCH v2 1/5] ide: Split qdev "ide-drive" into "ide-hd" and "ide-cd"
Date: Mon, 09 May 2011 13:59:11 +0200	[thread overview]
Message-ID: <4DC7D70F.3030103@redhat.com> (raw)
In-Reply-To: <1304934694-13432-2-git-send-email-armbru@redhat.com>

   Hi,

> +#define DEFINE_IDE_DEV_PROPERTIES()                     \
> +    DEFINE_PROP_UINT32("unit", IDEDrive, dev.unit, -1), \
> +    DEFINE_BLOCK_PROPERTIES(IDEDrive, dev.conf),        \
> +    DEFINE_PROP_STRING("ver",  IDEDrive, dev.version),  \
> +    DEFINE_PROP_STRING("serial",  IDEDrive, dev.serial)

This can also be done this way:

static Property ide_properties[] = {
     DEFINE_PROP_UINT32("unit", IDEDrive, dev.unit, -1),
     [ ... ]
     DEFINE_PROP_END_OF_LIST(),
};

> +static IDEDeviceInfo ide_dev_info[] = {
> +    {
> +        .qdev.name    = "ide-hd",
> +        .qdev.fw_name = "drive",
> +        .qdev.desc    = "virtual IDE disk",
> +        .qdev.size    = sizeof(IDEDrive),
> +        .init         = ide_hd_initfn,

            .qdev.props   = ide_properties,

Works only as long as all devices have exactly the same set (i.e. for 
scsi it wouldn't work as not all devices have the "removable" property).

I tend to like this more than the #define.  YMMV, matter of taste.

cheers,
   Gerd

  reply	other threads:[~2011-05-09 11:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-09  9:51 [Qemu-devel] [PATCH v2 0/5] Split ide-drive and scsi-disk qdevs, and more Markus Armbruster
2011-05-09  9:51 ` [Qemu-devel] [PATCH v2 1/5] ide: Split qdev "ide-drive" into "ide-hd" and "ide-cd" Markus Armbruster
2011-05-09 11:59   ` Gerd Hoffmann [this message]
2011-05-10  8:14     ` Markus Armbruster
2011-05-09  9:51 ` [Qemu-devel] [PATCH v2 2/5] scsi: Split qdev "scsi-disk" into "scsi-hd" and "scsi-cd" Markus Armbruster
2011-05-09  9:51 ` [Qemu-devel] [PATCH v2 3/5] block QMP: Drop query-block member "type" (type= in info block) Markus Armbruster
2011-05-09  9:51 ` [Qemu-devel] [PATCH v2 4/5] blockdev: Store -drive option media in DriveInfo Markus Armbruster
2011-05-09  9:51 ` [Qemu-devel] [PATCH v2 5/5] block: Remove type hint, it's guest matter, doesn't belong here Markus Armbruster
2011-05-09 12:04 ` [Qemu-devel] [PATCH v2 0/5] Split ide-drive and scsi-disk qdevs, and more Gerd Hoffmann
2011-05-10 11:39 ` Kevin Wolf
2011-05-12 15:05   ` Markus Armbruster

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=4DC7D70F.3030103@redhat.com \
    --to=kraxel@redhat.com \
    --cc=armbru@redhat.com \
    --cc=hch@lst.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.