TempleOSTS_130707.ISO

This commit is contained in:
Terry A. Davis authored and minexew committed 2018-09-08 21:45:45 +02:00
1 parent 17b71f1a2d
commit 1343005a29
617 files changed
+14399 -25130

No files matched your search

+1 -1
View File
@@ -1,4 +1,4 @@
//See $LK-A,"::/TempleOS/Doc/Acknowledgements.TXT"$ (2).
//See $LK-A,"::/TempleOS/Doc/Acknowledgements.TXT"$.
#define ATA_NOP 0x00
#define ATA_DEV_RST 0x08
+25 -25
View File
@@ -66,16 +66,16 @@ Bool BlkDevInit(CBlkDev *bdev)
bdev->flags|=BDF_INIT_IN_PROGRESS;
switch(bdev->type) {
case BDT_RAM:
bdev->RAM_dsk=AMAlloc((bdev->max_blk+1)<<BLK_SIZE_BITS);
bdev->max_blk=MSize(bdev->RAM_dsk)>>BLK_SIZE_BITS-1;
p->type=PT_NATIVE;
if (sys_boot_code.u8[0]!=BOOT_CODE_RAM ||
!NativeFSDrvValidate(bdev->first_drv_let))
NativeFSFmt(bdev->first_drv_let);
else {
p->size=bdev->max_blk+1;
NativeFSPrtInit(p);
if (!bdev->RAM_dsk) {
bdev->RAM_dsk=AMAlloc((bdev->max_blk+1)<<BLK_SIZE_BITS);
bdev->max_blk=MSize(bdev->RAM_dsk)>>BLK_SIZE_BITS-1;
}
p->type=PT_REDSEA;
p->size=bdev->max_blk+1;
if (RedSeaFSDrvValidate(bdev->first_drv_let))
RedSeaFSPrtInit(p);
else
RedSeaFSFmt(bdev->first_drv_let);
result=TRUE;
break;
case BDT_ATA:
@@ -214,7 +214,7 @@ U0 CleanMAPBuf(CPrt *p,I64 MAP_select=-1)
WBlks(p,p->cur_map_blk(I64)+i<<BLK_SIZE_BITS,p->map2+i+p->cur_map_blk_num,1);
}
U0 SetNativeBuf(CPrt *p,I64 c,I64 map_select=-1)
U0 SetFSBuf(CPrt *p,I64 c,I64 map_select=-1)
{
I64 MAP_blk_num;
if (c==INVALID_CLUSTER)
@@ -264,7 +264,7 @@ U0 WZeroBlks(CPrt *p,I64 blk,I64 cnt)
}
//Very dangerous
Bool SetDrvType(U8 drv_let,I64 type=PT_NATIVE)
Bool SetDrvType(U8 drv_let,I64 type=PT_REDSEA)
{
I64 i,j,ext_base,prt_num,offset,cur_type;
CMasterBoot mbr;
@@ -285,8 +285,8 @@ Bool SetDrvType(U8 drv_let,I64 type=PT_NATIVE)
else {
if (prt_num+'A'==ToUpper(drv_let)) {
switch (type) {
case PT_NATIVE:
mbr.p[i].type=MBR_PT_NATIVE;
case PT_REDSEA:
mbr.p[i].type=MBR_PT_REDSEA;
break;
case PT_FAT32:
mbr.p[i].type=MBR_PT_FAT32a;
@@ -416,7 +416,7 @@ U0 ChgDsk(U8 drv_let=0)
else if (bdev->flags&BDF_REMOVABLE)
DskCacheInvalidate(p);
Drv(drv_let);
NativeFSFreeFreeLst(p);
RedSeaFSFreeFreeLst(p);
Preempt(old_preempt);
}
@@ -464,7 +464,7 @@ U0 PrtRep()
drv_let=Prt2Drv(p);
if (Bt(&p->type,PTf_DISABLE))
"$$FG,RED$$X";
else if (drv_let==dft_drv)
else if (drv_let==*sys_acct)
"$$FG,GREEN$$:";
else
'' CH_SPACE;
@@ -495,12 +495,12 @@ I64 ClusterNumNext(CPrt *p,I64 c,I64 cnt=1)
unlock=PrtLock(p);
switch (p->type) {
case PT_ISO9660:
case PT_NATIVE:
case PT_REDSEA:
c+=cnt;
break;
case PT_FAT32:
while (cnt-->0 && 0<c<0x0FFFFFF8) {
SetNativeBuf(p,c);
SetFSBuf(p,c);
c=p->cur_map_blk[c & (BLK_SIZE/4-1)];
}
if (!(0<c<0x0FFFFFF8))
@@ -534,7 +534,7 @@ I64 RClustersBlks(CPrt *p,U8 *buf,I64 c,I64 blks)
unlock=PrtLock(p);
switch (p->type) {
case PT_ISO9660:
case PT_NATIVE:
case PT_REDSEA:
RBlks(p,buf,p->data+c*p->spc,blks);
c+=(blks+p->spc-1)/p->spc;
break;
@@ -590,8 +590,8 @@ I64 Name2DirCluster(CPrt *p,U8 *dirname)
StrFirstRem(buf,"/",buf2);
if (*buf2) {
switch (p->type) {
case PT_NATIVE:
cont=NativeFSFileFind(p,cur_dir_cluster,buf2,&de,FUF_JUST_DIRS);
case PT_REDSEA:
cont=RedSeaFSFileFind(p,cur_dir_cluster,buf2,&de,FUF_JUST_DIRS);
break;
case PT_FAT32:
cont=FAT32FileFind(p,cur_dir_cluster,buf2,&de,FUF_JUST_DIRS);
@@ -636,8 +636,8 @@ I64 Name2ParentDirCluster(CPrt *p,U8 *dirname)
StrFirstRem(buf,"/",buf2);
if (*buf2) {
switch (p->type) {
case PT_NATIVE:
cont=NativeFSFileFind(p,cur_dir_cluster,buf2,&de,FUF_JUST_DIRS);
case PT_REDSEA:
cont=RedSeaFSFileFind(p,cur_dir_cluster,buf2,&de,FUF_JUST_DIRS);
break;
case PT_FAT32:
cont=FAT32FileFind(p,cur_dir_cluster,buf2,&de,FUF_JUST_DIRS);
@@ -676,7 +676,7 @@ I64 WClustersBlks(CPrt *p,U8 *buf,I64 c,I64 blks)
try {
unlock=PrtLock(p);
switch (p->type) {
case PT_NATIVE:
case PT_REDSEA:
WBlks(p,buf,p->data+c*p->spc,blks);
c=0;
break;
@@ -715,8 +715,8 @@ I64 ClusersAlloc(CPrt *p,I64 c=0,I64 cnt=1,Bool contiguous=FALSE)
PrtChk(p);
if (cnt<=0) return c;
switch (p->type) {
case PT_NATIVE:
return NativeFSAllocClusters(p,cnt);
case PT_REDSEA:
return RedSeaFSAllocClusters(p,cnt);
case PT_FAT32:
if (contiguous) {
if (c) throw(EXCEPT_FILE,3);
+20 -20
View File
@@ -25,7 +25,7 @@ Bool Drv(U8 drv_let)
Free(Fs->cur_dir);
Fs->cur_dir=StrNew("/");
switch (p->type) {
case PT_NATIVE:
case PT_REDSEA:
case PT_FAT32:
case PT_ISO9660:
return TRUE;
@@ -44,7 +44,7 @@ Bool Cd(U8 *dirname,Bool make_dirs=FALSE)
if (!*dirname) return TRUE;
if (dirname[1]==':') {
if (*dirname==':') {
if (Fs->cur_prt->drv_let!=dft_drv)
if (Fs->cur_prt->drv_let!=*sys_acct)
if (!Drv(*dirname)) return FALSE;
} else {
if (Fs->cur_prt!=
@@ -85,8 +85,8 @@ Bool Cd(U8 *dirname,Bool make_dirs=FALSE)
p=Fs->cur_prt;
cur_dir_cluster=Name2DirCluster(p,new_cur_dir);
switch (p->type) {
case PT_NATIVE:
result=NativeFSCd(buf,cur_dir_cluster);
case PT_REDSEA:
result=RedSeaFSCd(buf,cur_dir_cluster);
break;
case PT_FAT32:
result=FAT32Cd(buf,cur_dir_cluster);
@@ -248,8 +248,8 @@ I64 Del(U8 *files_find_mask,Bool print_msg=TRUE)
CFileAccess *fa;
if (fa=FileAccessNew(files_find_mask)) {
switch (fa->p->type) {
case PT_NATIVE:
result=NativeFSFilesDel(fa->p,Fs->cur_dir,fa->mask,0,FALSE,print_msg);
case PT_REDSEA:
result=RedSeaFSFilesDel(fa->p,Fs->cur_dir,fa->mask,0,FALSE,print_msg);
break;
case PT_FAT32:
result=FAT32FilesDel(fa->p,Fs->cur_dir,fa->mask,0,FALSE,print_msg);
@@ -296,8 +296,8 @@ U8 *FileRead(U8 *filename,I64 *_size=NULL,I64 *_attr=NULL,Bool raw=FALSE)
curname=altname;
if (fa=FileAccessNew(curname)) {
switch (fa->p->type) {
case PT_NATIVE:
result=NativeFSFileRead(fa->p,Fs->cur_dir,fa->mask,&size,&attr,raw,&ac);
case PT_REDSEA:
result=RedSeaFSFileRead(fa->p,Fs->cur_dir,fa->mask,&size,&attr,raw,&ac);
break;
case PT_FAT32:
result=FAT32FileRead(fa->p,Fs->cur_dir,fa->mask,&size,&attr,raw,&ac);
@@ -322,8 +322,8 @@ U8 *FileRead(U8 *filename,I64 *_size=NULL,I64 *_attr=NULL,Bool raw=FALSE)
while (!result && StrCmp(Fs->cur_dir,"/")) {
Cd("..");
switch (Fs->cur_prt->type) {
case PT_NATIVE:
result=NativeFSFileRead(fa->p,Fs->cur_dir,fa->mask,&size,&attr,raw,&ac);
case PT_REDSEA:
result=RedSeaFSFileRead(fa->p,Fs->cur_dir,fa->mask,&size,&attr,raw,&ac);
break;
case PT_FAT32:
result=FAT32FileRead(fa->p,Fs->cur_dir,fa->mask,&size,&attr,raw,&ac);
@@ -383,8 +383,8 @@ Bool FileFind(U8 *filename,CDirEntry *rde=NULL,I64 fuf_flags=0)
if (fa=FileAccessNew(curname)) {
cur_dir_cluster=Name2DirCluster(fa->p,Fs->cur_dir);
switch (fa->p->type) {
case PT_NATIVE:
result=NativeFSFileFind(fa->p,cur_dir_cluster,fa->mask,&de,fuf_flags);
case PT_REDSEA:
result=RedSeaFSFileFind(fa->p,cur_dir_cluster,fa->mask,&de,fuf_flags);
break;
case PT_FAT32:
result=FAT32FileFind(fa->p,cur_dir_cluster,fa->mask,&de,fuf_flags);
@@ -411,8 +411,8 @@ Bool FileFind(U8 *filename,CDirEntry *rde=NULL,I64 fuf_flags=0)
Cd("..");
cur_dir_cluster=Name2DirCluster(fa->p,Fs->cur_dir);
switch (fa->p->type) {
case PT_NATIVE:
result=NativeFSFileFind(fa->p,cur_dir_cluster,fa->mask,&de,fuf_flags);
case PT_REDSEA:
result=RedSeaFSFileFind(fa->p,cur_dir_cluster,fa->mask,&de,fuf_flags);
break;
case PT_FAT32:
result=FAT32FileFind(fa->p,cur_dir_cluster,fa->mask,&de,fuf_flags);
@@ -458,7 +458,7 @@ I64 FileSizeExpanded(U8 *filename,I64 fuf_flags=0)
if (FileFind(filename,&de,fuf_flags)) {
p=Drv2Prt(*de.full_name);
Free(de.full_name);
if (p->type==PT_NATIVE && de.expanded_size)
if (p->type==PT_REDSEA && de.expanded_size)
return de.expanded_size;
else {
if (de.size && FileAttr(de.name) & _ATTR_COMPRESSED) {
@@ -472,7 +472,7 @@ I64 FileSizeExpanded(U8 *filename,I64 fuf_flags=0)
}
I64 FileWrite(U8 *filename,U8 *fbuf,
I64 size,CDate spdt=0,I64 attr=0,Bool raw=FALSE)
I64 size,CDate cdt=0,I64 attr=0,Bool raw=FALSE)
{
I64 c=0;
CHashGeneric *temph;
@@ -481,13 +481,13 @@ I64 FileWrite(U8 *filename,U8 *fbuf,
U8 *absname=FileNameAbs(filename);
if (fa=FileAccessNew(filename,FALSE,TRUE)) {
switch (fa->p->type) {
case PT_NATIVE:
c=NativeFSFileWrite(fa->p,Fs->cur_dir,fa->mask,
fbuf,size,spdt,attr,raw,&ac);
case PT_REDSEA:
c=RedSeaFSFileWrite(fa->p,Fs->cur_dir,fa->mask,
fbuf,size,cdt,attr,raw,&ac);
break;
case PT_FAT32:
c=FAT32FileWrite(fa->p,Fs->cur_dir,fa->mask,
fbuf,size,spdt,attr,raw,&ac);
fbuf,size,cdt,attr,raw,&ac);
break;
case PT_ISO9660:
PutDefineErr("ST_NOT_WRITABLE");
+15 -9
View File
@@ -31,7 +31,7 @@ Bool CopySingle(U8 *f1,U8 *f2) //Just one file
{
U8 *absf1=FileNameAbs(f1),*absf2=FileNameAbs(f2),*buf;
I64 cnt,n,size,attr1=FileAttr(f1),attr2=FileAttr(f2),
xsum=NATIVE_XSUM,i,j;
xsum=TEMPLEOS_XSUM,i,j;
CFile *in_file=NULL,*out_file=NULL;
if (!StrCmp(absf1,absf2)) { //onto self?
@@ -111,8 +111,8 @@ Bool MkDir(U8 *filename)
name=MStrUtil(fa->mask,
SUF_REM_LEADING|SUF_REM_TRAILING|SUF_REM_CTRL_CHARS);
switch (fa->p->type) {
case PT_NATIVE:
result=NativeFSMkDir(fa->p,Fs->cur_dir,name);
case PT_REDSEA:
result=RedSeaFSMkDir(fa->p,Fs->cur_dir,name);
break;
case PT_FAT32:
result=FAT32MkDir(fa->p,Fs->cur_dir,name);
@@ -137,8 +137,8 @@ I64 SysDel(U8 *wild,Bool make_mask) //this is dangerous
CFileAccess *fa;
if (fa=FileAccessNew(wild,make_mask)) {
switch (fa->p->type) {
case PT_NATIVE:
result=NativeFSFilesDel(fa->p,Fs->cur_dir,fa->mask,0,TRUE,TRUE);
case PT_REDSEA:
result=RedSeaFSFilesDel(fa->p,Fs->cur_dir,fa->mask,0,TRUE,TRUE);
break;
case PT_FAT32:
result=FAT32FilesDel(fa->p,Fs->cur_dir,fa->mask,0,TRUE,TRUE);
@@ -168,11 +168,11 @@ U0 Fmt(I64 drv_let,Bool quick=TRUE,Bool confirm=TRUE,I64 type=PT_FAT32)
return;
}
switch (type) {
case PT_NATIVE:
case PT_REDSEA:
Silent(ON);
Drv(drv_let);
Silent(old_silent);
NativeFSFmt(drv_let,quick);
RedSeaFSFmt(drv_let,quick);
DskCacheInvalidate(Drv2Prt(drv_let));
Drv(drv_let);
break;
@@ -266,7 +266,10 @@ U0 CDImageWriteTask(CDualBuf *d)
n=cnt;
if (n>d->CD_bdev->max_writes)
n=d->CD_bdev->max_writes;
buf=d->in_buf&1 ? d->buf1:d->buf0;
if (d->in_buf&1)
buf=d->buf1;
else
buf=d->buf0;
while (d->in_buf>d->out_buf+1)
Yield;
FRBlks(f,buf,blk,n);
@@ -345,7 +348,10 @@ U0 CDImageWrite(U8 cd_drv_let,U8 *in_name=NULL,I64 media_type=MT_CD)
n=cnt;
if (n>bdev->max_writes)
n=bdev->max_writes;
buf=d->out_buf&1 ? d->buf1:d->buf0;
if (d->out_buf&1)
buf=d->buf1;
else
buf=d->buf0;
while (d->in_buf<=d->out_buf)
Yield;
ATAPIWriteBlks(bdev,buf,blk/spc,(n+spc-1)/spc);
+9 -18
View File
@@ -662,8 +662,6 @@ Bool BootCdProbe(CBlkDev *bdev)
Bool result=FALSE;
"Port: %04X,%04X Unit: %02X ",bdev->base0,bdev->base1,bdev->unit;
if (ATAProbe(bdev->base0,bdev->base1,bdev->unit)==BDT_ATAPI) {
//After preboot + BootCD.BIN.Z comes Kernel.BIN.C
//See $LK,"CDBOOT","FA:::/TempleOS/Adam/Dsk/DskCDDVD.CPP,CDBOOT"$, See $LK,"CD Boot Blk","FF:::/TempleOS/Adam/Boot/BootCD.CPP,BOOT_CODE_CDROM"$
" ATAPI";
if (ATAPIStartStop(bdev,TRUE,tS+5.0)) {
" Started";
@@ -774,20 +772,15 @@ U0 ATARepEntry(I64 base0,I64 base1,I64 unit,I64 irq,U8 *msg,CATARep **_root,I64
}
}
Bool hint_ata_disable=FALSE;
U0 ATARepExitAllApplications()
Bool ATARepExitAllApplications()
{
I64 ch;
PutDefine("ST_GOING_TO_PROBE_HARDWARE");
PutDefine("ST_EXIT_ALL_APPLICATIONS");
PutDefine("ST_PRESS_A_KEY");
"Press '$$FG,PURPLE$$p$$FG$$' to probe or '$$FG,PURPLE$$s$$FG$$' to skip.\n";
ch=ToUpper(GetChar(NULL,FALSE));
if (ch=='S')
hint_ata_disable=TRUE;
PutDefine("ST_PROBE_OR_SKIP");
if (ToUpper(GetChar(,FALSE))=='S')
return TRUE;
else
hint_ata_disable=FALSE;
return FALSE;
}
public I64 ATARep(Bool pmt=TRUE,Bool just_ide=FALSE,CATARep **_root=NULL)
@@ -800,9 +793,7 @@ public I64 ATARep(Bool pmt=TRUE,Bool just_ide=FALSE,CATARep **_root=NULL)
if (_root) *_root=NULL;
if (pmt)
ATARepExitAllApplications;
if (hint_ata_disable)
if (pmt && ATARepExitAllApplications)
return 0;
old_preempt=Preempt(OFF);
@@ -870,13 +861,13 @@ public I64 ATARep(Bool pmt=TRUE,Bool just_ide=FALSE,CATARep **_root=NULL)
return num_hints;
}
CATARep *ATAIDDrvs(CATARep *root,U8 _dft_drv,CATARep **_ata_drv,CATARep **_atapi_drv)
CATARep *ATAIDDrvs(CATARep *root,U8 _sys_acct_drv,CATARep **_ata_drv,CATARep **_atapi_drv)
{
CATARep *result=NULL,*tempha=root,*ata_drv=NULL,*atapi_drv=NULL;
CBlkDev *bdev;
Bool was_silent=Silent(ON);
try
bdev=Drv2BlkDev(_dft_drv);
bdev=Drv2BlkDev(_sys_acct_drv);
catch {
Fs->catch_except=TRUE;
bdev=NULL;
@@ -929,7 +920,7 @@ I64 AutoMountIDE()
I64 result=0;
CATARep *root=NULL,*ata_drv=NULL,*atapi_drv=NULL,*tempha;
ATARep(FALSE,TRUE,&root);
ATAIDDrvs(root,dft_drv,&ata_drv,&atapi_drv);
ATAIDDrvs(root,*sys_acct,&ata_drv,&atapi_drv);
if (ata_drv && ATAMount(sys_first_hd_drv_let,BDT_ATA,
ata_drv->base0,ata_drv->base1,ata_drv->unit))
result++;
+41 -26
View File
@@ -31,13 +31,13 @@ I64 BlkDevAdd(CBlkDev *bdev,Bool one_prt,Bool make_free)
if (make_free)
p=PrtMakeFree(bdev->first_drv_let+result);
else
p=PrtNextFree(bdev->first_drv_let);
p=PrtNextFree(bdev->first_drv_let+result);
p->bdev=bdev;
p->size=bdev->max_blk+1;
switch (bdev->type) {
case BDT_RAM:
p->pt_signature=PRT_SIGNATURE_VAL;
p->type=PT_NATIVE;
p->type=PT_REDSEA;
p->rblks=&RAMRBlks;
p->wblks=&RAMWBlks;
//This is to force creation of a RAM
@@ -61,7 +61,7 @@ I64 BlkDevAdd(CBlkDev *bdev,Bool one_prt,Bool make_free)
if (one_prt) {
p->pt_signature=PRT_SIGNATURE_VAL;
result++;
p->type=PT_NATIVE;
p->type=PT_REDSEA;
p->rblks=&ATARBlks;
p->wblks=&ATAWBlks;
p->size=bdev->max_blk+1;
@@ -82,18 +82,18 @@ I64 BlkDevAdd(CBlkDev *bdev,Bool one_prt,Bool make_free)
if (make_free)
p=PrtMakeFree(bdev->first_drv_let+result);
else
p=PrtNextFree(bdev->first_drv_let);
p=PrtNextFree(bdev->first_drv_let+result);
p->bdev=bdev;
p->rblks=&ATARBlks;
p->wblks=&ATAWBlks;
p->offset=mbr.p[i].offset+offset;
p->size =mbr.p[i].size;
switch (mbr.p[i].type) {
case MBR_PT_NATIVE:
case MBR_PT_REDSEA:
p->pt_signature=PRT_SIGNATURE_VAL;
result++;
p->type=PT_NATIVE;
NativeFSPrtInit(p);
p->type=PT_REDSEA;
RedSeaFSPrtInit(p);
break;
case MBR_PT_FAT32a:
case MBR_PT_FAT32b:
@@ -104,9 +104,9 @@ I64 BlkDevAdd(CBlkDev *bdev,Bool one_prt,Bool make_free)
ATAReadBlks(bdev,&br,p->offset,1);
p->pt_signature=PRT_SIGNATURE_VAL;
result++;
if (br.signature==MBR_PT_NATIVE) {
p->type=PT_NATIVE;
NativeFSPrtInit(p);
if (br.signature==MBR_PT_REDSEA) {
p->type=PT_REDSEA;
RedSeaFSPrtInit(p);
} else {
p->type=PT_FAT32;
FAT32PrtInit(p);
@@ -185,7 +185,7 @@ U0 Mount(Bool repartition=FALSE)
{
CBlkDev *bdev;
I64 first_prt_num,type,unit,num_hints;
U8 blks_buf[32],base0_buf[128],base1_buf[128];
U8 blks_buf[128],addr_buf[128],base0_buf[128],base1_buf[128];
Bool add;
CATARep *root,*tempha;
@@ -201,7 +201,7 @@ U0 Mount(Bool repartition=FALSE)
unit=0;
if (type==BDT_ATA || type==BDT_ATAPI) {
num_hints=ATARep(TRUE,,&root);
num_hints=ATARep(,,&root);
do {
if (num_hints)
PutDefine("ST_MOUNT_BASE0_HINT");
@@ -231,15 +231,20 @@ U0 Mount(Bool repartition=FALSE)
LinkedLstDel(root);
}
if (type==BDT_RAM) {
PutDefine("ST_MOUNT_ADDR");
GetS(addr_buf,128);
PutDefine("ST_MOUNT_BLKS");
GetS(blks_buf,32);
GetS(blks_buf,128);
}
if (BDT_NULL<type<BDT_NUM_TYPES && 0<=unit<=1) {
bdev=BlkDevNextFree(first_prt_num+'A',type);
bdev->unit=unit;
if (type==BDT_RAM)
if (type==BDT_RAM) {
if (!*addr_buf) StrCpy(addr_buf,"0");
bdev->RAM_dsk=A2I(addr_buf);
bdev->max_blk=A2I(blks_buf)-1;
}
if (type==BDT_ATA ||
type==BDT_ATAPI) {
bdev->base0=A2I(base0_buf);
@@ -269,7 +274,10 @@ I64 SysPmtI64()
U8 st[136];
StrCpy(st,"0x");
GetS(st+2,134,FALSE);
return A2I(st);
if (!st[2])
return 0;
else
return A2I(st);
}
Bool PmtBaseUnit(CBlkDev *bdev)
@@ -287,12 +295,19 @@ Bool PmtBaseUnit(CBlkDev *bdev)
PutDefine("ST_CDROM_PORTS_PMT1");
bdev->base0=SysPmtI64;
bdev->base1=0;
"\nUnit (0 or 1): ";
do ch=GetChar(NULL,FALSE);
while (!('0'<=ch<='1'));
'' ch;
bdev->unit=ch-'0';
return TRUE;
bdev->unit =0;
if (bdev->base0) {
"\nUnit (0 or 1): ";
do ch=GetChar(,FALSE);
while (!('0'<=ch<='1'));
'' ch;
bdev->unit=ch-'0';
cdrom_boot_is_good=BootCdProbe(bdev);
return TRUE;
} else {
cdrom_boot_is_good=FALSE;
return FALSE;
}
}
return FALSE;
}
@@ -307,11 +322,11 @@ U0 BlkDevsInitAll()
drv_to_prt[i]=&sys_prts[i];
sys_raw_dc_col=0;
#exe {
if (kernel_cfg->opts[CFG_AUTO_MOUNT_IDE])
StreamPutS("AutoMountIDE;");
StreamPutS("#exe {OptOff(OPTf_WARN_PAREN);}");
StreamDoc(kernel_cfg->add_dev);
StreamPutS("#exe {OptOn(OPTf_WARN_PAREN);}");
if (kernel_cfg->opts[CFG_AUTO_MOUNT_IDE])
StreamPutS("AutoMountIDE;");
StreamPutS("#exe {OptOff(OPTf_WARN_PAREN);}");
StreamDoc(kernel_cfg->add_dev);
StreamPutS("#exe {OptOn(OPTf_WARN_PAREN);}");
};
PrtRep;
}
+11 -5
View File
@@ -22,11 +22,11 @@ CFile *FOpen(U8 *filename,U8 *flags,I64 cnt=0)
f->file_cluster_num=INVALID_CLUSTER;
full_name=FileNameAbs(filename);
f->p=Drv2Prt(*full_name);
if (f->p->type==PT_NATIVE)
if (f->p->type==PT_REDSEA)
contiguous=TRUE;
if (contiguous) {
f->flags|=FF_CONTIGUOUS;
if (f->p->type!=PT_NATIVE) {
if (f->p->type!=PT_REDSEA) {
if (!(FileAttr(filename) & _ATTR_CONTIGUOUS))
throw(EXCEPT_FILE,2);
}
@@ -82,7 +82,7 @@ U0 FClose(CFile *f)
if (f->flags & FF_NEEDS_WRITE) {
if (fa=FileAccessNew(f->de.full_name)) {
if (!(f->flags & FF_USE_OLD_DATETIME))
f->de.datetime=GetCurTimeCDate;
f->de.datetime=GetCurTimeDate;
if (f->flags & FF_NEW_FILE)
CDirNew(fa->p,Fs->cur_dir,&f->de,TRUE);
else
@@ -152,7 +152,10 @@ Bool FRBlks(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
if (i=blk%spc) {
c=FSetCluster(f,c,blk,TRUE);
j= cnt<spc-i ? cnt:spc-i;
if (cnt<spc-i)
j=cnt;
else
j=spc-i;
MemCpy(buf,f->cluster_buf+i<<BLK_SIZE_BITS,j<<BLK_SIZE_BITS);
buf+=j<<BLK_SIZE_BITS;
cnt-=j;
@@ -218,7 +221,10 @@ Bool FWBlks(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
if (i=blk%spc) {
FSetCluster(f,c,blk,TRUE);
j=cnt<spc-i ? cnt:spc-i;
if (cnt<spc-i)
j=cnt;
else
j=spc-i;
MemCpy(f->cluster_buf+BLK_SIZE*i,buf,j<<BLK_SIZE_BITS);
f->flags|=FF_BUF_DIRTY;
buf+=j<<BLK_SIZE_BITS;
+5 -5
View File
@@ -1,8 +1,8 @@
Bool CDirNew(CPrt *p,U8 *cur_dir,CDirEntry *tempm,Bool free_old_chain=TRUE)
{
switch (p->type) {
case PT_NATIVE:
return NativeFSDirNew(p,cur_dir,tempm,free_old_chain);
case PT_REDSEA:
return RedSeaFSDirNew(p,cur_dir,tempm,free_old_chain);
case PT_FAT32:
return FAT32DirNew(p,cur_dir,tempm,free_old_chain);
case PT_ISO9660:
@@ -151,8 +151,8 @@ CDirEntry *SysFilesFind(U8 *files_find_mask,I64 fuf_flags)
CDirEntry *result=NULL;
PrtChk(p);
switch (p->type) {
case PT_NATIVE:
result=NativeFSFilesFind(files_find_mask,fuf_flags);
case PT_REDSEA:
result=RedSeaFSFilesFind(files_find_mask,fuf_flags);
break;
case PT_FAT32:
result=FAT32FilesFind(files_find_mask,fuf_flags);
@@ -237,7 +237,7 @@ U0 Dir2(U8 *files_find_mask,I64 fuf_flags,Bool full)
esize=Bsr(esize)/4+1;
c=Bsr(c)/4+1;
"$$MA+A,\"Directory \",\"PopUpCd;Dir;\n\"$$ of %s\n",st;
"$$MA+A,\"Directory\",\"PopUpCd;Dir;\n\"$$ of %s\n",st;
if (full)
"__DATE__ __TIME__ %*ts %*ts %*ts\n",
csize,"SIZE",esize,"UNCMPSIZE",c,"CLUSTER";
+6 -5
View File
@@ -100,7 +100,7 @@ CPrt *Drv2Prt(U8 drv_let=0)
p=Fs->cur_prt;
else {
if (drv_let==':')
drv_let=dft_drv;
drv_let=*sys_acct;
p=drv_to_prt[ToUpper(drv_let)-'A'];
}
PrtChk(p);
@@ -159,7 +159,7 @@ U8 *DirNameAbs(U8 *_dirname)
drv[2]=0;
if (*dirname && dirname[1]==':') {
if (*dirname==':')
*drv=dft_drv;
*drv=*sys_acct;
else
*drv=*dirname;
dirname=dirname+2;
@@ -267,18 +267,19 @@ U8 *DftExt(U8 *filename,U8 *extension)
return result;
}
CDirEntry *CdDir(CDirEntry *tempm,U8 *abs_name)
CDirEntry *Cd2DirEntry(CDirEntry *tempm,U8 *abs_name)
{
I64 i;
while (tempm) {
i=StrLen(tempm->full_name);
if (StrNCmp(tempm->full_name,abs_name,i))
if (StrNCmp(tempm->full_name,abs_name,i)||
i && tempm->full_name[i-1]!='/' && abs_name[i] && abs_name[i]!='/')
tempm=tempm->next;
else
if (StrLen(abs_name)==i)
return tempm;
else
return CdDir(tempm->sub,abs_name);
return Cd2DirEntry(tempm->sub,abs_name);
}
return NULL;
}
+25 -22
View File
@@ -1,7 +1,7 @@
U0 CDate2Dos(U16 *t,U16 *d,CDate spdt)
U0 CDate2Dos(U16 *t,U16 *d,CDate cdt)
{
CDateStruct ds;
CDate2CDateStruct(&ds,spdt+local_time_offset);
Date2DateStruct(&ds,cdt+local_time_offset);
*d=ds.day_of_mon+(ds.mon+(ds.year-1980)<<4)<<5;
*t=ds.sec>>1+(ds.min+ds.hour<<6)<<5;
}
@@ -16,7 +16,7 @@ CDate Dos2CDate(U16 t,U16 d)
ds.sec=(t&0x1F)*2; t=t>>5;
ds.min=t&0x3F;
ds.hour=t>>6;
return CDateStruct2CDate(&ds)-local_time_offset;
return DateStruct2Date(&ds)-local_time_offset;
}
U0 FAT32PrtInit(CPrt *p)
@@ -71,9 +71,9 @@ U0 FAT32Fmt(U8 drv_let,Bool quick=TRUE)
PrtLock(p);
SetDrvType(drv_let,PT_FAT32);
p->type=PT_FAT32;
br->jump_and_nop[0]=0xEB;
br->jump_and_nop[1]=0x58;
br->jump_and_nop[2]=0x90;
br->jump_and_nop[0]=OC_JMP_REL8;
br->jump_and_nop[1]=offset(CFAT32Boot.code)-2;
br->jump_and_nop[2]=OC_NOP;
MemCpy(br->oem_name,"MSWIN4.1",8);
br->bytes_per_sect=BLK_SIZE;
if (p->size<= 500000)
@@ -163,7 +163,10 @@ I64 FATNameXSum(U8 *src)
{
I64 i,result=0;
for (i=0;i<11;i++)
result.u8[0]=(result&1?0x80:0)+result>>1+*src++;
if (result&1)
result.u8[0]=0x80+result>>1+*src++;
else
result.u8[0]=result>>1+*src++;
return result;
}
@@ -288,7 +291,7 @@ Bool FAT32DirFill(CFAT32DirEntry *de,CDirEntry *tempm,I64 *_de_cnt=NULL)
de[de_cnt].size=tempm->size;
de[de_cnt].attr=tempm->attr;
if (!tempm->datetime)
tempm->datetime=GetCurTimeCDate;
tempm->datetime=GetCurTimeDate;
CDate2Dos(&de[de_cnt].WrtTime,&de[de_cnt].WrtDate,tempm->datetime);
if (_de_cnt)
*_de_cnt=de_cnt+1;
@@ -447,7 +450,7 @@ U0 FAT32FreeClusters(CPrt *p,I64 c)
unlock=PrtLock(p);
CleanMAPBuf(p);
do {
SetNativeBuf(p,c,0);
SetFSBuf(p,c,0);
next=p->cur_map_blk[c&(BLK_SIZE/4-1)];
p->cur_map_blk[c&(BLK_SIZE/4-1)]=0;
LBts(p->buffered_map_dirty_bits,0);
@@ -457,7 +460,7 @@ U0 FAT32FreeClusters(CPrt *p,I64 c)
c=saved_c;
do {
SetNativeBuf(p,c,1);
SetFSBuf(p,c,1);
next=p->cur_map_blk[c&(BLK_SIZE/4-1)];
p->cur_map_blk[c&(BLK_SIZE/4-1)]=0;
LBts(p->buffered_map_dirty_bits,0);
@@ -498,14 +501,14 @@ I64 FAT32AllocClusters(CPrt *p,I64 c,I64 cnt)
j=1;
wrap_around=TRUE;
}
SetNativeBuf(p,j);
SetFSBuf(p,j);
if (!p->cur_map_blk[j&(BLK_SIZE/4-1)])
break;
}
if (!(0<first<0x0FFFFFF8))
first=j;
if (0<c<l) {
SetNativeBuf(p,c);
SetFSBuf(p,c);
p->cur_map_blk[c&(BLK_SIZE/4-1)]=j;
LBts(p->buffered_map_dirty_bits,0);
}
@@ -513,7 +516,7 @@ I64 FAT32AllocClusters(CPrt *p,I64 c,I64 cnt)
}
if (0<c<l) {
SetNativeBuf(p,c);
SetFSBuf(p,c);
p->cur_map_blk[c&(BLK_SIZE/4-1)]=0x0FFFFFFF;
LBts(p->buffered_map_dirty_bits,0);
}
@@ -552,7 +555,7 @@ I64 FAT32AllocContiguousClusters(CPrt *p,I64 cnt)
while (cont && i<cnt) {
if ((first+i+1)*p->spc+p->data>p->size+p->offset)
Dbg;
SetNativeBuf(p,first+i);
SetFSBuf(p,first+i);
if (p->cur_map_blk[(first+i)&(BLK_SIZE/4-1)])
cont=FALSE;
else
@@ -564,7 +567,7 @@ I64 FAT32AllocContiguousClusters(CPrt *p,I64 cnt)
CleanMAPBuf(p);
for (i=0;i<cnt;i++) {
SetNativeBuf(p,first+i,0);
SetFSBuf(p,first+i,0);
if (i+1==cnt)
p->cur_map_blk[(first+i)&(BLK_SIZE/4-1)]=0x0FFFFFFF;
else
@@ -574,7 +577,7 @@ I64 FAT32AllocContiguousClusters(CPrt *p,I64 cnt)
CleanMAPBuf(p,0);
for (i=0;i<cnt;i++) {
SetNativeBuf(p,first+i,1);
SetFSBuf(p,first+i,1);
if (i+1==cnt)
p->cur_map_blk[(first+i)&(BLK_SIZE/4-1)]=0x0FFFFFFF;
else
@@ -834,7 +837,7 @@ I64 FAT32FilesDel(CPrt *p,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
}
I64 FAT32FileWrite(CPrt *p,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
CDate spdt=0,I64 attr=0,Bool raw=FALSE,
CDate cdt=0,I64 attr=0,Bool raw=FALSE,
CArcCompress **_ac2=NULL)
{
CDirEntry de;
@@ -844,8 +847,8 @@ I64 FAT32FileWrite(CPrt *p,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
MemSet(&de,0,sizeof(CDirEntry));
if (_ac2) *_ac2=NULL;
if (size<0) size=0;
if (!spdt)
spdt=GetCurTimeCDate;
if (!cdt)
cdt=GetCurTimeDate;
if (p->type!=PT_FAT32)
PutDefine("ST_NOT_FAT32");
else if (!CFileNameTo(de.name,name))
@@ -869,7 +872,7 @@ I64 FAT32FileWrite(CPrt *p,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
c=0x0FFFFFFF;
de.cluster=c;
de.attr=attr;
de.datetime=spdt;
de.datetime=cdt;
if (blk_cnt)
WClustersBlks(p,buf,c,blk_cnt);
FAT32DirNew(p,cur_dir,&de,TRUE);
@@ -979,7 +982,7 @@ Bool FAT32MkDir(CPrt *p,U8 *cur_dir,U8 *name)
d_native.name[1]=0;
d_native.cluster=c;
d_native.size=0;
d_native.datetime=GetCurTimeCDate;
d_native.datetime=GetCurTimeDate;
FAT32DirFill(dFAT,&d_native);
dFAT++;
@@ -990,7 +993,7 @@ Bool FAT32MkDir(CPrt *p,U8 *cur_dir,U8 *name)
d_native.name[2]=0;
d_native.cluster=cur_dir_cluster;
d_native.size=0;
d_native.datetime=GetCurTimeCDate;
d_native.datetime=GetCurTimeDate;
FAT32DirFill(dFAT,&d_native);
WClusters(p,buf,c,1);
Free(buf);
+3 -3
View File
@@ -57,10 +57,10 @@ ipi_done:
return result;
}
U0 CDate2ISO1(CISO1Date *dst,CDate spdt)
U0 Date2ISO1(CISO1Date *dst,CDate cdt)
{
CDateStruct ds;
CDate2CDateStruct(&ds,spdt);
Date2DateStruct(&ds,cdt);
dst->year=ds.year-ISO1_BASE_YEAR;
dst->mon=ds.mon;
dst->day=ds.day_of_mon;
@@ -81,7 +81,7 @@ CDate ISO1DateStruct2CDate(CISO1Date *dt)
ds.sec=dt->sec;
ds.min=dt->min;
ds.hour=dt->hour;
return CDateStruct2CDate(&ds);
return DateStruct2Date(&ds);
}
Bool ISO1FromName(U8 *dst,U8 *src)
@@ -1,4 +1,4 @@
U0 NativeFSFreeFreeLst(CPrt *p)
U0 RedSeaFSFreeFreeLst(CPrt *p)
{
CFreeLst *tempf,*tempf1;
Bool unlock;
@@ -20,7 +20,7 @@ U0 NativeFSFreeFreeLst(CPrt *p)
PrtUnlock(p);
}
U0 NativeFSFreeLstBuild(CPrt *p)
U0 RedSeaFSFreeLstBuild(CPrt *p)
{
Bool unlock;
CFreeLst *tempf;
@@ -30,13 +30,13 @@ U0 NativeFSFreeLstBuild(CPrt *p)
try {
unlock=PrtLock(p);
if (p->next_free)
NativeFSFreeFreeLst(p);
RedSeaFSFreeFreeLst(p);
p->next_free=&p->next_free;
p->last_free=&p->next_free;
while (first<max_cluster) {
i=0; //count free clusters
while (first+i<max_cluster) {
SetNativeBuf(p,first+i);
SetFSBuf(p,first+i);
if (Bt(p->cur_map_blk,(first+i)&(BLK_SIZE<<3-1)))
break;
else
@@ -57,18 +57,18 @@ U0 NativeFSFreeLstBuild(CPrt *p)
PrtUnlock(p);
}
U0 NativeFSPrtInit(CPrt *p)
U0 RedSeaFSPrtInit(CPrt *p)
{
CBootStruct br;
Bool unlock;
try {
unlock=PrtLock(p);
RBlks(p,&br,p->offset,1);
if (br.signature!=MBR_PT_NATIVE ||
if (br.signature!=MBR_PT_REDSEA ||
br.signature2!=0xAA55)
throw(EXCEPT_PRT,7);
p->type=PT_NATIVE;
NativeFSFreeFreeLst(p);
p->type=PT_REDSEA;
RedSeaFSFreeFreeLst(p);
p->spc=br.sects_per_cluster;
p->size=br.sects;
p->data=p->offset+1+br.bitmap_sects-p->spc;
@@ -83,16 +83,16 @@ U0 NativeFSPrtInit(CPrt *p)
PrtUnlock(p);
}
Bool NativeFSDrvValidate(U8 drv_let)
Bool RedSeaFSDrvValidate(U8 drv_let)
{
CPrt *p;
CBootStruct br;
Bool result=FALSE;
try {
p=Drv2Prt(drv_let);
if (p->type==PT_NATIVE &&
if (p->type==PT_REDSEA &&
RBlks(p,&br,p->offset,1) &&
br.signature==MBR_PT_NATIVE &&
br.signature==MBR_PT_REDSEA &&
br.signature2==0xAA55 &&
br.sects==p->size)
result=TRUE;
@@ -101,7 +101,7 @@ Bool NativeFSDrvValidate(U8 drv_let)
return result;
}
U0 NativeFSFmt(U8 drv_let,Bool quick=TRUE)
U0 RedSeaFSFmt(U8 drv_let,Bool quick=TRUE)
{
U8 *root_dir;
CDirEntry *d_native;
@@ -110,9 +110,9 @@ U0 NativeFSFmt(U8 drv_let,Bool quick=TRUE)
I64 i,n;
try {
PrtLock(p);
// SetDrvType(drv_let,PT_NATIVE);
// SetDrvType(drv_let,PT_REDSEA);
SetDrvType(drv_let,PT_FAT32);
p->type=PT_NATIVE;
p->type=PT_REDSEA;
br->U8s_per_sect=BLK_SIZE;
if (p->size<0x20000)
br->sects_per_cluster=1;
@@ -127,7 +127,7 @@ U0 NativeFSFmt(U8 drv_let,Bool quick=TRUE)
else
br->sects_per_cluster=32;
br->signature=MBR_PT_NATIVE;
br->signature=MBR_PT_REDSEA;
br->signature2=0xAA55;
br->sects=p->size;
n=br->sects_per_cluster*(BLK_SIZE<<3);
@@ -143,7 +143,7 @@ U0 NativeFSFmt(U8 drv_let,Bool quick=TRUE)
WZeroBlks(p,p->offset,i);
WBlks(p,br,p->offset,1);
NativeFSPrtInit(p);
RedSeaFSPrtInit(p);
ClusersAlloc(p,0,1,FALSE); //Alloc #1
br->root_cluster=ClusersAlloc(p,0,1,FALSE);
WBlks(p,br,p->offset,1);
@@ -156,7 +156,7 @@ U0 NativeFSFmt(U8 drv_let,Bool quick=TRUE)
d_native->cluster=br->root_cluster;
d_native->size=p->spc<<BLK_SIZE_BITS;
d_native->expanded_size=d_native->size;
d_native->datetime=GetCurTimeCDate;
d_native->datetime=GetCurTimeDate;
d_native(U8 *)+=CDIR_SIZE;
@@ -164,10 +164,10 @@ U0 NativeFSFmt(U8 drv_let,Bool quick=TRUE)
d_native->name[1]='.';
d_native->attr=_ATTR_DIR|_ATTR_CONTIGUOUS;
d_native->cluster=br->root_cluster;
d_native->datetime=GetCurTimeCDate;
d_native->datetime=GetCurTimeDate;
WBlks(p,root_dir,p->data+br->root_cluster*p->spc,p->spc);
NativeFSPrtInit(p);
RedSeaFSPrtInit(p);
PrtUnlock(p);
} catch
PrtUnlock(p);
@@ -175,7 +175,7 @@ U0 NativeFSFmt(U8 drv_let,Bool quick=TRUE)
Free(root_dir);
}
Bool NativeFSFileFind(CPrt *p,I64 cur_dir_cluster,U8 *name,CDirEntry *_result,I64 fuf_flags=0)
Bool RedSeaFSFileFind(CPrt *p,I64 cur_dir_cluster,U8 *name,CDirEntry *_result,I64 fuf_flags=0)
{ //$LK,"FUF_JUST_DIRS","MN:FUF_JUST_DIRS"$, $LK,"FUF_JUST_FILES","MN:FUF_JUST_FILES"$
CDirEntry *buf,*buf2,*ptr;
U8 dname[CDIR_FILENAME_LEN];
@@ -185,8 +185,8 @@ Bool NativeFSFileFind(CPrt *p,I64 cur_dir_cluster,U8 *name,CDirEntry *_result,I6
throw(EXCEPT_FUF,10);
MemSet(_result,0,sizeof(CDirEntry));
PrtChk(p);
if (p->type!=PT_NATIVE)
PutDefineErr("ST_NOT_NATIVE");
if (p->type!=PT_REDSEA)
PutDefineErr("ST_NOT_REDSEA");
else if (!CFileNameTo(dname,name))
PutDefineErr("ST_INVALID_FILENAME");
else {
@@ -229,7 +229,7 @@ exit_this:
U8 *NativeFSFileRead(CPrt *p,U8 *cur_dir,U8 *filename,I64 *_size,
U8 *RedSeaFSFileRead(CPrt *p,U8 *cur_dir,U8 *filename,I64 *_size,
I64 *_attr,Bool raw,CArcCompress **_ac2)
{
U8 *buf=NULL;
@@ -241,20 +241,20 @@ U8 *NativeFSFileRead(CPrt *p,U8 *cur_dir,U8 *filename,I64 *_size,
if (_size) *_size=0;
if (_ac2) *_ac2=NULL;
if (_attr) *_attr=0;
if (p->type!=PT_NATIVE)
PutDefineErr("ST_NOT_NATIVE");
if (p->type!=PT_REDSEA)
PutDefineErr("ST_NOT_REDSEA");
else {
try {
PrtLock(p);
cur_dir_cluster=Name2DirCluster(p,cur_dir);
if (NativeFSFileFind(p,cur_dir_cluster,filename,&de,FUF_JUST_FILES)) {
if (RedSeaFSFileFind(p,cur_dir_cluster,filename,&de,FUF_JUST_FILES)) {
if (_attr) *_attr=de.attr;
blk_cnt=(de.size+BLK_SIZE-1)>>BLK_SIZE_BITS;
buf=MAlloc(blk_cnt<<BLK_SIZE_BITS+1);
c=de.cluster;
c=RClustersBlks(p,buf,c,blk_cnt);
if (de.xsum) {
if (de.xsum^ArcXSum(buf,de.size) !=NATIVE_XSUM)
if (de.xsum^ArcXSum(buf,de.size) !=TEMPLEOS_XSUM)
throw(EXCEPT_ARC_XSUM);
}
if (FileAttr(de.name) & _ATTR_COMPRESSED && !raw) {
@@ -281,13 +281,13 @@ U8 *NativeFSFileRead(CPrt *p,U8 *cur_dir,U8 *filename,I64 *_size,
return buf;
}
Bool NativeFSCd(U8 *name,I64 cur_dir_cluster)
Bool RedSeaFSCd(U8 *name,I64 cur_dir_cluster)
{
CDirEntry de;
if (Fs->cur_prt->type!=PT_NATIVE)
PutDefineErr("ST_NOT_NATIVE");
if (Fs->cur_prt->type!=PT_REDSEA)
PutDefineErr("ST_NOT_REDSEA");
else {
if (NativeFSFileFind(Fs->cur_prt,cur_dir_cluster,
if (RedSeaFSFileFind(Fs->cur_prt,cur_dir_cluster,
name,&de,FUF_JUST_DIRS))
return TRUE;
else {
@@ -298,20 +298,20 @@ Bool NativeFSCd(U8 *name,I64 cur_dir_cluster)
return FALSE;
}
U0 NativeFSFreeClusters(CPrt *p,I64 c,I64 cnt)
U0 RedSeaFSFreeClusters(CPrt *p,I64 c,I64 cnt)
{
CFreeLst *tempf;
Bool found=FALSE,unlock,unlock_break;
PrtChk(p);
if (!c) return;
if (p->type!=PT_NATIVE)
PutDefineErr("ST_NOT_NATIVE");
if (p->type!=PT_REDSEA)
PutDefineErr("ST_NOT_REDSEA");
else {
try {
unlock_break=BreakLock;
unlock=PrtLock(p);
if (!p->next_free)
NativeFSFreeLstBuild(p);
RedSeaFSFreeLstBuild(p);
tempf=p->next_free;
while (!found && tempf!=&p->next_free) {
if (tempf->start+tempf->size==c) {
@@ -331,7 +331,7 @@ U0 NativeFSFreeClusters(CPrt *p,I64 c,I64 cnt)
QueIns(tempf,p->last_free);
}
while (cnt-->0) {
SetNativeBuf(p,c);
SetFSBuf(p,c);
LBtr(p->cur_map_blk,c&(BLK_SIZE<<3-1));
LBts(p->buffered_map_dirty_bits,0);
c++;
@@ -351,7 +351,7 @@ U0 NativeFSFreeClusters(CPrt *p,I64 c,I64 cnt)
}
}
I64 NativeFSAllocClusters(CPrt *p,I64 cnt)
I64 RedSeaFSAllocClusters(CPrt *p,I64 cnt)
{
CFreeLst *tempf,*best_free=NULL;
I64 i,first,best_size=MAX_I64;
@@ -362,7 +362,7 @@ I64 NativeFSAllocClusters(CPrt *p,I64 cnt)
unlock_break=BreakLock;
unlock=PrtLock(p);
if (!p->next_free)
NativeFSFreeLstBuild(p);
RedSeaFSFreeLstBuild(p);
tempf=p->next_free;
while (tempf!=&p->next_free) {
if (tempf->size>=cnt && tempf->size<best_size) {
@@ -377,7 +377,7 @@ I64 NativeFSAllocClusters(CPrt *p,I64 cnt)
Dbg;
first=best_free->start;
for (i=0;i<cnt;i++) {
SetNativeBuf(p,first+i);
SetFSBuf(p,first+i);
LBts(p->cur_map_blk,(first+i)&(BLK_SIZE<<3-1));
LBts(p->buffered_map_dirty_bits,0);
}
@@ -402,7 +402,7 @@ I64 NativeFSAllocClusters(CPrt *p,I64 cnt)
}
Bool NativeFSDirNew(CPrt *p,U8 *cur_dir,CDirEntry *de,Bool free_old_chain)
Bool RedSeaFSDirNew(CPrt *p,U8 *cur_dir,CDirEntry *de,Bool free_old_chain)
{
CDirEntry *buf,*buf2,*ptr,de2;
CBootStruct *br;
@@ -434,7 +434,7 @@ Bool NativeFSDirNew(CPrt *p,U8 *cur_dir,CDirEntry *de,Bool free_old_chain)
else {
buf2=CAlloc(dir_size+p->spc<<BLK_SIZE_BITS);
MemCpy(buf2,buf,dir_size);
NativeFSFreeClusters(p,cur_dir_cluster,
RedSeaFSFreeClusters(p,cur_dir_cluster,
(dir_size>>BLK_SIZE_BITS+p->spc-1)/p->spc);
dir_size+=p->spc<<BLK_SIZE_BITS;
c=ClusersAlloc(p,0,(dir_size>>BLK_SIZE_BITS+p->spc-1)/p->spc,TRUE);
@@ -460,12 +460,12 @@ Bool NativeFSDirNew(CPrt *p,U8 *cur_dir,CDirEntry *de,Bool free_old_chain)
Free(parent_dir);
parent_dir=StrNew("/");
}
if (NativeFSFileFind(p,Name2DirCluster(p,parent_dir),
if (RedSeaFSFileFind(p,Name2DirCluster(p,parent_dir),
temp,&de2,FUF_JUST_DIRS)) {
de2.cluster=c;
de2.size=dir_size;
de2.expanded_size=dir_size;
NativeFSDirNew(p,parent_dir,&de2,FALSE);
RedSeaFSDirNew(p,parent_dir,&de2,FALSE);
} else
Dbg;
Free(temp);
@@ -483,7 +483,7 @@ Bool NativeFSDirNew(CPrt *p,U8 *cur_dir,CDirEntry *de,Bool free_old_chain)
} else {
if (!StrCmp(de->name,ptr->name)) {
if (free_old_chain)
NativeFSFreeClusters(p,ptr->cluster,
RedSeaFSFreeClusters(p,ptr->cluster,
(ptr->size+p->spc<<BLK_SIZE_BITS-1)/p->spc<<BLK_SIZE_BITS);
if (!written)
MemCpy(&ptr->start,&de->start,CDIR_SIZE);
@@ -514,7 +514,7 @@ Bool NativeFSDirNew(CPrt *p,U8 *cur_dir,CDirEntry *de,Bool free_old_chain)
return FALSE;
}
I64 NativeFSFilesDel(CPrt *p,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
I64 RedSeaFSFilesDel(CPrt *p,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
Bool del_dir,Bool print_msg)
{
CDirEntry *buf,*buf2,*ptr;
@@ -550,7 +550,7 @@ I64 NativeFSFilesDel(CPrt *p,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
ptr->attr|=_ATTR_DELETED;
WBlks(p,buf(U8 *)+j<<BLK_SIZE_BITS,
p->data+cur_dir_cluster*p->spc+j,1);
NativeFSFreeClusters(p,ptr->cluster,
RedSeaFSFreeClusters(p,ptr->cluster,
(ptr->size+p->spc<<BLK_SIZE_BITS-1)/p->spc<<BLK_SIZE_BITS);
}
ptr(U8 *)+=CDIR_SIZE;
@@ -571,8 +571,8 @@ I64 NativeFSFilesDel(CPrt *p,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
return result;
}
I64 NativeFSFileWrite(CPrt *p,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
CDate spdt,I64 attr,Bool raw,
I64 RedSeaFSFileWrite(CPrt *p,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
CDate cdt,I64 attr,Bool raw,
CArcCompress **_ac2)
{
CDirEntry de;
@@ -582,15 +582,15 @@ I64 NativeFSFileWrite(CPrt *p,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
MemSet(&de,0,sizeof(CDirEntry));
if (_ac2) *_ac2=NULL;
if (size<0) size=0;
if (!spdt)
spdt=GetCurTimeCDate;
if (!cdt)
cdt=GetCurTimeDate;
if (p->type!=PT_NATIVE)
PutDefineErr("ST_NOT_NATIVE");
if (p->type!=PT_REDSEA)
PutDefineErr("ST_NOT_REDSEA");
else if (!CFileNameTo(de.name,name))
PutDefineErr("ST_INVALID_FILENAME");
else {
NativeFSFilesDel(p,cur_dir,de.name,0,FALSE,FALSE);
RedSeaFSFilesDel(p,cur_dir,de.name,0,FALSE,FALSE);
attr=FileAttr(name,attr);
attr|=_ATTR_CONTIGUOUS;
contiguous=TRUE;
@@ -601,17 +601,17 @@ I64 NativeFSFileWrite(CPrt *p,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
buf=ac;
}
de.size=size;
de.xsum=ArcXSum(buf,size)^NATIVE_XSUM;
de.xsum=ArcXSum(buf,size)^TEMPLEOS_XSUM;
if (blk_cnt=(size+BLK_SIZE-1)>>BLK_SIZE_BITS)
c=ClusersAlloc(p,0,(blk_cnt+p->spc-1)/p->spc,contiguous);
else
c=INVALID_CLUSTER;
de.cluster=c;
de.attr=attr;
de.datetime=spdt;
de.datetime=cdt;
if (blk_cnt)
WClustersBlks(p,buf,c,blk_cnt);
NativeFSDirNew(p,cur_dir,&de,TRUE);
RedSeaFSDirNew(p,cur_dir,&de,TRUE);
if (_ac2)
*_ac2=ac;
else
@@ -620,7 +620,7 @@ I64 NativeFSFileWrite(CPrt *p,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
return c;
}
CDirEntry *NativeFSFilesFind(U8 *files_find_mask,I64 fuf_flags,CDirEntry *parent=NULL)
CDirEntry *RedSeaFSFilesFind(U8 *files_find_mask,I64 fuf_flags,CDirEntry *parent=NULL)
{
CPrt *p=Fs->cur_prt;
CDirEntry *buf,*buf2,*ptr,*result=NULL,*tempm;
@@ -657,7 +657,7 @@ CDirEntry *NativeFSFilesFind(U8 *files_find_mask,I64 fuf_flags,CDirEntry *parent
tempm->full_name=DirNameAbs(tempm->name);
PrtUnlock(p);
if (Cd(tempm->name)) {
tempm->sub=NativeFSFilesFind(files_find_mask,fuf_flags,tempm);
tempm->sub=RedSeaFSFilesFind(files_find_mask,fuf_flags,tempm);
Cd("..");
}
PrtLock(p);
@@ -679,7 +679,7 @@ CDirEntry *NativeFSFilesFind(U8 *files_find_mask,I64 fuf_flags,CDirEntry *parent
return result;
}
Bool NativeFSMkDir(CPrt *p,U8 *cur_dir,U8 *name)
Bool RedSeaFSMkDir(CPrt *p,U8 *cur_dir,U8 *name)
{
I64 size=p->spc<<BLK_SIZE_BITS,c,
cur_dir_cluster=Name2DirCluster(p,cur_dir);
@@ -695,7 +695,7 @@ Bool NativeFSMkDir(CPrt *p,U8 *cur_dir,U8 *name)
d_native->cluster=c;
d_native->size=size;
d_native->expanded_size=size;
d_native->datetime=GetCurTimeCDate;
d_native->datetime=GetCurTimeDate;
d_native(U8 *)+=CDIR_SIZE;
d_native->attr=_ATTR_DIR|_ATTR_CONTIGUOUS;
@@ -705,7 +705,7 @@ Bool NativeFSMkDir(CPrt *p,U8 *cur_dir,U8 *name)
d_native->cluster=cur_dir_cluster;
d_native->size=0;
d_native->expanded_size=0;
d_native->datetime=GetCurTimeCDate;
d_native->datetime=GetCurTimeDate;
WClusters(p,buf,c,1);
Free(buf);
if (unlock_break)