From: Anthony Liguori Subject: Re: [patch] [3/3] dom0_ops explicitly sized types Date: Fri, 26 May 2006 12:32:35 -0500 Message-ID: <44773BB3.1020103@us.ibm.com> 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> <1148660853.24768.97.camel@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1148660853.24768.97.camel@localhost.localdomain> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Campbell Cc: Muli Ben-Yehuda , xen-devel , xen-ppc-devel@lists.xensource.com, Hollis Blanchard , John Levon List-Id: xen-devel@lists.xenproject.org Ian Campbell wrote: >> 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). > The relevant portions of the spec are: 7.1.3 Reserved identifiers [#1] Each header declares or defines all identifiers listed in its associated subclause, and optionally declares or defines identifiers listed in its associated future library directions subclause and identifiers which are always reserved either for any use or for use as file scope identifiers. - All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use. - All identifiers that begin with an underscore are always reserved for use as macros and as identifiers with file scope in both the ordinary and tag name spaces. - Each macro name in any of the following subclauses (including the future library directions) is reserved for use as specified if any of its associated headers is included; unless explicitly stated otherwise (see 7.1.8 ). - All identifiers with external linkage in any of the following subclauses (including the future library directions) are always reserved for use as identifiers with external linkage.133 - Each identifier with file scope listed in any of the following subclauses (including the future library directions) is reserved for use as macro and as an identifier with file scope in the same name space if any of its associated headers is included. [#2] No other identifiers are reserved. If the program declares or defines an identifier that is reserved in that context (other than as allowed by 7.1.8 ), the behavior is undefined.134 It's pretty clear that __* names are reserved. The kernel is wrong here. The best explanation I've gotten is "egocentrism" :-) Regards, Anthony Liguori > 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. > > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel >