vac: cleanup

This commit is contained in:
Russ Cox 2008-06-14 14:29:24 -04:00
parent 233feb69cf
commit c52cda3061
3 changed files with 7 additions and 32 deletions

View file

@ -354,7 +354,7 @@ _fileopen(VacFs *fs, char *path, int partial)
elem[n] = 0; elem[n] = 0;
ff = _filewalk(f, elem, partial && *p=='\0'); ff = _filewalk(f, elem, partial && *p=='\0');
if(ff == nil){ if(ff == nil){
werrstr("%.*s: %R", utfnlen(opath, p-opath), opath); werrstr("%.*s: %r", utfnlen(opath, p-opath), opath);
goto Err; goto Err;
} }
vacfiledecref(f); vacfiledecref(f);

View file

@ -1,7 +1,5 @@
#include "stdinc.h" #include "stdinc.h"
#include <auth.h> #include <fcall.h> /* dirmodefmt */
#include <fcall.h>
#include <thread.h>
#include "vac.h" #include "vac.h"
VacFs *fs; VacFs *fs;
@ -35,7 +33,7 @@ threadmain(int argc, char *argv[])
fmtinstall('H', encodefmt); fmtinstall('H', encodefmt);
fmtinstall('V', vtscorefmt); fmtinstall('V', vtscorefmt);
fmtinstall('F', vtfcallfmt); fmtinstall('F', vtfcallfmt);
fmtinstall('T', mtimefmt); fmtinstall('t', mtimefmt);
fmtinstall('M', dirmodefmt); fmtinstall('M', dirmodefmt);
host = nil; host = nil;
@ -141,7 +139,8 @@ void
unvac(VacFile *f, char *name, VacDir *vdir) unvac(VacFile *f, char *name, VacDir *vdir)
{ {
static char buf[65536]; static char buf[65536];
int fd, mode, n, mode9; int fd, n;
ulong mode, mode9;
char *newname; char *newname;
char *what; char *what;
vlong off; vlong off;
@ -175,7 +174,7 @@ unvac(VacFile *f, char *name, VacDir *vdir)
mode9 |= DMSETGID; mode9 |= DMSETGID;
if(mode&ModeDevice) if(mode&ModeDevice)
mode9 |= DMDEVICE; mode9 |= DMDEVICE;
print("%M %-10s %-10s %11lld %T %s\n", print("%M %-10s %-10s %11lld %t %s\n",
mode9, vdir->uid, vdir->gid, vdir->size, mode9, vdir->uid, vdir->gid, vdir->size,
vdir->mtime, name); vdir->mtime, name);
}else }else

View file

@ -1,7 +1,5 @@
#include "stdinc.h" #include "stdinc.h"
#include <auth.h>
#include <fcall.h> #include <fcall.h>
#include <thread.h>
#include "vac.h" #include "vac.h"
typedef struct Fid Fid; typedef struct Fid Fid;
@ -508,29 +506,7 @@ rread(Fid *f)
char* char*
rwrite(Fid *f) rwrite(Fid *f)
{ {
char *buf; return vtstrdup(Erdonly);
vlong off;
int cnt;
VacFile *vf;
if(!f->busy)
return vtstrdup(Enotexist);
vf = f->file;
thdr.count = 0;
off = rhdr.offset;
buf = rhdr.data;
cnt = rhdr.count;
if(f->qid.type & QTDIR)
return "file is a directory";
thdr.count = vacfilewrite(vf, buf, cnt, off, "none");
if(thdr.count < 0) {
char err[80];
rerrstr(err, sizeof err);
fprint(2, "write failed: %s\n", err);
return vtstrdup(err);
}
return 0;
} }
char * char *