[master] 2637332 Clean out stuff which moved to vmod_vtc
Poul-Henning Kamp
phk at FreeBSD.org
Tue Feb 27 08:13:06 UTC 2018
commit 2637332b602f37d270d92bdc370bbffbf6ed744c
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Feb 27 08:11:40 2018 +0000
Clean out stuff which moved to vmod_vtc
Fixes #2386
diff --git a/lib/libvmod_debug/vmod.vcc b/lib/libvmod_debug/vmod.vcc
index 5933d52..ba5fa94 100644
--- a/lib/libvmod_debug/vmod.vcc
+++ b/lib/libvmod_debug/vmod.vcc
@@ -40,10 +40,6 @@ $Event event_function
You are not supposed to be able to see this text in the .RST
-$Function VOID panic(STRING_LIST)
-
-Don't.
-
$Function STRING author(ENUM { phk, des, kristian, mithrandir } person="phk",
ENUM { phk, slink, geoff } someone='phk')
@@ -65,14 +61,6 @@ $Function STRING test_priv_top(PRIV_TOP, STRING)
Test function for TOP private pointers
-$Function BACKEND no_backend()
-
-Fails at backend selection
-
-$Function STEVEDORE no_stevedore()
-
-Fails at storage selection.
-
$Object obj(STRING string="default", ENUM { one, two, three } number=one)
Test object
@@ -141,10 +129,6 @@ $Function VOID fail()
Function to fail vcl code. (See also: RFC748)
-$Function VOID sleep(DURATION)
-
-Sleep the current worker thread.
-
$Object dyn(STRING addr, STRING port)
Dynamically create a single-backend director, addr and port must not be empty.
@@ -157,33 +141,6 @@ $Method VOID .refresh(STRING addr, STRING port)
Dynamically refresh & (always!) replace the backend by a new one.
-$Function VOID workspace_allocate(ENUM { client, backend, session, thread },
- INT size)
-
-Allocate and zero out SIZE bytes from a workspace.
-If SIZE is negative, all but that many bytes are allocated from the workspace.
-(NB: Beware of the alignment imposed on workspace allocations.)
-
-$Function BOOL workspace_overflowed(ENUM { client, backend, session, thread })
-
-Return if the workspace overflow mark is set or not.
-
-$Function VOID workspace_overflow(ENUM { client, backend, session, thread })
-
-Mark a workspace as overflowed.
-
-$Function INT workspace_free(ENUM { client, backend, session, thread })
-
-Find how much unallocated space there is left in a workspace.
-
-$Function VOID workspace_snap(ENUM { client, backend, session, thread})
-
-Snapshot the named workspace. Only one snapshot may be active at a time.
-
-$Function VOID workspace_reset(ENUM { client, backend, session, thread })
-
-Reset to the previous snapshot of a workspace, taken from debug.workspace_snap.
-
$Function VOID vcl_release_delay(DURATION)
Hold a reference to the VCL when it goes cold for the given delay.
@@ -192,28 +149,10 @@ $Function BOOL match_acl(ACL acl, IP ip)
Perform an IP match against a named ACL.
-$Function BOOL barrier_sync(STRING)
-
-Synchronize with a varnishtest shared barrier.
-
$Function VOID test_probe(PROBE probe, PROBE same = 0)
Only here to make sure probe definitions are passed properly.
-$Function INT typesize(STRING)
-
-Returns the size in bytes of a collection of C-datatypes.
-
-* 'p' = pointer
-* 'i' = int
-* 'd' = double
-* 'f' = float
-* 'l' = long
-* 's' = short
-* 'z' = size_t
-* 'o' = off_t
-* 'j' = intmax_t
-
$Function VOID vsc_new()
Add a vsc
diff --git a/lib/libvmod_debug/vmod_debug.c b/lib/libvmod_debug/vmod_debug.c
index 8e730dc..5e1c4d7 100644
--- a/lib/libvmod_debug/vmod_debug.c
+++ b/lib/libvmod_debug/vmod_debug.c
@@ -69,20 +69,6 @@ static pthread_mutex_t vsc_mtx = PTHREAD_MUTEX_INITIALIZER;
static struct vsc_seg *vsc_seg;
static struct VSC_debug *vsc;
-VCL_VOID v_matchproto_(td_debug_panic)
-xyzzy_panic(VRT_CTX, const char *str, ...)
-{
- va_list ap;
- const char *b;
-
- CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
- WARN_RETIRED();
- va_start(ap, str);
- b = VRT_String(ctx->ws, "PANIC: ", str, ap);
- va_end(ap);
- VAS_Fail("VCL", "", 0, b, VAS_VCL);
-}
-
VCL_STRING v_matchproto_(td_debug_author)
xyzzy_author(VRT_CTX, VCL_ENUM person, VCL_ENUM someone)
{
@@ -163,24 +149,6 @@ xyzzy_test_priv_vcl(VRT_CTX, struct vmod_priv *priv)
assert(!strcmp(priv_vcl->foo, "FOO"));
}
-VCL_BACKEND
-xyzzy_no_backend(VRT_CTX)
-{
-
- CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
- WARN_RETIRED();
- return (NULL);
-}
-
-VCL_STEVEDORE v_matchproto_(td_debug_no_stevedore)
-xyzzy_no_stevedore(VRT_CTX)
-{
-
- CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
- WARN_RETIRED();
- return (NULL);
-}
-
VCL_VOID v_matchproto_(td_debug_rot52)
xyzzy_rot52(VRT_CTX, VCL_HTTP hp)
{
@@ -368,129 +336,6 @@ event_function(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e)
}
}
-VCL_VOID v_matchproto_(td_debug_sleep)
-xyzzy_sleep(VRT_CTX, VCL_DURATION t)
-{
-
- CHECK_OBJ_ORNULL(ctx, VRT_CTX_MAGIC);
- WARN_RETIRED();
- VTIM_sleep(t);
-}
-
-static struct ws *
-wsfind(VRT_CTX, VCL_ENUM which)
-{
- if (!strcmp(which, "client"))
- return (ctx->ws);
- else if (!strcmp(which, "backend"))
- return (ctx->bo->ws);
- else if (!strcmp(which, "session"))
- return (ctx->req->sp->ws);
- else if (!strcmp(which, "thread"))
- return (ctx->req->wrk->aws);
- else
- WRONG("No such workspace.");
-}
-
-void
-xyzzy_workspace_allocate(VRT_CTX, VCL_ENUM which, VCL_INT size)
-{
- struct ws *ws;
- char *s;
- CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
- WARN_RETIRED();
-
- ws = wsfind(ctx, which);
-
- WS_Assert(ws);
- AZ(ws->r);
-
- if (size < 0) {
- size += WS_Reserve(ws, 0);
- WS_Release(ws, 0);
- }
- if (size <= 0) {
- VRT_fail(ctx, "Attempted negative WS allocation");
- return;
- }
- s = WS_Alloc(ws, size);
- if (!s)
- return;
- memset(s, '\0', size);
-}
-
-VCL_INT
-xyzzy_workspace_free(VRT_CTX, VCL_ENUM which)
-{
- struct ws *ws;
- unsigned u;
-
- CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
- WARN_RETIRED();
-
- ws = wsfind(ctx, which);
-
- WS_Assert(ws);
- u = WS_Reserve(ws, 0);
- WS_Release(ws, 0);
-
- return (u);
-}
-
-VCL_BOOL
-xyzzy_workspace_overflowed(VRT_CTX, VCL_ENUM which)
-{
- struct ws *ws;
- CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
- WARN_RETIRED();
-
- ws = wsfind(ctx, which);
- WS_Assert(ws);
-
- return (WS_Overflowed(ws));
-}
-
-static uintptr_t debug_ws_snap;
-
-void
-xyzzy_workspace_snap(VRT_CTX, VCL_ENUM which)
-{
- struct ws *ws;
- CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
- WARN_RETIRED();
-
- ws = wsfind(ctx, which);
- WS_Assert(ws);
-
- debug_ws_snap = WS_Snapshot(ws);
-}
-
-void
-xyzzy_workspace_reset(VRT_CTX, VCL_ENUM which)
-{
- struct ws *ws;
- CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
- WARN_RETIRED();
-
- ws = wsfind(ctx, which);
- WS_Assert(ws);
-
- WS_Reset(ws, debug_ws_snap);
-}
-
-void
-xyzzy_workspace_overflow(VRT_CTX, VCL_ENUM which)
-{
- struct ws *ws;
- CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
- WARN_RETIRED();
-
- ws = wsfind(ctx, which);
- WS_Assert(ws);
-
- WS_MarkOverflow(ws);
-}
-
VCL_VOID v_matchproto_(td_debug_vcl_release_delay)
xyzzy_vcl_release_delay(VRT_CTX, VCL_DURATION delay)
{
@@ -511,39 +356,6 @@ xyzzy_match_acl(VRT_CTX, VCL_ACL acl, VCL_IP ip)
return (VRT_acl_match(ctx, acl, ip));
}
-VCL_BOOL
-xyzzy_barrier_sync(VRT_CTX, VCL_STRING addr)
-{
- const char *err;
- char buf[32];
- int sock, i;
- ssize_t sz;
-
- CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
- WARN_RETIRED();
- AN(addr);
- AN(*addr);
-
- VSLb(ctx->vsl, SLT_Debug, "barrier_sync(\"%s\")", addr);
- sock = VTCP_open(addr, NULL, 0., &err);
- if (sock < 0) {
- VSLb(ctx->vsl, SLT_Error, "Barrier connection failed: %s", err);
- return (0);
- }
-
- sz = read(sock, buf, sizeof buf);
- i = errno;
- closefd(&sock);
- if (sz == 0)
- return (1);
- if (sz < 0)
- VSLb(ctx->vsl, SLT_Error,
- "Barrier read failed: %s (errno=%d)", strerror(i), i);
- if (sz > 0)
- VSLb(ctx->vsl, SLT_Error, "Barrier unexpected data (%zdB)", sz);
- return (0);
-}
-
VCL_VOID v_matchproto_(td_debug_test_probe)
xyzzy_test_probe(VRT_CTX, VCL_PROBE probe, VCL_PROBE same)
{
@@ -554,31 +366,6 @@ xyzzy_test_probe(VRT_CTX, VCL_PROBE probe, VCL_PROBE same)
AZ(same == NULL || probe == same);
}
-VCL_INT
-xyzzy_typesize(VRT_CTX, VCL_STRING s)
-{
- size_t i = 0;
- const char *p;
-
- WARN_RETIRED();
- (void)ctx;
- for (p = s; *p; p++) {
- switch (*p) {
- case 'p': i += sizeof(void *); break;
- case 'i': i += sizeof(int); break;
- case 'd': i += sizeof(double); break;
- case 'f': i += sizeof(float); break;
- case 'l': i += sizeof(long); break;
- case 's': i += sizeof(short); break;
- case 'z': i += sizeof(size_t); break;
- case 'o': i += sizeof(off_t); break;
- case 'j': i += sizeof(intmax_t); break;
- default: return(-1);
- }
- }
- return ((VCL_INT)i);
-}
-
VCL_VOID
xyzzy_vsc_new(VRT_CTX)
{
More information about the varnish-commit
mailing list