Skip to content

Commit d8ac987

Browse files
ChenXiaoSongsmfrench
authored andcommitted
smb: move SMB_NEGOTIATE_REQ to common/smb2pdu.h
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>
1 parent 1172d85 commit d8ac987

4 files changed

Lines changed: 15 additions & 17 deletions

File tree

fs/smb/client/cifspdu.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -388,19 +388,15 @@ put_bcc(__u16 count, struct smb_hdr *hdr)
388388
*
389389
*/
390390

391-
typedef struct negotiate_req {
392-
struct smb_hdr hdr; /* wct = 0 */
393-
__le16 ByteCount;
394-
unsigned char DialectsArray[];
395-
} __attribute__((packed)) NEGOTIATE_REQ;
396-
397391
#define MIN_TZ_ADJ (15 * 60) /* minimum grid for timezones in seconds */
398392

399393
#define READ_RAW_ENABLE 1
400394
#define WRITE_RAW_ENABLE 2
401395
#define RAW_ENABLE (READ_RAW_ENABLE | WRITE_RAW_ENABLE)
402396
#define SMB1_CLIENT_GUID_SIZE (16)
403-
typedef struct negotiate_rsp {
397+
398+
/* See MS-CIFS 2.2.4.52.2 */
399+
typedef struct smb_negotiate_rsp {
404400
struct smb_hdr hdr; /* wct = 17 */
405401
__le16 DialectIndex; /* 0xFFFF = no dialect acceptable */
406402
__u8 SecurityMode;
@@ -426,7 +422,7 @@ typedef struct negotiate_rsp {
426422
unsigned char SecurityBlob[];
427423
} __attribute__((packed)) extended_response;
428424
} __attribute__((packed)) u;
429-
} __attribute__((packed)) NEGOTIATE_RSP;
425+
} __packed SMB_NEGOTIATE_RSP;
430426

431427
/* SecurityMode bits */
432428
#define SECMODE_USER 0x01 /* off indicates share level security */

fs/smb/client/cifssmb.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ static int validate_t2(struct smb_t2_rsp *pSMB)
361361
}
362362

363363
static int
364-
decode_ext_sec_blob(struct cifs_ses *ses, NEGOTIATE_RSP *pSMBr)
364+
decode_ext_sec_blob(struct cifs_ses *ses, SMB_NEGOTIATE_RSP *pSMBr)
365365
{
366366
int rc = 0;
367367
u16 count;
@@ -419,8 +419,8 @@ CIFSSMBNegotiate(const unsigned int xid,
419419
struct cifs_ses *ses,
420420
struct TCP_Server_Info *server)
421421
{
422-
NEGOTIATE_REQ *pSMB;
423-
NEGOTIATE_RSP *pSMBr;
422+
SMB_NEGOTIATE_REQ *pSMB;
423+
SMB_NEGOTIATE_RSP *pSMBr;
424424
int rc = 0;
425425
int bytes_returned;
426426
int i;

fs/smb/common/smb2pdu.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2151,4 +2151,11 @@ struct smb_hdr {
21512151
#define SET_MINIMUM_RIGHTS (FILE_READ_EA | FILE_READ_ATTRIBUTES \
21522152
| READ_CONTROL | SYNCHRONIZE)
21532153

2154+
/* See MS-CIFS 2.2.4.52.1 */
2155+
typedef struct smb_negotiate_req {
2156+
struct smb_hdr hdr; /* wct = 0 */
2157+
__le16 ByteCount;
2158+
unsigned char DialectsArray[];
2159+
} __packed SMB_NEGOTIATE_REQ;
2160+
21542161
#endif /* _COMMON_SMB2PDU_H */

fs/smb/server/smb_common.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,7 @@
116116
#define SMBFLG2_ERR_STATUS cpu_to_le16(0x4000)
117117
#define SMBFLG2_UNICODE cpu_to_le16(0x8000)
118118

119-
struct smb_negotiate_req {
120-
struct smb_hdr hdr; /* wct = 0 */
121-
__le16 ByteCount;
122-
unsigned char DialectsArray[];
123-
} __packed;
124-
119+
/* See MS-CIFS 2.2.4.52.2 */
125120
struct smb_negotiate_rsp {
126121
struct smb_hdr hdr; /* wct = 17 */
127122
__le16 DialectIndex; /* 0xFFFF = no dialect acceptable */

0 commit comments

Comments
 (0)