diff options
author | rodrigc <rodrigc@FreeBSD.org> | 2008-09-19 11:59:10 +0000 |
---|---|---|
committer | rodrigc <rodrigc@FreeBSD.org> | 2008-09-19 11:59:10 +0000 |
commit | ce45fb3cfc17b707191271c782c7b7b9060f5065 (patch) | |
tree | 88d0518d4fcdc49326a61099a7630c1f1b489d5d /sbin | |
parent | d1938e477bd6188affb7549fd2d1c9722c62fda8 (diff) | |
download | FreeBSD-src-ce45fb3cfc17b707191271c782c7b7b9060f5065.zip FreeBSD-src-ce45fb3cfc17b707191271c782c7b7b9060f5065.tar.gz |
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
Diffstat (limited to 'sbin')
-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 2f8308f..71ac14e 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); } |