0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef _FS_CONTEXT_H
0010 #define _FS_CONTEXT_H
0011
0012 #include "cifsglob.h"
0013 #include <linux/parser.h>
0014 #include <linux/fs_parser.h>
0015
0016
0017 #define cifs_errorf(fc, fmt, ...) \
0018 do { \
0019 errorf(fc, fmt, ## __VA_ARGS__); \
0020 cifs_dbg(VFS, fmt, ## __VA_ARGS__); \
0021 } while (0)
0022
0023 enum smb_version {
0024 Smb_1 = 1,
0025 Smb_20,
0026 Smb_21,
0027 Smb_30,
0028 Smb_302,
0029 Smb_311,
0030 Smb_3any,
0031 Smb_default,
0032 Smb_version_err
0033 };
0034
0035 enum {
0036 Opt_cache_loose,
0037 Opt_cache_strict,
0038 Opt_cache_none,
0039 Opt_cache_ro,
0040 Opt_cache_rw,
0041 Opt_cache_err
0042 };
0043
0044 enum cifs_sec_param {
0045 Opt_sec_krb5,
0046 Opt_sec_krb5i,
0047 Opt_sec_krb5p,
0048 Opt_sec_ntlmsspi,
0049 Opt_sec_ntlmssp,
0050 Opt_sec_ntlmv2,
0051 Opt_sec_ntlmv2i,
0052 Opt_sec_none,
0053
0054 Opt_sec_err
0055 };
0056
0057 enum cifs_param {
0058
0059 Opt_user_xattr,
0060 Opt_forceuid,
0061 Opt_forcegid,
0062 Opt_noblocksend,
0063 Opt_noautotune,
0064 Opt_nolease,
0065 Opt_nosparse,
0066 Opt_hard,
0067 Opt_soft,
0068 Opt_perm,
0069 Opt_nodelete,
0070 Opt_mapposix,
0071 Opt_mapchars,
0072 Opt_nomapchars,
0073 Opt_sfu,
0074 Opt_nodfs,
0075 Opt_posixpaths,
0076 Opt_unix,
0077 Opt_nocase,
0078 Opt_brl,
0079 Opt_handlecache,
0080 Opt_forcemandatorylock,
0081 Opt_setuidfromacl,
0082 Opt_setuids,
0083 Opt_dynperm,
0084 Opt_intr,
0085 Opt_strictsync,
0086 Opt_serverino,
0087 Opt_rwpidforward,
0088 Opt_cifsacl,
0089 Opt_acl,
0090 Opt_locallease,
0091 Opt_sign,
0092 Opt_ignore_signature,
0093 Opt_seal,
0094 Opt_noac,
0095 Opt_fsc,
0096 Opt_mfsymlinks,
0097 Opt_multiuser,
0098 Opt_sloppy,
0099 Opt_nosharesock,
0100 Opt_persistent,
0101 Opt_resilient,
0102 Opt_tcp_nodelay,
0103 Opt_domainauto,
0104 Opt_rdma,
0105 Opt_modesid,
0106 Opt_rootfs,
0107 Opt_multichannel,
0108 Opt_compress,
0109 Opt_witness,
0110
0111
0112 Opt_backupuid,
0113 Opt_backupgid,
0114 Opt_uid,
0115 Opt_cruid,
0116 Opt_gid,
0117 Opt_port,
0118 Opt_file_mode,
0119 Opt_dirmode,
0120 Opt_min_enc_offload,
0121 Opt_blocksize,
0122 Opt_rasize,
0123 Opt_rsize,
0124 Opt_wsize,
0125 Opt_actimeo,
0126 Opt_acdirmax,
0127 Opt_acregmax,
0128 Opt_closetimeo,
0129 Opt_echo_interval,
0130 Opt_max_credits,
0131 Opt_snapshot,
0132 Opt_max_channels,
0133 Opt_handletimeout,
0134
0135
0136 Opt_source,
0137 Opt_user,
0138 Opt_pass,
0139 Opt_ip,
0140 Opt_domain,
0141 Opt_srcaddr,
0142 Opt_iocharset,
0143 Opt_netbiosname,
0144 Opt_servern,
0145 Opt_ver,
0146 Opt_vers,
0147 Opt_sec,
0148 Opt_cache,
0149
0150
0151 Opt_ignore,
0152
0153 Opt_err
0154 };
0155
0156 struct smb3_fs_context {
0157 bool uid_specified;
0158 bool cruid_specified;
0159 bool gid_specified;
0160 bool sloppy;
0161 bool got_ip;
0162 bool got_version;
0163 bool got_rsize;
0164 bool got_wsize;
0165 bool got_bsize;
0166 unsigned short port;
0167
0168 char *username;
0169 char *password;
0170 char *domainname;
0171 char *source;
0172 char *server_hostname;
0173 char *UNC;
0174 char *nodename;
0175 char workstation_name[CIFS_MAX_WORKSTATION_LEN];
0176 char *iocharset;
0177 char source_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL];
0178 char target_rfc1001_name[RFC1001_NAME_LEN_WITH_NULL];
0179 kuid_t cred_uid;
0180 kuid_t linux_uid;
0181 kgid_t linux_gid;
0182 kuid_t backupuid;
0183 kgid_t backupgid;
0184 umode_t file_mode;
0185 umode_t dir_mode;
0186 enum securityEnum sectype;
0187 bool sign;
0188 bool ignore_signature:1;
0189 bool retry:1;
0190 bool intr:1;
0191 bool setuids:1;
0192 bool setuidfromacl:1;
0193 bool override_uid:1;
0194 bool override_gid:1;
0195 bool dynperm:1;
0196 bool noperm:1;
0197 bool nodelete:1;
0198 bool mode_ace:1;
0199 bool no_psx_acl:1;
0200 bool cifs_acl:1;
0201 bool backupuid_specified;
0202 bool backupgid_specified;
0203 bool no_xattr:1;
0204 bool server_ino:1;
0205 bool direct_io:1;
0206 bool strict_io:1;
0207 bool cache_ro:1;
0208 bool cache_rw:1;
0209 bool remap:1;
0210 bool sfu_remap:1;
0211 bool posix_paths:1;
0212 bool no_linux_ext:1;
0213 bool linux_ext:1;
0214 bool sfu_emul:1;
0215 bool nullauth:1;
0216 bool nocase:1;
0217 bool nobrl:1;
0218 bool nohandlecache:1;
0219 bool mand_lock:1;
0220 bool seal:1;
0221 bool nodfs:1;
0222 bool local_lease:1;
0223 bool noblocksnd:1;
0224 bool noautotune:1;
0225 bool nostrictsync:1;
0226 bool no_lease:1;
0227 bool no_sparse:1;
0228 bool fsc:1;
0229 bool mfsymlinks:1;
0230 bool multiuser:1;
0231 bool rwpidforward:1;
0232 bool nosharesock:1;
0233 bool persistent:1;
0234 bool nopersistent:1;
0235 bool resilient:1;
0236 bool domainauto:1;
0237 bool rdma:1;
0238 bool multichannel:1;
0239 bool use_client_guid:1;
0240
0241 u8 client_guid[SMB2_CLIENT_GUID_SIZE];
0242 unsigned int bsize;
0243 unsigned int rasize;
0244 unsigned int rsize;
0245 unsigned int wsize;
0246 unsigned int min_offload;
0247 bool sockopt_tcp_nodelay:1;
0248
0249 unsigned long acregmax;
0250 unsigned long acdirmax;
0251
0252 unsigned long closetimeo;
0253 struct smb_version_operations *ops;
0254 struct smb_version_values *vals;
0255 char *prepath;
0256 struct sockaddr_storage dstaddr;
0257 struct sockaddr_storage srcaddr;
0258 struct nls_table *local_nls;
0259 unsigned int echo_interval;
0260 __u64 snapshot_time;
0261 __u32 handle_timeout;
0262 unsigned int max_credits;
0263 unsigned int max_channels;
0264 __u16 compression;
0265 bool rootfs:1;
0266 bool witness:1;
0267
0268 char *mount_options;
0269 };
0270
0271 extern const struct fs_parameter_spec smb3_fs_parameters[];
0272
0273 extern int smb3_init_fs_context(struct fs_context *fc);
0274 extern void smb3_cleanup_fs_context_contents(struct smb3_fs_context *ctx);
0275 extern void smb3_cleanup_fs_context(struct smb3_fs_context *ctx);
0276
0277 static inline struct smb3_fs_context *smb3_fc2context(const struct fs_context *fc)
0278 {
0279 return fc->fs_private;
0280 }
0281
0282 extern int smb3_fs_context_dup(struct smb3_fs_context *new_ctx, struct smb3_fs_context *ctx);
0283 extern void smb3_update_mnt_flags(struct cifs_sb_info *cifs_sb);
0284
0285
0286
0287
0288 #define SMB3_MAX_DCLOSETIMEO (1 << 30)
0289 #define SMB3_DEF_DCLOSETIMEO (5 * HZ)
0290 #endif