cifs: add initial reconfigure support
[linux-block.git] / fs / cifs / fs_context.h
CommitLineData
a6a9cffa
RS
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * Copyright (C) 2020, Microsoft Corporation.
4 *
5 * Author(s): Steve French <stfrench@microsoft.com>
6 * David Howells <dhowells@redhat.com>
7 */
8
9#ifndef _FS_CONTEXT_H
10#define _FS_CONTEXT_H
11
5c6e5aa4 12#include "cifsglob.h"
24e0a1ef
RS
13#include <linux/parser.h>
14#include <linux/fs_parser.h>
15
16#define cifs_invalf(fc, fmt, ...) invalf(fc, fmt, ## __VA_ARGS__)
a6a9cffa 17
555782aa
RS
18enum smb_version {
19 Smb_1 = 1,
20 Smb_20,
21 Smb_21,
22 Smb_30,
23 Smb_302,
24 Smb_311,
25 Smb_3any,
26 Smb_default,
27 Smb_version_err
28};
29
2f20f076
RS
30enum {
31 Opt_cache_loose,
32 Opt_cache_strict,
33 Opt_cache_none,
34 Opt_cache_ro,
35 Opt_cache_rw,
36 Opt_cache_err
37};
38
5c6e5aa4
RS
39enum cifs_sec_param {
40 Opt_sec_krb5,
41 Opt_sec_krb5i,
42 Opt_sec_krb5p,
43 Opt_sec_ntlmsspi,
44 Opt_sec_ntlmssp,
45 Opt_ntlm,
46 Opt_sec_ntlmi,
47 Opt_sec_ntlmv2,
48 Opt_sec_ntlmv2i,
49 Opt_sec_lanman,
50 Opt_sec_none,
a6a9cffa 51
5c6e5aa4
RS
52 Opt_sec_err
53};
54
15c7d09a
RS
55enum cifs_param {
56 /* Mount options that take no arguments */
24e0a1ef
RS
57 Opt_user_xattr,
58 Opt_forceuid,
59 Opt_forcegid,
15c7d09a
RS
60 Opt_noblocksend,
61 Opt_noautotune,
62 Opt_nolease,
24e0a1ef
RS
63 Opt_hard,
64 Opt_soft,
65 Opt_perm,
15c7d09a 66 Opt_nodelete,
24e0a1ef 67 Opt_mapposix,
15c7d09a
RS
68 Opt_mapchars,
69 Opt_nomapchars,
24e0a1ef 70 Opt_sfu,
15c7d09a 71 Opt_nodfs,
24e0a1ef
RS
72 Opt_posixpaths,
73 Opt_unix,
15c7d09a 74 Opt_nocase,
24e0a1ef
RS
75 Opt_brl,
76 Opt_handlecache,
15c7d09a
RS
77 Opt_forcemandatorylock,
78 Opt_setuidfromacl,
24e0a1ef
RS
79 Opt_setuids,
80 Opt_dynperm,
81 Opt_intr,
82 Opt_strictsync,
83 Opt_serverino,
15c7d09a 84 Opt_rwpidforward,
24e0a1ef
RS
85 Opt_cifsacl,
86 Opt_acl,
15c7d09a
RS
87 Opt_locallease,
88 Opt_sign,
89 Opt_ignore_signature,
90 Opt_seal,
91 Opt_noac,
92 Opt_fsc,
93 Opt_mfsymlinks,
94 Opt_multiuser,
95 Opt_sloppy,
96 Opt_nosharesock,
24e0a1ef
RS
97 Opt_persistent,
98 Opt_resilient,
15c7d09a
RS
99 Opt_domainauto,
100 Opt_rdma,
101 Opt_modesid,
102 Opt_rootfs,
24e0a1ef 103 Opt_multichannel,
15c7d09a 104 Opt_compress,
0ac4e291 105 Opt_witness,
15c7d09a
RS
106
107 /* Mount options which take numeric value */
108 Opt_backupuid,
109 Opt_backupgid,
110 Opt_uid,
111 Opt_cruid,
112 Opt_gid,
113 Opt_port,
114 Opt_file_mode,
115 Opt_dirmode,
116 Opt_min_enc_offload,
117 Opt_blocksize,
118 Opt_rsize,
119 Opt_wsize,
120 Opt_actimeo,
121 Opt_echo_interval,
122 Opt_max_credits,
123 Opt_snapshot,
124 Opt_max_channels,
125 Opt_handletimeout,
126
127 /* Mount options which take string value */
128 Opt_source,
129 Opt_user,
130 Opt_pass,
131 Opt_ip,
132 Opt_domain,
133 Opt_srcaddr,
134 Opt_iocharset,
135 Opt_netbiosname,
136 Opt_servern,
137 Opt_ver,
138 Opt_vers,
139 Opt_sec,
140 Opt_cache,
141
142 /* Mount options to be ignored */
143 Opt_ignore,
144
15c7d09a
RS
145 Opt_err
146};
147
3fa1c6d1
RS
148struct smb3_fs_context {
149 bool uid_specified;
150 bool gid_specified;
151 bool sloppy;
152 char *nodename;
153 bool got_ip;
154 bool got_version;
522aa3b5
RS
155 bool got_rsize;
156 bool got_wsize;
157 bool got_bsize;
3fa1c6d1
RS
158 unsigned short port;
159
160 char *username;
161 char *password;
162 char *domainname;
163 char *UNC;
164 char *iocharset; /* local code page for mapping to and from Unicode */
165 char source_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL]; /* clnt nb name */
166 char target_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL]; /* srvr nb name */
167 kuid_t cred_uid;
168 kuid_t linux_uid;
169 kgid_t linux_gid;
170 kuid_t backupuid;
171 kgid_t backupgid;
172 umode_t file_mode;
173 umode_t dir_mode;
174 enum securityEnum sectype; /* sectype requested via mnt opts */
175 bool sign; /* was signing requested via mnt opts? */
176 bool ignore_signature:1;
177 bool retry:1;
178 bool intr:1;
179 bool setuids:1;
180 bool setuidfromacl:1;
181 bool override_uid:1;
182 bool override_gid:1;
183 bool dynperm:1;
184 bool noperm:1;
185 bool nodelete:1;
186 bool mode_ace:1;
187 bool no_psx_acl:1; /* set if posix acl support should be disabled */
188 bool cifs_acl:1;
189 bool backupuid_specified; /* mount option backupuid is specified */
190 bool backupgid_specified; /* mount option backupgid is specified */
191 bool no_xattr:1; /* set if xattr (EA) support should be disabled*/
192 bool server_ino:1; /* use inode numbers from server ie UniqueId */
193 bool direct_io:1;
194 bool strict_io:1; /* strict cache behavior */
195 bool cache_ro:1;
196 bool cache_rw:1;
197 bool remap:1; /* set to remap seven reserved chars in filenames */
198 bool sfu_remap:1; /* remap seven reserved chars ala SFU */
199 bool posix_paths:1; /* unset to not ask for posix pathnames. */
200 bool no_linux_ext:1;
201 bool linux_ext:1;
202 bool sfu_emul:1;
203 bool nullauth:1; /* attempt to authenticate with null user */
204 bool nocase:1; /* request case insensitive filenames */
205 bool nobrl:1; /* disable sending byte range locks to srv */
206 bool nohandlecache:1; /* disable caching dir handles if srvr probs */
207 bool mand_lock:1; /* send mandatory not posix byte range lock reqs */
208 bool seal:1; /* request transport encryption on share */
209 bool nodfs:1; /* Do not request DFS, even if available */
210 bool local_lease:1; /* check leases only on local system, not remote */
211 bool noblocksnd:1;
212 bool noautotune:1;
213 bool nostrictsync:1; /* do not force expensive SMBflush on every sync */
214 bool no_lease:1; /* disable requesting leases */
215 bool fsc:1; /* enable fscache */
216 bool mfsymlinks:1; /* use Minshall+French Symlinks */
217 bool multiuser:1;
218 bool rwpidforward:1; /* pid forward for read/write operations */
219 bool nosharesock:1;
220 bool persistent:1;
221 bool nopersistent:1;
222 bool resilient:1; /* noresilient not required since not fored for CA */
223 bool domainauto:1;
224 bool rdma:1;
225 bool multichannel:1;
226 bool use_client_guid:1;
227 /* reuse existing guid for multichannel */
228 u8 client_guid[SMB2_CLIENT_GUID_SIZE];
229 unsigned int bsize;
230 unsigned int rsize;
231 unsigned int wsize;
232 unsigned int min_offload;
233 bool sockopt_tcp_nodelay:1;
234 unsigned long actimeo; /* attribute cache timeout (jiffies) */
235 struct smb_version_operations *ops;
236 struct smb_version_values *vals;
237 char *prepath;
238 struct sockaddr_storage dstaddr; /* destination address */
239 struct sockaddr_storage srcaddr; /* allow binding to a local IP */
240 struct nls_table *local_nls;
241 unsigned int echo_interval; /* echo interval in secs */
242 __u64 snapshot_time; /* needed for timewarp tokens */
243 __u32 handle_timeout; /* persistent and durable handle timeout in ms */
244 unsigned int max_credits; /* smb3 max_credits 10 < credits < 60000 */
245 unsigned int max_channels;
246 __u16 compression; /* compression algorithm 0xFFFF default 0=disabled */
247 bool rootfs:1; /* if it's a SMB root file system */
0ac4e291 248 bool witness:1; /* use witness protocol */
24e0a1ef
RS
249
250 char *mount_options;
3fa1c6d1
RS
251};
252
24e0a1ef
RS
253extern const struct fs_parameter_spec smb3_fs_parameters[];
254
255extern int cifs_parse_cache_flavor(char *value,
256 struct smb3_fs_context *ctx);
257extern int cifs_parse_security_flavors(char *value,
258 struct smb3_fs_context *ctx);
259extern int smb3_init_fs_context(struct fs_context *fc);
c741cba2
RS
260extern void smb3_cleanup_fs_context_contents(struct smb3_fs_context *ctx);
261extern void smb3_cleanup_fs_context(struct smb3_fs_context *ctx);
24e0a1ef
RS
262
263static inline struct smb3_fs_context *smb3_fc2context(const struct fs_context *fc)
264{
265 return fc->fs_private;
266}
267
837e3a1b 268extern int smb3_fs_context_dup(struct smb3_fs_context *new_ctx, struct smb3_fs_context *ctx);
a6a9cffa 269
5c6e5aa4 270#endif