[Libguestfs] [PATCH 3/3] Add APIs for resolving the appliance kernel/initrd

Richard W.M. Jones rjones at redhat.com
Tue Jul 6 11:28:11 UTC 2010


On Tue, Jul 06, 2010 at 12:15:12PM +0100, Daniel P. Berrange wrote:
> On Tue, Jul 06, 2010 at 08:30:21AM +0100, Richard W.M. Jones wrote:
> > On Mon, Jul 05, 2010 at 12:26:01PM -0400, Daniel P. Berrange wrote:
> > 
> > > +  ("get_kernel", (RConstString "kernel", []), -1, [],
> > 
> > RConstString is the wrong type to use here, I think.
> > 
> > If users should call find_appliance before this, then it should be an
> > error not to have called it, so RString would be the correct return
> > type.
> 
> Using RString introduces a needless strdup & free between
> libguestfs & the caller, so I chose RConstString to avoid
> this.  Both RString and RConstString declare that NULL is
> an error condition, so I'm not sure why we need to change
> this to RString since they're appear to be equivalent in 
> their error reporting semantics.

OK I think you're right.  It's RConstOptString which is the one which
should [nearly] never be used.

But you should still alter the code so that it calls error() if the
internal g->kernel (or g->initrd) field is NULL.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list