linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mikko Rapeli <mikko.rapeli@iki.fi>
To: linux-kernel@vger.kernel.org, linux-api@vger.kernel.org
Cc: Mikko Rapeli <mikko.rapeli@iki.fi>,
	Frans Klaver <fransklaver@gmail.com>,
	David Miller <davem@davemloft.net>,
	"Dmitry V. Levin" <ldv@altlinux.org>,
	Jonas Gorski <jonas.gorski@gmail.com>
Subject: [PATCH v06 34/36] uapi: break dependency loop between <linux/hdlc/ioctl.h> and <linux/if.h>
Date: Sun,  6 Aug 2017 18:44:25 +0200	[thread overview]
Message-ID: <20170806164428.2273-35-mikko.rapeli@iki.fi> (raw)
In-Reply-To: <20170806164428.2273-1-mikko.rapeli@iki.fi>

Name structs in linux/hdlc/ioctl.h and forward declare and use them in
linux/if.h. Then include linux/if.h in linux/hdlc/ioctl.h to fix
user space compilation problem:

hdlc/ioctl.h:73:14: error: ‘IFNAMSIZ’ undeclared here (not in a function)
  char master[IFNAMSIZ]; /* Name of master FRAD device */
              ^~~~~~~~

This approach for suggested by Frans Klaver <fransklaver@gmail.com>
in lkml message
<CAH6sp9Ni636HR4sma0SeSZPs+Tws9Y41jij-=fu0gMZj5Zbsyg@mail.gmail.com>.

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: Frans Klaver <fransklaver@gmail.com>
Cc: David Miller <davem@davemloft.net>
---
 include/uapi/linux/hdlc/ioctl.h | 17 +++++++++--------
 include/uapi/linux/if.h         | 23 ++++++++++++++++-------
 2 files changed, 25 insertions(+), 15 deletions(-)

diff --git a/include/uapi/linux/hdlc/ioctl.h b/include/uapi/linux/hdlc/ioctl.h
index 04bc0274a189..717d3edef7d1 100644
--- a/include/uapi/linux/hdlc/ioctl.h
+++ b/include/uapi/linux/hdlc/ioctl.h
@@ -1,6 +1,7 @@
 #ifndef __HDLC_IOCTL_H__
 #define __HDLC_IOCTL_H__
 
+#include <linux/if.h>
 
 #define GENERIC_HDLC_VERSION 4	/* For synchronization with sethdlc utility */
 
@@ -36,25 +37,25 @@
 
 #ifndef __ASSEMBLY__
 
-typedef struct {
+typedef struct sync_serial_settings {
 	unsigned int clock_rate; /* bits per second */
 	unsigned int clock_type; /* internal, external, TX-internal etc. */
 	unsigned short loopback;
 } sync_serial_settings;          /* V.35, V.24, X.21 */
 
-typedef struct {
+typedef struct te1_settings {
 	unsigned int clock_rate; /* bits per second */
 	unsigned int clock_type; /* internal, external, TX-internal etc. */
 	unsigned short loopback;
 	unsigned int slot_map;
 } te1_settings;                  /* T1, E1 */
 
-typedef struct {
+typedef struct raw_hdlc_proto {
 	unsigned short encoding;
 	unsigned short parity;
 } raw_hdlc_proto;
 
-typedef struct {
+typedef struct fr_proto {
 	unsigned int t391;
 	unsigned int t392;
 	unsigned int n391;
@@ -64,16 +65,16 @@ typedef struct {
 	unsigned short dce; /* 1 for DCE (network side) operation */
 } fr_proto;
 
-typedef struct {
+typedef struct fr_proto_pvc {
 	unsigned int dlci;
 } fr_proto_pvc;          /* for creating/deleting FR PVCs */
 
-typedef struct {
+typedef struct fr_proto_pvc_info {
 	unsigned int dlci;
 	char master[IFNAMSIZ];	/* Name of master FRAD device */
-}fr_proto_pvc_info;		/* for returning PVC information only */
+} fr_proto_pvc_info;		/* for returning PVC information only */
 
-typedef struct {
+typedef struct cisco_proto {
     unsigned int interval;
     unsigned int timeout;
 } cisco_proto;
diff --git a/include/uapi/linux/if.h b/include/uapi/linux/if.h
index 259617a551f2..b57d9cd08ac9 100644
--- a/include/uapi/linux/if.h
+++ b/include/uapi/linux/if.h
@@ -34,6 +34,15 @@
 #define	IFALIASZ	256
 #include <linux/hdlc/ioctl.h>
 
+/* Forward declarations to break dependency loop with <linux/hdlc/ioctl.h> */
+struct sync_serial_settings;
+struct ae1_settings;
+struct raw_hdlc_proto;
+struct fr_proto;
+struct fr_proto_pvc;
+struct fr_proto_pvc_info;
+struct cisco_proto;
+
 /* For glibc compatibility. An empty enum does not compile. */
 #if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 || \
     __UAPI_DEF_IF_NET_DEVICE_FLAGS != 0
@@ -206,15 +215,15 @@ struct if_settings {
 	unsigned int size;	/* Size of the data allocated by the caller */
 	union {
 		/* {atm/eth/dsl}_settings anyone ? */
-		raw_hdlc_proto		__user *raw_hdlc;
-		cisco_proto		__user *cisco;
-		fr_proto		__user *fr;
-		fr_proto_pvc		__user *fr_pvc;
-		fr_proto_pvc_info	__user *fr_pvc_info;
+		struct raw_hdlc_proto		__user *raw_hdlc;
+		struct cisco_proto		__user *cisco;
+		struct fr_proto		__user *fr;
+		struct fr_proto_pvc		__user *fr_pvc;
+		struct fr_proto_pvc_info	__user *fr_pvc_info;
 
 		/* interface settings */
-		sync_serial_settings	__user *sync;
-		te1_settings		__user *te1;
+		struct sync_serial_settings	__user *sync;
+		struct te1_settings		__user *te1;
 	} ifs_ifsu;
 };
 
-- 
2.13.3

  parent reply	other threads:[~2017-08-06 16:44 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-06 16:43 [PATCH v06 00/36] Userspace compile test and fixes for exported uapi header files Mikko Rapeli
2017-08-06 16:43 ` [PATCH v06 01/36] Add scripts/headers_compile_test.sh: compile test for exported uapi headers Mikko Rapeli
2017-08-06 16:43 ` [PATCH v06 02/36] uapi scsi/scsi_bsg_fc.h: use __u8, __u32 and __u64 from linux/types.h Mikko Rapeli
2017-08-06 16:43 ` [PATCH v06 03/36] uapi scsi/scsi_netlink.h: use __u8, __u16 " Mikko Rapeli
2017-08-06 16:43 ` [PATCH v06 04/36] uapi scsi/scsi_netlink_fc.h: use __u16, __u32 " Mikko Rapeli
2017-08-06 18:22   ` James Bottomley
     [not found]     ` <1502043773.2673.9.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
2017-08-06 20:42       ` Mikko Rapeli
2017-08-06 22:09         ` James Bottomley
     [not found]           ` <1502057361.2673.21.camel-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
2017-08-07  6:08             ` Mikko Rapeli
2017-08-06 16:43 ` [PATCH v06 06/36] uapi asm-generic/ipcbuf.h: include linux/posix_types.h Mikko Rapeli
2017-08-06 16:43 ` [PATCH v06 07/36] uapi asm-generic/msgbuf.h: include asm/ipcbuf.h Mikko Rapeli
2017-08-06 16:43 ` [PATCH v06 08/36] uapi asm-generic/shmbuf.h: include fixes Mikko Rapeli
2017-08-08 22:42   ` Dmitry V. Levin
2017-08-06 16:44 ` [PATCH v06 09/36] uapi asm-generic/sembuf.h: include asm/posix_types.h and asm/ipcbuf.h Mikko Rapeli
2017-08-08 22:45   ` Dmitry V. Levin
2017-08-06 16:44 ` [PATCH v06 10/36] uapi asm-generic/signal.h: use __kernel_size_t instead of size_t Mikko Rapeli
2017-08-06 16:44 ` [PATCH v06 11/36] uapi asm-generic/ucontext.h: include asm/signal.h and asm/sigcontext.h Mikko Rapeli
2017-08-06 16:44 ` [PATCH v06 12/36] x86 uapi asm/signal.h: use __kernel_size_t instead of size_t Mikko Rapeli
2017-08-07 14:30   ` Arnd Bergmann
2017-08-08 22:50   ` Dmitry V. Levin
2017-08-06 16:44 ` [PATCH v06 13/36] x86 uapi asm/sembuf.h: include linux/types.h and linux/ipc.h Mikko Rapeli
     [not found]   ` <20170806164428.2273-14-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2017-08-08 22:54     ` Dmitry V. Levin
2017-08-06 16:44 ` [PATCH v06 14/36] arm uapi asm/signal.h: include <stddef.h> for size_t in userspace Mikko Rapeli
2017-08-08 22:57   ` Dmitry V. Levin
     [not found]     ` <20170808225739.GF10552-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
2017-08-09 12:41       ` Arnd Bergmann
     [not found]         ` <CAK8P3a30Vd2JquMvZ88tTO4jFAUMJGtUpvLuDmDPp2UFBYXDLQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-09 12:52           ` Dmitry V. Levin
2017-08-06 16:44 ` [PATCH v06 15/36] uapi linux/socket.h: include sys/socket.h in user space Mikko Rapeli
     [not found]   ` <20170806164428.2273-16-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2017-08-08 23:00     ` Dmitry V. Levin
     [not found]       ` <20170808230041.GG10552-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
2017-08-09 12:32         ` Arnd Bergmann
2017-08-06 16:44 ` [PATCH v06 16/36] uapi linux/dlm_netlink.h: include linux/dlmconstants.h Mikko Rapeli
2017-08-06 16:44 ` [PATCH v06 17/36] uapi linux/sctp.h: use __u8, __u16 and __u32 from linux/types.h Mikko Rapeli
2017-08-06 16:44 ` [PATCH v06 18/36] uapi linux/errqueue.h: include linux/time.h in user space Mikko Rapeli
2017-08-06 20:23   ` Willem de Bruijn
2017-08-06 20:26     ` Willem de Bruijn
2017-08-06 20:58       ` Mikko Rapeli
     [not found]     ` <CAF=yD-L2ntuH54J_SwN9WcpBMgkV_v0e-Q2Pu2mrQ3+1RozGFQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-06 20:56       ` Mikko Rapeli
     [not found]         ` <20170806205654.GF28459-dqH1CgrzRhOk/eJAJmRu5A@public.gmane.org>
2017-08-06 21:24           ` Willem de Bruijn
     [not found]             ` <CAF=yD-+w2sboybyUZ-6nKQy1s=Oi1S4Z5yZgksM-CzQjDRG+Vw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-06 21:33               ` Mikko Rapeli
2017-08-06 21:42                 ` Willem de Bruijn
     [not found]                   ` <CAF=yD-LN9b9q6sY38eCBM3VyfErQ8sqpQ_7fwkJzMxgjeRFtFg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-06 21:52                     ` Mikko Rapeli
     [not found]                       ` <20170806215244.GB31101-dqH1CgrzRhOk/eJAJmRu5A@public.gmane.org>
2017-08-06 22:03                         ` Willem de Bruijn
2017-08-06 16:44 ` [PATCH v06 19/36] uapi linux/omapfb.h: use __kernel_size_t instead of size_t Mikko Rapeli
2017-08-07 15:00   ` Arnd Bergmann
2017-08-08 23:11   ` Dmitry V. Levin
2017-08-06 16:44 ` [PATCH v06 20/36] uapi linux/scc.h: include linux/sockios.h Mikko Rapeli
     [not found] ` <20170806164428.2273-1-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2017-08-06 16:43   ` [PATCH v06 05/36] uapi linux/sysctl.h: use __kernel_size_t instead of size_t Mikko Rapeli
     [not found]     ` <20170806164428.2273-6-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2017-08-08 22:34       ` Dmitry V. Levin
2017-08-09  7:18         ` Mikko Rapeli
2017-08-06 16:44   ` [PATCH v06 21/36] uapi linux/kexec.h: " Mikko Rapeli
     [not found]     ` <20170806164428.2273-22-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2017-08-07 15:12       ` Arnd Bergmann
2017-08-08 23:15     ` Dmitry V. Levin
2017-08-06 16:44   ` [PATCH v06 30/36] uapi rdma/rdma_user_rxe.h: include in.h and in6.h Mikko Rapeli
     [not found]     ` <20170806164428.2273-31-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2017-08-08 23:13       ` Jason Gunthorpe
     [not found]         ` <20170808231306.GH29372-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-08-09 13:48           ` Moni Shoua
2017-08-09 15:52             ` Jason Gunthorpe
     [not found]               ` <20170809155241.GB15586-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-08-10  2:47                 ` Dmitry V. Levin
     [not found]                   ` <20170810024747.GA30198-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
2017-08-10 16:19                     ` Jason Gunthorpe
2017-08-06 16:44   ` [PATCH v06 36/36] uapi linux/kfd_ioctl.h: use __u32 and __u64 instead of uint32_t and uint64_t Mikko Rapeli
     [not found]     ` <20170806164428.2273-37-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2017-08-07 15:01       ` Arnd Bergmann
2017-09-02 12:30         ` Oded Gabbay
2017-08-06 16:44 ` [PATCH v06 22/36] uapi linux/reiserfs_xattr.h: use __kernel_size_t instead of size_t Mikko Rapeli
2017-08-08 23:17   ` Dmitry V. Levin
2017-08-06 16:44 ` [PATCH v06 23/36] uapi linux/coda.h: use __kernel_pid_t and add u_short etc definitions for userspace Mikko Rapeli
     [not found]   ` <20170806164428.2273-24-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2017-08-07 15:06     ` Arnd Bergmann
2017-08-06 16:44 ` [PATCH v06 24/36] uapi linux/coda_psdev.h: move upc_req definition from uapi to kernel side headers Mikko Rapeli
2017-08-06 16:44 ` [PATCH v06 25/36] uapi linux/android/binder.h: use __kernel_pid_t and __kernel_uid_t Mikko Rapeli
2017-08-06 16:44 ` [PATCH v06 26/36] uapi xen/privcmd.h: fix compilation in userspace Mikko Rapeli
2017-08-15 22:58   ` [Xen-devel] " Stefano Stabellini
2017-08-06 16:44 ` [PATCH v06 27/36] uapi xen/gntdev.h: include xen/privcmd.h and define grant_ref_t Mikko Rapeli
     [not found]   ` <20170806164428.2273-28-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2017-08-21 13:33     ` Juergen Gross
     [not found]       ` <ff3e726a-8e03-4543-7190-e6f8229b9e99-IBi9RG/b67k@public.gmane.org>
2017-08-21 14:31         ` Boris Ostrovsky
     [not found]           ` <c4766f8b-fcd0-4158-2d70-72417bf4afbb-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
2017-08-21 14:46             ` Juergen Gross
2017-08-21 14:59               ` Boris Ostrovsky
2017-08-06 16:44 ` [PATCH v06 28/36] uapi xen/evtchn.h: include xen/privcmd.h Mikko Rapeli
2017-08-06 16:44 ` [PATCH v06 29/36] uapi linux/elfcore.h: remove non-compiling userspace parts Mikko Rapeli
2017-08-06 16:44 ` [PATCH v06 31/36] uapi linux/patchkey.h: change #error to #warning if file included directly Mikko Rapeli
2017-08-06 16:44 ` [PATCH v06 32/36] uapi drm/armada_drm.h: use __u32 and __u64 instead of uint32_t and uint64_t Mikko Rapeli
     [not found]   ` <20170806164428.2273-33-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2017-08-07  9:47     ` Daniel Vetter
2017-08-06 16:44 ` [PATCH v06 33/36] uapi linux/fsmap.h: use __kernel_size_t instead of size_t Mikko Rapeli
     [not found]   ` <20170806164428.2273-34-mikko.rapeli-X3B1VOXEql0@public.gmane.org>
2017-08-07 15:54     ` Darrick J. Wong
2017-08-07 16:01       ` Arnd Bergmann
     [not found]         ` <CAK8P3a3sVWu9wiqct4h9njZC53qUOrLbM_wXL7XXZ8hfiuK7Lg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-08-07 16:45           ` Darrick J. Wong
2017-08-07 20:20             ` Arnd Bergmann
2017-08-08 23:08               ` Darrick J. Wong
2017-08-09  8:24                 ` Arnd Bergmann
2017-08-06 16:44 ` Mikko Rapeli [this message]
2017-08-06 16:44 ` [PATCH v06 35/36] uapi linux/tls.h: don't include <net/tcp.h> in user space Mikko Rapeli
2017-08-08 23:25   ` Dmitry V. Levin
2017-09-04 16:15     ` Dmitry V. Levin
     [not found]       ` <20170904161510.GA16001-u2l5PoMzF/Vg9hUCZPvPmw@public.gmane.org>
2017-09-18 12:57         ` Mikko Rapeli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170806164428.2273-35-mikko.rapeli@iki.fi \
    --to=mikko.rapeli@iki.fi \
    --cc=davem@davemloft.net \
    --cc=fransklaver@gmail.com \
    --cc=jonas.gorski@gmail.com \
    --cc=ldv@altlinux.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).