r3675 - in branches/2.0/varnish-cache: bin/varnishd include lib/libvcl

tfheen at projects.linpro.no tfheen at projects.linpro.no
Fri Feb 6 15:04:08 CET 2009


Author: tfheen
Date: 2009-02-06 15:04:08 +0100 (Fri, 06 Feb 2009)
New Revision: 3675

Modified:
   branches/2.0/varnish-cache/bin/varnishd/cache.h
   branches/2.0/varnish-cache/bin/varnishd/cache_expire.c
   branches/2.0/varnish-cache/include/vcl.h
   branches/2.0/varnish-cache/include/vcl_returns.h
   branches/2.0/varnish-cache/lib/libvcl/vcc_compile.c
   branches/2.0/varnish-cache/lib/libvcl/vcc_compile.h
   branches/2.0/varnish-cache/lib/libvcl/vcc_fixed_token.c
   branches/2.0/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl
   branches/2.0/varnish-cache/lib/libvcl/vcc_parse.c
   branches/2.0/varnish-cache/lib/libvcl/vcc_token_defs.h
Log:
Merge r3482+r3483: Move the enum MET/RET macros to vcl.h



Modified: branches/2.0/varnish-cache/bin/varnishd/cache.h
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache.h	2009-02-06 13:55:45 UTC (rev 3674)
+++ branches/2.0/varnish-cache/bin/varnishd/cache.h	2009-02-06 14:04:08 UTC (rev 3675)
@@ -54,7 +54,6 @@
 
 #include "libvarnish.h"
 
-#include "vcl_returns.h"
 #include "common.h"
 #include "heritage.h"
 #include "miniobj.h"

Modified: branches/2.0/varnish-cache/bin/varnishd/cache_expire.c
===================================================================
--- branches/2.0/varnish-cache/bin/varnishd/cache_expire.c	2009-02-06 13:55:45 UTC (rev 3674)
+++ branches/2.0/varnish-cache/bin/varnishd/cache_expire.c	2009-02-06 14:04:08 UTC (rev 3675)
@@ -60,6 +60,7 @@
 #include "shmlog.h"
 #include "binary_heap.h"
 #include "cache.h"
+#include "vcl.h"
 #include "hash_slinger.h"
 
 /*

Modified: branches/2.0/varnish-cache/include/vcl.h
===================================================================
--- branches/2.0/varnish-cache/include/vcl.h	2009-02-06 13:55:45 UTC (rev 3674)
+++ branches/2.0/varnish-cache/include/vcl.h	2009-02-06 14:04:08 UTC (rev 3675)
@@ -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: branches/2.0/varnish-cache/include/vcl_returns.h
===================================================================
--- branches/2.0/varnish-cache/include/vcl_returns.h	2009-02-06 13:55:45 UTC (rev 3674)
+++ branches/2.0/varnish-cache/include/vcl_returns.h	2009-02-06 14:04:08 UTC (rev 3675)
@@ -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: branches/2.0/varnish-cache/lib/libvcl/vcc_compile.c
===================================================================
--- branches/2.0/varnish-cache/lib/libvcl/vcc_compile.c	2009-02-06 13:55:45 UTC (rev 3674)
+++ branches/2.0/varnish-cache/lib/libvcl/vcc_compile.c	2009-02-06 14:04:08 UTC (rev 3675)
@@ -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: branches/2.0/varnish-cache/lib/libvcl/vcc_compile.h
===================================================================
--- branches/2.0/varnish-cache/lib/libvcl/vcc_compile.h	2009-02-06 13:55:45 UTC (rev 3674)
+++ branches/2.0/varnish-cache/lib/libvcl/vcc_compile.h	2009-02-06 14:04:08 UTC (rev 3675)
@@ -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: branches/2.0/varnish-cache/lib/libvcl/vcc_fixed_token.c
===================================================================
--- branches/2.0/varnish-cache/lib/libvcl/vcc_fixed_token.c	2009-02-06 13:55:45 UTC (rev 3674)
+++ branches/2.0/varnish-cache/lib/libvcl/vcc_fixed_token.c	2009-02-06 14:04:08 UTC (rev 3675)
@@ -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"
@@ -169,12 +169,36 @@
 
 	vsb_cat(sb, "/*\n * $Id: vcc_gen_fixed_token.tcl 3601 2009-02-05 10");
 	vsb_cat(sb, ":21:48Z 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, "erated, DO NOT EDIT!\n *\n * Edit and run vcc_gen_fixe");
+	vsb_cat(sb, "d_token.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");
@@ -311,9 +335,9 @@
 
 	/* ../../include/vrt_obj.h */
 
-	vsb_cat(sb, "/*\n * $Id: vrt_obj.h 3616 2009-02-05 11:43:20Z tfheen");
-	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 * $Id: vcc_gen_obj.tcl 3616 2009-02-05 11:43:20Z ");
+	vsb_cat(sb, "tfheen $\n *\n * NB:  This file is machine generated, ");
+	vsb_cat(sb, "DO NOT 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: branches/2.0/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl
===================================================================
--- branches/2.0/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl	2009-02-06 13:55:45 UTC (rev 3674)
+++ branches/2.0/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl	2009-02-06 14:04:08 UTC (rev 3675)
@@ -109,7 +109,7 @@
 	puts $fd " *"
 	puts $fd " * NB:  This file is machine generated, DO NOT EDIT!"
 	puts $fd " *"
-	puts $fd " * Edit vcc_gen_fixed_token.tcl instead"
+	puts $fd " * Edit and run vcc_gen_fixed_token.tcl instead"
 	puts $fd " */"
 	puts $fd ""
 }
@@ -126,6 +126,29 @@
 typedef void vcl_fini_f(struct cli *);
 typedef int vcl_func_f(struct sess *sp);
 }
+
+puts $fo "/* VCL Methods */"
+set u 0
+foreach m $methods {
+	if {[string length [lindex $m 0]] < 8} {
+		set sp "\t"
+	} else {
+		set sp ""
+	}
+	puts $fo "#define VCL_MET_[string toupper [lindex $m 0]]\t${sp}(1 << $u)"
+	incr u
+}
+
+puts $fo "\n#define VCL_MET_MAX\t\t$u\n"
+
+puts $fo "/* VCL Returns */"
+set i 0
+foreach k $returns {
+	puts $fo "#define VCL_RET_[string toupper $k]\t\t(1 << $i)"
+	incr i
+}
+puts $fo "\n#define VCL_RET_MAX\t\t$i\n"
+
 puts $fo "struct VCL_conf {"
 puts $fo {	unsigned	magic;
 #define VCL_CONF_MAGIC	0x7406c509	/* from /dev/random */
@@ -171,13 +194,6 @@
 	}
 	incr i
 }
-puts $for "#else"
-set i 0
-foreach k $returns {
-	puts $for "#define VCL_RET_[string toupper $k]  (1 << $i)"
-	incr i
-}
-puts $for "#define VCL_RET_MAX $i"
 puts $for "#endif"
 puts $for ""
 puts $for "#ifdef VCL_MET_MAC"
@@ -186,7 +202,7 @@
 	puts -nonewline $for "VCL_MET_MAC([lindex $m 0]"
 	puts -nonewline $for ",[string toupper [lindex $m 0]]"
 	set l [lindex $m 1]
-	puts -nonewline $for ",(\n    VCL_RET_[string toupper [lindex $l 0]]"
+	puts -nonewline $for ",\n    (VCL_RET_[string toupper [lindex $l 0]]"
 	foreach r [lrange $l 1 end] {
 		puts -nonewline $for "|VCL_RET_[string toupper $r]"
 	}
@@ -194,14 +210,7 @@
 	puts $for ")"
 	incr u
 }
-puts $for "#else"
-set u 0
-foreach m $methods {
-	puts $for "#define VCL_MET_[string toupper [lindex $m 0]]\t(1 << $u)"
-	incr u
-}
 puts $for "#endif"
-puts $for "#define N_METHODS $u"
 close $for
 
 #----------------------------------------------------------------------

Modified: branches/2.0/varnish-cache/lib/libvcl/vcc_parse.c
===================================================================
--- branches/2.0/varnish-cache/lib/libvcl/vcc_parse.c	2009-02-06 13:55:45 UTC (rev 3674)
+++ branches/2.0/varnish-cache/lib/libvcl/vcc_parse.c	2009-02-06 14:04:08 UTC (rev 3675)
@@ -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: branches/2.0/varnish-cache/lib/libvcl/vcc_token_defs.h
===================================================================
--- branches/2.0/varnish-cache/lib/libvcl/vcc_token_defs.h	2009-02-06 13:55:45 UTC (rev 3674)
+++ branches/2.0/varnish-cache/lib/libvcl/vcc_token_defs.h	2009-02-06 14:04:08 UTC (rev 3675)
@@ -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