From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Liu Subject: Re: [PATCH v2 05/13] xen-xsplice: Tool to manipulate xsplice payloads (v3) Date: Tue, 19 Jan 2016 11:14:25 +0000 Message-ID: <20160119111425.GP1691@citrix.com> References: <1452808031-706-1-git-send-email-konrad.wilk@oracle.com> <1452808031-706-6-git-send-email-konrad.wilk@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aLUF4-0004f6-Cd for xen-devel@lists.xenproject.org; Tue, 19 Jan 2016 11:14:30 +0000 Content-Disposition: inline In-Reply-To: <1452808031-706-6-git-send-email-konrad.wilk@oracle.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: Konrad Rzeszutek Wilk Cc: wei.liu2@citrix.com, ian.campbell@citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, mpohlack@amazon.com, ross.lagerwall@citrix.com, stefano.stabellini@citrix.com, jbeulich@suse.com, sasha.levin@oracle.com, xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On Thu, Jan 14, 2016 at 04:47:03PM -0500, Konrad Rzeszutek Wilk wrote: [...] > +/* This value was choosen adhoc. It could be 42 too. */ > +#define MAX_LEN 11 > +static int list_func(int argc, char *argv[]) > +{ > + unsigned int idx, done, left, i; > + xen_xsplice_status_t *info = NULL; > + char *id = NULL; > + uint32_t *len = NULL; > + int rc = ENOMEM; > + > + if ( argc ) > + { > + show_help(); > + return -1; > + } > + idx = left = 0; > + info = malloc(sizeof(*info) * MAX_LEN); > + if ( !info ) > + goto out; > + id = malloc(sizeof(*id) * XEN_XSPLICE_NAME_SIZE * MAX_LEN); > + if ( !id ) > + goto out; > + len = malloc(sizeof(*len) * MAX_LEN); > + if ( !len ) > + goto out; > + > + fprintf(stdout," ID | status\n" > + "----------------------------------------+------------\n"); > + do { > + done = 0; > + memset(info, 'A', sizeof(*info) * MAX_LEN); /* Optional. */ > + memset(id, 'i', sizeof(*id) * MAX_LEN * XEN_XSPLICE_NAME_SIZE); /* Optional. */ Line too long. [...] > +static int upload_func(int argc, char *argv[]) > +{ > + char *filename; > + char id[XEN_XSPLICE_NAME_SIZE]; > + int fd = 0, rc; > + struct stat buf; > + unsigned char *fbuf; > + ssize_t len; > + DECLARE_HYPERCALL_BUFFER(char, payload); > + I don't think you need to declare hypercall buffer here in the utility. It should be libxc's responsibility to bounce the buffer accordingly. Wei.