qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jes Sorensen <Jes.Sorensen@redhat.com>
To: Michael Roth <mdroth@linux.vnet.ibm.com>
Cc: aliguori@linux.vnet.ibm.com, ryanh@us.ibm.com,
	agl@linux.vnet.ibm.com, qemu-devel@nongnu.org,
	abeekhof@redhat.com
Subject: Re: [Qemu-devel] [RFC][PATCH v4 03/18] virtagent: qemu-vp, integrate virtagent server
Date: Thu, 18 Nov 2010 15:02:36 +0100	[thread overview]
Message-ID: <4CE531FC.5090608@redhat.com> (raw)
In-Reply-To: <1289923320-5638-4-git-send-email-mdroth@linux.vnet.ibm.com>

On 11/16/10 17:01, Michael Roth wrote:
> +    bool enable_virtagent;
>  
>      chr->opaque = drv;
>      chr->chr_write = vp_chr_write;
> @@ -2025,9 +2029,31 @@ static CharDriverState *qemu_chr_open_virtproxy(QemuOpts *opts)
>      /* parse socket forwarding options */
>      qemu_opt_foreach(opts, vp_init_forwards, drv, 1);
>  
> +    /* add forwarding options to enable virtagent server */
> +    enable_virtagent = qemu_opt_get_bool(opts, "virtagent", 0);

int qemu_opt_get_bool(QemuOpts *opts, const char *name, int defval)

Sorry qemu_opt_get_bool() actually returns an int.

> diff --git a/qemu-vp.c b/qemu-vp.c
> index cfd2a69..38959e5 100644
> --- a/qemu-vp.c
> +++ b/qemu-vp.c
> @@ -37,6 +37,8 @@
>  #include "qemu-option.h"
>  #include "qemu_socket.h"
>  #include "virtproxy.h"
> +#include "virtagent.h"
> +#include "virtagent-daemon.h"
>  
>  static bool verbose_enabled = 0;

You don't need to initialize global variables to zero, the compiler does
that.


> +static int init_agent(const VPData *agent_iforward) {
> +    QemuOpts *opts = agent_iforward->opts;
> +    VPDriver *drv;
> +    int ret, index;
> +
> +    INFO("initializing agent...");
> +    if (verbose_enabled) {
> +        qemu_opts_print(opts, NULL);
> +    }
> +
> +    index = qemu_opt_get_number(agent_iforward->opts, "index", 0);
> +    drv = get_channel_drv(index);
> +    if (drv == NULL) {
> +        warnx("unable to find channel with index: %d", index);
> +        goto err;
> +    }
> +
> +    /* outbound RPCs */
> +    ret = va_client_init(drv, false);
> +    if (ret) {
> +        warnx("error starting RPC server");
> +        goto err;
> +    }
> +
> +    /* start guest RPC server */
> +    ret = va_server_init(drv, false);
> +    if (ret != 0) {
> +        warnx("error starting RPC server");
> +        goto err;
> +    }
> +
> +    return 0;
> +
> +err:
> +    return -1;
> +}

Please set appropriate error codes and return something meaningful
instead of just -1.

Cheers,
Jes

  reply	other threads:[~2010-11-18 14:02 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-16 16:01 [Qemu-devel] [RFC][PATCH v4 00/18] virtagent: host/guest RPC communication agent Michael Roth
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 01/18] virtagent: add common rpc transport defs Michael Roth
2010-11-18 13:53   ` Jes Sorensen
2010-11-18 16:33     ` Michael Roth
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 02/18] virtagent: base definitions for host/guest RPC server Michael Roth
2010-11-18 13:57   ` Jes Sorensen
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 03/18] virtagent: qemu-vp, integrate virtagent server Michael Roth
2010-11-18 14:02   ` Jes Sorensen [this message]
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 04/18] virtagent: base RPC client definitions Michael Roth
2010-11-18 14:10   ` Jes Sorensen
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 05/18] virtagent: add getfile RPC Michael Roth
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 06/18] virtagent: add agent_viewfile command Michael Roth
2010-11-18 14:13   ` Jes Sorensen
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 07/18] virtagent: add getdmesg RPC Michael Roth
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 08/18] virtagent: add agent_viewdmesg command Michael Roth
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 09/18] virtagent: add va_shutdown RPC Michael Roth
2010-11-18 14:17   ` Jes Sorensen
2010-11-18 15:35     ` Anthony Liguori
2010-11-18 15:41       ` Jes Sorensen
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 10/18] virtagent: add agent_shutdown monitor command Michael Roth
2010-11-18 14:19   ` Jes Sorensen
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 11/18] virtagent: add va_ping RPC Michael Roth
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 12/18] virtagent: add agent_ping monitor command Michael Roth
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 13/18] virtagent: add agent_capabilities monitor function Michael Roth
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 14/18] virtagent: add client capabilities init function Michael Roth
2010-11-18 14:22   ` Jes Sorensen
2010-11-18 16:43     ` Michael Roth
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 15/18] virtagent: add va_hello RPC function Michael Roth
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 16/18] virtagent: add va_send_hello() client function Michael Roth
2010-11-16 16:01 ` [Qemu-devel] [RFC][PATCH v4 17/18] virtagent: qemu-vp, va_send_hello() on startup Michael Roth
2010-11-18 14:22   ` Jes Sorensen
2010-11-16 16:02 ` [Qemu-devel] [RFC][PATCH v4 18/18] virtagent: Makefile/configure changes to build virtagent bits Michael Roth
2010-11-18 13:50 ` [Qemu-devel] [RFC][PATCH v4 00/18] virtagent: host/guest RPC communication agent Jes Sorensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CE531FC.5090608@redhat.com \
    --to=jes.sorensen@redhat.com \
    --cc=abeekhof@redhat.com \
    --cc=agl@linux.vnet.ibm.com \
    --cc=aliguori@linux.vnet.ibm.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=ryanh@us.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).