[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v2 2/5] libxl: add vsnd list and info
On Fri, May 18, 2018 at 05:38:27PM +0300, Oleksandr Grytsov wrote: > From: Oleksandr Grytsov <oleksandr_grytsov@xxxxxxxx> > > Add getting vsnd list amd info API amd -> and here. > [...] > > +static int libxl__device_stream_getinfo(libxl__gc *gc, const char *path, > + libxl_vsnd_pcm* pcm, > + libxl_pcminfo *info) > +{ > + const char *tmp; > + int i; > + int rc; > + > + info->num_vsnd_streams = pcm->num_vsnd_streams; > + info->streams = malloc(sizeof(*info->streams) * info->num_vsnd_streams); > + No checking for NULL? In fact you should use libxl__malloc(NOGC,...). > + for (i = 0; i < info->num_vsnd_streams; i++) > + { > + libxl_streaminfo_init(&info->streams[i]); > + > + rc = libxl__xs_read_checked(gc, XBT_NULL, > + GCSPRINTF("%s/%d/"XENSND_FIELD_RING_REF, > + path, i), &tmp); > + if (rc) goto out; > + > + info->streams[i].req_rref = tmp ? strtoul(tmp, NULL, 10) : -1; > + > + rc = libxl__xs_read_checked(gc, XBT_NULL, > + GCSPRINTF("%s/%d/"XENSND_FIELD_EVT_CHNL, > + path, i), &tmp); > + if (rc) goto out; > + > + info->streams[i].req_evtch = tmp ? strtoul(tmp, NULL, 10) : -1; > + } > + > + rc = 0; > + > +out: > + > + return rc; > +} > + > +static int libxl__device_pcm_getinfo(libxl__gc *gc, const char *path, > + libxl_device_vsnd *vsnd, > + libxl_vsndinfo *info) > +{ > + int i; > + int rc; > + > + info->num_vsnd_pcms = vsnd->num_vsnd_pcms; > + info->pcms = malloc(sizeof(*info->pcms) * info->num_vsnd_pcms); > + > + for (i = 0; i < info->num_vsnd_pcms; i++) > + { > + libxl_pcminfo_init(&info->pcms[i]); > + > + rc = libxl__device_stream_getinfo(gc, GCSPRINTF("%s/%d", path, i), > + &vsnd->pcms[i], &info->pcms[i]); > + if (rc) goto out; > + } > + > + rc = 0; > + > +out: > + Too many blank lines here. In fact you can leave no blank like at all after the out label, here and other places. Wei. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |