From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH v2 4/6] tools/libxl: Allow limiting amount copied by datacopier Date: Wed, 11 Mar 2015 12:15:22 +0000 Message-ID: <1426076122.21353.217.camel@citrix.com> References: <1425668741-28003-1-git-send-email-andrew.cooper3@citrix.com> <1425668741-28003-5-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: <1425668741-28003-5-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: Ross Lagerwall , Ian Jackson , Wei Liu , Xen-devel List-Id: xen-devel@lists.xenproject.org On Fri, 2015-03-06 at 19:05 +0000, Andrew Cooper wrote: > From: Ross Lagerwall > > Currently, a datacopier will unconditionally read until EOF on its read fd. > > For migration v2, libxl needs to read records of a specific length out of the > migration stream, without reading any further data. > > Introduce a parameter, maxread, which may be used to stop the datacopier ahead > of reaching EOF. maxread is ok as a parameter but not really in the dc. It's unfortunate that "toread" is already used. Perhaps "remaining" (or remread if you want to get terse)? > diff --git a/tools/libxl/libxl_bootloader.c b/tools/libxl/libxl_bootloader.c > index 79947d4..1503101 100644 > --- a/tools/libxl/libxl_bootloader.c > +++ b/tools/libxl/libxl_bootloader.c > @@ -516,6 +516,7 @@ static void bootloader_gotptys(libxl__egc *egc, libxl__openpty_state *op) > > bl->keystrokes.ao = ao; > bl->keystrokes.maxsz = BOOTLOADER_BUF_OUT; > + bl->keystrokes.maxread = INT_MAX; SSIZE_MAX exists for this I think. But, doesn't this mean that if the bootloader receives INT_MAX (or SIZE_MAX) keystrokes it will mysteriously stop working? Or do we already have that via maxsz?