[master] 18b75e959 Add VRT_priv_top_get() to parallel VRT_priv_task_get()

Nils Goroll nils.goroll at uplex.de
Wed Jan 13 15:35:08 UTC 2021


commit 18b75e9597e61229df752d9da9c24fe55ec0d266
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Wed Jan 13 13:27:03 2021 +0100

    Add VRT_priv_top_get() to parallel VRT_priv_task_get()
    
    Ref 06cf60a020a81e49d001ee42e4d85f16580f3fe0

diff --git a/bin/varnishd/cache/cache_vrt_priv.c b/bin/varnishd/cache/cache_vrt_priv.c
index c27174450..d6884c228 100644
--- a/bin/varnishd/cache/cache_vrt_priv.c
+++ b/bin/varnishd/cache/cache_vrt_priv.c
@@ -216,6 +216,22 @@ VRT_priv_task(VRT_CTX, const void *vmod_id)
 		CHECK_OBJ_NOTNULL(req, REQ_MAGIC);			\
 	} while(0)
 
+struct vmod_priv *
+VRT_priv_top_get(VRT_CTX, const void *vmod_id)
+{
+	struct req *req;
+	struct sess *sp;
+	struct reqtop *top;
+	struct vmod_priv *priv;
+
+	VRT_PRIV_TOP_PREP(ctx, req, sp, top);
+
+	Lck_Lock(&sp->mtx);
+	priv = vrt_priv_dynamic_get(top->privs, (uintptr_t)vmod_id);
+	Lck_Unlock(&sp->mtx);
+	return (priv);
+}
+
 struct vmod_priv *
 VRT_priv_top(VRT_CTX, const void *vmod_id)
 {
diff --git a/include/vrt.h b/include/vrt.h
index 23de2361b..12cab679d 100644
--- a/include/vrt.h
+++ b/include/vrt.h
@@ -60,6 +60,7 @@
  *	VRT_CTX_Assert() added
  *	VRT_ban_string() signature changed
  *	VRT_priv_task_get() added
+ *	VRT_priv_top_get() added
  * 12.0 (2020-09-15)
  *	Added VRT_DirectorResolve()
  *	Added VCL_STRING VRT_BLOB_string(VRT_CTX, VCL_BLOB)
@@ -600,6 +601,7 @@ void VRT_priv_fini(const struct vmod_priv *p);
 struct vmod_priv *VRT_priv_task(VRT_CTX, const void *vmod_id);
 struct vmod_priv *VRT_priv_task_get(VRT_CTX, const void *vmod_id);
 struct vmod_priv *VRT_priv_top(VRT_CTX, const void *vmod_id);
+struct vmod_priv *VRT_priv_top_get(VRT_CTX, const void *vmod_id);
 
 /* Stevedore related functions */
 int VRT_Stv(const char *nm);


More information about the varnish-commit mailing list