Skip to content

Commit

Permalink
2741 format shouldn't allow write SMI label to disk with EFI partition
Browse files Browse the repository at this point in the history
Reviewed by: Garrett D'Amore <[email protected]>
Reviewed by: Milan Jurik <[email protected]>
Reviewed by: Steve Gonczi <[email protected]>
Reviewed by: Gary Mills <[email protected]>
Approved by: Albert Lee <[email protected]>
  • Loading branch information
alhazred committed Jun 14, 2012
1 parent 7bc8789 commit 9ef03c0
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions usr/src/cmd/format/menu_command.c
Original file line number Diff line number Diff line change
Expand Up @@ -1563,20 +1563,24 @@ c_label()
fmt_print("[1] EFI Label\n");
ioparam.io_bounds.lower = 0;
ioparam.io_bounds.upper = 1;
if (cur_label == L_TYPE_SOLARIS)
deflt = 0;
if ((cur_label == L_TYPE_SOLARIS) &&
(cur_disk->fdisk_part.systid != EFI_PMBR))
deflt = L_TYPE_SOLARIS;
else
deflt = 1;
deflt = L_TYPE_EFI;
defltptr = &deflt;
choice = input(FIO_INT, "Specify Label type", ':',
&ioparam, defltptr, DATA_INPUT);
if ((choice == 0) && (cur_label == L_TYPE_SOLARIS)) {
if ((choice == L_TYPE_SOLARIS) &&
(cur_label == L_TYPE_SOLARIS) &&
(cur_disk->fdisk_part.systid != EFI_PMBR)) {
goto expert_end;
} else if ((choice == 1) && (cur_label == L_TYPE_EFI)) {
} else if ((choice == L_TYPE_EFI) &&
(cur_label == L_TYPE_EFI)) {
goto expert_end;
}
switch (choice) {
case 0:
case L_TYPE_SOLARIS:
/*
* EFI label to SMI label
*/
Expand Down Expand Up @@ -1648,17 +1652,19 @@ c_label()
}


case 1:
case L_TYPE_EFI:
/*
* SMI label to EFI label
*/


fmt_print("Warning: This disk has an SMI label. Changing to "
"EFI label will erase all\ncurrent partitions.\n");

if (check("Continue")) {
return (-1);
if ((cur_disk->fdisk_part.systid == SUNIXOS) ||
(cur_disk->fdisk_part.systid == SUNIXOS2)) {
fmt_print("Warning: This disk has an SMI label. "
"Changing to EFI label will erase all\ncurrent "
"partitions.\n");
if (check("Continue")) {
return (-1);
}
}

if (get_disk_info(cur_file, &efinfo) != 0) {
Expand Down

0 comments on commit 9ef03c0

Please sign in to comment.