qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Max Reitz <mreitz@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Cc: patches@linaro.org, Kevin Wolf <kwolf@redhat.com>, qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] block/qcow2: Don't use cpu_to_*w()
Date: Mon, 20 Jun 2016 17:10:29 +0200	[thread overview]
Message-ID: <34c3863f-cf4f-2bf6-20cb-92b4711ad4d9@redhat.com> (raw)
In-Reply-To: <1466093177-17890-1-git-send-email-peter.maydell@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 1476 bytes --]

On 16.06.2016 18:06, Peter Maydell wrote:
> Don't use the cpu_to_*w() functions, which we are trying to deprecate.
> Instead either just use cpu_to_*() to do the byteswap, or use
> st*_be_p() if we need to do the store somewhere other than to a
> variable that's already the correct type.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  block/qcow2-cluster.c  |  2 +-
>  block/qcow2-refcount.c | 11 +++++------
>  block/qcow2.c          |  6 +++---
>  3 files changed, 9 insertions(+), 10 deletions(-)
>

[...]

> diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
> index 66f187a..088c00f 100644
> --- a/block/qcow2-refcount.c
> +++ b/block/qcow2-refcount.c
> @@ -565,8 +565,8 @@ static int alloc_refcount_block(BlockDriverState *bs,
>          uint64_t d64;
>          uint32_t d32;
>      } data;

This declaration is in the middle of the block, so it might have made
sense to fix that along the way. Since this is pre-existing, however:

Thanks, applied to my block tree:

https://github.com/XanClic/qemu/commits/block

Max

> -    cpu_to_be64w(&data.d64, table_offset);
> -    cpu_to_be32w(&data.d32, table_clusters);
> +    data.d64 = cpu_to_be64(table_offset);
> +    data.d32 = cpu_to_be32(table_clusters);
>      BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_SWITCH_TABLE);
>      ret = bdrv_pwrite_sync(bs->file->bs,
>                             offsetof(QCowHeader, refcount_table_offset),


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

  parent reply	other threads:[~2016-06-20 15:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-16 16:06 [Qemu-devel] [PATCH] block/qcow2: Don't use cpu_to_*w() Peter Maydell
2016-06-16 16:59 ` Eric Blake
2016-06-20 15:10 ` Max Reitz [this message]
2016-06-28 14:17   ` Peter Maydell
2016-06-28 15:04     ` Kevin Wolf
2016-06-28 15:07       ` Peter Maydell

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=34c3863f-cf4f-2bf6-20cb-92b4711ad4d9@redhat.com \
    --to=mreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=patches@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-block@nongnu.org \
    --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 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).