From: chenxiaosong.chenxiaosong@linux.dev
To: sfrench@samba.org, smfrench@gmail.com, linkinjeon@kernel.org,
linkinjeon@samba.org, christophe.jaillet@wanadoo.fr
Cc: linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org,
ChenXiaoSong <chenxiaosong@kylinos.cn>
Subject: [PATCH v5 08/14] smb: move SMB_NEGOTIATE_REQ to common/smb2pdu.h
Date: Sun, 2 Nov 2025 15:30:53 +0800 [thread overview]
Message-ID: <20251102073059.3681026-9-chenxiaosong.chenxiaosong@linux.dev> (raw)
In-Reply-To: <20251102073059.3681026-1-chenxiaosong.chenxiaosong@linux.dev>
From: ChenXiaoSong <chenxiaosong@kylinos.cn>
Modify the following places:
- negotiate_req -> smb_negotiate_req
- NEGOTIATE_REQ -> SMB_NEGOTIATE_REQ
- negotiate_rsp -> smb_negotiate_rsp
- NEGOTIATE_RSP -> SMB_NEGOTIATE_RSP
Then move SMB_NEGOTIATE_REQ to common header file.
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
---
fs/smb/client/cifspdu.h | 12 ++++--------
fs/smb/client/cifssmb.c | 6 +++---
fs/smb/common/smb2pdu.h | 7 +++++++
fs/smb/server/smb_common.h | 7 +------
4 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/fs/smb/client/cifspdu.h b/fs/smb/client/cifspdu.h
index 99cdba9f68dc..1e16ef6f0ff5 100644
--- a/fs/smb/client/cifspdu.h
+++ b/fs/smb/client/cifspdu.h
@@ -388,19 +388,15 @@ put_bcc(__u16 count, struct smb_hdr *hdr)
*
*/
-typedef struct negotiate_req {
- struct smb_hdr hdr; /* wct = 0 */
- __le16 ByteCount;
- unsigned char DialectsArray[];
-} __attribute__((packed)) NEGOTIATE_REQ;
-
#define MIN_TZ_ADJ (15 * 60) /* minimum grid for timezones in seconds */
#define READ_RAW_ENABLE 1
#define WRITE_RAW_ENABLE 2
#define RAW_ENABLE (READ_RAW_ENABLE | WRITE_RAW_ENABLE)
#define SMB1_CLIENT_GUID_SIZE (16)
-typedef struct negotiate_rsp {
+
+/* See MS-CIFS 2.2.4.52.2 */
+typedef struct smb_negotiate_rsp {
struct smb_hdr hdr; /* wct = 17 */
__le16 DialectIndex; /* 0xFFFF = no dialect acceptable */
__u8 SecurityMode;
@@ -426,7 +422,7 @@ typedef struct negotiate_rsp {
unsigned char SecurityBlob[];
} __attribute__((packed)) extended_response;
} __attribute__((packed)) u;
-} __attribute__((packed)) NEGOTIATE_RSP;
+} __packed SMB_NEGOTIATE_RSP;
/* SecurityMode bits */
#define SECMODE_USER 0x01 /* off indicates share level security */
diff --git a/fs/smb/client/cifssmb.c b/fs/smb/client/cifssmb.c
index 703c5a8ed924..0ef1d5024998 100644
--- a/fs/smb/client/cifssmb.c
+++ b/fs/smb/client/cifssmb.c
@@ -361,7 +361,7 @@ static int validate_t2(struct smb_t2_rsp *pSMB)
}
static int
-decode_ext_sec_blob(struct cifs_ses *ses, NEGOTIATE_RSP *pSMBr)
+decode_ext_sec_blob(struct cifs_ses *ses, SMB_NEGOTIATE_RSP *pSMBr)
{
int rc = 0;
u16 count;
@@ -419,8 +419,8 @@ CIFSSMBNegotiate(const unsigned int xid,
struct cifs_ses *ses,
struct TCP_Server_Info *server)
{
- NEGOTIATE_REQ *pSMB;
- NEGOTIATE_RSP *pSMBr;
+ SMB_NEGOTIATE_REQ *pSMB;
+ SMB_NEGOTIATE_RSP *pSMBr;
int rc = 0;
int bytes_returned;
int i;
diff --git a/fs/smb/common/smb2pdu.h b/fs/smb/common/smb2pdu.h
index be1e652bb474..824d27297bec 100644
--- a/fs/smb/common/smb2pdu.h
+++ b/fs/smb/common/smb2pdu.h
@@ -2151,4 +2151,11 @@ struct smb_hdr {
#define SET_MINIMUM_RIGHTS (FILE_READ_EA | FILE_READ_ATTRIBUTES \
| READ_CONTROL | SYNCHRONIZE)
+/* See MS-CIFS 2.2.4.52.1 */
+typedef struct smb_negotiate_req {
+ struct smb_hdr hdr; /* wct = 0 */
+ __le16 ByteCount;
+ unsigned char DialectsArray[];
+} __packed SMB_NEGOTIATE_REQ;
+
#endif /* _COMMON_SMB2PDU_H */
diff --git a/fs/smb/server/smb_common.h b/fs/smb/server/smb_common.h
index 1928b66d309f..cd21756379b5 100644
--- a/fs/smb/server/smb_common.h
+++ b/fs/smb/server/smb_common.h
@@ -116,12 +116,7 @@
#define SMBFLG2_ERR_STATUS cpu_to_le16(0x4000)
#define SMBFLG2_UNICODE cpu_to_le16(0x8000)
-struct smb_negotiate_req {
- struct smb_hdr hdr; /* wct = 0 */
- __le16 ByteCount;
- unsigned char DialectsArray[];
-} __packed;
-
+/* See MS-CIFS 2.2.4.52.2 */
struct smb_negotiate_rsp {
struct smb_hdr hdr; /* wct = 17 */
__le16 DialectIndex; /* 0xFFFF = no dialect acceptable */
--
2.43.0
next prev parent reply other threads:[~2025-11-02 7:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-02 7:30 [PATCH v5 00/14] smb: move duplicate definitions to common header file chenxiaosong.chenxiaosong
2025-11-02 7:30 ` [PATCH v5 01/14] smb/client: fix CAP_BULK_TRANSFER value chenxiaosong.chenxiaosong
2025-11-02 7:30 ` [PATCH v5 02/14] smb: move MAX_CIFS_SMALL_BUFFER_SIZE to common/smbglob.h chenxiaosong.chenxiaosong
2025-11-02 7:30 ` [PATCH v5 03/14] smb: move create_durable_req_v2 to common/smb2pdu.h chenxiaosong.chenxiaosong
2025-11-02 7:30 ` [PATCH v5 04/14] smb: move create_durable_handle_reconnect_v2 " chenxiaosong.chenxiaosong
2025-11-02 7:30 ` [PATCH v5 05/14] smb: move create_durable_rsp_v2 " chenxiaosong.chenxiaosong
2025-11-02 7:30 ` [PATCH v5 06/14] smb/server: remove create_durable_reconn_req chenxiaosong.chenxiaosong
2025-11-02 7:30 ` [PATCH v5 07/14] smb: move some duplicate definitions to common/smb2pdu.h chenxiaosong.chenxiaosong
2025-11-04 4:04 ` ChenXiaoSong
2025-11-02 7:30 ` chenxiaosong.chenxiaosong [this message]
2025-11-02 7:30 ` [PATCH v5 09/14] smb: move list of FileSystemAttributes to common/fscc.h chenxiaosong.chenxiaosong
2025-11-02 7:30 ` [PATCH v5 10/14] smb: move some duplicate struct definitions " chenxiaosong.chenxiaosong
2025-11-02 7:30 ` [PATCH v5 11/14] smb: move FILE_SYSTEM_SIZE_INFO " chenxiaosong.chenxiaosong
2025-11-02 7:30 ` [PATCH v5 12/14] smb: move FILE_SYSTEM_ATTRIBUTE_INFO " chenxiaosong.chenxiaosong
2025-11-02 7:30 ` [PATCH v5 13/14] smb: do some cleanups chenxiaosong.chenxiaosong
2025-11-02 7:30 ` [PATCH v5 14/14] smb: fix some warnings reported by scripts/checkpatch.pl chenxiaosong.chenxiaosong
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=20251102073059.3681026-9-chenxiaosong.chenxiaosong@linux.dev \
--to=chenxiaosong.chenxiaosong@linux.dev \
--cc=chenxiaosong@kylinos.cn \
--cc=christophe.jaillet@wanadoo.fr \
--cc=linkinjeon@kernel.org \
--cc=linkinjeon@samba.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sfrench@samba.org \
--cc=smfrench@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).