aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2007-07-08 11:40:40 -0400
committerSteve French <sfrench@us.ibm.com>2007-07-08 11:40:40 -0400
commit3870253efb65e1960421ca74f5d336218c28fc5b (patch)
tree2334067405b14a5896cd6fdebb5636adda8e896f
parent790fe579f5006b72dfd2814f9263a73b0b455e81 (diff)
[CIFS] more whitespace fixes
Signed-off-by: Steve French <sfrench@us.ibm.com>
-rw-r--r--fs/cifs/netmisc.c82
-rw-r--r--fs/cifs/readdir.c163
-rw-r--r--fs/cifs/sess.c9
-rw-r--r--fs/cifs/smbdes.c24
4 files changed, 141 insertions, 137 deletions
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c
index 20a3fe7cbd7b..96c343247ea6 100644
--- a/fs/cifs/netmisc.c
+++ b/fs/cifs/netmisc.c
@@ -3,23 +3,22 @@
3 * 3 *
4 * Copyright (c) International Business Machines Corp., 2002 4 * Copyright (c) International Business Machines Corp., 2002
5 * Author(s): Steve French (sfrench@us.ibm.com) 5 * Author(s): Steve French (sfrench@us.ibm.com)
6 * 6 *
7 * Error mapping routines from Samba libsmb/errormap.c 7 * Error mapping routines from Samba libsmb/errormap.c
8 * Copyright (C) Andrew Tridgell 2001 8 * Copyright (C) Andrew Tridgell 2001
9 * 9 *
10 *
11 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by 11 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or 12 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version. 13 * (at your option) any later version.
15 * 14 *
16 * This program is distributed in the hope that it will be useful, 15 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
19 * the GNU General Public License for more details. 18 * the GNU General Public License for more details.
20 * 19 *
21 * You should have received a copy of the GNU General Public License 20 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software 21 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */ 23 */
25 24
@@ -67,22 +66,22 @@ static const struct smb_to_posix_error mapping_table_ERRDOS[] = {
67 {ERRbadshare, -ETXTBSY}, 66 {ERRbadshare, -ETXTBSY},
68 {ERRlock, -EACCES}, 67 {ERRlock, -EACCES},
69 {ERRunsup, -EINVAL}, 68 {ERRunsup, -EINVAL},
70 {ERRnosuchshare,-ENXIO}, 69 {ERRnosuchshare, -ENXIO},
71 {ERRfilexists, -EEXIST}, 70 {ERRfilexists, -EEXIST},
72 {ERRinvparm, -EINVAL}, 71 {ERRinvparm, -EINVAL},
73 {ERRdiskfull, -ENOSPC}, 72 {ERRdiskfull, -ENOSPC},
74 {ERRinvname, -ENOENT}, 73 {ERRinvname, -ENOENT},
75 {ERRinvlevel,-EOPNOTSUPP}, 74 {ERRinvlevel, -EOPNOTSUPP},
76 {ERRdirnotempty, -ENOTEMPTY}, 75 {ERRdirnotempty, -ENOTEMPTY},
77 {ERRnotlocked, -ENOLCK}, 76 {ERRnotlocked, -ENOLCK},
78 {ERRcancelviolation, -ENOLCK}, 77 {ERRcancelviolation, -ENOLCK},
79 {ERRalreadyexists, -EEXIST}, 78 {ERRalreadyexists, -EEXIST},
80 {ERRmoredata, -EOVERFLOW}, 79 {ERRmoredata, -EOVERFLOW},
81 {ERReasnotsupported,-EOPNOTSUPP}, 80 {ERReasnotsupported, -EOPNOTSUPP},
82 {ErrQuota, -EDQUOT}, 81 {ErrQuota, -EDQUOT},
83 {ErrNotALink, -ENOLINK}, 82 {ErrNotALink, -ENOLINK},
84 {ERRnetlogonNotStarted,-ENOPROTOOPT}, 83 {ERRnetlogonNotStarted, -ENOPROTOOPT},
85 {ErrTooManyLinks,-EMLINK}, 84 {ErrTooManyLinks, -EMLINK},
86 {0, 0} 85 {0, 0}
87}; 86};
88 87
@@ -133,15 +132,15 @@ static const struct smb_to_posix_error mapping_table_ERRHRD[] = {
133/* returns 0 if invalid address */ 132/* returns 0 if invalid address */
134 133
135int 134int
136cifs_inet_pton(int address_family, char *cp,void *dst) 135cifs_inet_pton(int address_family, char *cp, void *dst)
137{ 136{
138 int ret = 0; 137 int ret = 0;
139 138
140 /* calculate length by finding first slash or NULL */ 139 /* calculate length by finding first slash or NULL */
141 /* BB Should we convert '/' slash to '\' here since it seems already done 140 /* BB Should we convert '/' slash to '\' here since it seems already
142 before this */ 141 * done before this */
143 if ( address_family == AF_INET ) { 142 if ( address_family == AF_INET ) {
144 ret = in4_pton(cp, -1 /* len */, dst , '\\', NULL); 143 ret = in4_pton(cp, -1 /* len */, dst , '\\', NULL);
145 } else if ( address_family == AF_INET6 ) { 144 } else if ( address_family == AF_INET6 ) {
146 ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL); 145 ret = in6_pton(cp, -1 /* len */, dst , '\\', NULL);
147 } 146 }
@@ -185,7 +184,7 @@ static const struct {
185 ERRHRD, ERRgeneral, NT_STATUS_UNRECOGNIZED_MEDIA}, { 184 ERRHRD, ERRgeneral, NT_STATUS_UNRECOGNIZED_MEDIA}, {
186 ERRDOS, 27, NT_STATUS_NONEXISTENT_SECTOR}, 185 ERRDOS, 27, NT_STATUS_NONEXISTENT_SECTOR},
187/* { This NT error code was 'sqashed' 186/* { This NT error code was 'sqashed'
188 from NT_STATUS_MORE_PROCESSING_REQUIRED to NT_STATUS_OK 187 from NT_STATUS_MORE_PROCESSING_REQUIRED to NT_STATUS_OK
189 during the session setup } */ 188 during the session setup } */
190 { 189 {
191 ERRDOS, ERRnomem, NT_STATUS_NO_MEMORY}, { 190 ERRDOS, ERRnomem, NT_STATUS_NO_MEMORY}, {
@@ -200,7 +199,7 @@ static const struct {
200 ERRDOS, 193, NT_STATUS_INVALID_FILE_FOR_SECTION}, { 199 ERRDOS, 193, NT_STATUS_INVALID_FILE_FOR_SECTION}, {
201 ERRDOS, ERRnoaccess, NT_STATUS_ALREADY_COMMITTED}, 200 ERRDOS, ERRnoaccess, NT_STATUS_ALREADY_COMMITTED},
202/* { This NT error code was 'sqashed' 201/* { This NT error code was 'sqashed'
203 from NT_STATUS_ACCESS_DENIED to NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE 202 from NT_STATUS_ACCESS_DENIED to NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE
204 during the session setup } */ 203 during the session setup } */
205 { 204 {
206 ERRDOS, ERRnoaccess, NT_STATUS_ACCESS_DENIED}, { 205 ERRDOS, ERRnoaccess, NT_STATUS_ACCESS_DENIED}, {
@@ -270,7 +269,7 @@ static const struct {
270 ERRHRD, ERRgeneral, NT_STATUS_INVALID_ACCOUNT_NAME}, { 269 ERRHRD, ERRgeneral, NT_STATUS_INVALID_ACCOUNT_NAME}, {
271 ERRHRD, ERRgeneral, NT_STATUS_USER_EXISTS}, 270 ERRHRD, ERRgeneral, NT_STATUS_USER_EXISTS},
272/* { This NT error code was 'sqashed' 271/* { This NT error code was 'sqashed'
273 from NT_STATUS_NO_SUCH_USER to NT_STATUS_LOGON_FAILURE 272 from NT_STATUS_NO_SUCH_USER to NT_STATUS_LOGON_FAILURE
274 during the session setup } */ 273 during the session setup } */
275 { 274 {
276 ERRDOS, ERRnoaccess, NT_STATUS_NO_SUCH_USER}, { 275 ERRDOS, ERRnoaccess, NT_STATUS_NO_SUCH_USER}, {
@@ -280,7 +279,7 @@ static const struct {
280 ERRHRD, ERRgeneral, NT_STATUS_MEMBER_NOT_IN_GROUP}, { 279 ERRHRD, ERRgeneral, NT_STATUS_MEMBER_NOT_IN_GROUP}, {
281 ERRHRD, ERRgeneral, NT_STATUS_LAST_ADMIN}, 280 ERRHRD, ERRgeneral, NT_STATUS_LAST_ADMIN},
282/* { This NT error code was 'sqashed' 281/* { This NT error code was 'sqashed'
283 from NT_STATUS_WRONG_PASSWORD to NT_STATUS_LOGON_FAILURE 282 from NT_STATUS_WRONG_PASSWORD to NT_STATUS_LOGON_FAILURE
284 during the session setup } */ 283 during the session setup } */
285 { 284 {
286 ERRSRV, ERRbadpw, NT_STATUS_WRONG_PASSWORD}, { 285 ERRSRV, ERRbadpw, NT_STATUS_WRONG_PASSWORD}, {
@@ -332,8 +331,8 @@ static const struct {
332 ERRHRD, ERRgeneral, NT_STATUS_FILE_INVALID}, { 331 ERRHRD, ERRgeneral, NT_STATUS_FILE_INVALID}, {
333 ERRHRD, ERRgeneral, NT_STATUS_ALLOTTED_SPACE_EXCEEDED}, 332 ERRHRD, ERRgeneral, NT_STATUS_ALLOTTED_SPACE_EXCEEDED},
334/* { This NT error code was 'sqashed' 333/* { This NT error code was 'sqashed'
335 from NT_STATUS_INSUFFICIENT_RESOURCES to NT_STATUS_INSUFF_SERVER_RESOURCES 334 from NT_STATUS_INSUFFICIENT_RESOURCES to
336 during the session setup } */ 335 NT_STATUS_INSUFF_SERVER_RESOURCES during the session setup } */
337 { 336 {
338 ERRDOS, ERRnomem, NT_STATUS_INSUFFICIENT_RESOURCES}, { 337 ERRDOS, ERRnomem, NT_STATUS_INSUFFICIENT_RESOURCES}, {
339 ERRDOS, ERRbadpath, NT_STATUS_DFS_EXIT_PATH_FOUND}, { 338 ERRDOS, ERRbadpath, NT_STATUS_DFS_EXIT_PATH_FOUND}, {
@@ -577,8 +576,8 @@ static const struct {
577 ERRDOS, 19, NT_STATUS_TOO_LATE}, { 576 ERRDOS, 19, NT_STATUS_TOO_LATE}, {
578 ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_LSA_SECRET}, 577 ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_LSA_SECRET},
579/* { This NT error code was 'sqashed' 578/* { This NT error code was 'sqashed'
580 from NT_STATUS_NO_TRUST_SAM_ACCOUNT to NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE 579 from NT_STATUS_NO_TRUST_SAM_ACCOUNT to
581 during the session setup } */ 580 NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE during the session setup } */
582 { 581 {
583 ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_SAM_ACCOUNT}, { 582 ERRDOS, ERRnoaccess, NT_STATUS_NO_TRUST_SAM_ACCOUNT}, {
584 ERRDOS, ERRnoaccess, NT_STATUS_TRUSTED_DOMAIN_FAILURE}, { 583 ERRDOS, ERRnoaccess, NT_STATUS_TRUSTED_DOMAIN_FAILURE}, {
@@ -597,7 +596,7 @@ static const struct {
597 ERRDOS, ERRnoaccess, NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT}, { 596 ERRDOS, ERRnoaccess, NT_STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT}, {
598 ERRDOS, ERRnoaccess, NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT}, 597 ERRDOS, ERRnoaccess, NT_STATUS_NOLOGON_SERVER_TRUST_ACCOUNT},
599/* { This NT error code was 'sqashed' 598/* { This NT error code was 'sqashed'
600 from NT_STATUS_DOMAIN_TRUST_INCONSISTENT to NT_STATUS_LOGON_FAILURE 599 from NT_STATUS_DOMAIN_TRUST_INCONSISTENT to NT_STATUS_LOGON_FAILURE
601 during the session setup } */ 600 during the session setup } */
602 { 601 {
603 ERRDOS, ERRnoaccess, NT_STATUS_DOMAIN_TRUST_INCONSISTENT}, { 602 ERRDOS, ERRnoaccess, NT_STATUS_DOMAIN_TRUST_INCONSISTENT}, {
@@ -728,7 +727,7 @@ cifs_print_status(__u32 status_code)
728 if (((nt_errs[idx].nt_errcode) & 0xFFFFFF) == 727 if (((nt_errs[idx].nt_errcode) & 0xFFFFFF) ==
729 (status_code & 0xFFFFFF)) { 728 (status_code & 0xFFFFFF)) {
730 printk(KERN_NOTICE "Status code returned 0x%08x %s\n", 729 printk(KERN_NOTICE "Status code returned 0x%08x %s\n",
731 status_code,nt_errs[idx].nt_errstr); 730 status_code, nt_errs[idx].nt_errstr);
732 } 731 }
733 idx++; 732 idx++;
734 } 733 }
@@ -760,7 +759,7 @@ int
760map_smb_to_linux_error(struct smb_hdr *smb) 759map_smb_to_linux_error(struct smb_hdr *smb)
761{ 760{
762 unsigned int i; 761 unsigned int i;
763 int rc = -EIO; /* if transport error smb error may not be set */ 762 int rc = -EIO; /* if transport error smb error may not be set */
764 __u8 smberrclass; 763 __u8 smberrclass;
765 __u16 smberrcode; 764 __u16 smberrcode;
766 765
@@ -771,7 +770,8 @@ map_smb_to_linux_error(struct smb_hdr *smb)
771 return 0; 770 return 0;
772 771
773 if (smb->Flags2 & SMBFLG2_ERR_STATUS) { 772 if (smb->Flags2 & SMBFLG2_ERR_STATUS) {
774 /* translate the newer STATUS codes to old style errors and then to POSIX errors */ 773 /* translate the newer STATUS codes to old style SMB errors
774 * and then to POSIX errors */
775 __u32 err = le32_to_cpu(smb->Status.CifsError); 775 __u32 err = le32_to_cpu(smb->Status.CifsError);
776 if (cifsFYI & CIFS_RC) 776 if (cifsFYI & CIFS_RC)
777 cifs_print_status(err); 777 cifs_print_status(err);
@@ -784,7 +784,7 @@ map_smb_to_linux_error(struct smb_hdr *smb)
784 /* old style errors */ 784 /* old style errors */
785 785
786 /* DOS class smb error codes - map DOS */ 786 /* DOS class smb error codes - map DOS */
787 if (smberrclass == ERRDOS) { /* one byte field no need to byte reverse */ 787 if (smberrclass == ERRDOS) { /* 1 byte field no need to byte reverse */
788 for (i = 0; 788 for (i = 0;
789 i < 789 i <
790 sizeof (mapping_table_ERRDOS) / 790 sizeof (mapping_table_ERRDOS) /
@@ -795,9 +795,9 @@ map_smb_to_linux_error(struct smb_hdr *smb)
795 rc = mapping_table_ERRDOS[i].posix_code; 795 rc = mapping_table_ERRDOS[i].posix_code;
796 break; 796 break;
797 } 797 }
798 /* else try the next error mapping one to see if it will match */ 798 /* else try next error mapping one to see if match */
799 } 799 }
800 } else if (smberrclass == ERRSRV) { /* server class of error codes */ 800 } else if (smberrclass == ERRSRV) { /* server class of error codes */
801 for (i = 0; 801 for (i = 0;
802 i < 802 i <
803 sizeof (mapping_table_ERRSRV) / 803 sizeof (mapping_table_ERRSRV) /
@@ -808,14 +808,16 @@ map_smb_to_linux_error(struct smb_hdr *smb)
808 rc = mapping_table_ERRSRV[i].posix_code; 808 rc = mapping_table_ERRSRV[i].posix_code;
809 break; 809 break;
810 } 810 }
811 /* else try the next error mapping one to see if it will match */ 811 /* else try next error mapping to see if match */
812 } 812 }
813 } 813 }
814 /* else ERRHRD class errors or junk - return EIO */ 814 /* else ERRHRD class errors or junk - return EIO */
815 815
816 cFYI(1, (" !!Mapping smb error code %d to POSIX err %d !!", smberrcode,rc)); 816 cFYI(1, (" !!Mapping smb error code %d to POSIX err %d !!",
817 smberrcode, rc));
817 818
818 /* generic corrective action e.g. reconnect SMB session on ERRbaduid could be added */ 819 /* generic corrective action e.g. reconnect SMB session on
820 * ERRbaduid could be added */
819 821
820 return rc; 822 return rc;
821} 823}
@@ -849,7 +851,7 @@ smbCalcSize_LE(struct smb_hdr *ptr)
849struct timespec 851struct timespec
850cifs_NTtimeToUnix(u64 ntutc) 852cifs_NTtimeToUnix(u64 ntutc)
851{ 853{
852 struct timespec ts; 854 struct timespec ts;
853 /* BB what about the timezone? BB */ 855 /* BB what about the timezone? BB */
854 856
855 /* Subtract the NTFS time offset, then convert to 1s intervals. */ 857 /* Subtract the NTFS time offset, then convert to 1s intervals. */
@@ -857,7 +859,7 @@ cifs_NTtimeToUnix(u64 ntutc)
857 859
858 t = ntutc - NTFS_TIME_OFFSET; 860 t = ntutc - NTFS_TIME_OFFSET;
859 ts.tv_nsec = do_div(t, 10000000) * 100; 861 ts.tv_nsec = do_div(t, 10000000) * 100;
860 ts.tv_sec = t; 862 ts.tv_sec = t;
861 return ts; 863 return ts;
862} 864}
863 865
@@ -885,20 +887,20 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time)
885 SMB_TIME * st = (SMB_TIME *)&time; 887 SMB_TIME * st = (SMB_TIME *)&time;
886 SMB_DATE * sd = (SMB_DATE *)&date; 888 SMB_DATE * sd = (SMB_DATE *)&date;
887 889
888 cFYI(1,("date %d time %d",date, time)); 890 cFYI(1, ("date %d time %d", date, time));
889 891
890 sec = 2 * st->TwoSeconds; 892 sec = 2 * st->TwoSeconds;
891 min = st->Minutes; 893 min = st->Minutes;
892 if ((sec > 59) || (min > 59)) 894 if ((sec > 59) || (min > 59))
893 cERROR(1,("illegal time min %d sec %d", min, sec)); 895 cERROR(1, ("illegal time min %d sec %d", min, sec));
894 sec += (min * 60); 896 sec += (min * 60);
895 sec += 60 * 60 * st->Hours; 897 sec += 60 * 60 * st->Hours;
896 if (st->Hours > 24) 898 if (st->Hours > 24)
897 cERROR(1,("illegal hours %d",st->Hours)); 899 cERROR(1, ("illegal hours %d", st->Hours));
898 days = sd->Day; 900 days = sd->Day;
899 month = sd->Month; 901 month = sd->Month;
900 if ((days > 31) || (month > 12)) 902 if ((days > 31) || (month > 12))
901 cERROR(1,("illegal date, month %d day: %d", month, days)); 903 cERROR(1, ("illegal date, month %d day: %d", month, days));
902 month -= 1; 904 month -= 1;
903 days += total_days_of_prev_months[month]; 905 days += total_days_of_prev_months[month];
904 days += 3652; /* account for difference in days between 1980 and 1970 */ 906 days += 3652; /* account for difference in days between 1980 and 1970 */
@@ -909,7 +911,7 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time)
909 for years/100 except for years/400, but since the maximum number for DOS 911 for years/100 except for years/400, but since the maximum number for DOS
910 year is 2**7, the last year is 1980+127, which means we need only 912 year is 2**7, the last year is 1980+127, which means we need only
911 consider 2 special case years, ie the years 2000 and 2100, and only 913 consider 2 special case years, ie the years 2000 and 2100, and only
912 adjust for the lack of leap year for the year 2100, as 2000 was a 914 adjust for the lack of leap year for the year 2100, as 2000 was a
913 leap year (divisable by 400) */ 915 leap year (divisable by 400) */
914 if (year >= 120) /* the year 2100 */ 916 if (year >= 120) /* the year 2100 */
915 days = days - 1; /* do not count leap year for the year 2100 */ 917 days = days - 1; /* do not count leap year for the year 2100 */
@@ -925,4 +927,4 @@ struct timespec cnvrtDosUnixTm(__u16 date, __u16 time)
925 927
926 ts.tv_nsec = 0; 928 ts.tv_nsec = 0;
927 return ts; 929 return ts;
928} 930}
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 19c8be4696f9..f519e1910191 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -101,7 +101,7 @@ static int construct_dentry(struct qstr *qstring, struct file *file,
101 if (*ptmp_inode == NULL) 101 if (*ptmp_inode == NULL)
102 return rc; 102 return rc;
103 if (file->f_path.dentry->d_sb->s_flags & MS_NOATIME) 103 if (file->f_path.dentry->d_sb->s_flags & MS_NOATIME)
104 (*ptmp_inode)->i_flags |= S_NOATIME | S_NOCMTIME; 104 (*ptmp_inode)->i_flags |= S_NOATIME | S_NOCMTIME;
105 rc = 2; 105 rc = 2;
106 } 106 }
107 107
@@ -431,14 +431,14 @@ static void unix_fill_in_inode(struct inode *tmp_inode,
431static int initiate_cifs_search(const int xid, struct file *file) 431static int initiate_cifs_search(const int xid, struct file *file)
432{ 432{
433 int rc = 0; 433 int rc = 0;
434 char * full_path; 434 char *full_path;
435 struct cifsFileInfo * cifsFile; 435 struct cifsFileInfo *cifsFile;
436 struct cifs_sb_info *cifs_sb; 436 struct cifs_sb_info *cifs_sb;
437 struct cifsTconInfo *pTcon; 437 struct cifsTconInfo *pTcon;
438 438
439 if (file->private_data == NULL) { 439 if (file->private_data == NULL) {
440 file->private_data = 440 file->private_data =
441 kzalloc(sizeof(struct cifsFileInfo),GFP_KERNEL); 441 kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL);
442 } 442 }
443 443
444 if (file->private_data == NULL) 444 if (file->private_data == NULL)
@@ -467,7 +467,7 @@ ffirst_retry:
467 /* test for Unix extensions */ 467 /* test for Unix extensions */
468 if (pTcon->ses->capabilities & CAP_UNIX) { 468 if (pTcon->ses->capabilities & CAP_UNIX) {
469 cifsFile->srch_inf.info_level = SMB_FIND_FILE_UNIX; 469 cifsFile->srch_inf.info_level = SMB_FIND_FILE_UNIX;
470 } else if ((pTcon->ses->capabilities & 470 } else if ((pTcon->ses->capabilities &
471 (CAP_NT_SMBS | CAP_NT_FIND)) == 0) { 471 (CAP_NT_SMBS | CAP_NT_FIND)) == 0) {
472 cifsFile->srch_inf.info_level = SMB_FIND_FILE_INFO_STANDARD; 472 cifsFile->srch_inf.info_level = SMB_FIND_FILE_INFO_STANDARD;
473 } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { 473 } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
@@ -476,13 +476,13 @@ ffirst_retry:
476 cifsFile->srch_inf.info_level = SMB_FIND_FILE_DIRECTORY_INFO; 476 cifsFile->srch_inf.info_level = SMB_FIND_FILE_DIRECTORY_INFO;
477 } 477 }
478 478
479 rc = CIFSFindFirst(xid, pTcon,full_path,cifs_sb->local_nls, 479 rc = CIFSFindFirst(xid, pTcon, full_path, cifs_sb->local_nls,
480 &cifsFile->netfid, &cifsFile->srch_inf, 480 &cifsFile->netfid, &cifsFile->srch_inf,
481 cifs_sb->mnt_cifs_flags & 481 cifs_sb->mnt_cifs_flags &
482 CIFS_MOUNT_MAP_SPECIAL_CHR, CIFS_DIR_SEP(cifs_sb)); 482 CIFS_MOUNT_MAP_SPECIAL_CHR, CIFS_DIR_SEP(cifs_sb));
483 if (rc == 0) 483 if (rc == 0)
484 cifsFile->invalidHandle = FALSE; 484 cifsFile->invalidHandle = FALSE;
485 if ((rc == -EOPNOTSUPP) && 485 if ((rc == -EOPNOTSUPP) &&
486 (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)) { 486 (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)) {
487 cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM; 487 cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM;
488 goto ffirst_retry; 488 goto ffirst_retry;
@@ -497,7 +497,7 @@ static int cifs_unicode_bytelen(char *str)
497 int len; 497 int len;
498 __le16 * ustr = (__le16 *)str; 498 __le16 * ustr = (__le16 *)str;
499 499
500 for(len=0;len <= PATH_MAX;len++) { 500 for (len = 0; len <= PATH_MAX; len++) {
501 if (ustr[len] == 0) 501 if (ustr[len] == 0)
502 return len << 1; 502 return len << 1;
503 } 503 }
@@ -507,7 +507,7 @@ static int cifs_unicode_bytelen(char *str)
507 507
508static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level) 508static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level)
509{ 509{
510 char * new_entry; 510 char *new_entry;
511 FILE_DIRECTORY_INFO * pDirInfo = (FILE_DIRECTORY_INFO *)old_entry; 511 FILE_DIRECTORY_INFO * pDirInfo = (FILE_DIRECTORY_INFO *)old_entry;
512 512
513 if (level == SMB_FIND_FILE_INFO_STANDARD) { 513 if (level == SMB_FIND_FILE_INFO_STANDARD) {
@@ -523,16 +523,16 @@ static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level)
523 if (new_entry >= end_of_smb) { 523 if (new_entry >= end_of_smb) {
524 cERROR(1, 524 cERROR(1,
525 ("search entry %p began after end of SMB %p old entry %p", 525 ("search entry %p began after end of SMB %p old entry %p",
526 new_entry, end_of_smb, old_entry)); 526 new_entry, end_of_smb, old_entry));
527 return NULL; 527 return NULL;
528 } else if (((level == SMB_FIND_FILE_INFO_STANDARD) && 528 } else if (((level == SMB_FIND_FILE_INFO_STANDARD) &&
529 (new_entry + sizeof(FIND_FILE_STANDARD_INFO) > end_of_smb)) || 529 (new_entry + sizeof(FIND_FILE_STANDARD_INFO) > end_of_smb))
530 ((level != SMB_FIND_FILE_INFO_STANDARD) && 530 || ((level != SMB_FIND_FILE_INFO_STANDARD) &&
531 (new_entry + sizeof(FILE_DIRECTORY_INFO) > end_of_smb))) { 531 (new_entry + sizeof(FILE_DIRECTORY_INFO) > end_of_smb))) {
532 cERROR(1,("search entry %p extends after end of SMB %p", 532 cERROR(1, ("search entry %p extends after end of SMB %p",
533 new_entry, end_of_smb)); 533 new_entry, end_of_smb));
534 return NULL; 534 return NULL;
535 } else 535 } else
536 return new_entry; 536 return new_entry;
537 537
538} 538}
@@ -543,8 +543,8 @@ static char *nxt_dir_entry(char *old_entry, char *end_of_smb, int level)
543static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile) 543static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile)
544{ 544{
545 int rc = 0; 545 int rc = 0;
546 char * filename = NULL; 546 char *filename = NULL;
547 int len = 0; 547 int len = 0;
548 548
549 if (cfile->srch_inf.info_level == SMB_FIND_FILE_UNIX) { 549 if (cfile->srch_inf.info_level == SMB_FIND_FILE_UNIX) {
550 FILE_UNIX_INFO * pFindData = (FILE_UNIX_INFO *)current_entry; 550 FILE_UNIX_INFO * pFindData = (FILE_UNIX_INFO *)current_entry;
@@ -556,25 +556,25 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile)
556 len = strnlen(filename, 5); 556 len = strnlen(filename, 5);
557 } 557 }
558 } else if (cfile->srch_inf.info_level == SMB_FIND_FILE_DIRECTORY_INFO) { 558 } else if (cfile->srch_inf.info_level == SMB_FIND_FILE_DIRECTORY_INFO) {
559 FILE_DIRECTORY_INFO * pFindData = 559 FILE_DIRECTORY_INFO * pFindData =
560 (FILE_DIRECTORY_INFO *)current_entry; 560 (FILE_DIRECTORY_INFO *)current_entry;
561 filename = &pFindData->FileName[0]; 561 filename = &pFindData->FileName[0];
562 len = le32_to_cpu(pFindData->FileNameLength); 562 len = le32_to_cpu(pFindData->FileNameLength);
563 } else if (cfile->srch_inf.info_level == 563 } else if (cfile->srch_inf.info_level ==
564 SMB_FIND_FILE_FULL_DIRECTORY_INFO) { 564 SMB_FIND_FILE_FULL_DIRECTORY_INFO) {
565 FILE_FULL_DIRECTORY_INFO * pFindData = 565 FILE_FULL_DIRECTORY_INFO * pFindData =
566 (FILE_FULL_DIRECTORY_INFO *)current_entry; 566 (FILE_FULL_DIRECTORY_INFO *)current_entry;
567 filename = &pFindData->FileName[0]; 567 filename = &pFindData->FileName[0];
568 len = le32_to_cpu(pFindData->FileNameLength); 568 len = le32_to_cpu(pFindData->FileNameLength);
569 } else if (cfile->srch_inf.info_level == 569 } else if (cfile->srch_inf.info_level ==
570 SMB_FIND_FILE_ID_FULL_DIR_INFO) { 570 SMB_FIND_FILE_ID_FULL_DIR_INFO) {
571 SEARCH_ID_FULL_DIR_INFO * pFindData = 571 SEARCH_ID_FULL_DIR_INFO * pFindData =
572 (SEARCH_ID_FULL_DIR_INFO *)current_entry; 572 (SEARCH_ID_FULL_DIR_INFO *)current_entry;
573 filename = &pFindData->FileName[0]; 573 filename = &pFindData->FileName[0];
574 len = le32_to_cpu(pFindData->FileNameLength); 574 len = le32_to_cpu(pFindData->FileNameLength);
575 } else if (cfile->srch_inf.info_level == 575 } else if (cfile->srch_inf.info_level ==
576 SMB_FIND_FILE_BOTH_DIRECTORY_INFO) { 576 SMB_FIND_FILE_BOTH_DIRECTORY_INFO) {
577 FILE_BOTH_DIRECTORY_INFO * pFindData = 577 FILE_BOTH_DIRECTORY_INFO * pFindData =
578 (FILE_BOTH_DIRECTORY_INFO *)current_entry; 578 (FILE_BOTH_DIRECTORY_INFO *)current_entry;
579 filename = &pFindData->FileName[0]; 579 filename = &pFindData->FileName[0];
580 len = le32_to_cpu(pFindData->FileNameLength); 580 len = le32_to_cpu(pFindData->FileNameLength);
@@ -598,12 +598,12 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile)
598 } else if (len == 4) { 598 } else if (len == 4) {
599 /* check for .. */ 599 /* check for .. */
600 if ((ufilename[0] == UNICODE_DOT) 600 if ((ufilename[0] == UNICODE_DOT)
601 &&(ufilename[1] == UNICODE_DOT)) 601 && (ufilename[1] == UNICODE_DOT))
602 rc = 2; 602 rc = 2;
603 } 603 }
604 } else /* ASCII */ { 604 } else /* ASCII */ {
605 if (len == 1) { 605 if (len == 1) {
606 if (filename[0] == '.') 606 if (filename[0] == '.')
607 rc = 1; 607 rc = 1;
608 } else if (len == 2) { 608 } else if (len == 2) {
609 if ((filename[0] == '.') && (filename[1] == '.')) 609 if ((filename[0] == '.') && (filename[1] == '.'))
@@ -617,7 +617,7 @@ static int cifs_entry_is_dot(char *current_entry, struct cifsFileInfo *cfile)
617 617
618/* Check if directory that we are searching has changed so we can decide 618/* Check if directory that we are searching has changed so we can decide
619 whether we can use the cached search results from the previous search */ 619 whether we can use the cached search results from the previous search */
620static int is_dir_changed(struct file * file) 620static int is_dir_changed(struct file *file)
621{ 621{
622 struct inode *inode = file->f_path.dentry->d_inode; 622 struct inode *inode = file->f_path.dentry->d_inode;
623 struct cifsInodeInfo *cifsInfo = CIFS_I(inode); 623 struct cifsInodeInfo *cifsInfo = CIFS_I(inode);
@@ -636,22 +636,22 @@ static int is_dir_changed(struct file * file)
636/* We start counting in the buffer with entry 2 and increment for every 636/* We start counting in the buffer with entry 2 and increment for every
637 entry (do not increment for . or .. entry) */ 637 entry (do not increment for . or .. entry) */
638static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon, 638static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
639 struct file *file, char **ppCurrentEntry, int *num_to_ret) 639 struct file *file, char **ppCurrentEntry, int *num_to_ret)
640{ 640{
641 int rc = 0; 641 int rc = 0;
642 int pos_in_buf = 0; 642 int pos_in_buf = 0;
643 loff_t first_entry_in_buffer; 643 loff_t first_entry_in_buffer;
644 loff_t index_to_find = file->f_pos; 644 loff_t index_to_find = file->f_pos;
645 struct cifsFileInfo * cifsFile = file->private_data; 645 struct cifsFileInfo *cifsFile = file->private_data;
646 /* check if index in the buffer */ 646 /* check if index in the buffer */
647 647
648 if ((cifsFile == NULL) || (ppCurrentEntry == NULL) || 648 if ((cifsFile == NULL) || (ppCurrentEntry == NULL) ||
649 (num_to_ret == NULL)) 649 (num_to_ret == NULL))
650 return -ENOENT; 650 return -ENOENT;
651 651
652 *ppCurrentEntry = NULL; 652 *ppCurrentEntry = NULL;
653 first_entry_in_buffer = 653 first_entry_in_buffer =
654 cifsFile->srch_inf.index_of_last_entry - 654 cifsFile->srch_inf.index_of_last_entry -
655 cifsFile->srch_inf.entries_in_buffer; 655 cifsFile->srch_inf.entries_in_buffer;
656 656
657 /* if first entry in buf is zero then is first buffer 657 /* if first entry in buf is zero then is first buffer
@@ -663,8 +663,8 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
663#ifdef CONFIG_CIFS_DEBUG2 663#ifdef CONFIG_CIFS_DEBUG2
664 dump_cifs_file_struct(file, "In fce "); 664 dump_cifs_file_struct(file, "In fce ");
665#endif 665#endif
666 if (((index_to_find < cifsFile->srch_inf.index_of_last_entry) && 666 if (((index_to_find < cifsFile->srch_inf.index_of_last_entry) &&
667 is_dir_changed(file)) || 667 is_dir_changed(file)) ||
668 (index_to_find < first_entry_in_buffer)) { 668 (index_to_find < first_entry_in_buffer)) {
669 /* close and restart search */ 669 /* close and restart search */
670 cFYI(1, ("search backing up - close and restart search")); 670 cFYI(1, ("search backing up - close and restart search"));
@@ -681,7 +681,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
681 cifs_buf_release(cifsFile->srch_inf. 681 cifs_buf_release(cifsFile->srch_inf.
682 ntwrk_buf_start); 682 ntwrk_buf_start);
683 } 683 }
684 rc = initiate_cifs_search(xid,file); 684 rc = initiate_cifs_search(xid, file);
685 if (rc) { 685 if (rc) {
686 cFYI(1, ("error %d reinitiating a search on rewind", 686 cFYI(1, ("error %d reinitiating a search on rewind",
687 rc)); 687 rc));
@@ -689,10 +689,10 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
689 } 689 }
690 } 690 }
691 691
692 while((index_to_find >= cifsFile->srch_inf.index_of_last_entry) && 692 while ((index_to_find >= cifsFile->srch_inf.index_of_last_entry) &&
693 (rc == 0) && (cifsFile->srch_inf.endOfSearch == FALSE)){ 693 (rc == 0) && (cifsFile->srch_inf.endOfSearch == FALSE)) {
694 cFYI(1, ("calling findnext2")); 694 cFYI(1, ("calling findnext2"));
695 rc = CIFSFindNext(xid,pTcon,cifsFile->netfid, 695 rc = CIFSFindNext(xid, pTcon, cifsFile->netfid,
696 &cifsFile->srch_inf); 696 &cifsFile->srch_inf);
697 if (rc) 697 if (rc)
698 return -ENOENT; 698 return -ENOENT;
@@ -701,8 +701,8 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
701 /* we found the buffer that contains the entry */ 701 /* we found the buffer that contains the entry */
702 /* scan and find it */ 702 /* scan and find it */
703 int i; 703 int i;
704 char * current_entry; 704 char *current_entry;
705 char * end_of_smb = cifsFile->srch_inf.ntwrk_buf_start + 705 char *end_of_smb = cifsFile->srch_inf.ntwrk_buf_start +
706 smbCalcSize((struct smb_hdr *) 706 smbCalcSize((struct smb_hdr *)
707 cifsFile->srch_inf.ntwrk_buf_start); 707 cifsFile->srch_inf.ntwrk_buf_start);
708 708
@@ -712,16 +712,16 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
712 pos_in_buf = index_to_find - first_entry_in_buffer; 712 pos_in_buf = index_to_find - first_entry_in_buffer;
713 cFYI(1, ("found entry - pos_in_buf %d", pos_in_buf)); 713 cFYI(1, ("found entry - pos_in_buf %d", pos_in_buf));
714 714
715 for(i=0;(i<(pos_in_buf)) && (current_entry != NULL);i++) { 715 for (i=0;(i<(pos_in_buf)) && (current_entry != NULL);i++) {
716 /* go entry by entry figuring out which is first */ 716 /* go entry by entry figuring out which is first */
717 current_entry = nxt_dir_entry(current_entry,end_of_smb, 717 current_entry = nxt_dir_entry(current_entry, end_of_smb,
718 cifsFile->srch_inf.info_level); 718 cifsFile->srch_inf.info_level);
719 } 719 }
720 if ((current_entry == NULL) && (i < pos_in_buf)) { 720 if ((current_entry == NULL) && (i < pos_in_buf)) {
721 /* BB fixme - check if we should flag this error */ 721 /* BB fixme - check if we should flag this error */
722 cERROR(1,("reached end of buf searching for pos in buf" 722 cERROR(1, ("reached end of buf searching for pos in buf"
723 " %d index to find %lld rc %d", 723 " %d index to find %lld rc %d",
724 pos_in_buf,index_to_find,rc)); 724 pos_in_buf, index_to_find, rc));
725 } 725 }
726 rc = 0; 726 rc = 0;
727 *ppCurrentEntry = current_entry; 727 *ppCurrentEntry = current_entry;
@@ -742,17 +742,17 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
742/* inode num, inode type and filename returned */ 742/* inode num, inode type and filename returned */
743static int cifs_get_name_from_search_buf(struct qstr *pqst, 743static int cifs_get_name_from_search_buf(struct qstr *pqst,
744 char *current_entry, __u16 level, unsigned int unicode, 744 char *current_entry, __u16 level, unsigned int unicode,
745 struct cifs_sb_info * cifs_sb, int max_len, ino_t *pinum) 745 struct cifs_sb_info *cifs_sb, int max_len, ino_t *pinum)
746{ 746{
747 int rc = 0; 747 int rc = 0;
748 unsigned int len = 0; 748 unsigned int len = 0;
749 char * filename; 749 char *filename;
750 struct nls_table * nlt = cifs_sb->local_nls; 750 struct nls_table *nlt = cifs_sb->local_nls;
751 751
752 *pinum = 0; 752 *pinum = 0;
753 753
754 if (level == SMB_FIND_FILE_UNIX) { 754 if (level == SMB_FIND_FILE_UNIX) {
755 FILE_UNIX_INFO * pFindData = (FILE_UNIX_INFO *)current_entry; 755 FILE_UNIX_INFO *pFindData = (FILE_UNIX_INFO *)current_entry;
756 756
757 filename = &pFindData->FileName[0]; 757 filename = &pFindData->FileName[0];
758 if (unicode) { 758 if (unicode) {
@@ -762,27 +762,27 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
762 len = strnlen(filename, PATH_MAX); 762 len = strnlen(filename, PATH_MAX);
763 } 763 }
764 764
765 /* BB fixme - hash low and high 32 bits if not 64 bit arch BB fixme */ 765 /* BB fixme - hash low and high 32 bits if not 64 bit arch BB */
766 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) 766 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)
767 *pinum = pFindData->UniqueId; 767 *pinum = pFindData->UniqueId;
768 } else if (level == SMB_FIND_FILE_DIRECTORY_INFO) { 768 } else if (level == SMB_FIND_FILE_DIRECTORY_INFO) {
769 FILE_DIRECTORY_INFO * pFindData = 769 FILE_DIRECTORY_INFO *pFindData =
770 (FILE_DIRECTORY_INFO *)current_entry; 770 (FILE_DIRECTORY_INFO *)current_entry;
771 filename = &pFindData->FileName[0]; 771 filename = &pFindData->FileName[0];
772 len = le32_to_cpu(pFindData->FileNameLength); 772 len = le32_to_cpu(pFindData->FileNameLength);
773 } else if (level == SMB_FIND_FILE_FULL_DIRECTORY_INFO) { 773 } else if (level == SMB_FIND_FILE_FULL_DIRECTORY_INFO) {
774 FILE_FULL_DIRECTORY_INFO * pFindData = 774 FILE_FULL_DIRECTORY_INFO *pFindData =
775 (FILE_FULL_DIRECTORY_INFO *)current_entry; 775 (FILE_FULL_DIRECTORY_INFO *)current_entry;
776 filename = &pFindData->FileName[0]; 776 filename = &pFindData->FileName[0];
777 len = le32_to_cpu(pFindData->FileNameLength); 777 len = le32_to_cpu(pFindData->FileNameLength);
778 } else if (level == SMB_FIND_FILE_ID_FULL_DIR_INFO) { 778 } else if (level == SMB_FIND_FILE_ID_FULL_DIR_INFO) {
779 SEARCH_ID_FULL_DIR_INFO * pFindData = 779 SEARCH_ID_FULL_DIR_INFO *pFindData =
780 (SEARCH_ID_FULL_DIR_INFO *)current_entry; 780 (SEARCH_ID_FULL_DIR_INFO *)current_entry;
781 filename = &pFindData->FileName[0]; 781 filename = &pFindData->FileName[0];
782 len = le32_to_cpu(pFindData->FileNameLength); 782 len = le32_to_cpu(pFindData->FileNameLength);
783 *pinum = pFindData->UniqueId; 783 *pinum = pFindData->UniqueId;
784 } else if (level == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) { 784 } else if (level == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) {
785 FILE_BOTH_DIRECTORY_INFO * pFindData = 785 FILE_BOTH_DIRECTORY_INFO *pFindData =
786 (FILE_BOTH_DIRECTORY_INFO *)current_entry; 786 (FILE_BOTH_DIRECTORY_INFO *)current_entry;
787 filename = &pFindData->FileName[0]; 787 filename = &pFindData->FileName[0];
788 len = le32_to_cpu(pFindData->FileNameLength); 788 len = le32_to_cpu(pFindData->FileNameLength);
@@ -798,7 +798,7 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
798 } 798 }
799 799
800 if (len > max_len) { 800 if (len > max_len) {
801 cERROR(1,("bad search response length %d past smb end", len)); 801 cERROR(1, ("bad search response length %d past smb end", len));
802 return -EINVAL; 802 return -EINVAL;
803 } 803 }
804 804
@@ -810,12 +810,12 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
810 (__le16 *)filename, len/2, nlt); 810 (__le16 *)filename, len/2, nlt);
811 else 811 else
812 pqst->len = cifs_strfromUCS_le((char *)pqst->name, 812 pqst->len = cifs_strfromUCS_le((char *)pqst->name,
813 (__le16 *)filename,len/2,nlt); 813 (__le16 *)filename, len/2, nlt);
814 } else { 814 } else {
815 pqst->name = filename; 815 pqst->name = filename;
816 pqst->len = len; 816 pqst->len = len;
817 } 817 }
818 pqst->hash = full_name_hash(pqst->name,pqst->len); 818 pqst->hash = full_name_hash(pqst->name, pqst->len);
819/* cFYI(1, ("filldir on %s",pqst->name)); */ 819/* cFYI(1, ("filldir on %s",pqst->name)); */
820 return rc; 820 return rc;
821} 821}
@@ -825,10 +825,10 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
825{ 825{
826 int rc = 0; 826 int rc = 0;
827 struct qstr qstring; 827 struct qstr qstring;
828 struct cifsFileInfo * pCifsF; 828 struct cifsFileInfo *pCifsF;
829 unsigned obj_type; 829 unsigned obj_type;
830 ino_t inum; 830 ino_t inum;
831 struct cifs_sb_info * cifs_sb; 831 struct cifs_sb_info *cifs_sb;
832 struct inode *tmp_inode; 832 struct inode *tmp_inode;
833 struct dentry *tmp_dentry; 833 struct dentry *tmp_dentry;
834 834
@@ -843,7 +843,7 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
843 if ((scratch_buf == NULL) || (pfindEntry == NULL) || (pCifsF == NULL)) 843 if ((scratch_buf == NULL) || (pfindEntry == NULL) || (pCifsF == NULL))
844 return -ENOENT; 844 return -ENOENT;
845 845
846 rc = cifs_entry_is_dot(pfindEntry,pCifsF); 846 rc = cifs_entry_is_dot(pfindEntry, pCifsF);
847 /* skip . and .. since we added them first */ 847 /* skip . and .. since we added them first */
848 if (rc != 0) 848 if (rc != 0)
849 return 0; 849 return 0;
@@ -851,23 +851,24 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
851 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); 851 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
852 852
853 qstring.name = scratch_buf; 853 qstring.name = scratch_buf;
854 rc = cifs_get_name_from_search_buf(&qstring,pfindEntry, 854 rc = cifs_get_name_from_search_buf(&qstring, pfindEntry,
855 pCifsF->srch_inf.info_level, 855 pCifsF->srch_inf.info_level,
856 pCifsF->srch_inf.unicode,cifs_sb, 856 pCifsF->srch_inf.unicode, cifs_sb,
857 max_len, 857 max_len,
858 &inum /* returned */); 858 &inum /* returned */);
859 859
860 if (rc) 860 if (rc)
861 return rc; 861 return rc;
862 862
863 rc = construct_dentry(&qstring,file,&tmp_inode, &tmp_dentry); 863 rc = construct_dentry(&qstring, file, &tmp_inode, &tmp_dentry);
864 if ((tmp_inode == NULL) || (tmp_dentry == NULL)) 864 if ((tmp_inode == NULL) || (tmp_dentry == NULL))
865 return -ENOMEM; 865 return -ENOMEM;
866 866
867 if (rc) { 867 if (rc) {
868 /* inode created, we need to hash it with right inode number */ 868 /* inode created, we need to hash it with right inode number */
869 if (inum != 0) { 869 if (inum != 0) {
870 /* BB fixme - hash the 2 32 quantities bits together if necessary BB */ 870 /* BB fixme - hash the 2 32 quantities bits together if
871 * necessary BB */
871 tmp_inode->i_ino = inum; 872 tmp_inode->i_ino = inum;
872 } 873 }
873 insert_inode_hash(tmp_inode); 874 insert_inode_hash(tmp_inode);
@@ -892,9 +893,9 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
892 d_rehash(tmp_dentry); 893 d_rehash(tmp_dentry);
893 } 894 }
894 895
895 896
896 rc = filldir(direntry,qstring.name,qstring.len,file->f_pos, 897 rc = filldir(direntry, qstring.name, qstring.len, file->f_pos,
897 tmp_inode->i_ino,obj_type); 898 tmp_inode->i_ino, obj_type);
898 if (rc) { 899 if (rc) {
899 cFYI(1, ("filldir rc = %d", rc)); 900 cFYI(1, ("filldir rc = %d", rc));
900 /* we can not return filldir errors to the caller 901 /* we can not return filldir errors to the caller
@@ -913,7 +914,7 @@ static int cifs_save_resume_key(const char *current_entry,
913 int rc = 0; 914 int rc = 0;
914 unsigned int len = 0; 915 unsigned int len = 0;
915 __u16 level; 916 __u16 level;
916 char * filename; 917 char *filename;
917 918
918 if ((cifsFile == NULL) || (current_entry == NULL)) 919 if ((cifsFile == NULL) || (current_entry == NULL))
919 return -EINVAL; 920 return -EINVAL;
@@ -932,31 +933,31 @@ static int cifs_save_resume_key(const char *current_entry,
932 } 933 }
933 cifsFile->srch_inf.resume_key = pFindData->ResumeKey; 934 cifsFile->srch_inf.resume_key = pFindData->ResumeKey;
934 } else if (level == SMB_FIND_FILE_DIRECTORY_INFO) { 935 } else if (level == SMB_FIND_FILE_DIRECTORY_INFO) {
935 FILE_DIRECTORY_INFO * pFindData = 936 FILE_DIRECTORY_INFO *pFindData =
936 (FILE_DIRECTORY_INFO *)current_entry; 937 (FILE_DIRECTORY_INFO *)current_entry;
937 filename = &pFindData->FileName[0]; 938 filename = &pFindData->FileName[0];
938 len = le32_to_cpu(pFindData->FileNameLength); 939 len = le32_to_cpu(pFindData->FileNameLength);
939 cifsFile->srch_inf.resume_key = pFindData->FileIndex; 940 cifsFile->srch_inf.resume_key = pFindData->FileIndex;
940 } else if (level == SMB_FIND_FILE_FULL_DIRECTORY_INFO) { 941 } else if (level == SMB_FIND_FILE_FULL_DIRECTORY_INFO) {
941 FILE_FULL_DIRECTORY_INFO * pFindData = 942 FILE_FULL_DIRECTORY_INFO *pFindData =
942 (FILE_FULL_DIRECTORY_INFO *)current_entry; 943 (FILE_FULL_DIRECTORY_INFO *)current_entry;
943 filename = &pFindData->FileName[0]; 944 filename = &pFindData->FileName[0];
944 len = le32_to_cpu(pFindData->FileNameLength); 945 len = le32_to_cpu(pFindData->FileNameLength);
945 cifsFile->srch_inf.resume_key = pFindData->FileIndex; 946 cifsFile->srch_inf.resume_key = pFindData->FileIndex;
946 } else if (level == SMB_FIND_FILE_ID_FULL_DIR_INFO) { 947 } else if (level == SMB_FIND_FILE_ID_FULL_DIR_INFO) {
947 SEARCH_ID_FULL_DIR_INFO * pFindData = 948 SEARCH_ID_FULL_DIR_INFO *pFindData =
948 (SEARCH_ID_FULL_DIR_INFO *)current_entry; 949 (SEARCH_ID_FULL_DIR_INFO *)current_entry;
949 filename = &pFindData->FileName[0]; 950 filename = &pFindData->FileName[0];
950 len = le32_to_cpu(pFindData->FileNameLength); 951 len = le32_to_cpu(pFindData->FileNameLength);
951 cifsFile->srch_inf.resume_key = pFindData->FileIndex; 952 cifsFile->srch_inf.resume_key = pFindData->FileIndex;
952 } else if (level == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) { 953 } else if (level == SMB_FIND_FILE_BOTH_DIRECTORY_INFO) {
953 FILE_BOTH_DIRECTORY_INFO * pFindData = 954 FILE_BOTH_DIRECTORY_INFO *pFindData =
954 (FILE_BOTH_DIRECTORY_INFO *)current_entry; 955 (FILE_BOTH_DIRECTORY_INFO *)current_entry;
955 filename = &pFindData->FileName[0]; 956 filename = &pFindData->FileName[0];
956 len = le32_to_cpu(pFindData->FileNameLength); 957 len = le32_to_cpu(pFindData->FileNameLength);
957 cifsFile->srch_inf.resume_key = pFindData->FileIndex; 958 cifsFile->srch_inf.resume_key = pFindData->FileIndex;
958 } else if (level == SMB_FIND_FILE_INFO_STANDARD) { 959 } else if (level == SMB_FIND_FILE_INFO_STANDARD) {
959 FIND_FILE_STANDARD_INFO * pFindData = 960 FIND_FILE_STANDARD_INFO *pFindData =
960 (FIND_FILE_STANDARD_INFO *)current_entry; 961 (FIND_FILE_STANDARD_INFO *)current_entry;
961 filename = &pFindData->FileName[0]; 962 filename = &pFindData->FileName[0];
962 /* one byte length, no name conversion */ 963 /* one byte length, no name conversion */
@@ -974,13 +975,13 @@ static int cifs_save_resume_key(const char *current_entry,
974int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) 975int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
975{ 976{
976 int rc = 0; 977 int rc = 0;
977 int xid,i; 978 int xid, i;
978 struct cifs_sb_info *cifs_sb; 979 struct cifs_sb_info *cifs_sb;
979 struct cifsTconInfo *pTcon; 980 struct cifsTconInfo *pTcon;
980 struct cifsFileInfo *cifsFile = NULL; 981 struct cifsFileInfo *cifsFile = NULL;
981 char * current_entry; 982 char *current_entry;
982 int num_to_fill = 0; 983 int num_to_fill = 0;
983 char * tmp_buf = NULL; 984 char *tmp_buf = NULL;
984 char * end_of_smb; 985 char * end_of_smb;
985 int max_len; 986 int max_len;
986 987
@@ -1009,13 +1010,13 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
1009 } 1010 }
1010 file->f_pos++; 1011 file->f_pos++;
1011 default: 1012 default:
1012 /* 1) If search is active, 1013 /* 1) If search is active,
1013 is in current search buffer? 1014 is in current search buffer?
1014 if it before then restart search 1015 if it before then restart search
1015 if after then keep searching till find it */ 1016 if after then keep searching till find it */
1016 1017
1017 if (file->private_data == NULL) { 1018 if (file->private_data == NULL) {
1018 rc = initiate_cifs_search(xid,file); 1019 rc = initiate_cifs_search(xid, file);
1019 cFYI(1, ("initiate cifs search rc %d", rc)); 1020 cFYI(1, ("initiate cifs search rc %d", rc));
1020 if (rc) { 1021 if (rc) {
1021 FreeXid(xid); 1022 FreeXid(xid);
@@ -1037,12 +1038,12 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
1037 } /* else { 1038 } /* else {
1038 cifsFile->invalidHandle = TRUE; 1039 cifsFile->invalidHandle = TRUE;
1039 CIFSFindClose(xid, pTcon, cifsFile->netfid); 1040 CIFSFindClose(xid, pTcon, cifsFile->netfid);
1040 } 1041 }
1041 kfree(cifsFile->search_resume_name); 1042 kfree(cifsFile->search_resume_name);
1042 cifsFile->search_resume_name = NULL; */ 1043 cifsFile->search_resume_name = NULL; */
1043 1044
1044 rc = find_cifs_entry(xid,pTcon, file, 1045 rc = find_cifs_entry(xid, pTcon, file,
1045 &current_entry,&num_to_fill); 1046 &current_entry, &num_to_fill);
1046 if (rc) { 1047 if (rc) {
1047 cFYI(1, ("fce error %d", rc)); 1048 cFYI(1, ("fce error %d", rc));
1048 goto rddir2_exit; 1049 goto rddir2_exit;
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 623c86cded24..b3f9d40d06db 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -75,7 +75,7 @@ static __u32 cifs_ssetup_hdr(struct cifsSesInfo *ses, SESSION_SETUP_ANDX *pSMB)
75 return capabilities; 75 return capabilities;
76} 76}
77 77
78static void unicode_ssetup_strings(char ** pbcc_area, struct cifsSesInfo *ses, 78static void unicode_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses,
79 const struct nls_table *nls_cp) 79 const struct nls_table *nls_cp)
80{ 80{
81 char *bcc_ptr = *pbcc_area; 81 char *bcc_ptr = *pbcc_area;
@@ -108,7 +108,7 @@ static void unicode_ssetup_strings(char ** pbcc_area, struct cifsSesInfo *ses,
108 *(bcc_ptr+1) = 0; 108 *(bcc_ptr+1) = 0;
109 bytes_ret = 0; 109 bytes_ret = 0;
110 } else 110 } else
111 bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, ses->domainName, 111 bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, ses->domainName,
112 256, nls_cp); 112 256, nls_cp);
113 bcc_ptr += 2 * bytes_ret; 113 bcc_ptr += 2 * bytes_ret;
114 bcc_ptr += 2; /* account for null terminator */ 114 bcc_ptr += 2; /* account for null terminator */
@@ -130,7 +130,7 @@ static void unicode_ssetup_strings(char ** pbcc_area, struct cifsSesInfo *ses,
130 *pbcc_area = bcc_ptr; 130 *pbcc_area = bcc_ptr;
131} 131}
132 132
133static void ascii_ssetup_strings(char ** pbcc_area, struct cifsSesInfo *ses, 133static void ascii_ssetup_strings(char **pbcc_area, struct cifsSesInfo *ses,
134 const struct nls_table *nls_cp) 134 const struct nls_table *nls_cp)
135{ 135{
136 char *bcc_ptr = *pbcc_area; 136 char *bcc_ptr = *pbcc_area;
@@ -468,7 +468,8 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
468 468
469 /* memcpy(bcc_ptr, (char *)ntlm_session_key,LM2_SESS_KEY_SIZE); 469 /* memcpy(bcc_ptr, (char *)ntlm_session_key,LM2_SESS_KEY_SIZE);
470 bcc_ptr += LM2_SESS_KEY_SIZE; */ 470 bcc_ptr += LM2_SESS_KEY_SIZE; */
471 memcpy(bcc_ptr, (char *)v2_sess_key, sizeof(struct ntlmv2_resp)); 471 memcpy(bcc_ptr, (char *)v2_sess_key,
472 sizeof(struct ntlmv2_resp));
472 bcc_ptr += sizeof(struct ntlmv2_resp); 473 bcc_ptr += sizeof(struct ntlmv2_resp);
473 kfree(v2_sess_key); 474 kfree(v2_sess_key);
474 if (ses->capabilities & CAP_UNICODE) { 475 if (ses->capabilities & CAP_UNICODE) {
diff --git a/fs/cifs/smbdes.c b/fs/cifs/smbdes.c
index 1b1daf63f062..1e92559cb8cf 100644
--- a/fs/cifs/smbdes.c
+++ b/fs/cifs/smbdes.c
@@ -1,8 +1,8 @@
1/* 1/*
2 Unix SMB/Netbios implementation. 2 Unix SMB/Netbios implementation.
3 Version 1.9. 3 Version 1.9.
4 4
5 a partial implementation of DES designed for use in the 5 a partial implementation of DES designed for use in the
6 SMB authentication protocol 6 SMB authentication protocol
7 7
8 Copyright (C) Andrew Tridgell 1998 8 Copyright (C) Andrew Tridgell 1998
@@ -23,10 +23,10 @@
23 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 23 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24*/ 24*/
25 25
26/* NOTES: 26/* NOTES:
27 27
28 This code makes no attempt to be fast! In fact, it is a very 28 This code makes no attempt to be fast! In fact, it is a very
29 slow implementation 29 slow implementation
30 30
31 This code is NOT a complete DES implementation. It implements only 31 This code is NOT a complete DES implementation. It implements only
32 the minimum necessary for SMB authentication, as used by all SMB 32 the minimum necessary for SMB authentication, as used by all SMB
@@ -153,7 +153,7 @@ static uchar sbox[8][4][16] = {
153}; 153};
154 154
155static void 155static void
156permute(char *out, char *in, uchar * p, int n) 156permute(char *out, char *in, uchar *p, int n)
157{ 157{
158 int i; 158 int i;
159 for (i = 0; i < n; i++) 159 for (i = 0; i < n; i++)
@@ -202,18 +202,18 @@ dohash(char *out, char *in, char *key, int forw)
202 char *rl; 202 char *rl;
203 203
204 /* Have to reduce stack usage */ 204 /* Have to reduce stack usage */
205 pk1 = kmalloc(56+56+64+64,GFP_KERNEL); 205 pk1 = kmalloc(56+56+64+64, GFP_KERNEL);
206 if(pk1 == NULL) 206 if (pk1 == NULL)
207 return; 207 return;
208 208
209 ki = kmalloc(16*48, GFP_KERNEL); 209 ki = kmalloc(16*48, GFP_KERNEL);
210 if(ki == NULL) { 210 if (ki == NULL) {
211 kfree(pk1); 211 kfree(pk1);
212 return; 212 return;
213 } 213 }
214 214
215 cd = pk1 + 56; 215 cd = pk1 + 56;
216 pd1= cd + 56; 216 pd1 = cd + 56;
217 rl = pd1 + 64; 217 rl = pd1 + 64;
218 218
219 permute(pk1, key, perm1, 56); 219 permute(pk1, key, perm1, 56);
@@ -247,7 +247,7 @@ dohash(char *out, char *in, char *key, int forw)
247 char *r2; /* r2[32] */ 247 char *r2; /* r2[32] */
248 248
249 er = kmalloc(48+48+32+32+32, GFP_KERNEL); 249 er = kmalloc(48+48+32+32+32, GFP_KERNEL);
250 if(er == NULL) { 250 if (er == NULL) {
251 kfree(pk1); 251 kfree(pk1);
252 kfree(ki); 252 kfree(ki);
253 return; 253 return;
@@ -327,8 +327,8 @@ smbhash(unsigned char *out, unsigned char *in, unsigned char *key, int forw)
327 char *keyb; /* keyb[64] */ 327 char *keyb; /* keyb[64] */
328 unsigned char key2[8]; 328 unsigned char key2[8];
329 329
330 outb = kmalloc(64 * 3,GFP_KERNEL); 330 outb = kmalloc(64 * 3, GFP_KERNEL);
331 if(outb == NULL) 331 if (outb == NULL)
332 return; 332 return;
333 333
334 inb = outb + 64; 334 inb = outb + 64;