Trivial changes: whitespace and modes.
Remote whitespace at the ends of lines. Remove blank lines from the ends of files. Change modes on source files so that they are not executable. Signed-off-by: Dan Cross <cross@gajendra.net>
This commit is contained in:
parent
77a0a5b519
commit
fa325e9b42
1021 changed files with 5688 additions and 6193 deletions
|
|
@ -35,4 +35,3 @@ struct VacDirEnum
|
|||
int i, n;
|
||||
VacDir *buf;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -8,21 +8,21 @@
|
|||
|
||||
/*
|
||||
* Vac file system. This is a simplified version of the same code in Fossil.
|
||||
*
|
||||
*
|
||||
* The locking order in the tree is upward: a thread can hold the lock
|
||||
* for a VacFile and then acquire the lock of f->up (the parent),
|
||||
* but not vice-versa.
|
||||
*
|
||||
*
|
||||
* A vac file is one or two venti files. Plain data files are one venti file,
|
||||
* while directores are two: a venti data file containing traditional
|
||||
* directory entries, and a venti directory file containing venti
|
||||
* directory entries, and a venti directory file containing venti
|
||||
* directory entries. The traditional directory entries in the data file
|
||||
* contain integers indexing into the venti directory entry file.
|
||||
* It's a little complicated, but it makes the data usable by standard
|
||||
* tools like venti/copy.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
static int filemetaflush(VacFile*, char*);
|
||||
|
||||
struct VacFile
|
||||
|
|
@ -45,7 +45,7 @@ struct VacFile
|
|||
VtFile *msource; /* metadata for children in a directory */
|
||||
VacFile *down; /* children */
|
||||
int mode;
|
||||
|
||||
|
||||
uvlong qidoffset; /* qid offset */
|
||||
};
|
||||
|
||||
|
|
@ -215,7 +215,7 @@ vacfiledecref(VacFile *f)
|
|||
filefree(f);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
filemetalock(f);
|
||||
f->ref--;
|
||||
if(f->ref > 0){
|
||||
|
|
@ -256,12 +256,12 @@ vacfiledecref(VacFile *f)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Construct a vacfile for the root of a vac tree, given the
|
||||
* venti file for the root information. That venti file is a
|
||||
/*
|
||||
* Construct a vacfile for the root of a vac tree, given the
|
||||
* venti file for the root information. That venti file is a
|
||||
* directory file containing VtEntries for three more venti files:
|
||||
* the two venti files making up the root directory, and a
|
||||
* third venti file that would be the metadata half of the
|
||||
* the two venti files making up the root directory, and a
|
||||
* third venti file that would be the metadata half of the
|
||||
* "root's parent".
|
||||
*
|
||||
* Fossil generates slightly different vac files, due to a now
|
||||
|
|
@ -273,7 +273,7 @@ VacFile*
|
|||
_vacfileroot(VacFs *fs, VtFile *r)
|
||||
{
|
||||
int redirected;
|
||||
char err[ERRMAX];
|
||||
char err[ERRMAX];
|
||||
VtBlock *b;
|
||||
VtFile *r0, *r1, *r2;
|
||||
MetaBlock mb;
|
||||
|
|
@ -374,7 +374,7 @@ Err1:
|
|||
* to look at every block to find a given name.
|
||||
* Dirlookup looks in f for an element name elem.
|
||||
* It returns a new VacFile with the dir, boff, and mode
|
||||
* filled in, but the sources (venti files) are not, and f is
|
||||
* filled in, but the sources (venti files) are not, and f is
|
||||
* not yet linked into the tree. These details must be taken
|
||||
* care of by the caller.
|
||||
*
|
||||
|
|
@ -535,8 +535,8 @@ Err:
|
|||
return nil;
|
||||
}
|
||||
|
||||
/*
|
||||
* Open a path in the vac file system:
|
||||
/*
|
||||
* Open a path in the vac file system:
|
||||
* just walk each element one at a time.
|
||||
*/
|
||||
VacFile*
|
||||
|
|
@ -696,12 +696,12 @@ vacfilegetsize(VacFile *f, uvlong *size)
|
|||
* Directory reading.
|
||||
*
|
||||
* A VacDirEnum is a buffer containing directory entries.
|
||||
* Directory entries contain malloced strings and need to
|
||||
* be cleaned up with vdcleanup. The invariant in the
|
||||
* Directory entries contain malloced strings and need to
|
||||
* be cleaned up with vdcleanup. The invariant in the
|
||||
* VacDirEnum is that the directory entries between
|
||||
* vde->i and vde->n are owned by the vde and need to
|
||||
* be cleaned up if it is closed. Those from 0 up to vde->i
|
||||
* have been handed to the reader, and the reader must
|
||||
* have been handed to the reader, and the reader must
|
||||
* take care of calling vdcleanup as appropriate.
|
||||
*/
|
||||
VacDirEnum*
|
||||
|
|
@ -718,7 +718,7 @@ vdeopen(VacFile *f)
|
|||
/*
|
||||
* There might be changes to this directory's children
|
||||
* that have not been flushed out into the cache yet.
|
||||
* Those changes are only available if we look at the
|
||||
* Those changes are only available if we look at the
|
||||
* VacFile structures directory. But the directory reader
|
||||
* is going to read the cache blocks directly, so update them.
|
||||
*/
|
||||
|
|
@ -912,19 +912,19 @@ vdeclose(VacDirEnum *vde)
|
|||
* On to mutation. If the vac file system has been opened
|
||||
* read-write, then the files and directories can all be edited.
|
||||
* Changes are kept in the in-memory cache until flushed out
|
||||
* to venti, so we must be careful to explicitly flush data
|
||||
* to venti, so we must be careful to explicitly flush data
|
||||
* that we're not likely to modify again.
|
||||
*
|
||||
* Each VacFile has its own copy of its VacDir directory entry
|
||||
* in f->dir, but otherwise the cache is the authoratative source
|
||||
* for data. Thus, for the most part, it suffices if we just
|
||||
* for data. Thus, for the most part, it suffices if we just
|
||||
* call vtfileflushbefore and vtfileflush when we modify things.
|
||||
* There are a few places where we have to remember to write
|
||||
* changed VacDirs back into the cache. If f->dir *is* out of sync,
|
||||
* then f->dirty should be set.
|
||||
*
|
||||
* The metadata in a directory is, to venti, a plain data file,
|
||||
* but as mentioned above it is actually a sequence of
|
||||
* but as mentioned above it is actually a sequence of
|
||||
* MetaBlocks that contain sorted lists of VacDir entries.
|
||||
* The filemetaxxx routines manipulate that stream.
|
||||
*/
|
||||
|
|
@ -949,10 +949,10 @@ filemetaalloc(VacFile *fp, VacDir *dir, u32int start)
|
|||
int i, n;
|
||||
MetaEntry me;
|
||||
VtFile *ms;
|
||||
|
||||
|
||||
ms = fp->msource;
|
||||
n = vdsize(dir, VacDirVersion);
|
||||
|
||||
|
||||
/* Look for a block with room for a new entry of size n. */
|
||||
nb = (vtfilegetsize(ms)+ms->dsize-1)/ms->dsize;
|
||||
if(start == NilBlock){
|
||||
|
|
@ -961,7 +961,7 @@ filemetaalloc(VacFile *fp, VacDir *dir, u32int start)
|
|||
else
|
||||
start = 0;
|
||||
}
|
||||
|
||||
|
||||
if(start > nb)
|
||||
start = nb;
|
||||
for(bo=start; bo<nb; bo++){
|
||||
|
|
@ -1015,7 +1015,7 @@ Err:
|
|||
}
|
||||
|
||||
/*
|
||||
* Update f's directory entry in the block cache.
|
||||
* Update f's directory entry in the block cache.
|
||||
* We look for the directory entry by name;
|
||||
* if we're trying to rename the file, oelem is the old name.
|
||||
*
|
||||
|
|
@ -1057,7 +1057,7 @@ filemetaflush(VacFile *f, char *oelem)
|
|||
goto Err;
|
||||
|
||||
/*
|
||||
* Check whether we can resize the entry and keep it
|
||||
* Check whether we can resize the entry and keep it
|
||||
* in this block.
|
||||
*/
|
||||
n = vdsize(&f->dir, VacDirVersion);
|
||||
|
|
@ -1076,20 +1076,20 @@ filemetaflush(VacFile *f, char *oelem)
|
|||
vdunpack(&f->dir, &me);
|
||||
mbinsert(&mb, i, &me);
|
||||
mbpack(&mb);
|
||||
|
||||
|
||||
/* Done */
|
||||
vtblockput(b);
|
||||
vtfileunlock(fp->msource);
|
||||
f->dirty = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The entry must be moved to another block.
|
||||
* This can only really happen on renames that
|
||||
* make the name very long.
|
||||
*/
|
||||
|
||||
|
||||
/* Allocate a spot in a new block. */
|
||||
if((bo = filemetaalloc(fp, &f->dir, f->boff+1)) == NilBlock){
|
||||
/* mbresize above might have modified block */
|
||||
|
|
@ -1175,7 +1175,7 @@ vacfileflush(VacFile *f, int recursive)
|
|||
int ret;
|
||||
VacFile **kids, *p;
|
||||
int i, nkids;
|
||||
|
||||
|
||||
if(f->mode == VtOREAD)
|
||||
return 0;
|
||||
|
||||
|
|
@ -1218,7 +1218,7 @@ vacfileflush(VacFile *f, int recursive)
|
|||
|
||||
/*
|
||||
* Now we can flush our own data.
|
||||
*/
|
||||
*/
|
||||
vtfilelock(f->source, -1);
|
||||
if(vtfileflush(f->source) < 0)
|
||||
ret = -1;
|
||||
|
|
@ -1233,7 +1233,7 @@ vacfileflush(VacFile *f, int recursive)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Create a new file named elem in fp with the given mode.
|
||||
* The mode can be changed later except for the ModeDir bit.
|
||||
|
|
@ -1339,7 +1339,7 @@ vacfilecreate(VacFile *fp, char *elem, ulong mode)
|
|||
vacfileincref(fp);
|
||||
|
||||
fileunlock(fp);
|
||||
|
||||
|
||||
filelock(ff);
|
||||
vtfilelock(ff->source, -1);
|
||||
vtfileunlock(ff->source);
|
||||
|
|
@ -1375,7 +1375,7 @@ vacfilesetsize(VacFile *f, uvlong size)
|
|||
werrstr(ENotFile);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if(filelock(f) < 0)
|
||||
return -1;
|
||||
|
||||
|
|
@ -1534,7 +1534,7 @@ vacfilesetdir(VacFile *f, VacDir *dir)
|
|||
if(filelock(f) < 0)
|
||||
return -1;
|
||||
filemetalock(f);
|
||||
|
||||
|
||||
if(f->source->mode != VtORDWR){
|
||||
werrstr(EReadOnly);
|
||||
goto Err;
|
||||
|
|
@ -1777,7 +1777,7 @@ vacfsopen(VtConn *z, char *file, int mode, ulong cachemem)
|
|||
int fd;
|
||||
uchar score[VtScoreSize];
|
||||
char *prefix;
|
||||
|
||||
|
||||
if(vtparsescore(file, &prefix, score) >= 0){
|
||||
if(prefix == nil || strcmp(prefix, "vac") != 0){
|
||||
werrstr("not a vac file");
|
||||
|
|
@ -1836,7 +1836,7 @@ if(debug) fprint(2, "bad type %s\n", rt.type);
|
|||
|
||||
memmove(e.score, rt.score, VtScoreSize);
|
||||
e.gen = 0;
|
||||
|
||||
|
||||
// Don't waste cache memory on pointer blocks
|
||||
// when rt.blocksize is large.
|
||||
e.psize = (rt.blocksize/VtEntrySize)*VtEntrySize;
|
||||
|
|
@ -1918,7 +1918,7 @@ int
|
|||
vacfsgetmaxqid(VacFs *fs, uvlong *maxqid)
|
||||
{
|
||||
VacDir vd;
|
||||
|
||||
|
||||
if(vacfilegetdir(fs->root, &vd) < 0)
|
||||
return -1;
|
||||
if(vd.qidspace)
|
||||
|
|
@ -1955,7 +1955,7 @@ vacfscreate(VtConn *z, int bsize, ulong cachemem)
|
|||
VacDir vd;
|
||||
MetaEntry me;
|
||||
int psize;
|
||||
|
||||
|
||||
if((fs = vacfsalloc(z, bsize, cachemem, VtORDWR)) == nil)
|
||||
return nil;
|
||||
|
||||
|
|
@ -1989,7 +1989,7 @@ if(debug) fprint(2, "create bsize %d psize %d\n", bsize, psize);
|
|||
vtblockwrite(b);
|
||||
memmove(metascore, b->score, VtScoreSize);
|
||||
vtblockput(b);
|
||||
|
||||
|
||||
/* First entry: empty venti directory stream. */
|
||||
memset(&e, 0, sizeof e);
|
||||
e.flags = VtEntryActive;
|
||||
|
|
@ -1999,7 +1999,7 @@ if(debug) fprint(2, "create bsize %d psize %d\n", bsize, psize);
|
|||
memmove(e.score, vtzeroscore, VtScoreSize);
|
||||
vtentrypack(&e, buf, 0);
|
||||
vtfilewrite(f, buf, VtEntrySize, 0);
|
||||
|
||||
|
||||
/* Second entry: empty metadata stream. */
|
||||
e.type = VtDataType;
|
||||
vtentrypack(&e, buf, 0);
|
||||
|
|
@ -2013,7 +2013,7 @@ if(debug) fprint(2, "create bsize %d psize %d\n", bsize, psize);
|
|||
|
||||
vtfileflush(f);
|
||||
vtfileunlock(f);
|
||||
|
||||
|
||||
/* Now open it as a vac fs. */
|
||||
fs->root = _vacfileroot(fs, f);
|
||||
if(fs->root == nil){
|
||||
|
|
@ -2105,7 +2105,7 @@ sha1matches(VacFile *f, ulong b, uchar *buf, int n)
|
|||
{
|
||||
uchar fscore[VtScoreSize];
|
||||
uchar bufscore[VtScoreSize];
|
||||
|
||||
|
||||
if(vacfileblockscore(f, b, fscore) < 0)
|
||||
return 0;
|
||||
n = vtzerotruncate(VtDataType, buf, n);
|
||||
|
|
@ -2114,4 +2114,3 @@ sha1matches(VacFile *f, ulong b, uchar *buf, int n)
|
|||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ glob2regexp(char *glob)
|
|||
*w++ = ')';
|
||||
*w++ = '$';
|
||||
*w = 0;
|
||||
|
||||
|
||||
re = regcomp(s);
|
||||
if(re == nil){
|
||||
syntax:
|
||||
|
|
@ -130,7 +130,7 @@ loadexcludefile(char *file)
|
|||
case '#':
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
inc = 0;
|
||||
if(strncmp(p, "include ", 8) == 0){
|
||||
inc = 1;
|
||||
|
|
@ -157,7 +157,7 @@ void
|
|||
excludepattern(char *p)
|
||||
{
|
||||
Reprog *re;
|
||||
|
||||
|
||||
if((re = glob2regexp(p)) == nil)
|
||||
sysfatal("bad glob pattern %s", p);
|
||||
|
||||
|
|
@ -171,10 +171,9 @@ int
|
|||
includefile(char *file)
|
||||
{
|
||||
Pattern *p, *ep;
|
||||
|
||||
|
||||
for(p=pattern, ep=p+npattern; p<ep; p++)
|
||||
if(regexec(p->re, file, nil, 0))
|
||||
return p->include;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ stringunpack(char **s, uchar **p, int *n)
|
|||
|
||||
if(*n < 2)
|
||||
return -1;
|
||||
|
||||
|
||||
nn = U16GET(*p);
|
||||
*p += 2;
|
||||
*n -= 2;
|
||||
|
|
@ -187,7 +187,7 @@ if(0)print("eo = %d en = %d\n", eo, en);
|
|||
}
|
||||
|
||||
p = mb->buf + eo;
|
||||
|
||||
|
||||
/* make sure entry looks ok and includes an elem name */
|
||||
if(en < 8 || U32GET(p) != DirMagic || en < 8 + U16GET(p+6)) {
|
||||
werrstr("corrupted meta block entry");
|
||||
|
|
@ -317,7 +317,7 @@ mbcompact(MetaBlock *mb, MetaChunk *mc)
|
|||
int oo, o, n, i;
|
||||
|
||||
oo = MetaHeaderSize + mb->maxindex*MetaIndexSize;
|
||||
|
||||
|
||||
for(i=0; i<mb->nindex; i++) {
|
||||
o = mc[i].offset;
|
||||
n = mc[i].size;
|
||||
|
|
@ -375,7 +375,7 @@ int
|
|||
vdsize(VacDir *dir, int version)
|
||||
{
|
||||
int n;
|
||||
|
||||
|
||||
if(version < 8 || version > 9)
|
||||
sysfatal("bad version %d in vdpack", version);
|
||||
|
||||
|
|
@ -433,7 +433,7 @@ vdpack(VacDir *dir, MetaEntry *me, int version)
|
|||
sysfatal("bad version %d in vdpack", version);
|
||||
|
||||
p = me->p;
|
||||
|
||||
|
||||
U32PUT(p, DirMagic);
|
||||
U16PUT(p+4, version); /* version */
|
||||
p += 6;
|
||||
|
|
@ -442,7 +442,7 @@ vdpack(VacDir *dir, MetaEntry *me, int version)
|
|||
|
||||
U32PUT(p, dir->entry);
|
||||
p += 4;
|
||||
|
||||
|
||||
if(version == 9){
|
||||
U32PUT(p, dir->gen);
|
||||
U32PUT(p+4, dir->mentry);
|
||||
|
|
@ -456,7 +456,7 @@ vdpack(VacDir *dir, MetaEntry *me, int version)
|
|||
p += stringpack(dir->uid, p);
|
||||
p += stringpack(dir->gid, p);
|
||||
p += stringpack(dir->mid, p);
|
||||
|
||||
|
||||
U32PUT(p, dir->mtime);
|
||||
U32PUT(p+4, dir->mcount);
|
||||
U32PUT(p+8, dir->ctime);
|
||||
|
|
@ -481,7 +481,7 @@ vdpack(VacDir *dir, MetaEntry *me, int version)
|
|||
U64PUT(p+8, dir->qidmax, t32);
|
||||
p += 16;
|
||||
}
|
||||
|
||||
|
||||
if(dir->gen && version < 9) {
|
||||
U8PUT(p, DirGenEntry);
|
||||
U16PUT(p+1, 4);
|
||||
|
|
@ -498,7 +498,7 @@ vdunpack(VacDir *dir, MetaEntry *me)
|
|||
{
|
||||
int t, nn, n, version;
|
||||
uchar *p;
|
||||
|
||||
|
||||
p = me->p;
|
||||
n = me->size;
|
||||
|
||||
|
|
@ -517,7 +517,7 @@ vdunpack(VacDir *dir, MetaEntry *me)
|
|||
if(version < 7 || version > 9)
|
||||
goto Err;
|
||||
p += 2;
|
||||
n -= 2;
|
||||
n -= 2;
|
||||
|
||||
/* elem */
|
||||
if(stringunpack(&dir->elem, &p, &n) < 0)
|
||||
|
|
@ -560,7 +560,7 @@ vdunpack(VacDir *dir, MetaEntry *me)
|
|||
p += VtScoreSize;
|
||||
n -= VtScoreSize;
|
||||
}
|
||||
|
||||
|
||||
/* uid */
|
||||
if(stringunpack(&dir->uid, &p, &n) < 0)
|
||||
goto Err;
|
||||
|
|
@ -678,7 +678,7 @@ mbsearch(MetaBlock *mb, char *elem, int *ri, MetaEntry *me)
|
|||
*ri = i;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if(x < 0)
|
||||
b = i+1;
|
||||
else /* x > 0 */
|
||||
|
|
@ -686,7 +686,7 @@ mbsearch(MetaBlock *mb, char *elem, int *ri, MetaEntry *me)
|
|||
}
|
||||
|
||||
assert(b == t);
|
||||
|
||||
|
||||
*ri = b; /* b is the index to insert this entry */
|
||||
memset(me, 0, sizeof(*me));
|
||||
|
||||
|
|
|
|||
|
|
@ -14,13 +14,13 @@ threadmain(int argc, char **argv)
|
|||
default:
|
||||
goto usage;
|
||||
}ARGEND
|
||||
|
||||
|
||||
if(argc != 1){
|
||||
usage:
|
||||
fprint(2, "usage: testinc includefile\n");
|
||||
threadexitsall("usage");
|
||||
}
|
||||
|
||||
|
||||
loadexcludefile(argv[0]);
|
||||
Binit(&b, 0, OREAD);
|
||||
while((p = Brdline(&b, '\n')) != nil){
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ threadmain(int argc, char *argv[])
|
|||
fmtinstall('F', vtfcallfmt);
|
||||
fmtinstall('t', mtimefmt);
|
||||
fmtinstall('M', dirmodefmt);
|
||||
|
||||
|
||||
host = nil;
|
||||
printstats = 0;
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ threadmain(int argc, char *argv[])
|
|||
|
||||
if((f = vacfsgetroot(fs)) == nil)
|
||||
sysfatal("vacfsgetroot: %r");
|
||||
|
||||
|
||||
unvac(f, nil, nil);
|
||||
for(i=0; i<nwant; i++){
|
||||
if(want[i] && !found[i]){
|
||||
|
|
@ -125,7 +125,7 @@ writen(int fd, char *buf, int n)
|
|||
{
|
||||
int m;
|
||||
int oldn;
|
||||
|
||||
|
||||
oldn = n;
|
||||
while(n > 0){
|
||||
m = write(fd, buf, n);
|
||||
|
|
@ -141,7 +141,7 @@ int
|
|||
wantfile(char *name)
|
||||
{
|
||||
int i, namelen, n;
|
||||
|
||||
|
||||
if(nwant == 0)
|
||||
return 1;
|
||||
|
||||
|
|
@ -229,7 +229,7 @@ unvac(VacFile *f, char *name, VacDir *vdir)
|
|||
fprint(2, "warning: ignoring %s %s\n", what, name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(mode&ModeDir){
|
||||
if((vde = vdeopen(f)) == nil){
|
||||
fprint(2, "vdeopen %s: %r", name);
|
||||
|
|
@ -342,7 +342,7 @@ int
|
|||
mtimefmt(Fmt *f)
|
||||
{
|
||||
Tm *tm;
|
||||
|
||||
|
||||
tm = localtime(va_arg(f->args, ulong));
|
||||
fmtprint(f, "%04d-%02d-%02d %02d:%02d",
|
||||
tm->year+1900, tm->mon+1, tm->mday,
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ static void removevacfile(void);
|
|||
#ifdef PLAN9PORT
|
||||
/*
|
||||
* We're between a rock and a hard place here.
|
||||
* The pw library (getpwnam, etc.) reads the
|
||||
* The pw library (getpwnam, etc.) reads the
|
||||
* password and group files into an on-stack buffer,
|
||||
* so if you have some huge groups, you overflow
|
||||
* the stack. Because of this, the thread library turns
|
||||
|
|
@ -136,10 +136,10 @@ threadmain(int argc, char **argv)
|
|||
default:
|
||||
usage();
|
||||
}ARGEND
|
||||
|
||||
|
||||
if(argc == 0 && !stdinname)
|
||||
usage();
|
||||
|
||||
|
||||
if(archivefile && (vacfile || diffvac)){
|
||||
fprint(2, "cannot use -a with -f, -d\n");
|
||||
usage();
|
||||
|
|
@ -266,7 +266,7 @@ threadmain(int argc, char **argv)
|
|||
}
|
||||
if(fdiff)
|
||||
vacfiledecref(fdiff);
|
||||
|
||||
|
||||
/*
|
||||
* Record the maximum qid so that vacs can be merged
|
||||
* without introducing overlapping qids. Older versions
|
||||
|
|
@ -313,7 +313,7 @@ recentarchive(VacFs *fs, char *path)
|
|||
char buf[10];
|
||||
int year, mmdd, nn, n, n1;
|
||||
char *p;
|
||||
|
||||
|
||||
fp = vacfsgetroot(fs);
|
||||
de = vdeopen(fp);
|
||||
year = 0;
|
||||
|
|
@ -339,7 +339,7 @@ recentarchive(VacFs *fs, char *path)
|
|||
return nil;
|
||||
}
|
||||
fp = f;
|
||||
|
||||
|
||||
de = vdeopen(fp);
|
||||
mmdd = 0;
|
||||
nn = 0;
|
||||
|
|
@ -440,7 +440,7 @@ enum {
|
|||
|
||||
/*
|
||||
* Archive the file named name, which has stat info d,
|
||||
* into the vac directory fp (p = parent).
|
||||
* into the vac directory fp (p = parent).
|
||||
*
|
||||
* If we're doing a vac -d against another archive, the
|
||||
* equivalent directory to fp in that archive is diffp.
|
||||
|
|
@ -469,7 +469,7 @@ vac(VacFile *fp, VacFile *diffp, char *name, Dir *d)
|
|||
|
||||
if(merge && vacmerge(fp, name) >= 0)
|
||||
return;
|
||||
|
||||
|
||||
if(verbose)
|
||||
fprint(2, "%s%s\n", name, (d->mode&DMDIR) ? "/" : "");
|
||||
|
||||
|
|
@ -551,7 +551,7 @@ vac(VacFile *fp, VacFile *diffp, char *name, Dir *d)
|
|||
if(vacfilegetentries(fdiff, &e, nil) >= 0)
|
||||
if(vacfilesetentries(f, &e, nil) >= 0){
|
||||
bsize = e.dsize;
|
||||
|
||||
|
||||
/*
|
||||
* Or if -q is set, and the metadata looks the same,
|
||||
* don't even bother reading the file.
|
||||
|
|
@ -565,7 +565,7 @@ vac(VacFile *fp, VacFile *diffp, char *name, Dir *d)
|
|||
vdcleanup(&vddiff);
|
||||
goto Out;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Skip over presumably-unchanged prefix
|
||||
* of an append-only file.
|
||||
|
|
@ -631,7 +631,7 @@ vacstdin(VacFile *fp, char *name)
|
|||
warn("vacfilecreate %s: %r", name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
off = 0;
|
||||
while((n = read(0, buf, sizeof buf)) > 0){
|
||||
if(vacfilewrite(f, buf, n, off) < 0){
|
||||
|
|
@ -660,7 +660,7 @@ vacmergefile(VacFile *fp, VacFile *mp, VacDir *d, char *vacfile,
|
|||
VtEntry ed, em;
|
||||
VacFile *mf;
|
||||
VacFile *f;
|
||||
|
||||
|
||||
mf = vacfilewalk(mp, d->elem);
|
||||
if(mf == nil){
|
||||
warn("could not walk %s in %s", d->elem, vacfile);
|
||||
|
|
@ -671,7 +671,7 @@ vacmergefile(VacFile *fp, VacFile *mp, VacDir *d, char *vacfile,
|
|||
vacfiledecref(mf);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
if((f = vacfilecreate(fp, d->elem, d->mode)) == nil){
|
||||
warn("vacfilecreate %s: %r", d->elem);
|
||||
vacfiledecref(mf);
|
||||
|
|
@ -693,7 +693,7 @@ vacmergefile(VacFile *fp, VacFile *mp, VacDir *d, char *vacfile,
|
|||
vacfiledecref(f);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
vacfiledecref(mf);
|
||||
vacfiledecref(f);
|
||||
return 0;
|
||||
|
|
@ -778,4 +778,3 @@ warn(char *fmt, ...)
|
|||
fprint(2, "\n");
|
||||
va_end(arg);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ typedef struct VacDirEnum VacDirEnum;
|
|||
*/
|
||||
enum
|
||||
{
|
||||
ModeOtherExec = (1<<0),
|
||||
ModeOtherExec = (1<<0),
|
||||
ModeOtherWrite = (1<<1),
|
||||
ModeOtherRead = (1<<2),
|
||||
ModeGroupExec = (1<<3),
|
||||
|
|
@ -64,7 +64,7 @@ struct VacDir
|
|||
ulong mgen; /* generation of meta entry */
|
||||
uvlong size; /* size of file */
|
||||
uvlong qid; /* unique file id */
|
||||
|
||||
|
||||
char *uid; /* owner id */
|
||||
char *gid; /* group id */
|
||||
char *mid; /* last modified by */
|
||||
|
|
@ -144,4 +144,3 @@ int vdeunread(VacDirEnum*);
|
|||
|
||||
int vacfiledsize(VacFile *f);
|
||||
int sha1matches(VacFile *f, ulong b, uchar *buf, int n);
|
||||
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ threadmain(int argc, char *argv[])
|
|||
fmtinstall('H', encodefmt);
|
||||
fmtinstall('V', vtscorefmt);
|
||||
fmtinstall('F', vtfcallfmt);
|
||||
|
||||
|
||||
defmnt = nil;
|
||||
defsrv = nil;
|
||||
ARGBEGIN{
|
||||
|
|
@ -620,7 +620,7 @@ rstat(Fid *f)
|
|||
VacDir dir;
|
||||
static uchar statbuf[1024];
|
||||
VacFile *parent;
|
||||
|
||||
|
||||
if(!f->busy)
|
||||
return vtstrdup(Enotexist);
|
||||
parent = vacfilegetparent(f->file);
|
||||
|
|
@ -671,7 +671,7 @@ vacstat(VacFile *parent, VacDir *vd, uchar *p, int np)
|
|||
dir.qid.type |= QTDIR;
|
||||
dir.mode |= DMDIR;
|
||||
}
|
||||
|
||||
|
||||
#ifdef PLAN9PORT
|
||||
if(vd->mode & (ModeLink|ModeDevice|ModeNamedPipe)){
|
||||
vf = vacfilewalk(parent, vd->elem);
|
||||
|
|
@ -695,7 +695,7 @@ vacstat(VacFile *parent, VacDir *vd, uchar *p, int np)
|
|||
dir.mode |= DMNAMEDPIPE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
dir.atime = vd->atime;
|
||||
dir.mtime = vd->mtime;
|
||||
dir.length = vd->size;
|
||||
|
|
@ -862,4 +862,3 @@ vacshutdown(void)
|
|||
vacfsclose(fs);
|
||||
vthangup(conn);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue