vac: plan9 compatibility

This commit is contained in:
Russ Cox 2008-06-14 23:12:20 -04:00
parent 62e69a48c7
commit 948cc14e07
2 changed files with 9 additions and 6 deletions

View file

@ -952,7 +952,6 @@ filemetaalloc(VacFile *fp, VacDir *dir, u32int start)
start = 0;
}
b = nil;
if(start > nb)
start = nb;
for(bo=start; bo<nb; bo++){
@ -969,7 +968,6 @@ filemetaalloc(VacFile *fp, VacDir *dir, u32int start)
goto Found;
}
vtblockput(b);
b = nil;
}
/* No block found, extend the file by one metablock. */
@ -1179,7 +1177,6 @@ vacfileflush(VacFile *f, int recursive)
*/
if(filelock(f) < 0)
return -1;
fileunlock(f);
vtfilelock(f->source, -1);
if(vtfileflush(f->source) < 0)
ret = -1;
@ -1304,7 +1301,7 @@ vacfilecreate(VacFile *fp, char *elem, ulong mode)
dir->ctime = dir->mtime;
dir->atime = dir->mtime;
dir->mode = mode;
if((bo = filemetaalloc(fp, &ff->dir, NilBlock)) < 0)
if((bo = filemetaalloc(fp, &ff->dir, NilBlock)) == NilBlock)
goto Err;
/*

View file

@ -2,6 +2,10 @@
#include <fcall.h> /* dirmodefmt */
#include "vac.h"
#ifndef PLAN9PORT
#pragma varargck type "t" ulong
#endif
VacFs *fs;
int tostdout;
int nwant;
@ -160,12 +164,13 @@ unvac(VacFile *f, char *name, VacDir *vdir)
mode9 = vdir->mode&0777;
if(mode&ModeDir)
mode9 |= DMDIR;
if(mode&ModeLink)
mode9 |= DMSYMLINK;
if(mode&ModeAppend)
mode9 |= DMAPPEND;
if(mode&ModeExclusive)
mode9 |= DMEXCL;
#ifdef PLAN9PORT
if(mode&ModeLink)
mode9 |= DMSYMLINK;
if(mode&ModeNamedPipe)
mode9 |= DMNAMEDPIPE;
if(mode&ModeSetUid)
@ -174,6 +179,7 @@ unvac(VacFile *f, char *name, VacDir *vdir)
mode9 |= DMSETGID;
if(mode&ModeDevice)
mode9 |= DMDEVICE;
#endif
print("%M %-10s %-10s %11lld %t %s\n",
mode9, vdir->uid, vdir->gid, vdir->size,
vdir->mtime, name);