cifs: rename dup_vol to smb3_fs_context_dup and move it into fs_context.c
[linux-2.6-microblaze.git] / fs / cifs / fs_context.h
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
12 #include <linux/parser.h>
13 #include "cifsglob.h"
14
15 enum smb_version {
16         Smb_1 = 1,
17         Smb_20,
18         Smb_21,
19         Smb_30,
20         Smb_302,
21         Smb_311,
22         Smb_3any,
23         Smb_default,
24         Smb_version_err
25 };
26
27 int cifs_parse_smb_version(char *value, struct smb3_fs_context *ctx, bool is_smb3);
28
29 enum {
30         Opt_cache_loose,
31         Opt_cache_strict,
32         Opt_cache_none,
33         Opt_cache_ro,
34         Opt_cache_rw,
35         Opt_cache_err
36 };
37
38 int cifs_parse_cache_flavor(char *value, struct smb3_fs_context *ctx);
39
40 enum cifs_sec_param {
41         Opt_sec_krb5,
42         Opt_sec_krb5i,
43         Opt_sec_krb5p,
44         Opt_sec_ntlmsspi,
45         Opt_sec_ntlmssp,
46         Opt_ntlm,
47         Opt_sec_ntlmi,
48         Opt_sec_ntlmv2,
49         Opt_sec_ntlmv2i,
50         Opt_sec_lanman,
51         Opt_sec_none,
52
53         Opt_sec_err
54 };
55
56 struct smb3_fs_context {
57         bool uid_specified;
58         bool gid_specified;
59         bool sloppy;
60         char *nodename;
61         bool got_ip;
62         bool got_version;
63         unsigned short port;
64
65         char *username;
66         char *password;
67         char *domainname;
68         char *UNC;
69         char *iocharset;  /* local code page for mapping to and from Unicode */
70         char source_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL]; /* clnt nb name */
71         char target_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL]; /* srvr nb name */
72         kuid_t cred_uid;
73         kuid_t linux_uid;
74         kgid_t linux_gid;
75         kuid_t backupuid;
76         kgid_t backupgid;
77         umode_t file_mode;
78         umode_t dir_mode;
79         enum securityEnum sectype; /* sectype requested via mnt opts */
80         bool sign; /* was signing requested via mnt opts? */
81         bool ignore_signature:1;
82         bool retry:1;
83         bool intr:1;
84         bool setuids:1;
85         bool setuidfromacl:1;
86         bool override_uid:1;
87         bool override_gid:1;
88         bool dynperm:1;
89         bool noperm:1;
90         bool nodelete:1;
91         bool mode_ace:1;
92         bool no_psx_acl:1; /* set if posix acl support should be disabled */
93         bool cifs_acl:1;
94         bool backupuid_specified; /* mount option  backupuid  is specified */
95         bool backupgid_specified; /* mount option  backupgid  is specified */
96         bool no_xattr:1;   /* set if xattr (EA) support should be disabled*/
97         bool server_ino:1; /* use inode numbers from server ie UniqueId */
98         bool direct_io:1;
99         bool strict_io:1; /* strict cache behavior */
100         bool cache_ro:1;
101         bool cache_rw:1;
102         bool remap:1;      /* set to remap seven reserved chars in filenames */
103         bool sfu_remap:1;  /* remap seven reserved chars ala SFU */
104         bool posix_paths:1; /* unset to not ask for posix pathnames. */
105         bool no_linux_ext:1;
106         bool linux_ext:1;
107         bool sfu_emul:1;
108         bool nullauth:1;   /* attempt to authenticate with null user */
109         bool nocase:1;     /* request case insensitive filenames */
110         bool nobrl:1;      /* disable sending byte range locks to srv */
111         bool nohandlecache:1; /* disable caching dir handles if srvr probs */
112         bool mand_lock:1;  /* send mandatory not posix byte range lock reqs */
113         bool seal:1;       /* request transport encryption on share */
114         bool nodfs:1;      /* Do not request DFS, even if available */
115         bool local_lease:1; /* check leases only on local system, not remote */
116         bool noblocksnd:1;
117         bool noautotune:1;
118         bool nostrictsync:1; /* do not force expensive SMBflush on every sync */
119         bool no_lease:1;     /* disable requesting leases */
120         bool fsc:1;     /* enable fscache */
121         bool mfsymlinks:1; /* use Minshall+French Symlinks */
122         bool multiuser:1;
123         bool rwpidforward:1; /* pid forward for read/write operations */
124         bool nosharesock:1;
125         bool persistent:1;
126         bool nopersistent:1;
127         bool resilient:1; /* noresilient not required since not fored for CA */
128         bool domainauto:1;
129         bool rdma:1;
130         bool multichannel:1;
131         bool use_client_guid:1;
132         /* reuse existing guid for multichannel */
133         u8 client_guid[SMB2_CLIENT_GUID_SIZE];
134         unsigned int bsize;
135         unsigned int rsize;
136         unsigned int wsize;
137         unsigned int min_offload;
138         bool sockopt_tcp_nodelay:1;
139         unsigned long actimeo; /* attribute cache timeout (jiffies) */
140         struct smb_version_operations *ops;
141         struct smb_version_values *vals;
142         char *prepath;
143         struct sockaddr_storage dstaddr; /* destination address */
144         struct sockaddr_storage srcaddr; /* allow binding to a local IP */
145         struct nls_table *local_nls;
146         unsigned int echo_interval; /* echo interval in secs */
147         __u64 snapshot_time; /* needed for timewarp tokens */
148         __u32 handle_timeout; /* persistent and durable handle timeout in ms */
149         unsigned int max_credits; /* smb3 max_credits 10 < credits < 60000 */
150         unsigned int max_channels;
151         __u16 compression; /* compression algorithm 0xFFFF default 0=disabled */
152         bool rootfs:1; /* if it's a SMB root file system */
153 };
154
155 extern int cifs_parse_security_flavors(char *value, struct smb3_fs_context *ctx);
156 extern int smb3_fs_context_dup(struct smb3_fs_context *new_ctx, struct smb3_fs_context *ctx);
157
158 #endif