diff options
-rw-r--r-- | utils/mount/configfile.c | 2 | ||||
-rw-r--r-- | utils/mount/network.c | 11 | ||||
-rw-r--r-- | utils/mount/network.h | 2 | ||||
-rw-r--r-- | utils/mount/nfsumount.c | 2 | ||||
-rw-r--r-- | utils/mount/stropts.c | 14 | ||||
-rw-r--r-- | utils/mount/stropts.h | 2 |
6 files changed, 14 insertions, 19 deletions
diff --git a/utils/mount/configfile.c b/utils/mount/configfile.c index dc964c7..e4b39ef 100644 --- a/utils/mount/configfile.c +++ b/utils/mount/configfile.c @@ -260,7 +260,7 @@ default_value(char *mopt) } } else if (strncasecmp(field, "vers", strlen("vers")) == 0) { if ((options = po_split(field)) != NULL) { - if (!nfs_nfs_version(options, &config_default_vers)) { + if (!nfs_nfs_version("nfs", options, &config_default_vers)) { xlog_warn("Unable to set default version: %s", strerror(errno)); diff --git a/utils/mount/network.c b/utils/mount/network.c index b014dd7..acf9a2e 100644 --- a/utils/mount/network.c +++ b/utils/mount/network.c @@ -1261,7 +1261,7 @@ nfs_nfs_program(struct mount_options *options, unsigned long *program) * or FALSE if the option was specified with an invalid value. */ int -nfs_nfs_version(struct mount_options *options, struct nfs_version *version) +nfs_nfs_version(char *type, struct mount_options *options, struct nfs_version *version) { char *version_key, *version_val, *cptr; int i, found = 0; @@ -1276,10 +1276,11 @@ nfs_nfs_version(struct mount_options *options, struct nfs_version *version) } } - if (!found) + if (!found && strcmp(type, "nfs4") == 0) + version_val = type + 3; + else if (!found) return 1; - - if (i <= 2 ) { + else if (i <= 2 ) { /* v2, v3, v4 */ version_val = version_key + 1; version->v_mode = V_SPECIFIC; @@ -1655,7 +1656,7 @@ int nfs_options2pmap(struct mount_options *options, if (!nfs_nfs_program(options, &nfs_pmap->pm_prog)) return 0; - if (!nfs_nfs_version(options, &version)) + if (!nfs_nfs_version("nfs", options, &version)) return 0; if (version.v_mode == V_DEFAULT) nfs_pmap->pm_vers = 0; diff --git a/utils/mount/network.h b/utils/mount/network.h index 9cc5dec..ecaac33 100644 --- a/utils/mount/network.h +++ b/utils/mount/network.h @@ -72,7 +72,7 @@ struct nfs_version { int nfs_nfs_proto_family(struct mount_options *options, sa_family_t *family); int nfs_mount_proto_family(struct mount_options *options, sa_family_t *family); -int nfs_nfs_version(struct mount_options *options, struct nfs_version *version); +int nfs_nfs_version(char *type, struct mount_options *options, struct nfs_version *version); int nfs_nfs_protocol(struct mount_options *options, unsigned long *protocol); int nfs_options2pmap(struct mount_options *, diff --git a/utils/mount/nfsumount.c b/utils/mount/nfsumount.c index de284f2..e16fb6a 100644 --- a/utils/mount/nfsumount.c +++ b/utils/mount/nfsumount.c @@ -180,7 +180,7 @@ static int nfs_umount_is_vers4(const struct mntentchn *mc) options = po_split(pmc->m.mnt_opts); if (options != NULL) { struct nfs_version version; - int rc = nfs_nfs_version(options, &version); + int rc = nfs_nfs_version("nfs", options, &version); po_destroy(options); if (rc && version.major == 4) goto out_nfs4; diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index 0a371bf..1d30d34 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -87,8 +87,8 @@ extern int sloppy; struct nfsmount_info { const char *spec, /* server:/path */ - *node, /* mounted-on dir */ - *type; /* "nfs" or "nfs4" */ + *node; /* mounted-on dir */ + char *type; /* "nfs" or "nfs4" */ char *hostname; /* server's hostname */ struct addrinfo *address; /* server's addresses */ sa_family_t family; /* Address family */ @@ -327,15 +327,9 @@ static int nfs_append_sloppy_option(struct mount_options *options) static int nfs_set_version(struct nfsmount_info *mi) { - if (!nfs_nfs_version(mi->options, &mi->version)) + if (!nfs_nfs_version(mi->type, mi->options, &mi->version)) return 0; - if (strncmp(mi->type, "nfs4", 4) == 0) { - /* Set to default values */ - mi->version.major = NFS_DEFAULT_MAJOR; - mi->version.minor = NFS_DEFAULT_MINOR; - mi->version.v_mode = V_GENERAL; - } /* * Before 2.6.32, the kernel NFS client didn't * support "-t nfs vers=4" mounts, so NFS version @@ -1205,7 +1199,7 @@ static int nfsmount_start(struct nfsmount_info *mi) * * Returns a valid mount command exit code. */ -int nfsmount_string(const char *spec, const char *node, const char *type, +int nfsmount_string(const char *spec, const char *node, char *type, int flags, char **extra_opts, int fake, int child) { struct nfsmount_info mi = { diff --git a/utils/mount/stropts.h b/utils/mount/stropts.h index 37316eb..6acd2ac 100644 --- a/utils/mount/stropts.h +++ b/utils/mount/stropts.h @@ -24,7 +24,7 @@ #ifndef _NFS_UTILS_MOUNT_STROPTS_H #define _NFS_UTILS_MOUNT_STROPTS_H -int nfsmount_string(const char *, const char *, const char *, int, +int nfsmount_string(const char *, const char *, char *, int, char **, int, int); #endif /* _NFS_UTILS_MOUNT_STROPTS_H */ |