Blame view
fs/cifs/ioctl.c
2.82 KB
1da177e4c
|
1 2 3 4 5 |
/* * fs/cifs/ioctl.c * * vfs operations that deal with io control * |
fb8c4b14d
|
6 |
* Copyright (C) International Business Machines Corp., 2005,2007 |
1da177e4c
|
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
* Author(s): Steve French (sfrench@us.ibm.com) * * This library is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See * the GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ |
f654bac22
|
23 |
|
1da177e4c
|
24 |
#include <linux/fs.h> |
1da177e4c
|
25 26 27 28 |
#include "cifspdu.h" #include "cifsglob.h" #include "cifsproto.h" #include "cifs_debug.h" |
c67593a03
|
29 |
#include "cifsfs.h" |
1da177e4c
|
30 |
|
f28ac91b0
|
31 |
#define CIFS_IOC_CHECKUMOUNT _IO(0xCF, 2) |
f9ddcca4c
|
32 |
long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) |
1da177e4c
|
33 |
{ |
f9ddcca4c
|
34 |
struct inode *inode = filep->f_dentry->d_inode; |
1da177e4c
|
35 |
int rc = -ENOTTY; /* strange error - but the precedent */ |
c81156dd2
|
36 37 |
int xid; struct cifs_sb_info *cifs_sb; |
1da177e4c
|
38 |
#ifdef CONFIG_CIFS_POSIX |
f654bac22
|
39 40 |
__u64 ExtAttrBits = 0; __u64 ExtAttrMask = 0; |
f28ac91b0
|
41 |
__u64 caps; |
f654bac22
|
42 |
struct cifsTconInfo *tcon; |
c21dfb699
|
43 |
struct cifsFileInfo *pSMBFile = filep->private_data; |
c81156dd2
|
44 |
#endif /* CONFIG_CIFS_POSIX */ |
f654bac22
|
45 46 |
xid = GetXid(); |
b6b38f704
|
47 |
cFYI(1, "ioctl file %p cmd %u arg %lu", filep, command, arg); |
f28ac91b0
|
48 |
|
f654bac22
|
49 |
cifs_sb = CIFS_SB(inode->i_sb); |
f654bac22
|
50 |
|
c81156dd2
|
51 52 |
#ifdef CONFIG_CIFS_POSIX tcon = cifs_sb->tcon; |
5fdae1f68
|
53 |
if (tcon) |
f654bac22
|
54 55 56 |
caps = le64_to_cpu(tcon->fsUnixInfo.Capability); else { rc = -EIO; |
c81156dd2
|
57 58 |
FreeXid(xid); return -EIO; |
f654bac22
|
59 |
} |
c81156dd2
|
60 |
#endif /* CONFIG_CIFS_POSIX */ |
f654bac22
|
61 |
|
5fdae1f68
|
62 |
switch (command) { |
f28ac91b0
|
63 |
case CIFS_IOC_CHECKUMOUNT: |
b6b38f704
|
64 |
cFYI(1, "User unmount attempted"); |
a001e5b55
|
65 |
if (cifs_sb->mnt_uid == current_uid()) |
f28ac91b0
|
66 67 68 |
rc = 0; else { rc = -EACCES; |
b6b38f704
|
69 |
cFYI(1, "uids do not match"); |
f28ac91b0
|
70 71 72 |
} break; #ifdef CONFIG_CIFS_POSIX |
36695673b
|
73 |
case FS_IOC_GETFLAGS: |
5fdae1f68
|
74 |
if (CIFS_UNIX_EXTATTR_CAP & caps) { |
f28ac91b0
|
75 |
if (pSMBFile == NULL) |
c81156dd2
|
76 |
break; |
f654bac22
|
77 78 |
rc = CIFSGetExtAttr(xid, tcon, pSMBFile->netfid, &ExtAttrBits, &ExtAttrMask); |
5fdae1f68
|
79 |
if (rc == 0) |
f654bac22
|
80 |
rc = put_user(ExtAttrBits & |
36695673b
|
81 |
FS_FL_USER_VISIBLE, |
f654bac22
|
82 83 84 |
(int __user *)arg); } break; |
36695673b
|
85 |
case FS_IOC_SETFLAGS: |
5fdae1f68
|
86 87 |
if (CIFS_UNIX_EXTATTR_CAP & caps) { if (get_user(ExtAttrBits, (int __user *)arg)) { |
f654bac22
|
88 |
rc = -EFAULT; |
c81156dd2
|
89 |
break; |
f654bac22
|
90 |
} |
f28ac91b0
|
91 |
if (pSMBFile == NULL) |
c81156dd2
|
92 |
break; |
f28ac91b0
|
93 |
/* rc= CIFSGetExtAttr(xid,tcon,pSMBFile->netfid, |
f654bac22
|
94 |
extAttrBits, &ExtAttrMask);*/ |
f654bac22
|
95 |
} |
b6b38f704
|
96 |
cFYI(1, "set flags not implemented yet"); |
f654bac22
|
97 |
break; |
f28ac91b0
|
98 |
#endif /* CONFIG_CIFS_POSIX */ |
1da177e4c
|
99 |
default: |
b6b38f704
|
100 |
cFYI(1, "unsupported ioctl"); |
f28ac91b0
|
101 |
break; |
1da177e4c
|
102 |
} |
f654bac22
|
103 |
|
f654bac22
|
104 |
FreeXid(xid); |
1da177e4c
|
105 |
return rc; |
5fdae1f68
|
106 |
} |