X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fncpfs%2Ffile.c;h=e6b7c67cf057765f86921cf2220fee385eaaee38;hb=43bc926fffd92024b46cafaf7350d669ba9ca884;hp=c1745b6f1a3efb3ba53fb28c9900b5dd05804843;hpb=9213980e6a70d8473e0ffd4b39ab5b6caaba9ff5;p=linux-2.6.git diff --git a/fs/ncpfs/file.c b/fs/ncpfs/file.c index c1745b6f1..e6b7c67cf 100644 --- a/fs/ncpfs/file.c +++ b/fs/ncpfs/file.c @@ -46,7 +46,7 @@ int ncp_make_open(struct inode *inode, int right) NCP_FINFO(inode)->volNumber, NCP_FINFO(inode)->dirEntNum); error = -EACCES; - down(&NCP_FINFO(inode)->open_sem); + mutex_lock(&NCP_FINFO(inode)->open_mutex); if (!atomic_read(&NCP_FINFO(inode)->opened)) { struct ncp_entry_info finfo; int result; @@ -93,7 +93,7 @@ int ncp_make_open(struct inode *inode, int right) } out_unlock: - up(&NCP_FINFO(inode)->open_sem); + mutex_unlock(&NCP_FINFO(inode)->open_mutex); out: return error; } @@ -115,11 +115,6 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) if (!ncp_conn_valid(NCP_SERVER(inode))) return -EIO; - if (!S_ISREG(inode->i_mode)) { - DPRINTK("ncp_file_read: read from non-file, mode %07o\n", - inode->i_mode); - return -EINVAL; - } pos = *ppos; @@ -175,10 +170,8 @@ ncp_file_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) *ppos = pos; - if (!IS_RDONLY(inode)) { - inode->i_atime = CURRENT_TIME; - } - + file_accessed(file); + DPRINTK("ncp_file_read: exit %s/%s\n", dentry->d_parent->d_name.name, dentry->d_name.name); outrel: @@ -201,11 +194,6 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t * dentry->d_parent->d_name.name, dentry->d_name.name); if (!ncp_conn_valid(NCP_SERVER(inode))) return -EIO; - if (!S_ISREG(inode->i_mode)) { - DPRINTK("ncp_file_write: write to non-file, mode %07o\n", - inode->i_mode); - return -EINVAL; - } if ((ssize_t) count < 0) return -EINVAL; pos = *ppos; @@ -273,8 +261,9 @@ ncp_file_write(struct file *file, const char __user *buf, size_t count, loff_t * } } vfree(bouncebuffer); - inode->i_mtime = inode->i_atime = CURRENT_TIME; - + + file_update_time(file); + *ppos = pos; if (pos > inode->i_size) { @@ -294,7 +283,7 @@ static int ncp_release(struct inode *inode, struct file *file) { return 0; } -struct file_operations ncp_file_operations = +const struct file_operations ncp_file_operations = { .llseek = remote_llseek, .read = ncp_file_read,