diff options
author | Garrett Wollman <wollman@FreeBSD.org> | 1994-09-22 02:07:33 +0000 |
---|---|---|
committer | Garrett Wollman <wollman@FreeBSD.org> | 1994-09-22 02:07:33 +0000 |
commit | c974f9c6a643886f1fd87eedbb82955f3420dc8e (patch) | |
tree | 0f1bbcb4a9275356d74b9a9abd61dac9b8c172d5 /sbin | |
parent | 862cdb8eb6329b6d1e3b67fa8d488f53ea58b03c (diff) | |
download | src-c974f9c6a643886f1fd87eedbb82955f3420dc8e.tar.gz src-c974f9c6a643886f1fd87eedbb82955f3420dc8e.zip |
Use getvfs* functions to map between VFS types and names.
Automatically load UFS if it is not present but is loadable.
(This won't happen now, but could happen if we fix NFS diskless support.)
Notes
Notes:
svn path=/head/; revision=2968
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/mount/mount.c | 7 | ||||
-rw-r--r-- | sbin/mount/mount_ufs.c | 17 | ||||
-rw-r--r-- | sbin/mount_ifs/mount.c | 7 | ||||
-rw-r--r-- | sbin/mount_ifs/mount_ufs.c | 17 |
4 files changed, 40 insertions, 8 deletions
diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c index d16b3d6b5543..ee05e9db3367 100644 --- a/sbin/mount/mount.c +++ b/sbin/mount/mount.c @@ -412,12 +412,13 @@ badvfstype(vfstype, vfslist) int vfstype; const char **vfslist; { -static const char *vfsnames[] = INITMOUNTNAMES; + struct vfsconf *vfc; + vfc = getvfsbytype(vfstype); - if ((vfstype < 0) || (vfstype > MOUNT_MAXTYPE)) + if ( ! vfc ) return (0); - return (badvfsname(vfsnames[vfstype], vfslist)); + return (badvfsname(vfc->vfc_name, vfslist)); } const char ** diff --git a/sbin/mount/mount_ufs.c b/sbin/mount/mount_ufs.c index babb760a07d8..43dfb055e198 100644 --- a/sbin/mount/mount_ufs.c +++ b/sbin/mount/mount_ufs.c @@ -72,6 +72,7 @@ mount_ufs(argc, argv) struct ufs_args args; int ch, mntflags; char *fs_name; + struct vfsconf *vfc; mntflags = 0; optind = optreset = 1; /* Reset for parse of new argv. */ @@ -100,7 +101,21 @@ mount_ufs(argc, argv) else args.export.ex_flags = 0; - if (mount(MOUNT_UFS, fs_name, mntflags, &args) < 0) { + setvfsent(0); + if(!(vfc = getvfsbyname("ufs"))) { + if(vfsisloadable("ufs")) { + if(vfsload("ufs")) { + warn("vfsload(\"ufs\")"); + return 1; + } + endvfsent(); /* flush old table */ + vfc = getvfsbyname("ufs"); + } else { + /*warnx("ufs: filesystem not found");*/ + } + } + + if (mount(vfc ? vfc->vfc_index : MOUNT_UFS, fs_name, mntflags, &args) < 0) { (void)fprintf(stderr, "%s on %s: ", args.fspec, fs_name); switch (errno) { case EMFILE: diff --git a/sbin/mount_ifs/mount.c b/sbin/mount_ifs/mount.c index d16b3d6b5543..ee05e9db3367 100644 --- a/sbin/mount_ifs/mount.c +++ b/sbin/mount_ifs/mount.c @@ -412,12 +412,13 @@ badvfstype(vfstype, vfslist) int vfstype; const char **vfslist; { -static const char *vfsnames[] = INITMOUNTNAMES; + struct vfsconf *vfc; + vfc = getvfsbytype(vfstype); - if ((vfstype < 0) || (vfstype > MOUNT_MAXTYPE)) + if ( ! vfc ) return (0); - return (badvfsname(vfsnames[vfstype], vfslist)); + return (badvfsname(vfc->vfc_name, vfslist)); } const char ** diff --git a/sbin/mount_ifs/mount_ufs.c b/sbin/mount_ifs/mount_ufs.c index babb760a07d8..43dfb055e198 100644 --- a/sbin/mount_ifs/mount_ufs.c +++ b/sbin/mount_ifs/mount_ufs.c @@ -72,6 +72,7 @@ mount_ufs(argc, argv) struct ufs_args args; int ch, mntflags; char *fs_name; + struct vfsconf *vfc; mntflags = 0; optind = optreset = 1; /* Reset for parse of new argv. */ @@ -100,7 +101,21 @@ mount_ufs(argc, argv) else args.export.ex_flags = 0; - if (mount(MOUNT_UFS, fs_name, mntflags, &args) < 0) { + setvfsent(0); + if(!(vfc = getvfsbyname("ufs"))) { + if(vfsisloadable("ufs")) { + if(vfsload("ufs")) { + warn("vfsload(\"ufs\")"); + return 1; + } + endvfsent(); /* flush old table */ + vfc = getvfsbyname("ufs"); + } else { + /*warnx("ufs: filesystem not found");*/ + } + } + + if (mount(vfc ? vfc->vfc_index : MOUNT_UFS, fs_name, mntflags, &args) < 0) { (void)fprintf(stderr, "%s on %s: ", args.fspec, fs_name); switch (errno) { case EMFILE: |