diff options
author | dfr <dfr@FreeBSD.org> | 1998-09-26 10:51:38 +0000 |
---|---|---|
committer | dfr <dfr@FreeBSD.org> | 1998-09-26 10:51:38 +0000 |
commit | ad6ddb77671a5780eefdb973075656e601890d74 (patch) | |
tree | 7ee815e87abf339583a4b840f14159bc49a21714 /sys/boot/alpha/boot1 | |
parent | 236ad5eb3ca90664e90a383de91faa975d35b8fc (diff) | |
download | FreeBSD-src-ad6ddb77671a5780eefdb973075656e601890d74.zip FreeBSD-src-ad6ddb77671a5780eefdb973075656e601890d74.tar.gz |
* Add old UFS compatibility code to alpha/boot1.
* Fix a raft of warnings, printf and otherwise.
* Allocate the correct amount in mod_searchmodule to prevent an overflow.
* Fix the makefiles so they work outside my home directory (oops).
Diffstat (limited to 'sys/boot/alpha/boot1')
-rw-r--r-- | sys/boot/alpha/boot1/Makefile | 3 | ||||
-rw-r--r-- | sys/boot/alpha/boot1/boot1.c | 4 | ||||
-rw-r--r-- | sys/boot/alpha/boot1/sys.c | 47 |
3 files changed, 46 insertions, 8 deletions
diff --git a/sys/boot/alpha/boot1/Makefile b/sys/boot/alpha/boot1/Makefile index 9eb9186..24cca02 100644 --- a/sys/boot/alpha/boot1/Makefile +++ b/sys/boot/alpha/boot1/Makefile @@ -10,10 +10,7 @@ PROG = boot1 SRCS= start.S boot1.c sys.c CFLAGS+= -mno-fp-regs CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR} -LIBSTANDDIR= /home/dfr/FreeBSD/alpha/src/lib/libstand -LIBSTAND= -lstand CFLAGS+= -I${LIBSTANDDIR} -LIBALPHA= ${.OBJDIR}/../libalpha/libalpha.a CFLAGS+= -I${.CURDIR}/.. CFLAGS+= -DSECONDARY_LOAD_ADDRESS=0x${SECONDARY_LOAD_ADDRESS} -DMINIMAL NOMAN=1 diff --git a/sys/boot/alpha/boot1/boot1.c b/sys/boot/alpha/boot1/boot1.c index e52987a..a3fbfc2 100644 --- a/sys/boot/alpha/boot1/boot1.c +++ b/sys/boot/alpha/boot1/boot1.c @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: boot1.c,v 1.1.1.1 1998/08/21 03:17:41 msmith Exp $ * From $NetBSD: bootxx.c,v 1.4 1997/09/06 14:08:29 drochner Exp $ */ @@ -162,7 +162,7 @@ loadfile(char *name, char *addr) } do { - n = read(addr, 1024); + n = readit(addr, 1024); addr += n; twiddle(); } while (n > 0); diff --git a/sys/boot/alpha/boot1/sys.c b/sys/boot/alpha/boot1/sys.c index 1c0d912..79f1702 100644 --- a/sys/boot/alpha/boot1/sys.c +++ b/sys/boot/alpha/boot1/sys.c @@ -25,7 +25,7 @@ * * from: Mach, Revision 2.2 92/04/04 11:36:34 rpd * fromL Id: sys.c,v 1.21 1997/06/09 05:10:56 bde Exp - * $Id$ + * $Id: sys.c,v 1.1.1.1 1998/08/21 03:17:41 msmith Exp $ */ #include <sys/param.h> @@ -37,6 +37,8 @@ #include <sys/dirent.h> +#define COMPAT_UFS + struct fs *fs; struct inode inode; int boff = 0; @@ -65,7 +67,7 @@ static int block_map(int file_block); static int find(char *path); int -read(char *buffer, int count) +readit(char *buffer, int count) { int logno, off, size; int cnt2, bnum2; @@ -160,11 +162,44 @@ block_map(int file_block) return (((int *)mapbuf)[(file_block - NDADDR) % NINDIR(fs)]); } +#ifdef COMPAT_UFS + +#define max(a, b) ((a) > (b) ? (a) : (b)) + +/* + * Sanity checks for old file systems. + * + * XXX - goes away some day. + */ +static void +ffs_oldfscompat(fs) + struct fs *fs; +{ + int i; + + fs->fs_npsect = max(fs->fs_npsect, fs->fs_nsect); /* XXX */ + fs->fs_interleave = max(fs->fs_interleave, 1); /* XXX */ + if (fs->fs_postblformat == FS_42POSTBLFMT) /* XXX */ + fs->fs_nrpos = 8; /* XXX */ + if (fs->fs_inodefmt < FS_44INODEFMT) { /* XXX */ + quad_t sizepb = fs->fs_bsize; /* XXX */ + /* XXX */ + fs->fs_maxfilesize = fs->fs_bsize * NDADDR - 1; /* XXX */ + for (i = 0; i < NIADDR; i++) { /* XXX */ + sizepb *= NINDIR(fs); /* XXX */ + fs->fs_maxfilesize += sizepb; /* XXX */ + } /* XXX */ + fs->fs_qbmask = ~fs->fs_bmask; /* XXX */ + fs->fs_qfmask = ~fs->fs_fmask; /* XXX */ + } /* XXX */ +} +#endif int openrd(char *name) { int ret; + char namecopy[128]; if (devopen()) return 1; @@ -174,10 +209,16 @@ openrd(char *name) */ devread((char *)(fs = (struct fs *)fsbuf), SBLOCK + boff, SBSIZE); +#ifdef COMPAT_UFS + ffs_oldfscompat(fs); +#endif + /* * Find the actual FILE on the mounted device. + * Make a copy of the name since find() is destructive. */ - ret = find(name); + strcpy(namecopy, name); + ret = find(namecopy); if (ret == 0) return 1; if (ret < 0) |