diff options
author | Steve French <sfrench@us.ibm.com> | 2005-11-15 19:45:16 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2005-11-15 19:45:16 -0500 |
commit | ff7feac9638e162263463edaeb342b4f3b1ce90e (patch) | |
tree | 9648611f4ff41bb3e16b1ace87e4bf3802075d99 /fs/cifs | |
parent | d6e2f2a4c892e4d131ab4fa5d212546c47dd3c40 (diff) |
[CIFS] Fix endian errors (setfacl/getfacl failures) in handling ACLs
(and a ppc64 compiler warning)
Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/cifssmb.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 8dbd8c2c0e3b..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 |
@@ -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; |