ref: b14138c2ae17ac725bd48ab736414770aed6d656
parent: 243cb68011ac5335bb2f9fc146d0f6be2d283fa9
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Sun Sep 1 17:18:11 EDT 2013
9bootfat: always try plan9 partition even when not marked active, fix bug always look for 9fat in plan9 partition even tho the partition is *not* maked active. marking partitions active is not recommended anymore with grub so this makes life easier for some people. multiple plan9 partitions on a single drive is not supported. have to copy partition table as buf gets trashed when reading first block of fat partition. it worked only when the first fat partition found (the one marked active) was the right one, but conffat() can fail.
--- a/sys/src/boot/pc/fat.c
+++ b/sys/src/boot/pc/fat.c
@@ -329,7 +329,7 @@
uchar echs[3];
uchar lba[4];
uchar len[4];
- } *p;
+ } p[4];
uchar buf[Sectsz];
int i;
@@ -345,7 +345,7 @@
if(!conffat(fat, buf))
return 0;
}
- p = (void*)&buf[0x1be];
+ memmove(p, &buf[0x1be], sizeof(p));
for(i=0; i<4; i++){ switch(p[i].typ){case 0x05:
@@ -360,6 +360,7 @@
default:
if(p[i].status != 0x80)
continue;
+ case 0x39: /* always try plan9 partition */
fat->drive = drive;
fat->partlba = lba + GETLONG(p[i].lba);
if(readsect(drive, fat->partlba, buf))
--
⑨