diff options
Diffstat (limited to 'fs/ncpfs/file.c')
| -rw-r--r-- | fs/ncpfs/file.c | 43 | 
1 files changed, 20 insertions, 23 deletions
diff --git a/fs/ncpfs/file.c b/fs/ncpfs/file.c index 6c754f70c52..77640a8bfb8 100644 --- a/fs/ncpfs/file.c +++ b/fs/ncpfs/file.c @@ -6,8 +6,9 @@   *   */ +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt +  #include <asm/uaccess.h> -#include <asm/system.h>  #include <linux/time.h>  #include <linux/kernel.h> @@ -17,14 +18,12 @@  #include <linux/mm.h>  #include <linux/vmalloc.h>  #include <linux/sched.h> -#include <linux/smp_lock.h> -#include <linux/ncp_fs.h> -#include "ncplib_kernel.h" +#include "ncp_fs.h" -static int ncp_fsync(struct file *file, int datasync) +static int ncp_fsync(struct file *file, loff_t start, loff_t end, int datasync)  { -	return 0; +	return filemap_write_and_wait_range(file->f_mapping, start, end);  }  /* @@ -37,11 +36,11 @@ int ncp_make_open(struct inode *inode, int right)  	error = -EINVAL;  	if (!inode) { -		printk(KERN_ERR "ncp_make_open: got NULL inode\n"); +		pr_err("%s: got NULL inode\n", __func__);  		goto out;  	} -	DPRINTK("ncp_make_open: opened=%d, volume # %u, dir entry # %u\n", +	ncp_dbg(1, "opened=%d, volume # %u, dir entry # %u\n",  		atomic_read(&NCP_FINFO(inode)->opened),   		NCP_FINFO(inode)->volNumber,   		NCP_FINFO(inode)->dirEntNum); @@ -74,7 +73,7 @@ int ncp_make_open(struct inode *inode, int right)  				break;  		}  		if (result) { -			PPRINTK("ncp_make_open: failed, result=%d\n", result); +			ncp_vdbg("failed, result=%d\n", result);  			goto out_unlock;  		}  		/* @@ -86,7 +85,7 @@ int ncp_make_open(struct inode *inode, int right)  	}  	access = NCP_FINFO(inode)->access; -	PPRINTK("ncp_make_open: file open, access=%x\n", access); +	ncp_vdbg("file open, access=%x\n", access);  	if (access == right || access == O_RDWR) {  		atomic_inc(&NCP_FINFO(inode)->opened);  		error = 0; @@ -110,8 +109,7 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)  	void* freepage;  	size_t freelen; -	DPRINTK("ncp_file_read: enter %s/%s\n", -		dentry->d_parent->d_name.name, dentry->d_name.name); +	ncp_dbg(1, "enter %pd2\n", dentry);  	pos = *ppos; @@ -128,7 +126,7 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)  	error = ncp_make_open(inode, O_RDONLY);  	if (error) { -		DPRINTK(KERN_ERR "ncp_file_read: open failed, error=%d\n", error); +		ncp_dbg(1, "open failed, error=%d\n", error);  		return error;  	} @@ -169,8 +167,7 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)  	file_accessed(file); -	DPRINTK("ncp_file_read: exit %s/%s\n", -		dentry->d_parent->d_name.name, dentry->d_name.name); +	ncp_dbg(1, "exit %pd2\n", dentry);  outrel:  	ncp_inode_close(inode);		  	return already_read ? already_read : error; @@ -187,8 +184,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *  	int errno;  	void* bouncebuffer; -	DPRINTK("ncp_file_write: enter %s/%s\n", -		dentry->d_parent->d_name.name, dentry->d_name.name); +	ncp_dbg(1, "enter %pd2\n", dentry);  	if ((ssize_t) count < 0)  		return -EINVAL;  	pos = *ppos; @@ -217,13 +213,17 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *  		return 0;  	errno = ncp_make_open(inode, O_WRONLY);  	if (errno) { -		DPRINTK(KERN_ERR "ncp_file_write: open failed, error=%d\n", errno); +		ncp_dbg(1, "open failed, error=%d\n", errno);  		return errno;  	}  	bufsize = NCP_SERVER(inode)->buffer_size;  	already_written = 0; +	errno = file_update_time(file); +	if (errno) +		goto outrel; +  	bouncebuffer = vmalloc(bufsize);  	if (!bouncebuffer) {  		errno = -EIO;	/* -ENOMEM */ @@ -255,8 +255,6 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *  	}  	vfree(bouncebuffer); -	file_update_time(file); -  	*ppos = pos;  	if (pos > i_size_read(inode)) { @@ -265,8 +263,7 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t *  			i_size_write(inode, pos);  		mutex_unlock(&inode->i_mutex);  	} -	DPRINTK("ncp_file_write: exit %s/%s\n", -		dentry->d_parent->d_name.name, dentry->d_name.name); +	ncp_dbg(1, "exit %pd2\n", dentry);  outrel:  	ncp_inode_close(inode);		  	return already_written ? already_written : errno; @@ -274,7 +271,7 @@ outrel:  static int ncp_release(struct inode *inode, struct file *file) {  	if (ncp_make_closed(inode)) { -		DPRINTK("ncp_release: failed to close\n"); +		ncp_dbg(1, "failed to close\n");  	}  	return 0;  }  | 
