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

Re: [Xen-devel] [PATCH v6 2/3] libxl: save/restore qemu's physmap



On Tue, 3 Apr 2012, Ian Jackson wrote:
> > +                    domid, pi->phys_offset), "%"PRIx64, pi->start_addr);
> > +        if (ret)
> > +            return -1;
> > +        ret = libxl__xs_write(gc, 0, libxl__sprintf(gc,
> > +                    
> > "/local/domain/0/device-model/%d/physmap/%"PRIx64"/size",
> > +                    domid, pi->phys_offset), "%"PRIx64, pi->size);
> 
> This whole thing contains a lot of repetitive code.  Can you perhaps
> break the xs_write into a helper function and then you'd make the
> repetition more explicit by writing something like:
> 
>            helper(gc, domid, "start_addr", "%"PRIx64, pi->start_addr);
>            helper(gc, domid, "name",       "%"PRIx64, pi->size);
>            if (pi->namelen)
>                 helper(gc, domid, "name",       "%s",      pi->name);

I'll try to make the code more readable.


> > +static int libxl__toolstack_save(uint32_t domid, uint8_t **buf,
> > +        uint32_t *len, void *data)
> > +{
> ...
> > +    *buf = calloc(1, *len);
> 
> Surely this should come from the gc.

Nope: libxc frees it.

_______________________________________________
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®.