From nobody Tue Feb 10 04:08:21 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1609857883; cv=none; d=zohomail.com; s=zohoarc; b=Ia/pxnj1V6vFll6fubQOwK9FkXXNPyffOiUEsuidXazETB8+AFwdODgk6O1bGJJLQtJq9vRVV87RYbMR0JYyMAnWLZIq2J+HTK+f2XeJGuyH53t0vnqVSoMleVoMahy05SWCKSfv2zkRnFtxzvwYF5tD3b09MQEnrA8fGv0YjNc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1609857883; 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=s20YU8Lb8TZisUFBkM/7P1zInuG8cyBfJNyDoNhQl+0=; b=TxP0vzgDOdvOJ0kR2JyCoYRr9Cbm/59x0lvJ1VWqLjg4KN+cEe2VROtR4G6/2RFARj+IBjL/26sPdxEB5JNT+gZZRHSOh1m/JBGrK+9su3v1aPXGHe4idYN8NzekdyuvVw9BM44wy1AvXj2YT849rTbbNzjCnQNZtQsLOba2nbY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1609857883556253.83365695112843; Tue, 5 Jan 2021 06:44:43 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-382-NMfo8vOYMnykaFucujhwXQ-1; Tue, 05 Jan 2021 09:44:40 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BE9748030AF; Tue, 5 Jan 2021 14:44:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4CF667092C; Tue, 5 Jan 2021 14:44:33 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B54A6180954D; Tue, 5 Jan 2021 14:44:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 105EiS1N014731 for ; Tue, 5 Jan 2021 09:44:28 -0500 Received: by smtp.corp.redhat.com (Postfix) id 12C502026D3B; Tue, 5 Jan 2021 14:44:28 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0CC0D2026DE8 for ; Tue, 5 Jan 2021 14:44:25 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A6DE9805B03 for ; Tue, 5 Jan 2021 14:44:25 +0000 (UTC) Received: from regular1.263xmail.com (regular1.263xmail.com [211.150.70.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-488-Skpmys9UMJSqBuj8cd-CVA-1; Tue, 05 Jan 2021 09:44:22 -0500 Received: from localhost (unknown [192.168.167.16]) by regular1.263xmail.com (Postfix) with ESMTP id D38EC1D8A for ; Tue, 5 Jan 2021 22:44:15 +0800 (CST) Received: from localhost.localdomain (unknown [14.18.236.70]) by smtp.263.net (postfix) whith ESMTP id P11398T139672637736704S1609857845743456_; Tue, 05 Jan 2021 22:44:16 +0800 (CST) X-MC-Unique: NMfo8vOYMnykaFucujhwXQ-1 X-MC-Unique: Skpmys9UMJSqBuj8cd-CVA-1 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: <2a87fb9a10a43035ecc1319cf66ec61a> X-RL-SENDER: yili@winhong.com X-SENDER: yili@winhong.com X-LOGIN-NAME: yili@winhong.com X-FST-TO: mprivozn@redhat.com X-SENDER-IP: 14.18.236.70 X-ATTACHMENT-NUM: 0 X-System-Flag: 0 From: Yi Li To: mprivozn@redhat.com Subject: [PATCH v2 1/3] createRawFile: remove unused return variable Date: Tue, 5 Jan 2021 22:43:30 +0800 Message-Id: <20210105144332.2605148-2-yili@winhong.com> In-Reply-To: <20210105144332.2605148-1-yili@winhong.com> References: <20210105144332.2605148-1-yili@winhong.com> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 105EiS1N014731 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Yi Li X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" remove unused return variable, The errno will throw by virReportSystemError Signed-off-by: Yi Li --- src/storage/storage_util.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index cf1f33f177..c13abf03af 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -315,7 +315,6 @@ createRawFile(int fd, virStorageVolDefPtr vol, bool reflink_copy) { bool need_alloc =3D true; - int ret =3D 0; unsigned long long pos =3D 0; =20 /* If the new allocation is lower than the capacity of the original fi= le, @@ -327,11 +326,10 @@ createRawFile(int fd, virStorageVolDefPtr vol, /* Seek to the final size, so the capacity is available upfront * for progress reporting */ if (ftruncate(fd, vol->target.capacity) < 0) { - ret =3D -errno; virReportSystemError(errno, _("cannot extend file '%s'"), vol->target.path); - return ret; + return -1; } =20 /* Avoid issues with older kernel's namespace pollution. */ @@ -347,11 +345,10 @@ createRawFile(int fd, virStorageVolDefPtr vol, if (fallocate(fd, 0, 0, vol->target.allocation) =3D=3D 0) { need_alloc =3D false; } else if (errno !=3D ENOSYS && errno !=3D EOPNOTSUPP) { - ret =3D -errno; virReportSystemError(errno, _("cannot allocate %llu bytes in file '%s= '"), vol->target.allocation, vol->target.path); - return ret; + return -1; } } #endif @@ -361,9 +358,9 @@ createRawFile(int fd, virStorageVolDefPtr vol, /* allow zero blocks to be skipped if we've requested sparse * allocation (allocation < capacity) or we have already * been able to allocate the required space. */ - if ((ret =3D virStorageBackendCopyToFD(vol, inputvol, fd, &remain, - !need_alloc, reflink_copy)) <= 0) - return ret; + if (virStorageBackendCopyToFD(vol, inputvol, fd, &remain, + !need_alloc, reflink_copy) < 0) + return -1; =20 /* If the new allocation is greater than the original capacity, * but fallocate failed, fill the rest with zeroes. @@ -373,21 +370,19 @@ createRawFile(int fd, virStorageVolDefPtr vol, =20 if (need_alloc && (vol->target.allocation - pos > 0)) { if (safezero(fd, pos, vol->target.allocation - pos) < 0) { - ret =3D -errno; virReportSystemError(errno, _("cannot fill file '%s'"), vol->target.path); - return ret; + return -1; } } =20 if (g_fsync(fd) < 0) { - ret =3D -errno; virReportSystemError(errno, _("cannot sync data to file '%s'"), vol->target.path); - return ret; + return -1; } =20 - return ret; + return 0; } =20 static int --=20 2.25.3