TempleOSTS_131005.ISO
This commit is contained in:
1 parent
1343005a29
commit
2d2a65d572
547 files changed
+33608
-12549
No files matched your search
@@ -31,11 +31,8 @@ Bool BlkDevUnlock(CBlkDev *bdev,Bool rst=FALSE)
|
||||
while (bdev->lock_fwding)
|
||||
bdev=bdev->lock_fwding;
|
||||
if (Bt(&bdev->locked_flags,BDlf_LOCKED) && bdev->owning_task==Fs) {
|
||||
if (rst) {
|
||||
if (!Bt(&sys_semas[SYS_SEMA_NO_IO_SND],0))
|
||||
Snd(0);
|
||||
if (rst)
|
||||
bdev->flags&=~(BDF_INITIALIZED|BDF_INIT_IN_PROGRESS);
|
||||
}
|
||||
bdev->owning_task=0;
|
||||
LBtr(&bdev->locked_flags,BDlf_LOCKED);
|
||||
Yield; //Prevent deadlock
|
||||
@@ -81,8 +78,6 @@ Bool BlkDevInit(CBlkDev *bdev)
|
||||
case BDT_ATA:
|
||||
bdev->max_reads=128;
|
||||
bdev->max_writes=1;
|
||||
bdev->read_freq=2000;
|
||||
bdev->write_freq=500;
|
||||
result=ATAInit(bdev);
|
||||
break;
|
||||
case BDT_ATAPI:
|
||||
@@ -94,8 +89,6 @@ Bool BlkDevInit(CBlkDev *bdev)
|
||||
if (bdev->max_reads<128)
|
||||
bdev->max_reads=128;
|
||||
bdev->max_writes=0xFFFF*4;
|
||||
bdev->read_freq=1000;
|
||||
bdev->write_freq=250;
|
||||
if (result=ATAInit(bdev))
|
||||
p->size=bdev->max_blk+1;
|
||||
break;
|
||||
@@ -220,7 +213,7 @@ U0 SetFSBuf(CPrt *p,I64 c,I64 map_select=-1)
|
||||
if (c==INVALID_CLUSTER)
|
||||
throw(EXCEPT_PRT,1);
|
||||
if (p->type==PT_FAT32)
|
||||
MAP_blk_num=c/(BLK_SIZE>>2);
|
||||
MAP_blk_num=c>>(BLK_SIZE_BITS-2);
|
||||
else
|
||||
MAP_blk_num=c>>(BLK_SIZE_BITS+3);
|
||||
if (MAP_blk_num!=p->cur_map_blk_num) {
|
||||
@@ -333,12 +326,8 @@ Bool RBlks(CPrt *p,U8 *buf, I64 blk, I64 cnt)
|
||||
if (bdev->flags & BDF_READ_CACHE)
|
||||
RCache(p,&buf,&blk,&cnt);
|
||||
if (cnt>0) {
|
||||
if (!Bt(&sys_semas[SYS_SEMA_NO_IO_SND],0))
|
||||
Snd(bdev->read_freq);
|
||||
result=(*p->rblks)(p,buf,blk,cnt);
|
||||
bdev->last_time=tS;
|
||||
if (!Bt(&sys_semas[SYS_SEMA_NO_IO_SND],0))
|
||||
Snd(0);
|
||||
if (bdev->flags & BDF_READ_CACHE)
|
||||
DskCacheAdd(p,buf,blk,cnt);
|
||||
}
|
||||
@@ -366,11 +355,7 @@ Bool WBlks(CPrt *p,U8 *buf, I64 blk, I64 cnt)
|
||||
throw(EXCEPT_PRT,3);
|
||||
blk+=bdev->offset;
|
||||
if (cnt>0) {
|
||||
if (!Bt(&sys_semas[SYS_SEMA_NO_IO_SND],0))
|
||||
Snd(bdev->write_freq);
|
||||
result=(*p->wblks)(p,buf,blk,cnt);
|
||||
if (!Bt(&sys_semas[SYS_SEMA_NO_IO_SND],0))
|
||||
Snd(0);
|
||||
bdev->last_time=tS;
|
||||
if (bdev->flags & BDF_READ_CACHE)
|
||||
DskCacheAdd(p,buf,blk,cnt);
|
||||
@@ -457,8 +442,7 @@ U0 PrtRep()
|
||||
I64 i;
|
||||
U8 *st,drv_let;
|
||||
"\nDefined Partitions:\n\n";
|
||||
p=sys_prts;
|
||||
for (i=0;i<NUM_PRTS;i++,p++) {
|
||||
for (i=0,p=sys_prts;i<NUM_PRTS;i++,p++) {
|
||||
if (p->pt_signature==PRT_SIGNATURE_VAL) {
|
||||
bdev=p->bdev;
|
||||
drv_let=Prt2Drv(p);
|
||||
@@ -629,8 +613,7 @@ I64 Name2ParentDirCluster(CPrt *p,U8 *dirname)
|
||||
PrtChk(p);
|
||||
try {
|
||||
unlock=PrtLock(p);
|
||||
cur_dir_cluster=p->root_cluster;
|
||||
cur_dir_cluster2=p->root_cluster;
|
||||
cur_dir_cluster=cur_dir_cluster2=p->root_cluster;
|
||||
while (*buf && cont) {
|
||||
cur_dir_cluster2=cur_dir_cluster;
|
||||
StrFirstRem(buf,"/",buf2);
|
||||
@@ -710,7 +693,7 @@ I64 WClusters(CPrt *p,U8 *buf,I64 c,I64 cnt)
|
||||
}
|
||||
|
||||
//c=0 means first cluster in chain
|
||||
I64 ClusersAlloc(CPrt *p,I64 c=0,I64 cnt=1,Bool contiguous=FALSE)
|
||||
I64 ClustersAlloc(CPrt *p,I64 c=0,I64 cnt=1,Bool contiguous=FALSE)
|
||||
{
|
||||
PrtChk(p);
|
||||
if (cnt<=0) return c;
|
||||
|
||||
@@ -154,7 +154,7 @@ CFileAccess *FileAccessNew(U8 *_mask,Bool make_mask=FALSE,Bool make_dirs=FALSE)
|
||||
if (!Drv(*mask)) valid=FALSE;
|
||||
mask+=2;
|
||||
}
|
||||
if (StrStr(mask,"HOME") && Fs->cur_prt!=Drv2Prt(*sys_acct))
|
||||
if (StrMatch("HOME",mask) && Fs->cur_prt!=Drv2Prt(*sys_acct))
|
||||
Drv(*sys_acct);
|
||||
fa->p=Fs->cur_prt;
|
||||
PrtChk(fa->p);
|
||||
@@ -197,12 +197,16 @@ CDirEntry *FilesFind(U8 *files_find_mask,I64 fuf_flags=0)
|
||||
{
|
||||
/*
|
||||
Flags:
|
||||
$LK,"FUF_RECURSE","MN:FUF_RECURSE"$ +r Recurse
|
||||
$LK,"FUF_FLATTEN_TREE","MN:FUF_FLATTEN_TREE"$ +f $BK,1$be sure to use this along with '+F'$BK,0$.
|
||||
$LK,"FUF_JUST_DIRS","MN:FUF_JUST_DIRS"$ +D just directories
|
||||
$LK,"FUF_JUST_FILES","MN:FUF_JUST_FILES"$ +F just files
|
||||
$LK,"FUF_JUST_TXT_FILES","MN:FUF_JUST_TXT_FILES"$ +T just text files: $LK,"FILENAME_MASK_TXT","MN:FILENAME_MASK_TXT"$
|
||||
$LK,"FUF_JUST_SRC_FILES","MN:FUF_JUST_SRC_FILES"$ +S just src files : $LK,"FILENAME_MASK_SRC","MN:FILENAME_MASK_SRC"$
|
||||
$LK,"FUF_RECURSE","MN:FUF_RECURSE"$ +r Recurse
|
||||
$LK,"FUF_FLATTEN_TREE","MN:FUF_FLATTEN_TREE"$ +f $BK,1$use with '+F'$BK,0$. Just use +F, probably.
|
||||
$LK,"FUF_JUST_DIRS","MN:FUF_JUST_DIRS"$ +D just directories
|
||||
$LK,"FUF_JUST_FILES","MN:FUF_JUST_FILES"$ +F just files (Flattens trees)
|
||||
$LK,"FUF_JUST_TXT","MN:FUF_JUST_TXT"$ +T just text files : $LK,"FILEMASK_TXT","MN:FILEMASK_TXT"$
|
||||
$LK,"FUF_JUST_SRC","MN:FUF_JUST_SRC"$ +S just src files : $LK,"FILEMASK_SRC","MN:FILEMASK_SRC"$
|
||||
$LK,"FUF_JUST_AOT","MN:FUF_JUST_AOT"$ +A just aot files : $LK,"FILEMASK_AOT","MN:FILEMASK_AOT"$
|
||||
$LK,"FUF_JUST_JIT","MN:FUF_JUST_JIT"$ +J just jit files : $LK,"FILEMASK_JIT","MN:FILEMASK_JIT"$
|
||||
$LK,"FUF_JUST_GRA","MN:FUF_JUST_GRA"$ +G just graphic files : $LK,"FILEMASK_GRA","MN:FILEMASK_GRA"$
|
||||
|
||||
See $LK,"ST_FILE_UTIL_FLAGS","MN:ST_FILE_UTIL_FLAGS"$ when used in calling program taking text flags.
|
||||
*/
|
||||
CDirEntry *result;
|
||||
@@ -219,7 +223,7 @@ See $LK,"ST_FILE_UTIL_FLAGS","MN:ST_FILE_UTIL_FLAGS"$ when used in calling progr
|
||||
|
||||
Bool IsDir(U8 *dir_name)
|
||||
{
|
||||
U8 *mask=MSPrintF("%s/*",dir_name);
|
||||
U8 *mask=MPrint("%s/*",dir_name);
|
||||
Bool result,old_silent=Silent(ON);
|
||||
CFileAccess *fa;
|
||||
if (fa=FileAccessNew(mask)) {
|
||||
@@ -359,9 +363,9 @@ U8 *TextFileRead(U8 *filename,I64 *_attr=NULL)
|
||||
}
|
||||
|
||||
|
||||
Bool FileFind(U8 *filename,CDirEntry *rde=NULL,I64 fuf_flags=0)
|
||||
Bool FileFind(U8 *filename,CDirEntry *_de=NULL,I64 fuf_flags=0)
|
||||
{ //$LK,"FUF_JUST_DIRS","MN:FUF_JUST_DIRS"$, $LK,"FUF_JUST_FILES","MN:FUF_JUST_FILES"$, $LK,"FUF_Z_OR_NOT_Z","MN:FUF_Z_OR_NOT_Z"$, $LK,"FUF_SCAN_PARENTS","MN:FUF_SCAN_PARENTS"$
|
||||
//If you pass rde, you must Free(rde->full_name);
|
||||
//If you pass _de, you must Free(_de->full_name);
|
||||
I64 i,j,cur_dir_cluster;
|
||||
U8 *altname,*curname,*full_name=NULL;
|
||||
CDirEntry de;
|
||||
@@ -395,8 +399,8 @@ Bool FileFind(U8 *filename,CDirEntry *rde=NULL,I64 fuf_flags=0)
|
||||
default:
|
||||
PutDefineErr("ST_UNSUPPORTED_FILE_SYSTEM");
|
||||
}
|
||||
if (result && rde)
|
||||
full_name=MSPrintF("%C:%s/%s",Fs->cur_prt->drv_let,Fs->cur_dir,de.name);
|
||||
if (result && _de)
|
||||
full_name=MPrint("%C:%s/%s",Fs->cur_prt->drv_let,Fs->cur_dir,de.name);
|
||||
FileAccessDel(fa);
|
||||
}
|
||||
}
|
||||
@@ -424,17 +428,17 @@ Bool FileFind(U8 *filename,CDirEntry *rde=NULL,I64 fuf_flags=0)
|
||||
PutDefineErr("ST_UNSUPPORTED_FILE_SYSTEM");
|
||||
}
|
||||
}
|
||||
if (result && rde)
|
||||
full_name=MSPrintF("%C:%s/%s",Fs->cur_prt->drv_let,Fs->cur_dir,de.name);
|
||||
if (result && _de)
|
||||
full_name=MPrint("%C:%s/%s",Fs->cur_prt->drv_let,Fs->cur_dir,de.name);
|
||||
FileAccessDel(fa);
|
||||
}
|
||||
}
|
||||
if (rde) {
|
||||
if (_de) {
|
||||
if (result) {
|
||||
MemCpy(rde,&de,sizeof(CDirEntry));
|
||||
rde->full_name=full_name;
|
||||
MemCpy(_de,&de,sizeof(CDirEntry));
|
||||
_de->full_name=full_name;
|
||||
} else
|
||||
MemSet(rde,0,sizeof(CDirEntry));
|
||||
MemSet(_de,0,sizeof(CDirEntry));
|
||||
}
|
||||
Free(altname);
|
||||
return result;
|
||||
@@ -458,15 +462,11 @@ 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_REDSEA && de.expanded_size)
|
||||
return de.expanded_size;
|
||||
else {
|
||||
if (de.size && FileAttr(de.name) & _ATTR_COMPRESSED) {
|
||||
RBlks(p,buf,Cluster2Blk(p,de.cluster),1);
|
||||
return (&buf)(CArcCompress *)->expanded_size;
|
||||
} else
|
||||
return de.size;
|
||||
}
|
||||
if (de.size && FileAttr(de.name) & _ATTR_COMPRESSED) {
|
||||
RBlks(p,buf,Cluster2Blk(p,de.cluster),1);
|
||||
return (&buf)(CArcCompress *)->expanded_size;
|
||||
} else
|
||||
return de.size;
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -30,8 +30,7 @@ Bool CopySingleZ(U8 *f1,U8 *f2) //Just one file
|
||||
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=TEMPLEOS_XSUM,i,j;
|
||||
I64 cnt,n,size,attr1=FileAttr(f1),attr2=FileAttr(f2),i,j;
|
||||
CFile *in_file=NULL,*out_file=NULL;
|
||||
|
||||
if (!StrCmp(absf1,absf2)) { //onto self?
|
||||
@@ -68,19 +67,13 @@ Bool CopySingle(U8 *f1,U8 *f2) //Just one file
|
||||
i=j;
|
||||
}
|
||||
FRBlks(in_file, buf,FFB_NEXT_BLK,n);
|
||||
xsum^=ArcXSum(buf,i);
|
||||
FWBlks(out_file,buf,FFB_NEXT_BLK,n);
|
||||
cnt-=n;
|
||||
j-=n<<BLK_SIZE_BITS;
|
||||
}
|
||||
if (in_file->de.xsum &&
|
||||
in_file->de.xsum!=xsum)
|
||||
throw(EXCEPT_ARC_XSUM);
|
||||
out_file->de.xsum=xsum;
|
||||
out_file->flags|=FF_USE_OLD_DATETIME;
|
||||
out_file->de.datetime=in_file->de.datetime;
|
||||
out_file->de.size=size;
|
||||
out_file->de.expanded_size=in_file->de.expanded_size;
|
||||
out_file->de.attr=FileAttr(f2,in_file->de.attr);
|
||||
FClose(out_file);
|
||||
FClose(in_file);
|
||||
@@ -105,9 +98,7 @@ Bool MkDir(U8 *filename)
|
||||
if (!FileNameChk(fa->mask))
|
||||
PutDefineErr("ST_INVALID_FILENAME");
|
||||
else {
|
||||
"Make Directory:";
|
||||
"" filename;
|
||||
NewLine;
|
||||
"Make Directory:%s\n",filename;
|
||||
name=MStrUtil(fa->mask,
|
||||
SUF_REM_LEADING|SUF_REM_TRAILING|SUF_REM_CTRL_CHARS);
|
||||
switch (fa->p->type) {
|
||||
@@ -214,8 +205,6 @@ U0 CDImageRead(U8 cd_drv_let,U8 *out_name)
|
||||
n=cnt;
|
||||
if (n>bdev->max_reads)
|
||||
n=bdev->max_reads;
|
||||
if (!Bt(&sys_semas[SYS_SEMA_NO_IO_SND],0))
|
||||
Snd(bdev->read_freq);
|
||||
|
||||
retry=4;
|
||||
while (--retry)
|
||||
@@ -227,8 +216,6 @@ U0 CDImageRead(U8 cd_drv_let,U8 *out_name)
|
||||
if (!retry)
|
||||
ATAPIReadBlks2(bdev,buf,blk/spc,n/spc,TRUE,0);
|
||||
|
||||
if (!Bt(&sys_semas[SYS_SEMA_NO_IO_SND],0))
|
||||
Snd(0);
|
||||
FWBlks(f,buf,blk,n);
|
||||
cnt-=n;
|
||||
blk+=n;
|
||||
@@ -273,8 +260,6 @@ U0 CDImageWriteTask(CDualBuf *d)
|
||||
while (d->in_buf>d->out_buf+1)
|
||||
Yield;
|
||||
FRBlks(f,buf,blk,n);
|
||||
if (!Bt(&sys_semas[SYS_SEMA_NO_IO_SND],0))
|
||||
Snd(d->CD_bdev->write_freq);
|
||||
d->in_buf++;
|
||||
cnt-=n;
|
||||
blk+=n;
|
||||
@@ -334,8 +319,6 @@ U0 CDImageWrite(U8 cd_drv_let,U8 *in_name=NULL,I64 media_type=MT_CD)
|
||||
while (d->in_buf<=d->out_buf)
|
||||
Yield;
|
||||
|
||||
if (!Bt(&sys_semas[SYS_SEMA_NO_IO_SND],0))
|
||||
Snd(bdev->write_freq);
|
||||
BlkDevLock(bdev);
|
||||
ATAPIWaitReady(bdev,0);
|
||||
|
||||
@@ -381,8 +364,6 @@ U0 CDImageWrite(U8 cd_drv_let,U8 *in_name=NULL,I64 media_type=MT_CD)
|
||||
*progress1_desc=0;
|
||||
progress1=progress1_max=0;
|
||||
|
||||
if (!Bt(&sys_semas[SYS_SEMA_NO_IO_SND],0))
|
||||
Snd(0);
|
||||
bdev->flags&=~BDF_READ_ONLY_OVERRIDE;
|
||||
BlkDevUnlock(bdev);
|
||||
Free(d->buf0);
|
||||
|
||||
@@ -800,46 +800,46 @@ public I64 ATARep(Bool pmt=TRUE,Bool just_ide=FALSE,CATARep **_root=NULL)
|
||||
for (i=0;i<NUM_BLKDEVS;i++)
|
||||
if (sys_blkdevs[i].bd_signature==BD_SIGNATURE_VAL)
|
||||
BEqu(&unlock_flags,i,
|
||||
BlkDevLock(&sys_blkdevs[i]));
|
||||
BlkDevLock(&sys_blkdevs[i]));
|
||||
|
||||
if (!just_ide)
|
||||
for (k=0;k<256;k++) {
|
||||
i=-1;
|
||||
while (TRUE) {
|
||||
j=PCIClassFind(0x010100+k,++i);
|
||||
if (j<0)
|
||||
break;
|
||||
for (k=0;k<256;k++) {
|
||||
i=-1;
|
||||
while (TRUE) {
|
||||
j=PCIClassFind(0x010100+k,++i);
|
||||
if (j<0)
|
||||
break;
|
||||
|
||||
"\nSubcode:0x%X Bus:0x%X Dev:0x%X Fun:0x%X\n",k,j.u8[2],j.u8[1],j.u8[0];
|
||||
cnt++;
|
||||
"\nSubcode:0x%X Bus:0x%X Dev:0x%X Fun:0x%X\n",k,j.u8[2],j.u8[1],j.u8[0];
|
||||
cnt++;
|
||||
|
||||
d1=PCIReadU32(j.u8[2],j.u8[1],j.u8[0],0x10);
|
||||
d2=PCIReadU32(j.u8[2],j.u8[1],j.u8[0],0x14);
|
||||
d3=PCIReadU8(j.u8[2],j.u8[1],j.u8[0],0x3C);
|
||||
if (d1&1 && d2&1) {
|
||||
ATARepEntry(d1,d2,0,d3,"Primary IDE",_root,&num_hints);
|
||||
ATARepEntry(d1,d2,1,d3,"Primary IDE",_root,&num_hints);
|
||||
} else {
|
||||
d1=0x1F0;
|
||||
d2=0x3F6;
|
||||
d3=14;
|
||||
ATARepEntry(d1,d2,0,d3,"Primary IDE",_root,&num_hints);
|
||||
ATARepEntry(d1,d2,1,d3,"Primary IDE",_root,&num_hints);
|
||||
}
|
||||
d1=PCIReadU32(j.u8[2],j.u8[1],j.u8[0],0x18);
|
||||
d2=PCIReadU32(j.u8[2],j.u8[1],j.u8[0],0x1C);
|
||||
if (d1&1 && d2&1) {
|
||||
ATARepEntry(d1,d2,0,d3,"Secondary IDE",_root,&num_hints);
|
||||
ATARepEntry(d1,d2,1,d3,"Secondary IDE",_root,&num_hints);
|
||||
} else {
|
||||
d1=0x170;
|
||||
d2=0x376;
|
||||
d3=15;
|
||||
ATARepEntry(d1,d2,0,d3,"Secondary IDE",_root,&num_hints);
|
||||
ATARepEntry(d1,d2,1,d3,"Secondary IDE",_root,&num_hints);
|
||||
d1=PCIReadU32(j.u8[2],j.u8[1],j.u8[0],0x10);
|
||||
d2=PCIReadU32(j.u8[2],j.u8[1],j.u8[0],0x14);
|
||||
d3=PCIReadU8(j.u8[2],j.u8[1],j.u8[0],0x3C);
|
||||
if (d1&1 && d2&1) {
|
||||
ATARepEntry(d1,d2,0,d3,"Primary IDE",_root,&num_hints);
|
||||
ATARepEntry(d1,d2,1,d3,"Primary IDE",_root,&num_hints);
|
||||
} else {
|
||||
d1=0x1F0;
|
||||
d2=0x3F6;
|
||||
d3=14;
|
||||
ATARepEntry(d1,d2,0,d3,"Primary IDE",_root,&num_hints);
|
||||
ATARepEntry(d1,d2,1,d3,"Primary IDE",_root,&num_hints);
|
||||
}
|
||||
d1=PCIReadU32(j.u8[2],j.u8[1],j.u8[0],0x18);
|
||||
d2=PCIReadU32(j.u8[2],j.u8[1],j.u8[0],0x1C);
|
||||
if (d1&1 && d2&1) {
|
||||
ATARepEntry(d1,d2,0,d3,"Secondary IDE",_root,&num_hints);
|
||||
ATARepEntry(d1,d2,1,d3,"Secondary IDE",_root,&num_hints);
|
||||
} else {
|
||||
d1=0x170;
|
||||
d2=0x376;
|
||||
d3=15;
|
||||
ATARepEntry(d1,d2,0,d3,"Secondary IDE",_root,&num_hints);
|
||||
ATARepEntry(d1,d2,1,d3,"Secondary IDE",_root,&num_hints);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!cnt) {
|
||||
d1=0x1F0;
|
||||
d2=0x3F6;
|
||||
|
||||
@@ -211,8 +211,8 @@ U0 Mount(Bool repartition=FALSE)
|
||||
} while (!A2I(base0_buf));
|
||||
if (1<=A2I(base0_buf)<=num_hints) {
|
||||
tempha=ATARepFind(root,A2I(base0_buf));
|
||||
SPrintF(base0_buf,"0x%X",tempha->base0);
|
||||
SPrintF(base1_buf,"0x%X",tempha->base1);
|
||||
SPrint(base0_buf,"0x%X",tempha->base0);
|
||||
SPrint(base1_buf,"0x%X",tempha->base1);
|
||||
unit=tempha->unit;
|
||||
} else {
|
||||
if (type==BDT_ATAPI)
|
||||
@@ -287,9 +287,9 @@ Bool PmtBaseUnit(CBlkDev *bdev)
|
||||
" TempleOS\n\n\n";
|
||||
#exe {
|
||||
if (kernel_cfg->opts[CFG_DONT_PROBE])
|
||||
StreamPutS("probe=FALSE;");
|
||||
StreamPrint("probe=FALSE;");
|
||||
else
|
||||
StreamPutS("probe=TRUE;");
|
||||
StreamPrint("probe=TRUE;");
|
||||
};
|
||||
if (!probe || !BootCdProbeAll(bdev)) {
|
||||
PutDefine("ST_CDROM_PORTS_PMT1");
|
||||
@@ -320,13 +320,13 @@ U0 BlkDevsInitAll()
|
||||
sys_prts=CAlloc(sizeof(CPrt)*NUM_PRTS);
|
||||
for (i=0;i<NUM_PRTS;i++)
|
||||
drv_to_prt[i]=&sys_prts[i];
|
||||
sys_raw_dc_col=0;
|
||||
sys_raw_col=0;
|
||||
#exe {
|
||||
if (kernel_cfg->opts[CFG_AUTO_MOUNT_IDE])
|
||||
StreamPutS("AutoMountIDE;");
|
||||
StreamPutS("#exe {OptOff(OPTf_WARN_PAREN);}");
|
||||
StreamPrint("AutoMountIDE;");
|
||||
StreamPrint("#exe {OptOff(OPTf_WARN_PAREN);}");
|
||||
StreamDoc(kernel_cfg->add_dev);
|
||||
StreamPutS("#exe {OptOn(OPTf_WARN_PAREN);}");
|
||||
StreamPrint("#exe {OptOn(OPTf_WARN_PAREN);}");
|
||||
};
|
||||
PrtRep;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ I64 FSize(CFile *f)
|
||||
|
||||
CFile *FOpen(U8 *filename,U8 *flags,I64 cnt=0)
|
||||
{ //allows flags "r","w","w+". Include a "c" for contiguous.
|
||||
//(It uses $LK,"StrOcc","MN:StrOcc"$() for 'w', 'r', '+', 'c')
|
||||
CFile *f=CAlloc(sizeof(CFile));
|
||||
CFileAccess *fa;
|
||||
U8 *full_name;
|
||||
@@ -48,10 +49,10 @@ CFile *FOpen(U8 *filename,U8 *flags,I64 cnt=0)
|
||||
if (fa=FileAccessNew(full_name)) {
|
||||
StrCpy(f->de.name,fa->mask);
|
||||
if (cnt>0) { //We pre-alloc the whole thing.
|
||||
f->de.cluster=ClusersAlloc(f->p,0,
|
||||
f->de.cluster=ClustersAlloc(f->p,0,
|
||||
(cnt+f->p->spc-1)/f->p->spc,contiguous);
|
||||
f->de.expanded_size=f->de.size=cnt<<BLK_SIZE_BITS;
|
||||
CDirNew(fa->p,Fs->cur_dir,&f->de,TRUE);
|
||||
f->de.size=cnt<<BLK_SIZE_BITS;
|
||||
DirNew(fa->p,Fs->cur_dir,&f->de,TRUE);
|
||||
f->flags&=~FF_NEW_FILE;
|
||||
}
|
||||
FileAccessDel(fa);
|
||||
@@ -82,11 +83,11 @@ 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=GetCurTimeDate;
|
||||
f->de.datetime=GetDateTime;
|
||||
if (f->flags & FF_NEW_FILE)
|
||||
CDirNew(fa->p,Fs->cur_dir,&f->de,TRUE);
|
||||
DirNew(fa->p,Fs->cur_dir,&f->de,TRUE);
|
||||
else
|
||||
CDirNew(fa->p,Fs->cur_dir,&f->de,FALSE);
|
||||
DirNew(fa->p,Fs->cur_dir,&f->de,FALSE);
|
||||
FileAccessDel(fa);
|
||||
} else
|
||||
throw(EXCEPT_FILE,1);
|
||||
@@ -196,7 +197,7 @@ Bool FWBlks(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
|
||||
blk+=cnt;
|
||||
} else {
|
||||
if (!c) {
|
||||
c=ClusersAlloc(p,0,1,FALSE);
|
||||
c=ClustersAlloc(p,0,1,FALSE);
|
||||
f->file_cluster_num=0;
|
||||
f->cluster=c;
|
||||
f->de.cluster=c;
|
||||
@@ -211,7 +212,7 @@ Bool FWBlks(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
|
||||
c1=c;
|
||||
c=ClusterNumNext(p,c1,1);
|
||||
if (c==INVALID_CLUSTER) {
|
||||
c=ClusersAlloc(p,c1,i,FALSE);
|
||||
c=ClustersAlloc(p,c1,i,FALSE);
|
||||
if (i>1)
|
||||
c=ClusterNumNext(p,c,i-1);
|
||||
break;
|
||||
@@ -234,7 +235,7 @@ Bool FWBlks(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
|
||||
c1=c;
|
||||
c=ClusterNumNext(p,c1,1);
|
||||
if (c==INVALID_CLUSTER)
|
||||
c=ClusersAlloc(p,c1,1,FALSE);
|
||||
c=ClustersAlloc(p,c1,1,FALSE);
|
||||
}
|
||||
}
|
||||
while (cnt>=spc) {
|
||||
@@ -248,7 +249,7 @@ Bool FWBlks(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
|
||||
c1=c;
|
||||
c=ClusterNumNext(p,c1,1);
|
||||
if (c==INVALID_CLUSTER)
|
||||
c=ClusersAlloc(p,c1,1,FALSE);
|
||||
c=ClustersAlloc(p,c1,1,FALSE);
|
||||
}
|
||||
}
|
||||
if (cnt>0) {
|
||||
@@ -260,8 +261,6 @@ Bool FWBlks(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
|
||||
}
|
||||
if (f->de.size<blk<<BLK_SIZE_BITS)
|
||||
f->de.size=blk<<BLK_SIZE_BITS;
|
||||
if (f->de.expanded_size<blk<<BLK_SIZE_BITS)
|
||||
f->de.expanded_size=blk<<BLK_SIZE_BITS;
|
||||
}
|
||||
f->fblk_num=blk;
|
||||
return TRUE;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
Bool CDirNew(CPrt *p,U8 *cur_dir,CDirEntry *tempm,Bool free_old_chain=TRUE)
|
||||
Bool DirNew(CPrt *p,U8 *cur_dir,CDirEntry *tempde,Bool free_old_chain=TRUE)
|
||||
{
|
||||
switch (p->type) {
|
||||
case PT_REDSEA:
|
||||
return RedSeaFSDirNew(p,cur_dir,tempm,free_old_chain);
|
||||
return RedSeaFSDirNew(p,cur_dir,tempde,free_old_chain);
|
||||
case PT_FAT32:
|
||||
return FAT32DirNew(p,cur_dir,tempm,free_old_chain);
|
||||
return FAT32DirNew(p,cur_dir,tempde,free_old_chain);
|
||||
case PT_ISO9660:
|
||||
PutDefineErr("ST_NOT_WRITABLE");
|
||||
return FALSE;
|
||||
@@ -14,48 +14,48 @@ Bool CDirNew(CPrt *p,U8 *cur_dir,CDirEntry *tempm,Bool free_old_chain=TRUE)
|
||||
}
|
||||
}
|
||||
|
||||
U0 CDirEntryDel(CDirEntry *tempm)
|
||||
U0 DirEntryDel(CDirEntry *tempde)
|
||||
{ //Doesn't Free user_data
|
||||
if (tempm) {
|
||||
Free(tempm->full_name);
|
||||
Free(tempm);
|
||||
if (tempde) {
|
||||
Free(tempde->full_name);
|
||||
Free(tempde);
|
||||
}
|
||||
}
|
||||
|
||||
U0 CDirEntryDel2(CDirEntry *tempm)
|
||||
U0 DirEntryDel2(CDirEntry *tempde)
|
||||
{ //Frees user_data
|
||||
if (tempm) {
|
||||
Free(tempm->full_name);
|
||||
Free(tempm->user_data);
|
||||
Free(tempm);
|
||||
if (tempde) {
|
||||
Free(tempde->full_name);
|
||||
Free(tempde->user_data);
|
||||
Free(tempde);
|
||||
}
|
||||
}
|
||||
|
||||
U0 CDirLstDel(CDirEntry *tempm)
|
||||
U0 DirLstDel(CDirEntry *tempde)
|
||||
{ //Doesn't Free user_data
|
||||
CDirEntry *tempm2;
|
||||
while (tempm) {
|
||||
tempm2=tempm->next;
|
||||
if (tempm->sub)
|
||||
CDirLstDel(tempm->sub);
|
||||
CDirEntryDel(tempm);
|
||||
tempm=tempm2;
|
||||
CDirEntry *tempde2;
|
||||
while (tempde) {
|
||||
tempde2=tempde->next;
|
||||
if (tempde->sub)
|
||||
DirLstDel(tempde->sub);
|
||||
DirEntryDel(tempde);
|
||||
tempde=tempde2;
|
||||
}
|
||||
}
|
||||
|
||||
U0 CDirLstDel2(CDirEntry *tempm)
|
||||
U0 DirLstDel2(CDirEntry *tempde)
|
||||
{ //Frees user_data
|
||||
CDirEntry *tempm2;
|
||||
while (tempm) {
|
||||
tempm2=tempm->next;
|
||||
if (tempm->sub)
|
||||
CDirLstDel2(tempm->sub);
|
||||
CDirEntryDel2(tempm);
|
||||
tempm=tempm2;
|
||||
CDirEntry *tempde2;
|
||||
while (tempde) {
|
||||
tempde2=tempde->next;
|
||||
if (tempde->sub)
|
||||
DirLstDel2(tempde->sub);
|
||||
DirEntryDel2(tempde);
|
||||
tempde=tempde2;
|
||||
}
|
||||
}
|
||||
|
||||
I64 CDirEntryCompare(CDirEntry *e1,CDirEntry *e2)
|
||||
I64 DirEntryCompare(CDirEntry *e1,CDirEntry *e2)
|
||||
{
|
||||
U8 buf1[CDIR_FILENAME_LEN],buf2[CDIR_FILENAME_LEN],
|
||||
buf3[CDIR_FILENAME_LEN],buf4[CDIR_FILENAME_LEN];
|
||||
@@ -77,67 +77,67 @@ I64 CDirEntryCompare(CDirEntry *e1,CDirEntry *e2)
|
||||
}
|
||||
}
|
||||
|
||||
U0 CDirFilesSort(CDirEntry **_tempm)
|
||||
U0 DirFilesSort(CDirEntry **_tempde)
|
||||
{
|
||||
I64 i,cnt=0;
|
||||
CDirEntry *tempm=*_tempm,*tempm1,**sort_buf;
|
||||
if (tempm) {
|
||||
tempm1=tempm;
|
||||
while (tempm1) {
|
||||
CDirEntry *tempde=*_tempde,*tempde1,**sort_buf;
|
||||
if (tempde) {
|
||||
tempde1=tempde;
|
||||
while (tempde1) {
|
||||
cnt++;
|
||||
tempm1=tempm1->next;
|
||||
tempde1=tempde1->next;
|
||||
}
|
||||
if (cnt>1) {
|
||||
sort_buf=MAlloc(cnt*sizeof(U8 *));
|
||||
i=0;
|
||||
tempm1=tempm;
|
||||
while (tempm1) {
|
||||
sort_buf[i++]=tempm1;
|
||||
tempm1=tempm1->next;
|
||||
tempde1=tempde;
|
||||
while (tempde1) {
|
||||
sort_buf[i++]=tempde1;
|
||||
tempde1=tempde1->next;
|
||||
}
|
||||
QSortI64(sort_buf,cnt,&CDirEntryCompare);
|
||||
tempm=sort_buf[0];
|
||||
*_tempm=tempm;
|
||||
QSortI64(sort_buf,cnt,&DirEntryCompare);
|
||||
tempde=sort_buf[0];
|
||||
*_tempde=tempde;
|
||||
for (i=0;i<cnt-1;i++) {
|
||||
tempm1=sort_buf[i];
|
||||
tempm1->next=sort_buf[i+1];
|
||||
tempde1=sort_buf[i];
|
||||
tempde1->next=sort_buf[i+1];
|
||||
}
|
||||
tempm1=sort_buf[i];
|
||||
tempm1->next=NULL;
|
||||
tempde1=sort_buf[i];
|
||||
tempde1->next=NULL;
|
||||
Free(sort_buf);
|
||||
|
||||
tempm1=tempm;
|
||||
while (tempm1) {
|
||||
if (tempm1->sub)
|
||||
CDirFilesSort(&tempm1->sub);
|
||||
tempm1=tempm1->next;
|
||||
tempde1=tempde;
|
||||
while (tempde1) {
|
||||
if (tempde1->sub)
|
||||
DirFilesSort(&tempde1->sub);
|
||||
tempde1=tempde1->next;
|
||||
}
|
||||
} else
|
||||
if (tempm->sub)
|
||||
CDirFilesSort(&tempm->sub);
|
||||
if (tempde->sub)
|
||||
DirFilesSort(&tempde->sub);
|
||||
}
|
||||
}
|
||||
|
||||
CDirEntry *CDirFilesFlatten(CDirEntry *tempm,CDirEntry **_result,I64 fuf_flags)
|
||||
CDirEntry *DirFilesFlatten(CDirEntry *tempde,CDirEntry **_result,I64 fuf_flags)
|
||||
{ //returns last node
|
||||
CDirEntry *tempm1;
|
||||
CDirEntry *tempde1;
|
||||
Bool del;
|
||||
if (tempm)
|
||||
if (tempde)
|
||||
while (TRUE) {
|
||||
tempm1=tempm->next;
|
||||
if (!(tempm->attr&_ATTR_DIR)||!(fuf_flags&FUF_JUST_FILES)) {
|
||||
_result=*_result=tempm;
|
||||
tempde1=tempde->next;
|
||||
if (!(tempde->attr&_ATTR_DIR)||!(fuf_flags&FUF_JUST_FILES)) {
|
||||
_result=*_result=tempde;
|
||||
del=FALSE;
|
||||
} else
|
||||
del=TRUE;
|
||||
if (tempm->sub) {
|
||||
_result=CDirFilesFlatten(tempm->sub,_result,fuf_flags);
|
||||
tempm->sub=NULL;
|
||||
if (tempde->sub) {
|
||||
_result=DirFilesFlatten(tempde->sub,_result,fuf_flags);
|
||||
tempde->sub=NULL;
|
||||
}
|
||||
if (del)
|
||||
CDirEntryDel(tempm);
|
||||
if (tempm1)
|
||||
tempm=tempm1;
|
||||
DirEntryDel(tempde);
|
||||
if (tempde1)
|
||||
tempde=tempde1;
|
||||
else
|
||||
break;
|
||||
}
|
||||
@@ -165,9 +165,9 @@ CDirEntry *SysFilesFind(U8 *files_find_mask,I64 fuf_flags)
|
||||
result=NULL;
|
||||
}
|
||||
if (result) {
|
||||
CDirFilesSort(&result);
|
||||
DirFilesSort(&result);
|
||||
if (fuf_flags&(FUF_FLATTEN_TREE|FUF_JUST_FILES))
|
||||
CDirFilesFlatten(result,&result,fuf_flags);
|
||||
DirFilesFlatten(result,&result,fuf_flags);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -180,7 +180,7 @@ U0 PutFileLink(U8 *filename,I64 line=0,Bool plain_text=FALSE)
|
||||
if (line)
|
||||
"%s,%04d",filename,line;
|
||||
else
|
||||
"" filename;
|
||||
"%s",filename;
|
||||
} else {
|
||||
buf=FileNameAbs(filename);
|
||||
if (plain_text) {
|
||||
@@ -203,7 +203,7 @@ U0 PutDirLink(U8 *dirname)
|
||||
U8 *buf;
|
||||
if (!dirname) return;
|
||||
if (IsRaw)
|
||||
"" dirname;
|
||||
"%s",dirname;
|
||||
else {
|
||||
buf=DirNameAbs(dirname);
|
||||
"$$MA+A,\"%s\",\"Cd(\\\"%s\\\");Dir;\n\"$$",dirname,buf;
|
||||
@@ -213,53 +213,49 @@ U0 PutDirLink(U8 *dirname)
|
||||
|
||||
U0 Dir2(U8 *files_find_mask,I64 fuf_flags,Bool full)
|
||||
{
|
||||
CDirEntry *tempm1=NULL,*tempm2;
|
||||
CDirEntry *tempde1=NULL,*tempde2;
|
||||
U8 *st;
|
||||
I64 csize=0xFFFF,esize=0xFFFF,c=0xFFFF;
|
||||
tempm1=SysFilesFind(files_find_mask,fuf_flags);
|
||||
I64 csize=0xFFFF,c=0xFFFF;
|
||||
tempde1=SysFilesFind(files_find_mask,fuf_flags);
|
||||
|
||||
if (!(st=CurDir))
|
||||
PutDefine("ST_INVALID_DRV");
|
||||
else {
|
||||
if (tempm1) {
|
||||
if (tempde1) {
|
||||
//Find max columns
|
||||
tempm2=tempm1;
|
||||
while (tempm2) {
|
||||
if (tempm2->size>csize)
|
||||
csize=tempm2->size;
|
||||
if (tempm2->expanded_size>esize)
|
||||
esize=tempm2->expanded_size;
|
||||
if (tempm2->cluster>c)
|
||||
c=tempm2->cluster;
|
||||
tempm2=tempm2->next;
|
||||
tempde2=tempde1;
|
||||
while (tempde2) {
|
||||
if (tempde2->size>csize)
|
||||
csize=tempde2->size;
|
||||
if (tempde2->cluster>c)
|
||||
c=tempde2->cluster;
|
||||
tempde2=tempde2->next;
|
||||
}
|
||||
csize=Bsr(csize)/4+1;
|
||||
esize=Bsr(esize)/4+1;
|
||||
c=Bsr(c)/4+1;
|
||||
|
||||
"$$MA+A,\"Directory\",\"PopUpCd;Dir;\n\"$$ of %s\n",st;
|
||||
if (full)
|
||||
"__DATE__ __TIME__ %*ts %*ts %*ts\n",
|
||||
csize,"SIZE",esize,"UNCMPSIZE",c,"CLUSTER";
|
||||
"__DATE__ __TIME__ %*ts %*ts\n",
|
||||
csize,"SIZE",c,"CLUSTER";
|
||||
else
|
||||
"DATE_ TIME_ %*ts\n",csize,"SIZE";
|
||||
while (tempm1) {
|
||||
tempm2=tempm1->next;
|
||||
while (tempde1) {
|
||||
tempde2=tempde1->next;
|
||||
if (full)
|
||||
"%D %T %0*tX %0*tX %0*tX ",tempm1->datetime,tempm1->datetime,
|
||||
csize,tempm1->size,esize,tempm1->expanded_size,
|
||||
c, tempm1->cluster;
|
||||
"%D %T %0*tX %0*tX ",tempde1->datetime,tempde1->datetime,
|
||||
csize,tempde1->size,c,tempde1->cluster;
|
||||
else
|
||||
"%h1D %h1T %0*tX ",tempm1->datetime,tempm1->datetime,
|
||||
csize,tempm1->size;
|
||||
if (tempm1->attr & _ATTR_DIR)
|
||||
PutDirLink(tempm1->name);
|
||||
"%h1D %h1T %0*tX ",tempde1->datetime,tempde1->datetime,
|
||||
csize,tempde1->size;
|
||||
if (tempde1->attr & _ATTR_DIR)
|
||||
PutDirLink(tempde1->name);
|
||||
else
|
||||
PutFileLink(tempm1->name);
|
||||
PutFileLink(tempde1->name);
|
||||
|
||||
NewLine;
|
||||
CDirEntryDel(tempm1);
|
||||
tempm1=tempm2;
|
||||
DirEntryDel(tempde1);
|
||||
tempde1=tempde2;
|
||||
}
|
||||
} else
|
||||
PutDefine("ST_NO_MATCHING_ENTRIES");
|
||||
|
||||
@@ -37,7 +37,7 @@ Bool IsDotC(U8 *filename)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Bool FilesFindMatch(U8 *files_find_mask,U8 *filename,I64 fuf_flags=0)
|
||||
Bool FilesFindMatch(U8 *pattern,U8 *files_find_mask,I64 fuf_flags=0)
|
||||
{
|
||||
U8 *st1=StrNew(files_find_mask),
|
||||
*st2=MAlloc(StrLen(files_find_mask)+1);
|
||||
@@ -46,25 +46,25 @@ Bool FilesFindMatch(U8 *files_find_mask,U8 *filename,I64 fuf_flags=0)
|
||||
StrFirstRem(st1,";",st2);
|
||||
if (*st2) {
|
||||
if (*st2=='~') {
|
||||
if (WildCardMatch(st2+1,filename)) {
|
||||
if (WildMatch(pattern,st2+1)) {
|
||||
result=FALSE;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (WildCardMatch(st2,filename)) {
|
||||
if (Bt(&fuf_flags,FUf_JUST_TXT_FILES) && !FilesFindMatch(FILENAME_MASK_TXT,filename)) {
|
||||
if (WildMatch(pattern,st2)) {
|
||||
if (Bt(&fuf_flags,FUf_JUST_TXT) && !FilesFindMatch(pattern,FILEMASK_TXT)) {
|
||||
result=FALSE;
|
||||
break;
|
||||
} else if (Bt(&fuf_flags,FUf_JUST_SRC_FILES) && !FilesFindMatch(FILENAME_MASK_SRC,filename)) {
|
||||
} else if (Bt(&fuf_flags,FUf_JUST_SRC) && !FilesFindMatch(pattern,FILEMASK_SRC)) {
|
||||
result=FALSE;
|
||||
break;
|
||||
} else if (Bt(&fuf_flags,FUf_JUST_AOT_FILES) && !FilesFindMatch(FILENAME_MASK_AOT,filename)) {
|
||||
} else if (Bt(&fuf_flags,FUf_JUST_AOT) && !FilesFindMatch(pattern,FILEMASK_AOT)) {
|
||||
result=FALSE;
|
||||
break;
|
||||
} else if (Bt(&fuf_flags,FUf_JUST_JIT_FILES) && !FilesFindMatch(FILENAME_MASK_JIT,filename)) {
|
||||
} else if (Bt(&fuf_flags,FUf_JUST_JIT) && !FilesFindMatch(pattern,FILEMASK_JIT)) {
|
||||
result=FALSE;
|
||||
break;
|
||||
} else if (Bt(&fuf_flags,FUf_JUST_GRA_FILES) && !FilesFindMatch(FILENAME_MASK_GRA,filename)) {
|
||||
} else if (Bt(&fuf_flags,FUf_JUST_GRA) && !FilesFindMatch(pattern,FILEMASK_GRA)) {
|
||||
result=FALSE;
|
||||
break;
|
||||
} else
|
||||
@@ -246,7 +246,7 @@ U8 *FileNameAbs(U8 *_filename,I64 fuf_flags=0)
|
||||
}
|
||||
|
||||
U8 *ChgExt(U8 *filename,U8 *extension)
|
||||
{//Change file name extension
|
||||
{//Change filename extension
|
||||
U8 *result=MAlloc(StrLen(filename)+1+StrLen(extension)+1);
|
||||
StrCpy(result,filename);
|
||||
if (FileExtDot(filename))
|
||||
@@ -267,19 +267,19 @@ U8 *DftExt(U8 *filename,U8 *extension)
|
||||
return result;
|
||||
}
|
||||
|
||||
CDirEntry *Cd2DirEntry(CDirEntry *tempm,U8 *abs_name)
|
||||
CDirEntry *Cd2DirEntry(CDirEntry *tempde,U8 *abs_name)
|
||||
{
|
||||
I64 i;
|
||||
while (tempm) {
|
||||
i=StrLen(tempm->full_name);
|
||||
if (StrNCmp(tempm->full_name,abs_name,i)||
|
||||
i && tempm->full_name[i-1]!='/' && abs_name[i] && abs_name[i]!='/')
|
||||
tempm=tempm->next;
|
||||
while (tempde) {
|
||||
i=StrLen(tempde->full_name);
|
||||
if (StrNCmp(tempde->full_name,abs_name,i)||
|
||||
i && tempde->full_name[i-1]!='/' && abs_name[i] && abs_name[i]!='/')
|
||||
tempde=tempde->next;
|
||||
else
|
||||
if (StrLen(abs_name)==i)
|
||||
return tempm;
|
||||
return tempde;
|
||||
else
|
||||
return Cd2DirEntry(tempm->sub,abs_name);
|
||||
return Cd2DirEntry(tempde->sub,abs_name);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -325,7 +325,7 @@ Strips file from dirname, scans for file upward until found or returns default.
|
||||
if (*_extension=='.')
|
||||
ext=StrNew(_extension);
|
||||
else
|
||||
ext=MSPrintF(".%s",_extension);
|
||||
ext=MPrint(".%s",_extension);
|
||||
} else
|
||||
ext=StrNew("");
|
||||
while (StrOcc(st,'/')&&!IsDir(st))
|
||||
@@ -336,10 +336,10 @@ Strips file from dirname, scans for file upward until found or returns default.
|
||||
StrLastRem(st2,"/",st3);
|
||||
|
||||
if (name)
|
||||
result=MSPrintF("%s/%s%s",st,name,ext);
|
||||
result=MPrint("%s/%s%s",st,name,ext);
|
||||
else {
|
||||
if (*ext)
|
||||
result=MSPrintF("%s/%s%s",st,st3,ext);
|
||||
result=MPrint("%s/%s%s",st,st3,ext);
|
||||
else
|
||||
result=StrNew(st);
|
||||
}
|
||||
@@ -369,6 +369,6 @@ U8 *ToggleZorNotZ(U8 *name)
|
||||
result=StrNew(name);
|
||||
result[StrLen(name)-2]=0;
|
||||
} else
|
||||
result=MSPrintF("%s.Z",name);
|
||||
result=MPrint("%s.Z",name);
|
||||
return result;
|
||||
}
|
||||
@@ -95,7 +95,7 @@ U0 FAT32Fmt(U8 drv_let,Bool quick=TRUE)
|
||||
br->copies_of_fat=2;
|
||||
br->media_desc=0xF8;
|
||||
br->sects=p->size;
|
||||
l=br->sects/br->sects_per_cluster/(BLK_SIZE/4)+1;
|
||||
l=(br->sects/br->sects_per_cluster)>>(BLK_SIZE_BITS-2)+1;
|
||||
br->sects_per_fat=l;
|
||||
br->root_cluster=2;
|
||||
br->file_system_info_sect=1;
|
||||
@@ -120,8 +120,8 @@ U0 FAT32Fmt(U8 drv_let,Bool quick=TRUE)
|
||||
WBlks(p,fis,p->offset+br->file_system_info_sect,1);
|
||||
WBlks(p,br,p->offset,1);
|
||||
FAT32PrtInit(p);
|
||||
ClusersAlloc(p,0,1,FALSE); //Allocate #1
|
||||
br->root_cluster=ClusersAlloc(p,0,1,FALSE);
|
||||
ClustersAlloc(p,0,1,FALSE); //Allocate #1
|
||||
br->root_cluster=ClustersAlloc(p,0,1,FALSE);
|
||||
WBlks(p,br,p->offset,1);
|
||||
FAT32PrtInit(p);
|
||||
PrtUnlock(p);
|
||||
@@ -201,27 +201,27 @@ U8 fat_long_name_map[13]={
|
||||
offset(CFAT32DirEntryLong.name3)+2
|
||||
};
|
||||
|
||||
Bool CDirLongNameFill(CDirEntry *tempm,CFAT32DirEntryLong *de,I64 *xsum)
|
||||
Bool DirLongNameFill(CDirEntry *tempde,CFAT32DirEntryLong *de,I64 *xsum)
|
||||
{
|
||||
I64 i;
|
||||
U8 *ptr=de;
|
||||
if (de->ord&0x40) {
|
||||
MemSet(tempm,0,sizeof(CDirEntry));
|
||||
MemSet(tempde,0,sizeof(CDirEntry));
|
||||
*xsum=de->xsum;
|
||||
} else if (de->type || de->zero || de->xsum!=*xsum) {
|
||||
MemSet(tempm,0,sizeof(CDirEntry));
|
||||
MemSet(tempde,0,sizeof(CDirEntry));
|
||||
*xsum=0;
|
||||
return FALSE;
|
||||
}
|
||||
switch (de->ord&0x3F) {
|
||||
case 1:
|
||||
for (i=0;i<13;i++)
|
||||
if (!(tempm->name[i]=ptr[fat_long_name_map[i]]))
|
||||
if (!(tempde->name[i]=ptr[fat_long_name_map[i]]))
|
||||
return TRUE;
|
||||
break;
|
||||
case 2:
|
||||
for (i=0;i<12;i++)
|
||||
if (!(tempm->name[i+13]=ptr[fat_long_name_map[i]]))
|
||||
if (!(tempde->name[i+13]=ptr[fat_long_name_map[i]]))
|
||||
return TRUE;
|
||||
break;
|
||||
}
|
||||
@@ -229,21 +229,21 @@ Bool CDirLongNameFill(CDirEntry *tempm,CFAT32DirEntryLong *de,I64 *xsum)
|
||||
}
|
||||
|
||||
|
||||
Bool FAT32CDirFill(CDirEntry *tempm,CFAT32DirEntry *de)
|
||||
Bool FAT32CDirFill(CDirEntry *tempde,CFAT32DirEntry *de)
|
||||
{
|
||||
Bool result;
|
||||
if (*tempm->name)
|
||||
if (*tempde->name)
|
||||
result=TRUE;
|
||||
else
|
||||
result=FATFromName(tempm->name,de->name);
|
||||
tempm->cluster=de->cluster_lo+de->cluster_hi<<16;
|
||||
tempm->size=de->size;
|
||||
tempm->attr=de->attr;
|
||||
tempm->datetime=Dos2CDate(de->WrtTime,de->WrtDate);
|
||||
result=FATFromName(tempde->name,de->name);
|
||||
tempde->cluster=de->cluster_lo+de->cluster_hi<<16;
|
||||
tempde->size=de->size;
|
||||
tempde->attr=de->attr;
|
||||
tempde->datetime=Dos2CDate(de->WrtTime,de->WrtDate);
|
||||
return result;
|
||||
}
|
||||
|
||||
Bool FAT32DirFill(CFAT32DirEntry *de,CDirEntry *tempm,I64 *_de_cnt=NULL)
|
||||
Bool FAT32DirFill(CFAT32DirEntry *de,CDirEntry *tempde,I64 *_de_cnt=NULL)
|
||||
{ //Fill up to 3 entries and store cnt of entries.
|
||||
I64 de_cnt=0,i,l,xsum,ord;
|
||||
U8 *ptr,dname[16];
|
||||
@@ -251,19 +251,19 @@ Bool FAT32DirFill(CFAT32DirEntry *de,CDirEntry *tempm,I64 *_de_cnt=NULL)
|
||||
Bool result;
|
||||
|
||||
MemSet(de,0,sizeof(CFAT32DirEntry));
|
||||
result=FATNameTo(de->name,tempm->name);
|
||||
result=FATNameTo(de->name,tempde->name);
|
||||
FATFromName(dname,de->name);
|
||||
if (StrCmp(dname,tempm->name)) {
|
||||
if (StrCmp(dname,tempde->name)) {
|
||||
ord=0x41;
|
||||
xsum=FATNameXSum(de->name);
|
||||
if ((l=StrLen(tempm->name))>13) {
|
||||
if ((l=StrLen(tempde->name))>13) {
|
||||
ptr=&ld[de_cnt];
|
||||
MemSet(ptr,0,sizeof(CFAT32DirEntryLong));
|
||||
ld[de_cnt].attr=_ATTR_LONG_NAME;
|
||||
ld[de_cnt].xsum=xsum;
|
||||
ld[de_cnt].ord=0x42;
|
||||
for (i=13;i<l;i++)
|
||||
ptr[fat_long_name_map[i-13]]=tempm->name[i];
|
||||
ptr[fat_long_name_map[i-13]]=tempde->name[i];
|
||||
i++;
|
||||
for (;i<26;i++)
|
||||
ptr[fat_long_name_map[i-13]](U16)=0xFFFF;
|
||||
@@ -277,22 +277,22 @@ Bool FAT32DirFill(CFAT32DirEntry *de,CDirEntry *tempm,I64 *_de_cnt=NULL)
|
||||
ld[de_cnt].xsum=xsum;
|
||||
ld[de_cnt].ord=ord;
|
||||
for (i=0;i<l;i++)
|
||||
ptr[fat_long_name_map[i]]=tempm->name[i];
|
||||
ptr[fat_long_name_map[i]]=tempde->name[i];
|
||||
i++;
|
||||
for (;i<13;i++)
|
||||
ptr[fat_long_name_map[i]](U16)=0xFFFF;
|
||||
de_cnt++;
|
||||
MemSet(&de[de_cnt],0,sizeof(CFAT32DirEntry));
|
||||
result=FATNameTo(de[de_cnt].name,tempm->name);
|
||||
result=FATNameTo(de[de_cnt].name,tempde->name);
|
||||
}
|
||||
de[de_cnt].cluster_lo=tempm->cluster.u16[0];
|
||||
de[de_cnt].cluster_hi=tempm->cluster.u16[1];
|
||||
if (!(tempm->attr&_ATTR_DIR))
|
||||
de[de_cnt].size=tempm->size;
|
||||
de[de_cnt].attr=tempm->attr;
|
||||
if (!tempm->datetime)
|
||||
tempm->datetime=GetCurTimeDate;
|
||||
CDate2Dos(&de[de_cnt].WrtTime,&de[de_cnt].WrtDate,tempm->datetime);
|
||||
de[de_cnt].cluster_lo=tempde->cluster.u16[0];
|
||||
de[de_cnt].cluster_hi=tempde->cluster.u16[1];
|
||||
if (!(tempde->attr&_ATTR_DIR))
|
||||
de[de_cnt].size=tempde->size;
|
||||
de[de_cnt].attr=tempde->attr;
|
||||
if (!tempde->datetime)
|
||||
tempde->datetime=GetDateTime;
|
||||
CDate2Dos(&de[de_cnt].WrtTime,&de[de_cnt].WrtDate,tempde->datetime);
|
||||
if (_de_cnt)
|
||||
*_de_cnt=de_cnt+1;
|
||||
return result;
|
||||
@@ -319,14 +319,14 @@ Bool FAT32FileFind(CPrt *p,I64 cur_dir_cluster,U8 *name,CDirEntry *_result,I64 f
|
||||
try {
|
||||
unlock=PrtLock(p);
|
||||
buf=MAlloc(BLK_SIZE*p->spc);
|
||||
entries_per_cluster=FAT32_ENTRIES_PER_BLK*p->spc;
|
||||
entries_per_cluster=p->spc<<FAT32_ENTRIES_BITS;
|
||||
RClusters(p,buf,cur_dir_cluster,1);
|
||||
cur_dir_entry=0;
|
||||
while (ch=*buf[cur_dir_entry].name) {
|
||||
attr=buf[cur_dir_entry].attr;
|
||||
if (ch!=0xE5) {
|
||||
if (attr&_ATTR_LONG_NAME_MASK==_ATTR_LONG_NAME)
|
||||
CDirLongNameFill(&long_name,&buf[cur_dir_entry],&xsum);
|
||||
DirLongNameFill(&long_name,&buf[cur_dir_entry],&xsum);
|
||||
else {
|
||||
if (!(attr&_ATTR_VOL_ID)) {
|
||||
if (xsum==FATNameXSum(buf[cur_dir_entry].name))
|
||||
@@ -601,7 +601,7 @@ I64 FAT32AllocContiguousClusters(CPrt *p,I64 cnt)
|
||||
return first;
|
||||
}
|
||||
|
||||
Bool FAT32DirNew(CPrt *p,U8 *cur_dir,CDirEntry *tempm,Bool free_old_chain)
|
||||
Bool FAT32DirNew(CPrt *p,U8 *cur_dir,CDirEntry *tempde,Bool free_old_chain)
|
||||
{
|
||||
//See $LK-A,"::/TempleOS/Doc/CutCorners.TXT"$.
|
||||
CFAT32DirEntry *buf,*last_buf,*temp_buf,de[3];
|
||||
@@ -611,7 +611,7 @@ Bool FAT32DirNew(CPrt *p,U8 *cur_dir,CDirEntry *tempm,Bool free_old_chain)
|
||||
U8 ch;
|
||||
Bool written=FALSE,unlock,unlock_break;
|
||||
CDirEntry long_name;
|
||||
FAT32DirFill(&de,tempm,&de_cnt);
|
||||
FAT32DirFill(&de,tempde,&de_cnt);
|
||||
MemSet(&long_name,0,sizeof(CDirEntry));
|
||||
try {
|
||||
unlock_break=BreakLock;
|
||||
@@ -619,13 +619,13 @@ Bool FAT32DirNew(CPrt *p,U8 *cur_dir,CDirEntry *tempm,Bool free_old_chain)
|
||||
cur_dir_cluster=Name2DirCluster(p,cur_dir);
|
||||
buf =MAlloc(BLK_SIZE*p->spc);
|
||||
last_buf=CAlloc(BLK_SIZE*p->spc);
|
||||
entries_per_cluster=FAT32_ENTRIES_PER_BLK*p->spc;
|
||||
entries_per_cluster=p->spc<<FAT32_ENTRIES_BITS;
|
||||
RClusters(p,buf,cur_dir_cluster,1);
|
||||
cur_dir_entry=0;
|
||||
while (ch=*buf[cur_dir_entry].name) {
|
||||
attr=buf[cur_dir_entry].attr;
|
||||
if (ch!=0xE5 && attr&_ATTR_LONG_NAME_MASK==_ATTR_LONG_NAME)
|
||||
CDirLongNameFill(&long_name,&buf[cur_dir_entry],&xsum);
|
||||
DirLongNameFill(&long_name,&buf[cur_dir_entry],&xsum);
|
||||
else {
|
||||
avail_cnt=FAT32_ENTRIES_PER_BLK-cur_dir_entry & (FAT32_ENTRIES_PER_BLK-1);
|
||||
for (i=0;i<avail_cnt;i++)
|
||||
@@ -638,7 +638,7 @@ Bool FAT32DirNew(CPrt *p,U8 *cur_dir,CDirEntry *tempm,Bool free_old_chain)
|
||||
MemCpy(&buf[cur_dir_entry],&de,de_cnt*sizeof(CFAT32DirEntry));
|
||||
WBlks(p,&buf[cur_dir_entry & -FAT32_ENTRIES_PER_BLK],
|
||||
p->data+cur_dir_cluster*p->spc
|
||||
+cur_dir_entry/FAT32_ENTRIES_PER_BLK,1);
|
||||
+cur_dir_entry>>FAT32_ENTRIES_BITS,1);
|
||||
cur_dir_entry+=de_cnt-1; //gets inc'ed
|
||||
written=TRUE;
|
||||
} else if (ch!=0xE5 && !(attr&_ATTR_VOL_ID)) {
|
||||
@@ -647,7 +647,7 @@ Bool FAT32DirNew(CPrt *p,U8 *cur_dir,CDirEntry *tempm,Bool free_old_chain)
|
||||
if (!*long_name.name)
|
||||
FATFromName(long_name.name,buf[cur_dir_entry].name);
|
||||
//Del old entry with same name
|
||||
if (!StrCmp(long_name.name,tempm->name)) {
|
||||
if (!StrCmp(long_name.name,tempde->name)) {
|
||||
if (free_old_chain)
|
||||
FAT32FreeClusters(p,buf[cur_dir_entry].cluster_lo+
|
||||
buf[cur_dir_entry].cluster_hi<<16);
|
||||
@@ -655,7 +655,7 @@ Bool FAT32DirNew(CPrt *p,U8 *cur_dir,CDirEntry *tempm,Bool free_old_chain)
|
||||
MemCpy(&buf[cur_dir_entry],&de[de_cnt-1],sizeof(CFAT32DirEntry));
|
||||
WBlks(p,&buf[cur_dir_entry & -FAT32_ENTRIES_PER_BLK],
|
||||
p->data+cur_dir_cluster*p->spc
|
||||
+cur_dir_entry/FAT32_ENTRIES_PER_BLK,1);
|
||||
+cur_dir_entry>>FAT32_ENTRIES_BITS,1);
|
||||
written=TRUE;
|
||||
} else {
|
||||
*buf[cur_dir_entry].name=0xE5;
|
||||
@@ -666,8 +666,8 @@ Bool FAT32DirNew(CPrt *p,U8 *cur_dir,CDirEntry *tempm,Bool free_old_chain)
|
||||
i--;
|
||||
WBlks(p,&buf[(cur_dir_entry-i)&-FAT32_ENTRIES_PER_BLK],
|
||||
p->data+cur_dir_cluster*p->spc
|
||||
+(cur_dir_entry-i)/FAT32_ENTRIES_PER_BLK,
|
||||
(i+FAT32_ENTRIES_PER_BLK)/FAT32_ENTRIES_PER_BLK);
|
||||
+(cur_dir_entry-i)>>FAT32_ENTRIES_BITS,
|
||||
(i+FAT32_ENTRIES_PER_BLK)>>FAT32_ENTRIES_BITS);
|
||||
if (i==cur_dir_entry && 0<last_dir_cluster<0x0FFFFFF8) {
|
||||
i=1;
|
||||
while (i<=entries_per_cluster &&
|
||||
@@ -676,8 +676,8 @@ Bool FAT32DirNew(CPrt *p,U8 *cur_dir,CDirEntry *tempm,Bool free_old_chain)
|
||||
if (--i>0)
|
||||
WBlks(p,&buf[(entries_per_cluster-i)&-FAT32_ENTRIES_PER_BLK],
|
||||
p->data+last_dir_cluster*p->spc
|
||||
+(entries_per_cluster-i)/FAT32_ENTRIES_PER_BLK,
|
||||
(i+FAT32_ENTRIES_PER_BLK-1)/FAT32_ENTRIES_PER_BLK);
|
||||
+(entries_per_cluster-i)>>FAT32_ENTRIES_BITS,
|
||||
(i+FAT32_ENTRIES_PER_BLK-1)>>FAT32_ENTRIES_BITS);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -690,7 +690,7 @@ Bool FAT32DirNew(CPrt *p,U8 *cur_dir,CDirEntry *tempm,Bool free_old_chain)
|
||||
temp_buf=buf; buf=last_buf; last_buf=temp_buf;
|
||||
c=ClusterNumNext(p,cur_dir_cluster);
|
||||
if (!(0<c<0x0FFFFFF8)) {
|
||||
c=ClusersAlloc(p,cur_dir_cluster,1,FALSE);
|
||||
c=ClustersAlloc(p,cur_dir_cluster,1,FALSE);
|
||||
MemSet(buf,0,BLK_SIZE*p->spc);
|
||||
WClusters(p,buf,c,1);
|
||||
} else
|
||||
@@ -706,12 +706,12 @@ Bool FAT32DirNew(CPrt *p,U8 *cur_dir,CDirEntry *tempm,Bool free_old_chain)
|
||||
*buf[cur_dir_entry+i].name=0xE5;
|
||||
WBlks(p,&buf[cur_dir_entry &-FAT32_ENTRIES_PER_BLK],
|
||||
p->data+cur_dir_cluster*p->spc
|
||||
+cur_dir_entry/FAT32_ENTRIES_PER_BLK,1);
|
||||
+cur_dir_entry>>FAT32_ENTRIES_BITS,1);
|
||||
cur_dir_entry+=avail_cnt;
|
||||
if (cur_dir_entry==entries_per_cluster) {
|
||||
last_dir_cluster=cur_dir_cluster;
|
||||
temp_buf=buf; buf=last_buf; last_buf=temp_buf;
|
||||
cur_dir_cluster=ClusersAlloc(p,cur_dir_cluster,1);
|
||||
cur_dir_cluster=ClustersAlloc(p,cur_dir_cluster,1);
|
||||
cur_dir_entry=0;
|
||||
MemSet(buf,0,BLK_SIZE*p->spc);
|
||||
WClusters(p,buf,cur_dir_cluster,1);
|
||||
@@ -720,17 +720,17 @@ Bool FAT32DirNew(CPrt *p,U8 *cur_dir,CDirEntry *tempm,Bool free_old_chain)
|
||||
MemCpy(&buf[cur_dir_entry],&de,de_cnt*sizeof(CFAT32DirEntry));
|
||||
WBlks(p,&buf[cur_dir_entry &-FAT32_ENTRIES_PER_BLK],
|
||||
p->data+cur_dir_cluster*p->spc+
|
||||
cur_dir_entry/FAT32_ENTRIES_PER_BLK,1);
|
||||
cur_dir_entry>>FAT32_ENTRIES_BITS,1);
|
||||
cur_dir_entry+=de_cnt;
|
||||
if (cur_dir_entry==entries_per_cluster) {
|
||||
cur_dir_cluster=ClusersAlloc(p,cur_dir_cluster,1);
|
||||
cur_dir_cluster=ClustersAlloc(p,cur_dir_cluster,1);
|
||||
MemSet(buf,0,BLK_SIZE*p->spc);
|
||||
WClusters(p,buf,cur_dir_cluster,1);
|
||||
} else {
|
||||
MemSet(&buf[cur_dir_entry],0,sizeof(CFAT32DirEntry));
|
||||
WBlks(p,&buf[cur_dir_entry &-FAT32_ENTRIES_PER_BLK],
|
||||
p->data+cur_dir_cluster*p->spc
|
||||
+cur_dir_entry/FAT32_ENTRIES_PER_BLK,1);
|
||||
+cur_dir_entry>>FAT32_ENTRIES_BITS,1);
|
||||
}
|
||||
}
|
||||
Free(last_buf);
|
||||
@@ -764,14 +764,14 @@ I64 FAT32FilesDel(CPrt *p,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
|
||||
cur_dir_cluster=Name2DirCluster(p,cur_dir);
|
||||
buf =MAlloc(BLK_SIZE*p->spc);
|
||||
last_buf=CAlloc(BLK_SIZE*p->spc);
|
||||
entries_per_cluster=FAT32_ENTRIES_PER_BLK*p->spc;
|
||||
entries_per_cluster=p->spc<<FAT32_ENTRIES_BITS;
|
||||
RClusters(p,buf,cur_dir_cluster,1);
|
||||
cur_dir_entry=0;
|
||||
while (ch=*buf[cur_dir_entry].name) {
|
||||
attr=buf[cur_dir_entry].attr;
|
||||
if (ch!=0xE5 && ch!='.') {
|
||||
if (attr&_ATTR_LONG_NAME_MASK==_ATTR_LONG_NAME)
|
||||
CDirLongNameFill(&long_name,&buf[cur_dir_entry],&xsum);
|
||||
DirLongNameFill(&long_name,&buf[cur_dir_entry],&xsum);
|
||||
else {
|
||||
if (!(attr & _ATTR_VOL_ID) &&
|
||||
(del_dir || !(attr & _ATTR_DIR))) {
|
||||
@@ -779,11 +779,11 @@ I64 FAT32FilesDel(CPrt *p,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
|
||||
MemSet(&long_name,0,sizeof(CDirEntry));
|
||||
if (!*long_name.name)
|
||||
FATFromName(long_name.name,buf[cur_dir_entry].name);
|
||||
if (FilesFindMatch(files_find_mask,long_name.name,fuf_flags)) {
|
||||
if (FilesFindMatch(long_name.name,files_find_mask,fuf_flags)) {
|
||||
if (!(attr & _ATTR_DIR)) result++;
|
||||
if (print_msg) {
|
||||
PutDefine("ST_DELETE");
|
||||
"" long_name.name;
|
||||
"%s",long_name.name;
|
||||
NewLine;
|
||||
}
|
||||
*buf[cur_dir_entry].name=0xE5;
|
||||
@@ -794,8 +794,8 @@ I64 FAT32FilesDel(CPrt *p,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
|
||||
i--;
|
||||
WBlks(p,&buf[(cur_dir_entry-i)&-FAT32_ENTRIES_PER_BLK],
|
||||
p->data+cur_dir_cluster*p->spc
|
||||
+(cur_dir_entry-i)/FAT32_ENTRIES_PER_BLK,
|
||||
(i+FAT32_ENTRIES_PER_BLK)/FAT32_ENTRIES_PER_BLK);
|
||||
+(cur_dir_entry-i)>>FAT32_ENTRIES_BITS,
|
||||
(i+FAT32_ENTRIES_PER_BLK)>>FAT32_ENTRIES_BITS);
|
||||
if (i==cur_dir_entry && last_dir_cluster!=INVALID_CLUSTER) {
|
||||
i=1;
|
||||
while (i<=entries_per_cluster &&
|
||||
@@ -804,8 +804,8 @@ I64 FAT32FilesDel(CPrt *p,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
|
||||
if (--i>0)
|
||||
WBlks(p,&buf[(entries_per_cluster-i)&-FAT32_ENTRIES_PER_BLK],
|
||||
p->data+last_dir_cluster*p->spc
|
||||
+(entries_per_cluster-i)/FAT32_ENTRIES_PER_BLK,
|
||||
(i+FAT32_ENTRIES_PER_BLK-1)/FAT32_ENTRIES_PER_BLK);
|
||||
+(entries_per_cluster-i)>>FAT32_ENTRIES_BITS,
|
||||
(i+FAT32_ENTRIES_PER_BLK-1)>>FAT32_ENTRIES_BITS);
|
||||
}
|
||||
FAT32FreeClusters(p,buf[cur_dir_entry].cluster_lo+
|
||||
buf[cur_dir_entry].cluster_hi<<16);
|
||||
@@ -848,7 +848,7 @@ I64 FAT32FileWrite(CPrt *p,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
|
||||
if (_ac2) *_ac2=NULL;
|
||||
if (size<0) size=0;
|
||||
if (!cdt)
|
||||
cdt=GetCurTimeDate;
|
||||
cdt=GetDateTime;
|
||||
if (p->type!=PT_FAT32)
|
||||
PutDefine("ST_NOT_FAT32");
|
||||
else if (!CFileNameTo(de.name,name))
|
||||
@@ -867,7 +867,7 @@ I64 FAT32FileWrite(CPrt *p,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
|
||||
}
|
||||
de.size=size;
|
||||
if (blk_cnt=(size+BLK_SIZE-1)>>BLK_SIZE_BITS)
|
||||
c=ClusersAlloc(p,0,(blk_cnt+p->spc-1)/p->spc,contiguous);
|
||||
c=ClustersAlloc(p,0,(blk_cnt+p->spc-1)/p->spc,contiguous);
|
||||
else
|
||||
c=0x0FFFFFFF;
|
||||
de.cluster=c;
|
||||
@@ -891,7 +891,7 @@ CDirEntry *FAT32FilesFind(U8 *files_find_mask,I64 fuf_flags,CDirEntry *parent=NU
|
||||
I64 attr,xsum=0,dir_size=0,sub_dir_size,
|
||||
cur_dir_cluster,cur_dir_entry,entries_per_cluster;
|
||||
U8 ch;
|
||||
CDirEntry *result=NULL,*tempm,long_name;
|
||||
CDirEntry *result=NULL,*tempde,long_name;
|
||||
if (fuf_flags&~FUG_FILES_FIND)
|
||||
throw(EXCEPT_FUF,7);
|
||||
try {
|
||||
@@ -899,7 +899,7 @@ CDirEntry *FAT32FilesFind(U8 *files_find_mask,I64 fuf_flags,CDirEntry *parent=NU
|
||||
PrtLock(p);
|
||||
cur_dir_cluster=Name2DirCluster(p,Fs->cur_dir);
|
||||
buf=MAlloc(BLK_SIZE*p->spc);
|
||||
entries_per_cluster=FAT32_ENTRIES_PER_BLK*p->spc;
|
||||
entries_per_cluster=p->spc<<FAT32_ENTRIES_BITS;
|
||||
RClusters(Fs->cur_prt,buf,cur_dir_cluster,1);
|
||||
dir_size+=Fs->cur_prt->spc*BLK_SIZE;
|
||||
cur_dir_entry=0;
|
||||
@@ -907,37 +907,37 @@ CDirEntry *FAT32FilesFind(U8 *files_find_mask,I64 fuf_flags,CDirEntry *parent=NU
|
||||
attr=buf[cur_dir_entry].attr;
|
||||
if (ch!=0xE5) {
|
||||
if (attr&_ATTR_LONG_NAME_MASK==_ATTR_LONG_NAME)
|
||||
CDirLongNameFill(&long_name,&buf[cur_dir_entry],&xsum);
|
||||
DirLongNameFill(&long_name,&buf[cur_dir_entry],&xsum);
|
||||
else {
|
||||
if (!(attr&_ATTR_VOL_ID)) {
|
||||
tempm=MAlloc(sizeof(CDirEntry));
|
||||
tempde=MAlloc(sizeof(CDirEntry));
|
||||
if (xsum==FATNameXSum(buf[cur_dir_entry].name))
|
||||
MemCpy(tempm,&long_name,sizeof(CDirEntry));
|
||||
MemCpy(tempde,&long_name,sizeof(CDirEntry));
|
||||
else
|
||||
MemSet(tempm,0,sizeof(CDirEntry));
|
||||
if (FAT32CDirFill(tempm,&buf[cur_dir_entry])) {
|
||||
tempm->parent=parent;
|
||||
if (Bt(&fuf_flags,FUf_RECURSE) && attr&_ATTR_DIR && *tempm->name!='.') {
|
||||
tempm->next=result;
|
||||
result=tempm;
|
||||
tempm->full_name=DirNameAbs(tempm->name);
|
||||
MemSet(tempde,0,sizeof(CDirEntry));
|
||||
if (FAT32CDirFill(tempde,&buf[cur_dir_entry])) {
|
||||
tempde->parent=parent;
|
||||
if (Bt(&fuf_flags,FUf_RECURSE) && attr&_ATTR_DIR && *tempde->name!='.') {
|
||||
tempde->next=result;
|
||||
result=tempde;
|
||||
tempde->full_name=DirNameAbs(tempde->name);
|
||||
PrtUnlock(p);
|
||||
if (Cd(tempm->name)) {
|
||||
tempm->sub=FAT32FilesFind(files_find_mask,fuf_flags,tempm,&sub_dir_size);
|
||||
tempm->size=tempm->expanded_size=sub_dir_size;
|
||||
if (Cd(tempde->name)) {
|
||||
tempde->sub=FAT32FilesFind(files_find_mask,fuf_flags,tempde,&sub_dir_size);
|
||||
tempde->size=sub_dir_size;
|
||||
Cd("..");
|
||||
}
|
||||
PrtLock(p);
|
||||
} else if ((attr&_ATTR_DIR || !Bt(&fuf_flags,FUf_JUST_DIRS)) &&
|
||||
!(Bt(&fuf_flags,FUf_RECURSE) && *tempm->name=='.' && attr&_ATTR_DIR) &&
|
||||
FilesFindMatch(files_find_mask,tempm->name,fuf_flags)) {
|
||||
tempm->next=result;
|
||||
result=tempm;
|
||||
tempm->full_name=FileNameAbs(tempm->name);
|
||||
!(Bt(&fuf_flags,FUf_RECURSE) && *tempde->name=='.' && attr&_ATTR_DIR) &&
|
||||
FilesFindMatch(tempde->name,files_find_mask,fuf_flags)) {
|
||||
tempde->next=result;
|
||||
result=tempde;
|
||||
tempde->full_name=FileNameAbs(tempde->name);
|
||||
} else
|
||||
CDirEntryDel(tempm);
|
||||
DirEntryDel(tempde);
|
||||
} else
|
||||
CDirEntryDel(tempm);
|
||||
DirEntryDel(tempde);
|
||||
}
|
||||
MemSet(&long_name,0,sizeof(CDirEntry));
|
||||
}
|
||||
@@ -982,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=GetCurTimeDate;
|
||||
d_native.datetime=GetDateTime;
|
||||
FAT32DirFill(dFAT,&d_native);
|
||||
dFAT++;
|
||||
|
||||
@@ -993,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=GetCurTimeDate;
|
||||
d_native.datetime=GetDateTime;
|
||||
FAT32DirFill(dFAT,&d_native);
|
||||
WClusters(p,buf,c,1);
|
||||
Free(buf);
|
||||
|
||||
@@ -21,7 +21,7 @@ Bool ISOPrtInit(CPrt *p,I64 blk)
|
||||
RBlks(p,iso,i*spc,spc);
|
||||
buf[0](U32)=iso->id[0](U32);
|
||||
buf[4](U16)=iso->id[4](U8);
|
||||
switch (LstEntryMatch(buf,"CD001\0CDW02\0BEA01\0BOOT2\0NSR02\0NSR03\0TEA01\0",LEF_EXACT)) {
|
||||
switch (LstMatch(buf,"CD001\0CDW02\0BEA01\0BOOT2\0NSR02\0NSR03\0TEA01\0",LMF_EXACT)) {
|
||||
case 0:
|
||||
p->type=PT_ISO9660;
|
||||
switch (iso->type) {
|
||||
@@ -112,25 +112,17 @@ Bool ISO1FromName(U8 *dst,U8 *src)
|
||||
return FileNameChk(dst);
|
||||
}
|
||||
|
||||
Bool ISO1CDirFill(CPrt *p,CDirEntry *tempm,CISO1DirEntry *de)
|
||||
Bool ISO1CDirFill(CDirEntry *tempde,CISO1DirEntry *de)
|
||||
{
|
||||
Bool result;
|
||||
CArcCompress *buf;
|
||||
MemSet(tempm,0,sizeof(CDirEntry));
|
||||
result=ISO1FromName(tempm->name,&de->name_len);
|
||||
tempm->cluster=de->loc.little;
|
||||
tempm->size=de->size.little;
|
||||
tempm->attr=FileAttr(tempm->name);
|
||||
MemSet(tempde,0,sizeof(CDirEntry));
|
||||
result=ISO1FromName(tempde->name,&de->name_len);
|
||||
tempde->cluster=de->loc.little;
|
||||
tempde->size=de->size.little;
|
||||
tempde->attr=FileAttr(tempde->name);
|
||||
if (de->flags & ISO1_ATTR_DIR)
|
||||
tempm->attr|=_ATTR_DIR;
|
||||
tempm->datetime=ISO1DateStruct2CDate(&de->date);
|
||||
if (tempm->attr & _ATTR_COMPRESSED) {
|
||||
buf=MAlloc(BLK_SIZE);
|
||||
RClustersBlks(p,buf,tempm->cluster,1);
|
||||
tempm->expanded_size=buf->expanded_size;
|
||||
Free(buf);
|
||||
} else
|
||||
tempm->expanded_size=tempm->size;
|
||||
tempde->attr|=_ATTR_DIR;
|
||||
tempde->datetime=ISO1DateStruct2CDate(&de->date);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -169,7 +161,7 @@ Bool ISO1FileFind(CPrt *p,I64 cur_dir_cluster,U8 *name,CDirEntry *_result,I64 fu
|
||||
ISO1FromName(dname,&isoptr->name_len);
|
||||
if (*dname) {
|
||||
if (!StrCmp(name,dname)) {
|
||||
result=ISO1CDirFill(p,_result,isoptr);
|
||||
result=ISO1CDirFill(_result,isoptr);
|
||||
if (result &&
|
||||
!(fuf_flags&FUF_JUST_DIRS && !(_result->attr & _ATTR_DIR)) &&
|
||||
!(fuf_flags&FUF_JUST_FILES && _result->attr & _ATTR_DIR) )
|
||||
@@ -262,7 +254,7 @@ CDirEntry *ISO1FilesFind(U8 *files_find_mask,I64 fuf_flags,CDirEntry *parent=NUL
|
||||
CPrt *p=Fs->cur_prt;
|
||||
CISO1DirEntry *buf,*buf2,*isoptr;
|
||||
I64 i,cur_dir_cluster=Name2DirCluster(p,Fs->cur_dir);
|
||||
CDirEntry *result=NULL,*tempm;
|
||||
CDirEntry *result=NULL,*tempde;
|
||||
if (fuf_flags&~FUG_FILES_FIND)
|
||||
throw(EXCEPT_FUF,9);
|
||||
isoptr=MAlloc(p->spc<<BLK_SIZE_BITS);
|
||||
@@ -283,27 +275,27 @@ CDirEntry *ISO1FilesFind(U8 *files_find_mask,I64 fuf_flags,CDirEntry *parent=NUL
|
||||
buf(U8 *)++;
|
||||
i--;
|
||||
} else {
|
||||
tempm=MAlloc(sizeof(CDirEntry));
|
||||
if (ISO1CDirFill(Fs->cur_prt,tempm,buf)) {
|
||||
tempm->parent=parent;
|
||||
if (Bt(&fuf_flags,FUf_RECURSE) && tempm->attr&_ATTR_DIR && *tempm->name!='.') {
|
||||
tempm->next=result;
|
||||
result=tempm;
|
||||
tempm->full_name=DirNameAbs(tempm->name);
|
||||
if (Cd(tempm->name)) {
|
||||
tempm->sub=ISO1FilesFind(files_find_mask,fuf_flags,tempm);
|
||||
tempde=MAlloc(sizeof(CDirEntry));
|
||||
if (ISO1CDirFill(tempde,buf)) {
|
||||
tempde->parent=parent;
|
||||
if (Bt(&fuf_flags,FUf_RECURSE) && tempde->attr&_ATTR_DIR && *tempde->name!='.') {
|
||||
tempde->next=result;
|
||||
result=tempde;
|
||||
tempde->full_name=DirNameAbs(tempde->name);
|
||||
if (Cd(tempde->name)) {
|
||||
tempde->sub=ISO1FilesFind(files_find_mask,fuf_flags,tempde);
|
||||
Cd("..");
|
||||
}
|
||||
} else if ((tempm->attr & _ATTR_DIR || !Bt(&fuf_flags,FUf_JUST_DIRS)) &&
|
||||
!(Bt(&fuf_flags,FUf_RECURSE) && *tempm->name=='.' && tempm->attr&_ATTR_DIR) &&
|
||||
FilesFindMatch(files_find_mask,tempm->name,fuf_flags)) {
|
||||
tempm->next=result;
|
||||
result=tempm;
|
||||
tempm->full_name=FileNameAbs(tempm->name);
|
||||
} else if ((tempde->attr & _ATTR_DIR || !Bt(&fuf_flags,FUf_JUST_DIRS)) &&
|
||||
!(Bt(&fuf_flags,FUf_RECURSE) && *tempde->name=='.' && tempde->attr&_ATTR_DIR) &&
|
||||
FilesFindMatch(tempde->name,files_find_mask,fuf_flags)) {
|
||||
tempde->next=result;
|
||||
result=tempde;
|
||||
tempde->full_name=FileNameAbs(tempde->name);
|
||||
} else
|
||||
CDirEntryDel(tempm);
|
||||
DirEntryDel(tempde);
|
||||
} else
|
||||
CDirEntryDel(tempm);
|
||||
DirEntryDel(tempde);
|
||||
i-=buf->len;
|
||||
buf(U8 *)+=buf->len;
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ U0 RedSeaFSFmt(U8 drv_let,Bool quick=TRUE)
|
||||
n=br->sects_per_cluster*(BLK_SIZE<<3);
|
||||
n=(br->sects+n-1)/n;
|
||||
br->bitmap_sects=n;
|
||||
br->unique_id=GetTimeStamp>>4;
|
||||
br->unique_id=GetTSC>>4;
|
||||
br->root_cluster=0;
|
||||
|
||||
if (quick)
|
||||
@@ -144,8 +144,8 @@ U0 RedSeaFSFmt(U8 drv_let,Bool quick=TRUE)
|
||||
|
||||
WBlks(p,br,p->offset,1);
|
||||
RedSeaFSPrtInit(p);
|
||||
ClusersAlloc(p,0,1,FALSE); //Alloc #1
|
||||
br->root_cluster=ClusersAlloc(p,0,1,FALSE);
|
||||
ClustersAlloc(p,0,1,FALSE); //Alloc #1
|
||||
br->root_cluster=ClustersAlloc(p,0,1,FALSE);
|
||||
WBlks(p,br,p->offset,1);
|
||||
root_dir=CAlloc(p->spc<<BLK_SIZE_BITS);
|
||||
|
||||
@@ -155,8 +155,7 @@ U0 RedSeaFSFmt(U8 drv_let,Bool quick=TRUE)
|
||||
*d_native->name='.';
|
||||
d_native->cluster=br->root_cluster;
|
||||
d_native->size=p->spc<<BLK_SIZE_BITS;
|
||||
d_native->expanded_size=d_native->size;
|
||||
d_native->datetime=GetCurTimeDate;
|
||||
d_native->datetime=GetDateTime;
|
||||
|
||||
d_native(U8 *)+=CDIR_SIZE;
|
||||
|
||||
@@ -164,7 +163,7 @@ U0 RedSeaFSFmt(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=GetCurTimeDate;
|
||||
d_native->datetime=GetDateTime;
|
||||
|
||||
WBlks(p,root_dir,p->data+br->root_cluster*p->spc,p->spc);
|
||||
RedSeaFSPrtInit(p);
|
||||
@@ -253,10 +252,6 @@ U8 *RedSeaFSFileRead(CPrt *p,U8 *cur_dir,U8 *filename,I64 *_size,
|
||||
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) !=TEMPLEOS_XSUM)
|
||||
throw(EXCEPT_ARC_XSUM);
|
||||
}
|
||||
if (FileAttr(de.name) & _ATTR_COMPRESSED && !raw) {
|
||||
ac=buf;
|
||||
if (_attr) *_attr=FileAttr(de.name,*_attr);
|
||||
@@ -437,12 +432,11 @@ Bool RedSeaFSDirNew(CPrt *p,U8 *cur_dir,CDirEntry *de,Bool free_old_chain)
|
||||
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);
|
||||
c=ClustersAlloc(p,0,(dir_size>>BLK_SIZE_BITS+p->spc-1)/p->spc,TRUE);
|
||||
Free(buf);
|
||||
buf=buf2;
|
||||
ptr=buf(U8 *)-offset(CDirEntry.start);
|
||||
ptr->size=dir_size;
|
||||
ptr->expanded_size=dir_size;
|
||||
ptr->cluster=c;
|
||||
WClustersBlks(p,buf,c,dir_size>>BLK_SIZE_BITS);
|
||||
if (cur_dir_cluster==p->root_cluster) {
|
||||
@@ -464,7 +458,6 @@ Bool RedSeaFSDirNew(CPrt *p,U8 *cur_dir,CDirEntry *de,Bool free_old_chain)
|
||||
temp,&de2,FUF_JUST_DIRS)) {
|
||||
de2.cluster=c;
|
||||
de2.size=dir_size;
|
||||
de2.expanded_size=dir_size;
|
||||
RedSeaFSDirNew(p,parent_dir,&de2,FALSE);
|
||||
} else
|
||||
Dbg;
|
||||
@@ -540,11 +533,11 @@ I64 RedSeaFSFilesDel(CPrt *p,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
|
||||
break;
|
||||
else if (!(ptr->attr & _ATTR_DELETED) && ch!='.' && (del_dir ||
|
||||
!(ptr->attr & _ATTR_DIR)) &&
|
||||
FilesFindMatch(files_find_mask,ptr->name,fuf_flags)) {
|
||||
FilesFindMatch(ptr->name,files_find_mask,fuf_flags)) {
|
||||
if (!(ptr->attr & _ATTR_DIR)) result++;
|
||||
if (print_msg) {
|
||||
PutDefine("ST_DELETE");
|
||||
"" ptr->name;
|
||||
"%s",ptr->name;
|
||||
NewLine;
|
||||
}
|
||||
ptr->attr|=_ATTR_DELETED;
|
||||
@@ -583,7 +576,7 @@ I64 RedSeaFSFileWrite(CPrt *p,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
|
||||
if (_ac2) *_ac2=NULL;
|
||||
if (size<0) size=0;
|
||||
if (!cdt)
|
||||
cdt=GetCurTimeDate;
|
||||
cdt=GetDateTime;
|
||||
|
||||
if (p->type!=PT_REDSEA)
|
||||
PutDefineErr("ST_NOT_REDSEA");
|
||||
@@ -594,16 +587,14 @@ I64 RedSeaFSFileWrite(CPrt *p,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
|
||||
attr=FileAttr(name,attr);
|
||||
attr|=_ATTR_CONTIGUOUS;
|
||||
contiguous=TRUE;
|
||||
de.expanded_size=size;
|
||||
if (attr&_ATTR_COMPRESSED && !raw) {
|
||||
ac=CompressBuf(buf,size,flags);
|
||||
size=ac->compressed_size;
|
||||
buf=ac;
|
||||
}
|
||||
de.size=size;
|
||||
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);
|
||||
c=ClustersAlloc(p,0,(blk_cnt+p->spc-1)/p->spc,contiguous);
|
||||
else
|
||||
c=INVALID_CLUSTER;
|
||||
de.cluster=c;
|
||||
@@ -623,7 +614,7 @@ I64 RedSeaFSFileWrite(CPrt *p,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
|
||||
CDirEntry *RedSeaFSFilesFind(U8 *files_find_mask,I64 fuf_flags,CDirEntry *parent=NULL)
|
||||
{
|
||||
CPrt *p=Fs->cur_prt;
|
||||
CDirEntry *buf,*buf2,*ptr,*result=NULL,*tempm;
|
||||
CDirEntry *buf,*buf2,*ptr,*result=NULL,*tempde;
|
||||
I64 ch,cur_dir_cluster;
|
||||
if (fuf_flags&~FUG_FILES_FIND)
|
||||
throw(EXCEPT_FUF,11);
|
||||
@@ -648,27 +639,27 @@ CDirEntry *RedSeaFSFilesFind(U8 *files_find_mask,I64 fuf_flags,CDirEntry *parent
|
||||
if (!(ch=*ptr->name))
|
||||
break;
|
||||
else if (!(ptr->attr & _ATTR_DELETED)) {
|
||||
tempm=CAlloc(sizeof(CDirEntry));
|
||||
MemCpy(&tempm->start,&ptr->start,CDIR_SIZE);
|
||||
tempm->parent=parent;
|
||||
if (Bt(&fuf_flags,FUf_RECURSE) && tempm->attr&_ATTR_DIR && *tempm->name!='.') {
|
||||
tempm->next=result;
|
||||
result=tempm;
|
||||
tempm->full_name=DirNameAbs(tempm->name);
|
||||
tempde=CAlloc(sizeof(CDirEntry));
|
||||
MemCpy(&tempde->start,&ptr->start,CDIR_SIZE);
|
||||
tempde->parent=parent;
|
||||
if (Bt(&fuf_flags,FUf_RECURSE) && tempde->attr&_ATTR_DIR && *tempde->name!='.') {
|
||||
tempde->next=result;
|
||||
result=tempde;
|
||||
tempde->full_name=DirNameAbs(tempde->name);
|
||||
PrtUnlock(p);
|
||||
if (Cd(tempm->name)) {
|
||||
tempm->sub=RedSeaFSFilesFind(files_find_mask,fuf_flags,tempm);
|
||||
if (Cd(tempde->name)) {
|
||||
tempde->sub=RedSeaFSFilesFind(files_find_mask,fuf_flags,tempde);
|
||||
Cd("..");
|
||||
}
|
||||
PrtLock(p);
|
||||
} else if ((tempm->attr&_ATTR_DIR || !Bt(&fuf_flags,FUf_JUST_DIRS)) &&
|
||||
!(Bt(&fuf_flags,FUf_RECURSE) && *tempm->name=='.' && tempm->attr&_ATTR_DIR) &&
|
||||
FilesFindMatch(files_find_mask,tempm->name,fuf_flags)) {
|
||||
tempm->next=result;
|
||||
result=tempm;
|
||||
tempm->full_name=FileNameAbs(tempm->name);
|
||||
} else if ((tempde->attr&_ATTR_DIR || !Bt(&fuf_flags,FUf_JUST_DIRS)) &&
|
||||
!(Bt(&fuf_flags,FUf_RECURSE) && *tempde->name=='.' && tempde->attr&_ATTR_DIR) &&
|
||||
FilesFindMatch(tempde->name,files_find_mask,fuf_flags)) {
|
||||
tempde->next=result;
|
||||
result=tempde;
|
||||
tempde->full_name=FileNameAbs(tempde->name);
|
||||
} else
|
||||
CDirEntryDel(tempm);
|
||||
DirEntryDel(tempde);
|
||||
}
|
||||
ptr(U8 *)+=CDIR_SIZE;
|
||||
}
|
||||
@@ -694,8 +685,7 @@ Bool RedSeaFSMkDir(CPrt *p,U8 *cur_dir,U8 *name)
|
||||
StrCpy(d_native->name,name);
|
||||
d_native->cluster=c;
|
||||
d_native->size=size;
|
||||
d_native->expanded_size=size;
|
||||
d_native->datetime=GetCurTimeDate;
|
||||
d_native->datetime=GetDateTime;
|
||||
d_native(U8 *)+=CDIR_SIZE;
|
||||
|
||||
d_native->attr=_ATTR_DIR|_ATTR_CONTIGUOUS;
|
||||
@@ -704,8 +694,7 @@ Bool RedSeaFSMkDir(CPrt *p,U8 *cur_dir,U8 *name)
|
||||
d_native->name[2]=0;
|
||||
d_native->cluster=cur_dir_cluster;
|
||||
d_native->size=0;
|
||||
d_native->expanded_size=0;
|
||||
d_native->datetime=GetCurTimeDate;
|
||||
d_native->datetime=GetDateTime;
|
||||
WClusters(p,buf,c,1);
|
||||
Free(buf);
|
||||
if (unlock_break)
|
||||
|
||||
Reference in new issue
Block a user