* Check for an existing MBR not by looking at the geometry, but by looking
at used partitions. fdisk may report the number of cylinders > 1024 correctly if no translation is used. * Print out the end of the partition as well as the size when editing things. * Enable the user to specify the BIOS geometry if he/she wishes. * Fix 1023 / 1024 mixup. The reason BIOSs will return 1023 is an old IBM convention to use the last cylinder as diagnostic cylinder. The user can still skip the last ('real') cylinder if specified. * Make some messages more verbose.
This commit is contained in:
parent
66d732b062
commit
0cd2d70c37
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: fdisk.c,v 1.3 1997/11/25 20:35:05 phil Exp $ */
|
/* $NetBSD: fdisk.c,v 1.4 1997/11/29 21:49:13 fvdl Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 1997 Piermont Information Systems Inc.
|
* Copyright 1997 Piermont Information Systems Inc.
|
||||||
|
@ -103,23 +103,30 @@ int partsoverlap(int i, int j)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void disp_cur_part (int sel, int disp)
|
void disp_cur_part(int sel, int disp)
|
||||||
{
|
{
|
||||||
int i, j, start, stop;
|
int i, j, start, stop, rsize, rend;
|
||||||
|
|
||||||
if (disp < 0)
|
if (disp < 0)
|
||||||
start = 0, stop = 4;
|
start = 0, stop = 4;
|
||||||
else
|
else
|
||||||
start = disp, stop = disp+1;
|
start = disp, stop = disp+1;
|
||||||
msg_display_add (MSG_part_head, multname, multname);
|
msg_display_add (MSG_part_head, multname, multname, multname);
|
||||||
for (i=start; i<stop; i++) {
|
for (i=start; i<stop; i++) {
|
||||||
if (sel == i) msg_standout();
|
if (sel == i) msg_standout();
|
||||||
if (part[i][SIZE] == 0 && part[i][START] == 0)
|
if (part[i][SIZE] == 0 && part[i][START] == 0)
|
||||||
msg_printf_add ("%d %24s ", i, "");
|
msg_printf_add ("%d %36s ", i, "");
|
||||||
else
|
else {
|
||||||
msg_printf_add ("%d %12d%12d ", i,
|
rsize = part[i][SIZE] / sizemult;
|
||||||
|
if (part[i][SIZE] % sizemult)
|
||||||
|
rsize++;
|
||||||
|
rend = (part[i][START] + part[i][SIZE]) / sizemult;
|
||||||
|
if ((part[i][SIZE] + part[i][SIZE]) % sizemult)
|
||||||
|
rend++;
|
||||||
|
msg_printf_add("%d %12d%12d%12d ", i,
|
||||||
part[i][START] / sizemult,
|
part[i][START] / sizemult,
|
||||||
part[i][SIZE] / sizemult);
|
rsize, rend);
|
||||||
|
}
|
||||||
for (j = 0; part_ids[j].id != -1 &&
|
for (j = 0; part_ids[j].id != -1 &&
|
||||||
part_ids[j].id != part[i][ID]; j++);
|
part_ids[j].id != part[i][ID]; j++);
|
||||||
msg_printf_add ("%s\n", part_ids[j].name);
|
msg_printf_add ("%s\n", part_ids[j].name);
|
||||||
|
@ -129,14 +136,14 @@ void disp_cur_part (int sel, int disp)
|
||||||
|
|
||||||
int check_geom (void)
|
int check_geom (void)
|
||||||
{
|
{
|
||||||
return bcyl < 1024 && bsec < 64 && bcyl > 0 && bhead > 0 && bsec > 0;
|
return bcyl <= 1024 && bsec < 64 && bcyl > 0 && bhead > 0 && bsec > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void set_fdisk_geom (void)
|
void set_fdisk_geom (void)
|
||||||
{
|
{
|
||||||
char res[80];
|
char res[80];
|
||||||
msg_display_add (MSG_setfdiskgeom);
|
msg_display_add(MSG_setbiosgeom);
|
||||||
disp_cur_geom();
|
disp_cur_geom();
|
||||||
msg_printf_add ("\n");
|
msg_printf_add ("\n");
|
||||||
msg_prompt_add (MSG_cylinders, NULL, res, 80);
|
msg_prompt_add (MSG_cylinders, NULL, res, 80);
|
||||||
|
@ -150,8 +157,8 @@ void set_fdisk_geom (void)
|
||||||
|
|
||||||
void disp_cur_geom (void)
|
void disp_cur_geom (void)
|
||||||
{
|
{
|
||||||
msg_display_add (MSG_realgeom, dlcyl, dlhead, dlsec);
|
msg_display_add(MSG_realgeom, dlcyl, dlhead, dlsec);
|
||||||
msg_display_add (MSG_fdiskgeom, bcyl, bhead, bsec);
|
msg_display_add(MSG_biosgeom, bcyl, bhead, bsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_fdisk_info (void)
|
void get_fdisk_info (void)
|
||||||
|
@ -174,9 +181,14 @@ void get_fdisk_info (void)
|
||||||
/* A common failure of fdisk is to get the number of cylinders
|
/* A common failure of fdisk is to get the number of cylinders
|
||||||
wrong and the number of sectors and heads right. This makes
|
wrong and the number of sectors and heads right. This makes
|
||||||
a disk look very big. In this case, we can just recompute
|
a disk look very big. In this case, we can just recompute
|
||||||
the number of cylinders and things should work just fine. */
|
the number of cylinders and things should work just fine.
|
||||||
|
Also, fdisk may correctly indentify the settings to include
|
||||||
|
a cylinder total > 1024, because translation mode is not used.
|
||||||
|
Check for it. */
|
||||||
|
|
||||||
if (bcyl > 1023 && bsec < 64) {
|
if (bcyl > 1024 && disk->geom[1] == bhead && disk->geom[2] == bsec)
|
||||||
|
bcyl = 1024;
|
||||||
|
else if (bcyl > 1024 && bsec < 64) {
|
||||||
t1 = disk->geom[0] * disk->geom[1] * disk->geom[2];
|
t1 = disk->geom[0] * disk->geom[1] * disk->geom[2];
|
||||||
t2 = bhead * bsec;
|
t2 = bhead * bsec;
|
||||||
if (bcyl * t2 > t1) {
|
if (bcyl * t2 > t1) {
|
||||||
|
@ -186,4 +198,3 @@ void get_fdisk_info (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: md.c,v 1.7 1997/11/25 20:35:07 phil Exp $ */
|
/* $NetBSD: md.c,v 1.8 1997/11/29 21:49:14 fvdl Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 1997 Piermont Information Systems Inc.
|
* Copyright 1997 Piermont Information Systems Inc.
|
||||||
|
@ -44,20 +44,30 @@
|
||||||
#include "msg_defs.h"
|
#include "msg_defs.h"
|
||||||
#include "menu_defs.h"
|
#include "menu_defs.h"
|
||||||
|
|
||||||
|
int mbr_present;
|
||||||
|
|
||||||
/* prototypes */
|
/* prototypes */
|
||||||
|
|
||||||
int md_get_info()
|
int md_get_info()
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
get_fdisk_info ();
|
|
||||||
|
get_fdisk_info();
|
||||||
|
|
||||||
/* Check fdisk information */
|
/* Check fdisk information */
|
||||||
if (bsec <= 0 || bcyl <= 0 || bsec <= 0 || bcyl > 1024 || bsec > 63)
|
if (part[0][ID] == 0 && part[1][ID] == 0 && part[2][ID] == 0 &&
|
||||||
process_menu (MENU_biosgeom);
|
part[3][ID] == 0) {
|
||||||
|
mbr_present = 0;
|
||||||
|
process_menu(MENU_nobiosgeom);
|
||||||
|
} else {
|
||||||
|
mbr_present = 1;
|
||||||
|
msg_display(MSG_confirmbiosgeom);
|
||||||
|
process_menu(MENU_confirmbiosgeom);
|
||||||
|
}
|
||||||
|
|
||||||
/* Ask about disk type ... */
|
/* Ask about disk type ... */
|
||||||
if (strncmp(disk->name, "wd", 2) == 0) {
|
if (strncmp(disk->name, "wd", 2) == 0) {
|
||||||
process_menu (MENU_wdtype);
|
process_menu(MENU_wdtype);
|
||||||
disktype = "ST506";
|
disktype = "ST506";
|
||||||
/* Check against disk geometry. */
|
/* Check against disk geometry. */
|
||||||
if (disk->geom[0] != dlcyl || disk->geom[1] != dlhead
|
if (disk->geom[0] != dlcyl || disk->geom[1] != dlhead
|
||||||
|
@ -73,13 +83,21 @@ int md_get_info()
|
||||||
process_menu (MENU_scsigeom2);
|
process_menu (MENU_scsigeom2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Compute the full sizes ... */
|
/* Compute the full sizes ... */
|
||||||
dlcylsize = dlhead*dlsec;
|
dlcylsize = dlhead*dlsec;
|
||||||
dlsize = dlcyl*dlcylsize;
|
dlsize = dlcyl*dlcylsize;
|
||||||
bcylsize = bhead*bsec;
|
bcylsize = bhead*bsec;
|
||||||
bsize = bcyl*bcylsize;
|
bsize = bcyl*bcylsize;
|
||||||
|
|
||||||
|
msg_display(MSG_diagcyl);
|
||||||
|
process_menu(MENU_noyes);
|
||||||
|
if (yesno) {
|
||||||
|
dlcyl--;
|
||||||
|
dlsize -= dlcylsize;
|
||||||
|
if (dlsize < bsize)
|
||||||
|
bcyl = dlsize / bcylsize;
|
||||||
|
}
|
||||||
|
|
||||||
/* Ask full/part */
|
/* Ask full/part */
|
||||||
msg_display (MSG_fullpart, diskdev);
|
msg_display (MSG_fullpart, diskdev);
|
||||||
process_menu (MENU_fullpart);
|
process_menu (MENU_fullpart);
|
||||||
|
@ -296,6 +314,7 @@ void md_make_bsd_partitions (void)
|
||||||
|
|
||||||
/* /usr */
|
/* /usr */
|
||||||
partsize = fsptsize - (partstart - ptstart);
|
partsize = fsptsize - (partstart - ptstart);
|
||||||
|
bsdlabel[E][D_FSTYPE] = T_42BSD;
|
||||||
bsdlabel[E][D_OFFSET] = partstart;
|
bsdlabel[E][D_OFFSET] = partstart;
|
||||||
bsdlabel[E][D_SIZE] = partsize;
|
bsdlabel[E][D_SIZE] = partsize;
|
||||||
bsdlabel[E][D_BSIZE] = 8192;
|
bsdlabel[E][D_BSIZE] = 8192;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: menus.md.eng,v 1.8 1997/11/25 20:35:10 phil Exp $ */
|
/* $NetBSD: menus.md.eng,v 1.9 1997/11/29 21:49:16 fvdl Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 1997 Piermont Information Systems Inc.
|
* Copyright 1997 Piermont Information Systems Inc.
|
||||||
|
@ -75,19 +75,23 @@ menu dlgeom, title " Choose an option";
|
||||||
disk->geom[2] = dlsec;
|
disk->geom[2] = dlsec;
|
||||||
};
|
};
|
||||||
|
|
||||||
menu biosgeom, title " Choose an option", y=16;
|
menu nobiosgeom, title " Choose an option", y=16;
|
||||||
display action { msg_display (MSG_biosgeom, diskdev);
|
display action { msg_display (MSG_nobiosgeom, diskdev);
|
||||||
disp_cur_geom ();
|
disp_cur_geom();
|
||||||
};
|
};
|
||||||
option "Abort install",
|
option "Abort install",
|
||||||
action (endwin) { exit(1); };
|
action (endwin) { exit(1); };
|
||||||
option "Enter geometry",
|
option "Enter geometry",
|
||||||
action { msg_clear(); set_fdisk_geom(); },
|
action { msg_clear(); set_fdisk_geom(); },
|
||||||
next menu confirmbios;
|
next menu confirmbiosgeom;
|
||||||
|
|
||||||
menu confirmbios;
|
menu confirmbiosgeom, y=16;
|
||||||
display action {
|
display action {
|
||||||
msg_display (MSG_badgeom);
|
extern int mbr_present; /* XXX */
|
||||||
|
msg_clear();
|
||||||
|
if (mbr_present)
|
||||||
|
msg_display_add(MSG_confirmbiosgeom);
|
||||||
|
msg_display_add(MSG_badgeom);
|
||||||
disp_cur_geom ();
|
disp_cur_geom ();
|
||||||
};
|
};
|
||||||
option "Reenter geometry",
|
option "Reenter geometry",
|
||||||
|
@ -96,7 +100,7 @@ menu confirmbios;
|
||||||
action {
|
action {
|
||||||
if (check_geom())
|
if (check_geom())
|
||||||
return TRUE;
|
return TRUE;
|
||||||
msg_display (MSG_reentergeom);
|
msg_display(MSG_reentergeom);
|
||||||
set_fdisk_geom();
|
set_fdisk_geom();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: msg.md.eng,v 1.3 1997/11/25 20:35:11 phil Exp $ */
|
/* $NetBSD: msg.md.eng,v 1.4 1997/11/29 21:49:17 fvdl Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 1997 Piermont Information Systems Inc.
|
* Copyright 1997 Piermont Information Systems Inc.
|
||||||
|
@ -59,26 +59,59 @@ disklabel: %d cylinders, %d heads, %d sectors
|
||||||
real geom: %d cylinders, %d heads, %d sectors
|
real geom: %d cylinders, %d heads, %d sectors
|
||||||
}
|
}
|
||||||
|
|
||||||
message biosgeom
|
message nobiosgeom
|
||||||
{It appears that your disk, %s, did not have a valid Master Boot
|
{It appears that your disk, %s, did not have a valid Master Boot
|
||||||
Record (MBR). That is, NetBSD is using a geometry which is
|
Record (MBR). This program gets the BIOS geometry of your disk by
|
||||||
incompatible with the BIOS. This "sysinst" program gets the BIOS
|
reading the MBR, so the BIOS geometry of your disk could not
|
||||||
fake geometry of your disk by reading the MBR. Your options are:
|
be determined in this case. Your options are:
|
||||||
-- Abort the install and initialize the MBR from some other OS
|
-- Abort the install. You can determine the actual BIOS
|
||||||
-- Enter the BIOS fake geometry and sysinst will initialize the MBR
|
geometry in your BIOS setup and then come back and
|
||||||
|
enter the values. Or you can use another setup program to
|
||||||
|
initialize the MBR first.
|
||||||
|
-- Enter the BIOS geometry values yourself. Sysinst will initialize
|
||||||
|
the MBR for you.
|
||||||
|
|
||||||
WARNING: Entering new geometry will cause this program to initialize
|
WARNING: Entering a new geometry will cause this program to initialize
|
||||||
your master boot record (MBR) and destroy any boot program you may
|
your master boot record (MBR) and destroy any boot program you may
|
||||||
have installed.
|
have installed.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message part_head
|
message diagcyl
|
||||||
{No Start(%s) Size(%s) Kind\n}
|
{Some old BIOSs or old diagnostic programs may use the last cylinder of
|
||||||
|
the disk for test purposes. This should no longer be the case with
|
||||||
|
modern systems. If you have an old system and are uncertain if it
|
||||||
|
may do this, you can exclude the last cylinder of your harddisk
|
||||||
|
from use.
|
||||||
|
|
||||||
message setfdiskgeom
|
If you exclude the last cylinder, both the real and BIOS geometry will
|
||||||
|
be adjusted, you do not need to reenter them.
|
||||||
|
|
||||||
|
Do you wish to exclude the last cylinder?
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
message part_head
|
||||||
|
{No Start(%s) Size(%s) End(%s) Kind\n}
|
||||||
|
|
||||||
|
message setbiosgeom
|
||||||
{You will be prompted for the geometry. Please enter the values you
|
{You will be prompted for the geometry. Please enter the values you
|
||||||
want. Remember, cylinders should be <= 1023 and sectors should <= 63.
|
want. The number of cylinders should be <= 1024 and the number of sectors
|
||||||
|
should be <= 63. If you have the BIOS set up to use > 1024 cylinders just
|
||||||
|
truncate that number to 1024 here; NetBSD will know about the rest of the
|
||||||
|
cylinders.
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
message confirmbiosgeom
|
||||||
|
{Please verify if the BIOS disk geometry below is correct. The value for
|
||||||
|
the number of cylinders may have been truncated to 1024. This is ok as
|
||||||
|
long as the other numbers are correct; only 1024 cylinders can be
|
||||||
|
specified in the MBR, the rest will be found in a different way by NetBSD.
|
||||||
|
|
||||||
|
If you re-enter the values, make sure that the values are correct and
|
||||||
|
match those used by other systems on this disk. Values that do not match
|
||||||
|
may result in data corruption.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,8 +123,8 @@ message badgeom
|
||||||
message realgeom
|
message realgeom
|
||||||
{real geom: %d cyl, %d heads, %d sec\n}
|
{real geom: %d cyl, %d heads, %d sec\n}
|
||||||
|
|
||||||
message fdiskgeom
|
message biosgeom
|
||||||
{fdisk geom: %d cyl, %d heads, %d sec\n}
|
{BIOS geom: %d cyl, %d heads, %d sec\n}
|
||||||
|
|
||||||
message reentergeom
|
message reentergeom
|
||||||
{The values just entered for the geometry are not usable. Please,
|
{The values just entered for the geometry are not usable. Please,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: fdisk.c,v 1.3 1997/11/25 20:35:05 phil Exp $ */
|
/* $NetBSD: fdisk.c,v 1.4 1997/11/29 21:49:13 fvdl Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 1997 Piermont Information Systems Inc.
|
* Copyright 1997 Piermont Information Systems Inc.
|
||||||
|
@ -103,23 +103,30 @@ int partsoverlap(int i, int j)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void disp_cur_part (int sel, int disp)
|
void disp_cur_part(int sel, int disp)
|
||||||
{
|
{
|
||||||
int i, j, start, stop;
|
int i, j, start, stop, rsize, rend;
|
||||||
|
|
||||||
if (disp < 0)
|
if (disp < 0)
|
||||||
start = 0, stop = 4;
|
start = 0, stop = 4;
|
||||||
else
|
else
|
||||||
start = disp, stop = disp+1;
|
start = disp, stop = disp+1;
|
||||||
msg_display_add (MSG_part_head, multname, multname);
|
msg_display_add (MSG_part_head, multname, multname, multname);
|
||||||
for (i=start; i<stop; i++) {
|
for (i=start; i<stop; i++) {
|
||||||
if (sel == i) msg_standout();
|
if (sel == i) msg_standout();
|
||||||
if (part[i][SIZE] == 0 && part[i][START] == 0)
|
if (part[i][SIZE] == 0 && part[i][START] == 0)
|
||||||
msg_printf_add ("%d %24s ", i, "");
|
msg_printf_add ("%d %36s ", i, "");
|
||||||
else
|
else {
|
||||||
msg_printf_add ("%d %12d%12d ", i,
|
rsize = part[i][SIZE] / sizemult;
|
||||||
|
if (part[i][SIZE] % sizemult)
|
||||||
|
rsize++;
|
||||||
|
rend = (part[i][START] + part[i][SIZE]) / sizemult;
|
||||||
|
if ((part[i][SIZE] + part[i][SIZE]) % sizemult)
|
||||||
|
rend++;
|
||||||
|
msg_printf_add("%d %12d%12d%12d ", i,
|
||||||
part[i][START] / sizemult,
|
part[i][START] / sizemult,
|
||||||
part[i][SIZE] / sizemult);
|
rsize, rend);
|
||||||
|
}
|
||||||
for (j = 0; part_ids[j].id != -1 &&
|
for (j = 0; part_ids[j].id != -1 &&
|
||||||
part_ids[j].id != part[i][ID]; j++);
|
part_ids[j].id != part[i][ID]; j++);
|
||||||
msg_printf_add ("%s\n", part_ids[j].name);
|
msg_printf_add ("%s\n", part_ids[j].name);
|
||||||
|
@ -129,14 +136,14 @@ void disp_cur_part (int sel, int disp)
|
||||||
|
|
||||||
int check_geom (void)
|
int check_geom (void)
|
||||||
{
|
{
|
||||||
return bcyl < 1024 && bsec < 64 && bcyl > 0 && bhead > 0 && bsec > 0;
|
return bcyl <= 1024 && bsec < 64 && bcyl > 0 && bhead > 0 && bsec > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void set_fdisk_geom (void)
|
void set_fdisk_geom (void)
|
||||||
{
|
{
|
||||||
char res[80];
|
char res[80];
|
||||||
msg_display_add (MSG_setfdiskgeom);
|
msg_display_add(MSG_setbiosgeom);
|
||||||
disp_cur_geom();
|
disp_cur_geom();
|
||||||
msg_printf_add ("\n");
|
msg_printf_add ("\n");
|
||||||
msg_prompt_add (MSG_cylinders, NULL, res, 80);
|
msg_prompt_add (MSG_cylinders, NULL, res, 80);
|
||||||
|
@ -150,8 +157,8 @@ void set_fdisk_geom (void)
|
||||||
|
|
||||||
void disp_cur_geom (void)
|
void disp_cur_geom (void)
|
||||||
{
|
{
|
||||||
msg_display_add (MSG_realgeom, dlcyl, dlhead, dlsec);
|
msg_display_add(MSG_realgeom, dlcyl, dlhead, dlsec);
|
||||||
msg_display_add (MSG_fdiskgeom, bcyl, bhead, bsec);
|
msg_display_add(MSG_biosgeom, bcyl, bhead, bsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_fdisk_info (void)
|
void get_fdisk_info (void)
|
||||||
|
@ -174,9 +181,14 @@ void get_fdisk_info (void)
|
||||||
/* A common failure of fdisk is to get the number of cylinders
|
/* A common failure of fdisk is to get the number of cylinders
|
||||||
wrong and the number of sectors and heads right. This makes
|
wrong and the number of sectors and heads right. This makes
|
||||||
a disk look very big. In this case, we can just recompute
|
a disk look very big. In this case, we can just recompute
|
||||||
the number of cylinders and things should work just fine. */
|
the number of cylinders and things should work just fine.
|
||||||
|
Also, fdisk may correctly indentify the settings to include
|
||||||
|
a cylinder total > 1024, because translation mode is not used.
|
||||||
|
Check for it. */
|
||||||
|
|
||||||
if (bcyl > 1023 && bsec < 64) {
|
if (bcyl > 1024 && disk->geom[1] == bhead && disk->geom[2] == bsec)
|
||||||
|
bcyl = 1024;
|
||||||
|
else if (bcyl > 1024 && bsec < 64) {
|
||||||
t1 = disk->geom[0] * disk->geom[1] * disk->geom[2];
|
t1 = disk->geom[0] * disk->geom[1] * disk->geom[2];
|
||||||
t2 = bhead * bsec;
|
t2 = bhead * bsec;
|
||||||
if (bcyl * t2 > t1) {
|
if (bcyl * t2 > t1) {
|
||||||
|
@ -186,4 +198,3 @@ void get_fdisk_info (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: mbr.c,v 1.3 1997/11/25 20:35:05 phil Exp $ */
|
/* $NetBSD: mbr.c,v 1.4 1997/11/29 21:49:13 fvdl Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright 1997 Piermont Information Systems Inc.
|
* Copyright 1997 Piermont Information Systems Inc.
|
||||||
|
@ -103,23 +103,30 @@ int partsoverlap(int i, int j)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void disp_cur_part (int sel, int disp)
|
void disp_cur_part(int sel, int disp)
|
||||||
{
|
{
|
||||||
int i, j, start, stop;
|
int i, j, start, stop, rsize, rend;
|
||||||
|
|
||||||
if (disp < 0)
|
if (disp < 0)
|
||||||
start = 0, stop = 4;
|
start = 0, stop = 4;
|
||||||
else
|
else
|
||||||
start = disp, stop = disp+1;
|
start = disp, stop = disp+1;
|
||||||
msg_display_add (MSG_part_head, multname, multname);
|
msg_display_add (MSG_part_head, multname, multname, multname);
|
||||||
for (i=start; i<stop; i++) {
|
for (i=start; i<stop; i++) {
|
||||||
if (sel == i) msg_standout();
|
if (sel == i) msg_standout();
|
||||||
if (part[i][SIZE] == 0 && part[i][START] == 0)
|
if (part[i][SIZE] == 0 && part[i][START] == 0)
|
||||||
msg_printf_add ("%d %24s ", i, "");
|
msg_printf_add ("%d %36s ", i, "");
|
||||||
else
|
else {
|
||||||
msg_printf_add ("%d %12d%12d ", i,
|
rsize = part[i][SIZE] / sizemult;
|
||||||
|
if (part[i][SIZE] % sizemult)
|
||||||
|
rsize++;
|
||||||
|
rend = (part[i][START] + part[i][SIZE]) / sizemult;
|
||||||
|
if ((part[i][SIZE] + part[i][SIZE]) % sizemult)
|
||||||
|
rend++;
|
||||||
|
msg_printf_add("%d %12d%12d%12d ", i,
|
||||||
part[i][START] / sizemult,
|
part[i][START] / sizemult,
|
||||||
part[i][SIZE] / sizemult);
|
rsize, rend);
|
||||||
|
}
|
||||||
for (j = 0; part_ids[j].id != -1 &&
|
for (j = 0; part_ids[j].id != -1 &&
|
||||||
part_ids[j].id != part[i][ID]; j++);
|
part_ids[j].id != part[i][ID]; j++);
|
||||||
msg_printf_add ("%s\n", part_ids[j].name);
|
msg_printf_add ("%s\n", part_ids[j].name);
|
||||||
|
@ -129,14 +136,14 @@ void disp_cur_part (int sel, int disp)
|
||||||
|
|
||||||
int check_geom (void)
|
int check_geom (void)
|
||||||
{
|
{
|
||||||
return bcyl < 1024 && bsec < 64 && bcyl > 0 && bhead > 0 && bsec > 0;
|
return bcyl <= 1024 && bsec < 64 && bcyl > 0 && bhead > 0 && bsec > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void set_fdisk_geom (void)
|
void set_fdisk_geom (void)
|
||||||
{
|
{
|
||||||
char res[80];
|
char res[80];
|
||||||
msg_display_add (MSG_setfdiskgeom);
|
msg_display_add(MSG_setbiosgeom);
|
||||||
disp_cur_geom();
|
disp_cur_geom();
|
||||||
msg_printf_add ("\n");
|
msg_printf_add ("\n");
|
||||||
msg_prompt_add (MSG_cylinders, NULL, res, 80);
|
msg_prompt_add (MSG_cylinders, NULL, res, 80);
|
||||||
|
@ -150,8 +157,8 @@ void set_fdisk_geom (void)
|
||||||
|
|
||||||
void disp_cur_geom (void)
|
void disp_cur_geom (void)
|
||||||
{
|
{
|
||||||
msg_display_add (MSG_realgeom, dlcyl, dlhead, dlsec);
|
msg_display_add(MSG_realgeom, dlcyl, dlhead, dlsec);
|
||||||
msg_display_add (MSG_fdiskgeom, bcyl, bhead, bsec);
|
msg_display_add(MSG_biosgeom, bcyl, bhead, bsec);
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_fdisk_info (void)
|
void get_fdisk_info (void)
|
||||||
|
@ -174,9 +181,14 @@ void get_fdisk_info (void)
|
||||||
/* A common failure of fdisk is to get the number of cylinders
|
/* A common failure of fdisk is to get the number of cylinders
|
||||||
wrong and the number of sectors and heads right. This makes
|
wrong and the number of sectors and heads right. This makes
|
||||||
a disk look very big. In this case, we can just recompute
|
a disk look very big. In this case, we can just recompute
|
||||||
the number of cylinders and things should work just fine. */
|
the number of cylinders and things should work just fine.
|
||||||
|
Also, fdisk may correctly indentify the settings to include
|
||||||
|
a cylinder total > 1024, because translation mode is not used.
|
||||||
|
Check for it. */
|
||||||
|
|
||||||
if (bcyl > 1023 && bsec < 64) {
|
if (bcyl > 1024 && disk->geom[1] == bhead && disk->geom[2] == bsec)
|
||||||
|
bcyl = 1024;
|
||||||
|
else if (bcyl > 1024 && bsec < 64) {
|
||||||
t1 = disk->geom[0] * disk->geom[1] * disk->geom[2];
|
t1 = disk->geom[0] * disk->geom[1] * disk->geom[2];
|
||||||
t2 = bhead * bsec;
|
t2 = bhead * bsec;
|
||||||
if (bcyl * t2 > t1) {
|
if (bcyl * t2 > t1) {
|
||||||
|
@ -186,4 +198,3 @@ void get_fdisk_info (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue