gendispatch: Drop 'aclapi' mode

The separate API perms XML is no longer used. Remove the support for
generating it.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2023-02-21 15:57:01 +01:00
parent 474d625b86
commit c5678110df

View File

@ -42,8 +42,8 @@ my $res = GetOptions("mode=s" => \$mode);
die "cannot parse command line options" unless $res;
die "unknown mode '$mode', expecting 'client', 'server', " .
"'aclheader', 'aclbody', 'aclsym', 'aclapi' or 'debug'"
unless $mode =~ /^(client|server|aclheader|aclbody|aclsym|aclapi|debug)$/;
"'aclheader', 'aclbody', 'aclsym', or 'debug'"
unless $mode =~ /^(client|server|aclheader|aclbody|aclsym|debug)$/;
my $structprefix = shift or die "missing struct prefix argument";
my $procprefix = shift or die "missing procedure prefix argument";
@ -452,14 +452,6 @@ if ($mode eq "aclsym") {
# Automatically generated from $protocol by gendispatch.pl.
# Do not edit this file. Any changes you make will be lost.
__EOF__
} elsif ($mode eq "aclapi") {
print <<__EOF__;
<?xml version="1.0" encoding="UTF-8"?>
<!--
- Automatically generated from $protocol by gendispatch.pl.
- Do not edit this file. Any changes you make will be lost.
-->
__EOF__
} else {
print <<__EOF__;
/* Automatically generated from $protocol by gendispatch.pl.
@ -2020,8 +2012,7 @@ elsif ($mode eq "client") {
}
} elsif ($mode eq "aclheader" ||
$mode eq "aclbody" ||
$mode eq "aclsym" ||
$mode eq "aclapi") {
$mode eq "aclsym") {
my %generate = map { $_ => 1 } @autogen;
my @keys = keys %calls;
@ -2059,8 +2050,6 @@ elsif ($mode eq "client") {
print "\n";
print "#define VIR_FROM_THIS VIR_FROM_ACCESS\n";
print "\n";
} elsif ($mode eq "aclapi") {
print "<aclinfo>\n";
} else {
print "\n";
}
@ -2085,8 +2074,6 @@ elsif ($mode eq "client") {
print $apiname . "CheckACL;\n";
}
print $apiname . "EnsureACL;\n";
} elsif ($mode eq "aclapi") {
&generate_aclapi($call);
} else {
&generate_acl($call, $call->{acl}, "Ensure");
if (defined $call->{aclfilter}) {
@ -2247,50 +2234,5 @@ elsif ($mode eq "client") {
print "}\n\n";
}
}
sub generate_aclapi {
my $call = shift;
my $apiname = $prefix . $call->{ProcName};
if ($structprefix eq "qemu") {
$apiname =~ s/(vir(Connect)?Domain)/${1}Qemu/;
} elsif ($structprefix eq "lxc") {
$apiname =~ s/virDomain/virDomainLxc/;
}
print " <api name='$apiname'>\n";
my $acl = $call->{acl};
foreach (@{$acl}) {
my @bits = split /:/;
my $objname = $bits[0];
$objname =~ s/_/-/g;
my $perm = $bits[1];
$perm =~ s/_/-/g;
print " <check object='$objname' perm='$perm'";
if (defined $bits[2]) {
print " flags='$bits[2]'";
}
print "/>\n";
}
my $aclfilter = $call->{aclfilter};
foreach (@{$aclfilter}) {
my @bits = split /:/;
my $objname = $bits[0];
$objname =~ s/_/-/g;
my $perm = $bits[1];
$perm =~ s/_/-/g;
print " <filter object='$objname' perm='$perm'/>\n";
}
print " </api>\n";
}
}
if ($mode eq "aclapi") {
print "</aclinfo>\n";
}
}