Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Mason <slash.tmp@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] package/linux-fusion: 'struct msghdr' has no member named 'msg_iov'
Date: Tue, 5 Jan 2016 15:33:09 +0100	[thread overview]
Message-ID: <568BD425.4070502@free.fr> (raw)
In-Reply-To: <568BBD3F.2030607@free.fr>

On 05/01/2016 13:55, Mason wrote:

> The linux-fusion package fails to build with recent kernels.

Using LWN's article as a reference, I came up with the following patch.
Al, could you take a look, and see whether it looks correct?

The iov_iter interface
https://lwn.net/Articles/625077/


diff --git a/one/one_udp.c b/one/one_udp.c
index 26b9e6a1f729..5d8bd605fa68 100644
--- a/one/one_udp.c
+++ b/one/one_udp.c
@@ -161,7 +161,7 @@ ksocket_send_iov( struct socket      *sock,
                   const struct iovec *iov,
                   size_t              iov_count )
 {
-     struct msghdr msg;
+     struct msghdr msg = { addr, sizeof *addr };
      mm_segment_t oldfs;
      int size = 0;
      size_t len = 0;
@@ -178,18 +178,20 @@ ksocket_send_iov( struct socket      *sock,
      for (i=0; i<iov_count; i++)
           len += iov[i].iov_len;
 
-     msg.msg_flags = 0;
-     msg.msg_name = addr;
-     msg.msg_namelen  = sizeof(struct sockaddr_in);
-     msg.msg_control = NULL;
-     msg.msg_controllen = 0;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
      msg.msg_iov = (struct iovec*) iov;
      msg.msg_iovlen = iov_count;
-     msg.msg_control = NULL;
+#else
+     iov_iter_init(&msg.msg_iter, WRITE, iov, iov_count, len);
+#endif
 
      oldfs = get_fs();
      set_fs(KERNEL_DS);
-     size = sock_sendmsg(sock,&msg,len);
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
+     size = sock_sendmsg(sock, &msg, len);
+#else
+     size = sock_sendmsg(sock, &msg);
+#endif
      set_fs(oldfs);
 
      return size;
@@ -198,7 +200,7 @@ ksocket_send_iov( struct socket      *sock,
 static int
 ksocket_receive(struct socket* sock, struct sockaddr_in* addr, void *buf, int len)
 {
-     struct msghdr msg;
+     struct msghdr msg = { addr, sizeof *addr };
      struct iovec iov;
      mm_segment_t oldfs;
      int size = 0;
@@ -213,14 +215,12 @@ ksocket_receive(struct socket* sock, struct sockaddr_in* addr, void *buf, int le
      iov.iov_base = buf;
      iov.iov_len = len;
 
-     msg.msg_flags = 0;
-     msg.msg_name = addr;
-     msg.msg_namelen  = sizeof(struct sockaddr_in);
-     msg.msg_control = NULL;
-     msg.msg_controllen = 0;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
      msg.msg_iov = &iov;
      msg.msg_iovlen = 1;
-     msg.msg_control = NULL;
+#else
+     iov_iter_init(&msg.msg_iter, READ, &iov, 1, len);
+#endif
 
      oldfs = get_fs();
      set_fs(KERNEL_DS);

  reply	other threads:[~2016-01-05 14:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-05 12:55 [Buildroot] package/linux-fusion: 'struct msghdr' has no member named 'msg_iov' Mason
2016-01-05 14:33 ` Mason [this message]
2016-01-06 13:09 ` Mason
2016-01-06 16:35 ` Mason
2016-01-12 15:10 ` Mason

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=568BD425.4070502@free.fr \
    --to=slash.tmp@free.fr \
    --cc=buildroot@busybox.net \
    /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