[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 43/43] block/qcow2: Don't use cpu_to_*w()
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 43/43] block/qcow2: Don't use cpu_to_*w() |
Date: |
Tue, 5 Jul 2016 17:50:52 +0200 |
From: Peter Maydell <address@hidden>
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>
Message-id: address@hidden
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Max Reitz <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-cluster.c b/block/qcow2-cluster.c
index cf159f1..6b92ce9 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -117,7 +117,7 @@ int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t
min_size,
/* set new table */
BLKDBG_EVENT(bs->file, BLKDBG_L1_GROW_ACTIVATE_TABLE);
- cpu_to_be32w((uint32_t*)data, new_l1_size);
+ stl_be_p(data, new_l1_size);
stq_be_p(data + 4, new_l1_table_offset);
ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, l1_size),
data, sizeof(data));
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 13bbc9c..49b6ce6 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -562,8 +562,8 @@ static int alloc_refcount_block(BlockDriverState *bs,
uint64_t d64;
uint32_t d32;
} data;
- 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,
offsetof(QCowHeader, refcount_table_offset),
@@ -2155,10 +2155,9 @@ write_refblocks:
}
/* Enter new reftable into the image header */
- cpu_to_be64w(&reftable_offset_and_clusters.reftable_offset,
- reftable_offset);
- cpu_to_be32w(&reftable_offset_and_clusters.reftable_clusters,
- size_to_clusters(s, reftable_size * sizeof(uint64_t)));
+ reftable_offset_and_clusters.reftable_offset =
cpu_to_be64(reftable_offset);
+ reftable_offset_and_clusters.reftable_clusters =
+ cpu_to_be32(size_to_clusters(s, reftable_size * sizeof(uint64_t)));
ret = bdrv_pwrite_sync(bs->file,
offsetof(QCowHeader, refcount_table_offset),
&reftable_offset_and_clusters,
diff --git a/block/qcow2.c b/block/qcow2.c
index 8a2c568..a5ea19b 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -2739,9 +2739,9 @@ static int make_completely_empty(BlockDriverState *bs)
/* "Create" an empty reftable (one cluster) directly after the image
* header and an empty L1 table three clusters after the image header;
* the cluster between those two will be used as the first refblock */
- cpu_to_be64w(&l1_ofs_rt_ofs_cls.l1_offset, 3 * s->cluster_size);
- cpu_to_be64w(&l1_ofs_rt_ofs_cls.reftable_offset, s->cluster_size);
- cpu_to_be32w(&l1_ofs_rt_ofs_cls.reftable_clusters, 1);
+ l1_ofs_rt_ofs_cls.l1_offset = cpu_to_be64(3 * s->cluster_size);
+ l1_ofs_rt_ofs_cls.reftable_offset = cpu_to_be64(s->cluster_size);
+ l1_ofs_rt_ofs_cls.reftable_clusters = cpu_to_be32(1);
ret = bdrv_pwrite_sync(bs->file, offsetof(QCowHeader, l1_table_offset),
&l1_ofs_rt_ofs_cls, sizeof(l1_ofs_rt_ofs_cls));
if (ret < 0) {
--
1.8.3.1
- [Qemu-devel] [PULL 33/43] block: Convert bdrv_co_do_readv/writev to BdrvChild, (continued)
- [Qemu-devel] [PULL 33/43] block: Convert bdrv_co_do_readv/writev to BdrvChild, Kevin Wolf, 2016/07/05
- [Qemu-devel] [PULL 32/43] block: Convert bdrv_aio_writev() to BdrvChild, Kevin Wolf, 2016/07/05
- [Qemu-devel] [PULL 31/43] block: Convert bdrv_aio_readv() to BdrvChild, Kevin Wolf, 2016/07/05
- [Qemu-devel] [PULL 35/43] block: Use BlockBackend for I/O in bdrv_commit(), Kevin Wolf, 2016/07/05
- [Qemu-devel] [PULL 37/43] block: Convert bdrv_write() to BdrvChild, Kevin Wolf, 2016/07/05
- [Qemu-devel] [PULL 36/43] block: Convert bdrv_read() to BdrvChild, Kevin Wolf, 2016/07/05
- [Qemu-devel] [PULL 34/43] block: Move bdrv_commit() to block/commit.c, Kevin Wolf, 2016/07/05
- [Qemu-devel] [PULL 41/43] block: Convert bdrv_prwv_co() to BdrvChild, Kevin Wolf, 2016/07/05
- [Qemu-devel] [PULL 40/43] block: Convert bdrv_pwrite_zeroes() to BdrvChild, Kevin Wolf, 2016/07/05
- [Qemu-devel] [PULL 39/43] block: Convert bdrv_pwrite(v/_sync) to BdrvChild, Kevin Wolf, 2016/07/05
- [Qemu-devel] [PULL 43/43] block/qcow2: Don't use cpu_to_*w(),
Kevin Wolf <=
- [Qemu-devel] [PULL 42/43] block: Convert bdrv_co_preadv/pwritev to BdrvChild, Kevin Wolf, 2016/07/05
- [Qemu-devel] [PULL 38/43] block: Convert bdrv_pread(v) to BdrvChild, Kevin Wolf, 2016/07/05
- Re: [Qemu-devel] [PULL 00/43] Block layer patches, Peter Maydell, 2016/07/06