Fix pmd_populate.
[linux-2.6/linux-mips.git] / fs / smbfs / ioctl.c
blob235f583d953c86b021a17c6c85f6557671dffa4f
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/time.h>
14 #include <linux/mm.h>
15 #include <linux/highuid.h>
16 #include <linux/net.h>
18 #include <linux/smb_fs.h>
19 #include <linux/smb_mount.h>
21 #include <asm/uaccess.h>
23 #include "proto.h"
25 int
26 smb_ioctl(struct inode *inode, struct file *filp,
27 unsigned int cmd, unsigned long arg)
29 struct smb_sb_info *server = server_from_inode(inode);
30 struct smb_conn_opt opt;
31 int result = -EINVAL;
33 switch (cmd) {
34 case SMB_IOC_GETMOUNTUID:
35 result = put_user(NEW_TO_OLD_UID(server->mnt->mounted_uid),
36 (uid16_t *) arg);
37 break;
38 case SMB_IOC_GETMOUNTUID32:
39 result = put_user(server->mnt->mounted_uid, (uid_t *) arg);
40 break;
42 case SMB_IOC_NEWCONN:
43 /* arg is smb_conn_opt, or NULL if no connection was made */
44 if (!arg) {
45 result = 0;
46 smb_lock_server(server);
47 server->state = CONN_RETRIED;
48 printk(KERN_ERR "Connection attempt failed! [%d]\n",
49 server->conn_error);
50 smbiod_flush(server);
51 smb_unlock_server(server);
52 break;
55 result = -EFAULT;
56 if (!copy_from_user(&opt, (void *)arg, sizeof(opt)))
57 result = smb_newconn(server, &opt);
58 break;
59 default:
60 break;
63 return result;