Inclusive naming

parent 80abdc61
...@@ -75,9 +75,9 @@ struct vmod_cluster_cluster_param { ...@@ -75,9 +75,9 @@ struct vmod_cluster_cluster_param {
VCL_BOOL direct; VCL_BOOL direct;
VCL_BACKEND cluster; VCL_BACKEND cluster;
VCL_BACKEND real; VCL_BACKEND real;
int nblack; int ndeny;
int spcblack; int spcdeny;
VCL_BACKEND blacklist[]; VCL_BACKEND denylist[];
}; };
struct vmod_cluster_cluster { struct vmod_cluster_cluster {
...@@ -97,13 +97,13 @@ static const struct vdi_methods vmod_cluster_methods[1] = {{ ...@@ -97,13 +97,13 @@ static const struct vdi_methods vmod_cluster_methods[1] = {{
.healthy = vmod_cluster_healthy, .healthy = vmod_cluster_healthy,
}}; }};
#define param_sz(p, spc) (sizeof(*(p)) + (spc) * sizeof(*(p)->blacklist)) #define param_sz(p, spc) (sizeof(*(p)) + (spc) * sizeof(*(p)->denylist))
/* /*
* return a writable task param struct for the current context * return a writable task param struct for the current context
* with sufficient space for nblack blacklist entries * with sufficient space for ndeny denylist entries
* *
* nblack: * ndeny:
* -1: do not create, return NULL if don't exist * -1: do not create, return NULL if don't exist
* *
* spc: * spc:
...@@ -111,11 +111,11 @@ static const struct vdi_methods vmod_cluster_methods[1] = {{ ...@@ -111,11 +111,11 @@ static const struct vdi_methods vmod_cluster_methods[1] = {{
* - in INIT, create on heap * - in INIT, create on heap
* - else create on workspace * - else create on workspace
* - otherwise return new object here. Size must be * - otherwise return new object here. Size must be
* param_sz(..., nblack) * param_sz(..., ndeny)
*/ */
static struct vmod_cluster_cluster_param * static struct vmod_cluster_cluster_param *
cluster_task_param_l(VRT_CTX, struct vmod_cluster_cluster *vc, cluster_task_param_l(VRT_CTX, struct vmod_cluster_cluster *vc,
int nblack, void *spc) int ndeny, void *spc)
{ {
struct vmod_priv *task = NULL; struct vmod_priv *task = NULL;
struct vmod_cluster_cluster_param *p = NULL; struct vmod_cluster_cluster_param *p = NULL;
...@@ -153,11 +153,11 @@ cluster_task_param_l(VRT_CTX, struct vmod_cluster_cluster *vc, ...@@ -153,11 +153,11 @@ cluster_task_param_l(VRT_CTX, struct vmod_cluster_cluster *vc,
VMOD_CLUSTER_CLUSTER_PARAM_MAGIC); VMOD_CLUSTER_CLUSTER_PARAM_MAGIC);
} }
if (nblack == -1) if (ndeny == -1)
return (p); return (p);
if (o && nblack < o->nblack) if (o && ndeny < o->ndeny)
nblack = o->nblack; ndeny = o->ndeny;
/* /*
* make the (new) allocation and copy or return if not required * make the (new) allocation and copy or return if not required
* if space was provided, we always return it * if space was provided, we always return it
...@@ -165,23 +165,23 @@ cluster_task_param_l(VRT_CTX, struct vmod_cluster_cluster *vc, ...@@ -165,23 +165,23 @@ cluster_task_param_l(VRT_CTX, struct vmod_cluster_cluster *vc,
if (spc) { if (spc) {
p = spc; p = spc;
if (o) { if (o) {
assert (nblack >= o->nblack); assert (ndeny >= o->ndeny);
memcpy(p, o, param_sz(o, o->nblack)); memcpy(p, o, param_sz(o, o->ndeny));
} }
} else if (p && nblack <= p->spcblack) { } else if (p && ndeny <= p->spcdeny) {
return (p); return (p);
} else { } else {
nblack = RUP2(nblack, 2); ndeny = RUP2(ndeny, 2);
if (ctx->method & VCL_MET_INIT) { if (ctx->method & VCL_MET_INIT) {
p = realloc(p, param_sz(p, nblack)); p = realloc(p, param_sz(p, ndeny));
AN(p); AN(p);
vc->param = p; vc->param = p;
} else { } else {
AN(o); AN(o);
p = WS_Alloc(ctx->ws, param_sz(p, nblack)); p = WS_Alloc(ctx->ws, param_sz(p, ndeny));
if (p == NULL) if (p == NULL)
return (NULL); return (NULL);
memcpy(p, o, param_sz(o, o->nblack)); memcpy(p, o, param_sz(o, o->ndeny));
} }
AN(task); AN(task);
task->priv = p; task->priv = p;
...@@ -191,7 +191,7 @@ cluster_task_param_l(VRT_CTX, struct vmod_cluster_cluster *vc, ...@@ -191,7 +191,7 @@ cluster_task_param_l(VRT_CTX, struct vmod_cluster_cluster *vc,
if (o == NULL) if (o == NULL)
INIT_OBJ(p, VMOD_CLUSTER_CLUSTER_PARAM_MAGIC); INIT_OBJ(p, VMOD_CLUSTER_CLUSTER_PARAM_MAGIC);
p->spcblack = nblack; p->spcdeny = ndeny;
return (p); return (p);
} }
...@@ -222,8 +222,8 @@ cluster_deny(VRT_CTX, struct vmod_cluster_cluster_param *p, ...@@ -222,8 +222,8 @@ cluster_deny(VRT_CTX, struct vmod_cluster_cluster_param *p,
VRT_fail(ctx, "Can not deny the NULL backend"); VRT_fail(ctx, "Can not deny the NULL backend");
return; return;
} }
assert(p->nblack < p->spcblack); assert(p->ndeny < p->spcdeny);
p->blacklist[p->nblack++] = b; p->denylist[p->ndeny++] = b;
} }
static void static void
...@@ -237,13 +237,13 @@ cluster_allow(VRT_CTX, struct vmod_cluster_cluster_param *p, ...@@ -237,13 +237,13 @@ cluster_allow(VRT_CTX, struct vmod_cluster_cluster_param *p,
VRT_fail(ctx, "Can not allow the NULL backend"); VRT_fail(ctx, "Can not allow the NULL backend");
return; return;
} }
for (i = 0; i < p->nblack; i++) for (i = 0; i < p->ndeny; i++)
if (p->blacklist[i] == b) { if (p->denylist[i] == b) {
p->nblack--; p->ndeny--;
if (i < p->nblack) if (i < p->ndeny)
memmove(&p->blacklist[i], memmove(&p->denylist[i],
&p->blacklist[i+1], &p->denylist[i+1],
(p->nblack - i) * sizeof(*p->blacklist)); (p->ndeny - i) * sizeof(*p->denylist));
return; return;
} }
} }
...@@ -256,8 +256,8 @@ cluster_denied(const struct vmod_cluster_cluster_param *p, ...@@ -256,8 +256,8 @@ cluster_denied(const struct vmod_cluster_cluster_param *p,
int i; int i;
CHECK_OBJ_NOTNULL(p, VMOD_CLUSTER_CLUSTER_PARAM_MAGIC); CHECK_OBJ_NOTNULL(p, VMOD_CLUSTER_CLUSTER_PARAM_MAGIC);
for (i = 0; i < p->nblack; i++) { for (i = 0; i < p->ndeny; i++) {
bl = p->blacklist[i]; bl = p->denylist[i];
CHECK_OBJ_NOTNULL(bl, DIRECTOR_MAGIC); CHECK_OBJ_NOTNULL(bl, DIRECTOR_MAGIC);
if (bl == b) if (bl == b)
return (1); return (1);
...@@ -272,7 +272,7 @@ vmod_cluster__init(VRT_CTX, ...@@ -272,7 +272,7 @@ vmod_cluster__init(VRT_CTX,
{ {
struct vmod_cluster_cluster *vc; struct vmod_cluster_cluster *vc;
struct vmod_cluster_cluster_param *p; struct vmod_cluster_cluster_param *p;
const int nblack_initial = 2; const int ndeny_initial = 2;
AN(vcp); AN(vcp);
AZ(*vcp); AZ(*vcp);
...@@ -282,7 +282,7 @@ vmod_cluster__init(VRT_CTX, ...@@ -282,7 +282,7 @@ vmod_cluster__init(VRT_CTX,
return; return;
} }
AN(vc); AN(vc);
p = cluster_task_param_l(ctx, vc, nblack_initial, NULL); p = cluster_task_param_l(ctx, vc, ndeny_initial, NULL);
if (p == NULL) { if (p == NULL) {
FREE_OBJ(vc); FREE_OBJ(vc);
return; return;
...@@ -330,7 +330,7 @@ vmod_cluster_deny(VRT_CTX, ...@@ -330,7 +330,7 @@ vmod_cluster_deny(VRT_CTX,
if (cluster_denied(pr, b)) if (cluster_denied(pr, b))
return; return;
pl = cluster_task_param_l(ctx, vc, pr->nblack + 1, NULL); pl = cluster_task_param_l(ctx, vc, pr->ndeny + 1, NULL);
cluster_deny(ctx, pl, b); cluster_deny(ctx, pl, b);
} }
...@@ -349,7 +349,7 @@ vmod_cluster_allow(VRT_CTX, ...@@ -349,7 +349,7 @@ vmod_cluster_allow(VRT_CTX,
if (! cluster_denied(pr, b)) if (! cluster_denied(pr, b))
return; return;
pl = cluster_task_param_l(ctx, vc, pr->nblack, NULL); pl = cluster_task_param_l(ctx, vc, pr->ndeny, NULL);
cluster_allow(ctx, pl, b); cluster_allow(ctx, pl, b);
} }
...@@ -518,14 +518,14 @@ cluster_update_by_args(VRT_CTX, struct vmod_cluster_cluster *vc, ...@@ -518,14 +518,14 @@ cluster_update_by_args(VRT_CTX, struct vmod_cluster_cluster *vc,
void *spc) void *spc)
{ {
struct vmod_cluster_cluster_param *pl = NULL; struct vmod_cluster_cluster_param *pl = NULL;
int nblack; int ndeny;
CHECK_OBJ_NOTNULL(pr, VMOD_CLUSTER_CLUSTER_PARAM_MAGIC); CHECK_OBJ_NOTNULL(pr, VMOD_CLUSTER_CLUSTER_PARAM_MAGIC);
nblack = pr->nblack; ndeny = pr->ndeny;
if (arg->valid_deny && arg->deny != NULL && if (arg->valid_deny && arg->deny != NULL &&
! cluster_denied(pr, arg->deny)) { ! cluster_denied(pr, arg->deny)) {
pr = pl = cluster_task_param_l(ctx, vc, ++nblack, spc); pr = pl = cluster_task_param_l(ctx, vc, ++ndeny, spc);
if (pl == NULL) if (pl == NULL)
return (NULL); return (NULL);
cluster_deny(ctx, pl, arg->deny); cluster_deny(ctx, pl, arg->deny);
...@@ -533,7 +533,7 @@ cluster_update_by_args(VRT_CTX, struct vmod_cluster_cluster *vc, ...@@ -533,7 +533,7 @@ cluster_update_by_args(VRT_CTX, struct vmod_cluster_cluster *vc,
AN(pr); AN(pr);
if (arg->valid_real && pr->real != arg->real) { if (arg->valid_real && pr->real != arg->real) {
if (pl == NULL) if (pl == NULL)
pr = pl = cluster_task_param_l(ctx, vc, nblack, spc); pr = pl = cluster_task_param_l(ctx, vc, ndeny, spc);
if (pl == NULL) if (pl == NULL)
return (NULL); return (NULL);
pl->real = arg->real; pl->real = arg->real;
...@@ -542,7 +542,7 @@ cluster_update_by_args(VRT_CTX, struct vmod_cluster_cluster *vc, ...@@ -542,7 +542,7 @@ cluster_update_by_args(VRT_CTX, struct vmod_cluster_cluster *vc,
if (arg->valid_uncacheable_direct && if (arg->valid_uncacheable_direct &&
pr->uncacheable_direct != arg->uncacheable_direct) { pr->uncacheable_direct != arg->uncacheable_direct) {
if (pl == NULL) if (pl == NULL)
pr = pl = cluster_task_param_l(ctx, vc, nblack, spc); pr = pl = cluster_task_param_l(ctx, vc, ndeny, spc);
if (pl == NULL) if (pl == NULL)
return (NULL); return (NULL);
pl->uncacheable_direct = arg->uncacheable_direct; pl->uncacheable_direct = arg->uncacheable_direct;
...@@ -583,7 +583,7 @@ cluster_choose(VRT_CTX, ...@@ -583,7 +583,7 @@ cluster_choose(VRT_CTX,
pr = cluster_task_param_r(ctx, vc); pr = cluster_task_param_r(ctx, vc);
CHECK_OBJ_NOTNULL(pr, VMOD_CLUSTER_CLUSTER_PARAM_MAGIC); CHECK_OBJ_NOTNULL(pr, VMOD_CLUSTER_CLUSTER_PARAM_MAGIC);
char pstk[param_sz(pr, pr->nblack + 1)]; char pstk[param_sz(pr, pr->ndeny + 1)];
if ((ctx->method & cluster_methods) == 0) if ((ctx->method & cluster_methods) == 0)
spc = pstk; spc = pstk;
......
...@@ -127,7 +127,7 @@ Instantiate a cluster director on top of the director passed as the ...@@ -127,7 +127,7 @@ Instantiate a cluster director on top of the director passed as the
`cluster` argument. `cluster` argument.
The optional `deny` argument allows to specify one backend for which The optional `deny` argument allows to specify one backend for which
the cluster director will resolve to a `real` backend (the blacklist) the cluster director will resolve to a `real` backend (the denylist)
as if the :ref:`func_cluster.deny` method had been called. as if the :ref:`func_cluster.deny` method had been called.
The optional `real` argument allows to specify the director which use The optional `real` argument allows to specify the director which use
...@@ -142,7 +142,7 @@ disables special handling of uncacheable backend requests. ...@@ -142,7 +142,7 @@ disables special handling of uncacheable backend requests.
$Method VOID .deny(BACKEND) $Method VOID .deny(BACKEND)
Add a backend to the list of backends for which the cluster director Add a backend to the list of backends for which the cluster director
will resolve to a `real` backend (the blacklist). will resolve to a `real` backend (the denylist).
$Restrict vcl_init vcl_backend_fetch $Restrict vcl_init vcl_backend_fetch
...@@ -151,7 +151,7 @@ See :ref:`meth_ctx` for limitations. ...@@ -151,7 +151,7 @@ See :ref:`meth_ctx` for limitations.
$Method VOID .allow(BACKEND) $Method VOID .allow(BACKEND)
Remove a backend to the list of backends for which the cluster Remove a backend to the list of backends for which the cluster
director will resolve to a `real` backend (the blacklist). director will resolve to a `real` backend (the denylist).
$Restrict vcl_init vcl_backend_fetch $Restrict vcl_init vcl_backend_fetch
...@@ -160,7 +160,7 @@ See :ref:`meth_ctx` for limitations. ...@@ -160,7 +160,7 @@ See :ref:`meth_ctx` for limitations.
$Method BOOL .is_denied(BACKEND) $Method BOOL .is_denied(BACKEND)
Return true if the argument is on list of backends for which the Return true if the argument is on list of backends for which the
cluster director will resolve to a `real` backend (the blacklist). cluster director will resolve to a `real` backend (the denylist).
$Restrict vcl_init vcl_backend_fetch $Restrict vcl_init vcl_backend_fetch
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment