aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/ioctl.c')
-rw-r--r--fs/cifs/ioctl.c75
1 files changed, 69 insertions, 6 deletions
diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c
index b4b8e201d428..b0ea6687ab55 100644
--- a/fs/cifs/ioctl.c
+++ b/fs/cifs/ioctl.c
@@ -20,30 +20,93 @@
20 * along with this library; if not, write to the Free Software 20 * along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */ 22 */
23
23#include <linux/fs.h> 24#include <linux/fs.h>
24#include <linux/ext2_fs.h> 25#include <linux/ext2_fs.h>
25#include "cifspdu.h" 26#include "cifspdu.h"
26#include "cifsglob.h" 27#include "cifsglob.h"
27#include "cifsproto.h" 28#include "cifsproto.h"
28#include "cifs_debug.h" 29#include "cifs_debug.h"
30#include "cifsfs.h"
31
32#define CIFS_IOC_CHECKUMOUNT _IO(0xCF, 2)
29 33
30int cifs_ioctl (struct inode * inode, struct file * filep, 34int cifs_ioctl (struct inode * inode, struct file * filep,
31 unsigned int command, unsigned long arg) 35 unsigned int command, unsigned long arg)
32{ 36{
33 int rc = -ENOTTY; /* strange error - but the precedent */ 37 int rc = -ENOTTY; /* strange error - but the precedent */
38 int xid;
39 struct cifs_sb_info *cifs_sb;
40#ifdef CONFIG_CIFS_POSIX
41 __u64 ExtAttrBits = 0;
42 __u64 ExtAttrMask = 0;
43 __u64 caps;
44 struct cifsTconInfo *tcon;
45 struct cifsFileInfo *pSMBFile =
46 (struct cifsFileInfo *)filep->private_data;
47#endif /* CONFIG_CIFS_POSIX */
48
49 xid = GetXid();
50
51 cFYI(1,("ioctl file %p cmd %u arg %lu",filep,command,arg));
52
53 cifs_sb = CIFS_SB(inode->i_sb);
54
34#ifdef CONFIG_CIFS_POSIX 55#ifdef CONFIG_CIFS_POSIX
35 cFYI(1,("ioctl file %p cmd %u arg %lu",filep,command,arg)); 56 tcon = cifs_sb->tcon;
57 if(tcon)
58 caps = le64_to_cpu(tcon->fsUnixInfo.Capability);
59 else {
60 rc = -EIO;
61 FreeXid(xid);
62 return -EIO;
63 }
64#endif /* CONFIG_CIFS_POSIX */
65
36 switch(command) { 66 switch(command) {
67 case CIFS_IOC_CHECKUMOUNT:
68 cFYI(1,("User unmount attempted"));
69 if(cifs_sb->mnt_uid == current->uid)
70 rc = 0;
71 else {
72 rc = -EACCES;
73 cFYI(1,("uids do not match"));
74 }
75 break;
76#ifdef CONFIG_CIFS_POSIX
37 case EXT2_IOC_GETFLAGS: 77 case EXT2_IOC_GETFLAGS:
38 cFYI(1,("get flags not implemented yet")); 78 if(CIFS_UNIX_EXTATTR_CAP & caps) {
39 return -EOPNOTSUPP; 79 if (pSMBFile == NULL)
80 break;
81 rc = CIFSGetExtAttr(xid, tcon, pSMBFile->netfid,
82 &ExtAttrBits, &ExtAttrMask);
83 if(rc == 0)
84 rc = put_user(ExtAttrBits &
85 EXT2_FL_USER_VISIBLE,
86 (int __user *)arg);
87 }
88 break;
89
40 case EXT2_IOC_SETFLAGS: 90 case EXT2_IOC_SETFLAGS:
91 if(CIFS_UNIX_EXTATTR_CAP & caps) {
92 if(get_user(ExtAttrBits,(int __user *)arg)) {
93 rc = -EFAULT;
94 break;
95 }
96 if (pSMBFile == NULL)
97 break;
98 /* rc= CIFSGetExtAttr(xid,tcon,pSMBFile->netfid,
99 extAttrBits, &ExtAttrMask);*/
100
101 }
41 cFYI(1,("set flags not implemented yet")); 102 cFYI(1,("set flags not implemented yet"));
42 return -EOPNOTSUPP; 103 break;
104#endif /* CONFIG_CIFS_POSIX */
43 default: 105 default:
44 cFYI(1,("unsupported ioctl")); 106 cFYI(1,("unsupported ioctl"));
45 return rc; 107 break;
46 } 108 }
47#endif /* CONFIG_CIFS_POSIX */ 109
110 FreeXid(xid);
48 return rc; 111 return rc;
49} 112}