patch-2.1.32 linux/fs/nfsd/lockd.c

Next file: linux/fs/nfsd/nfs3proc.c
Previous file: linux/fs/nfsd/export.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.31/linux/fs/nfsd/lockd.c linux/fs/nfsd/lockd.c
@@ -0,0 +1,70 @@
+/*
+ * linux/fs/nfsd/lockd.c
+ *
+ * This file contains all the stubs needed when communicating with lockd.
+ * This level of indirection is necessary so we can run nfsd+lockd without
+ * requiring the nfs client to be compiled in/loaded, and vice versa.
+ *
+ * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
+ */
+
+#include <linux/types.h>
+#include <linux/sunrpc/clnt.h>
+#include <linux/sunrpc/svc.h>
+#include <linux/nfsd/nfsd.h>
+#include <linux/lockd/bind.h>
+
+#define NFSDDBG_FACILITY		NFSDDBG_LOCKD
+
+static u32
+nlm_fopen(struct svc_rqst *rqstp, struct knfs_fh *f, struct file *filp)
+{
+	struct svc_fh	fh;
+	u32		nfserr;
+
+	fh.fh_handle = *f;
+	fh.fh_export = NULL;
+	fh.fh_inode  = NULL;
+
+	nfserr = nfsd_open(rqstp, &fh, S_IFREG, 0, filp);
+	fh_put(&fh);
+	return nfserr;
+}
+
+static void
+nlm_fclose(struct file *filp)
+{
+	nfsd_close(filp);
+}
+
+struct nlmsvc_binding		nfsd_nlm_ops = {
+	exp_readlock,		/* lock export table for reading */
+	exp_unlock,		/* unlock export table */
+	exp_getclient,		/* look up NFS client */
+	nlm_fopen,		/* open file for locking */
+	nlm_fclose,		/* close file */
+	exp_nlmdetach,		/* lockd shutdown notification */
+};
+
+/*
+ * When removing an NFS client entry, notify lockd that it is gone.
+ * FIXME: We should do the same when unexporting an NFS volume.
+ */
+void
+nfsd_lockd_unexport(struct svc_client *clnt)
+{
+	nlmsvc_invalidate_client(clnt);
+}
+
+void
+nfsd_lockd_init(void)
+{
+	dprintk("nfsd: initializing lockd\n");
+	nlmsvc_ops = &nfsd_nlm_ops;
+}
+
+void
+nfsd_lockd_shutdown(void)
+{
+	nlmsvc_ops = NULL;
+}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov