1From 7cdafc0dee8054f82777ed3bf6d4c8b5582d09ad Mon Sep 17 00:00:00 2001
2From: Dengke Du <dengke.du@windriver.com>
3Date: Tue, 18 Oct 2016 07:56:02 +0000
4Subject: [PATCH] fix compile error with linux kernel v4.8
5
6In src/maint/zntune.c, the glibc time.h is included before linux
7time.h, so when compile the zntune.c, it break down by errors:
8
9	redefinition of 'struct timespec' 'struct timeval'
10	                'struct timezone' 'struct itimerval'
11
12We should exclude the linux time.h by disable linux/atm_zatm.h and
13move some useful definition in linux/atm_zatm.h to zntune.c to resolve
14it.
15
16Upstream-status: Pending
17
18Signed-off-by: Dengke Du <dengke.du@windriver.com>
19---
20 src/include/atm_zatm.h | 26 ++++++++++++++++++++++++++
21 src/maint/zntune.c     |  3 +--
22 2 files changed, 27 insertions(+), 2 deletions(-)
23 create mode 100644 src/include/atm_zatm.h
24
25diff --git a/src/include/atm_zatm.h b/src/include/atm_zatm.h
26new file mode 100644
27index 0000000..7d64f4d
28--- /dev/null
29+++ b/src/include/atm_zatm.h
30@@ -0,0 +1,26 @@
31+#include <linux/atmapi.h>
32+#include <linux/atmioc.h>
33+
34+#define ZATM_GETPOOL    _IOW('a',ATMIOC_SARPRV+1,struct atmif_sioc)
35+                                                /* get pool statistics */
36+#define ZATM_GETPOOLZ   _IOW('a',ATMIOC_SARPRV+2,struct atmif_sioc)
37+                                                /* get statistics and zero */
38+#define ZATM_SETPOOL    _IOW('a',ATMIOC_SARPRV+3,struct atmif_sioc)
39+
40+struct zatm_pool_info {
41+        int ref_count;                  /* free buffer pool usage counters */
42+        int low_water,high_water;       /* refill parameters */
43+        int rqa_count,rqu_count;        /* queue condition counters */
44+        int offset,next_off;            /* alignment optimizations: offset */
45+        int next_cnt,next_thres;        /* repetition counter and threshold */
46+};                                                /* set pool parameters */
47+
48+struct zatm_pool_req {
49+        int pool_num;                   /* pool number */
50+        struct zatm_pool_info info;     /* actual information */
51+};
52+
53+#define ZATM_OAM_POOL           0       /* free buffer pool for OAM cells */
54+#define ZATM_AAL0_POOL          1       /* free buffer pool for AAL0 cells */
55+#define ZATM_AAL5_POOL_BASE     2       /* first AAL5 free buffer pool */
56+#define ZATM_LAST_POOL  ZATM_AAL5_POOL_BASE+10 /* max. 64 kB */
57diff --git a/src/maint/zntune.c b/src/maint/zntune.c
58index 62d62ab..bb93eab 100644
59--- a/src/maint/zntune.c
60+++ b/src/maint/zntune.c
61@@ -13,9 +13,8 @@
62 #include <sys/socket.h>
63 #include <sys/ioctl.h>
64 #include <atm.h>
65+#include <atm_zatm.h>
66 #include <sys/time.h> /* for struct timeval, although it's not used */
67-#include <linux/atm_zatm.h>
68-
69
70 static void usage(const char *name)
71 {
72--
732.9.0
74
75