Linux HAM/Amateur Radio development
 help / color / mirror / Atom feed
* [PATCH v05 68/72] uapi ax25.h: glibc netax25/ax25.h header file compatibility fixes
       [not found] <1471890809-4383-1-git-send-email-mikko.rapeli@iki.fi>
@ 2016-08-22 18:33 ` Mikko Rapeli
  2016-08-22 23:33   ` David Miller
  2016-08-22 18:33 ` [PATCH v05 69/72] uapi rose.h: glibc netrose/rose.h " Mikko Rapeli
  1 sibling, 1 reply; 13+ messages in thread
From: Mikko Rapeli @ 2016-08-22 18:33 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mikko Rapeli, Ralf Baechle, David S. Miller, Nicolas Dichtel,
	linux-hams

Fixes these userspace compile error when glibc netax25/ax25.h is included
before linux/ax25.h:

linux/ax25.h:28:0: warning: "SIOCAX25GETUID" redefined
linux/ax25.h:38:0: warning: "SIOCAX25GETINFO" redefined
linux/ax25.h:47:3: error: conflicting types for ‘ax25_address’
linux/ax25.h:49:8: error: redefinition of ‘struct sockaddr_ax25’
linux/ax25.h:58:8: error: redefinition of ‘struct full_sockaddr_ax25’
linux/ax25.h:63:8: error: redefinition of ‘struct ax25_routes_struct’
linux/ax25.h:70:8: error: redefinition of ‘struct ax25_route_opt_struct’
linux/ax25.h:77:8: error: redefinition of ‘struct ax25_ctl_struct’
linux/ax25.h:98:8: error: redefinition of ‘struct ax25_info_struct’
linux/ax25.h:111:8: error: redefinition of ‘struct ax25_fwd_struct’

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
---
 include/uapi/linux/ax25.h        | 22 +++++++++++++++++++++
 include/uapi/linux/libc-compat.h | 41 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+)

diff --git a/include/uapi/linux/ax25.h b/include/uapi/linux/ax25.h
index 74c89a4..e296c8a 100644
--- a/include/uapi/linux/ax25.h
+++ b/include/uapi/linux/ax25.h
@@ -6,6 +6,7 @@
 #ifndef	AX25_KERNEL_H
 #define	AX25_KERNEL_H
 
+#include <linux/libc-compat.h>
 #include <linux/socket.h>
 
 #define AX25_MTU	256
@@ -25,6 +26,7 @@
 
 #define AX25_KILL	99
 
+#if __UAPI_DEF_SIOCAX25GETUID_TO_SIOCAX25DELFWD
 #define SIOCAX25GETUID		(SIOCPROTOPRIVATE+0)
 #define SIOCAX25ADDUID		(SIOCPROTOPRIVATE+1)
 #define SIOCAX25DELUID		(SIOCPROTOPRIVATE+2)
@@ -34,46 +36,61 @@
 #define SIOCAX25GETINFOOLD	(SIOCPROTOPRIVATE+9)
 #define SIOCAX25ADDFWD		(SIOCPROTOPRIVATE+10)
 #define SIOCAX25DELFWD		(SIOCPROTOPRIVATE+11)
+#endif /* __UAPI_DEF_SIOCAX25GETUID_TO_SIOCAX25DELFWD */
 #define SIOCAX25DEVCTL          (SIOCPROTOPRIVATE+12)
+/* glibc uses SIOCPROTOPRIVATE+9 for SIOCAX25GETINFO */
+#if __UAPI_DEF_SIOCAX25GETINFO
 #define SIOCAX25GETINFO         (SIOCPROTOPRIVATE+13)
+#endif /* __UAPI_DEF_SIOCAX25GETINFO */
 
 #define AX25_SET_RT_IPMODE	2
 
 #define AX25_NOUID_DEFAULT	0
 #define AX25_NOUID_BLOCK	1
 
+#if __UAPI_DEF_AX25_ADDRESS
 typedef struct {
 	char		ax25_call[7];	/* 6 call + SSID (shifted ascii!) */
 } ax25_address;
+#endif /* __UAPI_DEF_AX25_ADDRESS */
 
+#if __UAPI_DEF_SOCKADDR_AX25
 struct sockaddr_ax25 {
 	__kernel_sa_family_t sax25_family;
 	ax25_address	sax25_call;
 	int		sax25_ndigis;
 	/* Digipeater ax25_address sets follow */
 };
+#endif /* __UAPI_DEF_SOCKADDR_AX25 */
 
 #define sax25_uid	sax25_ndigis
 
+#if __UAPI_DEF_FULL_SOCKADDR_AX25
 struct full_sockaddr_ax25 {
 	struct sockaddr_ax25 fsa_ax25;
 	ax25_address	fsa_digipeater[AX25_MAX_DIGIS];
 };
+#endif /* __UAPI_DEF_FULL_SOCKADDR_AX25 */
 
+#if __UAPI_DEF_AX25_ROUTES_STRUCT
 struct ax25_routes_struct {
 	ax25_address	port_addr;
 	ax25_address	dest_addr;
 	unsigned char	digi_count;
 	ax25_address	digi_addr[AX25_MAX_DIGIS];
 };
+#endif /* __UAPI_DEF_AX25_ROUTES_STRUCT */
 
+#if __UAPI_DEF_AX25_ROUTES_OPT_STRUCT
 struct ax25_route_opt_struct {
 	ax25_address	port_addr;
 	ax25_address	dest_addr;
 	int		cmd;
 	int		arg;
 };
+#endif /* __UAPI_DEF_AX25_ROUTES_OPT_STRUCT */
 
+#if __UAPI_DEF_AX25_CTL_STRUCT
 struct ax25_ctl_struct {
         ax25_address            port_addr;
         ax25_address            source_addr;
@@ -83,6 +100,7 @@ struct ax25_ctl_struct {
         unsigned char           digi_count;
         ax25_address            digi_addr[AX25_MAX_DIGIS];
 };
+#endif /* __UAPI_DEF_AX25_CTL_STRUCT */
 
 /* this will go away. Please do not export to user land */
 struct ax25_info_struct_deprecated {
@@ -95,6 +113,7 @@ struct ax25_info_struct_deprecated {
 	unsigned int	rcv_q, snd_q;
 };
 
+#if __UAPI_DEF_AX25_INFO_STRUCT
 struct ax25_info_struct {
 	unsigned int	n2, n2count;
 	unsigned int	t1, t1timer;
@@ -107,10 +126,13 @@ struct ax25_info_struct {
 	unsigned int	paclen;
 	unsigned int	window;
 };
+#endif /* __UAPI_DEF_AX25_INFO_STRUCT */
 
+#if __UAPI_DEF_AX25_FWD_STRUCT
 struct ax25_fwd_struct {
 	ax25_address	port_from;
 	ax25_address	port_to;
 };
+#endif /* __UAPI_DEF_AX25_FWD_STRUCT */
 
 #endif
diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
index f793b09..01bb521 100644
--- a/include/uapi/linux/libc-compat.h
+++ b/include/uapi/linux/libc-compat.h
@@ -100,6 +100,35 @@
 
 #endif /* _NET_IF_H */
 
+/* Coordinate with glibc netax25/ax25.h header. */
+#if defined(_NETAX25_AX25_H)
+
+#define __UAPI_DEF_SIOCAX25GETUID_TO_SIOCAX25DELFWD	0
+#define __UAPI_DEF_SIOCAX25GETINFO			0
+#define __UAPI_DEF_AX25_ADDRESS				0
+#define __UAPI_DEF_SOCKADDR_AX25			0
+#define __UAPI_DEF_FULL_SOCKADDR_AX25			0
+#define __UAPI_DEF_AX25_ROUTES_STRUCT			0
+#define __UAPI_DEF_AX25_ROUTES_OPT_STRUCT		0
+#define __UAPI_DEF_AX25_CTL_STRUCT			0
+#define __UAPI_DEF_AX25_INFO_STRUCT			0
+#define __UAPI_DEF_AX25_FWD_STRUCT			0
+
+#else /* defined(_NETAX25_AX25_H) */
+
+#define __UAPI_DEF_SIOCAX25GETUID_TO_SIOCAX25DELFWD	1
+#define __UAPI_DEF_SIOCAX25GETINFO			1
+#define __UAPI_DEF_AX25_ADDRESS				1
+#define __UAPI_DEF_SOCKADDR_AX25			1
+#define __UAPI_DEF_FULL_SOCKADDR_AX25			1
+#define __UAPI_DEF_AX25_ROUTES_STRUCT			1
+#define __UAPI_DEF_AX25_ROUTES_OPT_STRUCT		1
+#define __UAPI_DEF_AX25_CTL_STRUCT			1
+#define __UAPI_DEF_AX25_INFO_STRUCT			1
+#define __UAPI_DEF_AX25_FWD_STRUCT			1
+
+#endif /* defined(_NETAX25_AX25_H) */
+
 /* Coordinate with glibc netinet/in.h header. */
 #if defined(_NETINET_IN_H)
 
@@ -204,6 +233,18 @@
 #define __UAPI_DEF_F_DUPFD_CLOEXEC		1
 #define __UAPI_DEF_O_ACCMODE_RDONLY_WRONLY_RDWR	1
 
+/* Definitions for ax25.h */
+#define __UAPI_DEF_SIOCAX25GETUID_TO_SIOCAX25DELFWD	1
+#define __UAPI_DEF_SIOCAX25GETINFO			1
+#define __UAPI_DEF_AX25_ADDRESS				1
+#define __UAPI_DEF_SOCKADDR_AX25			1
+#define __UAPI_DEF_FULL_SOCKADDR_AX25			1
+#define __UAPI_DEF_AX25_ROUTES_STRUCT			1
+#define __UAPI_DEF_AX25_ROUTES_OPT_STRUCT		1
+#define __UAPI_DEF_AX25_CTL_STRUCT			1
+#define __UAPI_DEF_AX25_INFO_STRUCT			1
+#define __UAPI_DEF_AX25_FWD_STRUCT			1
+
 /* Definitions for if.h */
 #define __UAPI_DEF_IF_IFCONF 1
 #define __UAPI_DEF_IF_IFMAP 1
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v05 69/72] uapi rose.h: glibc netrose/rose.h header file compatibility fixes
       [not found] <1471890809-4383-1-git-send-email-mikko.rapeli@iki.fi>
  2016-08-22 18:33 ` [PATCH v05 68/72] uapi ax25.h: glibc netax25/ax25.h header file compatibility fixes Mikko Rapeli
@ 2016-08-22 18:33 ` Mikko Rapeli
  2016-08-22 23:33   ` David Miller
  2016-08-26 15:38   ` walter harms
  1 sibling, 2 replies; 13+ messages in thread
From: Mikko Rapeli @ 2016-08-22 18:33 UTC (permalink / raw)
  To: linux-kernel
  Cc: Mikko Rapeli, Ralf Baechle, David S. Miller, Nicolas Dichtel,
	linux-hams

Fixes these userspace compile errors and warnings when glibc
netrose/rose.h is included before linux/rose.h:

linux/rose.h:25:0: warning: "SIOCRSGCAUSE" redefined
linux/rose.h:26:0: warning: "SIOCRSSCAUSE" redefined
linux/rose.h:27:0: warning: "SIOCRSL2CALL" redefined
linux/rose.h:28:0: warning: "SIOCRSSL2CALL" redefined
linux/rose.h:29:0: warning: "SIOCRSACCEPT" redefined
linux/rose.h:30:0: warning: "SIOCRSCLRRT" redefined
linux/rose.h:31:0: warning: "SIOCRSGL2CALL" redefined
linux/rose.h:32:0: warning: "SIOCRSGFACILITIES" redefined
linux/rose.h:47:3: error: conflicting types for ‘rose_address’
linux/rose.h:49:8: error: redefinition of ‘struct sockaddr_rose’
linux/rose.h:57:8: error: redefinition of ‘struct full_sockaddr_rose’
linux/rose.h:65:8: error: redefinition of ‘struct rose_route_struct’
linux/rose.h:74:8: error: redefinition of ‘struct rose_cause_struct’
linux/rose.h:79:8: error: redefinition of ‘struct rose_facilities_struct’

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
---
 include/uapi/linux/libc-compat.h | 30 ++++++++++++++++++++++++++++++
 include/uapi/linux/rose.h        | 15 +++++++++++++++
 2 files changed, 45 insertions(+)

diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
index 01bb521..acc2e75 100644
--- a/include/uapi/linux/libc-compat.h
+++ b/include/uapi/linux/libc-compat.h
@@ -209,6 +209,27 @@
 
 #endif /* defined(__NETIPX_IPX_H) */
 
+/* Coordinate with glibc netrose/rose.h */
+#if defined(_NETROSE_ROSE_H)
+#define __UAPI_DEF_SIOCRSGCAUSE_TO_SIOCRSGFACILITIES	0
+#define __UAPI_DEF_ROSE_ADDRESS				0
+#define __UAPI_DEF_SOCKADDR_ROSE			0
+#define __UAPI_DEF_FULL_SOCKADDR_ROSE			0
+#define __UAPI_DEF_ROSE_ROUTE_STRUCT			0
+#define __UAPI_DEF_ROSE_CAUSE_STRUCT			0
+#define __UAPI_DEF_ROSE_FACILITIES_STRUCT		0
+
+#else /* defined(_NETROSE_ROSE_H) */
+#define __UAPI_DEF_SIOCRSGCAUSE_TO_SIOCRSGFACILITIES	1
+#define __UAPI_DEF_ROSE_ADDRESS				1
+#define __UAPI_DEF_SOCKADDR_ROSE			1
+#define __UAPI_DEF_FULL_SOCKADDR_ROSE			1
+#define __UAPI_DEF_ROSE_ROUTE_STRUCT			1
+#define __UAPI_DEF_ROSE_CAUSE_STRUCT			1
+#define __UAPI_DEF_ROSE_FACILITIES_STRUCT		1
+
+#endif /* defined(_NETROSE_ROSE_H) */
+
 /* Definitions for sys/uio.h */
 #if defined(_SYS_UIO_H)
 #define __UAPI_DEF_IOVEC		0
@@ -283,6 +304,15 @@
 #define __UAPI_DEF_IPX_CONFIG_DATA		1
 #define __UAPI_DEF_IPX_ROUTE_DEF		1
 
+/* Definitions for rose.h */
+#define __UAPI_DEF_SIOCRSGCAUSE_TO_SIOCRSGFACILITIES	1
+#define __UAPI_DEF_ROSE_ADDRESS				1
+#define __UAPI_DEF_SOCKADDR_ROSE			1
+#define __UAPI_DEF_FULL_SOCKADDR_ROSE			1
+#define __UAPI_DEF_ROSE_ROUTE_STRUCT			1
+#define __UAPI_DEF_ROSE_CAUSE_STRUCT			1
+#define __UAPI_DEF_ROSE_FACILITIES_STRUCT		1
+
 /* Definitions for uio.h */
 #define __UAPI_DEF_IOVEC		1
 
diff --git a/include/uapi/linux/rose.h b/include/uapi/linux/rose.h
index 1fcfe95..c39499c 100644
--- a/include/uapi/linux/rose.h
+++ b/include/uapi/linux/rose.h
@@ -7,6 +7,7 @@
 #ifndef	ROSE_KERNEL_H
 #define	ROSE_KERNEL_H
 
+#include <linux/libc-compat.h>
 #include <linux/socket.h>
 #include <linux/ax25.h>
 
@@ -22,6 +23,7 @@
 #define	ROSE_QBITINCL	6
 #define	ROSE_HOLDBACK	7
 
+#if __UAPI_DEF_SIOCRSGCAUSE_TO_SIOCRSGFACILITIES
 #define	SIOCRSGCAUSE		(SIOCPROTOPRIVATE+0)
 #define	SIOCRSSCAUSE		(SIOCPROTOPRIVATE+1)
 #define	SIOCRSL2CALL		(SIOCPROTOPRIVATE+2)
@@ -30,6 +32,7 @@
 #define	SIOCRSCLRRT		(SIOCPROTOPRIVATE+4)
 #define	SIOCRSGL2CALL		(SIOCPROTOPRIVATE+5)
 #define	SIOCRSGFACILITIES	(SIOCPROTOPRIVATE+6)
+#endif /* __UAPI_DEF_SIOCRSGCAUSE_TO_SIOCRSGFACILITIES */
 
 #define	ROSE_DTE_ORIGINATED	0x00
 #define	ROSE_NUMBER_BUSY	0x01
@@ -42,10 +45,13 @@
 #define	ROSE_LOCAL_PROCEDURE	0x13
 #define	ROSE_SHIP_ABSENT	0x39
 
+#if __UAPI_DEF_ROSE_ADDRESS
 typedef struct {
 	char		rose_addr[5];
 } rose_address;
+#endif /* __UAPI_DEF_ROSE_ADDRESS */
 
+#if __UAPI_DEF_SOCKADDR_ROSE
 struct sockaddr_rose {
 	__kernel_sa_family_t srose_family;
 	rose_address	srose_addr;
@@ -53,7 +59,9 @@ struct sockaddr_rose {
 	int		srose_ndigis;
 	ax25_address	srose_digi;
 };
+#endif /* __UAPI_DEF_SOCKADDR_ROSE */
 
+#if __UAPI_DEF_FULL_SOCKADDR_ROSE
 struct full_sockaddr_rose {
 	__kernel_sa_family_t srose_family;
 	rose_address	srose_addr;
@@ -61,7 +69,9 @@ struct full_sockaddr_rose {
 	unsigned int	srose_ndigis;
 	ax25_address	srose_digis[ROSE_MAX_DIGIS];
 };
+#endif /* __UAPI_DEF_FULL_SOCKADDR_ROSE */
 
+#if __UAPI_DEF_ROSE_ROUTE_STRUCT
 struct rose_route_struct {
 	rose_address	address;
 	unsigned short	mask;
@@ -70,12 +80,16 @@ struct rose_route_struct {
 	unsigned char	ndigis;
 	ax25_address	digipeaters[AX25_MAX_DIGIS];
 };
+#endif /* __UAPI_DEF_ROSE_ROUTE_STRUCT */
 
+#if __UAPI_DEF_ROSE_CAUSE_STRUCT
 struct rose_cause_struct {
 	unsigned char	cause;
 	unsigned char	diagnostic;
 };
+#endif /* __UAPI_DEF_ROSE_CAUSE_STRUCT */
 
+#if __UAPI_DEF_ROSE_FACILITIES_STRUCT
 struct rose_facilities_struct {
 	rose_address	source_addr,   dest_addr;
 	ax25_address	source_call,   dest_call;
@@ -86,5 +100,6 @@ struct rose_facilities_struct {
 	rose_address	fail_addr;
 	ax25_address	fail_call;
 };
+#endif /* __UAPI_DEF_ROSE_FACILITIES_STRUCT */
 
 #endif
-- 
2.8.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v05 69/72] uapi rose.h: glibc netrose/rose.h header file compatibility fixes
  2016-08-22 18:33 ` [PATCH v05 69/72] uapi rose.h: glibc netrose/rose.h " Mikko Rapeli
@ 2016-08-22 23:33   ` David Miller
  2016-08-26 15:38   ` walter harms
  1 sibling, 0 replies; 13+ messages in thread
From: David Miller @ 2016-08-22 23:33 UTC (permalink / raw)
  To: mikko.rapeli; +Cc: linux-kernel, ralf, nicolas.dichtel, linux-hams


Must be CC:'d to netdev.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v05 68/72] uapi ax25.h: glibc netax25/ax25.h header file compatibility fixes
  2016-08-22 18:33 ` [PATCH v05 68/72] uapi ax25.h: glibc netax25/ax25.h header file compatibility fixes Mikko Rapeli
@ 2016-08-22 23:33   ` David Miller
       [not found]     ` <20160822.163303.1956681667227236700.davem@davemloft.net>
  0 siblings, 1 reply; 13+ messages in thread
From: David Miller @ 2016-08-22 23:33 UTC (permalink / raw)
  To: mikko.rapeli; +Cc: linux-kernel, ralf, nicolas.dichtel, linux-hams


Must be CC:'d to netdev.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v05 66/72] uapi icmp.h: glibc netinet/ip_icmp.h header file compatibility fixes
       [not found]     ` <20160822.163303.1956681667227236700.davem@davemloft.net>
@ 2016-08-23 21:21       ` Mikko Rapeli
  2016-08-23 23:38         ` David Miller
  0 siblings, 1 reply; 13+ messages in thread
From: Mikko Rapeli @ 2016-08-23 21:21 UTC (permalink / raw)
  To: David Miller, netdev
  Cc: linux-kernel, edumazet, nicolas.dichtel, ralf, linux-hams

On Mon, Aug 22, 2016 at 04:32:51PM -0700, David Miller wrote:
> You have to post this properly to the netdev list.
> 
> If netdev is not CC:'d it doesn't get properly logged in patchwork,
> and won't be applied.

Sorry, get_maintainers.pl did not find netdev list for these patches.

Could you update MAINTAINERS so that networking stuff from include/linux/uapi/
finds netdev?

I could propose patches but they are bound to be incomplete so networking devs
could do this faster and with fewer review iterations.

This problem seems to be quite common though. Maybe the uapi split did not
update MAINTAINER file with include/uapi files.

-Mikko

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v05 66/72] uapi icmp.h: glibc netinet/ip_icmp.h header file compatibility fixes
  2016-08-23 21:21       ` [PATCH v05 66/72] uapi icmp.h: glibc netinet/ip_icmp.h " Mikko Rapeli
@ 2016-08-23 23:38         ` David Miller
  0 siblings, 0 replies; 13+ messages in thread
From: David Miller @ 2016-08-23 23:38 UTC (permalink / raw)
  To: mikko.rapeli
  Cc: netdev, linux-kernel, edumazet, nicolas.dichtel, ralf, linux-hams

From: Mikko Rapeli <mikko.rapeli@iki.fi>
Date: Wed, 24 Aug 2016 00:21:45 +0300

> I could propose patches but they are bound to be incomplete so
> networking devs could do this faster and with fewer review
> iterations.

If I did it I'm seriously not going to go any further than taking the
diffstat of your patches and using that to add entries to MAINTAINERS.

So you could do it equally as well.

I don't have time for an exhaustive add.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v05 69/72] uapi rose.h: glibc netrose/rose.h header file compatibility fixes
  2016-08-22 18:33 ` [PATCH v05 69/72] uapi rose.h: glibc netrose/rose.h " Mikko Rapeli
  2016-08-22 23:33   ` David Miller
@ 2016-08-26 15:38   ` walter harms
  2016-08-28  5:59     ` Mikko Rapeli
  1 sibling, 1 reply; 13+ messages in thread
From: walter harms @ 2016-08-26 15:38 UTC (permalink / raw)
  To: Mikko Rapeli; +Cc: linux-kernel, linux-hams


perhaps this not tested snipped would make sure that
you have included linux/rose.h ?

#ifndef ROSE_KERNEL_H
#include <linux/rose.h>
#endif

#include <netrose/rose.h>

re,
 wh


Am 22.08.2016 20:33, schrieb Mikko Rapeli:
> Fixes these userspace compile errors and warnings when glibc
> netrose/rose.h is included before linux/rose.h:
> 
> linux/rose.h:25:0: warning: "SIOCRSGCAUSE" redefined
> linux/rose.h:26:0: warning: "SIOCRSSCAUSE" redefined
> linux/rose.h:27:0: warning: "SIOCRSL2CALL" redefined
> linux/rose.h:28:0: warning: "SIOCRSSL2CALL" redefined
> linux/rose.h:29:0: warning: "SIOCRSACCEPT" redefined
> linux/rose.h:30:0: warning: "SIOCRSCLRRT" redefined
> linux/rose.h:31:0: warning: "SIOCRSGL2CALL" redefined
> linux/rose.h:32:0: warning: "SIOCRSGFACILITIES" redefined
> linux/rose.h:47:3: error: conflicting types for ‘rose_address’
> linux/rose.h:49:8: error: redefinition of ‘struct sockaddr_rose’
> linux/rose.h:57:8: error: redefinition of ‘struct full_sockaddr_rose’
> linux/rose.h:65:8: error: redefinition of ‘struct rose_route_struct’
> linux/rose.h:74:8: error: redefinition of ‘struct rose_cause_struct’
> linux/rose.h:79:8: error: redefinition of ‘struct rose_facilities_struct’
> 
> Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
> ---
>  include/uapi/linux/libc-compat.h | 30 ++++++++++++++++++++++++++++++
>  include/uapi/linux/rose.h        | 15 +++++++++++++++
>  2 files changed, 45 insertions(+)
> 
> diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
> index 01bb521..acc2e75 100644
> --- a/include/uapi/linux/libc-compat.h
> +++ b/include/uapi/linux/libc-compat.h
> @@ -209,6 +209,27 @@
>  
>  #endif /* defined(__NETIPX_IPX_H) */
>  
> +/* Coordinate with glibc netrose/rose.h */
> +#if defined(_NETROSE_ROSE_H)
> +#define __UAPI_DEF_SIOCRSGCAUSE_TO_SIOCRSGFACILITIES	0
> +#define __UAPI_DEF_ROSE_ADDRESS				0
> +#define __UAPI_DEF_SOCKADDR_ROSE			0
> +#define __UAPI_DEF_FULL_SOCKADDR_ROSE			0
> +#define __UAPI_DEF_ROSE_ROUTE_STRUCT			0
> +#define __UAPI_DEF_ROSE_CAUSE_STRUCT			0
> +#define __UAPI_DEF_ROSE_FACILITIES_STRUCT		0
> +
> +#else /* defined(_NETROSE_ROSE_H) */
> +#define __UAPI_DEF_SIOCRSGCAUSE_TO_SIOCRSGFACILITIES	1
> +#define __UAPI_DEF_ROSE_ADDRESS				1
> +#define __UAPI_DEF_SOCKADDR_ROSE			1
> +#define __UAPI_DEF_FULL_SOCKADDR_ROSE			1
> +#define __UAPI_DEF_ROSE_ROUTE_STRUCT			1
> +#define __UAPI_DEF_ROSE_CAUSE_STRUCT			1
> +#define __UAPI_DEF_ROSE_FACILITIES_STRUCT		1
> +
> +#endif /* defined(_NETROSE_ROSE_H) */
> +
>  /* Definitions for sys/uio.h */
>  #if defined(_SYS_UIO_H)
>  #define __UAPI_DEF_IOVEC		0
> @@ -283,6 +304,15 @@
>  #define __UAPI_DEF_IPX_CONFIG_DATA		1
>  #define __UAPI_DEF_IPX_ROUTE_DEF		1
>  
> +/* Definitions for rose.h */
> +#define __UAPI_DEF_SIOCRSGCAUSE_TO_SIOCRSGFACILITIES	1
> +#define __UAPI_DEF_ROSE_ADDRESS				1
> +#define __UAPI_DEF_SOCKADDR_ROSE			1
> +#define __UAPI_DEF_FULL_SOCKADDR_ROSE			1
> +#define __UAPI_DEF_ROSE_ROUTE_STRUCT			1
> +#define __UAPI_DEF_ROSE_CAUSE_STRUCT			1
> +#define __UAPI_DEF_ROSE_FACILITIES_STRUCT		1
> +
>  /* Definitions for uio.h */
>  #define __UAPI_DEF_IOVEC		1
>  
> diff --git a/include/uapi/linux/rose.h b/include/uapi/linux/rose.h
> index 1fcfe95..c39499c 100644
> --- a/include/uapi/linux/rose.h
> +++ b/include/uapi/linux/rose.h
> @@ -7,6 +7,7 @@
>  #ifndef	ROSE_KERNEL_H
>  #define	ROSE_KERNEL_H
>  
> +#include <linux/libc-compat.h>
>  #include <linux/socket.h>
>  #include <linux/ax25.h>
>  
> @@ -22,6 +23,7 @@
>  #define	ROSE_QBITINCL	6
>  #define	ROSE_HOLDBACK	7
>  
> +#if __UAPI_DEF_SIOCRSGCAUSE_TO_SIOCRSGFACILITIES
>  #define	SIOCRSGCAUSE		(SIOCPROTOPRIVATE+0)
>  #define	SIOCRSSCAUSE		(SIOCPROTOPRIVATE+1)
>  #define	SIOCRSL2CALL		(SIOCPROTOPRIVATE+2)
> @@ -30,6 +32,7 @@
>  #define	SIOCRSCLRRT		(SIOCPROTOPRIVATE+4)
>  #define	SIOCRSGL2CALL		(SIOCPROTOPRIVATE+5)
>  #define	SIOCRSGFACILITIES	(SIOCPROTOPRIVATE+6)
> +#endif /* __UAPI_DEF_SIOCRSGCAUSE_TO_SIOCRSGFACILITIES */
>  
>  #define	ROSE_DTE_ORIGINATED	0x00
>  #define	ROSE_NUMBER_BUSY	0x01
> @@ -42,10 +45,13 @@
>  #define	ROSE_LOCAL_PROCEDURE	0x13
>  #define	ROSE_SHIP_ABSENT	0x39
>  
> +#if __UAPI_DEF_ROSE_ADDRESS
>  typedef struct {
>  	char		rose_addr[5];
>  } rose_address;
> +#endif /* __UAPI_DEF_ROSE_ADDRESS */
>  
> +#if __UAPI_DEF_SOCKADDR_ROSE
>  struct sockaddr_rose {
>  	__kernel_sa_family_t srose_family;
>  	rose_address	srose_addr;
> @@ -53,7 +59,9 @@ struct sockaddr_rose {
>  	int		srose_ndigis;
>  	ax25_address	srose_digi;
>  };
> +#endif /* __UAPI_DEF_SOCKADDR_ROSE */
>  
> +#if __UAPI_DEF_FULL_SOCKADDR_ROSE
>  struct full_sockaddr_rose {
>  	__kernel_sa_family_t srose_family;
>  	rose_address	srose_addr;
> @@ -61,7 +69,9 @@ struct full_sockaddr_rose {
>  	unsigned int	srose_ndigis;
>  	ax25_address	srose_digis[ROSE_MAX_DIGIS];
>  };
> +#endif /* __UAPI_DEF_FULL_SOCKADDR_ROSE */
>  
> +#if __UAPI_DEF_ROSE_ROUTE_STRUCT
>  struct rose_route_struct {
>  	rose_address	address;
>  	unsigned short	mask;
> @@ -70,12 +80,16 @@ struct rose_route_struct {
>  	unsigned char	ndigis;
>  	ax25_address	digipeaters[AX25_MAX_DIGIS];
>  };
> +#endif /* __UAPI_DEF_ROSE_ROUTE_STRUCT */
>  
> +#if __UAPI_DEF_ROSE_CAUSE_STRUCT
>  struct rose_cause_struct {
>  	unsigned char	cause;
>  	unsigned char	diagnostic;
>  };
> +#endif /* __UAPI_DEF_ROSE_CAUSE_STRUCT */
>  
> +#if __UAPI_DEF_ROSE_FACILITIES_STRUCT
>  struct rose_facilities_struct {
>  	rose_address	source_addr,   dest_addr;
>  	ax25_address	source_call,   dest_call;
> @@ -86,5 +100,6 @@ struct rose_facilities_struct {
>  	rose_address	fail_addr;
>  	ax25_address	fail_call;
>  };
> +#endif /* __UAPI_DEF_ROSE_FACILITIES_STRUCT */
>  
>  #endif

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v05 69/72] uapi rose.h: glibc netrose/rose.h header file compatibility fixes
  2016-08-26 15:38   ` walter harms
@ 2016-08-28  5:59     ` Mikko Rapeli
  2016-08-28 12:37       ` walter harms
  2016-08-29 19:34       ` David Ranch
  0 siblings, 2 replies; 13+ messages in thread
From: Mikko Rapeli @ 2016-08-28  5:59 UTC (permalink / raw)
  To: walter harms; +Cc: linux-kernel, linux-hams

On Fri, Aug 26, 2016 at 05:38:00PM +0200, walter harms wrote:
> perhaps this not tested snipped would make sure that
> you have included linux/rose.h ?
> 
> #ifndef ROSE_KERNEL_H
> #include <linux/rose.h>
> #endif
> 
> #include <netrose/rose.h>

Sorry, I did not quite get this.

<linux/rose.h> has conflicting definitions with glibc <netrose/rose.h>.
The patches fixes the uapi headers <linux/rose.h> so that it hides
definitions if <netrose/rose.h> from glibc was already included.

-Mikko

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v05 69/72] uapi rose.h: glibc netrose/rose.h header file compatibility fixes
  2016-08-28  5:59     ` Mikko Rapeli
@ 2016-08-28 12:37       ` walter harms
  2016-08-29 19:34       ` David Ranch
  1 sibling, 0 replies; 13+ messages in thread
From: walter harms @ 2016-08-28 12:37 UTC (permalink / raw)
  To: Mikko Rapeli; +Cc: linux-kernel, linux-hams



Am 28.08.2016 07:59, schrieb Mikko Rapeli:
> On Fri, Aug 26, 2016 at 05:38:00PM +0200, walter harms wrote:
>> perhaps this not tested snipped would make sure that
>> you have included linux/rose.h ?
>>
>> #ifndef ROSE_KERNEL_H
>> #include <linux/rose.h>
>> #endif
>>
>> #include <netrose/rose.h>
> 
> Sorry, I did not quite get this.
> 
> <linux/rose.h> has conflicting definitions with glibc <netrose/rose.h>.
> The patches fixes the uapi headers <linux/rose.h> so that it hides
> definitions if <netrose/rose.h> from glibc was already included.
> 
> -Mikko

no problem,
so far i understand the conflict arise because you need to include
linux/rose.h before netrose/rose.h

My suggestion was to add a check for linux/rose.h (ROSE_KERNEL_H)
and include it if not already done. (basicly this should work out
of the box but it seems a problem here).

I have no idea if you need to cover other cases but in my
understanding userspace programms should not include kernel headers.

re,
 wh

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v05 69/72] uapi rose.h: glibc netrose/rose.h header file compatibility fixes
  2016-08-28  5:59     ` Mikko Rapeli
  2016-08-28 12:37       ` walter harms
@ 2016-08-29 19:34       ` David Ranch
  2016-08-30  7:34         ` Mikko Rapeli
  2016-11-16 19:07         ` Mikko Rapeli
  1 sibling, 2 replies; 13+ messages in thread
From: David Ranch @ 2016-08-29 19:34 UTC (permalink / raw)
  To: Mikko Rapeli, walter harms; +Cc: linux-kernel, linux-hams


Hello Mikko,

Somewhat related, the ax25.h file from libax25-devel also has conflicts 
with the Glibc's ax.25.h.  This creates trouble so if we could get a fix 
for that, that would be appreciated as well though it might be a Glibc 
issue and not a kernel issue.

--David



On 08/27/2016 10:59 PM, Mikko Rapeli wrote:
> On Fri, Aug 26, 2016 at 05:38:00PM +0200, walter harms wrote:
>> perhaps this not tested snipped would make sure that
>> you have included linux/rose.h ?
>>
>> #ifndef ROSE_KERNEL_H
>> #include <linux/rose.h>
>> #endif
>>
>> #include <netrose/rose.h>
> Sorry, I did not quite get this.
>
> <linux/rose.h> has conflicting definitions with glibc <netrose/rose.h>.
> The patches fixes the uapi headers <linux/rose.h> so that it hides
> definitions if <netrose/rose.h> from glibc was already included.
>
> -Mikko
> --
> To unsubscribe from this list: send the line "unsubscribe linux-hams" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v05 69/72] uapi rose.h: glibc netrose/rose.h header file compatibility fixes
  2016-08-29 19:34       ` David Ranch
@ 2016-08-30  7:34         ` Mikko Rapeli
  2016-11-16 19:07         ` Mikko Rapeli
  1 sibling, 0 replies; 13+ messages in thread
From: Mikko Rapeli @ 2016-08-30  7:34 UTC (permalink / raw)
  To: David Ranch; +Cc: walter harms, linux-kernel, linux-hams

On Mon, Aug 29, 2016 at 12:34:25PM -0700, David Ranch wrote:
> Hello Mikko,
> 
> Somewhat related, the ax25.h file from libax25-devel also has conflicts with
> the Glibc's ax.25.h.  This creates trouble so if we could get a fix for
> that, that would be appreciated as well though it might be a Glibc issue and
> not a kernel issue.

I'll put this to the back of my todo list. The approach could be similar to
include/uapi/linux/libc-compat.h from linux uapi headers.

-Mikko

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v05 69/72] uapi rose.h: glibc netrose/rose.h header file compatibility fixes
  2016-08-29 19:34       ` David Ranch
  2016-08-30  7:34         ` Mikko Rapeli
@ 2016-11-16 19:07         ` Mikko Rapeli
  2016-11-16 22:17           ` David Ranch
  1 sibling, 1 reply; 13+ messages in thread
From: Mikko Rapeli @ 2016-11-16 19:07 UTC (permalink / raw)
  To: David Ranch; +Cc: walter harms, linux-kernel, linux-hams

Hi,

On Mon, Aug 29, 2016 at 12:34:25PM -0700, David Ranch wrote:
> Hello Mikko,
> 
> Somewhat related, the ax25.h file from libax25-devel also has conflicts with
> the Glibc's ax.25.h.  This creates trouble so if we could get a fix for
> that, that would be appreciated as well though it might be a Glibc issue and
> not a kernel issue.

I had a look at libax25 git tree and the rose.h and ax25.h there are copies
from glibc sources which in turn are modified copies from age old kernel
headers. My suggestion is on Linux platforms to use the linux kernel headers
which will co-operate nicely with glibc headers with these changes if you need
something from them which are not available in glibc headers yet.

-Mikko

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v05 69/72] uapi rose.h: glibc netrose/rose.h header file compatibility fixes
  2016-11-16 19:07         ` Mikko Rapeli
@ 2016-11-16 22:17           ` David Ranch
  0 siblings, 0 replies; 13+ messages in thread
From: David Ranch @ 2016-11-16 22:17 UTC (permalink / raw)
  To: Mikko Rapeli; +Cc: walter harms, linux-kernel, linux-hams


Hello Mikko,

It would be great to see a solution to this long standing issue.  I 
would highlight that we have two pockets of AX.25 that need to be 
considered aligned IMHO:

#Official AX.25 repo but sometimes doesn't include all available fixes
http://git.linux-ax25.org/cgit/libax25.git/tree/netax25/ax25.h

#Unofficial AX.25 repo which sometimes has more fixes
https://github.com/ve7fet/linuxax25/blob/master/libax25/netax25/ax25.h

#Current Glibc version
https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=sysdeps/unix/sysv/linux/netax25/ax25.h;hb=HEAD


Fortunately, it looks like both of these repos have the same file 
(confirmed with a diff).  Comparing to the Glibc versio, the differences 
are minimal:


diff -u ax25.h-officialax25 ax25.h-glibc
--- ax25.h-officialax25 2016-11-16 13:53:27.000000000 -0800
+++ ax25.h-glibc        2016-11-16 14:14:03.000000000 -0800
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2016 Free Software Foundation, Inc.
     This file is part of the GNU C Library.

     The GNU C Library is free software; you can redistribute it and/or
@@ -12,15 +12,14 @@
     Lesser General Public License for more details.

     You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-   02111-1307 USA.  */
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */

  #ifndef _NETAX25_AX25_H
  #define _NETAX25_AX25_H        1

  #include <features.h>
-#include <sys/socket.h>
+#include <bits/sockaddr.h>

  /* Setsockoptions(2) level.  Thanks to BSD these must match 
IPPROTO_xxx.  */
  #define SOL_AX25       257


--David

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2016-11-16 22:17 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1471890809-4383-1-git-send-email-mikko.rapeli@iki.fi>
2016-08-22 18:33 ` [PATCH v05 68/72] uapi ax25.h: glibc netax25/ax25.h header file compatibility fixes Mikko Rapeli
2016-08-22 23:33   ` David Miller
     [not found]     ` <20160822.163303.1956681667227236700.davem@davemloft.net>
2016-08-23 21:21       ` [PATCH v05 66/72] uapi icmp.h: glibc netinet/ip_icmp.h " Mikko Rapeli
2016-08-23 23:38         ` David Miller
2016-08-22 18:33 ` [PATCH v05 69/72] uapi rose.h: glibc netrose/rose.h " Mikko Rapeli
2016-08-22 23:33   ` David Miller
2016-08-26 15:38   ` walter harms
2016-08-28  5:59     ` Mikko Rapeli
2016-08-28 12:37       ` walter harms
2016-08-29 19:34       ` David Ranch
2016-08-30  7:34         ` Mikko Rapeli
2016-11-16 19:07         ` Mikko Rapeli
2016-11-16 22:17           ` David Ranch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox