[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 2/7] vtpmmgr: add example control tools



On Wed, 2014-03-19 at 15:52 -0400, Daniel De Graaf wrote:
> +#my @pcr;
> +#$pcr[$_] = "\0"x20 for 0..23;
> +#
> +#sub extend {
> +#    my($n, $v) = @_;
> +#    $pcr[$n] = sha1($pcr[$n], $v);
> +#}
> +#
> +#sub composite {
> +#    my $sel = shift;
> +#    my $bits = unpack 'b24', pack 'V', $sel;
> +#    my @used;
> +#    my $i = 0;
> +#    for (split //, $bits) {
> +#            push @used, $pcr[$i] if $_;
> +#            $i++;
> +#    }
> +#    my $v = pack 'nb*N', 3, $bits, 20*scalar @used;
> +#    sha1($v, @used);
> +#}

Left over debug?

[...]
> +if ($cmd eq 'list') {
> +     cmd_list @ARGV;
> +} elsif ($cmd eq 'group-add') {
> +     cmd_group_add @ARGV;
> +} elsif ($cmd eq 'group-update') {
> +     cmd_group_update @ARGV;
> +} elsif ($cmd eq 'group-del') {
> +     cmd_group_del @ARGV;
> +} elsif ($cmd eq 'vtpm-add') {
> +     cmd_vtpm_add @ARGV;
> +} elsif ($cmd eq 'vtpm-del') {
> +     cmd_vtpm_del @ARGV;

A trick I learnt from osstest.git:mg-hosts:
        die unless @ARGV;
        my $subcmd= shift @ARGV;
        $subcmd =~ s/-/_/g;
        my $subcmdproc;
        {
            $subcmdproc= \&{ "cmd_$subcmd" };
        }
        $subcmdproc->();

(not sure what those braces do, Ian?)
Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.