Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Ronnie Sahlberg <lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: linux-cifs <linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: Steve French <smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: [PATCH 09/19] cifs: remove rfc1002 header from smb2_tree_connect_req
Date: Tue, 21 Nov 2017 11:04:32 +1100	[thread overview]
Message-ID: <20171121000442.24888-10-lsahlber@redhat.com> (raw)
In-Reply-To: <20171121000442.24888-1-lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

Signed-off-by: Ronnie Sahlberg <lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 fs/cifs/smb2pdu.c | 18 +++++++++---------
 fs/cifs/smb2pdu.h |  2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index c939b98dfb56..1d68dd0e3e45 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -1275,6 +1275,7 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
 	int unc_path_len;
 	__le16 *unc_path = NULL;
 	int flags = 0;
+	unsigned int total_len;
 
 	cifs_dbg(FYI, "TCON\n");
 
@@ -1296,7 +1297,8 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
 	if (tcon)
 		tcon->tid = 0;
 
-	rc = small_smb2_init(SMB2_TREE_CONNECT, tcon, (void **) &req);
+	rc = smb2_plain_req_init(SMB2_TREE_CONNECT, tcon, (void **) &req,
+			     &total_len);
 	if (rc) {
 		kfree(unc_path);
 		return rc;
@@ -1307,26 +1309,24 @@ SMB2_tcon(const unsigned int xid, struct cifs_ses *ses, const char *tree,
 			flags |= CIFS_TRANSFORM_REQ;
 
 		/* since no tcon, smb2_init can not do this, so do here */
-		req->hdr.sync_hdr.SessionId = ses->Suid;
+		req->sync_hdr.SessionId = ses->Suid;
 		if (ses->server->sign)
-			req->hdr.sync_hdr.Flags |= SMB2_FLAGS_SIGNED;
+			req->sync_hdr.Flags |= SMB2_FLAGS_SIGNED;
 	} else if (encryption_required(tcon))
 		flags |= CIFS_TRANSFORM_REQ;
 
 	iov[0].iov_base = (char *)req;
-	/* 4 for rfc1002 length field and 1 for pad */
-	iov[0].iov_len = get_rfc1002_length(req) + 4 - 1;
+	/* 1 for pad */
+	iov[0].iov_len = total_len - 1;
 
 	/* Testing shows that buffer offset must be at location of Buffer[0] */
 	req->PathOffset = cpu_to_le16(sizeof(struct smb2_tree_connect_req)
-			- 1 /* pad */ - 4 /* do not count rfc1001 len field */);
+			- 1 /* pad */);
 	req->PathLength = cpu_to_le16(unc_path_len - 2);
 	iov[1].iov_base = unc_path;
 	iov[1].iov_len = unc_path_len;
 
-	inc_rfc1001_len(req, unc_path_len - 1 /* pad */);
-
-	rc = SendReceive2(xid, ses, iov, 2, &resp_buftype, flags, &rsp_iov);
+	rc = smb2_send_recv(xid, ses, iov, 2, &resp_buftype, flags, &rsp_iov);
 	cifs_small_buf_release(req);
 	rsp = (struct smb2_tree_connect_rsp *)rsp_iov.iov_base;
 
diff --git a/fs/cifs/smb2pdu.h b/fs/cifs/smb2pdu.h
index e7acfa5e3fa6..4f80b95d02ae 100644
--- a/fs/cifs/smb2pdu.h
+++ b/fs/cifs/smb2pdu.h
@@ -323,7 +323,7 @@ struct smb2_logoff_rsp {
 #define SMB2_SHAREFLAG_CLUSTER_RECONNECT	0x0001
 
 struct smb2_tree_connect_req {
-	struct smb2_hdr hdr;
+	struct smb2_sync_hdr sync_hdr;
 	__le16 StructureSize;	/* Must be 9 */
 	__le16 Reserved; /* Flags in SMB3.1.1 */
 	__le16 PathOffset;
-- 
2.13.3

  parent reply	other threads:[~2017-11-21  0:04 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-21  0:04 [PATCH 00/19 Version 4] cifs: remove rfc1002 from smb2 requests Ronnie Sahlberg
     [not found] ` <20171121000442.24888-1-lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-11-21  0:04   ` [PATCH 01/19] cifs: Add smb2_send_recv Ronnie Sahlberg
2017-11-21  0:04   ` [PATCH 02/19] cifs: remove rfc1002 header from smb2_negotiate_req Ronnie Sahlberg
2017-11-21  0:04   ` [PATCH 03/19] cifs: remove rfc1002 header from smb2_logoff_req Ronnie Sahlberg
2017-11-21  0:04   ` [PATCH 04/19] cifs: remove rfc1002 header from smb2_tree_disconnect_req Ronnie Sahlberg
2017-11-21  0:04   ` [PATCH 05/19] cifs: remove rfc1002 header from smb2_close_req Ronnie Sahlberg
2017-11-21  0:04   ` [PATCH 06/19] cifs: remove rfc1002 header from smb2_ioctl_req Ronnie Sahlberg
     [not found]     ` <20171121000442.24888-7-lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-11-21  1:14       ` Pavel Shilovsky
2017-11-21  0:04   ` [PATCH 07/19] cifs: remove rfc1002 header from smb2_echo_req Ronnie Sahlberg
2017-11-21  0:04   ` [PATCH 08/19] cifs: remove rfc1002 header from smb2_sess_setup_req Ronnie Sahlberg
2017-11-21  0:04   ` Ronnie Sahlberg [this message]
2017-11-21  0:04   ` [PATCH 10/19] cifs: remove rfc1002 header from smb2_create_req Ronnie Sahlberg
2017-11-21  0:04   ` [PATCH 11/19] cifs: remove rfc1002 header from smb2_flush_req Ronnie Sahlberg
2017-11-21  0:04   ` [PATCH 12/19] cifs: remove rfc1002 header from smb2_lock_req Ronnie Sahlberg
2017-11-21  0:04   ` [PATCH 13/19] cifs: remove rfc1002 header from smb2 read/write requests Ronnie Sahlberg
2017-11-21  0:04   ` [PATCH 14/19] cifs: remove rfc1002 header from smb2_lease_ack Ronnie Sahlberg
2017-11-21  0:04   ` [PATCH 15/19] cifs: remove rfc1002 header from smb2_oplock_break we get from server Ronnie Sahlberg
2017-11-21  0:04   ` [PATCH 16/19] cifs: remove rfc1002 header from smb2_set_info_req Ronnie Sahlberg
2017-11-21  0:04   ` [PATCH 17/19] cifs: remove rfc1002 header from smb2_query_directory_req Ronnie Sahlberg
2017-11-21  0:04   ` [PATCH 18/19] cifs: remove rfc1002 header from smb2_query_info_req Ronnie Sahlberg
2017-11-21  0:04   ` [PATCH 19/19] cifs: remove small_smb2_init Ronnie Sahlberg
2017-11-21  1:22   ` [PATCH 00/19 Version 4] cifs: remove rfc1002 from smb2 requests Pavel Shilovsky
     [not found]     ` <CAKywueTabn0mDuagWUq5h4ByN_UszFZtpy4d5H_cy1qfEPZHEw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-21 11:15       ` Aurélien Aptel
  -- strict thread matches above, loose matches on Subject: below --
2017-11-20  0:24 [PATCH 00/10] cifs: Remove rfc1002 header from smb2 request structs Ronnie Sahlberg
     [not found] ` <20171120002447.32322-1-lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-11-20  0:24   ` [PATCH 09/19] cifs: remove rfc1002 header from smb2_tree_connect_req Ronnie Sahlberg
2017-11-09  1:14 [PATCH 00/19] Remove rfc1002 header from smb2 request structs Ronnie Sahlberg
     [not found] ` <20171109011433.14468-1-lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-11-09  1:14   ` [PATCH 09/19] cifs: remove rfc1002 header from smb2_tree_connect_req Ronnie Sahlberg
     [not found]     ` <20171109011433.14468-10-lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-11-09 14:10       ` Aurélien Aptel
2017-11-02  7:02 [PATCH 00/19] cifs: remove rfc1002 header from all smb2 requests Ronnie Sahlberg
     [not found] ` <20171102070312.18903-1-lsahlber-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-11-02  7:03   ` [PATCH 09/19] cifs: remove rfc1002 header from smb2_tree_connect_req Ronnie Sahlberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171121000442.24888-10-lsahlber@redhat.com \
    --to=lsahlber-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox