aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBadari Pulavarty <pbadari@us.ibm.com>2006-10-01 02:28:47 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-01 03:39:28 -0400
commitee0b3e671baff681d69fbf0db33b47603c0a8280 (patch)
tree3202ff815b2196c6c353bc5b28d7a2800df273ec /drivers
parent027445c37282bc1ed26add45e573ad2d3e4860a5 (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')
-rw-r--r--drivers/char/raw.c2
-rw-r--r--drivers/net/tun.c37
2 files changed, 10 insertions, 29 deletions
diff --git a/drivers/char/raw.c b/drivers/char/raw.c
index 173fb08555d5..490db531e2d8 100644
--- a/drivers/char/raw.c
+++ b/drivers/char/raw.c
@@ -257,8 +257,6 @@ static const struct file_operations raw_fops = {
257 .open = raw_open, 257 .open = raw_open,
258 .release= raw_release, 258 .release= raw_release,
259 .ioctl = raw_ioctl, 259 .ioctl = raw_ioctl,
260 .readv = generic_file_readv,
261 .writev = generic_file_writev,
262 .owner = THIS_MODULE, 260 .owner = THIS_MODULE,
263}; 261};
264 262
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 */ 291static ssize_t tun_chr_aio_write(struct kiocb *iocb, const struct iovec *iv,
292static 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 */
306static 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 */
314static __inline__ ssize_t tun_put_user(struct tun_struct *tun, 305static __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 */ 337static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv,
347static 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 */
430static 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
437static void tun_setup(struct net_device *dev) 420static 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)
764static struct file_operations tun_fops = { 747static 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,