aboutsummaryrefslogtreecommitdiff
path: root/sys/nlm/nlm_advlock.c
diff options
context:
space:
mode:
authorRick Macklem <rmacklem@FreeBSD.org>2010-10-19 00:20:00 +0000
committerRick Macklem <rmacklem@FreeBSD.org>2010-10-19 00:20:00 +0000
commitca27c028d8c59d9ea55c515bbdd43dbb4c10f263 (patch)
tree58fc2b105e6e1fb43a4b74746fd54253f3f2102d /sys/nlm/nlm_advlock.c
parent4f2bbc00f2a2801531a65e0ee15842664e21b331 (diff)
downloadsrc-ca27c028d8c59d9ea55c515bbdd43dbb4c10f263.tar.gz
src-ca27c028d8c59d9ea55c515bbdd43dbb4c10f263.zip
Modify the NFS clients and the NLM so that the NLM can be used
by both clients. Since the NLM uses various fields of the nfsmount structure, those fields were extracted and put in a separate nfs_mountcommon structure stored in sys/nfs/nfs_mountcommon.h. This structure also has a function pointer for a function that extracts the required information from the mount point and nfs vnode for that particular client, for information stored differently by the clients. Reviewed by: jhb MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=214048
Diffstat (limited to 'sys/nlm/nlm_advlock.c')
-rw-r--r--sys/nlm/nlm_advlock.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/sys/nlm/nlm_advlock.c b/sys/nlm/nlm_advlock.c
index b179595c5d02..b4edb4dd9628 100644
--- a/sys/nlm/nlm_advlock.c
+++ b/sys/nlm/nlm_advlock.c
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
#include <sys/mount.h>
#include <sys/mutex.h>
#include <sys/proc.h>
+#include <sys/socket.h>
#include <sys/syslog.h>
#include <sys/systm.h>
#include <sys/unistd.h>
@@ -47,7 +48,6 @@ __FBSDID("$FreeBSD$");
#include <nfs/nfsproto.h>
#include <nfsclient/nfs.h>
-#include <nfsclient/nfsnode.h>
#include <nfsclient/nfsmount.h>
#include <nlm/nlm_prot.h>
@@ -196,7 +196,6 @@ nlm_advlock_internal(struct vnode *vp, void *id, int op, struct flock *fl,
{
struct thread *td = curthread;
struct nfsmount *nmp;
- struct nfsnode *np;
off_t size;
size_t fhlen;
union nfsfh fh;
@@ -214,6 +213,7 @@ nlm_advlock_internal(struct vnode *vp, void *id, int op, struct flock *fl,
struct nlm_file_svid *ns;
int svid;
int error;
+ int is_v3;
ASSERT_VOP_LOCKED(vp, "nlm_advlock_1");
@@ -225,18 +225,13 @@ nlm_advlock_internal(struct vnode *vp, void *id, int op, struct flock *fl,
if (op == F_SETLK || op == F_UNLCK)
nfs_vinvalbuf(vp, V_SAVE, td, 1);
- np = VTONFS(vp);
nmp = VFSTONFS(vp->v_mount);
- size = np->n_size;
- sa = nmp->nm_nam;
- memcpy(&ss, sa, sa->sa_len);
- sa = (struct sockaddr *) &ss;
strcpy(servername, nmp->nm_hostname);
- fhlen = np->n_fhsize;
- memcpy(&fh.fh_bytes, np->n_fhp, fhlen);
+ nmp->nm_getinfo(vp, fh.fh_bytes, &fhlen, &ss, &is_v3, &size);
+ sa = (struct sockaddr *) &ss;
timo.tv_sec = nmp->nm_timeo / NFS_HZ;
timo.tv_usec = (nmp->nm_timeo % NFS_HZ) * (1000000 / NFS_HZ);
- if (NFS_ISV3(vp))
+ if (is_v3 != 0)
vers = NLM_VERS4;
else
vers = NLM_VERS;