Blame view
fs/cifs/ioctl.c
2.8 KB
1da177e4c Linux-2.6.12-rc2 |
1 2 3 4 5 |
/* * fs/cifs/ioctl.c * * vfs operations that deal with io control * |
fb8c4b14d [CIFS] whitespace... |
6 |
* Copyright (C) International Business Machines Corp., 2005,2007 |
1da177e4c Linux-2.6.12-rc2 |
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 [PATCH] cifs: add... |
23 |
|
1da177e4c Linux-2.6.12-rc2 |
24 |
#include <linux/fs.h> |
1da177e4c Linux-2.6.12-rc2 |
25 26 27 28 |
#include "cifspdu.h" #include "cifsglob.h" #include "cifsproto.h" #include "cifs_debug.h" |
c67593a03 [PATCH] cifs: Ena... |
29 |
#include "cifsfs.h" |
1da177e4c Linux-2.6.12-rc2 |
30 |
|
f28ac91b0 [PATCH] cifs: CIF... |
31 |
#define CIFS_IOC_CHECKUMOUNT _IO(0xCF, 2) |
f9ddcca4c [CIFS] BKL-remova... |
32 |
long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) |
1da177e4c Linux-2.6.12-rc2 |
33 |
{ |
f9ddcca4c [CIFS] BKL-remova... |
34 |
struct inode *inode = filep->f_dentry->d_inode; |
1da177e4c Linux-2.6.12-rc2 |
35 |
int rc = -ENOTTY; /* strange error - but the precedent */ |
c81156dd2 [PATCH] cifs: cle... |
36 37 |
int xid; struct cifs_sb_info *cifs_sb; |
1da177e4c Linux-2.6.12-rc2 |
38 |
#ifdef CONFIG_CIFS_POSIX |
ba00ba64c cifs: make variou... |
39 |
struct cifsFileInfo *pSMBFile = filep->private_data; |
96daf2b09 [CIFS] Rename thr... |
40 |
struct cifs_tcon *tcon; |
f654bac22 [PATCH] cifs: add... |
41 42 |
__u64 ExtAttrBits = 0; __u64 ExtAttrMask = 0; |
618763958 cifs: make cifs_i... |
43 |
__u64 caps; |
c81156dd2 [PATCH] cifs: cle... |
44 |
#endif /* CONFIG_CIFS_POSIX */ |
f654bac22 [PATCH] cifs: add... |
45 46 |
xid = GetXid(); |
b6b38f704 [CIFS] Neaten cER... |
47 |
cFYI(1, "ioctl file %p cmd %u arg %lu", filep, command, arg); |
f28ac91b0 [PATCH] cifs: CIF... |
48 |
|
f654bac22 [PATCH] cifs: add... |
49 |
cifs_sb = CIFS_SB(inode->i_sb); |
f654bac22 [PATCH] cifs: add... |
50 |
|
5fdae1f68 [CIFS] whitespace... |
51 |
switch (command) { |
f28ac91b0 [PATCH] cifs: CIF... |
52 |
case CIFS_IOC_CHECKUMOUNT: |
b6b38f704 [CIFS] Neaten cER... |
53 |
cFYI(1, "User unmount attempted"); |
a001e5b55 CRED: Wrap task c... |
54 |
if (cifs_sb->mnt_uid == current_uid()) |
f28ac91b0 [PATCH] cifs: CIF... |
55 56 57 |
rc = 0; else { rc = -EACCES; |
b6b38f704 [CIFS] Neaten cER... |
58 |
cFYI(1, "uids do not match"); |
f28ac91b0 [PATCH] cifs: CIF... |
59 60 61 |
} break; #ifdef CONFIG_CIFS_POSIX |
36695673b [PATCH] BLOCK: Mo... |
62 |
case FS_IOC_GETFLAGS: |
618763958 cifs: make cifs_i... |
63 64 65 66 |
if (pSMBFile == NULL) break; tcon = tlink_tcon(pSMBFile->tlink); caps = le64_to_cpu(tcon->fsUnixInfo.Capability); |
5fdae1f68 [CIFS] whitespace... |
67 |
if (CIFS_UNIX_EXTATTR_CAP & caps) { |
f654bac22 [PATCH] cifs: add... |
68 69 |
rc = CIFSGetExtAttr(xid, tcon, pSMBFile->netfid, &ExtAttrBits, &ExtAttrMask); |
5fdae1f68 [CIFS] whitespace... |
70 |
if (rc == 0) |
f654bac22 [PATCH] cifs: add... |
71 |
rc = put_user(ExtAttrBits & |
36695673b [PATCH] BLOCK: Mo... |
72 |
FS_FL_USER_VISIBLE, |
f654bac22 [PATCH] cifs: add... |
73 74 75 |
(int __user *)arg); } break; |
36695673b [PATCH] BLOCK: Mo... |
76 |
case FS_IOC_SETFLAGS: |
618763958 cifs: make cifs_i... |
77 78 79 80 |
if (pSMBFile == NULL) break; tcon = tlink_tcon(pSMBFile->tlink); caps = le64_to_cpu(tcon->fsUnixInfo.Capability); |
5fdae1f68 [CIFS] whitespace... |
81 82 |
if (CIFS_UNIX_EXTATTR_CAP & caps) { if (get_user(ExtAttrBits, (int __user *)arg)) { |
f654bac22 [PATCH] cifs: add... |
83 |
rc = -EFAULT; |
c81156dd2 [PATCH] cifs: cle... |
84 |
break; |
f654bac22 [PATCH] cifs: add... |
85 |
} |
f28ac91b0 [PATCH] cifs: CIF... |
86 |
/* rc= CIFSGetExtAttr(xid,tcon,pSMBFile->netfid, |
f654bac22 [PATCH] cifs: add... |
87 |
extAttrBits, &ExtAttrMask);*/ |
f654bac22 [PATCH] cifs: add... |
88 |
} |
b6b38f704 [CIFS] Neaten cER... |
89 |
cFYI(1, "set flags not implemented yet"); |
f654bac22 [PATCH] cifs: add... |
90 |
break; |
f28ac91b0 [PATCH] cifs: CIF... |
91 |
#endif /* CONFIG_CIFS_POSIX */ |
1da177e4c Linux-2.6.12-rc2 |
92 |
default: |
b6b38f704 [CIFS] Neaten cER... |
93 |
cFYI(1, "unsupported ioctl"); |
f28ac91b0 [PATCH] cifs: CIF... |
94 |
break; |
1da177e4c Linux-2.6.12-rc2 |
95 |
} |
f654bac22 [PATCH] cifs: add... |
96 |
|
f654bac22 [PATCH] cifs: add... |
97 |
FreeXid(xid); |
1da177e4c Linux-2.6.12-rc2 |
98 |
return rc; |
5fdae1f68 [CIFS] whitespace... |
99 |
} |