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
3e5f3757
Commit
3e5f3757
authored
May 13, 2013
by
Martin Blix Grydeland
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add an enum describing the return values from VSM_StillValid
Use the enum values where VSM_StillValid is used.
parent
f2e1f42f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
15 deletions
+21
-15
varnishstat_curses.c
bin/varnishstat/varnishstat_curses.c
+1
-1
vsm.h
include/vapi/vsm.h
+11
-5
vsc.c
lib/libvarnishapi/vsc.c
+2
-2
vsl_cursor.c
lib/libvarnishapi/vsl_cursor.c
+1
-1
vsm.c
lib/libvarnishapi/vsm.c
+6
-6
No files found.
bin/varnishstat/varnishstat_curses.c
View file @
3e5f3757
...
...
@@ -873,7 +873,7 @@ do_curses(struct VSM_data *vd, int delay)
}
VSC_C_mgt
=
VSC_Mgt
(
vd
,
&
f_mgt
);
VSC_C_main
=
VSC_Main
(
vd
,
&
f_main
);
if
(
VSM_
StillValid
(
vd
,
&
f_iter
)
!=
1
)
if
(
VSM_
valid
!=
VSM_StillValid
(
vd
,
&
f_iter
)
)
build_pt_list
(
vd
,
&
f_iter
);
now
=
VTIM_mono
();
...
...
include/vapi/vsm.h
View file @
3e5f3757
...
...
@@ -139,17 +139,23 @@ int VSM__itern(const struct VSM_data *vd, struct VSM_fantom *vf);
* vd = "struct VSM_data *"
*/
int
VSM_StillValid
(
const
struct
VSM_data
*
vd
,
struct
VSM_fantom
*
vf
);
enum
VSM_valid_e
{
VSM_invalid
,
VSM_valid
,
VSM_similar
,
};
enum
VSM_valid_e
VSM_StillValid
(
const
struct
VSM_data
*
vd
,
struct
VSM_fantom
*
vf
);
/*
* This is a cheap syscall-less check to see if the fantom is still
* valid. Further checking with VSM_Abandoned() may be a good
* idea.
*
* Return:
* 0: fantom is not valid any more.
* 1: fantom is still the same.
* 2: a fantom with same dimensions exist in same position,
* check class/type/ident
* VSM_invalid: fantom is not valid any more.
* VSM_valid: fantom is still the same.
* VSM_similar: a fantom with same dimensions exist in same position.
*/
int
VSM_Get
(
const
struct
VSM_data
*
vd
,
struct
VSM_fantom
*
vf
,
...
...
lib/libvarnishapi/vsc.c
View file @
3e5f3757
...
...
@@ -287,7 +287,7 @@ VSC_Get(struct VSM_data *vd, struct VSM_fantom *fantom, const char *type,
if
(
fantom
==
NULL
)
fantom
=
&
f2
;
if
(
!
VSM_StillValid
(
vd
,
fantom
)
&&
if
(
VSM_invalid
==
VSM_StillValid
(
vd
,
fantom
)
&&
!
VSM_Get
(
vd
,
fantom
,
VSC_CLASS
,
type
,
ident
))
return
(
NULL
);
return
((
void
*
)
fantom
->
b
);
...
...
@@ -470,7 +470,7 @@ VSC_Iter(struct VSM_data *vd, struct VSM_fantom *fantom, VSC_iter_f *func,
struct
vsc_pt
*
pt
;
int
i
;
if
(
1
!=
VSM_StillValid
(
vd
,
&
vsc
->
iter_fantom
))
{
if
(
VSM_valid
!=
VSM_StillValid
(
vd
,
&
vsc
->
iter_fantom
))
{
/* Tell app that list will be nuked */
(
void
)
func
(
priv
,
NULL
);
vsc_build_vf_list
(
vd
);
...
...
lib/libvarnishapi/vsl_cursor.c
View file @
3e5f3757
...
...
@@ -131,7 +131,7 @@ vslc_vsm_next(void *cursor)
/* Check VSL fantom and abandonment */
if
(
*
(
volatile
const
uint32_t
*
)
c
->
next
.
ptr
==
VSL_ENDMARKER
)
{
if
(
!
VSM_StillValid
(
c
->
vsm
,
&
c
->
vf
)
||
if
(
VSM_invalid
==
VSM_StillValid
(
c
->
vsm
,
&
c
->
vf
)
||
VSM_Abandoned
(
c
->
vsm
))
return
(
-
2
);
}
...
...
lib/libvarnishapi/vsm.c
View file @
3e5f3757
...
...
@@ -367,7 +367,7 @@ VSM__itern(const struct VSM_data *vd, struct VSM_fantom *vf)
/*--------------------------------------------------------------------*/
int
enum
VSM_valid_e
VSM_StillValid
(
const
struct
VSM_data
*
vd
,
struct
VSM_fantom
*
vf
)
{
struct
VSM_fantom
f2
;
...
...
@@ -375,11 +375,11 @@ VSM_StillValid(const struct VSM_data *vd, struct VSM_fantom *vf)
CHECK_OBJ_NOTNULL
(
vd
,
VSM_MAGIC
);
AN
(
vf
);
if
(
!
vd
->
head
)
return
(
0
);
return
(
VSM_invalid
);
if
(
!
vd
->
head
->
alloc_seq
)
return
(
0
);
return
(
VSM_invalid
);
if
(
vf
->
priv
==
vd
->
head
->
alloc_seq
)
return
(
1
);
return
(
VSM_valid
);
VSM_FOREACH
(
&
f2
,
vd
)
{
if
(
f2
.
chunk
!=
vf
->
chunk
||
f2
.
b
!=
vf
->
b
||
f2
.
e
!=
vf
->
e
)
continue
;
...
...
@@ -390,9 +390,9 @@ VSM_StillValid(const struct VSM_data *vd, struct VSM_fantom *vf)
if
(
strcmp
(
f2
.
ident
,
vf
->
ident
))
continue
;
vf
->
priv
=
vd
->
head
->
alloc_seq
;
return
(
2
);
return
(
VSM_similar
);
}
return
(
0
);
return
(
VSM_invalid
);
}
int
...
...
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