From nobody Sun May 19 01:43:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1582293135; cv=none; d=zohomail.com; s=zohoarc; b=hh8R3VjExSnNC3H3HdatI8/loJxRRpwH/mjHQjkNlVn52qaKvWJV4cxF/i6dC8ydAuZRm4UIbZcqR1EOdKLaU9birhPn9BM5gxzHkTxsKLbKyKQEQZ1XpEx/MJOkWprk8GnPiKNPENgpL5/P9IPDw5+RaXlH33UO3WKUamNXXm0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582293135; h=Content-Type:Content-Transfer-Encoding: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=d6dTQQsHzwd8HsLhFSbCvvo4XeHbD8vyMlDBL/u0h2U=; b=Z7Ze2z3esWAGe2O2iCzIc25m0RjXakh1MU4nZ1XLF8LFQIETfbad3q06qYCwsWqM89wGROnj8Y0Yc3RBPmm/zLVUVtW+5YGVoU6qdVJRXQ9PIHYZ2vjkJ1F80FydZh5Nsl+CfECZyDzuuZ+7uWGk66P8xNhnJU0V/48TEta3CTY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1582293135750137.38245592762507; Fri, 21 Feb 2020 05:52:15 -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-250-zxZ7pSIgMh67S7_jLBAFgQ-1; Fri, 21 Feb 2020 08:52:12 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C661A8048E7; Fri, 21 Feb 2020 13:52:06 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7F14691826; Fri, 21 Feb 2020 13:52:06 +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 A61E735B1F; Fri, 21 Feb 2020 13:52:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01LDpq4J032486 for ; Fri, 21 Feb 2020 08:51:52 -0500 Received: by smtp.corp.redhat.com (Postfix) id DAF925DA8C; Fri, 21 Feb 2020 13:51:52 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 606345DAAC for ; Fri, 21 Feb 2020 13:51:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582293134; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=d6dTQQsHzwd8HsLhFSbCvvo4XeHbD8vyMlDBL/u0h2U=; b=KwgqUWuBMGyvmMM7RIXKdv5zHrzEdtKbfuSAkq34m8mnmhpK+Xx4h2XbsDH7LUEuO0Io7u NVLSq3UXjjUpl/Yo4+WFIKgmOGW1TsUGHyjJrwNSZ3mtcuukEoVC+vqk9egxhdrH0ToJFt /yKbKMekXM4zROQlNjHRsmg5fZpXPFo= X-MC-Unique: zxZ7pSIgMh67S7_jLBAFgQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/7] tests: virstorage: Fix backing file format of created image Date: Fri, 21 Feb 2020 14:51:39 +0100 Message-Id: <88a99f094e5aef9106b9bbda54bdb7852ee14257.1582293053.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" We create some images for testing our code. We've recorded wrong format of the backing file for one of the images though. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/virstoragetest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c index 39040bf4cb..e7794d6168 100644 --- a/tests/virstoragetest.c +++ b/tests/virstoragetest.c @@ -964,7 +964,7 @@ mymain(void) /* Rewrite wrap and qcow2 back to 3-deep chain, absolute backing */ virCommandFree(cmd); cmd =3D virCommandNewArgList(qemuimg, "rebase", "-u", "-f", "qcow2", - "-F", "qcow2", "-b", absraw, "qcow2", NULL); + "-F", "raw", "-b", absraw, "qcow2", NULL); if (virCommandRun(cmd, NULL) < 0) ret =3D -1; --=20 2.24.1 From nobody Sun May 19 01:43:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1582293144; cv=none; d=zohomail.com; s=zohoarc; b=OqF4fI59wu1X/AtLCmbkPAMrD4DjtnZAM7FEbIQ3+l7xWRt2uJDhOPJX76NhvafPOOAtG2rOQsYep5GE0zVj4Wt2rk542XHfml+wW8A0fpF3TY99BSHTzGkG4jTA4/ZxcE/+FVlISWAiGUG9M2X+fc2k2dSw2XM0TIGLusnpB90= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582293144; h=Content-Type:Content-Transfer-Encoding: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=PDl7f08K/NTdb+8C7ZtwrqsNRLsIeG7Fy+sdiRUjYrU=; b=khFHCzsH9JuaYLDROQ3aC3gE7CwSdyAKWvFjjfGQdyo0HBq5yHpD+7l9dR/e+GRIRWt3SGfE2BcK1rjrCwyvGBeyE9HOfSiDYHOqC+SrBh2cWO/fOaZQ24bVWBDU8WDBwpIZowftsMeIgPogZCvTBHBlNTQFRC+gWOrFE0vkgD0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1582293144649100.4436969548268; Fri, 21 Feb 2020 05:52:24 -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-346-wHB_FOjYNOO6Nh94jUn98w-1; Fri, 21 Feb 2020 08:52:21 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7A1E51083EA0; Fri, 21 Feb 2020 13:52:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4ED275D9C5; Fri, 21 Feb 2020 13:52:15 +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 F11D081759; Fri, 21 Feb 2020 13:52:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01LDprV6032491 for ; Fri, 21 Feb 2020 08:51:53 -0500 Received: by smtp.corp.redhat.com (Postfix) id BFC255DA7B; Fri, 21 Feb 2020 13:51:53 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 44DDD5DE52 for ; Fri, 21 Feb 2020 13:51:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582293143; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=PDl7f08K/NTdb+8C7ZtwrqsNRLsIeG7Fy+sdiRUjYrU=; b=Az85uB6VFVijM9MQXjUZNSdZX4Vv/vrwR0EY6QlD+SNuMug4Arnv/gv7VKtsGBxpU2L/ZS q0qjmREVlAlrqviv1+5dRQ8Jgz0XcWF8L0hVuGFEVYjGjwshuYB95hSh/6wA4JiMeiRwWS /JPPI+4fh8UkLvEjylO2I1Nd/u+QUbg= X-MC-Unique: wHB_FOjYNOO6Nh94jUn98w-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/7] virStorageSourceUpdateCapacity: Drop 'probe' argument Date: Fri, 21 Feb 2020 14:51:40 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Both callers pass false. Since we frown upon format probing, remove the unused possibility to do the probing. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 2 +- src/storage/storage_util.c | 2 +- src/util/virstoragefile.c | 23 ++++++----------------- src/util/virstoragefile.h | 3 +-- 4 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 39e1f044e0..943caea011 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -12269,7 +12269,7 @@ qemuStorageLimitsRefresh(virQEMUDriverPtr driver, if (virStorageSourceUpdateBackingSizes(src, fd, &sb) < 0) goto cleanup; - if (virStorageSourceUpdateCapacity(src, buf, len, false) < 0) + if (virStorageSourceUpdateCapacity(src, buf, len) < 0) goto cleanup; /* If guest is not using raw disk format and is on a host block diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index c2754dbb93..8199c7a2af 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -1756,7 +1756,7 @@ storageBackendUpdateVolTargetInfo(virStorageVolType v= oltype, } } - if (virStorageSourceUpdateCapacity(target, buf, len, false) < 0) + if (virStorageSourceUpdateCapacity(target, buf, len) < 0) return -1; } diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index b984204b93..cc351e3f53 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -3964,18 +3964,15 @@ virStorageSourceUpdateBackingSizes(virStorageSource= Ptr src, * @src: disk source definition structure * @buf: buffer to the storage file header * @len: length of the storage file header - * @probe: allow probe * - * Update the storage @src capacity. This may involve probing the storage - * @src in order to "see" if we can recognize what exists. + * Update the storage @src capacity. * * Returns 0 on success, -1 on error. */ int virStorageSourceUpdateCapacity(virStorageSourcePtr src, char *buf, - ssize_t len, - bool probe) + ssize_t len) { int format =3D src->format; g_autoptr(virStorageSource) meta =3D NULL; @@ -3984,18 +3981,10 @@ virStorageSourceUpdateCapacity(virStorageSourcePtr = src, * the metadata has a capacity, use that, otherwise fall back to * physical size. */ if (format =3D=3D VIR_STORAGE_FILE_NONE) { - if (!probe) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("no disk format for %s and probing is disable= d"), - src->path); - return -1; - } - - if ((format =3D virStorageFileProbeFormatFromBuf(src->path, - buf, len)) < 0) - return -1; - - src->format =3D format; + virReportError(VIR_ERR_INTERNAL_ERROR, + _("no disk format for %s was specified"), + src->path); + return -1; } if (format =3D=3D VIR_STORAGE_FILE_RAW && !src->encryption) { diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index 1f41e6e357..2a684fd746 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -472,8 +472,7 @@ int virStorageSourceUpdatePhysicalSize(virStorageSource= Ptr src, int virStorageSourceUpdateBackingSizes(virStorageSourcePtr src, int fd, struct stat const *sb); int virStorageSourceUpdateCapacity(virStorageSourcePtr src, - char *buf, ssize_t len, - bool probe); + char *buf, ssize_t len); int virStorageSourceNewFromBacking(virStorageSourcePtr parent, virStorageSourcePtr *backing); --=20 2.24.1 From nobody Sun May 19 01:43:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1582293149; cv=none; d=zohomail.com; s=zohoarc; b=QYz7TtBSbV+3+neVspqX+CRtfk3wtC/sghOsMRyEwqJdw1DRS3r0z/wbQDXNagcwywvROS2W1MyjftS3UgmBwYY3PK+7dxp2KssS6JKxRyxRz8NJiZMVmmHtBr1acuf6YzQMgrzCBeJ/2CzWct6L4v8cxQioZEa6gSEg4K9ywJ8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582293149; h=Content-Type:Content-Transfer-Encoding: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=0dbdS7/pMB2Hb9FXhoKnledL44mZPwTBWSl1gYwH338=; b=NoRCzKXUjFERz713J+eBpc7HsWKc4MWXX/jXyUniPBTgc9vJ2u2LkQhvhI08eUUYL3yMVDZsQjANiQC3vDdQfuZ+A+HgOIRiiAF++0GW2OKuTW6bgg2141yUewpCXhem99p3hdJxMAhiBcJln6lZSgsbdQRF33URALDeerHZ2TM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1582293149449669.0236106443883; Fri, 21 Feb 2020 05:52:29 -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-304-iTfAqKFNOeWLN_YrrJdjLw-1; Fri, 21 Feb 2020 08:52:26 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C16F618CA26D; Fri, 21 Feb 2020 13:52:20 +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 9C8EF84BCC; Fri, 21 Feb 2020 13:52:20 +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 4EFB51832DAA; Fri, 21 Feb 2020 13:52:20 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01LDptea032502 for ; Fri, 21 Feb 2020 08:51:55 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8FD5F5D9C5; Fri, 21 Feb 2020 13:51:55 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 13CED5DA7C for ; Fri, 21 Feb 2020 13:51:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582293148; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=0dbdS7/pMB2Hb9FXhoKnledL44mZPwTBWSl1gYwH338=; b=S9YZxCcznNGsm78BYm7POYdXaI6g5WediSDJSF6JQED0CkMT4k+QUSDgmf7nqy93k5GmkH dmzrbImsqXjsrpuLvCEubD7stX8+AYWRMHj7NQk5jV/oWfGjsXQ6SfvyAYCPHX6yg446Qk 5PlXdo75xyGsvDH4rVuC58mZn3P/ZqE= X-MC-Unique: iTfAqKFNOeWLN_YrrJdjLw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/7] util: storage: Store backing store format in virStorageSource Date: Fri, 21 Feb 2020 14:51:41 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" We store the backing file string in the structure so we should also store the format so that callers can be simplified. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/util/virstoragefile.c | 35 +++++++++++++++++------------------ src/util/virstoragefile.h | 1 + 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index cc351e3f53..2d8fe59c25 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -935,15 +935,11 @@ virStorageFileGetEncryptionPayloadOffset(const struct= FileEncryptionInfo *info, static int virStorageFileGetMetadataInternal(virStorageSourcePtr meta, char *buf, - size_t len, - int *backingFormat) + size_t len) { - int dummy; + int format; size_t i; - if (!backingFormat) - backingFormat =3D &dummy; - VIR_DEBUG("path=3D%s, buf=3D%p, len=3D%zu, meta->format=3D%d", meta->path, buf, len, meta->format); @@ -1009,8 +1005,10 @@ virStorageFileGetMetadataInternal(virStorageSourcePt= r meta, VIR_FREE(meta->backingStoreRaw); if (fileTypeInfo[meta->format].getBackingStore !=3D NULL) { int store =3D fileTypeInfo[meta->format].getBackingStore(&meta->ba= ckingStoreRaw, - backingForm= at, + &format, buf, len); + meta->backingStoreRawFormat =3D format; + if (store =3D=3D BACKING_STORE_INVALID) return 0; @@ -1135,20 +1133,18 @@ virStorageFileGetMetadataFromBuf(const char *path, int *backingFormat) { virStorageSourcePtr ret =3D NULL; - int dummy; - - if (!backingFormat) - backingFormat =3D &dummy; if (!(ret =3D virStorageFileMetadataNew(path, format))) return NULL; - if (virStorageFileGetMetadataInternal(ret, buf, len, - backingFormat) < 0) { + if (virStorageFileGetMetadataInternal(ret, buf, len) < 0) { virObjectUnref(ret); return NULL; } + if (backingFormat) + *backingFormat =3D ret->backingStoreRawFormat; + return ret; } @@ -1211,9 +1207,12 @@ virStorageFileGetMetadataFromFD(const char *path, return NULL; } - if (virStorageFileGetMetadataInternal(meta, buf, len, backingFormat) <= 0) + if (virStorageFileGetMetadataInternal(meta, buf, len) < 0) return NULL; + if (backingFormat) + *backingFormat =3D meta->backingStoreRawFormat; + if (S_ISREG(sb.st_mode)) meta->type =3D VIR_STORAGE_TYPE_FILE; else if (S_ISBLK(sb.st_mode)) @@ -2293,6 +2292,7 @@ virStorageSourceCopy(const virStorageSource *src, def->volume =3D g_strdup(src->volume); def->relPath =3D g_strdup(src->relPath); def->backingStoreRaw =3D g_strdup(src->backingStoreRaw); + def->backingStoreRawFormat =3D src->backingStoreRawFormat; def->externalDataStoreRaw =3D g_strdup(src->externalDataStoreRaw); def->snapshot =3D g_strdup(src->snapshot); def->configFile =3D g_strdup(src->configFile); @@ -5000,7 +5000,6 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr = src, unsigned int depth) { size_t headerLen; - int backingFormat; int rv; g_autofree char *buf =3D NULL; g_autoptr(virStorageSource) backingStore =3D NULL; @@ -5018,7 +5017,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr = src, &buf, &headerLen, cycle= ) < 0) return -1; - if (virStorageFileGetMetadataInternal(src, buf, headerLen, &backingFor= mat) < 0) + if (virStorageFileGetMetadataInternal(src, buf, headerLen) < 0) return -1; if (src->backingStoreRaw) { @@ -5029,7 +5028,7 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr = src, if (rv =3D=3D 1) return 0; - backingStore->format =3D backingFormat; + backingStore->format =3D src->backingStoreRawFormat; if (backingStore->format =3D=3D VIR_STORAGE_FILE_AUTO) { /* Assuming the backing store to be raw can lead to failures. = We do @@ -5180,7 +5179,7 @@ virStorageFileGetBackingStoreStr(virStorageSourcePtr = src, if (!(tmp =3D virStorageSourceCopy(src, false))) return -1; - if (virStorageFileGetMetadataInternal(tmp, buf, headerLen, NULL) < 0) + if (virStorageFileGetMetadataInternal(tmp, buf, headerLen) < 0) return -1; *backing =3D g_steal_pointer(&tmp->backingStoreRaw); diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index 2a684fd746..ecba418bb3 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -330,6 +330,7 @@ struct _virStorageSource { /* Name of the child backing store recorded in metadata of the * current file. */ char *backingStoreRaw; + virStorageFileFormat backingStoreRawFormat; /* Name of the child data file recorded in metadata of the current fil= e. */ char *externalDataStoreRaw; --=20 2.24.1 From nobody Sun May 19 01:43:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1582293144; cv=none; d=zohomail.com; s=zohoarc; b=W4AijKKsQvwIzHSZwfXJJMZTFnf53HUWTyZVjXwmNKwavTGOxfoQjMdXFFVQP3Jq5Opj0hsSrPwOluivXD6IcFCff/SejxKlsdfqTa0wOT7qAkTzEf9sg5DwlGKe4/+MuhAqTmbz+zSTnDg1loueSVOjnKlwALci1UOpeSMWPbk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582293144; h=Content-Type:Content-Transfer-Encoding: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=cOZyN8yYENfL28j7yRnbH6bP/WCKPLG/ZPYCF97JY7k=; b=dXUvH9RcsngYsLuZ/QJXsyB4uZGFFVQ5HdRHIB9GZFAutzMCX8vPFDD46n0tkpiy7/JLm6Ghqn+beaeMe0tX0XlpkGyxi7e/FEljzSiFqdEEvI31AIuTYng4OH7h3sTtGvRzxbP2ljG84DCC4+EjBmwu7DYtSo7jqJe7RFP2CvM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1582293144574165.23613353687847; Fri, 21 Feb 2020 05:52:24 -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-14-ciI4d51UMiSfZ8OM770JPw-1; Fri, 21 Feb 2020 08:52:20 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 67B4B14E3; Fri, 21 Feb 2020 13:52:15 +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 3393091833; Fri, 21 Feb 2020 13:52:15 +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 E18F61832DA3; Fri, 21 Feb 2020 13:52:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01LDpvwK032515 for ; Fri, 21 Feb 2020 08:51:57 -0500 Received: by smtp.corp.redhat.com (Postfix) id 901655E7D4; Fri, 21 Feb 2020 13:51:57 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0719B5D9C5 for ; Fri, 21 Feb 2020 13:51:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582293143; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=cOZyN8yYENfL28j7yRnbH6bP/WCKPLG/ZPYCF97JY7k=; b=BMc+5RGbu3S3raquTvW/9tF8yZRAuapyRg47sPNysIb2v6s2e4aT2fA7O58EtQNz8iOq6Y 42JCH/G3dd+BKOF70pX3f9z2LdbPQaPAGUW1iNERgi30ZHZ3XQErApialWm1OhI42EcQCD lD7xrGjap+4qomR5rM/9SSwGxyy4xKg= X-MC-Unique: ciI4d51UMiSfZ8OM770JPw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 4/7] virStorageSourceNewFromBacking: Also transfer the format Date: Fri, 21 Feb 2020 14:51:42 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" When we create the new virStorageSource from the definitions stored in the parent we should also use the 'backingStoreRawFormat' field to populate the format. Callers which use virStorageSourceNewFromBacking are also fixed to stop setting the format manually. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/storage/storage_util.c | 5 +---- src/util/virstoragefile.c | 3 +-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index 8199c7a2af..f71abbd729 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -3329,7 +3329,6 @@ static int storageBackendProbeTarget(virStorageSourcePtr target, virStorageEncryptionPtr *encryption) { - int backingStoreFormat; int rc; struct stat sb; g_autoptr(virStorageSource) meta =3D NULL; @@ -3360,15 +3359,13 @@ storageBackendProbeTarget(virStorageSourcePtr targe= t, if (!(meta =3D virStorageFileGetMetadataFromFD(target->path, fd, VIR_STORAGE_FILE_AUTO, - &backingStoreFormat))) + NULL))) return -1; if (meta->backingStoreRaw) { if (virStorageSourceNewFromBacking(meta, &target->backingStore) < = 0) return -1; - target->backingStore->format =3D backingStoreFormat; - /* XXX: Remote storage doesn't play nicely with volumes backed by * remote storage. To avoid trouble, just fake the backing store i= s RAW * and put the string from the metadata as the path of the target.= */ diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 2d8fe59c25..6fddc0610e 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -3824,6 +3824,7 @@ virStorageSourceNewFromBacking(virStorageSourcePtr pa= rent, backing)) < 0) return rc; + (*backing)->format =3D parent->backingStoreRawFormat; (*backing)->readonly =3D true; return rc; } @@ -5028,8 +5029,6 @@ virStorageFileGetMetadataRecurse(virStorageSourcePtr = src, if (rv =3D=3D 1) return 0; - backingStore->format =3D src->backingStoreRawFormat; - if (backingStore->format =3D=3D VIR_STORAGE_FILE_AUTO) { /* Assuming the backing store to be raw can lead to failures. = We do * it only when we must not report an error to prevent losing = VMs. --=20 2.24.1 From nobody Sun May 19 01:43:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1582293188; cv=none; d=zohomail.com; s=zohoarc; b=H61dBJ7HiI7LP2aEzcwLUgseYFT9Ny82MMOEK7Tka0WKhn+UJty4fsrEy96bhUsg0w9nWIhapbWMpKgrlu6ZprmEc/NeLyNNyBTYNmtpRr7hIvD5pcUURMWtV1Mjd0yxxDoKME009/2HOhpfHKnlyvXjcBXJT6+PsYxI26lqcjc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582293188; h=Content-Type:Content-Transfer-Encoding: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=hX2HLxR2ik2It/ISfXiGsO3ff6fZLDPlTKNdblNyFE0=; b=M3UkDawblPcP47/Hu2fhpxWGDplaAGocxyY8cRzY2eRefOuXC6Iv9ueV35ZxEMVBMoeFnjKuGlv2WfhytffYZuCObuXpzeB9Gt6xeHnoNC8Hp0EbTKKUXW9BjyE4Y78RBGFASkuFxOqeNMIGK6tYAogOqy7rxe/jL+NwAkVfrvQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1582293188863500.4903081230668; Fri, 21 Feb 2020 05:53:08 -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-21-ml8APCd3MjeMLCyibfvnfQ-1; Fri, 21 Feb 2020 08:52:31 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5D850108444F; Fri, 21 Feb 2020 13:52:25 +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 334E45DA7B; Fri, 21 Feb 2020 13:52:25 +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 DF8671832DAD; Fri, 21 Feb 2020 13:52:24 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01LDpwJj032522 for ; Fri, 21 Feb 2020 08:51:58 -0500 Received: by smtp.corp.redhat.com (Postfix) id 578C55DA76; Fri, 21 Feb 2020 13:51:58 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id D28F65D9C5 for ; Fri, 21 Feb 2020 13:51:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582293185; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=hX2HLxR2ik2It/ISfXiGsO3ff6fZLDPlTKNdblNyFE0=; b=e5D6fLwNQ5NZltJDzWIQ5xUzqR4SlSQGHkGjq84iihYNUQglnIAiA8amtkPtHHsQGPx7/c uUcecG1Fsi3TlYur5u3RLDrGUjVuIafVFvOIZESppzt4Bnyh4KIQ4AumrolA8dIBQaCpIe oZwvMPwGXAe1/IzHrxsX2cQg6dSyQAU= X-MC-Unique: ml8APCd3MjeMLCyibfvnfQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 5/7] virStorageBackendGlusterRefreshVol: Refactor handling of backing store Date: Fri, 21 Feb 2020 14:51:43 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Take the format of the backing store from the 'meta' object directly and use g_steal_pointer go steal the path. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/storage/storage_backend_gluster.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_ba= ckend_gluster.c index 4a8ee3870d..e92e9612bd 100644 --- a/src/storage/storage_backend_gluster.c +++ b/src/storage/storage_backend_gluster.c @@ -224,7 +224,6 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlu= sterStatePtr state, int ret =3D -1; glfs_fd_t *fd =3D NULL; ssize_t len; - int backingFormat; g_autoptr(virStorageVolDef) vol =3D NULL; g_autoptr(virStorageSource) meta =3D NULL; g_autofree char *header =3D NULL; @@ -277,7 +276,7 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlu= sterStatePtr state, if (!(meta =3D virStorageFileGetMetadataFromBuf(name, header, len, VIR_STORAGE_FILE_AUTO, - &backingFormat))) + NULL))) goto cleanup; if (meta->backingStoreRaw) { @@ -286,13 +285,11 @@ virStorageBackendGlusterRefreshVol(virStorageBackendG= lusterStatePtr state, vol->target.backingStore->type =3D VIR_STORAGE_TYPE_NETWORK; - vol->target.backingStore->path =3D meta->backingStoreRaw; + vol->target.backingStore->path =3D g_steal_pointer(&meta->backingS= toreRaw); + vol->target.backingStore->format =3D meta->backingStoreRawFormat; - if (backingFormat < 0) + if (vol->target.backingStore->format < 0) vol->target.backingStore->format =3D VIR_STORAGE_FILE_RAW; - else - vol->target.backingStore->format =3D backingFormat; - meta->backingStoreRaw =3D NULL; } vol->target.format =3D meta->format; --=20 2.24.1 From nobody Sun May 19 01:43:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1582293149; cv=none; d=zohomail.com; s=zohoarc; b=F/0Eu+e9k2XyeRgmwu9yBgBwXrbtv6dR8pwPzCGwARH9OicCUJ37VLwgbpKWqFRotp3QoAhK4KwLAU2Thz8HkqGBudhllNkvDKpbSJ5gcMciTR3gQisphPVInsuqY3vxWw1u/ApX0qLTbvnI1vHsEu7g6szo9QQr+eG5nZVL2Dk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582293149; h=Content-Type:Content-Transfer-Encoding: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=OYl8TDHBKkKH2BARbHwoSkIkhpnQPUmKCVBCJRBktZw=; b=Hxr4aXKqsRaxnLlXUp3kzb8VtcDauvUYnpN3dtoiaybtUGi+ZheI/4gnE+Jh0A3qiaRH8NDNfCW14BumwkHanZQKuvvHIh984jD2xe84GVzvH7UQhcz5lHExS9rzCussPw5asFkG916I5XBdzghUu7q/WrLbzyfJ1cptji0gjWg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1582293149278918.0541240239448; Fri, 21 Feb 2020 05:52:29 -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-481-G34tyQYfM02vBL7VJijhkw-1; Fri, 21 Feb 2020 08:52:25 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1807E802B67; Fri, 21 Feb 2020 13:52:20 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DB59360C99; Fri, 21 Feb 2020 13:52:19 +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 8D82E35B1F; Fri, 21 Feb 2020 13:52:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01LDpx1b032530 for ; Fri, 21 Feb 2020 08:51:59 -0500 Received: by smtp.corp.redhat.com (Postfix) id 2E2335D9C5; Fri, 21 Feb 2020 13:51:59 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id A715C5DA76 for ; Fri, 21 Feb 2020 13:51:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582293148; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=OYl8TDHBKkKH2BARbHwoSkIkhpnQPUmKCVBCJRBktZw=; b=P1FQig1cSkNBov5ncstniLmCk3DwCkyohIC7sSnZYWvE0+KIEuCyXkfZIeD3cXBBr5bIvc thoOeJfFPP5m11qXddjfLzSH1UY3UHeK0JpLo4E3sMAFdfmeh2Q7Ck6B7EYTmx9zW/D/09 8og+7ohanAeoG35NVFkr5tylceZLp1o= X-MC-Unique: G34tyQYfM02vBL7VJijhkw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 6/7] virStorageFileGetMetadataFromBuf: Remove 'backingFormat' argument Date: Fri, 21 Feb 2020 14:51:44 +0100 Message-Id: <740656e71a44365f516c72b1538824007766d37c.1582293053.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" None of the callers actually use it. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/storage/storage_backend_gluster.c | 3 +-- src/util/virstoragefile.c | 16 ++++++---------- src/util/virstoragefile.h | 3 +-- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/storage/storage_backend_gluster.c b/src/storage/storage_ba= ckend_gluster.c index e92e9612bd..db3df82aad 100644 --- a/src/storage/storage_backend_gluster.c +++ b/src/storage/storage_backend_gluster.c @@ -275,8 +275,7 @@ virStorageBackendGlusterRefreshVol(virStorageBackendGlu= sterStatePtr state, goto cleanup; if (!(meta =3D virStorageFileGetMetadataFromBuf(name, header, len, - VIR_STORAGE_FILE_AUTO, - NULL))) + VIR_STORAGE_FILE_AUTO))) goto cleanup; if (meta->backingStoreRaw) { diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 6fddc0610e..94805e8741 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -1109,7 +1109,6 @@ virStorageFileMetadataNew(const char *path, * @buf: header bytes from @path * @len: length of @buf * @format: format of the storage file - * @backingFormat: format of @backing * * Extract metadata about the storage volume with the specified image form= at. * If image format is VIR_STORAGE_FILE_AUTO, it will probe to automatically @@ -1119,9 +1118,10 @@ virStorageFileMetadataNew(const char *path, * that might be raw if that file will then be passed to a guest, since a * malicious guest can turn a raw file into any other non-raw format at wi= ll. * - * If the returned @backingFormat is VIR_STORAGE_FILE_AUTO it indicates the - * image didn't specify an explicit format for its backing store. Callers = are - * advised against probing for the backing store format in this case. + * If the 'backingStoreRawFormat' field of the returned structure is + * VIR_STORAGE_FILE_AUTO it indicates the image didn't specify an explicit + * format for its backing store. Callers are advised against probing for t= he + * backing store format in this case. * * Caller MUST free the result after use via virObjectUnref. */ @@ -1129,8 +1129,7 @@ virStorageSourcePtr virStorageFileGetMetadataFromBuf(const char *path, char *buf, size_t len, - int format, - int *backingFormat) + int format) { virStorageSourcePtr ret =3D NULL; @@ -1142,9 +1141,6 @@ virStorageFileGetMetadataFromBuf(const char *path, return NULL; } - if (backingFormat) - *backingFormat =3D ret->backingStoreRawFormat; - return ret; } @@ -3991,7 +3987,7 @@ virStorageSourceUpdateCapacity(virStorageSourcePtr sr= c, if (format =3D=3D VIR_STORAGE_FILE_RAW && !src->encryption) { src->capacity =3D src->physical; } else if ((meta =3D virStorageFileGetMetadataFromBuf(src->path, buf, - len, format, NULL)= )) { + len, format))) { src->capacity =3D meta->capacity ? meta->capacity : src->physical; if (src->encryption && meta->encryption) src->encryption->payload_offset =3D meta->encryption->payload_= offset; diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index ecba418bb3..32f2c82147 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -386,8 +386,7 @@ virStorageSourcePtr virStorageFileGetMetadataFromFD(con= st char *path, virStorageSourcePtr virStorageFileGetMetadataFromBuf(const char *path, char *buf, size_t len, - int format, - int *backingFormat) + int format) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); int virStorageFileChainGetBroken(virStorageSourcePtr chain, char **broken_file); --=20 2.24.1 From nobody Sun May 19 01:43:00 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1582293189; cv=none; d=zohomail.com; s=zohoarc; b=Cdjg+OrUzUd1VWTYKviw/21Qd6C97ITHKcLUTIL8A5VRxynmNYE9rFUc8ca9buu6lkCyzDlpebiCHGwaTowqpBK1tEhzIF5YWkewjYBeobagFdOIr7sUdp/hew6ZBmD6d1gXLvdjM4Vx4qW/07ALCvvrTxnfOu2wyUdYd6lpPqk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1582293189; h=Content-Type:Content-Transfer-Encoding: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=ZS2vQmhXmix5XL8zR+/uLu7+3R7wn0fhdeGzAAerseM=; b=Hz/EzJVc9mLm+MTbQ7axyLiuc8t/y4eUNhnHU35kbj8bM8tHjtDM+Re+94A/oSn7CAeM0qS9x7Ytlrl5+L4dSfFyFMZkTAYuFc+I+BftvtChHKKHR6fz69+R2qDyn59mlbbEva/8zuM7DDWLtCaTZ8tD+ZFVE74MyzahMez8QiU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1582293189028570.4455617954003; Fri, 21 Feb 2020 05:53:09 -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-168-r3fjPtW7N-Kv-VCcPO3fxQ-1; Fri, 21 Feb 2020 08:52:34 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 199A2801FC7; Fri, 21 Feb 2020 13:52:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E6A078B57D; Fri, 21 Feb 2020 13:52:28 +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 900C0860CA; Fri, 21 Feb 2020 13:52:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 01LDq0cq032544 for ; Fri, 21 Feb 2020 08:52:00 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5A9895D9C5; Fri, 21 Feb 2020 13:52:00 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id D5D8A5DA7B for ; Fri, 21 Feb 2020 13:51:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582293184; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ZS2vQmhXmix5XL8zR+/uLu7+3R7wn0fhdeGzAAerseM=; b=XZuYwHrcZmbLgVSr7gFsbuZk5+COJX+5ZAMfz+v2WaL4s2WNrd1ICosdYrmUTI/vCkcjof OYqkGhWXXBtkb8ubd8yigd9Wah6+xvpO7CvZd17/BBOBqn9HVGWA41ytMoj4pqtpBIo0Be zfWF1y0s0prCtuFZWH3XO4lZTmoP7xw= X-MC-Unique: r3fjPtW7N-Kv-VCcPO3fxQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 7/7] virStorageFileGetMetadataFromFD: Remove unused 'backingFormat' argument Date: Fri, 21 Feb 2020 14:51:45 +0100 Message-Id: <1c1f5a53f74fd0c4e1e5c2518ce1f1d7fc1059f6.1582293053.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com 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.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/storage/storage_util.c | 3 +-- src/util/virstoragefile.c | 12 +----------- src/util/virstoragefile.h | 3 +-- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c index f71abbd729..8e43c7868d 100644 --- a/src/storage/storage_util.c +++ b/src/storage/storage_util.c @@ -3358,8 +3358,7 @@ storageBackendProbeTarget(virStorageSourcePtr target, if (!(meta =3D virStorageFileGetMetadataFromFD(target->path, fd, - VIR_STORAGE_FILE_AUTO, - NULL))) + VIR_STORAGE_FILE_AUTO))) return -1; if (meta->backingStoreRaw) { diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index 94805e8741..d5ac5970f1 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -1161,21 +1161,14 @@ virStorageFileGetMetadataFromBuf(const char *path, virStorageSourcePtr virStorageFileGetMetadataFromFD(const char *path, int fd, - int format, - int *backingFormat) + int format) { ssize_t len =3D VIR_STORAGE_MAX_HEADER; struct stat sb; - int dummy; g_autofree char *buf =3D NULL; g_autoptr(virStorageSource) meta =3D NULL; - if (!backingFormat) - backingFormat =3D &dummy; - - *backingFormat =3D VIR_STORAGE_FILE_NONE; - if (fstat(fd, &sb) < 0) { virReportSystemError(errno, _("cannot stat file '%s'"), path); @@ -1206,9 +1199,6 @@ virStorageFileGetMetadataFromFD(const char *path, if (virStorageFileGetMetadataInternal(meta, buf, len) < 0) return NULL; - if (backingFormat) - *backingFormat =3D meta->backingStoreRawFormat; - if (S_ISREG(sb.st_mode)) meta->type =3D VIR_STORAGE_TYPE_FILE; else if (S_ISBLK(sb.st_mode)) diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index 32f2c82147..5b995d54ab 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -381,8 +381,7 @@ int virStorageFileProbeFormat(const char *path, uid_t u= id, gid_t gid); virStorageSourcePtr virStorageFileGetMetadataFromFD(const char *path, int fd, - int format, - int *backingFormat); + int format); virStorageSourcePtr virStorageFileGetMetadataFromBuf(const char *path, char *buf, size_t len, --=20 2.24.1