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

Re: [libvirt] [PATCH 3/4] chardev: Add function to output -chardev options

On Tue, Nov 03, 2009 at 04:07:40PM +0000, Matthew Booth wrote:
> Note that, on its own, this patch will generate a warning about an unused static
> function.
> +/* This function outputs a -chardev command line option which describes only the
> + * host side of the character device */
> +static int qemudBuildCommandLineChrDevChardevStr(virDomainChrDefPtr dev,
> +                                                 const char *const id,
> +                                                 char *buf,
> +                                                 int buflen)
> +{
> +    switch(dev->type) {
> +        if (snprintf(buf, buflen, "null,id=%s", id) >= buflen)
> +            return -1;
> +        break;

Looks OK, but wouldn't it be preferable to use a virBuffer here
instead of depending on the caller to allocate a large enough buffer?



Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.

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