From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH 2/6] tools/libxl: Update datacopier to support sending data only Date: Fri, 20 Feb 2015 10:27:57 +0000 Message-ID: <1424428077.30924.172.camel@citrix.com> References: <1424277263-27745-1-git-send-email-andrew.cooper3@citrix.com> <1424277263-27745-3-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: <1424277263-27745-3-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: Wei Liu , Ian Jackson , Wen Congyang , Xen-devel List-Id: xen-devel@lists.xenproject.org On Wed, 2015-02-18 at 16:34 +0000, 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. Please can you clarify this commit message. Questions I'm left with after reading it: * What is the relevance of "send it over network" here, why does it matter what the output fd is? Or is this something to do with the lack of an input fd (in which case where does the incoming data come from?) * Why can datacopier not currently be used in this case, what actually goes wrong? * What is the nature of the update which makes it work? (possibly becomes obvious after the previous answers) Thanks. Ian. > > Signed-off-by: Wen Congyang > CC: Ian Campbell > CC: Ian Jackson > CC: Wei Liu > --- > 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);