aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/netmisc.c
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 /fs/cifs/netmisc.c
parent790fe579f5006b72dfd2814f9263a73b0b455e81 (diff)
[CIFS] more whitespace fixes
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/netmisc.c')
-rw-r--r--fs/cifs/netmisc.c82
1 files changed, 42 insertions, 40 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}