From mboxrd@z Thu Jan 1 00:00:00 1970 From: George Dunlap Subject: Re: [PATCH v2 5/5] libxl, hvmloader: Don't relocate memory for MMIO hole Date: Thu, 20 Jun 2013 11:59:45 +0100 Message-ID: <51C2E0A1.3060202@eu.citrix.com> References: <1371573984-28514-1-git-send-email-george.dunlap@eu.citrix.com> <1371573984-28514-5-git-send-email-george.dunlap@eu.citrix.com> <51C2C9E0.6060006@eu.citrix.com> <51C2F1A502000078000DF4B7@nat28.tlf.novell.com> <51C2D77D.90103@eu.citrix.com> <51C2FBF202000078000DF53F@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <51C2FBF202000078000DF53F@nat28.tlf.novell.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: Jan Beulich Cc: Ian Campbell , Hanweidong , Stefano Stabellini , xen-devel@lists.xen.org, Stefano Stabellini , Ian Jackson List-Id: xen-devel@lists.xenproject.org On 20/06/13 11:56, Jan Beulich wrote: >>>> On 20.06.13 at 12:29, Stefano Stabellini wrote: >> On Thu, 20 Jun 2013, George Dunlap wrote: >>> On 20/06/13 11:12, Jan Beulich wrote: >>>> However, if we want to be on the safe side and also make the >>>> code work with a compiler that doesn't have a built-in _Bool, I'd >>>> think >>>> >>>> allow_memory_relocate = !s || strtoll(s, NULL, 0); >>>> >>>> would be the better statement (without any if() surrounding it, >>>> and without the variable declaration having an initializer. >>> Doing this would effectively hide the "default" value. This is bad because 1) >>> it's not clear what the default is to someone just scanning the code, 2) it's >>> hard to change. (Consider how you'd modify the above statement if you wanted >>> to default to 0 instead.) >> I would avoid the strtoll altogether: >> >> if (s != NULL && s[0] != '0') >> allow_memory_relocate = 1; >> else >> allow_memory_relocate = 0; > Let's not add hacks like this - a string of "0x1" ought to not be > mis-interpreted as meaning 0. I'm pretty sure the xs protocol specifies "0" or "1" for booleans, so "0x1" would be undefined anyway. -George