diff options
author | Pavel Shilovsky <pshilovsky@samba.org> | 2012-05-27 12:21:53 -0400 |
---|---|---|
committer | Pavel Shilovsky <pshilovsky@samba.org> | 2012-07-24 13:55:01 -0400 |
commit | b669f33ca61738171aecc5ae90d776d91b122eb8 (patch) | |
tree | 71b83c4f7155b2297f6b00bbe41c89e572d1b9fe /fs/cifs | |
parent | aa24d1e9692411e605084938ced6b160f92df454 (diff) |
CIFS: Move getting dfs referalls to ops struct
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/cifsglob.h | 5 | ||||
-rw-r--r-- | fs/cifs/cifsproto.h | 15 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 13 | ||||
-rw-r--r-- | fs/cifs/connect.c | 15 | ||||
-rw-r--r-- | fs/cifs/smb1ops.c | 1 |
5 files changed, 27 insertions, 22 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index ef4e0a0bc826..2d80d82f41d0 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -162,6 +162,7 @@ struct TCP_Server_Info; | |||
162 | struct cifsFileInfo; | 162 | struct cifsFileInfo; |
163 | struct cifs_ses; | 163 | struct cifs_ses; |
164 | struct cifs_tcon; | 164 | struct cifs_tcon; |
165 | struct dfs_info3_param; | ||
165 | 166 | ||
166 | struct smb_version_operations { | 167 | struct smb_version_operations { |
167 | int (*send_cancel)(struct TCP_Server_Info *, void *, | 168 | int (*send_cancel)(struct TCP_Server_Info *, void *, |
@@ -208,6 +209,10 @@ struct smb_version_operations { | |||
208 | struct cifs_tcon *, const struct nls_table *); | 209 | struct cifs_tcon *, const struct nls_table *); |
209 | /* close tree connecion */ | 210 | /* close tree connecion */ |
210 | int (*tree_disconnect)(const unsigned int, struct cifs_tcon *); | 211 | int (*tree_disconnect)(const unsigned int, struct cifs_tcon *); |
212 | /* get DFS referrals */ | ||
213 | int (*get_dfs_refer)(const unsigned int, struct cifs_ses *, | ||
214 | const char *, struct dfs_info3_param **, | ||
215 | unsigned int *, const struct nls_table *, int); | ||
211 | }; | 216 | }; |
212 | 217 | ||
213 | struct smb_version_values { | 218 | struct smb_version_values { |
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 61baaa3330fb..4857965b22db 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -226,17 +226,16 @@ extern int CIFSSMBUnixQPathInfo(const unsigned int xid, | |||
226 | const struct nls_table *nls_codepage, int remap); | 226 | const struct nls_table *nls_codepage, int remap); |
227 | 227 | ||
228 | extern int CIFSGetDFSRefer(const unsigned int xid, struct cifs_ses *ses, | 228 | extern int CIFSGetDFSRefer(const unsigned int xid, struct cifs_ses *ses, |
229 | const unsigned char *searchName, | 229 | const char *search_name, |
230 | struct dfs_info3_param **target_nodes, | 230 | struct dfs_info3_param **target_nodes, |
231 | unsigned int *number_of_nodes_in_array, | 231 | unsigned int *num_of_nodes, |
232 | const struct nls_table *nls_codepage, int remap); | 232 | const struct nls_table *nls_codepage, int remap); |
233 | 233 | ||
234 | extern int get_dfs_path(unsigned int xid, struct cifs_ses *pSesInfo, | 234 | extern int get_dfs_path(const unsigned int xid, struct cifs_ses *ses, |
235 | const char *old_path, | 235 | const char *old_path, |
236 | const struct nls_table *nls_codepage, | 236 | const struct nls_table *nls_codepage, |
237 | unsigned int *pnum_referrals, | 237 | unsigned int *num_referrals, |
238 | struct dfs_info3_param **preferrals, | 238 | struct dfs_info3_param **referrals, int remap); |
239 | int remap); | ||
240 | extern void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon, | 239 | extern void reset_cifs_unix_caps(unsigned int xid, struct cifs_tcon *tcon, |
241 | struct cifs_sb_info *cifs_sb, | 240 | struct cifs_sb_info *cifs_sb, |
242 | struct smb_vol *vol); | 241 | struct smb_vol *vol); |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index f1dfc7844f1b..af859c325db1 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -4766,8 +4766,7 @@ parse_DFS_referrals_exit: | |||
4766 | 4766 | ||
4767 | int | 4767 | int |
4768 | CIFSGetDFSRefer(const unsigned int xid, struct cifs_ses *ses, | 4768 | CIFSGetDFSRefer(const unsigned int xid, struct cifs_ses *ses, |
4769 | const unsigned char *searchName, | 4769 | const char *search_name, struct dfs_info3_param **target_nodes, |
4770 | struct dfs_info3_param **target_nodes, | ||
4771 | unsigned int *num_of_nodes, | 4770 | unsigned int *num_of_nodes, |
4772 | const struct nls_table *nls_codepage, int remap) | 4771 | const struct nls_table *nls_codepage, int remap) |
4773 | { | 4772 | { |
@@ -4781,7 +4780,7 @@ CIFSGetDFSRefer(const unsigned int xid, struct cifs_ses *ses, | |||
4781 | *num_of_nodes = 0; | 4780 | *num_of_nodes = 0; |
4782 | *target_nodes = NULL; | 4781 | *target_nodes = NULL; |
4783 | 4782 | ||
4784 | cFYI(1, "In GetDFSRefer the path %s", searchName); | 4783 | cFYI(1, "In GetDFSRefer the path %s", search_name); |
4785 | if (ses == NULL) | 4784 | if (ses == NULL) |
4786 | return -ENODEV; | 4785 | return -ENODEV; |
4787 | getDFSRetry: | 4786 | getDFSRetry: |
@@ -4804,14 +4803,14 @@ getDFSRetry: | |||
4804 | pSMB->hdr.Flags2 |= SMBFLG2_UNICODE; | 4803 | pSMB->hdr.Flags2 |= SMBFLG2_UNICODE; |
4805 | name_len = | 4804 | name_len = |
4806 | cifsConvertToUTF16((__le16 *) pSMB->RequestFileName, | 4805 | cifsConvertToUTF16((__le16 *) pSMB->RequestFileName, |
4807 | searchName, PATH_MAX, nls_codepage, | 4806 | search_name, PATH_MAX, nls_codepage, |
4808 | remap); | 4807 | remap); |
4809 | name_len++; /* trailing null */ | 4808 | name_len++; /* trailing null */ |
4810 | name_len *= 2; | 4809 | name_len *= 2; |
4811 | } else { /* BB improve the check for buffer overruns BB */ | 4810 | } else { /* BB improve the check for buffer overruns BB */ |
4812 | name_len = strnlen(searchName, PATH_MAX); | 4811 | name_len = strnlen(search_name, PATH_MAX); |
4813 | name_len++; /* trailing null */ | 4812 | name_len++; /* trailing null */ |
4814 | strncpy(pSMB->RequestFileName, searchName, name_len); | 4813 | strncpy(pSMB->RequestFileName, search_name, name_len); |
4815 | } | 4814 | } |
4816 | 4815 | ||
4817 | if (ses->server) { | 4816 | if (ses->server) { |
@@ -4867,7 +4866,7 @@ getDFSRetry: | |||
4867 | /* parse returned result into more usable form */ | 4866 | /* parse returned result into more usable form */ |
4868 | rc = parse_DFS_referrals(pSMBr, num_of_nodes, | 4867 | rc = parse_DFS_referrals(pSMBr, num_of_nodes, |
4869 | target_nodes, nls_codepage, remap, | 4868 | target_nodes, nls_codepage, remap, |
4870 | searchName); | 4869 | search_name); |
4871 | 4870 | ||
4872 | GetDFSRefExit: | 4871 | GetDFSRefExit: |
4873 | cifs_buf_release(pSMB); | 4872 | cifs_buf_release(pSMB); |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 7cf8b1632242..70a34d126001 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -2767,14 +2767,14 @@ out: | |||
2767 | } | 2767 | } |
2768 | 2768 | ||
2769 | int | 2769 | int |
2770 | get_dfs_path(unsigned int xid, struct cifs_ses *ses, const char *old_path, | 2770 | get_dfs_path(const unsigned int xid, struct cifs_ses *ses, const char *old_path, |
2771 | const struct nls_table *nls_codepage, unsigned int *num_referrals, | 2771 | const struct nls_table *nls_codepage, unsigned int *num_referrals, |
2772 | struct dfs_info3_param **referrals, int remap) | 2772 | struct dfs_info3_param **referrals, int remap) |
2773 | { | 2773 | { |
2774 | char *temp_unc; | 2774 | char *temp_unc; |
2775 | int rc = 0; | 2775 | int rc = 0; |
2776 | 2776 | ||
2777 | if (!ses->server->ops->tree_connect) | 2777 | if (!ses->server->ops->tree_connect || !ses->server->ops->get_dfs_refer) |
2778 | return -ENOSYS; | 2778 | return -ENOSYS; |
2779 | 2779 | ||
2780 | *num_referrals = 0; | 2780 | *num_referrals = 0; |
@@ -2796,11 +2796,12 @@ get_dfs_path(unsigned int xid, struct cifs_ses *ses, const char *old_path, | |||
2796 | kfree(temp_unc); | 2796 | kfree(temp_unc); |
2797 | } | 2797 | } |
2798 | if (rc == 0) | 2798 | if (rc == 0) |
2799 | rc = CIFSGetDFSRefer(xid, ses, old_path, referrals, | 2799 | rc = ses->server->ops->get_dfs_refer(xid, ses, old_path, |
2800 | num_referrals, nls_codepage, remap); | 2800 | referrals, num_referrals, |
2801 | nls_codepage, remap); | ||
2801 | /* | 2802 | /* |
2802 | * BB - map targetUNCs to dfs_info3 structures, here or in | 2803 | * BB - map targetUNCs to dfs_info3 structures, here or in |
2803 | * CIFSGetDFSRefer. | 2804 | * ses->server->ops->get_dfs_refer. |
2804 | */ | 2805 | */ |
2805 | 2806 | ||
2806 | return rc; | 2807 | return rc; |
@@ -3488,7 +3489,7 @@ build_unc_path_to_root(const struct smb_vol *vol, | |||
3488 | * determine whether there were referrals. | 3489 | * determine whether there were referrals. |
3489 | */ | 3490 | */ |
3490 | static int | 3491 | static int |
3491 | expand_dfs_referral(unsigned int xid, struct cifs_ses *pSesInfo, | 3492 | expand_dfs_referral(const unsigned int xid, struct cifs_ses *ses, |
3492 | struct smb_vol *volume_info, struct cifs_sb_info *cifs_sb, | 3493 | struct smb_vol *volume_info, struct cifs_sb_info *cifs_sb, |
3493 | int check_prefix) | 3494 | int check_prefix) |
3494 | { | 3495 | { |
@@ -3504,7 +3505,7 @@ expand_dfs_referral(unsigned int xid, struct cifs_ses *pSesInfo, | |||
3504 | /* For DFS paths, skip the first '\' of the UNC */ | 3505 | /* For DFS paths, skip the first '\' of the UNC */ |
3505 | ref_path = check_prefix ? full_path + 1 : volume_info->UNC + 1; | 3506 | ref_path = check_prefix ? full_path + 1 : volume_info->UNC + 1; |
3506 | 3507 | ||
3507 | rc = get_dfs_path(xid, pSesInfo , ref_path, cifs_sb->local_nls, | 3508 | rc = get_dfs_path(xid, ses, ref_path, cifs_sb->local_nls, |
3508 | &num_referrals, &referrals, | 3509 | &num_referrals, &referrals, |
3509 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); | 3510 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); |
3510 | 3511 | ||
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index 8f873863142a..6d9025b29e54 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c | |||
@@ -434,6 +434,7 @@ struct smb_version_operations smb1_operations = { | |||
434 | .logoff = CIFSSMBLogoff, | 434 | .logoff = CIFSSMBLogoff, |
435 | .tree_connect = CIFSTCon, | 435 | .tree_connect = CIFSTCon, |
436 | .tree_disconnect = CIFSSMBTDis, | 436 | .tree_disconnect = CIFSSMBTDis, |
437 | .get_dfs_refer = CIFSGetDFSRefer, | ||
437 | }; | 438 | }; |
438 | 439 | ||
439 | struct smb_version_values smb1_values = { | 440 | struct smb_version_values smb1_values = { |