All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Orit Wasserman <owasserm@redhat.com>
Cc: kwolf@redhat.com, aliguori@us.ibm.com, akong@redhat.com,
	mst@redhat.com, quintela@redhat.com, mdroth@linux.vnet.ibm.com,
	qemu-devel@nongnu.org, pbonzini@redhat.com,
	lcapitulino@redhat.com
Subject: Re: [Qemu-devel] [PATCH v2 2/3] Separate inet_connect into inet_connect (blocking) and inet_nonblocking_connect
Date: Thu, 13 Sep 2012 14:44:37 +0200	[thread overview]
Message-ID: <87sjamgki2.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: <1347448378-23915-3-git-send-email-owasserm@redhat.com> (Orit Wasserman's message of "Wed, 12 Sep 2012 14:12:57 +0300")

Orit Wasserman <owasserm@redhat.com> writes:

> No need to add non blocking parameters to the blocking inet_connect
>
> Signed-off-by: Orit Wasserman <owasserm@redhat.com>
> ---
>  migration-tcp.c |    2 +-
>  nbd.c           |    2 +-
>  qemu-sockets.c  |   24 ++++++++++++++++++++----
>  qemu_socket.h   |    4 +++-
>  ui/vnc.c        |    2 +-
>  5 files changed, 26 insertions(+), 8 deletions(-)
>
> diff --git a/migration-tcp.c b/migration-tcp.c
> index ac891c3..7f6ad98 100644
> --- a/migration-tcp.c
> +++ b/migration-tcp.c
> @@ -88,7 +88,7 @@ int tcp_start_outgoing_migration(MigrationState *s, const char *host_port,
>      s->write = socket_write;
>      s->close = tcp_close;
>  
> -    s->fd = inet_connect(host_port, false, &in_progress, errp);
> +    s->fd = inet_nonblocking_connect(host_port, &in_progress, errp);
>      if (error_is_set(errp)) {
>          migrate_fd_error(s);
>          return -1;
> diff --git a/nbd.c b/nbd.c
> index 0dd60c5..206f75c 100644
> --- a/nbd.c
> +++ b/nbd.c
> @@ -162,7 +162,7 @@ int tcp_socket_outgoing(const char *address, uint16_t port)
>  
>  int tcp_socket_outgoing_spec(const char *address_and_port)
>  {
> -    return inet_connect(address_and_port, true, NULL, NULL);
> +    return inet_connect(address_and_port, NULL);
>  }
>  
>  int tcp_socket_incoming(const char *address, uint16_t port)
> diff --git a/qemu-sockets.c b/qemu-sockets.c
> index 68e4d30..4f5eca8 100644
> --- a/qemu-sockets.c
> +++ b/qemu-sockets.c
> @@ -518,16 +518,32 @@ int inet_listen(const char *str, char *ostr, int olen,
>      return sock;
>  }
>  
> -int inet_connect(const char *str, bool block, bool *in_progress, Error **errp)
> +int inet_connect(const char *str, Error **errp)
>  {
>      QemuOpts *opts;
>      int sock = -1;
>  
>      opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL);
>      if (inet_parse(opts, str) == 0) {
> -        if (block) {
> -            qemu_opt_set(opts, "block", "on");
> -        }
> +        qemu_opt_set(opts, "block", "on");
> +        sock = inet_connect_opts(opts, NULL, errp);

Let's go one step further: make inet_connect_opts() take a bool block
argument, and drop the stupid QemuOpt "block".  That way, opts are again
for user options only.

> +    } else {
> +        error_set(errp, QERR_SOCKET_CREATE_FAILED);
> +    }
> +    qemu_opts_del(opts);
> +    return sock;
> +}
> +
> +
> +int inet_nonblocking_connect(const char *str, bool *in_progress,
> +                             Error **errp)
> +{
> +    QemuOpts *opts;
> +    int sock = -1;
> +
> +    opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL);
> +    if (inet_parse(opts, str) == 0) {
> +        qemu_opt_set(opts, "block", "off");
>          sock = inet_connect_opts(opts, in_progress, errp);
>      } else {
>          error_set(errp, QERR_SOCKET_CREATE_FAILED);
[...]

  reply	other threads:[~2012-09-13 12:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-12 11:12 [Qemu-devel] [PATCH v2 0/3] nonblocking connect address handling cleanup Orit Wasserman
2012-09-12 11:12 ` [Qemu-devel] [PATCH v2 1/3] Refactor inet_connect_opts function Orit Wasserman
2012-09-13 12:35   ` Markus Armbruster
2012-09-13 16:44     ` Orit Wasserman
2012-09-13 16:52     ` Orit Wasserman
2012-09-14  7:37       ` Michael S. Tsirkin
2012-09-13 13:14   ` Markus Armbruster
2012-09-13 16:44     ` Orit Wasserman
2012-09-12 11:12 ` [Qemu-devel] [PATCH v2 2/3] Separate inet_connect into inet_connect (blocking) and inet_nonblocking_connect Orit Wasserman
2012-09-13 12:44   ` Markus Armbruster [this message]
2012-09-13 16:40     ` Orit Wasserman
2012-09-12 11:12 ` [Qemu-devel] [PATCH v2 3/3] Fix address handling in inet_nonblocking_connect Orit Wasserman
2012-09-13 13:22   ` Markus Armbruster
2012-09-13 13:32     ` Michael S. Tsirkin
2012-09-13 14:23       ` Orit Wasserman
2012-09-13 17:27     ` Orit Wasserman
2012-09-12 14:16 ` [Qemu-devel] [PATCH v2 0/3] nonblocking connect address handling cleanup Amos Kong
2012-09-12 20:37 ` Michael S. Tsirkin

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=87sjamgki2.fsf@blackfin.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=akong@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=kwolf@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=mst@redhat.com \
    --cc=owasserm@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.