[libvirt] PATCH 2/4: implement getVersion method for openvz

Daniel P. Berrange berrange at redhat.com
Mon Oct 20 10:40:45 UTC 2008


On Mon, Oct 20, 2008 at 11:33:20AM +0200, Daniel Veillard wrote:
> On Tue, Oct 14, 2008 at 04:19:06PM +0100, Daniel P. Berrange wrote:
> > This patch implements the getVersion driver method for openvz to report
> > the version number of vzctl. This is needed in the next patch to determine
> > if we have builtin support for bridges
> 
>   Looks fine except:
> 
> > +static int
> > +openvzExtractVersionInfo(const char *cmd, int *retversion)
> > +{
> [...]
> > +    enum { MAX_HELP_OUTPUT_SIZE = 8192 };
> > +    int len = virFileReadLimFD(newstdout, MAX_HELP_OUTPUT_SIZE, &help);
> 
>   Except that part which puzzles me. Why defining an enum for that. Also
> enum is one of the worse part of C, it has no clear storage size
> definition,  and virFileReadLimFD takes an input int anyway...

There's no particular reason for this - I just copied the equivalent
code in the QEMU driver for extracting version info & this was the
way it worked. This constant is only used once, so its not really
doing much of use.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list