1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-02 08:42:48 +00:00

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.)
This commit is contained in:
Garrett Wollman 1994-09-22 02:07:33 +00:00
parent 862cdb8eb6
commit c974f9c6a6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=2968
4 changed files with 40 additions and 8 deletions

View File

@ -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 **

View File

@ -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:

View File

@ -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 **

View File

@ -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: