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
722f654f
Commit
722f654f
authored
Nov 01, 2016
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a STV_Foreach() iterator, to isolate the clue to Transients
special treatment.
parent
a83b79b9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
14 deletions
+26
-14
mgt_vcc.c
bin/varnishd/mgt/mgt_vcc.c
+1
-2
mgt_stevedore.c
bin/varnishd/storage/mgt_stevedore.c
+19
-0
stevedore.c
bin/varnishd/storage/stevedore.c
+2
-12
storage.h
bin/varnishd/storage/storage.h
+4
-0
No files found.
bin/varnishd/mgt/mgt_vcc.c
View file @
722f654f
...
...
@@ -104,10 +104,9 @@ run_vcc(void *priv)
VCC_Err_Unref
(
vcc
,
mgt_vcc_err_unref
);
VCC_Allow_InlineC
(
vcc
,
mgt_vcc_allow_inline_c
);
VCC_Unsafe_Path
(
vcc
,
mgt_vcc_unsafe_path
);
VTAILQ_FOREACH
(
stv
,
&
stv_stevedores
,
list
)
STV_Foreach
(
stv
)
VCC_Predef
(
vcc
,
"VCL_STEVEDORE"
,
stv
->
ident
);
mgt_vcl_export_labels
(
vcc
);
VCC_Predef
(
vcc
,
"VCL_STEVEDORE"
,
stv_transient
->
ident
);
csrc
=
VCC_Compile
(
vcc
,
&
sb
,
vp
->
vclsrc
,
vp
->
vclsrcfile
);
AZ
(
VSB_finish
(
sb
));
if
(
VSB_len
(
sb
))
...
...
bin/varnishd/storage/mgt_stevedore.c
View file @
722f654f
...
...
@@ -51,6 +51,25 @@ struct stevedore *stv_transient;
/*--------------------------------------------------------------------*/
int
STV__iter
(
struct
stevedore
**
pp
)
{
if
(
*
pp
==
stv_transient
)
{
*
pp
=
NULL
;
return
(
0
);
}
if
(
*
pp
!=
NULL
)
*
pp
=
VTAILQ_NEXT
(
*
pp
,
list
);
else
*
pp
=
VTAILQ_FIRST
(
&
stv_stevedores
);
if
(
*
pp
==
NULL
)
*
pp
=
stv_transient
;
return
(
1
);
}
/*--------------------------------------------------------------------*/
static
void
__match_proto__
(
cli_func_t
)
stv_cli_list
(
struct
cli
*
cli
,
const
char
*
const
*
av
,
void
*
priv
)
{
...
...
bin/varnishd/storage/stevedore.c
View file @
722f654f
...
...
@@ -99,19 +99,13 @@ STV_open(void)
char
buf
[
1024
];
ASSERT_CLI
();
VTAILQ_FOREACH
(
stv
,
&
stv_stevedores
,
list
)
{
STV_Foreach
(
stv
)
{
bprintf
(
buf
,
"storage.%s"
,
stv
->
ident
);
stv
->
vclname
=
strdup
(
buf
);
AN
(
stv
->
vclname
);
if
(
stv
->
open
!=
NULL
)
stv
->
open
(
stv
);
}
stv
=
stv_transient
;
bprintf
(
buf
,
"storage.%s"
,
stv
->
ident
);
stv
->
vclname
=
strdup
(
buf
);
AN
(
stv
->
vclname
);
if
(
stv
->
open
!=
NULL
)
stv
->
open
(
stv
);
stv_next
=
VTAILQ_FIRST
(
&
stv_stevedores
);
}
...
...
@@ -124,11 +118,7 @@ STV_close(void)
ASSERT_CLI
();
for
(
i
=
1
;
i
>=
0
;
i
--
)
{
/* First send close warning */
VTAILQ_FOREACH
(
stv
,
&
stv_stevedores
,
list
)
if
(
stv
->
close
!=
NULL
)
stv
->
close
(
stv
,
i
);
stv
=
stv_transient
;
if
(
stv
->
close
!=
NULL
)
STV_Foreach
(
stv
)
if
(
stv
->
close
!=
NULL
)
stv
->
close
(
stv
,
i
);
}
...
...
bin/varnishd/storage/storage.h
View file @
722f654f
...
...
@@ -130,6 +130,10 @@ VTAILQ_HEAD(stevedore_head, stevedore);
extern
struct
stevedore_head
stv_stevedores
;
extern
struct
stevedore
*
stv_transient
;
/*--------------------------------------------------------------------*/
#define STV_Foreach(arg) for(arg = NULL; STV__iter(&arg);)
int
STV__iter
(
struct
stevedore
**
);
/*--------------------------------------------------------------------*/
int
STV_GetFile
(
const
char
*
fn
,
int
*
fdp
,
const
char
**
fnp
,
const
char
*
ctx
);
uintmax_t
STV_FileSize
(
int
fd
,
const
char
*
size
,
unsigned
*
granularity
,
...
...
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