From b14138c2ae17ac725bd48ab736414770aed6d656 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Sun, 1 Sep 2013 21:18:11 +0200 Subject: [PATCH] 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. --- sys/src/boot/pc/fat.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/src/boot/pc/fat.c b/sys/src/boot/pc/fat.c index 35a8f9603..7b90234b4 100644 --- a/sys/src/boot/pc/fat.c +++ b/sys/src/boot/pc/fat.c @@ -329,7 +329,7 @@ findfat(Fat *fat, int drive, ulong xbase, ulong lba) uchar echs[3]; uchar lba[4]; uchar len[4]; - } *p; + } p[4]; uchar buf[Sectsz]; int i; @@ -345,7 +345,7 @@ findfat(Fat *fat, int drive, ulong xbase, ulong lba) 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 @@ findfat(Fat *fat, int drive, ulong xbase, ulong lba) 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))