Browse Source

Plan 9 from Bell Labs 2007-09-12

David du Colombier 16 years ago
parent
commit
8a23059915

+ 5 - 5
dist/replica/_plan9.db

@@ -10346,7 +10346,7 @@ sys/src/cmd/fmt.c - 664 sys sys 1137603598 4078
 sys/src/cmd/fortune.c - 664 sys sys 1072729222 1779
 sys/src/cmd/fossil - 20000000775 sys sys 1087005595 0
 sys/src/cmd/fossil/9.h - 664 sys sys 1138465941 4438
-sys/src/cmd/fossil/9auth.c - 664 sys sys 1168308062 3960
+sys/src/cmd/fossil/9auth.c - 664 sys sys 1189552651 3972
 sys/src/cmd/fossil/9dir.c - 664 sys sys 1085333382 2219
 sys/src/cmd/fossil/9excl.c - 664 sys sys 1042005502 1887
 sys/src/cmd/fossil/9fid.c - 664 sys sys 1189110070 5584
@@ -10368,7 +10368,7 @@ sys/src/cmd/fossil/bwatch.c - 664 sys sys 1042005505 6754
 sys/src/cmd/fossil/cache.c - 664 sys sys 1180158132 43913
 sys/src/cmd/fossil/check.c - 664 sys sys 1187136398 17470
 sys/src/cmd/fossil/conf.rc - 775 sys sys 1084333190 1416
-sys/src/cmd/fossil/dat.h - 664 sys sys 1177432005 7655
+sys/src/cmd/fossil/dat.h - 664 sys sys 1189552944 7822
 sys/src/cmd/fossil/deadlock - 775 sys sys 1042005506 413
 sys/src/cmd/fossil/disk.c - 664 sys sys 1179296683 6993
 sys/src/cmd/fossil/dump.c - 664 sys sys 1042005506 1340
@@ -10381,13 +10381,13 @@ sys/src/cmd/fossil/flfmt.c - 664 sys sys 1080586881 10753
 sys/src/cmd/fossil/flfmt9660.c - 664 sys sys 1132451844 12318
 sys/src/cmd/fossil/flfmt9660.h - 664 sys sys 1072830621 134
 sys/src/cmd/fossil/flproto - 664 sys sys 1173736837 222
-sys/src/cmd/fossil/fns.h - 664 sys sys 1177432005 3233
+sys/src/cmd/fossil/fns.h - 664 sys sys 1189552875 3262
 sys/src/cmd/fossil/fossil-acid - 664 sys sys 1139667278 4365
 sys/src/cmd/fossil/fossil.c - 664 sys sys 1077896345 2435
 sys/src/cmd/fossil/fs.c - 664 sys sys 1177432004 21598
-sys/src/cmd/fossil/fs.h - 664 sys sys 1139667269 1581
+sys/src/cmd/fossil/fs.h - 664 sys sys 1189552775 1606
 sys/src/cmd/fossil/history - 664 sys sys 1055703793 1400
-sys/src/cmd/fossil/invariants - 664 sys sys 1042005509 4073
+sys/src/cmd/fossil/invariants - 664 sys sys 1189552808 4073
 sys/src/cmd/fossil/last.c - 664 sys sys 1087005593 812
 sys/src/cmd/fossil/mkfile - 664 sys sys 1189020178 2641
 sys/src/cmd/fossil/nobwatch.c - 664 sys sys 1042005509 329

+ 5 - 5
dist/replica/plan9.db

@@ -10346,7 +10346,7 @@ sys/src/cmd/fmt.c - 664 sys sys 1137603598 4078
 sys/src/cmd/fortune.c - 664 sys sys 1072729222 1779
 sys/src/cmd/fossil - 20000000775 sys sys 1087005595 0
 sys/src/cmd/fossil/9.h - 664 sys sys 1138465941 4438
-sys/src/cmd/fossil/9auth.c - 664 sys sys 1168308062 3960
+sys/src/cmd/fossil/9auth.c - 664 sys sys 1189552651 3972
 sys/src/cmd/fossil/9dir.c - 664 sys sys 1085333382 2219
 sys/src/cmd/fossil/9excl.c - 664 sys sys 1042005502 1887
 sys/src/cmd/fossil/9fid.c - 664 sys sys 1189110070 5584
@@ -10368,7 +10368,7 @@ sys/src/cmd/fossil/bwatch.c - 664 sys sys 1042005505 6754
 sys/src/cmd/fossil/cache.c - 664 sys sys 1180158132 43913
 sys/src/cmd/fossil/check.c - 664 sys sys 1187136398 17470
 sys/src/cmd/fossil/conf.rc - 775 sys sys 1084333190 1416
-sys/src/cmd/fossil/dat.h - 664 sys sys 1177432005 7655
+sys/src/cmd/fossil/dat.h - 664 sys sys 1189552944 7822
 sys/src/cmd/fossil/deadlock - 775 sys sys 1042005506 413
 sys/src/cmd/fossil/disk.c - 664 sys sys 1179296683 6993
 sys/src/cmd/fossil/dump.c - 664 sys sys 1042005506 1340
@@ -10381,13 +10381,13 @@ sys/src/cmd/fossil/flfmt.c - 664 sys sys 1080586881 10753
 sys/src/cmd/fossil/flfmt9660.c - 664 sys sys 1132451844 12318
 sys/src/cmd/fossil/flfmt9660.h - 664 sys sys 1072830621 134
 sys/src/cmd/fossil/flproto - 664 sys sys 1173736837 222
-sys/src/cmd/fossil/fns.h - 664 sys sys 1177432005 3233
+sys/src/cmd/fossil/fns.h - 664 sys sys 1189552875 3262
 sys/src/cmd/fossil/fossil-acid - 664 sys sys 1139667278 4365
 sys/src/cmd/fossil/fossil.c - 664 sys sys 1077896345 2435
 sys/src/cmd/fossil/fs.c - 664 sys sys 1177432004 21598
-sys/src/cmd/fossil/fs.h - 664 sys sys 1139667269 1581
+sys/src/cmd/fossil/fs.h - 664 sys sys 1189552775 1606
 sys/src/cmd/fossil/history - 664 sys sys 1055703793 1400
-sys/src/cmd/fossil/invariants - 664 sys sys 1042005509 4073
+sys/src/cmd/fossil/invariants - 664 sys sys 1189552808 4073
 sys/src/cmd/fossil/last.c - 664 sys sys 1087005593 812
 sys/src/cmd/fossil/mkfile - 664 sys sys 1189020178 2641
 sys/src/cmd/fossil/nobwatch.c - 664 sys sys 1042005509 329

+ 5 - 0
dist/replica/plan9.log

@@ -52735,3 +52735,8 @@
 1189366204 19 c 386/bin/venti/verifyarena - 775 sys sys 1189363307 154989
 1189366204 20 c 386/bin/venti/wrarena - 775 sys sys 1189363308 281565
 1189366204 21 c 386/bin/venti/write - 775 sys sys 1189363310 151645
+1189553403 0 c sys/src/cmd/fossil/9auth.c - 664 sys sys 1189552651 3972
+1189553403 1 c sys/src/cmd/fossil/dat.h - 664 sys sys 1189552944 7822
+1189553403 2 c sys/src/cmd/fossil/fns.h - 664 sys sys 1189552875 3262
+1189553403 3 c sys/src/cmd/fossil/fs.h - 664 sys sys 1189552775 1606
+1189553403 4 c sys/src/cmd/fossil/invariants - 664 sys sys 1189552808 4073

+ 12 - 9
sys/src/cmd/fossil/9auth.c

@@ -61,7 +61,7 @@ authWrite(Fid* afid, void* data, int count)
 }
 
 int
-authCheck(Fcall* t, Fid* fid, Fs* fsys)
+authCheck(Fcall* t, Fid* fid, Fsys* fsys)
 {
 	Con *con;
 	Fid *afid;
@@ -112,7 +112,8 @@ authCheck(Fcall* t, Fid* fid, Fs* fsys)
 	}
 
 	if((afid = fidGet(con, t->afid, 0)) == nil){
-		consPrint("attach %s as %s: bad afid\n", fsysGetName(fsys), fid->uname);
+		consPrint("attach %s as %s: bad afid\n",
+			fsysGetName(fsys), fid->uname);
 		vtSetError("bad authentication fid");
 		return 0;
 	}
@@ -122,15 +123,16 @@ authCheck(Fcall* t, Fid* fid, Fs* fsys)
 	 * check uname and aname match.
 	 */
 	if(!(afid->qid.type & QTAUTH)){
-		consPrint("attach %s as %s: afid not an auth file\n", fsysGetName(fsys),
-			fid->uname);
+		consPrint("attach %s as %s: afid not an auth file\n",
+			fsysGetName(fsys), fid->uname);
 		fidPut(afid);
 		vtSetError("bad authentication fid");
 		return 0;
 	}
 	if(strcmp(afid->uname, fid->uname) != 0 || afid->fsys != fsys){
-		consPrint("attach %s as %s: afid is for %s as %s\n", fsysGetName(fsys),
-			fid->uname, fsysGetName(afid->fsys), afid->uname);
+		consPrint("attach %s as %s: afid is for %s as %s\n",
+			fsysGetName(fsys), fid->uname,
+			fsysGetName(afid->fsys), afid->uname);
 		fidPut(afid);
 		vtSetError("attach/auth mismatch");
 		return 0;
@@ -140,7 +142,8 @@ authCheck(Fcall* t, Fid* fid, Fs* fsys)
 	if(afid->cuname == nil){
 		if(authRead(afid, buf, 0) != 0 || afid->cuname == nil){
 			vtUnlock(afid->alock);
-			consPrint("attach %s as %s: %R\n", fsysGetName(fsys), fid->uname);
+			consPrint("attach %s as %s: %R\n",
+				fsysGetName(fsys), fid->uname);
 			fidPut(afid);
 			vtSetError("fossil authCheck: auth protocol not finished");
 			return 0;
@@ -150,8 +153,8 @@ authCheck(Fcall* t, Fid* fid, Fs* fsys)
 
 	assert(fid->uid == nil);
 	if((fid->uid = uidByUname(afid->cuname)) == nil){
-		consPrint("attach %s as %s: unknown cuname %s\n", fsysGetName(fsys),
-			fid->uname, afid->cuname);
+		consPrint("attach %s as %s: unknown cuname %s\n",
+			fsysGetName(fsys), fid->uname, afid->cuname);
 		fidPut(afid);
 		vtSetError("unknown user");
 		return 0;

+ 71 - 61
sys/src/cmd/fossil/dat.h

@@ -20,10 +20,15 @@ typedef struct WalkPtr WalkPtr;
 #pragma incomplete Periodic
 #pragma incomplete Snap
 
-/* tuneable parameters - probably should not be constants */
+/* tunable parameters - probably should not be constants */
 enum {
-	BytesPerEntry = 100,	/* estimate of bytes per dir entries - determines number of index entries in the block */
-	FullPercentage = 80,	/* don't allocate in block if more than this percentage full */
+	/*
+	 * estimate of bytes per dir entries - determines number
+	 * of index entries in the block
+	 */
+	BytesPerEntry = 100,
+	/* don't allocate in block if more than this percentage full */
+	FullPercentage = 80,
 	FlushSize = 200,	/* number of blocks to flush */
 	DirtyPercentage = 50,	/* maximum percentage of dirty blocks */
 };
@@ -66,14 +71,14 @@ struct Super {
 
 
 struct Fs {
-	Arch *arch;		/* immutable */
-	Cache *cache;		/* immutable */
-	int mode;		/* immutable */
-	int blockSize;		/* immutable */
+	Arch	*arch;		/* immutable */
+	Cache	*cache;		/* immutable */
+	int	mode;		/* immutable */
+	int	blockSize;	/* immutable */
 	VtSession *z;		/* immutable */
-	Snap *snap;	/* immutable */
+	Snap	*snap;		/* immutable */
 
-	Periodic *metaFlush;	/* periodically flushes meta data cached in files */
+	Periodic *metaFlush; /* periodically flushes metadata cached in files */
 
 	/*
 	 * epoch lock.
@@ -83,14 +88,14 @@ struct Fs {
 	 * Deletion and creation of snapshots occurs under a write lock of elk,
 	 * ensuring no file operations are occurring concurrently.
 	 */
-	VtLock *elk;		/* epoch lock */
-	u32int ehi;		/* epoch high */
-	u32int elo;		/* epoch low */
+	VtLock	*elk;		/* epoch lock */
+	u32int	ehi;		/* epoch high */
+	u32int	elo;		/* epoch low */
 
-	int halted;		/* epoch lock is held to halt (console initiated) */
+	int	halted;	/* epoch lock is held to halt (console initiated) */
 
-	Source *source;		/* immutable: root of sources */
-	File *file;		/* immutable: root of files */
+	Source	*source;	/* immutable: root of sources */
+	File	*file;		/* immutable: root of files */
 };
 
 /*
@@ -98,30 +103,35 @@ struct Fs {
  * there are extra fields when stored locally
  */
 struct Entry {
-	u32int gen;			/* generation number */
-	ushort psize;			/* pointer block size */
-	ushort dsize;			/* data block size */
-	uchar depth;			/* unpacked from flags */
-	uchar flags;
-	uvlong size;
-	uchar score[VtScoreSize];
-	u32int tag;			/* tag for local blocks: zero if stored on Venti */
-	u32int snap;			/* non zero -> entering snapshot of given epoch */
-	uchar archive;			/* archive this snapshot: only valid for snap != 0 */
+	u32int	gen;			/* generation number */
+	ushort	psize;			/* pointer block size */
+	ushort	dsize;			/* data block size */
+	uchar	depth;			/* unpacked from flags */
+	uchar	flags;
+	uvlong	size;
+	uchar	score[VtScoreSize];
+	u32int	tag;	/* tag for local blocks: zero if stored on Venti */
+	u32int	snap;	/* non-zero -> entering snapshot of given epoch */
+	uchar	archive; /* archive this snapshot: only valid for snap != 0 */
 };
 
+/*
+ * This is called a `stream' in the fossil paper.  There used to be Sinks too.
+ * We believe that Sources and Files are one-to-one.
+ */
 struct Source {
-	Fs *fs;		/* immutable */
-	int mode;	/* immutable */
-	int issnapshot;	/* immutable */
-	u32int gen;	/* immutable */
-	int dsize;	/* immutable */
-	int dir;	/* immutable */
-
-	Source *parent;	/* immutable */
-
-	VtLock *lk;
-	int ref;
+	Fs	*fs;		/* immutable */
+	int	mode;		/* immutable */
+	int	issnapshot;	/* immutable */
+	u32int	gen;		/* immutable */
+	int	dsize;		/* immutable */
+	int	dir;		/* immutable */
+
+	Source	*parent;	/* immutable */
+	File	*file;		/* immutable */
+
+	VtLock	*lk;
+	int	ref;
 	/*
 	 * epoch for the source
 	 * for ReadWrite sources, epoch is used to lazily notice
@@ -131,13 +141,13 @@ struct Source {
 	 * sources that have become invalid because they belong to an old
 	 * snapshot.
 	 */
-	u32int epoch;
-	Block *b;			/* block containing this source */
-	uchar score[VtScoreSize];	/* score of block containing this source */
-	u32int scoreEpoch;	/* epoch of block containing this source */
-	int epb;			/* immutable: entries per block in parent */
-	u32int tag;			/* immutable: tag of parent */
-	u32int offset; 			/* immutable: entry offset in parent */
+	u32int	epoch;
+	Block	*b;		/* block containing this source */
+	uchar	score[VtScoreSize]; /* score of block containing this source */
+	u32int	scoreEpoch;	/* epoch of block containing this source */
+	int	epb;		/* immutable: entries per block in parent */
+	u32int	tag;		/* immutable: tag of parent */
+	u32int	offset; 	/* immutable: entry offset in parent */
 };
 
 
@@ -156,11 +166,11 @@ struct Header {
  * and to enable an interface that supports unget.
  */
 struct DirEntryEnum {
-	File *file;
+	File	*file;
 
-	u32int boff; 	/* block offset */
+	u32int	boff; 		/* block offset */
 
-	int i, n;
+	int	i, n;
 	DirEntry *buf;
 };
 
@@ -171,9 +181,9 @@ enum {
 
 	/* bit fields */
 	BsAlloc = 1<<0,	/* block is in use */
-	BsCopied = 1<<1,	/* block has been copied (usually in preparation for unlink) */
+	BsCopied = 1<<1,/* block has been copied (usually in preparation for unlink) */
 	BsVenti = 1<<2,	/* block has been stored on Venti */
-	BsClosed = 1<<3,	/* block has been unlinked on disk from active file system */
+	BsClosed = 1<<3,/* block has been unlinked on disk from active file system */
 	BsMask = BsAlloc|BsCopied|BsVenti|BsClosed,
 };
 
@@ -212,17 +222,17 @@ struct Label {
 };
 
 struct Block {
-	Cache *c;
-	int ref;
-	int nlock;
+	Cache	*c;
+	int	ref;
+	int	nlock;
 	uintptr	pc;		/* pc that fetched this block from the cache */
 
-	VtLock *lk;
+	VtLock	*lk;
 
 	int 	part;
 	u32int	addr;
 	uchar	score[VtScoreSize];	/* score */
-	Label l;
+	Label	l;
 
 	uchar	*dmap;
 
@@ -237,7 +247,7 @@ struct Block {
 
 	u32int	vers;			/* version of dirty flag */
 
-	BList	*uhead;			/* blocks to unlink when this block is written */
+	BList	*uhead;	/* blocks to unlink when this block is written */
 	BList	*utail;
 
 	/* block ordering for cache -> disk */
@@ -251,13 +261,13 @@ struct Block {
 /* tree walker, for gc and archiver */
 struct WalkPtr
 {
-	uchar *data;
-	int isEntry;
-	int n;
-	int m;
-	Entry e;
-	uchar type;
-	u32int tag;
+	uchar	*data;
+	int	isEntry;
+	int	n;
+	int	m;
+	Entry	e;
+	uchar	type;
+	u32int	tag;
 };
 
 enum

+ 96 - 95
sys/src/cmd/fossil/fns.h

@@ -1,105 +1,106 @@
-Source* sourceRoot(Fs*, u32int, int);
-Source* sourceOpen(Source*, ulong, int, int);
-Source* sourceCreate(Source*, int, int, u32int);
-Block* sourceBlock(Source*, ulong, int);
-Block* _sourceBlock(Source*, ulong, int, int, ulong);
-int sourceGetEntry(Source*, Entry*);
-int sourceSetEntry(Source*, Entry*);
-int sourceSetSize(Source*, uvlong);
-uvlong sourceGetSize(Source*);
-int sourceSetDirSize(Source*, ulong);
-ulong sourceGetDirSize(Source*);
-int sourceTruncate(Source*);
-int sourceRemove(Source*);
-void sourceClose(Source*);
-int sourceLock(Source*, int);
-void sourceUnlock(Source*);
-int sourceLock2(Source*, Source*, int);
-
-Cache* cacheAlloc(Disk*, VtSession*, ulong, int);
-void cacheCountUsed(Cache*, u32int, u32int*, u32int*, u32int*);
-void cacheFree(Cache*);
-Block* cacheLocal(Cache*, int, u32int, int);
-Block* cacheLocalData(Cache*, u32int, int, u32int, int, u32int);
-Block* cacheGlobal(Cache*, uchar[VtScoreSize], int, u32int, int);
-Block* cacheAllocBlock(Cache*, int, u32int, u32int, u32int);
-void cacheFlush(Cache*, int);
-u32int cacheLocalSize(Cache*, int);
-int cacheDirty(Cache*);
-int readLabel(Cache*, Label*, u32int addr);
-
-Block* blockCopy(Block*, u32int, u32int, u32int);
-void blockDupLock(Block*);
-void blockPut(Block*);
-void blockDependency(Block*, Block*, int, uchar*, Entry*);
-int blockDirty(Block*);
-void blockRemoveLink(Block*, u32int, int, u32int, int);
-int blockSetLabel(Block*, Label*, int);
-Block* _blockSetLabel(Block*, Label*);
-void blockSetIOState(Block*, int);
-int blockWrite(Block*);
-uchar* blockRollback(Block*, uchar*);
-
-Disk* diskAlloc(int);
-void diskFree(Disk*);
-int diskReadRaw(Disk*, int, u32int, uchar*);
-int diskWriteRaw(Disk*, int, u32int, uchar*);
-void diskRead(Disk*, Block*);
-void diskWrite(Disk*, Block*);
-void	diskWriteAndWait(Disk*, Block*);
-int diskFlush(Disk*);
-u32int diskSize(Disk*, int);
-int diskBlockSize(Disk*);
-
-char* bsStr(int);
-char* bioStr(int);
-char* btStr(int);
-u32int globalToLocal(uchar[VtScoreSize]);
-void localToGlobal(u32int, uchar[VtScoreSize]);
-
-int headerUnpack(Header*, uchar*);
-void headerPack(Header*, uchar*);
-
-int labelFmt(Fmt*);
-int labelUnpack(Label*, uchar*, int);
-void labelPack(Label*, uchar*, int);
-
-int scoreFmt(Fmt*);
-
-int superUnpack(Super*, uchar*);
-void superPack(Super*, uchar*);
-
-int entryUnpack(Entry*, uchar*, int);
-void entryPack(Entry*, uchar*, int);
-int entryType(Entry*);
+Block*	sourceBlock(Source*, ulong, int);
+Block*	_sourceBlock(Source*, ulong, int, int, ulong);
+void	sourceClose(Source*);
+Source*	sourceCreate(Source*, int, int, u32int);
+ulong	sourceGetDirSize(Source*);
+int	sourceGetEntry(Source*, Entry*);
+uvlong	sourceGetSize(Source*);
+int	sourceLock2(Source*, Source*, int);
+int	sourceLock(Source*, int);
+char	*sourceName(Source *s);
+Source*	sourceOpen(Source*, ulong, int, int);
+int	sourceRemove(Source*);
+Source*	sourceRoot(Fs*, u32int, int);
+int	sourceSetDirSize(Source*, ulong);
+int	sourceSetEntry(Source*, Entry*);
+int	sourceSetSize(Source*, uvlong);
+int	sourceTruncate(Source*);
+void	sourceUnlock(Source*);
+
+Block*	cacheAllocBlock(Cache*, int, u32int, u32int, u32int);
+Cache*	cacheAlloc(Disk*, VtSession*, ulong, int);
+void	cacheCountUsed(Cache*, u32int, u32int*, u32int*, u32int*);
+int	cacheDirty(Cache*);
+void	cacheFlush(Cache*, int);
+void	cacheFree(Cache*);
+Block*	cacheGlobal(Cache*, uchar[VtScoreSize], int, u32int, int);
+Block*	cacheLocal(Cache*, int, u32int, int);
+Block*	cacheLocalData(Cache*, u32int, int, u32int, int, u32int);
+u32int	cacheLocalSize(Cache*, int);
+int	readLabel(Cache*, Label*, u32int addr);
+
+Block*	blockCopy(Block*, u32int, u32int, u32int);
+void	blockDependency(Block*, Block*, int, uchar*, Entry*);
+int	blockDirty(Block*);
+void	blockDupLock(Block*);
+void	blockPut(Block*);
+void	blockRemoveLink(Block*, u32int, int, u32int, int);
+uchar*	blockRollback(Block*, uchar*);
+void	blockSetIOState(Block*, int);
+Block*	_blockSetLabel(Block*, Label*);
+int	blockSetLabel(Block*, Label*, int);
+int	blockWrite(Block*);
+
+Disk*	diskAlloc(int);
+int	diskBlockSize(Disk*);
+int	diskFlush(Disk*);
+void	diskFree(Disk*);
+void	diskRead(Disk*, Block*);
+int	diskReadRaw(Disk*, int, u32int, uchar*);
+u32int	diskSize(Disk*, int);
+void	diskWriteAndWait(Disk*,	Block*);
+void	diskWrite(Disk*, Block*);
+int	diskWriteRaw(Disk*, int, u32int, uchar*);
+
+char*	bioStr(int);
+char*	bsStr(int);
+char*	btStr(int);
+u32int	globalToLocal(uchar[VtScoreSize]);
+void	localToGlobal(u32int, uchar[VtScoreSize]);
+
+void	headerPack(Header*, uchar*);
+int	headerUnpack(Header*, uchar*);
+
+int	labelFmt(Fmt*);
+void	labelPack(Label*, uchar*, int);
+int	labelUnpack(Label*, uchar*, int);
+
+int	scoreFmt(Fmt*);
+
+void	superPack(Super*, uchar*);
+int	superUnpack(Super*, uchar*);
+
+void	entryPack(Entry*, uchar*, int);
+int	entryType(Entry*);
+int	entryUnpack(Entry*, uchar*, int);
 
 Periodic* periodicAlloc(void (*)(void*), void*, int);
-void periodicKill(Periodic*);
+void	periodicKill(Periodic*);
 
-File* fileRoot(Source*);
-int fileSnapshot(File*, File*, u32int, int);
-int fileGetSources(File*, Entry*, Entry*);
-int mkVac(VtSession*, uint, Entry*, Entry*, DirEntry*, uchar[VtScoreSize]);
-int fsNextQid(Fs*, u64int*);
-Block* superGet(Cache*, Super*);
+int	fileGetSources(File*, Entry*, Entry*);
+File*	fileRoot(Source*);
+int	fileSnapshot(File*, File*, u32int, int);
+int	fsNextQid(Fs*, u64int*);
+int	mkVac(VtSession*, uint, Entry*, Entry*, DirEntry*, uchar[VtScoreSize]);
+Block*	superGet(Cache*, Super*);
 
-Arch* archInit(Cache*, Disk*, Fs*, VtSession*);
-void archFree(Arch*);
-void archKick(Arch*);
+void	archFree(Arch*);
+Arch*	archInit(Cache*, Disk*, Fs*, VtSession*);
+void	archKick(Arch*);
 
-void bwatchLock(Block*);
-void bwatchUnlock(Block*);
-void bwatchInit(void);
-void bwatchSetBlockSize(uint);
-void bwatchDependency(Block*);
-void bwatchReset(uchar[VtScoreSize]);
+void	bwatchDependency(Block*);
+void	bwatchInit(void);
+void	bwatchLock(Block*);
+void	bwatchReset(uchar[VtScoreSize]);
+void	bwatchSetBlockSize(uint);
+void	bwatchUnlock(Block*);
 
-void initWalk(WalkPtr*, Block*, uint);
-int nextWalk(WalkPtr*, uchar[VtScoreSize], uchar*, u32int*, Entry**);
+void	initWalk(WalkPtr*, Block*, uint);
+int	nextWalk(WalkPtr*, uchar[VtScoreSize], uchar*, u32int*, Entry**);
 
-void snapGetTimes(Snap*, u32int*, u32int*, u32int*);
-void snapSetTimes(Snap*, u32int, u32int, u32int);
+void	snapGetTimes(Snap*, u32int*, u32int*, u32int*);
+void	snapSetTimes(Snap*, u32int, u32int, u32int);
 
-void fsCheck(Fsck*);
+void	fsCheck(Fsck*);
 
 #pragma varargck type "L" Label*

+ 43 - 42
sys/src/cmd/fossil/fs.h

@@ -14,47 +14,48 @@ enum {
 	OOverWrite,
 };
 
-Fs *fsOpen(char*, VtSession*, long, int);
-void fsClose(Fs*);
-File *fsGetRoot(Fs*);
-int fsSnapshot(Fs*, char*, char*, int);
-void fsSnapshotRemove(Fs*);
-void fsSnapshotCleanup(Fs*, u32int);
-int fsSync(Fs*);
-int fsHalt(Fs*);
-int fsUnhalt(Fs*);
-int fsVac(Fs*, char*, uchar[VtScoreSize]);
-int fsRedial(Fs*, char*);
-int fsEpochLow(Fs*, u32int);
+void	fsClose(Fs*);
+int	fsEpochLow(Fs*, u32int);
+File	*fsGetRoot(Fs*);
+int	fsHalt(Fs*);
+Fs	*fsOpen(char*, VtSession*, long, int);
+int	fsRedial(Fs*, char*);
+void	fsSnapshotCleanup(Fs*, u32int);
+int	fsSnapshot(Fs*, char*, char*, int);
+void	fsSnapshotRemove(Fs*);
+int	fsSync(Fs*);
+int	fsUnhalt(Fs*);
+int	fsVac(Fs*, char*, uchar[VtScoreSize]);
 
-File *fileOpen(Fs*, char*);
-File *fileCreate(File*, char*, ulong, char*);
-File *fileWalk(File*, char*);
-File *_fileWalk(File*, char*, int);
-int fileRemove(File*, char*);
-int fileClri(File*, char*, char*);
-int fileClriPath(Fs*, char*, char*);
-int fileRead(File*, void *, int, vlong);
-int fileWrite(File*, void *, int, vlong, char*);
-int fileMapBlock(File*, ulong, uchar[VtScoreSize], ulong);
-uvlong fileGetId(File*);
-ulong fileGetMcount(File*);
-int fileIsDir(File*);
-int fileGetSize(File*, uvlong*);
-int fileGetDir(File*, DirEntry*);
-int fileSetDir(File*, DirEntry*, char*);
-int fileSetSize(File*, uvlong);
-File *fileGetParent(File*);
-int fileSync(File*);
-File *fileIncRef(File*);
-int fileDecRef(File*);
-int fileIsRoot(File*);
-int fileMetaFlush(File*, int);
-int fileSetQidSpace(File*, u64int, u64int);
-int fileTruncate(File*, char*);
-int fileIsRoFs(File*);
-ulong fileGetMode(File*);
+void	deeClose(DirEntryEnum*);
 DirEntryEnum *deeOpen(File*);
-int deeRead(DirEntryEnum*, DirEntry*);
-void deeClose(DirEntryEnum*);
-int fileWalkSources(File*);
+int	deeRead(DirEntryEnum*, DirEntry*);
+int	fileClri(File*, char*, char*);
+int	fileClriPath(Fs*, char*, char*);
+File	*fileCreate(File*, char*, ulong, char*);
+int	fileDecRef(File*);
+int	fileGetDir(File*, DirEntry*);
+uvlong	fileGetId(File*);
+ulong	fileGetMcount(File*);
+ulong	fileGetMode(File*);
+File	*fileGetParent(File*);
+int	fileGetSize(File*, uvlong*);
+File	*fileIncRef(File*);
+int	fileIsDir(File*);
+int	fileIsRoFs(File*);
+int	fileIsRoot(File*);
+int	fileMapBlock(File*, ulong, uchar[VtScoreSize], ulong);
+int	fileMetaFlush(File*, int);
+char	*fileName(File *f);
+File	*fileOpen(Fs*, char*);
+int	fileRead(File*, void *, int, vlong);
+int	fileRemove(File*, char*);
+int	fileSetDir(File*, DirEntry*, char*);
+int	fileSetQidSpace(File*, u64int, u64int);
+int	fileSetSize(File*, uvlong);
+int	fileSync(File*);
+int	fileTruncate(File*, char*);
+File	*fileWalk(File*, char*);
+File	*_fileWalk(File*, char*, int);
+int	fileWalkSources(File*);
+int	fileWrite(File*, void *, int, vlong, char*);

+ 1 - 1
sys/src/cmd/fossil/invariants

@@ -3,7 +3,7 @@ delim $#
 .EN
 .NH 3
 Invariants
-.HP
+.LP
 Reclamation is tricky enough to warrant explicit statement
 of the invariants that are needed and the reasons they are true.
 This section will use the notation