aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorSteve French <smfrench@austin.rr.com>2005-04-29 01:41:07 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-29 01:41:07 -0400
commitf28ac91b0541a49d5bc7bfb9f0efd5289a7dd181 (patch)
tree65b4b2d1f2cef8d7db8a3c907748e1e959bbf1af /fs
parent848f3fce45d2ba93e10b5e9d65bcae0d9269ad0d (diff)
[PATCH] cifs: CIFS ioctl needed by umount.cifs utility
Signed-off-by: Steve French (sfrench@us.ibm.com) Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/cifs/cifsfs.c4
-rw-r--r--fs/cifs/cifspdu.h2
-rw-r--r--fs/cifs/ioctl.c31
3 files changed, 28 insertions, 9 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 3d5365b9f5ba..461a706b237b 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -190,6 +190,7 @@ cifs_statfs(struct super_block *sb, struct kstatfs *buf)
190 190
191#ifdef CONFIG_CIFS_EXPERIMENTAL 191#ifdef CONFIG_CIFS_EXPERIMENTAL
192/* BB we could add a second check for a QFS Unix capability bit */ 192/* BB we could add a second check for a QFS Unix capability bit */
193/* BB FIXME check CIFS_POSIX_EXTENSIONS Unix cap first FIXME BB */
193 if (pTcon->ses->capabilities & CAP_UNIX) 194 if (pTcon->ses->capabilities & CAP_UNIX)
194 rc = CIFSSMBQFSPosixInfo(xid, pTcon, buf); 195 rc = CIFSSMBQFSPosixInfo(xid, pTcon, buf);
195 196
@@ -599,6 +600,9 @@ struct file_operations cifs_dir_ops = {
599#ifdef CONFIG_CIFS_EXPERIMENTAL 600#ifdef CONFIG_CIFS_EXPERIMENTAL
600 .dir_notify = cifs_dir_notify, 601 .dir_notify = cifs_dir_notify,
601#endif /* CONFIG_CIFS_EXPERIMENTAL */ 602#endif /* CONFIG_CIFS_EXPERIMENTAL */
603#ifdef CONFIG_CIFS_POSIX
604 .ioctl = cifs_ioctl,
605#endif /* CONFIG_CIFS_POSIX */
602}; 606};
603 607
604static void 608static void
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h
index 5b352890f092..e3e92615705e 100644
--- a/fs/cifs/cifspdu.h
+++ b/fs/cifs/cifspdu.h
@@ -1556,7 +1556,7 @@ typedef struct {
1556#define CIFS_UNIX_POSIX_ACL_CAP 0x00000002 /* support getfacl/setfacl */ 1556#define CIFS_UNIX_POSIX_ACL_CAP 0x00000002 /* support getfacl/setfacl */
1557#define CIFS_UNIX_XATTR_CAP 0x00000004 /* support new namespace */ 1557#define CIFS_UNIX_XATTR_CAP 0x00000004 /* support new namespace */
1558#define CIFS_UNIX_EXTATTR_CAP 0x00000008 /* support chattr/chflag */ 1558#define CIFS_UNIX_EXTATTR_CAP 0x00000008 /* support chattr/chflag */
1559 1559#define CIFS_POSIX_EXTENSIONS 0x00000010 /* support for new QFSInfo */
1560typedef struct { 1560typedef struct {
1561 /* For undefined recommended transfer size return -1 in that field */ 1561 /* For undefined recommended transfer size return -1 in that field */
1562 __le32 OptimalTransferSize; /* bsize on some os, iosize on other os */ 1562 __le32 OptimalTransferSize; /* bsize on some os, iosize on other os */
diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c
index a4f1c34a8dc7..711bb7a3a98e 100644
--- a/fs/cifs/ioctl.c
+++ b/fs/cifs/ioctl.c
@@ -29,6 +29,8 @@
29#include "cifs_debug.h" 29#include "cifs_debug.h"
30#include "cifsfs.h" 30#include "cifsfs.h"
31 31
32#define CIFS_IOC_CHECKUMOUNT _IO(0xCF, 2)
33
32int cifs_ioctl (struct inode * inode, struct file * filep, 34int cifs_ioctl (struct inode * inode, struct file * filep,
33 unsigned int command, unsigned long arg) 35 unsigned int command, unsigned long arg)
34{ 36{
@@ -36,8 +38,8 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
36#ifdef CONFIG_CIFS_POSIX 38#ifdef CONFIG_CIFS_POSIX
37 __u64 ExtAttrBits = 0; 39 __u64 ExtAttrBits = 0;
38 __u64 ExtAttrMask = 0; 40 __u64 ExtAttrMask = 0;
39 __u64 caps;
40#endif /* CONFIG_CIFS_POSIX */ 41#endif /* CONFIG_CIFS_POSIX */
42 __u64 caps;
41 int xid; 43 int xid;
42 struct cifs_sb_info *cifs_sb; 44 struct cifs_sb_info *cifs_sb;
43 struct cifsTconInfo *tcon; 45 struct cifsTconInfo *tcon;
@@ -46,12 +48,11 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
46 48
47 xid = GetXid(); 49 xid = GetXid();
48 50
51 cFYI(1,("ioctl file %p cmd %u arg %lu",filep,command,arg));
52
49 cifs_sb = CIFS_SB(inode->i_sb); 53 cifs_sb = CIFS_SB(inode->i_sb);
50 tcon = cifs_sb->tcon; 54 tcon = cifs_sb->tcon;
51 if (pSMBFile == NULL)
52 goto cifs_ioctl_out;
53 55
54#ifdef CONFIG_CIFS_POSIX
55 if(tcon) 56 if(tcon)
56 caps = le64_to_cpu(tcon->fsUnixInfo.Capability); 57 caps = le64_to_cpu(tcon->fsUnixInfo.Capability);
57 else { 58 else {
@@ -59,10 +60,22 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
59 goto cifs_ioctl_out; 60 goto cifs_ioctl_out;
60 } 61 }
61 62
62 cFYI(1,("ioctl file %p cmd %u arg %lu",filep,command,arg));
63 switch(command) { 63 switch(command) {
64 case CIFS_IOC_CHECKUMOUNT:
65 cFYI(1,("User unmount attempted"));
66 /* BB FIXME - add missing code here FIXME */
67 if(cifs_sb->mnt_uid == current->uid)
68 rc = 0;
69 else {
70 rc = -EACCES;
71 cFYI(1,("uids do not match"));
72 }
73 break;
74#ifdef CONFIG_CIFS_POSIX
64 case EXT2_IOC_GETFLAGS: 75 case EXT2_IOC_GETFLAGS:
65 if(CIFS_UNIX_EXTATTR_CAP & caps) { 76 if(CIFS_UNIX_EXTATTR_CAP & caps) {
77 if (pSMBFile == NULL)
78 goto cifs_ioctl_out;
66 rc = CIFSGetExtAttr(xid, tcon, pSMBFile->netfid, 79 rc = CIFSGetExtAttr(xid, tcon, pSMBFile->netfid,
67 &ExtAttrBits, &ExtAttrMask); 80 &ExtAttrBits, &ExtAttrMask);
68 if(rc == 0) 81 if(rc == 0)
@@ -78,17 +91,19 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
78 rc = -EFAULT; 91 rc = -EFAULT;
79 goto cifs_ioctl_out; 92 goto cifs_ioctl_out;
80 } 93 }
81 /* rc = CIFSGetExtAttr(xid, tcon, pSMBFile->netfid, 94 if (pSMBFile == NULL)
95 goto cifs_ioctl_out;
96 /* rc= CIFSGetExtAttr(xid,tcon,pSMBFile->netfid,
82 extAttrBits, &ExtAttrMask);*/ 97 extAttrBits, &ExtAttrMask);*/
83 98
84 } 99 }
85 cFYI(1,("set flags not implemented yet")); 100 cFYI(1,("set flags not implemented yet"));
86 break; 101 break;
102#endif /* CONFIG_CIFS_POSIX */
87 default: 103 default:
88 cFYI(1,("unsupported ioctl")); 104 cFYI(1,("unsupported ioctl"));
89 return rc; 105 break;
90 } 106 }
91#endif /* CONFIG_CIFS_POSIX */
92 107
93cifs_ioctl_out: 108cifs_ioctl_out:
94 FreeXid(xid); 109 FreeXid(xid);