[Libguestfs] [PATCH] generator: Add visibility to action struct

Richard W.M. Jones rjones at redhat.com
Tue Feb 5 14:40:34 UTC 2013


On Mon, Feb 04, 2013 at 02:18:48PM +0000, Matthew Booth wrote:
> +let is_external =
> +  fun x -> match x.visibility with
> +  | VPublic | VStateTest | VBindTest | VDebug -> true
> +  | VInternal -> false

I know we discussed this on IRC, but seeing the whole
function I now realise you could write:

  let is_external { visibility = v } =
    match v with
    | VPublic | VStateTest | VBindTest | VDebug -> true
    | VInternal -> false

Or:

  let is_external = function
    { visibility = (VPublic | VStateTest | VBindTest | VDebug) } -> true
    { visibility = VInternal } -> false

Whether you prefer this or not is up to you :-)

Anyway, this all looks a lot more sensible.

One check you could do is to diff the generator output before
and after the change.

Basically, reset to before your patch, and do:

  make -C generator
  for f in `cat generator/files-generated.txt`; do cp $f $f.orig; done

Then apply your patch, and do:

  make -C generator
  for f in `cat generator/files-generated.txt`; do diff -u $f.orig $f; done \
    | less

Assuming that diff looks sensible to your eyes, then ACK.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v




More information about the Libguestfs mailing list