r3483 - in trunk/varnish-cache: bin/varnishd include lib/libvcl

phk at projects.linpro.no phk at projects.linpro.no
Sun Dec 21 17:19:14 CET 2008


Author: phk
Date: 2008-12-21 17:19:14 +0100 (Sun, 21 Dec 2008)
New Revision: 3483

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_expire.c
   trunk/varnish-cache/include/vcl.h
   trunk/varnish-cache/include/vcl_returns.h
   trunk/varnish-cache/lib/libvcl/vcc_compile.c
   trunk/varnish-cache/lib/libvcl/vcc_compile.h
   trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c
   trunk/varnish-cache/lib/libvcl/vcc_parse.c
   trunk/varnish-cache/lib/libvcl/vcc_token_defs.h
Log:
Move the enum MET/RET macros to vcl.h



Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2008-12-21 16:18:39 UTC (rev 3482)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2008-12-21 16:19:14 UTC (rev 3483)
@@ -54,7 +54,6 @@
 
 #include "libvarnish.h"
 
-#include "vcl_returns.h"
 #include "common.h"
 #include "heritage.h"
 #include "miniobj.h"

Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_expire.c	2008-12-21 16:18:39 UTC (rev 3482)
+++ trunk/varnish-cache/bin/varnishd/cache_expire.c	2008-12-21 16:19:14 UTC (rev 3483)
@@ -60,6 +60,7 @@
 #include "shmlog.h"
 #include "binary_heap.h"
 #include "cache.h"
+#include "vcl.h"
 #include "hash_slinger.h"
 
 /*

Modified: trunk/varnish-cache/include/vcl.h
===================================================================
--- trunk/varnish-cache/include/vcl.h	2008-12-21 16:18:39 UTC (rev 3482)
+++ trunk/varnish-cache/include/vcl.h	2008-12-21 16:19:14 UTC (rev 3483)
@@ -3,7 +3,7 @@
  *
  * NB:  This file is machine generated, DO NOT EDIT!
  *
- * Edit vcc_gen_fixed_token.tcl instead
+ * Edit and run vcc_gen_fixed_token.tcl instead
  */
 
 struct sess;
@@ -13,6 +13,36 @@
 typedef void vcl_fini_f(struct cli *);
 typedef int vcl_func_f(struct sess *sp);
 
+/* VCL Methods */
+#define VCL_MET_RECV		(1 << 0)
+#define VCL_MET_PIPE		(1 << 1)
+#define VCL_MET_PASS		(1 << 2)
+#define VCL_MET_HASH		(1 << 3)
+#define VCL_MET_MISS		(1 << 4)
+#define VCL_MET_HIT		(1 << 5)
+#define VCL_MET_FETCH		(1 << 6)
+#define VCL_MET_DELIVER		(1 << 7)
+#define VCL_MET_PREFETCH	(1 << 8)
+#define VCL_MET_TIMEOUT		(1 << 9)
+#define VCL_MET_DISCARD		(1 << 10)
+#define VCL_MET_ERROR		(1 << 11)
+
+#define VCL_MET_MAX		12
+
+/* VCL Returns */
+#define VCL_RET_ERROR		(1 << 0)
+#define VCL_RET_LOOKUP		(1 << 1)
+#define VCL_RET_HASH		(1 << 2)
+#define VCL_RET_PIPE		(1 << 3)
+#define VCL_RET_PASS		(1 << 4)
+#define VCL_RET_FETCH		(1 << 5)
+#define VCL_RET_DELIVER		(1 << 6)
+#define VCL_RET_DISCARD		(1 << 7)
+#define VCL_RET_KEEP		(1 << 8)
+#define VCL_RET_RESTART		(1 << 9)
+
+#define VCL_RET_MAX		10
+
 struct VCL_conf {
 	unsigned	magic;
 #define VCL_CONF_MAGIC	0x7406c509	/* from /dev/random */

Modified: trunk/varnish-cache/include/vcl_returns.h
===================================================================
--- trunk/varnish-cache/include/vcl_returns.h	2008-12-21 16:18:39 UTC (rev 3482)
+++ trunk/varnish-cache/include/vcl_returns.h	2008-12-21 16:19:14 UTC (rev 3483)
@@ -3,7 +3,7 @@
  *
  * NB:  This file is machine generated, DO NOT EDIT!
  *
- * Edit vcc_gen_fixed_token.tcl instead
+ * Edit and run vcc_gen_fixed_token.tcl instead
  */
 
 #ifdef VCL_RET_MAC
@@ -19,57 +19,31 @@
 VCL_RET_MAC(discard, DISCARD, (1 << 7), 7)
 VCL_RET_MAC(keep, KEEP, (1 << 8), 8)
 VCL_RET_MAC(restart, RESTART, (1 << 9), 9)
-#else
-#define VCL_RET_ERROR  (1 << 0)
-#define VCL_RET_LOOKUP  (1 << 1)
-#define VCL_RET_HASH  (1 << 2)
-#define VCL_RET_PIPE  (1 << 3)
-#define VCL_RET_PASS  (1 << 4)
-#define VCL_RET_FETCH  (1 << 5)
-#define VCL_RET_DELIVER  (1 << 6)
-#define VCL_RET_DISCARD  (1 << 7)
-#define VCL_RET_KEEP  (1 << 8)
-#define VCL_RET_RESTART  (1 << 9)
-#define VCL_RET_MAX 10
 #endif
 
 #ifdef VCL_MET_MAC
-VCL_MET_MAC(recv,RECV,(
-    VCL_RET_ERROR|VCL_RET_PASS|VCL_RET_PIPE|VCL_RET_LOOKUP))
-VCL_MET_MAC(pipe,PIPE,(
-    VCL_RET_ERROR|VCL_RET_PIPE))
-VCL_MET_MAC(pass,PASS,(
-    VCL_RET_ERROR|VCL_RET_RESTART|VCL_RET_PASS))
-VCL_MET_MAC(hash,HASH,(
-    VCL_RET_HASH))
-VCL_MET_MAC(miss,MISS,(
-    VCL_RET_ERROR|VCL_RET_RESTART|VCL_RET_PASS|VCL_RET_FETCH))
-VCL_MET_MAC(hit,HIT,(
-    VCL_RET_ERROR|VCL_RET_RESTART|VCL_RET_PASS|VCL_RET_DELIVER))
-VCL_MET_MAC(fetch,FETCH,(
-    VCL_RET_ERROR|VCL_RET_RESTART|VCL_RET_PASS|VCL_RET_DELIVER))
-VCL_MET_MAC(deliver,DELIVER,(
-    VCL_RET_RESTART|VCL_RET_DELIVER))
-VCL_MET_MAC(prefetch,PREFETCH,(
-    VCL_RET_FETCH|VCL_RET_PASS))
-VCL_MET_MAC(timeout,TIMEOUT,(
-    VCL_RET_FETCH|VCL_RET_DISCARD))
-VCL_MET_MAC(discard,DISCARD,(
-    VCL_RET_DISCARD|VCL_RET_KEEP))
-VCL_MET_MAC(error,ERROR,(
-    VCL_RET_DELIVER))
-#else
-#define VCL_MET_RECV	(1 << 0)
-#define VCL_MET_PIPE	(1 << 1)
-#define VCL_MET_PASS	(1 << 2)
-#define VCL_MET_HASH	(1 << 3)
-#define VCL_MET_MISS	(1 << 4)
-#define VCL_MET_HIT	(1 << 5)
-#define VCL_MET_FETCH	(1 << 6)
-#define VCL_MET_DELIVER	(1 << 7)
-#define VCL_MET_PREFETCH	(1 << 8)
-#define VCL_MET_TIMEOUT	(1 << 9)
-#define VCL_MET_DISCARD	(1 << 10)
-#define VCL_MET_ERROR	(1 << 11)
+VCL_MET_MAC(recv,RECV,
+    (VCL_RET_ERROR|VCL_RET_PASS|VCL_RET_PIPE|VCL_RET_LOOKUP))
+VCL_MET_MAC(pipe,PIPE,
+    (VCL_RET_ERROR|VCL_RET_PIPE))
+VCL_MET_MAC(pass,PASS,
+    (VCL_RET_ERROR|VCL_RET_RESTART|VCL_RET_PASS))
+VCL_MET_MAC(hash,HASH,
+    (VCL_RET_HASH))
+VCL_MET_MAC(miss,MISS,
+    (VCL_RET_ERROR|VCL_RET_RESTART|VCL_RET_PASS|VCL_RET_FETCH))
+VCL_MET_MAC(hit,HIT,
+    (VCL_RET_ERROR|VCL_RET_RESTART|VCL_RET_PASS|VCL_RET_DELIVER))
+VCL_MET_MAC(fetch,FETCH,
+    (VCL_RET_ERROR|VCL_RET_RESTART|VCL_RET_PASS|VCL_RET_DELIVER))
+VCL_MET_MAC(deliver,DELIVER,
+    (VCL_RET_RESTART|VCL_RET_DELIVER))
+VCL_MET_MAC(prefetch,PREFETCH,
+    (VCL_RET_FETCH|VCL_RET_PASS))
+VCL_MET_MAC(timeout,TIMEOUT,
+    (VCL_RET_FETCH|VCL_RET_DISCARD))
+VCL_MET_MAC(discard,DISCARD,
+    (VCL_RET_DISCARD|VCL_RET_KEEP))
+VCL_MET_MAC(error,ERROR,
+    (VCL_RET_DELIVER))
 #endif
-#define N_METHODS 12

Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_compile.c	2008-12-21 16:18:39 UTC (rev 3482)
+++ trunk/varnish-cache/lib/libvcl/vcc_compile.c	2008-12-21 16:19:14 UTC (rev 3483)
@@ -500,7 +500,7 @@
 	assert(tl->ff != NULL);
 
 	/* body code of methods */
-	for (i = 0; i < N_METHODS; i++) {
+	for (i = 0; i < VCL_MET_MAX; i++) {
 		tl->fm[i] = vsb_newauto();
 		assert(tl->fm[i] != NULL);
 	}
@@ -532,7 +532,7 @@
 	vsb_delete(tl->fc);
 	vsb_delete(tl->fi);
 	vsb_delete(tl->ff);
-	for (i = 0; i < N_METHODS; i++)
+	for (i = 0; i < VCL_MET_MAX; i++)
 		vsb_delete(tl->fm[i]);
 
 	free(tl);
@@ -611,7 +611,7 @@
 		return (vcc_DestroyTokenList(tl, NULL));
 
 	/* Emit method functions */
-	for (i = 0; i < N_METHODS; i++) {
+	for (i = 0; i < VCL_MET_MAX; i++) {
 		Fc(tl, 1, "\nstatic int\n");
 		Fc(tl, 1, "VGC_function_%s (struct sess *sp)\n",
 		    method_tab[i].name);

Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.h
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_compile.h	2008-12-21 16:18:39 UTC (rev 3482)
+++ trunk/varnish-cache/lib/libvcl/vcc_compile.h	2008-12-21 16:19:14 UTC (rev 3483)
@@ -31,7 +31,7 @@
 
 #include "vqueue.h"
 
-#include "vcl_returns.h"
+#include "vcl.h"
 
 #define INDENT		2
 
@@ -77,7 +77,7 @@
 	int			findent;
 	unsigned		cnt;
 	struct vsb		*fc, *fh, *fi, *ff, *fb;
-	struct vsb		*fm[N_METHODS];
+	struct vsb		*fm[VCL_MET_MAX];
 	VTAILQ_HEAD(, ref)	refs;
 	struct vsb		*sb;
 	int			err;
@@ -85,7 +85,7 @@
 	int			ndirector;
 	VTAILQ_HEAD(, proc)	procs;
 	struct proc		*curproc;
-	struct proc		*mprocs[N_METHODS];
+	struct proc		*mprocs[VCL_MET_MAX];
 
 	VTAILQ_HEAD(, acl_e)	acl;
 

Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c	2008-12-21 16:18:39 UTC (rev 3482)
+++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c	2008-12-21 16:19:14 UTC (rev 3483)
@@ -3,7 +3,7 @@
  *
  * NB:  This file is machine generated, DO NOT EDIT!
  *
- * Edit vcc_gen_fixed_token.tcl instead
+ * Edit and run vcc_gen_fixed_token.tcl instead
  */
 
 #include "config.h"
@@ -167,14 +167,38 @@
 
 	/* ../../include/vcl.h */
 
-	vsb_cat(sb, "/*\n * $Id: vcc_gen_fixed_token.tcl 3377 2008-11-10 11");
-	vsb_cat(sb, ":55:15Z tfheen $\n *\n * NB:  This file is machine gen");
-	vsb_cat(sb, "erated, DO NOT EDIT!\n *\n * Edit vcc_gen_fixed_token.");
-	vsb_cat(sb, "tcl instead\n */\n\nstruct sess;\n");
+	vsb_cat(sb, "/*\n * $Id: vcc_gen_fixed_token.tcl 3482 2008-12-21 16");
+	vsb_cat(sb, ":18:39Z phk $\n *\n * NB:  This file is machine genera");
+	vsb_cat(sb, "ted, DO NOT EDIT!\n *\n * Edit and run vcc_gen_fixed_t");
+	vsb_cat(sb, "oken.tcl instead\n */\n\nstruct sess;\n");
 	vsb_cat(sb, "struct cli;\n\ntypedef void vcl_init_f(struct cli *);\n");
 	vsb_cat(sb, "typedef void vcl_fini_f(struct cli *);\n");
 	vsb_cat(sb, "typedef int vcl_func_f(struct sess *sp);\n");
-	vsb_cat(sb, "\nstruct VCL_conf {\n\tunsigned\tmagic;\n");
+	vsb_cat(sb, "\n/* VCL Methods */\n#define VCL_MET_RECV\t\t(1 << 0)\n");
+	vsb_cat(sb, "#define VCL_MET_PIPE\t\t(1 << 1)\n");
+	vsb_cat(sb, "#define VCL_MET_PASS\t\t(1 << 2)\n");
+	vsb_cat(sb, "#define VCL_MET_HASH\t\t(1 << 3)\n");
+	vsb_cat(sb, "#define VCL_MET_MISS\t\t(1 << 4)\n");
+	vsb_cat(sb, "#define VCL_MET_HIT\t\t(1 << 5)\n");
+	vsb_cat(sb, "#define VCL_MET_FETCH\t\t(1 << 6)\n");
+	vsb_cat(sb, "#define VCL_MET_DELIVER\t\t(1 << 7)\n");
+	vsb_cat(sb, "#define VCL_MET_PREFETCH\t(1 << 8)\n");
+	vsb_cat(sb, "#define VCL_MET_TIMEOUT\t\t(1 << 9)\n");
+	vsb_cat(sb, "#define VCL_MET_DISCARD\t\t(1 << 10)\n");
+	vsb_cat(sb, "#define VCL_MET_ERROR\t\t(1 << 11)\n");
+	vsb_cat(sb, "\n#define VCL_MET_MAX\t\t12\n\n");
+	vsb_cat(sb, "/* VCL Returns */\n#define VCL_RET_ERROR\t\t(1 << 0)\n");
+	vsb_cat(sb, "#define VCL_RET_LOOKUP\t\t(1 << 1)\n");
+	vsb_cat(sb, "#define VCL_RET_HASH\t\t(1 << 2)\n");
+	vsb_cat(sb, "#define VCL_RET_PIPE\t\t(1 << 3)\n");
+	vsb_cat(sb, "#define VCL_RET_PASS\t\t(1 << 4)\n");
+	vsb_cat(sb, "#define VCL_RET_FETCH\t\t(1 << 5)\n");
+	vsb_cat(sb, "#define VCL_RET_DELIVER\t\t(1 << 6)\n");
+	vsb_cat(sb, "#define VCL_RET_DISCARD\t\t(1 << 7)\n");
+	vsb_cat(sb, "#define VCL_RET_KEEP\t\t(1 << 8)\n");
+	vsb_cat(sb, "#define VCL_RET_RESTART\t\t(1 << 9)\n");
+	vsb_cat(sb, "\n#define VCL_RET_MAX\t\t10\n\n");
+	vsb_cat(sb, "struct VCL_conf {\n\tunsigned\tmagic;\n");
 	vsb_cat(sb, "#define VCL_CONF_MAGIC\t0x7406c509\t/* from /dev/rando");
 	vsb_cat(sb, "m */\n\n\tstruct director\t**director;\n");
 	vsb_cat(sb, "\tunsigned\tndirector;\n\tstruct vrt_ref\t*ref;\n");
@@ -223,10 +247,10 @@
 	vsb_cat(sb, " * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWI");
 	vsb_cat(sb, "SE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFT");
 	vsb_cat(sb, "WARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n");
-	vsb_cat(sb, " * SUCH DAMAGE.\n *\n * $Id: vrt.h 3393 2008-11-14 09:");
-	vsb_cat(sb, "49:28Z phk $\n *\n * Runtime support for compiled VCL ");
-	vsb_cat(sb, "programs.\n *\n * XXX: When this file is changed, lib/");
-	vsb_cat(sb, "libvcl/vcc_gen_fixed_token.tcl\n");
+	vsb_cat(sb, " * SUCH DAMAGE.\n *\n * $Id: vrt.h 3406 2008-11-19 14:");
+	vsb_cat(sb, "13:57Z petter $\n *\n * Runtime support for compiled V");
+	vsb_cat(sb, "CL programs.\n *\n * XXX: When this file is changed, l");
+	vsb_cat(sb, "ib/libvcl/vcc_gen_fixed_token.tcl\n");
 	vsb_cat(sb, " * XXX: *MUST* be rerun.\n */\n");
 	vsb_cat(sb, "\nstruct sess;\nstruct vsb;\nstruct cli;\n");
 	vsb_cat(sb, "struct director;\nstruct VCL_conf;\n");
@@ -311,9 +335,9 @@
 
 	/* ../../include/vrt_obj.h */
 
-	vsb_cat(sb, "/*\n * $Id: vcc_gen_obj.tcl 3324 2008-10-18 20:50:10Z ");
-	vsb_cat(sb, "phk $\n *\n * NB:  This file is machine generated, DO ");
-	vsb_cat(sb, "NOT EDIT!\n *\n * Edit vcc_gen_obj.tcl instead\n");
+	vsb_cat(sb, "/*\n * $Id: vrt_obj.h 3406 2008-11-19 14:13:57Z petter");
+	vsb_cat(sb, " $\n *\n * NB:  This file is machine generated, DO NOT");
+	vsb_cat(sb, " EDIT!\n *\n * Edit vcc_gen_obj.tcl instead\n");
 	vsb_cat(sb, " */\n\nstruct sockaddr * VRT_r_client_ip(const struct ");
 	vsb_cat(sb, "sess *);\nstruct sockaddr * VRT_r_server_ip(struct ses");
 	vsb_cat(sb, "s *);\nint VRT_r_server_port(struct sess *);\n");

Modified: trunk/varnish-cache/lib/libvcl/vcc_parse.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_parse.c	2008-12-21 16:18:39 UTC (rev 3482)
+++ trunk/varnish-cache/lib/libvcl/vcc_parse.c	2008-12-21 16:19:14 UTC (rev 3483)
@@ -540,7 +540,7 @@
 
 	m = IsMethod(tl->t);
 	if (m != -1) {
-		assert(m < N_METHODS);
+		assert(m < VCL_MET_MAX);
 		tl->fb = tl->fm[m];
 		if (tl->mprocs[m] == NULL) {
 			tl->mprocs[m] = vcc_AddProc(tl, tl->t);

Modified: trunk/varnish-cache/lib/libvcl/vcc_token_defs.h
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_token_defs.h	2008-12-21 16:18:39 UTC (rev 3482)
+++ trunk/varnish-cache/lib/libvcl/vcc_token_defs.h	2008-12-21 16:19:14 UTC (rev 3483)
@@ -3,7 +3,7 @@
  *
  * NB:  This file is machine generated, DO NOT EDIT!
  *
- * Edit vcc_gen_fixed_token.tcl instead
+ * Edit and run vcc_gen_fixed_token.tcl instead
  */
 
 #define LOW_TOKEN 128



More information about the varnish-commit mailing list