From nobody Mon Feb 9 07:54:47 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1562694415; cv=none; d=zoho.com; s=zohoarc; b=NGqS+aDrI9ZyGHfsoS4UueYJHEa7QEO3eClx66rRZsT/6RzUJbFvIG2tvZ1wt0oP4eP/8x9D2MLBttU3r2yPQRiyT6Q60J57rtMs3it4KVvokDMT9TRDJQMIz5Q9oE0ZMCQofMZZRmsQvsQRU1GNot4wXV8OTEPFa066hiz5Tno= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1562694415; 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:ARC-Authentication-Results; bh=1vFxRRJ41s8VE6O/MNaB4oSIlIqVXEuXJTcMJEYFGig=; b=dH1y+KwqYW+n2T7UvlTNJSj7hqIas+8g8WpcAKwFiOkOdX/E4WV0gSgWQYQF56buNQunHB9QhDR7pLTm6DORaPaon7bDc2QOJo0vArNqUkzvSact+tWUizbue/tqsjduNFm4u53II5nlGNI5nntm0BkSXQa1Rk6IoZAJ7L4OBY4= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1562694415740472.26086395539005; Tue, 9 Jul 2019 10:46:55 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 9D6772EED35; Tue, 9 Jul 2019 17:46:48 +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 F35D95B80B; Tue, 9 Jul 2019 17:46:46 +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 B7AC51833003; Tue, 9 Jul 2019 17:46:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x69HkgZY031151 for ; Tue, 9 Jul 2019 13:46:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id CA5221001B11; Tue, 9 Jul 2019 17:46:42 +0000 (UTC) Received: from blue.redhat.com (ovpn-116-78.phx2.redhat.com [10.3.116.78]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6DEAC1001B1B; Tue, 9 Jul 2019 17:46:42 +0000 (UTC) From: Eric Blake To: libvir-list@redhat.com Date: Tue, 9 Jul 2019 12:46:32 -0500 Message-Id: <20190709174638.17164-4-eblake@redhat.com> In-Reply-To: <20190709174638.17164-1-eblake@redhat.com> References: <20190709174638.17164-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Cc: pkrempa@redhat.com Subject: [libvirt] [PATCH v2 3/9] maint: Enhance check-driverimpls.pl to check for API pairing 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: , Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 09 Jul 2019 17:46:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" As shown in recent patches, several drivers provided only an older counterpart of an API, making it harder to uniformly use the newer preferred API form. We can prevent future instances of this by enhancing 'make syntax-check' to flag any time a modern API is forgotten when an older API is present. It also flags if a modern API is provided without an old counterpart; but thankfully, that situation didn't flag, which gives us some room for future patches to confine the magic of API pairs to just src/libvirt*.c and the remote driver. Also, drop support for special-casing xenUnified, since 1dac5fbbbb0 dropped support for that naming scheme. --- src/check-driverimpls.pl | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/src/check-driverimpls.pl b/src/check-driverimpls.pl index b175e710f1..34273ddbba 100755 --- a/src/check-driverimpls.pl +++ b/src/check-driverimpls.pl @@ -23,14 +23,41 @@ use warnings; my $intable =3D 0; my $table; my $mainprefix; +my %apis; + +# API pairs where a driver should provide both or neither alternative. +my %pairs =3D ( + 'domainShutdown' =3D> 'domainShutdownFlags', + 'domainDestroy' =3D> 'domainDestroyFlags', + 'domainSetMemory' =3D> 'domainSetMemoryFlags', + 'domainSave' =3D> 'domainSaveFlags', + 'domainRestore' =3D> 'domainRestoreFlags', + 'domainSetVcpus' =3D> 'domainSetVcpusFlags', + 'domainPinVcpu' =3D> 'domainPinVcpuFlags', + 'domainCreate' =3D> 'domainCreateWithFlags', + 'domainDefineXML' =3D> 'domainDefineXMLFlags', + 'domainUndefine' =3D> 'domainUndefineFlags', + 'domainAttachDevice' =3D> 'domainAttachDeviceFlags', + 'domainDetachDevice' =3D> 'domainDetachDeviceFlags', + 'domainGetSchedulerParameters' =3D> 'domainGetSchedulerParametersFlags= ', + 'domainSetSchedulerParameters' =3D> 'domainSetSchedulerParametersFlags= ', + 'nodeDeviceDettach' =3D> 'nodeDeviceDetachFlags', +); my $status =3D 0; while (<>) { if ($intable) { if (/}/) { + while (my ($old, $new) =3D each %pairs) { + if (exists $apis{$old} !=3D exists $apis{$new}) { + print "$ARGV:$. Inconsistent paired API '$old' vs. '$n= ew'\n"; + $status =3D 1; + } + } $intable =3D 0; $table =3D undef; $mainprefix =3D undef; + %apis =3D (); } elsif (/\.(\w+)\s*=3D\s*(\w+),?/) { my $api =3D $1; my $impl =3D $2; @@ -39,9 +66,11 @@ while (<>) { next if $api eq "name"; next if $impl eq "NULL"; + $apis{$api} =3D 1; + my $suffix =3D $impl; my $prefix =3D $impl; - $prefix =3D~ s/^([a-z]+(?:Unified)?)(.*?)$/$1/; + $prefix =3D~ s/^([a-z]+)(.*?)$/$1/; if (defined $mainprefix) { if ($mainprefix ne $prefix) { @@ -53,7 +82,7 @@ while (<>) { } if ($api !~ /^$mainprefix/) { - $suffix =3D~ s/^[a-z]+(?:Unified)?//; + $suffix =3D~ s/^[a-z]+//; $suffix =3D~ s/^([A-Z]+)/lc $1/e; } --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list