From patchwork Mon Apr 4 06:19:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 12799943 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBD01C433FE for ; Mon, 4 Apr 2022 06:20:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377455AbiDDGWi (ORCPT ); Mon, 4 Apr 2022 02:22:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377422AbiDDGWd (ORCPT ); Mon, 4 Apr 2022 02:22:33 -0400 Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFA8C377ED; Sun, 3 Apr 2022 23:20:30 -0700 (PDT) Received: from grover.. (133-32-177-133.west.xps.vectant.ne.jp [133.32.177.133]) (authenticated) by conuserg-08.nifty.com with ESMTP id 2346K1Bk008244; Mon, 4 Apr 2022 15:20:02 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com 2346K1Bk008244 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1649053202; bh=a1RDShE0uWC0OhbAt+4QzV+tQ/pdHe8WAiRE756c3W0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fJPyIo+5xtFjhpXfI/BagGdqzFGxiVFbkzFEFKe/4hq72+9HM+ofFhg3C+avRmDFi hza7CyscxdpcubFRlNiLS0kbH61rK+vhmw6kZAm7CaNkIeAEntqhg53Vk4rcNy1ywo x/TGhBjhkBk8txewXSq0PGSbyR19/mmt9p8GzRs5zqjnD5m+k2cYD2Xe4nTnoicemn 47NSP1iNGOYi50tRjT1+05Skq/DjvIpW0r2NYOgLpzSCW6tUYxSVx6uVWAFxpyAllz 3fTV+2QMQb9SQbK52ZNYV6nGQynwNpHpAMaAfT3YMuhr98ArpRyfEJ/QCVf2X7apei HNSlPD8YILMog== X-Nifty-SrcIP: [133.32.177.133] From: Masahiro Yamada To: Arnd Bergmann , linux-kernel@vger.kernel.org Cc: linux-kbuild@vger.kernel.org, linux-arch@vger.kernel.org, Masahiro Yamada Subject: [PATCH 1/8] agpgart.h: do not include from exported header Date: Mon, 4 Apr 2022 15:19:41 +0900 Message-Id: <20220404061948.2111820-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220404061948.2111820-1-masahiroy@kernel.org> References: <20220404061948.2111820-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Commit 35d0f1d54ecd ("include/uapi/linux/agpgart.h: include stdlib.h in userspace") included to fix the unknown size_t error, but I do not think it is the right fix. This header already uses __kernel_size_t a few lines below. Replace the remaining size_t, and stop including . Signed-off-by: Masahiro Yamada Reviewed-by: Christoph Hellwig Reviewed-by: Nick Desaulniers --- include/uapi/linux/agpgart.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/include/uapi/linux/agpgart.h b/include/uapi/linux/agpgart.h index f5251045181a..9cc3448c0b5b 100644 --- a/include/uapi/linux/agpgart.h +++ b/include/uapi/linux/agpgart.h @@ -52,7 +52,6 @@ #ifndef __KERNEL__ #include -#include struct agp_version { __u16 major; @@ -64,10 +63,10 @@ typedef struct _agp_info { __u32 bridge_id; /* bridge vendor/device */ __u32 agp_mode; /* mode info of bridge */ unsigned long aper_base;/* base of aperture */ - size_t aper_size; /* size of aperture */ - size_t pg_total; /* max pages (swap + system) */ - size_t pg_system; /* max pages (system) */ - size_t pg_used; /* current pages used */ + __kernel_size_t aper_size; /* size of aperture */ + __kernel_size_t pg_total; /* max pages (swap + system) */ + __kernel_size_t pg_system; /* max pages (system) */ + __kernel_size_t pg_used; /* current pages used */ } agp_info; typedef struct _agp_setup { From patchwork Mon Apr 4 06:19:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 12799945 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7B79C4321E for ; Mon, 4 Apr 2022 06:20:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377438AbiDDGWk (ORCPT ); Mon, 4 Apr 2022 02:22:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377432AbiDDGWe (ORCPT ); Mon, 4 Apr 2022 02:22:34 -0400 Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A2A937A38; Sun, 3 Apr 2022 23:20:34 -0700 (PDT) Received: from grover.. (133-32-177-133.west.xps.vectant.ne.jp [133.32.177.133]) (authenticated) by conuserg-08.nifty.com with ESMTP id 2346K1Bl008244; Mon, 4 Apr 2022 15:20:03 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com 2346K1Bl008244 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1649053203; bh=evk6/aYPuF2OY3xkmu3cNWpVgpoeGt39vDeD/Q5in9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qN8rma96BAx4qoBdu4TnTxvEqbo++kPrCIAYSURH3m+VD4ye6kWp4TOPDWkN6jIeR 2RQzITJQ0Ej5T3duadfncDESM66XaGPayX8VZD5iFApNjWUqrj8Kbl3cYzanZ7R6iD OnHFIMXPiwHTRziYWG5WVafQlzU/RBZgPDY5mIXYt8mjFfvk4v6WIxJvq077XT0+3+ LT3IyOny5PRlMyW3yGfuNI0sEYPdQNMd1aGMfPeeWnmSaHL9iAEWqdR8A3GkOUwBvh zxvo6vsPB/pluueOhqDf9pgvXQUBR5wcAlMKsnsZoAZ1pIAVJDL9LhBPDHvOkzBvS8 4TjAEecDSY3Rg== X-Nifty-SrcIP: [133.32.177.133] From: Masahiro Yamada To: Arnd Bergmann , linux-kernel@vger.kernel.org Cc: linux-kbuild@vger.kernel.org, linux-arch@vger.kernel.org, Masahiro Yamada , Greg Kroah-Hartman Subject: [PATCH 2/8] kbuild: prevent exported headers from including , Date: Mon, 4 Apr 2022 15:19:42 +0900 Message-Id: <20220404061948.2111820-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220404061948.2111820-1-masahiroy@kernel.org> References: <20220404061948.2111820-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Some UAPI headers included , like this: #ifndef __KERNEL__ #include #endif As it turned out, they just included it for no good reason. After some fixes, now I can compile-test UAPI headers (CONFIG_UAPI_HEADER_TEST=y) without including from the system header search paths. To avoid somebody getting it back again, this commit adds the dummy header, usr/dummy-include/stdlib.h I added $(srctree)/usr/dummy-include to the header search paths. Because it is searched before the system directories, if someone tries to include , they will see the error message. While I am here, I also replaced $(objtree)/usr/include with $(obj), but it has no functional change. If we can make kernel headers self-contained (that is, none of exported kernel headers includes system headers), we will be able to add the -nostdinc flag, but that is much far from where we stand now. As a realistic solution, we can ban header inclusion individually by putting a dummy header into usr/dummy-include/. Currently, no header include . I put it as well before somebody attempts to use it. Signed-off-by: Masahiro Yamada Reviewed-by: Greg Kroah-Hartman --- usr/dummy-include/stdbool.h | 7 +++++++ usr/dummy-include/stdlib.h | 7 +++++++ usr/include/Makefile | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 usr/dummy-include/stdbool.h create mode 100644 usr/dummy-include/stdlib.h diff --git a/usr/dummy-include/stdbool.h b/usr/dummy-include/stdbool.h new file mode 100644 index 000000000000..54ff9e9c90ac --- /dev/null +++ b/usr/dummy-include/stdbool.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef _STDBOOL_H +#define _STDBOOL_H + +#error "Please do not include from exported headers" + +#endif /* _STDBOOL_H */ diff --git a/usr/dummy-include/stdlib.h b/usr/dummy-include/stdlib.h new file mode 100644 index 000000000000..e8c21888e371 --- /dev/null +++ b/usr/dummy-include/stdlib.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef _STDLIB_H +#define _STDLIB_H + +#error "Please do not include from exported headers" + +#endif /* _STDLIB_H */ diff --git a/usr/include/Makefile b/usr/include/Makefile index fa9819e022b7..7740777b49f8 100644 --- a/usr/include/Makefile +++ b/usr/include/Makefile @@ -15,7 +15,7 @@ UAPI_CFLAGS += $(filter -m32 -m64 --target=%, $(KBUILD_CFLAGS)) # USERCFLAGS might contain sysroot location for CC. UAPI_CFLAGS += $(USERCFLAGS) -override c_flags = $(UAPI_CFLAGS) -Wp,-MMD,$(depfile) -I$(objtree)/usr/include +override c_flags = $(UAPI_CFLAGS) -Wp,-MMD,$(depfile) -I $(obj) -I $(srctree)/usr/dummy-include # The following are excluded for now because they fail to build. # From patchwork Mon Apr 4 06:19:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 12799939 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62C8EC4321E for ; Mon, 4 Apr 2022 06:20:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377444AbiDDGWf (ORCPT ); Mon, 4 Apr 2022 02:22:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357066AbiDDGWd (ORCPT ); Mon, 4 Apr 2022 02:22:33 -0400 Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC3C03701E; Sun, 3 Apr 2022 23:20:29 -0700 (PDT) Received: from grover.. (133-32-177-133.west.xps.vectant.ne.jp [133.32.177.133]) (authenticated) by conuserg-08.nifty.com with ESMTP id 2346K1Bm008244; Mon, 4 Apr 2022 15:20:03 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com 2346K1Bm008244 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1649053204; bh=onG4O2hzMHEf6qaqVbfAftNHSCP2ymImYtDLBkce8BQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2XCo8+ynA3ZkPRPZ7e5rOjcfamztHNMENTk32k5hxLI+HMilH74Q0q/4DEMs8F1eW SqgpNq7yzHZXEwMUflVNuAdx2FUyIENfjDwDqU/yMmLGGMWWN0rA8eZvoVeZUz+y3b F7n/+MuasgOanikBN4CaUZPYL26svTCQWrH7ag+lbyJ9ZSl0eYAl/GkFXJojSE/Et4 9JhOrQBJH0eW7tff++Y+vkbGMQFaSSsteMERZSvPHdkqRm+oCfXvkM0zJqjBO887JK HUdIKzFRTmTkjwaW3P6eZ5IReuBOS20jNpYmeG6XWKgxQPG1O5exOm92VPgJlwurR9 QjtyMYXp0X8GA== X-Nifty-SrcIP: [133.32.177.133] From: Masahiro Yamada To: Arnd Bergmann , linux-kernel@vger.kernel.org Cc: linux-kbuild@vger.kernel.org, linux-arch@vger.kernel.org, Masahiro Yamada Subject: [PATCH 3/8] riscv: add linux/bpf_perf_event.h to UAPI compile-test coverage Date: Mon, 4 Apr 2022 15:19:43 +0900 Message-Id: <20220404061948.2111820-4-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220404061948.2111820-1-masahiroy@kernel.org> References: <20220404061948.2111820-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org I can compile this for ARCH=riscv with CONFIG_UAPI_HEADER_TEST=y. Signed-off-by: Masahiro Yamada Reviewed-by: Christoph Hellwig --- usr/include/Makefile | 4 ---- 1 file changed, 4 deletions(-) diff --git a/usr/include/Makefile b/usr/include/Makefile index 7740777b49f8..a1a8403896cf 100644 --- a/usr/include/Makefile +++ b/usr/include/Makefile @@ -74,10 +74,6 @@ no-header-test += asm/stat.h no-header-test += linux/bpf_perf_event.h endif -ifeq ($(SRCARCH),riscv) -no-header-test += linux/bpf_perf_event.h -endif - ifeq ($(SRCARCH),sparc) no-header-test += asm/stat.h no-header-test += asm/uctx.h From patchwork Mon Apr 4 06:19:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 12799942 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CC93C4167E for ; Mon, 4 Apr 2022 06:20:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377452AbiDDGWh (ORCPT ); Mon, 4 Apr 2022 02:22:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377427AbiDDGWd (ORCPT ); Mon, 4 Apr 2022 02:22:33 -0400 Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35D423700C; Sun, 3 Apr 2022 23:20:29 -0700 (PDT) Received: from grover.. (133-32-177-133.west.xps.vectant.ne.jp [133.32.177.133]) (authenticated) by conuserg-08.nifty.com with ESMTP id 2346K1Bn008244; Mon, 4 Apr 2022 15:20:04 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com 2346K1Bn008244 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1649053204; bh=v8waAouIUGkxU/aNRA3BQI4iA3QkcGu9o6MGxOfVIVA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BAnV+HljdwWp89suOUT2tJIaStBnzQ2aDP/UptXIaBWZaTBmkkDIoxiSxtNfMFkvN xNcj77UAFLdBVdNtBtZV4ezLjIG4unzTbCG+tqECIRSJbOVVsC+ya/0PIit2ZG7XYI 05S2ZBh5VtZD7wQKfdYC6uSxGIR3aFjr97NK4LK2xi3DHbByFDHJKFS9Yhu9cNd1ui xLA1dyeucfLD4nCbOdcG7CAuDNnJcftP+Ad4bt8EtpBnQsofZfucSoYForxIDcZ6bO cW+zukNVcBHbyWtqkj8/VTdFbgfwMln9RJIjRbU4YbXFUslB66ckN2YpLn6nydCxwL SkAUhtR6HmcOQ== X-Nifty-SrcIP: [133.32.177.133] From: Masahiro Yamada To: Arnd Bergmann , linux-kernel@vger.kernel.org Cc: linux-kbuild@vger.kernel.org, linux-arch@vger.kernel.org, Masahiro Yamada Subject: [PATCH 4/8] mips: add asm/stat.h to UAPI compile-test coverage Date: Mon, 4 Apr 2022 15:19:44 +0900 Message-Id: <20220404061948.2111820-5-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220404061948.2111820-1-masahiroy@kernel.org> References: <20220404061948.2111820-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org asm/stat.h is currently excluded from the UAPI compile-test for ARCH=mips because of the errors like follows: HDRTEST usr/include/asm/stat.h In file included from :32: ./usr/include/asm/stat.h:22:2: error: unknown type name 'ino_t' 22 | ino_t st_ino; | ^~~~~ ./usr/include/asm/stat.h:23:2: error: unknown type name 'mode_t' 23 | mode_t st_mode; | ^~~~~~ ./usr/include/asm/stat.h:25:2: error: unknown type name 'uid_t' 25 | uid_t st_uid; | ^~~~~ ./usr/include/asm/stat.h:26:2: error: unknown type name 'gid_t' 26 | gid_t st_gid; | ^~~~~ ./usr/include/asm/stat.h:58:2: error: unknown type name 'mode_t' 58 | mode_t st_mode; | ^~~~~~ ./usr/include/asm/stat.h:61:2: error: unknown type name 'uid_t' 61 | uid_t st_uid; | ^~~~~ ./usr/include/asm/stat.h:62:2: error: unknown type name 'gid_t' 62 | gid_t st_gid; | ^~~~~ The errors can be fixed by prefixing the types with __kernel_. Then, remove the no-header-test entry from user/include/Makefile. Signed-off-by: Masahiro Yamada Reviewed-by: Christoph Hellwig --- arch/mips/include/uapi/asm/stat.h | 20 ++++++++++---------- usr/include/Makefile | 4 ---- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/arch/mips/include/uapi/asm/stat.h b/arch/mips/include/uapi/asm/stat.h index 3d2a3b71845c..8a8bb78883a4 100644 --- a/arch/mips/include/uapi/asm/stat.h +++ b/arch/mips/include/uapi/asm/stat.h @@ -19,11 +19,11 @@ struct stat { unsigned st_dev; long st_pad1[3]; /* Reserved for network id */ - ino_t st_ino; - mode_t st_mode; + __kernel_ino_t st_ino; + __kernel_mode_t st_mode; __u32 st_nlink; - uid_t st_uid; - gid_t st_gid; + __kernel_uid_t st_uid; + __kernel_gid_t st_gid; unsigned st_rdev; long st_pad2[2]; long st_size; @@ -55,11 +55,11 @@ struct stat64 { unsigned long long st_ino; - mode_t st_mode; + __kernel_mode_t st_mode; __u32 st_nlink; - uid_t st_uid; - gid_t st_gid; + __kernel_uid_t st_uid; + __kernel_gid_t st_gid; unsigned long st_rdev; unsigned long st_pad1[3]; /* Reserved for st_rdev expansion */ @@ -96,11 +96,11 @@ struct stat { unsigned long st_ino; - mode_t st_mode; + __kernel_mode_t st_mode; __u32 st_nlink; - uid_t st_uid; - gid_t st_gid; + __kernel_uid_t st_uid; + __kernel_gid_t st_gid; unsigned int st_rdev; unsigned int st_pad1[3]; /* Reserved for st_rdev expansion */ diff --git a/usr/include/Makefile b/usr/include/Makefile index a1a8403896cf..da280bdcb391 100644 --- a/usr/include/Makefile +++ b/usr/include/Makefile @@ -65,10 +65,6 @@ no-header-test += asm/sigcontext.h no-header-test += linux/if_bonding.h endif -ifeq ($(SRCARCH),mips) -no-header-test += asm/stat.h -endif - ifeq ($(SRCARCH),powerpc) no-header-test += asm/stat.h no-header-test += linux/bpf_perf_event.h From patchwork Mon Apr 4 06:19:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 12799937 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C456C433FE for ; Mon, 4 Apr 2022 06:20:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377423AbiDDGWd (ORCPT ); Mon, 4 Apr 2022 02:22:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377417AbiDDGWc (ORCPT ); Mon, 4 Apr 2022 02:22:32 -0400 Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21ED236E32; Sun, 3 Apr 2022 23:20:29 -0700 (PDT) Received: from grover.. (133-32-177-133.west.xps.vectant.ne.jp [133.32.177.133]) (authenticated) by conuserg-08.nifty.com with ESMTP id 2346K1Bo008244; Mon, 4 Apr 2022 15:20:05 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com 2346K1Bo008244 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1649053205; bh=PdbBnXvGqqA+FniCDgXg05k8pJcNIN9vip0pBgTchzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FJMPxHJFUUv3FiXSITD4Z4GcTOwl0ot6nym5pD5crBXzIA9vZkfP+B1F0WurK52Tt K+moBR35Ld27Wi+FCQjA+KNnvDBRaSM+wPdnX8lbejsDa/YPmi3voHFaPUX3DWrwPx E+GYKJuEhTLZcG3BFx12qajmBCGXPnaCoM023VBrzLpUJOuQkYBZQ6xt4lGKeRKIug fB/x4okJYDOLuRAMqGHEk2euAlSC17xxisGufgIqtVD7Ftkrj+QhXIfkWgZBZDSpCC G7p3tzmLGng1WGANWaGYYDZg16AhQ0Hmx9FccmhMl/VKCvAgWsnAKZOmMqWmj0rd8+ PjnTSLXuzibLg== X-Nifty-SrcIP: [133.32.177.133] From: Masahiro Yamada To: Arnd Bergmann , linux-kernel@vger.kernel.org Cc: linux-kbuild@vger.kernel.org, linux-arch@vger.kernel.org, Masahiro Yamada Subject: [PATCH 5/8] powerpc: add asm/stat.h to UAPI compile-test coverage Date: Mon, 4 Apr 2022 15:19:45 +0900 Message-Id: <20220404061948.2111820-6-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220404061948.2111820-1-masahiroy@kernel.org> References: <20220404061948.2111820-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org asm/stat.h is currently excluded from the UAPI compile-test for ARCH=powerpc because of the errors like follows: HDRTEST usr/include/asm/stat.h In file included from :32: ./usr/include/asm/stat.h:32:2: error: unknown type name 'ino_t' 32 | ino_t st_ino; | ^~~~~ ./usr/include/asm/stat.h:35:2: error: unknown type name 'mode_t' 35 | mode_t st_mode; | ^~~~~~ ./usr/include/asm/stat.h:40:2: error: unknown type name 'uid_t' 40 | uid_t st_uid; | ^~~~~ ./usr/include/asm/stat.h:41:2: error: unknown type name 'gid_t' 41 | gid_t st_gid; | ^~~~~ The errors can be fixed by prefixing the types with __kernel_. Then, remove the no-header-test entry from user/include/Makefile. Signed-off-by: Masahiro Yamada Reviewed-by: Christoph Hellwig --- arch/powerpc/include/uapi/asm/stat.h | 10 +++++----- usr/include/Makefile | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/include/uapi/asm/stat.h b/arch/powerpc/include/uapi/asm/stat.h index 7871055e5e32..a28c9a1201fa 100644 --- a/arch/powerpc/include/uapi/asm/stat.h +++ b/arch/powerpc/include/uapi/asm/stat.h @@ -29,16 +29,16 @@ struct __old_kernel_stat { struct stat { unsigned long st_dev; - ino_t st_ino; + __kernel_ino_t st_ino; #ifdef __powerpc64__ unsigned long st_nlink; - mode_t st_mode; + __kernel_mode_t st_mode; #else - mode_t st_mode; + __kernel_mode_t st_mode; unsigned short st_nlink; #endif - uid_t st_uid; - gid_t st_gid; + __kernel_uid_t st_uid; + __kernel_gid_t st_gid; unsigned long st_rdev; long st_size; unsigned long st_blksize; diff --git a/usr/include/Makefile b/usr/include/Makefile index da280bdcb391..9d9dea32e3a0 100644 --- a/usr/include/Makefile +++ b/usr/include/Makefile @@ -66,7 +66,6 @@ no-header-test += linux/if_bonding.h endif ifeq ($(SRCARCH),powerpc) -no-header-test += asm/stat.h no-header-test += linux/bpf_perf_event.h endif From patchwork Mon Apr 4 06:19:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 12799940 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89B54C43217 for ; Mon, 4 Apr 2022 06:20:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377437AbiDDGWg (ORCPT ); Mon, 4 Apr 2022 02:22:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357155AbiDDGWd (ORCPT ); Mon, 4 Apr 2022 02:22:33 -0400 Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF57F377E9; Sun, 3 Apr 2022 23:20:31 -0700 (PDT) Received: from grover.. (133-32-177-133.west.xps.vectant.ne.jp [133.32.177.133]) (authenticated) by conuserg-08.nifty.com with ESMTP id 2346K1Bp008244; Mon, 4 Apr 2022 15:20:05 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com 2346K1Bp008244 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1649053205; bh=AibnhiOX0rfEwfkAILcnM2PzOi/J+jq6D5Fuzdi0fro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k63ucyOl0RQy5imVlGzYsp3c84dHD6pqsryc/kkjRRQ8rpVcHFVlXBxunwh7OmW2H gvocXzgPrK22FWM8YNjR/d/7AAiLVTfpBshPJwVT1NSLwAJAlI4OfL0HRW0GvBh849 L6f48TVwA9qw1j5G+5HgFw3DIv8ED6wCImzJR8U21II0jybFA3oDzYbeSzK3898Up5 3Mdka2nOtr+gsLl1TN8IFDONSFbefQ/n/bqdM7xa7cqHfPbQPfy+bEtTtjD/vhR9DG EBtz++annCjeukz036uvD87qdRauwZiodSVeRR9mrkfFNzCPV+MzPsfnGPElCfF3fQ lauOJy2FgdjlA== X-Nifty-SrcIP: [133.32.177.133] From: Masahiro Yamada To: Arnd Bergmann , linux-kernel@vger.kernel.org Cc: linux-kbuild@vger.kernel.org, linux-arch@vger.kernel.org, Masahiro Yamada Subject: [PATCH 6/8] sparc: add asm/stat.h to UAPI compile-test coverage Date: Mon, 4 Apr 2022 15:19:46 +0900 Message-Id: <20220404061948.2111820-7-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220404061948.2111820-1-masahiroy@kernel.org> References: <20220404061948.2111820-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org asm/stat.h is currently excluded from the UAPI compile-test for ARCH=sparc because of the errors like follows: In file included from : ./usr/include/asm/stat.h:11:2: error: unknown type name 'ino_t' 11 | ino_t st_ino; | ^~~~~ HDRTEST usr/include/asm/param.h ./usr/include/asm/stat.h:12:2: error: unknown type name 'mode_t' 12 | mode_t st_mode; | ^~~~~~ ./usr/include/asm/stat.h:14:2: error: unknown type name 'uid_t' 14 | uid_t st_uid; | ^~~~~ ./usr/include/asm/stat.h:15:2: error: unknown type name 'gid_t' 15 | gid_t st_gid; | ^~~~~ The errors can be fixed by prefixing the types with __kernel_. Then, remove the no-header-test entry from user/include/Makefile. Signed-off-by: Masahiro Yamada Reviewed-by: Christoph Hellwig --- arch/sparc/include/uapi/asm/stat.h | 12 ++++++------ usr/include/Makefile | 1 - 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/arch/sparc/include/uapi/asm/stat.h b/arch/sparc/include/uapi/asm/stat.h index 732c41720e24..e03d6f8ec301 100644 --- a/arch/sparc/include/uapi/asm/stat.h +++ b/arch/sparc/include/uapi/asm/stat.h @@ -8,11 +8,11 @@ /* 64 bit sparc */ struct stat { unsigned int st_dev; - ino_t st_ino; - mode_t st_mode; + __kernel_ino_t st_ino; + __kernel_mode_t st_mode; short st_nlink; - uid_t st_uid; - gid_t st_gid; + __kernel_uid_t st_uid; + __kernel_gid_t st_gid; unsigned int st_rdev; long st_size; long st_atime; @@ -51,8 +51,8 @@ struct stat64 { /* 32 bit sparc */ struct stat { unsigned short st_dev; - ino_t st_ino; - mode_t st_mode; + __kernel_ino_t st_ino; + __kernel_mode_t st_mode; short st_nlink; unsigned short st_uid; unsigned short st_gid; diff --git a/usr/include/Makefile b/usr/include/Makefile index 9d9dea32e3a0..e2615b9b0402 100644 --- a/usr/include/Makefile +++ b/usr/include/Makefile @@ -70,7 +70,6 @@ no-header-test += linux/bpf_perf_event.h endif ifeq ($(SRCARCH),sparc) -no-header-test += asm/stat.h no-header-test += asm/uctx.h no-header-test += asm/fbio.h endif From patchwork Mon Apr 4 06:19:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 12799941 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73FFAC433EF for ; Mon, 4 Apr 2022 06:20:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377428AbiDDGWg (ORCPT ); Mon, 4 Apr 2022 02:22:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377420AbiDDGWd (ORCPT ); Mon, 4 Apr 2022 02:22:33 -0400 Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA6993702D; Sun, 3 Apr 2022 23:20:30 -0700 (PDT) Received: from grover.. (133-32-177-133.west.xps.vectant.ne.jp [133.32.177.133]) (authenticated) by conuserg-08.nifty.com with ESMTP id 2346K1Bq008244; Mon, 4 Apr 2022 15:20:06 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com 2346K1Bq008244 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1649053206; bh=UcJbYMsGaLuu7rAXGRGEhGl4XasheiUdUe7mSwsDoTU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hQTCEOTZ3vyAuJAL0MhzurcEXRT0uqHWdOrjQYHxk4cv5fN72PJWy5fBWhmPR8R1K a67n6Yhgi2DYziOXih72STy2qpLWs9DCTZMlFU0DBiPJyR96FUOzD8G367Q+BZcv2t vRq5dbnp+IffePUiSEy1TcqCAShhScE4/ot4fCxhkbK9GmA3MtcStBJBPCycA7kx/6 dFW+ml2lTsSpmb3Em1Wcrh5Q0yIjCJRU6zz+F8Gab7KUZQ/ELY1kiRvwr673hm9q6Y js2Af/IW5uv81oRmQUn+X1Ss6TDfqSJph2bwpgguQoIp2mY4n+d2OdInROb17+X9wm +wozaiWr/6gTQ== X-Nifty-SrcIP: [133.32.177.133] From: Masahiro Yamada To: Arnd Bergmann , linux-kernel@vger.kernel.org Cc: linux-kbuild@vger.kernel.org, linux-arch@vger.kernel.org, Masahiro Yamada Subject: [PATCH 7/8] posix_types.h: add __kernel_uintptr_t to UAPI posix_types.h Date: Mon, 4 Apr 2022 15:19:47 +0900 Message-Id: <20220404061948.2111820-8-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220404061948.2111820-1-masahiroy@kernel.org> References: <20220404061948.2111820-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org This will allow us to replace uintptr_t with __kernel_uintptr_t in exported headers. I think this is acceptable because we already have __kernel_ptrdiff_t. Define __kernel_uintptr_t in the same ways as __kernel_ptrdiff_t but with 'unsigned' qualifier. Signed-off-by: Masahiro Yamada Reported-by: kernel test robot Reported-by: kernel test robot Reported-by: kernel test robot --- arch/h8300/include/uapi/asm/posix_types.h | 1 + arch/s390/include/uapi/asm/posix_types.h | 2 ++ arch/sparc/include/uapi/asm/posix_types.h | 1 + arch/xtensa/include/uapi/asm/posix_types.h | 1 + include/linux/types.h | 2 +- include/uapi/asm-generic/posix_types.h | 2 ++ tools/arch/h8300/include/asm/bitsperlong.h | 1 + 7 files changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/h8300/include/uapi/asm/posix_types.h b/arch/h8300/include/uapi/asm/posix_types.h index 3efc9dd59476..9728120c6742 100644 --- a/arch/h8300/include/uapi/asm/posix_types.h +++ b/arch/h8300/include/uapi/asm/posix_types.h @@ -7,6 +7,7 @@ typedef unsigned long __kernel_size_t; typedef long __kernel_ssize_t; typedef long __kernel_ptrdiff_t; +typedef unsigned long __kernel_uintptr_t; #include diff --git a/arch/s390/include/uapi/asm/posix_types.h b/arch/s390/include/uapi/asm/posix_types.h index 1913613e71b6..2c700a44bf83 100644 --- a/arch/s390/include/uapi/asm/posix_types.h +++ b/arch/s390/include/uapi/asm/posix_types.h @@ -34,6 +34,7 @@ typedef unsigned short __kernel_ipc_pid_t; typedef unsigned short __kernel_uid_t; typedef unsigned short __kernel_gid_t; typedef int __kernel_ptrdiff_t; +typedef unsigned int __kernel_uintptr_t; #else /* __s390x__ */ @@ -43,6 +44,7 @@ typedef int __kernel_ipc_pid_t; typedef unsigned int __kernel_uid_t; typedef unsigned int __kernel_gid_t; typedef long __kernel_ptrdiff_t; +typedef unsigned long __kernel_uintptr_t; typedef unsigned long __kernel_sigset_t; /* at least 32 bits */ #endif /* __s390x__ */ diff --git a/arch/sparc/include/uapi/asm/posix_types.h b/arch/sparc/include/uapi/asm/posix_types.h index f139e0048628..402e1656e3b5 100644 --- a/arch/sparc/include/uapi/asm/posix_types.h +++ b/arch/sparc/include/uapi/asm/posix_types.h @@ -35,6 +35,7 @@ struct __kernel_old_timeval { typedef unsigned int __kernel_size_t; typedef int __kernel_ssize_t; typedef long int __kernel_ptrdiff_t; +typedef unsigned long __kernel_uintptr_t; #define __kernel_size_t __kernel_size_t typedef unsigned short __kernel_ipc_pid_t; diff --git a/arch/xtensa/include/uapi/asm/posix_types.h b/arch/xtensa/include/uapi/asm/posix_types.h index 1dc67592881f..5ba366f6c789 100644 --- a/arch/xtensa/include/uapi/asm/posix_types.h +++ b/arch/xtensa/include/uapi/asm/posix_types.h @@ -26,6 +26,7 @@ typedef unsigned short __kernel_ipc_pid_t; typedef unsigned int __kernel_size_t; typedef int __kernel_ssize_t; typedef long __kernel_ptrdiff_t; +typedef unsigned long __kernel_uintptr_t; #define __kernel_size_t __kernel_size_t typedef unsigned short __kernel_old_uid_t; diff --git a/include/linux/types.h b/include/linux/types.h index ea8cf60a8a79..a54335007fe2 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -34,7 +34,7 @@ typedef __kernel_gid32_t gid_t; typedef __kernel_uid16_t uid16_t; typedef __kernel_gid16_t gid16_t; -typedef unsigned long uintptr_t; +typedef __kernel_uintptr_t uintptr_t; #ifdef CONFIG_HAVE_UID16 /* This is defined by include/asm-{arch}/posix_types.h */ diff --git a/include/uapi/asm-generic/posix_types.h b/include/uapi/asm-generic/posix_types.h index b5f7594eee7a..4a7c5b852e38 100644 --- a/include/uapi/asm-generic/posix_types.h +++ b/include/uapi/asm-generic/posix_types.h @@ -68,10 +68,12 @@ typedef unsigned int __kernel_old_dev_t; typedef unsigned int __kernel_size_t; typedef int __kernel_ssize_t; typedef int __kernel_ptrdiff_t; +typedef unsigned int __kernel_uintptr_t; #else typedef __kernel_ulong_t __kernel_size_t; typedef __kernel_long_t __kernel_ssize_t; typedef __kernel_long_t __kernel_ptrdiff_t; +typedef __kernel_ulong_t __kernel_uintptr_t; #endif #endif diff --git a/tools/arch/h8300/include/asm/bitsperlong.h b/tools/arch/h8300/include/asm/bitsperlong.h index fa1508337ffc..fea7dc923006 100644 --- a/tools/arch/h8300/include/asm/bitsperlong.h +++ b/tools/arch/h8300/include/asm/bitsperlong.h @@ -10,6 +10,7 @@ typedef unsigned long __kernel_size_t; typedef long __kernel_ssize_t; typedef long __kernel_ptrdiff_t; +typedef unsigned long __kernel_uintptr_t; #endif #endif /* __ASM_H8300_BITS_PER_LONG */ From patchwork Mon Apr 4 06:19:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 12799944 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F100C43219 for ; Mon, 4 Apr 2022 06:20:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377460AbiDDGWj (ORCPT ); Mon, 4 Apr 2022 02:22:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377429AbiDDGWe (ORCPT ); Mon, 4 Apr 2022 02:22:34 -0400 Received: from conuserg-08.nifty.com (conuserg-08.nifty.com [210.131.2.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BC13377D3; Sun, 3 Apr 2022 23:20:30 -0700 (PDT) Received: from grover.. (133-32-177-133.west.xps.vectant.ne.jp [133.32.177.133]) (authenticated) by conuserg-08.nifty.com with ESMTP id 2346K1Br008244; Mon, 4 Apr 2022 15:20:06 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-08.nifty.com 2346K1Br008244 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1649053207; bh=0K4SM890AXVb9yL32lizEN5lNqgMqpVmCB0ZtXPBQyY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F9sOVL7DA9P1ovJNmmoz7LYEGMQKCHLFRHXEpGNhEXtt+Uy88Shx9J83GxKAgZL7O a0eW/hvcWw4w6A5g8udfkNRqpro8cNGENMVvQq8Pef0RkfvMPM5g1IOtNnQynfxBOB 3eWHDPVwXH8t+3D/PA6Cs3OFs+Bfgh2XN5XSleshCAONgvIFeo7mYd1FSluNCMYKO1 Xn2KJiyT7MBQFoXTVueG8ZD9TMPl04HoCpzBSBAykHG9bzoG+Mwp6pEC4AMiJtjLVh hG2d3j9Pc99bjsOUMhm7s8T36l2zu8Z2Pjg02tFwvrFDysrZcUBkRgkGu3Dy1m/hZP wDawh5v4NlwEQ== X-Nifty-SrcIP: [133.32.177.133] From: Masahiro Yamada To: Arnd Bergmann , linux-kernel@vger.kernel.org Cc: linux-kbuild@vger.kernel.org, linux-arch@vger.kernel.org, Masahiro Yamada Subject: [PATCH 8/8] virtio_ring.h: do not include from exported header Date: Mon, 4 Apr 2022 15:19:48 +0900 Message-Id: <20220404061948.2111820-9-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220404061948.2111820-1-masahiroy@kernel.org> References: <20220404061948.2111820-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Arnd mentioned a limitation when including from UAPI headers. [1] Besides, I'd like exported headers to be as compliant with the traditional C as possible. In fact, the UAPI headers are compile-tested with -std=c90 (see usr/include/Makefile) even though the kernel itself is now built with -std=gnu11. Currently, include/uapi/linux/virtio_ring.h includes presumably because it uses uintptr_t. Replace it with __kernel_uintptr_t, and stop including . [1]: https://lore.kernel.org/all/CAK8P3a0bz8XYJOsmND2=CT_oTDmGMJGaRo9+QMroEhpekSMEaQ@mail.gmail.com/ Signed-off-by: Masahiro Yamada Acked-by: Michael S. Tsirkin --- include/uapi/linux/virtio_ring.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/include/uapi/linux/virtio_ring.h b/include/uapi/linux/virtio_ring.h index 476d3e5c0fe7..6329e4ff35f4 100644 --- a/include/uapi/linux/virtio_ring.h +++ b/include/uapi/linux/virtio_ring.h @@ -31,9 +31,7 @@ * SUCH DAMAGE. * * Copyright Rusty Russell IBM Corporation 2007. */ -#ifndef __KERNEL__ -#include -#endif + #include #include @@ -196,7 +194,7 @@ static inline void vring_init(struct vring *vr, unsigned int num, void *p, vr->num = num; vr->desc = p; vr->avail = (struct vring_avail *)((char *)p + num * sizeof(struct vring_desc)); - vr->used = (void *)(((uintptr_t)&vr->avail->ring[num] + sizeof(__virtio16) + vr->used = (void *)(((__kernel_uintptr_t)&vr->avail->ring[num] + sizeof(__virtio16) + align-1) & ~(align - 1)); }