]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
smb: move SMB_NEGOTIATE_REQ to common/smb2pdu.h
authorChenXiaoSong <chenxiaosong@kylinos.cn>
Sun, 2 Nov 2025 07:30:53 +0000 (15:30 +0800)
committerSteve French <stfrench@microsoft.com>
Mon, 1 Dec 2025 03:11:45 +0000 (21:11 -0600)
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>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/cifspdu.h
fs/smb/client/cifssmb.c
fs/smb/common/smb2pdu.h
fs/smb/server/smb_common.h

index 99cdba9f68dceeae1c4639279c86884e403ebcae..1e16ef6f0ff5507a0a2b59b6193de807f0090df5 100644 (file)
@@ -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 */
index 132d015cbdf1bea9f165f039bfbc08128050c8a9..fba439447dec36fbfdfa435fde5916a837d7a98c 100644 (file)
@@ -361,7 +361,7 @@ vt2_err:
 }
 
 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;
index be1e652bb474128e763c744cfd55bd558dc4c88b..824d27297beca2717ac8b14b32348eacfe5b1654 100644 (file)
@@ -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 */
index 6be079d78022e8732838600aca6c8decc807cd3c..c5df18d679b5f2df2e8dcc90d1ef1327cec7f593 100644 (file)
 #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 */