diff options
author | Steve French <sfrench@us.ibm.com> | 2007-07-07 19:25:05 +0000 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2007-07-07 19:25:05 +0000 |
commit | 790fe579f5006b72dfd2814f9263a73b0b455e81 (patch) | |
tree | 8d0749bb66bcd8993ae66101c6706e0ba432e155 | |
parent | 6dc0f87e351142e224b396f29b59527c4b2d834c (diff) |
[CIFS] more whitespace cleanup
Signed-off-by: Steve French <sfrench@us.ibm.com>
-rw-r--r-- | fs/cifs/cifsfs.c | 18 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 540 | ||||
-rw-r--r-- | fs/cifs/misc.c | 64 | ||||
-rw-r--r-- | fs/cifs/netmisc.c | 18 | ||||
-rw-r--r-- | fs/cifs/readdir.c | 179 | ||||
-rw-r--r-- | fs/cifs/sess.c | 225 | ||||
-rw-r--r-- | fs/cifs/smbencrypt.c | 38 |
7 files changed, 544 insertions, 538 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 9122ef5c317..17ed7cf750a 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -98,7 +98,7 @@ cifs_read_super(struct super_block *sb, void *data, /* BB should we make this contingent on mount parm? */ sb->s_flags |= MS_NODIRATIME | MS_NOATIME; - sb->s_fs_info = kzalloc(sizeof(struct cifs_sb_info),GFP_KERNEL); + sb->s_fs_info = kzalloc(sizeof(struct cifs_sb_info), GFP_KERNEL); cifs_sb = CIFS_SB(sb); if (cifs_sb == NULL) return -ENOMEM; @@ -117,9 +117,10 @@ cifs_read_super(struct super_block *sb, void *data, #ifdef CONFIG_CIFS_EXPERIMENTAL if (experimEnabled != 0) sb->s_export_op = &cifs_export_ops; -#endif /* EXPERIMENTAL */ +#endif /* EXPERIMENTAL */ /* if (cifs_sb->tcon->ses->server->maxBuf > MAX_CIFS_HDR_SIZE + 512) - sb->s_blocksize = cifs_sb->tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; */ + sb->s_blocksize = + cifs_sb->tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; */ #ifdef CONFIG_CIFS_QUOTA sb->s_qcop = &cifs_quotactl_ops; #endif @@ -164,10 +165,10 @@ cifs_put_super(struct super_block *sb) cFYI(1, ("In cifs_put_super")); cifs_sb = CIFS_SB(sb); if (cifs_sb == NULL) { - cFYI(1,("Empty cifs superblock info passed to unmount")); + cFYI(1, ("Empty cifs superblock info passed to unmount")); return; } - rc = cifs_umount(sb, cifs_sb); + rc = cifs_umount(sb, cifs_sb); if (rc) { cERROR(1, ("cifs_umount failed with return code %d", rc)); } @@ -180,7 +181,7 @@ static int cifs_statfs(struct dentry *dentry, struct kstatfs *buf) { struct super_block *sb = dentry->d_sb; - int xid; + int xid; int rc = -EOPNOTSUPP; struct cifs_sb_info *cifs_sb; struct cifsTconInfo *pTcon; @@ -193,7 +194,7 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf) buf->f_type = CIFS_MAGIC_NUMBER; /* 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 + buf->f_namelen = PATH_MAX; /* PATH_MAX may be too long - it would presumably be total path, but note that some servers (includinng Samba 3) have a shorter maximum path */ @@ -217,8 +218,7 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf) bypassed it because we detected that this was an older LANMAN sess */ if (rc) rc = SMBOldQFSInfo(xid, pTcon, buf); - /* - int f_type; + /* int f_type; __fsid_t f_fsid; int f_namelen; */ /* BB get from info in tcon struct at mount time call to QFSAttrInfo */ diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index b4916eb6fd4..5b19ce2e435 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -61,7 +61,7 @@ static struct { {LANMAN_PROT, "\2LM1.2X002"}, {LANMAN2_PROT, "\2LANMAN2.1"}, #endif /* weak password hashing for legacy clients */ - {CIFS_PROT, "\2NT LM 0.12"}, + {CIFS_PROT, "\2NT LM 0.12"}, {BAD_PROT, "\2"} }; #endif @@ -84,17 +84,17 @@ static struct { /* Mark as invalid, all open files on tree connections since they were closed when session to server was lost */ -static void mark_open_files_invalid(struct cifsTconInfo * pTcon) +static void mark_open_files_invalid(struct cifsTconInfo *pTcon) { struct cifsFileInfo *open_file = NULL; - struct list_head * tmp; - struct list_head * tmp1; + struct list_head *tmp; + struct list_head *tmp1; /* list all files open on tree connection and mark them invalid */ write_lock(&GlobalSMBSeslock); list_for_each_safe(tmp, tmp1, &pTcon->openFileList) { - open_file = list_entry(tmp,struct cifsFileInfo, tlist); - if(open_file) { + open_file = list_entry(tmp, struct cifsFileInfo, tlist); + if (open_file) { open_file->invalidHandle = TRUE; } } @@ -113,20 +113,20 @@ small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, /* SMBs NegProt, SessSetup, uLogoff do not have tcon yet so check for tcp and smb session status done differently for those three - in the calling routine */ - if(tcon) { - if(tcon->tidStatus == CifsExiting) { + if (tcon) { + if (tcon->tidStatus == CifsExiting) { /* only tree disconnect, open, and write, (and ulogoff which does not have tcon) are allowed as we start force umount */ - if((smb_command != SMB_COM_WRITE_ANDX) && + if ((smb_command != SMB_COM_WRITE_ANDX) && (smb_command != SMB_COM_OPEN_ANDX) && (smb_command != SMB_COM_TREE_DISCONNECT)) { - cFYI(1,("can not send cmd %d while umounting", + cFYI(1, ("can not send cmd %d while umounting", smb_command)); return -ENODEV; } } - if((tcon->ses) && (tcon->ses->status != CifsExiting) && + if ((tcon->ses) && (tcon->ses->status != CifsExiting) && (tcon->ses->server)){ struct nls_table *nls_codepage; /* Give Demultiplex thread up to 10 seconds to @@ -135,9 +135,9 @@ small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, while(tcon->ses->server->tcpStatus == CifsNeedReconnect) { wait_event_interruptible_timeout(tcon->ses->server->response_q, (tcon->ses->server->tcpStatus == CifsGood), 10 * HZ); - if(tcon->ses->server->tcpStatus == CifsNeedReconnect) { + if (tcon->ses->server->tcpStatus == CifsNeedReconnect) { /* on "soft" mounts we wait once */ - if((tcon->retry == FALSE) || + if ((tcon->retry == FALSE) || (tcon->ses->status == CifsExiting)) { cFYI(1,("gave up waiting on reconnect in smb_init")); return -EHOSTDOWN; @@ -153,10 +153,10 @@ small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, /* need to prevent multiple threads trying to simultaneously reconnect the same SMB session */ down(&tcon->ses->sesSem); - if(tcon->ses->status == CifsNeedReconnect) + if (tcon->ses->status == CifsNeedReconnect) rc = cifs_setup_session(0, tcon->ses, nls_codepage); - if(!rc && (tcon->tidStatus == CifsNeedReconnect)) { + if (!rc && (tcon->tidStatus == CifsNeedReconnect)) { mark_open_files_invalid(tcon); rc = CIFSTCon(0, tcon->ses, tcon->treeName, tcon, nls_codepage); @@ -170,7 +170,7 @@ small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, /* BB FIXME add code to check if wsize needs update due to negotiated smb buffer size shrinking */ - if(rc == 0) + if (rc == 0) atomic_inc(&tconInfoReconnectCount); cFYI(1, ("reconnect tcon rc = %d", rc)); @@ -200,7 +200,7 @@ small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, return -EIO; } } - if(rc) + if (rc) return rc; *request_buf = cifs_small_buf_get(); @@ -211,8 +211,8 @@ small_smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, header_assemble((struct smb_hdr *) *request_buf, smb_command, tcon,wct); - if(tcon != NULL) - cifs_stats_inc(&tcon->num_smbs_sent); + if (tcon != NULL) + cifs_stats_inc(&tcon->num_smbs_sent); return rc; } @@ -225,7 +225,7 @@ small_smb_init_no_tc(const int smb_command, const int wct, struct smb_hdr * buffer; rc = small_smb_init(smb_command, wct, NULL, request_buf); - if(rc) + if (rc) return rc; buffer = (struct smb_hdr *)*request_buf; @@ -254,21 +254,21 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, /* SMBs NegProt, SessSetup, uLogoff do not have tcon yet so check for tcp and smb session status done differently for those three - in the calling routine */ - if(tcon) { - if(tcon->tidStatus == CifsExiting) { + if (tcon) { + if (tcon->tidStatus == CifsExiting) { /* only tree disconnect, open, and write, (and ulogoff which does not have tcon) are allowed as we start force umount */ - if((smb_command != SMB_COM_WRITE_ANDX) && + if ((smb_command != SMB_COM_WRITE_ANDX) && (smb_command != SMB_COM_OPEN_ANDX) && (smb_command != SMB_COM_TREE_DISCONNECT)) { - cFYI(1,("can not send cmd %d while umounting", + cFYI(1, ("can not send cmd %d while umounting", smb_command)); return -ENODEV; } } - if((tcon->ses) && (tcon->ses->status != CifsExiting) && + if ((tcon->ses) && (tcon->ses->status != CifsExiting) && (tcon->ses->server)){ struct nls_table *nls_codepage; /* Give Demultiplex thread up to 10 seconds to @@ -277,10 +277,10 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, while(tcon->ses->server->tcpStatus == CifsNeedReconnect) { wait_event_interruptible_timeout(tcon->ses->server->response_q, (tcon->ses->server->tcpStatus == CifsGood), 10 * HZ); - if(tcon->ses->server->tcpStatus == + if (tcon->ses->server->tcpStatus == CifsNeedReconnect) { /* on "soft" mounts we wait once */ - if((tcon->retry == FALSE) || + if ((tcon->retry == FALSE) || (tcon->ses->status == CifsExiting)) { cFYI(1,("gave up waiting on reconnect in smb_init")); return -EHOSTDOWN; @@ -296,10 +296,10 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, /* need to prevent multiple threads trying to simultaneously reconnect the same SMB session */ down(&tcon->ses->sesSem); - if(tcon->ses->status == CifsNeedReconnect) + if (tcon->ses->status == CifsNeedReconnect) rc = cifs_setup_session(0, tcon->ses, nls_codepage); - if(!rc && (tcon->tidStatus == CifsNeedReconnect)) { + if (!rc && (tcon->tidStatus == CifsNeedReconnect)) { mark_open_files_invalid(tcon); rc = CIFSTCon(0, tcon->ses, tcon->treeName, tcon, nls_codepage); @@ -313,7 +313,7 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, /* BB FIXME add code to check if wsize needs update due to negotiated smb buffer size shrinking */ - if(rc == 0) + if (rc == 0) atomic_inc(&tconInfoReconnectCount); cFYI(1, ("reconnect tcon rc = %d", rc)); @@ -343,7 +343,7 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, return -EIO; } } - if(rc) + if (rc) return rc; *request_buf = cifs_buf_get(); @@ -355,14 +355,14 @@ smb_init(int smb_command, int wct, struct cifsTconInfo *tcon, /* potential retries of smb operations it turns out we can determine */ /* from the mid flags when the request buffer can be resent without */ /* having to use a second distinct buffer for the response */ - if(response_buf) + if (response_buf) *response_buf = *request_buf; header_assemble((struct smb_hdr *) *request_buf, smb_command, tcon, wct /*wct */ ); - if(tcon != NULL) - cifs_stats_inc(&tcon->num_smbs_sent); + if (tcon != NULL) + cifs_stats_inc(&tcon->num_smbs_sent); return rc; } @@ -375,19 +375,19 @@ static int validate_t2(struct smb_t2_rsp * pSMB) /* check for plausible wct, bcc and t2 data and parm sizes */ /* check for parm and data offset going beyond end of smb */ - if(pSMB->hdr.WordCount >= 10) { - if((le16_to_cpu(pSMB->t2_rsp.ParameterOffset) <= 1024) && + if (pSMB->hdr.WordCount >= 10) { + if ((le16_to_cpu(pSMB->t2_rsp.ParameterOffset) <= 1024) && (le16_to_cpu(pSMB->t2_rsp.DataOffset) <= 1024)) { /* check that bcc is at least as big as parms + data */ /* check that bcc is less than negotiated smb buffer */ total_size = le16_to_cpu(pSMB->t2_rsp.ParameterCount); - if(total_size < 512) { + if (total_size < 512) { total_size+=le16_to_cpu(pSMB->t2_rsp.DataCount); /* BCC le converted in SendReceive */ pBCC = (pSMB->hdr.WordCount * 2) + sizeof(struct smb_hdr) + (char *)pSMB; - if((total_size <= (*(u16 *)pBCC)) && + if ((total_size <= (*(u16 *)pBCC)) && (total_size < CIFSMaxBufSize+MAX_CIFS_HDR_SIZE)) { return 0; @@ -413,7 +413,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) unsigned int secFlags; u16 dialect; - if(ses->server) + if (ses->server) server = ses->server; else { rc = -EIO; @@ -425,7 +425,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) return rc; /* if any of auth flags (ie not sign or seal) are overriden use them */ - if(ses->overrideSecFlg & (~(CIFSSEC_MUST_SIGN | CIFSSEC_MUST_SEAL))) + if (ses->overrideSecFlg & (~(CIFSSEC_MUST_SIGN | CIFSSEC_MUST_SEAL))) secFlags = ses->overrideSecFlg; /* BB FIXME fix sign flags? */ else /* if override flags set only sign/seal OR them with global auth */ secFlags = extended_security | ses->overrideSecFlg; @@ -452,22 +452,22 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) goto neg_err_exit; dialect = le16_to_cpu(pSMBr->DialectIndex); - cFYI(1,("Dialect: %d", dialect)); + cFYI(1, ("Dialect: %d", dialect)); /* Check wct = 1 error case */ - if((pSMBr->hdr.WordCount < 13) || (dialect == BAD_PROT)) { + if ((pSMBr->hdr.WordCount < 13) || (dialect == BAD_PROT)) { /* core returns wct = 1, but we do not ask for core - otherwise small wct just comes when dialect index is -1 indicating we could not negotiate a common dialect */ rc = -EOPNOTSUPP; goto neg_err_exit; #ifdef CONFIG_CIFS_WEAK_PW_HASH - } else if((pSMBr->hdr.WordCount == 13) + } else if ((pSMBr->hdr.WordCount == 13) && ((dialect == LANMAN_PROT) || (dialect == LANMAN2_PROT))) { __s16 tmp; struct lanman_neg_rsp * rsp = (struct lanman_neg_rsp *)pSMBr; - if((secFlags & CIFSSEC_MAY_LANMAN) || + if ((secFlags & CIFSSEC_MAY_LANMAN) || (secFlags & CIFSSEC_MAY_PLNTXT)) server->secType = LANMAN; else { @@ -483,7 +483,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) GETU32(server->sessid) = le32_to_cpu(rsp->SessionKey); /* even though we do not use raw we might as well set this accurately, in case we ever find a need for it */ - if((le16_to_cpu(rsp->RawMode) & RAW_ENABLE) == RAW_ENABLE) { + if ((le16_to_cpu(rsp->RawMode) & RAW_ENABLE) == RAW_ENABLE) { server->maxRw = 0xFF00; server->capabilities = CAP_MPX_MODE | CAP_RAW_MODE; } else { @@ -511,16 +511,16 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) seconds = val < 0 ? -val : val; result = (seconds / MIN_TZ_ADJ) * MIN_TZ_ADJ; remain = seconds % MIN_TZ_ADJ; - if(remain >= (MIN_TZ_ADJ / 2)) + if (remain >= (MIN_TZ_ADJ / 2)) result += MIN_TZ_ADJ; - if(val < 0) + if (val < 0) result = - result; server->timeAdj = result; } else { server->timeAdj = (int)tmp; server->timeAdj *= 60; /* also in seconds */ } - cFYI(1,("server->timeAdj: %d seconds", server->timeAdj)); + cFYI(1, ("server->timeAdj: %d seconds", server->timeAdj)); /* BB get server time for time conversions and add @@ -535,39 +535,39 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) goto neg_err_exit; } - cFYI(1,("LANMAN negotiated")); + cFYI(1, ("LANMAN negotiated")); /* we will not end up setting signing flags - as no signing was in LANMAN and server did not return the flags on */ goto signing_check; #else /* weak security disabled */ - } else if(pSMBr->hdr.WordCount == 13) { + } else if (pSMBr->hdr.WordCount == 13) { cERROR(1,("mount failed, cifs module not built " "with CIFS_WEAK_PW_HASH support")); rc = -EOPNOTSUPP; #endif /* WEAK_PW_HASH */ goto neg_err_exit; - } else if(pSMBr->hdr.WordCount != 17) { + } else if (pSMBr->hdr.WordCount != 17) { /* unknown wct */ rc = -EOPNOTSUPP; goto neg_err_exit; } /* else wct == 17 NTLM */ server->secMode = pSMBr->SecurityMode; - if((server->secMode & SECMODE_USER) == 0) - cFYI(1,("share mode security")); + if ((server->secMode & SECMODE_USER) == 0) + cFYI(1, ("share mode security")); - if((server->secMode & SECMODE_PW_ENCRYPT) == 0) + if ((server->secMode & SECMODE_PW_ENCRYPT) == 0) #ifdef CONFIG_CIFS_WEAK_PW_HASH if ((secFlags & CIFSSEC_MAY_PLNTXT) == 0) #endif /* CIFS_WEAK_PW_HASH */ cERROR(1,("Server requests plain text password" " but client support disabled")); - if((secFlags & CIFSSEC_MUST_NTLMV2) == CIFSSEC_MUST_NTLMV2) + if ((secFlags & CIFSSEC_MUST_NTLMV2) == CIFSSEC_MUST_NTLMV2) server->secType = NTLMv2; - else if(secFlags & CIFSSEC_MAY_NTLM) + else if (secFlags & CIFSSEC_MAY_NTLM) server->secType = NTLM; - else if(secFlags & CIFSSEC_MAY_NTLMV2) + else if (secFlags & CIFSSEC_MAY_NTLMV2) server->secType = NTLMv2; /* else krb5 ... any others ... */ @@ -620,7 +620,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) SecurityBlob, count - 16, &server->secType); - if(rc == 1) { + if (rc == 1) { /* BB Need to fill struct for sessetup here */ rc = -EOPNOTSUPP; } else { @@ -637,7 +637,7 @@ signing_check: /* MUST_SIGN already includes the MAY_SIGN FLAG so if this is zero it means that signing is disabled */ cFYI(1, ("Signing disabled")); - if(server->secMode & SECMODE_SIGN_REQUIRED) + if (server->secMode & SECMODE_SIGN_REQUIRED) cERROR(1, ("Server requires " "/proc/fs/cifs/PacketSigningEnabled " "to be on")); @@ -655,7 +655,7 @@ signing_check: server->secMode |= SECMODE_SIGN_REQUIRED; } else { /* signing optional ie CIFSSEC_MAY_SIGN */ - if((server->secMode & SECMODE_SIGN_REQUIRED) == 0) + if ((server->secMode & SECMODE_SIGN_REQUIRED) == 0) server->secMode &= ~(SECMODE_SIGN_ENABLED | SECMODE_SIGN_REQUIRED); } @@ -663,7 +663,7 @@ signing_check: neg_err_exit: cifs_buf_release(pSMB); - cFYI(1,("negprot rc %d",rc)); + cFYI(1, ("negprot rc %d", rc)); return rc; } @@ -696,12 +696,12 @@ CIFSSMBTDis(const int xid, struct cifsTconInfo *tcon) /* No need to return error on this operation if tid invalidated and closed on server already e.g. due to tcp session crashing */ - if(tcon->tidStatus == CifsNeedReconnect) { + if (tcon->tidStatus == CifsNeedReconnect) { up(&tcon->tconSem); return 0; } - if((tcon->ses == NULL) || (tcon->ses->server == NULL)) { + if ((tcon->ses == NULL) || (tcon->ses->server == NULL)) { up(&tcon->tconSem); return -EIO; } @@ -757,10 +757,10 @@ CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses) smb_buffer_response = (struct smb_hdr *)pSMB; /* BB removeme BB */ - if(ses->server) { + if (ses->server) { pSMB->hdr.Mid = GetNextMid(ses->server); - if(ses->server->secMode & + if (ses->server->secMode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) pSMB->hdr.Flags2 |= SMBFLG2_SECURITY_SIGNATURE; } @@ -999,7 +999,7 @@ PsxCreat: goto psx_create_err; } - cFYI(1,("copying inode info")); + cFYI(1, ("copying inode info")); rc = validate_t2((struct smb_t2_rsp *)pSMBr); if (rc || (pSMBr->ByteCount < sizeof(OPEN_PSX_RSP))) { @@ -1012,20 +1012,20 @@ PsxCreat: + le16_to_cpu(pSMBr->t2.DataOffset)); *pOplock = le16_to_cpu(psx_rsp->OplockFlags); - if(netfid) + if (netfid) *netfid = psx_rsp->Fid; /* cifs fid stays in le */ /* Let caller know file was created so we can set the mode. */ /* Do we care about the CreateAction in any other cases? */ - if(cpu_to_le32(FILE_CREATE) == psx_rsp->CreateAction) + if (cpu_to_le32(FILE_CREATE) == psx_rsp->CreateAction) *pOplock |= CIFS_CREATE_ACTION; /* check to make sure response data is there */ - if(psx_rsp->ReturnedLevel != SMB_QUERY_FILE_UNIX_BASIC) { + if (psx_rsp->ReturnedLevel != SMB_QUERY_FILE_UNIX_BASIC) { pRetData->Type = -1; /* unknown */ #ifdef CONFIG_CIFS_DEBUG2 - cFYI(1,("unknown type")); + cFYI(1, ("unknown type")); #endif } else { - if(pSMBr->ByteCount < sizeof(OPEN_PSX_RSP) + if (pSMBr->ByteCount < sizeof(OPEN_PSX_RSP) + sizeof(FILE_UNIX_BASIC_INFO)) { cERROR(1,("Open response data too small")); pRetData->Type = -1; @@ -1072,7 +1072,7 @@ static __u16 convert_disposition(int disposition) ofun = SMBOPEN_OCREATE | SMBOPEN_OTRUNC; break; default: - cFYI(1,("unknown disposition %d",disposition)); + cFYI(1, ("unknown disposition %d", disposition)); ofun = SMBOPEN_OAPPEND; /* regular open */ } return ofun; @@ -1131,9 +1131,9 @@ OldOpenRetry: as fifo and server expecting SFU style and no Unix extensions */ - if(create_options & CREATE_OPTION_SPECIAL) - pSMB->FileAttributes = cpu_to_le16(ATTR_SYSTEM); - else + if (create_options & CREATE_OPTION_SPECIAL) + pSMB->FileAttributes = cpu_to_le16(ATTR_SYSTEM); + else pSMB->FileAttributes = cpu_to_le16(0/*ATTR_NORMAL*/); /* BB FIXME */ /* if ((omode & S_IWUGO) == 0) @@ -1167,11 +1167,11 @@ OldOpenRetry: /* Let caller know file was created so we can set the mode. */ /* Do we care about the CreateAction in any other cases? */ /* BB FIXME BB */ -/* if(cpu_to_le32(FILE_CREATE) == pSMBr->CreateAction) +/* if (cpu_to_le32(FILE_CREATE) == pSMBr->CreateAction) *pOplock |= CIFS_CREATE_ACTION; */ /* BB FIXME END */ - if(pfile_info) { + if (pfile_info) { pfile_info->CreationTime = 0; /* BB convert CreateTime*/ pfile_info->LastAccessTime = 0; /* BB fixme */ pfile_info->LastWriteTime = 0; /* BB fixme */ @@ -1239,7 +1239,7 @@ openRetry: /* set file as system file if special file such as fifo and server expecting SFU style and no Unix extensions */ - if(create_options & CREATE_OPTION_SPECIAL) + if (create_options & CREATE_OPTION_SPECIAL) pSMB->FileAttributes = cpu_to_le32(ATTR_SYSTEM); else pSMB->FileAttributes = cpu_to_le32(ATTR_NORMAL); @@ -1277,9 +1277,9 @@ openRetry: *netfid = pSMBr->Fid; /* cifs fid stays in le */ /* Let caller know file was created so we can set the mode. */ /* Do we care about the CreateAction in any other cases? */ - if(cpu_to_le32(FILE_CREATE) == pSMBr->CreateAction) + if (cpu_to_le32(FILE_CREATE) == pSMBr->CreateAction) *pOplock |= CIFS_CREATE_ACTION; - if(pfile_info) { + if (pfile_info) { memcpy((char *)pfile_info,(char *)&pSMBr->CreationTime, 36 /* CreationTime to Attributes */); /* the file_info buf is endian converted by caller */ @@ -1309,8 +1309,8 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, int resp_buf_type = 0; struct kvec iov[1]; - cFYI(1,("Reading %d bytes on fid %d",count,netfid)); - if(tcon->ses->capabilities & CAP_LARGE_FILES) + cFYI(1, ("Reading %d bytes on fid %d", count, netfid)); + if (tcon->ses->capabilities & CAP_LARGE_FILES) wct = 12; else wct = 10; /* old style read */ @@ -1327,15 +1327,15 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, pSMB->AndXCommand = 0xFF; /* none */ pSMB->Fid = netfid; pSMB->OffsetLow = cpu_to_le32(lseek & 0xFFFFFFFF); - if(wct == 12) + if (wct == 12) pSMB->OffsetHigh = cpu_to_le32(lseek >> 32); - else if((lseek >> 32) > 0) /* can not handle this big offset for old */ + else if ((lseek >> 32) > 0) /* can not handle this big offset for old */ return -EIO; pSMB->Remaining = 0; pSMB->MaxCount = cpu_to_le16(count & 0xFFFF); pSMB->MaxCountHigh = cpu_to_le32(count >> 16); - if(wct == 12) + if (wct == 12) pSMB->ByteCount = 0; /* no need to do le conversion since 0 */ else { /* old style read */ @@ -1368,27 +1368,27 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, } else { pReadData = (char *) (&pSMBr->hdr.Protocol) + le16_to_cpu(pSMBr->DataOffset); -/* if(rc = copy_to_user(buf, pReadData, data_length)) { +/* if (rc = copy_to_user(buf, pReadData, data_length)) { cERROR(1,("Faulting on read rc = %d",rc)); rc = -EFAULT; }*/ /* can not use copy_to_user when using page cache*/ - if(*buf) + if (*buf) memcpy(*buf,pReadData,data_length); } } /* cifs_small_buf_release(pSMB); */ /* Freed earlier now in SendReceive2 */ - if(*buf) { - if(resp_buf_type == CIFS_SMALL_BUFFER) + if (*buf) { + if (resp_buf_type == CIFS_SMALL_BUFFER) cifs_small_buf_release(iov[0].iov_base); - else if(resp_buf_type == CIFS_LARGE_BUFFER) + else if (resp_buf_type == CIFS_LARGE_BUFFER) cifs_buf_release(iov[0].iov_base); - } else if(resp_buf_type != CIFS_NO_BUFFER) { + } else if (resp_buf_type != CIFS_NO_BUFFER) { /* return buffer to caller to free */ *buf = iov[0].iov_base; - if(resp_buf_type == CIFS_SMALL_BUFFER) + if (resp_buf_type == CIFS_SMALL_BUFFER) *pbuf_type = CIFS_SMALL_BUFFER; - else if(resp_buf_type == CIFS_LARGE_BUFFER) + else if (resp_buf_type == CIFS_LARGE_BUFFER) *pbuf_type = CIFS_LARGE_BUFFER; } /* else no valid buffer on return - leave as null */ @@ -1412,10 +1412,10 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon, __u16 byte_count; /* cFYI(1,("write at %lld %d bytes",offset,count));*/ - if(tcon->ses == NULL) + if (tcon->ses == NULL) return -ECONNABORTED; - if(tcon->ses->capabilities & CAP_LARGE_FILES) + if (tcon->ses->capabilities & CAP_LARGE_FILES) wct = 14; else wct = 12; @@ -1431,9 +1431,9 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon, pSMB->AndXCommand = 0xFF; /* none */ pSMB->Fid = netfid; pSMB->OffsetLow = cpu_to_le32(offset & 0xFFFFFFFF); - if(wct == 14) + if (wct == 14) pSMB->OffsetHigh = cpu_to_le32(offset >> 32); - else if((offset >> 32) > 0) /* can not handle this big offset for old */ + else if ((offset >> 32) > 0) /* can not handle big offset for old srv */ return -EIO; pSMB->Reserved = 0xFFFFFFFF; @@ -1444,7 +1444,7 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon, can send more if LARGE_WRITE_X capability returned by the server and if our buffer is big enough or if we convert to iovecs on socket writes and eliminate the copy to the CIFS buffer */ - if(tcon->ses->capabilities & CAP_LARGE_WRITE_X) { + if (tcon->ses->capabilities & CAP_LARGE_WRITE_X) { bytes_sent = min_t(const unsigned int, CIFSMaxBufSize, count); } else { bytes_sent = (tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) @@ -1455,10 +1455,10 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon, bytes_sent = count; pSMB->DataOffset = cpu_to_le16(offsetof(struct smb_com_write_req,Data) - 4); - if(buf) + if (buf) memcpy(pSMB->Data,buf,bytes_sent); - else if(ubuf) { - if(copy_from_user(pSMB->Data,ubuf,bytes_sent)) { + else if (ubuf) { + if (copy_from_user(pSMB->Data, ubuf, bytes_sent)) { cifs_buf_release(pSMB); return -EFAULT; } @@ -1467,7 +1467,7 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon, cifs_buf_release(pSMB); return -EINVAL; } /* else setting file size with write of zero bytes */ - if(wct == 14) + if (wct == 14) byte_count = bytes_sent + 1; /* pad */ else /* wct == 12 */ { byte_count = bytes_sent + 5; /* bigger pad, smaller smb hdr */ @@ -1476,7 +1476,7 @@ CIFSSMBWrite(const int xid, struct cifsTconInfo *tcon, pSMB->DataLengthHigh = cpu_to_le16(bytes_sent >> 16); pSMB->hdr.smb_buf_length += byte_count; - if(wct == 14) + if (wct == 14) pSMB->ByteCount = cpu_to_le16(byte_count); else { /* old style write has byte count 4 bytes earlier so 4 bytes pad */ struct smb_com_writex_req * pSMBW = @@ -1516,9 +1516,9 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon, int smb_hdr_len; int resp_buf_type = 0; - cFYI(1,("write2 at %lld %d bytes", (long long)offset, count)); + cFYI(1, ("write2 at %lld %d bytes", (long long)offset, count)); - if(tcon->ses->capabilities & CAP_LARGE_FILES) + if (tcon->ses->capabilities & CAP_LARGE_FILES) wct = 14; else wct = 12; @@ -1532,9 +1532,9 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon, pSMB->AndXCommand = 0xFF; /* none */ pSMB->Fid = netfid; pSMB->OffsetLow = cpu_to_le32(offset & 0xFFFFFFFF); - if(wct == 14) + if (wct == 14) pSMB->OffsetHigh = cpu_to_le32(offset >> 32); - else if((offset >> 32) > 0) /* can not handle this big offset for old */ + else if ((offset >> 32) > 0) /* can not handle big offset for old srv */ return -EIO; pSMB->Reserved = 0xFFFFFFFF; pSMB->WriteMode = 0; @@ -1546,11 +1546,11 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon, pSMB->DataLengthLow = cpu_to_le16(count & 0xFFFF); pSMB->DataLengthHigh = cpu_to_le16(count >> 16); smb_hdr_len = pSMB->hdr.smb_buf_length + 1; /* hdr + 1 byte pad */ - if(wct == 14) + if (wct == 14) pSMB->hdr.smb_buf_length += count+1; else /* wct == 12 */ - pSMB->hdr.smb_buf_length += count+5; /* smb data starts later */ - if(wct == 14) + pSMB->hdr.smb_buf_length += count+5; /* smb data starts later */ + if (wct == 14) pSMB->ByteCount = cpu_to_le16(count + 1); else /* wct == 12 */ /* bigger pad, smaller smb hdr, keep offset ok */ { struct smb_com_writex_req * pSMBW = @@ -1558,7 +1558,7 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon, pSMBW->ByteCount = cpu_to_le16(count + 5); } iov[0].iov_base = pSMB; - if(wct == 14) + if (wct == 14) iov[0].iov_len = smb_hdr_len + 4; else /* wct == 12 pad bigger by four bytes */ iov[0].iov_len = smb_hdr_len + 8; @@ -1570,7 +1570,7 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon, if (rc) { cFYI(1, ("Send error Write2 = %d", rc)); *nbytes = 0; - } else if(resp_buf_type == 0) { + } else if (resp_buf_type == 0) { /* presumably this can not happen, but best to be safe */ rc = -EIO; *nbytes = 0; @@ -1582,9 +1582,9 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon, } /* cifs_small_buf_release(pSMB); */ /* Freed earlier now in SendReceive2 */ - if(resp_buf_type == CIFS_SMALL_BUFFER) + if (resp_buf_type == CIFS_SMALL_BUFFER) cifs_small_buf_release(iov[0].iov_base); - else if(resp_buf_type == CIFS_LARGE_BUFFER) + else if (resp_buf_type == CIFS_LARGE_BUFFER) cifs_buf_release(iov[0].iov_base); /* Note: On -EAGAIN error only caller can retry on handle based calls @@ -1615,7 +1615,7 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, pSMBr = (LOCK_RSP *)pSMB; /* BB removeme BB */ - if(lockType == LOCKING_ANDX_OPLOCK_RELEASE) { + if (lockType == LOCKING_ANDX_OPLOCK_RELEASE) { timeout = -1; /* no response expected */ pSMB->Timeout = 0; } else if (waitFlag == TRUE) { @@ -1631,7 +1631,7 @@ CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, pSMB->AndXCommand = 0xFF; /* none */ pSMB->Fid = smb_file_id; /* netfid stays le */ - if((numLock != 0) || (numUnlock != 0)) { + if ((numLock != 0) || (numUnlock != 0)) { pSMB->Locks[0].Pid = cpu_to_le16(current->tgid); /* BB where to store pid high? */ pSMB->Locks[0].LengthLow = cpu_to_le32((u32)len); @@ -1681,7 +1681,7 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, cFYI(1, ("Posix Lock")); - if(pLockData == NULL) + if (pLockData == NULL) return EINVAL; rc = small_smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB); @@ -1706,7 +1706,7 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB PDU from sess */ pSMB->SetupCount = 1; pSMB->Reserved3 = 0; - if(get_flag) + if (get_flag) pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FILE_INFORMATION); else pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION); @@ -1720,7 +1720,7 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, (((char *) &pSMB->hdr.Protocol) + offset); parm_data->lock_type = cpu_to_le16(lock_type); - if(waitFlag) { + if (waitFlag) { timeout = 3; /* blocking operation, no timeout */ parm_data->lock_flags = cpu_to_le16(1); pSMB->Timeout = cpu_to_le32(-1); @@ -1757,19 +1757,19 @@ CIFSSMBPosixLock(const int xid, struct cifsTconInfo *tcon, rc = -EIO; /* bad smb */ goto plk_err_exit; } - if(pLockData == NULL) { + if (pLockData == NULL) { rc = -EINVAL; goto plk_err_exit; } data_offset = le16_to_cpu(pSMBr->t2.DataOffset); data_count = le16_to_cpu(pSMBr->t2.DataCount); - if(data_count < sizeof(struct cifs_posix_lock)) { + if (data_count < sizeof(struct cifs_posix_lock)) { rc = -EIO; goto plk_err_exit; } parm_data = (struct cifs_posix_lock *) ((char *)&pSMBr->hdr.Protocol + data_offset); - if(parm_data->lock_type == cpu_to_le16(CIFS_UNLCK)) + if (parm_data->lock_type == cpu_to_le16(CIFS_UNLCK)) pLockData->fl_type = F_UNLCK; } @@ -1795,7 +1795,7 @@ CIFSSMBClose(const int xid, struct cifsTconInfo *tcon, int smb_file_id) /* do not retry on dead session on close */ rc = small_smb_init(SMB_COM_CLOSE, 3, tcon, (void **) &pSMB); - if(rc == -EAGAIN) + if (rc == -EAGAIN) return 0; if (rc) return rc; @@ -1809,7 +1809,7 @@ CIFSSMBClose(const int xid, struct cifsTconInfo *tcon, int smb_file_id) (struct smb_hdr *) pSMBr, &bytes_returned, 0); cifs_stats_inc(&tcon->num_closes); if (rc) { - if(rc!=-EINTR) { + if (rc != -EINTR) { /* EINTR is expected when user ctl-c to kill app */ cERROR(1, ("Send error in Close = %d", rc)); } @@ -1818,7 +1818,7 @@ CIFSSMBClose(const int xid, struct cifsTconInfo *tcon, int smb_file_id) cifs_small_buf_release(pSMB); /* Since session is dead, file will be closed on server already */ - if(rc == -EAGAIN) + if (rc == -EAGAIN) rc = 0; return rc; @@ -1938,7 +1938,7 @@ int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon, rename_info->overwrite = cpu_to_le32(1); rename_info->root_fid = 0; /* unicode only call */ - if(target_name == NULL) { + if (target_name == NULL) { sprintf(dummy_string,"cifs%x",pSMB->hdr.Mid); len_of_str = cifsConvertToUCS((__le16 *)rename_info->target_name, dummy_string, 24, nls_codepage, remap); @@ -1961,7 +1961,7 @@ int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon, (struct smb_hdr *) pSMBr, &bytes_returned, 0); cifs_stats_inc(&pTcon->num_t2renames); if (rc) { - cFYI(1,("Send error in Rename (by file handle) = %d", rc)); + cFYI(1, ("Send error in Rename (by file handle) = %d", rc)); } cifs_buf_release(pSMB); @@ -2434,7 +2434,7 @@ validate_ntransact(char * buf, char ** ppparm, char ** ppdata, __u32 data_count, data_offset, parm_count, parm_offset; struct smb_com_ntransact_rsp * pSMBr; - if(buf == NULL) + if (buf == NULL) return -EINVAL; pSMBr = (struct smb_com_ntransact_rsp *)buf; @@ -2453,21 +2453,21 @@ validate_ntransact(char * buf, char ** ppparm, char ** ppdata, *ppdata = (char *)&pSMBr->hdr.Protocol + data_offset; /* should we also check that parm and data areas do not overlap? */ - if(*ppparm > end_of_smb) { - cFYI(1,("parms start after end of smb")); + if (*ppparm > end_of_smb) { + cFYI(1, ("parms start after end of smb")); return -EINVAL; - } else if(parm_count + *ppparm > end_of_smb) { - cFYI(1,("parm end after end of smb")); + } else if (parm_count + *ppparm > end_of_smb) { + cFYI(1, ("parm end after end of smb")); return -EINVAL; - } else if(*ppdata > end_of_smb) { - cFYI(1,("data starts after end of smb")); + } else if (*ppdata > end_of_smb) { + cFYI(1, ("data starts after end of smb")); return -EINVAL; - } else if(data_count + *ppdata > end_of_smb) { + } else if (data_count + *ppdata > end_of_smb) { cFYI(1,("data %p + count %d (%p) ends after end of smb %p start %p", *ppdata, data_count, (data_coun |