Wed Nov 4 13:27:08 2020 UTC ()
Pull up the following revisions(s) (requested by martin in ticket #1119):
	usr.sbin/sysinst/mbr.c:	revision 1.37

Do not force alignment of the first partition by default (which is
treated special to skip the first track), unless an existing partition
table hints at it.


(sborrill)
diff -r1.19.2.7 -r1.19.2.8 src/usr.sbin/sysinst/mbr.c

cvs diff -r1.19.2.7 -r1.19.2.8 src/usr.sbin/sysinst/mbr.c (expand / switch to unified diff)

--- src/usr.sbin/sysinst/mbr.c 2020/10/15 19:36:51 1.19.2.7
+++ src/usr.sbin/sysinst/mbr.c 2020/11/04 13:27:08 1.19.2.8
@@ -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
882static void 882static void
883mbr_init_default_alignments(struct mbr_disk_partitions *parts, uint track) 883mbr_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
906static struct disk_partitions * 905static struct disk_partitions *
907mbr_create_new(const char *disk, daddr_t start, daddr_t len, 906mbr_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)