qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org, Michael Roth <mdroth@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] [PATCH 3/4] sockets: add AF_VSOCK support
Date: Fri, 7 Oct 2016 13:21:32 +0100	[thread overview]
Message-ID: <20161007122132.GA5834@stefanha-x1.localdomain> (raw)
In-Reply-To: <96805a9d-3211-51fa-b0f3-677fb3905696@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1488 bytes --]

On Thu, Oct 06, 2016 at 01:14:08PM -0500, Eric Blake wrote:
> On 10/06/2016 11:40 AM, Stefan Hajnoczi wrote:
> > +static int vsock_connect_addr(const struct sockaddr_vm *svm, bool *in_progress,
> > +                              ConnectState *connect_state, Error **errp)
> > +{
> > +    int sock, rc;
> > +
> > +    *in_progress = false;
> > +
> > +    sock = qemu_socket(AF_VSOCK, SOCK_STREAM, 0);
> > +    if (sock < 0) {
> > +        error_setg_errno(errp, errno, "Failed to create socket");
> > +        return -1;
> > +    }
> > +    if (connect_state != NULL) {
> > +        qemu_set_nonblock(sock);
> 
> Isn't the presence of vsock support sufficient to prove that we have
> SOCK_NONBLOCK support as part of our socket() call?  In which case,
> wouldn't it be better to pass that option up front to atomically get a
> non-blocking socket, rather than having to change its state after the fact?

I'm sending a separate patch series to introduce a QemuSockFlags
argument for qemu_socket() and qemu_accept().  It will convert existing
qemu_set_nonblock() callers too.

> > +static VsockSocketAddress *vsock_parse(const char *str, Error **errp)
> > +{
> > +    VsockSocketAddress *addr = NULL;
> > +    char cid[33];
> > +    char port[33];
> > +
> > +    if (sscanf(str, "%32[^:]:%32[^,]", cid, port) != 2) {
> 
> Would it be a wise idea to also use %n to ensure that you aren't
> ignoring trailing garbage?

Okay, will fix in the next version.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

  reply	other threads:[~2016-10-07 12:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-06 16:40 [Qemu-devel] [PATCH 0/4] qga: add vsock-listen Stefan Hajnoczi
2016-10-06 16:40 ` [Qemu-devel] [PATCH 1/4] qga: drop unused sockaddr in accept(2) call Stefan Hajnoczi
2016-10-07 16:01   ` Michael Roth
2016-10-06 16:40 ` [Qemu-devel] [PATCH 2/4] qga: drop unnecessary GA_CHANNEL_UNIX_LISTEN checks Stefan Hajnoczi
2016-10-07 16:04   ` Michael Roth
2016-10-06 16:40 ` [Qemu-devel] [PATCH 3/4] sockets: add AF_VSOCK support Stefan Hajnoczi
2016-10-06 18:14   ` Eric Blake
2016-10-07 12:21     ` Stefan Hajnoczi [this message]
2016-10-07 16:42   ` Michael Roth
2016-10-12 15:06     ` Stefan Hajnoczi
2016-10-13 20:20       ` Michael Roth
2016-10-06 16:40 ` [Qemu-devel] [PATCH 4/4] qga: add vsock-listen method Stefan Hajnoczi
2016-10-07 17:07   ` Michael Roth
2016-10-12 15:07     ` Stefan Hajnoczi
2016-10-13 20:29       ` Michael Roth

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=20161007122132.GA5834@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=eblake@redhat.com \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /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).