diff options
author | Joe Perches <joe@perches.com> | 2010-04-20 23:50:45 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2010-04-20 23:50:45 -0400 |
commit | b6b38f704a8193daba520493ebdaf7e819962fc8 (patch) | |
tree | c38f4557b51b33573e36817888afa2accf3da9ca /fs/cifs/misc.c | |
parent | 315e995c63a15cb4d4efdbfd70fe2db191917f7a (diff) |
[CIFS] Neaten cERROR and cFYI macros, reduce text space
Neaten cERROR and cFYI macros, reduce text space
~2.5K
Convert '__FILE__ ": " fmt' to '"%s: " fmt', __FILE__' to save text space
Surround macros with do {} while
Add parentheses to macros
Make statement expression macro from macro with assign
Remove now unnecessary parentheses from cFYI and cERROR uses
defconfig with CIFS support old
$ size fs/cifs/built-in.o
text data bss dec hex filename
156012 1760 148 157920 268e0 fs/cifs/built-in.o
defconfig with CIFS support old
$ size fs/cifs/built-in.o
text data bss dec hex filename
153508 1760 148 155416 25f18 fs/cifs/built-in.o
allyesconfig old:
$ size fs/cifs/built-in.o
text data bss dec hex filename
309138 3864 74824 387826 5eaf2 fs/cifs/built-in.o
allyesconfig new
$ size fs/cifs/built-in.o
text data bss dec hex filename
305655 3864 74824 384343 5dd57 fs/cifs/built-in.o
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/misc.c')
-rw-r--r-- | fs/cifs/misc.c | 81 |
1 files changed, 40 insertions, 41 deletions
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index d1474996a812..1394aa37f26c 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c | |||
@@ -51,7 +51,7 @@ _GetXid(void) | |||
51 | if (GlobalTotalActiveXid > GlobalMaxActiveXid) | 51 | if (GlobalTotalActiveXid > GlobalMaxActiveXid) |
52 | GlobalMaxActiveXid = GlobalTotalActiveXid; | 52 | GlobalMaxActiveXid = GlobalTotalActiveXid; |
53 | if (GlobalTotalActiveXid > 65000) | 53 | if (GlobalTotalActiveXid > 65000) |
54 | cFYI(1, ("warning: more than 65000 requests active")); | 54 | cFYI(1, "warning: more than 65000 requests active"); |
55 | xid = GlobalCurrentXid++; | 55 | xid = GlobalCurrentXid++; |
56 | spin_unlock(&GlobalMid_Lock); | 56 | spin_unlock(&GlobalMid_Lock); |
57 | return xid; | 57 | return xid; |
@@ -88,7 +88,7 @@ void | |||
88 | sesInfoFree(struct cifsSesInfo *buf_to_free) | 88 | sesInfoFree(struct cifsSesInfo *buf_to_free) |
89 | { | 89 | { |
90 | if (buf_to_free == NULL) { | 90 | if (buf_to_free == NULL) { |
91 | cFYI(1, ("Null buffer passed to sesInfoFree")); | 91 | cFYI(1, "Null buffer passed to sesInfoFree"); |
92 | return; | 92 | return; |
93 | } | 93 | } |
94 | 94 | ||
@@ -126,7 +126,7 @@ void | |||
126 | tconInfoFree(struct cifsTconInfo *buf_to_free) | 126 | tconInfoFree(struct cifsTconInfo *buf_to_free) |
127 | { | 127 | { |
128 | if (buf_to_free == NULL) { | 128 | if (buf_to_free == NULL) { |
129 | cFYI(1, ("Null buffer passed to tconInfoFree")); | 129 | cFYI(1, "Null buffer passed to tconInfoFree"); |
130 | return; | 130 | return; |
131 | } | 131 | } |
132 | atomic_dec(&tconInfoAllocCount); | 132 | atomic_dec(&tconInfoAllocCount); |
@@ -166,7 +166,7 @@ void | |||
166 | cifs_buf_release(void *buf_to_free) | 166 | cifs_buf_release(void *buf_to_free) |
167 | { | 167 | { |
168 | if (buf_to_free == NULL) { | 168 | if (buf_to_free == NULL) { |
169 | /* cFYI(1, ("Null buffer passed to cifs_buf_release"));*/ | 169 | /* cFYI(1, "Null buffer passed to cifs_buf_release");*/ |
170 | return; | 170 | return; |
171 | } | 171 | } |
172 | mempool_free(buf_to_free, cifs_req_poolp); | 172 | mempool_free(buf_to_free, cifs_req_poolp); |
@@ -202,7 +202,7 @@ cifs_small_buf_release(void *buf_to_free) | |||
202 | { | 202 | { |
203 | 203 | ||
204 | if (buf_to_free == NULL) { | 204 | if (buf_to_free == NULL) { |
205 | cFYI(1, ("Null buffer passed to cifs_small_buf_release")); | 205 | cFYI(1, "Null buffer passed to cifs_small_buf_release"); |
206 | return; | 206 | return; |
207 | } | 207 | } |
208 | mempool_free(buf_to_free, cifs_sm_req_poolp); | 208 | mempool_free(buf_to_free, cifs_sm_req_poolp); |
@@ -345,19 +345,19 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ , | |||
345 | /* with userid/password pairs found on the smb session */ | 345 | /* with userid/password pairs found on the smb session */ |
346 | /* for other target tcp/ip addresses BB */ | 346 | /* for other target tcp/ip addresses BB */ |
347 | if (current_fsuid() != treeCon->ses->linux_uid) { | 347 | if (current_fsuid() != treeCon->ses->linux_uid) { |
348 | cFYI(1, ("Multiuser mode and UID " | 348 | cFYI(1, "Multiuser mode and UID " |
349 | "did not match tcon uid")); | 349 | "did not match tcon uid"); |
350 | read_lock(&cifs_tcp_ses_lock); | 350 | read_lock(&cifs_tcp_ses_lock); |
351 | list_for_each(temp_item, &treeCon->ses->server->smb_ses_list) { | 351 | list_for_each(temp_item, &treeCon->ses->server->smb_ses_list) { |
352 | ses = list_entry(temp_item, struct cifsSesInfo, smb_ses_list); | 352 | ses = list_entry(temp_item, struct cifsSesInfo, smb_ses_list); |
353 | if (ses->linux_uid == current_fsuid()) { | 353 | if (ses->linux_uid == current_fsuid()) { |
354 | if (ses->server == treeCon->ses->server) { | 354 | if (ses->server == treeCon->ses->server) { |
355 | cFYI(1, ("found matching uid substitute right smb_uid")); | 355 | cFYI(1, "found matching uid substitute right smb_uid"); |
356 | buffer->Uid = ses->Suid; | 356 | buffer->Uid = ses->Suid; |
357 | break; | 357 | break; |
358 | } else { | 358 | } else { |
359 | /* BB eventually call cifs_setup_session here */ | 359 | /* BB eventually call cifs_setup_session here */ |
360 | cFYI(1, ("local UID found but no smb sess with this server exists")); | 360 | cFYI(1, "local UID found but no smb sess with this server exists"); |
361 | } | 361 | } |
362 | } | 362 | } |
363 | } | 363 | } |
@@ -394,17 +394,16 @@ checkSMBhdr(struct smb_hdr *smb, __u16 mid) | |||
394 | if (smb->Command == SMB_COM_LOCKING_ANDX) | 394 | if (smb->Command == SMB_COM_LOCKING_ANDX) |
395 | return 0; | 395 | return 0; |
396 | else | 396 | else |
397 | cERROR(1, ("Received Request not response")); | 397 | cERROR(1, "Received Request not response"); |
398 | } | 398 | } |
399 | } else { /* bad signature or mid */ | 399 | } else { /* bad signature or mid */ |
400 | if (*(__le32 *) smb->Protocol != cpu_to_le32(0x424d53ff)) | 400 | if (*(__le32 *) smb->Protocol != cpu_to_le32(0x424d53ff)) |
401 | cERROR(1, | 401 | cERROR(1, "Bad protocol string signature header %x", |
402 | ("Bad protocol string signature header %x", | 402 | *(unsigned int *) smb->Protocol); |
403 | *(unsigned int *) smb->Protocol)); | ||
404 | if (mid != smb->Mid) | 403 | if (mid != smb->Mid) |
405 | cERROR(1, ("Mids do not match")); | 404 | cERROR(1, "Mids do not match"); |
406 | } | 405 | } |
407 | cERROR(1, ("bad smb detected. The Mid=%d", smb->Mid)); | 406 | cERROR(1, "bad smb detected. The Mid=%d", smb->Mid); |
408 | return 1; | 407 | return 1; |
409 | } | 408 | } |
410 | 409 | ||
@@ -413,7 +412,7 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length) | |||
413 | { | 412 | { |
414 | __u32 len = smb->smb_buf_length; | 413 | __u32 len = smb->smb_buf_length; |
415 | __u32 clc_len; /* calculated length */ | 414 | __u32 clc_len; /* calculated length */ |
416 | cFYI(0, ("checkSMB Length: 0x%x, smb_buf_length: 0x%x", length, len)); | 415 | cFYI(0, "checkSMB Length: 0x%x, smb_buf_length: 0x%x", length, len); |
417 | 416 | ||
418 | if (length < 2 + sizeof(struct smb_hdr)) { | 417 | if (length < 2 + sizeof(struct smb_hdr)) { |
419 | if ((length >= sizeof(struct smb_hdr) - 1) | 418 | if ((length >= sizeof(struct smb_hdr) - 1) |
@@ -437,15 +436,15 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length) | |||
437 | tmp[sizeof(struct smb_hdr)+1] = 0; | 436 | tmp[sizeof(struct smb_hdr)+1] = 0; |
438 | return 0; | 437 | return 0; |
439 | } | 438 | } |
440 | cERROR(1, ("rcvd invalid byte count (bcc)")); | 439 | cERROR(1, "rcvd invalid byte count (bcc)"); |
441 | } else { | 440 | } else { |
442 | cERROR(1, ("Length less than smb header size")); | 441 | cERROR(1, "Length less than smb header size"); |
443 | } | 442 | } |
444 | return 1; | 443 | return 1; |
445 | } | 444 | } |
446 | if (len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) { | 445 | if (len > CIFSMaxBufSize + MAX_CIFS_HDR_SIZE - 4) { |
447 | cERROR(1, ("smb length greater than MaxBufSize, mid=%d", | 446 | cERROR(1, "smb length greater than MaxBufSize, mid=%d", |
448 | smb->Mid)); | 447 | smb->Mid); |
449 | return 1; | 448 | return 1; |
450 | } | 449 | } |
451 | 450 | ||
@@ -454,8 +453,8 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length) | |||
454 | clc_len = smbCalcSize_LE(smb); | 453 | clc_len = smbCalcSize_LE(smb); |
455 | 454 | ||
456 | if (4 + len != length) { | 455 | if (4 + len != length) { |
457 | cERROR(1, ("Length read does not match RFC1001 length %d", | 456 | cERROR(1, "Length read does not match RFC1001 length %d", |
458 | len)); | 457 | len); |
459 | return 1; | 458 | return 1; |
460 | } | 459 | } |
461 | 460 | ||
@@ -466,8 +465,8 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length) | |||
466 | if (((4 + len) & 0xFFFF) == (clc_len & 0xFFFF)) | 465 | if (((4 + len) & 0xFFFF) == (clc_len & 0xFFFF)) |
467 | return 0; /* bcc wrapped */ | 466 | return 0; /* bcc wrapped */ |
468 | } | 467 | } |
469 | cFYI(1, ("Calculated size %d vs length %d mismatch for mid %d", | 468 | cFYI(1, "Calculated size %d vs length %d mismatch for mid %d", |
470 | clc_len, 4 + len, smb->Mid)); | 469 | clc_len, 4 + len, smb->Mid); |
471 | /* Windows XP can return a few bytes too much, presumably | 470 | /* Windows XP can return a few bytes too much, presumably |
472 | an illegal pad, at the end of byte range lock responses | 471 | an illegal pad, at the end of byte range lock responses |
473 | so we allow for that three byte pad, as long as actual | 472 | so we allow for that three byte pad, as long as actual |
@@ -482,8 +481,8 @@ checkSMB(struct smb_hdr *smb, __u16 mid, unsigned int length) | |||
482 | if ((4+len > clc_len) && (len <= clc_len + 512)) | 481 | if ((4+len > clc_len) && (len <= clc_len + 512)) |
483 | return 0; | 482 | return 0; |
484 | else { | 483 | else { |
485 | cERROR(1, ("RFC1001 size %d bigger than SMB for Mid=%d", | 484 | cERROR(1, "RFC1001 size %d bigger than SMB for Mid=%d", |
486 | len, smb->Mid)); | 485 | len, smb->Mid); |
487 | return 1; | 486 | return 1; |
488 | } | 487 | } |
489 | } | 488 | } |
@@ -501,7 +500,7 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) | |||
501 | struct cifsFileInfo *netfile; | 500 | struct cifsFileInfo *netfile; |
502 | int rc; | 501 | int rc; |
503 | 502 | ||
504 | cFYI(1, ("Checking for oplock break or dnotify response")); | 503 | cFYI(1, "Checking for oplock break or dnotify response"); |
505 | if ((pSMB->hdr.Command == SMB_COM_NT_TRANSACT) && | 504 | if ((pSMB->hdr.Command == SMB_COM_NT_TRANSACT) && |
506 | (pSMB->hdr.Flags & SMBFLG_RESPONSE)) { | 505 | (pSMB->hdr.Flags & SMBFLG_RESPONSE)) { |
507 | struct smb_com_transaction_change_notify_rsp *pSMBr = | 506 | struct smb_com_transaction_change_notify_rsp *pSMBr = |
@@ -513,15 +512,15 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) | |||
513 | 512 | ||
514 | pnotify = (struct file_notify_information *) | 513 | pnotify = (struct file_notify_information *) |
515 | ((char *)&pSMBr->hdr.Protocol + data_offset); | 514 | ((char *)&pSMBr->hdr.Protocol + data_offset); |
516 | cFYI(1, ("dnotify on %s Action: 0x%x", | 515 | cFYI(1, "dnotify on %s Action: 0x%x", |
517 | pnotify->FileName, pnotify->Action)); | 516 | pnotify->FileName, pnotify->Action); |
518 | /* cifs_dump_mem("Rcvd notify Data: ",buf, | 517 | /* cifs_dump_mem("Rcvd notify Data: ",buf, |
519 | sizeof(struct smb_hdr)+60); */ | 518 | sizeof(struct smb_hdr)+60); */ |
520 | return true; | 519 | return true; |
521 | } | 520 | } |
522 | if (pSMBr->hdr.Status.CifsError) { | 521 | if (pSMBr->hdr.Status.CifsError) { |
523 | cFYI(1, ("notify err 0x%d", | 522 | cFYI(1, "notify err 0x%d", |
524 | pSMBr->hdr.Status.CifsError)); | 523 | pSMBr->hdr.Status.CifsError); |
525 | return true; | 524 | return true; |
526 | } | 525 | } |
527 | return false; | 526 | return false; |
@@ -535,7 +534,7 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) | |||
535 | large dirty files cached on the client */ | 534 | large dirty files cached on the client */ |
536 | if ((NT_STATUS_INVALID_HANDLE) == | 535 | if ((NT_STATUS_INVALID_HANDLE) == |
537 | le32_to_cpu(pSMB->hdr.Status.CifsError)) { | 536 | le32_to_cpu(pSMB->hdr.Status.CifsError)) { |
538 | cFYI(1, ("invalid handle on oplock break")); | 537 | cFYI(1, "invalid handle on oplock break"); |
539 | return true; | 538 | return true; |
540 | } else if (ERRbadfid == | 539 | } else if (ERRbadfid == |
541 | le16_to_cpu(pSMB->hdr.Status.DosError.Error)) { | 540 | le16_to_cpu(pSMB->hdr.Status.DosError.Error)) { |
@@ -547,8 +546,8 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) | |||
547 | if (pSMB->hdr.WordCount != 8) | 546 | if (pSMB->hdr.WordCount != 8) |
548 | return false; | 547 | return false; |
549 | 548 | ||
550 | cFYI(1, ("oplock type 0x%d level 0x%d", | 549 | cFYI(1, "oplock type 0x%d level 0x%d", |
551 | pSMB->LockType, pSMB->OplockLevel)); | 550 | pSMB->LockType, pSMB->OplockLevel); |
552 | if (!(pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE)) | 551 | if (!(pSMB->LockType & LOCKING_ANDX_OPLOCK_RELEASE)) |
553 | return false; | 552 | return false; |
554 | 553 | ||
@@ -579,15 +578,15 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) | |||
579 | return true; | 578 | return true; |
580 | } | 579 | } |
581 | 580 | ||
582 | cFYI(1, ("file id match, oplock break")); | 581 | cFYI(1, "file id match, oplock break"); |
583 | pCifsInode = CIFS_I(netfile->pInode); | 582 | pCifsInode = CIFS_I(netfile->pInode); |
584 | pCifsInode->clientCanCacheAll = false; | 583 | pCifsInode->clientCanCacheAll = false; |
585 | if (pSMB->OplockLevel == 0) | 584 | if (pSMB->OplockLevel == 0) |
586 | pCifsInode->clientCanCacheRead = false; | 585 | pCifsInode->clientCanCacheRead = false; |
587 | rc = slow_work_enqueue(&netfile->oplock_break); | 586 | rc = slow_work_enqueue(&netfile->oplock_break); |
588 | if (rc) { | 587 | if (rc) { |
589 | cERROR(1, ("failed to enqueue oplock " | 588 | cERROR(1, "failed to enqueue oplock " |
590 | "break: %d\n", rc)); | 589 | "break: %d\n", rc); |
591 | } else { | 590 | } else { |
592 | netfile->oplock_break_cancelled = false; | 591 | netfile->oplock_break_cancelled = false; |
593 | } | 592 | } |
@@ -597,12 +596,12 @@ is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) | |||
597 | } | 596 | } |
598 | read_unlock(&GlobalSMBSeslock); | 597 | read_unlock(&GlobalSMBSeslock); |
599 | read_unlock(&cifs_tcp_ses_lock); | 598 | read_unlock(&cifs_tcp_ses_lock); |
600 | cFYI(1, ("No matching file for oplock break")); | 599 | cFYI(1, "No matching file for oplock break"); |
601 | return true; | 600 | return true; |
602 | } | 601 | } |
603 | } | 602 | } |
604 | read_unlock(&cifs_tcp_ses_lock); | 603 | read_unlock(&cifs_tcp_ses_lock); |
605 | cFYI(1, ("Can not process oplock break for non-existent connection")); | 604 | cFYI(1, "Can not process oplock break for non-existent connection"); |
606 | return true; | 605 | return true; |
607 | } | 606 | } |
608 | 607 | ||
@@ -721,11 +720,11 @@ cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb) | |||
721 | { | 720 | { |
722 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { | 721 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { |
723 | cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM; | 722 | cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM; |
724 | cERROR(1, ("Autodisabling the use of server inode numbers on " | 723 | cERROR(1, "Autodisabling the use of server inode numbers on " |
725 | "%s. This server doesn't seem to support them " | 724 | "%s. This server doesn't seem to support them " |
726 | "properly. Hardlinks will not be recognized on this " | 725 | "properly. Hardlinks will not be recognized on this " |
727 | "mount. Consider mounting with the \"noserverino\" " | 726 | "mount. Consider mounting with the \"noserverino\" " |
728 | "option to silence this message.", | 727 | "option to silence this message.", |
729 | cifs_sb->tcon->treeName)); | 728 | cifs_sb->tcon->treeName); |
730 | } | 729 | } |
731 | } | 730 | } |