cosmetic changes.
This commit is contained in:
parent
9b073f6668
commit
7fa181d423
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=145763
@ -51,8 +51,6 @@ int iotest;
|
|||||||
#define LBUF 100
|
#define LBUF 100
|
||||||
static char lbuf[LBUF];
|
static char lbuf[LBUF];
|
||||||
|
|
||||||
#define MBRSIGOFF 510
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* Ported to 386bsd by Julian Elischer Thu Oct 15 20:26:46 PDT 1992
|
* Ported to 386bsd by Julian Elischer Thu Oct 15 20:26:46 PDT 1992
|
||||||
@ -76,15 +74,14 @@ static int cyls, sectors, heads, cylsecs, disksecs;
|
|||||||
|
|
||||||
struct mboot {
|
struct mboot {
|
||||||
unsigned char padding[2]; /* force the longs to be long aligned */
|
unsigned char padding[2]; /* force the longs to be long aligned */
|
||||||
unsigned char *bootinst; /* boot code */
|
unsigned char *bootinst; /* boot code */
|
||||||
off_t bootinst_size;
|
off_t bootinst_size;
|
||||||
struct dos_partition parts[NDOSPART];
|
struct dos_partition parts[NDOSPART];
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct mboot mboot;
|
static struct mboot mboot;
|
||||||
static int fd, fdw;
|
static int fd, fdw;
|
||||||
|
|
||||||
|
|
||||||
#define ACTIVE 0x80
|
#define ACTIVE 0x80
|
||||||
|
|
||||||
static uint dos_cyls;
|
static uint dos_cyls;
|
||||||
@ -125,7 +122,7 @@ static int v_flag = 0; /* Be verbose */
|
|||||||
|
|
||||||
static struct part_type
|
static struct part_type
|
||||||
{
|
{
|
||||||
unsigned char type;
|
unsigned char type;
|
||||||
const char *name;
|
const char *name;
|
||||||
} part_types[] = {
|
} part_types[] = {
|
||||||
{0x00, "unused"}
|
{0x00, "unused"}
|
||||||
@ -401,7 +398,7 @@ main(int argc, char *argv[])
|
|||||||
if (!t_flag) {
|
if (!t_flag) {
|
||||||
if (ok("Should we write new partition table?"))
|
if (ok("Should we write new partition table?"))
|
||||||
write_s0();
|
write_s0();
|
||||||
} else {
|
} else {
|
||||||
printf("\n-t flag specified -- partition table not written.\n");
|
printf("\n-t flag specified -- partition table not written.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -581,7 +578,7 @@ change_part(int i)
|
|||||||
print_part(i);
|
print_part(i);
|
||||||
} while (!ok("Are we happy with this entry?"));
|
} while (!ok("Are we happy with this entry?"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
print_params()
|
print_params()
|
||||||
@ -589,7 +586,7 @@ print_params()
|
|||||||
printf("parameters extracted from in-core disklabel are:\n");
|
printf("parameters extracted from in-core disklabel are:\n");
|
||||||
printf("cylinders=%d heads=%d sectors/track=%d (%d blks/cyl)\n\n"
|
printf("cylinders=%d heads=%d sectors/track=%d (%d blks/cyl)\n\n"
|
||||||
,cyls,heads,sectors,cylsecs);
|
,cyls,heads,sectors,cylsecs);
|
||||||
if((dos_sectors > 63) || (dos_cyls > 1023) || (dos_heads > 255))
|
if (dos_cyls > 1023 || dos_heads > 255 || dos_sectors > 63)
|
||||||
printf("Figures below won't work with BIOS for partitions not in cyl 1\n");
|
printf("Figures below won't work with BIOS for partitions not in cyl 1\n");
|
||||||
printf("parameters to be used for BIOS calculations are:\n");
|
printf("parameters to be used for BIOS calculations are:\n");
|
||||||
printf("cylinders=%d heads=%d sectors/track=%d (%d blks/cyl)\n\n"
|
printf("cylinders=%d heads=%d sectors/track=%d (%d blks/cyl)\n\n"
|
||||||
@ -740,18 +737,19 @@ open_disk(int flag)
|
|||||||
static ssize_t
|
static ssize_t
|
||||||
read_disk(off_t sector, void *buf)
|
read_disk(off_t sector, void *buf)
|
||||||
{
|
{
|
||||||
lseek(fd,(sector * 512), 0);
|
|
||||||
if( secsize == 0 )
|
lseek(fd, (sector * 512), 0);
|
||||||
for( secsize = MIN_SEC_SIZE; secsize <= MAX_SEC_SIZE; secsize *= 2 )
|
if (secsize == 0)
|
||||||
{
|
for (secsize = MIN_SEC_SIZE; secsize <= MAX_SEC_SIZE;
|
||||||
|
secsize *= 2) {
|
||||||
/* try the read */
|
/* try the read */
|
||||||
int size = read(fd, buf, secsize);
|
int size = read(fd, buf, secsize);
|
||||||
if( size == secsize )
|
if (size == secsize)
|
||||||
/* it worked so return */
|
/* it worked so return */
|
||||||
return secsize;
|
return secsize;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return read( fd, buf, secsize );
|
return read(fd, buf, secsize);
|
||||||
|
|
||||||
/* we failed to read at any of the sizes */
|
/* we failed to read at any of the sizes */
|
||||||
return -1;
|
return -1;
|
||||||
@ -764,7 +762,7 @@ write_disk(off_t sector, void *buf)
|
|||||||
if (fdw != -1) {
|
if (fdw != -1) {
|
||||||
return ioctl(fdw, DIOCSMBR, buf);
|
return ioctl(fdw, DIOCSMBR, buf);
|
||||||
} else {
|
} else {
|
||||||
lseek(fd,(sector * 512), 0);
|
lseek(fd, (sector * 512), 0);
|
||||||
/* write out in the size that the read_disk found worked */
|
/* write out in the size that the read_disk found worked */
|
||||||
return write(fd, buf, secsize);
|
return write(fd, buf, secsize);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user