// SPDX-License-Identifier: GPL-2.0-only
/*
* linux/fs/nfs/fs_context.c
*
* Copyright (C) 1992 Rick Sladkey
*
* NFS mount handling.
*
* Split from fs/nfs/super.c by David Howells <dhowells@redhat.com>
*/
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/fs_context.h>
#include <linux/fs_parser.h>
#include <linux/nfs_fs.h>
#include <linux/nfs_mount.h>
#include <linux/nfs4_mount.h>
#include "nfs.h"
#include "internal.h"
#define NFSDBG_FACILITY NFSDBG_MOUNT
#if IS_ENABLED(CONFIG_NFS_V3)
#define NFS_DEFAULT_VERSION 3
#else
#define NFS_DEFAULT_VERSION 2
#endif
#define NFS_MAX_CONNECTIONS 16
enum nfs_param {
Opt_ac,
Opt_acdirmax,
Opt_acdirmin,
Opt_acl,
Opt_acregmax,
Opt_acregmin,
Opt_actimeo,
Opt_addr,
Opt_bg,
Opt_bsize,
Opt_clientaddr,
Opt_cto,
Opt_fg,
Opt_fscache,
Opt_hard,
Opt_intr,
Opt_local_lock,
Opt_lock,
Opt_lookupcache,
Opt_migration,
Opt_minorversion,
Opt_mountaddr,
Opt_mounthost,
Opt_mountport,
Opt_mountproto,
Opt_mountvers,
Opt_namelen,
Opt_nconnect,
Opt_port,
Opt_posix,
Opt_proto,
Opt_rdirplus,
Opt_rdma,
Opt_resvport,
Opt_retrans,
Opt_retry,
Opt_rsize,
Opt_sec,
Opt_sharecache,
Opt_sloppy,
Opt_soft,
Opt_softerr,
Opt_source,
Opt_tcp,
Opt_timeo,
Opt_udp,
Opt_v,
Opt_vers,
Opt_wsize,
};
static const struct fs_parameter_spec nfs_param_specs[] = {
fsparam_flag_no("ac", Opt_ac),
fsparam_u32 ("acdirmax", Opt_acdirmax),
fsparam_u32 ("acdirmin", Opt_acdirmin),
fsparam_flag_no("acl", Opt_acl),
fsparam_u32 ("acregmax", Opt_acregmax),
fsparam_u32 ("acregmin", Opt_acregmin),
fsparam_u32 ("actimeo", Opt_actimeo),
fsparam_string("addr", Opt_addr),
fsparam_flag ("bg", Opt_bg),
fsparam_u32 ("bsize", Opt_bsize),
fsparam_string("clientaddr", Opt_clientaddr),
fsparam_flag_no("cto", Opt_cto),
fsparam_flag ("fg", Opt_fg),
__fsparam(fs_param_is_string, "fsc", Opt_fscache,
fs_param_neg_with_no|fs_param_v_optional),
fsparam_flag ("hard", Opt_hard),
__fsparam(fs_param_is_flag, "intr", Opt_intr,
fs_param_neg_with_no