dossrv: cleanup
This commit is contained in:
parent
1e0b65c8bf
commit
ec1c1b9b52
2 changed files with 11 additions and 11 deletions
|
@ -144,7 +144,8 @@ dosfs(Xfs *xf)
|
||||||
bp->fatinfo = fisec;
|
bp->fatinfo = fisec;
|
||||||
bp->freeptr = GLONG(fi->nextfree);
|
bp->freeptr = GLONG(fi->nextfree);
|
||||||
bp->freeclusters = GLONG(fi->freeclust);
|
bp->freeclusters = GLONG(fi->freeclust);
|
||||||
chat("fat info: %ld free clusters, next free %ld\n", bp->freeclusters, bp->freeptr);
|
chat("fat info: %ld free clusters, next free %ld\n",
|
||||||
|
bp->freeclusters, bp->freeptr);
|
||||||
}
|
}
|
||||||
putsect(p1);
|
putsect(p1);
|
||||||
}
|
}
|
||||||
|
@ -154,12 +155,10 @@ dosfs(Xfs *xf)
|
||||||
bootdump(2, b);
|
bootdump(2, b);
|
||||||
bp->rootaddr = bp->fataddr + bp->nfats*bp->fatsize;
|
bp->rootaddr = bp->fataddr + bp->nfats*bp->fatsize;
|
||||||
bp->rootstart = 0;
|
bp->rootstart = 0;
|
||||||
i = bp->rootsize*DOSDIRSIZE + bp->sectsize-1;
|
bp->dataaddr = bp->rootaddr + (bp->rootsize*DOSDIRSIZE + bp->sectsize-1)/bp->sectsize;
|
||||||
i /= bp->sectsize;
|
|
||||||
bp->dataaddr = bp->rootaddr + i;
|
|
||||||
bp->freeptr = FATRESRV;
|
bp->freeptr = FATRESRV;
|
||||||
}
|
}
|
||||||
bp->fatclusters = FATRESRV+(bp->volsize - bp->dataaddr)/bp->clustsize;
|
bp->fatclusters = FATRESRV + (bp->volsize - bp->dataaddr)/bp->clustsize;
|
||||||
|
|
||||||
if(xf->isfat32)
|
if(xf->isfat32)
|
||||||
bp->fatbits = 32;
|
bp->fatbits = 32;
|
||||||
|
@ -205,7 +204,7 @@ getfile(Xfile *f)
|
||||||
Iosect *p;
|
Iosect *p;
|
||||||
|
|
||||||
dp = f->ptr;
|
dp = f->ptr;
|
||||||
if(dp->p)
|
if(dp->p != nil)
|
||||||
panic("getfile");
|
panic("getfile");
|
||||||
p = getsect(f->xf, dp->addr);
|
p = getsect(f->xf, dp->addr);
|
||||||
if(p == nil)
|
if(p == nil)
|
||||||
|
@ -234,7 +233,7 @@ putfile(Xfile *f)
|
||||||
Dosptr *dp;
|
Dosptr *dp;
|
||||||
|
|
||||||
dp = f->ptr;
|
dp = f->ptr;
|
||||||
if(!dp->p)
|
if(dp->p == nil)
|
||||||
panic("putfile");
|
panic("putfile");
|
||||||
putsect(dp->p);
|
putsect(dp->p);
|
||||||
dp->p = nil;
|
dp->p = nil;
|
||||||
|
@ -898,8 +897,7 @@ walkup(Xfile *f, Dosptr *ndp)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
k = clust2sect(bp, ppclust) +
|
k = clust2sect(bp, ppclust) + so%bp->clustsize;
|
||||||
so%bp->clustsize;
|
|
||||||
}else{
|
}else{
|
||||||
if(so*bp->sectsize >= bp->rootsize*DOSDIRSIZE)
|
if(so*bp->sectsize >= bp->rootsize*DOSDIRSIZE)
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -919,7 +917,7 @@ out:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if(p)
|
if(p != nil)
|
||||||
putsect(p);
|
putsect(p);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,13 +39,15 @@ getiosect(Xfs *xf, vlong addr, int rflag)
|
||||||
int toff;
|
int toff;
|
||||||
Iosect *p;
|
Iosect *p;
|
||||||
|
|
||||||
|
if(addr < 0)
|
||||||
|
return nil;
|
||||||
toff = addr % Sect2trk;
|
toff = addr % Sect2trk;
|
||||||
taddr = addr - toff;
|
taddr = addr - toff;
|
||||||
t = getiotrack(xf, taddr);
|
t = getiotrack(xf, taddr);
|
||||||
if(rflag && (t->flags&BSTALE)){
|
if(rflag && (t->flags&BSTALE)){
|
||||||
if(tread(t) < 0){
|
if(tread(t) < 0){
|
||||||
unmlock(&t->lock);
|
unmlock(&t->lock);
|
||||||
return 0;
|
return nil;
|
||||||
}
|
}
|
||||||
t->flags &= ~BSTALE;
|
t->flags &= ~BSTALE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue