* [PATCH] net: include compat.h first incase some specifier-qualifier-list error
@ 2013-08-13 15:13 Hangbin Liu
2013-08-13 15:48 ` Dave Jones
0 siblings, 1 reply; 3+ messages in thread
From: Hangbin Liu @ 2013-08-13 15:13 UTC (permalink / raw)
To: Trinity list; +Cc: Hangbin Liu
On some old distros, we use sa_family_t in linux/irda.h and linux/netlink.h
first, but include the header file bits/sockaddr.h later in compat.h. Then it
will compile failed with error: expected specifier-qualifier-list before
‘sa_family_t’. So let's move compat.h before irda.h and netlink.h
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
net/irda_setsockopt.c | 2 +-
net/netlink_setsockopt.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/irda_setsockopt.c b/net/irda_setsockopt.c
index a5d96ec..21ff649 100644
--- a/net/irda_setsockopt.c
+++ b/net/irda_setsockopt.c
@@ -1,9 +1,9 @@
#include <stdlib.h>
-#include <linux/irda.h>
#include "net.h"
#include "maps.h" // page_rand
#include "compat.h"
#include "trinity.h" // ARRAY_SIZE
+#include <linux/irda.h>
#define NR_SOL_IRDA_OPTS ARRAY_SIZE(irda_opts)
static const unsigned int irda_opts[] = {
diff --git a/net/netlink_setsockopt.c b/net/netlink_setsockopt.c
index c6e9297..c401047 100644
--- a/net/netlink_setsockopt.c
+++ b/net/netlink_setsockopt.c
@@ -1,9 +1,9 @@
#include <stdlib.h>
-#include <linux/netlink.h>
#include "net.h"
#include "maps.h" // page_rand
#include "compat.h"
#include "trinity.h" // ARRAY_SIZE
+#include <linux/netlink.h>
#define SOL_NETLINK 270
--
1.8.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: include compat.h first incase some specifier-qualifier-list error
2013-08-13 15:13 [PATCH] net: include compat.h first incase some specifier-qualifier-list error Hangbin Liu
@ 2013-08-13 15:48 ` Dave Jones
2013-08-14 0:27 ` Hangbin Liu
0 siblings, 1 reply; 3+ messages in thread
From: Dave Jones @ 2013-08-13 15:48 UTC (permalink / raw)
To: Hangbin Liu; +Cc: Trinity list
On Tue, Aug 13, 2013 at 11:13:29PM +0800, Hangbin Liu wrote:
> On some old distros, we use sa_family_t in linux/irda.h and linux/netlink.h
> first, but include the header file bits/sockaddr.h later in compat.h. Then it
> will compile failed with error: expected specifier-qualifier-list before
> ‘sa_family_t’. So let's move compat.h before irda.h and netlink.h
>
>
> diff --git a/net/irda_setsockopt.c b/net/irda_setsockopt.c
> index a5d96ec..21ff649 100644
> --- a/net/irda_setsockopt.c
> +++ b/net/irda_setsockopt.c
> @@ -1,9 +1,9 @@
> #include <stdlib.h>
> -#include <linux/irda.h>
> #include "net.h"
> #include "maps.h" // page_rand
> #include "compat.h"
> #include "trinity.h" // ARRAY_SIZE
> +#include <linux/irda.h>
>
> #define NR_SOL_IRDA_OPTS ARRAY_SIZE(irda_opts)
> static const unsigned int irda_opts[] = {
> diff --git a/net/netlink_setsockopt.c b/net/netlink_setsockopt.c
> index c6e9297..c401047 100644
> --- a/net/netlink_setsockopt.c
> +++ b/net/netlink_setsockopt.c
> @@ -1,9 +1,9 @@
> #include <stdlib.h>
> -#include <linux/netlink.h>
> #include "net.h"
> #include "maps.h" // page_rand
> #include "compat.h"
> #include "trinity.h" // ARRAY_SIZE
> +#include <linux/netlink.h>
This seems fragile to me. The idea here is that compat.h is to override
all the system includes, so reordering like this may mean that we won't
get the desired affect on some other distro.
I don't have a better answer for this though, need to think about it some more.
Perhaps changing compat.h to include something other than the bits/sockaddr
(Or adding additional includes there)..
What distribution was this ?
Dave
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: include compat.h first incase some specifier-qualifier-list error
2013-08-13 15:48 ` Dave Jones
@ 2013-08-14 0:27 ` Hangbin Liu
0 siblings, 0 replies; 3+ messages in thread
From: Hangbin Liu @ 2013-08-14 0:27 UTC (permalink / raw)
To: Dave Jones; +Cc: Trinity list
On Tue, Aug 13, 2013 at 11:48:33AM -0400, Dave Jones wrote:
> On Tue, Aug 13, 2013 at 11:13:29PM +0800, Hangbin Liu wrote:
> > On some old distros, we use sa_family_t in linux/irda.h and linux/netlink.h
> > first, but include the header file bits/sockaddr.h later in compat.h. Then it
> > will compile failed with error: expected specifier-qualifier-list before
> > ‘sa_family_t’. So let's move compat.h before irda.h and netlink.h
> >
> >
> > diff --git a/net/irda_setsockopt.c b/net/irda_setsockopt.c
> > index a5d96ec..21ff649 100644
> > --- a/net/irda_setsockopt.c
> > +++ b/net/irda_setsockopt.c
> > @@ -1,9 +1,9 @@
> > #include <stdlib.h>
> > -#include <linux/irda.h>
> > #include "net.h"
> > #include "maps.h" // page_rand
> > #include "compat.h"
> > #include "trinity.h" // ARRAY_SIZE
> > +#include <linux/irda.h>
> >
> > #define NR_SOL_IRDA_OPTS ARRAY_SIZE(irda_opts)
> > static const unsigned int irda_opts[] = {
> > diff --git a/net/netlink_setsockopt.c b/net/netlink_setsockopt.c
> > index c6e9297..c401047 100644
> > --- a/net/netlink_setsockopt.c
> > +++ b/net/netlink_setsockopt.c
> > @@ -1,9 +1,9 @@
> > #include <stdlib.h>
> > -#include <linux/netlink.h>
> > #include "net.h"
> > #include "maps.h" // page_rand
> > #include "compat.h"
> > #include "trinity.h" // ARRAY_SIZE
> > +#include <linux/netlink.h>
>
> This seems fragile to me. The idea here is that compat.h is to override
> all the system includes, so reordering like this may mean that we won't
> get the desired affect on some other distro.
>
> I don't have a better answer for this though, need to think about it some more.
> Perhaps changing compat.h to include something other than the bits/sockaddr
> (Or adding additional includes there)..
>
> What distribution was this ?
>
RHEL6.4
# make
<snip>
CC net/irda_setsockopt.o
In file included from net/irda_setsockopt.c:2:
/usr/include/linux/irda.h:128: error: expected specifier-qualifier-list before ‘sa_family_t’
make: *** [net/irda_setsockopt.o] Error 1
# uname -r
2.6.32-358.el6.x86_64
# rpm -qf /usr/include/linux/irda.h
kernel-headers-2.6.32-358.el6.x86_64
# rpm -qa | grep gcc
libgcc-4.4.7-3.el6.x86_64
gcc-4.4.7-3.el6.x86_64
gcc-gfortran-4.4.7-3.el6.x86_64
gcc-c++-4.4.7-3.el6.x86_64
# rpm -qa | grep glibc
glibc-common-2.12-1.107.el6.x86_64
glibc-headers-2.12-1.107.el6.x86_64
glibc-2.12-1.107.el6.x86_64
glibc-devel-2.12-1.107.el6.x86_64
--
Thanks & Best Regards
Hangbin Liu <liuhangbin@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-08-14 0:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-13 15:13 [PATCH] net: include compat.h first incase some specifier-qualifier-list error Hangbin Liu
2013-08-13 15:48 ` Dave Jones
2013-08-14 0:27 ` Hangbin Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox