1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Copyright (C) 2020, Microsoft Corporation.
5 * Author(s): Steve French <stfrench@microsoft.com>
6 * David Howells <dhowells@redhat.com>
13 #include <linux/parser.h>
14 #include <linux/fs_parser.h>
16 /* Log errors in fs_context (new mount api) but also in dmesg (old style) */
17 #define cifs_errorf(fc, fmt, ...) \
19 errorf(fc, fmt, ## __VA_ARGS__); \
20 cifs_dbg(VFS, fmt, ## __VA_ARGS__); \
58 /* Mount options that take no arguments */
80 Opt_forcemandatorylock,
111 /* Mount options which take numeric value */
136 /* Mount options which take string value */
151 /* Mount options to be ignored */
157 struct smb3_fs_context {
159 bool cruid_specified;
173 char *server_hostname;
176 char workstation_name[CIFS_MAX_WORKSTATION_LEN];
177 char *iocharset; /* local code page for mapping to and from Unicode */
178 char source_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL]; /* clnt nb name */
179 char target_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL]; /* srvr nb name */
187 enum securityEnum sectype; /* sectype requested via mnt opts */
188 bool sign; /* was signing requested via mnt opts? */
189 bool ignore_signature:1;
193 bool setuidfromacl:1;
200 bool no_psx_acl:1; /* set if posix acl support should be disabled */
202 bool backupuid_specified; /* mount option backupuid is specified */
203 bool backupgid_specified; /* mount option backupgid is specified */
204 bool no_xattr:1; /* set if xattr (EA) support should be disabled*/
205 bool server_ino:1; /* use inode numbers from server ie UniqueId */
207 bool strict_io:1; /* strict cache behavior */
210 bool remap:1; /* set to remap seven reserved chars in filenames */
211 bool sfu_remap:1; /* remap seven reserved chars ala SFU */
212 bool posix_paths:1; /* unset to not ask for posix pathnames. */
216 bool nullauth:1; /* attempt to authenticate with null user */
217 bool nocase:1; /* request case insensitive filenames */
218 bool nobrl:1; /* disable sending byte range locks to srv */
219 bool nohandlecache:1; /* disable caching dir handles if srvr probs */
220 bool mand_lock:1; /* send mandatory not posix byte range lock reqs */
221 bool seal:1; /* request transport encryption on share */
222 bool nodfs:1; /* Do not request DFS, even if available */
223 bool local_lease:1; /* check leases only on local system, not remote */
226 bool nostrictsync:1; /* do not force expensive SMBflush on every sync */
227 bool no_lease:1; /* disable requesting leases */
228 bool no_sparse:1; /* do not attempt to set files sparse */
229 bool fsc:1; /* enable fscache */
230 bool mfsymlinks:1; /* use Minshall+French Symlinks */
232 bool rwpidforward:1; /* pid forward for read/write operations */
236 bool resilient:1; /* noresilient not required since not fored for CA */
240 bool use_client_guid:1;
241 /* reuse existing guid for multichannel */
242 u8 client_guid[SMB2_CLIENT_GUID_SIZE];
247 unsigned int min_offload;
248 bool sockopt_tcp_nodelay:1;
249 /* attribute cache timemout for files and directories in jiffies */
250 unsigned long acregmax;
251 unsigned long acdirmax;
252 /* timeout for deferred close of files in jiffies */
253 unsigned long closetimeo;
254 struct smb_version_operations *ops;
255 struct smb_version_values *vals;
257 struct sockaddr_storage dstaddr; /* destination address */
258 struct sockaddr_storage srcaddr; /* allow binding to a local IP */
259 struct nls_table *local_nls; /* This is a copy of the pointer in cifs_sb */
260 unsigned int echo_interval; /* echo interval in secs */
261 __u64 snapshot_time; /* needed for timewarp tokens */
262 __u32 handle_timeout; /* persistent and durable handle timeout in ms */
263 unsigned int max_credits; /* smb3 max_credits 10 < credits < 60000 */
264 unsigned int max_channels;
265 unsigned int max_cached_dirs;
266 __u16 compression; /* compression algorithm 0xFFFF default 0=disabled */
267 bool rootfs:1; /* if it's a SMB root file system */
268 bool witness:1; /* use witness protocol */
270 struct cifs_ses *dfs_root_ses;
273 extern const struct fs_parameter_spec smb3_fs_parameters[];
275 extern int smb3_init_fs_context(struct fs_context *fc);
276 extern void smb3_cleanup_fs_context_contents(struct smb3_fs_context *ctx);
277 extern void smb3_cleanup_fs_context(struct smb3_fs_context *ctx);
279 static inline struct smb3_fs_context *smb3_fc2context(const struct fs_context *fc)
281 return fc->fs_private;
284 extern int smb3_fs_context_dup(struct smb3_fs_context *new_ctx, struct smb3_fs_context *ctx);
285 extern void smb3_update_mnt_flags(struct cifs_sb_info *cifs_sb);
288 * max deferred close timeout (jiffies) - 2^30
290 #define SMB3_MAX_DCLOSETIMEO (1 << 30)
291 #define SMB3_DEF_DCLOSETIMEO (1 * HZ) /* even 1 sec enough to help eg open/write/close/open/read */
292 #define MAX_CACHED_FIDS 16
293 extern char *cifs_sanitize_prepath(char *prepath, gfp_t gfp);