Fix a bug with preloaded image -- for some reason [that i don't

completely understand], md_takeroot() runs before md_preloaded(),
rendering both useless.
As a fix, move the body (effectively one line!) of md_takeroot()
into md_preloaded(), and get rid of the stuff that has become useless.

Bug and fix reported 10 days ago on -current, no reply.
This commit is contained in:
Luigi Rizzo 2004-03-31 21:48:02 +00:00
parent e271f829b8
commit 5d4ca75e56

View File

@ -110,7 +110,6 @@ static u_char end_mfs_root[] __unused = "MFS Filesystem had better STOP here";
static g_init_t md_drvinit;
static int mdrootready;
static int mdunits;
static dev_t status_dev = 0;
@ -1180,8 +1179,10 @@ md_preloaded(u_char *image, unsigned length)
sc->nsect = length / DEV_BSIZE;
sc->pl_ptr = image;
sc->pl_len = length;
#ifdef MD_ROOT
if (sc->unit == 0)
mdrootready = 1;
rootdevnames[0] = "ufs:/dev/md0";
#endif
mdinit(sc);
}
@ -1253,15 +1254,3 @@ static moduledata_t md_mod = {
};
DECLARE_MODULE(md, md_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
MODULE_VERSION(md, MD_MODVER);
#ifdef MD_ROOT
static void
md_takeroot(void *junk)
{
if (mdrootready)
rootdevnames[0] = "ufs:/dev/md0";
}
SYSINIT(md_root, SI_SUB_MOUNT_ROOT, SI_ORDER_FIRST, md_takeroot, NULL);
#endif /* MD_ROOT */