- Stephen Rothwell: APM updates
[davej-history.git] / fs / smbfs / ioctl.c
blob73dc857b6b43b8eb4ec6ff619a185312395be877
1 /*
2 * ioctl.c
4 * Copyright (C) 1995, 1996 by Volker Lendecke
5 * Copyright (C) 1997 by Volker Lendecke
7 * Please add a note about your changes to smbfs in the ChangeLog file.
8 */
10 #include <linux/errno.h>
11 #include <linux/fs.h>
12 #include <linux/ioctl.h>
13 #include <linux/sched.h>
14 #include <linux/mm.h>
15 #include <linux/highuid.h>
17 #include <linux/smb_fs.h>
18 #include <linux/smb_mount.h>
20 #include <asm/uaccess.h>
22 int
23 smb_ioctl(struct inode *inode, struct file *filp,
24 unsigned int cmd, unsigned long arg)
26 struct smb_sb_info *server = SMB_SERVER(inode);
27 struct smb_conn_opt opt;
28 int result = -EINVAL;
30 switch (cmd) {
31 case SMB_IOC_GETMOUNTUID:
32 result = put_user(NEW_TO_OLD_UID(server->mnt->mounted_uid),
33 (uid16_t *) arg);
34 break;
35 case SMB_IOC_GETMOUNTUID32:
36 result = put_user(server->mnt->mounted_uid, (uid_t *) arg);
37 break;
39 case SMB_IOC_NEWCONN:
40 /* require an argument == the mount data, else it is EINVAL */
41 if (!arg)
42 break;
44 result = -EFAULT;
45 if (!copy_from_user(&opt, (void *)arg, sizeof(opt)))
46 result = smb_newconn(server, &opt);
47 break;
48 default:
51 return result;