From dc98ee4196c8969bd3d587924ee9e570228ec62f Mon Sep 17 00:00:00 2001 From: dfr Date: Thu, 27 Mar 2008 11:54:20 +0000 Subject: Add kernel module support for nfslockd and krpc. Use the module system to detect (or load) kernel NLM support in rpc.lockd. Remove the '-k' option to rpc.lockd and make kernel NLM the default. A user can still force the use of the old user NLM by building a kernel without NFSLOCKD and/or removing the nfslockd.ko module. --- usr.sbin/rpc.lockd/lockd.c | 19 ++++++++++++++----- usr.sbin/rpc.lockd/rpc.lockd.8 | 6 ------ 2 files changed, 14 insertions(+), 11 deletions(-) (limited to 'usr.sbin/rpc.lockd') diff --git a/usr.sbin/rpc.lockd/lockd.c b/usr.sbin/rpc.lockd/lockd.c index 3b1572e..1e55540 100644 --- a/usr.sbin/rpc.lockd/lockd.c +++ b/usr.sbin/rpc.lockd/lockd.c @@ -46,7 +46,9 @@ __RCSID("$NetBSD: lockd.c,v 1.7 2000/08/12 18:08:44 thorpej Exp $"); * The actual program logic is in the file lock_proc.c */ -#include +#include +#include +#include #include #include @@ -116,7 +118,7 @@ main(int argc, char **argv) int maxrec = RPC_MAXDATASIZE; in_port_t svcport = 0; - while ((ch = getopt(argc, argv, "d:g:h:kp:")) != (-1)) { + while ((ch = getopt(argc, argv, "d:g:h:p:")) != (-1)) { switch (ch) { case 'd': debug_level = atoi(optarg); @@ -153,9 +155,6 @@ main(int argc, char **argv) out_of_mem(); } break; - case 'k': - kernel_lockd = TRUE; - break; case 'p': endptr = NULL; svcport = (in_port_t)strtoul(optarg, &endptr, 10); @@ -175,6 +174,16 @@ main(int argc, char **argv) exit(1); } + kernel_lockd = FALSE; + if (modfind("nfslockd") < 0) { + if (kldload("nfslockd") < 0) { + fprintf(stderr, "Can't find or load kernel support for rpc.lockd - using non-kernel implementation\n"); + } + kernel_lockd = TRUE; + } else { + kernel_lockd = TRUE; + } + (void)rpcb_unset(NLM_PROG, NLM_SM, NULL); (void)rpcb_unset(NLM_PROG, NLM_VERS, NULL); (void)rpcb_unset(NLM_PROG, NLM_VERSX, NULL); diff --git a/usr.sbin/rpc.lockd/rpc.lockd.8 b/usr.sbin/rpc.lockd/rpc.lockd.8 index 9cd429b..4fabe5d 100644 --- a/usr.sbin/rpc.lockd/rpc.lockd.8 +++ b/usr.sbin/rpc.lockd/rpc.lockd.8 @@ -41,7 +41,6 @@ .Nd NFS file locking daemon .Sh SYNOPSIS .Nm -.Op Fl k .Op Fl d Ar debug_level .Op Fl g Ar grace period .Op Fl h Ar bindip @@ -59,11 +58,6 @@ with Options and operands available for .Nm : .Bl -tag -width indent -.It Fl k -The -.Fl k -option specifies the use of the kernel-resident NFS lock manager, if -possible. .It Fl d The .Fl d -- cgit v1.1