From patchwork Thu Oct 1 21:19:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Petr Vorel X-Patchwork-Id: 40629 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 88579398B45A; Thu, 1 Oct 2020 21:20:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 88579398B45A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1601587212; bh=92mK7zBHisCWLSyJKdx4TrhYPHWohdb3930tufPI2eQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=L2G0i4vn4/Lp5mMitjknai+M60N/oAeDM4aIzyKWwiK52WNGVaiThLYKuUHHAb9NR 8dr8/U050Sh1MEAKorNl0Gp8NxLCAvUqtJaOKJPh5E2SY6F9+mr8tFsD4tdTLmZV1E RhRJrBPYLQZjmAl4FkVRt+0ZOTvhAc2igURHj/wM= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by sourceware.org (Postfix) with ESMTPS id D7F1B398600B for ; Thu, 1 Oct 2020 21:20:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D7F1B398600B Received: by mail-wr1-x441.google.com with SMTP id z1so297223wrt.3 for ; Thu, 01 Oct 2020 14:20:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=92mK7zBHisCWLSyJKdx4TrhYPHWohdb3930tufPI2eQ=; b=YHxOiV8/1onUebqdwigjNWY9fbvLt21ZSOZtJPHEGz4q5R/mEc0L4FjyxrX3YPnzQ4 LKLGxAkKpobG4DcCUOGaDKt1uYC0deaTFa6Thn3Cf7gQjnDyQBMKBhBmK/mRdsuZPiOe GzIzZuSzGN2wCJMmJGbLb3E5UNTzOHbgV+ibTRPag38dLdtCQfbHEMB5+qJ00uLcskrC +aIGIJgZsJ0M+8Srun0AbLmFk/I5qy/1DWCo0Csn57Pzo+cvifD/rfmVry/HTEEYvB5Z wT/eaaaaFjjQkSlx/m11PUT9MPFBKOVlUai5dD4oGkyv5zFed0p96zr3Z5grpM/ZKG1a asDA== X-Gm-Message-State: AOAM530KGgX55clITsGgIWEN4PSfBiN/Mk3b5tCMfW3JkGHbjMPmmU84 hUWC1QrewbVqvD49DS9Dmp8= X-Google-Smtp-Source: ABdhPJx+5C2pl861hVRnpuxaeLSGcq52n+kjey8zmxUpkImCEOo8imG9vXHMS48cPyOtB3hf0HhJ3g== X-Received: by 2002:adf:9124:: with SMTP id j33mr11044813wrj.272.1601587199869; Thu, 01 Oct 2020 14:19:59 -0700 (PDT) Received: from dell5510.suse.de ([62.201.25.198]) by smtp.gmail.com with ESMTPSA id l3sm1664763wmh.27.2020.10.01.14.19.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 14:19:59 -0700 (PDT) To: linux-kernel@vger.kernel.org Subject: [RFC PATCH v2 1/1] uapi: Introduce Date: Thu, 1 Oct 2020 23:19:42 +0200 Message-Id: <20201001211942.13336-1-petr.vorel@gmail.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Petr Vorel via Libc-alpha From: Petr Vorel Reply-To: Petr Vorel Cc: Michal Kubecek , Florian Weimer , Peter Korsgaard , libc-alpha@sourceware.org, musl@lists.openwall.com, Baruch Siach , Stephen Hemminger , linux-api@vger.kernel.org, "David S . Miller" Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" move there code from , and include it in UAPI headers instead of . The reason is to avoid indirect include when using some network headers: or others -> -> . This indirect include causes on MUSL redefinition of struct sysinfo when included both and some of UAPI headers: In file included from x86_64-buildroot-linux-musl/sysroot/usr/include/linux/kernel.h:5, from x86_64-buildroot-linux-musl/sysroot/usr/include/linux/netlink.h:5, from ../include/tst_netlink.h:14, from tst_crypto.c:13: x86_64-buildroot-linux-musl/sysroot/usr/include/linux/sysinfo.h:8:8: error: redefinition of ‘struct sysinfo’ struct sysinfo { ^~~~~~~ In file included from ../include/tst_safe_macros.h:15, from ../include/tst_test.h:93, from tst_crypto.c:11: x86_64-buildroot-linux-musl/sysroot/usr/include/sys/sysinfo.h:10:8: note: originally defined here Suggested-by: Rich Felker Signed-off-by: Petr Vorel --- Changes v1->v2: * Move kernel.h content into new header in order not break the existing contract with glibc. Background: long standing problem: python-psutil [1], iproute2 [2], even for glibc in the past [3]. Kind regards, Petr [1] https://git.buildroot.net/buildroot/commit/?id=ab930190d7754b7f5fdda115b2069d00f1320861 [2] http://patchwork.ozlabs.org/project/netdev/patch/602128d22db86bd67e11dec8fe40a73832c222c9.1559230347.git.baruch@tkos.co.il/ [3] https://www.mail-archive.com/busybox@busybox.net/msg15363.html include/uapi/linux/align.h | 10 ++++++++++ include/uapi/linux/ethtool.h | 2 +- include/uapi/linux/kernel.h | 9 +-------- include/uapi/linux/lightnvm.h | 2 +- include/uapi/linux/mroute6.h | 2 +- include/uapi/linux/netfilter/x_tables.h | 2 +- include/uapi/linux/netlink.h | 2 +- include/uapi/linux/sysctl.h | 2 +- 8 files changed, 17 insertions(+), 14 deletions(-) create mode 100644 include/uapi/linux/align.h diff --git a/include/uapi/linux/align.h b/include/uapi/linux/align.h new file mode 100644 index 000000000000..6d2fef859d03 --- /dev/null +++ b/include/uapi/linux/align.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _UAPI_LINUX_ALIGN_H +#define _UAPI_LINUX_ALIGN_H + +#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1) +#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) + +#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) + +#endif /* _UAPI_LINUX_ALIGN_H */ diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h index b4f2d134e713..73ca97a6ec86 100644 --- a/include/uapi/linux/ethtool.h +++ b/include/uapi/linux/ethtool.h @@ -14,7 +14,7 @@ #ifndef _UAPI_LINUX_ETHTOOL_H #define _UAPI_LINUX_ETHTOOL_H -#include +#include #include #include diff --git a/include/uapi/linux/kernel.h b/include/uapi/linux/kernel.h index 0ff8f7477847..15f70c510311 100644 --- a/include/uapi/linux/kernel.h +++ b/include/uapi/linux/kernel.h @@ -3,13 +3,6 @@ #define _UAPI_LINUX_KERNEL_H #include - -/* - * 'kernel.h' contains some often-used function prototypes etc - */ -#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1) -#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask)) - -#define __KERNEL_DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) +#include #endif /* _UAPI_LINUX_KERNEL_H */ diff --git a/include/uapi/linux/lightnvm.h b/include/uapi/linux/lightnvm.h index f9a1be7fc696..d686cd576a24 100644 --- a/include/uapi/linux/lightnvm.h +++ b/include/uapi/linux/lightnvm.h @@ -21,7 +21,7 @@ #define _UAPI_LINUX_LIGHTNVM_H #ifdef __KERNEL__ -#include +#include #include #else /* __KERNEL__ */ #include diff --git a/include/uapi/linux/mroute6.h b/include/uapi/linux/mroute6.h index c36177a86516..e638aaefbe7f 100644 --- a/include/uapi/linux/mroute6.h +++ b/include/uapi/linux/mroute6.h @@ -2,7 +2,7 @@ #ifndef _UAPI__LINUX_MROUTE6_H #define _UAPI__LINUX_MROUTE6_H -#include +#include #include #include #include /* For struct sockaddr_in6. */ diff --git a/include/uapi/linux/netfilter/x_tables.h b/include/uapi/linux/netfilter/x_tables.h index a8283f7dbc51..c49d7a630d05 100644 --- a/include/uapi/linux/netfilter/x_tables.h +++ b/include/uapi/linux/netfilter/x_tables.h @@ -1,7 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ #ifndef _UAPI_X_TABLES_H #define _UAPI_X_TABLES_H -#include +#include #include #define XT_FUNCTION_MAXNAMELEN 30 diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h index eac8a6a648ea..2ff384e9bf00 100644 --- a/include/uapi/linux/netlink.h +++ b/include/uapi/linux/netlink.h @@ -2,7 +2,7 @@ #ifndef _UAPI__LINUX_NETLINK_H #define _UAPI__LINUX_NETLINK_H -#include +#include #include /* for __kernel_sa_family_t */ #include diff --git a/include/uapi/linux/sysctl.h b/include/uapi/linux/sysctl.h index 27c1ed2822e6..18360ea6dd4e 100644 --- a/include/uapi/linux/sysctl.h +++ b/include/uapi/linux/sysctl.h @@ -23,7 +23,7 @@ #ifndef _UAPI_LINUX_SYSCTL_H #define _UAPI_LINUX_SYSCTL_H -#include +#include #include #include