From patchwork Tue Jul 5 15:50:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Wolf X-Patchwork-Id: 71395 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp432396qgy; Tue, 5 Jul 2016 10:47:36 -0700 (PDT) X-Received: by 10.55.166.149 with SMTP id p143mr23365630qke.79.1467740856462; Tue, 05 Jul 2016 10:47:36 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id d29si2923493qkh.218.2016.07.05.10.47.36 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 05 Jul 2016 10:47:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org Received: from localhost ([::1]:56739 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKURb-0006Xg-V3 for patch@linaro.org; Tue, 05 Jul 2016 13:47:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43035) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKSds-0001q7-Ak for qemu-devel@nongnu.org; Tue, 05 Jul 2016 11:52:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKSdq-0006qE-6R for qemu-devel@nongnu.org; Tue, 05 Jul 2016 11:52:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42787) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKSdj-0006nk-DA; Tue, 05 Jul 2016 11:51:59 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E855160D0; Tue, 5 Jul 2016 15:51:58 +0000 (UTC) Received: from noname.redhat.com (ovpn-116-92.ams2.redhat.com [10.36.116.92]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u65Fp6fs006758; Tue, 5 Jul 2016 11:51:58 -0400 From: Kevin Wolf To: qemu-block@nongnu.org Date: Tue, 5 Jul 2016 17:50:52 +0200 Message-Id: <1467733852-27097-44-git-send-email-kwolf@redhat.com> In-Reply-To: <1467733852-27097-1-git-send-email-kwolf@redhat.com> References: <1467733852-27097-1-git-send-email-kwolf@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 05 Jul 2016 15:51:58 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 43/43] block/qcow2: Don't use cpu_to_*w() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell 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 Message-id: 1466093177-17890-1-git-send-email-peter.maydell@linaro.org Reviewed-by: Eric Blake Signed-off-by: Max Reitz --- block/qcow2-cluster.c | 2 +- block/qcow2-refcount.c | 11 +++++------ block/qcow2.c | 6 +++--- 3 files changed, 9 insertions(+), 10 deletions(-) -- 1.8.3.1 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) {