[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v3 03/11] libxl: add generic function to get and free device list
On Wed, Jul 12, 2017 at 12:51 PM, Wei Liu <wei.liu2@xxxxxxxxxx> wrote: > On Mon, Jul 10, 2017 at 03:26:12PM +0300, Oleksandr Grytsov wrote: >> It means for each device where getting device list is required there will be >> GC_INIT(ctc) >> >> libxl__device_list(gc, ...) >> >> GC_FREE >> >> instead of just: >> >> libxl__device_list(ctx, ...); > > I think this is worth it because we might need to use the > libl__device_list function internally. I've reworked the patch series and done it in following way: libxl__device_list takes gc and interface function init CTX: libxl_device_disk *libxl_device_disk_list(libxl_ctx *ctx, uint32_t domid, int *num) { libxl_device_disk *r; GC_INIT(ctx); r = libxl__device_list(gc, &libxl__disk_devtype, domid, "disk", num); GC_FREE; return r; } There was comment to use libxl_malloc instead of malloc in libxl__device_list. But it can't be used because calling GC_FREE frees the list. So I've left malloc and free the list in libxl__device_list_free. -- Best Regards, Oleksandr Grytsov. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |