linux/fs/nfs/fs_context.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * linux/fs/nfs/fs_context.c
 *
 * Copyright (C) 1992 Rick Sladkey
 * Conversion to new mount api Copyright (C) David Howells
 *
 * NFS mount handling.
 *
 * Split from fs/nfs/super.c by David Howells <[email protected]>
 */

#include <linux/compat.h>
#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 <net/handshake.h>

#include "nfs.h"
#include "internal.h"

#include "nfstrace.h"

#define NFSDBG_FACILITY

#if IS_ENABLED(CONFIG_NFS_V3)
#define NFS_DEFAULT_VERSION
#else
#define NFS_DEFAULT_VERSION
#endif

#define NFS_MAX_CONNECTIONS

enum nfs_param {};

enum {};

static const struct constant_table nfs_param_enums_local_lock[] =;

enum {};

static const struct constant_table nfs_param_enums_lookupcache[] =;

enum {};

static const struct constant_table nfs_param_enums_write[] =;

static const struct fs_parameter_spec nfs_fs_parameters[] =;

enum {};

static const struct constant_table nfs_vers_tokens[] =;

enum {};

static const struct constant_table nfs_xprt_protocol_tokens[] =;

enum {};

static const struct constant_table nfs_secflavor_tokens[] =;

enum {};

static const struct constant_table nfs_xprtsec_policies[] =;

/*
 * Sanity-check a server address provided by the mount command.
 *
 * Address family must be initialized, and address must not be
 * the ANY address for that family.
 */
static int nfs_verify_server_address(struct sockaddr_storage *addr)
{}

#ifdef CONFIG_NFS_DISABLE_UDP_SUPPORT
static bool nfs_server_transport_udp_invalid(const struct nfs_fs_context *ctx)
{}
#else
static bool nfs_server_transport_udp_invalid(const struct nfs_fs_context *ctx)
{
	if (ctx->version == 4)
		return true;
	return false;
}
#endif

/*
 * Sanity check the NFS transport protocol.
 */
static int nfs_validate_transport_protocol(struct fs_context *fc,
					   struct nfs_fs_context *ctx)
{}

/*
 * For text based NFSv2/v3 mounts, the mount protocol transport default
 * settings should depend upon the specified NFS transport.
 */
static void nfs_set_mount_transport_protocol(struct nfs_fs_context *ctx)
{}

/*
 * Add 'flavor' to 'auth_info' if not already present.
 * Returns true if 'flavor' ends up in the list, false otherwise
 */
static int nfs_auth_info_add(struct fs_context *fc,
			     struct nfs_auth_info *auth_info,
			     rpc_authflavor_t flavor)
{}

/*
 * Parse the value of the 'sec=' option.
 */
static int nfs_parse_security_flavors(struct fs_context *fc,
				      struct fs_parameter *param)
{}

static int nfs_parse_xprtsec_policy(struct fs_context *fc,
				    struct fs_parameter *param)
{}

static int nfs_parse_version_string(struct fs_context *fc,
				    const char *string)
{}

/*
 * Parse a single mount parameter.
 */
static int nfs_fs_context_parse_param(struct fs_context *fc,
				      struct fs_parameter *param)
{}

/*
 * Split fc->source into "hostname:export_path".
 *
 * The leftmost colon demarks the split between the server's hostname
 * and the export path.  If the hostname starts with a left square
 * bracket, then it may contain colons.
 *
 * Note: caller frees hostname and export path, even on error.
 */
static int nfs_parse_source(struct fs_context *fc,
			    size_t maxnamlen, size_t maxpathlen)
{}

static inline bool is_remount_fc(struct fs_context *fc)
{}

/*
 * Parse monolithic NFS2/NFS3 mount data
 * - fills in the mount root filehandle
 *
 * For option strings, user space handles the following behaviors:
 *
 * + DNS: mapping server host name to IP address ("addr=" option)
 *
 * + failure mode: how to behave if a mount request can't be handled
 *   immediately ("fg/bg" option)
 *
 * + retry: how often to retry a mount request ("retry=" option)
 *
 * + breaking back: trying proto=udp after proto=tcp, v2 after v3,
 *   mountproto=tcp after mountproto=udp, and so on
 */
static int nfs23_parse_monolithic(struct fs_context *fc,
				  struct nfs_mount_data *data)
{}

#if IS_ENABLED(CONFIG_NFS_V4)
struct compat_nfs_string {};

static inline void compat_nfs_string(struct nfs_string *dst,
				     struct compat_nfs_string *src)
{}

struct compat_nfs4_mount_data_v1 {};

static void nfs4_compat_mount_data_conv(struct nfs4_mount_data *data)
{}

/*
 * Validate NFSv4 mount options
 */
static int nfs4_parse_monolithic(struct fs_context *fc,
				 struct nfs4_mount_data *data)
{}
#endif

/*
 * Parse a monolithic block of data from sys_mount().
 */
static int nfs_fs_context_parse_monolithic(struct fs_context *fc,
					   void *data)
{}

/*
 * Validate the preparsed information in the config.
 */
static int nfs_fs_context_validate(struct fs_context *fc)
{}

/*
 * Create an NFS superblock by the appropriate method.
 */
static int nfs_get_tree(struct fs_context *fc)
{}

/*
 * Handle duplication of a configuration.  The caller copied *src into *sc, but
 * it can't deal with resource pointers in the filesystem context, so we have
 * to do that.  We need to clear pointers, copy data or get extra refs as
 * appropriate.
 */
static int nfs_fs_context_dup(struct fs_context *fc, struct fs_context *src_fc)
{}

static void nfs_fs_context_free(struct fs_context *fc)
{}

static const struct fs_context_operations nfs_fs_context_ops =;

/*
 * Prepare superblock configuration.  We use the namespaces attached to the
 * context.  This may be the current process's namespaces, or it may be a
 * container's namespaces.
 */
static int nfs_init_fs_context(struct fs_context *fc)
{}

struct file_system_type nfs_fs_type =;
MODULE_ALIAS_FS();
EXPORT_SYMBOL_GPL();

#if IS_ENABLED(CONFIG_NFS_V4)
struct file_system_type nfs4_fs_type =;
MODULE_ALIAS_FS();
MODULE_ALIAS();
EXPORT_SYMBOL_GPL();
#endif /* CONFIG_NFS_V4 */