diff options
author | Pavel Shilovsky <pshilovsky@samba.org> | 2012-05-25 02:54:49 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2012-07-24 11:25:03 -0400 |
commit | 58c45c58a1cbc8d2e1d07839820bf745fb3e7f41 (patch) | |
tree | 1952b449f17ef2f544fdb88240149c927bd0fc5c /fs | |
parent | 286170aa241819f39d9d1d5d9f2434cfb8519506 (diff) |
CIFS: Move protocol specific session setup/logoff code to ops struct
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/cifsglob.h | 5 | ||||
-rw-r--r-- | fs/cifs/cifsproto.h | 10 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 2 | ||||
-rw-r--r-- | fs/cifs/connect.c | 18 | ||||
-rw-r--r-- | fs/cifs/sess.c | 2 | ||||
-rw-r--r-- | fs/cifs/smb1ops.c | 2 |
6 files changed, 24 insertions, 15 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 8a4150573cf8..a6eb9befdb2d 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -196,6 +196,11 @@ struct smb_version_operations { | |||
196 | bool (*need_neg)(struct TCP_Server_Info *); | 196 | bool (*need_neg)(struct TCP_Server_Info *); |
197 | /* negotiate to the server */ | 197 | /* negotiate to the server */ |
198 | int (*negotiate)(const unsigned int, struct cifs_ses *); | 198 | int (*negotiate)(const unsigned int, struct cifs_ses *); |
199 | /* setup smb sessionn */ | ||
200 | int (*sess_setup)(const unsigned int, struct cifs_ses *, | ||
201 | const struct nls_table *); | ||
202 | /* close smb session */ | ||
203 | int (*logoff)(const unsigned int, struct cifs_ses *); | ||
199 | }; | 204 | }; |
200 | 205 | ||
201 | struct smb_version_values { | 206 | struct smb_version_values { |
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 723a3273c6bb..a17be2618473 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -112,8 +112,8 @@ extern void header_assemble(struct smb_hdr *, char /* command */ , | |||
112 | extern int small_smb_init_no_tc(const int smb_cmd, const int wct, | 112 | extern int small_smb_init_no_tc(const int smb_cmd, const int wct, |
113 | struct cifs_ses *ses, | 113 | struct cifs_ses *ses, |
114 | void **request_buf); | 114 | void **request_buf); |
115 | extern int CIFS_SessSetup(unsigned int xid, struct cifs_ses *ses, | 115 | extern int CIFS_SessSetup(const unsigned int xid, struct cifs_ses *ses, |
116 | const struct nls_table *nls_cp); | 116 | const struct nls_table *nls_cp); |
117 | extern struct timespec cifs_NTtimeToUnix(__le64 utc_nanoseconds_since_1601); | 117 | extern struct timespec cifs_NTtimeToUnix(__le64 utc_nanoseconds_since_1601); |
118 | extern u64 cifs_UnixTimeToNT(struct timespec); | 118 | extern u64 cifs_UnixTimeToNT(struct timespec); |
119 | extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time, | 119 | extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time, |
@@ -180,8 +180,8 @@ void cifs_proc_clean(void); | |||
180 | 180 | ||
181 | extern int cifs_negotiate_protocol(const unsigned int xid, | 181 | extern int cifs_negotiate_protocol(const unsigned int xid, |
182 | struct cifs_ses *ses); | 182 | struct cifs_ses *ses); |
183 | extern int cifs_setup_session(unsigned int xid, struct cifs_ses *ses, | 183 | extern int cifs_setup_session(const unsigned int xid, struct cifs_ses *ses, |
184 | struct nls_table *nls_info); | 184 | struct nls_table *nls_info); |
185 | extern int CIFSSMBNegotiate(const unsigned int xid, struct cifs_ses *ses); | 185 | extern int CIFSSMBNegotiate(const unsigned int xid, struct cifs_ses *ses); |
186 | 186 | ||
187 | extern int CIFSTCon(unsigned int xid, struct cifs_ses *ses, | 187 | extern int CIFSTCon(unsigned int xid, struct cifs_ses *ses, |
@@ -391,7 +391,7 @@ extern int CIFSSMBPosixLock(const int xid, struct cifs_tcon *tcon, | |||
391 | const bool waitFlag); | 391 | const bool waitFlag); |
392 | extern int CIFSSMBTDis(const int xid, struct cifs_tcon *tcon); | 392 | extern int CIFSSMBTDis(const int xid, struct cifs_tcon *tcon); |
393 | extern int CIFSSMBEcho(struct TCP_Server_Info *server); | 393 | extern int CIFSSMBEcho(struct TCP_Server_Info *server); |
394 | extern int CIFSSMBLogoff(const int xid, struct cifs_ses *ses); | 394 | extern int CIFSSMBLogoff(const unsigned int xid, struct cifs_ses *ses); |
395 | 395 | ||
396 | extern struct cifs_ses *sesInfoAlloc(void); | 396 | extern struct cifs_ses *sesInfoAlloc(void); |
397 | extern void sesInfoFree(struct cifs_ses *); | 397 | extern void sesInfoFree(struct cifs_ses *); |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index ae59d6e4e4f5..915b8fc212e9 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -781,7 +781,7 @@ CIFSSMBEcho(struct TCP_Server_Info *server) | |||
781 | } | 781 | } |
782 | 782 | ||
783 | int | 783 | int |
784 | CIFSSMBLogoff(const int xid, struct cifs_ses *ses) | 784 | CIFSSMBLogoff(const unsigned int xid, struct cifs_ses *ses) |
785 | { | 785 | { |
786 | LOGOFF_ANDX_REQ *pSMB; | 786 | LOGOFF_ANDX_REQ *pSMB; |
787 | int rc = 0; | 787 | int rc = 0; |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 03389f59390f..444243d9232b 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -2253,7 +2253,7 @@ cifs_find_smb_ses(struct TCP_Server_Info *server, struct smb_vol *vol) | |||
2253 | static void | 2253 | static void |
2254 | cifs_put_smb_ses(struct cifs_ses *ses) | 2254 | cifs_put_smb_ses(struct cifs_ses *ses) |
2255 | { | 2255 | { |
2256 | int xid; | 2256 | unsigned int xid; |
2257 | struct TCP_Server_Info *server = ses->server; | 2257 | struct TCP_Server_Info *server = ses->server; |
2258 | 2258 | ||
2259 | cFYI(1, "%s: ses_count=%d", __func__, ses->ses_count); | 2259 | cFYI(1, "%s: ses_count=%d", __func__, ses->ses_count); |
@@ -2266,9 +2266,9 @@ cifs_put_smb_ses(struct cifs_ses *ses) | |||
2266 | list_del_init(&ses->smb_ses_list); | 2266 | list_del_init(&ses->smb_ses_list); |
2267 | spin_unlock(&cifs_tcp_ses_lock); | 2267 | spin_unlock(&cifs_tcp_ses_lock); |
2268 | 2268 | ||
2269 | if (ses->status == CifsGood) { | 2269 | if (ses->status == CifsGood && server->ops->logoff) { |
2270 | xid = GetXid(); | 2270 | xid = GetXid(); |
2271 | CIFSSMBLogoff(xid, ses); | 2271 | server->ops->logoff(xid, ses); |
2272 | _FreeXid(xid); | 2272 | _FreeXid(xid); |
2273 | } | 2273 | } |
2274 | sesInfoFree(ses); | 2274 | sesInfoFree(ses); |
@@ -3989,11 +3989,11 @@ cifs_negotiate_protocol(const unsigned int xid, struct cifs_ses *ses) | |||
3989 | return rc; | 3989 | return rc; |
3990 | } | 3990 | } |
3991 | 3991 | ||
3992 | 3992 | int | |
3993 | int cifs_setup_session(unsigned int xid, struct cifs_ses *ses, | 3993 | cifs_setup_session(const unsigned int xid, struct cifs_ses *ses, |
3994 | struct nls_table *nls_info) | 3994 | struct nls_table *nls_info) |
3995 | { | 3995 | { |
3996 | int rc = 0; | 3996 | int rc = -ENOSYS; |
3997 | struct TCP_Server_Info *server = ses->server; | 3997 | struct TCP_Server_Info *server = ses->server; |
3998 | 3998 | ||
3999 | ses->flags = 0; | 3999 | ses->flags = 0; |
@@ -4004,7 +4004,9 @@ int cifs_setup_session(unsigned int xid, struct cifs_ses *ses, | |||
4004 | cFYI(1, "Security Mode: 0x%x Capabilities: 0x%x TimeAdjust: %d", | 4004 | cFYI(1, "Security Mode: 0x%x Capabilities: 0x%x TimeAdjust: %d", |
4005 | server->sec_mode, server->capabilities, server->timeAdj); | 4005 | server->sec_mode, server->capabilities, server->timeAdj); |
4006 | 4006 | ||
4007 | rc = CIFS_SessSetup(xid, ses, nls_info); | 4007 | if (server->ops->sess_setup) |
4008 | rc = server->ops->sess_setup(xid, ses, nls_info); | ||
4009 | |||
4008 | if (rc) { | 4010 | if (rc) { |
4009 | cERROR(1, "Send error in SessSetup = %d", rc); | 4011 | cERROR(1, "Send error in SessSetup = %d", rc); |
4010 | } else { | 4012 | } else { |
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index 3ba3f3cd2397..08efc3c8efef 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c | |||
@@ -556,7 +556,7 @@ setup_ntlmv2_ret: | |||
556 | } | 556 | } |
557 | 557 | ||
558 | int | 558 | int |
559 | CIFS_SessSetup(unsigned int xid, struct cifs_ses *ses, | 559 | CIFS_SessSetup(const unsigned int xid, struct cifs_ses *ses, |
560 | const struct nls_table *nls_cp) | 560 | const struct nls_table *nls_cp) |
561 | { | 561 | { |
562 | int rc = 0; | 562 | int rc = 0; |
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c index ea4fb8aaaafb..6b0a5d616338 100644 --- a/fs/cifs/smb1ops.c +++ b/fs/cifs/smb1ops.c | |||
@@ -430,6 +430,8 @@ struct smb_version_operations smb1_operations = { | |||
430 | .check_trans2 = cifs_check_trans2, | 430 | .check_trans2 = cifs_check_trans2, |
431 | .need_neg = cifs_need_neg, | 431 | .need_neg = cifs_need_neg, |
432 | .negotiate = cifs_negotiate, | 432 | .negotiate = cifs_negotiate, |
433 | .sess_setup = CIFS_SessSetup, | ||
434 | .logoff = CIFSSMBLogoff, | ||
433 | }; | 435 | }; |
434 | 436 | ||
435 | struct smb_version_values smb1_values = { | 437 | struct smb_version_values smb1_values = { |