diff options
author | Badari Pulavarty <pbadari@us.ibm.com> | 2006-10-01 02:28:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-01 03:39:28 -0400 |
commit | ee0b3e671baff681d69fbf0db33b47603c0a8280 (patch) | |
tree | 3202ff815b2196c6c353bc5b28d7a2800df273ec /drivers/net | |
parent | 027445c37282bc1ed26add45e573ad2d3e4860a5 (diff) |
[PATCH] Remove readv/writev methods and use aio_read/aio_write instead
This patch removes readv() and writev() methods and replaces them with
aio_read()/aio_write() methods.
Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/tun.c | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index de8da6dee1b0..bc0face01d25 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -288,11 +288,10 @@ static inline size_t iov_total(const struct iovec *iv, unsigned long count) | |||
288 | return len; | 288 | return len; |
289 | } | 289 | } |
290 | 290 | ||
291 | /* Writev */ | 291 | static ssize_t tun_chr_aio_write(struct kiocb *iocb, const struct iovec *iv, |
292 | static ssize_t tun_chr_writev(struct file * file, const struct iovec *iv, | 292 | unsigned long count, loff_t pos) |
293 | unsigned long count, loff_t *pos) | ||
294 | { | 293 | { |
295 | struct tun_struct *tun = file->private_data; | 294 | struct tun_struct *tun = iocb->ki_filp->private_data; |
296 | 295 | ||
297 | if (!tun) | 296 | if (!tun) |
298 | return -EBADFD; | 297 | return -EBADFD; |
@@ -302,14 +301,6 @@ static ssize_t tun_chr_writev(struct file * file, const struct iovec *iv, | |||
302 | return tun_get_user(tun, (struct iovec *) iv, iov_total(iv, count)); | 301 | return tun_get_user(tun, (struct iovec *) iv, iov_total(iv, count)); |
303 | } | 302 | } |
304 | 303 | ||
305 | /* Write */ | ||
306 | static ssize_t tun_chr_write(struct file * file, const char __user * buf, | ||
307 | size_t count, loff_t *pos) | ||
308 | { | ||
309 | struct iovec iv = { (void __user *) buf, count }; | ||
310 | return tun_chr_writev(file, &iv, 1, pos); | ||
311 | } | ||
312 | |||
313 | /* Put packet to the user space buffer */ | 304 | /* Put packet to the user space buffer */ |
314 | static __inline__ ssize_t tun_put_user(struct tun_struct *tun, | 305 | static __inline__ ssize_t tun_put_user(struct tun_struct *tun, |
315 | struct sk_buff *skb, | 306 | struct sk_buff *skb, |
@@ -343,10 +334,10 @@ static __inline__ ssize_t tun_put_user(struct tun_struct *tun, | |||
343 | return total; | 334 | return total; |
344 | } | 335 | } |
345 | 336 | ||
346 | /* Readv */ | 337 | static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv, |
347 | static ssize_t tun_chr_readv(struct file *file, const struct iovec *iv, | 338 | unsigned long count, loff_t pos) |
348 | unsigned long count, loff_t *pos) | ||
349 | { | 339 | { |
340 | struct file *file = iocb->ki_filp; | ||
350 | struct tun_struct *tun = file->private_data; | 341 | struct tun_struct *tun = file->private_data; |
351 | DECLARE_WAITQUEUE(wait, current); | 342 | DECLARE_WAITQUEUE(wait, current); |
352 | struct sk_buff *skb; | 343 | struct sk_buff *skb; |
@@ -426,14 +417,6 @@ static ssize_t tun_chr_readv(struct file *file, const struct iovec *iv, | |||
426 | return ret; | 417 | return ret; |
427 | } | 418 | } |
428 | 419 | ||
429 | /* Read */ | ||
430 | static ssize_t tun_chr_read(struct file * file, char __user * buf, | ||
431 | size_t count, loff_t *pos) | ||
432 | { | ||
433 | struct iovec iv = { buf, count }; | ||
434 | return tun_chr_readv(file, &iv, 1, pos); | ||
435 | } | ||
436 | |||
437 | static void tun_setup(struct net_device *dev) | 420 | static void tun_setup(struct net_device *dev) |
438 | { | 421 | { |
439 | struct tun_struct *tun = netdev_priv(dev); | 422 | struct tun_struct *tun = netdev_priv(dev); |
@@ -764,10 +747,10 @@ static int tun_chr_close(struct inode *inode, struct file *file) | |||
764 | static struct file_operations tun_fops = { | 747 | static struct file_operations tun_fops = { |
765 | .owner = THIS_MODULE, | 748 | .owner = THIS_MODULE, |
766 | .llseek = no_llseek, | 749 | .llseek = no_llseek, |
767 | .read = tun_chr_read, | 750 | .read = do_sync_read, |
768 | .readv = tun_chr_readv, | 751 | .aio_read = tun_chr_aio_read, |
769 | .write = tun_chr_write, | 752 | .write = do_sync_write, |
770 | .writev = tun_chr_writev, | 753 | .aio_write = tun_chr_aio_write, |
771 | .poll = tun_chr_poll, | 754 | .poll = tun_chr_poll, |
772 | .ioctl = tun_chr_ioctl, | 755 | .ioctl = tun_chr_ioctl, |
773 | .open = tun_chr_open, | 756 | .open = tun_chr_open, |