Mailing List Archive

r837 - in trunk/varnish-cache: bin/varnishd include
Author: phk
Date: 2006-08-19 22:28:30 +0200 (Sat, 19 Aug 2006)
New Revision: 837

Added:
trunk/varnish-cache/bin/varnishd/mgt_param.c
Modified:
trunk/varnish-cache/bin/varnishd/Makefile.am
trunk/varnish-cache/bin/varnishd/mgt_cli.c
trunk/varnish-cache/bin/varnishd/mgt_cli.h
trunk/varnish-cache/include/cli.h
Log:
Add two new CLI commands: param.set and param.show.

Eliminate requirement that "help" be first, I was just lazy I guess.


Modified: trunk/varnish-cache/bin/varnishd/Makefile.am
===================================================================
--- trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-19 20:16:48 UTC (rev 836)
+++ trunk/varnish-cache/bin/varnishd/Makefile.am 2006-08-19 20:28:30 UTC (rev 837)
@@ -31,6 +31,7 @@
mgt_child.c \
mgt_cli.c \
mgt_event.c \
+ mgt_param.c \
mgt_vcc.c \
rfc2616.c \
shmlog.c \

Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-19 20:16:48 UTC (rev 836)
+++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2006-08-19 20:28:30 UTC (rev 837)
@@ -104,8 +104,8 @@

static struct cli_proto *cli_proto;

+/* XXX: what order should this list be in ? */
static struct cli_proto mgt_cli_proto[] = {
- { CLI_HELP, cli_func_help, NULL }, /* must be first */
{ CLI_PING, cli_func_ping },
{ CLI_SERVER_START, mcf_server_startstop, NULL },
{ CLI_SERVER_STOP, mcf_server_startstop, &cli_proto },
@@ -115,6 +115,9 @@
{ CLI_CONFIG_USE, mcf_config_use, NULL },
{ CLI_CONFIG_DISCARD, mcf_config_discard, NULL },
{ CLI_CONFIG_LIST, mcf_config_list, NULL },
+ { CLI_PARAM_SHOW, mcf_param_show, NULL },
+ { CLI_PARAM_SET, mcf_param_set, NULL },
+ { CLI_HELP, cli_func_help, NULL },
#if 0
{ CLI_SERVER_RESTART },
{ CLI_ZERO },
@@ -163,8 +166,12 @@
}

/* Fixup the entry for 'help' entry */
- assert(!strcmp(cli_proto[0].request, "help"));
- cli_proto[0].priv = cli_proto;
+ for (u = 0; cli_proto[u].request != NULL; u++) {
+ if (!strcmp(cli_proto[u].request, "help")) {
+ cli_proto[u].priv = cli_proto;
+ break;
+ }
+ }
}

/*--------------------------------------------------------------------

Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_cli.h 2006-08-19 20:16:48 UTC (rev 836)
+++ trunk/varnish-cache/bin/varnishd/mgt_cli.h 2006-08-19 20:28:30 UTC (rev 837)
@@ -5,6 +5,10 @@
/* mgt_child.c */
cli_func_t mcf_server_startstop;

+/* mgt_param.c */
+cli_func_t mcf_param_show;
+cli_func_t mcf_param_set;
+
/* mgt_vcc.c */
cli_func_t mcf_config_load;
cli_func_t mcf_config_inline;

Added: trunk/varnish-cache/bin/varnishd/mgt_param.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_param.c 2006-08-19 20:16:48 UTC (rev 836)
+++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2006-08-19 20:28:30 UTC (rev 837)
@@ -0,0 +1,28 @@
+/*
+ * $Id$
+ */
+
+#include <unistd.h>
+
+#include "cli_priv.h"
+#include "mgt.h"
+#include "mgt_cli.h"
+
+void
+mcf_param_show(struct cli *cli, char **av, void *priv)
+{
+
+ (void)cli;
+ (void)av;
+ (void)priv;
+}
+
+void
+mcf_param_set(struct cli *cli, char **av, void *priv)
+{
+
+ (void)cli;
+ (void)av;
+ (void)priv;
+}
+

Modified: trunk/varnish-cache/include/cli.h
===================================================================
--- trunk/varnish-cache/include/cli.h 2006-08-19 20:16:48 UTC (rev 836)
+++ trunk/varnish-cache/include/cli.h 2006-08-19 20:28:30 UTC (rev 837)
@@ -77,6 +77,18 @@
"\tSwitch to the named configuration immediately.", \
1, 1

+#define CLI_PARAM_SHOW \
+ "param.show", \
+ "param.show [<param>]", \
+ "\tShow parameters and their values.", \
+ 0, 1
+
+#define CLI_PARAM_SET \
+ "param.set", \
+ "param.set <param> <value>", \
+ "\tSet parameter value.", \
+ 2,2
+
#define CLI_SERVER_FREEZE \
"server.freeze", \
"server.freeze", \