diff options
author | Craig Rodrigues <rodrigc@FreeBSD.org> | 2008-09-19 11:59:10 +0000 |
---|---|---|
committer | Craig Rodrigues <rodrigc@FreeBSD.org> | 2008-09-19 11:59:10 +0000 |
commit | 049307ba00529cae1734ff2861201568b2afda14 (patch) | |
tree | 88d0518d4fcdc49326a61099a7630c1f1b489d5d /sbin/mount_nfs | |
parent | d873f463799501f3d9f039243a1cd6264ecf7b22 (diff) | |
download | src-049307ba00529cae1734ff2861201568b2afda14.tar.gz src-049307ba00529cae1734ff2861201568b2afda14.zip |
Use the version of the kernel returned by getosreldate()
to determine whether to call the fallback_mount() backwards
compatibility function or not.
Reviewed by: dfr
Notes
Notes:
svn path=/head/; revision=183182
Diffstat (limited to 'sbin/mount_nfs')
-rw-r--r-- | sbin/mount_nfs/mount_nfs.c | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/sbin/mount_nfs/mount_nfs.c b/sbin/mount_nfs/mount_nfs.c index 2f8308f15a24..71ac14ecf5a8 100644 --- a/sbin/mount_nfs/mount_nfs.c +++ b/sbin/mount_nfs/mount_nfs.c @@ -164,19 +164,19 @@ enum tryret nfs_tryproto(struct addrinfo *ai, char *hostp, char *spec, enum tryret nfs4_tryproto(struct addrinfo *ai, char *hostp, char *spec, char **errstr); enum tryret returncode(enum clnt_stat stat, struct rpc_err *rpcerr); +extern int getosreldate(void); int main(int argc, char *argv[]) { int c; struct iovec *iov; - int mntflags, altflags, num; - int iovlen; + int mntflags, num, iovlen; + int osversion; char *name, *p, *spec, *fstype; char mntpath[MAXPATHLEN], errmsg[255]; mntflags = 0; - altflags = 0; iov = NULL; iovlen = 0; memset(errmsg, 0, sizeof(errmsg)); @@ -403,9 +403,19 @@ main(int argc, char *argv[]) build_iovec(&iov, &iovlen, "fspath", mntpath, (size_t)-1); build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); - if (nmount(iov, iovlen, mntflags)) { - if (errno != ENOENT - || fallback_mount(iov, iovlen, mntflags)) + /* + * XXX: + * Backwards compatibility routines for older kernels. + * Remove this and fallback_mount() code when we do not need to support + * NFS mounts against older kernels which still need + * struct nfs_args to be passed in via nmount(). + */ + osversion = getosreldate(); + if (osversion >= 800048) { + if (nmount(iov, iovlen, mntflags)) + err(1, "%s, %s", mntpath, errmsg); + } else { + if (fallback_mount(iov, iovlen, mntflags)) err(1, "%s, %s", mntpath, errmsg); } |