summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorwollman <wollman@FreeBSD.org>1994-09-22 22:17:02 +0000
committerwollman <wollman@FreeBSD.org>1994-09-22 22:17:02 +0000
commiteeef7952c3836dd1eb5e994695d5c745b6b51784 (patch)
treeeae3d93fb9be635a1496c02de15cdef92b491f86 /sbin
parentd4b42cfe457790ba8db25f68e68f7c056ddc69b5 (diff)
downloadFreeBSD-src-eeef7952c3836dd1eb5e994695d5c745b6b51784.zip
FreeBSD-src-eeef7952c3836dd1eb5e994695d5c745b6b51784.tar.gz
Automatically load NFS and a bevy of other filesystems.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/i386/mount_msdos/mount_msdos.c13
-rw-r--r--sbin/mount_cd9660/mount_cd9660.c12
-rw-r--r--sbin/mount_fdesc/mount_fdesc.c11
-rw-r--r--sbin/mount_lfs/mount_lfs.c11
-rw-r--r--sbin/mount_msdos/mount_msdos.c13
-rw-r--r--sbin/mount_msdosfs/mount_msdosfs.c13
-rw-r--r--sbin/mount_nfs/mount_nfs.c12
-rw-r--r--sbin/mount_null/mount_null.c11
-rw-r--r--sbin/mount_nullfs/mount_nullfs.c11
-rw-r--r--sbin/mount_portal/mount_portal.c11
-rw-r--r--sbin/mount_portalfs/mount_portalfs.c11
-rw-r--r--sbin/mount_procfs/mount_procfs.c11
-rw-r--r--sbin/mount_umap/mount_umap.c11
-rw-r--r--sbin/mount_umapfs/mount_umapfs.c11
-rw-r--r--sbin/mount_union/mount_union.c11
-rw-r--r--sbin/mount_unionfs/mount_unionfs.c11
-rw-r--r--sbin/mountd/Makefile5
-rw-r--r--sbin/mountd/mountd.822
-rw-r--r--sbin/mountd/mountd.c20
-rw-r--r--sbin/nfsd/nfsd.818
-rw-r--r--sbin/nfsd/nfsd.c12
-rw-r--r--sbin/nfsiod/nfsiod.822
-rw-r--r--sbin/nfsiod/nfsiod.c14
23 files changed, 269 insertions, 28 deletions
diff --git a/sbin/i386/mount_msdos/mount_msdos.c b/sbin/i386/mount_msdos/mount_msdos.c
index 075a512..9cac3ff 100644
--- a/sbin/i386/mount_msdos/mount_msdos.c
+++ b/sbin/i386/mount_msdos/mount_msdos.c
@@ -29,7 +29,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: mount_msdos.c,v 1.8 1994/07/16 21:32:08 cgd Exp $";
+static char rcsid[] = "$Id: mount_msdos.c,v 1.1 1994/09/19 15:30:36 dfr Exp $";
#endif /* not lint */
#include <sys/cdefs.h>
@@ -67,6 +67,7 @@ main(argc, argv)
struct stat sb;
int c, mntflags, set_gid, set_uid, set_mask;
char *dev, *dir, ndir[MAXPATHLEN+1];
+ struct vfsconf *vfc;
mntflags = set_gid = set_uid = set_mask = 0;
(void)memset(&args, '\0', sizeof(args));
@@ -128,7 +129,15 @@ main(argc, argv)
args.mask = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
}
- if (mount(MOUNT_MSDOS, dir, mntflags, &args) < 0)
+ vfc = getvfsbyname("msdos");
+ if(!vfc && vfsisloadable("msdos")) {
+ if(vfsload("msdos"))
+ err(1, "vfsload(msdos)");
+ endvfsent(); /* clear cache */
+ vfc = getvfsbyname("msdos");
+ }
+
+ if (mount(vfc ? vfc->vfc_index : MOUNT_MSDOS, dir, mntflags, &args) < 0)
err(1, "mount");
exit (0);
diff --git a/sbin/mount_cd9660/mount_cd9660.c b/sbin/mount_cd9660/mount_cd9660.c
index c22901e..2dfe3e6 100644
--- a/sbin/mount_cd9660/mount_cd9660.c
+++ b/sbin/mount_cd9660/mount_cd9660.c
@@ -76,6 +76,7 @@ main(argc, argv)
struct iso_args args;
int ch, mntflags, opts;
char *dev, *dir;
+ struct vfsconf *vfc;
mntflags = opts = 0;
while ((ch = getopt(argc, argv, "ego:r")) != EOF)
@@ -117,7 +118,16 @@ main(argc, argv)
args.flags = opts;
- if (mount(MOUNT_CD9660, dir, mntflags, &args) < 0)
+ vfc = getvfsbyname("cd9660");
+ if(!vfc && vfsisloadable("cd9660")) {
+ if(vfsload("cd9660")) {
+ err(1, "vfsload(cd9660)");
+ }
+ endvfsent(); /* flush cache */
+ vfc = getvfsbyname("cd9660");
+ }
+
+ if (mount(vfc ? vfc->vfc_index : MOUNT_CD9660, dir, mntflags, &args) < 0)
err(1, NULL);
exit(0);
}
diff --git a/sbin/mount_fdesc/mount_fdesc.c b/sbin/mount_fdesc/mount_fdesc.c
index 55927d8..bf7f615 100644
--- a/sbin/mount_fdesc/mount_fdesc.c
+++ b/sbin/mount_fdesc/mount_fdesc.c
@@ -69,6 +69,7 @@ main(argc, argv)
char *argv[];
{
int ch, mntflags;
+ struct vfsconf *vfc;
mntflags = 0;
while ((ch = getopt(argc, argv, "o:")) != EOF)
@@ -86,7 +87,15 @@ main(argc, argv)
if (argc != 2)
usage();
- if (mount(MOUNT_FDESC, argv[1], mntflags, NULL))
+ vfc = getvfsbyname("fdesc");
+ if(!vfc && vfsisloadable("fdesc")) {
+ if(vfsload("fdesc"))
+ err(1, "vfsload(fdesc)");
+ endvfsent(); /* flush cache */
+ vfc = getvfsbyname("fdesc");
+ }
+
+ if (mount(vfc ? vfc->vfc_index : MOUNT_FDESC, argv[1], mntflags, NULL))
err(1, NULL);
exit(0);
}
diff --git a/sbin/mount_lfs/mount_lfs.c b/sbin/mount_lfs/mount_lfs.c
index 374c930..b4e4d2e 100644
--- a/sbin/mount_lfs/mount_lfs.c
+++ b/sbin/mount_lfs/mount_lfs.c
@@ -72,6 +72,7 @@ main(argc, argv)
struct ufs_args args;
int ch, mntflags, noclean;
char *fs_name, *options;
+ struct vfsconf *vfc;
options = NULL;
mntflags = noclean = 0;
@@ -109,7 +110,15 @@ main(argc, argv)
else
args.export.ex_flags = 0;
- if (mount(MOUNT_LFS, fs_name, mntflags, &args))
+ vfc = getvfsbyname("lfs");
+ if(!vfc && vfsisloadable("lfs")) {
+ if(vfsload("lfs"))
+ err(1, "vfsload(lfs)");
+ endvfsent(); /* flush cache */
+ vfc = getvfsbyname("lfs");
+ }
+
+ if (mount(vfc ? vfc->vfc_index : MOUNT_LFS, fs_name, mntflags, &args))
err(1, NULL);
if (!noclean)
diff --git a/sbin/mount_msdos/mount_msdos.c b/sbin/mount_msdos/mount_msdos.c
index 075a512..9cac3ff 100644
--- a/sbin/mount_msdos/mount_msdos.c
+++ b/sbin/mount_msdos/mount_msdos.c
@@ -29,7 +29,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: mount_msdos.c,v 1.8 1994/07/16 21:32:08 cgd Exp $";
+static char rcsid[] = "$Id: mount_msdos.c,v 1.1 1994/09/19 15:30:36 dfr Exp $";
#endif /* not lint */
#include <sys/cdefs.h>
@@ -67,6 +67,7 @@ main(argc, argv)
struct stat sb;
int c, mntflags, set_gid, set_uid, set_mask;
char *dev, *dir, ndir[MAXPATHLEN+1];
+ struct vfsconf *vfc;
mntflags = set_gid = set_uid = set_mask = 0;
(void)memset(&args, '\0', sizeof(args));
@@ -128,7 +129,15 @@ main(argc, argv)
args.mask = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
}
- if (mount(MOUNT_MSDOS, dir, mntflags, &args) < 0)
+ vfc = getvfsbyname("msdos");
+ if(!vfc && vfsisloadable("msdos")) {
+ if(vfsload("msdos"))
+ err(1, "vfsload(msdos)");
+ endvfsent(); /* clear cache */
+ vfc = getvfsbyname("msdos");
+ }
+
+ if (mount(vfc ? vfc->vfc_index : MOUNT_MSDOS, dir, mntflags, &args) < 0)
err(1, "mount");
exit (0);
diff --git a/sbin/mount_msdosfs/mount_msdosfs.c b/sbin/mount_msdosfs/mount_msdosfs.c
index 075a512..9cac3ff 100644
--- a/sbin/mount_msdosfs/mount_msdosfs.c
+++ b/sbin/mount_msdosfs/mount_msdosfs.c
@@ -29,7 +29,7 @@
*/
#ifndef lint
-static char rcsid[] = "$Id: mount_msdos.c,v 1.8 1994/07/16 21:32:08 cgd Exp $";
+static char rcsid[] = "$Id: mount_msdos.c,v 1.1 1994/09/19 15:30:36 dfr Exp $";
#endif /* not lint */
#include <sys/cdefs.h>
@@ -67,6 +67,7 @@ main(argc, argv)
struct stat sb;
int c, mntflags, set_gid, set_uid, set_mask;
char *dev, *dir, ndir[MAXPATHLEN+1];
+ struct vfsconf *vfc;
mntflags = set_gid = set_uid = set_mask = 0;
(void)memset(&args, '\0', sizeof(args));
@@ -128,7 +129,15 @@ main(argc, argv)
args.mask = sb.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO);
}
- if (mount(MOUNT_MSDOS, dir, mntflags, &args) < 0)
+ vfc = getvfsbyname("msdos");
+ if(!vfc && vfsisloadable("msdos")) {
+ if(vfsload("msdos"))
+ err(1, "vfsload(msdos)");
+ endvfsent(); /* clear cache */
+ vfc = getvfsbyname("msdos");
+ }
+
+ if (mount(vfc ? vfc->vfc_index : MOUNT_MSDOS, dir, mntflags, &args) < 0)
err(1, "mount");
exit (0);
diff --git a/sbin/mount_nfs/mount_nfs.c b/sbin/mount_nfs/mount_nfs.c
index cd4234b..900f22e 100644
--- a/sbin/mount_nfs/mount_nfs.c
+++ b/sbin/mount_nfs/mount_nfs.c
@@ -148,6 +148,7 @@ main(argc, argv)
int mntflags, i, nfssvc_flag, num;
char *name, *p, *spec;
int error = 0;
+ struct vfsconf *vfc;
#ifdef KERBEROS
uid_t last_ruid;
#endif
@@ -294,7 +295,16 @@ main(argc, argv)
if (!getnfsargs(spec, nfsargsp))
exit(1);
- if (mount(MOUNT_NFS, name, mntflags, nfsargsp))
+
+ vfc = getvfsbyname("nfs");
+ if(!vfc && vfsisloadable("nfs")) {
+ if(vfsload("nfs"))
+ err(1, "vfsload(nfs)");
+ endvfsent(); /* flush cache */
+ vfc = getvfsbyname("nfs");
+ }
+
+ if (mount(vfc ? vfc->vfc_index : MOUNT_NFS, name, mntflags, nfsargsp))
err(1, "%s", name);
if (nfsargsp->flags & (NFSMNT_NQNFS | NFSMNT_KERB)) {
if ((opflags & ISBGRND) == 0) {
diff --git a/sbin/mount_null/mount_null.c b/sbin/mount_null/mount_null.c
index e8c26df..d042359 100644
--- a/sbin/mount_null/mount_null.c
+++ b/sbin/mount_null/mount_null.c
@@ -72,6 +72,7 @@ main(argc, argv)
struct null_args args;
int ch, mntflags;
char target[MAXPATHLEN];
+ struct vfsconf *vfc;
mntflags = 0;
while ((ch = getopt(argc, argv, "o:")) != EOF)
@@ -98,7 +99,15 @@ main(argc, argv)
args.target = target;
- if (mount(MOUNT_NULL, argv[1], mntflags, &args))
+ vfc = getvfsbyname("null");
+ if(!vfc && vfsisloadable("null")) {
+ if(vfsload("null"))
+ err(1, "vfsload(null)");
+ endvfsent(); /* flush cache */
+ vfc = getvfsbyname("null");
+ }
+
+ if (mount(vfc ? vfc->vfc_index : MOUNT_NULL, argv[1], mntflags, &args))
err(1, NULL);
exit(0);
}
diff --git a/sbin/mount_nullfs/mount_nullfs.c b/sbin/mount_nullfs/mount_nullfs.c
index e8c26df..d042359 100644
--- a/sbin/mount_nullfs/mount_nullfs.c
+++ b/sbin/mount_nullfs/mount_nullfs.c
@@ -72,6 +72,7 @@ main(argc, argv)
struct null_args args;
int ch, mntflags;
char target[MAXPATHLEN];
+ struct vfsconf *vfc;
mntflags = 0;
while ((ch = getopt(argc, argv, "o:")) != EOF)
@@ -98,7 +99,15 @@ main(argc, argv)
args.target = target;
- if (mount(MOUNT_NULL, argv[1], mntflags, &args))
+ vfc = getvfsbyname("null");
+ if(!vfc && vfsisloadable("null")) {
+ if(vfsload("null"))
+ err(1, "vfsload(null)");
+ endvfsent(); /* flush cache */
+ vfc = getvfsbyname("null");
+ }
+
+ if (mount(vfc ? vfc->vfc_index : MOUNT_NULL, argv[1], mntflags, &args))
err(1, NULL);
exit(0);
}
diff --git a/sbin/mount_portal/mount_portal.c b/sbin/mount_portal/mount_portal.c
index ae5345d..d88a38d 100644
--- a/sbin/mount_portal/mount_portal.c
+++ b/sbin/mount_portal/mount_portal.c
@@ -94,6 +94,7 @@ main(argc, argv)
char *mountpt;
int mntflags = 0;
char tag[32];
+ struct vfsconf *vfc;
qelem q;
int rc;
@@ -156,7 +157,15 @@ main(argc, argv)
sprintf(tag, "portal:%d", getpid());
args.pa_config = tag;
- rc = mount(MOUNT_PORTAL, mountpt, mntflags, &args);
+ vfc = getvfsbyname("portal");
+ if(!vfc && vfsisloadable("portal")) {
+ if(vfsload("portal"))
+ err(1, "vfsload(portal)");
+ endvfsent(); /* flush cache */
+ vfc = getvfsbyname("portal");
+ }
+
+ rc = mount(vfc ? vfc->vfc_index : MOUNT_PORTAL, mountpt, mntflags, &args);
if (rc < 0)
err(1, NULL);
diff --git a/sbin/mount_portalfs/mount_portalfs.c b/sbin/mount_portalfs/mount_portalfs.c
index ae5345d..d88a38d 100644
--- a/sbin/mount_portalfs/mount_portalfs.c
+++ b/sbin/mount_portalfs/mount_portalfs.c
@@ -94,6 +94,7 @@ main(argc, argv)
char *mountpt;
int mntflags = 0;
char tag[32];
+ struct vfsconf *vfc;
qelem q;
int rc;
@@ -156,7 +157,15 @@ main(argc, argv)
sprintf(tag, "portal:%d", getpid());
args.pa_config = tag;
- rc = mount(MOUNT_PORTAL, mountpt, mntflags, &args);
+ vfc = getvfsbyname("portal");
+ if(!vfc && vfsisloadable("portal")) {
+ if(vfsload("portal"))
+ err(1, "vfsload(portal)");
+ endvfsent(); /* flush cache */
+ vfc = getvfsbyname("portal");
+ }
+
+ rc = mount(vfc ? vfc->vfc_index : MOUNT_PORTAL, mountpt, mntflags, &args);
if (rc < 0)
err(1, NULL);
diff --git a/sbin/mount_procfs/mount_procfs.c b/sbin/mount_procfs/mount_procfs.c
index 79016c8..6beae7f 100644
--- a/sbin/mount_procfs/mount_procfs.c
+++ b/sbin/mount_procfs/mount_procfs.c
@@ -69,6 +69,7 @@ main(argc, argv)
char *argv[];
{
int ch, mntflags;
+ struct vfsconf *vfc;
mntflags = 0;
while ((ch = getopt(argc, argv, "o:")) != EOF)
@@ -86,7 +87,15 @@ main(argc, argv)
if (argc != 2)
usage();
- if (mount(MOUNT_PROCFS, argv[1], mntflags, NULL))
+ vfc = getvfsbyname("procfs");
+ if(!vfc && vfsisloadable("procfs")) {
+ if(vfsload("procfs"))
+ err(1, "vfsload(procfs)");
+ endvfsent(); /* flush cache */
+ vfc = getvfsbyname("procfs");
+ }
+
+ if (mount(vfc ? vfc->vfc_index : MOUNT_PROCFS, argv[1], mntflags, NULL))
err(1, NULL);
exit(0);
}
diff --git a/sbin/mount_umap/mount_umap.c b/sbin/mount_umap/mount_umap.c
index a069fe5..f6a7ab5 100644
--- a/sbin/mount_umap/mount_umap.c
+++ b/sbin/mount_umap/mount_umap.c
@@ -95,6 +95,7 @@ main(argc, argv)
u_long gmapdata[GMAPFILEENTRIES][2], mapdata[MAPFILEENTRIES][2];
int ch, count, gnentries, mntflags, nentries;
char *gmapfile, *mapfile, *source, *target, buf[20];
+ struct vfsconf *vfc;
mntflags = 0;
mapfile = gmapfile = NULL;
@@ -218,7 +219,15 @@ main(argc, argv)
args.gnentries = gnentries;
args.gmapdata = gmapdata;
- if (mount(MOUNT_UMAP, argv[1], mntflags, &args))
+ vfc = getvfsbyname("umap");
+ if(!vfc && vfsisloadable("umap")) {
+ if(vfsload("umap"))
+ err(1, "vfsload(umap)");
+ endvfsent(); /* flush cache */
+ vfc = getvfsbyname("umap");
+ }
+
+ if (mount(vfc ? vfc->vfc_index : MOUNT_UMAP, argv[1], mntflags, &args))
err(1, NULL);
exit(0);
}
diff --git a/sbin/mount_umapfs/mount_umapfs.c b/sbin/mount_umapfs/mount_umapfs.c
index a069fe5..f6a7ab5 100644
--- a/sbin/mount_umapfs/mount_umapfs.c
+++ b/sbin/mount_umapfs/mount_umapfs.c
@@ -95,6 +95,7 @@ main(argc, argv)
u_long gmapdata[GMAPFILEENTRIES][2], mapdata[MAPFILEENTRIES][2];
int ch, count, gnentries, mntflags, nentries;
char *gmapfile, *mapfile, *source, *target, buf[20];
+ struct vfsconf *vfc;
mntflags = 0;
mapfile = gmapfile = NULL;
@@ -218,7 +219,15 @@ main(argc, argv)
args.gnentries = gnentries;
args.gmapdata = gmapdata;
- if (mount(MOUNT_UMAP, argv[1], mntflags, &args))
+ vfc = getvfsbyname("umap");
+ if(!vfc && vfsisloadable("umap")) {
+ if(vfsload("umap"))
+ err(1, "vfsload(umap)");
+ endvfsent(); /* flush cache */
+ vfc = getvfsbyname("umap");
+ }
+
+ if (mount(vfc ? vfc->vfc_index : MOUNT_UMAP, argv[1], mntflags, &args))
err(1, NULL);
exit(0);
}
diff --git a/sbin/mount_union/mount_union.c b/sbin/mount_union/mount_union.c
index 90d075b..54d4df6 100644
--- a/sbin/mount_union/mount_union.c
+++ b/sbin/mount_union/mount_union.c
@@ -73,6 +73,7 @@ main(argc, argv)
struct union_args args;
int ch, mntflags;
char target[MAXPATHLEN];
+ struct vfsconf *vfc;
mntflags = 0;
args.mntflags = UNMNT_ABOVE;
@@ -109,7 +110,15 @@ main(argc, argv)
args.target = target;
- if (mount(MOUNT_UNION, argv[1], mntflags, &args))
+ vfc = getvfsbyname("union");
+ if(!vfc && vfsisloadable("union")) {
+ if(vfsload("union"))
+ err(1, "vfsload(union)");
+ endvfsent(); /* flush cache */
+ vfc = getvfsbyname("union");
+ }
+
+ if (mount(vfc ? vfc->vfc_index : MOUNT_UNION, argv[1], mntflags, &args))
err(1, NULL);
exit(0);
}
diff --git a/sbin/mount_unionfs/mount_unionfs.c b/sbin/mount_unionfs/mount_unionfs.c
index 90d075b..54d4df6 100644
--- a/sbin/mount_unionfs/mount_unionfs.c
+++ b/sbin/mount_unionfs/mount_unionfs.c
@@ -73,6 +73,7 @@ main(argc, argv)
struct union_args args;
int ch, mntflags;
char target[MAXPATHLEN];
+ struct vfsconf *vfc;
mntflags = 0;
args.mntflags = UNMNT_ABOVE;
@@ -109,7 +110,15 @@ main(argc, argv)
args.target = target;
- if (mount(MOUNT_UNION, argv[1], mntflags, &args))
+ vfc = getvfsbyname("union");
+ if(!vfc && vfsisloadable("union")) {
+ if(vfsload("union"))
+ err(1, "vfsload(union)");
+ endvfsent(); /* flush cache */
+ vfc = getvfsbyname("union");
+ }
+
+ if (mount(vfc ? vfc->vfc_index : MOUNT_UNION, argv[1], mntflags, &args))
err(1, NULL);
exit(0);
}
diff --git a/sbin/mountd/Makefile b/sbin/mountd/Makefile
index 57d6b43..f32e11b 100644
--- a/sbin/mountd/Makefile
+++ b/sbin/mountd/Makefile
@@ -1,7 +1,8 @@
-# @(#)Makefile 8.3 (Berkeley) 1/25/94
+# From: @(#)Makefile 8.3 (Berkeley) 1/25/94
+# $Id$
PROG= mountd
-CFLAGS+=-DNFS -DMFS -DCD9660
+CFLAGS+=-DNFS -DMFS -DCD9660 -DMSDOSFS
MAN5= exports.5 netgroup.5
MAN8= mountd.8
diff --git a/sbin/mountd/mountd.8 b/sbin/mountd/mountd.8
index 47a6cfc..77cb9c9 100644
--- a/sbin/mountd/mountd.8
+++ b/sbin/mountd/mountd.8
@@ -29,9 +29,10 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)mountd.8 8.1 (Berkeley) 6/9/93
+.\" From: @(#)mountd.8 8.1 (Berkeley) 6/9/93
+.\" $Id$
.\"
-.Dd June 9, 1993
+.Dd September 22, 1994
.Dt MOUNTD 8
.Os
.Sh NAME
@@ -81,6 +82,22 @@ After sending the SIGHUP
(kill -HUP `cat /var/run/mountd.pid`),
check the syslog output to see if mountd logged any parsing
errors in the exports file.
+.Pp
+If
+.Nm mountd
+detects that the running kernel does not include
+.Tn NFS
+support, it will attempt to load a loadable kernel module containing
+.Tn NFS
+code, using
+.Xr modload 8
+by way of
+.Xr vfsload 3 .
+If this fails, or no
+.Tn NFS
+LKM was available,
+.Nm mountd
+exits with an error.
.Sh FILES
.Bl -tag -width /var/run/mountd.pid -compact
.It Pa /etc/exports
@@ -91,6 +108,7 @@ the pid of the currently running mountd
.Sh SEE ALSO
.Xr nfsstat 1 ,
.Xr exports 5 ,
+.Xr modload 8 ,
.Xr nfsd 8 ,
.Xr portmap 8 ,
.Xr showmount 8
diff --git a/sbin/mountd/mountd.c b/sbin/mountd/mountd.c
index e674150..605e31f 100644
--- a/sbin/mountd/mountd.c
+++ b/sbin/mountd/mountd.c
@@ -38,11 +38,13 @@
static char copyright[] =
"@(#) Copyright (c) 1989, 1993\n\
The Regents of the University of California. All rights reserved.\n";
-#endif not lint
+#endif /*not lint*/
#ifndef lint
-static char sccsid[] = "@(#)mountd.c 8.8 (Berkeley) 2/20/94";
-#endif not lint
+/*static char sccsid[] = "From: @(#)mountd.c 8.8 (Berkeley) 2/20/94";*/
+static const char rcsid[] =
+ "$Id$";
+#endif /*not lint*/
#include <sys/param.h>
#include <sys/file.h>
@@ -235,6 +237,18 @@ main(argc, argv)
{
SVCXPRT *transp;
int c;
+ struct vfsconf *vfc;
+
+ vfc = getvfsbyname("nfs");
+ if(!vfc && vfsisloadable("nfs")) {
+ if(vfsload("nfs"))
+ err(1, "vfsload(nfs)");
+ endvfsent(); /* flush cache */
+ vfc = getvfsbyname("nfs");
+ }
+ if(!vfc) {
+ errx(1, "NFS support is not available in the running kernel");
+ }
while ((c = getopt(argc, argv, "n")) != EOF)
switch (c) {
diff --git a/sbin/nfsd/nfsd.8 b/sbin/nfsd/nfsd.8
index 4ee6c4b..a54a564 100644
--- a/sbin/nfsd/nfsd.8
+++ b/sbin/nfsd/nfsd.8
@@ -100,12 +100,30 @@ server specification; see
.%T "Network File System Protocol Specification" ,
RFC1094.
.Pp
+If
+.Nm nfsd
+detects that
+.Tn NFS
+is not loaded in the running kernel, it will attempt
+to load a loadable kernel module containing
+.Tn NFS
+support using
+.Xr modload 8
+by way of
+.Xr vfsload 3 .
+If this fails, or no
+.Tn NFS
+LKM is available,
+.Nm nfsd
+will exit with an error.
+.Pp
The
.Nm nfsd
utility exits 0 on success, and >0 if an error occurs.
.Sh SEE ALSO
.Xr nfsstat 1 ,
.Xr nfssvc 2 ,
+.Xr modload 8 ,
.Xr mountd 8 ,
.Xr portmap 8
.Sh HISTORY
diff --git a/sbin/nfsd/nfsd.c b/sbin/nfsd/nfsd.c
index 8e2d14c..9d4d226 100644
--- a/sbin/nfsd/nfsd.c
+++ b/sbin/nfsd/nfsd.c
@@ -144,6 +144,18 @@ main(argc, argv, envp)
int nfsdcnt, nfssvc_flag, on, reregister, sock, tcpflag, tcpsock;
int tp4cnt, tp4flag, tp4sock, tpipcnt, tpipflag, tpipsock, udpflag;
char *cp, **cpp;
+ struct vfsconf *vfc;
+
+ vfc = getvfsbyname("nfs");
+ if(!vfc && vfsisloadable("nfs")) {
+ if(vfsload("nfs"))
+ err(1, "vfsload(nfs)");
+ endvfsent(); /* flush cache */
+ vfc = getvfsbyname("nfs"); /* probably unnecessary */
+ }
+ if(!vfc) {
+ errx(1, "NFS is not available in the running kernel");
+ }
/* Save start and extent of argv for setproctitle. */
Argv = argv;
diff --git a/sbin/nfsiod/nfsiod.8 b/sbin/nfsiod/nfsiod.8
index 2acd365..e2ccc67 100644
--- a/sbin/nfsiod/nfsiod.8
+++ b/sbin/nfsiod/nfsiod.8
@@ -29,9 +29,10 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" @(#)nfsiod.8 8.2 (Berkeley) 2/22/94
+.\" From: @(#)nfsiod.8 8.2 (Berkeley) 2/22/94
+.\" $Id$
.\"
-.Dd February 22, 1994
+.Dd September 22, 1994
.Dt NFSIOD 8
.Os
.Sh NAME
@@ -60,12 +61,29 @@ Specify how many servers are to be started.
A client should run enough daemons to handle its maximum
level of concurrency, typically four to six.
.Pp
+If
+.Nm nfsiod
+detects that the running kernel does not include
+.Tn NFS
+support, it will attempt to load a loadable kernel module containing
+.Tn NFS
+code, using
+.Xr modload 8
+by way of
+.Xr vfsload 3 .
+If this fails, or no
+.Tn NFS
+LKM was available,
+.Nm nfsiod
+exits with an error.
+.Pp
The
.Nm nfsiod
utility exits 0 on success, and >0 if an error occurs.
.Sh SEE ALSO
.Xr nfsstat 1 ,
.Xr nfssvc 2 ,
+.Xr modload 8 ,
.Xr mountd 8 ,
.Xr portmap 8
.Sh HISTORY
diff --git a/sbin/nfsiod/nfsiod.c b/sbin/nfsiod/nfsiod.c
index b742fdc..d066329 100644
--- a/sbin/nfsiod/nfsiod.c
+++ b/sbin/nfsiod/nfsiod.c
@@ -49,6 +49,7 @@ static char sccsid[] = "@(#)nfsiod.c 8.3 (Berkeley) 2/22/94";
#include <sys/syslog.h>
#include <sys/ucred.h>
#include <sys/wait.h>
+#include <sys/mount.h>
#include <nfs/nfsv2.h>
#include <nfs/nfs.h>
@@ -83,6 +84,19 @@ main(argc, argv)
char *argv[];
{
int ch, num_servers;
+ struct vfsconf *vfc;
+
+ vfc = getvfsbyname("nfs");
+ if(!vfc && vfsisloadable("nfs")) {
+ if(vfsload("nfs"))
+ err(1, "vfsload(nfs)");
+ endvfsent(); /* flush cache */
+ vfc = getvfsbyname("nfs");
+ }
+
+ if(!vfc) {
+ errx(1, "NFS support is not available in the running kernel");
+ }
#define MAXNFSDCNT 20
#define DEFNFSDCNT 1
OpenPOWER on IntegriCloud