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
df0a067d
Commit
df0a067d
authored
Sep 27, 2017
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the VSC-set create/destroy functions part of VRT
parent
cf3c9d92
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
33 additions
and
69 deletions
+33
-69
Makefile.am
bin/varnishd/Makefile.am
+0
-1
cache_shmlog.c
bin/varnishd/cache/cache_shmlog.c
+2
-3
common_vsc.c
bin/varnishd/common/common_vsc.c
+9
-10
common_vsm.h
bin/varnishd/common/common_vsm.h
+0
-47
heritage.h
bin/varnishd/common/heritage.h
+8
-0
mgt_child.c
bin/varnishd/mgt/mgt_child.c
+2
-3
mgt_shmem.c
bin/varnishd/mgt/mgt_shmem.c
+1
-2
vrt.h
include/vrt.h
+8
-0
vsctool.py
lib/libvcc/vsctool.py
+3
-3
No files found.
bin/varnishd/Makefile.am
View file @
df0a067d
...
...
@@ -139,7 +139,6 @@ nobase_pkginclude_HEADERS = \
cache/cache_filter.h
\
cache/cache_backend.h
\
cache/cache_director.h
\
common/common_vsm.h
\
common/common_param.h
\
waiter/waiter.h
...
...
bin/varnishd/cache/cache_shmlog.c
View file @
df0a067d
...
...
@@ -36,7 +36,6 @@
#include <stdlib.h>
#include "common/heritage.h"
#include "common/common_vsm.h"
#include "vend.h"
#include "vgz.h"
...
...
@@ -501,8 +500,8 @@ VSM_Init(void)
VSC_C_main
=
VSC_main_New
(
""
);
AN
(
VSC_C_main
);
AN
(
proc_vsmw
);
vsl_head
=
VSMW_Allocf
(
proc_vsmw
,
VSL_CLASS
,
AN
(
heritage
.
proc_vsmw
);
vsl_head
=
VSMW_Allocf
(
heritage
.
proc_vsmw
,
VSL_CLASS
,
cache_param
->
vsl_space
,
VSL_CLASS
);
AN
(
vsl_head
);
vsl_segsize
=
((
cache_param
->
vsl_space
-
sizeof
*
vsl_head
)
/
...
...
bin/varnishd/common/common_vsc.c
View file @
df0a067d
...
...
@@ -36,19 +36,18 @@
#include <string.h>
#include <stdlib.h>
#include "common/common_vsm.h"
#include "vdef.h"
#include "miniobj.h"
#include "vas.h"
#include "vend.h"
#include "vsmw.h"
#include "vgz.h"
#include "vmb.h"
#include "vrt.h"
#include "vsmw.h"
#include "vqueue.h"
#include "vapi/vsc_int.h"
struct
vsmw
*
proc_vsmw
;
#include "common/heritage.h"
/*--------------------------------------------------------------------*/
...
...
@@ -69,7 +68,7 @@ vsc_callback_f *vsc_lock;
vsc_callback_f
*
vsc_unlock
;
void
*
VSC_Alloc
(
const
char
*
nm
,
size_t
sd
,
size_t
sj
,
const
unsigned
char
*
zj
,
V
RT_V
SC_Alloc
(
const
char
*
nm
,
size_t
sd
,
size_t
sj
,
const
unsigned
char
*
zj
,
size_t
szj
,
const
char
*
fmt
,
va_list
va
)
{
char
*
p
;
...
...
@@ -85,8 +84,8 @@ VSC_Alloc(const char *nm, size_t sd, size_t sj, const unsigned char *zj,
else
bprintf
(
buf
,
"%s.%s"
,
nm
,
fmt
);
AN
(
proc_vsmw
);
p
=
VSMW_Allocv
(
proc_vsmw
,
VSC_CLASS
,
8
+
sd
+
sj
,
buf
,
va
);
AN
(
heritage
.
proc_vsmw
);
p
=
VSMW_Allocv
(
heritage
.
proc_vsmw
,
VSC_CLASS
,
8
+
sd
+
sj
,
buf
,
va
);
AN
(
p
);
memset
(
&
vz
,
0
,
sizeof
vz
);
...
...
@@ -111,19 +110,19 @@ VSC_Alloc(const char *nm, size_t sd, size_t sj, const unsigned char *zj,
}
void
VSC_Destroy
(
const
char
*
nm
,
const
void
*
p
)
V
RT_V
SC_Destroy
(
const
char
*
nm
,
const
void
*
p
)
{
struct
vsc_segs
*
vsg
;
if
(
vsc_lock
!=
NULL
)
vsc_lock
();
AN
(
proc_vsmw
);
AN
(
heritage
.
proc_vsmw
);
VTAILQ_FOREACH
(
vsg
,
&
vsc_seglist
,
list
)
{
if
(
vsg
->
ptr
!=
p
)
continue
;
assert
(
vsg
->
nm
==
nm
);
VSMW_Free
(
proc_vsmw
,
&
vsg
->
seg
);
VSMW_Free
(
heritage
.
proc_vsmw
,
&
vsg
->
seg
);
VTAILQ_REMOVE
(
&
vsc_seglist
,
vsg
,
list
);
FREE_OBJ
(
vsg
);
break
;
...
...
bin/varnishd/common/common_vsm.h
deleted
100644 → 0
View file @
cf3c9d92
/*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2017 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
#ifdef COMMON_COMMON_VSM_H
#error "Multiple includes of common/common_vsm.h"
#endif
#define COMMON_COMMON_VSM_H
struct
vsmw
;
extern
struct
vsmw
*
proc_vsmw
;
typedef
void
vsc_callback_f
(
void
);
extern
vsc_callback_f
*
vsc_lock
;
extern
vsc_callback_f
*
vsc_unlock
;
void
*
VSC_Alloc
(
const
char
*
,
size_t
,
size_t
,
const
unsigned
char
*
,
size_t
,
const
char
*
,
va_list
);
void
VSC_Destroy
(
const
char
*
,
const
void
*
);
bin/varnishd/common/heritage.h
View file @
df0a067d
...
...
@@ -89,6 +89,8 @@ struct heritage {
const
char
*
ident
;
long
mgt_pid
;
struct
vsmw
*
proc_vsmw
;
};
extern
struct
heritage
heritage
;
...
...
@@ -116,3 +118,9 @@ int VCL_TestLoad(const char *);
struct
transport
;
void
XPORT_Init
(
void
);
const
struct
transport
*
XPORT_Find
(
const
char
*
name
);
/* common/common_vsc.c */
typedef
void
vsc_callback_f
(
void
);
extern
vsc_callback_f
*
vsc_lock
;
extern
vsc_callback_f
*
vsc_unlock
;
bin/varnishd/mgt/mgt_child.c
View file @
df0a067d
...
...
@@ -46,7 +46,6 @@
#include "mgt/mgt.h"
#include "common/heritage.h"
#include "common/common_vsm.h"
#include "vbm.h"
#include "vcli_serve.h"
...
...
@@ -397,8 +396,8 @@ mgt_launch_child(struct cli *cli)
VJ_subproc
(
JAIL_SUBPROC_WORKER
);
proc_vsmw
=
VSMW_New
(
heritage
.
vsm_fd
,
0640
,
"_.index"
);
AN
(
proc_vsmw
);
heritage
.
proc_vsmw
=
VSMW_New
(
heritage
.
vsm_fd
,
0640
,
"_.index"
);
AN
(
heritage
.
proc_vsmw
);
child_main
();
...
...
bin/varnishd/mgt/mgt_shmem.c
View file @
df0a067d
...
...
@@ -42,7 +42,6 @@
#include "mgt/mgt.h"
#include "common/heritage.h"
#include "common/common_vsm.h"
#include "vsm_priv.h"
#include "vsmw.h"
...
...
@@ -101,7 +100,7 @@ mgt_SHM_Init(void)
mgt_vsmw
=
VSMW_New
(
fd
,
0640
,
"_.index"
);
AN
(
mgt_vsmw
);
proc_vsmw
=
mgt_vsmw
;
heritage
.
proc_vsmw
=
mgt_vsmw
;
/* Setup atexit handler */
AZ
(
atexit
(
mgt_shm_atexit
));
...
...
include/vrt.h
View file @
df0a067d
...
...
@@ -50,6 +50,8 @@
*
* 6.2 (scheduled for: 2018-03-15)
* VRT_Healthy() added
* VRT_VSC_Alloc() added
* VRT_VSC_Destroy() added
* 6.1 (2017-09-15 aka 5.2)
* http_CollectHdrSep added
* VRT_purge modified (may fail a transaction, signature changed)
...
...
@@ -411,3 +413,9 @@ typedef int vcl_init_f(VRT_CTX);
typedef
void
vcl_fini_f
(
VRT_CTX
);
typedef
void
vcl_func_f
(
VRT_CTX
);
typedef
int
vmod_event_f
(
VRT_CTX
,
struct
vmod_priv
*
,
enum
vcl_event_e
);
#ifdef va_start // XXX: hackish
void
*
VRT_VSC_Alloc
(
const
char
*
,
size_t
,
size_t
,
const
unsigned
char
*
,
size_t
,
const
char
*
,
va_list
);
void
VRT_VSC_Destroy
(
const
char
*
,
const
void
*
);
#endif
lib/libvcc/vsctool.py
View file @
df0a067d
...
...
@@ -162,7 +162,7 @@ class vscset(object):
fo
.
write
(
'#include <stdint.h>
\n
'
)
fo
.
write
(
'#include "vdef.h"
\n
'
)
fo
.
write
(
'#include "vas.h"
\n
'
)
fo
.
write
(
'#include "
common/common_vsm
.h"
\n
'
)
fo
.
write
(
'#include "
vrt
.h"
\n
'
)
fo
.
write
(
'#include "VSC_
%
s.h"
\n
'
%
self
.
name
)
fo
.
write
(
"
\n
"
)
...
...
@@ -187,7 +187,7 @@ class vscset(object):
fo
.
write
(
"
\t
"
+
self
.
struct
+
" *retval;
\n
"
)
fo
.
write
(
"
\n
"
)
fo
.
write
(
"
\t
va_start(ap, fmt);
\n
"
)
fo
.
write
(
"
\t
retval = VSC_Alloc"
)
fo
.
write
(
"
\t
retval = V
RT_V
SC_Alloc"
)
fo
.
write
(
"(vsc_"
+
self
.
name
+
"_name, "
)
fo
.
write
(
"sizeof("
+
self
.
struct
+
"),
\n\t
"
)
fo
.
write
(
"vsc_"
+
self
.
name
+
"_jsonlen, "
)
...
...
@@ -205,7 +205,7 @@ class vscset(object):
fo
.
write
(
"{
\n
"
)
fo
.
write
(
"
\n
"
)
fo
.
write
(
"
\t
AN(pp);
\n
"
)
fo
.
write
(
'
\t
VSC_Destroy(vsc_
%
s_name, *pp);
\n
'
%
self
.
name
)
fo
.
write
(
'
\t
V
RT_V
SC_Destroy(vsc_
%
s_name, *pp);
\n
'
%
self
.
name
)
fo
.
write
(
"
\t
*pp = NULL;
\n
"
)
fo
.
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