autoconf.c,locore.c: changes for setroot()

disksubr.c: removing some debugging code
machdep.c: changes to boot() for file syncing (uncommenting an #if 0)
This commit is contained in:
phil 1994-04-01 23:16:54 +00:00
parent 3626d9a416
commit f58e820881
4 changed files with 57 additions and 19 deletions

View File

@ -35,7 +35,7 @@
*
* @(#)autoconf.c 7.1 (Berkeley) 5/9/91
*
* $Id: autoconf.c,v 1.5 1994/03/22 00:18:25 phil Exp $
* $Id: autoconf.c,v 1.6 1994/04/01 23:16:54 phil Exp $
*/
/*
@ -136,10 +136,36 @@ static char devname[][2] = {
* If we can do so, and not instructed not to do so,
* change rootdev to correspond to the load device.
*/
extern int _boot_flags;
/* 0 => no flags */
setroot()
{
#if 1
/* boothowto |= RB_SINGLE; */
int majdev, mindev;
char ans;
dev_t temp;
if (_boot_flags & 0x2) {
boothowto |= RB_SINGLE;
}
if (_boot_flags & 0x1) {
printf ("root dev (0=>/dev/rd, 1=>/dev/sd0a, 2=>/dev/sd1a) ?");
ans = cngetc();
printf ("%c\n", ans);
if (ans < '0' || ans > '2') {
printf ("bad root dev, using config root dev \n");
return;
}
if (ans == '0') {
rootdev = makedev(2,0);
} else if (ans == '1') {
rootdev = makedev(0,0);
} else {
rootdev = makedev(0,8);
}
}
#else
int majdev, mindev, unit, part, adaptor;
dev_t temp, orootdev;

View File

@ -32,7 +32,7 @@
*
* from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
*
* $Id: disksubr.c,v 1.4 1994/03/22 00:18:30 phil Exp $
* $Id: disksubr.c,v 1.5 1994/04/01 23:16:56 phil Exp $
*/
#include "param.h"
@ -158,7 +158,6 @@ writedisklabel(dev, strat, lp, osdep)
int labelpart;
int error = 0;
printf ("write disk label ...");
labelpart = dkpart(dev);
if (lp->d_partitions[labelpart].p_offset != 0) {
if (lp->d_partitions[0].p_offset != 0)
@ -188,7 +187,6 @@ printf ("write disk label ...");
}
error = ESRCH;
done:
printf (" ... error = %d\n", error);
brelse(bp);
return (error);
}
@ -206,9 +204,6 @@ bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel)
int maxsz = p->p_size,
sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT;
if (bp->b_blkno + p->p_offset <= LABELSECTOR )
printf ("access to sector 0\n");
/* Check to see if it is the label sector and it is write only. */
if (bp->b_blkno + p->p_offset <= LABELSECTOR &&
(bp->b_flags & B_READ) == 0 && wlabel == 0) {

View File

@ -106,6 +106,12 @@ _PL_zero: .long 0
start:
br here_we_go
.align 4
.globl __boot_flags /* First cut at flags from a boot program */
__boot_flags:
.long 0 /* 0 => nothing sent in by boot loader. */
.long 0 /* Other information? */
.align 4 /* So the trap table is double aligned. */
int_base_tab: /* Here is the fixed jump table for traps! */
.long __trap_nvi

View File

@ -655,20 +655,27 @@ boot(arghowto)
}
howto = arghowto;
printf ("boot: howto=0x%x\n", howto);
#if 0
if ((howto&RB_NOSYNC) == 0 && waittime < 0 && bfreelist[0].b_forw) {
register struct buf *bp;
int iter, nbusy;
waittime = 0;
(void) splnet();
printf("syncing disks... ");
/*
* Release inodes held by texts before update.
*/
if (panicstr == 0)
vnode_pager_umount(NULL);
sync((struct sigcontext *)0);
sync((struct proc *)0, (void *)0, (int *)0);
/*
* Unmount filesystems
*/
#if 0
if (panicstr == 0)
vfs_unmountall();
#endif
for (iter = 0; iter < 20; iter++) {
nbusy = 0;
for (bp = &buf[nbuf]; --bp >= buf; )
@ -676,20 +683,24 @@ printf ("boot: howto=0x%x\n", howto);
nbusy++;
if (nbusy == 0)
break;
if (nomsg) {
printf("updating disks before rebooting... ");
nomsg = 0;
}
/* printf("%d ", nbusy); */
printf("%d ", nbusy);
DELAY(40000 * iter);
}
if (nbusy)
printf(" failed!\n");
else if (nomsg == 0)
printf("succeded.\n");
printf("giving up\n");
else
printf("done\n");
#if 0
/*
* If we've been adjusting the clock, the todr
* will be out of synch; adjust it now.
*/
resettodr();
#endif
DELAY(10000); /* wait for printf to finish */
}
#endif /* if 0 */
splhigh();
devtype = major(rootdev);