| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: mbr.c,v 1.19.2.7 2020/10/15 19:36:51 bouyer Exp $ */ | | 1 | /* $NetBSD: mbr.c,v 1.19.2.8 2020/11/04 13:27:08 sborrill Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright 1997 Piermont Information Systems Inc. | | 4 | * Copyright 1997 Piermont Information Systems Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Written by Philip A. Nelson for Piermont Information Systems Inc. | | 7 | * Written by Philip A. Nelson for Piermont Information Systems Inc. |
8 | * | | 8 | * |
9 | * Redistribution and use in source and binary forms, with or without | | 9 | * Redistribution and use in source and binary forms, with or without |
10 | * modification, are permitted provided that the following conditions | | 10 | * modification, are permitted provided that the following conditions |
11 | * are met: | | 11 | * are met: |
12 | * 1. Redistributions of source code must retain the above copyright | | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| @@ -879,36 +879,35 @@ mbr_sort_main_mbr(struct mbr_sector *m) | | | @@ -879,36 +879,35 @@ mbr_sort_main_mbr(struct mbr_sector *m) |
879 | sizeof(m->mbr_parts[0]), mbr_comp_part_entry); | | 879 | sizeof(m->mbr_parts[0]), mbr_comp_part_entry); |
880 | } | | 880 | } |
881 | | | 881 | |
882 | static void | | 882 | static void |
883 | mbr_init_default_alignments(struct mbr_disk_partitions *parts, uint track) | | 883 | mbr_init_default_alignments(struct mbr_disk_partitions *parts, uint track) |
884 | { | | 884 | { |
885 | if (track == 0) | | 885 | if (track == 0) |
886 | track = 16065; | | 886 | track = 16065; |
887 | | | 887 | |
888 | assert(parts->dp.disk_size > 0); | | 888 | assert(parts->dp.disk_size > 0); |
889 | if (parts->dp.disk_size < 0) | | 889 | if (parts->dp.disk_size < 0) |
890 | return; | | 890 | return; |
891 | | | 891 | |
| | | 892 | parts->ptn_0_offset = parts->geo_sec; |
| | | 893 | |
892 | /* Use 1MB offset/alignemnt for large (>128GB) disks */ | | 894 | /* Use 1MB offset/alignemnt for large (>128GB) disks */ |
893 | if (parts->dp.disk_size > HUGE_DISK_SIZE) { | | 895 | if (parts->dp.disk_size > HUGE_DISK_SIZE) { |
894 | parts->ptn_alignment = 2048; | | 896 | parts->ptn_alignment = 2048; |
895 | parts->ptn_0_offset = 2048; | | | |
896 | } else if (parts->dp.disk_size > TINY_DISK_SIZE) { | | 897 | } else if (parts->dp.disk_size > TINY_DISK_SIZE) { |
897 | parts->ptn_alignment = 64; | | 898 | parts->ptn_alignment = 64; |
898 | parts->ptn_0_offset = parts->geo_sec; | | | |
899 | } else { | | 899 | } else { |
900 | parts->ptn_alignment = 1; | | 900 | parts->ptn_alignment = 1; |
901 | parts->ptn_0_offset = parts->geo_sec; | | | |
902 | } | | 901 | } |
903 | parts->ext_ptn_alignment = track; | | 902 | parts->ext_ptn_alignment = track; |
904 | } | | 903 | } |
905 | | | 904 | |
906 | static struct disk_partitions * | | 905 | static struct disk_partitions * |
907 | mbr_create_new(const char *disk, daddr_t start, daddr_t len, | | 906 | mbr_create_new(const char *disk, daddr_t start, daddr_t len, |
908 | bool is_boot_drive, struct disk_partitions *parent) | | 907 | bool is_boot_drive, struct disk_partitions *parent) |
909 | { | | 908 | { |
910 | struct mbr_disk_partitions *parts; | | 909 | struct mbr_disk_partitions *parts; |
911 | struct disk_geom geo; | | 910 | struct disk_geom geo; |
912 | | | 911 | |
913 | assert(start == 0); | | 912 | assert(start == 0); |
914 | if (start != 0) | | 913 | if (start != 0) |