xref: /linux/fs/smb/common/smbglob.h (revision 3d99347a2e1ae60d9368b1d734290bab1acde0ce)
1 /* SPDX-License-Identifier: LGPL-2.1 */
2 /*
3  *
4  *   Copyright (C) International Business Machines  Corp., 2002,2008
5  *                 2018 Samsung Electronics Co., Ltd.
6  *   Author(s): Steve French (sfrench@us.ibm.com)
7  *              Jeremy Allison (jra@samba.org)
8  *              Namjae Jeon (linkinjeon@kernel.org)
9  *
10  */
11 #ifndef _COMMON_SMB_GLOB_H
12 #define _COMMON_SMB_GLOB_H
13 
14 #define SMB1_PROTO_NUMBER		cpu_to_le32(0x424d53ff)
15 
16 struct smb_version_values {
17 	char		*version_string;
18 	__u16		protocol_id;
19 	__le16		lock_cmd;
20 	__u32		req_capabilities;
21 	__u32		max_read_size;
22 	__u32		max_write_size;
23 	__u32		max_trans_size;
24 	__u32		max_credits;
25 	__u32		large_lock_type;
26 	__u32		exclusive_lock_type;
27 	__u32		shared_lock_type;
28 	__u32		unlock_lock_type;
29 	size_t		header_size;
30 	size_t		max_header_size;
31 	size_t		read_rsp_size;
32 	unsigned int	cap_unix;
33 	unsigned int	cap_nt_find;
34 	unsigned int	cap_large_files;
35 	unsigned int	cap_unicode;
36 	__u16		signing_enabled;
37 	__u16		signing_required;
38 	size_t		create_lease_size;
39 	size_t		create_durable_size;
40 	size_t		create_durable_v2_size;
41 	size_t		create_mxac_size;
42 	size_t		create_disk_id_size;
43 	size_t		create_posix_size;
44 };
45 
get_rfc1002_len(void * buf)46 static inline unsigned int get_rfc1002_len(void *buf)
47 {
48 	return be32_to_cpu(*((__be32 *)buf)) & 0xffffff;
49 }
50 
inc_rfc1001_len(void * buf,int count)51 static inline void inc_rfc1001_len(void *buf, int count)
52 {
53 	be32_add_cpu((__be32 *)buf, count);
54 }
55 
56 #define SMB1_VERSION_STRING	"1.0"
57 #define SMB20_VERSION_STRING    "2.0"
58 #define SMB21_VERSION_STRING	"2.1"
59 #define SMBDEFAULT_VERSION_STRING "default"
60 #define SMB3ANY_VERSION_STRING "3"
61 #define SMB30_VERSION_STRING	"3.0"
62 #define SMB302_VERSION_STRING	"3.02"
63 #define ALT_SMB302_VERSION_STRING "3.0.2"
64 #define SMB311_VERSION_STRING	"3.1.1"
65 #define ALT_SMB311_VERSION_STRING "3.11"
66 
67 #define CIFS_DEFAULT_IOSIZE (1024 * 1024)
68 
69 #define MAX_CIFS_SMALL_BUFFER_SIZE 448 /* big enough for most */
70 
71 #endif	/* _COMMON_SMB_GLOB_H */
72