Commit c81156dd authored by Steve French's avatar Steve French Committed by Linus Torvalds

[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: default avatarLinus Torvalds <torvalds@osdl.org>
parent f28ac91b
...@@ -169,7 +169,8 @@ cifs_put_super(struct super_block *sb) ...@@ -169,7 +169,8 @@ cifs_put_super(struct super_block *sb)
static int static int
cifs_statfs(struct super_block *sb, struct kstatfs *buf) cifs_statfs(struct super_block *sb, struct kstatfs *buf)
{ {
int xid, rc = -EOPNOTSUPP; int xid;
int rc = -EOPNOTSUPP;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *pTcon; struct cifsTconInfo *pTcon;
...@@ -181,17 +182,18 @@ cifs_statfs(struct super_block *sb, struct kstatfs *buf) ...@@ -181,17 +182,18 @@ cifs_statfs(struct super_block *sb, struct kstatfs *buf)
buf->f_type = CIFS_MAGIC_NUMBER; buf->f_type = CIFS_MAGIC_NUMBER;
/* instead could get the real value via SMB_QUERY_FS_ATTRIBUTE_INFO */ /* instead could get the real value via SMB_QUERY_FS_ATTRIBUTE_INFO */
buf->f_namelen = PATH_MAX; /* PATH_MAX may be too long - it would presumably buf->f_namelen = PATH_MAX; /* PATH_MAX may be too long - it would
be length of total path, note that some servers may be presumably be total path, but note
able to support more than this, but best to be safe that some servers (includinng Samba 3)
since Win2k and others can not handle very long filenames */ have a shorter maximum path */
buf->f_files = 0; /* undefined */ buf->f_files = 0; /* undefined */
buf->f_ffree = 0; /* unlimited */ buf->f_ffree = 0; /* unlimited */
#ifdef CONFIG_CIFS_EXPERIMENTAL #ifdef CONFIG_CIFS_EXPERIMENTAL
/* BB we could add a second check for a QFS Unix capability bit */ /* BB we could add a second check for a QFS Unix capability bit */
/* BB FIXME check CIFS_POSIX_EXTENSIONS Unix cap first FIXME BB */ /* BB FIXME check CIFS_POSIX_EXTENSIONS Unix cap first FIXME BB */
if (pTcon->ses->capabilities & CAP_UNIX) if ((pTcon->ses->capabilities & CAP_UNIX) && (CIFS_POSIX_EXTENSIONS &
le64_to_cpu(pTcon->fsUnixInfo.Capability)))
rc = CIFSSMBQFSPosixInfo(xid, pTcon, buf); rc = CIFSSMBQFSPosixInfo(xid, pTcon, buf);
/* Only need to call the old QFSInfo if failed /* Only need to call the old QFSInfo if failed
...@@ -204,9 +206,10 @@ cifs_statfs(struct super_block *sb, struct kstatfs *buf) ...@@ -204,9 +206,10 @@ cifs_statfs(struct super_block *sb, struct kstatfs *buf)
int f_type; int f_type;
__fsid_t f_fsid; __fsid_t f_fsid;
int f_namelen; */ int f_namelen; */
/* BB get from info put in tcon struct at mount time with call to QFSAttrInfo */ /* BB get from info in tcon struct at mount time call to QFSAttrInfo */
FreeXid(xid); FreeXid(xid);
return 0; /* always return success? what if volume is no longer available? */ return 0; /* always return success? what if volume is no
longer available? */
} }
static int cifs_permission(struct inode * inode, int mask, struct nameidata *nd) static int cifs_permission(struct inode * inode, int mask, struct nameidata *nd)
...@@ -600,9 +603,7 @@ struct file_operations cifs_dir_ops = { ...@@ -600,9 +603,7 @@ struct file_operations cifs_dir_ops = {
#ifdef CONFIG_CIFS_EXPERIMENTAL #ifdef CONFIG_CIFS_EXPERIMENTAL
.dir_notify = cifs_dir_notify, .dir_notify = cifs_dir_notify,
#endif /* CONFIG_CIFS_EXPERIMENTAL */ #endif /* CONFIG_CIFS_EXPERIMENTAL */
#ifdef CONFIG_CIFS_POSIX
.ioctl = cifs_ioctl, .ioctl = cifs_ioctl,
#endif /* CONFIG_CIFS_POSIX */
}; };
static void static void
......
...@@ -319,6 +319,8 @@ struct mid_q_entry { ...@@ -319,6 +319,8 @@ struct mid_q_entry {
struct smb_hdr *resp_buf; /* response buffer */ struct smb_hdr *resp_buf; /* response buffer */
int midState; /* wish this were enum but can not pass to wait_event */ int midState; /* wish this were enum but can not pass to wait_event */
__u8 command; /* smb command code */ __u8 command; /* smb command code */
unsigned multiPart:1; /* multiple responses to one SMB request */
unsigned largeBuf:1; /* if valid response, is pointer to large buf */
}; };
struct oplock_q_entry { struct oplock_q_entry {
......
...@@ -35,35 +35,37 @@ int cifs_ioctl (struct inode * inode, struct file * filep, ...@@ -35,35 +35,37 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
unsigned int command, unsigned long arg) unsigned int command, unsigned long arg)
{ {
int rc = -ENOTTY; /* strange error - but the precedent */ int rc = -ENOTTY; /* strange error - but the precedent */
int xid;
struct cifs_sb_info *cifs_sb;
#ifdef CONFIG_CIFS_POSIX #ifdef CONFIG_CIFS_POSIX
__u64 ExtAttrBits = 0; __u64 ExtAttrBits = 0;
__u64 ExtAttrMask = 0; __u64 ExtAttrMask = 0;
#endif /* CONFIG_CIFS_POSIX */
__u64 caps; __u64 caps;
int xid;
struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *tcon; struct cifsTconInfo *tcon;
struct cifsFileInfo *pSMBFile = struct cifsFileInfo *pSMBFile =
(struct cifsFileInfo *)filep->private_data; (struct cifsFileInfo *)filep->private_data;
#endif /* CONFIG_CIFS_POSIX */
xid = GetXid(); xid = GetXid();
cFYI(1,("ioctl file %p cmd %u arg %lu",filep,command,arg)); cFYI(1,("ioctl file %p cmd %u arg %lu",filep,command,arg));
cifs_sb = CIFS_SB(inode->i_sb); cifs_sb = CIFS_SB(inode->i_sb);
tcon = cifs_sb->tcon;
#ifdef CONFIG_CIFS_POSIX
tcon = cifs_sb->tcon;
if(tcon) if(tcon)
caps = le64_to_cpu(tcon->fsUnixInfo.Capability); caps = le64_to_cpu(tcon->fsUnixInfo.Capability);
else { else {
rc = -EIO; rc = -EIO;
goto cifs_ioctl_out; FreeXid(xid);
return -EIO;
} }
#endif /* CONFIG_CIFS_POSIX */
switch(command) { switch(command) {
case CIFS_IOC_CHECKUMOUNT: case CIFS_IOC_CHECKUMOUNT:
cFYI(1,("User unmount attempted")); cFYI(1,("User unmount attempted"));
/* BB FIXME - add missing code here FIXME */
if(cifs_sb->mnt_uid == current->uid) if(cifs_sb->mnt_uid == current->uid)
rc = 0; rc = 0;
else { else {
...@@ -75,7 +77,7 @@ int cifs_ioctl (struct inode * inode, struct file * filep, ...@@ -75,7 +77,7 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
case EXT2_IOC_GETFLAGS: case EXT2_IOC_GETFLAGS:
if(CIFS_UNIX_EXTATTR_CAP & caps) { if(CIFS_UNIX_EXTATTR_CAP & caps) {
if (pSMBFile == NULL) if (pSMBFile == NULL)
goto cifs_ioctl_out; break;
rc = CIFSGetExtAttr(xid, tcon, pSMBFile->netfid, rc = CIFSGetExtAttr(xid, tcon, pSMBFile->netfid,
&ExtAttrBits, &ExtAttrMask); &ExtAttrBits, &ExtAttrMask);
if(rc == 0) if(rc == 0)
...@@ -89,10 +91,10 @@ int cifs_ioctl (struct inode * inode, struct file * filep, ...@@ -89,10 +91,10 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
if(CIFS_UNIX_EXTATTR_CAP & caps) { if(CIFS_UNIX_EXTATTR_CAP & caps) {
if(get_user(ExtAttrBits,(int __user *)arg)) { if(get_user(ExtAttrBits,(int __user *)arg)) {
rc = -EFAULT; rc = -EFAULT;
goto cifs_ioctl_out; break;
} }
if (pSMBFile == NULL) if (pSMBFile == NULL)
goto cifs_ioctl_out; break;
/* rc= CIFSGetExtAttr(xid,tcon,pSMBFile->netfid, /* rc= CIFSGetExtAttr(xid,tcon,pSMBFile->netfid,
extAttrBits, &ExtAttrMask);*/ extAttrBits, &ExtAttrMask);*/
...@@ -105,7 +107,6 @@ int cifs_ioctl (struct inode * inode, struct file * filep, ...@@ -105,7 +107,6 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
break; break;
} }
cifs_ioctl_out:
FreeXid(xid); FreeXid(xid);
return rc; return rc;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment