summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/cmd/format/menu_fdisk.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/usr/src/cmd/format/menu_fdisk.c b/usr/src/cmd/format/menu_fdisk.c
index 426a4e1bc6..7fa65c2eff 100644
--- a/usr/src/cmd/format/menu_fdisk.c
+++ b/usr/src/cmd/format/menu_fdisk.c
@@ -404,6 +404,7 @@ get_solaris_part(int fd, struct ipart *ipart)
struct ipart ip;
int status;
char *bootptr;
+ struct dk_label update_label;
(void) lseek(fd, 0, 0);
status = read(fd, (caddr_t)&boot_sec, NBPSCTR);
@@ -466,7 +467,14 @@ get_solaris_part(int fd, struct ipart *ipart)
bcopy(&ip, ipart, sizeof (struct ipart));
- /* if the disk partitioning has changed - get the VTOC */
+ /* if it is not a Solaris partition, skip the updating */
+ if (is_efi_type(fd))
+ return (0);
+
+ /*
+ * if the disk partitioning has changed - get the VTOC
+ * and the partition information
+ */
if (status) {
status = ioctl(fd, DKIOCGVTOC, &cur_parts->vtoc);
if (status == -1) {
@@ -476,6 +484,30 @@ get_solaris_part(int fd, struct ipart *ipart)
err_print("Cannot read vtoc information.\n");
return (-1);
}
+
+ status = read_label(fd, &update_label);
+ if (status == -1) {
+ err_print("Cannot read label information.\n");
+ return (-1);
+ }
+ for (i = 0; i < NDKMAP; i ++) {
+ cur_parts->pinfo_map[i].dkl_cylno =
+ update_label.dkl_vtoc.v_part[i].p_start /
+ ((int)(update_label.dkl_nhead *
+ update_label.dkl_nsect));
+ cur_parts->pinfo_map[i].dkl_nblk =
+ update_label.dkl_vtoc.v_part[i].p_size;
+ }
+ cur_dtype->dtype_ncyl = update_label.dkl_ncyl;
+ cur_dtype->dtype_pcyl = update_label.dkl_pcyl;
+ cur_dtype->dtype_acyl = update_label.dkl_acyl;
+ cur_dtype->dtype_nhead = update_label.dkl_nhead;
+ cur_dtype->dtype_nsect = update_label.dkl_nsect;
+ ncyl = cur_dtype->dtype_ncyl;
+ acyl = cur_dtype->dtype_acyl;
+ pcyl = cur_dtype->dtype_pcyl;
+ nsect = cur_dtype->dtype_nsect;
+ nhead = cur_dtype->dtype_nhead;
}
return (0);
}