Re: [PATCH] net, uapi: remove inclusion of arpa/inet.h
From: Arnd Bergmann
Date: Wed Mar 30 2022 - 02:11:29 EST
On Wed, Mar 30, 2022 at 8:08 AM Arnd Bergmann <arnd@xxxxxxxx> wrote:
> On Wed, Mar 30, 2022 at 12:26 AM Nick Desaulniers
> <ndesaulniers@xxxxxxxxxx> wrote:
> > On Tue, Mar 29, 2022 at 3:09 PM Nick Desaulniers <ndesaulniers@xxxxxxxxxx> wrote:
> > ```
> > diff --git a/include/uapi/linux/byteorder/little_endian.h
> > b/include/uapi/linux/byteorder/little_endian.h
> > index cd98982e7523..c14f2c3728e2 100644
> > --- a/include/uapi/linux/byteorder/little_endian.h
> > +++ b/include/uapi/linux/byteorder/little_endian.h
> > @@ -103,5 +103,8 @@ static __always_inline __u16 __be16_to_cpup(const __be16 *p)
> > #define __cpu_to_be16s(x) __swab16s((x))
> > #define __be16_to_cpus(x) __swab16s((x))
> >
> > +#define htonl(x) __cpu_to_be32(x)
> > +#define htons(x) __cpu_to_be16(x)
> > +#define ntohs(x) __be16_to_cpu(x)
> >
>
> This is unfortunately a namespace violation, you can't define things in uapi
> headers that conflict with standard library interfaces.
nevermind, I just saw the thread continues and you arrived at a good solution
withusing the __cpu_to_be16() etc directly.
Arnd