Fix reported Samba bug.
[linux-2.6/linux-mips.git] / fs / smbfs / ioctl.c
blobdee105a5e834533839062a9bbee4a1b61e4bd7f7
1 /*
2 * ioctl.c
4 * Copyright (C) 1995, 1996 by Volker Lendecke
5 * Copyright (C) 1997 by Volker Lendecke
7 */
9 #include <linux/errno.h>
10 #include <linux/fs.h>
11 #include <linux/ioctl.h>
12 #include <linux/sched.h>
13 #include <linux/mm.h>
14 #include <linux/highuid.h>
16 #include <linux/smb_fs.h>
17 #include <linux/smb_mount.h>
19 #include <asm/uaccess.h>
21 int
22 smb_ioctl(struct inode *inode, struct file *filp,
23 unsigned int cmd, unsigned long arg)
25 struct smb_sb_info *server = SMB_SERVER(inode);
26 int result = -EINVAL;
28 switch (cmd)
30 case SMB_IOC_GETMOUNTUID:
31 result = put_user(NEW_TO_OLD_UID(server->mnt->mounted_uid), (uid16_t *) arg);
32 break;
33 case SMB_IOC_GETMOUNTUID32:
34 result = put_user(server->mnt->mounted_uid, (uid_t *) arg);
35 break;
37 case SMB_IOC_NEWCONN:
39 struct smb_conn_opt opt;
41 if (arg)
43 result = -EFAULT;
44 if (!copy_from_user(&opt, (void *)arg, sizeof(opt)))
45 result = smb_newconn(server, &opt);
47 else
49 #if 0
50 /* obsolete option ... print a warning */
51 printk("SMBFS: ioctl deprecated, please upgrade "
52 "smbfs package\n");
53 #endif
54 result = 0;
56 break;
58 default:
60 return result;