summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/format/label.c93
-rw-r--r--usr/src/cmd/format/label.h2
-rw-r--r--usr/src/cmd/format/menu_command.c2
3 files changed, 3 insertions, 94 deletions
diff --git a/usr/src/cmd/format/label.c b/usr/src/cmd/format/label.c
index ac0bbd066a..9ce00d0082 100644
--- a/usr/src/cmd/format/label.c
+++ b/usr/src/cmd/format/label.c
@@ -282,7 +282,7 @@ write_label()
if (cur_label == L_TYPE_EFI) {
enter_critical();
vtoc64 = cur_parts->etoc;
- err_check(vtoc64);
+ efi_err_check(vtoc64);
if (efi_write(cur_file, vtoc64) != 0) {
err_print("Warning: error writing EFI.\n");
error = -1;
@@ -979,97 +979,6 @@ is_efi_type(int fd)
return (0);
}
-/* make sure the user specified something reasonable */
-void
-err_check(struct dk_gpt *vtoc)
-{
- int resv_part = -1;
- int i, j;
- diskaddr_t istart, jstart, isize, jsize, endsect;
- int overlap = 0;
- uint_t reserved;
-
- /*
- * make sure no partitions overlap
- */
- reserved = efi_reserved_sectors(vtoc);
- for (i = 0; i < vtoc->efi_nparts; i++) {
- /* It can't be unassigned and have an actual size */
- if ((vtoc->efi_parts[i].p_tag == V_UNASSIGNED) &&
- (vtoc->efi_parts[i].p_size != 0)) {
- (void) fprintf(stderr,
-"partition %d is \"unassigned\" but has a size of %llu\n", i,
- vtoc->efi_parts[i].p_size);
- }
- if (vtoc->efi_parts[i].p_tag == V_UNASSIGNED) {
- continue;
- }
- if (vtoc->efi_parts[i].p_tag == V_RESERVED) {
- if (resv_part != -1) {
- (void) fprintf(stderr,
-"found duplicate reserved partition at %d\n", i);
- }
- resv_part = i;
- if (vtoc->efi_parts[i].p_size != reserved)
- (void) fprintf(stderr,
-"Warning: reserved partition size must be %u sectors\n",
- reserved);
- }
- if ((vtoc->efi_parts[i].p_start < vtoc->efi_first_u_lba) ||
- (vtoc->efi_parts[i].p_start > vtoc->efi_last_u_lba)) {
- (void) fprintf(stderr,
- "Partition %d starts at %llu\n",
- i,
- vtoc->efi_parts[i].p_start);
- (void) fprintf(stderr,
- "It must be between %llu and %llu.\n",
- vtoc->efi_first_u_lba,
- vtoc->efi_last_u_lba);
- }
- if ((vtoc->efi_parts[i].p_start +
- vtoc->efi_parts[i].p_size <
- vtoc->efi_first_u_lba) ||
- (vtoc->efi_parts[i].p_start +
- vtoc->efi_parts[i].p_size >
- vtoc->efi_last_u_lba + 1)) {
- (void) fprintf(stderr,
- "Partition %d ends at %llu\n",
- i,
- vtoc->efi_parts[i].p_start +
- vtoc->efi_parts[i].p_size);
- (void) fprintf(stderr,
- "It must be between %llu and %llu.\n",
- vtoc->efi_first_u_lba,
- vtoc->efi_last_u_lba);
- }
-
- for (j = 0; j < vtoc->efi_nparts; j++) {
- isize = vtoc->efi_parts[i].p_size;
- jsize = vtoc->efi_parts[j].p_size;
- istart = vtoc->efi_parts[i].p_start;
- jstart = vtoc->efi_parts[j].p_start;
- if ((i != j) && (isize != 0) && (jsize != 0)) {
- endsect = jstart + jsize -1;
- if ((jstart <= istart) &&
- (istart <= endsect)) {
- if (!overlap) {
- (void) fprintf(stderr,
-"label error: EFI Labels do not support overlapping partitions\n");
- }
- (void) fprintf(stderr,
-"Partition %d overlaps partition %d.\n", i, j);
- overlap = 1;
- }
- }
- }
- }
- /* make sure there is a reserved partition */
- if (resv_part == -1) {
- (void) fprintf(stderr,
- "no reserved partition found\n");
- }
-}
-
#ifdef DEBUG
static void
dump_label(struct dk_label *label)
diff --git a/usr/src/cmd/format/label.h b/usr/src/cmd/format/label.h
index d1be86c766..6096c9b765 100644
--- a/usr/src/cmd/format/label.h
+++ b/usr/src/cmd/format/label.h
@@ -44,7 +44,7 @@ int get_disk_inquiry_prop(char *, char **, char **, char **);
int get_disk_info(int, struct efi_info *, struct disk_info *);
int label_to_vtoc(struct extvtoc *, struct dk_label *);
int SMI_vtoc_to_EFI(int, struct dk_gpt **);
-void err_check(struct dk_gpt *);
+void efi_err_check(struct dk_gpt *);
extern int is_efi_type(int);
#ifdef __cplusplus
diff --git a/usr/src/cmd/format/menu_command.c b/usr/src/cmd/format/menu_command.c
index 4633344be7..05a359b158 100644
--- a/usr/src/cmd/format/menu_command.c
+++ b/usr/src/cmd/format/menu_command.c
@@ -1709,7 +1709,7 @@ c_label()
return (-1);
}
if (efi_write(cur_file, vtoc64) != 0) {
- err_check(vtoc64);
+ efi_err_check(vtoc64);
err_print("Warning: error writing EFI.\n");
return (-1);
} else {