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
e68819f4
Commit
e68819f4
authored
Feb 26, 2018
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change VCL_Check signature to return enum vcl_check
parent
437171de
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
12 deletions
+21
-12
vsl.h
include/vapi/vsl.h
+9
-1
vsl_api.h
lib/libvarnishapi/vsl_api.h
+2
-1
vsl_cursor.c
lib/libvarnishapi/vsl_cursor.c
+9
-9
vsl_dispatch.c
lib/libvarnishapi/vsl_dispatch.c
+1
-1
No files found.
include/vapi/vsl.h
View file @
e68819f4
...
...
@@ -312,7 +312,15 @@ int VSL_ResetCursor(const struct VSL_cursor *c);
* -1: Operation not supported
*/
int
VSL_Check
(
const
struct
VSL_cursor
*
c
,
const
struct
VSLC_ptr
*
ptr
);
enum
vsl_check
{
vsl_check_e_notsupp
=
-
1
,
vsl_check_e_inval
=
0
,
vsl_check_warn
=
1
,
vsl_check_valid
=
2
};
enum
vsl_check
VSL_Check
(
const
struct
VSL_cursor
*
c
,
const
struct
VSLC_ptr
*
ptr
);
/*
* Check if the VSLC_ptr structure points to a value that is still
* valid:
...
...
lib/libvarnishapi/vsl_api.h
View file @
e68819f4
...
...
@@ -39,7 +39,8 @@ void vsl_vbm_bitclr(int bit, void *priv);
typedef
void
vslc_delete_f
(
const
struct
VSL_cursor
*
);
typedef
int
vslc_next_f
(
const
struct
VSL_cursor
*
);
typedef
int
vslc_reset_f
(
const
struct
VSL_cursor
*
);
typedef
int
vslc_check_f
(
const
struct
VSL_cursor
*
,
const
struct
VSLC_ptr
*
);
typedef
enum
vsl_check
vslc_check_f
(
const
struct
VSL_cursor
*
,
const
struct
VSLC_ptr
*
);
struct
vslc_tbl
{
unsigned
magic
;
...
...
lib/libvarnishapi/vsl_cursor.c
View file @
e68819f4
...
...
@@ -91,7 +91,7 @@ vslc_vsm_delete(const struct VSL_cursor *cursor)
* written
*/
static
int
static
enum
vsl_check
v_matchproto_
(
vslc_check_f
)
vslc_vsm_check
(
const
struct
VSL_cursor
*
cursor
,
const
struct
VSLC_ptr
*
ptr
)
{
const
struct
vslc_vsm
*
c
;
...
...
@@ -101,25 +101,25 @@ vslc_vsm_check(const struct VSL_cursor *cursor, const struct VSLC_ptr *ptr)
assert
(
&
c
->
cursor
==
cursor
);
if
(
ptr
->
ptr
==
NULL
)
return
(
0
);
return
(
vsl_check_e_inval
);
dist
=
c
->
head
->
segment_n
-
ptr
->
priv
;
if
(
dist
>=
VSL_SEGMENTS
-
2
)
/* Too close to continue */
return
(
0
);
return
(
vsl_check_e_inval
);
if
(
dist
>=
VSL_SEGMENTS
-
4
)
/* Warning level */
return
(
1
);
return
(
vsl_check_warn
);
/* Safe */
return
(
2
);
return
(
vsl_check_valid
);
}
static
int
vslc_vsm_next
(
const
struct
VSL_cursor
*
cursor
)
{
struct
vslc_vsm
*
c
;
int
i
;
enum
vsl_check
i
;
uint32_t
t
;
CAST_OBJ_NOTNULL
(
c
,
cursor
->
priv_data
,
VSLC_VSM_MAGIC
);
...
...
@@ -127,7 +127,7 @@ vslc_vsm_next(const struct VSL_cursor *cursor)
while
(
1
)
{
i
=
vslc_vsm_check
(
&
c
->
cursor
,
&
c
->
next
);
if
(
i
<
=
0
)
{
if
(
i
<
vsl_check_warn
)
{
if
(
VSM_StillValid
(
c
->
vsm
,
&
c
->
vf
)
!=
VSM_valid
)
return
(
-
2
);
/* VSL abandoned */
else
...
...
@@ -489,13 +489,13 @@ VSL_Next(const struct VSL_cursor *cursor)
return
((
tbl
->
next
)(
cursor
));
}
int
enum
vsl_check
VSL_Check
(
const
struct
VSL_cursor
*
cursor
,
const
struct
VSLC_ptr
*
ptr
)
{
const
struct
vslc_tbl
*
tbl
;
CAST_OBJ_NOTNULL
(
tbl
,
cursor
->
priv_tbl
,
VSLC_TBL_MAGIC
);
if
(
tbl
->
check
==
NULL
)
return
(
-
1
);
return
(
vsl_check_e_notsupp
);
return
((
tbl
->
check
)(
cursor
,
ptr
));
}
lib/libvarnishapi/vsl_dispatch.c
View file @
e68819f4
...
...
@@ -435,7 +435,7 @@ vtx_append(struct VSLQ *vslq, struct vtx *vtx, const struct VSLC_ptr *start,
return
;
AN
(
start
);
if
(
VSL_Check
(
vslq
->
c
,
start
)
==
2
&&
if
(
VSL_Check
(
vslq
->
c
,
start
)
==
vsl_check_valid
&&
!
VTAILQ_EMPTY
(
&
vtx
->
shmchunks_free
))
{
/* Shmref it */
chunk
=
VTAILQ_FIRST
(
&
vtx
->
shmchunks_free
);
...
...
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