Skip to contentSkip to conversation

macvtap: update file current position

PATCH In review Zhi Yong Wu 2 participants 4 messages Dec 4, 2013 – Dec 6, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 macvtap: update file current position

From: Zhi Yong Wu <[email protected]>

---
 drivers/net/macvtap.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/macvtap.c +2 -0
index 9093004..957cc5c 100644
@@ -876,6 +876,8 @@ static ssize_t macvtap_aio_read(struct kiocb *iocb, const struct iovec *iv,
 
 	ret = macvtap_do_read(q, iocb, iv, len, file->f_flags & O_NONBLOCK);
 	ret = min_t(ssize_t, ret, len); /* XXX copied from tun.c. Why? */
+	if (ret > 0)
+		iocb->ki_pos = ret;
 out:
 	return ret;
 }
Signature · 1 line
1.7.6.5
#1 lore raw

PATCH 2/2 macvtap: remove unused paramter in macvtap_do_read()

From: Zhi Yong Wu <[email protected]>

---
 drivers/net/macvtap.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/macvtap.c +3 -3
index 957cc5c..c0d412e 100644
@@ -823,7 +823,7 @@ done:
 	return ret ? ret : copied;
 }
 
-static ssize_t macvtap_do_read(struct macvtap_queue *q, struct kiocb *iocb,
+static ssize_t macvtap_do_read(struct macvtap_queue *q,
 			       const struct iovec *iv, unsigned long len,
 			       int noblock)
 {
@@ -874,7 +874,7 @@ static ssize_t macvtap_aio_read(struct kiocb *iocb, const struct iovec *iv,
 		goto out;
 	}
 
-	ret = macvtap_do_read(q, iocb, iv, len, file->f_flags & O_NONBLOCK);
+	ret = macvtap_do_read(q, iv, len, file->f_flags & O_NONBLOCK);
 	ret = min_t(ssize_t, ret, len); /* XXX copied from tun.c. Why? */
 	if (ret > 0)
 		iocb->ki_pos = ret;
@@ -1108,7 +1108,7 @@ static int macvtap_recvmsg(struct kiocb *iocb, struct socket *sock,
 	int ret;
 	if (flags & ~(MSG_DONTWAIT|MSG_TRUNC))
 		return -EINVAL;
-	ret = macvtap_do_read(q, iocb, m->msg_iov, total_len,
+	ret = macvtap_do_read(q, m->msg_iov, total_len,
 			  flags & MSG_DONTWAIT);
 	if (ret > total_len) {
 		m->msg_flags |= MSG_TRUNC;
Signature · 1 line
1.7.6.5
#3 lore raw
Quoted 9 lines · David Miller

From: Zhi Yong Wu <[email protected]>
Date: Wed, 4 Dec 2013 17:29:00 +0800

Quoted 3 lines

From: Zhi Yong Wu <[email protected]>

The tun driver seems to have the same exact bug, please if you are going to fix one then fix the other too.

will post v2 with tun bugfix.

Quoted 2 lines

Thanks.

Signature · 3 lines
Regards,

Zhi Yong Wu