Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752526AbdHIIYc (ORCPT ); Wed, 9 Aug 2017 04:24:32 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:37323 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752410AbdHIIYa (ORCPT ); Wed, 9 Aug 2017 04:24:30 -0400 MIME-Version: 1.0 In-Reply-To: <20170808230826.GE4474@magnolia> References: <20170806164428.2273-1-mikko.rapeli@iki.fi> <20170806164428.2273-34-mikko.rapeli@iki.fi> <20170807155445.GA4074@magnolia> <20170807164505.GC4474@magnolia> <20170808230826.GE4474@magnolia> From: Arnd Bergmann Date: Wed, 9 Aug 2017 10:24:28 +0200 X-Google-Sender-Auth: ARwgViAPf3JU9i2vigup3l4XTao Message-ID: Subject: Re: [PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t To: "Darrick J. Wong" Cc: Mikko Rapeli , Linux Kernel Mailing List , Linux API , "Theodore Ts'o" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2008 Lines: 44 On Wed, Aug 9, 2017 at 1:08 AM, Darrick J. Wong wrote: > On Mon, Aug 07, 2017 at 10:20:58PM +0200, Arnd Bergmann wrote: >> On Mon, Aug 7, 2017 at 6:45 PM, Darrick J. Wong wrote: >> > On Mon, Aug 07, 2017 at 06:01:43PM +0200, Arnd Bergmann wrote: >> >> On Mon, Aug 7, 2017 at 5:54 PM, Darrick J. Wong wrote: >> >> > On Sun, Aug 06, 2017 at 06:44:24PM +0200, Mikko Rapeli wrote: >> >> >> >> Either way works, but including a system header from a kernel header >> >> requires an additional "#ifndef __KERNEL__" check, so I think Miko's >> >> variant is a little nicer. >> >> >> >> Generally speaking, you also want to avoid including system headers >> >> indirectly from kernel headers, as POSIX requires that including one >> >> system header should not indirectly make symbols from other system >> >> headers visible. I think this is not a problem here though, as no system >> >> header should include linux/fsmap.h. >> > >> > Sorry, I guess I was a little unclear about what I was asking -- I was >> > wondering why can't the userspace program include sys/types.h prior to >> > linux/fsmap.h? I wasn't proposing including C library headers in kernel >> > headers. >> > >> > I think the patch author is pushing towards kernel headers never relying >> > on /anything/ in the system headers. >> >> Right, and I think that is a good thing to have, because it allows us to >> do better compile-time testing of the exported kernel headers. >> >> > For data structures being >> > exchanged with the kernel I agree, but the fsmap_sizeof result is never >> > passed to or received from the kernel; it exists purely for malloc >> > convenience. >> >> Would you prefer making fsmap_sizeof a macro? That would also >> make it possible to do static checking on the header without having >> to resort to odd types. > > Ick, no macros, please. :) > > How about just change it to unsigned long long and call it a day? Works for me. Arnd