summaryrefslogtreecommitdiffstats
path: root/sys/nfs
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1996-01-13 23:27:58 +0000
committerphk <phk@FreeBSD.org>1996-01-13 23:27:58 +0000
commit9e14900495b009fccd80e7c2068ea6eedd558dce (patch)
treea45ad8603041d3d4de6f0ddac019214235dbdefd /sys/nfs
parentb4cbe069b996fab93a71c0d32c7d3c678864bf5a (diff)
downloadFreeBSD-src-9e14900495b009fccd80e7c2068ea6eedd558dce.zip
FreeBSD-src-9e14900495b009fccd80e7c2068ea6eedd558dce.tar.gz
Add an option NFS_NOSERVER which saves 100K in the install kernel (or
any other kernel that uses it). Use with option NFS.
Diffstat (limited to 'sys/nfs')
-rw-r--r--sys/nfs/nfs_common.c19
-rw-r--r--sys/nfs/nfs_nqlease.c14
-rw-r--r--sys/nfs/nfs_serv.c15
-rw-r--r--sys/nfs/nfs_socket.c15
-rw-r--r--sys/nfs/nfs_srvcache.c5
-rw-r--r--sys/nfs/nfs_subs.c19
-rw-r--r--sys/nfs/nfs_syscalls.c29
7 files changed, 97 insertions, 19 deletions
diff --git a/sys/nfs/nfs_common.c b/sys/nfs/nfs_common.c
index 46327bf..6d064c7 100644
--- a/sys/nfs/nfs_common.c
+++ b/sys/nfs/nfs_common.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
- * $Id: nfs_subs.c,v 1.25 1995/12/07 12:47:26 davidg Exp $
+ * $Id: nfs_subs.c,v 1.26 1995/12/17 21:12:30 phk Exp $
*/
/*
@@ -112,6 +112,7 @@ struct nqtimerhead nqtimerhead;
struct nqfhhashhead *nqfhhashtbl;
u_long nqfhhash;
+#ifndef NFS_NOSERVER
/*
* Mapping of old NFS Version 2 RPC numbers to generic numbers.
*/
@@ -144,6 +145,7 @@ int nfsv3_procid[NFS_NPROCS] = {
NFSPROC_NOOP
};
+#endif /* NFS_NOSERVER */
/*
* and the reverse mapping from generic to Version 2 procedure numbers
*/
@@ -176,6 +178,7 @@ int nfsv2_procid[NFS_NPROCS] = {
NFSV2PROC_NOOP,
};
+#ifndef NFS_NOSERVER
/*
* Maps errno values to nfs error numbers.
* Use NFSERR_IO as the catch all for ones not specifically defined in
@@ -533,6 +536,8 @@ static short *nfsrv_v3errmap[] = {
nfsv3err_commit,
};
+#endif /* NFS_NOSERVER */
+
extern struct proc *nfs_iodwant[NFS_MAXASYNCDAEMON];
extern struct nfsrtt nfsrtt;
extern time_t nqnfsstarttime;
@@ -1122,8 +1127,10 @@ nfs_init()
nfs_iodwant[i] = (struct proc *)0;
TAILQ_INIT(&nfs_bufq);
nfs_nhinit(); /* Init the nfsnode table */
+#ifndef NFS_NOSERVER
nfsrv_init(0); /* Init server data structures */
nfsrv_initcache(); /* Init the server request cache */
+#endif
/*
* Initialize the nqnfs server stuff.
@@ -1140,23 +1147,29 @@ nfs_init()
* Initialize reply list and start timer
*/
TAILQ_INIT(&nfs_reqq);
+#ifndef NFS_NOSERVER
nfs_timer(0);
+#endif
#ifdef __FreeBSD__
/*
* Set up lease_check and lease_updatetime so that other parts
* of the system can call us, if we are loadable.
*/
+#ifndef NFS_NOSERVER
lease_check = nfs_lease_check;
+#endif
lease_updatetime = nfs_lease_updatetime;
vfsconf[MOUNT_NFS]->vfc_refcount++; /* make us non-unloadable */
#ifdef VFS_LKM
sysent[SYS_nfssvc].sy_narg = 2;
sysent[SYS_nfssvc].sy_call = nfssvc;
+#ifndef NFS_NOSERVER
sysent[SYS_getfh].sy_narg = 2;
sysent[SYS_getfh].sy_call = getfh;
#endif
#endif
+#endif
return (0);
}
@@ -1388,6 +1401,7 @@ nfs_getattrcache(vp, vaper)
return (0);
}
+#ifndef NFS_NOSERVER
/*
* Set up nameidata for a lookup() call and do it
*/
@@ -1728,6 +1742,7 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag)
return (0);
}
+#endif /* NFS_NOSERVER */
/*
* This function compares two net addresses by family and returns TRUE
* if they are the same host.
@@ -1881,6 +1896,7 @@ loop:
splx(s);
}
+#ifndef NFS_NOSERVER
/*
* Map errnos to NFS error numbers. For Version 3 also filter out error
* numbers not specified for the associated procedure.
@@ -1960,3 +1976,4 @@ nfsrv_vrele(struct vnode *vp) {
}
return 0;
}
+#endif /* NFS_NOSERVER */
diff --git a/sys/nfs/nfs_nqlease.c b/sys/nfs/nfs_nqlease.c
index 5af47fb..134260f 100644
--- a/sys/nfs/nfs_nqlease.c
+++ b/sys/nfs/nfs_nqlease.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_nqlease.c 8.3 (Berkeley) 1/4/94
- * $Id: nfs_nqlease.c,v 1.17 1995/11/21 15:51:31 bde Exp $
+ * $Id: nfs_nqlease.c,v 1.18 1995/12/17 21:12:16 phk Exp $
*/
/*
@@ -140,6 +140,7 @@ extern struct nfsstats nfsstats;
#define TRUE 1
#define FALSE 0
+#ifndef NFS_NOSERVER
/*
* Get or check for a lease for "vp", based on ND_CHECK flag.
* The rules are as follows:
@@ -346,6 +347,8 @@ nqnfs_lease_check(vp, p, cred, flag)
p, (struct mbuf *)0, &cache, &frev, cred);
}
+#endif /* NFS_NOSERVER */
+
#ifdef HAS_VOPLEASE
int
nqnfs_vop_lease_check(ap)
@@ -625,6 +628,8 @@ tryagain:
}
}
+#ifndef NFS_NOSERVER
+
/*
* Nqnfs server timer that maintains the server lease queue.
* Scan the lease queue for expired entries:
@@ -847,6 +852,8 @@ nfsmout:
return (EPERM);
}
+#endif /* NFS_NOSERVER */
+
/*
* Client get lease rpc function.
*/
@@ -941,6 +948,8 @@ nfsmout:
return (error);
}
+#ifndef NFS_NOSERVER
+
/*
* Called for client side callbacks
*/
@@ -999,6 +1008,7 @@ nqnfs_callback(nmp, mrep, md, dpos)
nfsm_srvdone;
}
+
/*
* Nqnfs client helper daemon. Runs once a second to expire leases.
* It also get authorization strings for "kerb" mounts.
@@ -1159,6 +1169,8 @@ nqnfs_clientd(nmp, cred, ncd, flag, argp, p)
return (error);
}
+#endif /* NFS_NOSERVER */
+
/*
* Adjust all timer queue expiry times when the time of day clock is changed.
* Called from the settimeofday() syscall.
diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c
index 3fc96a4..2c574cac 100644
--- a/sys/nfs/nfs_serv.c
+++ b/sys/nfs/nfs_serv.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_serv.c 8.3 (Berkeley) 1/12/94
- * $Id: nfs_serv.c,v 1.26 1995/12/07 12:47:25 davidg Exp $
+ * $Id: nfs_serv.c,v 1.27 1995/12/17 21:12:22 phk Exp $
*/
/*
@@ -85,21 +85,22 @@
#include <nfs/nfsm_subs.h>
#include <nfs/nqnfs.h>
+nfstype nfsv3_type[9] = { NFNON, NFREG, NFDIR, NFBLK, NFCHR, NFLNK, NFSOCK,
+ NFFIFO, NFNON };
+#ifndef NFS_NOSERVER
+nfstype nfsv2_type[9] = { NFNON, NFREG, NFDIR, NFBLK, NFCHR, NFLNK, NFNON,
+ NFCHR, NFNON };
/* Global vars */
extern u_long nfs_xdrneg1;
extern u_long nfs_false, nfs_true;
extern enum vtype nv3tov_type[8];
extern struct nfsstats nfsstats;
-nfstype nfsv2_type[9] = { NFNON, NFREG, NFDIR, NFBLK, NFCHR, NFLNK, NFNON,
- NFCHR, NFNON };
-nfstype nfsv3_type[9] = { NFNON, NFREG, NFDIR, NFBLK, NFCHR, NFLNK, NFSOCK,
- NFFIFO, NFNON };
+
int nfsrvw_procrastinate = NFS_GATHERDELAY * 1000;
int nfs_async;
SYSCTL_INT(_fs_nfs, OID_AUTO, async, CTLFLAG_RW, &nfs_async, 0, "");
-
static int nfsrv_access __P((struct vnode *,int,struct ucred *,int,
struct proc *));
static void nfsrvw_coalesce __P((struct nfsrv_descript *,
@@ -3431,3 +3432,5 @@ nfsrv_access(vp, flags, cred, rdonly, p)
return (error);
return (0);
}
+#endif /* NFS_NOSERVER */
+
diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c
index 0059f5e..cbda277 100644
--- a/sys/nfs/nfs_socket.c
+++ b/sys/nfs/nfs_socket.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_socket.c 8.3 (Berkeley) 1/12/94
- * $Id: nfs_socket.c,v 1.12 1995/12/03 10:02:59 bde Exp $
+ * $Id: nfs_socket.c,v 1.13 1995/12/17 21:12:25 phk Exp $
*/
/*
@@ -143,6 +143,7 @@ static int nfs_receive __P((struct nfsreq *rep, struct mbuf **aname,
static int nfs_reconnect __P((struct nfsreq *rep));
static int nfsrv_getstream __P((struct nfssvc_sock *,int));
+#ifndef NFS_NOSERVER
int (*nfsrv3_procs[NFS_NPROCS]) __P((struct nfsrv_descript *nd,
struct nfssvc_sock *slp,
struct proc *procp,
@@ -174,6 +175,7 @@ int (*nfsrv3_procs[NFS_NPROCS]) __P((struct nfsrv_descript *nd,
nfsrv_noop,
nfsrv_noop
};
+#endif /* NFS_NOSERVER */
/*
* Initialize sockets and congestion for a new NFS connection.
@@ -715,6 +717,7 @@ nfs_reply(myrep)
nfsm_dissect(tl, u_long *, 2*NFSX_UNSIGNED);
rxid = *tl++;
if (*tl != rpc_reply) {
+#ifndef NFS_NOSERVER
if (nmp->nm_flag & NFSMNT_NQNFS) {
if (nqnfs_callback(nmp, mrep, md, dpos))
nfsstats.rpcinvalid++;
@@ -722,6 +725,10 @@ nfs_reply(myrep)
nfsstats.rpcinvalid++;
m_freem(mrep);
}
+#else
+ nfsstats.rpcinvalid++;
+ m_freem(mrep);
+#endif
nfsmout:
if (myrep->r_flags & R_GETONEREP)
return (0);
@@ -1104,6 +1111,7 @@ nfsmout:
return (error);
}
+#ifndef NFS_NOSERVER
/*
* Generate the rpc reply header
* siz arg. is used to decide if adding a cluster is worthwhile
@@ -1256,6 +1264,7 @@ nfs_rephead(siz, nd, slp, err, cache, frev, mrq, mbp, bposp)
return (0);
}
+
/*
* Nfs timer routine
* Scan the nfsreq list and retranmit any requests that have timed out
@@ -1386,6 +1395,8 @@ nfs_timer(arg)
timeout(nfs_timer, (void *)0, nfs_ticks);
}
+#endif /* NFS_NOSERVER */
+
/*
* Test for a termination condition pending on the process.
* This is used for NFSMNT_INT mounts.
@@ -1593,6 +1604,7 @@ nfs_realign(m, hsiz)
}
}
+#ifndef NFS_NOSERVER
/*
* Socket upcall routine for the nfsd sockets.
* The caddr_t arg is a pointer to the "struct nfssvc_sock".
@@ -2145,6 +2157,7 @@ nfsrv_wakenfsd(slp)
slp->ns_flag |= SLP_DOREC;
nfsd_head_flag |= NFSD_CHECKSLP;
}
+#endif /* NFS_NOSERVER */
static int
nfs_msg(p, server, msg)
diff --git a/sys/nfs/nfs_srvcache.c b/sys/nfs/nfs_srvcache.c
index 574729c..44aaf83 100644
--- a/sys/nfs/nfs_srvcache.c
+++ b/sys/nfs/nfs_srvcache.c
@@ -34,9 +34,10 @@
* SUCH DAMAGE.
*
* @(#)nfs_srvcache.c 8.1 (Berkeley) 6/10/93
- * $Id: nfs_srvcache.c,v 1.6 1995/06/27 11:06:43 dfr Exp $
+ * $Id: nfs_srvcache.c,v 1.7 1995/12/17 21:12:27 phk Exp $
*/
+#ifndef NFS_NOSERVER
/*
* Reference: Chet Juszczak, "Improving the Performance and Correctness
* of an NFS Server", in Proc. Winter 1989 USENIX Conference,
@@ -336,3 +337,5 @@ nfsrv_cleancache()
}
numnfsrvcache = 0;
}
+
+#endif /* NFS_NOSERVER */
diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c
index 46327bf..6d064c7 100644
--- a/sys/nfs/nfs_subs.c
+++ b/sys/nfs/nfs_subs.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_subs.c 8.3 (Berkeley) 1/4/94
- * $Id: nfs_subs.c,v 1.25 1995/12/07 12:47:26 davidg Exp $
+ * $Id: nfs_subs.c,v 1.26 1995/12/17 21:12:30 phk Exp $
*/
/*
@@ -112,6 +112,7 @@ struct nqtimerhead nqtimerhead;
struct nqfhhashhead *nqfhhashtbl;
u_long nqfhhash;
+#ifndef NFS_NOSERVER
/*
* Mapping of old NFS Version 2 RPC numbers to generic numbers.
*/
@@ -144,6 +145,7 @@ int nfsv3_procid[NFS_NPROCS] = {
NFSPROC_NOOP
};
+#endif /* NFS_NOSERVER */
/*
* and the reverse mapping from generic to Version 2 procedure numbers
*/
@@ -176,6 +178,7 @@ int nfsv2_procid[NFS_NPROCS] = {
NFSV2PROC_NOOP,
};
+#ifndef NFS_NOSERVER
/*
* Maps errno values to nfs error numbers.
* Use NFSERR_IO as the catch all for ones not specifically defined in
@@ -533,6 +536,8 @@ static short *nfsrv_v3errmap[] = {
nfsv3err_commit,
};
+#endif /* NFS_NOSERVER */
+
extern struct proc *nfs_iodwant[NFS_MAXASYNCDAEMON];
extern struct nfsrtt nfsrtt;
extern time_t nqnfsstarttime;
@@ -1122,8 +1127,10 @@ nfs_init()
nfs_iodwant[i] = (struct proc *)0;
TAILQ_INIT(&nfs_bufq);
nfs_nhinit(); /* Init the nfsnode table */
+#ifndef NFS_NOSERVER
nfsrv_init(0); /* Init server data structures */
nfsrv_initcache(); /* Init the server request cache */
+#endif
/*
* Initialize the nqnfs server stuff.
@@ -1140,23 +1147,29 @@ nfs_init()
* Initialize reply list and start timer
*/
TAILQ_INIT(&nfs_reqq);
+#ifndef NFS_NOSERVER
nfs_timer(0);
+#endif
#ifdef __FreeBSD__
/*
* Set up lease_check and lease_updatetime so that other parts
* of the system can call us, if we are loadable.
*/
+#ifndef NFS_NOSERVER
lease_check = nfs_lease_check;
+#endif
lease_updatetime = nfs_lease_updatetime;
vfsconf[MOUNT_NFS]->vfc_refcount++; /* make us non-unloadable */
#ifdef VFS_LKM
sysent[SYS_nfssvc].sy_narg = 2;
sysent[SYS_nfssvc].sy_call = nfssvc;
+#ifndef NFS_NOSERVER
sysent[SYS_getfh].sy_narg = 2;
sysent[SYS_getfh].sy_call = getfh;
#endif
#endif
+#endif
return (0);
}
@@ -1388,6 +1401,7 @@ nfs_getattrcache(vp, vaper)
return (0);
}
+#ifndef NFS_NOSERVER
/*
* Set up nameidata for a lookup() call and do it
*/
@@ -1728,6 +1742,7 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag)
return (0);
}
+#endif /* NFS_NOSERVER */
/*
* This function compares two net addresses by family and returns TRUE
* if they are the same host.
@@ -1881,6 +1896,7 @@ loop:
splx(s);
}
+#ifndef NFS_NOSERVER
/*
* Map errnos to NFS error numbers. For Version 3 also filter out error
* numbers not specified for the associated procedure.
@@ -1960,3 +1976,4 @@ nfsrv_vrele(struct vnode *vp) {
}
return 0;
}
+#endif /* NFS_NOSERVER */
diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c
index 68d7dc1..5285374 100644
--- a/sys/nfs/nfs_syscalls.c
+++ b/sys/nfs/nfs_syscalls.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_syscalls.c 8.3 (Berkeley) 1/4/94
- * $Id: nfs_syscalls.c,v 1.11 1995/12/03 10:03:06 bde Exp $
+ * $Id: nfs_syscalls.c,v 1.12 1995/12/17 21:12:33 phk Exp $
*/
#include <sys/param.h>
@@ -87,25 +87,26 @@ extern struct nfsstats nfsstats;
extern int nfsrvw_procrastinate;
struct nfssvc_sock *nfs_udpsock, *nfs_cltpsock;
static int nuidhash_max = NFS_MAXUIDHASH;
-static int nfs_numnfsd = 0;
-int nfsd_waiting = 0;
-static int notstarted = 1;
-static int modify_flag = 0;
-static struct nfsdrt nfsdrt;
static void nfsrv_zapsock __P((struct nfssvc_sock *slp));
+static int nfssvc_iod __P((struct proc *));
#define TRUE 1
#define FALSE 0
static int nfs_asyncdaemon[NFS_MAXASYNCDAEMON];
+
+#ifndef NFS_NOSERVER
+int nfsd_waiting = 0;
+static struct nfsdrt nfsdrt;
+static int nfs_numnfsd = 0;
+static int notstarted = 1;
+static int modify_flag = 0;
static void nfsd_rt __P((int sotype, struct nfsrv_descript *nd,
int cacherep));
static int nfssvc_addsock __P((struct file *,struct mbuf *));
-static int nfssvc_iod __P((struct proc *));
static int nfssvc_nfsd __P((struct nfsd_srvargs *,caddr_t,struct proc *));
-
/*
* NFS server system calls
* getfh() lives here too, but maybe should move to kern/vfs_syscalls.c
@@ -152,6 +153,7 @@ getfh(p, uap, retval)
return (error);
}
+#endif /* NFS_NOSERVER */
/*
* Nfs server psuedo system call for the nfsd's
* Based on the flag value it either:
@@ -171,6 +173,7 @@ nfssvc(p, uap, retval)
register struct nfssvc_args *uap;
int *retval;
{
+#ifndef NFS_NOSERVER
struct nameidata nd;
struct file *fp;
struct mbuf *nam;
@@ -181,6 +184,7 @@ nfssvc(p, uap, retval)
struct nfssvc_sock *slp;
struct nfsuid *nuidp;
struct nfsmount *nmp;
+#endif /* NFS_NOSERVER */
int error;
/*
@@ -195,6 +199,10 @@ nfssvc(p, uap, retval)
}
if (uap->flag & NFSSVC_BIOD)
error = nfssvc_iod(p);
+#ifdef NFS_NOSERVER
+ else
+ error = ENXIO;
+#else /* !NFS_NOSERVER */
else if (uap->flag & NFSSVC_MNTD) {
error = copyin(uap->argp, (caddr_t)&ncd, sizeof (ncd));
if (error)
@@ -327,11 +335,13 @@ nfssvc(p, uap, retval)
nfsd->nfsd_flag |= NFSD_AUTHFAIL;
error = nfssvc_nfsd(nsd, uap->argp, p);
}
+#endif /* NFS_NOSERVER */
if (error == EINTR || error == ERESTART)
error = 0;
return (error);
}
+#ifndef NFS_NOSERVER
/*
* Adds a socket to the list for servicing by nfsds.
*/
@@ -702,6 +712,7 @@ done:
nfsrv_init(TRUE); /* Reinitialize everything */
return (error);
}
+#endif /* NFS_NOSERVER */
/*
* Asynchronous I/O daemons for client nfs.
@@ -1038,6 +1049,7 @@ nfsmout:
return (error);
}
+#ifndef NFS_NOSERVER
/*
* Derefence a server socket structure. If it has no more references and
* is no longer valid, you can throw it away.
@@ -1134,3 +1146,4 @@ nfsd_rt(sotype, nd, cacherep)
rt->tstamp = time;
nfsdrt.pos = (nfsdrt.pos + 1) % NFSRTTLOGSIZ;
}
+#endif /* NFS_NOSERVER */
OpenPOWER on IntegriCloud