Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * fs/cifs/ioctl.c | |
3 | * | |
4 | * vfs operations that deal with io control | |
5 | * | |
6 | * Copyright (C) International Business Machines Corp., 2005 | |
7 | * Author(s): Steve French (sfrench@us.ibm.com) | |
8 | * | |
9 | * This library is free software; you can redistribute it and/or modify | |
10 | * it under the terms of the GNU Lesser General Public License as published | |
11 | * by the Free Software Foundation; either version 2.1 of the License, or | |
12 | * (at your option) any later version. | |
13 | * | |
14 | * This library is distributed in the hope that it will be useful, | |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | |
17 | * the GNU Lesser General Public License for more details. | |
18 | * | |
19 | * You should have received a copy of the GNU Lesser General Public License | |
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 | |
22 | */ | |
f654bac2 | 23 | |
1da177e4 LT |
24 | #include <linux/fs.h> |
25 | #include <linux/ext2_fs.h> | |
26 | #include "cifspdu.h" | |
27 | #include "cifsglob.h" | |
28 | #include "cifsproto.h" | |
29 | #include "cifs_debug.h" | |
c67593a0 | 30 | #include "cifsfs.h" |
1da177e4 LT |
31 | |
32 | int cifs_ioctl (struct inode * inode, struct file * filep, | |
33 | unsigned int command, unsigned long arg) | |
34 | { | |
35 | int rc = -ENOTTY; /* strange error - but the precedent */ | |
36 | #ifdef CONFIG_CIFS_POSIX | |
f654bac2 SF |
37 | __u64 ExtAttrBits = 0; |
38 | __u64 ExtAttrMask = 0; | |
39 | __u64 caps; | |
40 | #endif /* CONFIG_CIFS_POSIX */ | |
41 | int xid; | |
42 | struct cifs_sb_info *cifs_sb; | |
43 | struct cifsTconInfo *tcon; | |
44 | struct cifsFileInfo *pSMBFile = | |
45 | (struct cifsFileInfo *)filep->private_data; | |
46 | ||
47 | xid = GetXid(); | |
48 | ||
49 | cifs_sb = CIFS_SB(inode->i_sb); | |
50 | tcon = cifs_sb->tcon; | |
51 | if (pSMBFile == NULL) | |
52 | goto cifs_ioctl_out; | |
53 | ||
54 | #ifdef CONFIG_CIFS_POSIX | |
55 | if(tcon) | |
56 | caps = le64_to_cpu(tcon->fsUnixInfo.Capability); | |
57 | else { | |
58 | rc = -EIO; | |
59 | goto cifs_ioctl_out; | |
60 | } | |
61 | ||
1da177e4 LT |
62 | cFYI(1,("ioctl file %p cmd %u arg %lu",filep,command,arg)); |
63 | switch(command) { | |
64 | case EXT2_IOC_GETFLAGS: | |
f654bac2 SF |
65 | if(CIFS_UNIX_EXTATTR_CAP & caps) { |
66 | rc = CIFSGetExtAttr(xid, tcon, pSMBFile->netfid, | |
67 | &ExtAttrBits, &ExtAttrMask); | |
68 | if(rc == 0) | |
69 | rc = put_user(ExtAttrBits & | |
70 | EXT2_FL_USER_VISIBLE, | |
71 | (int __user *)arg); | |
72 | } | |
73 | break; | |
74 | ||
1da177e4 | 75 | case EXT2_IOC_SETFLAGS: |
f654bac2 SF |
76 | if(CIFS_UNIX_EXTATTR_CAP & caps) { |
77 | if(get_user(ExtAttrBits,(int __user *)arg)) { | |
78 | rc = -EFAULT; | |
79 | goto cifs_ioctl_out; | |
80 | } | |
81 | /* rc = CIFSGetExtAttr(xid, tcon, pSMBFile->netfid, | |
82 | extAttrBits, &ExtAttrMask);*/ | |
83 | ||
84 | } | |
1da177e4 | 85 | cFYI(1,("set flags not implemented yet")); |
f654bac2 | 86 | break; |
1da177e4 LT |
87 | default: |
88 | cFYI(1,("unsupported ioctl")); | |
89 | return rc; | |
90 | } | |
91 | #endif /* CONFIG_CIFS_POSIX */ | |
f654bac2 SF |
92 | |
93 | cifs_ioctl_out: | |
94 | FreeXid(xid); | |
1da177e4 LT |
95 | return rc; |
96 | } |