Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp444905rwi; Mon, 31 Oct 2022 03:36:15 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4HR5nkOHmhjPHk0ASWKobUU+54vb5Q1K/Dm93uA8a2k1E/rnS+f5g0mDc50nn3z1qKt8GK X-Received: by 2002:a17:906:4f82:b0:7ad:c7d6:eee5 with SMTP id o2-20020a1709064f8200b007adc7d6eee5mr6376811eju.681.1667212575440; Mon, 31 Oct 2022 03:36:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667212575; cv=none; d=google.com; s=arc-20160816; b=ikiXPYYTIpUgJbiL0SzTwsNWxMm5dYQgYdTXHfiWgw7bF+tzcm0KFw3TONMXhfnU9N M0fYoqLHzflXJCphJvCnXm3AB9n2GF/JoW7v1K8VYEqXoxo5TUgJZAlVVbq/VuH7SGJu WQ/tVjRUbe476yFvbrGRVtjbB7aZJYmCOjhKwVAX+KlP8fugn3iCs9I8QMAD74BS4BjK xBTyXOSIi6zlAe/GWX1FZ1JCgCcRXk1Rh/0o/YywpHIuKaofEN2NRM4fKDVviwjplm4Y /neEBTEM42Sg7NgafaGZBXltbU0aqNnztAKru2T07MSSWN9RBVlUTb+CG6DqE4gWEIx5 i+hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=PFiQU7PkO4+IJKLIL7GYpGHBxoHyCoystO+VKwk16rg=; b=jUTXMfDDbL0XPq4cVh8ueJm+v5PeGIAkgfmbNMPfQvE1IGeKqIbb0NKb8PMY2mlu+O jO3u2HiaGf9t3X8acMZ+KEjE9sAKzJjV6J+uhBuU6enHKGmig5+jnt9yLVeDbltZ6E7A VLo2/60YVbM/aDU+3Q50qUL+DU1R2gosQC/GfCIrjxsVl5+B0cYk2i44A1+YqUsaCJC/ NUfiORQlIfF+StAPWc/usI1FQFg+BbOoj0vO93rAID3swWdu4muu26SheFh8J3//2VeA EyZw0YTRjzxS9swC4LnobJgzph2ow/DmxFh8ZWFq2RGw1aLambPnx95iDAzNaKYG2CQs JceA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs36-20020a1709072d2400b00783d5a873dcsi8479568ejc.341.2022.10.31.03.35.49; Mon, 31 Oct 2022 03:36:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230043AbiJaJeU (ORCPT + 99 others); Mon, 31 Oct 2022 05:34:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229500AbiJaJeS (ORCPT ); Mon, 31 Oct 2022 05:34:18 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8AD52FB; Mon, 31 Oct 2022 02:34:16 -0700 (PDT) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4N17C42K5RzVjKr; Mon, 31 Oct 2022 17:29:20 +0800 (CST) Received: from kwepemm600003.china.huawei.com (7.193.23.202) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 31 Oct 2022 17:34:14 +0800 Received: from ubuntu1804.huawei.com (10.67.174.61) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 31 Oct 2022 17:34:14 +0800 From: Yang Jihong To: , , , , CC: Subject: [PATCH] tools headers UAPI: Sync linux/stddef.h with the kernel sources Date: Mon, 31 Oct 2022 17:30:57 +0800 Message-ID: <20221031093057.29050-1-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.61] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit 036b8f5b8970 ("tools headers uapi: Update linux/in.h copy") modify tools/include/uapi/linux/in.h, and __DECLARE_FLEX_ARRAY is introduced. Macro is not defined in tools/include, compilation fails: CLNG-BPF [test_maps] bind4_prog.bpf.o In file included from progs/bind4_prog.c:7: /root/linux-mainline-new/linux/tools/include/uapi/linux/in.h:199:3: error: type name requires a specifier or qualifier __DECLARE_FLEX_ARRAY(__be32, imsf_slist_flex); ^ /root/linux-mainline-new/linux/tools/include/uapi/linux/in.h:199:32: error: type specifier missing, defaults to 'int' [-Werror,-Wimplicit-int] __DECLARE_FLEX_ARRAY(__be32, imsf_slist_flex); ^ 2 errors generated. Synchronize include/uapi/linux/stddef.h to tools headers directory, and delete the line "#include ": # cp ./include/uapi/linux/stddef.h tools/include/uapi/linux/stddef.h # sed -i '/#include /,+1d' tools/include/uapi/linux/stddef.h And add missed header in tools/include/uapi/linux/in.h. Fixes: 036b8f5b8970 (tools headers uapi: Update linux/in.h copy) Signed-off-by: Yang Jihong --- tools/include/uapi/linux/in.h | 1 + tools/include/uapi/linux/stddef.h | 45 +++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 tools/include/uapi/linux/stddef.h diff --git a/tools/include/uapi/linux/in.h b/tools/include/uapi/linux/in.h index f243ce665f74..79015665daf1 100644 --- a/tools/include/uapi/linux/in.h +++ b/tools/include/uapi/linux/in.h @@ -22,6 +22,7 @@ #include #include #include +#include #if __UAPI_DEF_IN_IPPROTO /* Standard well-defined IP protocols. */ diff --git a/tools/include/uapi/linux/stddef.h b/tools/include/uapi/linux/stddef.h new file mode 100644 index 000000000000..72bcdf96999f --- /dev/null +++ b/tools/include/uapi/linux/stddef.h @@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _UAPI_LINUX_STDDEF_H +#define _UAPI_LINUX_STDDEF_H + +#ifndef __always_inline +#define __always_inline inline +#endif + +/** + * __struct_group() - Create a mirrored named and anonyomous struct + * + * @TAG: The tag name for the named sub-struct (usually empty) + * @NAME: The identifier name of the mirrored sub-struct + * @ATTRS: Any struct attributes (usually empty) + * @MEMBERS: The member declarations for the mirrored structs + * + * Used to create an anonymous union of two structs with identical layout + * and size: one anonymous and one named. The former's members can be used + * normally without sub-struct naming, and the latter can be used to + * reason about the start, end, and size of the group of struct members. + * The named struct can also be explicitly tagged for layer reuse, as well + * as both having struct attributes appended. + */ +#define __struct_group(TAG, NAME, ATTRS, MEMBERS...) \ + union { \ + struct { MEMBERS } ATTRS; \ + struct TAG { MEMBERS } ATTRS NAME; \ + } + +/** + * __DECLARE_FLEX_ARRAY() - Declare a flexible array usable in a union + * + * @TYPE: The type of each flexible array element + * @NAME: The name of the flexible array member + * + * In order to have a flexible array member in a union or alone in a + * struct, it needs to be wrapped in an anonymous struct with at least 1 + * named member, but that member can be empty. + */ +#define __DECLARE_FLEX_ARRAY(TYPE, NAME) \ + struct { \ + struct { } __empty_ ## NAME; \ + TYPE NAME[]; \ + } +#endif -- 2.30.GIT