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
3a08c3d9
Commit
3a08c3d9
authored
Sep 08, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Vmod_Id handle which VMOD can identify themselves to VRT with.
parent
8b4c13c4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
cache_vrt_vmod.c
bin/varnishd/cache_vrt_vmod.c
+7
-3
vmod.py
lib/libvmod_std/vmod.py
+4
-0
No files found.
bin/varnishd/cache_vrt_vmod.c
View file @
3a08c3d9
...
...
@@ -56,6 +56,7 @@ struct vmod {
void
*
hdl
;
const
void
*
funcs
;
int
funclen
;
const
void
*
idptr
;
};
static
VTAILQ_HEAD
(,
vmod
)
vmods
=
VTAILQ_HEAD_INITIALIZER
(
vmods
);
...
...
@@ -65,12 +66,12 @@ VRT_Vmod_Init(void **hdl, void *ptr, int len, const char *nm,
const
char
*
path
,
struct
cli
*
cli
)
{
struct
vmod
*
v
;
void
*
x
,
*
y
,
*
z
;
void
*
x
,
*
y
,
*
z
,
*
w
;
ASSERT_CLI
();
VTAILQ_FOREACH
(
v
,
&
vmods
,
list
)
if
(
!
strcmp
(
v
->
nm
,
nm
))
if
(
!
strcmp
(
v
->
nm
,
nm
))
// Also path, len ?
break
;
if
(
v
==
NULL
)
{
ALLOC_OBJ
(
v
,
VMOD_MAGIC
);
...
...
@@ -88,7 +89,8 @@ VRT_Vmod_Init(void **hdl, void *ptr, int len, const char *nm,
x
=
dlsym
(
v
->
hdl
,
"Vmod_Name"
);
y
=
dlsym
(
v
->
hdl
,
"Vmod_Len"
);
z
=
dlsym
(
v
->
hdl
,
"Vmod_Func"
);
if
(
x
==
NULL
||
y
==
NULL
||
z
==
NULL
)
{
w
=
dlsym
(
v
->
hdl
,
"Vmod_Id"
);
if
(
x
==
NULL
||
y
==
NULL
||
z
==
NULL
||
w
==
NULL
)
{
VCLI_Out
(
cli
,
"Loading VMOD %s from %s:
\n
"
,
nm
,
path
);
VCLI_Out
(
cli
,
"VMOD symbols not found
\n
"
);
VCLI_Out
(
cli
,
"Check relative pathnames.
\n
"
);
...
...
@@ -99,6 +101,7 @@ VRT_Vmod_Init(void **hdl, void *ptr, int len, const char *nm,
AN
(
x
);
AN
(
y
);
AN
(
z
);
AN
(
w
);
if
(
strcmp
(
x
,
nm
))
{
VCLI_Out
(
cli
,
"Loading VMOD %s from %s:
\n
"
,
nm
,
path
);
VCLI_Out
(
cli
,
"File contain wrong VMOD (
\"
%s
\"
)
\n
"
,
x
);
...
...
@@ -116,6 +119,7 @@ VRT_Vmod_Init(void **hdl, void *ptr, int len, const char *nm,
VSC_C_main
->
vmods
++
;
VTAILQ_INSERT_TAIL
(
&
vmods
,
v
,
list
);
v
->
idptr
=
w
;
}
assert
(
len
==
v
->
funclen
);
...
...
lib/libvmod_std/vmod.py
View file @
3a08c3d9
...
...
@@ -308,5 +308,9 @@ fc.write("\n");
fc
.
write
(
'const char * const Vmod_Spec[] = {
\n
'
+
slist
+
'
\t
0
\n
};
\n
'
)
fc
.
write
(
'const char Vmod_Varnish_ABI[] = VMOD_ABI_Version;
\n
'
)
fh
.
write
(
'extern const void * const Vmod_Id;
\n
'
)
fc
.
write
(
'const void * const Vmod_Id = &Vmod_Id;
\n
'
)
fc
.
write
(
"
\n
"
)
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