9front - general discussion about 9front
 help / color / mirror / Atom feed
* Re: [9front] Patch to bring 9front venti libventi up to date with 9legacy
@ 2018-09-18 23:36 cinap_lenrek
  2018-09-19  0:34 ` Sean Hinchee
  0 siblings, 1 reply; 12+ messages in thread
From: cinap_lenrek @ 2018-09-18 23:36 UTC (permalink / raw)
  To: 9front

it is as i suspected. that just undoes a fix i did a while ago.
just leave it out.

term% hg log -p /sys/src/cmd/venti/srv/conf.rc
changeset:   6344:95785cc684a7
user:        cinap_lenrek@felloff.net
date:        Sun Jan 28 17:22:00 2018 +0100
summary:     venti/conf: fix padding so we write multiple of sector size

diff -r 12804f5a9a22 -r 95785cc684a7 sys/src/cmd/venti/srv/conf.rc
--- a/sys/src/cmd/venti/srv/conf.rc	Sat Jan 27 23:47:46 2018 +0100
+++ b/sys/src/cmd/venti/srv/conf.rc	Sun Jan 28 17:22:00 2018 +0100
@@ -49,7 +49,7 @@
 	}
 	dd -quiet 1 -bs 1024 -count 8 -if $disk -iseek 248 \
 		>/tmp/_venticonf.old || exit backup
-	dd -quiet 1 -count 2 </dev/zero >> /tmp/venticonf.$pid || exit dd
+	dd -quiet 1 -bs 1024 -count 8 </dev/zero >> /tmp/venticonf.$pid || exit dd
 	dd -quiet 1 -bs 1024 -count 8 -if /tmp/venticonf.$pid \
 		-of $disk -trunc 0 -oseek 248 || exit dd2
 	exit 0

--
cinap


^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: [9front] Patch to bring 9front venti libventi up to date with 9legacy
@ 2018-09-19 12:29 cinap_lenrek
  0 siblings, 0 replies; 12+ messages in thread
From: cinap_lenrek @ 2018-09-19 12:29 UTC (permalink / raw)
  To: 9front

you could, for some parts. but not all. %z for example is 9front
specific (depends on our compiler and libc).

just go over what they changed and then *THINK* if these changes
would be of any use.

as far as i can see, the only relevant changes are the reconnect
stuff, the no NoArchive flag, and the wrapper arround sha1.

right now, value of all this racket is negative. theres no program
using the new functionality in 9front.

--
cinap


^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: [9front] Patch to bring 9front venti libventi up to date with 9legacy
@ 2018-09-19  9:11 cinap_lenrek
  2018-09-19 10:26 ` hiro
  0 siblings, 1 reply; 12+ messages in thread
From: cinap_lenrek @ 2018-09-19  9:11 UTC (permalink / raw)
  To: 9front

what are these changes for? VtEntry oe seems to be unused?

diff -r a3522064f5dc sys/src/libventi/file.c
--- a/sys/src/libventi/file.c	Wed Sep 19 01:11:49 2018 +0200
+++ b/sys/src/libventi/file.c	Tue Sep 18 19:30:23 2018 -0500
@@ -503,6 +503,7 @@
 	VtBlock *b;
 	int type;
 	uchar *score;
+	VtEntry oe;
 
 	switch(p->type){
 	case VtDataType:
@@ -530,6 +531,8 @@
 
 	if(vtglobaltolocal(b->score) != NilBlock)
 		return b;
+	
+	oe = *e;
 
 	/*
 	 * Copy on write.
@@ -597,6 +600,7 @@
 shrinkdepth(VtFile *r, VtBlock *p, VtEntry *e, int depth)
 {
 	VtBlock *b, *nb, *ob, *rb;
+	VtEntry oe;
 
 	assert(ISLOCKED(r));
 	assert(depth <= VtPointerDepth);
@@ -604,6 +608,12 @@
 	rb = vtcacheglobal(r->c, e->score, e->type);
 	if(rb == nil)
 		return -1;
+	
+	/*
+	 * Walk down to the new root block.
+	 * We may stop early, but something is better than nothing.
+	 */
+	oe = *e;
 
 	ob = nil;
 	b = rb;

--
cinap


^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: [9front] Patch to bring 9front venti libventi up to date with 9legacy
@ 2018-09-19  9:08 cinap_lenrek
  0 siblings, 0 replies; 12+ messages in thread
From: cinap_lenrek @ 2018-09-19  9:08 UTC (permalink / raw)
  To: 9front

ape/diff3 --help

--
cinap


^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: [9front] Patch to bring 9front venti libventi up to date with 9legacy
@ 2018-09-18 23:41 cinap_lenrek
  0 siblings, 0 replies; 12+ messages in thread
From: cinap_lenrek @ 2018-09-18 23:41 UTC (permalink / raw)
  To: 9front

maybe a tip. you can use hgfs and try a proper 3-way diff.
that way you do not have to rely on my memory.

--
cinap


^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: [9front] Patch to bring 9front venti libventi up to date with 9legacy
@ 2018-09-17 21:49 cinap_lenrek
  2018-09-18 23:22 ` Sean Hinchee
  0 siblings, 1 reply; 12+ messages in thread
From: cinap_lenrek @ 2018-09-17 21:49 UTC (permalink / raw)
  To: 9front

this undoes a bunch of bugfixes.

- %z format was changed to %Z because %z is used for pointer diff (our 6c yiels vlong there)

-	dd -quiet 1 -bs 1024 -count 8 </dev/zero >> /tmp/venticonf.$pid || exit dd
+	dd -quiet 1 -count 2 </dev/zero >> /tmp/venticonf.$pid || exit dd

this is suspect, there was a bug there with devfs which doesnt allow unaligned
writes. please check if thats not broken.

+	sha1.$O\

missing the file?

--
cinap


^ permalink raw reply	[flat|nested] 12+ messages in thread
* [9front] Patch to bring 9front venti libventi up to date with 9legacy
@ 2018-09-17 20:54 Sean Hinchee
  0 siblings, 0 replies; 12+ messages in thread
From: Sean Hinchee @ 2018-09-17 20:54 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 194 bytes --]

All,

Attached is a patch to bring venti, libventi, and the affected manual
up to date with some changes in 9legacy.

This should not break anything existing as far as I can tell.

Cheers,
Sean

[-- Attachment #2: ventiupdate.diff --]
[-- Type: text/x-patch, Size: 8856 bytes --]

diff -r 6223c291c7b7 sys/include/venti.h
--- a/sys/include/venti.h	Mon Sep 17 18:09:33 2018 +0200
+++ b/sys/include/venti.h	Mon Sep 17 15:51:53 2018 -0500
@@ -134,7 +134,8 @@
 	_VtEntryDir = 1<<1,		/* a directory */
 	_VtEntryDepthShift = 2,		/* shift for pointer depth */
 	_VtEntryDepthMask = 7<<2,	/* mask for pointer depth */
-	VtEntryLocal = 1<<5		/* for local storage only */
+	VtEntryLocal = 1<<5,		/* for local storage only */
+	VtEntryNoArchive = 1<<6		/* for local storage only */
 };
 enum
 {
@@ -334,7 +335,9 @@
 };
 
 VtConn*	vtconn(int infd, int outfd);
+int	vtreconn(VtConn*, int, int);
 VtConn*	vtdial(char*);
+int	vtredial(VtConn*, char*);
 void	vtfreeconn(VtConn*);
 int	vtsend(VtConn*, Packet*);
 Packet*	vtrecv(VtConn*);
@@ -378,6 +381,10 @@
 int	vtsync(VtConn*);
 int	vtping(VtConn*);
 
+/* sha1 */
+void	vtsha1(uchar score[VtScoreSize], uchar*, int);
+int	vtsha1check(uchar score[VtScoreSize], uchar*, int);
+
 /*
  * Data blocks and block cache.
  */
diff -r 6223c291c7b7 sys/man/2/venti-conn
--- a/sys/man/2/venti-conn	Mon Sep 17 18:09:33 2018 +0200
+++ b/sys/man/2/venti-conn	Mon Sep 17 15:51:53 2018 -0500
@@ -28,9 +28,15 @@
 VtConn*	vtconn(int infd, int outfd)
 .PP
 .B
+int	vtreconn(VtConn *z, int infd, int outfd)
+.PP
+.B
 VtConn*	vtdial(char *addr)
 .PP
 .B
+int	vtredial(VtConn *z, char *addr)
+.PP
+.B
 int	vtversion(VtConn *z)
 .PP
 .B
diff -r 6223c291c7b7 sys/src/cmd/venti/copy.c
--- a/sys/src/cmd/venti/copy.c	Mon Sep 17 18:09:33 2018 +0200
+++ b/sys/src/cmd/venti/copy.c	Mon Sep 17 15:51:53 2018 -0500
@@ -122,7 +122,7 @@
 		break;
 
 	case VtDirType:
-		for(i=0; i<n/VtEntrySize; i++){
+		for(i=0; i*VtEntrySize<n; i++){
 			if(vtentryunpack(&e, buf, i) < 0){
 				fprint(2, "warning: could not unpack entry #%d in %V %d\n", i, score, type);
 				continue;
diff -r 6223c291c7b7 sys/src/cmd/venti/srv/arenas.c
--- a/sys/src/cmd/venti/srv/arenas.c	Mon Sep 17 18:09:33 2018 +0200
+++ b/sys/src/cmd/venti/srv/arenas.c	Mon Sep 17 15:51:53 2018 -0500
@@ -15,7 +15,8 @@
 
 enum
 {
-	AHashSize	= 512
+	AHashSize	= 512,
+	Emergency	= 0,		/* flag: performing emergency surgery */
 };
 
 static AHash	*ahash[AHashSize];
@@ -142,8 +143,11 @@
 	ap->narenas = amn.n;
 	ap->map = amn.map;
 	if(okamap(ap->map, ap->narenas, ap->arenabase, ap->size, "arena table") < 0){
-		freearenapart(ap, 0);
-		return nil;
+		if(!Emergency){
+			freearenapart(ap, 0);
+			return nil;
+		}
+		/* else keep on, for emergency use */
 	}
 
 	ap->arenas = MKNZ(Arena*, ap->narenas);
@@ -152,8 +156,14 @@
 		ap->arenas[i] = initarena(part, ap->map[i].start, ap->map[i].stop - ap->map[i].start, ap->blocksize);
 		if(ap->arenas[i] == nil){
 			seterr(ECorrupt, "%s: %r", ap->map[i].name);
-			freearenapart(ap, 1);
-			return nil;
+			if(!Emergency){
+				freearenapart(ap, 1);
+				return nil;
+			}else{
+				/* keep on, for emergency use */
+				ap->narenas = i;
+				break;
+			}
 		}
 		if(namecmp(ap->map[i].name, ap->arenas[i]->name) != 0){
 			seterr(ECorrupt, "arena name mismatches with expected name: %s vs. %s",
diff -r 6223c291c7b7 sys/src/cmd/venti/srv/buildindex.c
--- a/sys/src/cmd/venti/srv/buildindex.c	Mon Sep 17 18:09:33 2018 +0200
+++ b/sys/src/cmd/venti/srv/buildindex.c	Mon Sep 17 15:51:53 2018 -0500
@@ -813,7 +813,7 @@
 	}
 	if (nbuf == 0) {
 		fprint(2, "%s: brand-new index, no work to do\n", argv0);
-		exits(0);
+		threadexitsall(0);
 	}
 
 	/* size buffer to use extra memory */
diff -r 6223c291c7b7 sys/src/cmd/venti/srv/conf.rc
--- a/sys/src/cmd/venti/srv/conf.rc	Mon Sep 17 18:09:33 2018 +0200
+++ b/sys/src/cmd/venti/srv/conf.rc	Mon Sep 17 15:51:53 2018 -0500
@@ -49,7 +49,7 @@
 	}
 	dd -quiet 1 -bs 1024 -count 8 -if $disk -iseek 248 \
 		>/tmp/_venticonf.old || exit backup
-	dd -quiet 1 -bs 1024 -count 8 </dev/zero >> /tmp/venticonf.$pid || exit dd
+	dd -quiet 1 -count 2 </dev/zero >> /tmp/venticonf.$pid || exit dd
 	dd -quiet 1 -bs 1024 -count 8 -if /tmp/venticonf.$pid \
 		-of $disk -trunc 0 -oseek 248 || exit dd2
 	exit 0
diff -r 6223c291c7b7 sys/src/cmd/venti/srv/config.c
--- a/sys/src/cmd/venti/srv/config.c	Mon Sep 17 18:09:33 2018 +0200
+++ b/sys/src/cmd/venti/srv/config.c	Mon Sep 17 15:51:53 2018 -0500
@@ -177,6 +177,10 @@
 			}
 			config->vaddr = estrdup(flds[1]);
 		}else{
+			/*
+			 * this is insanely paranoid.  a single typo should not
+			 * prevent venti from starting.
+			 */
 			seterr(EAdmin, "illegal line '%s' in configuration file %s", line, file);
 			break;
 		}
diff -r 6223c291c7b7 sys/src/cmd/venti/srv/dat.h
--- a/sys/src/cmd/venti/srv/dat.h	Mon Sep 17 18:09:33 2018 +0200
+++ b/sys/src/cmd/venti/srv/dat.h	Mon Sep 17 15:51:53 2018 -0500
@@ -48,7 +48,7 @@
 	MaxIo			= 64*1024,	/* max size of a single read or write operation */
 	ICacheBits		= 16,		/* default bits for indexing icache */
 	MaxAMap			= 31*1024,	/* max. allowed arenas in an address mapping; must be < 32*1024 */
-	Unspecified		= ~0ul,
+	Unspecified		= TWID32,
 
 	/*
 	 * return codes from syncarena
diff -r 6223c291c7b7 sys/src/cmd/venti/srv/fixarenas.c
--- a/sys/src/cmd/venti/srv/fixarenas.c	Mon Sep 17 18:09:33 2018 +0200
+++ b/sys/src/cmd/venti/srv/fixarenas.c	Mon Sep 17 15:51:53 2018 -0500
@@ -61,7 +61,7 @@
  * Format number in simplest way that is okay with unittoull.
  */
 static int
-Zfmt(Fmt *fmt)
+zfmt(Fmt *fmt)
 {
 	vlong x;
 	
@@ -130,12 +130,12 @@
 	int i, j, k, n;
 
 	if(offset >= partend){
-		memset(buf, 0xFB, sizeof buf);
+		memset(buf, 0xFB, len);
 		return buf;
 	}
 	
 	if(offset+len > partend){
-		memset(buf, 0xFB, sizeof buf);
+		memset(buf, 0xFB, len);
 		len = partend - offset;
 	}
 
@@ -1894,7 +1894,7 @@
 	file = argv[0];
 	
 	ventifmtinstall();
-	fmtinstall('Z', Zfmt);
+	fmtinstall('z', zfmt);
 	fmtinstall('t', tfmt);
 	quotefmtinstall();
 	
diff -r 6223c291c7b7 sys/src/cmd/venti/srv/unwhack.c
--- a/sys/src/cmd/venti/srv/unwhack.c	Mon Sep 17 18:09:33 2018 +0200
+++ b/sys/src/cmd/venti/srv/unwhack.c	Mon Sep 17 15:51:53 2018 -0500
@@ -156,8 +156,7 @@
 		off++;
 
 		if(off > d - dst){
-			snprint(uw->err, WhackErrLen, "offset out of range: off=%d d=%zd len=%d nbits=%d",
-				off, d - dst, len, uwnbits);
+			snprint(uw->err, WhackErrLen, "offset out of range: off=%d d=%zd len=%d nbits=%d", off, d - dst, len, uwnbits);
 			return -1;
 		}
 		if(d + len > dmax){
diff -r 6223c291c7b7 sys/src/libventi/conn.c
--- a/sys/src/libventi/conn.c	Mon Sep 17 18:09:33 2018 +0200
+++ b/sys/src/libventi/conn.c	Mon Sep 17 15:51:53 2018 -0500
@@ -27,6 +27,28 @@
 	return z;
 }
 
+int
+vtreconn(VtConn *z, int infd, int outfd)
+{
+	NetConnInfo *nci;
+
+	z->state = VtStateAlloc;
+	if(z->infd >= 0)
+		close(z->infd);
+	z->infd = infd;
+	if(z->outfd >= 0)
+		close(z->outfd);
+	z->outfd = outfd;
+	nci = getnetconninfo(nil, infd);
+	if(nci == nil)
+		snprint(z->addr, sizeof z->addr, "/dev/fd/%d", infd);
+	else{
+		strecpy(z->addr, z->addr+sizeof z->addr, nci->raddr);
+		freenetconninfo(nci);
+	}
+	return 0;
+}
+
 void
 vtfreeconn(VtConn *z)
 {
diff -r 6223c291c7b7 sys/src/libventi/dial.c
--- a/sys/src/libventi/dial.c	Mon Sep 17 18:09:33 2018 +0200
+++ b/sys/src/libventi/dial.c	Mon Sep 17 15:51:53 2018 -0500
@@ -23,3 +23,21 @@
 		strecpy(z->addr, z->addr+sizeof z->addr, na);
 	return z;
 }
+
+int
+vtredial(VtConn *z, char *addr)
+{
+	char *na;
+	int fd;
+
+	if(addr == nil)
+		addr = getenv("venti");
+	if(addr == nil)
+		addr = "$venti";
+
+	na = netmkaddr(addr, "tcp", "venti");
+	if((fd = dial(na, nil, nil, nil)) < 0)
+		return fd;
+
+	return vtreconn(z, fd, fd);
+}
diff -r 6223c291c7b7 sys/src/libventi/file.c
--- a/sys/src/libventi/file.c	Mon Sep 17 18:09:33 2018 +0200
+++ b/sys/src/libventi/file.c	Mon Sep 17 15:51:53 2018 -0500
@@ -503,6 +503,7 @@
 	VtBlock *b;
 	int type;
 	uchar *score;
+	VtEntry oe;
 
 	switch(p->type){
 	case VtDataType:
@@ -530,6 +531,8 @@
 
 	if(vtglobaltolocal(b->score) != NilBlock)
 		return b;
+	
+	oe = *e;
 
 	/*
 	 * Copy on write.
@@ -597,6 +600,7 @@
 shrinkdepth(VtFile *r, VtBlock *p, VtEntry *e, int depth)
 {
 	VtBlock *b, *nb, *ob, *rb;
+	VtEntry oe;
 
 	assert(ISLOCKED(r));
 	assert(depth <= VtPointerDepth);
@@ -604,6 +608,12 @@
 	rb = vtcacheglobal(r->c, e->score, e->type);
 	if(rb == nil)
 		return -1;
+	
+	/*
+	 * Walk down to the new root block.
+	 * We may stop early, but something is better than nothing.
+	 */
+	oe = *e;
 
 	ob = nil;
 	b = rb;
diff -r 6223c291c7b7 sys/src/libventi/mkfile
--- a/sys/src/libventi/mkfile	Mon Sep 17 18:09:33 2018 +0200
+++ b/sys/src/libventi/mkfile	Mon Sep 17 15:51:53 2018 -0500
@@ -24,6 +24,7 @@
 	scorefmt.$O\
 	send.$O\
 	server.$O\
+	sha1.$O\
 	srvhello.$O\
 	strdup.$O\
 	string.$O\
diff -r 6223c291c7b7 sys/src/libventi/rpc.c
--- a/sys/src/libventi/rpc.c	Mon Sep 17 18:09:33 2018 +0200
+++ b/sys/src/libventi/rpc.c	Mon Sep 17 15:51:53 2018 -0500
@@ -37,7 +37,6 @@
 	uchar tag, buf[2], *top;
 	Rwait *r, *rr;
 
- 
 	if(z == nil){
 		werrstr("not connected");
 		packetfree(p);

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-09-19 12:29 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-18 23:36 [9front] Patch to bring 9front venti libventi up to date with 9legacy cinap_lenrek
2018-09-19  0:34 ` Sean Hinchee
2018-09-19  6:55   ` hiro
2018-09-19  7:00     ` hiro
  -- strict thread matches above, loose matches on Subject: below --
2018-09-19 12:29 cinap_lenrek
2018-09-19  9:11 cinap_lenrek
2018-09-19 10:26 ` hiro
2018-09-19  9:08 cinap_lenrek
2018-09-18 23:41 cinap_lenrek
2018-09-17 21:49 cinap_lenrek
2018-09-18 23:22 ` Sean Hinchee
2018-09-17 20:54 Sean Hinchee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).