From: "Jan Beulich" Subject: Re: [PATCH v2 1/3] xen/domain_page: Convert map_domain_page_global() to using mfn_t Date: Tue, 14 Jul 2015 12:38:15 +0100 Message-ID: <55A510C70200007800090A49@mail.emea.novell.com> References: <1435838656-9219-1-git-send-email-Ben.Catterall@citrix.com> <559BBF80020000780008D42A@mail.emea.novell.com> <559BA4DE.5000507@citrix.com> <559BCB0C020000780008D499@mail.emea.novell.com> <21923.60840.497467.16673@mariner.uk.xensource.com> <55A4F8EC02000078000908CA@mail.emea.novell.com> <21924.59994.101060.320567@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZEyXS-0003g5-Gu for xen-devel@lists.xenproject.org; Tue, 14 Jul 2015 11:38:18 +0000 In-Reply-To: <21924.59994.101060.320567@mariner.uk.xensource.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Jackson Cc: keir@xen.org, ian.campbell@citrix.com, Andrew Cooper , tim@xen.org, stefano.stabellini@citrix.com, Ben Catterall , xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org >>> On 14.07.15 at 12:54, wrote: > Jan Beulich writes ("Re: [Xen-devel] [PATCH v2 1/3] xen/domain_page: Convert > map_domain_page_global() to using mfn_t"): >> On 13.07.15 at 18:56, wrote: >> > Surely xfree() ought to have the same prototype as free() ? >> >> Why? If it were to be a full match, why wouldn't we call it free() in >> the first place? > > Is that what is supposed to differ between free and xfree ? That > would be a bit odd. > > In the userland world, xfree is the companion to xmalloc: > > > http://manpages.debian.org/cgi-bin/man.cgi?query=xfree&apropos=0&sektion=0&manp > ath=Debian+8+jessie&format=html&locale=en > > (Although, logically speaking, xfree is unnecessary in that set.) And I don't view the hypervisor's xmalloc() as a counterpart to the user mode one, but as one of Linux'es kmalloc(). >> > free is declared in C99 (7.20.3.2 in my copy of TC2) as: >> > >> > void free(void *ptr); >> > >> > That is, non-const. AFAIAA this is not generally regarded as a bug. >> >> Perhaps, but certainly depending on who looks at it. I for my part >> dislike (as hinted at above) that I have to cast away const-ness in >> order to be able to call free() without causing compiler warnings, >> and I generally hide this in wrappers to limit such casting. > > The flipside is that if free can take a const*, functions which take a > const struct foo* can free it. That's not what I would expect such a > function to do. Depends. > Do we need to resolve this disagreement now ? As long as no patch is pending to adjust xfree(), I don't think so. And of course unless you request what the patch here (already have gone in) did to be adjusted. Jan