# \[PATCH v05 21/72\] include/uapi/linux/if\_pppox.h: include linux/if.h

- Subsystems: NETWORKING DRIVERS, THE REST
- Maintainers: Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds
- Status: SUPERSEDED (Superseded by v06 posted 2017-08-06)
- Superseded by v06 (posted 2017-08-06).
- Revision v05 (4 revisions archived).
- List: netdev
- 5 messages, 3 authors
- Page: https://ratatoskr.run/netdev/2016/08/4819979/t

## \[PATCH v05 21/72\] include/uapi/linux/if\_pppox.h: include linux/if.h

- From: Mikko Rapeli \<hidden\>
- Date: 2016-08-22 19:00:38 
- Message: https://ratatoskr.run/netdev/2016/08/4819979.md

```text
Fixes userspace compilation error:

error: ‘IFNAMSIZ’ undeclared here (not in a function)

Signed-off-by: Mikko Rapeli <redacted>
---
 include/uapi/linux/if_pppox.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/uapi/linux/if_pppox.h b/include/uapi/linux/if_pppox.h
index e128769..473c3c4 100644
--- a/include/uapi/linux/if_pppox.h
+++ b/include/uapi/linux/if_pppox.h
@@ -21,6 +21,7 @@
 #include <asm/byteorder.h>
 
 #include <linux/socket.h>
+#include <linux/if.h>
 #include <linux/if_ether.h>
 #include <linux/if_pppol2tp.h>
 
-- 
2.8.1
```

## Re: \[PATCH v05 21/72\] include/uapi/linux/if\_pppox.h: include linux/if.h

- From: Stephen Hemminger \<stephen@networkplumber.org\>
- Date: 2016-08-22 19:37:35 
- Message: https://ratatoskr.run/netdev/2016/08/4820015.md

```text
On Mon, 22 Aug 2016 20:32:38 +0200
Mikko Rapeli [ref] wrote:

> Fixes userspace compilation error:
> 
> error: ‘IFNAMSIZ’ undeclared here (not in a function)
> 
> Signed-off-by: Mikko Rapeli <redacted>
> ---
>  include/uapi/linux/if_pppox.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/uapi/linux/if_pppox.h b/include/uapi/linux/if_pppox.h
> index e128769..473c3c4 100644
> --- a/include/uapi/linux/if_pppox.h
> +++ b/include/uapi/linux/if_pppox.h
> @@ -21,6 +21,7 @@
>  #include <asm/byteorder.h>
>  
>  #include <linux/socket.h>
> +#include <linux/if.h>
>  #include <linux/if_ether.h>
>  #include <linux/if_pppol2tp.h>
>  

I went back to the first patch in LKML for this series.
It seems your goal is that every include file should be standalone,
i.e it must include every definition it uses.

I disagree with this premise. It just makes things harder to maintain with
no real gain for any existing program.  What is the motivation for all this
useless churn? Is there some silly style rule that should be fixed instead?
```

## Re: \[PATCH v05 21/72\] include/uapi/linux/if\_pppox.h: include linux/if.h

- From: David Miller \<davem@davemloft.net\>
- Date: 2016-08-22 23:26:49 
- Message: https://ratatoskr.run/netdev/2016/08/4820189.md

```text
From: Stephen Hemminger <stephen@networkplumber.org>
Date: Mon, 22 Aug 2016 12:37:45 -0700

> It seems your goal is that every include file should be standalone,
> i.e it must include every definition it uses.

I think this is absolutely mandatory Stephen.  If you include x.h
it should just work if you use the interfaces x.h defines.

No user should have to know about dependencies, that is exactly the
job of the header file itself.
```

## Re: \[PATCH v05 21/72\] include/uapi/linux/if\_pppox.h: include linux/if.h

- From: David Miller \<davem@davemloft.net\>
- Date: 2016-08-22 23:33:20 
- Message: https://ratatoskr.run/netdev/2016/08/4820208.md

```text
From: Mikko Rapeli <redacted>
Date: Mon, 22 Aug 2016 20:32:38 +0200

> Fixes userspace compilation error:
> 
> error: ‘IFNAMSIZ’ undeclared here (not in a function)
> 
> Signed-off-by: Mikko Rapeli <redacted>

Applied.
```

## Re: \[PATCH v05 21/72\] include/uapi/linux/if\_pppox.h: include linux/if.h

- From: Mikko Rapeli \<hidden\>
- Date: 2016-08-23 06:41:56 
- Message: https://ratatoskr.run/netdev/2016/08/4820399.md

```text
On Mon, Aug 22, 2016 at 12:37:45PM -0700, Stephen Hemminger wrote:
> On Mon, 22 Aug 2016 20:32:38 +0200
> Mikko Rapeli [ref] wrote:
> 
> > Fixes userspace compilation error:
> > 
> > error: ‘IFNAMSIZ’ undeclared here (not in a function)
> > 
> > Signed-off-by: Mikko Rapeli <redacted>
> > ---
> >  include/uapi/linux/if_pppox.h | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/include/uapi/linux/if_pppox.h b/include/uapi/linux/if_pppox.h
> > index e128769..473c3c4 100644
> > --- a/include/uapi/linux/if_pppox.h
> > +++ b/include/uapi/linux/if_pppox.h
> > @@ -21,6 +21,7 @@
> >  #include <asm/byteorder.h>
> >  
> >  #include <linux/socket.h>
> > +#include <linux/if.h>
> >  #include <linux/if_ether.h>
> >  #include <linux/if_pppol2tp.h>
> >  
> 
> I went back to the first patch in LKML for this series.
> It seems your goal is that every include file should be standalone,
> i.e it must include every definition it uses.
> 
> I disagree with this premise. It just makes things harder to maintain with
> no real gain for any existing program.  What is the motivation for all this
> useless churn? Is there some silly style rule that should be fixed instead?

With over 700 uapi headers exported to userspace by Linux kernel, how
do I find out the 'correct' order of including them if they can not be
included alone? Any hints on automating that?

My first trial was to include all of the uapi headers as a single bunch to
abi checker tool which calls gcc on them, but the compilation result was
so bad and hopeless that I decided to try feeding each header file one by
one to the compiler and here I am over two years later still fixing these
issues.

I came up with the rule because to me it makes sense. Several kernel
devs agree with this approach and have accepted patches.

If your kernel subsystem uapi headers have a single entry point header file,
then all of the others can just depend on that and be done with it.
For example most (if not all) drm driver specific headers include <drm/drm.h>.

-Mikko
```
