From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37805) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tkxsf-0000h4-8f for qemu-devel@nongnu.org; Tue, 18 Dec 2012 09:10:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tkxsc-00009j-K4 for qemu-devel@nongnu.org; Tue, 18 Dec 2012 09:10:49 -0500 From: David Howells In-Reply-To: <0C2DB64D-B8EB-492B-876F-111BD818101C@suse.de> References: <0C2DB64D-B8EB-492B-876F-111BD818101C@suse.de> <1355760067-12087-1-git-send-email-bharat.bhushan@freescale.com> Date: Tue, 18 Dec 2012 14:10:20 +0000 Message-ID: <6056.1355839820@warthog.procyon.org.uk> Subject: Re: [Qemu-devel] [PATCH v2] Added uapi directory into linux-header List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: Peter Maydell , Jan Kiszka , Marcelo Tosatti , qemu-devel qemu-devel , dhowells@redhat.com, "qemu-ppc@nongnu.org List" , Bharat Bhushan , Bharat Bhushan Alexander Graf wrote: > But looking through this whole thing, it seems like the root cause is > actually different. We don't want any uapi directories exposed to user > space. So let's go back a step: > > Why do we need the uapi include dir? Because some header is using it. > > linux-headers/asm-powerpc/kvm_para.h: > > #include > > This is the root cause of the problem. We must never manually include any > uapi header paths. We only ever include their normal asm-counterparts which > then may include uapi (in kernel) or actually are uapi (in user > space). David, please correct me if I'm wrong. I think you're correct, if I understand what you're saying. Within the kernel sources, the userspace facing headers are in uapi/ directories whilst the stuff userspace shouldn't see is outside of that. uapi/ headers should _not_ #include headers with uapi/ prefixes; rather they should rely on the -I flags to pull in the UAPI header if the KAPI header of the same name does not exist. However, KAPI headers that shadow UAPI headers (linux/fs.h for example) _must_ manually #include the UAPI header with the uapi/ prefix as there's no other way to reach it. I originally used #include_next for this, but some people refused to countenance it because it's a gcc-ism, but no matter. After doing make headers_install in the kernel, you should find the contents of the appropriate uapi/ directories installed in the target directory without any uapi/ directories present. Further, the _UAPI prefixes on the guards are removed if present. There should be no #includes with "uapi/" in their filenames. David