Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ee0b3e67 authored by Badari Pulavarty's avatar Badari Pulavarty Committed by Linus Torvalds
Browse files

[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: default avatarBadari Pulavarty <pbadari@us.ibm.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 027445c3
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -257,8 +257,6 @@ static const struct file_operations raw_fops = {
	.open	=	raw_open,
	.release=	raw_release,
	.ioctl	=	raw_ioctl,
	.readv	= 	generic_file_readv,
	.writev	= 	generic_file_writev,
	.owner	=	THIS_MODULE,
};

+10 −27
Original line number Diff line number Diff line
@@ -288,11 +288,10 @@ static inline size_t iov_total(const struct iovec *iv, unsigned long count)
	return len;
}

/* Writev */
static ssize_t tun_chr_writev(struct file * file, const struct iovec *iv,
			      unsigned long count, loff_t *pos)
static ssize_t tun_chr_aio_write(struct kiocb *iocb, const struct iovec *iv,
			      unsigned long count, loff_t pos)
{
	struct tun_struct *tun = file->private_data;
	struct tun_struct *tun = iocb->ki_filp->private_data;

	if (!tun)
		return -EBADFD;
@@ -302,14 +301,6 @@ static ssize_t tun_chr_writev(struct file * file, const struct iovec *iv,
	return tun_get_user(tun, (struct iovec *) iv, iov_total(iv, count));
}

/* Write */
static ssize_t tun_chr_write(struct file * file, const char __user * buf,
			     size_t count, loff_t *pos)
{
	struct iovec iv = { (void __user *) buf, count };
	return tun_chr_writev(file, &iv, 1, pos);
}

/* Put packet to the user space buffer */
static __inline__ ssize_t tun_put_user(struct tun_struct *tun,
				       struct sk_buff *skb,
@@ -343,10 +334,10 @@ static __inline__ ssize_t tun_put_user(struct tun_struct *tun,
	return total;
}

/* Readv */
static ssize_t tun_chr_readv(struct file *file, const struct iovec *iv,
			    unsigned long count, loff_t *pos)
static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv,
			    unsigned long count, loff_t pos)
{
	struct file *file = iocb->ki_filp;
	struct tun_struct *tun = file->private_data;
	DECLARE_WAITQUEUE(wait, current);
	struct sk_buff *skb;
@@ -426,14 +417,6 @@ static ssize_t tun_chr_readv(struct file *file, const struct iovec *iv,
	return ret;
}

/* Read */
static ssize_t tun_chr_read(struct file * file, char __user * buf,
			    size_t count, loff_t *pos)
{
	struct iovec iv = { buf, count };
	return tun_chr_readv(file, &iv, 1, pos);
}

static void tun_setup(struct net_device *dev)
{
	struct tun_struct *tun = netdev_priv(dev);
@@ -764,10 +747,10 @@ static int tun_chr_close(struct inode *inode, struct file *file)
static struct file_operations tun_fops = {
	.owner	= THIS_MODULE,
	.llseek = no_llseek,
	.read	= tun_chr_read,
	.readv	= tun_chr_readv,
	.write	= tun_chr_write,
	.writev = tun_chr_writev,
	.read  = do_sync_read,
	.aio_read  = tun_chr_aio_read,
	.write = do_sync_write,
	.aio_write = tun_chr_aio_write,
	.poll	= tun_chr_poll,
	.ioctl	= tun_chr_ioctl,
	.open	= tun_chr_open,
+0 −2
Original line number Diff line number Diff line
@@ -40,8 +40,6 @@ static const struct file_operations bad_file_ops =
	.aio_fsync	= EIO_ERROR,
	.fasync		= EIO_ERROR,
	.lock		= EIO_ERROR,
	.readv		= EIO_ERROR,
	.writev		= EIO_ERROR,
	.sendfile	= EIO_ERROR,
	.sendpage	= EIO_ERROR,
	.get_unmapped_area = EIO_ERROR,
+0 −2
Original line number Diff line number Diff line
@@ -1191,8 +1191,6 @@ const struct file_operations def_blk_fops = {
#ifdef CONFIG_COMPAT
	.compat_ioctl	= compat_blkdev_ioctl,
#endif
	.readv		= generic_file_readv,
	.writev		= generic_file_write_nolock,
	.sendfile	= generic_file_sendfile,
	.splice_read	= generic_file_splice_read,
	.splice_write	= generic_file_splice_write,
+0 −16
Original line number Diff line number Diff line
@@ -480,18 +480,6 @@ cifs_get_sb(struct file_system_type *fs_type,
	return simple_set_mnt(mnt, sb);
}

static ssize_t cifs_file_writev(struct file *file, const struct iovec *iov,
				unsigned long nr_segs, loff_t *ppos)
{
	struct inode *inode = file->f_dentry->d_inode;
	ssize_t written;

	written = generic_file_writev(file, iov, nr_segs, ppos);
	if (!CIFS_I(inode)->clientCanCacheAll)
		filemap_fdatawrite(inode->i_mapping);
	return written;
}

static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
				   unsigned long nr_segs, loff_t pos)
{
@@ -577,8 +565,6 @@ struct inode_operations cifs_symlink_inode_ops = {
const struct file_operations cifs_file_ops = {
	.read = do_sync_read,
	.write = do_sync_write,
	.readv = generic_file_readv,
	.writev = cifs_file_writev,
	.aio_read = generic_file_aio_read,
	.aio_write = cifs_file_aio_write,
	.open = cifs_open,
@@ -620,8 +606,6 @@ const struct file_operations cifs_file_direct_ops = {
const struct file_operations cifs_file_nobrl_ops = {
	.read = do_sync_read,
	.write = do_sync_write,
	.readv = generic_file_readv,
	.writev = cifs_file_writev,
	.aio_read = generic_file_aio_read,
	.aio_write = cifs_file_aio_write,
	.open = cifs_open,
Loading