qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] block/qcow2: Don't use cpu_to_*w()


From: Max Reitz
Subject: Re: [Qemu-devel] [PATCH] block/qcow2: Don't use cpu_to_*w()
Date: Mon, 20 Jun 2016 17:10:29 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1

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 <address@hidden>
> ---
>  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: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]