Begone with some garish Mach_StructureNames.

Add a comment about the bootblock structure.
This commit is contained in:
simonb 1999-10-25 02:29:45 +00:00
parent 690672a81d
commit 249879ba34
3 changed files with 41 additions and 32 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dec_boot.h,v 1.5 1999/04/24 08:01:10 simonb Exp $ */
/* $NetBSD: dec_boot.h,v 1.6 1999/10/25 02:29:45 simonb Exp $ */
/*
* Copyright (c) 1992, 1993
@ -60,21 +60,30 @@
* after the boot information expected by the PROM boot loader.
*/
struct Dec_BootMap {
int numBlocks; /* Number of blocks to read. */
int startBlock; /* Starting block on disk. */
struct boot_map {
int num_blocks; /* Number of blocks to read. */
int start_block; /* Starting block on disk. */
};
struct Dec_DiskBoot {
/*
* This is the structure of a disk or tape boot block. The boot_map
* can either be a single boot count and start block (contiguous mode)
* or a list of up to 61 (to fill a 512 byte sector) block count and
* start block pairs. Under NetBSD, contiguous mode is always used.
*/
struct boot_block {
char pad[8];
int magic; /* DEC_BOOT_MAGIC */
int mode; /* Mode for boot info. */
int loadAddr; /* Address to start loading. */
int execAddr; /* Address to start execing. */
struct Dec_BootMap map[61]; /* boot program sections. */
int load_addr; /* Address to start loading. */
int exec_addr; /* Address to start execing. */
struct boot_map map[1]; /* boot program section(s). */
};
#define DEC_BOOT_MAGIC 0x0002757a
#define DEC_BOOTMODE_CONTIGUOUS 0
#define DEC_BOOTMODE_SCATTERED 1
#define DEC_BOOT_SECTOR 0
/*
@ -88,20 +97,20 @@ struct Dec_DiskBoot {
* A disk is divided into partitions and this type specifies where a
* partition starts and how many bytes it contains.
*/
typedef struct Dec_DiskMap {
int numBlocks; /* Number of 512 byte blocks in partition. */
int startBlock; /* Start of partition in blocks. */
} Dec_DiskMap;
typedef struct dec_disk_map {
int num_blocks; /* Number of 512 byte blocks in partition. */
int start_block; /* Start of partition in blocks. */
} dec_disk_map;
/*
* Label information on the 31st (DEC_LABEL_SECTOR) sector.
*/
typedef struct Dec_DiskLabel {
typedef struct dec_disklabel {
char pad0[440]; /* DIFFERENT from sprite!!! */
int magic; /* DEC_LABEL_MAGIC */
int isPartitioned; /* 1 if disk is partitioned. */
Dec_DiskMap map[DEC_NUM_DISK_PARTS]; /* Indicates disk partitions. */
} Dec_DiskLabel;
int is_partitioned; /* 1 if disk is partitioned. */
dec_disk_map map[DEC_NUM_DISK_PARTS]; /* Indicates disk partitions. */
} dec_disklabel;
#define DEC_LABEL_MAGIC 0x00032957
#define DEC_LABEL_SECTOR 31

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.20 1999/04/24 08:01:12 simonb Exp $ */
/* $NetBSD: disksubr.c,v 1.21 1999/10/25 02:29:46 simonb Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -127,7 +127,7 @@ compat_label(dev, strat, lp, osdep)
struct disklabel *lp;
struct cpu_disklabel *osdep;
{
Dec_DiskLabel *dlp;
dec_disklabel *dlp;
struct buf *bp = NULL;
char *msg = NULL;
@ -144,9 +144,9 @@ compat_label(dev, strat, lp, osdep)
goto done;
}
for (dlp = (Dec_DiskLabel *)bp->b_un.b_addr;
dlp <= (Dec_DiskLabel *)(bp->b_un.b_addr+DEV_BSIZE-sizeof(*dlp));
dlp = (Dec_DiskLabel *)((char *)dlp + sizeof(long))) {
for (dlp = (dec_disklabel *)bp->b_un.b_addr;
dlp <= (dec_disklabel *)(bp->b_un.b_addr+DEV_BSIZE-sizeof(*dlp));
dlp = (dec_disklabel *)((char *)dlp + sizeof(long))) {
int part;
@ -166,8 +166,8 @@ compat_label(dev, strat, lp, osdep)
part <((MAXPARTITIONS<DEC_NUM_DISK_PARTS) ?
MAXPARTITIONS : DEC_NUM_DISK_PARTS);
part++) {
lp->d_partitions[part].p_size = dlp->map[part].numBlocks;
lp->d_partitions[part].p_offset = dlp->map[part].startBlock;
lp->d_partitions[part].p_size = dlp->map[part].num_blocks;
lp->d_partitions[part].p_offset = dlp->map[part].start_block;
lp->d_partitions[part].p_fsize = 1024;
lp->d_partitions[part].p_fstype =
(part==1) ? FS_SWAP : FS_BSDFFS;

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkboot.c,v 1.11 1999/03/26 05:23:59 simonb Exp $ */
/* $NetBSD: mkboot.c,v 1.12 1999/10/25 02:29:46 simonb Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -84,7 +84,7 @@ static char copyright[] =
#ifdef notdef
static char sccsid[] = "@(#)mkboot.c 8.1 (Berkeley) 6/10/93";
#endif
static char rcsid[] = "$NetBSD: mkboot.c,v 1.11 1999/03/26 05:23:59 simonb Exp $";
static char rcsid[] = "$NetBSD: mkboot.c,v 1.12 1999/10/25 02:29:46 simonb Exp $";
#endif not lint
#include <sys/param.h>
@ -94,7 +94,7 @@ static char rcsid[] = "$NetBSD: mkboot.c,v 1.11 1999/03/26 05:23:59 simonb Exp $
#include <machine/dec_boot.h>
struct Dec_DiskBoot decBootInfo;
struct boot_block dec_boot_block;
char block[DEV_BSIZE];
char *bootfname, *xxboot, *bootxx;
@ -148,16 +148,16 @@ main(argc, argv)
/*
* Write the boot information block.
*/
read(ifd, &decBootInfo, sizeof(decBootInfo));
if (decBootInfo.magic != DEC_BOOT_MAGIC) {
read(ifd, &dec_boot_block, sizeof(dec_boot_block));
if (dec_boot_block.magic != DEC_BOOT_MAGIC) {
fprintf(stderr, "bootfile does not contain boot sector\n");
die();
}
decBootInfo.map[0].numBlocks = nsectors =
dec_boot_block.map[0].num_blocks = nsectors =
(length + DEV_BSIZE - 1) >> DEV_BSHIFT;
length -= sizeof(decBootInfo);
if (write(ofd1, (char *)&decBootInfo, sizeof(decBootInfo)) !=
sizeof(decBootInfo) || close(ofd1) != 0) {
length -= sizeof(dec_boot_block);
if (write(ofd1, (char *)&dec_boot_block, sizeof(dec_boot_block)) !=
sizeof(dec_boot_block) || close(ofd1) != 0) {
perror(xxboot);
die();
}