git: 9front

Download patch

ref: 2cf91043bb58d0325879ad8fa53b7f8889d7ec7e
parent: 6b9ae01f9f61e9976d9c8023780cc37066828a92
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Fri Jul 8 12:19:15 EDT 2016

disk/prep: if no 9fat, reserve space for plan9 partition table in autopart (thanks Shamar)

usually, the plan9 partition table is contained in
the first 9fat partition after the pbs/fat header,
but when no 9fat partition is requested, we have
to make sure partitions wont overlap the partition
table (start at sector offset >= 2).

--- a/sys/src/cmd/disk/prep/prep.c
+++ b/sys/src/cmd/disk/prep/prep.c
@@ -432,6 +432,11 @@
 	}
 
 	s = 0;
+	if(autox[0].alloc == 0){
+		/* if no 9fat, reserve space for plan9 partition table */ 
+		s = 2;
+		if((s + pa) % stride) s += stride - (s + pa) % stride;
+	}
 	secs = edit->disk->secs;
 	for(i=0; i<nelem(autox); i++){
 		if(autox[i].alloc == 0)
--