Beispiel #1
0
/*
 * Returns the RPC version number specified by the given mount options,
 * or the version "3" if all fails.
 */
static rpcvers_t nfs_mount_version(struct mount_options *options)
{
	long tmp;

	if (po_get_numeric(options, "mountvers", &tmp) == PO_FOUND)
		if (tmp >= 1 && tmp <= 4)
			return tmp;

	return nfsvers_to_mnt(nfs_nfs_version(options));
}
Beispiel #2
0
/**
 * nfs_options2pmap - set up pmap structs based on mount options
 * @options: pointer to mount options
 * @nfs_pmap: OUT: pointer to pmap arguments for NFS server
 * @mnt_pmap: OUT: pointer to pmap arguments for mountd server
 *
 */
void nfs_options2pmap(struct mount_options *options,
		      struct pmap *nfs_pmap, struct pmap *mnt_pmap)
{
	nfs_pmap->pm_prog = nfs_nfs_program(options);
	nfs_pmap->pm_vers = nfs_nfs_version(options);
	nfs_pmap->pm_prot = nfs_nfs_protocol(options);
	nfs_pmap->pm_port = nfs_nfs_port(options);

	mnt_pmap->pm_prog = nfs_mount_program(options);
	mnt_pmap->pm_vers = nfs_mount_version(options);
	mnt_pmap->pm_prot = nfs_mount_protocol(options);
	mnt_pmap->pm_port = nfs_mount_port(options);
}
Beispiel #3
0
/*
 * Returns the transport protocol to use for the mount service
 *
 * Returns the IPPROTO_ value specified by the mountproto option, or
 * if that doesn't exist, the IPPROTO_ value specified for NFS
 * itself.
 */
static unsigned short nfs_mount_protocol(struct mount_options *options)
{
	char *option;

	option = po_get(options, "mountproto");
	if (option) {
		if (strcmp(option, "tcp") == 0)
			return IPPROTO_TCP;
		if (strcmp(option, "udp") == 0)
			return IPPROTO_UDP;
	}

	return nfs_nfs_version(options);
}
Beispiel #4
0
static int nfs_set_version(struct nfsmount_info *mi)
{
	if (!nfs_nfs_version(mi->options, &mi->version))
		return 0;

	if (strncmp(mi->type, "nfs4", 4) == 0)
		mi->version = 4;

	/*
	 * Before 2.6.32, the kernel NFS client didn't
	 * support "-t nfs vers=4" mounts, so NFS version
	 * 4 cannot be included when autonegotiating
	 * while running on those kernels.
	 */
	if (mi->version == 0 &&
	    linux_version_code() <= MAKE_VERSION(2, 6, 31))
		mi->version = 3;

	/*
	 * If we still don't know, check for version-specific
	 * mount options.
	 */
	if (mi->version == 0) {
		if (po_contains(mi->options, "mounthost") ||
		    po_contains(mi->options, "mountaddr") ||
		    po_contains(mi->options, "mountvers") ||
		    po_contains(mi->options, "mountproto"))
			mi->version = 3;
	}

	/*
	 * If enabled, see if the default version was
	 * set in the config file
	 */
	nfs_default_version(mi);
	
	return 1;
}