Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3054863pxb; Mon, 18 Oct 2021 07:23:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxKpRdkpXU82wFvPZ2S1udgVH59aFXCu3a+fcHS0+YLlvFv8GpNDz62ThgsILsT8Iqaqoxv X-Received: by 2002:a17:90a:6b4f:: with SMTP id x15mr47854294pjl.233.1634566993375; Mon, 18 Oct 2021 07:23:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634566993; cv=none; d=google.com; s=arc-20160816; b=lrItqCKBj8NIyNmII80QTyFXyw1NEWKF6q0mUxbv6ML8PR/rtPV+l7jeQ8QkQfwGy1 Wy2ohDpfHXS/VS5Hp8Jv5XzNgbObw0XLNzzkwNbxjUtlLRpk/5cnIvZ2v2XXGs0QHqUL sHbBBm9X+DGWZwtqxcQp78gz1A3zkdlYGnnWLxkkRSio+0yADrYKzSHZ27kcgPVl4bKT bK+zXLXr5u8zsr3A1bdesIL7EjyJANvpiRf/ZRKhCstEwbUrdxSQJ0+ekXDGp/Xc7UP1 dBSBoyHCrQkqyqDrhVBYh7c/DCTn7Uqq7575gCO0Eo0MX6UvJ/yBs30TnfvHDdyrzTB+ a7Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:dkim-signature; bh=wsBzi6/FipbnixO9Ln4BQdmP3LDK7EulRzXGYdFFDfw=; b=arlMk9ssouiaxaKYTG6wJNksRtF48CJUhLQNI75ckOBtcVOSmYBWHflL3LUwACgZpj j/bYiWxfqnTeHnOtubKlYl4TiKwlx3ywVEzEZOyhrfgCt6COw6lNsLBSVi+c6k2LbAta bUkRGaRhliXTMcrTVz05w/NmHzTTAkwfU2jqRwX5HUg1CVY1I1gBfBUyuF/n+YZCS+MQ aqaZFb99kyIS0gev65M4FcIoCjl8+aN3SgEQdFfDFSssMcKePa7sg95aTzKezwluxbCg O2rHyiXGcUGRf1zji5qJfG6vNo00HS+eQDtRjeFVQCal7UDQxJ9A/wn3cv1gbiTyk2pu HroQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=d3Owkt3E; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j2si15290500pfu.4.2021.10.18.07.23.00; Mon, 18 Oct 2021 07:23:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=d3Owkt3E; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231872AbhJROWv (ORCPT + 99 others); Mon, 18 Oct 2021 10:22:51 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:55834 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231855AbhJROWt (ORCPT ); Mon, 18 Oct 2021 10:22:49 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id B9F0E21A8A; Mon, 18 Oct 2021 14:20:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1634566837; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wsBzi6/FipbnixO9Ln4BQdmP3LDK7EulRzXGYdFFDfw=; b=d3Owkt3EMAeSlGnoqWOra3Npjx9Z12TL/Q5MIAYqC/RG3KklZ0CvLlZsomhaM1/GHkAoXq JU6GayJ+K0xJXJxZqkEQ6qO0VXdOkrKbmbOE/b6HbV4DzMEfNbCrY+VvOILSvo7OzVLHmi K7sH+znpqu9Ff8i1Gpzp5MFJWHqZlOA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1634566837; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wsBzi6/FipbnixO9Ln4BQdmP3LDK7EulRzXGYdFFDfw=; b=rNpaFBqB6UabpWmgR3aJxZc6DA7txYY5Y1fFgod3eePAvBm0XCzIx4isOmZB1r14V6i87S DUQKRUX9U2ZMp9CA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A689713E81; Mon, 18 Oct 2021 14:20:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id WvBsG7OCbWGKegAAMHmgww (envelope-from ); Mon, 18 Oct 2021 14:20:35 +0000 Subject: Re: [PATCH] [v2] bcache: hide variable-sized types from uapi header check To: Arnd Bergmann Cc: Arnd Bergmann , Jens Axboe , Kent Overstreet , linux-kernel@vger.kernel.org References: <20210928085554.2299495-1-arnd@kernel.org> From: Coly Li Message-ID: Date: Mon, 18 Oct 2021 22:20:33 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20210928085554.2299495-1-arnd@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/28/21 4:55 PM, Arnd Bergmann wrote: > From: Arnd Bergmann > > The headers_check helper complains about a GNU extension in > one of the exported headers: > > linux/bcache.h:354:2: warning: field '' with variable sized type 'union jset::(anonymous at ./usr/include/linux/bcache.h:354:2)' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end] > BKEY_PADDED(uuid_bucket); > ^ > linux/bcache.h:134:2: note: expanded from macro 'BKEY_PADDED' > union { struct bkey key; __u64 key ## _pad[BKEY_PAD]; } > ^ > > Address this by enclosing the GNU extensions in an #ifdef: Since the > header check is done with --std=c90, this shuts up the warning and makes > it possible to include the header file C90 user space applications, but > allows applications built with --std=gnu89 or higher to use those > parts. > > Another alternative would be to exclude this header from the check, > but the GNU extension check seems more sensible. > > Fixes: 81ab4190ac17 ("bcache: Pull on disk data structures out into a separate header") > Signed-off-by: Arnd Bergmann Hi Arnd, IMHO, remove bcache related header from uapi check might be better solution. So far only bcache-tools uses this header with its own copy, no application includes the header(s) so far. It makes sense to exclude bcache.h from upai headers check. Thanks. Coly Li > --- > v2: use __STRICT_ANSI__ check instead of __KERNEL__. > > I think this version is better than the first, let me know if that > works for you. > --- > include/uapi/linux/bcache.h | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h > index cf7399f03b71..b7901e986193 100644 > --- a/include/uapi/linux/bcache.h > +++ b/include/uapi/linux/bcache.h > @@ -23,9 +23,13 @@ static inline void SET_##name(type *k, __u64 v) \ > struct bkey { > __u64 high; > __u64 low; > +#ifndef __STRICT_ANSI__ > + /* gcc extension not meant for user space */ > __u64 ptr[]; > +#endif > }; > > +#ifndef __STRICT_ANSI__ > #define KEY_FIELD(name, field, offset, size) \ > BITMASK(name, struct bkey, field, offset, size) > > @@ -127,6 +131,8 @@ static inline struct bkey *bkey_idx(const struct bkey *k, unsigned int nr_keys) > > return (struct bkey *) (d + nr_keys); > } > +#endif > + > /* Enough for a key with 6 pointers */ > #define BKEY_PAD 8 >