diff options
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/CHANGES | 2 | ||||
-rw-r--r-- | fs/cifs/cifs_unicode.c | 13 | ||||
-rw-r--r-- | fs/cifs/cifs_unicode.h | 6 | ||||
-rw-r--r-- | fs/cifs/cifsencrypt.c | 2 | ||||
-rw-r--r-- | fs/cifs/cifsfs.c | 40 | ||||
-rw-r--r-- | fs/cifs/cifsfs.h | 2 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 43 | ||||
-rw-r--r-- | fs/cifs/connect.c | 91 | ||||
-rw-r--r-- | fs/cifs/inode.c | 114 | ||||
-rw-r--r-- | fs/cifs/misc.c | 2 | ||||
-rw-r--r-- | fs/cifs/readdir.c | 12 |
11 files changed, 218 insertions, 109 deletions
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index eab3750cf304..289e4079c96b 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES | |||
@@ -3,6 +3,8 @@ Version 1.39 | |||
3 | Defer close of a file handle slightly if pending writes depend on that file handle | 3 | Defer close of a file handle slightly if pending writes depend on that file handle |
4 | (this reduces the EBADF bad file handle errors that can be logged under heavy | 4 | (this reduces the EBADF bad file handle errors that can be logged under heavy |
5 | stress on writes). Modify cifs Kconfig options to expose CONFIG_CIFS_STATS2 | 5 | stress on writes). Modify cifs Kconfig options to expose CONFIG_CIFS_STATS2 |
6 | Fix SFU style symlinks and mknod needed for servers which do not support the CIFS | ||
7 | Unix Extensions. | ||
6 | 8 | ||
7 | Version 1.38 | 9 | Version 1.38 |
8 | ------------ | 10 | ------------ |
diff --git a/fs/cifs/cifs_unicode.c b/fs/cifs/cifs_unicode.c index 4e12053f0806..d2b128255944 100644 --- a/fs/cifs/cifs_unicode.c +++ b/fs/cifs/cifs_unicode.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * fs/cifs/cifs_unicode.c | 2 | * fs/cifs/cifs_unicode.c |
3 | * | 3 | * |
4 | * Copyright (c) International Business Machines Corp., 2000,2002 | 4 | * Copyright (c) International Business Machines Corp., 2000,2005 |
5 | * Modified by Steve French (sfrench@us.ibm.com) | 5 | * Modified by Steve French (sfrench@us.ibm.com) |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
@@ -31,7 +31,7 @@ | |||
31 | * | 31 | * |
32 | */ | 32 | */ |
33 | int | 33 | int |
34 | cifs_strfromUCS_le(char *to, const wchar_t * from, /* LITTLE ENDIAN */ | 34 | cifs_strfromUCS_le(char *to, const __le16 * from, |
35 | int len, const struct nls_table *codepage) | 35 | int len, const struct nls_table *codepage) |
36 | { | 36 | { |
37 | int i; | 37 | int i; |
@@ -60,25 +60,26 @@ cifs_strfromUCS_le(char *to, const wchar_t * from, /* LITTLE ENDIAN */ | |||
60 | * | 60 | * |
61 | */ | 61 | */ |
62 | int | 62 | int |
63 | cifs_strtoUCS(wchar_t * to, const char *from, int len, | 63 | cifs_strtoUCS(__le16 * to, const char *from, int len, |
64 | const struct nls_table *codepage) | 64 | const struct nls_table *codepage) |
65 | { | 65 | { |
66 | int charlen; | 66 | int charlen; |
67 | int i; | 67 | int i; |
68 | wchar_t * wchar_to = (wchar_t *)to; /* needed to quiet sparse */ | ||
68 | 69 | ||
69 | for (i = 0; len && *from; i++, from += charlen, len -= charlen) { | 70 | for (i = 0; len && *from; i++, from += charlen, len -= charlen) { |
70 | 71 | ||
71 | /* works for 2.4.0 kernel or later */ | 72 | /* works for 2.4.0 kernel or later */ |
72 | charlen = codepage->char2uni(from, len, &to[i]); | 73 | charlen = codepage->char2uni(from, len, &wchar_to[i]); |
73 | if (charlen < 1) { | 74 | if (charlen < 1) { |
74 | cERROR(1, | 75 | cERROR(1, |
75 | ("cifs_strtoUCS: char2uni returned %d", | 76 | ("cifs_strtoUCS: char2uni returned %d", |
76 | charlen)); | 77 | charlen)); |
77 | /* A question mark */ | 78 | /* A question mark */ |
78 | to[i] = (wchar_t)cpu_to_le16(0x003f); | 79 | to[i] = cpu_to_le16(0x003f); |
79 | charlen = 1; | 80 | charlen = 1; |
80 | } else | 81 | } else |
81 | to[i] = (wchar_t)cpu_to_le16(to[i]); | 82 | to[i] = cpu_to_le16(wchar_to[i]); |
82 | 83 | ||
83 | } | 84 | } |
84 | 85 | ||
diff --git a/fs/cifs/cifs_unicode.h b/fs/cifs/cifs_unicode.h index da8dde965275..39e5b970325f 100644 --- a/fs/cifs/cifs_unicode.h +++ b/fs/cifs/cifs_unicode.h | |||
@@ -5,7 +5,7 @@ | |||
5 | * Convert a unicode character to upper or lower case using | 5 | * Convert a unicode character to upper or lower case using |
6 | * compressed tables. | 6 | * compressed tables. |
7 | * | 7 | * |
8 | * Copyright (c) International Business Machines Corp., 2000,2002 | 8 | * Copyright (c) International Business Machines Corp., 2000,2005555555555555555555555555555555555555555555555555555555 |
9 | * | 9 | * |
10 | * 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 |
11 | * 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 |
@@ -59,8 +59,8 @@ extern struct UniCaseRange UniLowerRange[]; | |||
59 | #endif /* UNIUPR_NOLOWER */ | 59 | #endif /* UNIUPR_NOLOWER */ |
60 | 60 | ||
61 | #ifdef __KERNEL__ | 61 | #ifdef __KERNEL__ |
62 | int cifs_strfromUCS_le(char *, const wchar_t *, int, const struct nls_table *); | 62 | int cifs_strfromUCS_le(char *, const __le16 *, int, const struct nls_table *); |
63 | int cifs_strtoUCS(wchar_t *, const char *, int, const struct nls_table *); | 63 | int cifs_strtoUCS(__le16 *, const char *, int, const struct nls_table *); |
64 | #endif | 64 | #endif |
65 | 65 | ||
66 | /* | 66 | /* |
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index 1959c7c4b185..fe2bb7c4c912 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c | |||
@@ -149,7 +149,7 @@ int CalcNTLMv2_partial_mac_key(struct cifsSesInfo * ses, struct nls_table * nls_ | |||
149 | char temp_hash[16]; | 149 | char temp_hash[16]; |
150 | struct HMACMD5Context ctx; | 150 | struct HMACMD5Context ctx; |
151 | char * ucase_buf; | 151 | char * ucase_buf; |
152 | wchar_t * unicode_buf; | 152 | __le16 * unicode_buf; |
153 | unsigned int i,user_name_len,dom_name_len; | 153 | unsigned int i,user_name_len,dom_name_len; |
154 | 154 | ||
155 | if(ses == NULL) | 155 | if(ses == NULL) |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 682b0235ad9a..1433455c61ea 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -635,6 +635,46 @@ struct file_operations cifs_file_direct_ops = { | |||
635 | .dir_notify = cifs_dir_notify, | 635 | .dir_notify = cifs_dir_notify, |
636 | #endif /* CONFIG_CIFS_EXPERIMENTAL */ | 636 | #endif /* CONFIG_CIFS_EXPERIMENTAL */ |
637 | }; | 637 | }; |
638 | struct file_operations cifs_file_nobrl_ops = { | ||
639 | .read = cifs_read_wrapper, | ||
640 | .write = cifs_write_wrapper, | ||
641 | .open = cifs_open, | ||
642 | .release = cifs_close, | ||
643 | .fsync = cifs_fsync, | ||
644 | .flush = cifs_flush, | ||
645 | .mmap = cifs_file_mmap, | ||
646 | .sendfile = generic_file_sendfile, | ||
647 | #ifdef CONFIG_CIFS_POSIX | ||
648 | .ioctl = cifs_ioctl, | ||
649 | #endif /* CONFIG_CIFS_POSIX */ | ||
650 | |||
651 | #ifdef CONFIG_CIFS_EXPERIMENTAL | ||
652 | .readv = generic_file_readv, | ||
653 | .writev = generic_file_writev, | ||
654 | .aio_read = generic_file_aio_read, | ||
655 | .aio_write = generic_file_aio_write, | ||
656 | .dir_notify = cifs_dir_notify, | ||
657 | #endif /* CONFIG_CIFS_EXPERIMENTAL */ | ||
658 | }; | ||
659 | |||
660 | struct file_operations cifs_file_direct_nobrl_ops = { | ||
661 | /* no mmap, no aio, no readv - | ||
662 | BB reevaluate whether they can be done with directio, no cache */ | ||
663 | .read = cifs_user_read, | ||
664 | .write = cifs_user_write, | ||
665 | .open = cifs_open, | ||
666 | .release = cifs_close, | ||
667 | .fsync = cifs_fsync, | ||
668 | .flush = cifs_flush, | ||
669 | .sendfile = generic_file_sendfile, /* BB removeme BB */ | ||
670 | #ifdef CONFIG_CIFS_POSIX | ||
671 | .ioctl = cifs_ioctl, | ||
672 | #endif /* CONFIG_CIFS_POSIX */ | ||
673 | |||
674 | #ifdef CONFIG_CIFS_EXPERIMENTAL | ||
675 | .dir_notify = cifs_dir_notify, | ||
676 | #endif /* CONFIG_CIFS_EXPERIMENTAL */ | ||
677 | }; | ||
638 | 678 | ||
639 | struct file_operations cifs_dir_ops = { | 679 | struct file_operations cifs_dir_ops = { |
640 | .readdir = cifs_readdir, | 680 | .readdir = cifs_readdir, |
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 1223fa81dbd2..9ec40e0e54fc 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -63,6 +63,8 @@ extern struct inode_operations cifs_symlink_inode_ops; | |||
63 | /* Functions related to files and directories */ | 63 | /* Functions related to files and directories */ |
64 | extern struct file_operations cifs_file_ops; | 64 | extern struct file_operations cifs_file_ops; |
65 | extern struct file_operations cifs_file_direct_ops; /* if directio mount */ | 65 | extern struct file_operations cifs_file_direct_ops; /* if directio mount */ |
66 | extern struct file_operations cifs_file_nobrl_ops; | ||
67 | extern struct file_operations cifs_file_direct_nobrl_ops; /* if directio mount */ | ||
66 | extern int cifs_open(struct inode *inode, struct file *file); | 68 | extern int cifs_open(struct inode *inode, struct file *file); |
67 | extern int cifs_close(struct inode *inode, struct file *file); | 69 | extern int cifs_close(struct inode *inode, struct file *file); |
68 | extern int cifs_closedir(struct inode *inode, struct file *file); | 70 | extern int cifs_closedir(struct inode *inode, struct file *file); |
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 | } |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 2cb620716bc1..c467de857610 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -1986,32 +1986,32 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
1986 | bytes_returned = 0; /* skill null user */ | 1986 | bytes_returned = 0; /* skill null user */ |
1987 | else | 1987 | else |
1988 | bytes_returned = | 1988 | bytes_returned = |
1989 | cifs_strtoUCS((wchar_t *) bcc_ptr, user, 100, | 1989 | cifs_strtoUCS((__le16 *) bcc_ptr, user, 100, |
1990 | nls_codepage); | 1990 | nls_codepage); |
1991 | /* convert number of 16 bit words to bytes */ | 1991 | /* convert number of 16 bit words to bytes */ |
1992 | bcc_ptr += 2 * bytes_returned; | 1992 | bcc_ptr += 2 * bytes_returned; |
1993 | bcc_ptr += 2; /* trailing null */ | 1993 | bcc_ptr += 2; /* trailing null */ |
1994 | if (domain == NULL) | 1994 | if (domain == NULL) |
1995 | bytes_returned = | 1995 | bytes_returned = |
1996 | cifs_strtoUCS((wchar_t *) bcc_ptr, | 1996 | cifs_strtoUCS((__le16 *) bcc_ptr, |
1997 | "CIFS_LINUX_DOM", 32, nls_codepage); | 1997 | "CIFS_LINUX_DOM", 32, nls_codepage); |
1998 | else | 1998 | else |
1999 | bytes_returned = | 1999 | bytes_returned = |
2000 | cifs_strtoUCS((wchar_t *) bcc_ptr, domain, 64, | 2000 | cifs_strtoUCS((__le16 *) bcc_ptr, domain, 64, |
2001 | nls_codepage); | 2001 | nls_codepage); |
2002 | bcc_ptr += 2 * bytes_returned; | 2002 | bcc_ptr += 2 * bytes_returned; |
2003 | bcc_ptr += 2; | 2003 | bcc_ptr += 2; |
2004 | bytes_returned = | 2004 | bytes_returned = |
2005 | cifs_strtoUCS((wchar_t *) bcc_ptr, "Linux version ", | 2005 | cifs_strtoUCS((__le16 *) bcc_ptr, "Linux version ", |
2006 | 32, nls_codepage); | 2006 | 32, nls_codepage); |
2007 | bcc_ptr += 2 * bytes_returned; | 2007 | bcc_ptr += 2 * bytes_returned; |
2008 | bytes_returned = | 2008 | bytes_returned = |
2009 | cifs_strtoUCS((wchar_t *) bcc_ptr, system_utsname.release, | 2009 | cifs_strtoUCS((__le16 *) bcc_ptr, system_utsname.release, |
2010 | 32, nls_codepage); | 2010 | 32, nls_codepage); |
2011 | bcc_ptr += 2 * bytes_returned; | 2011 | bcc_ptr += 2 * bytes_returned; |
2012 | bcc_ptr += 2; | 2012 | bcc_ptr += 2; |
2013 | bytes_returned = | 2013 | bytes_returned = |
2014 | cifs_strtoUCS((wchar_t *) bcc_ptr, CIFS_NETWORK_OPSYS, | 2014 | cifs_strtoUCS((__le16 *) bcc_ptr, CIFS_NETWORK_OPSYS, |
2015 | 64, nls_codepage); | 2015 | 64, nls_codepage); |
2016 | bcc_ptr += 2 * bytes_returned; | 2016 | bcc_ptr += 2 * bytes_returned; |
2017 | bcc_ptr += 2; | 2017 | bcc_ptr += 2; |
@@ -2081,7 +2081,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2081 | if(ses->serverOS == NULL) | 2081 | if(ses->serverOS == NULL) |
2082 | goto sesssetup_nomem; | 2082 | goto sesssetup_nomem; |
2083 | cifs_strfromUCS_le(ses->serverOS, | 2083 | cifs_strfromUCS_le(ses->serverOS, |
2084 | (wchar_t *)bcc_ptr, len,nls_codepage); | 2084 | (__le16 *)bcc_ptr, len,nls_codepage); |
2085 | bcc_ptr += 2 * (len + 1); | 2085 | bcc_ptr += 2 * (len + 1); |
2086 | remaining_words -= len + 1; | 2086 | remaining_words -= len + 1; |
2087 | ses->serverOS[2 * len] = 0; | 2087 | ses->serverOS[2 * len] = 0; |
@@ -2093,7 +2093,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2093 | if(ses->serverNOS == NULL) | 2093 | if(ses->serverNOS == NULL) |
2094 | goto sesssetup_nomem; | 2094 | goto sesssetup_nomem; |
2095 | cifs_strfromUCS_le(ses->serverNOS, | 2095 | cifs_strfromUCS_le(ses->serverNOS, |
2096 | (wchar_t *)bcc_ptr,len,nls_codepage); | 2096 | (__le16 *)bcc_ptr,len,nls_codepage); |
2097 | bcc_ptr += 2 * (len + 1); | 2097 | bcc_ptr += 2 * (len + 1); |
2098 | ses->serverNOS[2 * len] = 0; | 2098 | ses->serverNOS[2 * len] = 0; |
2099 | ses->serverNOS[1 + (2 * len)] = 0; | 2099 | ses->serverNOS[1 + (2 * len)] = 0; |
@@ -2111,7 +2111,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2111 | if(ses->serverDomain == NULL) | 2111 | if(ses->serverDomain == NULL) |
2112 | goto sesssetup_nomem; | 2112 | goto sesssetup_nomem; |
2113 | cifs_strfromUCS_le(ses->serverDomain, | 2113 | cifs_strfromUCS_le(ses->serverDomain, |
2114 | (wchar_t *)bcc_ptr,len,nls_codepage); | 2114 | (__le16 *)bcc_ptr,len,nls_codepage); |
2115 | bcc_ptr += 2 * (len + 1); | 2115 | bcc_ptr += 2 * (len + 1); |
2116 | ses->serverDomain[2*len] = 0; | 2116 | ses->serverDomain[2*len] = 0; |
2117 | ses->serverDomain[1+(2*len)] = 0; | 2117 | ses->serverDomain[1+(2*len)] = 0; |
@@ -2255,30 +2255,30 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2255 | bcc_ptr++; | 2255 | bcc_ptr++; |
2256 | } | 2256 | } |
2257 | bytes_returned = | 2257 | bytes_returned = |
2258 | cifs_strtoUCS((wchar_t *) bcc_ptr, user, 100, nls_codepage); | 2258 | cifs_strtoUCS((__le16 *) bcc_ptr, user, 100, nls_codepage); |
2259 | bcc_ptr += 2 * bytes_returned; /* convert num of 16 bit words to bytes */ | 2259 | bcc_ptr += 2 * bytes_returned; /* convert num of 16 bit words to bytes */ |
2260 | bcc_ptr += 2; /* trailing null */ | 2260 | bcc_ptr += 2; /* trailing null */ |
2261 | if (domain == NULL) | 2261 | if (domain == NULL) |
2262 | bytes_returned = | 2262 | bytes_returned = |
2263 | cifs_strtoUCS((wchar_t *) bcc_ptr, | 2263 | cifs_strtoUCS((__le16 *) bcc_ptr, |
2264 | "CIFS_LINUX_DOM", 32, nls_codepage); | 2264 | "CIFS_LINUX_DOM", 32, nls_codepage); |
2265 | else | 2265 | else |
2266 | bytes_returned = | 2266 | bytes_returned = |
2267 | cifs_strtoUCS((wchar_t *) bcc_ptr, domain, 64, | 2267 | cifs_strtoUCS((__le16 *) bcc_ptr, domain, 64, |
2268 | nls_codepage); | 2268 | nls_codepage); |
2269 | bcc_ptr += 2 * bytes_returned; | 2269 | bcc_ptr += 2 * bytes_returned; |
2270 | bcc_ptr += 2; | 2270 | bcc_ptr += 2; |
2271 | bytes_returned = | 2271 | bytes_returned = |
2272 | cifs_strtoUCS((wchar_t *) bcc_ptr, "Linux version ", | 2272 | cifs_strtoUCS((__le16 *) bcc_ptr, "Linux version ", |
2273 | 32, nls_codepage); | 2273 | 32, nls_codepage); |
2274 | bcc_ptr += 2 * bytes_returned; | 2274 | bcc_ptr += 2 * bytes_returned; |
2275 | bytes_returned = | 2275 | bytes_returned = |
2276 | cifs_strtoUCS((wchar_t *) bcc_ptr, system_utsname.release, 32, | 2276 | cifs_strtoUCS((__le16 *) bcc_ptr, system_utsname.release, 32, |
2277 | nls_codepage); | 2277 | nls_codepage); |
2278 | bcc_ptr += 2 * bytes_returned; | 2278 | bcc_ptr += 2 * bytes_returned; |
2279 | bcc_ptr += 2; | 2279 | bcc_ptr += 2; |
2280 | bytes_returned = | 2280 | bytes_returned = |
2281 | cifs_strtoUCS((wchar_t *) bcc_ptr, CIFS_NETWORK_OPSYS, | 2281 | cifs_strtoUCS((__le16 *) bcc_ptr, CIFS_NETWORK_OPSYS, |
2282 | 64, nls_codepage); | 2282 | 64, nls_codepage); |
2283 | bcc_ptr += 2 * bytes_returned; | 2283 | bcc_ptr += 2 * bytes_returned; |
2284 | bcc_ptr += 2; | 2284 | bcc_ptr += 2; |
@@ -2357,7 +2357,7 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2357 | ses->serverOS = | 2357 | ses->serverOS = |
2358 | kzalloc(2 * (len + 1), GFP_KERNEL); | 2358 | kzalloc(2 * (len + 1), GFP_KERNEL); |
2359 | cifs_strfromUCS_le(ses->serverOS, | 2359 | cifs_strfromUCS_le(ses->serverOS, |
2360 | (wchar_t *) | 2360 | (__le16 *) |
2361 | bcc_ptr, len, | 2361 | bcc_ptr, len, |
2362 | nls_codepage); | 2362 | nls_codepage); |
2363 | bcc_ptr += 2 * (len + 1); | 2363 | bcc_ptr += 2 * (len + 1); |
@@ -2372,7 +2372,7 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2372 | kzalloc(2 * (len + 1), | 2372 | kzalloc(2 * (len + 1), |
2373 | GFP_KERNEL); | 2373 | GFP_KERNEL); |
2374 | cifs_strfromUCS_le(ses->serverNOS, | 2374 | cifs_strfromUCS_le(ses->serverNOS, |
2375 | (wchar_t *)bcc_ptr, | 2375 | (__le16 *)bcc_ptr, |
2376 | len, | 2376 | len, |
2377 | nls_codepage); | 2377 | nls_codepage); |
2378 | bcc_ptr += 2 * (len + 1); | 2378 | bcc_ptr += 2 * (len + 1); |
@@ -2384,9 +2384,8 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2384 | /* last string is not always null terminated (for e.g. for Windows XP & 2000) */ | 2384 | /* last string is not always null terminated (for e.g. for Windows XP & 2000) */ |
2385 | ses->serverDomain = kzalloc(2*(len+1),GFP_KERNEL); | 2385 | ses->serverDomain = kzalloc(2*(len+1),GFP_KERNEL); |
2386 | cifs_strfromUCS_le(ses->serverDomain, | 2386 | cifs_strfromUCS_le(ses->serverDomain, |
2387 | (wchar_t *)bcc_ptr, | 2387 | (__le16 *)bcc_ptr, |
2388 | len, | 2388 | len, nls_codepage); |
2389 | nls_codepage); | ||
2390 | bcc_ptr += 2*(len+1); | 2389 | bcc_ptr += 2*(len+1); |
2391 | ses->serverDomain[2*len] = 0; | 2390 | ses->serverDomain[2*len] = 0; |
2392 | ses->serverDomain[1+(2*len)] = 0; | 2391 | ses->serverDomain[1+(2*len)] = 0; |
@@ -2560,16 +2559,16 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2560 | } | 2559 | } |
2561 | 2560 | ||
2562 | bytes_returned = | 2561 | bytes_returned = |
2563 | cifs_strtoUCS((wchar_t *) bcc_ptr, "Linux version ", | 2562 | cifs_strtoUCS((__le16 *) bcc_ptr, "Linux version ", |
2564 | 32, nls_codepage); | 2563 | 32, nls_codepage); |
2565 | bcc_ptr += 2 * bytes_returned; | 2564 | bcc_ptr += 2 * bytes_returned; |
2566 | bytes_returned = | 2565 | bytes_returned = |
2567 | cifs_strtoUCS((wchar_t *) bcc_ptr, system_utsname.release, 32, | 2566 | cifs_strtoUCS((__le16 *) bcc_ptr, system_utsname.release, 32, |
2568 | nls_codepage); | 2567 | nls_codepage); |
2569 | bcc_ptr += 2 * bytes_returned; | 2568 | bcc_ptr += 2 * bytes_returned; |
2570 | bcc_ptr += 2; /* null terminate Linux version */ | 2569 | bcc_ptr += 2; /* null terminate Linux version */ |
2571 | bytes_returned = | 2570 | bytes_returned = |
2572 | cifs_strtoUCS((wchar_t *) bcc_ptr, CIFS_NETWORK_OPSYS, | 2571 | cifs_strtoUCS((__le16 *) bcc_ptr, CIFS_NETWORK_OPSYS, |
2573 | 64, nls_codepage); | 2572 | 64, nls_codepage); |
2574 | bcc_ptr += 2 * bytes_returned; | 2573 | bcc_ptr += 2 * bytes_returned; |
2575 | *(bcc_ptr + 1) = 0; | 2574 | *(bcc_ptr + 1) = 0; |
@@ -2673,7 +2672,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2673 | ses->serverOS = | 2672 | ses->serverOS = |
2674 | kzalloc(2 * (len + 1), GFP_KERNEL); | 2673 | kzalloc(2 * (len + 1), GFP_KERNEL); |
2675 | cifs_strfromUCS_le(ses->serverOS, | 2674 | cifs_strfromUCS_le(ses->serverOS, |
2676 | (wchar_t *) | 2675 | (__le16 *) |
2677 | bcc_ptr, len, | 2676 | bcc_ptr, len, |
2678 | nls_codepage); | 2677 | nls_codepage); |
2679 | bcc_ptr += 2 * (len + 1); | 2678 | bcc_ptr += 2 * (len + 1); |
@@ -2690,7 +2689,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2690 | GFP_KERNEL); | 2689 | GFP_KERNEL); |
2691 | cifs_strfromUCS_le(ses-> | 2690 | cifs_strfromUCS_le(ses-> |
2692 | serverNOS, | 2691 | serverNOS, |
2693 | (wchar_t *) | 2692 | (__le16 *) |
2694 | bcc_ptr, | 2693 | bcc_ptr, |
2695 | len, | 2694 | len, |
2696 | nls_codepage); | 2695 | nls_codepage); |
@@ -2708,23 +2707,15 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, | |||
2708 | 1), | 2707 | 1), |
2709 | GFP_KERNEL); | 2708 | GFP_KERNEL); |
2710 | cifs_strfromUCS_le | 2709 | cifs_strfromUCS_le |
2711 | (ses-> | 2710 | (ses->serverDomain, |
2712 | serverDomain, | 2711 | (__le16 *)bcc_ptr, |
2713 | (wchar_t *) | 2712 | len, nls_codepage); |
2714 | bcc_ptr, len, | ||
2715 | nls_codepage); | ||
2716 | bcc_ptr += | 2713 | bcc_ptr += |
2717 | 2 * (len + 1); | 2714 | 2 * (len + 1); |
2718 | ses-> | 2715 | ses->serverDomain[2*len] |
2719 | serverDomain[2 | ||
2720 | * len] | ||
2721 | = 0; | 2716 | = 0; |
2722 | ses-> | 2717 | ses->serverDomain |
2723 | serverDomain[1 | 2718 | [1 + (2 * len)] |
2724 | + | ||
2725 | (2 | ||
2726 | * | ||
2727 | len)] | ||
2728 | = 0; | 2719 | = 0; |
2729 | } /* else no more room so create dummy domain string */ | 2720 | } /* else no more room so create dummy domain string */ |
2730 | else | 2721 | else |
@@ -2903,7 +2894,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2903 | SecurityBlob->DomainName.MaximumLength = 0; | 2894 | SecurityBlob->DomainName.MaximumLength = 0; |
2904 | } else { | 2895 | } else { |
2905 | __u16 len = | 2896 | __u16 len = |
2906 | cifs_strtoUCS((wchar_t *) bcc_ptr, domain, 64, | 2897 | cifs_strtoUCS((__le16 *) bcc_ptr, domain, 64, |
2907 | nls_codepage); | 2898 | nls_codepage); |
2908 | len *= 2; | 2899 | len *= 2; |
2909 | SecurityBlob->DomainName.MaximumLength = | 2900 | SecurityBlob->DomainName.MaximumLength = |
@@ -2921,7 +2912,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2921 | SecurityBlob->UserName.MaximumLength = 0; | 2912 | SecurityBlob->UserName.MaximumLength = 0; |
2922 | } else { | 2913 | } else { |
2923 | __u16 len = | 2914 | __u16 len = |
2924 | cifs_strtoUCS((wchar_t *) bcc_ptr, user, 64, | 2915 | cifs_strtoUCS((__le16 *) bcc_ptr, user, 64, |
2925 | nls_codepage); | 2916 | nls_codepage); |
2926 | len *= 2; | 2917 | len *= 2; |
2927 | SecurityBlob->UserName.MaximumLength = | 2918 | SecurityBlob->UserName.MaximumLength = |
@@ -2934,7 +2925,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2934 | cpu_to_le16(len); | 2925 | cpu_to_le16(len); |
2935 | } | 2926 | } |
2936 | 2927 | ||
2937 | /* SecurityBlob->WorkstationName.Length = cifs_strtoUCS((wchar_t *) bcc_ptr, "AMACHINE",64, nls_codepage); | 2928 | /* SecurityBlob->WorkstationName.Length = cifs_strtoUCS((__le16 *) bcc_ptr, "AMACHINE",64, nls_codepage); |
2938 | SecurityBlob->WorkstationName.Length *= 2; | 2929 | SecurityBlob->WorkstationName.Length *= 2; |
2939 | SecurityBlob->WorkstationName.MaximumLength = cpu_to_le16(SecurityBlob->WorkstationName.Length); | 2930 | SecurityBlob->WorkstationName.MaximumLength = cpu_to_le16(SecurityBlob->WorkstationName.Length); |
2940 | SecurityBlob->WorkstationName.Buffer = cpu_to_le32(SecurityBlobLength); | 2931 | SecurityBlob->WorkstationName.Buffer = cpu_to_le32(SecurityBlobLength); |
@@ -2947,16 +2938,16 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2947 | bcc_ptr++; | 2938 | bcc_ptr++; |
2948 | } | 2939 | } |
2949 | bytes_returned = | 2940 | bytes_returned = |
2950 | cifs_strtoUCS((wchar_t *) bcc_ptr, "Linux version ", | 2941 | cifs_strtoUCS((__le16 *) bcc_ptr, "Linux version ", |
2951 | 32, nls_codepage); | 2942 | 32, nls_codepage); |
2952 | bcc_ptr += 2 * bytes_returned; | 2943 | bcc_ptr += 2 * bytes_returned; |
2953 | bytes_returned = | 2944 | bytes_returned = |
2954 | cifs_strtoUCS((wchar_t *) bcc_ptr, system_utsname.release, 32, | 2945 | cifs_strtoUCS((__le16 *) bcc_ptr, system_utsname.release, 32, |
2955 | nls_codepage); | 2946 | nls_codepage); |
2956 | bcc_ptr += 2 * bytes_returned; | 2947 | bcc_ptr += 2 * bytes_returned; |
2957 | bcc_ptr += 2; /* null term version string */ | 2948 | bcc_ptr += 2; /* null term version string */ |
2958 | bytes_returned = | 2949 | bytes_returned = |
2959 | cifs_strtoUCS((wchar_t *) bcc_ptr, CIFS_NETWORK_OPSYS, | 2950 | cifs_strtoUCS((__le16 *) bcc_ptr, CIFS_NETWORK_OPSYS, |
2960 | 64, nls_codepage); | 2951 | 64, nls_codepage); |
2961 | bcc_ptr += 2 * bytes_returned; | 2952 | bcc_ptr += 2 * bytes_returned; |
2962 | *(bcc_ptr + 1) = 0; | 2953 | *(bcc_ptr + 1) = 0; |
@@ -3069,7 +3060,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
3069 | ses->serverOS = | 3060 | ses->serverOS = |
3070 | kzalloc(2 * (len + 1), GFP_KERNEL); | 3061 | kzalloc(2 * (len + 1), GFP_KERNEL); |
3071 | cifs_strfromUCS_le(ses->serverOS, | 3062 | cifs_strfromUCS_le(ses->serverOS, |
3072 | (wchar_t *) | 3063 | (__le16 *) |
3073 | bcc_ptr, len, | 3064 | bcc_ptr, len, |
3074 | nls_codepage); | 3065 | nls_codepage); |
3075 | bcc_ptr += 2 * (len + 1); | 3066 | bcc_ptr += 2 * (len + 1); |
@@ -3086,7 +3077,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
3086 | GFP_KERNEL); | 3077 | GFP_KERNEL); |
3087 | cifs_strfromUCS_le(ses-> | 3078 | cifs_strfromUCS_le(ses-> |
3088 | serverNOS, | 3079 | serverNOS, |
3089 | (wchar_t *) | 3080 | (__le16 *) |
3090 | bcc_ptr, | 3081 | bcc_ptr, |
3091 | len, | 3082 | len, |
3092 | nls_codepage); | 3083 | nls_codepage); |
@@ -3105,7 +3096,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
3105 | cifs_strfromUCS_le | 3096 | cifs_strfromUCS_le |
3106 | (ses-> | 3097 | (ses-> |
3107 | serverDomain, | 3098 | serverDomain, |
3108 | (wchar_t *) | 3099 | (__le16 *) |
3109 | bcc_ptr, len, | 3100 | bcc_ptr, len, |
3110 | nls_codepage); | 3101 | nls_codepage); |
3111 | bcc_ptr += | 3102 | bcc_ptr += |
@@ -3227,7 +3218,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, | |||
3227 | if (ses->capabilities & CAP_UNICODE) { | 3218 | if (ses->capabilities & CAP_UNICODE) { |
3228 | smb_buffer->Flags2 |= SMBFLG2_UNICODE; | 3219 | smb_buffer->Flags2 |= SMBFLG2_UNICODE; |
3229 | length = | 3220 | length = |
3230 | cifs_strtoUCS((wchar_t *) bcc_ptr, tree, 100, nls_codepage); | 3221 | cifs_strtoUCS((__le16 *) bcc_ptr, tree, 100, nls_codepage); |
3231 | bcc_ptr += 2 * length; /* convert num of 16 bit words to bytes */ | 3222 | bcc_ptr += 2 * length; /* convert num of 16 bit words to bytes */ |
3232 | bcc_ptr += 2; /* skip trailing null */ | 3223 | bcc_ptr += 2; /* skip trailing null */ |
3233 | } else { /* ASCII */ | 3224 | } else { /* ASCII */ |
@@ -3263,7 +3254,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, | |||
3263 | tcon->nativeFileSystem = | 3254 | tcon->nativeFileSystem = |
3264 | kzalloc(length + 2, GFP_KERNEL); | 3255 | kzalloc(length + 2, GFP_KERNEL); |
3265 | cifs_strfromUCS_le(tcon->nativeFileSystem, | 3256 | cifs_strfromUCS_le(tcon->nativeFileSystem, |
3266 | (wchar_t *) bcc_ptr, | 3257 | (__le16 *) bcc_ptr, |
3267 | length, nls_codepage); | 3258 | length, nls_codepage); |
3268 | bcc_ptr += 2 * length; | 3259 | bcc_ptr += 2 * length; |
3269 | bcc_ptr[0] = 0; /* null terminate the string */ | 3260 | bcc_ptr[0] = 0; /* null terminate the string */ |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 923d071163b2..ba9eae56d011 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -97,9 +97,9 @@ int cifs_get_inode_info_unix(struct inode **pinode, | |||
97 | inode = *pinode; | 97 | inode = *pinode; |
98 | cifsInfo = CIFS_I(inode); | 98 | cifsInfo = CIFS_I(inode); |
99 | 99 | ||
100 | cFYI(1, (" Old time %ld ", cifsInfo->time)); | 100 | cFYI(1, ("Old time %ld ", cifsInfo->time)); |
101 | cifsInfo->time = jiffies; | 101 | cifsInfo->time = jiffies; |
102 | cFYI(1, (" New time %ld ", cifsInfo->time)); | 102 | cFYI(1, ("New time %ld ", cifsInfo->time)); |
103 | /* this is ok to set on every inode revalidate */ | 103 | /* this is ok to set on every inode revalidate */ |
104 | atomic_set(&cifsInfo->inUse,1); | 104 | atomic_set(&cifsInfo->inUse,1); |
105 | 105 | ||
@@ -155,34 +155,39 @@ int cifs_get_inode_info_unix(struct inode **pinode, | |||
155 | } | 155 | } |
156 | 156 | ||
157 | if (num_of_bytes < end_of_file) | 157 | if (num_of_bytes < end_of_file) |
158 | cFYI(1, ("allocation size less than end of file ")); | 158 | cFYI(1, ("allocation size less than end of file")); |
159 | cFYI(1, | 159 | cFYI(1, |
160 | ("Size %ld and blocks %ld", | 160 | ("Size %ld and blocks %ld", |
161 | (unsigned long) inode->i_size, inode->i_blocks)); | 161 | (unsigned long) inode->i_size, inode->i_blocks)); |
162 | if (S_ISREG(inode->i_mode)) { | 162 | if (S_ISREG(inode->i_mode)) { |
163 | cFYI(1, (" File inode ")); | 163 | cFYI(1, ("File inode")); |
164 | inode->i_op = &cifs_file_inode_ops; | 164 | inode->i_op = &cifs_file_inode_ops; |
165 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) | 165 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) { |
166 | inode->i_fop = &cifs_file_direct_ops; | 166 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) |
167 | else | 167 | inode->i_fop = |
168 | &cifs_file_direct_nobrl_ops; | ||
169 | else | ||
170 | inode->i_fop = &cifs_file_direct_ops; | ||
171 | } else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | ||
172 | inode->i_fop = &cifs_file_nobrl_ops; | ||
173 | else /* not direct, send byte range locks */ | ||
168 | inode->i_fop = &cifs_file_ops; | 174 | inode->i_fop = &cifs_file_ops; |
169 | if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | 175 | |
170 | inode->i_fop->lock = NULL; | ||
171 | inode->i_data.a_ops = &cifs_addr_ops; | 176 | inode->i_data.a_ops = &cifs_addr_ops; |
172 | /* check if server can support readpages */ | 177 | /* check if server can support readpages */ |
173 | if(pTcon->ses->server->maxBuf < | 178 | if(pTcon->ses->server->maxBuf < |
174 | 4096 + MAX_CIFS_HDR_SIZE) | 179 | 4096 + MAX_CIFS_HDR_SIZE) |
175 | inode->i_data.a_ops->readpages = NULL; | 180 | inode->i_data.a_ops->readpages = NULL; |
176 | } else if (S_ISDIR(inode->i_mode)) { | 181 | } else if (S_ISDIR(inode->i_mode)) { |
177 | cFYI(1, (" Directory inode")); | 182 | cFYI(1, ("Directory inode")); |
178 | inode->i_op = &cifs_dir_inode_ops; | 183 | inode->i_op = &cifs_dir_inode_ops; |
179 | inode->i_fop = &cifs_dir_ops; | 184 | inode->i_fop = &cifs_dir_ops; |
180 | } else if (S_ISLNK(inode->i_mode)) { | 185 | } else if (S_ISLNK(inode->i_mode)) { |
181 | cFYI(1, (" Symbolic Link inode ")); | 186 | cFYI(1, ("Symbolic Link inode")); |
182 | inode->i_op = &cifs_symlink_inode_ops; | 187 | inode->i_op = &cifs_symlink_inode_ops; |
183 | /* tmp_inode->i_fop = */ /* do not need to set to anything */ | 188 | /* tmp_inode->i_fop = */ /* do not need to set to anything */ |
184 | } else { | 189 | } else { |
185 | cFYI(1, (" Init special inode ")); | 190 | cFYI(1, ("Init special inode")); |
186 | init_special_inode(inode, inode->i_mode, | 191 | init_special_inode(inode, inode->i_mode, |
187 | inode->i_rdev); | 192 | inode->i_rdev); |
188 | } | 193 | } |
@@ -190,6 +195,55 @@ int cifs_get_inode_info_unix(struct inode **pinode, | |||
190 | return rc; | 195 | return rc; |
191 | } | 196 | } |
192 | 197 | ||
198 | static int decode_sfu_inode(struct inode * inode, __u64 size, | ||
199 | const unsigned char *path, | ||
200 | struct cifs_sb_info *cifs_sb, int xid) | ||
201 | { | ||
202 | int rc; | ||
203 | int oplock = FALSE; | ||
204 | __u16 netfid; | ||
205 | struct cifsTconInfo *pTcon = cifs_sb->tcon; | ||
206 | char buf[8]; | ||
207 | unsigned int bytes_read; | ||
208 | char * pbuf; | ||
209 | |||
210 | pbuf = buf; | ||
211 | |||
212 | if(size == 0) { | ||
213 | inode->i_mode |= S_IFIFO; | ||
214 | return 0; | ||
215 | } else if (size < 8) { | ||
216 | return -EINVAL; /* EOPNOTSUPP? */ | ||
217 | } | ||
218 | |||
219 | rc = CIFSSMBOpen(xid, pTcon, path, FILE_OPEN, GENERIC_READ, | ||
220 | CREATE_NOT_DIR, &netfid, &oplock, NULL, | ||
221 | cifs_sb->local_nls, | ||
222 | cifs_sb->mnt_cifs_flags & | ||
223 | CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
224 | if (rc==0) { | ||
225 | /* Read header */ | ||
226 | rc = CIFSSMBRead(xid, pTcon, | ||
227 | netfid, | ||
228 | 8 /* length */, 0 /* offset */, | ||
229 | &bytes_read, &pbuf); | ||
230 | if((rc == 0) && (bytes_read == 8)) { | ||
231 | /* if memcmp(IntxCHR\000, pbuf, 8) | ||
232 | else if memcmp(IntxBLK\000, pbuf, 8) | ||
233 | else if memcmp(IntxLNK\001, pbuf, 8) */ | ||
234 | } | ||
235 | |||
236 | CIFSSMBClose(xid, pTcon, netfid); | ||
237 | |||
238 | |||
239 | /* inode->i_rdev = MKDEV(le64_to_cpu(DevMajor), | ||
240 | le64_to_cpu(DevMinor) & MINORMASK);*/ | ||
241 | /* inode->i_mode |= S_IFBLK; */ | ||
242 | } | ||
243 | return rc; | ||
244 | |||
245 | } | ||
246 | |||
193 | int cifs_get_inode_info(struct inode **pinode, | 247 | int cifs_get_inode_info(struct inode **pinode, |
194 | const unsigned char *search_path, FILE_ALL_INFO *pfindData, | 248 | const unsigned char *search_path, FILE_ALL_INFO *pfindData, |
195 | struct super_block *sb, int xid) | 249 | struct super_block *sb, int xid) |
@@ -202,7 +256,7 @@ int cifs_get_inode_info(struct inode **pinode, | |||
202 | char *buf = NULL; | 256 | char *buf = NULL; |
203 | 257 | ||
204 | pTcon = cifs_sb->tcon; | 258 | pTcon = cifs_sb->tcon; |
205 | cFYI(1,("Getting info on %s ", search_path)); | 259 | cFYI(1,("Getting info on %s", search_path)); |
206 | 260 | ||
207 | if ((pfindData == NULL) && (*pinode != NULL)) { | 261 | if ((pfindData == NULL) && (*pinode != NULL)) { |
208 | if (CIFS_I(*pinode)->clientCanCacheRead) { | 262 | if (CIFS_I(*pinode)->clientCanCacheRead) { |
@@ -340,10 +394,15 @@ int cifs_get_inode_info(struct inode **pinode, | |||
340 | (pfindData->EndOfFile == 0)) { | 394 | (pfindData->EndOfFile == 0)) { |
341 | inode->i_mode = cifs_sb->mnt_file_mode; | 395 | inode->i_mode = cifs_sb->mnt_file_mode; |
342 | inode->i_mode |= S_IFIFO; | 396 | inode->i_mode |= S_IFIFO; |
343 | /* BB Finish for SFU style symlinks and devies */ | 397 | /* BB Finish for SFU style symlinks and devices */ |
344 | /* } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) && | 398 | } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) && |
345 | (cifsInfo->cifsAttrs & ATTR_SYSTEM) && ) */ | 399 | (cifsInfo->cifsAttrs & ATTR_SYSTEM)) { |
346 | 400 | if (decode_sfu_inode(inode, | |
401 | le64_to_cpu(pfindData->EndOfFile), | ||
402 | search_path, | ||
403 | cifs_sb, xid)) { | ||
404 | cFYI(1,("Unrecognized sfu inode type")); | ||
405 | } | ||
347 | } else { | 406 | } else { |
348 | inode->i_mode |= S_IFREG; | 407 | inode->i_mode |= S_IFREG; |
349 | /* treat the dos attribute of read-only as read-only | 408 | /* treat the dos attribute of read-only as read-only |
@@ -377,24 +436,29 @@ int cifs_get_inode_info(struct inode **pinode, | |||
377 | } | 436 | } |
378 | 437 | ||
379 | if (S_ISREG(inode->i_mode)) { | 438 | if (S_ISREG(inode->i_mode)) { |
380 | cFYI(1, (" File inode ")); | 439 | cFYI(1, ("File inode")); |
381 | inode->i_op = &cifs_file_inode_ops; | 440 | inode->i_op = &cifs_file_inode_ops; |
382 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) | 441 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) { |
383 | inode->i_fop = &cifs_file_direct_ops; | 442 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) |
384 | else | 443 | inode->i_fop = |
444 | &cifs_file_direct_nobrl_ops; | ||
445 | else | ||
446 | inode->i_fop = &cifs_file_direct_ops; | ||
447 | } else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | ||
448 | inode->i_fop = &cifs_file_nobrl_ops; | ||
449 | else /* not direct, send byte range locks */ | ||
385 | inode->i_fop = &cifs_file_ops; | 450 | inode->i_fop = &cifs_file_ops; |
386 | if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | 451 | |
387 | inode->i_fop->lock = NULL; | ||
388 | inode->i_data.a_ops = &cifs_addr_ops; | 452 | inode->i_data.a_ops = &cifs_addr_ops; |
389 | if(pTcon->ses->server->maxBuf < | 453 | if(pTcon->ses->server->maxBuf < |
390 | 4096 + MAX_CIFS_HDR_SIZE) | 454 | 4096 + MAX_CIFS_HDR_SIZE) |
391 | inode->i_data.a_ops->readpages = NULL; | 455 | inode->i_data.a_ops->readpages = NULL; |
392 | } else if (S_ISDIR(inode->i_mode)) { | 456 | } else if (S_ISDIR(inode->i_mode)) { |
393 | cFYI(1, (" Directory inode ")); | 457 | cFYI(1, ("Directory inode")); |
394 | inode->i_op = &cifs_dir_inode_ops; | 458 | inode->i_op = &cifs_dir_inode_ops; |
395 | inode->i_fop = &cifs_dir_ops; | 459 | inode->i_fop = &cifs_dir_ops; |
396 | } else if (S_ISLNK(inode->i_mode)) { | 460 | } else if (S_ISLNK(inode->i_mode)) { |
397 | cFYI(1, (" Symbolic Link inode ")); | 461 | cFYI(1, ("Symbolic Link inode")); |
398 | inode->i_op = &cifs_symlink_inode_ops; | 462 | inode->i_op = &cifs_symlink_inode_ops; |
399 | } else { | 463 | } else { |
400 | init_special_inode(inode, inode->i_mode, | 464 | init_special_inode(inode, inode->i_mode, |
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index 34a06692e4fa..ca27a82c54cd 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c | |||
@@ -678,7 +678,7 @@ cifsConvertToUCS(__le16 * target, const char *source, int maxlen, | |||
678 | __u16 temp; | 678 | __u16 temp; |
679 | 679 | ||
680 | if(!mapChars) | 680 | if(!mapChars) |
681 | return cifs_strtoUCS((wchar_t *) target, source, PATH_MAX, cp); | 681 | return cifs_strtoUCS(target, source, PATH_MAX, cp); |
682 | 682 | ||
683 | for(i = 0, j = 0; i < maxlen; j++) { | 683 | for(i = 0, j = 0; i < maxlen; j++) { |
684 | src_char = source[i]; | 684 | src_char = source[i]; |
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index a86bd1c07602..9b7e0ff9584b 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -193,8 +193,14 @@ static void fill_in_inode(struct inode *tmp_inode, | |||
193 | if (S_ISREG(tmp_inode->i_mode)) { | 193 | if (S_ISREG(tmp_inode->i_mode)) { |
194 | cFYI(1, ("File inode")); | 194 | cFYI(1, ("File inode")); |
195 | tmp_inode->i_op = &cifs_file_inode_ops; | 195 | tmp_inode->i_op = &cifs_file_inode_ops; |
196 | if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) | 196 | if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) { |
197 | tmp_inode->i_fop = &cifs_file_direct_ops; | 197 | if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) |
198 | tmp_inode->i_fop = &cifs_file_direct_nobrl_ops; | ||
199 | else | ||
200 | tmp_inode->i_fop = &cifs_file_direct_ops; | ||
201 | |||
202 | } else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | ||
203 | tmp_inode->i_fop = &cifs_file_nobrl_ops; | ||
198 | else | 204 | else |
199 | tmp_inode->i_fop = &cifs_file_ops; | 205 | tmp_inode->i_fop = &cifs_file_ops; |
200 | if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | 206 | if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) |
@@ -699,7 +705,7 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst, | |||
699 | (__le16 *)filename, len/2, nlt); | 705 | (__le16 *)filename, len/2, nlt); |
700 | else | 706 | else |
701 | pqst->len = cifs_strfromUCS_le((char *)pqst->name, | 707 | pqst->len = cifs_strfromUCS_le((char *)pqst->name, |
702 | (wchar_t *)filename,len/2,nlt); | 708 | (__le16 *)filename,len/2,nlt); |
703 | } else { | 709 | } else { |
704 | pqst->name = filename; | 710 | pqst->name = filename; |
705 | pqst->len = len; | 711 | pqst->len = len; |