python-dataproperty: bump version to 0.17.0
[buildroot-gz.git] / package / linux-fusion / 0004-Port-one-one_udp.c-to-Linux-4.1.patch
blobe1bff64f3b9cb1e702953b3d0e48475cfb7e353f
1 From be288b60278c78eccfd347aacf4d3dd8771215a9 Mon Sep 17 00:00:00 2001
2 From: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
3 Date: Tue, 12 Jan 2016 14:01:42 +0100
4 Subject: [PATCH] Port one/one_udp.c to Linux 4.1
6 Kernel commit c0371da6047a replaced msg_iov and msg_iovlen with msg_iter
7 in struct msghdr since 3.19
9 one/one_udp.c: In function 'ksocket_send_iov':
10 one/one_udp.c:186:9: error: 'struct msghdr' has no member named 'msg_iov'
11 one/one_udp.c:187:9: error: 'struct msghdr' has no member named 'msg_iovlen'
13 one/one_udp.c: In function 'ksocket_receive':
14 one/one_udp.c:221:9: error: 'struct msghdr' has no member named 'msg_iov'
15 one/one_udp.c:222:9: error: 'struct msghdr' has no member named 'msg_iovlen'
17 The iov_iter interface
18 https://lwn.net/Articles/625077/
20 Kernel commit d8725c86aeba dropped the len parameter in sock_sendmsg
21 since 4.1
23 one/one_udp.c: In function 'ksocket_send_iov':
24 one/one_udp.c:192:13: error: too many arguments to function 'sock_sendmsg'
26 Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
27 ---
28 one/one_udp.c | 30 +++++++++++++++---------------
29 1 file changed, 15 insertions(+), 15 deletions(-)
31 diff --git a/one/one_udp.c b/one/one_udp.c
32 index 26b9e6a1f729..b1daae164cdf 100644
33 --- a/one/one_udp.c
34 +++ b/one/one_udp.c
35 @@ -161,7 +161,7 @@ ksocket_send_iov( struct socket *sock,
36 const struct iovec *iov,
37 size_t iov_count )
39 - struct msghdr msg;
40 + struct msghdr msg = { addr, sizeof *addr };
41 mm_segment_t oldfs;
42 int size = 0;
43 size_t len = 0;
44 @@ -178,18 +178,20 @@ ksocket_send_iov( struct socket *sock,
45 for (i=0; i<iov_count; i++)
46 len += iov[i].iov_len;
48 - msg.msg_flags = 0;
49 - msg.msg_name = addr;
50 - msg.msg_namelen = sizeof(struct sockaddr_in);
51 - msg.msg_control = NULL;
52 - msg.msg_controllen = 0;
53 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) // commit c0371da6047a
54 msg.msg_iov = (struct iovec*) iov;
55 msg.msg_iovlen = iov_count;
56 - msg.msg_control = NULL;
57 +#else
58 + iov_iter_init(&msg.msg_iter, WRITE, iov, iov_count, len);
59 +#endif
61 oldfs = get_fs();
62 set_fs(KERNEL_DS);
63 - size = sock_sendmsg(sock,&msg,len);
64 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) // commit d8725c86aeba
65 + size = sock_sendmsg(sock, &msg, len);
66 +#else
67 + size = sock_sendmsg(sock, &msg);
68 +#endif
69 set_fs(oldfs);
71 return size;
72 @@ -198,7 +200,7 @@ ksocket_send_iov( struct socket *sock,
73 static int
74 ksocket_receive(struct socket* sock, struct sockaddr_in* addr, void *buf, int len)
76 - struct msghdr msg;
77 + struct msghdr msg = { addr, sizeof *addr };
78 struct iovec iov;
79 mm_segment_t oldfs;
80 int size = 0;
81 @@ -213,14 +215,12 @@ ksocket_receive(struct socket* sock, struct sockaddr_in* addr, void *buf, int le
82 iov.iov_base = buf;
83 iov.iov_len = len;
85 - msg.msg_flags = 0;
86 - msg.msg_name = addr;
87 - msg.msg_namelen = sizeof(struct sockaddr_in);
88 - msg.msg_control = NULL;
89 - msg.msg_controllen = 0;
90 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) // commit c0371da6047a
91 msg.msg_iov = &iov;
92 msg.msg_iovlen = 1;
93 - msg.msg_control = NULL;
94 +#else
95 + iov_iter_init(&msg.msg_iter, READ, &iov, 1, len);
96 +#endif
98 oldfs = get_fs();
99 set_fs(KERNEL_DS);