From: Ian Campbell Subject: Re: [PATCH 20/29] tools/libxl: Update datacopier to support sending data only Date: Thu, 11 Sep 2014 12:56:49 +0100 Message-ID: <1410436609.25388.1.camel@kazak.uk.xensource.com> References: <1410369067-1330-1-git-send-email-andrew.cooper3@citrix.com> <1410369067-1330-21-git-send-email-andrew.cooper3@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1410369067-1330-21-git-send-email-andrew.cooper3@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: Ian Jackson , Wen Congyang , Xen-devel List-Id: xen-devel@lists.xenproject.org On Wed, 2014-09-10 at 18:10 +0100, Andrew Cooper wrote: > From: Wen Congyang > > datacopier is to read some data and write it out. If we > have some data to send it over network, we cannot use > datacopier. Update it to support this case. I'm afraid I'm not sure what this changelog is saying. If we have data to send over the network then why can't we use datacopier? How does making this conditional on readfd's validity help that case? > > Signed-off-by: Wen Congyang > --- > tools/libxl/libxl_aoutils.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/tools/libxl/libxl_aoutils.c b/tools/libxl/libxl_aoutils.c > index b10d2e1..3e0c0ae 100644 > --- a/tools/libxl/libxl_aoutils.c > +++ b/tools/libxl/libxl_aoutils.c > @@ -309,9 +309,11 @@ int libxl__datacopier_start(libxl__datacopier_state *dc) > > libxl__datacopier_init(dc); > > - rc = libxl__ev_fd_register(gc, &dc->toread, datacopier_readable, > - dc->readfd, POLLIN); > - if (rc) goto out; > + if (dc->readfd >= 0) { > + rc = libxl__ev_fd_register(gc, &dc->toread, datacopier_readable, > + dc->readfd, POLLIN); > + if (rc) goto out; > + } > > rc = libxl__ev_fd_register(gc, &dc->towrite, datacopier_writable, > dc->writefd, POLLOUT);