Changed the MBR partition type field from being a string to
a decimal value. I don't have the time to deal with users typing in partition names such as "FreeBSD" at the moment so just allow the numerical id to be specified for the moment.
This commit is contained in:
parent
b0e421ddac
commit
433a9ec864
@ -103,7 +103,7 @@ toggle_press(WINDOW *window, struct field field)
|
||||
field.spare++;
|
||||
if (!field.misc[field.spare])
|
||||
field.spare = 0;
|
||||
sprintf(field.field, "%", field.misc[field.spare]);
|
||||
sprintf(field.field, "%s", field.misc[field.spare]);
|
||||
return (key);
|
||||
break;
|
||||
case '\n':
|
||||
|
@ -358,7 +358,7 @@ edit_mbr(int disk)
|
||||
ok = 0;
|
||||
while (!ok && (key != ESC)) {
|
||||
for (i=0; i < NDOSPART; i++) {
|
||||
sprintf(mbr_field[(i*12)+1].field, "%s", part_type(mbr->dospart[i].dp_typ));
|
||||
sprintf(mbr_field[(i*12)+1].field, "%d", mbr->dospart[i].dp_typ);
|
||||
sprintf(mbr_field[(i*12)+2].field, "%ld", mbr->dospart[i].dp_start);
|
||||
sprintf(mbr_field[(i*12)+3].field, "%d", mbr->dospart[i].dp_scyl);
|
||||
sprintf(mbr_field[(i*12)+4].field, "%d", mbr->dospart[i].dp_shd);
|
||||
@ -383,6 +383,7 @@ edit_mbr(int disk)
|
||||
mbr_field[cur_field].field);
|
||||
/* Propagate changes to MBR */
|
||||
for (i=0; i < NDOSPART; i++) {
|
||||
mbr->dospart[i].dp_typ = atoi(mbr_field[(i*12)+1].field);
|
||||
mbr->dospart[i].dp_start = atoi(mbr_field[(i*12)+2].field);
|
||||
mbr->dospart[i].dp_scyl = atoi(mbr_field[(i*12)+3].field);
|
||||
mbr->dospart[i].dp_shd = atoi(mbr_field[(i*12)+4].field);
|
||||
@ -417,6 +418,20 @@ edit_mbr(int disk)
|
||||
cur_field = next;
|
||||
}
|
||||
|
||||
/* Clear active flags */
|
||||
for (i=0; i < NDOSPART; i++)
|
||||
mbr->dospart[i].dp_flag = 0;
|
||||
|
||||
/* Find first FreeBSD partition and make it active */
|
||||
|
||||
disk_list[disk].inst_part = -1;
|
||||
for (i=0; i < NDOSPART; i++)
|
||||
if (mbr->dospart[i].dp_typ == MBR_PTYPE_FreeBSD) {
|
||||
disk_list[disk].inst_part = i;
|
||||
mbr->dospart[i].dp_flag = ACTIVE;
|
||||
break;
|
||||
}
|
||||
|
||||
sprintf(scratch, "\nWriting a new master boot record can erase the current disk contents.\n\n Are you sure you want to write the new MBR?\n");
|
||||
dialog_clear_norefresh();
|
||||
if (!dialog_yesno("Write new MBR?", scratch, -1, -1)) {
|
||||
@ -428,13 +443,6 @@ edit_mbr(int disk)
|
||||
}
|
||||
}
|
||||
|
||||
/* Find first FreeBSD partition, as kernel would upon boot */
|
||||
disk_list[disk].inst_part = -1;
|
||||
for (i=0; i < NDOSPART; i++)
|
||||
if (mbr->dospart[i].dp_typ == MBR_PTYPE_FreeBSD) {
|
||||
disk_list[disk].inst_part = i;
|
||||
break;
|
||||
}
|
||||
|
||||
if (disk_list[disk].inst_part == -1) {
|
||||
sprintf(errmsg, "\nThere is no space allocated to FreeBSD on %s\n",
|
||||
|
@ -1,6 +1,6 @@
|
||||
struct field mbr_field[] = {
|
||||
{ 0, 25, 31, -1, -1, -1, -1, -1, -1, "Master Boot Record (MBR) editor", F_TITLE, 0, 0},
|
||||
{ 4, 8, 30, 30, 2, 49, 2, 50, 2, "Uknown", F_EDIT, 0, 0},
|
||||
{ 4, 8, 5, 5, 2, 49, 2, 50, 2, "000", F_EDIT, 0, 0},
|
||||
{ 5, 31, 7, 10, 3, 1, 3, 1, 3, "0", F_EDIT, 0, 0},
|
||||
{ 6, 5, 5, 10, 4, 2, 6, 2, 4, "0", F_EDIT, 0, 0},
|
||||
{ 6, 14, 5, 10, 5, 2, 6, 3, 5, "0", F_EDIT, 0, 0},
|
||||
@ -12,7 +12,7 @@ struct field mbr_field[] = {
|
||||
{ 9, 9, 6, 10, 11, 7, 12, 9, 11, "0", F_EDIT, 0, 0},
|
||||
{ 9, 27, 5, 10, 12, 7, 12, 10, 12, "0", F_EDIT, 0, 0},
|
||||
{10, 10, 10, 10, 13, 10, 25, 11, 13, "Not Active", F_EDIT, 0, 0},
|
||||
{ 4, 47, 30, 30, 14, 50, 14, 12, 14, "Uknown", F_EDIT, 0, 0},
|
||||
{ 4, 47, 5, 5, 14, 50, 14, 12, 14, "000", F_EDIT, 0, 0},
|
||||
{ 5, 70, 7, 10, 15, 13, 15, 13, 15, "0", F_EDIT, 0, 0},
|
||||
{ 6, 44, 5, 10, 16, 14, 18, 14, 16, "0", F_EDIT, 0, 0},
|
||||
{ 6, 54, 5, 10, 17, 14, 18, 15, 17, "0", F_EDIT, 0, 0},
|
||||
@ -24,7 +24,7 @@ struct field mbr_field[] = {
|
||||
{ 9, 48, 6, 10, 23, 19, 24, 21, 23, "0", F_EDIT, 0, 0},
|
||||
{ 9, 66, 5, 10, 24, 20, 24, 22, 24, "0", F_EDIT, 0, 0},
|
||||
{10, 49, 10, 10, 25, 22, 37, 23, 25, "Not Active", F_EDIT, 0, 0},
|
||||
{14, 8, 30, 30, 26, 12, 26, 24, 26, "Uknown", F_EDIT, 0, 0},
|
||||
{14, 8, 5, 5, 26, 12, 26, 24, 26, "000", F_EDIT, 0, 0},
|
||||
{15, 31, 7, 10, 27, 25, 27, 25, 27, "0", F_EDIT, 0, 0},
|
||||
{16, 5, 5, 10, 28, 26, 30, 26, 28, "0", F_EDIT, 0, 0},
|
||||
{16, 14, 5, 10, 29, 26, 30, 27, 29, "0", F_EDIT, 0, 0},
|
||||
@ -36,7 +36,7 @@ struct field mbr_field[] = {
|
||||
{19, 9, 6, 10, 35, 31, 36, 33, 35, "0", F_EDIT, 0, 0},
|
||||
{19, 27, 5, 10, 36, 31, 36, 34, 36, "0", F_EDIT, 0, 0},
|
||||
{20, 10, 10, 10, 37, 34, 49, 35, 37, "Not Active", F_EDIT, 0, 0},
|
||||
{14, 47, 30, 30, 38, 24, 38, 36, 38, "Uknown", F_EDIT, 0, 0},
|
||||
{14, 47, 5, 5, 38, 24, 38, 36, 38, "000", F_EDIT, 0, 0},
|
||||
{15, 70, 7, 10, 39, 37, 39, 37, 39, "0", F_EDIT, 0, 0},
|
||||
{16, 44, 5, 10, 40, 38, 42, 38, 40, "0", F_EDIT, 0, 0},
|
||||
{16, 54, 5, 10, 41, 38, 42, 39, 41, "0", F_EDIT, 0, 0},
|
||||
|
Loading…
Reference in New Issue
Block a user