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
e8ce24cb
Commit
e8ce24cb
authored
Dec 01, 2021
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Collapse the VFP and VDP filter repository lists to a single list.
parent
e51208cb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
22 deletions
+34
-22
cache_vcl.c
bin/varnishd/cache/cache_vcl.c
+2
-4
cache_vcl.h
bin/varnishd/cache/cache_vcl.h
+1
-2
cache_vrt_filter.c
bin/varnishd/cache/cache_vrt_filter.c
+31
-16
No files found.
bin/varnishd/cache/cache_vcl.c
View file @
e8ce24cb
...
...
@@ -516,8 +516,7 @@ VCL_Close(struct vcl **vclp)
struct
vcl
*
vcl
;
TAKE_OBJ_NOTNULL
(
vcl
,
vclp
,
VCL_MAGIC
);
assert
(
VTAILQ_EMPTY
(
&
vcl
->
vfps
));
assert
(
VTAILQ_EMPTY
(
&
vcl
->
vdps
));
assert
(
VTAILQ_EMPTY
(
&
vcl
->
filters
));
AZ
(
dlclose
(
vcl
->
dlh
));
FREE_OBJ
(
vcl
);
}
...
...
@@ -685,8 +684,7 @@ vcl_load(struct cli *cli,
XXXAN
(
vcl
->
loaded_name
);
VTAILQ_INIT
(
&
vcl
->
director_list
);
VTAILQ_INIT
(
&
vcl
->
ref_list
);
VTAILQ_INIT
(
&
vcl
->
vfps
);
VTAILQ_INIT
(
&
vcl
->
vdps
);
VTAILQ_INIT
(
&
vcl
->
filters
);
vcl
->
temp
=
VCL_TEMP_INIT
;
...
...
bin/varnishd/cache/cache_vcl.h
View file @
e8ce24cb
...
...
@@ -55,8 +55,7 @@ struct vcl {
int
nrefs
;
struct
vcl
*
label
;
int
nlabels
;
struct
vfilter_head
vfps
;
struct
vfilter_head
vdps
;
struct
vfilter_head
filters
;
};
struct
vclref
{
...
...
bin/varnishd/cache/cache_vrt_filter.c
View file @
e8ce24cb
...
...
@@ -57,17 +57,14 @@ struct vfilter {
VTAILQ_ENTRY
(
vfilter
)
list
;
};
static
struct
vfilter_head
vfp_filters
=
VTAILQ_HEAD_INITIALIZER
(
vfp_filters
);
static
struct
vfilter_head
vdp_filters
=
VTAILQ_HEAD_INITIALIZER
(
vdp_filters
);
static
struct
vfilter_head
vrt_filters
=
VTAILQ_HEAD_INITIALIZER
(
vrt_filters
);
void
VRT_AddVFP
(
VRT_CTX
,
const
struct
vfp
*
filter
)
{
struct
vfilter
*
vp
;
struct
vfilter_head
*
hd
=
&
v
fp
_filters
;
struct
vfilter_head
*
hd
=
&
v
rt
_filters
;
CHECK_OBJ_ORNULL
(
ctx
,
VRT_CTX_MAGIC
);
AN
(
filter
);
...
...
@@ -75,14 +72,18 @@ VRT_AddVFP(VRT_CTX, const struct vfp *filter)
AN
(
*
filter
->
name
);
VTAILQ_FOREACH
(
vp
,
hd
,
list
)
{
if
(
vp
->
vfp
==
NULL
)
continue
;
xxxassert
(
vp
->
vfp
!=
filter
);
xxxassert
(
strcasecmp
(
vp
->
name
,
filter
->
name
));
}
if
(
ctx
!=
NULL
)
{
ASSERT_CLI
();
CHECK_OBJ_NOTNULL
(
ctx
->
vcl
,
VCL_MAGIC
);
hd
=
&
ctx
->
vcl
->
vfp
s
;
hd
=
&
ctx
->
vcl
->
filter
s
;
VTAILQ_FOREACH
(
vp
,
hd
,
list
)
{
if
(
vp
->
vfp
==
NULL
)
continue
;
xxxassert
(
vp
->
vfp
!=
filter
);
xxxassert
(
strcasecmp
(
vp
->
name
,
filter
->
name
));
}
...
...
@@ -99,7 +100,7 @@ void
VRT_AddVDP
(
VRT_CTX
,
const
struct
vdp
*
filter
)
{
struct
vfilter
*
vp
;
struct
vfilter_head
*
hd
=
&
v
dp
_filters
;
struct
vfilter_head
*
hd
=
&
v
rt
_filters
;
CHECK_OBJ_ORNULL
(
ctx
,
VRT_CTX_MAGIC
);
AN
(
filter
);
...
...
@@ -107,14 +108,18 @@ VRT_AddVDP(VRT_CTX, const struct vdp *filter)
AN
(
*
filter
->
name
);
VTAILQ_FOREACH
(
vp
,
hd
,
list
)
{
if
(
vp
->
vdp
==
NULL
)
continue
;
xxxassert
(
vp
->
vdp
!=
filter
);
xxxassert
(
strcasecmp
(
vp
->
name
,
filter
->
name
));
}
if
(
ctx
!=
NULL
)
{
ASSERT_CLI
();
CHECK_OBJ_NOTNULL
(
ctx
->
vcl
,
VCL_MAGIC
);
hd
=
&
ctx
->
vcl
->
vdp
s
;
hd
=
&
ctx
->
vcl
->
filter
s
;
VTAILQ_FOREACH
(
vp
,
hd
,
list
)
{
if
(
vp
->
vdp
==
NULL
)
continue
;
xxxassert
(
vp
->
vdp
!=
filter
);
xxxassert
(
strcasecmp
(
vp
->
name
,
filter
->
name
));
}
...
...
@@ -135,7 +140,7 @@ VRT_RemoveVFP(VRT_CTX, const struct vfp *filter)
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
vcl
,
VCL_MAGIC
);
hd
=
&
ctx
->
vcl
->
vfp
s
;
hd
=
&
ctx
->
vcl
->
filter
s
;
AN
(
filter
);
AN
(
filter
->
name
);
AN
(
*
filter
->
name
);
...
...
@@ -159,7 +164,7 @@ VRT_RemoveVDP(VRT_CTX, const struct vdp *filter)
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
vcl
,
VCL_MAGIC
);
hd
=
&
ctx
->
vcl
->
vdp
s
;
hd
=
&
ctx
->
vcl
->
filter
s
;
AN
(
filter
);
AN
(
filter
->
name
);
AN
(
*
filter
->
name
);
...
...
@@ -179,7 +184,7 @@ static const struct vfilter vfilter_error[1];
// XXX: idea(fgs): Allow filters (...) arguments in the list
static
const
struct
vfilter
*
vcl_filter_list_iter
(
const
struct
vfilter_head
*
h1
,
vcl_filter_list_iter
(
int
want_vfp
,
const
struct
vfilter_head
*
h1
,
const
struct
vfilter_head
*
h2
,
const
char
**
flp
)
{
const
char
*
fl
,
*
q
;
...
...
@@ -201,12 +206,22 @@ vcl_filter_list_iter(const struct vfilter_head *h1,
for
(
q
=
fl
;
*
q
&&
!
vct_isspace
(
*
q
);
q
++
)
continue
;
*
flp
=
q
;
VTAILQ_FOREACH
(
vp
,
h1
,
list
)
VTAILQ_FOREACH
(
vp
,
h1
,
list
)
{
if
(
want_vfp
&&
vp
->
vfp
==
NULL
)
continue
;
else
if
(
!
want_vfp
&&
vp
->
vdp
==
NULL
)
continue
;
if
(
vp
->
nlen
==
q
-
fl
&&
!
memcmp
(
fl
,
vp
->
name
,
vp
->
nlen
))
return
(
vp
);
VTAILQ_FOREACH
(
vp
,
h2
,
list
)
}
VTAILQ_FOREACH
(
vp
,
h2
,
list
)
{
if
(
want_vfp
&&
vp
->
vfp
==
NULL
)
continue
;
else
if
(
!
want_vfp
&&
vp
->
vdp
==
NULL
)
continue
;
if
(
vp
->
nlen
==
q
-
fl
&&
!
memcmp
(
fl
,
vp
->
name
,
vp
->
nlen
))
return
(
vp
);
}
*
flp
=
fl
;
return
(
vfilter_error
);
}
...
...
@@ -220,7 +235,7 @@ VCL_StackVFP(struct vfp_ctx *vc, const struct vcl *vcl, const char *fl)
VSLb
(
vc
->
wrk
->
vsl
,
SLT_Filters
,
"%s"
,
fl
);
while
(
1
)
{
vp
=
vcl_filter_list_iter
(
&
vfp_filters
,
&
vcl
->
vfp
s
,
&
fl
);
vp
=
vcl_filter_list_iter
(
1
,
&
vrt_filters
,
&
vcl
->
filter
s
,
&
fl
);
if
(
vp
==
NULL
)
return
(
0
);
if
(
vp
==
vfilter_error
)
...
...
@@ -238,7 +253,7 @@ VCL_StackVDP(struct req *req, const struct vcl *vcl, const char *fl)
AN
(
fl
);
VSLb
(
req
->
vsl
,
SLT_Filters
,
"%s"
,
fl
);
while
(
1
)
{
vp
=
vcl_filter_list_iter
(
&
vdp_filters
,
&
vcl
->
vdp
s
,
&
fl
);
vp
=
vcl_filter_list_iter
(
0
,
&
vrt_filters
,
&
vcl
->
filter
s
,
&
fl
);
if
(
vp
==
NULL
)
return
(
0
);
if
(
vp
==
vfilter_error
)
{
...
...
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