diff options
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r-- | fs/cifs/cifssmb.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index a53c596e1082..d179b0c3eee4 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -1142,7 +1142,9 @@ CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon, | |||
1142 | int bytes_returned, wct; | 1142 | int bytes_returned, wct; |
1143 | int smb_hdr_len; | 1143 | int smb_hdr_len; |
1144 | 1144 | ||
1145 | cFYI(1,("write2 at %lld %d bytes",offset,count)); /* BB removeme BB */ | 1145 | /* BB removeme BB */ |
1146 | cFYI(1,("write2 at %lld %d bytes", (long long)offset, count)); | ||
1147 | |||
1146 | if(tcon->ses->capabilities & CAP_LARGE_FILES) | 1148 | if(tcon->ses->capabilities & CAP_LARGE_FILES) |
1147 | wct = 14; | 1149 | wct = 14; |
1148 | else | 1150 | else |
@@ -1553,7 +1555,7 @@ createSymLinkRetry: | |||
1553 | 1555 | ||
1554 | if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { | 1556 | if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { |
1555 | name_len = | 1557 | name_len = |
1556 | cifs_strtoUCS((wchar_t *) pSMB->FileName, fromName, PATH_MAX | 1558 | cifs_strtoUCS((__le16 *) pSMB->FileName, fromName, PATH_MAX |
1557 | /* find define for this maxpathcomponent */ | 1559 | /* find define for this maxpathcomponent */ |
1558 | , nls_codepage); | 1560 | , nls_codepage); |
1559 | name_len++; /* trailing null */ | 1561 | name_len++; /* trailing null */ |
@@ -1577,7 +1579,7 @@ createSymLinkRetry: | |||
1577 | data_offset = (char *) (&pSMB->hdr.Protocol) + offset; | 1579 | data_offset = (char *) (&pSMB->hdr.Protocol) + offset; |
1578 | if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { | 1580 | if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { |
1579 | name_len_target = | 1581 | name_len_target = |
1580 | cifs_strtoUCS((wchar_t *) data_offset, toName, PATH_MAX | 1582 | cifs_strtoUCS((__le16 *) data_offset, toName, PATH_MAX |
1581 | /* find define for this maxpathcomponent */ | 1583 | /* find define for this maxpathcomponent */ |
1582 | , nls_codepage); | 1584 | , nls_codepage); |
1583 | name_len_target++; /* trailing null */ | 1585 | name_len_target++; /* trailing null */ |
@@ -1803,7 +1805,7 @@ querySymLinkRetry: | |||
1803 | 1805 | ||
1804 | if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { | 1806 | if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { |
1805 | name_len = | 1807 | name_len = |
1806 | cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX | 1808 | cifs_strtoUCS((__le16 *) pSMB->FileName, searchName, PATH_MAX |
1807 | /* find define for this maxpathcomponent */ | 1809 | /* find define for this maxpathcomponent */ |
1808 | , nls_codepage); | 1810 | , nls_codepage); |
1809 | name_len++; /* trailing null */ | 1811 | name_len++; /* trailing null */ |
@@ -1860,7 +1862,7 @@ querySymLinkRetry: | |||
1860 | min_t(const int, buflen,count) / 2); | 1862 | min_t(const int, buflen,count) / 2); |
1861 | /* BB FIXME investigate remapping reserved chars here */ | 1863 | /* BB FIXME investigate remapping reserved chars here */ |
1862 | cifs_strfromUCS_le(symlinkinfo, | 1864 | cifs_strfromUCS_le(symlinkinfo, |
1863 | (wchar_t *) ((char *)&pSMBr->hdr.Protocol + | 1865 | (__le16 *) ((char *)&pSMBr->hdr.Protocol + |
1864 | data_offset), | 1866 | data_offset), |
1865 | name_len, nls_codepage); | 1867 | name_len, nls_codepage); |
1866 | } else { | 1868 | } else { |
@@ -1951,7 +1953,7 @@ CIFSSMBQueryReparseLinkInfo(const int xid, struct cifsTconInfo *tcon, | |||
1951 | reparse_buf->TargetNameOffset), | 1953 | reparse_buf->TargetNameOffset), |
1952 | min(buflen/2, reparse_buf->TargetNameLen / 2)); | 1954 | min(buflen/2, reparse_buf->TargetNameLen / 2)); |
1953 | cifs_strfromUCS_le(symlinkinfo, | 1955 | cifs_strfromUCS_le(symlinkinfo, |
1954 | (wchar_t *) (reparse_buf->LinkNamesBuf + | 1956 | (__le16 *) (reparse_buf->LinkNamesBuf + |
1955 | reparse_buf->TargetNameOffset), | 1957 | reparse_buf->TargetNameOffset), |
1956 | name_len, nls_codepage); | 1958 | name_len, nls_codepage); |
1957 | } else { /* ASCII names */ | 1959 | } else { /* ASCII names */ |
@@ -1983,9 +1985,9 @@ qreparse_out: | |||
1983 | static void cifs_convert_ace(posix_acl_xattr_entry * ace, struct cifs_posix_ace * cifs_ace) | 1985 | static void cifs_convert_ace(posix_acl_xattr_entry * ace, struct cifs_posix_ace * cifs_ace) |
1984 | { | 1986 | { |
1985 | /* u8 cifs fields do not need le conversion */ | 1987 | /* u8 cifs fields do not need le conversion */ |
1986 | ace->e_perm = (__u16)cifs_ace->cifs_e_perm; | 1988 | ace->e_perm = cpu_to_le16(cifs_ace->cifs_e_perm); |
1987 | ace->e_tag = (__u16)cifs_ace->cifs_e_tag; | 1989 | ace->e_tag = cpu_to_le16(cifs_ace->cifs_e_tag); |
1988 | ace->e_id = (__u32)le64_to_cpu(cifs_ace->cifs_uid); | 1990 | ace->e_id = cpu_to_le32(le64_to_cpu(cifs_ace->cifs_uid)); |
1989 | /* cFYI(1,("perm %d tag %d id %d",ace->e_perm,ace->e_tag,ace->e_id)); */ | 1991 | /* cFYI(1,("perm %d tag %d id %d",ace->e_perm,ace->e_tag,ace->e_id)); */ |
1990 | 1992 | ||
1991 | return; | 1993 | return; |
@@ -2037,7 +2039,7 @@ static int cifs_copy_posix_acl(char * trgt,char * src, const int buflen, | |||
2037 | } else if(size > buflen) { | 2039 | } else if(size > buflen) { |
2038 | return -ERANGE; | 2040 | return -ERANGE; |
2039 | } else /* buffer big enough */ { | 2041 | } else /* buffer big enough */ { |
2040 | local_acl->a_version = POSIX_ACL_XATTR_VERSION; | 2042 | local_acl->a_version = cpu_to_le32(POSIX_ACL_XATTR_VERSION); |
2041 | for(i = 0;i < count ;i++) { | 2043 | for(i = 0;i < count ;i++) { |
2042 | cifs_convert_ace(&local_acl->a_entries[i],pACE); | 2044 | cifs_convert_ace(&local_acl->a_entries[i],pACE); |
2043 | pACE ++; | 2045 | pACE ++; |
@@ -2051,14 +2053,14 @@ static __u16 convert_ace_to_cifs_ace(struct cifs_posix_ace * cifs_ace, | |||
2051 | { | 2053 | { |
2052 | __u16 rc = 0; /* 0 = ACL converted ok */ | 2054 | __u16 rc = 0; /* 0 = ACL converted ok */ |
2053 | 2055 | ||
2054 | cifs_ace->cifs_e_perm = (__u8)cpu_to_le16(local_ace->e_perm); | 2056 | cifs_ace->cifs_e_perm = le16_to_cpu(local_ace->e_perm); |
2055 | cifs_ace->cifs_e_tag = (__u8)cpu_to_le16(local_ace->e_tag); | 2057 | cifs_ace->cifs_e_tag = le16_to_cpu(local_ace->e_tag); |
2056 | /* BB is there a better way to handle the large uid? */ | 2058 | /* BB is there a better way to handle the large uid? */ |
2057 | if(local_ace->e_id == -1) { | 2059 | if(local_ace->e_id == cpu_to_le32(-1)) { |
2058 | /* Probably no need to le convert -1 on any arch but can not hurt */ | 2060 | /* Probably no need to le convert -1 on any arch but can not hurt */ |
2059 | cifs_ace->cifs_uid = cpu_to_le64(-1); | 2061 | cifs_ace->cifs_uid = cpu_to_le64(-1); |
2060 | } else | 2062 | } else |
2061 | cifs_ace->cifs_uid = (__u64)cpu_to_le32(local_ace->e_id); | 2063 | cifs_ace->cifs_uid = cpu_to_le64(le32_to_cpu(local_ace->e_id)); |
2062 | /*cFYI(1,("perm %d tag %d id %d",ace->e_perm,ace->e_tag,ace->e_id));*/ | 2064 | /*cFYI(1,("perm %d tag %d id %d",ace->e_perm,ace->e_tag,ace->e_id));*/ |
2063 | return rc; | 2065 | return rc; |
2064 | } | 2066 | } |
@@ -2078,16 +2080,17 @@ static __u16 ACL_to_cifs_posix(char * parm_data,const char * pACL,const int bufl | |||
2078 | 2080 | ||
2079 | count = posix_acl_xattr_count((size_t)buflen); | 2081 | count = posix_acl_xattr_count((size_t)buflen); |
2080 | cFYI(1,("setting acl with %d entries from buf of length %d and version of %d", | 2082 | cFYI(1,("setting acl with %d entries from buf of length %d and version of %d", |
2081 | count,buflen,local_acl->a_version)); | 2083 | count, buflen, le32_to_cpu(local_acl->a_version))); |
2082 | if(local_acl->a_version != 2) { | 2084 | if(le32_to_cpu(local_acl->a_version) != 2) { |
2083 | cFYI(1,("unknown POSIX ACL version %d",local_acl->a_version)); | 2085 | cFYI(1,("unknown POSIX ACL version %d", |
2086 | le32_to_cpu(local_acl->a_version))); | ||
2084 | return 0; | 2087 | return 0; |
2085 | } | 2088 | } |
2086 | cifs_acl->version = cpu_to_le16(1); | 2089 | cifs_acl->version = cpu_to_le16(1); |
2087 | if(acl_type == ACL_TYPE_ACCESS) | 2090 | if(acl_type == ACL_TYPE_ACCESS) |
2088 | cifs_acl->access_entry_count = count; | 2091 | cifs_acl->access_entry_count = cpu_to_le16(count); |
2089 | else if(acl_type == ACL_TYPE_DEFAULT) | 2092 | else if(acl_type == ACL_TYPE_DEFAULT) |
2090 | cifs_acl->default_entry_count = count; | 2093 | cifs_acl->default_entry_count = cpu_to_le16(count); |
2091 | else { | 2094 | else { |
2092 | cFYI(1,("unknown ACL type %d",acl_type)); | 2095 | cFYI(1,("unknown ACL type %d",acl_type)); |
2093 | return 0; | 2096 | return 0; |
@@ -3203,7 +3206,7 @@ getDFSRetry: | |||
3203 | temp = ((char *)referrals) + le16_to_cpu(referrals->DfsPathOffset); | 3206 | temp = ((char *)referrals) + le16_to_cpu(referrals->DfsPathOffset); |
3204 | if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) { | 3207 | if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) { |
3205 | cifs_strfromUCS_le(*targetUNCs, | 3208 | cifs_strfromUCS_le(*targetUNCs, |
3206 | (wchar_t *) temp, name_len, nls_codepage); | 3209 | (__le16 *) temp, name_len, nls_codepage); |
3207 | } else { | 3210 | } else { |
3208 | strncpy(*targetUNCs,temp,name_len); | 3211 | strncpy(*targetUNCs,temp,name_len); |
3209 | } | 3212 | } |