aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2007-11-20 01:46:51 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:54:34 -0500
commit52427c9d11477d5a2633d81050f52523decf9eff (patch)
treee4107505fb7f7041344e0ec77a9ac714383f9b4a
parent02d45827fa211093202f96bdd58020cc8687929f (diff)
[TUN]: Use iov_length()
Use iov_length() instead of tun's homemade iov_total(). Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/tun.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index f8b8c71187a0..5db4df460049 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -292,17 +292,6 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv,
292 return count; 292 return count;
293} 293}
294 294
295static inline size_t iov_total(const struct iovec *iv, unsigned long count)
296{
297 unsigned long i;
298 size_t len;
299
300 for (i = 0, len = 0; i < count; i++)
301 len += iv[i].iov_len;
302
303 return len;
304}
305
306static ssize_t tun_chr_aio_write(struct kiocb *iocb, const struct iovec *iv, 295static ssize_t tun_chr_aio_write(struct kiocb *iocb, const struct iovec *iv,
307 unsigned long count, loff_t pos) 296 unsigned long count, loff_t pos)
308{ 297{
@@ -313,7 +302,7 @@ static ssize_t tun_chr_aio_write(struct kiocb *iocb, const struct iovec *iv,
313 302
314 DBG(KERN_INFO "%s: tun_chr_write %ld\n", tun->dev->name, count); 303 DBG(KERN_INFO "%s: tun_chr_write %ld\n", tun->dev->name, count);
315 304
316 return tun_get_user(tun, (struct iovec *) iv, iov_total(iv, count)); 305 return tun_get_user(tun, (struct iovec *) iv, iov_length(iv, count));
317} 306}
318 307
319/* Put packet to the user space buffer */ 308/* Put packet to the user space buffer */
@@ -364,7 +353,7 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv,
364 353
365 DBG(KERN_INFO "%s: tun_chr_read\n", tun->dev->name); 354 DBG(KERN_INFO "%s: tun_chr_read\n", tun->dev->name);
366 355
367 len = iov_total(iv, count); 356 len = iov_length(iv, count);
368 if (len < 0) 357 if (len < 0)
369 return -EINVAL; 358 return -EINVAL;
370 359