Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

smb: move some SMB1 definitions into common/smb1pdu.h

These definitions are only used by SMB1, so move them into the new
common/smb1pdu.h.

KSMBD only implements SMB_COM_NEGOTIATE, see MS-SMB2 3.3.5.2.

Co-developed-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn>
Signed-off-by: ZhangGuoDong <zhangguodong@kylinos.cn>
Signed-off-by: Steve French <stfrench@microsoft.com>

authored by

ZhangGuoDong and committed by
Steve French
94d5b8db 05f5e355

+58 -43
+1 -1
fs/smb/client/cifspdu.h
··· 12 12 #include <net/sock.h> 13 13 #include <linux/unaligned.h> 14 14 #include "../common/smbfsctl.h" 15 - #include "../common/smb2pdu.h" 15 + #include "../common/smb1pdu.h" 16 16 17 17 #define CIFS_PROT 0 18 18 #define POSIX_PROT (CIFS_PROT+1)
+56
fs/smb/common/smb1pdu.h
··· 1 + /* SPDX-License-Identifier: LGPL-2.1 */ 2 + /* 3 + * 4 + * Copyright (C) International Business Machines Corp., 2002,2009 5 + * 2018 Samsung Electronics Co., Ltd. 6 + * Author(s): Steve French <sfrench@us.ibm.com> 7 + * Namjae Jeon <linkinjeon@kernel.org> 8 + * 9 + */ 10 + 11 + #ifndef _COMMON_SMB1_PDU_H 12 + #define _COMMON_SMB1_PDU_H 13 + 14 + #define SMB1_PROTO_NUMBER cpu_to_le32(0x424d53ff) 15 + 16 + /* 17 + * See MS-CIFS 2.2.3.1 18 + * MS-SMB 2.2.3.1 19 + */ 20 + struct smb_hdr { 21 + __u8 Protocol[4]; 22 + __u8 Command; 23 + union { 24 + struct { 25 + __u8 ErrorClass; 26 + __u8 Reserved; 27 + __le16 Error; 28 + } __packed DosError; 29 + __le32 CifsError; 30 + } __packed Status; 31 + __u8 Flags; 32 + __le16 Flags2; /* note: le */ 33 + __le16 PidHigh; 34 + union { 35 + struct { 36 + __le32 SequenceNumber; /* le */ 37 + __u32 Reserved; /* zero */ 38 + } __packed Sequence; 39 + __u8 SecuritySignature[8]; /* le */ 40 + } __packed Signature; 41 + __u8 pad[2]; 42 + __u16 Tid; 43 + __le16 Pid; 44 + __u16 Uid; 45 + __le16 Mid; 46 + __u8 WordCount; 47 + } __packed; 48 + 49 + /* See MS-CIFS 2.2.4.52.1 */ 50 + typedef struct smb_negotiate_req { 51 + struct smb_hdr hdr; /* wct = 0 */ 52 + __le16 ByteCount; 53 + unsigned char DialectsArray[]; 54 + } __packed SMB_NEGOTIATE_REQ; 55 + 56 + #endif /* _COMMON_SMB1_PDU_H */
-40
fs/smb/common/smb2pdu.h
··· 1986 1986 __le64 LeaseDuration; 1987 1987 } __packed; 1988 1988 1989 - /* 1990 - * See MS-CIFS 2.2.3.1 1991 - * MS-SMB 2.2.3.1 1992 - */ 1993 - struct smb_hdr { 1994 - __u8 Protocol[4]; 1995 - __u8 Command; 1996 - union { 1997 - struct { 1998 - __u8 ErrorClass; 1999 - __u8 Reserved; 2000 - __le16 Error; 2001 - } __packed DosError; 2002 - __le32 CifsError; 2003 - } __packed Status; 2004 - __u8 Flags; 2005 - __le16 Flags2; /* note: le */ 2006 - __le16 PidHigh; 2007 - union { 2008 - struct { 2009 - __le32 SequenceNumber; /* le */ 2010 - __u32 Reserved; /* zero */ 2011 - } __packed Sequence; 2012 - __u8 SecuritySignature[8]; /* le */ 2013 - } __packed Signature; 2014 - __u8 pad[2]; 2015 - __u16 Tid; 2016 - __le16 Pid; 2017 - __u16 Uid; 2018 - __le16 Mid; 2019 - __u8 WordCount; 2020 - } __packed; 2021 - 2022 1989 #define OP_BREAK_STRUCT_SIZE_20 24 2023 1990 #define OP_BREAK_STRUCT_SIZE_21 36 2024 1991 ··· 2089 2122 | WRITE_OWNER | SYNCHRONIZE) 2090 2123 #define SET_MINIMUM_RIGHTS (FILE_READ_EA | FILE_READ_ATTRIBUTES \ 2091 2124 | READ_CONTROL | SYNCHRONIZE) 2092 - 2093 - /* See MS-CIFS 2.2.4.52.1 */ 2094 - typedef struct smb_negotiate_req { 2095 - struct smb_hdr hdr; /* wct = 0 */ 2096 - __le16 ByteCount; 2097 - unsigned char DialectsArray[]; 2098 - } __packed SMB_NEGOTIATE_REQ; 2099 2125 2100 2126 #endif /* _COMMON_SMB2PDU_H */
-2
fs/smb/common/smbglob.h
··· 11 11 #ifndef _COMMON_SMB_GLOB_H 12 12 #define _COMMON_SMB_GLOB_H 13 13 14 - #define SMB1_PROTO_NUMBER cpu_to_le32(0x424d53ff) 15 - 16 14 struct smb_version_values { 17 15 char *version_string; 18 16 __u16 protocol_id;
+1
fs/smb/server/smb_common.h
··· 10 10 11 11 #include "glob.h" 12 12 #include "../common/smbglob.h" 13 + #include "../common/smb1pdu.h" 13 14 #include "../common/smb2pdu.h" 14 15 #include "../common/fscc.h" 15 16 #include "smb2pdu.h"