From: Akinobu Mita <akinobu.mita@gmail.com>
To: netdev@vger.kernel.org
Cc: vtun@office.satix.net, Maxim Krasnyansky <maxk@qualcomm.com>
Subject: [PATCH] tun: use iov_length()
Date: Sat, 17 Nov 2007 22:55:00 +0900 [thread overview]
Message-ID: <20071117135500.GA14691@APFDCB5C> (raw)
Use iov_length() instead of tun's homemade iov_total().
Cc: Maxim Krasnyansky <maxk@qualcomm.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
drivers/net/tun.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
Index: 2.6-mm/drivers/net/tun.c
===================================================================
--- 2.6-mm.orig/drivers/net/tun.c
+++ 2.6-mm/drivers/net/tun.c
@@ -292,17 +292,6 @@ static __inline__ ssize_t tun_get_user(s
return count;
}
-static inline size_t iov_total(const struct iovec *iv, unsigned long count)
-{
- unsigned long i;
- size_t len;
-
- for (i = 0, len = 0; i < count; i++)
- len += iv[i].iov_len;
-
- return len;
-}
-
static ssize_t tun_chr_aio_write(struct kiocb *iocb, const struct iovec *iv,
unsigned long count, loff_t pos)
{
@@ -313,7 +302,7 @@ static ssize_t tun_chr_aio_write(struct
DBG(KERN_INFO "%s: tun_chr_write %ld\n", tun->dev->name, count);
- return tun_get_user(tun, (struct iovec *) iv, iov_total(iv, count));
+ return tun_get_user(tun, (struct iovec *) iv, iov_length(iv, count));
}
/* Put packet to the user space buffer */
@@ -364,7 +353,7 @@ static ssize_t tun_chr_aio_read(struct k
DBG(KERN_INFO "%s: tun_chr_read\n", tun->dev->name);
- len = iov_total(iv, count);
+ len = iov_length(iv, count);
if (len < 0)
return -EINVAL;
next reply other threads:[~2007-11-17 14:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-17 13:55 Akinobu Mita [this message]
2007-11-20 6:47 ` [PATCH] tun: use iov_length() David Miller
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=20071117135500.GA14691@APFDCB5C \
--to=akinobu.mita@gmail.com \
--cc=maxk@qualcomm.com \
--cc=netdev@vger.kernel.org \
--cc=vtun@office.satix.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;
as well as URLs for NNTP newsgroup(s).