Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvdp-pesi
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Jobs
Commits
Open sidebar
uplex-varnish
libvdp-pesi
Commits
b56bd733
Unverified
Commit
b56bd733
authored
Jan 26, 2023
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename bytes_tree struct member to reduce confusion using the coccinelle script
parent
d8c5e5c5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
89 additions
and
29 deletions
+89
-29
bytes_tree.cocci
misc/coccinelle/archive/bytes_tree.cocci
+20
-0
spatch.sh
misc/coccinelle/spatch.sh
+40
-0
pesi_tree.h
src/pesi_tree.h
+1
-1
vdp_pesi.c
src/vdp_pesi.c
+28
-28
No files found.
misc/coccinelle/archive/bytes_tree.cocci
0 → 100644
View file @
b56bd733
@@
struct pesi_tree *ptr;
@@
- ptr->tree
+ ptr->bytes_tree
@@
struct pesi *pesi;
@@
- pesi->pesi_tree->tree
+ pesi->pesi_tree->bytes_tree
@@
struct pesi_tree val;
@@
- val.tree
+ val.bytes_tree
\ No newline at end of file
misc/coccinelle/spatch.sh
0 → 100755
View file @
b56bd733
#!/bin/bash
function
usage
()
{
cat
<<
EOF
Usage:
$0
<sp-file> <spatch-arguments>
Examples:
* apply
$0
my.cocci --dir . --in-place
* expand a patch
$0
my.cocci --parse-cocci
EOF
}
if
[[
${#
@
}
-lt
1
]]
;
then
usage
exit
fi
if
[[
-z
"
${
VARNISHSRC
}
"
]]
;
then
echo
VARNISHSRC must be
set
, pointing to the Varnish-Cache
source
tree
exit
fi
cocci
=
"
${
1
}
"
shift
spatch
=(
spatch
--macro-file
${
VARNISHSRC
}
/tools/coccinelle/vdef.h
-I
${
VARNISHSRC
}
/include/
-I
${
VARNISHSRC
}
/bin/varnishd/
"
${
@
}
"
--sp-file
"
${
cocci
}
"
)
exec
"
${
spatch
[@]
}
"
src/pesi_tree.h
View file @
b56bd733
...
...
@@ -34,7 +34,7 @@
struct
pesi_tree
{
unsigned
magic
;
#define PESI_TREE_MAGIC 0xe8ce8adb
struct
bytes_tree
*
tree
;
struct
bytes_tree
*
bytes_
tree
;
/* all pesis (struct pesi) we started */
struct
lock
task_lock
;
...
...
src/vdp_pesi.c
View file @
b56bd733
/*-
* Copyright 2019 - 2021 UPLEX Nils Goroll Systemoptimierung
* Copyright 2019 - 2021
, 2023
UPLEX Nils Goroll Systemoptimierung
* All rights reserved
*
* Authors: Geoffrey Simmons <geoffrey.simmons@uplex.de>
...
...
@@ -170,7 +170,7 @@ vped_task(struct worker *wrk, void *priv)
pesi
->
wrk
=
wrk
;
node
=
pesi
->
node
;
CHECK_OBJ_NOTNULL
(
node
,
NODE_MAGIC
);
CHECK_OBJ_NOTNULL
(
pesi_tree
->
tree
,
BYTES_TREE_MAGIC
);
CHECK_OBJ_NOTNULL
(
pesi_tree
->
bytes_
tree
,
BYTES_TREE_MAGIC
);
THR_SetRequest
(
req
);
VSLb_ts_req
(
req
,
"Start"
,
W_TIM_real
(
wrk
));
...
...
@@ -230,11 +230,11 @@ vped_task(struct worker *wrk, void *priv)
break
;
case
T_SUBREQ
:
assert
(
pesi
==
req
->
transport_priv
);
Lck_Lock
(
&
pesi_tree
->
tree
->
tree_lock
);
Lck_Lock
(
&
pesi_tree
->
bytes_
tree
->
tree_lock
);
task_fini
(
pesi_tree
,
pesi
);
node
->
subreq
.
done
=
1
;
AZ
(
pthread_cond_signal
(
&
node
->
subreq
.
cond
));
Lck_Unlock
(
&
pesi_tree
->
tree
->
tree_lock
);
Lck_Unlock
(
&
pesi_tree
->
bytes_
tree
->
tree_lock
);
break
;
case
T_NEXUS
:
assert
(
node
->
nexus
.
req
==
req
);
...
...
@@ -250,9 +250,9 @@ vped_task(struct worker *wrk, void *priv)
AZ
(
req
->
transport_priv
);
pesi
=
NULL
;
Lck_Lock
(
&
pesi_tree
->
tree
->
tree_lock
);
set_closed
(
pesi_tree
->
tree
,
node
,
wrk
);
Lck_Unlock
(
&
pesi_tree
->
tree
->
tree_lock
);
Lck_Lock
(
&
pesi_tree
->
bytes_
tree
->
tree_lock
);
set_closed
(
pesi_tree
->
bytes_
tree
,
node
,
wrk
);
Lck_Unlock
(
&
pesi_tree
->
bytes_
tree
->
tree_lock
);
AZ
(
pesi
);
task_fini
(
pesi_tree
,
pesi
);
break
;
...
...
@@ -286,12 +286,12 @@ vped_task(struct worker *wrk, void *priv)
req_fini
(
&
node
->
nexus
.
req
,
wrk
);
/* turn into T_DATA node */
node_mutate_prep
(
pesi_tree
->
tree
,
node
);
node_mutate_prep
(
pesi_tree
->
bytes_
tree
,
node
);
memset
(
&
node
->
data
,
0
,
sizeof
node
->
data
);
node_mutate_lock
(
pesi_tree
->
tree
,
node
,
T_DATA
,
ST_DATA
);
node_mutate_unlock
(
pesi_tree
->
tree
);
node_mutate_lock
(
pesi_tree
->
bytes_
tree
,
node
,
T_DATA
,
ST_DATA
);
node_mutate_unlock
(
pesi_tree
->
bytes_
tree
);
task_fini
(
pesi_tree
,
pesi
);
break
;
...
...
@@ -323,7 +323,7 @@ vped_include(struct req *preq, const char *src, const char *host,
CHECK_OBJ_NOTNULL
(
pesi
,
PESI_MAGIC
);
pesi_tree
=
pesi
->
pesi_tree
;
CHECK_OBJ_NOTNULL
(
pesi_tree
,
PESI_TREE_MAGIC
);
tree
=
pesi_tree
->
tree
;
tree
=
pesi_tree
->
bytes_
tree
;
CHECK_OBJ_NOTNULL
(
tree
,
BYTES_TREE_MAGIC
);
CHECK_OBJ_NOTNULL
(
node
,
NODE_MAGIC
);
wrk
=
preq
->
wrk
;
...
...
@@ -525,7 +525,7 @@ pesi_buf_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
CAST_OBJ_NOTNULL
(
pesi
,
*
priv
,
PESI_MAGIC
);
CHECK_OBJ_NOTNULL
(
pesi
->
pesi_tree
,
PESI_TREE_MAGIC
);
tree
=
pesi
->
pesi_tree
->
tree
;
tree
=
pesi
->
pesi_tree
->
bytes_
tree
;
CHECK_OBJ_NOTNULL
(
tree
,
BYTES_TREE_MAGIC
);
if
(
tree
->
retval
||
ptr
==
NULL
||
len
==
0
)
...
...
@@ -701,13 +701,13 @@ vdp_pesi_init(VRT_CTX, struct vdp_ctx *vdc, void **priv, struct objcore *oc)
INIT_OBJ
(
pesi_tree
,
PESI_TREE_MAGIC
);
if
((
pesi_tree
->
tree
=
WS_Alloc
(
req
->
ws
,
sizeof
(
*
pesi_tree
->
tree
)))
if
((
pesi_tree
->
bytes_tree
=
WS_Alloc
(
req
->
ws
,
sizeof
(
*
pesi_tree
->
bytes_
tree
)))
==
NULL
)
{
VSLb
(
req
->
vsl
,
SLT_Error
,
"insufficient workspace for "
"parallel ESI tree data"
);
return
(
-
1
);
}
INIT_OBJ
(
pesi_tree
->
tree
,
BYTES_TREE_MAGIC
);
INIT_OBJ
(
pesi_tree
->
bytes_
tree
,
BYTES_TREE_MAGIC
);
Lck_New
(
&
pesi_tree
->
task_lock
,
lck_pesi_tree
);
AZ
(
pthread_cond_init
(
&
pesi_tree
->
task_cond
,
NULL
));
...
...
@@ -725,7 +725,7 @@ vdp_pesi_init(VRT_CTX, struct vdp_ctx *vdc, void **priv, struct objcore *oc)
*
priv
=
pesi
;
node_fill_nodestock
(
req
->
ws
,
&
pesi
->
nodestock
);
pesi_tree
->
tree
->
front
=
pesi_tree
->
tree
->
root
=
root_node
=
pesi_tree
->
bytes_tree
->
front
=
pesi_tree
->
bytes_
tree
->
root
=
root_node
=
node_alloc
(
pesi
);
CHECK_OBJ_NOTNULL
(
root_node
,
NODE_MAGIC
);
root_node
->
state
=
ST_PRIVATE
;
...
...
@@ -734,10 +734,10 @@ vdp_pesi_init(VRT_CTX, struct vdp_ctx *vdc, void **priv, struct objcore *oc)
root_node
->
nexus
.
gzip
.
magic
=
NEXUS_GZIP_MAGIC
;
root_node
->
nexus
.
npending_private
=
1
;
VSTAILQ_INIT
(
&
root_node
->
nexus
.
children
);
Lck_New
(
&
pesi_tree
->
tree
->
tree_lock
,
lck_bytes_tree
);
AZ
(
pthread_cond_init
(
&
pesi_tree
->
tree
->
cond
,
NULL
));
AZ
(
pesi_tree
->
tree
->
retval
);
AZ
(
pesi_tree
->
tree
->
npending
);
Lck_New
(
&
pesi_tree
->
bytes_
tree
->
tree_lock
,
lck_bytes_tree
);
AZ
(
pthread_cond_init
(
&
pesi_tree
->
bytes_
tree
->
cond
,
NULL
));
AZ
(
pesi_tree
->
bytes_
tree
->
retval
);
AZ
(
pesi_tree
->
bytes_
tree
->
npending
);
pesi
->
node
=
root_node
;
AZ
(
pecx
->
state
);
...
...
@@ -765,7 +765,7 @@ vdp_pesi_fini(struct vdp_ctx *vdc, void **priv)
CAST_OBJ_NOTNULL
(
pesi
,
*
priv
,
PESI_MAGIC
);
pesi_tree
=
pesi
->
pesi_tree
;
CHECK_OBJ_NOTNULL
(
pesi_tree
,
PESI_TREE_MAGIC
);
bytes_tree
=
pesi_tree
->
tree
;
bytes_tree
=
pesi_tree
->
bytes_
tree
;
CHECK_OBJ_NOTNULL
(
bytes_tree
,
BYTES_TREE_MAGIC
);
node
=
pesi
->
node
;
...
...
@@ -821,7 +821,7 @@ vdp_pesi_fini(struct vdp_ctx *vdc, void **priv)
CHECK_OBJ_NOTNULL
(
pesi_tree
,
PESI_TREE_MAGIC
);
assert
(
pesi_tree
==
pesi
->
pesi_tree
);
CHECK_OBJ_NOTNULL
(
bytes_tree
,
BYTES_TREE_MAGIC
);
assert
(
bytes_tree
==
pesi_tree
->
tree
);
assert
(
bytes_tree
==
pesi_tree
->
bytes_
tree
);
pesi_destroy
(
&
pesi
);
task_fini
(
pesi_tree
,
pesi
);
...
...
@@ -842,7 +842,7 @@ vdp_pesi_fini(struct vdp_ctx *vdc, void **priv)
/*
* prevent race with vped_task()
*/
Lck_Lock
(
&
pesi_tree
->
tree
->
tree_lock
);
Lck_Lock
(
&
pesi_tree
->
bytes_
tree
->
tree_lock
);
assert_node
(
bytes_tree
->
root
,
CHK_ANY
);
/*
...
...
@@ -855,7 +855,7 @@ vdp_pesi_fini(struct vdp_ctx *vdc, void **priv)
Lck_Delete
(
&
pesi_tree
->
task_lock
);
AZ
(
pthread_cond_destroy
(
&
pesi_tree
->
task_cond
));
Lck_Unlock
(
&
pesi_tree
->
tree
->
tree_lock
);
Lck_Unlock
(
&
pesi_tree
->
bytes_
tree
->
tree_lock
);
Lck_Delete
(
&
bytes_tree
->
tree_lock
);
AZ
(
pthread_cond_destroy
(
&
bytes_tree
->
cond
));
...
...
@@ -919,9 +919,9 @@ vdp_pesi_bytes(struct vdp_ctx *vdx, enum vdp_action act, void **priv,
CAST_OBJ_NOTNULL
(
pesi
,
*
priv
,
PESI_MAGIC
);
CHECK_OBJ_NOTNULL
(
pesi
->
pecx
,
PECX_MAGIC
);
CHECK_OBJ_NOTNULL
(
pesi
->
pesi_tree
,
PESI_TREE_MAGIC
);
CHECK_OBJ_NOTNULL
(
pesi
->
pesi_tree
->
tree
,
BYTES_TREE_MAGIC
);
CHECK_OBJ_NOTNULL
(
pesi
->
pesi_tree
->
bytes_
tree
,
BYTES_TREE_MAGIC
);
pecx
=
pesi
->
pecx
;
tree
=
pesi
->
pesi_tree
->
tree
;
tree
=
pesi
->
pesi_tree
->
bytes_
tree
;
node
=
pesi
->
node
;
CHECK_OBJ_NOTNULL
(
node
,
NODE_MAGIC
);
...
...
@@ -1293,8 +1293,8 @@ vped_deliver(struct req *req, struct boc *boc, int wantbody)
CAST_OBJ_NOTNULL
(
pesi
,
req
->
transport_priv
,
PESI_MAGIC
);
CHECK_OBJ_NOTNULL
(
pesi
->
pesi_tree
,
PESI_TREE_MAGIC
);
CHECK_OBJ_NOTNULL
(
pesi
->
pesi_tree
->
tree
,
BYTES_TREE_MAGIC
);
tree
=
pesi
->
pesi_tree
->
tree
;
CHECK_OBJ_NOTNULL
(
pesi
->
pesi_tree
->
bytes_
tree
,
BYTES_TREE_MAGIC
);
tree
=
pesi
->
pesi_tree
->
bytes_
tree
;
node
=
pesi
->
node
;
parent
=
node
->
parent
;
...
...
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