From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Fréderic Konrad" <fred.konrad@greensocs.com>,
"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
"Andreas Faerber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [RFC 2/5] virtio: add child alias properties for virtio-blk
Date: Wed, 14 May 2014 14:04:25 +0000 [thread overview]
Message-ID: <CAEgOgz4eaNDKxm0HxVeUCyOxdTeL2bcHuFdOdMQcVMrRKWOJ0Q@mail.gmail.com> (raw)
In-Reply-To: <1395244138-8834-3-git-send-email-stefanha@redhat.com>
On Wed, Mar 19, 2014 at 3:48 PM, Stefan Hajnoczi <stefanha@redhat.com> wrote:
> Now that qdev child alias properties exist, define aliases for
> virtio-blk properties. The aliases will replace the duplicated
> properties that current live in virtio-blk-pci, virtio-blk-ccw, and
> friends.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
> include/hw/block/block.h | 14 ++++++++++++++
> include/hw/virtio/virtio-blk.h | 17 +++++++++++++++++
> 2 files changed, 31 insertions(+)
>
> diff --git a/include/hw/block/block.h b/include/hw/block/block.h
> index 7c3d6c8..702f1eb 100644
> --- a/include/hw/block/block.h
> +++ b/include/hw/block/block.h
> @@ -52,11 +52,25 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf)
> DEFINE_PROP_UINT32("discard_granularity", _state, \
> _conf.discard_granularity, -1)
>
> +#define DEFINE_BLOCK_CHILD_ALIASES(_state, _field) \
> + DEFINE_PROP_CHILD_ALIAS("drive", _state, _field), \
> + DEFINE_PROP_CHILD_ALIAS("logical_block_size", _state, _field), \
> + DEFINE_PROP_CHILD_ALIAS("physical_block_size", _state, _field), \
> + DEFINE_PROP_CHILD_ALIAS("min_io_size", _state, _field), \
> + DEFINE_PROP_CHILD_ALIAS("opt_io_size", _state, _field), \
> + DEFINE_PROP_CHILD_ALIAS("bootindex", _state, _field), \
> + DEFINE_PROP_CHILD_ALIAS("discard_granularity", _state, _field)
> +
> #define DEFINE_BLOCK_CHS_PROPERTIES(_state, _conf) \
> DEFINE_PROP_UINT32("cyls", _state, _conf.cyls, 0), \
> DEFINE_PROP_UINT32("heads", _state, _conf.heads, 0), \
> DEFINE_PROP_UINT32("secs", _state, _conf.secs, 0)
>
> +#define DEFINE_BLOCK_CHS_CHILD_ALIASES(_state, _field) \
> + DEFINE_PROP_CHILD_ALIAS("cyls", _state, _field), \
> + DEFINE_PROP_CHILD_ALIAS("heads", _state, _field), \
> + DEFINE_PROP_CHILD_ALIAS("secs", _state, _field)
> +
> /* Configuration helpers */
>
> void blkconf_serial(BlockConf *conf, char **serial);
> diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h
> index e4c41ff..5095ff4 100644
> --- a/include/hw/virtio/virtio-blk.h
> +++ b/include/hw/virtio/virtio-blk.h
> @@ -153,6 +153,23 @@ typedef struct VirtIOBlock {
> DEFINE_PROP_IOTHREAD("x-iothread", _state, _field.iothread)
> #endif /* __linux__ */
>
> +#ifdef __linux__
> +#define DEFINE_VIRTIO_BLK_CHILD_ALIASES(_state, _field) \
> + DEFINE_BLOCK_CHILD_ALIASES(_state, _field), \
> + DEFINE_BLOCK_CHS_CHILD_ALIASES(_state, _field), \
> + DEFINE_PROP_CHILD_ALIAS("serial", _state, _field), \
> + DEFINE_PROP_CHILD_ALIAS("config-wce", _state, _field), \
> + DEFINE_PROP_CHILD_ALIAS("scsi", _state, _field), \
> + DEFINE_PROP_CHILD_ALIAS("x-iothread", _state, _field)
> +#else
> +#define DEFINE_VIRTIO_BLK_CHILD_ALIASES(_state, _field) \
> + DEFINE_BLOCK_CHILD_ALIASES(_state, _field), \
> + DEFINE_BLOCK_CHS_CHILD_ALIASES(_state, _field), \
> + DEFINE_PROP_CHILD_ALIAS("serial", _state, _field), \
> + DEFINE_PROP_CHILD_ALIAS("config-wce", _state, _field), \
> + DEFINE_PROP_CHILD_ALIAS("x-iothread", _state, _field)
> +#endif /* __linux__ */
Can the duplication be avoided with:
#ifdef __linux__
#define DEFINE_VIRTIO_BLK_CHILD_ALIASES_LINUX \
DEFINE_PROP_CHILD_ALIAS("scsi", _state, _field),
#else
#define DEFINE_VIRTIO_BLK_CHILD_ALIASES_LINUX
#endif
?
Regards,
Peter
> +
> void virtio_blk_set_conf(DeviceState *dev, VirtIOBlkConf *blk);
>
> #endif
> --
> 1.8.5.3
>
>
next prev parent reply other threads:[~2014-05-14 14:04 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-19 15:48 [Qemu-devel] [RFC 0/5] virtio: use alias properties in transport devices Stefan Hajnoczi
2014-03-19 15:48 ` [Qemu-devel] [RFC 1/5] qdev: add child alias properties Stefan Hajnoczi
2014-05-14 13:27 ` Andreas Färber
2014-05-14 13:31 ` Paolo Bonzini
2014-05-14 14:13 ` Peter Crosthwaite
2014-05-14 14:17 ` Andreas Färber
2014-05-14 14:26 ` Peter Crosthwaite
2014-03-19 15:48 ` [Qemu-devel] [RFC 2/5] virtio: add child alias properties for virtio-blk Stefan Hajnoczi
2014-05-14 14:04 ` Peter Crosthwaite [this message]
2014-05-14 14:33 ` Stefan Hajnoczi
2014-05-14 14:38 ` Peter Crosthwaite
2014-03-19 15:48 ` [Qemu-devel] [RFC 3/5] virtio: use child aliases for virtio-blk transport properties Stefan Hajnoczi
2014-03-19 15:48 ` [Qemu-devel] [RFC 4/5] virtio-blk: drop virtio_blk_set_conf() Stefan Hajnoczi
2014-03-19 15:48 ` [Qemu-devel] [RFC 5/5] virtio: fix virtio-blk child refcount in transports Stefan Hajnoczi
2014-05-14 13:21 ` [Qemu-devel] [RFC 0/5] virtio: use alias properties in transport devices Stefan Hajnoczi
2014-05-16 15:08 ` Frederic Konrad
2014-05-19 14:21 ` Stefan Hajnoczi
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=CAEgOgz4eaNDKxm0HxVeUCyOxdTeL2bcHuFdOdMQcVMrRKWOJ0Q@mail.gmail.com \
--to=peter.crosthwaite@xilinx.com \
--cc=afaerber@suse.de \
--cc=fred.konrad@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).