From nobody Sun May 12 02:22:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1597801041; cv=none; d=zohomail.com; s=zohoarc; b=CSOtZA4A2a4sAlv5NwtJqs5me50XcD2zfc/5JP3qJAYHDmvyZooea+pomq9ynrOThos/vQFpHTLwWZlE6uKrD3PUODAyTug4aOeLOJ1zP/wfeS10XGJoKYxo+MZNc7PiXwzu+hfdz5vlSs6xPjBXUzHTJbRQl+o1PDZ2/U6ZwdA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597801041; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=TieTCKPRLY6ztzdnUo0ffDZskgbIgRhxiwYlorIOoyY=; b=bIpaXxdVBk+Zv2kYN9qlxXz/T38gNzFRxKvS9drJFroN7OWZMEzLSk2le19fTZEf1pvHXvgG1mfZJTKZqooi9g2uvAQPU7EIOOmAUeA+YwtZVFFgub+iULuxVwZ55TNbe5CFVPu6GmuxRtXFXr6jeeobO11l2DwceFFW9O2a6oY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1597801041497431.4654026363878; Tue, 18 Aug 2020 18:37:21 -0700 (PDT) Received: from localhost ([::1]:40862 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8D2W-0007nK-4c for importer@patchew.org; Tue, 18 Aug 2020 21:37:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35440) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8D1v-0007IH-Tv; Tue, 18 Aug 2020 21:36:43 -0400 Received: from regular1.263xmail.com ([211.150.70.203]:57502) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8D1s-0002VH-9d; Tue, 18 Aug 2020 21:36:43 -0400 Received: from localhost (unknown [192.168.167.16]) by regular1.263xmail.com (Postfix) with ESMTP id 6A252776; Wed, 19 Aug 2020 09:36:25 +0800 (CST) Received: from localhost.localdomain (unknown [14.18.236.70]) by smtp.263.net (postfix) whith ESMTP id P25960T140259931186944S1597800969397832_; Wed, 19 Aug 2020 09:36:15 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-SKE-CHECKED: 1 X-ABS-CHECKED: 1 X-IP-DOMAINF: 1 X-UNIQUE-TAG: X-RL-SENDER: yili@winhong.com X-SENDER: yili@winhong.com X-LOGIN-NAME: yili@winhong.com X-FST-TO: qemu-block@nongnu.org X-SENDER-IP: 14.18.236.70 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Yi Li To: qemu-block@nongnu.org, mreitz@redhat.com, sgarzare@redhat.com Subject: [PATCH v2] qemu-img: Explicit number replaced by a constant Date: Wed, 19 Aug 2020 09:36:07 +0800 Message-Id: <20200819013607.32280-1-yili@winhong.com> X-Mailer: git-send-email 2.25.3 In-Reply-To: <0107e40a-1d96-fa3d-bd15-019c004d0353@redhat.com> References: <0107e40a-1d96-fa3d-bd15-019c004d0353@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=211.150.70.203; envelope-from=yili@winhong.com; helo=regular1.263xmail.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/18 21:36:27 X-ACL-Warn: Detected OS = ??? X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, yilikernel@gmail.com, qemu-devel@nongnu.org, yili@winhong.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Signed-off-by: Yi Li Reviewed-by: Alberto Garcia Reviewed-by: Stefano Garzarella --- qemu-img.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index 5308773811..aa2e31c8ae 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -1200,10 +1200,10 @@ static int is_allocated_sectors(const uint8_t *buf,= int n, int *pnum, *pnum =3D 0; return 0; } - is_zero =3D buffer_is_zero(buf, 512); + is_zero =3D buffer_is_zero(buf, BDRV_SECTOR_SIZE); for(i =3D 1; i < n; i++) { - buf +=3D 512; - if (is_zero !=3D buffer_is_zero(buf, 512)) { + buf +=3D BDRV_SECTOR_SIZE; + if (is_zero !=3D buffer_is_zero(buf, BDRV_SECTOR_SIZE)) { break; } } @@ -2489,8 +2489,8 @@ static int img_convert(int argc, char **argv) } } =20 - qemu_opt_set_number(opts, BLOCK_OPT_SIZE, s.total_sectors * 512, - &error_abort); + qemu_opt_set_number(opts, BLOCK_OPT_SIZE, + s.total_sectors * BDRV_SECTOR_SIZE, &error_abo= rt); ret =3D add_old_style_options(out_fmt, opts, out_baseimg, NULL); if (ret < 0) { goto out; --=20 2.25.3