aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/misc.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2007-07-07 15:25:05 -0400
committerSteve French <sfrench@us.ibm.com>2007-07-07 15:25:05 -0400
commit790fe579f5006b72dfd2814f9263a73b0b455e81 (patch)
tree8d0749bb66bcd8993ae66101c6706e0ba432e155 /fs/cifs/misc.c
parent6dc0f87e351142e224b396f29b59527c4b2d834c (diff)
[CIFS] more whitespace cleanup
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/misc.c')
-rw-r--r--fs/cifs/misc.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c
index 19cc294c7c70..0211e0651b50 100644
--- a/fs/cifs/misc.c
+++ b/fs/cifs/misc.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * fs/cifs/misc.c 2 * fs/cifs/misc.c
3 * 3 *
4 * Copyright (C) International Business Machines Corp., 2002,2005 4 * Copyright (C) International Business Machines Corp., 2002,2007
5 * Author(s): Steve French (sfrench@us.ibm.com) 5 * Author(s): Steve French (sfrench@us.ibm.com)
6 * 6 *
7 * This library is free software; you can redistribute it and/or modify 7 * This library is free software; you can redistribute it and/or modify
@@ -49,7 +49,7 @@ _GetXid(void)
49 GlobalTotalActiveXid++; 49 GlobalTotalActiveXid++;
50 if (GlobalTotalActiveXid > GlobalMaxActiveXid) 50 if (GlobalTotalActiveXid > GlobalMaxActiveXid)
51 GlobalMaxActiveXid = GlobalTotalActiveXid; /* keep high water mark for number of simultaneous vfs ops in our filesystem */ 51 GlobalMaxActiveXid = GlobalTotalActiveXid; /* keep high water mark for number of simultaneous vfs ops in our filesystem */
52 if(GlobalTotalActiveXid > 65000) 52 if (GlobalTotalActiveXid > 65000)
53 cFYI(1,("warning: more than 65000 requests active")); 53 cFYI(1,("warning: more than 65000 requests active"));
54 xid = GlobalCurrentXid++; 54 xid = GlobalCurrentXid++;
55 spin_unlock(&GlobalMid_Lock); 55 spin_unlock(&GlobalMid_Lock);
@@ -60,7 +60,7 @@ void
60_FreeXid(unsigned int xid) 60_FreeXid(unsigned int xid)
61{ 61{
62 spin_lock(&GlobalMid_Lock); 62 spin_lock(&GlobalMid_Lock);
63 /* if(GlobalTotalActiveXid == 0) 63 /* if (GlobalTotalActiveXid == 0)
64 BUG(); */ 64 BUG(); */
65 GlobalTotalActiveXid--; 65 GlobalTotalActiveXid--;
66 spin_unlock(&GlobalMid_Lock); 66 spin_unlock(&GlobalMid_Lock);
@@ -242,7 +242,7 @@ __u16 GetNextMid(struct TCP_Server_Info *server)
242 __u16 last_mid; 242 __u16 last_mid;
243 int collision; 243 int collision;
244 244
245 if(server == NULL) 245 if (server == NULL)
246 return mid; 246 return mid;
247 247
248 spin_lock(&GlobalMid_Lock); 248 spin_lock(&GlobalMid_Lock);
@@ -260,7 +260,7 @@ __u16 GetNextMid(struct TCP_Server_Info *server)
260 struct mid_q_entry *mid_entry; 260 struct mid_q_entry *mid_entry;
261 261
262 collision = 0; 262 collision = 0;
263 if(server->CurrentMid == 0) 263 if (server->CurrentMid == 0)
264 server->CurrentMid++; 264 server->CurrentMid++;
265 265
266 list_for_each(tmp, &server->pending_mid_q) { 266 list_for_each(tmp, &server->pending_mid_q) {
@@ -273,7 +273,7 @@ __u16 GetNextMid(struct TCP_Server_Info *server)
273 break; 273 break;
274 } 274 }
275 } 275 }
276 if(collision == 0) { 276 if (collision == 0) {
277 mid = server->CurrentMid; 277 mid = server->CurrentMid;
278 break; 278 break;
279 } 279 }
@@ -325,7 +325,7 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ ,
325 /* Uid is not converted */ 325 /* Uid is not converted */
326 buffer->Uid = treeCon->ses->Suid; 326 buffer->Uid = treeCon->ses->Suid;
327 buffer->Mid = GetNextMid(treeCon->ses->server); 327 buffer->Mid = GetNextMid(treeCon->ses->server);
328 if(multiuser_mount != 0) { 328 if (multiuser_mount != 0) {
329 /* For the multiuser case, there are few obvious technically */ 329 /* For the multiuser case, there are few obvious technically */
330 /* possible mechanisms to match the local linux user (uid) */ 330 /* possible mechanisms to match the local linux user (uid) */
331 /* to a valid remote smb user (smb_uid): */ 331 /* to a valid remote smb user (smb_uid): */
@@ -350,13 +350,13 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ ,
350 /* BB Add support for establishing new tCon and SMB Session */ 350 /* BB Add support for establishing new tCon and SMB Session */
351 /* with userid/password pairs found on the smb session */ 351 /* with userid/password pairs found on the smb session */
352 /* for other target tcp/ip addresses BB */ 352 /* for other target tcp/ip addresses BB */
353 if(current->fsuid != treeCon->ses->linux_uid) { 353 if (current->fsuid != treeCon->ses->linux_uid) {
354 cFYI(1,("Multiuser mode and UID did not match tcon uid")); 354 cFYI(1,("Multiuser mode and UID did not match tcon uid"));
355 read_lock(&GlobalSMBSeslock); 355 read_lock(&GlobalSMBSeslock);
356 list_for_each(temp_item, &GlobalSMBSessionList) { 356 list_for_each(temp_item, &GlobalSMBSessionList) {
357 ses = list_entry(temp_item, struct cifsSesInfo, cifsSessionList); 357 ses = list_entry(temp_item, struct cifsSesInfo, cifsSessionList);
358 if(ses->linux_uid == current->fsuid) { 358 if (ses->linux_uid == current->fsuid) {
359 if(ses->server == treeCon->ses->server) { 359 if (ses->server == treeCon->ses->server) {
360 cFYI(1,("found matching uid substitute right smb_uid")); 360 cFYI(1,("found matching uid substitute right smb_uid"));
361 buffer->Uid = ses->Suid; 361 buffer->Uid = ses->Suid;
362 break; 362 break;
@@ -374,8 +374,8 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ ,
374 buffer->Flags2 |= SMBFLG2_DFS; 374 buffer->Flags2 |= SMBFLG2_DFS;
375 if (treeCon->nocase) 375 if (treeCon->nocase)
376 buffer->Flags |= SMBFLG_CASELESS; 376 buffer->Flags |= SMBFLG_CASELESS;
377 if((treeCon->ses) && (treeCon->ses->server)) 377 if ((treeCon->ses) && (treeCon->ses->server))
378 if(treeCon->ses->server->secMode & 378 if (treeCon->ses->server->secMode &
379 (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) 379 (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED))
380 buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; 380 buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE;
381 } 381 }
@@ -392,11 +392,11 @@ checkSMBhdr(struct smb_hdr *smb, __u16 mid)
392 and that the message ids match */ 392 and that the message ids match */
393 if ((*(__le32 *) smb->Protocol == cpu_to_le32(0x424d53ff)) && 393 if ((*(__le32 *) smb->Protocol == cpu_to_le32(0x424d53ff)) &&
394 (mid == smb->Mid)) { 394 (mid == smb->Mid)) {
395 if(smb->Flags & SMBFLG_RESPONSE) 395 if (smb->Flags & SMBFLG_RESPONSE)
396 return 0; 396 return 0;
397 else { 397 else {
398 /* only one valid case where server sends us request */ 398 /* only one valid case where server sends us request */
399 if(smb->Command == SMB_COM_LOCKING_ANDX) 399 if (smb->Command == SMB_COM_LOCKING_ANDX)
400 return 0; 400 return 0;
401 else 401 else
402 cERROR(1, ("Rcvd Request not response")); 402 cERROR(1, ("Rcvd Request not response"));
@@ -458,16 +458,16 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length)
458 return 1; 458 return 1;
459 clc_len = smbCalcSize_LE(smb); 459 clc_len = smbCalcSize_LE(smb);
460 460
461 if(4 + len != length) { 461 if (4 + len != length) {
462 cERROR(1, ("Length read does not match RFC1001 length %d",len)); 462 cERROR(1, ("Length read does not match RFC1001 length %d",len));
463 return 1; 463 return 1;
464 } 464 }
465 465
466 if (4 + len != clc_len) { 466 if (4 + len != clc_len) {
467 /* check if bcc wrapped around for large read responses */ 467 /* check if bcc wrapped around for large read responses */
468 if((len > 64 * 1024) && (len > clc_len)) { 468 if ((len > 64 * 1024) && (len > clc_len)) {
469 /* check if lengths match mod 64K */ 469 /* check if lengths match mod 64K */
470 if(((4 + len) & 0xFFFF) == (clc_len & 0xFFFF)) 470 if (((4 + len) & 0xFFFF) == (clc_len & 0xFFFF))
471 return 0; /* bcc wrapped */ 471 return 0; /* bcc wrapped */
472 } 472 }
473 cFYI(1, ("Calculated size %d vs length %d mismatch for mid %d", 473 cFYI(1, ("Calculated size %d vs length %d mismatch for mid %d",
@@ -483,7 +483,7 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length)
483 but server says length is 0x21 bytes too long as if the server 483 but server says length is 0x21 bytes too long as if the server
484 forget to reset the smb rfc1001 length when it reset the 484 forget to reset the smb rfc1001 length when it reset the
485 wct and bcc to minimum size and drop the t2 parms and data */ 485 wct and bcc to minimum size and drop the t2 parms and data */
486 if((4+len > clc_len) && (len <= clc_len + 512)) 486 if ((4+len > clc_len) && (len <= clc_len + 512))
487 return 0; 487 return 0;
488 else { 488 else {
489 cERROR(1, ("RFC1001 size %d bigger than SMB for Mid=%d", 489 cERROR(1, ("RFC1001 size %d bigger than SMB for Mid=%d",
@@ -503,13 +503,13 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
503 struct cifsFileInfo *netfile; 503 struct cifsFileInfo *netfile;
504 504
505 cFYI(1,("Checking for oplock break or dnotify response")); 505 cFYI(1,("Checking for oplock break or dnotify response"));
506 if((pSMB->hdr.Command == SMB_COM_NT_TRANSACT) && 506 if ((pSMB->hdr.Command == SMB_COM_NT_TRANSACT) &&
507 (pSMB->hdr.Flags & SMBFLG_RESPONSE)) { 507 (pSMB->hdr.Flags & SMBFLG_RESPONSE)) {
508 struct smb_com_transaction_change_notify_rsp * pSMBr = 508 struct smb_com_transaction_change_notify_rsp * pSMBr =
509 (struct smb_com_transaction_change_notify_rsp *)buf; 509 (struct smb_com_transaction_change_notify_rsp *)buf;
510 struct file_notify_information * pnotify; 510 struct file_notify_information * pnotify;
511 __u32 data_offset = 0; 511 __u32 data_offset = 0;
512 if(pSMBr->ByteCount > sizeof(struct file_notify_information)) { 512 if (pSMBr->ByteCount > sizeof(struct file_notify_information)) {
513 data_offset = le32_to_cpu(pSMBr->DataOffset); 513 data_offset = le32_to_cpu(pSMBr->DataOffset);
514 514
515 pnotify = (struct file_notify_information *) 515 pnotify = (struct file_notify_information *)
@@ -520,15 +520,15 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
520 sizeof(struct smb_hdr)+60); */ 520 sizeof(struct smb_hdr)+60); */
521 return TRUE; 521 return TRUE;
522 } 522 }
523 if(pSMBr->hdr.Status.CifsError) { 523 if (pSMBr->hdr.Status.CifsError) {
524 cFYI(1,("notify err 0x%d",pSMBr->hdr.Status.CifsError)); 524 cFYI(1,("notify err 0x%d",pSMBr->hdr.Status.CifsError));
525 return TRUE; 525 return TRUE;
526 } 526 }
527 return FALSE; 527 return FALSE;
528 } 528 }
529 if(pSMB->hdr.Command != SMB_COM_LOCKING_ANDX) 529 if (pSMB->hdr.Command != SMB_COM_LOCKING_ANDX)
530 return FALSE; 530 return FALSE;
531 if(pSMB->hdr.Flags & SMBFLG_RESPONSE) { 531 if (pSMB->hdr.Flags & SMBFLG_RESPONSE) {
532 /* no sense logging error on invalid handle on oplock 532 /* no sense logging error on invalid handle on oplock
533 break - harmless race between close request and oplock 533 break - harmless race between close request and oplock
534 break response is expected from time to time writing out 534 break response is expected from time to time writing out
@@ -544,11 +544,11 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
544 return FALSE; /* on valid oplock brk we get "request" */ 544 return FALSE; /* on valid oplock brk we get "request" */
545 } 545 }
546 } 546 }
547 if(pSMB->hdr.WordCount != 8) 547 if (pSMB->hdr.WordCount != 8)
548 return FALSE; 548 return FALSE;
549 549
550 cFYI(1,(" oplock type 0x%d level 0x%d",pSMB->LockType,pSMB->OplockLevel)); 550 cFYI(1,(" oplock type 0x%d level 0x%d",pSMB->LockType,pSMB->OplockLevel));
551 if(!(pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE)) 551 if (!(pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE))
552 return FALSE; 552 return FALSE;
553 553
554 /* look up tcon based on tid & uid */ 554 /* look up tcon based on tid & uid */
@@ -560,14 +560,14 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
560 list_for_each(tmp1,&tcon->openFileList){ 560 list_for_each(tmp1,&tcon->openFileList){
561 netfile = list_entry(tmp1,struct cifsFileInfo, 561 netfile = list_entry(tmp1,struct cifsFileInfo,
562 tlist); 562 tlist);
563 if(pSMB->Fid == netfile->netfid) { 563 if (pSMB->Fid == netfile->netfid) {
564 struct cifsInodeInfo *pCifsInode; 564 struct cifsInodeInfo *pCifsInode;
565 read_unlock(&GlobalSMBSeslock); 565 read_unlock(&GlobalSMBSeslock);
566 cFYI(1,("file id match, oplock break")); 566 cFYI(1,("file id match, oplock break"));
567 pCifsInode = 567 pCifsInode =
568 CIFS_I(netfile->pInode); 568 CIFS_I(netfile->pInode);
569 pCifsInode->clientCanCacheAll = FALSE; 569 pCifsInode->clientCanCacheAll = FALSE;
570 if(pSMB->OplockLevel == 0) 570 if (pSMB->OplockLevel == 0)
571 pCifsInode->clientCanCacheRead 571 pCifsInode->clientCanCacheRead
572 = FALSE; 572 = FALSE;
573 pCifsInode->oplockPending = TRUE; 573 pCifsInode->oplockPending = TRUE;
@@ -575,7 +575,7 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv)
575 netfile->netfid, 575 netfile->netfid,
576 tcon); 576 tcon);
577 cFYI(1,("about to wake up oplock thd")); 577 cFYI(1,("about to wake up oplock thd"));
578 if(oplockThread) 578 if (oplockThread)
579 wake_up_process(oplockThread); 579 wake_up_process(oplockThread);
580 return TRUE; 580 return TRUE;
581 } 581 }
@@ -681,7 +681,7 @@ cifs_convertUCSpath(char *target, const __le16 * source, int maxlen,
681 default: 681 default:
682 len = cp->uni2char(src_char, &target[j], 682 len = cp->uni2char(src_char, &target[j],
683 NLS_MAX_CHARSET_SIZE); 683 NLS_MAX_CHARSET_SIZE);
684 if(len > 0) { 684 if (len > 0) {
685 j += len; 685 j += len;
686 continue; 686 continue;
687 } else { 687 } else {
@@ -690,7 +690,7 @@ cifs_convertUCSpath(char *target, const __le16 * source, int maxlen,
690 } 690 }
691 j++; 691 j++;
692 /* make sure we do not overrun callers allocated temp buffer */ 692 /* make sure we do not overrun callers allocated temp buffer */
693 if(j >= (2 * NAME_MAX)) 693 if (j >= (2 * NAME_MAX))
694 break; 694 break;
695 } 695 }
696cUCS_out: 696cUCS_out:
@@ -711,7 +711,7 @@ cifsConvertToUCS(__le16 * target, const char *source, int maxlen,
711 char src_char; 711 char src_char;
712 __u16 temp; 712 __u16 temp;
713 713
714 if(!mapChars) 714 if (!mapChars)
715 return cifs_strtoUCS(target, source, PATH_MAX, cp); 715 return cifs_strtoUCS(target, source, PATH_MAX, cp);
716 716
717 for(i = 0, j = 0; i < maxlen; j++) { 717 for(i = 0, j = 0; i < maxlen; j++) {
@@ -749,7 +749,7 @@ cifsConvertToUCS(__le16 * target, const char *source, int maxlen,
749 len_remaining, &temp); 749 len_remaining, &temp);
750 /* if no match, use question mark, which 750 /* if no match, use question mark, which
751 at least in some cases servers as wild card */ 751 at least in some cases servers as wild card */
752 if(charlen < 1) { 752 if (charlen < 1) {
753 target[j] = cpu_to_le16(0x003f); 753 target[j] = cpu_to_le16(0x003f);
754 charlen = 1; 754 charlen = 1;
755 } else 755 } else