From: Ian Campbell Subject: Re: PATCH [base vtpm and libxl patches 4/6] add iomem support to libxl Date: Wed, 26 Sep 2012 09:52:29 +0100 Message-ID: <1348649549.19176.15.camel@zakaz.uk.xensource.com> References: <505CBA02.5040308@jhuapl.edu> <1348569044.3452.176.camel@zakaz.uk.xensource.com> <5061E293.7000106@jhuapl.edu> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <5061E293.7000106@jhuapl.edu> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Matthew Fioravante Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On Tue, 2012-09-25 at 17:57 +0100, Matthew Fioravante wrote: > >> @@ -1005,6 +1005,30 @@ static void parse_config_data(const char > >> *config_source, > >> } > >> } > >> > >> + if (!xlu_cfg_get_list(config, "iomem", &iomem, &num_iomem, 0)) { > >> + b_info->num_iomem = num_iomem; > >> + b_info->iomem = calloc(num_iomem, sizeof(*b_info->iomem)); > >> + if (b_info->iomem == NULL) { > >> + fprintf(stderr, "unable to allocate memory for iomem\n"); > >> + exit(-1); > >> + } > >> + for (i = 0; i < num_iomem; i++) { > >> + buf = xlu_cfg_get_listitem (iomem, i); > >> + if (!buf) { > >> + fprintf(stderr, > >> + "xl: Unable to get element %d in iomem list\n", i); > >> + exit(1); > >> + } > >> + if(sscanf(buf, "%" SCNx64",%" SCNu64, > >> &b_info->iomem[i].start, &b_info->iomem[i].number) != 2) { > > This should be relatively simply to parse with strtoul (see the ioports > > case) which would allow people to select hex or decimal in their > > configuration files. > Do we want to support hex or decimal? Pretty much anytime people start > talking about physical memory addresses or page numbers they use hex. > Also the ioports code actually only supports hexadecimal as it sets the > base in strtoul to 16. It also explicitly says in the xl.cfg manpage > that ioports should be given in hex. Good point. You mix decimal (SCNu64) and hex (SCNx64) though, it would be better to be consistent (in hex) I think. Ian