From nobody Sun Feb 8 01:52:04 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1607961433; cv=none; d=zohomail.com; s=zohoarc; b=VIY6lUgg+qHHCRRAD3KJlUac8/lwpZLAi+vIc9gIvAZr1i4o9+72ahdGZyRKArZcCtsFvq3nJ/nr6WAmD5vEv5Yll1Scc/puhV0Q65YHJrkJEtH5WyaEU/1Un0aqZDEhuj9ju7PKu9HxeP429iTCK+QUzKtLeETQNHaXjvi2UBM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607961433; 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=hM7JwI0QGd6Chw+I0KcdFF+ZvcMN2vw0pO4DJzpt0c8=; b=fPRo9x7gOMginLpwItsRX5X/V2NU5w59DRuUE0Pb9o+c6WAXzGfOO/e0onPn9gJ58nBVQcnXKF9zuhK4ujF9ENeFOsx8AbI6MMRJf93QVtHdkcsPTOj3feA6ZW9elJJHK9y3xuX5WC7PTnmjZ/wONiXCjVaC3kDvSkBD9aeTtzs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1607961433721324.9500211644695; Mon, 14 Dec 2020 07:57:13 -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-483-x_MJSMaWOXeI_159X5ex-A-1; Mon, 14 Dec 2020 10:56:10 -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 F0A11E758; Mon, 14 Dec 2020 15:56:03 +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 C3ACD5D9E3; Mon, 14 Dec 2020 15:56:03 +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 7E80B1809CA4; Mon, 14 Dec 2020 15:56:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0BEFtlvh028536 for ; Mon, 14 Dec 2020 10:55:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id BB47B62688; Mon, 14 Dec 2020 15:55:47 +0000 (UTC) Received: from antique-work.lan (unknown [10.40.194.243]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3880462467 for ; Mon, 14 Dec 2020 15:55:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607961429; 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=hM7JwI0QGd6Chw+I0KcdFF+ZvcMN2vw0pO4DJzpt0c8=; b=ds2ch5bvjnit1X9gN8/M8JO75R9kBbjzoCu1sciKQecPGihtTRSdHGFx5JxNCgRynEFxiJ 5kJuOgAQWijxl6my/pzNN8Rs5AMKKjn/1PQKLP+1SsSjznfULnmjK+CV+3On3AKeH5cw1G RZaakDYxCRoaGEAvuhwKHgyigyyo0MM= X-MC-Unique: x_MJSMaWOXeI_159X5ex-A-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 05/17] util: move virStorageFileCheckCompat into conf Date: Mon, 14 Dec 2020 16:55:25 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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 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 X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" It is not used anywhere else. Signed-off-by: Pavel Hrdina Reviewed-by: Peter Krempa --- src/conf/storage_conf.c | 23 ++++++++++++++++++++++- src/util/virstoragefile.c | 24 ------------------------ src/util/virstoragefile.h | 2 -- 3 files changed, 22 insertions(+), 27 deletions(-) diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index 09769e6c79..0c50529ace 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -1296,6 +1296,27 @@ virStorageSize(const char *unit, } =20 =20 +static int +virStorageCheckCompat(const char *compat) +{ + unsigned int result; + g_auto(GStrv) version =3D NULL; + + if (!compat) + return 0; + + version =3D virStringSplit(compat, ".", 2); + if (!version || !version[1] || + virStrToLong_ui(version[0], NULL, 10, &result) < 0 || + virStrToLong_ui(version[1], NULL, 10, &result) < 0) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("forbidden characters in 'compat' attribute")); + return -1; + } + return 0; +} + + static virStorageVolDefPtr virStorageVolDefParseXML(virStoragePoolDefPtr pool, xmlXPathContextPtr ctxt, @@ -1424,7 +1445,7 @@ virStorageVolDefParseXML(virStoragePoolDefPtr pool, } =20 def->target.compat =3D virXPathString("string(./target/compat)", ctxt); - if (virStorageFileCheckCompat(def->target.compat) < 0) + if (virStorageCheckCompat(def->target.compat) < 0) return NULL; =20 if (virXPathNode("./target/nocow", ctxt)) diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index bc342cabe3..d6ff47e4a7 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -4410,30 +4410,6 @@ virStorageFileGetRelativeBackingPath(virStorageSourc= ePtr top, } =20 =20 -/* - * virStorageFileCheckCompat - */ -int -virStorageFileCheckCompat(const char *compat) -{ - unsigned int result; - g_auto(GStrv) version =3D NULL; - - if (!compat) - return 0; - - version =3D virStringSplit(compat, ".", 2); - if (!version || !version[1] || - virStrToLong_ui(version[0], NULL, 10, &result) < 0 || - virStrToLong_ui(version[1], NULL, 10, &result) < 0) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("forbidden characters in 'compat' attribute")); - return -1; - } - return 0; -} - - /** * virStorageSourceIsRelative: * @src: storage source to check diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h index 31feb22f26..ec34f2d899 100644 --- a/src/util/virstoragefile.h +++ b/src/util/virstoragefile.h @@ -513,8 +513,6 @@ int virStorageFileGetRelativeBackingPath(virStorageSour= cePtr from, char **relpath) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); =20 -int virStorageFileCheckCompat(const char *compat); - int virStorageSourceNewFromBackingAbsolute(const char *path, virStorageSourcePtr *src); =20 --=20 2.28.0