From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W40Ik-0002XL-9g for qemu-devel@nongnu.org; Thu, 16 Jan 2014 22:41:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W40Ib-0004KE-BQ for qemu-devel@nongnu.org; Thu, 16 Jan 2014 22:40:58 -0500 Received: from e23smtp06.au.ibm.com ([202.81.31.148]:42591) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W40IY-0004IU-4f for qemu-devel@nongnu.org; Thu, 16 Jan 2014 22:40:49 -0500 Received: from /spool/local by e23smtp06.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 17 Jan 2014 13:40:36 +1000 Received: from d23relay03.au.ibm.com (d23relay03.au.ibm.com [9.190.235.21]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id 362C12CE802D for ; Fri, 17 Jan 2014 14:40:34 +1100 (EST) Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay03.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s0H3eLMw10813752 for ; Fri, 17 Jan 2014 14:40:21 +1100 Received: from d23av04.au.ibm.com (localhost [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s0H3eXlV029297 for ; Fri, 17 Jan 2014 14:40:33 +1100 Message-ID: <52D8A62F.7090107@linux.vnet.ibm.com> Date: Fri, 17 Jan 2014 11:40:31 +0800 From: Lei Li MIME-Version: 1.0 References: <1389172376-30636-1-git-send-email-lilei@linux.vnet.ibm.com> <1389172376-30636-6-git-send-email-lilei@linux.vnet.ibm.com> <20140116101631.GC29231@redhat.com> In-Reply-To: <20140116101631.GC29231@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 5/6] virtio-9p-proxy: replace v9fs_receivefd with qemu_recv_with_fd List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: pbonzini@redhat.com, mohan@in.ibm.com, qemu-devel@nongnu.org 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 >> --- >> 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