diff options
-rw-r--r-- | lib/libdisk/write_pc98_disk.c | 4 | ||||
-rw-r--r-- | sbin/bsdlabel/bsdlabel.c | 12 | ||||
-rw-r--r-- | sbin/disklabel/disklabel.c | 12 | ||||
-rw-r--r-- | sbin/fdisk_pc98/fdisk.c | 25 | ||||
-rw-r--r-- | sys/boot/pc98/boot2/disk.c | 4 | ||||
-rw-r--r-- | sys/boot/pc98/libpc98/biosdisk.c | 12 | ||||
-rw-r--r-- | sys/geom/geom_pc98.c | 16 | ||||
-rw-r--r-- | sys/pc98/pc98/diskslice_machdep.c | 14 | ||||
-rw-r--r-- | sys/sys/diskpc98.h | 4 |
9 files changed, 62 insertions, 41 deletions
diff --git a/lib/libdisk/write_pc98_disk.c b/lib/libdisk/write_pc98_disk.c index 14ebda5..efd2d10 100644 --- a/lib/libdisk/write_pc98_disk.c +++ b/lib/libdisk/write_pc98_disk.c @@ -68,7 +68,7 @@ Write_Disk(const struct disk *d1) int ret = 0; char device[64]; u_char *mbr; - struct dos_partition *dp, work[NDOSPART]; + struct pc98_partition *dp, work[NDOSPART]; int s[7]; int PC98_EntireDisk = 0; @@ -91,7 +91,7 @@ Write_Disk(const struct disk *d1) memset(s, 0, sizeof s); mbr = read_block(fd, 1, d1->sector_size); - dp = (struct dos_partition *)(mbr + DOSPARTOFF); + dp = (struct pc98_partition *)(mbr + DOSPARTOFF); memcpy(work, dp, sizeof work); dp = work; free(mbr); diff --git a/sbin/bsdlabel/bsdlabel.c b/sbin/bsdlabel/bsdlabel.c index 3d3139f..786ca62 100644 --- a/sbin/bsdlabel/bsdlabel.c +++ b/sbin/bsdlabel/bsdlabel.c @@ -658,7 +658,17 @@ makebootarea(char *boot, struct disklabel *dp, int f) if (read(b, boot, (int)dp->d_secsize) < 0) err(4, "%s", xxboot); (void)close(b); -#ifdef __i386__ +#ifdef PC98 + for (i = DOSPARTOFF, found = 0; + !found && i < (int)(DOSPARTOFF + NDOSPART * sizeof(struct pc98_partition)); + i++) + found = tmpbuf[i] != 0; + if (found) + memcpy((void *)&boot[DOSPARTOFF], + (void *)&tmpbuf[DOSPARTOFF], + NDOSPART * sizeof(struct pc98_partition)); + free(tmpbuf); +#elif defined(__i386__) for (i = DOSPARTOFF, found = 0; !found && i < (int)(DOSPARTOFF + NDOSPART*sizeof(struct dos_partition)); i++) diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c index 3d3139f..786ca62 100644 --- a/sbin/disklabel/disklabel.c +++ b/sbin/disklabel/disklabel.c @@ -658,7 +658,17 @@ makebootarea(char *boot, struct disklabel *dp, int f) if (read(b, boot, (int)dp->d_secsize) < 0) err(4, "%s", xxboot); (void)close(b); -#ifdef __i386__ +#ifdef PC98 + for (i = DOSPARTOFF, found = 0; + !found && i < (int)(DOSPARTOFF + NDOSPART * sizeof(struct pc98_partition)); + i++) + found = tmpbuf[i] != 0; + if (found) + memcpy((void *)&boot[DOSPARTOFF], + (void *)&tmpbuf[DOSPARTOFF], + NDOSPART * sizeof(struct pc98_partition)); + free(tmpbuf); +#elif defined(__i386__) for (i = DOSPARTOFF, found = 0; !found && i < (int)(DOSPARTOFF + NDOSPART*sizeof(struct dos_partition)); i++) diff --git a/sbin/fdisk_pc98/fdisk.c b/sbin/fdisk_pc98/fdisk.c index 4aba829..eb046f0 100644 --- a/sbin/fdisk_pc98/fdisk.c +++ b/sbin/fdisk_pc98/fdisk.c @@ -83,7 +83,7 @@ struct mboot { unsigned char padding[2]; /* force the longs to be long aligned */ unsigned char bootinst[510]; unsigned short int signature; - struct dos_partition parts[8]; + struct pc98_partition parts[8]; unsigned char large_sector_overflow[MAX_SEC_SIZE-MIN_SEC_SIZE]; }; #else /* PC98 */ @@ -219,7 +219,7 @@ main(int argc, char *argv[]) struct stat sb; int c, i; int partition = -1; - struct dos_partition *partp; + struct pc98_partition *partp; #ifdef PC98 while ((c = getopt(argc, argv, "Ba:f:istuv12345678")) != -1) @@ -319,7 +319,7 @@ main(int argc, char *argv[]) #ifdef PC98 printf("Part %11s %11s SID\n", "Start", "Size"); for (i = 0; i < NDOSPART; i++) { - partp = ((struct dos_partition *) &mboot.parts) + i; + partp = ((struct pc98_partition *) &mboot.parts) + i; if (partp->dp_sid == 0) continue; printf("%4d: %11lu %11lu 0x%02x\n", i + 1, @@ -437,17 +437,17 @@ print_s0(int which) print_part(which); } -static struct dos_partition mtpart; +static struct pc98_partition mtpart; static void print_part(int i) { - struct dos_partition *partp; + struct pc98_partition *partp; u_int64_t part_sz, part_mb; - partp = ((struct dos_partition *) &mboot.parts) + i - 1; + partp = ((struct pc98_partition *) &mboot.parts) + i - 1; - if (!bcmp(partp, &mtpart, sizeof (struct dos_partition))) { + if (!bcmp(partp, &mtpart, sizeof (struct pc98_partition))) { printf("<UNUSED>\n"); return; } @@ -522,8 +522,8 @@ static void init_sector0(unsigned long start) { #ifdef PC98 - struct dos_partition *partp = - (struct dos_partition *)(&mboot.parts[3]); + struct pc98_partition *partp = + (struct pc98_partition *)(&mboot.parts[3]); unsigned long size = disksecs - start; init_boot(); @@ -557,7 +557,8 @@ init_sector0(unsigned long start) static void change_part(int i) { - struct dos_partition *partp = ((struct dos_partition *) &mboot.parts) + i - 1; + struct pc98_partition *partp = + ((struct pc98_partition *) &mboot.parts) + i - 1; printf("The data for partition %d is:\n", i); print_part(i); @@ -566,7 +567,7 @@ change_part(int i) int tmp; if (i_flag) { - bzero((char *)partp, sizeof (struct dos_partition)); + bzero((char *)partp, sizeof (struct pc98_partition)); if (i == 4) { init_sector0(1); printf("\nThe static data for the DOS partition 4 has been reinitialized to:\n"); @@ -669,7 +670,7 @@ static void change_active(int which) { #ifdef PC98 - struct dos_partition *partp = ((struct dos_partition *) &mboot.parts); + struct pc98_partition *partp = ((struct pc98_partition *) &mboot.parts); int active, i, tmp; active = 8; diff --git a/sys/boot/pc98/boot2/disk.c b/sys/boot/pc98/boot2/disk.c index 297e806..e878258 100644 --- a/sys/boot/pc98/boot2/disk.c +++ b/sys/boot/pc98/boot2/disk.c @@ -77,7 +77,7 @@ static char *Bread(int dosdev, int sector); int devopen(void) { - struct dos_partition *dptr; + struct pc98_partition *dptr; struct disklabel *dl; char *p; int i, sector = 0, di, dosdev_copy; @@ -99,7 +99,7 @@ devopen(void) #else /* EMBEDDED_DISKLABEL */ #ifdef PC98 p = Bread(dosdev_copy, 1); - dptr = (struct dos_partition *)p; + dptr = (struct pc98_partition *)p; slice = WHOLE_DISK_SLICE; for (i = 0; i < NDOSPART; i++, dptr++) if (dptr->dp_mid == DOSPTYP_386BSD) { diff --git a/sys/boot/pc98/libpc98/biosdisk.c b/sys/boot/pc98/libpc98/biosdisk.c index ea36959..9606a11 100644 --- a/sys/boot/pc98/libpc98/biosdisk.c +++ b/sys/boot/pc98/libpc98/biosdisk.c @@ -83,7 +83,7 @@ struct open_disk { #define BD_PARTTABOK 0x0010 struct disklabel od_disklabel; int od_nslices; /* slice count */ - struct dos_partition od_slicetab[MAX_SLICES]; + struct pc98_partition od_slicetab[MAX_SLICES]; }; /* @@ -109,7 +109,7 @@ static int bd_write(struct open_disk *od, daddr_t dblk, int blks, static int bd_int13probe(struct bdinfo *bd); -static void bd_printslice(struct open_disk *od, struct dos_partition *dp, +static void bd_printslice(struct open_disk *od, struct pc98_partition *dp, char *prefix, int verbose); static void bd_printbsdslice(struct open_disk *od, daddr_t offset, char *prefix, int verbose); @@ -298,7 +298,7 @@ bd_print(int verbose) char line[80]; struct i386_devdesc dev; struct open_disk *od; - struct dos_partition *dptr; + struct pc98_partition *dptr; for (i = 0; i < nbdinfo; i++) { #ifdef PC98 @@ -523,7 +523,7 @@ bd_open(struct open_file *f, ...) static int bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev) { - struct dos_partition *dptr; + struct pc98_partition *dptr; struct disklabel *lp; struct open_disk *od; int sector, slice, i; @@ -605,7 +605,7 @@ bd_opendisk(struct open_disk **odp, struct i386_devdesc *dev) * copy the partition table, then pick up any extended partitions. */ bcopy(buf + DOSPARTOFF, &od->od_slicetab, - sizeof(struct dos_partition) * NDOSPART); + sizeof(struct pc98_partition) * NDOSPART); #ifdef PC98 od->od_nslices = NDOSPART; /* extended slices start here */ #else @@ -810,7 +810,7 @@ done: static int bd_bestslice(struct open_disk *od) { - struct dos_partition *dp; + struct pc98_partition *dp; int pref, preflevel; int i, prefslice; diff --git a/sys/geom/geom_pc98.c b/sys/geom/geom_pc98.c index 90f51ed..d61e50b 100644 --- a/sys/geom/geom_pc98.c +++ b/sys/geom/geom_pc98.c @@ -55,7 +55,7 @@ #define PC98_CLASS_NAME "PC98" static void -g_dec_dos_partition(u_char *ptr, struct dos_partition *d) +g_dec_pc98_partition(u_char *ptr, struct pc98_partition *d) { u_int u; @@ -83,7 +83,7 @@ struct g_pc98_softc { }; static void -g_pc98_print(int i, struct dos_partition *dp) +g_pc98_print(int i, struct pc98_partition *dp) { char sname[17]; @@ -103,7 +103,7 @@ g_pc98_modify(struct g_geom *gp, struct g_pc98_softc *ms, u_char *sec) { int i, error; off_t s[NDOSPART], l[NDOSPART]; - struct dos_partition dp[NDOSPART]; + struct pc98_partition dp[NDOSPART]; g_topology_assert(); @@ -120,8 +120,8 @@ g_pc98_modify(struct g_geom *gp, struct g_pc98_softc *ms, u_char *sec) #endif for (i = 0; i < NDOSPART; i++) - g_dec_dos_partition( - sec + 512 + i * sizeof(struct dos_partition), &dp[i]); + g_dec_pc98_partition( + sec + 512 + i * sizeof(struct pc98_partition), &dp[i]); for (i = 0; i < NDOSPART; i++) { /* If start and end are identical it's bogus */ @@ -255,16 +255,16 @@ g_pc98_dumpconf(struct sbuf *sb, const char *indent, struct g_geom *gp, { struct g_pc98_softc *mp; struct g_slicer *gsp; - struct dos_partition dp; + struct pc98_partition dp; char sname[17]; gsp = gp->softc; mp = gsp->softc; g_slice_dumpconf(sb, indent, gp, cp, pp); if (pp != NULL) { - g_dec_dos_partition( + g_dec_pc98_partition( mp->sec + 512 + - pp->index * sizeof(struct dos_partition), &dp); + pp->index * sizeof(struct pc98_partition), &dp); strncpy(sname, dp.dp_name, 16); sname[16] = '\0'; if (indent == NULL) { diff --git a/sys/pc98/pc98/diskslice_machdep.c b/sys/pc98/pc98/diskslice_machdep.c index 3bec4c6..7e8a299 100644 --- a/sys/pc98/pc98/diskslice_machdep.c +++ b/sys/pc98/pc98/diskslice_machdep.c @@ -65,11 +65,11 @@ static volatile u_char dsi_debug; -static int check_part(char *sname, struct dos_partition *dp, +static int check_part(char *sname, struct pc98_partition *dp, u_long offset, int nsectors, int ntracks, u_long mbr_offset); static int mbr_setslice(char *sname, struct disklabel *lp, - struct diskslice *sp, struct dos_partition *dp, + struct diskslice *sp, struct pc98_partition *dp, u_long br_offset); #define DPBLKNO(cyl,hd,sect) ((cyl)*(lp->d_secpercyl)) @@ -81,7 +81,7 @@ int atcompat_dsinit(dev_t dev, static int check_part(sname, dp, offset, nsectors, ntracks, mbr_offset ) char *sname; - struct dos_partition *dp; + struct pc98_partition *dp; u_long offset; int nsectors; int ntracks; @@ -172,8 +172,8 @@ dsinit(dev, lp, sspp) struct buf *bp; u_char *cp; int dospart; - struct dos_partition *dp; - struct dos_partition *dp0; + struct pc98_partition *dp; + struct pc98_partition *dp0; int error; int max_ncyls; int max_nsectors; @@ -276,7 +276,7 @@ dsinit(dev, lp, sspp) return atcompat_dsinit(dev, lp, sspp); } #endif - dp0 = (struct dos_partition *)(cp + 512); + dp0 = (struct pc98_partition *)(cp + 512); /* Guess the geometry. */ /* @@ -381,7 +381,7 @@ mbr_setslice(sname, lp, sp, dp, br_offset) char *sname; struct disklabel *lp; struct diskslice *sp; - struct dos_partition *dp; + struct pc98_partition *dp; u_long br_offset; { u_long offset; diff --git a/sys/sys/diskpc98.h b/sys/sys/diskpc98.h index aaca7d1..3bfb2c8 100644 --- a/sys/sys/diskpc98.h +++ b/sys/sys/diskpc98.h @@ -44,7 +44,7 @@ #define NDOSPART 16 #define DOSPTYP_386BSD 0x94 /* 386BSD partition type */ -struct dos_partition { +struct pc98_partition { unsigned char dp_mid; #define DOSMID_386BSD (0x14|0x80) /* 386bsd|bootable */ unsigned char dp_sid; @@ -63,7 +63,7 @@ struct dos_partition { unsigned char dp_name[16]; }; #ifdef CTASSERT -CTASSERT(sizeof (struct dos_partition) == 32); +CTASSERT(sizeof (struct pc98_partition) == 32); #endif #define DIOCGPC98 _IOR('M', 128, u_char[8192]) |