From: Ian Campbell Subject: Re: [patch] [3/3] dom0_ops explicitly sized types Date: Fri, 26 May 2006 17:27:33 +0100 Message-ID: <1148660853.24768.97.camel@localhost.localdomain> References: <1148509900.26460.22.camel@basalt.austin.ibm.com> <1148511175.26460.35.camel@basalt.austin.ibm.com> <1148511400.26460.39.camel@basalt.austin.ibm.com> <1148511874.26460.47.camel@basalt.austin.ibm.com> <20060525153957.GO6710@rhun.ibm.com> <1148583731.15517.16.camel@basalt.austin.ibm.com> <20060526133221.GA5569@rhun.e-centre.net> <1148653733.24768.49.camel@localhost.localdomain> <1148657437.26643.5.camel@basalt.austin.ibm.com> Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1148657437.26643.5.camel@basalt.austin.ibm.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Hollis Blanchard Cc: Muli Ben-Yehuda , John Levon , xen-devel , xen-ppc-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On Fri, 2006-05-26 at 10:30 -0500, Hollis Blanchard wrote: > On Fri, 2006-05-26 at 15:28 +0100, Ian Campbell wrote: > > On Fri, 2006-05-26 at 16:32 +0300, Muli Ben-Yehuda wrote: > > > > I assume you're referring specifically to the privcmd structure change, > > > > which is the only Linux-specific part of the patch. The privcmd > > > > structure is shared between userspace and the kernel. Since "u64" is a > > > > kernel type, we need to use "uint64_t", which has meaning in > > > > userspace. > > > > > > Oh well, I didn't realize it was shared with userspace... sorry for > > > the false alarm. > > > > I think Linus' opinion[0] is that kernel headers which are shared with > > userspace cannot assume that stdint.h has been included so you need to > > use __u64 and friends. > > > > Ian. > > > > [0] http://www.ussg.iu.edu/hypermail/linux/kernel/0412.1/1456.html. > > There's been plenty of other traffic in lkml about it too. > > There certainly has been plenty of traffic, but I have seen no clear > statements (other than "THIS IS BAD" with little explanation). In fact > there was just a thread about it this month > (http://www.ussg.iu.edu/hypermail/linux/kernel/0605.0/0146.html), and I > still don't understand the objections. > > If you use __u64, you'd need to include some header defining what __u64 > is, so you're requiring another header anyways. You might as well use > the standard stdint.h rather than inventing your own. As I understand it the issue is that the C spec makes the __* namespace available for the kernel to pollute and reserves the non-prefixed namespace for application usage. (Single underscore is for compiler or libc internals or something). An application which has not included stdint.h itself can expect to use uint64_t however it wishes, including making it a struct, a function or even something as gross as a 32 bit signed int etc. Exporting some other idea of what uint64_t should be via the kernel headers breaks this. I guess this is more of a problem when a kernel header gets indirectly included -- presumably an app which includes a kernel header directly knows what it is doing. Anyway, regardless of any opinion expressed here the Linux gatekeepers will no doubt insist on __uN. We might as well do it now as change it later. Ian.