mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
ramfs: update to work
ramfs: update to work erealloc(p, 0) is handled correctly removed fprint(2, ... removed assert()
This commit is contained in:
parent
3a877764da
commit
f8681acb37
1 changed files with 4 additions and 5 deletions
|
@ -368,13 +368,11 @@ rwalk(Fid *f)
|
|||
}
|
||||
if(nf != nil && (err!=nil || rhdr.nwqid<thdr.nwname)){
|
||||
/* clunk the new fid, which is the one we walked */
|
||||
fprint(2, "f %d zero busy\n", f->fid);
|
||||
f->busy = 0;
|
||||
f->ram = nil;
|
||||
}
|
||||
if(rhdr.nwqid == thdr.nwname) /* update the fid after a successful walk */
|
||||
f->ram = fram;
|
||||
assert(f->busy);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -615,8 +613,6 @@ rclunk(Fid *f)
|
|||
f->ram->open--;
|
||||
if(f->rclose)
|
||||
e = realremove(f->ram);
|
||||
fprint(2, "clunk fid %d busy=%d\n", f->fid, f->busy);
|
||||
fprint(2, "f %d zero busy\n", f->fid);
|
||||
f->busy = 0;
|
||||
f->open = 0;
|
||||
f->ram = 0;
|
||||
|
@ -630,7 +626,6 @@ rremove(Fid *f)
|
|||
|
||||
if(f->open)
|
||||
f->ram->open--;
|
||||
fprint(2, "f %d zero busy\n", f->fid);
|
||||
f->busy = 0;
|
||||
f->open = 0;
|
||||
r = f->ram;
|
||||
|
@ -874,6 +869,10 @@ emalloc(ulong n)
|
|||
void *
|
||||
erealloc(void *p, ulong n)
|
||||
{
|
||||
if(n == 0) {
|
||||
free(p);
|
||||
return nil;
|
||||
}
|
||||
p = realloc(p, n);
|
||||
if(!p)
|
||||
error("out of memory");
|
||||
|
|
Loading…
Reference in a new issue