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
a70d412c
Commit
a70d412c
authored
Jan 31, 2019
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use unique names for the function-container in vmods.
parent
c0903203
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
23 deletions
+22
-23
vclflint.sh
bin/varnishd/vclflint.sh
+3
-2
vrt.h
include/vrt.h
+1
-0
vcc_vmod.c
lib/libvcc/vcc_vmod.c
+2
-2
vmodtool.py
lib/libvcc/vmodtool.py
+16
-19
No files found.
bin/varnishd/vclflint.sh
View file @
a70d412c
#!/bin/sh
#
# Run flexelint on the VCL output
LIBS
=
"-p vmod_path=/home/phk/Varnish/trunk/varnish-cache/lib/libvmod_std/.libs:/home/phk/Varnish/trunk/varnish-cache/lib/libvmod_debug/.libs:/home/phk/Varnish/trunk/varnish-cache/lib/libvmod_directors/.libs:/home/phk/Varnish/trunk/varnish-cache/lib/libvmod_purge/.libs:/home/phk/Varnish/trunk/varnish-cache/lib/libvmod_vtc/.libs:/home/phk/Varnish/trunk/varnish-cache/lib/libvmod_blob/.libs:/home/phk/Varnish/trunk/varnish-cache/lib/libvmod_unix/.libs:/home/phk/Varnish/trunk/varnish-cache/lib/libvmod_proxy/.libs"
if
[
"x
$1
"
=
"x"
]
;
then
./varnishd
-C
-b
localhost
>
/tmp/_.c
./varnishd
$LIBS
-C
-b
localhost
>
/tmp/_.c
elif
[
-f
$1
]
;
then
./varnishd
-C
-f
$1
>
/tmp/_.c
./varnishd
$LIBS
-C
-f
$1
>
/tmp/_.c
else
echo
"usage!"
1>&2
fi
...
...
include/vrt.h
View file @
a70d412c
...
...
@@ -270,6 +270,7 @@ struct vmod_data {
const
char
*
file_id
;
const
char
*
name
;
const
char
*
func_name
;
const
void
*
func
;
int
func_len
;
const
char
*
proto
;
...
...
lib/libvcc/vcc_vmod.c
View file @
a70d412c
...
...
@@ -307,8 +307,8 @@ vcc_ParseImport(struct vcc *tl)
VSB_printf
(
ifp
->
ini
,
"
\t
if (VRT_Vmod_Init(ctx,
\n
"
);
VSB_printf
(
ifp
->
ini
,
"
\t
&VGC_vmod_%.*s,
\n
"
,
PF
(
mod
));
VSB_printf
(
ifp
->
ini
,
"
\t
%u,
\n
"
,
tl
->
vmod_count
++
);
VSB_printf
(
ifp
->
ini
,
"
\t
&
Vmod_%.*s_Func,
\n
"
,
PF
(
mod
)
);
VSB_printf
(
ifp
->
ini
,
"
\t
sizeof(
Vmod_%.*s_Func),
\n
"
,
PF
(
mod
)
);
VSB_printf
(
ifp
->
ini
,
"
\t
&
%s,
\n
"
,
vmd
->
func_name
);
VSB_printf
(
ifp
->
ini
,
"
\t
sizeof(
%s),
\n
"
,
vmd
->
func_name
);
VSB_printf
(
ifp
->
ini
,
"
\t
\"
%.*s
\"
,
\n
"
,
PF
(
mod
));
VSB_printf
(
ifp
->
ini
,
"
\t
"
);
VSB_quote
(
ifp
->
ini
,
fnp
,
-
1
,
VSB_QUOTE_CSTR
);
...
...
lib/libvcc/vmodtool.py
View file @
a70d412c
...
...
@@ -468,7 +468,7 @@ class ProtoType(object):
''' Produce VCL prototype as JSON '''
ll
=
[]
self
.
retval
.
jsonproto
(
ll
)
ll
.
append
(
'
Vmod_
%
s_Func.
%
s'
%
(
self
.
st
.
vcc
.
modname
,
cfunc
))
ll
.
append
(
'
%
s.
%
s'
%
(
self
.
st
.
vcc
.
csn
,
cfunc
))
if
self
.
argstruct
:
ll
.
append
(
self
.
argstructname
())
else
:
...
...
@@ -656,10 +656,7 @@ class EventStanza(Stanza):
fo
.
write
(
"
\t
%
s,
\n
"
%
self
.
event_func
)
def
json
(
self
,
jl
):
jl
.
append
([
"$EVENT"
,
"Vmod_
%
s_Func._event"
%
self
.
vcc
.
modname
])
jl
.
append
([
"$EVENT"
,
"
%
s._event"
%
self
.
vcc
.
csn
])
class
FunctionStanza
(
Stanza
):
...
...
@@ -832,6 +829,7 @@ class vcc(object):
self
.
strict_abi
=
True
self
.
auto_synopsis
=
True
self
.
modname
=
None
self
.
csn
=
None
def
openfile
(
self
,
fn
):
self
.
commit_files
.
append
(
fn
)
...
...
@@ -858,6 +856,7 @@ class vcc(object):
err
(
"Unknown stanza $
%
s"
%
toks
[
0
],
warn
=
False
)
stanzaclass
(
self
,
toks
,
docstr
)
inputline
=
None
self
.
csn
=
"Vmod_
%
s
%
s_Func"
%
(
self
.
sympfx
,
self
.
modname
)
def
tokenize
(
self
,
txt
,
seps
=
None
,
quotes
=
None
):
if
seps
is
None
:
...
...
@@ -952,16 +951,16 @@ class vcc(object):
j
.
cstuff
(
fo
,
'h'
)
fo
.
close
()
def
cstruct
(
self
,
fo
,
csn
):
fo
.
write
(
"
\n
%
s {
\n
"
%
csn
)
def
cstruct
(
self
,
fo
):
fo
.
write
(
"
\n
struct
%
s {
\n
"
%
self
.
csn
)
for
j
in
self
.
contents
:
j
.
cstruct
(
fo
,
True
)
for
j
in
sorted
(
self
.
enums
):
fo
.
write
(
"
\t
VCL_ENUM
\t\t\t
*enum_
%
s;
\n
"
%
j
)
fo
.
write
(
"};
\n
"
)
def
cstruct_init
(
self
,
fo
,
csn
):
fo
.
write
(
"
\n
static const
%
s Vmod_Func = {
\n
"
%
csn
)
def
cstruct_init
(
self
,
fo
):
fo
.
write
(
"
\n
static const
struct
%
s
%
s = {
\n
"
%
(
self
.
csn
,
self
.
csn
)
)
for
j
in
self
.
contents
:
j
.
cstruct
(
fo
,
False
)
fo
.
write
(
"
\n
"
)
...
...
@@ -1000,8 +999,9 @@ class vcc(object):
fo
.
write
(
"
\t
.vrt_major =
\t
VRT_MAJOR_VERSION,
\n
"
)
fo
.
write
(
"
\t
.vrt_minor =
\t
VRT_MINOR_VERSION,
\n
"
)
fo
.
write
(
'
\t
.name =
\t\t
"
%
s",
\n
'
%
self
.
modname
)
fo
.
write
(
'
\t
.func =
\t\t
&Vmod_Func,
\n
'
)
fo
.
write
(
'
\t
.func_len =
\t
sizeof(Vmod_Func),
\n
'
)
fo
.
write
(
'
\t
.func =
\t\t
&
%
s,
\n
'
%
self
.
csn
)
fo
.
write
(
'
\t
.func_len =
\t
sizeof(
%
s),
\n
'
%
self
.
csn
)
fo
.
write
(
'
\t
.func_name =
\t
"
%
s",
\n
'
%
self
.
csn
)
fo
.
write
(
'
\t
.proto =
\t
Vmod_Proto,
\n
'
)
fo
.
write
(
'
\t
.json =
\t\t
Vmod_Json,
\n
'
)
fo
.
write
(
'
\t
.abi =
\t\t
VMOD_ABI_Version,
\n
'
)
...
...
@@ -1038,21 +1038,18 @@ class vcc(object):
i
.
cstuff
(
fo
,
'c'
)
i
.
cstuff
(
fx
,
'o'
)
csn
=
"Vmod_
%
s_Func"
%
self
.
modname
s
csn
=
"struct "
+
csn
self
.
cstruct
(
fo
)
s
elf
.
cstruct
(
fx
)
self
.
cstruct
(
fo
,
scsn
)
self
.
cstruct
(
fx
,
scsn
)
fo
.
write
(
"
\n
/*lint -esym(754, "
+
csn
+
"::*) */
\n
"
)
self
.
cstruct_init
(
fo
,
scsn
)
fo
.
write
(
"
\n
/*lint -esym(754, "
+
self
.
csn
+
"::*) */
\n
"
)
self
.
cstruct_init
(
fo
)
fx
.
close
()
fo
.
write
(
"
\n
static const char Vmod_Proto[] =
\n
"
)
for
i
in
open
(
fnx
):
fo
.
write
(
'
\t
"
%
s
\\
n"
\n
'
%
i
.
rstrip
())
fo
.
write
(
'
\t
"static struct
%
s
%
s;";
\n
'
%
(
csn
,
csn
))
fo
.
write
(
'
\t
"static struct
%
s
%
s;";
\n
'
%
(
self
.
csn
,
self
.
csn
))
os
.
remove
(
fnx
)
...
...
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