aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
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
commitc81156dd217818c143a09b6a744e797a04571e99 (patch)
tree3e20876b3b1d6d4fda144c0e13029e5570dd237a /fs/cifs
parentf28ac91b0541a49d5bc7bfb9f0efd5289a7dd181 (diff)
[PATCH] cifs: cleanup of ifdefs usage so it is more consistent
And fix to not needlessly send new POSIX QFSInfo when server does not explicitly claim support for the new protocol extensions. Signed-off-by: Steve French (sfrench@us.ibm.com) Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/cifsfs.c21
-rw-r--r--fs/cifs/cifsglob.h4
-rw-r--r--fs/cifs/ioctl.c21
3 files changed, 25 insertions, 21 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 461a706b237b..6322aada491f 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -169,7 +169,8 @@ cifs_put_super(struct super_block *sb)
169static int 169static int
170cifs_statfs(struct super_block *sb, struct kstatfs *buf) 170cifs_statfs(struct super_block *sb, struct kstatfs *buf)
171{ 171{
172 int xid, rc = -EOPNOTSUPP; 172 int xid;
173 int rc = -EOPNOTSUPP;
173 struct cifs_sb_info *cifs_sb; 174 struct cifs_sb_info *cifs_sb;
174 struct cifsTconInfo *pTcon; 175 struct cifsTconInfo *pTcon;
175 176
@@ -181,17 +182,18 @@ cifs_statfs(struct super_block *sb, struct kstatfs *buf)
181 buf->f_type = CIFS_MAGIC_NUMBER; 182 buf->f_type = CIFS_MAGIC_NUMBER;
182 183
183 /* instead could get the real value via SMB_QUERY_FS_ATTRIBUTE_INFO */ 184 /* instead could get the real value via SMB_QUERY_FS_ATTRIBUTE_INFO */
184 buf->f_namelen = PATH_MAX; /* PATH_MAX may be too long - it would presumably 185 buf->f_namelen = PATH_MAX; /* PATH_MAX may be too long - it would
185 be length of total path, note that some servers may be 186 presumably be total path, but note
186 able to support more than this, but best to be safe 187 that some servers (includinng Samba 3)
187 since Win2k and others can not handle very long filenames */ 188 have a shorter maximum path */
188 buf->f_files = 0; /* undefined */ 189 buf->f_files = 0; /* undefined */
189 buf->f_ffree = 0; /* unlimited */ 190 buf->f_ffree = 0; /* unlimited */
190 191
191#ifdef CONFIG_CIFS_EXPERIMENTAL 192#ifdef CONFIG_CIFS_EXPERIMENTAL
192/* BB we could add a second check for a QFS Unix capability bit */ 193/* 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 */ 194/* BB FIXME check CIFS_POSIX_EXTENSIONS Unix cap first FIXME BB */
194 if (pTcon->ses->capabilities & CAP_UNIX) 195 if ((pTcon->ses->capabilities & CAP_UNIX) && (CIFS_POSIX_EXTENSIONS &
196 le64_to_cpu(pTcon->fsUnixInfo.Capability)))
195 rc = CIFSSMBQFSPosixInfo(xid, pTcon, buf); 197 rc = CIFSSMBQFSPosixInfo(xid, pTcon, buf);
196 198
197 /* Only need to call the old QFSInfo if failed 199 /* Only need to call the old QFSInfo if failed
@@ -204,9 +206,10 @@ cifs_statfs(struct super_block *sb, struct kstatfs *buf)
204 int f_type; 206 int f_type;
205 __fsid_t f_fsid; 207 __fsid_t f_fsid;
206 int f_namelen; */ 208 int f_namelen; */
207 /* BB get from info put in tcon struct at mount time with call to QFSAttrInfo */ 209 /* BB get from info in tcon struct at mount time call to QFSAttrInfo */
208 FreeXid(xid); 210 FreeXid(xid);
209 return 0; /* always return success? what if volume is no longer available? */ 211 return 0; /* always return success? what if volume is no
212 longer available? */
210} 213}
211 214
212static int cifs_permission(struct inode * inode, int mask, struct nameidata *nd) 215static int cifs_permission(struct inode * inode, int mask, struct nameidata *nd)
@@ -600,9 +603,7 @@ struct file_operations cifs_dir_ops = {
600#ifdef CONFIG_CIFS_EXPERIMENTAL 603#ifdef CONFIG_CIFS_EXPERIMENTAL
601 .dir_notify = cifs_dir_notify, 604 .dir_notify = cifs_dir_notify,
602#endif /* CONFIG_CIFS_EXPERIMENTAL */ 605#endif /* CONFIG_CIFS_EXPERIMENTAL */
603#ifdef CONFIG_CIFS_POSIX
604 .ioctl = cifs_ioctl, 606 .ioctl = cifs_ioctl,
605#endif /* CONFIG_CIFS_POSIX */
606}; 607};
607 608
608static void 609static void
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index fe1409799513..322a12450ad3 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -318,7 +318,9 @@ struct mid_q_entry {
318 struct task_struct *tsk; /* task waiting for response */ 318 struct task_struct *tsk; /* task waiting for response */
319 struct smb_hdr *resp_buf; /* response buffer */ 319 struct smb_hdr *resp_buf; /* response buffer */
320 int midState; /* wish this were enum but can not pass to wait_event */ 320 int midState; /* wish this were enum but can not pass to wait_event */
321 __u8 command; /* smb command code */ 321 __u8 command; /* smb command code */
322 unsigned multiPart:1; /* multiple responses to one SMB request */
323 unsigned largeBuf:1; /* if valid response, is pointer to large buf */
322}; 324};
323 325
324struct oplock_q_entry { 326struct oplock_q_entry {
diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c
index 711bb7a3a98e..b0ea6687ab55 100644
--- a/fs/cifs/ioctl.c
+++ b/fs/cifs/ioctl.c
@@ -35,35 +35,37 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
35 unsigned int command, unsigned long arg) 35 unsigned int command, unsigned long arg)
36{ 36{
37 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;
38#ifdef CONFIG_CIFS_POSIX 40#ifdef CONFIG_CIFS_POSIX
39 __u64 ExtAttrBits = 0; 41 __u64 ExtAttrBits = 0;
40 __u64 ExtAttrMask = 0; 42 __u64 ExtAttrMask = 0;
41#endif /* CONFIG_CIFS_POSIX */
42 __u64 caps; 43 __u64 caps;
43 int xid;
44 struct cifs_sb_info *cifs_sb;
45 struct cifsTconInfo *tcon; 44 struct cifsTconInfo *tcon;
46 struct cifsFileInfo *pSMBFile = 45 struct cifsFileInfo *pSMBFile =
47 (struct cifsFileInfo *)filep->private_data; 46 (struct cifsFileInfo *)filep->private_data;
47#endif /* CONFIG_CIFS_POSIX */
48 48
49 xid = GetXid(); 49 xid = GetXid();
50 50
51 cFYI(1,("ioctl file %p cmd %u arg %lu",filep,command,arg)); 51 cFYI(1,("ioctl file %p cmd %u arg %lu",filep,command,arg));
52 52
53 cifs_sb = CIFS_SB(inode->i_sb); 53 cifs_sb = CIFS_SB(inode->i_sb);
54 tcon = cifs_sb->tcon;
55 54
55#ifdef CONFIG_CIFS_POSIX
56 tcon = cifs_sb->tcon;
56 if(tcon) 57 if(tcon)
57 caps = le64_to_cpu(tcon->fsUnixInfo.Capability); 58 caps = le64_to_cpu(tcon->fsUnixInfo.Capability);
58 else { 59 else {
59 rc = -EIO; 60 rc = -EIO;
60 goto cifs_ioctl_out; 61 FreeXid(xid);
62 return -EIO;
61 } 63 }
64#endif /* CONFIG_CIFS_POSIX */
62 65
63 switch(command) { 66 switch(command) {
64 case CIFS_IOC_CHECKUMOUNT: 67 case CIFS_IOC_CHECKUMOUNT:
65 cFYI(1,("User unmount attempted")); 68 cFYI(1,("User unmount attempted"));
66 /* BB FIXME - add missing code here FIXME */
67 if(cifs_sb->mnt_uid == current->uid) 69 if(cifs_sb->mnt_uid == current->uid)
68 rc = 0; 70 rc = 0;
69 else { 71 else {
@@ -75,7 +77,7 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
75 case EXT2_IOC_GETFLAGS: 77 case EXT2_IOC_GETFLAGS:
76 if(CIFS_UNIX_EXTATTR_CAP & caps) { 78 if(CIFS_UNIX_EXTATTR_CAP & caps) {
77 if (pSMBFile == NULL) 79 if (pSMBFile == NULL)
78 goto cifs_ioctl_out; 80 break;
79 rc = CIFSGetExtAttr(xid, tcon, pSMBFile->netfid, 81 rc = CIFSGetExtAttr(xid, tcon, pSMBFile->netfid,
80 &ExtAttrBits, &ExtAttrMask); 82 &ExtAttrBits, &ExtAttrMask);
81 if(rc == 0) 83 if(rc == 0)
@@ -89,10 +91,10 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
89 if(CIFS_UNIX_EXTATTR_CAP & caps) { 91 if(CIFS_UNIX_EXTATTR_CAP & caps) {
90 if(get_user(ExtAttrBits,(int __user *)arg)) { 92 if(get_user(ExtAttrBits,(int __user *)arg)) {
91 rc = -EFAULT; 93 rc = -EFAULT;
92 goto cifs_ioctl_out; 94 break;
93 } 95 }
94 if (pSMBFile == NULL) 96 if (pSMBFile == NULL)
95 goto cifs_ioctl_out; 97 break;
96 /* rc= CIFSGetExtAttr(xid,tcon,pSMBFile->netfid, 98 /* rc= CIFSGetExtAttr(xid,tcon,pSMBFile->netfid,
97 extAttrBits, &ExtAttrMask);*/ 99 extAttrBits, &ExtAttrMask);*/
98 100
@@ -105,7 +107,6 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
105 break; 107 break;
106 } 108 }
107 109
108cifs_ioctl_out:
109 FreeXid(xid); 110 FreeXid(xid);
110 return rc; 111 return rc;
111} 112}