[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOdmsnVsW46pTZYCNu-bx5c-aJ8ARMCOsYeMmQHpAw3PtPg@mail.gmail.com>
Date: Tue, 29 Mar 2022 14:50:04 -0700
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Jon Maloy <jmaloy@...hat.com>, Ying Xue <ying.xue@...driver.com>,
Arnd Bergmann <arnd@...db.de>,
Masahiro Yamada <masahiroy@...nel.org>
Cc: Nathan Chancellor <nathan@...nel.org>, netdev@...r.kernel.org,
tipc-discussion@...ts.sourceforge.net,
linux-kernel@...r.kernel.org, llvm@...ts.linux.dev
Subject: Re: [PATCH] net, uapi: remove inclusion of arpa/inet.h
On Tue, Mar 29, 2022 at 2:29 PM Nick Desaulniers
<ndesaulniers@...gle.com> wrote:
>
> Testing out CONFIG_UAPI_HEADER_TEST=y with a prebuilt Bionic sysroot
> from Android's SDK, I encountered an error:
>
> HDRTEST usr/include/linux/fsi.h
> In file included from <built-in>:1:
> In file included from ./usr/include/linux/tipc_config.h:46:
> prebuilts/ndk/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/arpa/inet.h:39:1:
> error: unknown type name 'in_addr_t'
> in_addr_t inet_addr(const char* __s);
> ^
Oh, this might not quite be the correct fix for this particular issue.
Cherry picking this diff back into my Android kernel tree, I now observe:
HDRTEST usr/include/linux/tipc_config.h
In file included from <built-in>:1:
./usr/include/linux/tipc_config.h:268:4: error: implicit declaration
of function 'ntohs' [-Werror,-Wimplicit-function-declaration]
(ntohs(((struct tlv_desc *)tlv)->tlv_len) <= space);
^
Is there more than one byteorder.h? Oh, I see what I did; ntohs is defined in
linux/byteorder/generic.h
not
usr/include/asm/byteorder.h
Sorry, I saw `byteorder` and mixed up the path with the filename.
So rather than just remove the latter, I should additionally be adding
the former. Though that then produces
common/include/linux/byteorder/generic.h:146:9: error: implicit
declaration of function '__cpu_to_le16'
[-Werror,-Wimplicit-function-declaration]
*var = cpu_to_le16(le16_to_cpu(*var) + val);
^
Oh?
>
> This is because Bionic has a bug in its inclusion chain. I sent a patch
> to fix that, but looking closer at include/uapi/linux/tipc_config.h,
> there's a comment that it includes arpa/inet.h for ntohs; but ntohs is
> already defined in include/linux/byteorder/generic.h which is already
> included in include/uapi/linux/tipc_config.h. There are no __KERNEL__
> guards on include/linux/byteorder/generic.h's definition of ntohs. So
> besides fixing Bionic, it looks like we can additionally remove this
> unnecessary header inclusion.
>
> Link: https://android-review.googlesource.com/c/platform/bionic/+/2048127
> Signed-off-by: Nick Desaulniers <ndesaulniers@...gle.com>
> ---
> include/uapi/linux/tipc_config.h | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/include/uapi/linux/tipc_config.h b/include/uapi/linux/tipc_config.h
> index 4dfc05651c98..b38374d5f192 100644
> --- a/include/uapi/linux/tipc_config.h
> +++ b/include/uapi/linux/tipc_config.h
> @@ -43,10 +43,6 @@
> #include <linux/tipc.h>
> #include <asm/byteorder.h>
>
> -#ifndef __KERNEL__
> -#include <arpa/inet.h> /* for ntohs etc. */
> -#endif
> -
> /*
> * Configuration
> *
>
> base-commit: 5efabdadcf4a5b9a37847ecc85ba71cf2eff0fcf
> prerequisite-patch-id: 0c2abf2af8051f4b37a70ef11b7d2fc2a3ec7181
> --
> 2.35.1.1021.g381101b075-goog
>
--
Thanks,
~Nick Desaulniers
Powered by blists - more mailing lists