Commit dd134343 authored by John Ballance's avatar John Ballance
Browse files

progress, bug fixes, and improved diagnostics

Detail:
  still needs optimisation of formatter element
Admin:


Version 0.11. Tagged as 'PartMan-0_11'
parent 6b956286
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "0.10"
Module_Version SETA 10
Module_MajorVersion SETS "0.11"
Module_Version SETA 11
Module_MinorVersion SETS ""
Module_Date SETS "01 Dec 2016"
Module_ApplicationDate SETS "01-Dec-16"
Module_Date SETS "06 Dec 2016"
Module_ApplicationDate SETS "06-Dec-16"
Module_ComponentName SETS "PartMan"
Module_ComponentPath SETS "castle/RiscOS/Sources/FileSys/SCSIFS/PartMan"
Module_FullVersion SETS "0.10"
Module_HelpVersion SETS "0.10 (01 Dec 2016)"
Module_FullVersion SETS "0.11"
Module_HelpVersion SETS "0.11 (06 Dec 2016)"
END
/* (0.10)
/* (0.11)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.10
#define Module_MajorVersion_CMHG 0.11
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 01 Dec 2016
#define Module_Date_CMHG 06 Dec 2016
#define Module_MajorVersion "0.10"
#define Module_Version 10
#define Module_MajorVersion "0.11"
#define Module_Version 11
#define Module_MinorVersion ""
#define Module_Date "01 Dec 2016"
#define Module_Date "06 Dec 2016"
#define Module_ApplicationDate "01-Dec-16"
#define Module_ApplicationDate "06-Dec-16"
#define Module_ComponentName "PartMan"
#define Module_ComponentPath "castle/RiscOS/Sources/FileSys/SCSIFS/PartMan"
#define Module_FullVersion "0.10"
#define Module_HelpVersion "0.10 (01 Dec 2016)"
#define Module_LibraryVersionInfo "0:10"
#define Module_FullVersion "0.11"
#define Module_HelpVersion "0.11 (06 Dec 2016)"
#define Module_LibraryVersionInfo "0:11"
......@@ -52,117 +52,65 @@ void testsave (char* title, char * data, int size)
}
}
// print item to disc appended to end of testfile
void testprint (char * data)
void testprint (char * fmt, ...)
{
FILE * fp;
va_list arg;
va_start (arg,fmt);
if((fp = fopen( debugfile,"ab")) != NULL)
{
fprintf(fp,data);
fclose(fp);
}
}
// print item to disc appended to end of testfile
void testprint1 (char * data, int format)
{
FILE * fp;
if((fp = fopen( debugfile,"ab")) != NULL)
{
fprintf(fp,data,format);
fclose(fp);
}
}
void testprint2 (char * data, int format, int a1)
{
FILE * fp;
if((fp = fopen( debugfile,"ab")) != NULL)
{
fprintf(fp,data,format, a1);
fclose(fp);
}
}
void testprint3 (char * data, int format, int a1, int a2)
{
FILE * fp;
if((fp = fopen( debugfile,"ab")) != NULL)
{
fprintf(fp,data,format, a1,a2);
fclose(fp);
}
}
void testprint4 (char * data, int format, int a1, int a2, int a3)
{
FILE * fp;
if((fp = fopen( debugfile,"ab")) != NULL)
{
fprintf(fp,data,format, a1,a2,a3);
fclose(fp);
}
}
void testprint5 (char * data, int format, int a1, int a2, int a3, int a4)
{
FILE * fp;
if((fp = fopen( debugfile,"ab")) != NULL)
{
fprintf(fp,data,format, a1,a2,a3,a4);
fclose(fp);
}
}
void testprint6 (char * data, int format, int a1, int a2, int a3, int a4, int a5)
{
FILE * fp;
if((fp = fopen( debugfile,"ab")) != NULL)
{
fprintf(fp,data,format, a1,a2,a3,a4,a5);
vfprintf(fp,fmt,arg);
fclose(fp);
}
va_end(arg);
}
void testprintGUID (char * ptr)
{
testprint4(" %02x%02x%02x%02x-",ptr[3],ptr[2],ptr[1],ptr[0]);
testprint2("%02x%02x-",ptr[5],ptr[4]);
testprint2("%02x%02x-",ptr[7],ptr[6]);
testprint2("%02x%02x-",ptr[8],ptr[9]);
testprint3("%02x%02x%02x",ptr[10],ptr[11],ptr[12]);
testprint3("%02x%02x%02x ",ptr[13],ptr[14],ptr[15]);
testprint(" %02x%02x%02x%02x-",ptr[3],ptr[2],ptr[1],ptr[0]);
testprint("%02x%02x-",ptr[5],ptr[4]);
testprint("%02x%02x-",ptr[7],ptr[6]);
testprint("%02x%02x-",ptr[8],ptr[9]);
testprint("%02x%02x%02x",ptr[10],ptr[11],ptr[12]);
testprint("%02x%02x%02x ",ptr[13],ptr[14],ptr[15]);
}
void reportfmt(FormatArray* fmt)
{
testprint1("\nfmt->log2secsize %x",fmt->log2secsize);
testprint1("\nfmt->idlen %d",fmt->idlen);
testprint1("\nfmt->log2bpmb %x",fmt->log2bpmb );
testprint1("\n (LFAU) %x",1<<fmt->log2bpmb );
testprint1("\nfmt->zonecount %d",fmt->zonecount);
testprint1("\nfmt->zonecount2 %x",fmt->zonecount2);
testprint1("\nfmt->bigdisc %x",fmt->bigdisc);
testprint1("\nfmt->bigdir %x",fmt->bigdir);
testprint1("\nfmt->zonespare %d",fmt->zonespare);
testprint1("\nfmt->SecSize %d",fmt->SecSize);
testprint1("\nfmt->SecCount %x",fmt->SecCount);
testprint1("\nfmt->endzonebits %x",fmt->endzonebits);
testprint1("\nfmt->rootaddress %x",fmt->rootaddress);
testprint1("\nfmt->rootdiradd %x",fmt->rootdiradd);
testprint1("\nfmt->newrootaddr %x",fmt->newrootaddress);
testprint1("\nfmt->mapbase %x",fmt->mapbase);
testprint1("\nfmt->discsize %x",fmt->discsize);
testprint1("\nfmt->discsizehi %x",fmt->discsizehi);
testprint1("\nfmt->sharesize %d",fmt->sharesize);
testprint1("\nfmt->newshsize %x",fmt->newsharesize);
testprint1("\nfmt->mapbits %x",fmt->mapbits);
testprint1("\nfmt->dirbits %x",fmt->dirbits);
testprint1("\nfmt->bootsecbits %x",fmt->bootsecbits);
testprint1("\nfmt->fragcount %x",fmt->fragmentcount);
testprint1("\nfmt->fragmissed %x",fmt->fragmentmissed);
testprint1("\nfmt->fragsZ0 %x",fmt->fragmentzone0);
testprint1("\nfmt->fragsZnorm %x",fmt->fragmentzonenorm);
testprint1("\nfmt->fragsZlast %x",fmt->fragmentzonelast);
testprint1("\nfmt->z0sparefnd %x",fmt->zone0sparefound);
testprint1("\nfmt->zsparefnd %x",fmt->zonesparefound);
testprint1("\nfmt->cyls %d",fmt->cyls);
testprint1("\nfmt->spt %d",fmt->spt);
testprint1("\nfmt->heads %d",fmt->heads);
testprint1("\nfmt->density %x",fmt->density);
testprint1("\nfmt->skew %x",fmt->skew);
testprint("\nfmt->log2secsize %x",fmt->log2secsize);
testprint("\nfmt->idlen %d",fmt->idlen);
testprint("\nfmt->log2bpmb %x",fmt->log2bpmb );
testprint("\n (LFAU) %x",1<<fmt->log2bpmb );
testprint("\nfmt->zonecount %d",fmt->zonecount);
testprint("\nfmt->zonecount2 %x",fmt->zonecount2);
testprint("\nfmt->bigdisc %x",fmt->bigdisc);
testprint("\nfmt->bigdir %x",fmt->bigdir);
testprint("\nfmt->zonespare %d",fmt->zonespare);
testprint("\nfmt->SecSize %d",fmt->SecSize);
testprint("\nfmt->SecCount %x",fmt->SecCount);
testprint("\nfmt->endzonebits %x",fmt->endzonebits);
testprint("\nfmt->rootaddress %x",fmt->rootaddress);
testprint("\nfmt->rootdiradd %x",fmt->rootdiradd);
testprint("\nfmt->newrootaddr %x",fmt->newrootaddress);
testprint("\nfmt->mapbase %x",fmt->mapbase);
testprint("\nfmt->discsize %x",fmt->discsize);
testprint("\nfmt->discsizehi %x",fmt->discsizehi);
testprint("\nfmt->sharesize %d",fmt->sharesize);
testprint("\nfmt->newshsize %x",fmt->newsharesize);
testprint("\nfmt->mapbits %x",fmt->mapbits);
testprint("\nfmt->dirbits %x",fmt->dirbits);
testprint("\nfmt->bootsecbits %x",fmt->bootsecbits);
testprint("\nfmt->fragcount %x",fmt->fragmentcount);
testprint("\nfmt->fragmissed %x",fmt->fragmentmissed);
testprint("\nfmt->fragsZ0 %x",fmt->fragmentzone0);
testprint("\nfmt->fragsZnorm %x",fmt->fragmentzonenorm);
testprint("\nfmt->fragsZlast %x",fmt->fragmentzonelast);
testprint("\nfmt->z0sparefnd %x",fmt->zone0sparefound);
testprint("\nfmt->zsparefnd %x",fmt->zonesparefound);
testprint("\nfmt->cyls %d",fmt->cyls);
testprint("\nfmt->spt %d",fmt->spt);
testprint("\nfmt->heads %d",fmt->heads);
testprint("\nfmt->density %x",fmt->density);
testprint("\nfmt->skew %x",fmt->skew);
}
......@@ -174,13 +122,7 @@ void reportfmt(FormatArray* fmt)
void testfileinit (void){}
void testsave (char* title, char * data, int size){_UU(title);_UU(data);_UU(size); }
void testprint (char * data){_UU(data);}
void testprint1 (char * data, int a1){_UU(data);_UU(a1);}
void testprint2 (char * data, int a1,int a2){_UU(data);_UU(a1);_UU(a2);}
void testprint3 (char * data, int a1, int a2,int a3){_UU(data);_UU(a1);_UU(a2);_UU(a3);}
void testprint4 (char * data, int a1, int a2,int a3,int a4){_UU(data);_UU(a1);_UU(a2);_UU(a3);_UU(a4);}
void testprint5 (char * data, int a1, int a2,int a3,int a4,int a5) {_UU(data);_UU(a1);_UU(a2);_UU(a3);_UU(a4);_UU(a5);}
void testprint6 (char * data, int a1, int a2,int a3,int a4,int a5,int a6){_UU(data);_UU(a1);_UU(a2);_UU(a3);_UU(a4);_UU(a5);_UU(a6);}
void testprint (char * data, ...){_UU(data);}
void reportfmt(FormatArray* fmt){_UU(fmt);}
void testprintGUID (char * ptr) {_UU(ptr);}
......
......@@ -39,7 +39,7 @@ static _kernel_oserror our_error;
void fragwrite(char* mapsector, int position, int FragmentID, int FragmentLen, int IDlen)
{
testprint5("FW: mapsec:%x pos:%x id:%x len:%x idlen%x\n",(int)mapsector,position,FragmentID,FragmentLen,IDlen);
testprint("FW: mapsec:%x pos:%x id:%x len:%x idlen%x\n",(int)mapsector,position,FragmentID,FragmentLen,IDlen);
FragmentID=(FragmentID>>8)<<(position%8);
// n.b. offset of 1 added to position to allow for zone cksum at byte 0 of zone
mapsector[1+(position/8)] |= (FragmentID>>0 );
......@@ -85,7 +85,7 @@ int MakeAcornFormat(int ID,
// cyls=cyls/secs;
//
// } while((cyls>65535)&&(heads>255));
testprint4(" suggested heads %d, cyls %d, secs %d giving disk size %x\n",fa.heads,fa.cyls,fa.spt,fa.SecCount);
testprint(" suggested heads %d, cyls %d, secs %d giving disk size %x\n",fa.heads,fa.cyls,fa.spt,fa.SecCount);
......@@ -101,7 +101,7 @@ int MakeAcornFormat(int ID,
wimp_error( SecRead(ID, AccessKey, tfbuf, (SecSize>0x200)?SecSize:0x200, (0xc00/SecSize)+BaseOffset, SecSize));
insecoffset=0xc00-((0xc00/SecSize)*SecSize);
boot=(bootsector*)((int)tfbuf+insecoffset);
testprint2("\n tfbuf:%x boot:%x ",(int)tfbuf,(int)boot);
testprint("\n tfbuf:%x boot:%x ",(int)tfbuf,(int)boot);
newname=name;
testprint("\nabt to build layout");
......@@ -176,7 +176,7 @@ int MakeAcornFormat(int ID,
// }
// Write sector(s) with bootblock out again
testprint2("base offset %x at boot sector write, discname %s\n",BaseOffset,(int)newname);
testprint("base offset %x at boot sector write, discname %s\n",BaseOffset,(int)newname);
//testsave(tfbuf,0x200);
......@@ -220,19 +220,19 @@ int MakeAcornFormat(int ID,
}
// write in first fragment to map out boot area
boff = fa.idlen;
testprint2("\n bytes for base %x, boff %x ",(int)(boff*(1<<fa.log2bpmb)),boff);
testprint("\n bytes for base %x, boff %x ",(int)(boff*(1<<fa.log2bpmb)),boff);
while((boff*(1<<fa.log2bpmb))<0xe00)boff++; // ensure boot sector mapped out
testprint1("\n boff %x ",(int)(boff));
testprint("\n boff %x ",(int)(boff));
if((1<<fa.log2bpmb)<SecSize)
{ // ensure we point to highest subsec alloc unit
boff++;
while(((boff*(1<<fa.log2bpmb))%SecSize)>0)boff++;// ensure integer sector count for this
boff--;
}
testprint1("\n boff %x ",(int)(boff));
testprint("\n boff %x ",(int)(boff));
i=(1<<(boff)); // mark last unit used
i+=2; // add in ID
testprint1("\nmarking bit: %x ",(int)i);
testprint("\nmarking bit: %x ",(int)i);
map[64+base] = (char)i;
map[65+base] = (char)(i>>8);
map[66+base] = (char)(i>>16);
......@@ -240,7 +240,7 @@ int MakeAcornFormat(int ID,
// write in freelink
skew = (int)map[1+base] + ((((int)map[2+base])*0x100)&0x7f00);
skew += (60*8)+boff+1; // first free alloc unit after
testprint1("\nskew: %x ",(int)skew);
testprint("\nskew: %x ",(int)skew);
map[1+base] = (char)skew;
map[2+base] = (char)(skew>>8) + (0x80);
map[3+base] = (fa.zonecount&1)?0xff:0x00; // ensure EOR of all Zonechecks -> 0xff
......@@ -253,7 +253,7 @@ int MakeAcornFormat(int ID,
// compute bit offset & skew of frag start
i = 0x18;//(int)map[1+base] + ((int)map[2+base])<<8;
testprint2("root zone offset %x.. starting freelink at %x\n",k*SecSize,i);
testprint("root zone offset %x.. starting freelink at %x\n",k*SecSize,i);
fragwrite((char*)(map+base), i, 0x201, fa.mapbits,fa.idlen+1);
i += (fa.mapbits);
......@@ -264,7 +264,7 @@ int MakeAcornFormat(int ID,
}
map[1+base] = (char)i;
map[2+base] = ((char)(i>>8))+ 0x80;
testprint1("setting freelink to %x\nrootdirzone\n",i);
testprint("setting freelink to %x\nrootdirzone\n",i);
}
}
// compute bit offset & skew of free space end (so as to terminate zone)
......@@ -272,7 +272,7 @@ int MakeAcornFormat(int ID,
skew+= ((k==0)?((fa.fragmentzone0*(fa.idlen+1))+(60*8)):
(k == fa.zonecount-1)?(fa.endzonebits):
(fa.fragmentzonenorm*(fa.idlen+1)));
//testprint1("Sk:%x ",skew);
//testprint("Sk:%x ",skew);
// terminate zone
map[(skew/8)+base+1] |= 1<<(skew%8);
// start zonespare fragment
......@@ -283,7 +283,7 @@ int MakeAcornFormat(int ID,
// Write out Zone map & copy
wimp_error( SecWrite(ID, AccessKey, map, SecSize*fa.zonecount, fa.mapbase+BaseOffset, SecSize));
wimp_error( SecWrite(ID, AccessKey, map, SecSize*fa.zonecount, fa.mapbase+fa.zonecount+BaseOffset, SecSize));
testprint2 ("End of map at %x\n rootdir at %x\n",fa.mapbase+fa.zonecount+fa.zonecount+BaseOffset,fa.mapbase+fa.rootdiradd+BaseOffset);
testprint ("End of map at %x\n rootdir at %x\n",fa.mapbase+fa.zonecount+fa.zonecount+BaseOffset,fa.mapbase+fa.rootdiradd+BaseOffset);
testsave ("map",(char*)(map),SecSize*fa.zonecount);
if(map != NULL) free(map);
if(tfbuf != NULL) free(tfbuf);
......@@ -392,7 +392,7 @@ int MakeAcornFormat(int ID,
map[0x800-1] = (unsigned char)i;
}
// write out root dir
testprint1("rootdiradd=%x\n",fa.mapbase+fa.rootdiradd+BaseOffset);
testprint("rootdiradd=%x\n",fa.mapbase+fa.rootdiradd+BaseOffset);
// testsave (map,0x800);
wimp_error( SecWrite(ID, AccessKey, map, 0x800, fa.mapbase+fa.rootdiradd+BaseOffset, SecSize));
if(map != NULL) free(map);
......@@ -453,7 +453,7 @@ int BuildAcornLayout(FormatArray* fmt,bootsector* bsec)
if(zonec< MaxZones-1)
{
zonec++;
//testprint1("zc:%x ",zonec);
//testprint("zc:%x ",zonec);
}
else
{
......@@ -461,7 +461,7 @@ int BuildAcornLayout(FormatArray* fmt,bootsector* bsec)
if((fmt->idlen<idmaxlen))
{
fmt->idlen+=1;
//testprint1("\nidl:%x ",fmt->idlen);
//testprint("\nidl:%x ",fmt->idlen);
}
else
{
......@@ -475,7 +475,7 @@ int BuildAcornLayout(FormatArray* fmt,bootsector* bsec)
else
{
fmt->log2bpmb+=1; // increase allocation length
testprint1("\nl2bmb:%x ",fmt->log2bpmb);
testprint("\nl2bmb:%x ",fmt->log2bpmb);
}
}
}
......@@ -489,9 +489,9 @@ int BuildAcornLayout(FormatArray* fmt,bootsector* bsec)
fmt->rootaddress = fmt->newrootaddress;
ComputeAcornLayout(fmt);
reportfmt(fmt);
// testprint2("\n Z0cap %x Zcap %x",zone0cap,zonecap);
// testprint("\n Z0cap %x Zcap %x",zone0cap,zonecap);
// ensure zonespare value is integer sector count
testprint2("\nbefore: zs %x endzs %x",(int)fmt->zonespare,(int)fmt->endzonebits);
testprint("\nbefore: zs %x endzs %x",(int)fmt->zonespare,(int)fmt->endzonebits);
return 0;
}
......@@ -768,6 +768,6 @@ void ComputeAcornLayout(FormatArray* fmt)
// fmt->cyls=fmt->cyls/fmt->spt;
//
// } while((fmt->cyls>65535)&&(fmt->heads>255));
// testprint3("heads %d, cyls %d, secs %d\n",fmt->heads,fmt->cyls,fmt->spt);
// testprint("heads %d, cyls %d, secs %d\n",fmt->heads,fmt->cyls,fmt->spt);
}
......@@ -55,7 +55,7 @@ int MakeDosFormat(int ID,
IGNORE(bootoption);
IGNORE(defect);
testprint5("\n Dos format ID:%x SecSize:%x Offset:%x Count:%x dospart:%d",ID,SecSize,BaseOffset,SecCount,dospartition);
testprint("\n Dos format ID:%x SecSize:%x Offset:%x Count:%x dospart:%d",ID,SecSize,BaseOffset,SecCount,dospartition);
// ensure SecCount max endpoint cannot exceed 2Gb for FAT16
vtmp=((1<<20)/SecSize)<<11; // conversion to 2Gb in sector units
......@@ -65,12 +65,12 @@ int MakeDosFormat(int ID,
wimp_error(&er);
}
utmp=SecCount+BaseOffset; // end sector
testprint2("\n utmp:%x vtmp:%x ",(int)utmp,(int)vtmp);
testprint("\n utmp:%x vtmp:%x ",(int)utmp,(int)vtmp);
if(utmp>vtmp) // if too big
{
SecCount=vtmp-BaseOffset;
SecCount-=(((1<<20)/SecSize)-BaseOffset); // & 1Mb exact
testprint1("\n new SecCount %x",SecCount);
testprint("\n new SecCount %x",SecCount);
er.errnum=0; strcpy(er.errmess,"Dos partition set to the 2047Mb maximum");
wimp_error(&er);
}
......@@ -202,13 +202,13 @@ int MakeDosFormat(int ID,
while(clusters>0xfffd){clusters/=2;clustersecs*=2;} // 2 cluster entries used at table start, 2 bytes/entry (FAT16!)
clusters+=((clusters*clustersecs)<(SecCount-1))?1:0; // ensure enough clusters to cover whole disc
testprint2("\nClustersecs:%d clusters:%d ",clustersecs,clusters);
testprint("\nClustersecs:%d clusters:%d ",clustersecs,clusters);
fatcount=((2*clusters)/SecSize)+((((2*clusters)%SecSize)>0)?1:0); // 2 bytes/cluster.. round clusters up
testprint1("secs used/ fat:%d ",fatcount);
testprint("secs used/ fat:%d ",fatcount);
// get space for boot sector, FAT area & root dir
if( (fb = (dosformatbootsector*) calloc(sizeof(dosformatbootsector)+(2*fatcount*SecSize)+(512*48),1)) == NULL)
......
......@@ -25,7 +25,7 @@ extern _kernel_oserror err;
_kernel_oserror * FormatPartition( int ID, FormatParamsp FP, int sectorsize)
{
testprint3("FormatPartition ID:%x partn:%d name:%s\n",ID,FP->partition,(int)FP->discname);
testprint("FormatPartition ID:%x partn:%d name:%s\n",ID,FP->partition,(int)FP->discname);
// first read the partition spec
GUIDPartn* myGP = ReturnGPTPartionInfo ( ID, FP->partition);
if(myGP)
......
......@@ -47,9 +47,9 @@ void printGUIDpart(GUIDPartn * gp)
{
testprint("type: ");testprintGUID((char*)(gp->PTypeGUID));
testprint("\nuniq: ");testprintGUID((char*)(gp->PUniqGUID));
testprint2("\nStartLBA: %08x%08x\n",gp->StartLBA[1],gp->StartLBA[0]);
testprint2("EndLBA: %08x%08x\n",gp->EndLBA[1],gp->EndLBA[0]);
testprint2("Attrib: %08x%08x\n",gp->Attributes[1],gp->Attributes[0]);
testprint("\nStartLBA: %08x%08x\n",gp->StartLBA[1],gp->StartLBA[0]);
testprint("EndLBA: %08x%08x\n",gp->EndLBA[1],gp->EndLBA[0]);
testprint("Attrib: %08x%08x\n",gp->Attributes[1],gp->Attributes[0]);
char *ch = gp->Name;
testprint("Name: ");
while (*ch)
......@@ -70,13 +70,13 @@ void printUTF16LEname(char* name, char* buffer, int maxchars)
}
void printLegacyPartition(PartitionRecord * partn)
{
testprint2("buffer addr %x, p1 addr %x\n",(int)mbrp,(int)partn);
testprint1("boot %02x\n",partn->boot);
testprint1("StartCHS %06x\n",partn->StartC+(partn->StartH<<8)+(partn->StartS<<16));
testprint1("OStype %02x\n",partn->OSType);
testprint1("EndCHS %06x\n",partn->EndC+(partn->EndH<<8)+(partn->EndS<<16));
testprint1("StartLBA %08x\n",partn->StartLBA[0]+(partn->StartLBA[1]<<8)+(partn->StartLBA[2]<<16)+(partn->StartLBA[3]<<24));
testprint1("SizeLBA %08x\n\n",partn->SizeLBA[0]+(partn->SizeLBA[1]<<8)+(partn->SizeLBA[2]<<16)+(partn->SizeLBA[03]<<24));
testprint("buffer addr %x, p1 addr %x\n",(int)mbrp,(int)partn);
testprint("boot %02x\n",partn->boot);
testprint("StartCHS %06x\n",partn->StartC+(partn->StartH<<8)+(partn->StartS<<16));
testprint("OStype %02x\n",partn->OSType);
testprint("EndCHS %06x\n",partn->EndC+(partn->EndH<<8)+(partn->EndS<<16));
testprint("StartLBA %08x\n",partn->StartLBA[0]+(partn->StartLBA[1]<<8)+(partn->StartLBA[2]<<16)+(partn->StartLBA[3]<<24));
testprint("SizeLBA %08x\n\n",partn->SizeLBA[0]+(partn->SizeLBA[1]<<8)+(partn->SizeLBA[2]<<16)+(partn->SizeLBA[03]<<24));
}
void printPartitionHeader(GPTHeader* altg)
......@@ -88,21 +88,21 @@ void printPartitionHeader(GPTHeader* altg)
testprint("CRC32 of partition header is bad\n");
}
altg->HeaderCRC32=tmp1;
testprint1("buffer addr %x\n",(int)altg);
testprint1("Sign %08s\n",(int)(altg->Sign));
testprint1("Revisn %08x\n",altg->Revisn);
testprint1("HeaderSize %08x\n",altg->HeaderSize);
testprint1("HeaderCRC %08x\n",altg->HeaderCRC32);
testprint2("MyLBA %08x%08x\n",altg->MyLBA[1],altg->MyLBA[0]);
testprint2("AltLBA %08x%08x\n",altg->AltLBA[1],altg->AltLBA[0]);
testprint2("OkLBAstrt %08x%08x\n",altg->FirstOKLBA[1],altg->FirstOKLBA[0]);
testprint2("OkLBAend %08x%08x\n",altg->LastOKLBA[1],altg->LastOKLBA[0]);
testprint("buffer addr %x\n",(int)altg);
testprint("Sign %08s\n",(int)(altg->Sign));
testprint("Revisn %08x\n",altg->Revisn);
testprint("HeaderSize %08x\n",altg->HeaderSize);
testprint("HeaderCRC %08x\n",altg->HeaderCRC32);
testprint("MyLBA %08x%08x\n",altg->MyLBA[1],altg->MyLBA[0]);
testprint("AltLBA %08x%08x\n",altg->AltLBA[1],altg->AltLBA[0]);
testprint("OkLBAstrt %08x%08x\n",altg->FirstOKLBA[1],altg->FirstOKLBA[0]);
testprint("OkLBAend %08x%08x\n",altg->LastOKLBA[1],altg->LastOKLBA[0]);
testprint("DiscGUID ");
testprintGUID((char*)(altg->DiscGUID));
testprint2("\nGUIDPstrt %08x%08x\n",altg->GUIDPArray[1],altg->GUIDPArray[0]);
testprint1("GUIDPcount %08x\n",altg->GUIDPnum);
testprint1("GUIDPsize %08x\n",altg->GUIDPsize);
testprint1("GUIDPCRC %08x\n\n",altg->GUIDPArrayCRC);
testprint("\nGUIDPstrt %08x%08x\n",altg->GUIDPArray[1],altg->GUIDPArray[0]);
testprint("GUIDPcount %08x\n",altg->GUIDPnum);
testprint("GUIDPsize %08x\n",altg->GUIDPsize);
testprint("GUIDPCRC %08x\n\n",altg->GUIDPArrayCRC);
}
// free the pointers set up by CheckGPTValid()
......@@ -127,9 +127,12 @@ void freepointers(void)
//
bool CheckGPTValid(int device)
{
testprint("cgptv %d\n",device);
ReadDiscCapacity(device,OverrideKey,&DiscMaxLBA,&DiscSectorSize);
if(DiscSectorSize==0){testprint1(" dss=0 dev %d\n",device);return(false);}
testprint1(" dss><0 dev %d\n",device);
testprint("cgptv rdc done \n");
testprint(" dss><0 dev %d\n",device);
if(DiscSectorSize==0){testprint(" dss=0 dev %d\n",device);return(false);}
testprint(" dss><0 dev %d\n",device);
if(mbrp=calloc(1,sizeof(struct ProtectiveMBR)),mbrp)
{
err=SecRead(device,OverrideKey,mbrp,sizeof(struct ProtectiveMBR),0,DiscSectorSize);
......@@ -166,7 +169,7 @@ bool CheckGPTValid(int device)
{
int tmp = gpth->HeaderCRC32;
gpth->HeaderCRC32=0;
// testprint2(" gpth %x hs %x\n",(int)gpth,gpth->HeaderSize);
// testprint(" gpth %x hs %x\n",(int)gpth,gpth->HeaderSize);
if (tmp!=crc32((unsigned char*)gpth,(gpth->HeaderSize)))
{
freepointers(); return false;
......@@ -321,7 +324,7 @@ case GUIDUnknown:
// partn[] = array of partcount partition sizes (LBA)
int PartitionDisc(int device, int numpart, int partcount, int partn[])
{
// testprint3("creating dev:%d maxpart:%d with %d used\n",device,numpart,partcount);
// testprint("creating dev:%d maxpart:%d with %d used\n",device,numpart,partcount);
if(device==0){testprint(" not allowed to touch scsi id 0\n");return 1;}
// ProtectiveMBR* sec0=0;
GPTHeader* sec1=0;
......@@ -337,10 +340,10 @@ int PartitionDisc(int device, int numpart, int partcount, int partn[])
// use calloc() a we need to clear unused space
sec1=calloc(1,GPTHdrSize(sectorsize));
tmp =(sizeof(struct GUIDPartn)*numpart);
testprint2("partn table size %x gp %x\n",tmp,sizeof(struct GPTHeader));
testprint("partn table size %x gp %x\n",tmp,sizeof(struct GPTHeader));
gptseccount=(tmp/sectorsize);
if(tmp%sectorsize) gptseccount++;
testprint1("claiming %d secs for partn table\n",gptseccount);
testprint("claiming %d secs for partn table\n",gptseccount);
gpt =calloc(tmp,sizeof(struct GUIDPartn));
if(!(gpt||sec1/*||sec0*/))
{
......@@ -390,7 +393,7 @@ int PartitionDisc(int device, int numpart, int partcount, int partn[])
{
if(GUIDValid((char*)(myGP->PTypeGUID)))
{
testprint1("Partn: %d\n",i);
testprint("Partn: %d\n",i);
printGUIDpart(myGP);
}
myGP++;
......@@ -422,8 +425,8 @@ int PartitionDisc(int device, int numpart, int partcount, int partn[])
// uses pointers set up by CheckGPTValid()
void ReadGPTInfo(int device)
{
testprint1("ReadGPTInfo devid:%d\n",device);
testprint2("Device Max LBA %08x - SectorSize %08x \n\n",DiscMaxLBA,DiscSectorSize);
testprint("ReadGPTInfo devid:%d\n",device);
testprint("Device Max LBA %08x - SectorSize %08x \n\n",DiscMaxLBA,DiscSectorSize);
printLegacyPartition((PartitionRecord *)&mbrp->Partition1);
printLegacyPartition((PartitionRecord *)&mbrp->Partition2);
printLegacyPartition((PartitionRecord *)&mbrp->Partition3);
......@@ -443,7 +446,7 @@ void ReadGPTInfo(int device)
{
if(GUIDValid((char*)(myGP->PTypeGUID)))
{
testprint1("Partn: %d\n",i);
testprint("Partn: %d\n",i);
printGUIDpart(myGP);
}
myGP++;
......@@ -498,7 +501,7 @@ void WriteDosBootSector(int device, int numpart, PartitionRecord *newpr, int dis
{
for (int i=1; i<numpart; i++)
{
testprint2(" copy in partn %d from %x\n",i ,(int)newpr);
testprint(" copy in partn %d from %x\n",i ,(int)newpr);
newpr++;
}
}
......
......@@ -116,7 +116,7 @@ int main (int argc,char* argv[])
int result;
result=PartitionDisc(ID, MaxPartitions, partcount, partn);
testprint1("result = %d\n",result);
testprint("result = %d\n",result);
if(CheckGPTValid(ID))
{
......@@ -145,7 +145,7 @@ void wimp_error(_kernel_oserror *er)