qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Lei Li <lilei@linux.vnet.ibm.com>
To: "Daniel P. Berrange" <berrange@redhat.com>
Cc: pbonzini@redhat.com, mohan@in.ibm.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 5/6] virtio-9p-proxy: replace v9fs_receivefd with qemu_recv_with_fd
Date: Fri, 17 Jan 2014 11:40:31 +0800	[thread overview]
Message-ID: <52D8A62F.7090107@linux.vnet.ibm.com> (raw)
In-Reply-To: <20140116101631.GC29231@redhat.com>

On 01/16/2014 06:16 PM, Daniel P. Berrange wrote:
> On Wed, Jan 08, 2014 at 05:12:55PM +0800, Lei Li wrote:
>> Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
>> ---
>>   hw/9pfs/virtio-9p-proxy.c |   60 ++------------------------------------------
>>   1 files changed, 3 insertions(+), 57 deletions(-)
>>
>> diff --git a/hw/9pfs/virtio-9p-proxy.c b/hw/9pfs/virtio-9p-proxy.c
>> index 5f44bb7..f34b845 100644
>> --- a/hw/9pfs/virtio-9p-proxy.c
>> +++ b/hw/9pfs/virtio-9p-proxy.c
>> -    do {
>> -        retval = recvmsg(sockfd, &msg, 0);
>> -    } while (retval < 0 && errno == EINTR);
>> -    if (retval <= 0) {
>> -        return retval;
>> -    }
>> -    /*
>> -     * data is set to V9FS_FD_VALID, if ancillary data is sent.  If this
>> -     * request doesn't need ancillary data (fd) or an error occurred,
>> -     * data is set to negative errno value.
>> -     */
>> -    if (data != V9FS_FD_VALID) {
>> -        *status = data;
>> -        return 0;
>> -    }
> This code is handling the 'data' value...
>
>
>> @@ -307,6 +252,7 @@ static int v9fs_request(V9fsProxy *proxy, int type,
>>       V9fsString *name, *value;
>>       V9fsString *path, *oldpath;
>>       struct iovec *iovec = NULL, *reply = NULL;
>> +    int data = V9FS_FD_VALID;
>>   
>>       qemu_mutex_lock(&proxy->mutex);
>>   
>> @@ -548,7 +494,7 @@ static int v9fs_request(V9fsProxy *proxy, int type,
>>            * A file descriptor is returned as response for
>>            * T_OPEN,T_CREATE on success
>>            */
>> -        if (v9fs_receivefd(proxy->sockfd, &retval) < 0) {
>> +        if (qemu_recv_with_fd(proxy->sockfd, &retval, &data, sizeof(data)) < 0) {
>>               goto close_error;
>>           }
> ...but this code is ignoring the return value in 'data'.

It is not be ignored. The above logical is put into the common
method, like:

     if (data != *(int *)buf) {
         *passed_fd = data;
         return 0;
     }

>
>
> Daniel


-- 
Lei

  reply	other threads:[~2014-01-17  3:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-08  9:12 [Qemu-devel] [PATCH resend 0/6 RFC] Provide common methods for exchange FD Lei Li
2014-01-08  9:12 ` [Qemu-devel] [PATCH 1/6] qemu-fd-exchange: provide common methods for exchange fd Lei Li
2014-01-16 15:16   ` Eric Blake
2014-01-17  3:40     ` Lei Li
2014-01-16 15:26   ` Eric Blake
2014-01-17  3:41     ` Lei Li
2014-01-17 10:02   ` Daniel P. Berrange
2014-01-20  1:50     ` Lei Li
2014-01-08  9:12 ` [Qemu-devel] [PATCH 2/6] qemu-bridge-helper: replace send_fd with qemu_send_with_fd Lei Li
2014-01-08  9:12 ` [Qemu-devel] [PATCH 3/6] net/tap: replace recv_fd with qemu_recv_with_fd Lei Li
2014-01-08  9:12 ` [Qemu-devel] [PATCH 4/6] virtfs-proxy-helper: replace send_fd with qemu_send_with_fd Lei Li
2014-01-16 10:15   ` Daniel P. Berrange
2014-01-17  3:40     ` Lei Li
2014-01-08  9:12 ` [Qemu-devel] [PATCH 5/6] virtio-9p-proxy: replace v9fs_receivefd with qemu_recv_with_fd Lei Li
2014-01-16 10:16   ` Daniel P. Berrange
2014-01-17  3:40     ` Lei Li [this message]
2014-01-08  9:12 ` [Qemu-devel] [PATCH 6/6] migration-local: replace send_pipefd with qemu_send_with_fd Lei Li
2014-01-16  9:26 ` [Qemu-devel] [PATCH resend 0/6 RFC] Provide common methods for exchange FD Lei Li
2014-01-16 10:17 ` Daniel P. Berrange

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=52D8A62F.7090107@linux.vnet.ibm.com \
    --to=lilei@linux.vnet.ibm.com \
    --cc=berrange@redhat.com \
    --cc=mohan@in.ibm.com \
    --cc=pbonzini@redhat.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).