Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
unique-xids
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
unique-xids
Commits
f4924656
Commit
f4924656
authored
Apr 30, 2013
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace the newly introduced "ws" argument to VCL/VRT, with the
even newer vrt_ctx argument.
parent
1c759b87
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
34 deletions
+35
-34
cache_vcl.c
bin/varnishd/cache/cache_vcl.c
+3
-3
cache_vrt.c
bin/varnishd/cache/cache_vrt.c
+16
-15
vrt.h
include/vrt.h
+5
-5
generate.py
lib/libvcl/generate.py
+1
-2
vcc_compile.c
lib/libvcl/vcc_compile.c
+3
-2
vcc_expr.c
lib/libvcl/vcc_expr.c
+7
-7
No files found.
bin/varnishd/cache/cache_vcl.c
View file @
f4924656
...
...
@@ -220,7 +220,7 @@ VCL_Load(const char *fn, const char *name, struct cli *cli)
REPLACE
(
vcl
->
name
,
name
);
VCLI_Out
(
cli
,
"Loaded
\"
%s
\"
as
\"
%s
\"
"
,
fn
,
name
);
VTAILQ_INSERT_TAIL
(
&
vcl_head
,
vcl
,
list
);
(
void
)
vcl
->
conf
->
init_func
(
&
ctx
,
NULL
,
NULL
,
NULL
,
NULL
);
(
void
)
vcl
->
conf
->
init_func
(
&
ctx
,
NULL
,
NULL
,
NULL
);
Lck_Lock
(
&
vcl_mtx
);
if
(
vcl_active
==
NULL
)
vcl_active
=
vcl
;
...
...
@@ -247,7 +247,7 @@ VCL_Nuke(struct vcls *vcl)
assert
(
vcl
->
conf
->
discard
);
assert
(
vcl
->
conf
->
busy
==
0
);
VTAILQ_REMOVE
(
&
vcl_head
,
vcl
,
list
);
(
void
)
vcl
->
conf
->
fini_func
(
&
ctx
,
NULL
,
NULL
,
NULL
,
NULL
);
(
void
)
vcl
->
conf
->
fini_func
(
&
ctx
,
NULL
,
NULL
,
NULL
);
vcl
->
conf
->
fini_vcl
(
NULL
);
free
(
vcl
->
name
);
(
void
)
dlclose
(
vcl
->
dlh
);
...
...
@@ -419,7 +419,7 @@ vcl_call_method(struct worker *wrk, struct req *req, struct busyobj *bo,
wrk
->
cur_method
=
method
;
AN
(
vsl
);
VSLb
(
vsl
,
SLT_VCL_call
,
"%s"
,
VCL_Method_Name
(
method
));
(
void
)
func
(
&
ctx
,
wrk
,
req
,
bo
,
ws
);
(
void
)
func
(
&
ctx
,
wrk
,
req
,
bo
);
VSLb
(
vsl
,
SLT_VCL_return
,
"%s"
,
VCL_Return_Name
(
wrk
->
handling
));
wrk
->
cur_method
=
0
;
WS_Reset
(
wrk
->
aws
,
aws
);
...
...
bin/varnishd/cache/cache_vrt.c
View file @
f4924656
...
...
@@ -214,14 +214,15 @@ VRT_String(struct ws *ws, const char *h, const char *p, va_list ap)
*/
const
char
*
VRT_CollectString
(
struct
ws
*
ws
,
const
char
*
p
,
...)
VRT_CollectString
(
const
struct
vrt_ctx
*
ctx
,
const
char
*
p
,
...)
{
va_list
ap
;
char
*
b
;
CHECK_OBJ_NOTNULL
(
ws
,
WS_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
ws
,
WS_MAGIC
);
va_start
(
ap
,
p
);
b
=
VRT_String
(
ws
,
NULL
,
p
,
ap
);
b
=
VRT_String
(
ctx
->
ws
,
NULL
,
p
,
ap
);
va_end
(
ap
);
return
(
b
);
}
...
...
@@ -303,7 +304,7 @@ VRT_r_now()
/*--------------------------------------------------------------------*/
char
*
VRT_IP_string
(
struct
ws
*
ws
,
const
struct
sockaddr_storage
*
sa
)
VRT_IP_string
(
const
struct
vrt_ctx
*
ctx
,
const
struct
sockaddr_storage
*
sa
)
{
char
*
p
;
const
struct
sockaddr_in
*
si4
;
...
...
@@ -311,7 +312,7 @@ VRT_IP_string(struct ws *ws, const struct sockaddr_storage *sa)
const
void
*
addr
;
int
len
;
CHECK_OBJ_NOTNULL
(
ws
,
WS
_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX
_MAGIC
);
switch
(
sa
->
ss_family
)
{
case
AF_INET
:
len
=
INET_ADDRSTRLEN
;
...
...
@@ -327,44 +328,44 @@ VRT_IP_string(struct ws *ws, const struct sockaddr_storage *sa)
INCOMPL
();
}
XXXAN
(
len
);
AN
(
p
=
WS_Alloc
(
ws
,
len
));
AN
(
p
=
WS_Alloc
(
ctx
->
ws
,
len
));
AN
(
inet_ntop
(
sa
->
ss_family
,
addr
,
p
,
len
));
return
(
p
);
}
char
*
VRT_INT_string
(
struct
ws
*
ws
,
long
num
)
VRT_INT_string
(
const
struct
vrt_ctx
*
ctx
,
long
num
)
{
char
*
p
;
int
size
;
CHECK_OBJ_NOTNULL
(
ws
,
WS
_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX
_MAGIC
);
size
=
snprintf
(
NULL
,
0
,
"%ld"
,
num
)
+
1
;
AN
(
p
=
WS_Alloc
(
ws
,
size
));
AN
(
p
=
WS_Alloc
(
ctx
->
ws
,
size
));
assert
(
snprintf
(
p
,
size
,
"%ld"
,
num
)
<
size
);
return
(
p
);
}
char
*
VRT_REAL_string
(
struct
ws
*
ws
,
double
num
)
VRT_REAL_string
(
const
struct
vrt_ctx
*
ctx
,
double
num
)
{
char
*
p
;
int
size
;
CHECK_OBJ_NOTNULL
(
ws
,
WS
_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX
_MAGIC
);
size
=
snprintf
(
NULL
,
0
,
"%.3f"
,
num
)
+
1
;
AN
(
p
=
WS_Alloc
(
ws
,
size
));
AN
(
p
=
WS_Alloc
(
ctx
->
ws
,
size
));
assert
(
snprintf
(
p
,
size
,
"%.3f"
,
num
)
<
size
);
return
(
p
);
}
char
*
VRT_TIME_string
(
struct
ws
*
ws
,
double
t
)
VRT_TIME_string
(
const
struct
vrt_ctx
*
ctx
,
double
t
)
{
char
*
p
;
CHECK_OBJ_NOTNULL
(
ws
,
WS
_MAGIC
);
p
=
WS_Alloc
(
ws
,
VTIM_FORMAT_SIZE
);
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX
_MAGIC
);
p
=
WS_Alloc
(
ctx
->
ws
,
VTIM_FORMAT_SIZE
);
if
(
p
!=
NULL
)
VTIM_format
(
t
,
p
);
return
(
p
);
...
...
include/vrt.h
View file @
f4924656
...
...
@@ -251,11 +251,11 @@ int VRT_Stv(const char *nm);
/* Convert things to string */
char
*
VRT_IP_string
(
struct
ws
*
,
const
struct
sockaddr_storage
*
sa
);
char
*
VRT_INT_string
(
struct
ws
*
,
long
);
char
*
VRT_REAL_string
(
struct
ws
*
,
double
);
char
*
VRT_TIME_string
(
struct
ws
*
,
double
);
char
*
VRT_IP_string
(
const
struct
vrt_ctx
*
,
const
struct
sockaddr_storage
*
sa
);
char
*
VRT_INT_string
(
const
struct
vrt_ctx
*
,
long
);
char
*
VRT_REAL_string
(
const
struct
vrt_ctx
*
,
double
);
char
*
VRT_TIME_string
(
const
struct
vrt_ctx
*
,
double
);
const
char
*
VRT_BOOL_string
(
unsigned
);
const
char
*
VRT_BACKEND_string
(
const
struct
director
*
d
);
const
char
*
VRT_CollectString
(
struct
ws
*
,
const
char
*
p
,
...);
const
char
*
VRT_CollectString
(
const
struct
vrt_ctx
*
,
const
char
*
p
,
...);
lib/libvcl/generate.py
View file @
f4924656
...
...
@@ -774,8 +774,7 @@ struct worker;
typedef int vcl_init_f(struct cli *);
typedef void vcl_fini_f(struct cli *);
typedef int vcl_func_f(struct vrt_ctx *ctx, struct worker *, struct req *, struct busyobj *,
struct ws *);
typedef int vcl_func_f(const struct vrt_ctx *ctx, struct worker *, struct req *, struct busyobj *);
"""
)
...
...
lib/libvcl/vcc_compile.c
View file @
f4924656
...
...
@@ -693,8 +693,9 @@ vcc_CompileSource(const struct vcc *tl0, struct vsb *sb, struct source *sp)
for
(
i
=
0
;
i
<
VCL_MET_MAX
;
i
++
)
{
Fc
(
tl
,
1
,
"
\n
static int __match_proto__(vcl_func_f)
\n
"
);
Fc
(
tl
,
1
,
"VGC_function_%s(struct vrt_ctx *ctx, struct worker *wrk,"
" struct req *req, struct busyobj *bo, struct ws *ws)
\n
"
,
"VGC_function_%s(const struct vrt_ctx *ctx,"
" struct worker *wrk,"
" struct req *req, struct busyobj *bo)
\n
"
,
method_tab
[
i
].
name
);
AZ
(
VSB_finish
(
tl
->
fm
[
i
]));
Fc
(
tl
,
1
,
"{
\n
"
);
...
...
lib/libvcl/vcc_expr.c
View file @
f4924656
...
...
@@ -404,20 +404,20 @@ vcc_expr_tostring(struct expr **e, enum var_type fmt)
switch
((
*
e
)
->
fmt
)
{
case
BACKEND
:
p
=
"VRT_BACKEND_string(
\v
1)"
;
break
;
case
BOOL
:
p
=
"VRT_BOOL_string(
\v
1)"
;
break
;
case
DURATION
:
p
=
"VRT_REAL_string(
ws
,
\v
1)"
;
break
;
case
DURATION
:
p
=
"VRT_REAL_string(
ctx
,
\v
1)"
;
break
;
/* XXX: should DURATION insist on "s" suffix ? */
case
INT
:
if
(
vcc_isconst
(
*
e
))
{
p
=
"
\"\v
1
\"
"
;
constant
=
EXPR_CONST
;
}
else
{
p
=
"VRT_INT_string(
ws
,
\v
1)"
;
p
=
"VRT_INT_string(
ctx
,
\v
1)"
;
}
break
;
case
IP
:
p
=
"VRT_IP_string(
ws
,
\v
1)"
;
break
;
case
BYTES
:
p
=
"VRT_REAL_string(
ws
,
\v
1)"
;
break
;
/* XXX */
case
REAL
:
p
=
"VRT_REAL_string(
ws
,
\v
1)"
;
break
;
case
TIME
:
p
=
"VRT_TIME_string(
ws
,
\v
1)"
;
break
;
case
IP
:
p
=
"VRT_IP_string(
ctx
,
\v
1)"
;
break
;
case
BYTES
:
p
=
"VRT_REAL_string(
ctx
,
\v
1)"
;
break
;
/* XXX */
case
REAL
:
p
=
"VRT_REAL_string(
ctx
,
\v
1)"
;
break
;
case
TIME
:
p
=
"VRT_TIME_string(
ctx
,
\v
1)"
;
break
;
case
HEADER
:
p
=
"VRT_GetHdr(ctx,
\v
1)"
;
break
;
case
ENUM
:
case
STRING
:
...
...
@@ -914,7 +914,7 @@ vcc_expr_strfold(struct vcc *tl, struct expr **e, enum var_type fmt)
if
(
fmt
!=
STRING_LIST
&&
(
*
e
)
->
fmt
==
STRING_LIST
)
*
e
=
vcc_expr_edit
(
STRING
,
"
\v
+VRT_CollectString(
ws
,
\n\v
1,
\n
vrt_magic_string_end)
\v
-"
,
"
\v
+VRT_CollectString(
ctx
,
\n\v
1,
\n
vrt_magic_string_end)
\v
-"
,
*
e
,
NULL
);
if
(
fmt
==
STRING_LIST
&&
(
*
e
)
->
fmt
==
STRING
)
(
*
e
)
->
fmt
=
STRING_LIST
;
...
...
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