Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 198169
b: refs/heads/master
c: 93d84b6
h: refs/heads/master
i:
  198167: 2551d41
v: v3
  • Loading branch information
John Kacur authored and Frederic Weisbecker committed May 17, 2010
1 parent a5c4e1a commit 05cd1f3
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1977bb2ed8ffdd161fe1c9eef1f9fd283e41d4b5
refs/heads/master: 93d84b6d99f5ddb911b318990c759a0fefa0f7ea
2 changes: 1 addition & 1 deletion trunk/fs/ncpfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const struct file_operations ncp_dir_operations =
{
.read = generic_read_dir,
.readdir = ncp_readdir,
.ioctl = ncp_ioctl,
.unlocked_ioctl = ncp_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = ncp_compat_ioctl,
#endif
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/ncpfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ const struct file_operations ncp_file_operations =
.llseek = ncp_remote_llseek,
.read = ncp_file_read,
.write = ncp_file_write,
.ioctl = ncp_ioctl,
.unlocked_ioctl = ncp_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = ncp_compat_ioctl,
#endif
Expand Down
27 changes: 16 additions & 11 deletions trunk/fs/ncpfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <linux/smp_lock.h>
#include <linux/vmalloc.h>
#include <linux/sched.h>
#include <linux/smp_lock.h>

#include <linux/ncp_fs.h>

Expand Down Expand Up @@ -261,9 +262,9 @@ ncp_get_charsets(struct ncp_server* server, struct ncp_nls_ioctl __user *arg)
}
#endif /* CONFIG_NCPFS_NLS */

static int __ncp_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
static long __ncp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
struct inode *inode = filp->f_dentry->d_inode;
struct ncp_server *server = NCP_SERVER(inode);
int result;
struct ncp_ioctl_request request;
Expand Down Expand Up @@ -841,36 +842,40 @@ static int ncp_ioctl_need_write(unsigned int cmd)
}
}

int ncp_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
long ncp_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
int ret;
long ret;

lock_kernel();
if (ncp_ioctl_need_write(cmd)) {
/*
* inside the ioctl(), any failures which
* are because of file_permission() are
* -EACCESS, so it seems consistent to keep
* that here.
*/
if (mnt_want_write(filp->f_path.mnt))
return -EACCES;
if (mnt_want_write(filp->f_path.mnt)) {
ret = -EACCES;
goto out;
}
}
ret = __ncp_ioctl(inode, filp, cmd, arg);
ret = __ncp_ioctl(filp, cmd, arg);
if (ncp_ioctl_need_write(cmd))
mnt_drop_write(filp->f_path.mnt);

out:
unlock_kernel();
return ret;
}

#ifdef CONFIG_COMPAT
long ncp_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
struct inode *inode = file->f_path.dentry->d_inode;
int ret;
long ret;

lock_kernel();
arg = (unsigned long) compat_ptr(arg);
ret = ncp_ioctl(inode, file, cmd, arg);
ret = ncp_ioctl(file, cmd, arg);
unlock_kernel();
return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/ncp_fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ int ncp_date_dos2unix(__le16 time, __le16 date);
void ncp_date_unix2dos(int unix_date, __le16 * time, __le16 * date);

/* linux/fs/ncpfs/ioctl.c */
int ncp_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
long ncp_ioctl(struct file *, unsigned int, unsigned long);
long ncp_compat_ioctl(struct file *, unsigned int, unsigned long);

/* linux/fs/ncpfs/sock.c */
Expand Down

0 comments on commit 05cd1f3

Please sign in to comment.