mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-26 04:54:07 +01:00
After having put on my Asbestos suit, complete the MFS_ROOT part of Terry's
mountroot changes. This means that the mfs_initminiroot functionality into the root mfs_mount....
This commit is contained in:
parent
6884d2aae7
commit
018309ece7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=12499
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
|
||||
* $Id: autoconf.c,v 1.41 1995/11/05 04:43:11 gibbs Exp $
|
||||
* $Id: autoconf.c,v 1.42 1995/11/20 12:09:54 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -75,6 +75,9 @@ static void setroot(void);
|
||||
*/
|
||||
int dkn; /* number of iostat dk numbers assigned so far */
|
||||
|
||||
#ifdef MFS_ROOT
|
||||
extern struct vfsops mfs_vfsops;
|
||||
#endif
|
||||
#ifdef FFS
|
||||
extern struct vfsops ufs_vfsops;
|
||||
#endif
|
||||
@ -90,11 +93,6 @@ int cd9660_mountroot __P((void *));
|
||||
#ifdef MSDOSFS
|
||||
int msdosfs_mountroot __P((void *));
|
||||
#endif
|
||||
#ifdef MFS_ROOT
|
||||
int mfs_initminiroot __P((u_char *));
|
||||
u_char mfs_root[MFS_ROOT*1024] = "MFS Filesystem goes here";
|
||||
u_char end_mfs_root[] = "MFS Filesystem had better STOP here";
|
||||
#endif
|
||||
|
||||
#include "eisa.h"
|
||||
#include "isa.h"
|
||||
@ -199,10 +197,6 @@ configure(dummy)
|
||||
|
||||
cninit_finish();
|
||||
|
||||
#ifdef MFS_ROOT
|
||||
mfs_initminiroot(mfs_root); /* XXX UGLY*/
|
||||
#endif /* MFS_ROOT */
|
||||
|
||||
#ifdef CD9660
|
||||
if ((boothowto & RB_CDROM) && !mountroot)
|
||||
mountroot = find_cdrom_root;
|
||||
@ -213,6 +207,22 @@ configure(dummy)
|
||||
mountroot = nfs_mountroot;
|
||||
#endif /* NFS */
|
||||
|
||||
#ifdef MFS_ROOT
|
||||
if (!mountroot) {
|
||||
mountroot = vfs_mountroot; /* XXX goes away*/
|
||||
mountrootvfsops = &mfs_vfsops;
|
||||
/*
|
||||
* Ignore the -a flag if this kernel isn't compiled
|
||||
* with a generic root/swap configuration: if we skip
|
||||
* setroot() and we aren't a generic kernel, chaos
|
||||
* will ensue because setconf() will be a no-op.
|
||||
* (rootdev is always initialized to NODEV in a
|
||||
* generic configuration, so we test for that.)
|
||||
*/
|
||||
if ((boothowto & RB_ASKNAME) == 0 || rootdev != NODEV)
|
||||
setroot();
|
||||
}
|
||||
#endif
|
||||
#ifdef FFS
|
||||
if (!mountroot) {
|
||||
mountroot = vfs_mountroot; /* XXX goes away*/
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
|
||||
* $Id: autoconf.c,v 1.41 1995/11/05 04:43:11 gibbs Exp $
|
||||
* $Id: autoconf.c,v 1.42 1995/11/20 12:09:54 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -75,6 +75,9 @@ static void setroot(void);
|
||||
*/
|
||||
int dkn; /* number of iostat dk numbers assigned so far */
|
||||
|
||||
#ifdef MFS_ROOT
|
||||
extern struct vfsops mfs_vfsops;
|
||||
#endif
|
||||
#ifdef FFS
|
||||
extern struct vfsops ufs_vfsops;
|
||||
#endif
|
||||
@ -90,11 +93,6 @@ int cd9660_mountroot __P((void *));
|
||||
#ifdef MSDOSFS
|
||||
int msdosfs_mountroot __P((void *));
|
||||
#endif
|
||||
#ifdef MFS_ROOT
|
||||
int mfs_initminiroot __P((u_char *));
|
||||
u_char mfs_root[MFS_ROOT*1024] = "MFS Filesystem goes here";
|
||||
u_char end_mfs_root[] = "MFS Filesystem had better STOP here";
|
||||
#endif
|
||||
|
||||
#include "eisa.h"
|
||||
#include "isa.h"
|
||||
@ -199,10 +197,6 @@ configure(dummy)
|
||||
|
||||
cninit_finish();
|
||||
|
||||
#ifdef MFS_ROOT
|
||||
mfs_initminiroot(mfs_root); /* XXX UGLY*/
|
||||
#endif /* MFS_ROOT */
|
||||
|
||||
#ifdef CD9660
|
||||
if ((boothowto & RB_CDROM) && !mountroot)
|
||||
mountroot = find_cdrom_root;
|
||||
@ -213,6 +207,22 @@ configure(dummy)
|
||||
mountroot = nfs_mountroot;
|
||||
#endif /* NFS */
|
||||
|
||||
#ifdef MFS_ROOT
|
||||
if (!mountroot) {
|
||||
mountroot = vfs_mountroot; /* XXX goes away*/
|
||||
mountrootvfsops = &mfs_vfsops;
|
||||
/*
|
||||
* Ignore the -a flag if this kernel isn't compiled
|
||||
* with a generic root/swap configuration: if we skip
|
||||
* setroot() and we aren't a generic kernel, chaos
|
||||
* will ensue because setconf() will be a no-op.
|
||||
* (rootdev is always initialized to NODEV in a
|
||||
* generic configuration, so we test for that.)
|
||||
*/
|
||||
if ((boothowto & RB_ASKNAME) == 0 || rootdev != NODEV)
|
||||
setroot();
|
||||
}
|
||||
#endif
|
||||
#ifdef FFS
|
||||
if (!mountroot) {
|
||||
mountroot = vfs_mountroot; /* XXX goes away*/
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)mfs_vfsops.c 8.4 (Berkeley) 4/16/94
|
||||
* $Id: mfs_vfsops.c,v 1.14 1995/11/09 08:14:26 bde Exp $
|
||||
* $Id: mfs_vfsops.c,v 1.15 1995/11/28 02:15:29 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -88,32 +88,12 @@ struct vfsops mfs_vfsops = {
|
||||
|
||||
VFS_SET(mfs_vfsops, mfs, MOUNT_MFS, 0);
|
||||
|
||||
/*
|
||||
* This is called early in boot to set the base address and size
|
||||
* of the mini-root.
|
||||
*
|
||||
* XXX THIS IS A DESIGN ERROR; THIS CODE SHOULD BE MOVED INTO
|
||||
* XXX THE ROOT MOUNT CODE IN "mfs_mount"!!!
|
||||
*/
|
||||
int
|
||||
mfs_initminiroot(base)
|
||||
caddr_t base;
|
||||
{
|
||||
struct fs *fs = (struct fs *)(base + SBOFF);
|
||||
#ifdef MFS_ROOT
|
||||
|
||||
/* check for valid super block */
|
||||
if (fs->fs_magic != FS_MAGIC || fs->fs_bsize > MAXBSIZE ||
|
||||
fs->fs_bsize < sizeof(struct fs))
|
||||
return (0);
|
||||
mountroot = vfs_mountroot; /* XXX goes away*/
|
||||
mountrootvfsops = &mfs_vfsops;
|
||||
mfs_rootbase = base;
|
||||
mfs_rootsize = fs->fs_fsize * fs->fs_size;
|
||||
rootdev = makedev(255, mfs_minor++);
|
||||
printf("rootfs is %ld Kbyte compiled in MFS\n",mfs_rootsize/1024);
|
||||
return (mfs_rootsize);
|
||||
}
|
||||
u_char mfs_root[MFS_ROOT*1024] = "MFS Filesystem goes here";
|
||||
u_char end_mfs_root[] = "MFS Filesystem had better STOP here";
|
||||
|
||||
#endif /* MFS_ROOT */
|
||||
|
||||
/*
|
||||
* mfs_mount
|
||||
@ -179,6 +159,23 @@ mfs_mount(mp, path, data, ndp, p)
|
||||
***
|
||||
*/
|
||||
|
||||
#ifdef MFS_ROOT
|
||||
/* Location of MFS/FFS superblock */
|
||||
fs = (struct fs *)(mfs_root + SBOFF);
|
||||
|
||||
/* recheck for valid super block */
|
||||
if (fs->fs_magic != FS_MAGIC || fs->fs_bsize > MAXBSIZE ||
|
||||
fs->fs_bsize < sizeof(struct fs)) {
|
||||
panic("MFS image is invalid!!");
|
||||
}
|
||||
|
||||
mfs_rootbase = mfs_root;
|
||||
mfs_rootsize = fs->fs_fsize * fs->fs_size;
|
||||
rootdev = makedev(255, mfs_minor++);
|
||||
printf("rootfs is %ld Kbyte compiled in MFS\n",
|
||||
mfs_rootsize/1024);
|
||||
|
||||
|
||||
/* Get vnode for root device*/
|
||||
if( bdevvp( rootdev, &rootvp))
|
||||
panic("mfs_mountroot: can't setup bdevvp for rootdev");
|
||||
@ -207,6 +204,10 @@ mfs_mount(mp, path, data, ndp, p)
|
||||
}
|
||||
|
||||
goto dostatfs; /* success*/
|
||||
#else
|
||||
/* you loose */
|
||||
panic("mfs_mount: mount MFS as root: not configured!");
|
||||
#endif /* MFS_ROOT */
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user