original comment: +Wilson03172004,marked due to this pci host does not support MWI
[linux-2.4.git] / fs / smbfs / ioctl.c
1 /*
2  *  ioctl.c
3  *
4  *  Copyright (C) 1995, 1996 by Volker Lendecke
5  *  Copyright (C) 1997 by Volker Lendecke
6  *
7  *  Please add a note about your changes to smbfs in the ChangeLog file.
8  */
9
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>
16
17 #include <linux/smb_fs.h>
18 #include <linux/smb_mount.h>
19
20 #include <asm/uaccess.h>
21
22 #include "proto.h"
23
24 int
25 smb_ioctl(struct inode *inode, struct file *filp,
26           unsigned int cmd, unsigned long arg)
27 {
28         struct smb_sb_info *server = server_from_inode(inode);
29         struct smb_conn_opt opt;
30         int result = -EINVAL;
31
32         switch (cmd) {
33         case SMB_IOC_GETMOUNTUID:
34                 result = put_user(NEW_TO_OLD_UID(server->mnt->mounted_uid),
35                                   (uid16_t *) arg);
36                 break;
37         case SMB_IOC_GETMOUNTUID32:
38                 result = put_user(server->mnt->mounted_uid, (uid_t *) arg);
39                 break;
40
41         case SMB_IOC_NEWCONN:
42                 /* arg is smb_conn_opt, or NULL if no connection was made */
43                 if (!arg) {
44                         result = smb_wakeup(server);
45                         break;
46                 }
47
48                 result = -EFAULT;
49                 if (!copy_from_user(&opt, (void *)arg, sizeof(opt)))
50                         result = smb_newconn(server, &opt);
51                 break;
52         default:
53                 break;
54         }
55
56         return result;
57 }