summaryrefslogtreecommitdiff
path: root/sys/src/cmd/dossrv/dosfs.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2023-04-30 18:44:29 +0000
committercinap_lenrek <cinap_lenrek@felloff.net>2023-04-30 18:44:29 +0000
commitd24b5a7a0e45186f13d19ddefde62b0932726e42 (patch)
treea3cfeee8dd915bbd60e9f6be96c7318f81e1dfd1 /sys/src/cmd/dossrv/dosfs.c
parent101b3c2724779fcb0e503ae274abd7b751a3a48f (diff)
dossrv: Implement support for != 512 sector and track sizes
The iotrack buffer layer always assumed 512 byte sector size and 9 sectors per track. To support 4K sector size fats, make the iotrack code deal with it. Instead of the fixed size Track structure, we just allocate the pointers and buffers dynamically, and move the sector size and tack size in the Xfs structure. Tracks can still be reused between differnet file-systems after a purgetrack(). The initial fat header has to be read with devread() instead of getsect() to determine the sector/track size of the file-system.
Diffstat (limited to 'sys/src/cmd/dossrv/dosfs.c')
-rw-r--r--sys/src/cmd/dossrv/dosfs.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/sys/src/cmd/dossrv/dosfs.c b/sys/src/cmd/dossrv/dosfs.c
index 72c94768e..3acd0ea33 100644
--- a/sys/src/cmd/dossrv/dosfs.c
+++ b/sys/src/cmd/dossrv/dosfs.c
@@ -138,7 +138,7 @@ rwalk(void)
if(isroot(dp->addr))
f->qid.path = f->xf->rootqid.path;
else
- f->qid.path = QIDPATH(dp);
+ f->qid.path = QIDPATH(dp, f->xf);
}
}else{
fixname(req->wname[rep->nwqid]);
@@ -155,7 +155,7 @@ rwalk(void)
if(r < 0)
goto error;
memmove(f->ptr, dp, sizeof(Dosptr));
- f->qid.path = QIDPATH(dp);
+ f->qid.path = QIDPATH(dp, f->xf);
f->qid.type = QTFILE;
if(isroot(dp->addr))
f->qid.path = f->xf->rootqid.path;
@@ -457,7 +457,7 @@ badperm:
*/
f->ptr = ndp;
f->qid.type = QTFILE;
- f->qid.path = QIDPATH(ndp);
+ f->qid.path = QIDPATH(ndp, f->xf);
//ZZZ set type for excl, append?
if(req->perm & DMDIR){
@@ -567,7 +567,7 @@ doremove(Xfs *xf, Dosptr *dp)
}
if(prevdo < 0 && dp->prevaddr != -1){
p = getsect(xf, dp->prevaddr);
- for(prevdo = ((Dosbpb*)xf->ptr)->sectsize-DOSDIRSIZE; prevdo >= 0; prevdo -= DOSDIRSIZE){
+ for(prevdo = xf->sectsize-DOSDIRSIZE; prevdo >= 0; prevdo -= DOSDIRSIZE){
if(p->iobuf[prevdo+11] != 0xf)
break;
p->iobuf[prevdo] = DOSEMPTY;
@@ -636,17 +636,17 @@ out:
static int
dostat(Xfile *f, Dir *d)
{
- Dosptr *dp;
+ Xfs *xf = f->xf;
+ Dosptr *dp = f->ptr;
Iosect *p;
char *name, namebuf[DOSNAMELEN];
int islong, sum, prevdo;
- dp = f->ptr;
if(isroot(dp->addr)){
memset(d, 0, sizeof(Dir));
d->name = "/";
d->qid.type = QTDIR;
- d->qid.path = f->xf->rootqid.path;
+ d->qid.path = xf->rootqid.path;
d->mode = DMDIR|0777;
d->uid = "bill";
d->muid = "bill";
@@ -664,17 +664,17 @@ dostat(Xfile *f, Dir *d)
name = getnamesect(namebuf, name, &dp->p->iobuf[prevdo], &islong, &sum, -1);
}
if(prevdo < 0 && dp->prevaddr != -1){
- p = getsect(f->xf, dp->prevaddr);
+ p = getsect(xf, dp->prevaddr);
if(p == nil)
return -1;
- for(prevdo = ((Dosbpb*)f->xf->ptr)->sectsize-DOSDIRSIZE; prevdo >= 0; prevdo -= DOSDIRSIZE){
+ for(prevdo = xf->sectsize-DOSDIRSIZE; prevdo >= 0; prevdo -= DOSDIRSIZE){
if(p->iobuf[prevdo+11] != 0xf)
break;
name = getnamesect(namebuf, name, &p->iobuf[prevdo], &islong, &sum, -1);
}
putsect(p);
}
- getdir(f->xf, d, dp->d, dp->addr, dp->offset);
+ getdir(xf, d, dp->d, dp->addr, dp->offset);
if(islong && sum == -1 && nameok(namebuf))
strcpy(d->name, namebuf);
}
@@ -894,7 +894,7 @@ rwstat(void)
/*
* relocate up other fids to the same file, if it moved
*/
- f->qid.path = QIDPATH(dp);
+ f->qid.path = QIDPATH(dp, pf.xf);
if(oaddr != dp->addr || ooffset != dp->offset)
dosptrreloc(f, dp, oaddr, ooffset);