Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
cc4455d0
Commit
cc4455d0
authored
Apr 29, 2019
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move VPI stuff out of VRT
parent
df178b49
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
130 additions
and
89 deletions
+130
-89
Makefile.am
bin/varnishd/Makefile.am
+1
-0
cache_vpi.c
bin/varnishd/cache/cache_vpi.c
+108
-0
cache_vrt_vcl.c
bin/varnishd/cache/cache_vrt_vcl.c
+0
-71
vcc_interface.h
include/vcc_interface.h
+14
-0
vrt.h
include/vrt.h
+0
-13
Makefile.am
lib/libvcc/Makefile.am
+3
-1
generate.py
lib/libvcc/generate.py
+2
-2
vcc_compile.c
lib/libvcc/vcc_compile.c
+1
-1
vcc_parse.c
lib/libvcc/vcc_parse.c
+1
-1
No files found.
bin/varnishd/Makefile.am
View file @
cc4455d0
...
...
@@ -44,6 +44,7 @@ varnishd_SOURCES = \
cache/cache_tcp_pool.c
\
cache/cache_vary.c
\
cache/cache_vcl.c
\
cache/cache_vpi.c
\
cache/cache_vrt.c
\
cache/cache_vrt_filter.c
\
cache/cache_vrt_priv.c
\
...
...
bin/varnishd/cache/cache_vpi.c
0 → 100644
View file @
cc4455d0
/*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2019 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
#include "config.h"
#include "cache_varnishd.h"
#include "vcl.h"
#include "vcc_interface.h"
#include "cache_vcl.h"
/*--------------------------------------------------------------------
* Private & exclusive interfaces between VCC and varnishd
*/
void
VPI_count
(
VRT_CTX
,
unsigned
u
)
{
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
vcl
,
VCL_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
vcl
->
conf
,
VCL_CONF_MAGIC
);
assert
(
u
<
ctx
->
vcl
->
conf
->
nref
);
if
(
ctx
->
vsl
!=
NULL
)
VSLb
(
ctx
->
vsl
,
SLT_VCL_trace
,
"%s %u %u.%u.%u"
,
ctx
->
vcl
->
loaded_name
,
u
,
ctx
->
vcl
->
conf
->
ref
[
u
].
source
,
ctx
->
vcl
->
conf
->
ref
[
u
].
line
,
ctx
->
vcl
->
conf
->
ref
[
u
].
pos
);
else
VSL
(
SLT_VCL_trace
,
0
,
"%s %u %u.%u.%u"
,
ctx
->
vcl
->
loaded_name
,
u
,
ctx
->
vcl
->
conf
->
ref
[
u
].
source
,
ctx
->
vcl
->
conf
->
ref
[
u
].
line
,
ctx
->
vcl
->
conf
->
ref
[
u
].
pos
);
}
VCL_VCL
VPI_vcl_get
(
VRT_CTX
,
const
char
*
name
)
{
VCL_VCL
vcl
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
vcl
=
vcl_find
(
name
);
AN
(
vcl
);
Lck_Lock
(
&
vcl_mtx
);
vcl
->
nrefs
++
;
Lck_Unlock
(
&
vcl_mtx
);
return
(
vcl
);
}
void
VPI_vcl_rel
(
VRT_CTX
,
VCL_VCL
vcl
)
{
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
AN
(
vcl
);
Lck_Lock
(
&
vcl_mtx
);
vcl
->
nrefs
--
;
Lck_Unlock
(
&
vcl_mtx
);
}
void
VPI_vcl_select
(
VRT_CTX
,
VCL_VCL
vcl
)
{
struct
req
*
req
=
ctx
->
req
;
CHECK_OBJ_NOTNULL
(
vcl
,
VCL_MAGIC
);
if
(
IS_TOPREQ
(
req
)
&&
req
->
vcl0
!=
NULL
)
return
;
// Illega, req-FSM will fail this later.
VCL_TaskLeave
(
req
->
vcl
,
req
->
privs
);
if
(
IS_TOPREQ
(
req
))
{
req
->
vcl0
=
req
->
vcl
;
req
->
vcl
=
NULL
;
}
else
{
VCL_Rel
(
&
req
->
vcl
);
}
vcl_get
(
&
req
->
vcl
,
vcl
);
VSLb
(
ctx
->
req
->
vsl
,
SLT_VCL_use
,
"%s via %s"
,
req
->
vcl
->
loaded_name
,
vcl
->
loaded_name
);
VCL_TaskEnter
(
req
->
vcl
,
req
->
privs
);
}
bin/varnishd/cache/cache_vrt_vcl.c
View file @
cc4455d0
...
...
@@ -38,8 +38,6 @@
#include "vcl.h"
#include "vtim.h"
#include "vcc_interface.h"
#include "cache_director.h"
#include "cache_vcl.h"
...
...
@@ -324,75 +322,6 @@ VCL_DefaultProbe(const struct vcl *vcl)
return
(
vcl
->
conf
->
default_probe
);
}
/*--------------------------------------------------------------------
* VRT apis relating to VCL's as VCLS.
*/
void
VRT_count
(
VRT_CTX
,
unsigned
u
)
{
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
vcl
,
VCL_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
vcl
->
conf
,
VCL_CONF_MAGIC
);
assert
(
u
<
ctx
->
vcl
->
conf
->
nref
);
if
(
ctx
->
vsl
!=
NULL
)
VSLb
(
ctx
->
vsl
,
SLT_VCL_trace
,
"%s %u %u.%u.%u"
,
ctx
->
vcl
->
loaded_name
,
u
,
ctx
->
vcl
->
conf
->
ref
[
u
].
source
,
ctx
->
vcl
->
conf
->
ref
[
u
].
line
,
ctx
->
vcl
->
conf
->
ref
[
u
].
pos
);
else
VSL
(
SLT_VCL_trace
,
0
,
"%s %u %u.%u.%u"
,
ctx
->
vcl
->
loaded_name
,
u
,
ctx
->
vcl
->
conf
->
ref
[
u
].
source
,
ctx
->
vcl
->
conf
->
ref
[
u
].
line
,
ctx
->
vcl
->
conf
->
ref
[
u
].
pos
);
}
VCL_VCL
VPI_vcl_get
(
VRT_CTX
,
const
char
*
name
)
{
VCL_VCL
vcl
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
vcl
=
vcl_find
(
name
);
AN
(
vcl
);
Lck_Lock
(
&
vcl_mtx
);
vcl
->
nrefs
++
;
Lck_Unlock
(
&
vcl_mtx
);
return
(
vcl
);
}
void
VPI_vcl_rel
(
VRT_CTX
,
VCL_VCL
vcl
)
{
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
AN
(
vcl
);
Lck_Lock
(
&
vcl_mtx
);
vcl
->
nrefs
--
;
Lck_Unlock
(
&
vcl_mtx
);
}
void
VPI_vcl_select
(
VRT_CTX
,
VCL_VCL
vcl
)
{
struct
req
*
req
=
ctx
->
req
;
CHECK_OBJ_NOTNULL
(
vcl
,
VCL_MAGIC
);
if
(
IS_TOPREQ
(
req
)
&&
req
->
vcl0
!=
NULL
)
return
;
// Illega, req-FSM will fail this later.
VCL_TaskLeave
(
req
->
vcl
,
req
->
privs
);
if
(
IS_TOPREQ
(
req
))
{
req
->
vcl0
=
req
->
vcl
;
req
->
vcl
=
NULL
;
}
else
{
VCL_Rel
(
&
req
->
vcl
);
}
vcl_get
(
&
req
->
vcl
,
vcl
);
VSLb
(
ctx
->
req
->
vsl
,
SLT_VCL_use
,
"%s via %s"
,
req
->
vcl
->
loaded_name
,
vcl
->
loaded_name
);
VCL_TaskEnter
(
req
->
vcl
,
req
->
privs
);
}
struct
vclref
*
VRT_ref_vcl
(
VRT_CTX
,
const
char
*
desc
)
{
...
...
include/vcc_interface.h
View file @
cc4455d0
...
...
@@ -36,3 +36,17 @@
VCL_VCL
VPI_vcl_get
(
VRT_CTX
,
const
char
*
);
void
VPI_vcl_rel
(
VRT_CTX
,
VCL_VCL
);
void
VPI_vcl_select
(
VRT_CTX
,
VCL_VCL
);
/***********************************************************************
* VPI_count() refers to this structure for coordinates into the VCL source.
*/
struct
vpi_ref
{
unsigned
source
;
unsigned
offset
;
unsigned
line
;
unsigned
pos
;
const
char
*
token
;
};
void
VPI_count
(
VRT_CTX
,
unsigned
);
include/vrt.h
View file @
cc4455d0
...
...
@@ -376,19 +376,6 @@ struct vrt_backend_probe {
VRT_BACKEND_PROBE_FIELDS
(
const
)
};
/***********************************************************************
* VRT_count() refers to this structure for coordinates into the VCL source.
*/
struct
vrt_ref
{
unsigned
source
;
unsigned
offset
;
unsigned
line
;
unsigned
pos
;
const
char
*
token
;
};
void
VRT_count
(
VRT_CTX
,
unsigned
);
/***********************************************************************
* Implementation details of ACLs
...
...
lib/libvcc/Makefile.am
View file @
cc4455d0
...
...
@@ -42,8 +42,10 @@ dist_pkgdata_SCRIPTS = \
## keep in sync with include/Makefile.am
vcc_obj.c
:
\
$(top_srcdir)/lib/libvcc/generate.py
\
$(top_srcdir)/include/vcc_interface.h
\
$(top_srcdir)/include/vdef.h
\
$(top_srcdir)/include/vrt.h
$(top_srcdir)/include/vrt.h
\
$(top_srcdir)/include/vrt_obj.h
mkdir
-p
$(top_builddir)
/include/tbl
@
PYTHON@
$(top_srcdir)
/lib/libvcc/generate.py
\
$(top_srcdir)
$(top_builddir)
...
...
lib/libvcc/generate.py
View file @
cc4455d0
...
...
@@ -651,8 +651,8 @@ struct VCL_conf {
unsigned syntax;
VCL_BACKEND *default_director;
VCL_PROBE default_probe;
int
nref;
const struct v
rt
_ref *ref;
unsigned
nref;
const struct v
pi
_ref *ref;
int nsrc;
const char **srcname;
...
...
lib/libvcc/vcc_compile.c
View file @
cc4455d0
...
...
@@ -243,7 +243,7 @@ EmitCoordinates(const struct vcc *tl, struct vsb *vsb)
VSB_printf
(
vsb
,
"
\n
#define VGC_NREFS %u
\n\n
"
,
tl
->
cnt
+
1
);
VSB_printf
(
vsb
,
"static const struct v
rt
_ref VGC_ref[VGC_NREFS] = {
\n
"
);
VSB_printf
(
vsb
,
"static const struct v
pi
_ref VGC_ref[VGC_NREFS] = {
\n
"
);
lin
=
1
;
pos
=
0
;
sp
=
0
;
...
...
lib/libvcc/vcc_parse.c
View file @
cc4455d0
...
...
@@ -46,7 +46,7 @@ static void vcc_Compound(struct vcc *tl);
} while (0)
#define C(tl, sep) do { \
Fb(tl, 1, "V
RT
_count(ctx, %u)%s\n", ++tl->cnt, sep); \
Fb(tl, 1, "V
PI
_count(ctx, %u)%s\n", ++tl->cnt, sep); \
tl->t->cnt = tl->cnt; \
} while (0)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment