From nobody Sun May 19 02:38:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1604565750; cv=none; d=zohomail.com; s=zohoarc; b=m4i63gshLIkXTfhnZGSV9DwrPAnEBcmUOAbvEGBfgxIRsj75AvZlxithCGyrYOB9mScUO34LO7r/9sRi5yx/H/DsCAY/HbkqLInxYTfXgP2FoyTk9pqrZuKcJj/27KypcVA7G4A92MxmhShnnx13pITYruxxwOH/DNb/3LrvdQM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604565750; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=V6BFMZQqIjh79Hr33h/RqCf9MmONsCeYxYsmLOX6anM=; b=j6zlFfpi2CyP2kiv8v8yDXj8zRrnsIAluE8TvjTjFvr4/i65xROgVv3m78NcUUH2MAndeXD4BCFRyxwyJtij55QIJ8xlN2W7kNUgJyJrYk9aA5/HTViZyP83Zii/kQQ8OaBXz6FqvkHdAnrsQhYyefFwPdzJPeAm9X1fbuBOZwM= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1604565750679751.4136210610355; Thu, 5 Nov 2020 00:42:30 -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-497-jIxv9nRANgSKjk48Po47tg-1; Thu, 05 Nov 2020 03:42:27 -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 9F2B4AF9A6; Thu, 5 Nov 2020 08:42: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 7CAF875121; Thu, 5 Nov 2020 08:42:17 +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 AEE9C8C7DB; Thu, 5 Nov 2020 08:42:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0A58g94q014204 for ; Thu, 5 Nov 2020 03:42:10 -0500 Received: by smtp.corp.redhat.com (Postfix) id C5B85D1D12; Thu, 5 Nov 2020 08:42:09 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BC7F8D29DF for ; Thu, 5 Nov 2020 08:42:07 +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 5A0C5801224 for ; Thu, 5 Nov 2020 08:42:07 +0000 (UTC) Received: from regular1.263xmail.com (regular1.263xmail.com [211.150.70.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-392-cbOn8p-iOQ2jLUpnrr8qEw-1; Thu, 05 Nov 2020 03:42:03 -0500 Received: from localhost (unknown [192.168.167.69]) by regular1.263xmail.com (Postfix) with ESMTP id DB7EF1133 for ; Thu, 5 Nov 2020 16:37:51 +0800 (CST) Received: from localhost.localdomain (unknown [14.18.236.70]) by smtp.263.net (postfix) whith ESMTP id P1246T139713922979584S1604565467630045_; Thu, 05 Nov 2020 16:37:51 +0800 (CST) X-MC-Unique: jIxv9nRANgSKjk48Po47tg-1 X-MC-Unique: cbOn8p-iOQ2jLUpnrr8qEw-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: X-RL-SENDER: yili@winhong.com X-SENDER: yili@winhong.com X-LOGIN-NAME: yili@winhong.com X-FST-TO: libvir-list@redhat.com X-SENDER-IP: 14.18.236.70 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Yi Li To: libvir-list@redhat.com Subject: [PATCH] virsh-domain: Remove unused virshNodeIsSuperset Date: Thu, 5 Nov 2020 16:37:46 +0800 Message-Id: <20201105083746.2258651-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.79 on 10.11.54.5 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 0A58g94q014204 X-loop: libvir-list@redhat.com Cc: yili@winhong.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 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" The function is marked as unused. Remove it from the tree until a new use case can be found. Signed-off-by: Yi Li Reviewed-by: Erik Skultety --- tools/virsh-domain.c | 115 ------------------------------------------- 1 file changed, 115 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index ef347585e8..1ae936c6b2 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -11933,121 +11933,6 @@ cmdDomHostname(vshControl *ctl, const vshCmd *cmd) return true; } =20 -/** - * Check if n1 is superset of n2, meaning n1 contains all elements and - * attributes as n2 at least. Including children. - * @n1 first node - * @n2 second node - * returns true in case n1 covers n2, false otherwise. - */ -G_GNUC_UNUSED -static bool -virshNodeIsSuperset(xmlNodePtr n1, xmlNodePtr n2) -{ - xmlNodePtr child1, child2; - xmlAttrPtr attr; - char *prop1, *prop2; - bool found; - bool visited; - bool ret =3D false; - long n1_child_size, n2_child_size, n1_iter; - virBitmapPtr bitmap; - - if (!n1 && !n2) - return true; - - if (!n1 || !n2) - return false; - - if (!xmlStrEqual(n1->name, n2->name)) - return false; - - /* Iterate over n2 attributes and check if n1 contains them */ - attr =3D n2->properties; - while (attr) { - if (attr->type =3D=3D XML_ATTRIBUTE_NODE) { - prop1 =3D virXMLPropString(n1, (const char *) attr->name); - prop2 =3D virXMLPropString(n2, (const char *) attr->name); - if (STRNEQ_NULLABLE(prop1, prop2)) { - xmlFree(prop1); - xmlFree(prop2); - return false; - } - xmlFree(prop1); - xmlFree(prop2); - } - attr =3D attr->next; - } - - n1_child_size =3D virXMLChildElementCount(n1); - n2_child_size =3D virXMLChildElementCount(n2); - if (n1_child_size < 0 || n2_child_size < 0 || - n1_child_size < n2_child_size) - return false; - - if (n1_child_size =3D=3D 0 && n2_child_size =3D=3D 0) - return true; - - bitmap =3D virBitmapNew(n1_child_size); - - child2 =3D n2->children; - while (child2) { - if (child2->type !=3D XML_ELEMENT_NODE) { - child2 =3D child2->next; - continue; - } - - child1 =3D n1->children; - n1_iter =3D 0; - found =3D false; - while (child1) { - if (child1->type !=3D XML_ELEMENT_NODE) { - child1 =3D child1->next; - continue; - } - - if (virBitmapGetBit(bitmap, n1_iter, &visited) < 0) { - vshError(NULL, "%s", _("Bad child elements counting.")); - goto cleanup; - } - - if (visited) { - child1 =3D child1->next; - n1_iter++; - continue; - } - - if (xmlStrEqual(child1->name, child2->name)) { - found =3D true; - if (virBitmapSetBit(bitmap, n1_iter) < 0) { - vshError(NULL, "%s", _("Bad child elements counting.")= ); - goto cleanup; - } - - if (!virshNodeIsSuperset(child1, child2)) - goto cleanup; - - break; - } - - child1 =3D child1->next; - n1_iter++; - } - - if (!found) - goto cleanup; - - child2 =3D child2->next; - } - - ret =3D true; - - cleanup: - virBitmapFree(bitmap); - return ret; -} - - /* * "detach-device" command */ --=20 2.25.3