diff mbox series

bpfilter: remove extra header search paths for bpfilter_umh

Message ID 1548904535-9853-1-git-send-email-yamada.masahiro@socionext.com
State Accepted
Delegated to: David Miller
Headers show
Series bpfilter: remove extra header search paths for bpfilter_umh | expand

Commit Message

Masahiro Yamada Jan. 31, 2019, 3:15 a.m. UTC
Currently, the header search paths -Itools/include and
-Itools/include/uapi are not used. Let's drop the unused code.

We can remove -I. too by fixing up one C file.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

Perhaps, are these extra header search paths for
more upstreaming in the future?

If this patch is rejected, I will send an alternative one.

To clean up the Kbuild core,
I want to drop as many unused header search paths as possible.


 net/bpfilter/Makefile | 1 -
 net/bpfilter/main.c   | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

Comments

Alexei Starovoitov Feb. 1, 2019, 11:59 p.m. UTC | #1
On Thu, Jan 31, 2019 at 12:15:35PM +0900, Masahiro Yamada wrote:
> Currently, the header search paths -Itools/include and
> -Itools/include/uapi are not used. Let's drop the unused code.
> 
> We can remove -I. too by fixing up one C file.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
> 
> Perhaps, are these extra header search paths for
> more upstreaming in the future?
> 
> If this patch is rejected, I will send an alternative one.
> 
> To clean up the Kbuild core,
> I want to drop as many unused header search paths as possible.
> 
> 
>  net/bpfilter/Makefile | 1 -
>  net/bpfilter/main.c   | 2 +-
>  2 files changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/net/bpfilter/Makefile b/net/bpfilter/Makefile
> index 0947ee7..5d6c776 100644
> --- a/net/bpfilter/Makefile
> +++ b/net/bpfilter/Makefile
> @@ -5,7 +5,6 @@
>  
>  hostprogs-y := bpfilter_umh
>  bpfilter_umh-objs := main.o
> -KBUILD_HOSTCFLAGS += -I. -Itools/include/ -Itools/include/uapi
>  HOSTCC := $(CC)
>  
>  ifeq ($(CONFIG_BPFILTER_UMH), y)
> diff --git a/net/bpfilter/main.c b/net/bpfilter/main.c
> index 1317f10..61ce845 100644
> --- a/net/bpfilter/main.c
> +++ b/net/bpfilter/main.c
> @@ -6,7 +6,7 @@
>  #include <sys/socket.h>
>  #include <fcntl.h>
>  #include <unistd.h>
> -#include "include/uapi/linux/bpf.h"
> +#include "../../include/uapi/linux/bpf.h"

argh. that's not pretty.
I would prefer to keep -I in a makefile
Masahiro Yamada Feb. 2, 2019, 1:40 p.m. UTC | #2
On Sat, Feb 2, 2019 at 9:00 AM Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
>
> On Thu, Jan 31, 2019 at 12:15:35PM +0900, Masahiro Yamada wrote:
> > Currently, the header search paths -Itools/include and
> > -Itools/include/uapi are not used. Let's drop the unused code.
> >
> > We can remove -I. too by fixing up one C file.
> >
> > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> > ---
> >
> > Perhaps, are these extra header search paths for
> > more upstreaming in the future?
> >
> > If this patch is rejected, I will send an alternative one.
> >
> > To clean up the Kbuild core,
> > I want to drop as many unused header search paths as possible.
> >
> >
> >  net/bpfilter/Makefile | 1 -
> >  net/bpfilter/main.c   | 2 +-
> >  2 files changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/net/bpfilter/Makefile b/net/bpfilter/Makefile
> > index 0947ee7..5d6c776 100644
> > --- a/net/bpfilter/Makefile
> > +++ b/net/bpfilter/Makefile
> > @@ -5,7 +5,6 @@
> >
> >  hostprogs-y := bpfilter_umh
> >  bpfilter_umh-objs := main.o
> > -KBUILD_HOSTCFLAGS += -I. -Itools/include/ -Itools/include/uapi
> >  HOSTCC := $(CC)
> >
> >  ifeq ($(CONFIG_BPFILTER_UMH), y)
> > diff --git a/net/bpfilter/main.c b/net/bpfilter/main.c
> > index 1317f10..61ce845 100644
> > --- a/net/bpfilter/main.c
> > +++ b/net/bpfilter/main.c
> > @@ -6,7 +6,7 @@
> >  #include <sys/socket.h>
> >  #include <fcntl.h>
> >  #include <unistd.h>
> > -#include "include/uapi/linux/bpf.h"
> > +#include "../../include/uapi/linux/bpf.h"
>
> argh. that's not pretty.
> I would prefer to keep -I in a makefile


This hunk is not a question.

The code #include "include/uapi/linux/bpf.h" is wrong
if you understand the meaning of #include "..."

https://gcc.gnu.org/onlinedocs/cpp/Search-Path.html


The directive #include "include/uapi/linux/bpf.h"
means the preprocessor should look for this header first
in the path relative to the directory of net/bpfilter/main.c

That is, the preprocessor will look for
net/bpfilter/include/uapi/linux/bpf.h
which obviously does not exist.


I am fixing this because adding -I.
in kernel Makefile is always wrong.
For example, commit 5cd5548ff439b91
David Miller Feb. 4, 2019, 4:13 a.m. UTC | #3
From: Masahiro Yamada <yamada.masahiro@socionext.com>
Date: Thu, 31 Jan 2019 12:15:35 +0900

> Currently, the header search paths -Itools/include and
> -Itools/include/uapi are not used. Let's drop the unused code.
> 
> We can remove -I. too by fixing up one C file.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

I guess I'm ok with this, applied to net-next.

Thanks for explaining things.
diff mbox series

Patch

diff --git a/net/bpfilter/Makefile b/net/bpfilter/Makefile
index 0947ee7..5d6c776 100644
--- a/net/bpfilter/Makefile
+++ b/net/bpfilter/Makefile
@@ -5,7 +5,6 @@ 
 
 hostprogs-y := bpfilter_umh
 bpfilter_umh-objs := main.o
-KBUILD_HOSTCFLAGS += -I. -Itools/include/ -Itools/include/uapi
 HOSTCC := $(CC)
 
 ifeq ($(CONFIG_BPFILTER_UMH), y)
diff --git a/net/bpfilter/main.c b/net/bpfilter/main.c
index 1317f10..61ce845 100644
--- a/net/bpfilter/main.c
+++ b/net/bpfilter/main.c
@@ -6,7 +6,7 @@ 
 #include <sys/socket.h>
 #include <fcntl.h>
 #include <unistd.h>
-#include "include/uapi/linux/bpf.h"
+#include "../../include/uapi/linux/bpf.h"
 #include <asm/unistd.h>
 #include "msgfmt.h"