[libvirt] [PATCH 4/8] parallels: get info about serial ports

Daniel P. Berrange berrange at redhat.com
Fri Jul 27 09:34:03 UTC 2012


On Thu, Jul 26, 2012 at 10:34:31PM +0400, Dmitry Guryanov wrote:
> Add support of collecting information about serial
> ports. This change is needed mostly as an example,
> support of other devices will be added later.
> 
> Signed-off-by: Dmitry Guryanov <dguryanov at parallels.com>
> ---
>  src/parallels/parallels_driver.c |  116 ++++++++++++++++++++++++++++++++++++++
>  1 files changed, 116 insertions(+), 0 deletions(-)
> 
> diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
> index 8c20d27..ee31e6d 100644
> --- a/src/parallels/parallels_driver.c
> +++ b/src/parallels/parallels_driver.c
> @@ -182,6 +182,119 @@ parallelsGetCapabilities(virConnectPtr conn)
>      return xml;
>  }

> +static int
> +parallelsAddDomainHardware(virDomainDefPtr def, virJSONValuePtr jobj)
> +{
> +    int n, i;
> +    virJSONValuePtr value;
> +    const char *key;


Minor nit-pick, its slightly preferable to declare loop iterators
like 'i' as a size_t

> +
> +    n = virJSONValueObjectKeysNumber(jobj);
> +    if (n < 1)
> +        goto cleanup;
> +
> +    for (i = 0; i < n; i++) {
> +        key = virJSONValueObjectGetKey(jobj, i);
> +        value = virJSONValueObjectGetValue(jobj, i);
> +
> +        if (STRPREFIX(key, "serial")) {
> +            if (parallelsAddSerialInfo(def, key, value))
> +                goto cleanup;
> +        }
> +    }
> +
> +    return 0;
> +
> +  cleanup:
> +    return -1;
> +}
> +
>  /*
>   * Must be called with privconn->lock held
>   */

ACK regardless of the above comment.

Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list