Browse Source

Plan 9 from Bell Labs 2007-04-25

David du Colombier 14 years ago
parent
commit
4304f598bc

+ 13 - 13
dist/replica/_plan9.db

@@ -236,9 +236,9 @@
 386/bin/fortune - 775 sys sys 1168402308 67356
 386/bin/fossil - 20000000775 sys sys 1042005470 0
 386/bin/fossil/conf - 775 sys sys 1085077052 1506
-386/bin/fossil/flchk - 775 sys sys 1176520480 239078
-386/bin/fossil/flfmt - 775 sys sys 1176520481 247129
-386/bin/fossil/fossil - 775 sys sys 1176520483 364516
+386/bin/fossil/flchk - 775 sys sys 1177460372 239289
+386/bin/fossil/flfmt - 775 sys sys 1177460373 247308
+386/bin/fossil/fossil - 775 sys sys 1177460374 364762
 386/bin/fossil/last - 775 sys sys 1168402310 63550
 386/bin/freq - 775 sys sys 1168402310 62040
 386/bin/fs - 20000000775 sys sys 954380769 0
@@ -7765,7 +7765,7 @@ sys/man/8/cron - 664 sys sys 1063858596 1867
 sys/man/8/dhcpd - 664 sys sys 1172959497 5572
 sys/man/8/disksim - 664 sys sys 1144150487 1476
 sys/man/8/drawterm - 664 sys sys 1135901219 1741
-sys/man/8/fossilcons - 664 sys sys 1155362671 18291
+sys/man/8/fossilcons - 664 sys sys 1177432029 18368
 sys/man/8/fs - 664 sys sys 1172956177 15086
 sys/man/8/fsconfig - 664 sys sys 1172956534 8878
 sys/man/8/fshalt - 664 sys sys 1173737264 862
@@ -8093,7 +8093,7 @@ sys/src/9/pc/screen.h - 664 sys sys 1147023549 4256
 sys/src/9/pc/sd53c8xx.c - 664 sys sys 1170456695 55276
 sys/src/9/pc/sd53c8xx.n - 664 sys sys 1131290556 12657
 sys/src/9/pc/sdata.c - 664 sys sys 1175564140 52809
-sys/src/9/pc/sdmv50xx.c - 664 sys sys 1167774867 25865
+sys/src/9/pc/sdmv50xx.c - 664 sys sys 1177393607 33810
 sys/src/9/pc/sdmylex.c - 664 sys sys 1171321627 28237
 sys/src/9/pc/sdscsi.c - 664 sys sys 1158889425 7241
 sys/src/9/pc/trap.c - 664 sys sys 1168306369 21848
@@ -8212,7 +8212,7 @@ sys/src/9/port/swap.c - 664 sys sys 1138028310 7019
 sys/src/9/port/sysfile.c - 664 sys sys 1141940070 22192
 sys/src/9/port/sysproc.c - 664 sys sys 1143289632 21534
 sys/src/9/port/systab.h - 664 sys sys 1161222889 3204
-sys/src/9/port/taslock.c - 664 sys sys 1146151714 4536
+sys/src/9/port/taslock.c - 664 sys sys 1177343190 4418
 sys/src/9/port/thwack.c - 664 sys sys 1057323394 7253
 sys/src/9/port/thwack.h - 664 sys sys 1015278340 1792
 sys/src/9/port/tod.c - 664 sys sys 1146746630 5377
@@ -10295,7 +10295,7 @@ sys/src/cmd/fossil/9auth.c - 664 sys sys 1168308062 3960
 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 1045600016 5521
-sys/src/cmd/fossil/9fsys.c - 664 sys sys 1168308072 33424
+sys/src/cmd/fossil/9fsys.c - 664 sys sys 1177432002 33485
 sys/src/cmd/fossil/9lstn.c - 664 sys sys 1147355153 3038
 sys/src/cmd/fossil/9p.c - 664 sys sys 1140010159 22931
 sys/src/cmd/fossil/9ping.c - 664 sys sys 1042005503 1563
@@ -10311,25 +10311,25 @@ sys/src/cmd/fossil/build - 664 sys sys 1042005505 449
 sys/src/cmd/fossil/buildsh - 775 sys sys 1042005505 561
 sys/src/cmd/fossil/bwatch.c - 664 sys sys 1042005505 6754
 sys/src/cmd/fossil/cache.c - 664 sys sys 1176500208 43930
-sys/src/cmd/fossil/check.c - 664 sys sys 1173736846 17436
+sys/src/cmd/fossil/check.c - 664 sys sys 1177432003 17448
 sys/src/cmd/fossil/conf.rc - 775 sys sys 1084333190 1416
-sys/src/cmd/fossil/dat.h - 664 sys sys 1158373945 7622
+sys/src/cmd/fossil/dat.h - 664 sys sys 1177432005 7655
 sys/src/cmd/fossil/deadlock - 775 sys sys 1042005506 413
 sys/src/cmd/fossil/disk.c - 664 sys sys 1158373945 6887
 sys/src/cmd/fossil/dump.c - 664 sys sys 1042005506 1340
 sys/src/cmd/fossil/epoch.c - 664 sys sys 1045600021 997
 sys/src/cmd/fossil/error.c - 664 sys sys 1073851927 1450
 sys/src/cmd/fossil/error.h - 664 sys sys 1073851928 796
-sys/src/cmd/fossil/file.c - 664 sys sys 1139667293 29983
+sys/src/cmd/fossil/file.c - 664 sys sys 1177432003 30146
 sys/src/cmd/fossil/flchk.c - 664 sys sys 1087005592 1771
 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 1139667257 3228
+sys/src/cmd/fossil/fns.h - 664 sys sys 1177432005 3233
 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 1139667263 21572
+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/history - 664 sys sys 1055703793 1400
 sys/src/cmd/fossil/invariants - 664 sys sys 1042005509 4073
@@ -10338,7 +10338,7 @@ sys/src/cmd/fossil/mkfile - 664 sys sys 1139667242 2640
 sys/src/cmd/fossil/nobwatch.c - 664 sys sys 1042005509 329
 sys/src/cmd/fossil/pack.c - 664 sys sys 1061530726 4682
 sys/src/cmd/fossil/periodic.c - 664 sys sys 1061530726 1087
-sys/src/cmd/fossil/source.c - 664 sys sys 1103225456 20229
+sys/src/cmd/fossil/source.c - 664 sys sys 1177432004 20301
 sys/src/cmd/fossil/srcload.c - 664 sys sys 1042005510 4178
 sys/src/cmd/fossil/stdinc.h - 664 sys sys 1042005510 155
 sys/src/cmd/fossil/trunc.c - 664 sys sys 1042005511 280

+ 13 - 13
dist/replica/plan9.db

@@ -236,9 +236,9 @@
 386/bin/fortune - 775 sys sys 1168402308 67356
 386/bin/fossil - 20000000775 sys sys 1042005470 0
 386/bin/fossil/conf - 775 sys sys 1085077052 1506
-386/bin/fossil/flchk - 775 sys sys 1176520480 239078
-386/bin/fossil/flfmt - 775 sys sys 1176520481 247129
-386/bin/fossil/fossil - 775 sys sys 1176520483 364516
+386/bin/fossil/flchk - 775 sys sys 1177460372 239289
+386/bin/fossil/flfmt - 775 sys sys 1177460373 247308
+386/bin/fossil/fossil - 775 sys sys 1177460374 364762
 386/bin/fossil/last - 775 sys sys 1168402310 63550
 386/bin/freq - 775 sys sys 1168402310 62040
 386/bin/fs - 20000000775 sys sys 954380769 0
@@ -7765,7 +7765,7 @@ sys/man/8/cron - 664 sys sys 1063858596 1867
 sys/man/8/dhcpd - 664 sys sys 1172959497 5572
 sys/man/8/disksim - 664 sys sys 1144150487 1476
 sys/man/8/drawterm - 664 sys sys 1135901219 1741
-sys/man/8/fossilcons - 664 sys sys 1155362671 18291
+sys/man/8/fossilcons - 664 sys sys 1177432029 18368
 sys/man/8/fs - 664 sys sys 1172956177 15086
 sys/man/8/fsconfig - 664 sys sys 1172956534 8878
 sys/man/8/fshalt - 664 sys sys 1173737264 862
@@ -8093,7 +8093,7 @@ sys/src/9/pc/screen.h - 664 sys sys 1147023549 4256
 sys/src/9/pc/sd53c8xx.c - 664 sys sys 1170456695 55276
 sys/src/9/pc/sd53c8xx.n - 664 sys sys 1131290556 12657
 sys/src/9/pc/sdata.c - 664 sys sys 1175564140 52809
-sys/src/9/pc/sdmv50xx.c - 664 sys sys 1167774867 25865
+sys/src/9/pc/sdmv50xx.c - 664 sys sys 1177393607 33810
 sys/src/9/pc/sdmylex.c - 664 sys sys 1171321627 28237
 sys/src/9/pc/sdscsi.c - 664 sys sys 1158889425 7241
 sys/src/9/pc/trap.c - 664 sys sys 1168306369 21848
@@ -8212,7 +8212,7 @@ sys/src/9/port/swap.c - 664 sys sys 1138028310 7019
 sys/src/9/port/sysfile.c - 664 sys sys 1141940070 22192
 sys/src/9/port/sysproc.c - 664 sys sys 1143289632 21534
 sys/src/9/port/systab.h - 664 sys sys 1161222889 3204
-sys/src/9/port/taslock.c - 664 sys sys 1146151714 4536
+sys/src/9/port/taslock.c - 664 sys sys 1177343190 4418
 sys/src/9/port/thwack.c - 664 sys sys 1057323394 7253
 sys/src/9/port/thwack.h - 664 sys sys 1015278340 1792
 sys/src/9/port/tod.c - 664 sys sys 1146746630 5377
@@ -10295,7 +10295,7 @@ sys/src/cmd/fossil/9auth.c - 664 sys sys 1168308062 3960
 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 1045600016 5521
-sys/src/cmd/fossil/9fsys.c - 664 sys sys 1168308072 33424
+sys/src/cmd/fossil/9fsys.c - 664 sys sys 1177432002 33485
 sys/src/cmd/fossil/9lstn.c - 664 sys sys 1147355153 3038
 sys/src/cmd/fossil/9p.c - 664 sys sys 1140010159 22931
 sys/src/cmd/fossil/9ping.c - 664 sys sys 1042005503 1563
@@ -10311,25 +10311,25 @@ sys/src/cmd/fossil/build - 664 sys sys 1042005505 449
 sys/src/cmd/fossil/buildsh - 775 sys sys 1042005505 561
 sys/src/cmd/fossil/bwatch.c - 664 sys sys 1042005505 6754
 sys/src/cmd/fossil/cache.c - 664 sys sys 1176500208 43930
-sys/src/cmd/fossil/check.c - 664 sys sys 1173736846 17436
+sys/src/cmd/fossil/check.c - 664 sys sys 1177432003 17448
 sys/src/cmd/fossil/conf.rc - 775 sys sys 1084333190 1416
-sys/src/cmd/fossil/dat.h - 664 sys sys 1158373945 7622
+sys/src/cmd/fossil/dat.h - 664 sys sys 1177432005 7655
 sys/src/cmd/fossil/deadlock - 775 sys sys 1042005506 413
 sys/src/cmd/fossil/disk.c - 664 sys sys 1158373945 6887
 sys/src/cmd/fossil/dump.c - 664 sys sys 1042005506 1340
 sys/src/cmd/fossil/epoch.c - 664 sys sys 1045600021 997
 sys/src/cmd/fossil/error.c - 664 sys sys 1073851927 1450
 sys/src/cmd/fossil/error.h - 664 sys sys 1073851928 796
-sys/src/cmd/fossil/file.c - 664 sys sys 1139667293 29983
+sys/src/cmd/fossil/file.c - 664 sys sys 1177432003 30146
 sys/src/cmd/fossil/flchk.c - 664 sys sys 1087005592 1771
 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 1139667257 3228
+sys/src/cmd/fossil/fns.h - 664 sys sys 1177432005 3233
 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 1139667263 21572
+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/history - 664 sys sys 1055703793 1400
 sys/src/cmd/fossil/invariants - 664 sys sys 1042005509 4073
@@ -10338,7 +10338,7 @@ sys/src/cmd/fossil/mkfile - 664 sys sys 1139667242 2640
 sys/src/cmd/fossil/nobwatch.c - 664 sys sys 1042005509 329
 sys/src/cmd/fossil/pack.c - 664 sys sys 1061530726 4682
 sys/src/cmd/fossil/periodic.c - 664 sys sys 1061530726 1087
-sys/src/cmd/fossil/source.c - 664 sys sys 1103225456 20229
+sys/src/cmd/fossil/source.c - 664 sys sys 1177432004 20301
 sys/src/cmd/fossil/srcload.c - 664 sys sys 1042005510 4178
 sys/src/cmd/fossil/stdinc.h - 664 sys sys 1042005510 155
 sys/src/cmd/fossil/trunc.c - 664 sys sys 1042005511 280

+ 13 - 0
dist/replica/plan9.log

@@ -48461,3 +48461,16 @@
 1177284607 7 c 386/bin/ip/httpd/wikipost - 775 sys sys 1177283321 115228
 1177284607 8 c 386/bin/ip/ipconfig - 775 sys sys 1177283321 158920
 1177284607 9 c 386/lib/libhttpd.a - 664 sys sys 1177283321 99734
+1177444807 0 c sys/man/8/fossilcons - 664 sys sys 1177432029 18368
+1177444807 1 c sys/src/9/pc/sdmv50xx.c - 664 sys sys 1177393607 33810
+1177444807 2 c sys/src/9/port/taslock.c - 664 sys sys 1177343190 4418
+1177444807 3 c sys/src/cmd/fossil/9fsys.c - 664 sys sys 1177432002 33485
+1177444807 4 c sys/src/cmd/fossil/check.c - 664 sys sys 1177432003 17448
+1177444807 5 c sys/src/cmd/fossil/dat.h - 664 sys sys 1177432005 7655
+1177444807 6 c sys/src/cmd/fossil/file.c - 664 sys sys 1177432003 30146
+1177444807 7 c sys/src/cmd/fossil/fns.h - 664 sys sys 1177432005 3233
+1177444807 8 c sys/src/cmd/fossil/fs.c - 664 sys sys 1177432004 21598
+1177444807 9 c sys/src/cmd/fossil/source.c - 664 sys sys 1177432004 20301
+1177461006 0 c 386/bin/fossil/flchk - 775 sys sys 1177460372 239289
+1177461006 1 c 386/bin/fossil/flfmt - 775 sys sys 1177460373 247308
+1177461006 2 c 386/bin/fossil/fossil - 775 sys sys 1177460374 364762

+ 5 - 1
sys/man/8/fossilcons

@@ -219,10 +219,11 @@ con /srv/fscons
 .I name
 ]
 .B epoch
-[
+[[
 .B -ry
 ]
 .I n
+]
 .PP
 [
 .B fsys
@@ -907,6 +908,9 @@ and reclaim the disk space they occupy.
 (The high epoch number is always the epoch of the currently
 active file system.)
 .PP
+With no argument
+.I epoch
+reports the current low and high epoch numbers.
 The command
 ``\fLepoch\fI n''\fR
 is used to propose changing the low epoch to

File diff suppressed because it is too large
+ 520 - 252
sys/src/9/pc/sdmv50xx.c


+ 4 - 0
sys/src/cmd/fossil/9fsys.c

@@ -1009,6 +1009,10 @@ fsysEpoch(Fsys* fsys, int argc, char* argv[])
 
 	vtRLock(fs->elk);
 	consPrint("\tlow %ud hi %ud\n", fs->elo, fs->ehi);
+	if(low == ~(u32int)0){
+		vtRUnlock(fs->elk);
+		return 1;
+	}
 	n = fsysEsearch(fsys->fs, "/archive", low);
 	n += fsysEsearch(fsys->fs, "/snapshot", low);
 	consPrint("\t%d snapshot%s found with epoch < %ud\n", n, n==1 ? "" : "s", low);

+ 4 - 4
sys/src/cmd/fossil/check.c

@@ -412,7 +412,7 @@ openSource(Fsck *chk, Source *s, char *name, uchar *bm, u32int offset,
 	}
 	setBit(bm, offset);
 
-	r = sourceOpen(s, offset, OReadOnly);
+	r = sourceOpen(s, offset, OReadOnly, 0);
 	if(r == nil){
 		warn(chk, "could not open source: %s -> %d: %R", name, offset);
 		goto Err;
@@ -690,7 +690,7 @@ if(0)		fprint(2, "source %V:%d block %d addr %d\n", source->score,
 	for(o=0; o<nb; o++){
 		if(getBit(bm, o))
 			continue;
-		r = sourceOpen(source, o, OReadOnly);
+		r = sourceOpen(source, o, OReadOnly, 0);
 		if(r == nil)
 			continue;
 		warn(chk, "non referenced entry in source %s[%d]", name, o);
@@ -717,8 +717,8 @@ checkDirs(Fsck *chk)
 	Source *r, *mr;
 
 	sourceLock(chk->fs->source, OReadOnly);
-	r = sourceOpen(chk->fs->source, 0, OReadOnly);
-	mr = sourceOpen(chk->fs->source, 1, OReadOnly);
+	r = sourceOpen(chk->fs->source, 0, OReadOnly, 0);
+	mr = sourceOpen(chk->fs->source, 1, OReadOnly, 0);
 	sourceUnlock(chk->fs->source);
 	chkDir(chk, "", r, mr);
 

+ 1 - 0
sys/src/cmd/fossil/dat.h

@@ -113,6 +113,7 @@ struct Entry {
 struct Source {
 	Fs *fs;		/* immutable */
 	int mode;	/* immutable */
+	int issnapshot;	/* immutable */
 	u32int gen;	/* immutable */
 	int dsize;	/* immutable */
 	int dir;	/* immutable */

+ 13 - 9
sys/src/cmd/fossil/file.c

@@ -31,6 +31,7 @@ struct File {
 	File	*down;		/* children */
 
 	int	mode;
+	int	issnapshot;
 };
 
 static int fileMetaFlush2(File*, char*);
@@ -106,6 +107,7 @@ dirLookup(File *f, char *elem)
 			blockPut(b);
 			ff->boff = bo;
 			ff->mode = f->mode;
+			ff->issnapshot = f->issnapshot;
 			return ff;
 		}
 
@@ -139,13 +141,13 @@ fileRoot(Source *r)
 	fs = r->fs;
 	if(!sourceLock(r, -1))
 		return nil;
-	r0 = sourceOpen(r, 0, fs->mode);
+	r0 = sourceOpen(r, 0, fs->mode, 0);
 	if(r0 == nil)
 		goto Err;
-	r1 = sourceOpen(r, 1, fs->mode);
+	r1 = sourceOpen(r, 1, fs->mode, 0);
 	if(r1 == nil)
 		goto Err;
-	r2 = sourceOpen(r, 2, fs->mode);
+	r2 = sourceOpen(r, 2, fs->mode, 0);
 	if(r2 == nil)
 		goto Err;
 
@@ -199,13 +201,13 @@ Err:
 }
 
 static Source *
-fileOpenSource(File *f, u32int offset, u32int gen, int dir, uint mode)
+fileOpenSource(File *f, u32int offset, u32int gen, int dir, uint mode, int issnapshot)
 {
 	Source *r;
 
 	if(!sourceLock(f->source, mode))
 		return nil;
-	r = sourceOpen(f->source, offset, mode);
+	r = sourceOpen(f->source, offset, mode, issnapshot);
 	sourceUnlock(f->source);
 	if(r == nil)
 		return nil;
@@ -265,8 +267,10 @@ _fileWalk(File *f, char *elem, int partial)
 	if(ff == nil)
 		goto Err;
 
-	if(ff->dir.mode & ModeSnapshot)
+	if(ff->dir.mode & ModeSnapshot){
 		ff->mode = OReadOnly;
+		ff->issnapshot = 1;
+	}
 
 	if(partial){
 		/*
@@ -279,12 +283,12 @@ _fileWalk(File *f, char *elem, int partial)
 		 */
 		ff->partial = 1;
 	}else if(ff->dir.mode & ModeDir){
-		ff->source = fileOpenSource(f, ff->dir.entry, ff->dir.gen, 1, ff->mode);
-		ff->msource = fileOpenSource(f, ff->dir.mentry, ff->dir.mgen, 0, ff->mode);
+		ff->source = fileOpenSource(f, ff->dir.entry, ff->dir.gen, 1, ff->mode, ff->issnapshot);
+		ff->msource = fileOpenSource(f, ff->dir.mentry, ff->dir.mgen, 0, ff->mode, ff->issnapshot);
 		if(ff->source == nil || ff->msource == nil)
 			goto Err;
 	}else{
-		ff->source = fileOpenSource(f, ff->dir.entry, ff->dir.gen, 0, ff->mode);
+		ff->source = fileOpenSource(f, ff->dir.entry, ff->dir.gen, 0, ff->mode, ff->issnapshot);
 		if(ff->source == nil)
 			goto Err;
 	}

+ 1 - 1
sys/src/cmd/fossil/fns.h

@@ -1,5 +1,5 @@
 Source* sourceRoot(Fs*, u32int, int);
-Source* sourceOpen(Source*, ulong, 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);

+ 5 - 2
sys/src/cmd/fossil/fs.c

@@ -983,6 +983,7 @@ snapEvent(void *v)
 	u32int now, min;
 	Tm tm;
 	int need;
+	u32int snaplife;
 
 	s = v;
 
@@ -1026,8 +1027,10 @@ snapEvent(void *v)
 	/*
 	 * Snapshot cleanup happens every snaplife or every day.
 	 */
-	if(s->snapLife != ~0
-	&& (s->lastCleanup+s->snapLife < now || s->lastCleanup+24*60 < now)){
+	snaplife = s->snapLife;
+	if(snaplife == ~0)
+		snaplife = 24*60;
+	if(s->lastCleanup+snaplife < now){
 		fsSnapshotCleanup(s->fs, s->snapLife);
 		s->lastCleanup = now;
 	}

+ 7 - 6
sys/src/cmd/fossil/source.c

@@ -14,7 +14,7 @@ static int	sourceGrowDepth(Source*, Block*, Entry*, int);
 #define sourceIsLocked(r)	((r)->b != nil)
 
 static Source *
-sourceAlloc(Fs *fs, Block *b, Source *p, u32int offset, int mode)
+sourceAlloc(Fs *fs, Block *b, Source *p, u32int offset, int mode, int issnapshot)
 {
 	Source *r;
 	int epb;
@@ -84,6 +84,7 @@ sourceAlloc(Fs *fs, Block *b, Source *p, u32int offset, int mode)
 	r = vtMemAllocZ(sizeof(Source));
 	r->fs = fs;
 	r->mode = mode;
+	r->issnapshot = issnapshot;
 	r->dsize = e.dsize;
 	r->gen = e.gen;
 	r->dir = (e.flags & VtEntryDir) != 0;
@@ -130,13 +131,13 @@ sourceRoot(Fs *fs, u32int addr, int mode)
 		return nil;
 	}
 
-	r = sourceAlloc(fs, b, nil, 0, mode);
+	r = sourceAlloc(fs, b, nil, 0, mode, 0);
 	blockPut(b);
 	return r;
 }
 
 Source *
-sourceOpen(Source *r, ulong offset, int mode)
+sourceOpen(Source *r, ulong offset, int mode, int issnapshot)
 {
 	ulong bn;
 	Block *b;
@@ -154,7 +155,7 @@ sourceOpen(Source *r, ulong offset, int mode)
 	b = sourceBlock(r, bn, mode);
 	if(b == nil)
 		return nil;
-	r = sourceAlloc(r->fs, b, r, offset, mode);
+	r = sourceAlloc(r->fs, b, r, offset, mode, issnapshot);
 	blockPut(b);
 	return r;
 }
@@ -234,7 +235,7 @@ Found:
 		}
 	}
 
-	rr = sourceAlloc(r->fs, b, r, offset, OReadWrite);
+	rr = sourceAlloc(r->fs, b, r, offset, OReadWrite, 0);
 	blockPut(b);
 	return rr;
 }
@@ -743,7 +744,7 @@ _sourceBlock(Source *r, ulong bn, int mode, int early, ulong tag)
 	b = sourceLoad(r, &e);
 	if(b == nil)
 		return nil;
-	if(r->mode == OReadOnly && (e.flags & VtEntryNoArchive)){
+	if(r->issnapshot && (e.flags & VtEntryNoArchive)){
 		blockPut(b);
 		vtSetError(ENotArchived);
 		return nil;

Some files were not shown because too many files changed in this diff