[PATCH v05 27/72] linux/if.h linux/hdlc/ioctl.h: move IFNAMSIZ definition to hdlc/ioctl.h

From: Mikko Rapeli
Date: Mon Aug 22 2016 - 14:44:34 EST


Fixes userspace compiler error:

error: âIFNAMSIZâ undeclared here (not in a function)

Suggested by Frans Klaver <fransklaver@xxxxxxxxx> on lkml message
<20150530195223.GA15645@xxxxxxxxxxx>.

Signed-off-by: Mikko Rapeli <mikko.rapeli@xxxxxx>
---
include/uapi/linux/hdlc/ioctl.h | 5 +++++
include/uapi/linux/if.h | 5 +----
2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/include/uapi/linux/hdlc/ioctl.h b/include/uapi/linux/hdlc/ioctl.h
index 04bc027..4b7a7ed 100644
--- a/include/uapi/linux/hdlc/ioctl.h
+++ b/include/uapi/linux/hdlc/ioctl.h
@@ -1,6 +1,11 @@
#ifndef __HDLC_IOCTL_H__
#define __HDLC_IOCTL_H__

+#include <linux/libc-compat.h> /* for compatibility with glibc */
+
+#if __UAPI_DEF_IF_IFNAMSIZ
+#define IFNAMSIZ 16
+#endif /* __UAPI_DEF_IF_IFNAMSIZ */

#define GENERIC_HDLC_VERSION 4 /* For synchronization with sethdlc utility */

diff --git a/include/uapi/linux/if.h b/include/uapi/linux/if.h
index e601c8c..68bd205 100644
--- a/include/uapi/linux/if.h
+++ b/include/uapi/linux/if.h
@@ -23,12 +23,9 @@
#include <linux/types.h> /* for "__kernel_caddr_t" et al */
#include <linux/socket.h> /* for "struct sockaddr" et al */
#include <linux/compiler.h> /* for "__user" et al */
+#include <linux/hdlc/ioctl.h> /* for IFNAMSIZ */

-#if __UAPI_DEF_IF_IFNAMSIZ
-#define IFNAMSIZ 16
-#endif /* __UAPI_DEF_IF_IFNAMSIZ */
#define IFALIASZ 256
-#include <linux/hdlc/ioctl.h>

/* For glibc compatibility. An empty enum does not compile. */
#if __UAPI_DEF_IF_NET_DEVICE_FLAGS_LOWER_UP_DORMANT_ECHO != 0 && \
--
2.8.1