r4685 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl

tfheen at varnish-cache.org tfheen at varnish-cache.org
Mon Apr 19 13:54:33 CEST 2010


Author: tfheen
Date: 2010-04-19 13:54:32 +0200 (Mon, 19 Apr 2010)
New Revision: 4685

Modified:
   branches/2.1/
   branches/2.1/varnish-cache/bin/varnishd/cache_backend.h
   branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c
   branches/2.1/varnish-cache/bin/varnishd/cache_ws.c
   branches/2.1/varnish-cache/bin/varnishd/vparam.h
   branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc
   branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc
   branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc
   branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc
   branches/2.1/varnish-cache/include/vct.h
   branches/2.1/varnish-cache/include/vev.h
   branches/2.1/varnish-cache/lib/libvarnish/tcp.c
   branches/2.1/varnish-cache/lib/libvarnish/vev.c
   branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c
Log:
Merge r4660: Align all workspace allocations on pointer boundaries.

Add plenty of asserts until we see that the world don't end.




Property changes on: branches/2.1
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk:4637,4640,4643-4645,4647-4650,4654-4659
   + /trunk:4637,4640,4643-4645,4647-4650,4654-4660


Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4659
   + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4660


Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4659
   + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4660

Modified: branches/2.1/varnish-cache/bin/varnishd/cache_ws.c
===================================================================
--- branches/2.1/varnish-cache/bin/varnishd/cache_ws.c	2010-04-19 11:49:37 UTC (rev 4684)
+++ branches/2.1/varnish-cache/bin/varnishd/cache_ws.c	2010-04-19 11:54:32 UTC (rev 4685)
@@ -57,13 +57,17 @@
 	    ws->r == NULL ? 0 : pdiff(ws->f, ws->r),
 	    pdiff(ws->s, ws->e));
 	assert(ws->s != NULL);
+	// assert(PAOK(ws->s));
 	assert(ws->e != NULL);
+	// assert(PAOK(ws->e));
 	assert(ws->s < ws->e);
 	assert(ws->f >= ws->s);
 	assert(ws->f <= ws->e);
+	// assert(PAOK(ws->f));
 	if (ws->r) {
 		assert(ws->r > ws->s);
 		assert(ws->r <= ws->e);
+		// assert(PAOK(ws->r));
 	}
 }
 
@@ -77,7 +81,9 @@
 	memset(ws, 0, sizeof *ws);
 	ws->magic = WS_MAGIC;
 	ws->s = space;
+	assert(PAOK(space));
 	ws->e = ws->s + len;
+	assert(PAOK(len));
 	ws->f = ws->s;
 	ws->id = id;
 	WS_Assert(ws);
@@ -101,6 +107,7 @@
 		assert(p < ws->e);
 		ws->f = p;
 	}
+	WS_Assert(ws);
 }
 
 char *
@@ -109,14 +116,18 @@
 	char *r;
 
 	WS_Assert(ws);
+	bytes = PRNDUP(bytes);
+
 	assert(ws->r == NULL);
 	if (ws->f + bytes > ws->e) {
 		ws->overflow++;
+		WS_Assert(ws);
 		return(NULL);
 	}
 	r = ws->f;
 	ws->f += bytes;
 	DSL(0x02, SLT_Debug, 0, "WS_Alloc(%p, %u) = %p", ws, bytes, r);
+	WS_Assert(ws);
 	return (r);
 }
 
@@ -126,11 +137,13 @@
 	unsigned l;
 	char *p;
 
+	WS_Assert(ws);
 	l = strlen(s) + 1;
 	p = WS_Alloc(ws, l);
 	if (p != NULL)
 		memcpy(p, s, l);
 	DSL(0x02, SLT_Debug, 0, "WS_Dup(%p, \"%s\") = %p", ws, s, p);
+	WS_Assert(ws);
 	return (p);
 }
 
@@ -155,16 +168,20 @@
 unsigned
 WS_Reserve(struct ws *ws, unsigned bytes)
 {
-	unsigned b2 = bytes;
+	unsigned b2;
 
 	WS_Assert(ws);
 	assert(ws->r == NULL);
 	if (bytes == 0)
 		b2 = ws->e - ws->f;
+	else
+		b2 = bytes;
+	// b2 = PRNDND(b2);
 	xxxassert(ws->f + b2 <= ws->e);
 	ws->r = ws->f + b2;
 	DSL(0x02, SLT_Debug, 0, "WS_Reserve(%p, %u/%u) = %u",
 	    ws, b2, bytes, pdiff(ws->f, ws->r));
+	WS_Assert(ws);
 	return (pdiff(ws->f, ws->r));
 }
 
@@ -172,12 +189,14 @@
 WS_Release(struct ws *ws, unsigned bytes)
 {
 	WS_Assert(ws);
+	// bytes = PRNDUP(bytes);
 	assert(bytes <= ws->e - ws->f);
 	DSL(0x02, SLT_Debug, 0, "WS_Release(%p, %u)", ws, bytes);
 	assert(ws->r != NULL);
 	assert(ws->f + bytes <= ws->r);
 	ws->f += bytes;
 	ws->r = NULL;
+	WS_Assert(ws);
 }
 
 void
@@ -188,8 +207,10 @@
 	assert(ws->r != NULL);
 	assert(ptr >= ws->f);
 	assert(ptr <= ws->r);
-	ws->f = ptr;
+	// ws->f += PRNDUP(ptr - ws->f);
+	ws->f += (ptr - ws->f);
 	ws->r = NULL;
+	WS_Assert(ws);
 }
 
 #if 0


Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4659
   + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4660


Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4659
   + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4660


Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4659
   + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4660


Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4659
   + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4660


Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4659
   + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4660


Property changes on: branches/2.1/varnish-cache/include/vct.h
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4659
   + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4660


Property changes on: branches/2.1/varnish-cache/include/vev.h
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4659
   + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4660


Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4659
   + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4660


Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4659
   + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4660


Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4659
   + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4660




More information about the varnish-commit mailing list