Nightly update (ISO SHA-1 29c437f)
This commit is contained in:
1 parent
0315c180e3
commit
b650d335ae
95 files changed
+1969
-1195
No files matched your search
@@ -463,7 +463,7 @@ Bool ATARBlks(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
|
||||
|
||||
U0 ATAWriteBlks(CBlkDev *bd,U8 *buf, I64 blk, I64 cnt)
|
||||
{//For low level disk access.
|
||||
//Use WBlks() instead.
|
||||
//Use BlkWrite() instead.
|
||||
I64 i,U32s_avail,sects_avail,retries=3;
|
||||
F64 timeout;
|
||||
Bool unlock=BlkDevLock(bd);
|
||||
|
||||
@@ -260,7 +260,7 @@ CBlkDev *ATAMount(U8 first_drv_let,I64 type,I64 base0,I64 base1,I64 unit)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
I64 AutoMountIDE()
|
||||
I64 MountIDEAuto()
|
||||
{//Try to mount hard drive and CD/DVD, automatically. (Kernel.Cfg option).
|
||||
//It uses 'C' and 'T' as first drive letters or whatever you set
|
||||
//in config when compiling Kernel.BIN.
|
||||
@@ -288,6 +288,6 @@ I64 AutoMountIDE()
|
||||
tmpha=tmpha->next;
|
||||
}
|
||||
LinkedLstDel(head);
|
||||
blkdev.auto_mount_ide_cnt=res;
|
||||
blkdev.mount_ide_auto_cnt=res;
|
||||
return res;
|
||||
}
|
||||
@@ -78,7 +78,7 @@ I64 BlkDevAdd(CBlkDev *bd,I64 prt_num=I64_MIN,
|
||||
break;
|
||||
}
|
||||
offset=0;
|
||||
ext_base=INVALID_CLUSTER;
|
||||
ext_base=INVALID_CLUS;
|
||||
while (prt_num<0 || num<=prt_num) {
|
||||
ATAReadBlks(bd,&mbr,offset,1);
|
||||
if (mbr.signature!=0xAA55)
|
||||
@@ -144,7 +144,7 @@ I64 BlkDevAdd(CBlkDev *bd,I64 prt_num=I64_MIN,
|
||||
break;
|
||||
if (!mbr.p[j].offset)
|
||||
break;
|
||||
if (ext_base==INVALID_CLUSTER) {
|
||||
if (ext_base==INVALID_CLUS) {
|
||||
offset=mbr.p[j].offset;
|
||||
ext_base=offset;
|
||||
} else
|
||||
@@ -231,8 +231,8 @@ U0 BlkDevsInitAll()
|
||||
for (i=0;i<DRVS_NUM;i++)
|
||||
blkdev.let_to_drv[i]=&blkdev.drvs[i];
|
||||
#exe {
|
||||
if (kernel_cfg->opts[CFG_AUTO_MOUNT_IDE])
|
||||
StreamPrint("AutoMountIDE;");
|
||||
if (kernel_cfg->opts[CFG_MOUNT_IDE_AUTO])
|
||||
StreamPrint("MountIDEAuto;");
|
||||
StreamPrint("#exe {Option(OPTf_WARN_PAREN,OFF);}");
|
||||
StreamDoc(kernel_cfg->add_dev);
|
||||
StreamPrint("#exe {Option(OPTf_WARN_PAREN,ON);}");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#define ZERO_BUF_SIZE 2048
|
||||
U0 WZeroBlks(CDrv *dv,I64 blk,I64 cnt)
|
||||
U0 BlkWriteZero(CDrv *dv,I64 blk,I64 cnt)
|
||||
{//Fill blk cnt with zeros in Drv.
|
||||
I64 n;
|
||||
U8 *z=CAlloc(ZERO_BUF_SIZE<<BLK_SIZE_BITS);
|
||||
@@ -14,7 +14,7 @@ U0 WZeroBlks(CDrv *dv,I64 blk,I64 cnt)
|
||||
n=cnt;
|
||||
if (n>ZERO_BUF_SIZE)
|
||||
n=ZERO_BUF_SIZE;
|
||||
WBlks(dv,z,blk,n);
|
||||
BlkWrite(dv,z,blk,n);
|
||||
blk+=n;
|
||||
cnt-=n;
|
||||
if (show_progress)
|
||||
@@ -28,7 +28,7 @@ U0 WZeroBlks(CDrv *dv,I64 blk,I64 cnt)
|
||||
}
|
||||
}
|
||||
|
||||
Bool RBlks(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
|
||||
Bool BlkRead(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
|
||||
{//Read blk cnt from Drv to buf.
|
||||
Bool res=TRUE,unlock;
|
||||
CBlkDev *bd=dv->bd;
|
||||
@@ -49,7 +49,7 @@ Bool RBlks(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
|
||||
break;
|
||||
case BDT_ISO_FILE_READ:
|
||||
case BDT_ISO_FILE_WRITE:
|
||||
FRBlks(bd->file_dsk,buf,blk,cnt);
|
||||
FBlkRead(bd->file_dsk,buf,blk,cnt);
|
||||
break;
|
||||
case BDT_ATA:
|
||||
case BDT_ATAPI:
|
||||
@@ -68,7 +68,7 @@ Bool RBlks(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
|
||||
return res;
|
||||
}
|
||||
|
||||
Bool WBlks(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
|
||||
Bool BlkWrite(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
|
||||
{//Write blk cnt from buf to Drv.
|
||||
Bool res=TRUE,unlock;
|
||||
CBlkDev *bd=dv->bd;
|
||||
@@ -89,7 +89,7 @@ Bool WBlks(CDrv *dv,U8 *buf, I64 blk, I64 cnt)
|
||||
break;
|
||||
case BDT_ISO_FILE_READ:
|
||||
case BDT_ISO_FILE_WRITE:
|
||||
FWBlks(bd->file_dsk,buf,blk,cnt);
|
||||
FBlkWrite(bd->file_dsk,buf,blk,cnt);
|
||||
break;
|
||||
case BDT_ATA:
|
||||
case BDT_ATAPI:
|
||||
|
||||
@@ -15,10 +15,10 @@ Bool ISOInit(CDrv *dv,I64 blk)
|
||||
unlock=DrvLock(dv);
|
||||
dv->fs_type=FSt_ISO9660;
|
||||
dv->spc=spc;
|
||||
dv->data_area=dv->root_cluster=dv->drv_offset=bd->drv_offset=dv->size=0;
|
||||
dv->data_area=dv->root_clus=dv->drv_offset=bd->drv_offset=dv->size=0;
|
||||
while (TRUE) {
|
||||
dv->size=MaxI64(dv->size,(i+1)*spc);
|
||||
RBlks(dv,iso,i*spc,spc);
|
||||
BlkRead(dv,iso,i*spc,spc);
|
||||
buf[0](U32)=iso->id[0](U32);
|
||||
buf[4](U16)=iso->id[4](U8);
|
||||
switch (LstMatch(buf,"CD001\0CDW02\0BEA01\0BOOT2\0NSR02\0NSR03\0TEA01\0",
|
||||
@@ -38,7 +38,7 @@ Bool ISOInit(CDrv *dv,I64 blk)
|
||||
dv->size-=bd->drv_offset;
|
||||
RedSeaInit(dv);
|
||||
} else
|
||||
dv->root_cluster=de->loc.little;
|
||||
dv->root_clus=de->loc.little;
|
||||
res=TRUE;
|
||||
goto di_done;
|
||||
case ISO1T_TERMINATOR:
|
||||
@@ -58,7 +58,7 @@ di_done:
|
||||
} catch {
|
||||
dv->fs_type=FSt_ISO9660;
|
||||
dv->spc=spc;
|
||||
dv->drv_offset=bd->drv_offset=dv->data_area=dv->root_cluster=0;
|
||||
dv->drv_offset=bd->drv_offset=dv->data_area=dv->root_clus=0;
|
||||
Free(iso);
|
||||
if (unlock)
|
||||
DrvUnlock(dv);
|
||||
@@ -71,7 +71,7 @@ U0 DVDImageRead(U8 dvd_drv_let,U8 *out_name)
|
||||
CDrv *dv=Let2Drv(dvd_drv_let);
|
||||
CBlkDev *bd=dv->bd;
|
||||
U8 *buf=MAlloc(COPY_BUF_BLKS<<BLK_SIZE_BITS),
|
||||
*out_name2=DftExt(out_name,"ISO");
|
||||
*out_name2=ExtDft(out_name,"ISO");
|
||||
CFile *f=FOpen(out_name2,"w");
|
||||
I64 n,spc=bd->blk_size>>BLK_SIZE_BITS,blk=0,cnt,retry;
|
||||
BlkDevInit(bd);
|
||||
@@ -97,7 +97,7 @@ U0 DVDImageRead(U8 dvd_drv_let,U8 *out_name)
|
||||
if (!retry)
|
||||
ATAPIReadBlks2(bd,0,buf,blk/spc,n/spc,TRUE);
|
||||
|
||||
FWBlks(f,buf,blk,n);
|
||||
FBlkWrite(f,buf,blk,n);
|
||||
cnt-=n;
|
||||
blk+=n;
|
||||
}
|
||||
@@ -136,7 +136,7 @@ U0 DVDImageWriteTask(CDualBuf *d)
|
||||
buf=d->buf0;
|
||||
while (d->in_buf>d->out_buf+1)
|
||||
Yield;
|
||||
FRBlks(f,buf,blk,n);
|
||||
FBlkRead(f,buf,blk,n);
|
||||
d->in_buf++;
|
||||
cnt-=n;
|
||||
blk+=n;
|
||||
@@ -156,7 +156,7 @@ U0 DVDImageWrite(U8 dvd_drv_let,U8 *in_name=NULL,I64 media_type=MT_DVD)
|
||||
|
||||
if (!in_name)
|
||||
in_name=blkdev.dft_iso_filename;
|
||||
in_name3=DftExt(in_name,"ISO");
|
||||
in_name3=ExtDft(in_name,"ISO");
|
||||
in_name2=FileNameAbs(in_name3);
|
||||
f=FOpen(in_name2,"r");
|
||||
if (!f) {
|
||||
|
||||
@@ -14,13 +14,13 @@ CFile *FOpen(U8 *filename,U8 *flags,I64 cnt=0)
|
||||
U8 *full_name;
|
||||
Bool contiguous=StrOcc(flags,'c');
|
||||
|
||||
f->cluster=INVALID_CLUSTER;
|
||||
f->clus=INVALID_CLUS;
|
||||
f->fblk_num=0;
|
||||
if (cnt>0)
|
||||
f->max_blk=cnt-1;
|
||||
else
|
||||
f->max_blk=I64_MAX;
|
||||
f->file_cluster_num=INVALID_CLUSTER;
|
||||
f->file_clus_num=INVALID_CLUS;
|
||||
full_name=FileNameAbs(filename);
|
||||
f->dv=Let2Drv(*full_name);
|
||||
if (f->dv->fs_type==FSt_REDSEA)
|
||||
@@ -31,7 +31,7 @@ CFile *FOpen(U8 *filename,U8 *flags,I64 cnt=0)
|
||||
!(FileAttr(filename) & RS_ATTR_CONTIGUOUS))
|
||||
throw('File');
|
||||
}
|
||||
f->cluster_buf=CAlloc(f->dv->spc<<BLK_SIZE_BITS);
|
||||
f->clus_buf=CAlloc(f->dv->spc<<BLK_SIZE_BITS);
|
||||
if (StrOcc(flags,'w')) {
|
||||
f->flags=f->flags|FF_WRITE|FF_NEEDS_WRITE;
|
||||
if (StrOcc(flags,'+')) {
|
||||
@@ -48,7 +48,7 @@ CFile *FOpen(U8 *filename,U8 *flags,I64 cnt=0)
|
||||
if (dirc=DirContextNew(full_name)) {
|
||||
StrCpy(f->de.name,dirc->mask);
|
||||
if (cnt>0) {//We pre-alloc the whole thing.
|
||||
f->de.cluster=ClustersAlloc(f->dv,0,
|
||||
f->de.clus=ClusAlloc(f->dv,0,
|
||||
(cnt+f->dv->spc-1)/f->dv->spc,contiguous);
|
||||
f->de.size=cnt<<BLK_SIZE_BITS;
|
||||
DirNew(dirc->dv,Fs->cur_dir,&f->de,TRUE);
|
||||
@@ -64,7 +64,7 @@ CFile *FOpen(U8 *filename,U8 *flags,I64 cnt=0)
|
||||
return f;
|
||||
}
|
||||
}
|
||||
Free(f->cluster_buf);
|
||||
Free(f->clus_buf);
|
||||
Free(full_name);
|
||||
Free(f);
|
||||
return NULL;
|
||||
@@ -75,7 +75,7 @@ U0 FClose(CFile *f)
|
||||
CDirContext *dirc;
|
||||
if (f) {
|
||||
if (f->flags & FF_BUF_DIRTY) {
|
||||
WClusters(f->dv,f->cluster_buf,f->cluster,1);
|
||||
ClusWrite(f->dv,f->clus_buf,f->clus,1);
|
||||
f->flags&=~FF_BUF_DIRTY;
|
||||
}
|
||||
if (f->flags & FF_NEEDS_WRITE) {
|
||||
@@ -90,46 +90,46 @@ U0 FClose(CFile *f)
|
||||
} else
|
||||
throw('File');
|
||||
}
|
||||
Free(f->cluster_buf);
|
||||
Free(f->clus_buf);
|
||||
Free(f->de.full_name);
|
||||
Free(f);
|
||||
}
|
||||
}
|
||||
|
||||
I64 FSetCluster(CFile *f,I64 c,I64 blk,Bool read)
|
||||
I64 FSetClus(CFile *f,I64 c,I64 blk,Bool read)
|
||||
{
|
||||
CDrv *dv=f->dv;
|
||||
I64 i;
|
||||
if (f->cluster!=c) {
|
||||
if (f->clus!=c) {
|
||||
if (f->flags & FF_BUF_DIRTY) {
|
||||
i=dv->spc;
|
||||
if (f->max_blk!=I64_MAX) {
|
||||
i=f->max_blk+1-f->file_cluster_num*dv->spc;
|
||||
i=f->max_blk+1-f->file_clus_num*dv->spc;
|
||||
if (i>dv->spc)
|
||||
i=dv->spc;
|
||||
}
|
||||
WClustersBlks(dv,f->cluster_buf,f->cluster,i);
|
||||
ClusBlkWrite(dv,f->clus_buf,f->clus,i);
|
||||
f->flags=f->flags & ~FF_BUF_DIRTY;
|
||||
}
|
||||
f->cluster=c;
|
||||
f->file_cluster_num=blk/dv->spc;
|
||||
f->clus=c;
|
||||
f->file_clus_num=blk/dv->spc;
|
||||
if (read) {
|
||||
i=dv->spc;
|
||||
if (f->max_blk!=I64_MAX) {
|
||||
i=f->max_blk+1-f->file_cluster_num*dv->spc;
|
||||
i=f->max_blk+1-f->file_clus_num*dv->spc;
|
||||
if (i>dv->spc)
|
||||
i=dv->spc;
|
||||
}
|
||||
c=RClustersBlks(dv,f->cluster_buf,c,i);
|
||||
c=ClusBlkRead(dv,f->clus_buf,c,i);
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
Bool FRBlks(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
|
||||
Bool FBlkRead(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
|
||||
{//Read [nth,n+cnt) blks of file.
|
||||
CDrv *dv=f->dv;
|
||||
I64 spc=dv->spc,i,j,c=f->de.cluster;
|
||||
I64 spc=dv->spc,i,j,c=f->de.clus;
|
||||
if (!f || !dv) return FALSE;
|
||||
if (blk==FFB_NEXT_BLK)
|
||||
blk=f->fblk_num;
|
||||
@@ -138,38 +138,38 @@ Bool FRBlks(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
|
||||
if (cnt<=0) return TRUE;
|
||||
|
||||
if (f->flags & FF_CONTIGUOUS) {
|
||||
RBlks(dv,buf,Cluster2Blk(dv,c)+blk,cnt);
|
||||
BlkRead(dv,buf,Clus2Blk(dv,c)+blk,cnt);
|
||||
blk+=cnt;
|
||||
} else {
|
||||
i=blk/spc;
|
||||
if (0<=f->file_cluster_num<=i) {
|
||||
c=f->cluster;
|
||||
i-=f->file_cluster_num;
|
||||
if (0<=f->file_clus_num<=i) {
|
||||
c=f->clus;
|
||||
i-=f->file_clus_num;
|
||||
}
|
||||
if (i>0)
|
||||
c=ClusterNumNext(dv,c,i);
|
||||
c=ClusNumNext(dv,c,i);
|
||||
|
||||
if (i=blk%spc) {
|
||||
c=FSetCluster(f,c,blk,TRUE);
|
||||
c=FSetClus(f,c,blk,TRUE);
|
||||
if (cnt<spc-i)
|
||||
j=cnt;
|
||||
else
|
||||
j=spc-i;
|
||||
MemCpy(buf,f->cluster_buf+i<<BLK_SIZE_BITS,j<<BLK_SIZE_BITS);
|
||||
MemCpy(buf,f->clus_buf+i<<BLK_SIZE_BITS,j<<BLK_SIZE_BITS);
|
||||
buf+=j<<BLK_SIZE_BITS;
|
||||
cnt-=j;
|
||||
blk+=j;
|
||||
}
|
||||
while (cnt>=spc) {
|
||||
c=FSetCluster(f,c,blk,TRUE);
|
||||
MemCpy(buf,f->cluster_buf,spc<<BLK_SIZE_BITS);
|
||||
c=FSetClus(f,c,blk,TRUE);
|
||||
MemCpy(buf,f->clus_buf,spc<<BLK_SIZE_BITS);
|
||||
buf+=spc<<BLK_SIZE_BITS;
|
||||
cnt-=spc;
|
||||
blk+=spc;
|
||||
}
|
||||
if (cnt>0) {
|
||||
c=FSetCluster(f,c,blk,TRUE);
|
||||
MemCpy(buf,f->cluster_buf,cnt<<BLK_SIZE_BITS);
|
||||
c=FSetClus(f,c,blk,TRUE);
|
||||
MemCpy(buf,f->clus_buf,cnt<<BLK_SIZE_BITS);
|
||||
buf+=cnt<<BLK_SIZE_BITS;
|
||||
blk+=cnt;
|
||||
}
|
||||
@@ -178,10 +178,10 @@ Bool FRBlks(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
Bool FWBlks(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
|
||||
Bool FBlkWrite(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
|
||||
{//Write [nth,n+cnt) blks of file.
|
||||
CDrv *dv=f->dv;
|
||||
I64 spc=dv->spc,i,j,c=f->de.cluster,c1;
|
||||
I64 spc=dv->spc,i,j,c=f->de.clus,c1;
|
||||
if (!f || !dv) return FALSE;
|
||||
if (blk==FFB_NEXT_BLK)
|
||||
blk=f->fblk_num;
|
||||
@@ -191,68 +191,68 @@ Bool FWBlks(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1)
|
||||
return FALSE;
|
||||
if (cnt<=0) return TRUE;
|
||||
if (f->flags & FF_CONTIGUOUS) {
|
||||
WBlks(dv,buf,Cluster2Blk(dv,c)+blk,cnt);
|
||||
BlkWrite(dv,buf,Clus2Blk(dv,c)+blk,cnt);
|
||||
blk+=cnt;
|
||||
} else {
|
||||
if (!c) {
|
||||
c=ClustersAlloc(dv,0,1,FALSE);
|
||||
f->file_cluster_num=0;
|
||||
f->cluster=c;
|
||||
f->de.cluster=c;
|
||||
c=ClusAlloc(dv,0,1,FALSE);
|
||||
f->file_clus_num=0;
|
||||
f->clus=c;
|
||||
f->de.clus=c;
|
||||
f->flags|=FF_NEEDS_WRITE|FF_NEW_FILE;
|
||||
}
|
||||
i=blk/spc;
|
||||
if (0<=f->file_cluster_num<=i) {
|
||||
c=f->cluster;
|
||||
i-=f->file_cluster_num;
|
||||
if (0<=f->file_clus_num<=i) {
|
||||
c=f->clus;
|
||||
i-=f->file_clus_num;
|
||||
}
|
||||
while (i>0) {
|
||||
c1=c;
|
||||
c=ClusterNumNext(dv,c1,1);
|
||||
if (c==INVALID_CLUSTER) {
|
||||
c=ClustersAlloc(dv,c1,i,FALSE);
|
||||
c=ClusNumNext(dv,c1,1);
|
||||
if (c==INVALID_CLUS) {
|
||||
c=ClusAlloc(dv,c1,i,FALSE);
|
||||
if (i>1)
|
||||
c=ClusterNumNext(dv,c,i-1);
|
||||
c=ClusNumNext(dv,c,i-1);
|
||||
break;
|
||||
} else
|
||||
i--;
|
||||
}
|
||||
|
||||
if (i=blk%spc) {
|
||||
FSetCluster(f,c,blk,TRUE);
|
||||
FSetClus(f,c,blk,TRUE);
|
||||
if (cnt<spc-i)
|
||||
j=cnt;
|
||||
else
|
||||
j=spc-i;
|
||||
MemCpy(f->cluster_buf+BLK_SIZE*i,buf,j<<BLK_SIZE_BITS);
|
||||
MemCpy(f->clus_buf+BLK_SIZE*i,buf,j<<BLK_SIZE_BITS);
|
||||
f->flags|=FF_BUF_DIRTY;
|
||||
buf+=j<<BLK_SIZE_BITS;
|
||||
cnt-=j;
|
||||
blk+=j;
|
||||
if (cnt>0) {
|
||||
c1=c;
|
||||
c=ClusterNumNext(dv,c1,1);
|
||||
if (c==INVALID_CLUSTER)
|
||||
c=ClustersAlloc(dv,c1,1,FALSE);
|
||||
c=ClusNumNext(dv,c1,1);
|
||||
if (c==INVALID_CLUS)
|
||||
c=ClusAlloc(dv,c1,1,FALSE);
|
||||
}
|
||||
}
|
||||
while (cnt>=spc) {
|
||||
FSetCluster(f,c,blk,FALSE);
|
||||
MemCpy(f->cluster_buf,buf,spc<<BLK_SIZE_BITS);
|
||||
FSetClus(f,c,blk,FALSE);
|
||||
MemCpy(f->clus_buf,buf,spc<<BLK_SIZE_BITS);
|
||||
f->flags|=FF_BUF_DIRTY;
|
||||
buf+=spc<<BLK_SIZE_BITS;
|
||||
cnt-=spc;
|
||||
blk+=spc;
|
||||
if (cnt>0) {
|
||||
c1=c;
|
||||
c=ClusterNumNext(dv,c1,1);
|
||||
if (c==INVALID_CLUSTER)
|
||||
c=ClustersAlloc(dv,c1,1,FALSE);
|
||||
c=ClusNumNext(dv,c1,1);
|
||||
if (c==INVALID_CLUS)
|
||||
c=ClusAlloc(dv,c1,1,FALSE);
|
||||
}
|
||||
}
|
||||
if (cnt>0) {
|
||||
FSetCluster(f,c,blk,TRUE);
|
||||
MemCpy(f->cluster_buf,buf,cnt<<BLK_SIZE_BITS);
|
||||
FSetClus(f,c,blk,TRUE);
|
||||
MemCpy(f->clus_buf,buf,cnt<<BLK_SIZE_BITS);
|
||||
f->flags|=FF_BUF_DIRTY;
|
||||
buf+=cnt<<BLK_SIZE_BITS;
|
||||
blk+=cnt;
|
||||
|
||||
@@ -0,0 +1,151 @@
|
||||
I64 ClusNumNext(CDrv *dv,I64 c,I64 cnt=1)
|
||||
{//Return next cnt'th clus in chain.
|
||||
Bool unlock;
|
||||
DrvChk(dv);
|
||||
if (cnt<=0) return c;
|
||||
try {
|
||||
unlock=DrvLock(dv);
|
||||
switch (dv->fs_type) {
|
||||
case FSt_ISO9660:
|
||||
case FSt_REDSEA:
|
||||
c+=cnt;
|
||||
break;
|
||||
case FSt_FAT32:
|
||||
while (cnt-->0 && 0<c<0x0FFFFFF8) {
|
||||
DrvFATBlkSet(dv,c);
|
||||
c=dv->cur_fat_blk[c & (BLK_SIZE/4-1)];
|
||||
}
|
||||
if (!(0<c<0x0FFFFFF8))
|
||||
c=INVALID_CLUS;
|
||||
break;
|
||||
default:
|
||||
throw('Drv');
|
||||
}
|
||||
if (unlock)
|
||||
DrvUnlock(dv);
|
||||
} catch
|
||||
if (unlock)
|
||||
DrvUnlock(dv);
|
||||
return c;
|
||||
}
|
||||
|
||||
I64 Clus2Blk(CDrv *dv,I64 c)
|
||||
{//Drv clus num to blk num.
|
||||
DrvChk(dv);
|
||||
switch (dv->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
return c;
|
||||
case FSt_ISO9660:
|
||||
case FSt_FAT32:
|
||||
return dv->data_area+c*dv->spc;
|
||||
default:
|
||||
throw('Drv');
|
||||
}
|
||||
}
|
||||
|
||||
I64 ClusBlkRead(CDrv *dv,U8 *buf,I64 c,I64 blks)
|
||||
{//Accepts blk count, so padding on last clus is not read.
|
||||
I64 i;
|
||||
Bool unlock;
|
||||
DrvChk(dv);
|
||||
if (blks<=0) return c;
|
||||
try {
|
||||
unlock=DrvLock(dv);
|
||||
switch (dv->fs_type) {
|
||||
case FSt_ISO9660:
|
||||
BlkRead(dv,buf,dv->data_area+c*dv->spc,blks);
|
||||
c+=(blks+dv->spc-1)/dv->spc;
|
||||
break;
|
||||
case FSt_REDSEA:
|
||||
BlkRead(dv,buf,c,blks);
|
||||
c+=blks;
|
||||
break;
|
||||
case FSt_FAT32:
|
||||
while (blks && 0<c<0x0FFFFFF8) {
|
||||
i=blks;
|
||||
if (i>dv->spc)
|
||||
i=dv->spc;
|
||||
BlkRead(dv,buf,dv->data_area+c*dv->spc,i);
|
||||
buf+=i<<BLK_SIZE_BITS;
|
||||
c=ClusNumNext(dv,c,1);
|
||||
blks-=i;
|
||||
}
|
||||
if (blks)
|
||||
throw('Drv');
|
||||
break;
|
||||
default:
|
||||
throw('Drv');
|
||||
}
|
||||
if (unlock)
|
||||
DrvUnlock(dv);
|
||||
} catch
|
||||
if (unlock)
|
||||
DrvUnlock(dv);
|
||||
return c;
|
||||
}
|
||||
|
||||
I64 ClusRead(CDrv *dv,U8 *buf,I64 c,I64 cnt)
|
||||
{//Read clus cnt from drv to buf.
|
||||
return ClusBlkRead(dv,buf,c,cnt*dv->spc);
|
||||
}
|
||||
|
||||
I64 ClusBlkWrite(CDrv *dv,U8 *buf,I64 c,I64 blks)
|
||||
{//Accepts blk count, so padding on last clus is not written.
|
||||
I64 i;
|
||||
Bool unlock;
|
||||
DrvChk(dv);
|
||||
if (blks<=0) return c;
|
||||
try {
|
||||
unlock=DrvLock(dv);
|
||||
switch (dv->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
BlkWrite(dv,buf,c,blks);
|
||||
c=0;
|
||||
break;
|
||||
case FSt_FAT32:
|
||||
while (blks) {
|
||||
if (!(0<c<0x0FFFFFF8))
|
||||
throw('Drv');
|
||||
i=blks;
|
||||
if (i>dv->spc)
|
||||
i=dv->spc;
|
||||
BlkWrite(dv,buf,dv->data_area+c*dv->spc,i);
|
||||
buf+=i<<BLK_SIZE_BITS;
|
||||
c=ClusNumNext(dv,c);
|
||||
blks-=i;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw('Drv');
|
||||
}
|
||||
if (unlock)
|
||||
DrvUnlock(dv);
|
||||
} catch
|
||||
if (unlock)
|
||||
DrvUnlock(dv);
|
||||
return c;
|
||||
}
|
||||
|
||||
I64 ClusWrite(CDrv *dv,U8 *buf,I64 c,I64 cnt)
|
||||
{//Write clus cnt from buf to drv.
|
||||
return ClusBlkWrite(dv,buf,c,cnt*dv->spc);
|
||||
}
|
||||
|
||||
I64 ClusAlloc(CDrv *dv,I64 c=0,I64 cnt=1,Bool contiguous=FALSE)
|
||||
{//Alloc clus cnt into chain.
|
||||
//c=0 means first clus in chain
|
||||
DrvChk(dv);
|
||||
if (cnt<=0) return c;
|
||||
switch (dv->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
return RedSeaAllocClus(dv,cnt);
|
||||
case FSt_FAT32:
|
||||
if (contiguous) {
|
||||
if (c) throw('File');
|
||||
return FAT32AllocContiguousClus(dv,cnt);
|
||||
} else
|
||||
return FAT32AllocClus(dv,c,cnt);
|
||||
default:
|
||||
throw('Drv');
|
||||
}
|
||||
}
|
||||
@@ -57,8 +57,8 @@ Bool CopySingle(U8 *f1,U8 *f2) //Just one file
|
||||
n=cnt;
|
||||
i=j;
|
||||
}
|
||||
FRBlks(in_file, buf,FFB_NEXT_BLK,n);
|
||||
FWBlks(out_file,buf,FFB_NEXT_BLK,n);
|
||||
FBlkRead(in_file, buf,FFB_NEXT_BLK,n);
|
||||
FBlkWrite(out_file,buf,FFB_NEXT_BLK,n);
|
||||
cnt-=n;
|
||||
j-=n<<BLK_SIZE_BITS;
|
||||
}
|
||||
|
||||
@@ -81,13 +81,13 @@ I64 DirEntryCompareName(CDirEntry *e1,CDirEntry *e2)
|
||||
}
|
||||
}
|
||||
|
||||
I64 DirEntryCompareCluster(CDirEntry *e1,CDirEntry *e2)
|
||||
I64 DirEntryCompareClus(CDirEntry *e1,CDirEntry *e2)
|
||||
{
|
||||
return e1->cluster-e2->cluster;
|
||||
return e1->clus-e2->clus;
|
||||
}
|
||||
|
||||
#define SK_NAME 0
|
||||
#define SK_CLUSTER 1
|
||||
#define SK_CLUS 1
|
||||
|
||||
U0 DirFilesSort(CDirEntry **_tmpde,I64 key)
|
||||
{
|
||||
@@ -107,8 +107,8 @@ U0 DirFilesSort(CDirEntry **_tmpde,I64 key)
|
||||
case SK_NAME:
|
||||
QSortI64(sort_buf,cnt,&DirEntryCompareName);
|
||||
break;
|
||||
case SK_CLUSTER:
|
||||
QSortI64(sort_buf,cnt,&DirEntryCompareCluster);
|
||||
case SK_CLUS:
|
||||
QSortI64(sort_buf,cnt,&DirEntryCompareClus);
|
||||
break;
|
||||
}
|
||||
tmpde=sort_buf[0];
|
||||
|
||||
@@ -8,7 +8,7 @@ U0 HomeSet(U8 *dirname)
|
||||
|
||||
Bool Cd(U8 *dirname=NULL,Bool make_dirs=FALSE)
|
||||
{//Change directory. Optionally, make directories, too.
|
||||
I64 maxlen,cur_dir_cluster=0;
|
||||
I64 maxlen,cur_dir_clus=0;
|
||||
U8 *chg_to_buf,*new_cur_dir,*buf;
|
||||
CDrv *dv;
|
||||
Bool res=TRUE;
|
||||
@@ -52,16 +52,16 @@ Bool Cd(U8 *dirname=NULL,Bool make_dirs=FALSE)
|
||||
return FALSE;
|
||||
} else if (StrCmp(buf,".") && *buf) {
|
||||
dv=Fs->cur_dv;
|
||||
cur_dir_cluster=Name2DirCluster(dv,new_cur_dir);
|
||||
cur_dir_clus=Name2DirClus(dv,new_cur_dir);
|
||||
switch (dv->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
res=RedSeaCd(buf,cur_dir_cluster);
|
||||
res=RedSeaCd(buf,cur_dir_clus);
|
||||
break;
|
||||
case FSt_FAT32:
|
||||
res=FAT32Cd(buf,cur_dir_cluster);
|
||||
res=FAT32Cd(buf,cur_dir_clus);
|
||||
break;
|
||||
case FSt_ISO9660:
|
||||
res=ISO1Cd(buf,cur_dir_cluster);
|
||||
res=ISO1Cd(buf,cur_dir_clus);
|
||||
break;
|
||||
default:
|
||||
PrintErr("File System Not Supported\n");
|
||||
@@ -70,7 +70,7 @@ Bool Cd(U8 *dirname=NULL,Bool make_dirs=FALSE)
|
||||
if (!res && make_dirs) {
|
||||
Free(Fs->cur_dir);
|
||||
Fs->cur_dir=StrNew(new_cur_dir);
|
||||
res=MkDir(buf);
|
||||
res=DirMk(buf);
|
||||
}
|
||||
if (res) {
|
||||
if (StrCmp(new_cur_dir,"/"))
|
||||
@@ -109,7 +109,7 @@ I64 Dir(U8 *files_find_mask,Bool full)
|
||||
CDateStruct ds;
|
||||
I64 csize=0xFFFF,c=0xFFFF,res=0;
|
||||
tmpde1=FilesFind(files_find_mask);
|
||||
if (!(st=CurDir))
|
||||
if (!(st=DirCur))
|
||||
PrintErr("Invalid Drive\n");
|
||||
else {
|
||||
if (tmpde1) {
|
||||
@@ -123,8 +123,8 @@ I64 Dir(U8 *files_find_mask,Bool full)
|
||||
while (tmpde2) {
|
||||
if (tmpde2->size>csize)
|
||||
csize=tmpde2->size;
|
||||
if (tmpde2->cluster>c)
|
||||
c=tmpde2->cluster;
|
||||
if (tmpde2->clus>c)
|
||||
c=tmpde2->clus;
|
||||
tmpde2=tmpde2->next;
|
||||
}
|
||||
csize=Bsr(csize)/4+1;
|
||||
@@ -133,7 +133,7 @@ I64 Dir(U8 *files_find_mask,Bool full)
|
||||
"$$MA,T=\"Directory\",LM=\"PopUpCd;Dir;\n\"$$ of %s\n",st;
|
||||
if (full)
|
||||
"__DATE__ __TIME__ %*ts %*ts\n",
|
||||
csize,"SIZE",c,"CLUSTER";
|
||||
csize,"SIZE",c,"CLUS";
|
||||
else
|
||||
"DATE_ TIME_ %*ts\n",csize,"SIZE";
|
||||
while (tmpde1) {
|
||||
@@ -141,7 +141,7 @@ I64 Dir(U8 *files_find_mask,Bool full)
|
||||
res++;
|
||||
if (full)
|
||||
"%D %T %0*tX %0*tX ",tmpde1->datetime,tmpde1->datetime,
|
||||
csize,tmpde1->size,c,tmpde1->cluster;
|
||||
csize,tmpde1->size,c,tmpde1->clus;
|
||||
else {
|
||||
Date2Struct(&ds,tmpde1->datetime+local_time_offset);
|
||||
"%02d/%02d %02d:%02d %0*tX ",ds.mon,ds.day_of_mon,ds.hour,ds.min,
|
||||
@@ -162,7 +162,7 @@ I64 Dir(U8 *files_find_mask,Bool full)
|
||||
return res;
|
||||
}
|
||||
|
||||
Bool MkDir(U8 *filename,I64 entry_cnt=0)
|
||||
Bool DirMk(U8 *filename,I64 entry_cnt=0)
|
||||
{//Make directory. $LK,"Cd",A="MN:Cd"$() can also make directories.
|
||||
//entry_cnt is for preallocating dir blks, leave it zero if you like.
|
||||
U8 *name;
|
||||
|
||||
@@ -93,7 +93,7 @@ U0 DrvFATBlkAlloc(CDrv *dv)
|
||||
dv->cur_fat_blk=AMAlloc(BLK_SIZE);
|
||||
dv->cur_fat_blk_num=0;
|
||||
dv->fat_blk_dirty=0;
|
||||
RBlks(dv,dv->cur_fat_blk,dv->fat1,1);
|
||||
BlkRead(dv,dv->cur_fat_blk,dv->fat1,1);
|
||||
}
|
||||
|
||||
U0 DrvFATBlkClean(CDrv *dv,I64 fat_sel=3)
|
||||
@@ -101,13 +101,13 @@ U0 DrvFATBlkClean(CDrv *dv,I64 fat_sel=3)
|
||||
if ((dv->fs_type==FSt_FAT32 || dv->fs_type==FSt_REDSEA) &&
|
||||
Bt(&dv->fat_blk_dirty,0)) {
|
||||
if (dv->fat1==dv->fat2) {
|
||||
WBlks(dv,dv->cur_fat_blk,dv->fat1+dv->cur_fat_blk_num,1);
|
||||
BlkWrite(dv,dv->cur_fat_blk,dv->fat1+dv->cur_fat_blk_num,1);
|
||||
LBtr(&dv->fat_blk_dirty,0);
|
||||
} else {
|
||||
if (fat_sel==3 || !fat_sel)
|
||||
WBlks(dv,dv->cur_fat_blk,dv->fat1+dv->cur_fat_blk_num,1);
|
||||
BlkWrite(dv,dv->cur_fat_blk,dv->fat1+dv->cur_fat_blk_num,1);
|
||||
if (fat_sel==3 || fat_sel==1) {
|
||||
WBlks(dv,dv->cur_fat_blk,dv->fat2+dv->cur_fat_blk_num,1);
|
||||
BlkWrite(dv,dv->cur_fat_blk,dv->fat2+dv->cur_fat_blk_num,1);
|
||||
LBtr(&dv->fat_blk_dirty,0);
|
||||
}
|
||||
}
|
||||
@@ -117,7 +117,7 @@ U0 DrvFATBlkClean(CDrv *dv,I64 fat_sel=3)
|
||||
U0 DrvFATBlkSet(CDrv *dv,I64 c,I64 fat_sel=3)
|
||||
{
|
||||
I64 fat_blk_num;
|
||||
if (c==INVALID_CLUSTER)
|
||||
if (c==INVALID_CLUS)
|
||||
throw('Drv');
|
||||
switch (dv->fs_type) {
|
||||
case FSt_FAT32:
|
||||
@@ -133,9 +133,9 @@ U0 DrvFATBlkSet(CDrv *dv,I64 c,I64 fat_sel=3)
|
||||
DrvFATBlkClean(dv,fat_sel);
|
||||
dv->cur_fat_blk_num=fat_blk_num;
|
||||
if (fat_sel==3 || !fat_sel)
|
||||
RBlks(dv,dv->cur_fat_blk,dv->fat1+dv->cur_fat_blk_num,1);
|
||||
BlkRead(dv,dv->cur_fat_blk,dv->fat1+dv->cur_fat_blk_num,1);
|
||||
else
|
||||
RBlks(dv,dv->cur_fat_blk,dv->fat2+dv->cur_fat_blk_num,1);
|
||||
BlkRead(dv,dv->cur_fat_blk,dv->fat2+dv->cur_fat_blk_num,1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ CBlkDev *DrvIsWritable(U8 drv_let=0,Bool except=FALSE)
|
||||
}
|
||||
|
||||
U0 DskCacheInvalidate(CDrv *dv)
|
||||
{//Needed for removable media. Called by $LK,"ChgDsk",A="MN:ChgDsk"$().
|
||||
{//Needed for removable media. Called by $LK,"DskChg",A="MN:DskChg"$().
|
||||
Bool unlock;
|
||||
CBlkDev *bd=dv->bd;
|
||||
DrvChk(dv);
|
||||
@@ -234,7 +234,7 @@ U0 DskCacheInvalidate(CDrv *dv)
|
||||
DrvUnlock(dv);
|
||||
}
|
||||
|
||||
U0 ChgDsk(U8 drv_let=0)
|
||||
U0 DskChg(U8 drv_let=0)
|
||||
{//Change disk. (Needed for removable media.)
|
||||
CDrv *dv=Let2Drv(drv_let);
|
||||
CBlkDev *bd=dv->bd;
|
||||
@@ -267,7 +267,7 @@ Bool Drv(U8 drv_let)
|
||||
bd=BlkDevChk(dv->bd);
|
||||
if (dv!=Fs->cur_dv) {
|
||||
if (bd->flags & BDF_REMOVABLE && !(bd->flags & BDF_INITIALIZED))
|
||||
ChgDsk(Drv2Let(dv));
|
||||
DskChg(Drv2Let(dv));
|
||||
if (bd->type==BDT_RAM ||
|
||||
bd->type==BDT_ISO_FILE_READ || bd->type==BDT_ISO_FILE_WRITE)
|
||||
BlkDevInit(bd);
|
||||
|
||||
@@ -21,8 +21,8 @@ CDirEntry *FilesFind2(U8 *files_find_mask,I64 fuf_flags)
|
||||
DirFilesSort(&res,SK_NAME);
|
||||
if (fuf_flags&(FUF_FLATTEN_TREE|FUF_JUST_FILES))
|
||||
DirFilesFlatten(res,&res,fuf_flags);
|
||||
if (fuf_flags&FUF_CLUSTER_ORDER)
|
||||
DirFilesSort(&res,SK_CLUSTER);
|
||||
if (fuf_flags&FUF_CLUS_ORDER)
|
||||
DirFilesSort(&res,SK_CLUS);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@@ -57,7 +57,7 @@ $LK,"DirTreeDel",A="MN:DirTreeDel"$() or $LK,"DirTreeDel2",A="MN:DirTreeDel2"$()
|
||||
Bool FileFind(U8 *filename,CDirEntry *_de=NULL,I64 fuf_flags=0)
|
||||
{//$LK,"FUF_JUST_DIRS",A="MN:FUF_JUST_DIRS"$, $LK,"FUF_JUST_FILES",A="MN:FUF_JUST_FILES"$, $LK,"FUF_Z_OR_NOT_Z",A="MN:FUF_Z_OR_NOT_Z"$, $LK,"FUF_SCAN_PARENTS",A="MN:FUF_SCAN_PARENTS"$
|
||||
//If you pass _de, you must Free(_de->full_name);
|
||||
I64 i,j,cur_dir_cluster;
|
||||
I64 i,j,cur_dir_clus;
|
||||
U8 *altname,*curname,*full_name=NULL;
|
||||
CDirEntry de;
|
||||
CDirContext *dirc;
|
||||
@@ -81,18 +81,18 @@ Bool FileFind(U8 *filename,CDirEntry *_de=NULL,I64 fuf_flags=0)
|
||||
Silent(old_silent);
|
||||
else {
|
||||
Silent(old_silent);
|
||||
cur_dir_cluster=Name2DirCluster(dirc->dv,Fs->cur_dir);
|
||||
cur_dir_clus=Name2DirClus(dirc->dv,Fs->cur_dir);
|
||||
switch (dirc->dv->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
res=RedSeaFileFind(dirc->dv,cur_dir_cluster,dirc->mask,
|
||||
res=RedSeaFileFind(dirc->dv,cur_dir_clus,dirc->mask,
|
||||
&de,fuf_flags);
|
||||
break;
|
||||
case FSt_FAT32:
|
||||
res=FAT32FileFind(dirc->dv,cur_dir_cluster,dirc->mask,
|
||||
res=FAT32FileFind(dirc->dv,cur_dir_clus,dirc->mask,
|
||||
&de,fuf_flags);
|
||||
break;
|
||||
case FSt_ISO9660:
|
||||
res=ISO1FileFind(dirc->dv,cur_dir_cluster,dirc->mask,
|
||||
res=ISO1FileFind(dirc->dv,cur_dir_clus,dirc->mask,
|
||||
&de,fuf_flags);
|
||||
break;
|
||||
default:
|
||||
@@ -118,21 +118,21 @@ Bool FileFind(U8 *filename,CDirEntry *_de=NULL,I64 fuf_flags=0)
|
||||
Silent(old_silent);
|
||||
else {
|
||||
Silent(old_silent);
|
||||
cur_dir_cluster=Name2DirCluster(dirc->dv,Fs->cur_dir);
|
||||
cur_dir_clus=Name2DirClus(dirc->dv,Fs->cur_dir);
|
||||
while (!res && StrCmp(Fs->cur_dir,"/")) {
|
||||
Cd("..");
|
||||
cur_dir_cluster=Name2DirCluster(dirc->dv,Fs->cur_dir);
|
||||
cur_dir_clus=Name2DirClus(dirc->dv,Fs->cur_dir);
|
||||
switch (dirc->dv->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
res=RedSeaFileFind(dirc->dv,cur_dir_cluster,
|
||||
res=RedSeaFileFind(dirc->dv,cur_dir_clus,
|
||||
dirc->mask,&de,fuf_flags);
|
||||
break;
|
||||
case FSt_FAT32:
|
||||
res=FAT32FileFind(dirc->dv,cur_dir_cluster,
|
||||
res=FAT32FileFind(dirc->dv,cur_dir_clus,
|
||||
dirc->mask,&de,fuf_flags);
|
||||
break;
|
||||
case FSt_ISO9660:
|
||||
res=ISO1FileFind(dirc->dv,cur_dir_cluster,
|
||||
res=ISO1FileFind(dirc->dv,cur_dir_clus,
|
||||
dirc->mask,&de,fuf_flags);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -9,7 +9,7 @@ Bool DrvTypeSet(U8 drv_let,I64 type=FSt_REDSEA)
|
||||
switch (bd->type) {
|
||||
case BDT_ATA:
|
||||
offset=0;
|
||||
ext_base=INVALID_CLUSTER;
|
||||
ext_base=INVALID_CLUS;
|
||||
while (TRUE) {
|
||||
ATAReadBlks(bd,&mbr,offset,1);
|
||||
j=-1;
|
||||
@@ -42,7 +42,7 @@ Bool DrvTypeSet(U8 drv_let,I64 type=FSt_REDSEA)
|
||||
break;
|
||||
if (!mbr.p[j].offset)
|
||||
break;
|
||||
if (ext_base==INVALID_CLUSTER) {
|
||||
if (ext_base==INVALID_CLUS) {
|
||||
offset=mbr.p[j].offset;
|
||||
ext_base=offset;
|
||||
} else
|
||||
|
||||
@@ -200,7 +200,7 @@ U8 *FileNameAbs(U8 *_filename,I64 fuf_flags=0)
|
||||
return res;
|
||||
}
|
||||
|
||||
U8 *ChgExt(U8 *filename,U8 *extension)
|
||||
U8 *ExtChg(U8 *filename,U8 *extension)
|
||||
{//Change filename extension.
|
||||
U8 *res=MAlloc(StrLen(filename)+1+StrLen(extension)+1);
|
||||
StrCpy(res,filename);
|
||||
@@ -209,7 +209,7 @@ U8 *ChgExt(U8 *filename,U8 *extension)
|
||||
return CatPrint(res,".%s",extension);
|
||||
}
|
||||
|
||||
U8 *DftExt(U8 *filename,U8 *extension)
|
||||
U8 *ExtDft(U8 *filename,U8 *extension)
|
||||
{//Give extension if has none.
|
||||
U8 *res=MAlloc(StrLen(filename)+1+StrLen(extension)+1);
|
||||
StrCpy(res,filename);
|
||||
@@ -278,7 +278,7 @@ U8 *FileNameTmpTxt()
|
||||
return MStrPrint("~/SysTmp%X.DD.Z",GetTSC>>8&0xFFFFFFFF);
|
||||
}
|
||||
|
||||
U8 *CurDir(CTask *task=NULL,CTask *mem_task=NULL)
|
||||
U8 *DirCur(CTask *task=NULL,CTask *mem_task=NULL)
|
||||
{//MAlloc copy of cur dir with drv letter.
|
||||
U8 *st;
|
||||
if (!task) task=Fs;
|
||||
|
||||
@@ -7,39 +7,39 @@ Bool CFileNameTo(U8 *dst,U8 *src)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
I64 Name2DirCluster(CDrv *dv,U8 *dirname)
|
||||
I64 Name2DirClus(CDrv *dv,U8 *dirname)
|
||||
{
|
||||
Bool cont=TRUE,unlock;
|
||||
I64 cur_dir_cluster;
|
||||
I64 cur_dir_clus;
|
||||
CDirEntry de;
|
||||
U8 *buf=StrNew(dirname),*buf2=StrNew(dirname);
|
||||
DrvChk(dv);
|
||||
try {
|
||||
unlock=DrvLock(dv);
|
||||
cur_dir_cluster=dv->root_cluster;
|
||||
cur_dir_clus=dv->root_clus;
|
||||
while (*buf && cont) {
|
||||
StrFirstRem(buf,"/",buf2);
|
||||
if (*buf2) {
|
||||
switch (dv->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
cont=RedSeaFileFind(dv,cur_dir_cluster,buf2,&de,FUF_JUST_DIRS);
|
||||
cont=RedSeaFileFind(dv,cur_dir_clus,buf2,&de,FUF_JUST_DIRS);
|
||||
break;
|
||||
case FSt_FAT32:
|
||||
cont=FAT32FileFind(dv,cur_dir_cluster,buf2,&de,FUF_JUST_DIRS);
|
||||
cont=FAT32FileFind(dv,cur_dir_clus,buf2,&de,FUF_JUST_DIRS);
|
||||
break;
|
||||
case FSt_ISO9660:
|
||||
cont=ISO1FileFind(dv,cur_dir_cluster,buf2,&de,FUF_JUST_DIRS);
|
||||
cont=ISO1FileFind(dv,cur_dir_clus,buf2,&de,FUF_JUST_DIRS);
|
||||
break;
|
||||
default:
|
||||
throw('Drv');
|
||||
}
|
||||
cur_dir_cluster=de.cluster;
|
||||
cur_dir_clus=de.clus;
|
||||
}
|
||||
}
|
||||
if (!cont) {
|
||||
"%s ",dirname;
|
||||
PrintErr("File not found.\n");
|
||||
cur_dir_cluster=0;
|
||||
cur_dir_clus=0;
|
||||
}
|
||||
if (unlock)
|
||||
DrvUnlock(dv);
|
||||
@@ -48,43 +48,43 @@ I64 Name2DirCluster(CDrv *dv,U8 *dirname)
|
||||
DrvUnlock(dv);
|
||||
Free(buf);
|
||||
Free(buf2);
|
||||
return cur_dir_cluster;
|
||||
return cur_dir_clus;
|
||||
}
|
||||
|
||||
I64 Name2ParentDirCluster(CDrv *dv,U8 *dirname)
|
||||
I64 Name2ParentDirClus(CDrv *dv,U8 *dirname)
|
||||
{
|
||||
Bool cont=TRUE,unlock;
|
||||
I64 cur_dir_cluster,cur_dir_cluster2;
|
||||
I64 cur_dir_clus,cur_dir_clus2;
|
||||
CDirEntry de;
|
||||
U8 *buf=StrNew(dirname),*buf2=StrNew(dirname);
|
||||
DrvChk(dv);
|
||||
try {
|
||||
unlock=DrvLock(dv);
|
||||
cur_dir_cluster=cur_dir_cluster2=dv->root_cluster;
|
||||
cur_dir_clus=cur_dir_clus2=dv->root_clus;
|
||||
while (*buf && cont) {
|
||||
cur_dir_cluster2=cur_dir_cluster;
|
||||
cur_dir_clus2=cur_dir_clus;
|
||||
StrFirstRem(buf,"/",buf2);
|
||||
if (*buf2) {
|
||||
switch (dv->fs_type) {
|
||||
case FSt_REDSEA:
|
||||
cont=RedSeaFileFind(dv,cur_dir_cluster,buf2,&de,FUF_JUST_DIRS);
|
||||
cont=RedSeaFileFind(dv,cur_dir_clus,buf2,&de,FUF_JUST_DIRS);
|
||||
break;
|
||||
case FSt_FAT32:
|
||||
cont=FAT32FileFind(dv,cur_dir_cluster,buf2,&de,FUF_JUST_DIRS);
|
||||
cont=FAT32FileFind(dv,cur_dir_clus,buf2,&de,FUF_JUST_DIRS);
|
||||
break;
|
||||
case FSt_ISO9660:
|
||||
cont=ISO1FileFind(dv,cur_dir_cluster,buf2,&de,FUF_JUST_DIRS);
|
||||
cont=ISO1FileFind(dv,cur_dir_clus,buf2,&de,FUF_JUST_DIRS);
|
||||
break;
|
||||
default:
|
||||
throw('Drv');
|
||||
}
|
||||
cur_dir_cluster=de.cluster;
|
||||
cur_dir_clus=de.clus;
|
||||
}
|
||||
}
|
||||
if (!cont) {
|
||||
"%s ",dirname;
|
||||
PrintErr("File not found.\n");
|
||||
cur_dir_cluster2=0;
|
||||
cur_dir_clus2=0;
|
||||
}
|
||||
if (unlock)
|
||||
DrvUnlock(dv);
|
||||
@@ -93,5 +93,5 @@ I64 Name2ParentDirCluster(CDrv *dv,U8 *dirname)
|
||||
DrvUnlock(dv);
|
||||
Free(buf);
|
||||
Free(buf2);
|
||||
return cur_dir_cluster2;
|
||||
return cur_dir_clus2;
|
||||
}
|
||||
@@ -26,18 +26,18 @@ U0 FAT32Init(CDrv *dv)
|
||||
try {
|
||||
unlock=DrvLock(dv);
|
||||
dv->fs_type=FSt_FAT32;
|
||||
RBlks(dv,&br32,dv->drv_offset,1);
|
||||
BlkRead(dv,&br32,dv->drv_offset,1);
|
||||
dv->file_system_info_sect=dv->drv_offset+br32.file_system_info_sect;
|
||||
dv->fat1=dv->drv_offset+br32.reserved_sects;
|
||||
dv->fat2=dv->fat1+br32.sects_per_fat;
|
||||
dv->data_area=dv->fat2+br32.sects_per_fat
|
||||
-2*br32.sects_per_cluster; //Starts at Cluster 2
|
||||
dv->spc=br32.sects_per_cluster;
|
||||
dv->root_cluster=br32.root_cluster;
|
||||
-2*br32.sects_per_clus; //Starts at Clus 2
|
||||
dv->spc=br32.sects_per_clus;
|
||||
dv->root_clus=br32.root_clus;
|
||||
DrvFATBlkAlloc(dv);
|
||||
Free(dv->fis);
|
||||
dv->fis=AMAlloc(BLK_SIZE);
|
||||
RBlks(dv,dv->fis,dv->file_system_info_sect,1);
|
||||
BlkRead(dv,dv->fis,dv->file_system_info_sect,1);
|
||||
if (unlock)
|
||||
DrvUnlock(dv);
|
||||
} catch
|
||||
@@ -61,27 +61,27 @@ U0 FAT32Fmt(U8 drv_let,Bool quick=TRUE)
|
||||
br->oem_name[0](I64)='MSWIN4.1';
|
||||
br->bytes_per_sect=BLK_SIZE;
|
||||
if (dv->size<= 500000)
|
||||
br->sects_per_cluster=1;
|
||||
br->sects_per_clus=1;
|
||||
else if (dv->size<=2000000)
|
||||
br->sects_per_cluster=2;
|
||||
br->sects_per_clus=2;
|
||||
else if (dv->size<=6000000)
|
||||
br->sects_per_cluster=4;
|
||||
br->sects_per_clus=4;
|
||||
else if (dv->size<=12000000)
|
||||
br->sects_per_cluster=8;
|
||||
br->sects_per_clus=8;
|
||||
else if (dv->size<=33000000)
|
||||
br->sects_per_cluster=16;
|
||||
br->sects_per_clus=16;
|
||||
else if (dv->size<=67000000)
|
||||
br->sects_per_cluster=32;
|
||||
br->sects_per_clus=32;
|
||||
else
|
||||
br->sects_per_cluster=64;
|
||||
br->sects_per_clus=64;
|
||||
|
||||
br->reserved_sects=32;
|
||||
br->copies_of_fat=2;
|
||||
br->media_desc=0xF8;
|
||||
br->sects=dv->size;
|
||||
l=(br->sects/br->sects_per_cluster)>>(BLK_SIZE_BITS-2)+1;
|
||||
l=(br->sects/br->sects_per_clus)>>(BLK_SIZE_BITS-2)+1;
|
||||
br->sects_per_fat=l;
|
||||
br->root_cluster=2;
|
||||
br->root_clus=2;
|
||||
br->file_system_info_sect=1;
|
||||
br->log_drv_num=0x80;
|
||||
br->ext_signature=0x29;
|
||||
@@ -91,22 +91,22 @@ U0 FAT32Fmt(U8 drv_let,Bool quick=TRUE)
|
||||
br->signature=0xAA55;
|
||||
fis->signature1='RRaA';
|
||||
fis->signature2='rrAa';
|
||||
fis->free_clusters=-1;
|
||||
fis->free_clus=-1;
|
||||
fis->most_recently_alloced=0;
|
||||
fis->signature3=0xAA550000;
|
||||
|
||||
if (quick)
|
||||
i=br->reserved_sects+2*l+4*br->sects_per_cluster;
|
||||
i=br->reserved_sects+2*l+4*br->sects_per_clus;
|
||||
else
|
||||
i=dv->size;
|
||||
WZeroBlks(dv,dv->drv_offset,i);
|
||||
BlkWriteZero(dv,dv->drv_offset,i);
|
||||
|
||||
WBlks(dv,fis,dv->drv_offset+br->file_system_info_sect,1);
|
||||
WBlks(dv,br,dv->drv_offset,1);
|
||||
BlkWrite(dv,fis,dv->drv_offset+br->file_system_info_sect,1);
|
||||
BlkWrite(dv,br,dv->drv_offset,1);
|
||||
FAT32Init(dv);
|
||||
ClustersAlloc(dv,0,1,FALSE); //Alloc #1
|
||||
br->root_cluster=ClustersAlloc(dv,0,1,FALSE);
|
||||
WBlks(dv,br,dv->drv_offset,1);
|
||||
ClusAlloc(dv,0,1,FALSE); //Alloc #1
|
||||
br->root_clus=ClusAlloc(dv,0,1,FALSE);
|
||||
BlkWrite(dv,br,dv->drv_offset,1);
|
||||
FAT32Init(dv);
|
||||
DrvUnlock(dv);
|
||||
} catch
|
||||
@@ -219,7 +219,7 @@ Bool FAT32CDirFill(CDirEntry *tmpde,
|
||||
res=TRUE;
|
||||
else
|
||||
res=FATFromName(tmpde->name,de->name);
|
||||
tmpde->cluster=de->cluster_lo+de->cluster_hi<<16;
|
||||
tmpde->clus=de->clus_lo+de->clus_hi<<16;
|
||||
tmpde->size=de->size;
|
||||
tmpde->attr=de->attr;
|
||||
tmpde->datetime=Dos2CDate(de->WrtTime,de->WrtDate)-_local_time_offset;
|
||||
@@ -269,8 +269,8 @@ Bool FAT32DirFill(CFAT32DirEntry *de,
|
||||
MemSet(&de[de_cnt],0,sizeof(CFAT32DirEntry));
|
||||
res=FATNameTo(de[de_cnt].name,tmpde->name);
|
||||
}
|
||||
de[de_cnt].cluster_lo=tmpde->cluster.u16[0];
|
||||
de[de_cnt].cluster_hi=tmpde->cluster.u16[1];
|
||||
de[de_cnt].clus_lo=tmpde->clus.u16[0];
|
||||
de[de_cnt].clus_hi=tmpde->clus.u16[1];
|
||||
if (!(tmpde->attr&RS_ATTR_DIR))
|
||||
de[de_cnt].size=tmpde->size;
|
||||
de[de_cnt].attr=tmpde->attr;
|
||||
@@ -283,12 +283,12 @@ Bool FAT32DirFill(CFAT32DirEntry *de,
|
||||
return res;
|
||||
}
|
||||
|
||||
Bool FAT32FileFind(CDrv *dv,I64 cur_dir_cluster,
|
||||
Bool FAT32FileFind(CDrv *dv,I64 cur_dir_clus,
|
||||
U8 *name,CDirEntry *_res,I64 fuf_flags=0)
|
||||
{//$LK,"FUF_JUST_DIRS",A="MN:FUF_JUST_DIRS"$, $LK,"FUF_JUST_FILES",A="MN:FUF_JUST_FILES"$
|
||||
Bool res=FALSE,unlock;
|
||||
CFAT32DirEntry *buf;
|
||||
I64 xsum=0,attr,cur_dir_entry,entries_per_cluster;
|
||||
I64 xsum=0,attr,cur_dir_entry,entries_per_clus;
|
||||
U8 dname[CDIR_FILENAME_LEN],ch;
|
||||
CDirEntry long_name;
|
||||
if (fuf_flags&~FUG_FILE_FIND)
|
||||
@@ -304,8 +304,8 @@ Bool FAT32FileFind(CDrv *dv,I64 cur_dir_cluster,
|
||||
try {
|
||||
unlock=DrvLock(dv);
|
||||
buf=MAlloc(BLK_SIZE*dv->spc);
|
||||
entries_per_cluster=dv->spc<<FAT32_ENTRIES_BITS;
|
||||
RClusters(dv,buf,cur_dir_cluster,1);
|
||||
entries_per_clus=dv->spc<<FAT32_ENTRIES_BITS;
|
||||
ClusRead(dv,buf,cur_dir_clus,1);
|
||||
cur_dir_entry=0;
|
||||
while (ch=*buf[cur_dir_entry].name) {
|
||||
attr=buf[cur_dir_entry].attr;
|
||||
@@ -331,12 +331,12 @@ Bool FAT32FileFind(CDrv *dv,I64 cur_dir_cluster,
|
||||
}
|
||||
} else
|
||||
MemSet(&long_name,0,sizeof(CDirEntry));
|
||||
if (++cur_dir_entry==entries_per_cluster) {
|
||||
cur_dir_cluster=ClusterNumNext(dv,cur_dir_cluster);
|
||||
if (!(0<cur_dir_cluster<0x0FFFFFF8))
|
||||
if (++cur_dir_entry==entries_per_clus) {
|
||||
cur_dir_clus=ClusNumNext(dv,cur_dir_clus);
|
||||
if (!(0<cur_dir_clus<0x0FFFFFF8))
|
||||
break;
|
||||
else {
|
||||
RClusters(dv,buf,cur_dir_cluster,1);
|
||||
ClusRead(dv,buf,cur_dir_clus,1);
|
||||
cur_dir_entry=0;
|
||||
}
|
||||
}
|
||||
@@ -356,7 +356,7 @@ U8 *FAT32FileRead(CDrv *dv,U8 *cur_dir,U8 *filename,I64 *_size,I64 *_attr)
|
||||
{
|
||||
U8 *buf=NULL;
|
||||
CDirEntry de;
|
||||
I64 c,blk_cnt,cur_dir_cluster;
|
||||
I64 c,blk_cnt,cur_dir_clus;
|
||||
DrvChk(dv);
|
||||
*_size=0;
|
||||
*_attr=0;
|
||||
@@ -365,15 +365,15 @@ U8 *FAT32FileRead(CDrv *dv,U8 *cur_dir,U8 *filename,I64 *_size,I64 *_attr)
|
||||
else
|
||||
try {
|
||||
DrvLock(dv);
|
||||
cur_dir_cluster=Name2DirCluster(dv,cur_dir);
|
||||
if (FAT32FileFind(dv,cur_dir_cluster,filename,&de,FUF_JUST_FILES)) {
|
||||
cur_dir_clus=Name2DirClus(dv,cur_dir);
|
||||
if (FAT32FileFind(dv,cur_dir_clus,filename,&de,FUF_JUST_FILES)) {
|
||||
blk_cnt=(de.size+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
buf=MAlloc(blk_cnt<<BLK_SIZE_BITS+1);
|
||||
c=de.cluster;
|
||||
c=de.clus;
|
||||
if (!(0<c<0x0FFFFFF8))
|
||||
c=0x0FFFFFFF;
|
||||
else
|
||||
c=RClustersBlks(dv,buf,c,blk_cnt);
|
||||
c=ClusBlkRead(dv,buf,c,blk_cnt);
|
||||
buf[de.size]=0; //Terminate
|
||||
*_size=de.size;
|
||||
*_attr=FileAttr(de.name,de.attr);
|
||||
@@ -384,12 +384,12 @@ U8 *FAT32FileRead(CDrv *dv,U8 *cur_dir,U8 *filename,I64 *_size,I64 *_attr)
|
||||
return buf;
|
||||
}
|
||||
|
||||
Bool FAT32Cd(U8 *name,I64 cur_dir_cluster)
|
||||
Bool FAT32Cd(U8 *name,I64 cur_dir_clus)
|
||||
{
|
||||
CDirEntry de;
|
||||
if (Fs->cur_dv->fs_type!=FSt_FAT32)
|
||||
PrintErr("Not FAT32 Drv\n");
|
||||
else if (FAT32FileFind(Fs->cur_dv,cur_dir_cluster,name,&de,FUF_JUST_DIRS))
|
||||
else if (FAT32FileFind(Fs->cur_dv,cur_dir_clus,name,&de,FUF_JUST_DIRS))
|
||||
return TRUE;
|
||||
else {
|
||||
"%s ",name;
|
||||
@@ -398,7 +398,7 @@ Bool FAT32Cd(U8 *name,I64 cur_dir_cluster)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
U0 FAT32FreeClusters(CDrv *dv,I64 c)
|
||||
U0 FAT32FreeClus(CDrv *dv,I64 c)
|
||||
{
|
||||
I64 next,saved_c=c;
|
||||
Bool unlock,unlock_break;
|
||||
@@ -441,10 +441,10 @@ U0 FAT32FreeClusters(CDrv *dv,I64 c)
|
||||
}
|
||||
}
|
||||
|
||||
I64 FAT32AllocClusters(CDrv *dv,I64 c,I64 cnt)
|
||||
I64 FAT32AllocClus(CDrv *dv,I64 c,I64 cnt)
|
||||
{
|
||||
Bool wrap_around=FALSE,unlock,unlock_break;
|
||||
I64 first=INVALID_CLUSTER,j,l;
|
||||
I64 first=INVALID_CLUS,j,l;
|
||||
|
||||
if (cnt<=0) return 0x0FFFFFFF;
|
||||
try {
|
||||
@@ -484,8 +484,8 @@ I64 FAT32AllocClusters(CDrv *dv,I64 c,I64 cnt)
|
||||
DrvFATBlkClean(dv);
|
||||
|
||||
dv->fis->most_recently_alloced=j;
|
||||
dv->fis->free_clusters=-1;
|
||||
WBlks(dv,dv->fis,dv->file_system_info_sect,1);
|
||||
dv->fis->free_clus=-1;
|
||||
BlkWrite(dv,dv->fis,dv->file_system_info_sect,1);
|
||||
} catch {
|
||||
if (unlock)
|
||||
DrvUnlock(dv);
|
||||
@@ -499,7 +499,7 @@ I64 FAT32AllocClusters(CDrv *dv,I64 c,I64 cnt)
|
||||
return first;
|
||||
}
|
||||
|
||||
I64 FAT32AllocContiguousClusters(CDrv *dv,I64 cnt)
|
||||
I64 FAT32AllocContiguousClus(CDrv *dv,I64 cnt)
|
||||
{
|
||||
I64 i,first=1;
|
||||
Bool cont,unlock,unlock_break;
|
||||
@@ -566,8 +566,8 @@ Bool FAT32DirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
//See $LK,"::/Doc/CutCorners.DD"$.
|
||||
CFAT32DirEntry *buf,*last_buf,*tmp_buf,de[3];
|
||||
I64 i,attr,avail_cnt,de_cnt,c,
|
||||
cur_dir_entry,entries_per_cluster,
|
||||
cur_dir_cluster,xsum=0,last_dir_cluster=INVALID_CLUSTER;
|
||||
cur_dir_entry,entries_per_clus,
|
||||
cur_dir_clus,xsum=0,last_dir_clus=INVALID_CLUS;
|
||||
U8 ch;
|
||||
Bool written=FALSE,unlock,unlock_break;
|
||||
CDirEntry long_name;
|
||||
@@ -576,11 +576,11 @@ Bool FAT32DirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
try {
|
||||
unlock_break=BreakLock;
|
||||
unlock=DrvLock(dv);
|
||||
cur_dir_cluster=Name2DirCluster(dv,cur_dir);
|
||||
cur_dir_clus=Name2DirClus(dv,cur_dir);
|
||||
buf =MAlloc(BLK_SIZE*dv->spc);
|
||||
last_buf=CAlloc(BLK_SIZE*dv->spc);
|
||||
entries_per_cluster=dv->spc<<FAT32_ENTRIES_BITS;
|
||||
RClusters(dv,buf,cur_dir_cluster,1);
|
||||
entries_per_clus=dv->spc<<FAT32_ENTRIES_BITS;
|
||||
ClusRead(dv,buf,cur_dir_clus,1);
|
||||
cur_dir_entry=0;
|
||||
while (ch=*buf[cur_dir_entry].name) {
|
||||
attr=buf[cur_dir_entry].attr;
|
||||
@@ -597,8 +597,8 @@ Bool FAT32DirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
}
|
||||
if (ch==0xE5 && !written && avail_cnt>=de_cnt) {
|
||||
MemCpy(&buf[cur_dir_entry],&de,de_cnt*sizeof(CFAT32DirEntry));
|
||||
WBlks(dv,&buf[cur_dir_entry & -FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+cur_dir_cluster*dv->spc
|
||||
BlkWrite(dv,&buf[cur_dir_entry & -FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+cur_dir_clus*dv->spc
|
||||
+cur_dir_entry>>FAT32_ENTRIES_BITS,1);
|
||||
cur_dir_entry+=de_cnt-1; //gets inc'ed
|
||||
written=TRUE;
|
||||
@@ -610,12 +610,12 @@ Bool FAT32DirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
//Del old entry with same name
|
||||
if (!StrCmp(long_name.name,tmpde->name)) {
|
||||
if (free_old_chain)
|
||||
FAT32FreeClusters(dv,buf[cur_dir_entry].cluster_lo+
|
||||
buf[cur_dir_entry].cluster_hi<<16);
|
||||
FAT32FreeClus(dv,buf[cur_dir_entry].clus_lo+
|
||||
buf[cur_dir_entry].clus_hi<<16);
|
||||
if (!written) {
|
||||
MemCpy(&buf[cur_dir_entry],&de[de_cnt-1],sizeof(CFAT32DirEntry));
|
||||
WBlks(dv,&buf[cur_dir_entry & -FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+cur_dir_cluster*dv->spc
|
||||
BlkWrite(dv,&buf[cur_dir_entry & -FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+cur_dir_clus*dv->spc
|
||||
+cur_dir_entry>>FAT32_ENTRIES_BITS,1);
|
||||
written=TRUE;
|
||||
} else {
|
||||
@@ -626,20 +626,20 @@ Bool FAT32DirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
==RS_ATTR_LONG_NAME)
|
||||
*buf[cur_dir_entry-i++].name=0xE5;
|
||||
i--;
|
||||
WBlks(dv,&buf[(cur_dir_entry-i)&-FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+cur_dir_cluster*dv->spc
|
||||
BlkWrite(dv,&buf[(cur_dir_entry-i)&-FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+cur_dir_clus*dv->spc
|
||||
+(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) {
|
||||
if (i==cur_dir_entry && 0<last_dir_clus<0x0FFFFFF8) {
|
||||
i=1;
|
||||
while (i<=entries_per_cluster &&
|
||||
last_buf[entries_per_cluster-i].attr
|
||||
while (i<=entries_per_clus &&
|
||||
last_buf[entries_per_clus-i].attr
|
||||
&RS_ATTR_LONG_NAME_MASK==RS_ATTR_LONG_NAME)
|
||||
*last_buf[entries_per_cluster-i++].name=0xE5;
|
||||
*last_buf[entries_per_clus-i++].name=0xE5;
|
||||
if (--i>0)
|
||||
WBlks(dv,&buf[(entries_per_cluster-i)&-FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+last_dir_cluster*dv->spc
|
||||
+(entries_per_cluster-i)>>FAT32_ENTRIES_BITS,
|
||||
BlkWrite(dv,&buf[(entries_per_clus-i)&-FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+last_dir_clus*dv->spc
|
||||
+(entries_per_clus-i)>>FAT32_ENTRIES_BITS,
|
||||
(i+FAT32_ENTRIES_PER_BLK-1)>>FAT32_ENTRIES_BITS);
|
||||
}
|
||||
}
|
||||
@@ -648,17 +648,17 @@ Bool FAT32DirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
}
|
||||
MemSet(&long_name,0,sizeof(CDirEntry));
|
||||
}
|
||||
if (++cur_dir_entry==entries_per_cluster) {
|
||||
last_dir_cluster=cur_dir_cluster;
|
||||
if (++cur_dir_entry==entries_per_clus) {
|
||||
last_dir_clus=cur_dir_clus;
|
||||
tmp_buf=buf; buf=last_buf; last_buf=tmp_buf;
|
||||
c=ClusterNumNext(dv,cur_dir_cluster);
|
||||
c=ClusNumNext(dv,cur_dir_clus);
|
||||
if (!(0<c<0x0FFFFFF8)) {
|
||||
c=ClustersAlloc(dv,cur_dir_cluster,1,FALSE);
|
||||
c=ClusAlloc(dv,cur_dir_clus,1,FALSE);
|
||||
MemSet(buf,0,BLK_SIZE*dv->spc);
|
||||
WClusters(dv,buf,c,1);
|
||||
ClusWrite(dv,buf,c,1);
|
||||
} else
|
||||
RClusters(dv,buf,c,1);
|
||||
cur_dir_cluster=c;
|
||||
ClusRead(dv,buf,c,1);
|
||||
cur_dir_clus=c;
|
||||
cur_dir_entry=0;
|
||||
}
|
||||
}
|
||||
@@ -667,32 +667,32 @@ Bool FAT32DirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
if (avail_cnt<de_cnt) {
|
||||
for (i=0;i<avail_cnt;i++)
|
||||
*buf[cur_dir_entry+i].name=0xE5;
|
||||
WBlks(dv,&buf[cur_dir_entry &-FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+cur_dir_cluster*dv->spc
|
||||
BlkWrite(dv,&buf[cur_dir_entry &-FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+cur_dir_clus*dv->spc
|
||||
+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;
|
||||
if (cur_dir_entry==entries_per_clus) {
|
||||
last_dir_clus=cur_dir_clus;
|
||||
tmp_buf=buf; buf=last_buf; last_buf=tmp_buf;
|
||||
cur_dir_cluster=ClustersAlloc(dv,cur_dir_cluster,1);
|
||||
cur_dir_clus=ClusAlloc(dv,cur_dir_clus,1);
|
||||
cur_dir_entry=0;
|
||||
MemSet(buf,0,BLK_SIZE*dv->spc);
|
||||
WClusters(dv,buf,cur_dir_cluster,1);
|
||||
ClusWrite(dv,buf,cur_dir_clus,1);
|
||||
}
|
||||
}
|
||||
MemCpy(&buf[cur_dir_entry],&de,de_cnt*sizeof(CFAT32DirEntry));
|
||||
WBlks(dv,&buf[cur_dir_entry &-FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+cur_dir_cluster*dv->spc+
|
||||
BlkWrite(dv,&buf[cur_dir_entry &-FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+cur_dir_clus*dv->spc+
|
||||
cur_dir_entry>>FAT32_ENTRIES_BITS,1);
|
||||
cur_dir_entry+=de_cnt;
|
||||
if (cur_dir_entry==entries_per_cluster) {
|
||||
cur_dir_cluster=ClustersAlloc(dv,cur_dir_cluster,1);
|
||||
if (cur_dir_entry==entries_per_clus) {
|
||||
cur_dir_clus=ClusAlloc(dv,cur_dir_clus,1);
|
||||
MemSet(buf,0,BLK_SIZE*dv->spc);
|
||||
WClusters(dv,buf,cur_dir_cluster,1);
|
||||
ClusWrite(dv,buf,cur_dir_clus,1);
|
||||
} else {
|
||||
MemSet(&buf[cur_dir_entry],0,sizeof(CFAT32DirEntry));
|
||||
WBlks(dv,&buf[cur_dir_entry &-FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+cur_dir_cluster*dv->spc
|
||||
BlkWrite(dv,&buf[cur_dir_entry &-FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+cur_dir_clus*dv->spc
|
||||
+cur_dir_entry>>FAT32_ENTRIES_BITS,1);
|
||||
}
|
||||
}
|
||||
@@ -715,8 +715,8 @@ I64 FAT32FilesDel(CDrv *dv,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
|
||||
Bool del_dir,Bool print_msg)
|
||||
{
|
||||
CFAT32DirEntry *buf,*last_buf,*tmp_buf;
|
||||
I64 i,res=0,attr,xsum=0,last_dir_cluster=INVALID_CLUSTER,
|
||||
cur_dir_entry,entries_per_cluster,cur_dir_cluster;
|
||||
I64 i,res=0,attr,xsum=0,last_dir_clus=INVALID_CLUS,
|
||||
cur_dir_entry,entries_per_clus,cur_dir_clus;
|
||||
U8 ch;
|
||||
Bool unlock_break;
|
||||
CDirEntry long_name;
|
||||
@@ -724,11 +724,11 @@ I64 FAT32FilesDel(CDrv *dv,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
|
||||
try {
|
||||
unlock_break=BreakLock;
|
||||
DrvLock(dv);
|
||||
cur_dir_cluster=Name2DirCluster(dv,cur_dir);
|
||||
cur_dir_clus=Name2DirClus(dv,cur_dir);
|
||||
buf =MAlloc(BLK_SIZE*dv->spc);
|
||||
last_buf=CAlloc(BLK_SIZE*dv->spc);
|
||||
entries_per_cluster=dv->spc<<FAT32_ENTRIES_BITS;
|
||||
RClusters(dv,buf,cur_dir_cluster,1);
|
||||
entries_per_clus=dv->spc<<FAT32_ENTRIES_BITS;
|
||||
ClusRead(dv,buf,cur_dir_clus,1);
|
||||
cur_dir_entry=0;
|
||||
while (ch=*buf[cur_dir_entry].name) {
|
||||
attr=buf[cur_dir_entry].attr;
|
||||
@@ -753,35 +753,35 @@ I64 FAT32FilesDel(CDrv *dv,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
|
||||
==RS_ATTR_LONG_NAME)
|
||||
*buf[cur_dir_entry-i++].name=0xE5;
|
||||
i--;
|
||||
WBlks(dv,&buf[(cur_dir_entry-i)&-FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+cur_dir_cluster*dv->spc
|
||||
BlkWrite(dv,&buf[(cur_dir_entry-i)&-FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+cur_dir_clus*dv->spc
|
||||
+(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) {
|
||||
if (i==cur_dir_entry && last_dir_clus!=INVALID_CLUS) {
|
||||
i=1;
|
||||
while (i<=entries_per_cluster &&
|
||||
last_buf[entries_per_cluster-i].attr
|
||||
while (i<=entries_per_clus &&
|
||||
last_buf[entries_per_clus-i].attr
|
||||
&RS_ATTR_LONG_NAME_MASK==RS_ATTR_LONG_NAME)
|
||||
*last_buf[entries_per_cluster-i++].name=0xE5;
|
||||
*last_buf[entries_per_clus-i++].name=0xE5;
|
||||
if (--i>0)
|
||||
WBlks(dv,&buf[(entries_per_cluster-i)&-FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+last_dir_cluster*dv->spc
|
||||
+(entries_per_cluster-i)>>FAT32_ENTRIES_BITS,
|
||||
BlkWrite(dv,&buf[(entries_per_clus-i)&-FAT32_ENTRIES_PER_BLK],
|
||||
dv->data_area+last_dir_clus*dv->spc
|
||||
+(entries_per_clus-i)>>FAT32_ENTRIES_BITS,
|
||||
(i+FAT32_ENTRIES_PER_BLK-1)>>FAT32_ENTRIES_BITS);
|
||||
}
|
||||
FAT32FreeClusters(dv,buf[cur_dir_entry].cluster_lo+
|
||||
buf[cur_dir_entry].cluster_hi<<16);
|
||||
FAT32FreeClus(dv,buf[cur_dir_entry].clus_lo+
|
||||
buf[cur_dir_entry].clus_hi<<16);
|
||||
}
|
||||
}
|
||||
MemSet(&long_name,0,sizeof(CDirEntry));
|
||||
}
|
||||
} else
|
||||
MemSet(&long_name,0,sizeof(CDirEntry));
|
||||
if (++cur_dir_entry==entries_per_cluster) {
|
||||
last_dir_cluster=cur_dir_cluster;
|
||||
cur_dir_cluster=ClusterNumNext(dv,cur_dir_cluster,1);
|
||||
if (++cur_dir_entry==entries_per_clus) {
|
||||
last_dir_clus=cur_dir_clus;
|
||||
cur_dir_clus=ClusNumNext(dv,cur_dir_clus,1);
|
||||
tmp_buf=buf; buf=last_buf; last_buf=tmp_buf;
|
||||
RClusters(dv,buf,cur_dir_cluster,1);
|
||||
ClusRead(dv,buf,cur_dir_clus,1);
|
||||
cur_dir_entry=0;
|
||||
}
|
||||
}
|
||||
@@ -818,14 +818,14 @@ I64 FAT32FileWrite(CDrv *dv,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
|
||||
contiguous=FALSE;
|
||||
de.size=size;
|
||||
if (blk_cnt=(size+BLK_SIZE-1)>>BLK_SIZE_BITS)
|
||||
c=ClustersAlloc(dv,0,(blk_cnt+dv->spc-1)/dv->spc,contiguous);
|
||||
c=ClusAlloc(dv,0,(blk_cnt+dv->spc-1)/dv->spc,contiguous);
|
||||
else
|
||||
c=0x0FFFFFFF;
|
||||
de.cluster=c;
|
||||
de.clus=c;
|
||||
de.attr=attr;
|
||||
de.datetime=cdt;
|
||||
if (blk_cnt)
|
||||
WClustersBlks(dv,buf,c,blk_cnt);
|
||||
ClusBlkWrite(dv,buf,c,blk_cnt);
|
||||
FAT32DirNew(dv,cur_dir,&de,TRUE);
|
||||
}
|
||||
return c;
|
||||
@@ -837,7 +837,7 @@ CDirEntry *FAT32FilesFind(U8 *files_find_mask,
|
||||
CDrv *dv=Fs->cur_dv;
|
||||
CFAT32DirEntry *buf;
|
||||
I64 attr,xsum=0,dir_size=0,sub_dir_size,
|
||||
cur_dir_cluster,cur_dir_entry,entries_per_cluster;
|
||||
cur_dir_clus,cur_dir_entry,entries_per_clus;
|
||||
U8 ch;
|
||||
CDirEntry *res=NULL,*tmpde,long_name;
|
||||
if (fuf_flags&~FUG_FILES_FIND)
|
||||
@@ -845,10 +845,10 @@ CDirEntry *FAT32FilesFind(U8 *files_find_mask,
|
||||
try {
|
||||
MemSet(&long_name,0,sizeof(CDirEntry));
|
||||
DrvLock(dv);
|
||||
cur_dir_cluster=Name2DirCluster(dv,Fs->cur_dir);
|
||||
cur_dir_clus=Name2DirClus(dv,Fs->cur_dir);
|
||||
buf=MAlloc(BLK_SIZE*dv->spc);
|
||||
entries_per_cluster=dv->spc<<FAT32_ENTRIES_BITS;
|
||||
RClusters(dv,buf,cur_dir_cluster,1);
|
||||
entries_per_clus=dv->spc<<FAT32_ENTRIES_BITS;
|
||||
ClusRead(dv,buf,cur_dir_clus,1);
|
||||
dir_size+=dv->spc*BLK_SIZE;
|
||||
cur_dir_entry=0;
|
||||
while (ch=*buf[cur_dir_entry].name) {
|
||||
@@ -898,12 +898,12 @@ CDirEntry *FAT32FilesFind(U8 *files_find_mask,
|
||||
}
|
||||
} else
|
||||
MemSet(&long_name,0,sizeof(CDirEntry));
|
||||
if (++cur_dir_entry==entries_per_cluster) {
|
||||
cur_dir_cluster=ClusterNumNext(dv,cur_dir_cluster);
|
||||
if (cur_dir_cluster==INVALID_CLUSTER)
|
||||
if (++cur_dir_entry==entries_per_clus) {
|
||||
cur_dir_clus=ClusNumNext(dv,cur_dir_clus);
|
||||
if (cur_dir_clus==INVALID_CLUS)
|
||||
break;
|
||||
else {
|
||||
RClusters(dv,buf,cur_dir_cluster,1);
|
||||
ClusRead(dv,buf,cur_dir_clus,1);
|
||||
dir_size+=dv->spc*BLK_SIZE;
|
||||
cur_dir_entry=0;
|
||||
}
|
||||
@@ -920,7 +920,7 @@ CDirEntry *FAT32FilesFind(U8 *files_find_mask,
|
||||
|
||||
Bool FAT32MkDir(CDrv *dv,U8 *cur_dir,U8 *name,I64 entry_cnt)
|
||||
{
|
||||
I64 c,cur_dir_cluster=Name2DirCluster(dv,cur_dir),
|
||||
I64 c,cur_dir_clus=Name2DirClus(dv,cur_dir),
|
||||
//Rough estimate of size
|
||||
size=CeilU64((entry_cnt+2)<<FAT32_ENTRIES_BITS,dv->spc<<BLK_SIZE_BITS);
|
||||
U8 *buf=CAlloc(size);
|
||||
@@ -935,7 +935,7 @@ Bool FAT32MkDir(CDrv *dv,U8 *cur_dir,U8 *name,I64 entry_cnt)
|
||||
d_native.attr=RS_ATTR_DIR;
|
||||
*d_native.name='.';
|
||||
d_native.name[1]=0;
|
||||
d_native.cluster=c;
|
||||
d_native.clus=c;
|
||||
d_native.size=0;
|
||||
d_native.datetime=Now;
|
||||
FAT32DirFill(dFAT,&d_native,NULL,dv->fat32_local_time_offset);
|
||||
@@ -946,11 +946,11 @@ Bool FAT32MkDir(CDrv *dv,U8 *cur_dir,U8 *name,I64 entry_cnt)
|
||||
*d_native.name='.';
|
||||
d_native.name[1]='.';
|
||||
d_native.name[2]=0;
|
||||
d_native.cluster=cur_dir_cluster;
|
||||
d_native.clus=cur_dir_clus;
|
||||
d_native.size=0;
|
||||
d_native.datetime=Now;
|
||||
FAT32DirFill(dFAT,&d_native,NULL,dv->fat32_local_time_offset);
|
||||
WClusters(dv,buf,c,1);
|
||||
ClusWrite(dv,buf,c,1);
|
||||
Free(buf);
|
||||
if (unlock_break)
|
||||
BreakUnlock;
|
||||
|
||||
@@ -58,7 +58,7 @@ Bool ISO1CDirFill(CDirEntry *tmpde,CISO1DirEntry *de)
|
||||
Bool res;
|
||||
MemSet(tmpde,0,sizeof(CDirEntry));
|
||||
res=ISO1FromName(tmpde->name,&de->name_len);
|
||||
tmpde->cluster=de->loc.little;
|
||||
tmpde->clus=de->loc.little;
|
||||
tmpde->size=de->size.little;
|
||||
tmpde->attr=FileAttr(tmpde->name);
|
||||
if (de->flags & ISO1_ATTR_DIR)
|
||||
@@ -67,7 +67,7 @@ Bool ISO1CDirFill(CDirEntry *tmpde,CISO1DirEntry *de)
|
||||
return res;
|
||||
}
|
||||
|
||||
Bool ISO1FileFind(CDrv *dv,I64 cur_dir_cluster,U8 *name,
|
||||
Bool ISO1FileFind(CDrv *dv,I64 cur_dir_clus,U8 *name,
|
||||
CDirEntry *_res,I64 fuf_flags=0)
|
||||
{//$LK,"FUF_JUST_DIRS",A="MN:FUF_JUST_DIRS"$, $LK,"FUF_JUST_FILES",A="MN:FUF_JUST_FILES"$
|
||||
CISO1DirEntry *isoptr,*buf;
|
||||
@@ -83,11 +83,11 @@ Bool ISO1FileFind(CDrv *dv,I64 cur_dir_cluster,U8 *name,
|
||||
try {
|
||||
unlock=DrvLock(dv);
|
||||
isoptr=MAlloc(dv->spc<<BLK_SIZE_BITS);
|
||||
RClusters(dv,isoptr,cur_dir_cluster,1);
|
||||
ClusRead(dv,isoptr,cur_dir_clus,1);
|
||||
if (isoptr->name_len==1 && !isoptr->name) {//curdir
|
||||
i=(isoptr->size.little+dv->spc<<BLK_SIZE_BITS-1)/dv->spc<<BLK_SIZE_BITS;
|
||||
buf=MAlloc(dv->spc<<BLK_SIZE_BITS*i);
|
||||
RClusters(dv,buf,cur_dir_cluster,i);
|
||||
ClusRead(dv,buf,cur_dir_clus,i);
|
||||
Free(isoptr);
|
||||
} else {
|
||||
buf=isoptr;
|
||||
@@ -131,7 +131,7 @@ U8 *ISO1FileRead(CDrv *dv,U8 *cur_dir,U8 *filename,I64 *_size,I64 *_attr)
|
||||
{
|
||||
U8 *buf=NULL;
|
||||
CDirEntry de;
|
||||
I64 c,blk_cnt,cur_dir_cluster;
|
||||
I64 c,blk_cnt,cur_dir_clus;
|
||||
DrvChk(dv);
|
||||
*_size=0;
|
||||
*_attr=0;
|
||||
@@ -140,12 +140,12 @@ U8 *ISO1FileRead(CDrv *dv,U8 *cur_dir,U8 *filename,I64 *_size,I64 *_attr)
|
||||
else
|
||||
try {
|
||||
DrvLock(dv);
|
||||
cur_dir_cluster=Name2DirCluster(dv,cur_dir);
|
||||
if (ISO1FileFind(dv,cur_dir_cluster,filename,&de,FUF_JUST_FILES)) {
|
||||
cur_dir_clus=Name2DirClus(dv,cur_dir);
|
||||
if (ISO1FileFind(dv,cur_dir_clus,filename,&de,FUF_JUST_FILES)) {
|
||||
blk_cnt=(de.size+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
buf=MAlloc(blk_cnt<<BLK_SIZE_BITS+1);
|
||||
c=de.cluster;
|
||||
c=RClustersBlks(dv,buf,c,blk_cnt);
|
||||
c=de.clus;
|
||||
c=ClusBlkRead(dv,buf,c,blk_cnt);
|
||||
buf[de.size]=0; //Terminate
|
||||
*_size=de.size;
|
||||
*_attr=FileAttr(de.name,de.attr);
|
||||
@@ -156,12 +156,12 @@ U8 *ISO1FileRead(CDrv *dv,U8 *cur_dir,U8 *filename,I64 *_size,I64 *_attr)
|
||||
return buf;
|
||||
}
|
||||
|
||||
Bool ISO1Cd(U8 *name,I64 cur_dir_cluster)
|
||||
Bool ISO1Cd(U8 *name,I64 cur_dir_clus)
|
||||
{
|
||||
CDirEntry de;
|
||||
if (Fs->cur_dv->fs_type!=FSt_ISO9660)
|
||||
PrintErr("Not ISO9660 Drv\n");
|
||||
else if (ISO1FileFind(Fs->cur_dv,cur_dir_cluster,name,&de,FUF_JUST_DIRS))
|
||||
else if (ISO1FileFind(Fs->cur_dv,cur_dir_clus,name,&de,FUF_JUST_DIRS))
|
||||
return TRUE;
|
||||
else {
|
||||
"%s ",name;
|
||||
@@ -175,16 +175,16 @@ CDirEntry *ISO1FilesFind(U8 *files_find_mask,
|
||||
{
|
||||
CDrv *dv=Fs->cur_dv;
|
||||
CISO1DirEntry *buf,*buf2,*isoptr;
|
||||
I64 i,cur_dir_cluster=Name2DirCluster(dv,Fs->cur_dir);
|
||||
I64 i,cur_dir_clus=Name2DirClus(dv,Fs->cur_dir);
|
||||
CDirEntry *res=NULL,*tmpde;
|
||||
if (fuf_flags&~FUG_FILES_FIND)
|
||||
throw('FUF');
|
||||
isoptr=MAlloc(dv->spc<<BLK_SIZE_BITS);
|
||||
RClusters(dv,isoptr,cur_dir_cluster,1);
|
||||
ClusRead(dv,isoptr,cur_dir_clus,1);
|
||||
if (isoptr->name_len==1 && !isoptr->name) {//curdir
|
||||
i=(isoptr->size.little+dv->spc<<BLK_SIZE_BITS-1)/dv->spc<<BLK_SIZE_BITS;
|
||||
buf=MAlloc(dv->spc<<BLK_SIZE_BITS*i);
|
||||
RClusters(dv,buf,cur_dir_cluster,i);
|
||||
ClusRead(dv,buf,cur_dir_clus,i);
|
||||
Free(isoptr);
|
||||
} else {
|
||||
buf=isoptr;
|
||||
|
||||
@@ -32,7 +32,7 @@ U0 RedSeaFreeLstBuild(CDrv *dv)
|
||||
RedSeaFreeFreeLst(dv);
|
||||
QueInit(&dv->next_free);
|
||||
while (first<max_blk) {
|
||||
i=0; //count free clusters
|
||||
i=0; //count free clus
|
||||
while (first+i<max_blk) {
|
||||
DrvFATBlkSet(dv,first+i);
|
||||
if (Bt(dv->cur_fat_blk,(first+i-dv->data_area)&(BLK_SIZE<<3-1)))
|
||||
@@ -61,7 +61,7 @@ U0 RedSeaInit(CDrv *dv)
|
||||
Bool unlock;
|
||||
try {
|
||||
unlock=DrvLock(dv);
|
||||
RBlks(dv,&br,dv->drv_offset,1);
|
||||
BlkRead(dv,&br,dv->drv_offset,1);
|
||||
if (br.signature!=MBR_PT_REDSEA || br.signature2!=0xAA55)
|
||||
throw('Drv');
|
||||
dv->fs_type=FSt_REDSEA;
|
||||
@@ -69,7 +69,7 @@ U0 RedSeaInit(CDrv *dv)
|
||||
dv->spc=1;
|
||||
dv->size=br.sects;
|
||||
dv->data_area=dv->drv_offset+br.bitmap_sects;
|
||||
dv->root_cluster=br.root_cluster;
|
||||
dv->root_clus=br.root_clus;
|
||||
dv->fat1=dv->fat2=dv->drv_offset+1;
|
||||
DrvFATBlkAlloc(dv);
|
||||
if (unlock)
|
||||
@@ -84,7 +84,7 @@ Bool RedSeaValidate(U8 drv_let)
|
||||
CDrv *dv;
|
||||
CRedSeaBoot br;
|
||||
if ((dv=Let2Drv(drv_let,FALSE)) && dv->fs_type==FSt_REDSEA &&
|
||||
RBlks(dv,&br,dv->drv_offset,1) && br.signature==MBR_PT_REDSEA &&
|
||||
BlkRead(dv,&br,dv->drv_offset,1) && br.signature==MBR_PT_REDSEA &&
|
||||
br.signature2==0xAA55 && br.sects==dv->size)
|
||||
return TRUE;
|
||||
else
|
||||
@@ -110,28 +110,28 @@ U0 RedSeaFmt(U8 drv_let,Bool quick=TRUE)
|
||||
n=(br->sects+BLK_SIZE<<3-1)/BLK_SIZE<<3;
|
||||
br->bitmap_sects=n;
|
||||
br->unique_id=GetTSC^Now()(U64);
|
||||
br->root_cluster=0;
|
||||
br->root_clus=0;
|
||||
|
||||
if (quick)
|
||||
i=n+1;
|
||||
else
|
||||
i=dv->size;
|
||||
WZeroBlks(dv,dv->drv_offset,i);
|
||||
BlkWriteZero(dv,dv->drv_offset,i);
|
||||
|
||||
WBlks(dv,br,dv->drv_offset,1);
|
||||
BlkWrite(dv,br,dv->drv_offset,1);
|
||||
RedSeaInit(dv);
|
||||
ClustersAlloc(dv,0,1,FALSE); //Alloc #1
|
||||
ClusAlloc(dv,0,1,FALSE); //Alloc #1
|
||||
|
||||
root_dir_blks=MaxI64(1,dv->bd->init_root_dir_blks);
|
||||
br->root_cluster=ClustersAlloc(dv,0,root_dir_blks,FALSE);
|
||||
WBlks(dv,br,dv->drv_offset,1);
|
||||
br->root_clus=ClusAlloc(dv,0,root_dir_blks,FALSE);
|
||||
BlkWrite(dv,br,dv->drv_offset,1);
|
||||
root_dir=CAlloc(BLK_SIZE*root_dir_blks);
|
||||
|
||||
d_native=root_dir-offset(CDirEntry.start);
|
||||
|
||||
d_native->attr=RS_ATTR_DIR|RS_ATTR_CONTIGUOUS;
|
||||
*d_native->name='.';
|
||||
d_native->cluster=br->root_cluster;
|
||||
d_native->clus=br->root_clus;
|
||||
d_native->size=BLK_SIZE*root_dir_blks;
|
||||
d_native->datetime=Now;
|
||||
|
||||
@@ -140,10 +140,10 @@ U0 RedSeaFmt(U8 drv_let,Bool quick=TRUE)
|
||||
*d_native->name='.';
|
||||
d_native->name[1]='.';
|
||||
d_native->attr=RS_ATTR_DIR|RS_ATTR_CONTIGUOUS;
|
||||
d_native->cluster=br->root_cluster;
|
||||
d_native->clus=br->root_clus;
|
||||
d_native->datetime=Now;
|
||||
|
||||
WBlks(dv,root_dir,br->root_cluster,root_dir_blks);
|
||||
BlkWrite(dv,root_dir,br->root_clus,root_dir_blks);
|
||||
RedSeaInit(dv);
|
||||
DrvUnlock(dv);
|
||||
} catch
|
||||
@@ -152,7 +152,7 @@ U0 RedSeaFmt(U8 drv_let,Bool quick=TRUE)
|
||||
Free(root_dir);
|
||||
}
|
||||
|
||||
Bool RedSeaFileFind(CDrv *dv,I64 cur_dir_cluster,U8 *name,
|
||||
Bool RedSeaFileFind(CDrv *dv,I64 cur_dir_clus,U8 *name,
|
||||
CDirEntry *_res,I64 fuf_flags=0)
|
||||
{//$LK,"FUF_JUST_DIRS",A="MN:FUF_JUST_DIRS"$, $LK,"FUF_JUST_FILES",A="MN:FUF_JUST_FILES"$
|
||||
CDirEntry *buf,*buf2,*ptr;
|
||||
@@ -171,11 +171,11 @@ Bool RedSeaFileFind(CDrv *dv,I64 cur_dir_cluster,U8 *name,
|
||||
try {
|
||||
unlock=DrvLock(dv);
|
||||
buf2=MAlloc(BLK_SIZE);
|
||||
RBlks(dv,buf2,cur_dir_cluster,1);
|
||||
BlkRead(dv,buf2,cur_dir_clus,1);
|
||||
|
||||
ptr=buf2(U8 *)-offset(CDirEntry.start);
|
||||
buf=MAlloc(ptr->size);
|
||||
RBlks(dv,buf,cur_dir_cluster,ptr->size>>BLK_SIZE_BITS);
|
||||
BlkRead(dv,buf,cur_dir_clus,ptr->size>>BLK_SIZE_BITS);
|
||||
Free(buf2);
|
||||
|
||||
ptr=buf(U8 *)-offset(CDirEntry.start);
|
||||
@@ -208,7 +208,7 @@ U8 *RedSeaFileRead(CDrv *dv,U8 *cur_dir,U8 *filename,I64 *_size,I64 *_attr)
|
||||
{
|
||||
U8 *buf=NULL;
|
||||
CDirEntry de;
|
||||
I64 c,blk_cnt,cur_dir_cluster;
|
||||
I64 c,blk_cnt,cur_dir_clus;
|
||||
DrvChk(dv);
|
||||
*_size=0;
|
||||
*_attr=0;
|
||||
@@ -217,12 +217,12 @@ U8 *RedSeaFileRead(CDrv *dv,U8 *cur_dir,U8 *filename,I64 *_size,I64 *_attr)
|
||||
else
|
||||
try {
|
||||
DrvLock(dv);
|
||||
cur_dir_cluster=Name2DirCluster(dv,cur_dir);
|
||||
if (RedSeaFileFind(dv,cur_dir_cluster,filename,&de,FUF_JUST_FILES)) {
|
||||
cur_dir_clus=Name2DirClus(dv,cur_dir);
|
||||
if (RedSeaFileFind(dv,cur_dir_clus,filename,&de,FUF_JUST_FILES)) {
|
||||
blk_cnt=(de.size+BLK_SIZE-1)>>BLK_SIZE_BITS;
|
||||
buf=MAlloc(blk_cnt<<BLK_SIZE_BITS+1);
|
||||
c=de.cluster;
|
||||
c=RBlks(dv,buf,c,blk_cnt);
|
||||
c=de.clus;
|
||||
c=BlkRead(dv,buf,c,blk_cnt);
|
||||
buf[de.size]=0; //Terminate
|
||||
*_size=de.size;
|
||||
*_attr=FileAttr(de.name,de.attr);
|
||||
@@ -233,12 +233,12 @@ U8 *RedSeaFileRead(CDrv *dv,U8 *cur_dir,U8 *filename,I64 *_size,I64 *_attr)
|
||||
return buf;
|
||||
}
|
||||
|
||||
Bool RedSeaCd(U8 *name,I64 cur_dir_cluster)
|
||||
Bool RedSeaCd(U8 *name,I64 cur_dir_clus)
|
||||
{
|
||||
CDirEntry de;
|
||||
if (Fs->cur_dv->fs_type!=FSt_REDSEA)
|
||||
PrintErr("Not RedSea Drv\n");
|
||||
else if (RedSeaFileFind(Fs->cur_dv,cur_dir_cluster,name,&de,FUF_JUST_DIRS))
|
||||
else if (RedSeaFileFind(Fs->cur_dv,cur_dir_clus,name,&de,FUF_JUST_DIRS))
|
||||
return TRUE;
|
||||
else {
|
||||
"%s ",name;
|
||||
@@ -247,7 +247,7 @@ Bool RedSeaCd(U8 *name,I64 cur_dir_cluster)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
U0 RedSeaFreeClusters(CDrv *dv,I64 c,I64 cnt)
|
||||
U0 RedSeaFreeClus(CDrv *dv,I64 c,I64 cnt)
|
||||
{
|
||||
CFreeLst *tmpf;
|
||||
Bool found=FALSE,unlock,unlock_break;
|
||||
@@ -299,7 +299,7 @@ U0 RedSeaFreeClusters(CDrv *dv,I64 c,I64 cnt)
|
||||
}
|
||||
}
|
||||
|
||||
I64 RedSeaAllocClusters(CDrv *dv,I64 cnt)
|
||||
I64 RedSeaAllocClus(CDrv *dv,I64 cnt)
|
||||
{
|
||||
CFreeLst *tmpf,*best_free=NULL;
|
||||
I64 i,first,best_size=I64_MAX;
|
||||
@@ -353,20 +353,20 @@ Bool RedSeaDirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
{
|
||||
CDirEntry *buf,*buf2,*ptr,de2;
|
||||
CRedSeaBoot *br;
|
||||
I64 c,ch,i=1,j=0,n=BLK_SIZE/CDIR_SIZE,dir_size,cur_dir_cluster;
|
||||
I64 c,ch,i=1,j=0,n=BLK_SIZE/CDIR_SIZE,dir_size,cur_dir_clus;
|
||||
Bool written=FALSE,unlock,unlock_break;
|
||||
U8 *tmp,*parent_dir;
|
||||
try {
|
||||
unlock_break=BreakLock;
|
||||
tmpde->attr|=RS_ATTR_CONTIGUOUS;
|
||||
unlock=DrvLock(dv);
|
||||
cur_dir_cluster=Name2DirCluster(dv,cur_dir);
|
||||
cur_dir_clus=Name2DirClus(dv,cur_dir);
|
||||
buf2=MAlloc(BLK_SIZE);
|
||||
RBlks(dv,buf2,cur_dir_cluster,1);
|
||||
BlkRead(dv,buf2,cur_dir_clus,1);
|
||||
|
||||
ptr=buf2(U8 *)-offset(CDirEntry.start);
|
||||
buf=MAlloc(ptr->size);
|
||||
RBlks(dv,buf,cur_dir_cluster,ptr->size>>BLK_SIZE_BITS);
|
||||
BlkRead(dv,buf,cur_dir_clus,ptr->size>>BLK_SIZE_BITS);
|
||||
|
||||
dir_size=ptr->size;
|
||||
ptr=buf(U8 *)-offset(CDirEntry.start)+CDIR_SIZE;
|
||||
@@ -376,26 +376,26 @@ Bool RedSeaDirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
if (!written)
|
||||
MemCpy(&ptr->start,&tmpde->start,CDIR_SIZE);
|
||||
if ((i+1)*CDIR_SIZE+j<<BLK_SIZE_BITS<dir_size)
|
||||
WBlks(dv,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_cluster+j,1);
|
||||
BlkWrite(dv,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_clus+j,1);
|
||||
else {
|
||||
buf2=CAlloc(dir_size+BLK_SIZE);
|
||||
MemCpy(buf2,buf,dir_size);
|
||||
RedSeaFreeClusters(dv,cur_dir_cluster,dir_size>>BLK_SIZE_BITS);
|
||||
RedSeaFreeClus(dv,cur_dir_clus,dir_size>>BLK_SIZE_BITS);
|
||||
dir_size+=BLK_SIZE;
|
||||
c=ClustersAlloc(dv,0,dir_size>>BLK_SIZE_BITS,TRUE);
|
||||
c=ClusAlloc(dv,0,dir_size>>BLK_SIZE_BITS,TRUE);
|
||||
Free(buf);
|
||||
buf=buf2;
|
||||
ptr=buf(U8 *)-offset(CDirEntry.start);
|
||||
ptr->size=dir_size;
|
||||
ptr->cluster=c;
|
||||
WBlks(dv,buf,c,dir_size>>BLK_SIZE_BITS);
|
||||
if (cur_dir_cluster==dv->root_cluster) {
|
||||
ptr->clus=c;
|
||||
BlkWrite(dv,buf,c,dir_size>>BLK_SIZE_BITS);
|
||||
if (cur_dir_clus==dv->root_clus) {
|
||||
br=CAlloc(BLK_SIZE);
|
||||
RBlks(dv,br,dv->drv_offset,1);
|
||||
br->root_cluster=c;
|
||||
WBlks(dv,br,dv->drv_offset,1);
|
||||
BlkRead(dv,br,dv->drv_offset,1);
|
||||
br->root_clus=c;
|
||||
BlkWrite(dv,br,dv->drv_offset,1);
|
||||
Free(br);
|
||||
dv->root_cluster=c;
|
||||
dv->root_clus=c;
|
||||
} else {
|
||||
tmp=StrNew(cur_dir);
|
||||
parent_dir=StrNew(cur_dir);
|
||||
@@ -404,9 +404,9 @@ Bool RedSeaDirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
Free(parent_dir);
|
||||
parent_dir=StrNew("/");
|
||||
}
|
||||
if (RedSeaFileFind(dv,Name2DirCluster(dv,parent_dir),
|
||||
if (RedSeaFileFind(dv,Name2DirClus(dv,parent_dir),
|
||||
tmp,&de2,FUF_JUST_DIRS)) {
|
||||
de2.cluster=c;
|
||||
de2.clus=c;
|
||||
de2.size=dir_size;
|
||||
RedSeaDirNew(dv,parent_dir,&de2,FALSE);
|
||||
} else
|
||||
@@ -419,19 +419,19 @@ Bool RedSeaDirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,Bool free_old_chain)
|
||||
} else if (ptr->attr & RS_ATTR_DELETED) {
|
||||
if (!written) {
|
||||
MemCpy(&ptr->start,&tmpde->start,CDIR_SIZE);
|
||||
WBlks(dv,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_cluster+j,1);
|
||||
BlkWrite(dv,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_clus+j,1);
|
||||
written=TRUE;
|
||||
}
|
||||
} else {
|
||||
if (!StrCmp(tmpde->name,ptr->name)) {
|
||||
if (free_old_chain)
|
||||
RedSeaFreeClusters(dv,ptr->cluster,
|
||||
RedSeaFreeClus(dv,ptr->clus,
|
||||
(ptr->size+BLK_SIZE-1)>>BLK_SIZE_BITS);
|
||||
if (!written)
|
||||
MemCpy(&ptr->start,&tmpde->start,CDIR_SIZE);
|
||||
else
|
||||
ptr->attr|=RS_ATTR_DELETED;
|
||||
WBlks(dv,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_cluster+j,1);
|
||||
BlkWrite(dv,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_clus+j,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -459,18 +459,18 @@ I64 RedSeaFilesDel(CDrv *dv,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
|
||||
Bool del_dir,Bool print_msg)
|
||||
{
|
||||
CDirEntry *buf,*buf2,*ptr;
|
||||
I64 i=0,res=0,ch,j=0,n=BLK_SIZE/CDIR_SIZE,cur_dir_cluster;
|
||||
I64 i=0,res=0,ch,j=0,n=BLK_SIZE/CDIR_SIZE,cur_dir_clus;
|
||||
Bool unlock_break;
|
||||
try {
|
||||
unlock_break=BreakLock;
|
||||
DrvLock(dv);
|
||||
cur_dir_cluster=Name2DirCluster(dv,cur_dir);
|
||||
cur_dir_clus=Name2DirClus(dv,cur_dir);
|
||||
buf2=MAlloc(BLK_SIZE);
|
||||
RBlks(dv,buf2,cur_dir_cluster,1);
|
||||
BlkRead(dv,buf2,cur_dir_clus,1);
|
||||
|
||||
ptr=buf2(U8 *)-offset(CDirEntry.start);
|
||||
buf=MAlloc(ptr->size);
|
||||
RBlks(dv,buf,cur_dir_cluster,ptr->size>>BLK_SIZE_BITS);
|
||||
BlkRead(dv,buf,cur_dir_clus,ptr->size>>BLK_SIZE_BITS);
|
||||
Free(buf2);
|
||||
|
||||
ptr=buf(U8 *)-offset(CDirEntry.start);
|
||||
@@ -486,8 +486,8 @@ I64 RedSeaFilesDel(CDrv *dv,U8 *cur_dir,U8 *files_find_mask,I64 fuf_flags,
|
||||
if (print_msg)
|
||||
"Del %s\n",ptr->name;
|
||||
ptr->attr|=RS_ATTR_DELETED;
|
||||
WBlks(dv,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_cluster+j,1);
|
||||
RedSeaFreeClusters(dv,ptr->cluster,
|
||||
BlkWrite(dv,buf(U8 *)+j<<BLK_SIZE_BITS,cur_dir_clus+j,1);
|
||||
RedSeaFreeClus(dv,ptr->clus,
|
||||
(ptr->size+BLK_SIZE-1)>>BLK_SIZE_BITS);
|
||||
}
|
||||
ptr(U8 *)+=CDIR_SIZE;
|
||||
@@ -523,14 +523,14 @@ I64 RedSeaFileWrite(CDrv *dv,U8 *cur_dir,U8 *name,U8 *buf,I64 size,
|
||||
RedSeaFilesDel(dv,cur_dir,de.name,0,FALSE,FALSE);
|
||||
de.size=size;
|
||||
if (blk_cnt=(size+BLK_SIZE-1)>>BLK_SIZE_BITS)
|
||||
c=ClustersAlloc(dv,0,blk_cnt,TRUE); //Always contiguous
|
||||
c=ClusAlloc(dv,0,blk_cnt,TRUE); //Always contiguous
|
||||
else
|
||||
c=INVALID_CLUSTER;
|
||||
de.cluster=c;
|
||||
c=INVALID_CLUS;
|
||||
de.clus=c;
|
||||
de.attr=attr|RS_ATTR_CONTIGUOUS;
|
||||
de.datetime=cdt;
|
||||
if (blk_cnt)
|
||||
WBlks(dv,buf,c,blk_cnt);
|
||||
BlkWrite(dv,buf,c,blk_cnt);
|
||||
RedSeaDirNew(dv,cur_dir,&de,TRUE);
|
||||
}
|
||||
return c;
|
||||
@@ -541,25 +541,25 @@ CDirEntry *RedSeaFilesFind(U8 *files_find_mask,I64 fuf_flags,
|
||||
{
|
||||
CDrv *dv=Fs->cur_dv;
|
||||
CDirEntry *buf,*buf2,*ptr,*res=NULL,*tmpde;
|
||||
I64 ch,cur_dir_cluster;
|
||||
I64 ch,cur_dir_clus;
|
||||
if (fuf_flags&~FUG_FILES_FIND)
|
||||
throw('FUF');
|
||||
try {
|
||||
DrvLock(dv);
|
||||
cur_dir_cluster=Name2DirCluster(dv,Fs->cur_dir);
|
||||
cur_dir_clus=Name2DirClus(dv,Fs->cur_dir);
|
||||
buf2=MAlloc(BLK_SIZE);
|
||||
RBlks(dv,buf2,cur_dir_cluster,1);
|
||||
BlkRead(dv,buf2,cur_dir_clus,1);
|
||||
|
||||
ptr=buf2(U8 *)-offset(CDirEntry.start);
|
||||
buf=MAlloc(ptr->size);
|
||||
RBlks(dv,buf,cur_dir_cluster,ptr->size>>BLK_SIZE_BITS);
|
||||
BlkRead(dv,buf,cur_dir_clus,ptr->size>>BLK_SIZE_BITS);
|
||||
Free(buf2);
|
||||
|
||||
ptr=buf(U8 *)-offset(CDirEntry.start);
|
||||
*ptr->name='.';
|
||||
ptr->name[1]=0;
|
||||
ptr(U8 *)+=CDIR_SIZE;
|
||||
ptr->cluster=Name2ParentDirCluster(dv,Fs->cur_dir);
|
||||
ptr->clus=Name2ParentDirClus(dv,Fs->cur_dir);
|
||||
ptr(U8 *)-=CDIR_SIZE;
|
||||
while (TRUE) {
|
||||
if (!(ch=*ptr->name))
|
||||
@@ -603,7 +603,7 @@ CDirEntry *RedSeaFilesFind(U8 *files_find_mask,I64 fuf_flags,
|
||||
|
||||
Bool RedSeaMkDir(CDrv *dv,U8 *cur_dir,U8 *name,I64 entry_cnt)
|
||||
{//entry_cnt is for preallocating dir blks.
|
||||
I64 c,cur_dir_cluster=Name2DirCluster(dv,cur_dir),
|
||||
I64 c,cur_dir_clus=Name2DirClus(dv,cur_dir),
|
||||
size=CeilU64((entry_cnt+3)<<6,BLK_SIZE);
|
||||
#assert CDIR_SIZE==64
|
||||
U8 *buf=CAlloc(size);
|
||||
@@ -614,7 +614,7 @@ Bool RedSeaMkDir(CDrv *dv,U8 *cur_dir,U8 *name,I64 entry_cnt)
|
||||
c=FileWrite(name,buf,size,0,RS_ATTR_DIR);
|
||||
d_native->attr=RS_ATTR_DIR|RS_ATTR_CONTIGUOUS;
|
||||
StrCpy(d_native->name,name);
|
||||
d_native->cluster=c;
|
||||
d_native->clus=c;
|
||||
d_native->size=size;
|
||||
d_native->datetime=Now;
|
||||
d_native(U8 *)+=CDIR_SIZE;
|
||||
@@ -623,10 +623,10 @@ Bool RedSeaMkDir(CDrv *dv,U8 *cur_dir,U8 *name,I64 entry_cnt)
|
||||
*d_native->name='.';
|
||||
d_native->name[1]='.';
|
||||
d_native->name[2]=0;
|
||||
d_native->cluster=cur_dir_cluster;
|
||||
d_native->clus=cur_dir_clus;
|
||||
d_native->size=0;
|
||||
d_native->datetime=Now;
|
||||
WBlks(dv,buf,c,1);
|
||||
BlkWrite(dv,buf,c,1);
|
||||
Free(buf);
|
||||
if (unlock_break)
|
||||
BreakUnlock;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "DskBlkDev"
|
||||
#include "DskDrv"
|
||||
#include "DskBlk"
|
||||
#include "DskCluster"
|
||||
#include "DskClus"
|
||||
#include "DskStrB"
|
||||
#include "DskAddDev"
|
||||
#include "DskDirA"
|
||||
|
||||
@@ -473,7 +473,7 @@ U0 InStr(U8 *fmt,...)
|
||||
|
||||
U0 InFile(U8 *filename)
|
||||
{//Send InFile code file to self.
|
||||
U8 *name=DftExt(filename,"IN.Z");
|
||||
U8 *name=ExtDft(filename,"IN.Z");
|
||||
InStr("Cd(\"%C:%s\");;#include \"%s\"",
|
||||
Drv2Let(Fs->cur_dv),Fs->cur_dir,name);
|
||||
Free(name);
|
||||
|
||||
+17
-17
@@ -1,7 +1,7 @@
|
||||
//This is run in a $LK,"#exe",A="FF:::/Kernel/Kernel.PRJ,KCfg"${}.
|
||||
|
||||
U8 *kernel_cfg_options="MemInit\0HeapInit\0VarInit\0StaffMode\0"
|
||||
"HomeDir\0NoMP\0TextMode\0DontProbe\0AutoMountIDE\0DbgDistro\0Help\0";
|
||||
"HomeDir\0NoMP\0TextMode\0DontProbe\0MountIDEAuto\0DbgDistro\0Help\0";
|
||||
|
||||
#define CFG_MEM_INIT 0
|
||||
#define CFG_HEAP_INIT 1
|
||||
@@ -11,7 +11,7 @@ U8 *kernel_cfg_options="MemInit\0HeapInit\0VarInit\0StaffMode\0"
|
||||
#define CFG_NO_MP 5
|
||||
#define CFG_TEXT_MODE 6
|
||||
#define CFG_DONT_PROBE 7
|
||||
#define CFG_AUTO_MOUNT_IDE 8
|
||||
#define CFG_MOUNT_IDE_AUTO 8
|
||||
#define CFG_DBG_DISTRO 9
|
||||
#define CFG_OPTIONS_NUM 10
|
||||
|
||||
@@ -25,7 +25,7 @@ class CKCfg
|
||||
U8 *home_dir;
|
||||
Bool opts[CFG_OPTIONS_NUM];
|
||||
U8 mem_init_val,heap_init_val,var_init_val,
|
||||
boot_drv_let,auto_mount_ide_hd_let,auto_mount_ide_cd_let;
|
||||
boot_drv_let,mount_ide_auto_hd_let,mount_ide_auto_cd_let;
|
||||
};
|
||||
|
||||
CDoc *KCfgAddDev(CKCfg *c)
|
||||
@@ -72,7 +72,7 @@ U0 KCfgOptions(CKCfg *c)
|
||||
"$$PURPLE$$NoMP$$FG$$ No multicore.\n"
|
||||
"$$PURPLE$$TextMode$$FG$$ Text Mode (requires hard reboot).\n"
|
||||
"$$PURPLE$$DontProbe$$FG$$ Just prompt CD/DVD ports, don't probe.\n"
|
||||
"$$PURPLE$$AutoMountIDE$$FG$$ AutoMount IDE drives to 'C' and 'T'.\n"
|
||||
"$$PURPLE$$MountIDEAuto$$FG$$ Auto Mount IDE drives to 'C' and 'T'.\n"
|
||||
"$$PURPLE$$DbgDistro$$FG$$ Include RAM Drv in Kernel.BIN.\n"
|
||||
"\n";
|
||||
else
|
||||
@@ -107,30 +107,30 @@ U0 KCfgOptions(CKCfg *c)
|
||||
else
|
||||
c->opts[i]=FALSE;
|
||||
break;
|
||||
case CFG_AUTO_MOUNT_IDE:
|
||||
case CFG_MOUNT_IDE_AUTO:
|
||||
if (state) {
|
||||
"First HD Drive Let:";
|
||||
c->auto_mount_ide_hd_let=Let2Let(GetChar);
|
||||
if (!('A'<=c->auto_mount_ide_hd_let<='Z'))
|
||||
c->auto_mount_ide_hd_let=0;
|
||||
c->mount_ide_auto_hd_let=Let2Let(GetChar);
|
||||
if (!('A'<=c->mount_ide_auto_hd_let<='Z'))
|
||||
c->mount_ide_auto_hd_let=0;
|
||||
'\n';
|
||||
if (c->auto_mount_ide_hd_let)
|
||||
"First HD Drive:%C\n",c->auto_mount_ide_hd_let;
|
||||
if (c->mount_ide_auto_hd_let)
|
||||
"First HD Drive:%C\n",c->mount_ide_auto_hd_let;
|
||||
else
|
||||
"First HD Drive:%C\n",'C';
|
||||
|
||||
"First CD Drive Let:";
|
||||
c->auto_mount_ide_cd_let=Let2Let(GetChar);
|
||||
if (!('A'<=c->auto_mount_ide_cd_let<='Z'))
|
||||
c->auto_mount_ide_cd_let=0;
|
||||
c->mount_ide_auto_cd_let=Let2Let(GetChar);
|
||||
if (!('A'<=c->mount_ide_auto_cd_let<='Z'))
|
||||
c->mount_ide_auto_cd_let=0;
|
||||
'\n';
|
||||
if (c->auto_mount_ide_cd_let)
|
||||
"First CD Drive:%C\n",c->auto_mount_ide_cd_let;
|
||||
if (c->mount_ide_auto_cd_let)
|
||||
"First CD Drive:%C\n",c->mount_ide_auto_cd_let;
|
||||
else
|
||||
"First CD Drive:%C\n",'T';
|
||||
} else {
|
||||
c->auto_mount_ide_hd_let=0;
|
||||
c->auto_mount_ide_cd_let=0;
|
||||
c->mount_ide_auto_hd_let=0;
|
||||
c->mount_ide_auto_cd_let=0;
|
||||
}
|
||||
break;
|
||||
case CFG_DBG_DISTRO:
|
||||
|
||||
@@ -14,14 +14,14 @@ U0 SysGlblsInit()
|
||||
blkdev.tmp_filename =AStrNew("~/Tmp.DD.Z");
|
||||
blkdev.dvd_boot_is_good=TRUE;
|
||||
#exe {
|
||||
if (!kernel_cfg->auto_mount_ide_hd_let)
|
||||
kernel_cfg->auto_mount_ide_hd_let='C';
|
||||
if (!kernel_cfg->auto_mount_ide_cd_let)
|
||||
kernel_cfg->auto_mount_ide_cd_let='T';
|
||||
if (!kernel_cfg->mount_ide_auto_hd_let)
|
||||
kernel_cfg->mount_ide_auto_hd_let='C';
|
||||
if (!kernel_cfg->mount_ide_auto_cd_let)
|
||||
kernel_cfg->mount_ide_auto_cd_let='T';
|
||||
StreamPrint("blkdev.first_hd_drv_let=%d;",
|
||||
kernel_cfg->auto_mount_ide_hd_let);
|
||||
kernel_cfg->mount_ide_auto_hd_let);
|
||||
StreamPrint("blkdev.first_dvd_drv_let=%d;",
|
||||
kernel_cfg->auto_mount_ide_cd_let);
|
||||
kernel_cfg->mount_ide_auto_cd_let);
|
||||
}
|
||||
|
||||
DbgMode(ON);
|
||||
@@ -172,8 +172,8 @@ U0 KMain()
|
||||
|
||||
TimeStampFreqCal;
|
||||
BlkDevsInitAll;
|
||||
"ChgDsk(':');\n";
|
||||
ChgDsk(':');
|
||||
"DskChg(':');\n";
|
||||
DskChg(':');
|
||||
#exe {
|
||||
StreamPrint("HomeSet(\"%s\");\n"
|
||||
"blkdev.ins_base0=%d;blkdev.ins_base1=%d;blkdev.ins_unit =%d;\n",
|
||||
|
||||
+12
-12
@@ -17,6 +17,8 @@ extern Bool BlkDevLock(CBlkDev *bd);
|
||||
extern CBlkDev *BlkDevNextFreeSlot(U8 first_drv_let,I64 type);
|
||||
extern Bool BlkDevUnlock(CBlkDev *bd,Bool rst=FALSE);
|
||||
extern U0 BlkDevsRelease();
|
||||
extern Bool BlkRead(CDrv *dv,U8 *buf, I64 blk, I64 cnt);
|
||||
extern Bool BlkWrite(CDrv *dv,U8 *buf, I64 blk, I64 cnt);
|
||||
extern U8 *Caller(I64 num=1);
|
||||
extern U8 *CatPrint(U8 *_dst,U8 *fmt,...);
|
||||
extern Bool Cd(U8 *dirname=NULL,Bool make_dirs=FALSE);
|
||||
@@ -26,7 +28,7 @@ extern I64 DefineMatch(U8 *needle,U8 *haystack_lst_dname,I64 flags=0);
|
||||
extern U8 *DefineSub(I64 sub,U8 *dname);
|
||||
extern I64 Del(U8 *files_find_mask,Bool make_mask=FALSE,
|
||||
Bool del_dir=FALSE,Bool print_msg=TRUE);
|
||||
extern U8 *DftExt(U8 *filename,U8 *extension);
|
||||
extern Bool DirMk(U8 *filename,I64 entry_cnt=0);
|
||||
extern Bool Drv(U8 drv_let);
|
||||
extern U8 Drv2Let(CDrv *dv=NULL);
|
||||
extern U0 DrvBlkDevDel(CBlkDev *bd);
|
||||
@@ -36,17 +38,18 @@ extern Bool DrvTypeSet(U8 drv_let,I64 type=FSt_REDSEA);
|
||||
extern U0 DrvsRelease();
|
||||
extern U0 DskCacheInvalidate(CDrv *dv);
|
||||
extern U0 Exit();
|
||||
extern I64 FAT32AllocClusters(CDrv *dv,I64 c,I64 cnt);
|
||||
extern I64 FAT32AllocContiguousClusters(CDrv *dv,I64 cnt);
|
||||
extern U8 *ExtDft(U8 *filename,U8 *extension);
|
||||
extern I64 FAT32AllocClus(CDrv *dv,I64 c,I64 cnt);
|
||||
extern I64 FAT32AllocContiguousClus(CDrv *dv,I64 cnt);
|
||||
extern Bool FAT32DirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,
|
||||
Bool free_old_chain);
|
||||
extern Bool FAT32FileFind(CDrv *dv,I64 cur_dir_cluster,U8 *name,
|
||||
extern Bool FAT32FileFind(CDrv *dv,I64 cur_dir_clus,U8 *name,
|
||||
CDirEntry *_res,I64 fuf_flags=0);
|
||||
extern U0 FAT32Init(CDrv *dv);
|
||||
extern Bool FBlkRead(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1);
|
||||
extern Bool FBlkWrite(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1);
|
||||
extern U0 FClose(CFile *f);
|
||||
extern CFile *FOpen(U8 *filename,U8 *flags,I64 cnt=0);
|
||||
extern Bool FRBlks(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1);
|
||||
extern Bool FWBlks(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1);
|
||||
extern U8 *FileExtRem(U8 *src,U8 *dst=NULL);
|
||||
extern Bool FileFind(U8 *filename,CDirEntry *_de=NULL,I64 fuf_flags=0);
|
||||
extern U8 *FileNameAbs(U8 *_filename,I64 fuf_flags=0);
|
||||
@@ -57,7 +60,7 @@ extern I64 GetChar(I64 *_scan_code=NULL,Bool echo=TRUE,Bool raw_cursor=FALSE);
|
||||
extern I64 GetS(U8 *buf,I64 size,Bool allow_ext=TRUE);
|
||||
extern CHeapCtrl *HeapCtrlInit(CHeapCtrl *hc=NULL,
|
||||
CTask *task=NULL,CBlkPool *bp);
|
||||
extern Bool ISO1FileFind(CDrv *dv,I64 cur_dir_cluster,U8 *name,
|
||||
extern Bool ISO1FileFind(CDrv *dv,I64 cur_dir_clus,U8 *name,
|
||||
CDirEntry *_res,I64 fuf_flags=0);
|
||||
extern Bool ISOInit(CDrv *dv,I64 blk);
|
||||
extern Bool IsDbgMode();
|
||||
@@ -73,7 +76,6 @@ extern CDrv *Let2Drv(U8 drv_let=0,Bool except=TRUE);
|
||||
extern U8 Let2Let(U8 drv_let=0);
|
||||
extern U0 MPInt(U8 num,I64 cpu_num=1);
|
||||
extern U8 *MStrPrint(U8 *fmt,...);
|
||||
extern Bool MkDir(U8 *filename,I64 entry_cnt=0);
|
||||
extern U0 MsHardSet(I64 x,I64 y,I64 z,I64 l,I64 r);
|
||||
extern U0 Msg(I64 msg_code,I64 arg1,I64 arg2,I64 flags=0);
|
||||
extern U0 Panic(U8 *msg=NULL,I64 msg_num=0,Bool panic=TRUE);
|
||||
@@ -81,11 +83,10 @@ extern I64 PopUp(U8 *buf,CTask *parent=NULL,CTask **_pu_task=NULL);
|
||||
extern U0 Print(U8 *fmt,...);
|
||||
extern U0 PutChars(U64 ch);
|
||||
extern U0 PutS(U8 *st); //Use $LK,"Print",A="MN:Print"$()
|
||||
extern Bool RBlks(CDrv *dv,U8 *buf, I64 blk, I64 cnt);
|
||||
extern I64 RedSeaAllocClusters(CDrv *dv,I64 cnt);
|
||||
extern I64 RedSeaAllocClus(CDrv *dv,I64 cnt);
|
||||
extern Bool RedSeaDirNew(CDrv *dv,U8 *cur_dir,CDirEntry *tmpde,
|
||||
Bool free_old_chain);
|
||||
extern Bool RedSeaFileFind(CDrv *dv,I64 cur_dir_cluster,U8 *name,
|
||||
extern Bool RedSeaFileFind(CDrv *dv,I64 cur_dir_clus,U8 *name,
|
||||
CDirEntry *_res,I64 fuf_flags=0);
|
||||
extern U0 RedSeaFmt(U8 drv_let,Bool quick=TRUE);
|
||||
extern U0 RedSeaFreeFreeLst(CDrv *dv);
|
||||
@@ -104,6 +105,5 @@ extern Bool TaskValidate(CTask *task);
|
||||
extern U0 TaskWait(CTask *task=NULL,Bool cmd_line_pmt=FALSE);
|
||||
extern CTask *User(U8 *fmt=NULL,...);
|
||||
extern U0 UserTaskCont();
|
||||
extern Bool WBlks(CDrv *dv,U8 *buf, I64 blk, I64 cnt);
|
||||
extern U0 XTalk(CTask *task,U8 *fmt,...);
|
||||
extern U0 throw(I64 ch=0,Bool no_log=FALSE);
|
||||
@@ -185,7 +185,7 @@ CBinFile *Load(U8 *filename,I64 ld_flags=0,CBinFile *bfh_addr=INVALID_PTR)
|
||||
I64 size,module_align,misalignment;
|
||||
CBinFile *bfh;
|
||||
|
||||
fbuf=DftExt(filename,"BIN.Z");
|
||||
fbuf=ExtDft(filename,"BIN.Z");
|
||||
if (!(bfh=FileRead(fbuf,&size))) {
|
||||
Free(fbuf);
|
||||
return NULL;
|
||||
|
||||
@@ -228,7 +228,7 @@ I64 TaskInit(CTask *task,I64 stk_size)
|
||||
task->win_top =13;
|
||||
task->win_bottom =text.rows-2;
|
||||
|
||||
if (blkdev.home_dir) {//Beware Adam $LK,"TaskInit",A="FF:::/Kernel/KStart64.HC,TaskInit"$. I guess ok until $LK,"ChgDsk",A="FF:::/Kernel/KEnd.HC,ChgDsk"$().
|
||||
if (blkdev.home_dir) {//Beware Adam $LK,"TaskInit",A="FF:::/Kernel/KStart64.HC,TaskInit"$. I guess ok until $LK,"DskChg",A="FF:::/Kernel/KEnd.HC,DskChg"$().
|
||||
task->cur_dv=blkdev.let_to_drv[*blkdev.home_dir-'A'];
|
||||
task->cur_dir=StrNew(blkdev.home_dir+2,task);
|
||||
} else
|
||||
|
||||
+584
-589
File diff suppressed because it is too large.
Load diff
@@ -2295,7 +2295,7 @@ public class CATARep
|
||||
#define BLK_SIZE (1<<BLK_SIZE_BITS)
|
||||
#define DVD_BLK_SIZE (4*BLK_SIZE)
|
||||
#define DVD_BOOT_LOADER_SIZE DVD_BLK_SIZE*1
|
||||
#define INVALID_CLUSTER (-1)
|
||||
#define INVALID_CLUS (-1)
|
||||
|
||||
class CMBRPrt
|
||||
{
|
||||
@@ -2324,7 +2324,7 @@ class CRedSeaBoot
|
||||
signature,reserved[4]; //MBR_PT_REDSEA=0x88. Distinguish from real FAT32
|
||||
I64 drv_offset, //For CD/DVD image copy.
|
||||
sects,
|
||||
root_cluster,
|
||||
root_clus,
|
||||
bitmap_sects,
|
||||
unique_id;
|
||||
U8 code[462];
|
||||
@@ -2336,7 +2336,7 @@ class CFAT32Boot
|
||||
U8 jump_and_nop[3],
|
||||
oem_name[8];
|
||||
U16 bytes_per_sect;
|
||||
U8 sects_per_cluster;
|
||||
U8 sects_per_clus;
|
||||
U16 reserved_sects;
|
||||
U8 copies_of_fat;
|
||||
U16 max_root_dir_entries, //Not used
|
||||
@@ -2350,7 +2350,7 @@ class CFAT32Boot
|
||||
sects_per_fat;
|
||||
U16 flags,
|
||||
version;
|
||||
U32 root_cluster;
|
||||
U32 root_clus;
|
||||
U16 file_system_info_sect,
|
||||
backup_boot_sect;
|
||||
U8 reserved[12],
|
||||
@@ -2369,7 +2369,7 @@ class CFAT32FileInfoSect
|
||||
U32 signature1;
|
||||
U8 unknown[480];
|
||||
U32 signature2,
|
||||
free_clusters,
|
||||
free_clus,
|
||||
most_recently_alloced;
|
||||
U8 reserved[12];
|
||||
U32 signature3;
|
||||
@@ -2384,10 +2384,10 @@ class CFAT32DirEntry
|
||||
U16 CrtTime,
|
||||
CrtDate,
|
||||
LstAccDate,
|
||||
cluster_hi,
|
||||
clus_hi,
|
||||
WrtTime,
|
||||
WrtDate,
|
||||
cluster_lo;
|
||||
clus_lo;
|
||||
U32 size;
|
||||
};
|
||||
|
||||
@@ -2556,7 +2556,7 @@ public class CDirEntry
|
||||
U0 start;
|
||||
U16 attr;
|
||||
U8 name[CDIR_FILENAME_LEN];
|
||||
I64 cluster,size;
|
||||
I64 clus,size;
|
||||
CDate datetime;
|
||||
};
|
||||
#define CDIR_SIZE (sizeof(CDirEntry)-offset(CDirEntry.start))
|
||||
@@ -2584,7 +2584,7 @@ public class CDirEntry
|
||||
#define FUf_JUST_JIT 16
|
||||
#define FUf_JUST_GR 17
|
||||
#define FUf_Z_OR_NOT_Z 18
|
||||
#define FUf_CLUSTER_ORDER 19
|
||||
#define FUf_CLUS_ORDER 19
|
||||
#define FUf_SCAN_PARENTS 20
|
||||
#define FUf_FLATTEN_TREE 21
|
||||
#define FUf_WHOLE_LABELS 22
|
||||
@@ -2611,14 +2611,14 @@ public class CDirEntry
|
||||
#define FUF_JUST_JIT 0x0010000 //J
|
||||
#define FUF_JUST_GR 0x0020000 //G
|
||||
#define FUF_Z_OR_NOT_Z 0x0040000 //Z
|
||||
#define FUF_CLUSTER_ORDER 0x0080000 //O Move disk head one direction
|
||||
#define FUF_CLUS_ORDER 0x0080000 //O Move disk head one direction
|
||||
#define FUF_SCAN_PARENTS 0x0100000 //P
|
||||
#define FUF_FLATTEN_TREE 0x0200000 //f
|
||||
#define FUF_WHOLE_LABELS 0x0400000 //l
|
||||
#define FUF_WHOLE_LABELS_BEFORE 0x0800000 //lb
|
||||
#define FUF_WHOLE_LABELS_AFTER 0x1000000 //la
|
||||
|
||||
#define FUG_FILES_FIND (FUF_RECURSE|FUF_SINGLE|FUF_CLUSTER_ORDER|\
|
||||
#define FUG_FILES_FIND (FUF_RECURSE|FUF_SINGLE|FUF_CLUS_ORDER|\
|
||||
FUF_JUST_DIRS|FUF_JUST_FILES|FUF_JUST_TXT|FUF_JUST_DD|\
|
||||
FUF_JUST_SRC|FUF_JUST_AOT|FUF_JUST_JIT|FUF_JUST_GR|FUF_FLATTEN_TREE)
|
||||
#define FUG_FILE_FIND (FUF_JUST_DIRS|FUF_JUST_FILES|FUF_Z_OR_NOT_Z|\
|
||||
@@ -2728,9 +2728,9 @@ public class CDrv
|
||||
prt_num,
|
||||
file_system_info_sect,
|
||||
fat1,fat2,
|
||||
root_cluster,
|
||||
root_clus,
|
||||
data_area,
|
||||
spc; //sectors per cluster
|
||||
spc; //sectors per clus
|
||||
CDate fat32_local_time_offset;
|
||||
CTask *owning_task;
|
||||
CBlkDev *bd;
|
||||
@@ -2767,7 +2767,7 @@ public class CBlkDevGlbls
|
||||
CCacheBlk *cache_base,*cache_ctrl,**cache_hash_table;
|
||||
I64 cache_size,read_cnt,write_cnt;
|
||||
CDrv *drvs,*let_to_drv[32];
|
||||
I64 auto_mount_ide_cnt,
|
||||
I64 mount_ide_auto_cnt,
|
||||
ins_base0,ins_base1; //Install cd/dvd controller.
|
||||
U8 boot_drv_let,first_hd_drv_let,first_dvd_drv_let;
|
||||
Bool dvd_boot_is_good,ins_unit,pad[3];
|
||||
@@ -2795,8 +2795,8 @@ public class CFile //See $LK,"::/Demo/Dsk/DataBase.HC"$.
|
||||
I64 flags;
|
||||
CDirEntry de;
|
||||
CDrv *dv;
|
||||
I64 fblk_num,cluster,file_cluster_num,max_blk;
|
||||
U8 *cluster_buf;
|
||||
I64 fblk_num,clus,file_clus_num,max_blk;
|
||||
U8 *clus_buf;
|
||||
};
|
||||
|
||||
#help_index "Memory/Heap"
|
||||
|
||||
@@ -270,33 +270,33 @@ public extern U0 DVDImageWrite(U8 dvd_drv_let,
|
||||
U8 *in_name=NULL,I64 media_type=MT_DVD);
|
||||
|
||||
#help_index "File/CFile"
|
||||
public extern Bool FBlkRead(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1);
|
||||
public extern Bool FBlkWrite(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1);
|
||||
public extern U0 FClose(CFile *f);
|
||||
public extern CFile *FOpen(U8 *filename,U8 *flags,I64 cnt=0);
|
||||
public extern Bool FRBlks(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1);
|
||||
public extern I64 FSize(CFile *f);
|
||||
public extern Bool FWBlks(CFile *f,U8 *buf,I64 blk=FFB_NEXT_BLK,I64 cnt=1);
|
||||
|
||||
#help_index "File/Cmd Line (Typically);Cmd Line (Typically)"
|
||||
public extern Bool Cd(U8 *dirname=NULL,Bool make_dirs=FALSE);
|
||||
public extern U0 ChgDsk(U8 drv_let=0);
|
||||
public extern I64 Del(U8 *files_find_mask,Bool make_mask=FALSE,
|
||||
Bool del_dir=FALSE,Bool print_msg=TRUE);
|
||||
public extern I64 Dir(U8 *files_find_mask="*",Bool full=FALSE);
|
||||
public extern Bool DirMk(U8 *filename,I64 entry_cnt=0);
|
||||
public extern Bool Drv(U8 drv_let);
|
||||
public extern U0 DskChg(U8 drv_let=0);
|
||||
public extern U0 HomeSet(U8 *dirname);
|
||||
public extern Bool MkDir(U8 *filename,I64 entry_cnt=0);
|
||||
|
||||
#help_index "File/Cmd Line (Typically);Cmd Line (Typically);Install"
|
||||
public extern Bool DrvMap(U8 drv_let,CDrv *dv);
|
||||
|
||||
#help_index "File/FileNames"
|
||||
extern CDirEntry *Cd2DirEntry(CDirEntry *tmpde,U8 *abs_name);
|
||||
public extern U8 *ChgExt(U8 *filename,U8 *extension);
|
||||
public extern U8 *CurDir(CTask *task=NULL,CTask *mem_task=NULL);
|
||||
public extern U8 *DftExt(U8 *filename,U8 *extension);
|
||||
public extern U8 *DirCur(CTask *task=NULL,CTask *mem_task=NULL);
|
||||
public extern U8 *DirFile(U8 *dirname,U8 *name=NULL,U8 *_extension=NULL);
|
||||
public extern U8 *DirNameAbs(U8 *dirname);
|
||||
public extern CBlkDev *DrvIsWritable(U8 drv_let=0,Bool except=FALSE);
|
||||
public extern U8 *ExtChg(U8 *filename,U8 *extension);
|
||||
public extern U8 *ExtDft(U8 *filename,U8 *extension);
|
||||
public extern U8 *FileExtDot(U8 *src);
|
||||
public extern U8 *FileExtRem(U8 *src,U8 *dst=NULL);
|
||||
public extern U8 *FileNameAbs(U8 *filename,I64 fuf_flags=0);
|
||||
@@ -331,10 +331,17 @@ public extern Bool BlkDevLock(CBlkDev *bd);
|
||||
public extern CBlkDev *BlkDevNextFreeSlot(U8 first_drv_let,I64 type);
|
||||
public extern Bool BlkDevUnlock(CBlkDev *bd,Bool rst=FALSE);
|
||||
public extern U0 BlkDevsRelease();
|
||||
public extern I64 Cluster2Blk(CDrv *dv,I64 c);
|
||||
public extern I64 ClusterNumNext(CDrv *dv,I64 c,I64 cnt=1);
|
||||
public extern I64 ClustersAlloc(CDrv *dv,I64 c=0,
|
||||
public extern Bool BlkRead(CDrv *dv,U8 *buf, I64 blk, I64 cnt);
|
||||
public extern Bool BlkWrite(CDrv *dv,U8 *buf, I64 blk, I64 cnt);
|
||||
public extern U0 BlkWriteZero(CDrv *dv,I64 blk,I64 cnt);
|
||||
public extern I64 Clus2Blk(CDrv *dv,I64 c);
|
||||
public extern I64 ClusAlloc(CDrv *dv,I64 c=0,
|
||||
I64 cnt=1,Bool contiguous=FALSE);
|
||||
public extern I64 ClusBlkRead(CDrv *dv,U8 *buf,I64 c,I64 blks);
|
||||
public extern I64 ClusBlkWrite(CDrv *dv,U8 *buf,I64 c,I64 blks);
|
||||
public extern I64 ClusNumNext(CDrv *dv,I64 c,I64 cnt=1);
|
||||
public extern I64 ClusRead(CDrv *dv,U8 *buf,I64 c,I64 cnt);
|
||||
public extern I64 ClusWrite(CDrv *dv,U8 *buf,I64 c,I64 cnt);
|
||||
extern Bool CopySingle(U8 *f1,U8 *f2); //Just one file
|
||||
public extern U8 Drv2Let(CDrv *dv=NULL);
|
||||
public extern CDrv *DrvChk(CDrv *dv,Bool except=TRUE);
|
||||
@@ -347,21 +354,14 @@ public extern U8 *DrvSerialNum(U8 drv_let=0);
|
||||
public extern U8 DrvTextAttrGet(U8 drv_let=0);
|
||||
public extern Bool DrvUnlock(CDrv *dv,Bool rst=FALSE);
|
||||
public extern U0 DrvsRelease();
|
||||
extern U0 FAT32FreeClusters(CDrv *dv,I64 c);
|
||||
extern U0 FAT32FreeClus(CDrv *dv,I64 c);
|
||||
public extern CBlkDev *Let2BlkDev(U8 drv_let=0,Bool except=TRUE);
|
||||
public extern I64 Let2BlkDevType(U8 drv_let);
|
||||
public extern CDrv *Let2Drv(U8 drv_let=0,Bool except=TRUE);
|
||||
public extern U8 Let2Let(U8 drv_let=0);
|
||||
extern I64 Name2DirCluster(CDrv *dv,U8 *dirname);
|
||||
extern I64 Name2ParentDirCluster(CDrv *dv,U8 *dirname);
|
||||
public extern Bool RBlks(CDrv *dv,U8 *buf, I64 blk, I64 cnt);
|
||||
public extern I64 RClusters(CDrv *dv,U8 *buf,I64 c,I64 cnt);
|
||||
public extern I64 RClustersBlks(CDrv *dv,U8 *buf,I64 c,I64 blks);
|
||||
extern U0 RedSeaFreeClusters(CDrv *dv,I64 c,I64 cnt);
|
||||
public extern Bool WBlks(CDrv *dv,U8 *buf, I64 blk, I64 cnt);
|
||||
public extern I64 WClusters(CDrv *dv,U8 *buf,I64 c,I64 cnt);
|
||||
public extern I64 WClustersBlks(CDrv *dv,U8 *buf,I64 c,I64 blks);
|
||||
public extern U0 WZeroBlks(CDrv *dv,I64 blk,I64 cnt);
|
||||
extern I64 Name2DirClus(CDrv *dv,U8 *dirname);
|
||||
extern I64 Name2ParentDirClus(CDrv *dv,U8 *dirname);
|
||||
extern U0 RedSeaFreeClus(CDrv *dv,I64 c,I64 cnt);
|
||||
|
||||
#help_index "File/Program Routines"
|
||||
public extern U0 DirEntryDel(CDirEntry *tmpde);
|
||||
@@ -385,11 +385,11 @@ extern Bool ATAPIStartStop(CBlkDev *bd,F64 timeout,Bool start);
|
||||
extern I64 ATAProbe(I64 base0,I64 base1,I64 unit);
|
||||
extern U0 ATAReadBlks(CBlkDev *bd,U8 *buf, I64 blk, I64 cnt);
|
||||
extern U0 ATAWriteBlks(CBlkDev *bd,U8 *buf, I64 blk, I64 cnt);
|
||||
public extern I64 AutoMountIDE();
|
||||
extern I64 BlkDevAdd(CBlkDev *bd,I64 prt_num=I64_MIN,
|
||||
Bool whole_drv,Bool make_free);
|
||||
extern U0 DskCacheInit(I64 size_in_U8s);
|
||||
public extern U0 DskCacheInvalidate(CDrv *dv);
|
||||
public extern I64 MountIDEAuto();
|
||||
public extern CBlkDevGlbls blkdev;
|
||||
|
||||
#help_index "Graphics/Color"
|
||||
@@ -488,7 +488,6 @@ public extern U0 XTalk(CTask *task,U8 *fmt,...);
|
||||
public extern U0 XTalkStr(CTask *task,U8 *fmt,...);
|
||||
public extern U0 XTalkStrWait(CTask *task,U8 *fmt,...);
|
||||
public extern U0 XTalkWait(CTask *task,U8 *fmt,...);
|
||||
|
||||
#help_index "Job/Text & Msgs;Task/Job/Text & Msgs;Messages"
|
||||
public extern U0 Msg(I64 msg_code,I64 arg1,I64 arg2,I64 flags=0);
|
||||
public extern U0 PostMsg(CTask *task,
|
||||
|
||||
Reference in new issue
Block a user