X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fnfs%2Ffile.c;h=1ea93c580a03f8362a72462d642ecf376f5810f3;hb=746550cff061581f89c687ada8523670768364f2;hp=df23d4de5b898b2a42fdf24a45d8491609db2876;hpb=86090fcac5e27b630656fe3d963a6b80e26dac44;p=linux-2.6.git diff --git a/fs/nfs/file.c b/fs/nfs/file.c index df23d4de5..1ea93c580 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c @@ -38,9 +38,9 @@ static long nfs_file_fcntl(int fd, unsigned int cmd, static int nfs_file_open(struct inode *, struct file *); static int nfs_file_release(struct inode *, struct file *); static int nfs_file_mmap(struct file *, struct vm_area_struct *); -static ssize_t nfs_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void *); -static ssize_t nfs_file_read(struct kiocb *, char *, size_t, loff_t); -static ssize_t nfs_file_write(struct kiocb *, const char *, size_t, loff_t); +static ssize_t nfs_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void __user *); +static ssize_t nfs_file_read(struct kiocb *, char __user *, size_t, loff_t); +static ssize_t nfs_file_write(struct kiocb *, const char __user *, size_t, loff_t); static int nfs_file_flush(struct file *); static int nfs_fsync(struct file *, struct dentry *dentry, int datasync); @@ -148,12 +148,17 @@ nfs_file_flush(struct file *file) } static ssize_t -nfs_file_read(struct kiocb *iocb, char * buf, size_t count, loff_t pos) +nfs_file_read(struct kiocb *iocb, char __user * buf, size_t count, loff_t pos) { struct dentry * dentry = iocb->ki_filp->f_dentry; struct inode * inode = dentry->d_inode; ssize_t result; +#ifdef CONFIG_NFS_DIRECTIO + if (iocb->ki_filp->f_flags & O_DIRECT) + return nfs_file_direct_read(iocb, buf, count, pos); +#endif + dfprintk(VFS, "nfs: read(%s/%s, %lu@%lu)\n", dentry->d_parent->d_name.name, dentry->d_name.name, (unsigned long) count, (unsigned long) pos); @@ -166,7 +171,7 @@ nfs_file_read(struct kiocb *iocb, char * buf, size_t count, loff_t pos) static ssize_t nfs_file_sendfile(struct file *filp, loff_t *ppos, size_t count, - read_actor_t actor, void *target) + read_actor_t actor, void __user *target) { struct dentry *dentry = filp->f_dentry; struct inode *inode = dentry->d_inode; @@ -262,12 +267,17 @@ struct address_space_operations nfs_file_aops = { * Write to a file (through the page cache). */ static ssize_t -nfs_file_write(struct kiocb *iocb, const char *buf, size_t count, loff_t pos) +nfs_file_write(struct kiocb *iocb, const char __user *buf, size_t count, loff_t pos) { struct dentry * dentry = iocb->ki_filp->f_dentry; struct inode * inode = dentry->d_inode; ssize_t result; +#ifdef CONFIG_NFS_DIRECTIO + if (iocb->ki_filp->f_flags & O_DIRECT) + return nfs_file_direct_write(iocb, buf, count, pos); +#endif + dfprintk(VFS, "nfs: write(%s/%s(%ld), %lu@%lu)\n", dentry->d_parent->d_name.name, dentry->d_name.name, inode->i_ino, (unsigned long) count, (unsigned long) pos);