Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936120Ab3DPUAj (ORCPT ); Tue, 16 Apr 2013 16:00:39 -0400 Received: from mail-vb0-f42.google.com ([209.85.212.42]:38963 "EHLO mail-vb0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935189Ab3DPUAi (ORCPT ); Tue, 16 Apr 2013 16:00:38 -0400 MIME-Version: 1.0 In-Reply-To: References: <1366058481-21033-1-git-send-email-ccross@android.com> Date: Tue, 16 Apr 2013 13:00:37 -0700 X-Google-Sender-Auth: PPBgEPuMn_mhZ3s-jvyL7jhtJ6c Message-ID: Subject: Re: [PATCH] fuse: use kernel headers when __KERNEL__ is set From: Colin Cross To: Miklos Szeredi Cc: Linus Torvalds , lkml , "open list:FUSE: FILESYSTEM..." , =?ISO-8859-1?Q?Arve_Hj=F8nnev=E5g?= Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2946 Lines: 66 On Tue, Apr 16, 2013 at 12:11 PM, Miklos Szeredi wrote: > On Tue, Apr 16, 2013 at 8:29 PM, Colin Cross wrote: >> Dropping __linux__ causes a make headers_check warning, which the >> kbuild test robot reported this morning: >> usr/include/linux/fuse.h:99: found __[us]{8,16,32,64} type without >> #include >> Using my patch without modification does not cause that warning. >> >> linux/types.h defines the types that are used to communicate between >> the kernel and userspace. Redefining those in each header makes no >> sense, and will probably cause redefined types warnings if you compile >> a userspace file that includes fuse.h and another uapi header that >> properly includes linux/types.h. > > is linux specific while the fuse API is cross > platform. So the userspace header obviously has to use some cross > platform type definitions. Making the type definitions depend on > __linux__ is probably just as unreliable in userspace as it is in the > kernel, so why complicate things with that? I'm not sure what you mean by __linux__ being unreliable, it is set by any toolchain that is compield with linux as its target. It should be very reliable in userspace, its only unreliable in the kernel because the kernel doesn't rely on any specific os target in the toolchain, it is self contained. With your change, compiling a program that includes linux/fuse.h and linux/icmp.h against the headers installed by make headers_installed results in some strange preprocessor results. The lines in int-ll64.h, which is what normally defines the userspace types, are: typedef __signed__ char __s8; typedef unsigned char __u8; typedef __signed__ short __s16; typedef unsigned short __u16; typedef __signed__ int __s32; typedef unsigned int __u32; After preprocessing with your fuse.h included before icmp.h (which includes linux/types.h, which eventually includes asm-generic/int-ll64.h): typedef __signed__ char __s8; typedef unsigned char __u8; typedef __signed__ short __s16; typedef unsigned short uint16_t; typedef __signed__ int int32_t; typedef unsigned int uint32_t; The first three lines are the kernel headers providing typedefs for the types that are not used in fuse.h, and therefore not covered by the #define hacks there. The last three lines are a problem: now you have redefined the stdint types to match the kernel's types, better hope they match the host's stdint definitions or you'll get redefined type warnings. Every other uapi header includes linux/types.h to get its type definitions, and fuse.h should do the same when compiling for userspace targeting linux or when compiling the kernel. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/